Skip to content

Commit

Permalink
[FSSDK-8580] prepare for release 5.0.0 (#893)
Browse files Browse the repository at this point in the history
  • Loading branch information
raju-opti authored Jan 19, 2024
1 parent d4d87e7 commit 961f6a1
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 77 deletions.
57 changes: 57 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,63 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [5.0.0] - January 19, 2024

### New Features

The 5.0.0 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. ([#892](https://github.com/optimizely/javascript-sdk/pull/892), [#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 `9.0.1`.
- Dropped support for the following browser versions.
- All versions of Microsof Internet Explorer.
- Chrome versions earlier than `102.0`.
- Microsoft Edge versions earlier than `84.0`.
- Firefox versions earlier than `91.0`.
- Opera versions earlier than `76.0`.
- Safari versions earlier than `13.0`.
- Dropped support for Node JS versions earlier than `16`.

## 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.10.0] - October 11, 2023

### New Features
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2016-2017, Optimizely, Inc. and contributors
© Optimizely 2016

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
94 changes: 26 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,17 @@

This repository houses the JavaScript SDK for use with Optimizely Feature Experimentation and Optimizely Full Stack (legacy).

Optimizely Feature Experimentation is an A/B testing and feature management tool for product development teams that enables you to experiment at every step. Using Optimizely Feature Experimentation allows for every feature on your roadmap to be an opportunity to discover hidden insights. Learn more at [Optimizely.com](https://www.optimizely.com/products/experiment/feature-experimentation/), or see the [developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/welcome).
Optimizely Feature Experimentation is an A/B testing and feature management tool for product development teams that enables you to experiment at every step. Using Optimizely Feature Experimentation allows for every feature on your roadmap to be an opportunity to discover hidden insights. Learn more at [Optimizely.com](https://www.optimizely.com/products/experiment/feature-experimentation/), or see the [developer documentation](https://docs.developers.optimizely.com/feature-experimentation/docs/introduction).

Optimizely Rollouts is [free feature flags](https://www.optimizely.com/free-feature-flagging/) for development teams. You can easily roll out and roll back features in any application without code deploys, mitigating risk for every feature on your roadmap.

---

## Get Started

> For **Browser** applications, refer to the [JavaScript SDK's developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/javascript-sdk) for detailed instructions on getting started with using the SDK within client-side applications.
> For **Browser** applications, refer to the [JavaScript SDK's developer documentation](https://docs.developers.optimizely.com/feature-experimentation/docs/javascript-sdk) for detailed instructions on getting started with using the SDK within client-side applications.
> For **React** applications, refer to the [React SDK developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/javascript-react-sdk).
> For **React Native** applications, refer to the [JavaScript (React Native) variant of the developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/javascript-react-native-sdk).
> For **Node.js** applications, refer to the [JavaScript (Node) variant of the developer documentation](https://docs.developers.optimizely.com/experimentation/v4.0.0-full-stack/docs/javascript-node-sdk).
> For **Node.js** applications, refer to the [JavaScript (Node) variant of the developer documentation](https://docs.developers.optimizely.com/feature-experimentation/docs/javascript-node-sdk).
> For **Edge Functions**, we provide starter kits that utilize the Optimizely JavaScript SDK for the following platforms:
> - [Akamai (Edgeworkers)](https://github.com/optimizely/akamai-edgeworker-starter-kit)
Expand All @@ -31,13 +27,13 @@ Optimizely Rollouts is [free feature flags](https://www.optimizely.com/free-feat
> - [Fastly Compute@Edge](https://github.com/optimizely/fastly-compute-starter-kit)
> - [Vercel Edge Middleware](https://github.com/optimizely/vercel-examples/tree/main/edge-middleware/feature-flag-optimizely)
>
> Note: These starter kits use the **Lite** variant of the JavaScript SDK which excludes the datafile manager and event processor packages.
> Note: We recommend using the **Lite** version of the sdk for edge platforms. These starter kits also use the **Lite** variant of the JavaScript SDK which excludes the datafile manager and event processor packages.
### Prerequisites

Ensure the SDK supports all of the platforms you're targeting. In particular, the SDK targets any ES5-compliant JavaScript environment. We officially support:
- Node.js >= 8.0.0. By extension, environments like AWS Lambda, Google Cloud Functions, and Auth0 Webtasks are supported as well. Older Node.js releases likely work too (try `npm test` to validate for yourself), but are not formally supported.
- [Modern Web Browsers, such as IE 10+, Firefox 21+, Safari 6+, and Chrome 23+](https://caniuse.com/#feat=es5)
Ensure the SDK supports all of the platforms you're targeting. In particular, the SDK targets modern ES5-compliant JavaScript environment. We officially support:
- Node.js >= 16.0.0. By extension, environments like AWS Lambda, Google Cloud Functions, and Auth0 Webtasks are supported as well. Older Node.js releases likely work too (try `npm test` to validate for yourself), but are not formally supported.
- Modern Web Browsers, such as Microsoft Edge 84+, Firefox 91+, Safari 13+, and Chrome 102+, Opera 76+

In addition, other environments are likely compatible but are not formally supported including:
- Progressive Web Apps, WebViews, and hybrid mobile apps like those built with React Native and Apache Cordova.
Expand All @@ -48,44 +44,8 @@ In addition, other environments are likely compatible but are not formally suppo

* JavaScript (Browser): Modern web browser that is ES5-compliant.

* JavaScript (Node): Node 8.0+

* The following peer dependencies may be required for use in production:

```json
{
"[email protected]": {
"licenses": [
"AFLv2.1",
"BSD"
],
"publisher": "Kris Zyp",
"repository": "https://github.com/kriszyp/json-schema"
},
"[email protected]": {
"licenses": "MIT*",
"repository": "https://github.com/perezd/node-murmurhash"
},
"[email protected]": {
"licenses": "MIT",
"repository": "https://github.com/kelektiv/node-uuid"
},
"[email protected]": {
"licenses": "MIT",
"repository": "https://github.com/sindresorhus/decompress-response"
}
}
```

To regenerate this, run the following command:

```sh
npx license-checker --production --json | jq 'map_values({ licenses, publisher, repository }) | del(.[][] | nulls)'
```

and remove the self (`@optimizely/optimizely-sdk`) entry.
* JavaScript (Node): Node 16.0.0+

> Note: The `jq` command line tool is required to run the above script. You may install `jq` to your environment by using Homebrew on MacOS using the command `brew install jq`. For Windows users, please visit the [JQ GitHub repository](https://github.com/stedolan/jq) to learn more.

### Install the SDK

Expand Down Expand Up @@ -116,7 +76,7 @@ See the [Optimizely Feature Experimentation developer documentation for JavaScri

### Initialization (Browser)

The package's entry point is a CommonJS module, which can be used directly in environments which support it (e.g., Node.js, or loaded in a browser via Browserify or RequireJS). Additionally, for ease of use during initial evaluations you can include a standalone bundle of the SDK in your web page by fetching it from [unpkg](https://unpkg.com/):
The package has different entry points for different environments. The browser entry point is an ES module, which can be used with an appropriate bundler like **Webpack** or **Rollup**. Additionally, for ease of use during initial evaluations you can include a standalone umd bundle of the SDK in your web page by fetching it from [unpkg](https://unpkg.com/):

```html
<script src="https://unpkg.com/@optimizely/optimizely-sdk/dist/optimizely.browser.umd.min.js"></script>
Expand All @@ -134,11 +94,13 @@ const optimizelyClient = window.optimizelySdk.createInstance({
sdkKey: '<YOUR_SDK_KEY>',
// datafile: window.optimizelyDatafile,
// etc.
})
});

optimizelyClient.onReady().then(() => {
// Create the Optimizely user context, make decisions, and more here!
})
optimizelyClient.onReady().then(({ success, reason }) => {
if (success) {
// Create the Optimizely user context, make decisions, and more here!
}
});
```

Regarding `EventDispatcher`s: In Node.js and browser environments, the default `EventDispatcher` is powered by the [`http/s`](https://nodejs.org/api/http.html) modules and by [`XMLHttpRequest`](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#Browser_compatibility), respectively. In all other environments, you must supply your own `EventDispatcher`.
Expand All @@ -149,20 +111,22 @@ See the [Optimizely Feature Experimentation developer documentation for JavaScri

### Initialization (Node)

The package's entry point is a CommonJS module, which can be used directly in environments which support it (e.g., Node.js, or loaded in a browser via Browserify or RequireJS). Additionally, for ease of use during initial evaluations you can include a standalone bundle of the SDK in your web page by fetching it from [unpkg](https://unpkg.com/):
The package has different entry points for different environments. The node entry point is CommonJS module.

```typescript
import optimizelyClient from "@optimizely/optimizely-sdk";
```javascript
const optimizelySdk = require('@optimizely/optimizely-sdk');

optimizelyClient.createInstance({
const optimizelyClient = optimizelySdk.createInstance({
sdkKey: '<YOUR_SDK_KEY>',
// datafile: window.optimizelyDatafile,
// etc.
});

optimizelyClient.onReady().then(() => {
// Create the Optimizely user context, make decisions, and more here!
})
optimizelyClient.onReady().then(({ success, reason }) => {
if (success) {
// Create the Optimizely user context, make decisions, and more here!
}
});
```

Regarding `EventDispatcher`s: In Node.js environment, the default `EventDispatcher` is powered by the [`http/s`](https://nodejs.org/api/http.html) module.
Expand Down Expand Up @@ -207,15 +171,9 @@ For more information regarding contributing to the Optimizely JavaScript SDK, pl

## Special Notes

### Migrating from 1.x.x

This version represents a major version change and, as such, introduces some breaking changes:

- The Node.js SDK is now combined with the JavaScript SDK. We now have just one package, `@optimizely/optimizely-sdk`, that works in many JavaScript environments.

- We no longer support Node.js < 4.0.0, which collectively [reached end-of-life](https://github.com/nodejs/Release#end-of-life-releases) on 2016-12-31.
### Migrating from 4.x.x

- You will no longer be able to pass in `revenue` value as a stand-alone argument to the `track` call. Instead you will need to pass it as an entry in the [`eventTags`](https://developers.optimizely.com/x/solutions/sdks/reference/index.html?language=javascript#event-tags).
This version represents a major version change and, as such, introduces some breaking changes. Please refer to the [Changelog](CHANGELOG.md#500---january-19-2024) for more details.

### Feature Management access

Expand Down
2 changes: 1 addition & 1 deletion lib/index.browser.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ describe('javascript-sdk (Browser)', function() {
optlyInstance.onReady().catch(function() {});

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

it('should set the JavaScript client engine and version', function() {
Expand Down
2 changes: 1 addition & 1 deletion lib/index.lite.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('optimizelyFactory', function() {
optlyInstance.onReady().catch(function() {});

assert.instanceOf(optlyInstance, Optimizely);
assert.equal(optlyInstance.clientVersion, '5.0.0-beta5');
assert.equal(optlyInstance.clientVersion, '5.0.0');
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion lib/index.node.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('optimizelyFactory', function() {
optlyInstance.onReady().catch(function() {});

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

describe('event processor configuration', function() {
Expand Down
4 changes: 2 additions & 2 deletions 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 = '5.0.0-beta5';
export const NODE_CLIENT_VERSION = '5.0.0-beta5';
export const BROWSER_CLIENT_VERSION = '5.0.0';
export const NODE_CLIENT_VERSION = '5.0.0';

export const DECISION_NOTIFICATION_TYPES = {
AB_TEST: 'ab-test',
Expand Down
2 changes: 1 addition & 1 deletion 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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@optimizely/optimizely-sdk",
"version": "5.0.0-beta5",
"version": "5.0.0",
"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
2 changes: 1 addition & 1 deletion tests/index.react_native.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('javascript-sdk/react-native', () => {

expect(optlyInstance).toBeInstanceOf(Optimizely);
// @ts-ignore
expect(optlyInstance.clientVersion).toEqual('5.0.0-beta5');
expect(optlyInstance.clientVersion).toEqual('5.0.0');
});

it('should set the React Native JS client engine and javascript SDK version', () => {
Expand Down

0 comments on commit 961f6a1

Please sign in to comment.