From c54f7cc588a361b7c91c5d6818ef51d191b3a9aa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 13 Sep 2024 21:12:00 +0000 Subject: [PATCH 1/2] v1.17.6 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index fe23cdb8b..0c33931a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/answers-search-ui", - "version": "1.17.5", + "version": "1.17.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/answers-search-ui", - "version": "1.17.5", + "version": "1.17.6", "license": "BSD-3-Clause", "dependencies": { "@mapbox/mapbox-gl-language": "^0.10.1", diff --git a/package.json b/package.json index 73e3eb898..364bf6851 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/answers-search-ui", - "version": "1.17.5", + "version": "1.17.6", "description": "Javascript Search Programming Interface", "main": "dist/answers-umd.js", "repository": { From 05844f441bef38e2ccd82b2ec3db3e656b902485 Mon Sep 17 00:00:00 2001 From: Fondryext <160865254+Fondryext@users.noreply.github.com> Date: Fri, 13 Sep 2024 17:33:38 -0400 Subject: [PATCH 2/2] ksearch: properly use cloudChoice (#1900) A previous change to add cloudChoice support wasn't quite right. This CR corrects the logic, and makes sure to pass it everywhere. J=WAT-4375 TEST=manual Linked a local theme to a local sdk, and saw the cloudChoice param be used correctly --- src/answers-search-bar.js | 3 ++- src/answers-umd.js | 3 ++- src/core/constants.js | 5 +++++ src/core/core.js | 7 ++++--- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/answers-search-bar.js b/src/answers-search-bar.js index 8519a4ebb..ac98fcf96 100644 --- a/src/answers-search-bar.js +++ b/src/answers-search-bar.js @@ -194,7 +194,8 @@ class AnswersSearchBar { onVerticalSearch: parsedConfig.onVerticalSearch, onUniversalSearch: parsedConfig.onUniversalSearch, environment: parsedConfig.environment, - componentManager: this.components + componentManager: this.components, + cloudChoice: parsedConfig.cloudChoice }); if (parsedConfig.onStateChange && typeof parsedConfig.onStateChange === 'function') { diff --git a/src/answers-umd.js b/src/answers-umd.js index c1fc03eb1..0778bbb76 100644 --- a/src/answers-umd.js +++ b/src/answers-umd.js @@ -293,7 +293,8 @@ class Answers { onUniversalSearch: parsedConfig.onUniversalSearch, environment: parsedConfig.environment, componentManager: this.components, - additionalHttpHeaders: parsedConfig.additionalHttpHeaders + additionalHttpHeaders: parsedConfig.additionalHttpHeaders, + cloudChoice: parsedConfig.cloudChoice }); if (parsedConfig.onStateChange && typeof parsedConfig.onStateChange === 'function') { diff --git a/src/core/constants.js b/src/core/constants.js index 8a8702d64..4047ccd28 100644 --- a/src/core/constants.js +++ b/src/core/constants.js @@ -11,6 +11,11 @@ export const SPEECH_RECOGNITION_LOCALES_SUPPORTED_BY_EDGE = '@@SPEECH_RECOGNITIO /** The cloud region being used, injected by the build process */ export const CLOUD_REGION = '@@CLOUD_REGION'; +/** The identifier for all cloud providers */ +export const GLOBAL_MULTI = 'multi'; + +/** The identifier for using GCP */ +export const GLOBAL_GCP = 'gcp'; /** The identifier of the production environment */ export const PRODUCTION = 'production'; diff --git a/src/core/core.js b/src/core/core.js index 05265b001..21cf0b27a 100644 --- a/src/core/core.js +++ b/src/core/core.js @@ -19,7 +19,7 @@ import FilterRegistry from './filters/filterregistry'; import DirectAnswer from './models/directanswer'; import AutoCompleteResponseTransformer from './search/autocompleteresponsetransformer'; -import { PRODUCTION, LIB_VERSION, CLOUD_REGION, SANDBOX } from './constants'; +import { PRODUCTION, LIB_VERSION, CLOUD_REGION, SANDBOX, GLOBAL_MULTI, GLOBAL_GCP } from './constants'; import { SearchParams } from '../ui'; import SearchStates from './storage/searchstates'; import Searcher from './models/searcher'; @@ -124,7 +124,7 @@ export default class Core { * Determines the cloud choice of the api endpoints used when making search requests. * @type {string} */ - this._cloudChoice = config.cloudChoice || CloudChoice.GLOBAL_MULTI; + this._cloudChoice = config.cloudChoice || GLOBAL_MULTI; /** @type {string} */ this._verticalKey = config.verticalKey; @@ -150,6 +150,7 @@ export default class Core { */ init (config) { const environment = this._environment === SANDBOX ? Environment.SANDBOX : Environment.PROD; + const cloudChoice = this._cloudChoice === GLOBAL_GCP ? CloudChoice.GLOBAL_GCP : CloudChoice.GLOBAL_MULTI; const params = { ...(this._token && { token: this._token }), ...(this._apiKey && { apiKey: this._apiKey }), @@ -160,7 +161,7 @@ export default class Core { jsLibVersion: LIB_VERSION }, cloudRegion: this._cloudRegion, - cloudChoice: this._cloudChoice, + cloudChoice, environment, ...config };