Skip to content

Releases: optimizely/javascript-sdk

Release 3.3.0

25 Sep 21:29
274ef4b
Compare
Choose a tag to compare

[3.3.0] - September 25th, 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) as a more idiomatic approach to getting values of feature variables.
    • Typed getFeatureVariable methods will still be available for use.

Release 3.3.0-beta

21 Aug 16:44
f71646a
Compare
Choose a tag to compare
Release 3.3.0-beta Pre-release
Pre-release

[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, 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) as a more idiomatic approach to getting values of feature variables.
    • Typed getFeatureVariable methods will still be available for use.

Release 3.2.2

20 Aug 18:34
61d5a64
Compare
Choose a tag to compare

[3.2.2] - August 20th, 2019

Bug fixes

  • Dont use pendingEventsDispatcher with user defined eventDispatcher (#289)
    Note: This was supposed to be released in 3.2.1 but did not make it into the release.
  • Updated lodash dependency to ^4.17.11 to address security vulnerabilities (#296)

Release 3.2.1

01 Jul 22:21
Compare
Choose a tag to compare

[3.2.1] - July 1st, 2019

Changed

  • Updated lodash dependency to ^4.17.11 to address security vulnerabilities (#296)

Release 3.2.0

30 May 20:43
db57438
Compare
Choose a tag to compare

[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 sdkKey as a string property in the options object you pass to createInstance.
    • 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 onReady method to wait until the download is complete and the SDK is ready to use.
    • Customize datafile management behavior by passing a datafileOptions object within the options you pass to createInstance.
      • 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.
    • Add a notification listener for the OPTIMIZELY_CONFIG_UPDATE notification 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 close method

    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 onReady to wait until optimizelyClientInstance has a datafile

    const 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();

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

16 May 22:17
8655733
Compare
Choose a tag to compare
Release 3.2.0-beta Pre-release
Pre-release

[3.2.0-beta] - May 16th, 2019

Bug Fixes:

  • Clear timeout created in onReady call 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)

Release 3.2.0-alpha

26 Apr 18:27
f754018
Compare
Choose a tag to compare
Release 3.2.0-alpha Pre-release
Pre-release

[3.2.0-alpha] - April 26nd, 2019

New Features

  • Added support for automatic datafile management

    • To use automatic datafile management, include sdkKey as a string property in the options object you pass to createInstance.
    • 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 onReady method to wait until the download is complete and the SDK is ready to use.
    • Customize datafile management behavior by passing a datafileOptions object within the options you pass to createInstance.
      • 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.
    • Add a notification listener for the OPTIMIZELY_CONFIG_UPDATE notification type to be notified when an instance updates its Optimizely config after obtaining a new datafile.
    • Stop active downloads and cancel pending downloads by calling the close method

    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 onReady to wait until optimizelyClientInstance has a datafile

    const 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();

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.

Release 3.1.0

23 Apr 23:22
55e2628
Compare
Choose a tag to compare

[3.1.0] - April 22nd, 2019

New Features:

  • Introduced Decision notification listener to be able to record:
    • Variation assignments for users activated in an experiment.
    • Feature access for users.
    • Feature variable value for users.

Changed

  • New APIs for setting logger and logLevel on the optimizelySDK singleton (#232)
  • logger and logLevel are now set globally for all instances of Optimizely. If you were passing
    different loggers to individual instances of Optimizely, logging behavior may now be different.

Setting a ConsoleLogger

var optimizelySDK = require('@optimizely/optimizely-sdk')

// logger and logLevel are now set on the optimizelySDK singleton
optimizelySDK.setLogger(optimizelySDK.logging.createLogger())

// valid levels: 'DEBUG', 'INFO', 'WARN', 'ERROR'
optimizelySDK.setLogLevel('WARN')
// enums can also be used
optimizelySDK.setLogLevel(optimizelySDK.enums.LOG_LEVEL.ERROR)

Disable logging

var optimizelySDK = require('@optimizely/optimizely-sdk')

optimizelySDK.setLogger(null)

Bug Fixes

  • Feature variable APIs now return default variable value when featureEnabled property is false. (#249)

Deprecated

  • Activate notification listener is deprecated as of this release. Recommendation is to use the new Decision notification listener. Activate notification listener will be removed in the next major release.

[3.1.0-beta1] - March 6th, 2019

06 Mar 19:30
34ecdcc
Compare
Choose a tag to compare

[3.1.0-beta1] - March 6th, 2019

Changed

  • New APIs for setting logger and logLevel on the optimizelySDK singleton (#232)
  • logger and logLevel are now set globally for all instances of Optimizely. If you were passing
    different loggers to individual instances of Optimizely, logging behavior may now be different.

Setting a ConsoleLogger

var optimizelySDK = require('@optimizely/optimizely-sdk')

// logger and logLevel are now set on the optimizelySDK singleton
optimizelySDK.setLogger(optimizelySDK.logging.createLogger())

// valid levels: 'DEBUG', 'INFO', 'WARN', 'ERROR'
optimizelySDK.setLogLevel('WARN')
// enums can also be used
optimizelySDK.setLogLevel(optimizely.enums.LOG_LEVEL.ERROR)

Disable logging

var optimizelySDK = require('@optimizely/optimizely-sdk')

optimizelySDK.setLogger(null)

[3.0.1] - February 21, 2019

21 Feb 18:40
521225e
Compare
Choose a tag to compare

Changed

  • Expose default loggers, errorHandlers, eventDispatcher and enums on top level require.
  • createLogger and createNoOpLogger are available as methods on optimizelySdk.logging
  • Added optimizelySdk.errorHandler
  • Added optimizelySdk.eventDispatcher
  • Added optimizelySdk.enums