Skip to content

feat: getOptimizelyConfig #19

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

Merged
merged 5 commits into from
Jan 29, 2020
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 @@ -28,7 +28,7 @@
},
"dependencies": {
"@optimizely/js-sdk-logging": "^0.1.0",
"@optimizely/optimizely-sdk": "3.3.2",
"@optimizely/optimizely-sdk": "3.4.1",
"hoist-non-react-statics": "^3.3.0",
"prop-types": "^15.6.2",
"utility-types": "^2.1.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 @@ -40,6 +40,7 @@ describe('ReactSDKClient', () => {
getFeatureVariableDouble: jest.fn(() => null),
getFeatureVariableInteger: jest.fn(() => null),
getFeatureVariableString: jest.fn(() => null),
getOptimizelyConfig: jest.fn(() => null),
onReady: jest.fn(() => Promise.resolve({ success: false })),
close: jest.fn(),
notificationCenter: {
Expand Down
12 changes: 11 additions & 1 deletion src/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2019, Optimizely
* Copyright 2019-2020, Optimizely
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -99,6 +99,8 @@ export interface ReactSDKClient extends optimizely.Client {
overrideAttributes?: optimizely.UserAttributes,
): Array<string>

getOptimizelyConfig(): optimizely.OptimizelyConfig | null;

track(
eventKey: string,
overrideUserId?: string | optimizely.EventTags,
Expand Down Expand Up @@ -578,6 +580,14 @@ class OptimizelyReactSDKClient implements ReactSDKClient {
return this._client.setForcedVariation(experiment, finalUserId, finalVariationKey)
}

/**
* Returns OptimizelyConfig object containing experiments and features data
* @returns {optimizely.OptimizelyConfig | null} optimizely config
*/
public getOptimizelyConfig(): optimizely.OptimizelyConfig | null {
return this._client.getOptimizelyConfig()
}

/**
* Cleanup method for killing an running timers and flushing eventQueue
*/
Expand Down