Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Answers SDK: add cloudChoice support #1896

Merged
merged 2 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion THIRD-PARTY-NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ CDN

The following NPM package may be included in this product:

- @yext/[email protected].1
- @yext/[email protected].4

This package contains the following license and notice below:

Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@mapbox/mapbox-gl-language": "^0.10.1",
"@yext/answers-storage": "^1.1.0",
"@yext/rtf-converter": "^1.7.1",
"@yext/search-core": "^2.5.1",
"@yext/search-core": "^2.5.4",
"bowser": "^2.11.0",
"cross-fetch": "^3.1.5",
"css-vars-ponyfill": "^2.4.3",
Expand Down
9 changes: 8 additions & 1 deletion src/core/core.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @module Core */
import { provideCore } from '@yext/search-core/lib/commonjs';
// Using the ESM build for importing the Environment enum due to an issue importing the commonjs version
import { Environment } from '@yext/search-core';
import { CloudChoice, Environment } from '@yext/search-core';
import { generateUUID } from './utils/uuid';
import SearchDataTransformer from './search/searchdatatransformer';

Expand Down Expand Up @@ -120,6 +120,12 @@ export default class Core {
*/
this._cloudRegion = CLOUD_REGION;

/**
* Determines the cloud choice of the api endpoints used when making search requests.
* @type {string}
*/
this._cloudChoice = config.cloudChoice || CloudChoice.GLOBAL_MULTI;

/** @type {string} */
this._verticalKey = config.verticalKey;

Expand Down Expand Up @@ -154,6 +160,7 @@ export default class Core {
jsLibVersion: LIB_VERSION
},
cloudRegion: this._cloudRegion,
cloudChoice: this._cloudChoice,
environment,
...config
};
Expand Down
Loading