true, 'strategy' => 'defer', ) ); wp_set_script_translations( self::HANDLE, 'ai-provider-for-chatgpt' ); $css_file = $build_dir . '/style-index.css'; if ( file_exists( $css_file ) ) { wp_enqueue_style( self::HANDLE, $build_url . '/style-index.css', array( 'wp-components' ), $asset['version'] ); } else { wp_enqueue_style( 'wp-components' ); } wp_add_inline_script( self::HANDLE, 'window.aiProviderForChatGpt = ' . wp_json_encode( array( 'restNamespace' => 'ai-provider-for-chatgpt/v1', 'restRoot' => esc_url_raw( rest_url() ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'adminUrl' => esc_url_raw( admin_url() ), ) ) . ';', 'before' ); } /** * Admin notice shown when the JS bundle has not been built yet. * * @since 0.1.0 * * @return void */ public function render_missing_build_notice(): void { echo '
'; echo esc_html__( 'AI Provider for ChatGPT: the admin UI bundle is missing. Run `npm install && npm run build` inside the plugin directory.', 'ai-provider-for-chatgpt' ); echo '