Skip to content

Commit 003398c

Browse files
feat: getOptimizelyConfig (#19)
* Added Support for Optimizely Config
1 parent ebeebd7 commit 003398c

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
"dependencies": {
3030
"@optimizely/js-sdk-logging": "^0.1.0",
31-
"@optimizely/optimizely-sdk": "3.3.2",
31+
"@optimizely/optimizely-sdk": "3.4.1",
3232
"hoist-non-react-statics": "^3.3.0",
3333
"prop-types": "^15.6.2",
3434
"utility-types": "^2.1.0"

src/client.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ describe('ReactSDKClient', () => {
4040
getFeatureVariableDouble: jest.fn(() => null),
4141
getFeatureVariableInteger: jest.fn(() => null),
4242
getFeatureVariableString: jest.fn(() => null),
43+
getOptimizelyConfig: jest.fn(() => null),
4344
onReady: jest.fn(() => Promise.resolve({ success: false })),
4445
close: jest.fn(),
4546
notificationCenter: {

src/client.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2019, Optimizely
2+
* Copyright 2019-2020, Optimizely
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -99,6 +99,8 @@ export interface ReactSDKClient extends optimizely.Client {
9999
overrideAttributes?: optimizely.UserAttributes,
100100
): Array<string>
101101

102+
getOptimizelyConfig(): optimizely.OptimizelyConfig | null;
103+
102104
track(
103105
eventKey: string,
104106
overrideUserId?: string | optimizely.EventTags,
@@ -578,6 +580,14 @@ class OptimizelyReactSDKClient implements ReactSDKClient {
578580
return this._client.setForcedVariation(experiment, finalUserId, finalVariationKey)
579581
}
580582

583+
/**
584+
* Returns OptimizelyConfig object containing experiments and features data
585+
* @returns {optimizely.OptimizelyConfig | null} optimizely config
586+
*/
587+
public getOptimizelyConfig(): optimizely.OptimizelyConfig | null {
588+
return this._client.getOptimizelyConfig()
589+
}
590+
581591
/**
582592
* Cleanup method for killing an running timers and flushing eventQueue
583593
*/

0 commit comments

Comments
 (0)