Skip to content

[FSSDK-9096] chore: Prepare release 5.0.0-beta #822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion packages/optimizely-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,49 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Breaking Changes
## 5.0.0-beta
May 4, 2023

### New Features

The 5.0.0-beta release introduces a new primary feature, [Advanced Audience Targeting]( https://docs.developers.optimizely.com/feature-experimentation/docs/optimizely-data-platform-advanced-audience-targeting) enabled through integration with [Optimizely Data Platform (ODP)](https://docs.developers.optimizely.com/optimizely-data-platform/docs) ([#765](https://github.com/optimizely/javascript-sdk/pull/765), [#775](https://github.com/optimizely/javascript-sdk/pull/775), [#776](https://github.com/optimizely/javascript-sdk/pull/776), [#777](https://github.com/optimizely/javascript-sdk/pull/777), [#778](https://github.com/optimizely/javascript-sdk/pull/778), [#786](https://github.com/optimizely/javascript-sdk/pull/786), [#789](https://github.com/optimizely/javascript-sdk/pull/789), [#790](https://github.com/optimizely/javascript-sdk/pull/790), [#797](https://github.com/optimizely/javascript-sdk/pull/797), [#799](https://github.com/optimizely/javascript-sdk/pull/799), [#808](https://github.com/optimizely/javascript-sdk/pull/808)).

You can use ODP, a high-performance [Customer Data Platform (CDP)]( https://www.optimizely.com/optimization-glossary/customer-data-platform/), to easily create complex real-time segments (RTS) using first-party and 50+ third-party data sources out of the box. You can create custom schemas that support the user attributes important for your business, and stitch together user behavior done on different devices to better understand and target your customers for personalized user experiences. ODP can be used as a single source of truth for these segments in any Optimizely or 3rd party tool.

With ODP accounts integrated into Optimizely projects, you can build audiences using segments pre-defined in ODP. The SDK will fetch the segments for given users and make decisions using the segments. For access to ODP audience targeting in your Feature Experimentation account, please contact your Customer Success Manager.

This version includes the following changes:

- New API added to `OptimizelyUserContext`:

- `fetchQualifiedSegments()`: this API will retrieve user segments from the ODP server. The fetched segments will be used for audience evaluation. The fetched data will be stored in the local cache to avoid repeated network delays.

- When an `OptimizelyUserContext` is created, the SDK will automatically send an identify request to the ODP server to facilitate observing user activities.

- New APIs added to `OptimizelyClient`:

- `sendOdpEvent()`: customers can build/send arbitrary ODP events that will bind user identifiers and data to user profiles in ODP.

- `createUserContext()` with anonymous user IDs: user-contexts can be created without a userId. The SDK will create and use a persistent `VUID` specific to a device when userId is not provided.

For details, refer to our documentation pages:

- [Advanced Audience Targeting](https://docs.developers.optimizely.com/feature-experimentation/docs/optimizely-data-platform-advanced-audience-targeting)

- [Client SDK Support](https://docs.developers.optimizely.com/feature-experimentation/v1.0/docs/advanced-audience-targeting-for-client-side-sdks)

- [Initialize JavaScript SDK](https://docs.developers.optimizely.com/feature-experimentation/docs/initialize-sdk-javascript-aat)

- [OptimizelyUserContext JavaScript SDK](https://docs.developers.optimizely.com/feature-experimentation/docs/optimizelyusercontext-javascript-aat)

- [Advanced Audience Targeting segment qualification methods](https://docs.developers.optimizely.com/feature-experimentation/docs/advanced-audience-targeting-segment-qualification-methods-javascript)

- [Send Optimizely Data Platform data using Advanced Audience Targeting](https://docs.developers.optimizely.com/feature-experimentation/docs/send-odp-data-using-advanced-audience-targeting-javascript)

Additionally, a handful of major package updates are also included in this release including `murmurhash`, `uuid`, and others. For more information, check out the **Breaking Changes** section below. ([#762](https://github.com/optimizely/javascript-sdk/pull/762))

### Breaking Changes
- `ODPManager` in the SDK is enabled by default. Unless an ODP account is integrated into the Optimizely projects, most `ODPManager` functions will be ignored. If needed, `ODPManager` can be disabled when `OptimizelyClient` is instantiated.
- Updated `murmurhash` dependency to version `2.0.1`.
- Updated `uuid` dependency to version `8.3.2`.
- Dropped support for the following browser versions.
Expand All @@ -19,6 +61,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Safari versions earlier than `13.0`.
- Dropped support for Node JS versions earlier than `14`.

## Changed
- Updated `createUserContext`'s `userId` parameter to be optional due to the Browser variation's use of the new `vuid` field. Note: The Node variation of the SDK does **not** use the new `vuid` field and you should pass in a `userId` when within the context of the Node variant.

## [4.9.3] - March 17, 2023

### Changed
Expand Down
10 changes: 5 additions & 5 deletions packages/optimizely-sdk/lib/index.browser.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ describe('javascript-sdk (Browser)', function() {
optlyInstance.onReady().catch(function() {});

assert.instanceOf(optlyInstance, Optimizely);
assert.equal(optlyInstance.clientVersion, '4.9.3');
assert.equal(optlyInstance.clientVersion, '5.0.0-beta');
});

it('should set the JavaScript client engine and version', function() {
Expand Down Expand Up @@ -1055,9 +1055,9 @@ describe('javascript-sdk (Browser)', function() {
const apiManager = new BrowserOdpEventApiManager(mockRequestHandler, logger);
sinon.spy(apiManager, 'sendEvents');
const eventManager = new BrowserOdpEventManager({
odpConfig,
apiManager,
logger,
odpConfig,
apiManager,
logger,
});
const datafile = testData.getOdpIntegratedConfigWithSegments();
const client = optimizelyFactory.createInstance({
Expand All @@ -1078,7 +1078,7 @@ describe('javascript-sdk (Browser)', function() {

clock.tick(100);

const [,,events] = apiManager.sendEvents.getCall(0).args;
const [, , events] = apiManager.sendEvents.getCall(0).args;
const [firstEvent] = events;
assert.equal(firstEvent.action, 'client_initialized');
assert.equal(firstEvent.type, 'fullstack');
Expand Down
28 changes: 14 additions & 14 deletions packages/optimizely-sdk/lib/index.lite.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import * as loggerPlugin from './plugins/logger';
import optimizelyFactory from './index.lite';
import configValidator from './utils/config_validator';

describe('optimizelyFactory', function () {
describe('APIs', function () {
it('should expose logger, errorHandler, eventDispatcher and enums', function () {
describe('optimizelyFactory', function() {
describe('APIs', function() {
it('should expose logger, errorHandler, eventDispatcher and enums', function() {
assert.isDefined(optimizelyFactory.logging);
assert.isDefined(optimizelyFactory.logging.createLogger);
assert.isDefined(optimizelyFactory.logging.createNoOpLogger);
Expand All @@ -33,50 +33,50 @@ describe('optimizelyFactory', function () {
assert.isDefined(optimizelyFactory.enums);
});

describe('createInstance', function () {
var fakeErrorHandler = { handleError: function () { } };
var fakeEventDispatcher = { dispatchEvent: function () { } };
describe('createInstance', function() {
var fakeErrorHandler = { handleError: function() {} };
var fakeEventDispatcher = { dispatchEvent: function() {} };
var fakeLogger;

beforeEach(function () {
beforeEach(function() {
fakeLogger = { log: sinon.spy(), setLogLevel: sinon.spy() };
sinon.stub(loggerPlugin, 'createLogger').returns(fakeLogger);
sinon.stub(configValidator, 'validate');
sinon.stub(console, 'error');
});

afterEach(function () {
afterEach(function() {
loggerPlugin.createLogger.restore();
configValidator.validate.restore();
console.error.restore();
});

it('should not throw if the provided config is not valid and log an error if logger is passed in', function () {
it('should not throw if the provided config is not valid and log an error if logger is passed in', function() {
configValidator.validate.throws(new Error('Invalid config or something'));
var localLogger = loggerPlugin.createLogger({ logLevel: enums.LOG_LEVEL.INFO });
assert.doesNotThrow(function () {
assert.doesNotThrow(function() {
var optlyInstance = optimizelyFactory.createInstance({
datafile: {},
logger: localLogger,
});
// Invalid datafile causes onReady Promise rejection - catch this
optlyInstance.onReady().catch(function () { });
optlyInstance.onReady().catch(function() {});
});
sinon.assert.calledWith(localLogger.log, enums.LOG_LEVEL.ERROR);
});

it('should create an instance of optimizely', function () {
it('should create an instance of optimizely', function() {
var optlyInstance = optimizelyFactory.createInstance({
datafile: {},
errorHandler: fakeErrorHandler,
eventDispatcher: fakeEventDispatcher,
logger: fakeLogger,
});
// Invalid datafile causes onReady Promise rejection - catch this
optlyInstance.onReady().catch(function () { });
optlyInstance.onReady().catch(function() {});

assert.instanceOf(optlyInstance, Optimizely);
assert.equal(optlyInstance.clientVersion, '4.9.3');
assert.equal(optlyInstance.clientVersion, '5.0.0-beta');
});
});
});
Expand Down
52 changes: 26 additions & 26 deletions packages/optimizely-sdk/lib/index.node.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import * as loggerPlugin from './plugins/logger';
import optimizelyFactory from './index.node';
import configValidator from './utils/config_validator';

describe('optimizelyFactory', function () {
describe('APIs', function () {
it('should expose logger, errorHandler, eventDispatcher and enums', function () {
describe('optimizelyFactory', function() {
describe('APIs', function() {
it('should expose logger, errorHandler, eventDispatcher and enums', function() {
assert.isDefined(optimizelyFactory.logging);
assert.isDefined(optimizelyFactory.logging.createLogger);
assert.isDefined(optimizelyFactory.logging.createNoOpLogger);
Expand All @@ -35,75 +35,75 @@ describe('optimizelyFactory', function () {
assert.isDefined(optimizelyFactory.enums);
});

describe('createInstance', function () {
var fakeErrorHandler = { handleError: function () { } };
var fakeEventDispatcher = { dispatchEvent: function () { } };
describe('createInstance', function() {
var fakeErrorHandler = { handleError: function() {} };
var fakeEventDispatcher = { dispatchEvent: function() {} };
var fakeLogger;

beforeEach(function () {
beforeEach(function() {
fakeLogger = { log: sinon.spy(), setLogLevel: sinon.spy() };
sinon.stub(loggerPlugin, 'createLogger').returns(fakeLogger);
sinon.stub(configValidator, 'validate');
sinon.stub(console, 'error');
});

afterEach(function () {
afterEach(function() {
loggerPlugin.createLogger.restore();
configValidator.validate.restore();
console.error.restore();
});

it('should not throw if the provided config is not valid and log an error if logger is passed in', function () {
it('should not throw if the provided config is not valid and log an error if logger is passed in', function() {
configValidator.validate.throws(new Error('Invalid config or something'));
var localLogger = loggerPlugin.createLogger({ logLevel: enums.LOG_LEVEL.INFO });
assert.doesNotThrow(function () {
assert.doesNotThrow(function() {
var optlyInstance = optimizelyFactory.createInstance({
datafile: {},
logger: localLogger,
});
// Invalid datafile causes onReady Promise rejection - catch this
optlyInstance.onReady().catch(function () { });
optlyInstance.onReady().catch(function() {});
});
sinon.assert.calledWith(localLogger.log, enums.LOG_LEVEL.ERROR);
});

it('should not throw if the provided config is not valid and log an error if no logger is provided', function () {
it('should not throw if the provided config is not valid and log an error if no logger is provided', function() {
configValidator.validate.throws(new Error('Invalid config or something'));
assert.doesNotThrow(function () {
assert.doesNotThrow(function() {
var optlyInstance = optimizelyFactory.createInstance({
datafile: {},
});
// Invalid datafile causes onReady Promise rejection - catch this
optlyInstance.onReady().catch(function () { });
optlyInstance.onReady().catch(function() {});
});
sinon.assert.calledOnce(console.error);
});

it('should create an instance of optimizely', function () {
it('should create an instance of optimizely', function() {
var optlyInstance = optimizelyFactory.createInstance({
datafile: {},
errorHandler: fakeErrorHandler,
eventDispatcher: fakeEventDispatcher,
logger: fakeLogger,
});
// Invalid datafile causes onReady Promise rejection - catch this
optlyInstance.onReady().catch(function () { });
optlyInstance.onReady().catch(function() {});

assert.instanceOf(optlyInstance, Optimizely);
assert.equal(optlyInstance.clientVersion, '4.9.3');
assert.equal(optlyInstance.clientVersion, '5.0.0-beta');
});

describe('event processor configuration', function () {
describe('event processor configuration', function() {
var eventProcessorSpy;
beforeEach(function () {
beforeEach(function() {
eventProcessorSpy = sinon.stub(eventProcessor, 'createEventProcessor').callThrough();
});

afterEach(function () {
afterEach(function() {
eventProcessor.createEventProcessor.restore();
});

it('should ignore invalid event flush interval and use default instead', function () {
it('should ignore invalid event flush interval and use default instead', function() {
optimizelyFactory.createInstance({
datafile: testData.getTestProjectConfigWithFeatures(),
errorHandler: fakeErrorHandler,
Expand All @@ -119,7 +119,7 @@ describe('optimizelyFactory', function () {
);
});

it('should use default event flush interval when none is provided', function () {
it('should use default event flush interval when none is provided', function() {
optimizelyFactory.createInstance({
datafile: testData.getTestProjectConfigWithFeatures(),
errorHandler: fakeErrorHandler,
Expand All @@ -134,7 +134,7 @@ describe('optimizelyFactory', function () {
);
});

it('should use provided event flush interval when valid', function () {
it('should use provided event flush interval when valid', function() {
optimizelyFactory.createInstance({
datafile: testData.getTestProjectConfigWithFeatures(),
errorHandler: fakeErrorHandler,
Expand All @@ -150,7 +150,7 @@ describe('optimizelyFactory', function () {
);
});

it('should ignore invalid event batch size and use default instead', function () {
it('should ignore invalid event batch size and use default instead', function() {
optimizelyFactory.createInstance({
datafile: testData.getTestProjectConfigWithFeatures(),
errorHandler: fakeErrorHandler,
Expand All @@ -166,7 +166,7 @@ describe('optimizelyFactory', function () {
);
});

it('should use default event batch size when none is provided', function () {
it('should use default event batch size when none is provided', function() {
optimizelyFactory.createInstance({
datafile: testData.getTestProjectConfigWithFeatures(),
errorHandler: fakeErrorHandler,
Expand All @@ -181,7 +181,7 @@ describe('optimizelyFactory', function () {
);
});

it('should use provided event batch size when valid', function () {
it('should use provided event batch size when valid', function() {
optimizelyFactory.createInstance({
datafile: testData.getTestProjectConfigWithFeatures(),
errorHandler: fakeErrorHandler,
Expand Down
4 changes: 2 additions & 2 deletions packages/optimizely-sdk/lib/utils/enums/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ export const NODE_CLIENT_ENGINE = 'node-sdk';
export const REACT_CLIENT_ENGINE = 'react-sdk';
export const REACT_NATIVE_CLIENT_ENGINE = 'react-native-sdk';
export const REACT_NATIVE_JS_CLIENT_ENGINE = 'react-native-js-sdk';
export const BROWSER_CLIENT_VERSION = '4.9.3';
export const NODE_CLIENT_VERSION = '4.9.3';
export const BROWSER_CLIENT_VERSION = '5.0.0-beta';
export const NODE_CLIENT_VERSION = '5.0.0-beta';

export const DECISION_NOTIFICATION_TYPES = {
AB_TEST: 'ab-test',
Expand Down
2 changes: 1 addition & 1 deletion packages/optimizely-sdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/optimizely-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@optimizely/optimizely-sdk",
"version": "4.9.3",
"version": "5.0.0-beta",
"description": "JavaScript SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts",
"module": "dist/optimizely.browser.es.js",
"main": "dist/optimizely.node.min.js",
Expand Down
Loading