Skip to content
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
51 changes: 51 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,57 @@ 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.2.0] - October 22, 2025

### New Features

- **Added support for Contextual Multi-Armed Bandit (CMAB)**: Added support for CMAB experiments(Contextual Bandits rules) with new configuration options and cache control. To get decision from CMAB rules, `decideAsync` and related methods must be used. The sync `decide` method does not support CMABs and will just skip CMAB rules while making decision for a flag.

#### CMAB Configuration Options

The following new options have been added to configure the cmab cache:

```js
import { createInstance } from '@optimizely/optimizely-sdk'

const optimizely = createInstance({
// ... other config options
cmab: {
cacheSize: 1000, // Optional: Set CMAB cache size (default: 1000)
cacheTtl: 30 * 60 * 1000, // Optional: Set CMAB cache TTL in milliseconds (default: 30 * 60 * 1000)
cache: customCache // Optional: Custom cache implementation, instance of CacheWithRemove interface
}
});
```

#### CMAB-Related OptimizelyDecideOptions

New decide options are available to control CMAB caching behavior:

- `OptimizelyDecideOption.IGNORE_CMAB_CACHE`: Bypass CMAB cache for fresh decisions
- `OptimizelyDecideOption.RESET_CMAB_CACHE`: Clear and reset CMAB cache before making decisions
- `OptimizelyDecideOption.INVALIDATE_USER_CMAB_CACHE`: Invalidate CMAB cache for the particular user and experiment

```js

// Example usage with CMAB decide options
const decision = await userContext.decideAsync('feature-flag-key', [
optimizelySdk.enums.OptimizelyDecideOption.IGNORE_CMAB_CACHE
]);
```

### Bug Fixes
- Flush events without closing client on page unload which causes event processing to stop working when page is loaded from bfcache ([#1087](https://github.com/optimizely/javascript-sdk/pull/1087))
- Fixed typo in clientEngine option ([#1095](https://github.com/optimizely/javascript-sdk/pull/1095))

## [5.4.0] - Oct 13, 2025

### New Features
- Added `customHeaders` option to `datafileOptions` for passing custom HTTP headers in datafile requests ([#1092](https://github.com/optimizely/javascript-sdk/pull/1092))
### Bug Fixes
- Fix the EventTags type to allow event properties ([#1040](https://github.com/optimizely/javascript-sdk/pull/1040))
- Fix typo in event.experimentIds field in project config ([#1088](https://github.com/optimizely/javascript-sdk/pull/1088))

## [6.1.0] - September 8, 2025

### New Features
Expand Down
4 changes: 2 additions & 2 deletions lib/export_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ export type {
export type { ErrorHandler } from './error/error_handler';
export type { OpaqueErrorNotifier } from './error/error_notifier_factory';

export type { Cache } from './utils/cache/cache';
export type { Store } from './utils/cache/store'
export type { SyncCache, AsyncCache, Cache, SyncCacheWithRemove, AsyncCacheWithRemove, CacheWithRemove } from './utils/cache/cache';
export type { SyncStore, AsyncStore, Store } from './utils/cache/store'

export type {
NotificationType,
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 @@ -153,7 +153,7 @@ describe('javascript-sdk (Browser)', function() {
});

assert.instanceOf(optlyInstance, Optimizely);
assert.equal(optlyInstance.clientVersion, '6.1.0');
assert.equal(optlyInstance.clientVersion, '6.2.0');
});

it('should set the JavaScript client engine and version', function() {
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 @@ -88,7 +88,7 @@ describe('optimizelyFactory', function() {
});

assert.instanceOf(optlyInstance, Optimizely);
assert.equal(optlyInstance.clientVersion, '6.1.0');
assert.equal(optlyInstance.clientVersion, '6.2.0');
});
// TODO: user will create and inject an event processor
// these tests will be refactored accordingly
Expand Down
2 changes: 1 addition & 1 deletion lib/index.react_native.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('6.1.0');
expect(optlyInstance.clientVersion).toEqual('6.2.0');
});

it('should set the React Native JS client engine and javascript SDK version', () => {
Expand Down
3 changes: 2 additions & 1 deletion lib/index.universal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ export type {
export type { ErrorHandler } from './error/error_handler';
export type { OpaqueErrorNotifier } from './error/error_notifier_factory';

export type { Cache } from './utils/cache/cache';
export type { SyncCache, AsyncCache, Cache, SyncCacheWithRemove, AsyncCacheWithRemove, CacheWithRemove } from './utils/cache/cache';
export type { SyncStore, AsyncStore, Store } from './utils/cache/store'

export type {
NotificationType,
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/enums/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '6.1.0';
export const CLIENT_VERSION = '6.2.0';

/*
* Represents the source of a decision for feature management. When a feature
Expand Down
4 changes: 2 additions & 2 deletions 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": "6.1.0",
"version": "6.2.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",
Expand Down
Loading