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

[FSSDK-10198] odp not integrated error #262

Merged
merged 5 commits into from
May 22, 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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"access": "public"
},
"dependencies": {
"@optimizely/optimizely-sdk": "^5.3.0",
"@optimizely/optimizely-sdk": "^5.3.2",
"hoist-non-react-statics": "^3.3.0",
"prop-types": "^15.6.2",
"utility-types": "^2.1.0 || ^3.0.0"
Expand Down
1 change: 1 addition & 0 deletions src/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ describe('ReactSDKClient', () => {
getFeatureVariableString: jest.fn(() => null),
getOptimizelyConfig: jest.fn(() => null),
getProjectConfig: jest.fn(() => null),
isOdpIntegrated: jest.fn(() => true),
onReady: jest.fn(() => Promise.resolve({ success: false })),
close: jest.fn(),
getVuid: jest.fn(),
Expand Down
11 changes: 6 additions & 5 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export const DefaultUser: UserInfo = {
attributes: {},
};

export interface ReactSDKClient extends Omit<optimizely.Client, 'createUserContext' | 'getProjectConfig'> {
export interface ReactSDKClient
mikechu-optimizely marked this conversation as resolved.
Show resolved Hide resolved
extends Omit<optimizely.Client, 'createUserContext' | 'getProjectConfig' | 'isOdpIntegrated'> {
user: UserInfo;

onReady(opts?: { timeout?: number }): Promise<any>;
Expand Down Expand Up @@ -364,14 +365,14 @@ class OptimizelyReactSDKClient implements ReactSDKClient {
}

public async fetchQualifiedSegments(options?: optimizely.OptimizelySegmentOption[]): Promise<boolean> {
if (this.odpExplicitlyOff) {
return true;
}

if (!this.userContext) {
return false;
}

if (this.odpExplicitlyOff || !this._client?.isOdpIntegrated()) {
return true;
}

return await this.userContext.fetchQualifiedSegments(options);
}

Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -656,9 +656,9 @@
"@jridgewell/sourcemap-codec" "^1.4.10"

"@optimizely/optimizely-sdk@^5.3.0":
version "5.3.0"
resolved "https://registry.yarnpkg.com/@optimizely/optimizely-sdk/-/optimizely-sdk-5.3.0.tgz#dd1ca9d19287b31675d2f95c24234e074ade9a8b"
integrity sha512-PzfjcApCvcHGir8XWSG3IBaOJXvPADjqpzXypEWTfArrONA3FlmqdnwDAlxF4b557fo/UZI6ZCyj3AWrG8cprg==
version "5.3.2"
resolved "https://registry.yarnpkg.com/@optimizely/optimizely-sdk/-/optimizely-sdk-5.3.2.tgz#4a4918485c9319b2237f6e32d901c3ff7e998051"
integrity sha512-9d3sRusZfkN+CCq7C7DXp0bKam+dx2cDPPdcBQxLfwtTKFulzf6kGwnz4pVTtjwQ89vbJz10iJNMmD9qtSduPw==
dependencies:
decompress-response "^4.2.1"
json-schema "^0.4.0"
Expand Down
Loading