diff --git a/CHANGELOG.md b/CHANGELOG.md index 0903ae80f..4d09e1a77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,31 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [6.0.0] - May 29, 2025 + +### Breaking Changes + +- Modularized SDK architecture: The monolithic `createInstance` call has been split into multiple factory functions for greater flexibility and control. +- Core functionalities (project configuration, event processing, ODP, VUID, logging, and error handling) are now configured through dedicated components created via factory functions, giving you greater flexibility and control in enabling/disabling certain components and allowing optimizing the bundle size for frontend projects. +- `onReady` Promise behavior changed: It now resolves only when the SDK is ready and rejects on initialization errors. +- event processing is disabled by default and must be explicitly enabled by passing a `eventProcessor` to the client. +- Event dispatcher interface updated to use Promises instead of callbacks. +- Logging is disabled by default and must be explicitly enabled using a logger created via a factory function. +- VUID tracking is disabled by default and must be explicitly enabled by passing a `vuidManager` to the client instance. +- ODP functionality is no longer enabled by default. You must explicitly pass an `odpManager` to enable it. +- Dropped support for older browser versions and Node.js versions earlier than 18.0.0. + +### New Features +- Added support for async user profile service and async decide methods (see dcoumentation for [User Profile Service](https://docs.developers.optimizely.com/feature-experimentation/docs/implement-a-user-profile-service-for-the-javascript-sdk) and [Decide methods](https://docs.developers.optimizely.com/feature-experimentation/docs/decide-methods-for-the-javascript-sdk)) + +### Migration Guide + +For detailed migration instructions, refer to the [Migration Guide](MIGRATION.md). + +### Documentation + +For more details, see the official documentation: [JavaScript SDK](https://docs.developers.optimizely.com/feature-experimentation/docs/javascript-sdk). + ## [5.3.5] - Jan 29, 2025 ### Bug Fixes diff --git a/MIGRATION.md b/MIGRATION.md index d462c7d66..8a2173ebf 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -21,7 +21,7 @@ This guide will help you migrate your implementation from Optimizely JavaScript In v6, the SDK architecture has been modularized to give you more control over different components: - The monolithic `createInstance` call is now split into multiple factory functions -- Core functionality (project configuration, event processing, ODP, VUID, logging, and error handling) is now configured through dedicated components created via factory functions, giving you greater flexibility and control in enabling/disabling certain components and allowing optimizing the bundle size for frontend projects. +- Core functionalities (project configuration, event processing, ODP, VUID, logging, and error handling) are now configured through dedicated components created via factory functions, giving you greater flexibility and control in enabling/disabling certain components and allowing optimizing the bundle size for frontend projects. - Event dispatcher interface has been updated to use Promises - onReady Promise behavior has changed diff --git a/lib/index.browser.tests.js b/lib/index.browser.tests.js index 28b94a9d0..82da1278f 100644 --- a/lib/index.browser.tests.js +++ b/lib/index.browser.tests.js @@ -152,7 +152,7 @@ describe('javascript-sdk (Browser)', function() { }); assert.instanceOf(optlyInstance, Optimizely); - assert.equal(optlyInstance.clientVersion, '5.3.4'); + assert.equal(optlyInstance.clientVersion, '6.0.0'); }); it('should set the JavaScript client engine and version', function() { diff --git a/lib/index.node.tests.js b/lib/index.node.tests.js index 8279c5110..0c6904778 100644 --- a/lib/index.node.tests.js +++ b/lib/index.node.tests.js @@ -79,17 +79,17 @@ describe('optimizelyFactory', function() { // // sinon.assert.calledOnce(fakeLogger.error); // }); - // it('should create an instance of optimizely', function() { - // var optlyInstance = optimizelyFactory.createInstance({ - // projectConfigManager: getMockProjectConfigManager(), - // errorHandler: fakeErrorHandler, - // eventDispatcher: fakeEventDispatcher, - // logger: fakeLogger, - // }); - - // assert.instanceOf(optlyInstance, Optimizely); - // assert.equal(optlyInstance.clientVersion, '5.3.4'); - // }); + it('should create an instance of optimizely', function() { + var optlyInstance = optimizelyFactory.createInstance({ + projectConfigManager: wrapConfigManager(getMockProjectConfigManager()), + // errorHandler: fakeErrorHandler, + // eventDispatcher: fakeEventDispatcher, + // logger: fakeLogger, + }); + + assert.instanceOf(optlyInstance, Optimizely); + assert.equal(optlyInstance.clientVersion, '6.0.0'); + }); // TODO: user will create and inject an event processor // these tests will be refactored accordingly // describe('event processor configuration', function() { diff --git a/lib/index.react_native.spec.ts b/lib/index.react_native.spec.ts index d46311278..b1ce89452 100644 --- a/lib/index.react_native.spec.ts +++ b/lib/index.react_native.spec.ts @@ -92,7 +92,7 @@ describe('javascript-sdk/react-native', () => { expect(optlyInstance).toBeInstanceOf(Optimizely); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - expect(optlyInstance.clientVersion).toEqual('5.3.4'); + expect(optlyInstance.clientVersion).toEqual('6.0.0'); }); it('should set the React Native JS client engine and javascript SDK version', () => { diff --git a/lib/utils/enums/index.ts b/lib/utils/enums/index.ts index 9d1fea0d3..892bff837 100644 --- a/lib/utils/enums/index.ts +++ b/lib/utils/enums/index.ts @@ -41,7 +41,7 @@ export const CONTROL_ATTRIBUTES = { export const JAVASCRIPT_CLIENT_ENGINE = 'javascript-sdk'; export const NODE_CLIENT_ENGINE = 'node-sdk'; export const REACT_NATIVE_JS_CLIENT_ENGINE = 'react-native-js-sdk'; -export const CLIENT_VERSION = '5.3.4'; +export const CLIENT_VERSION = '6.0.0'; /* * Represents the source of a decision for feature management. When a feature diff --git a/package-lock.json b/package-lock.json index a1f3df701..3b07d7c32 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@optimizely/optimizely-sdk", - "version": "5.3.4", + "version": "6.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@optimizely/optimizely-sdk", - "version": "5.3.4", + "version": "6.0.0", "license": "Apache-2.0", "dependencies": { "decompress-response": "^7.0.0", diff --git a/package.json b/package.json index 40bc9df11..f5e8a583f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@optimizely/optimizely-sdk", - "version": "5.3.4", + "version": "6.0.0", "description": "JavaScript SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts", "main": "./dist/index.node.min.js", "browser": "./dist/index.browser.es.min.js",