From ad35710b7a257e91928f03633d03f0e69b2d503a Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Mon, 23 Sep 2019 14:18:50 -0700 Subject: [PATCH 1/2] Prepare for 3.3.0 release --- packages/optimizely-sdk/CHANGELOG.MD | 17 +++++++++++++++++ .../optimizely-sdk/lib/index.browser.tests.js | 2 +- packages/optimizely-sdk/lib/index.node.tests.js | 2 +- .../optimizely-sdk/lib/utils/enums/index.js | 2 +- packages/optimizely-sdk/package-lock.json | 2 +- packages/optimizely-sdk/package.json | 2 +- 6 files changed, 22 insertions(+), 5 deletions(-) diff --git a/packages/optimizely-sdk/CHANGELOG.MD b/packages/optimizely-sdk/CHANGELOG.MD index db593e6fb..677c337b9 100644 --- a/packages/optimizely-sdk/CHANGELOG.MD +++ b/packages/optimizely-sdk/CHANGELOG.MD @@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] Changes that have landed but are not yet released. +## [3.3.0] - September 23, 2019 + +### New Features + +- Added support for event batching via the event processor. + - Events generated by methods like `activate`, `track`, and `isFeatureEnabled` will be held in a queue until the configured batch size is reached, or the configured flush interval has elapsed. Then, they will be combined into a request and sent to the event dispatcher. + - To configure event batching, include the `eventBatchSize` and `eventFlushInterval` number properties in the object you pass to `createInstance`. + - Event batching is enabled by default. `eventBatchSize` defaults to `10`. `eventFlushInterval` defaults to `30000` in Node and `1000` in browsers. +- Added `localStorage` mitigation against lost events in the browser + - When event requests are dispatched, they are written to `localStorage`, and when a response is received, they are removed from `localStorage`. + - When the SDK is initialized for the first time in the browser, if any requests remain in `localStorage`, they will be sent, and removed from `localStorage` when a response is received. +- Updated the `close` method to return a `Promise` representing the process of closing the instance. When `close` is called, any events waiting to be sent as part of a batched event request will be immediately batched and sent to the event dispatcher. + - If any such requests were sent to the event dispatcher, `close` returns a `Promise` that fulfills after the event dispatcher calls the response callback for each request. Otherwise, `close` returns an immediately-fulfilled `Promise`. + - The `Promise` returned from `close` is fulfilled with a result object containing `success` (boolean) and `reason` (string, only when success is `false`) properties. In the result object, `success` is `true` if all events in the queue at the time close was called were combined into requests, sent to the event dispatcher, and the event dispatcher called the callbacks for each request. `success` is false if an unexpected error was encountered during the close process. +- Added non-typed `getFeatureVariable` method ([#298](https://github.com/optimizely/javascript-sdk/pull/298)) as a more idiomatic approach to getting values of feature variables. + - Typed `getFeatureVariable` methods will still be available for use. + ## [3.3.0-beta] - August 21th, 2019 ### New Features diff --git a/packages/optimizely-sdk/lib/index.browser.tests.js b/packages/optimizely-sdk/lib/index.browser.tests.js index 8c840d949..88005041c 100644 --- a/packages/optimizely-sdk/lib/index.browser.tests.js +++ b/packages/optimizely-sdk/lib/index.browser.tests.js @@ -148,7 +148,7 @@ describe('javascript-sdk', function() { optlyInstance.onReady().catch(function() {}); assert.instanceOf(optlyInstance, Optimizely); - assert.equal(optlyInstance.clientVersion, '3.3.0-beta'); + assert.equal(optlyInstance.clientVersion, '3.3.0'); }); it('should set the JavaScript client engine and version', function() { diff --git a/packages/optimizely-sdk/lib/index.node.tests.js b/packages/optimizely-sdk/lib/index.node.tests.js index 9eed24e39..cf5f6a8e5 100644 --- a/packages/optimizely-sdk/lib/index.node.tests.js +++ b/packages/optimizely-sdk/lib/index.node.tests.js @@ -92,7 +92,7 @@ describe('optimizelyFactory', function() { optlyInstance.onReady().catch(function() {}); assert.instanceOf(optlyInstance, Optimizely); - assert.equal(optlyInstance.clientVersion, '3.3.0-beta'); + assert.equal(optlyInstance.clientVersion, '3.3.0'); }); describe('event processor configuration', function() { diff --git a/packages/optimizely-sdk/lib/utils/enums/index.js b/packages/optimizely-sdk/lib/utils/enums/index.js index b22b7e84a..ee68e78e9 100644 --- a/packages/optimizely-sdk/lib/utils/enums/index.js +++ b/packages/optimizely-sdk/lib/utils/enums/index.js @@ -159,7 +159,7 @@ exports.CONTROL_ATTRIBUTES = { exports.JAVASCRIPT_CLIENT_ENGINE = 'javascript-sdk'; exports.NODE_CLIENT_ENGINE = 'node-sdk'; exports.REACT_CLIENT_ENGINE = 'react-sdk'; -exports.NODE_CLIENT_VERSION = '3.3.0-beta'; +exports.NODE_CLIENT_VERSION = '3.3.0'; exports.VALID_CLIENT_ENGINES = [ exports.NODE_CLIENT_ENGINE, diff --git a/packages/optimizely-sdk/package-lock.json b/packages/optimizely-sdk/package-lock.json index 29e602842..958d6ff85 100644 --- a/packages/optimizely-sdk/package-lock.json +++ b/packages/optimizely-sdk/package-lock.json @@ -1,6 +1,6 @@ { "name": "@optimizely/optimizely-sdk", - "version": "3.3.0-beta", + "version": "3.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/optimizely-sdk/package.json b/packages/optimizely-sdk/package.json index 1412c53ce..a6ded5221 100644 --- a/packages/optimizely-sdk/package.json +++ b/packages/optimizely-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@optimizely/optimizely-sdk", - "version": "3.3.0-beta", + "version": "3.3.0", "description": "JavaScript SDK for Optimizely X Full Stack", "main": "lib/index.node.js", "browser": "lib/index.browser.js", From 79130fd2a29a4df9e4ec9e53a4f7f4631e7c35a7 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 25 Sep 2019 10:51:04 -0700 Subject: [PATCH 2/2] Update date --- packages/optimizely-sdk/CHANGELOG.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/optimizely-sdk/CHANGELOG.MD b/packages/optimizely-sdk/CHANGELOG.MD index 677c337b9..a40705cd8 100644 --- a/packages/optimizely-sdk/CHANGELOG.MD +++ b/packages/optimizely-sdk/CHANGELOG.MD @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] Changes that have landed but are not yet released. -## [3.3.0] - September 23, 2019 +## [3.3.0] - September 25th, 2019 ### New Features