From 1b6ddbee6fb0968e7fc7dbb3a34696f2cc57dd0a Mon Sep 17 00:00:00 2001 From: Kallyan Singha Date: Mon, 25 May 2026 11:32:53 +0530 Subject: [PATCH 1/8] fix: fixed missing indices and search option --- assets/src/admin/search/index.tsx | 108 +++++++++++++++++++----------- assets/src/types/global.d.ts | 4 ++ inc/Modules/Core/Assets.php | 19 +++--- inc/Modules/Search/Admin.php | 5 +- inc/Modules/Settings/Admin.php | 2 +- 5 files changed, 87 insertions(+), 51 deletions(-) diff --git a/assets/src/admin/search/index.tsx b/assets/src/admin/search/index.tsx index 7956d66..4857ebf 100644 --- a/assets/src/admin/search/index.tsx +++ b/assets/src/admin/search/index.tsx @@ -3,7 +3,7 @@ */ import { useState, useEffect, createRoot } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -import { Snackbar } from '@wordpress/components'; +import { Snackbar, Card, CardBody, Button } from '@wordpress/components'; /** * External dependencies @@ -49,6 +49,14 @@ interface FetchAllPostTypesResponse { } const OneSearchSettingsPage = () => { + const gSharedSites = window.OneSearchSettings.sharedSites || []; + const gAlgoliaCreds = window.OneSearchSettings.algoliaCredentials; + const hasAlgoliaCreds = !! ( + gAlgoliaCreds?.app_id && gAlgoliaCreds?.write_key + ); + const hasBrandSites = gSharedSites.length > 0; + const hasPrerequisites = hasBrandSites && hasAlgoliaCreds; + const [ siteType, setSiteType ] = useState< SiteType >( '' ); const [ showModal, setShowModal ] = useState( false ); const [ editingIndex, setEditingIndex ] = useState< number | null >( null ); @@ -288,45 +296,69 @@ const OneSearchSettingsPage = () => { ) } - { siteType === 'governing-site' && ( - - ) } - - { siteType === 'governing-site' && ( - + { siteType === 'governing-site' && ! hasPrerequisites && ( + + +

{ __( 'Setup Required', 'onesearch' ) }

+

+ { __( + 'You need to add at least one Brand Site and configure your Algolia credentials before you can set up indices and search.', + 'onesearch' + ) } +

+ +
+
) } - { showModal && ( - { - setShowModal( false ); - setEditingIndex( null ); - setFormData( { name: '', url: '', api_key: '' } ); - } } - editing={ editingIndex !== null } - sites={ sites } - originalData={ - editingIndex !== null - ? sites[ editingIndex ] - : undefined - } - /> + { siteType === 'governing-site' && hasPrerequisites && ( + <> + + + + + { showModal && ( + { + setShowModal( false ); + setEditingIndex( null ); + setFormData( { + name: '', + url: '', + api_key: '', + } ); + } } + editing={ editingIndex !== null } + sites={ sites } + originalData={ + editingIndex !== null + ? sites[ editingIndex ] + : undefined + } + /> + ) } + ) } ); diff --git a/assets/src/types/global.d.ts b/assets/src/types/global.d.ts index f463ed3..b7101f3 100644 --- a/assets/src/types/global.d.ts +++ b/assets/src/types/global.d.ts @@ -22,6 +22,10 @@ export interface OneSearchSettings { restNamespace: string; currentSiteUrl: string; indexableEntities?: Record< string, string[] >; + algoliaCredentials?: { + app_id: string | null; + write_key: string | null; + }; } export interface OneSearchOnboarding { diff --git a/inc/Modules/Core/Assets.php b/inc/Modules/Core/Assets.php index 84ca819..d2d8241 100644 --- a/inc/Modules/Core/Assets.php +++ b/inc/Modules/Core/Assets.php @@ -66,15 +66,16 @@ final class Assets implements Registrable { public static function get_localized_data(): array { if ( empty( self::$localized_data ) ) { self::$localized_data = [ - 'currentSiteUrl' => esc_url( home_url( '/' ) ), - 'indexableEntities' => Search_Settings::get_indexable_entities(), - 'nonce' => wp_create_nonce( 'wp_rest' ), - 'api_key' => Settings::get_api_key(), - 'restNamespace' => Abstract_REST_Controller::NAMESPACE, - 'restUrl' => esc_url( home_url( '/wp-json/' ) ), - 'setupUrl' => admin_url( 'admin.php?page=onesearch-settings' ), - 'sharedSites' => array_values( Settings::get_shared_sites() ), - 'siteType' => Settings::get_site_type(), + 'algoliaCredentials' => Search_Settings::get_algolia_credentials(), + 'currentSiteUrl' => esc_url( home_url( '/' ) ), + 'indexableEntities' => Search_Settings::get_indexable_entities(), + 'nonce' => wp_create_nonce( 'wp_rest' ), + 'api_key' => Settings::get_api_key(), + 'restNamespace' => Abstract_REST_Controller::NAMESPACE, + 'restUrl' => esc_url( home_url( '/wp-json/' ) ), + 'setupUrl' => admin_url( 'admin.php?page=onesearch-settings' ), + 'sharedSites' => array_values( Settings::get_shared_sites() ), + 'siteType' => Settings::get_site_type(), ]; } diff --git a/inc/Modules/Search/Admin.php b/inc/Modules/Search/Admin.php index 06ac2de..7422915 100644 --- a/inc/Modules/Search/Admin.php +++ b/inc/Modules/Search/Admin.php @@ -11,7 +11,6 @@ use OneSearch\Contracts\Interfaces\Registrable; use OneSearch\Modules\Core\Assets; -use OneSearch\Modules\Search\Settings as Search_Settings; use OneSearch\Modules\Settings\Settings; /** @@ -34,7 +33,7 @@ final class Admin implements Registrable { * {@inheritDoc} */ public function register_hooks(): void { - if ( ! Settings::is_governing_site() || empty( Search_Settings::get_algolia_credentials() ) ) { + if ( ! Settings::is_governing_site() ) { return; } add_action( 'admin_menu', [ $this, 'add_submenu' ] ); @@ -45,7 +44,7 @@ public function register_hooks(): void { * Register the settings page. */ public function add_submenu(): void { - // Register the "Indices and Search" submenu only for governing sites with Algolia credentials. + // Register the "Indices and Search" submenu for governing sites. add_submenu_page( self::MENU_SLUG, __( 'Indices and Search', 'onesearch' ), diff --git a/inc/Modules/Settings/Admin.php b/inc/Modules/Settings/Admin.php index 4e852ea..b0ed4ac 100644 --- a/inc/Modules/Settings/Admin.php +++ b/inc/Modules/Settings/Admin.php @@ -85,7 +85,7 @@ public function add_submenu(): void { * Remove the default submenu added by WordPress. */ public function remove_default_submenu(): void { - if ( Settings::is_governing_site() && ! empty( Settings::get_shared_sites() ) ) { + if ( Settings::is_governing_site() ) { return; } remove_submenu_page( self::MENU_SLUG, self::MENU_SLUG ); From e4b7a40a2cc3bbaf235387354928d991604a187b Mon Sep 17 00:00:00 2001 From: Kallyan Singha Date: Mon, 25 May 2026 16:13:02 +0530 Subject: [PATCH 2/8] fix: add Algolia credentials validation and improve UI for setup requirements --- assets/src/admin/search/index.tsx | 49 ++++++++++++------- .../src/components/SiteIndexableEntities.tsx | 14 ++++++ assets/src/components/SiteSearchSettings.tsx | 32 +++++++++++- inc/Modules/Rest/Search_Controller.php | 11 +++++ tests/js/setup.ts | 4 ++ 5 files changed, 91 insertions(+), 19 deletions(-) diff --git a/assets/src/admin/search/index.tsx b/assets/src/admin/search/index.tsx index 4857ebf..edbbdb6 100644 --- a/assets/src/admin/search/index.tsx +++ b/assets/src/admin/search/index.tsx @@ -297,23 +297,38 @@ const OneSearchSettingsPage = () => { { siteType === 'governing-site' && ! hasPrerequisites && ( - - -

{ __( 'Setup Required', 'onesearch' ) }

-

- { __( - 'You need to add at least one Brand Site and configure your Algolia credentials before you can set up indices and search.', - 'onesearch' - ) } -

- -
-
+
+ + +

{ __( 'Setup Required', 'onesearch' ) }

+

+ { __( + 'You need to add at least one Brand Site and configure your Algolia credentials before you can set up indices and search.', + 'onesearch' + ) } +

+ +
+
+
) } { siteType === 'governing-site' && hasPrerequisites && ( diff --git a/assets/src/components/SiteIndexableEntities.tsx b/assets/src/components/SiteIndexableEntities.tsx index 5d2083a..a9768ef 100644 --- a/assets/src/components/SiteIndexableEntities.tsx +++ b/assets/src/components/SiteIndexableEntities.tsx @@ -210,6 +210,20 @@ const SiteIndexableEntities = ( { }; const handleReIndex = async (): Promise< boolean > => { + const creds = window.OneSearchSettings?.algoliaCredentials; + if ( ! creds?.app_id || ! creds?.write_key ) { + setNotice( { + message: __( + 'Algolia is not configured. Please add your Algolia credentials in Settings first.', + 'onesearch' + ), + type: 'error', + } ); + setReindexing( false ); + setShowReindexingModal( false ); + return false; + } + try { setReindexing( true ); // @todo use @wordpress/api-fetch everywhere internal. diff --git a/assets/src/components/SiteSearchSettings.tsx b/assets/src/components/SiteSearchSettings.tsx index 4b83a37..c18cb1b 100644 --- a/assets/src/components/SiteSearchSettings.tsx +++ b/assets/src/components/SiteSearchSettings.tsx @@ -76,6 +76,10 @@ const SiteSearchSettings = ( { // Get all sites from sharedSites and governing site const sharedSites = window.OneSearchSettings?.sharedSites || []; const currentSiteUrl = window.OneSearchSettings?.currentSiteUrl || ''; + const algoliaCreds = window.OneSearchSettings?.algoliaCredentials; + const hasAlgoliaCredentials = !! ( + algoliaCreds?.app_id && algoliaCreds?.write_key + ); const [ initialSettings, setInitialSettings ] = useState< Record< string, SiteSearchSetting > >( {} ); @@ -118,7 +122,8 @@ const SiteSearchSettings = ( { useEffect( () => { if ( ! indexableEntities || - Object.keys( searchSettings ).length === 0 + Object.keys( searchSettings ).length === 0 || + ! hasAlgoliaCredentials ) { return; } @@ -348,6 +353,9 @@ const SiteSearchSettings = ( { // Save the settings. const handleSave = async () => { + if ( ! hasAlgoliaCredentials ) { + return; + } setSaving( true ); await apiFetch< { onesearch_sites_search_settings: Record< @@ -422,6 +430,7 @@ const SiteSearchSettings = ( { variant="secondary" onClick={ () => handleBulkToggle( true ) } disabled={ + ! hasAlgoliaCredentials || saving || allSites.length === 0 || isIndexableEntitiesSaving || @@ -441,6 +450,7 @@ const SiteSearchSettings = ( { variant="secondary" onClick={ () => handleBulkToggle( false ) } disabled={ + ! hasAlgoliaCredentials || saving || allSites.length === 0 || isIndexableEntitiesSaving || @@ -457,7 +467,10 @@ const SiteSearchSettings = ( { variant="primary" onClick={ handleSave } disabled={ - saving || ! isDirty || isIndexableEntitiesSaving + ! hasAlgoliaCredentials || + saving || + ! isDirty || + isIndexableEntitiesSaving } isBusy={ saving } className="onesearch-btn-save" @@ -470,6 +483,19 @@ const SiteSearchSettings = ( { { /* Notice for warnings */ } + { ! hasAlgoliaCredentials && ( + + { __( + 'Algolia is not configured. Add your credentials in Settings to enable search configuration.', + 'onesearch' + ) } + + ) } + { localNotice && ( 400 ] + ); + } + } + $errors = []; // If Governing, trigger re-index on children as well. diff --git a/tests/js/setup.ts b/tests/js/setup.ts index ff0f0df..347d63f 100644 --- a/tests/js/setup.ts +++ b/tests/js/setup.ts @@ -22,6 +22,10 @@ Object.defineProperty( window, 'OneSearchSettings', { currentSiteUrl: 'https://governing.example.com/', siteType: 'governing-site', setupUrl: '/wp-admin/admin.php?page=onesearch-settings', + algoliaCredentials: { + app_id: 'test-app-id', + write_key: 'test-write-key', + }, }, writable: true, } ); From fd43ad23ece5d7dfe0cdde72eaec902216dd6151 Mon Sep 17 00:00:00 2001 From: Kallyan Singha Date: Mon, 25 May 2026 16:29:42 +0530 Subject: [PATCH 3/8] chore: remove Algolia credentials check from button disable conditions --- assets/src/components/SiteSearchSettings.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/assets/src/components/SiteSearchSettings.tsx b/assets/src/components/SiteSearchSettings.tsx index c18cb1b..2bcabd5 100644 --- a/assets/src/components/SiteSearchSettings.tsx +++ b/assets/src/components/SiteSearchSettings.tsx @@ -430,7 +430,6 @@ const SiteSearchSettings = ( { variant="secondary" onClick={ () => handleBulkToggle( true ) } disabled={ - ! hasAlgoliaCredentials || saving || allSites.length === 0 || isIndexableEntitiesSaving || @@ -450,7 +449,6 @@ const SiteSearchSettings = ( { variant="secondary" onClick={ () => handleBulkToggle( false ) } disabled={ - ! hasAlgoliaCredentials || saving || allSites.length === 0 || isIndexableEntitiesSaving || @@ -467,10 +465,7 @@ const SiteSearchSettings = ( { variant="primary" onClick={ handleSave } disabled={ - ! hasAlgoliaCredentials || - saving || - ! isDirty || - isIndexableEntitiesSaving + saving || ! isDirty || isIndexableEntitiesSaving } isBusy={ saving } className="onesearch-btn-save" @@ -573,7 +568,6 @@ const SiteSearchSettings = ( { siteSettings.algolia_enabled } disabled={ - ! hasAlgoliaCredentials || ! hasEntities || saving || isIndexableEntitiesSaving @@ -691,7 +685,6 @@ const SiteSearchSettings = ( { isSelf } disabled={ - ! hasAlgoliaCredentials || isSelf || saving || isIndexableEntitiesSaving From 98994ebc95d7a534f9a696e0ef1e30ae8817c234 Mon Sep 17 00:00:00 2001 From: Kallyan Singha Date: Tue, 26 May 2026 16:14:49 +0530 Subject: [PATCH 4/8] fix: enhance setup overlay for governing site with prerequisites check --- assets/src/admin/search/index.tsx | 113 ++++++++++++++++-------------- assets/src/css/admin.scss | 35 ++++++++- 2 files changed, 95 insertions(+), 53 deletions(-) diff --git a/assets/src/admin/search/index.tsx b/assets/src/admin/search/index.tsx index edbbdb6..4003628 100644 --- a/assets/src/admin/search/index.tsx +++ b/assets/src/admin/search/index.tsx @@ -296,59 +296,34 @@ const OneSearchSettingsPage = () => { ) } - { siteType === 'governing-site' && ! hasPrerequisites && ( -
- +
- -

{ __( 'Setup Required', 'onesearch' ) }

-

- { __( - 'You need to add at least one Brand Site and configure your Algolia credentials before you can set up indices and search.', - 'onesearch' - ) } -

- -
- -
- ) } + - { siteType === 'governing-site' && hasPrerequisites && ( - <> - - - + +
{ showModal && ( { } /> ) } + + { ! hasPrerequisites && ( + <> +
+
+ + +

+ { __( + 'Setup Required', + 'onesearch' + ) } +

+

+ { __( + 'You need to add at least one Brand Site and configure your Algolia credentials before you can set up indices and search.', + 'onesearch' + ) } +

+ +
+
+
+ + ) } ) } diff --git a/assets/src/css/admin.scss b/assets/src/css/admin.scss index b78cb63..94b7602 100644 --- a/assets/src/css/admin.scss +++ b/assets/src/css/admin.scss @@ -51,7 +51,6 @@ background-color: #e11d1d; color: #fff; } - } body { @@ -363,7 +362,13 @@ body { margin: 0 0 2px 0; font-size: 13px; color: #666; - font-family: "SF Mono", Consolas, "Liberation Mono", Menlo, Courier, monospace; + font-family: + "SF Mono", + Consolas, + "Liberation Mono", + Menlo, + Courier, + monospace; } .onesearch-entity-site-domain { @@ -404,6 +409,32 @@ body { margin-right: 4px; } +.onesearch-setup-overlay-blur { + filter: blur(6px); + pointer-events: none; + user-select: none; +} + +.onesearch-setup-overlay-backdrop { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.3); + z-index: 9998; +} + +.onesearch-setup-overlay-dialog { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + z-index: 9999; + max-width: 480px; + width: 100%; +} + .onesearch-governing-site-card { display: flex; justify-content: flex-end; From 3523ec63afc987ac5f966e0c34dfa157f5d9d066 Mon Sep 17 00:00:00 2001 From: Kallyan Singha Date: Tue, 26 May 2026 16:28:13 +0530 Subject: [PATCH 5/8] fix: remove Algolia credentials checks from SiteIndexableEntities and SiteSearchSettings components --- .../src/components/SiteIndexableEntities.tsx | 14 ----------- assets/src/components/SiteSearchSettings.tsx | 24 +------------------ 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/assets/src/components/SiteIndexableEntities.tsx b/assets/src/components/SiteIndexableEntities.tsx index a9768ef..5d2083a 100644 --- a/assets/src/components/SiteIndexableEntities.tsx +++ b/assets/src/components/SiteIndexableEntities.tsx @@ -210,20 +210,6 @@ const SiteIndexableEntities = ( { }; const handleReIndex = async (): Promise< boolean > => { - const creds = window.OneSearchSettings?.algoliaCredentials; - if ( ! creds?.app_id || ! creds?.write_key ) { - setNotice( { - message: __( - 'Algolia is not configured. Please add your Algolia credentials in Settings first.', - 'onesearch' - ), - type: 'error', - } ); - setReindexing( false ); - setShowReindexingModal( false ); - return false; - } - try { setReindexing( true ); // @todo use @wordpress/api-fetch everywhere internal. diff --git a/assets/src/components/SiteSearchSettings.tsx b/assets/src/components/SiteSearchSettings.tsx index 2bcabd5..381f05e 100644 --- a/assets/src/components/SiteSearchSettings.tsx +++ b/assets/src/components/SiteSearchSettings.tsx @@ -76,10 +76,6 @@ const SiteSearchSettings = ( { // Get all sites from sharedSites and governing site const sharedSites = window.OneSearchSettings?.sharedSites || []; const currentSiteUrl = window.OneSearchSettings?.currentSiteUrl || ''; - const algoliaCreds = window.OneSearchSettings?.algoliaCredentials; - const hasAlgoliaCredentials = !! ( - algoliaCreds?.app_id && algoliaCreds?.write_key - ); const [ initialSettings, setInitialSettings ] = useState< Record< string, SiteSearchSetting > >( {} ); @@ -122,8 +118,7 @@ const SiteSearchSettings = ( { useEffect( () => { if ( ! indexableEntities || - Object.keys( searchSettings ).length === 0 || - ! hasAlgoliaCredentials + Object.keys( searchSettings ).length === 0 ) { return; } @@ -353,9 +348,6 @@ const SiteSearchSettings = ( { // Save the settings. const handleSave = async () => { - if ( ! hasAlgoliaCredentials ) { - return; - } setSaving( true ); await apiFetch< { onesearch_sites_search_settings: Record< @@ -477,20 +469,6 @@ const SiteSearchSettings = ( {
- { /* Notice for warnings */ } - { ! hasAlgoliaCredentials && ( - - { __( - 'Algolia is not configured. Add your credentials in Settings to enable search configuration.', - 'onesearch' - ) } - - ) } - { localNotice && ( Date: Tue, 26 May 2026 20:34:50 +0530 Subject: [PATCH 6/8] chore: removed unused code --- assets/src/admin/search/index.tsx | 22 ++++++++------------ assets/src/components/SiteSearchSettings.tsx | 10 +++++---- assets/src/types/global.d.ts | 4 ---- inc/Modules/Core/Assets.php | 19 ++++++++--------- tests/js/setup.ts | 4 ---- 5 files changed, 24 insertions(+), 35 deletions(-) diff --git a/assets/src/admin/search/index.tsx b/assets/src/admin/search/index.tsx index 4003628..19ca3ab 100644 --- a/assets/src/admin/search/index.tsx +++ b/assets/src/admin/search/index.tsx @@ -1,13 +1,18 @@ /** * WordPress dependencies */ -import { useState, useEffect, createRoot } from '@wordpress/element'; +import { Button, Card, CardBody, Snackbar } from '@wordpress/components'; +import { createRoot, useEffect, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; -import { Snackbar, Card, CardBody, Button } from '@wordpress/components'; /** * External dependencies */ +import type { + BrandSite, + defaultBrandSite, + NoticeType, +} from '@/admin/settings/page'; import SiteIndexableEntities from '@/components/SiteIndexableEntities'; import SiteModal from '@/components/SiteModal'; import SiteSearchSettings, { @@ -15,15 +20,10 @@ import SiteSearchSettings, { } from '@/components/SiteSearchSettings'; import { API_NAMESPACE, - NONCE, CURRENT_SITE_URL, + NONCE, withTrailingSlash, } from '@/js/utils'; -import type { - BrandSite, - defaultBrandSite, - NoticeType, -} from '@/admin/settings/page'; import type { SiteType } from '@/types/global'; type BrandSiteFormData = typeof defaultBrandSite; @@ -50,12 +50,8 @@ interface FetchAllPostTypesResponse { const OneSearchSettingsPage = () => { const gSharedSites = window.OneSearchSettings.sharedSites || []; - const gAlgoliaCreds = window.OneSearchSettings.algoliaCredentials; - const hasAlgoliaCreds = !! ( - gAlgoliaCreds?.app_id && gAlgoliaCreds?.write_key - ); const hasBrandSites = gSharedSites.length > 0; - const hasPrerequisites = hasBrandSites && hasAlgoliaCreds; + const hasPrerequisites = hasBrandSites; const [ siteType, setSiteType ] = useState< SiteType >( '' ); const [ showModal, setShowModal ] = useState( false ); diff --git a/assets/src/components/SiteSearchSettings.tsx b/assets/src/components/SiteSearchSettings.tsx index 381f05e..d66ef69 100644 --- a/assets/src/components/SiteSearchSettings.tsx +++ b/assets/src/components/SiteSearchSettings.tsx @@ -7,22 +7,22 @@ import { Card, CardBody, CardHeader, - ToggleControl, - Spinner, Notice, + Spinner, + ToggleControl, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; /** * External dependencies */ -import { useState, useEffect, useCallback, useRef } from 'react'; +import { useCallback, useEffect, useRef, useState } from 'react'; /** * Internal dependencies */ -import { NONCE, withTrailingSlash } from '../js/utils'; import type { NoticeType } from '@/admin/settings/page'; +import { NONCE, withTrailingSlash } from '../js/utils'; /** * Create NONCE middleware for apiFetch @@ -468,6 +468,8 @@ const SiteSearchSettings = ( { + + { /* Notice for warnings */ } { localNotice && ( ; - algoliaCredentials?: { - app_id: string | null; - write_key: string | null; - }; } export interface OneSearchOnboarding { diff --git a/inc/Modules/Core/Assets.php b/inc/Modules/Core/Assets.php index d2d8241..84ca819 100644 --- a/inc/Modules/Core/Assets.php +++ b/inc/Modules/Core/Assets.php @@ -66,16 +66,15 @@ final class Assets implements Registrable { public static function get_localized_data(): array { if ( empty( self::$localized_data ) ) { self::$localized_data = [ - 'algoliaCredentials' => Search_Settings::get_algolia_credentials(), - 'currentSiteUrl' => esc_url( home_url( '/' ) ), - 'indexableEntities' => Search_Settings::get_indexable_entities(), - 'nonce' => wp_create_nonce( 'wp_rest' ), - 'api_key' => Settings::get_api_key(), - 'restNamespace' => Abstract_REST_Controller::NAMESPACE, - 'restUrl' => esc_url( home_url( '/wp-json/' ) ), - 'setupUrl' => admin_url( 'admin.php?page=onesearch-settings' ), - 'sharedSites' => array_values( Settings::get_shared_sites() ), - 'siteType' => Settings::get_site_type(), + 'currentSiteUrl' => esc_url( home_url( '/' ) ), + 'indexableEntities' => Search_Settings::get_indexable_entities(), + 'nonce' => wp_create_nonce( 'wp_rest' ), + 'api_key' => Settings::get_api_key(), + 'restNamespace' => Abstract_REST_Controller::NAMESPACE, + 'restUrl' => esc_url( home_url( '/wp-json/' ) ), + 'setupUrl' => admin_url( 'admin.php?page=onesearch-settings' ), + 'sharedSites' => array_values( Settings::get_shared_sites() ), + 'siteType' => Settings::get_site_type(), ]; } diff --git a/tests/js/setup.ts b/tests/js/setup.ts index 347d63f..ff0f0df 100644 --- a/tests/js/setup.ts +++ b/tests/js/setup.ts @@ -22,10 +22,6 @@ Object.defineProperty( window, 'OneSearchSettings', { currentSiteUrl: 'https://governing.example.com/', siteType: 'governing-site', setupUrl: '/wp-admin/admin.php?page=onesearch-settings', - algoliaCredentials: { - app_id: 'test-app-id', - write_key: 'test-write-key', - }, }, writable: true, } ); From c2f3b02626b6a0f6617353baed97624a0dee0f65 Mon Sep 17 00:00:00 2001 From: Kallyan Singha Date: Tue, 26 May 2026 21:58:32 +0530 Subject: [PATCH 7/8] fix: resolved failed test and format SCSS font-family --- inc/Modules/Rest/Search_Controller.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/inc/Modules/Rest/Search_Controller.php b/inc/Modules/Rest/Search_Controller.php index 7618a8c..d346d79 100644 --- a/inc/Modules/Rest/Search_Controller.php +++ b/inc/Modules/Rest/Search_Controller.php @@ -210,17 +210,6 @@ public function set_indexable_entities( \WP_REST_Request $request ) { * If the site is a governing site, trigger the reindex on children as well. */ public function reindex(): \WP_REST_Response|\WP_Error { - if ( Settings::is_governing_site() ) { - $creds = Search_Settings::get_algolia_credentials(); - if ( empty( $creds['app_id'] ) || empty( $creds['write_key'] ) ) { - return new \WP_Error( - 'onesearch_algolia_not_configured', - __( 'Algolia is not configured. Please add your Algolia credentials in Settings first.', 'onesearch' ), - [ 'status' => 400 ] - ); - } - } - $errors = []; // If Governing, trigger re-index on children as well. From 4e5c7bd9d296095e7c763c4ad3d8293f26e3781f Mon Sep 17 00:00:00 2001 From: Kallyan Singha Date: Tue, 26 May 2026 22:18:12 +0530 Subject: [PATCH 8/8] fix: resolved css lint errors --- assets/src/css/admin.scss | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/src/css/admin.scss b/assets/src/css/admin.scss index 94b7602..597aa99 100644 --- a/assets/src/css/admin.scss +++ b/assets/src/css/admin.scss @@ -364,10 +364,10 @@ body { color: #666; font-family: "SF Mono", - Consolas, - "Liberation Mono", - Menlo, - Courier, + Consolas, + "Liberation Mono", + Menlo, + Courier, monospace; }