Releases: optimizely/javascript-sdk
Releases · optimizely/javascript-sdk
Release 3.4.0
[3.4.0] - January 21th, 2020
Bug fixes
- Fixed incorrect payload for decision notification triggered by calling getVariation on a feature test in a mutex group(#375)
New Features
- Added a new API to get project configuration static data.
- Call
getOptimizelyConfig()to get a snapshot of project configuration static data. - It returns an
OptimizelyConfiginstance which includes a datafile revision number, all experiments, and feature flags mapped by their key values. - Added caching for
getOptimizelyConfig-OptimizelyConfigobject will be cached and reused for the lifetime of the datafile. - For details, refer to our documentation page: https://docs.developers.optimizely.com/full-stack/docs/optimizelyconfig-javascript-node.
- Call
Removed Features
- Removed support for
'launched'experiment status.- Previously, experiments with status
'running'or'launched'would return non-nullvariations fromactivateandgetVariation, and generate impression events fromactivate. - Now, only
'running'experiments will return non-nullvariations and generate impressions.
- Previously, experiments with status
Release 3.4.0-beta
[3.4.0-beta] - December 18th, 2019
Bug fixes
- Fixed incorrect payload for decision notification triggered by calling getVariation on a feature test in a mutex group(#375)
New Features
- Added a new API to get a project configuration static data.
- Call
getOptimizelyConfig()to get a snapshot copy of project configuration static data. - It returns an
OptimizelyConfiginstance which includes a datafile revision number, all experiments, and feature flags mapped by their key values. - For details, refer to a documention page: https://docs.developers.optimizely.com/full-stack/docs/optimizelyconfig-javascript-node
- Call
Release 3.3.2
[3.3.2] - November 14th, 2019
Bug fixes
- Fixed error message that was being logged when a user was bucketed into empty space in an experiment or a mutual exclusion group. This is not an error. With the fix, the message indicates that the user was not included in any experiment (#366).
Release 3.3.1
[3.3.1] - October 25th, 2019
Bug fixes
- Fixed full screen error dialog appearing in local development for React Native apps when using the default logger. We now provide a default logger for React Native that does not call
console.error.
Release 3.3.0
[3.3.0] - September 25th, 2019
New Features
- Added support for event batching via the event processor.
- Events generated by methods like
activate,track, andisFeatureEnabledwill 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
eventBatchSizeandeventFlushIntervalnumber properties in the object you pass tocreateInstance. - Event batching is enabled by default.
eventBatchSizedefaults to10.eventFlushIntervaldefaults to30000in Node and1000in browsers.
- Events generated by methods like
- Added
localStoragemitigation 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 fromlocalStorage. - When the SDK is initialized for the first time in the browser, if any requests remain in
localStorage, they will be sent, and removed fromlocalStoragewhen a response is received.
- When event requests are dispatched, they are written to
- Updated the
closemethod to return aPromiserepresenting the process of closing the instance. Whencloseis 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,
closereturns aPromisethat fulfills after the event dispatcher calls the response callback for each request. Otherwise,closereturns an immediately-fulfilledPromise. - The
Promisereturned fromcloseis fulfilled with a result object containingsuccess(boolean) andreason(string, only when success isfalse) properties. In the result object,successistrueif 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.successis false if an unexpected error was encountered during the close process.
- If any such requests were sent to the event dispatcher,
- Added non-typed
getFeatureVariablemethod (#298) as a more idiomatic approach to getting values of feature variables.- Typed
getFeatureVariablemethods will still be available for use.
- Typed
Release 3.3.0-beta
[3.3.0-beta] - August 21st, 2019
New Features
- Added support for event batching via the event processor.
- Events generated by methods like
activate,track, andisFeatureEnabledwill 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
eventBatchSizeandeventFlushIntervalnumber properties in the object you pass tocreateInstance. - Event batching is enabled by default.
eventBatchSizedefaults to10.eventFlushIntervaldefaults to30000in Node and1000in browsers.
- Events generated by methods like
- Added
localStoragemitigation 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 fromlocalStorage. - When the SDK is initialized for the first time in the browser, if any requests remain in
localStorage, they will be sent, and removed fromlocalStoragewhen a response is received.
- When event requests are dispatched, they are written to
- Updated the
closemethod to return aPromiserepresenting the process of closing the instance. Whencloseis 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,
closereturns aPromisethat fulfills after the event dispatcher calls the response callback for each request. Otherwise,closereturns an immediately-fulfilledPromise. - The
Promisereturned fromcloseis fulfilled with a result object containingsuccess(boolean) andreason(string, only when success isfalse) properties. In the result object,successistrueif 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.successis false if an unexpected error was encountered during the close process.
- If any such requests were sent to the event dispatcher,
- Added non-typed
getFeatureVariablemethod (#298) as a more idiomatic approach to getting values of feature variables.- Typed
getFeatureVariablemethods will still be available for use.
- Typed
Release 3.2.2
Release 3.2.1
[3.2.1] - July 1st, 2019
Changed
- Updated lodash dependency to ^4.17.11 to address security vulnerabilities (#296)
Release 3.2.0
[3.2.0] - May 30th, 2019
New Features
-
Added support for automatic datafile management (#261), (#266), (#267), (#268), (#270), (#272)
- To use automatic datafile management, include
sdkKeyas a string property in the options object you pass tocreateInstance. - When sdkKey is provided, the SDK instance will download the datafile associated with that sdkKey immediately upon construction. When the download completes, the SDK instance will update itself to use the downloaded datafile.
- Use the
onReadymethod to wait until the download is complete and the SDK is ready to use. - Customize datafile management behavior by passing a
datafileOptionsobject within the options you pass tocreateInstance.- Enable automatic updates by passing
autoUpdate: true. Periodically (on the provided update interval), the SDK instance will download the datafile and update itself. Use this to ensure that the SDK instance is using a fresh datafile reflecting changes recently made to your experiment or feature configuration.
- Enable automatic updates by passing
- Add a notification listener for the
OPTIMIZELY_CONFIG_UPDATEnotification type to be notified when an instance updates its Optimizely config after obtaining a new datafile. - Stop active downloads and cancel recurring downloads by calling the
closemethod
Create an instance with datafile management enabled
const optimizely = require('@optimizely/optimizely-sdk'); const optimizelyClientInstance = optimizely.createInstance({ sdkKey: '12345', // Provide the sdkKey of your desired environment here });
Use
onReadyto wait until optimizelyClientInstance has a datafileconst optimizely = require('@optimizely/optimizely-sdk'); const optimizelyClientInstance = optimizely.createInstance({ sdkKey: '12345', }); optimizelyClientInstance.onReady().then(() => { // optimizelyClientInstance is ready to use, with datafile downloaded from the Optimizely CDN });
Enable automatic updates, add notification listener for OPTIMIZELY_CONFIG_UPDATE notification type, and stop automatic updates
const optimizely = require('@optimizely/optimizely-sdk'); const optimizelyClientInstance = optimizely.createInstance({ sdkKey: '12345', datafileOptions: { autoUpdate: true, updateInterval: 600000 // 10 minutes in milliseconds }, }); optimizelyClientInstance.notificationCenter.addNotificationListener( optimizely.enums.NOTIFICATION_TYPES.OPTIMIZELY_CONFIG_UPDATE, () => { // optimizelyClientInstance has updated its Optimizely config }, ); // Stop automatic updates - optimizelyClientInstance will use whatever datafile it currently has from now on optimizelyClientInstance.close();
- To use automatic datafile management, include
Changed
- Forced variation logic has been moved from the project config module to the decision service. Prefixes for forced-variation-related log messages will reflect this change (#261).
- Update TypeScript definitions to account for new methods (
onReady,close) and new properties on object accepted by createInstance (datafileOptions,sdkKey), (#263), (#278) - Allow react-sdk to be passed in as
clientEngine(#279)
Bug Fixes:
- Add logging message for
optimizely.track()(#281)
Release 3.2.0-beta
[3.2.0-beta] - May 16th, 2019
Bug Fixes:
- Clear timeout created in
onReadycall for timeout promise as soon as project config manager's ready promise fulfills
New Features
- Added 60 second timeout for all datafile requests
Changed
- Updated datafile request polling behavior:
- Start update interval timer immediately after request
- When update interval timer fires during request, wait until request completes, then immediately start next request
- Update TypeScript definitions to account for new methods (
onReady,close) and new properties on object accepted by createInstance (datafileOptions,sdkKey)