Skip to content

Commit 9846277

Browse files
Merge branch 'master' into alibaker/add-notification-center-unit-tests
2 parents b1eecf5 + bc84698 commit 9846277

File tree

9 files changed

+322
-197
lines changed

9 files changed

+322
-197
lines changed

packages/optimizely-sdk/CHANGELOG.MD

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,22 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
88
### Bug fixes
99
- Fixed default event dispatcher not used in React Native entry point ([#383](https://github.com/optimizely/javascript-sdk/pull/383))
1010

11+
## [3.4.1] - January 28th, 2020
12+
13+
### Bug fixes
14+
- Added `getOptimizelyConfig` and related types to TypeScript type definitions([#390](https://github.com/optimizely/javascript-sdk/pull/390)).
15+
1116
## [3.4.0] - January 21th, 2020
1217

1318
### Bug fixes
14-
- Fixed incorrect payload for decision notification triggered by calling getVariation on a feature test in a mutex group([#375](https://github.com/optimizely/javascript-sdk/pull/375))
19+
- Fixed incorrect payload for decision notification triggered by calling getVariation on a feature test in a mutex group([#375](https://github.com/optimizely/javascript-sdk/pull/375)).
1520

1621
### New Features
17-
- Added a new API to get a project configuration static data.
18-
- Call `getOptimizelyConfig()` to get a snapshot copy of project configuration static data.
22+
- Added a new API to get project configuration static data.
23+
- Call `getOptimizelyConfig()` to get a snapshot of project configuration static data.
1924
- It returns an `OptimizelyConfig` instance which includes a datafile revision number, all experiments, and feature flags mapped by their key values.
20-
- Added caching for `getOptimizelyConfig` - `OptimizelyConfig` object will be cached and reused for the lifetime of the datafile
21-
- For details, refer to a documention page: https://docs.developers.optimizely.com/full-stack/docs/optimizelyconfig-javascript-node
25+
- Added caching for `getOptimizelyConfig` - `OptimizelyConfig` object will be cached and reused for the lifetime of the datafile.
26+
- For details, refer to our documentation page: [https://docs.developers.optimizely.com/full-stack/docs/optimizelyconfig-javascript-node](https://docs.developers.optimizely.com/full-stack/docs/optimizelyconfig-javascript-node).
2227

2328
### Removed Features
2429
- Removed support for `'launched'` experiment status

packages/optimizely-sdk/lib/core/audience_evaluator/index.tests.js

Lines changed: 243 additions & 184 deletions
Large diffs are not rendered by default.

packages/optimizely-sdk/lib/index.browser.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe('javascript-sdk', function() {
148148
optlyInstance.onReady().catch(function() {});
149149

150150
assert.instanceOf(optlyInstance, Optimizely);
151-
assert.equal(optlyInstance.clientVersion, '3.4.0');
151+
assert.equal(optlyInstance.clientVersion, '3.4.1');
152152
});
153153

154154
it('should set the JavaScript client engine and version', function() {

packages/optimizely-sdk/lib/index.d.ts

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2018-2019, Optimizely
2+
* Copyright 2018-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.
@@ -111,10 +111,11 @@ declare module "@optimizely/optimizely-sdk" {
111111
userId: string,
112112
attributes?: UserAttributes
113113
): string | null;
114+
getOptimizelyConfig(): OptimizelyConfig | null;
114115
onReady(options?: {
115116
timeout?: number;
116117
}): Promise<{ success: boolean; reason?: string }>;
117-
close(): void;
118+
close(): void;
118119
}
119120

120121
// An event to be submitted to Optimizely, enabling tracking the reach and impact of
@@ -214,6 +215,66 @@ declare module "@optimizely/optimizely-sdk" {
214215
};
215216
};
216217
}
218+
219+
/**
220+
* Optimizely Config Entities
221+
*/
222+
export interface OptimizelyVariable {
223+
id: string;
224+
key: string;
225+
type: string;
226+
value: string;
227+
}
228+
229+
export interface OptimizelyVariation {
230+
id: string;
231+
key: string;
232+
featureEnabled?: boolean;
233+
variablesMap: {
234+
[variableKey: string]: {
235+
variable: OptimizelyVariable;
236+
};
237+
};
238+
}
239+
240+
export interface OptimizelyExperiment {
241+
id: string;
242+
key: string;
243+
variationsMap: {
244+
[variationKey: string]: {
245+
variation: OptimizelyVariation;
246+
};
247+
};
248+
}
249+
250+
export interface OptimizelyFeature {
251+
id: string;
252+
key: string;
253+
experimentsMap: {
254+
[experimentKey: string]: {
255+
experiment: OptimizelyExperiment;
256+
};
257+
};
258+
variablesMap: {
259+
[variableKey: string]: {
260+
variable: OptimizelyVariable;
261+
};
262+
};
263+
}
264+
265+
export interface OptimizelyConfig {
266+
experimentsMap: {
267+
[experimentKey: string]: {
268+
experiment: OptimizelyExperiment;
269+
};
270+
};
271+
featuresMap: {
272+
[featureKey: string]: {
273+
feature: OptimizelyFeature;
274+
};
275+
};
276+
revision: string;
277+
}
217278
}
218279

219280
declare module "@optimizely/optimizely-sdk/lib/utils/enums" {

packages/optimizely-sdk/lib/index.node.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe('optimizelyFactory', function() {
9292
optlyInstance.onReady().catch(function() {});
9393

9494
assert.instanceOf(optlyInstance, Optimizely);
95-
assert.equal(optlyInstance.clientVersion, '3.4.0');
95+
assert.equal(optlyInstance.clientVersion, '3.4.1');
9696
});
9797

9898
describe('event processor configuration', function() {

packages/optimizely-sdk/lib/index.react_native.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe('javascript-sdk/react-native', function() {
9292
optlyInstance.onReady().catch(function() {});
9393

9494
assert.instanceOf(optlyInstance, Optimizely);
95-
assert.equal(optlyInstance.clientVersion, '3.4.0');
95+
assert.equal(optlyInstance.clientVersion, '3.4.1');
9696
});
9797

9898
it('should set the JavaScript client engine and version', function() {

packages/optimizely-sdk/lib/utils/enums/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ exports.CONTROL_ATTRIBUTES = {
159159
exports.JAVASCRIPT_CLIENT_ENGINE = 'javascript-sdk';
160160
exports.NODE_CLIENT_ENGINE = 'node-sdk';
161161
exports.REACT_CLIENT_ENGINE = 'react-sdk';
162-
exports.NODE_CLIENT_VERSION = '3.4.0';
162+
exports.NODE_CLIENT_VERSION = '3.4.1';
163163

164164
exports.VALID_CLIENT_ENGINES = [
165165
exports.NODE_CLIENT_ENGINE,

packages/optimizely-sdk/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/optimizely-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@optimizely/optimizely-sdk",
3-
"version": "3.4.0",
3+
"version": "3.4.1",
44
"description": "JavaScript SDK for Optimizely X Full Stack",
55
"main": "lib/index.node.js",
66
"browser": "lib/index.browser.js",

0 commit comments

Comments
 (0)