From 934e838764aaec621520c9551b71ee3016444c48 Mon Sep 17 00:00:00 2001 From: Emiliano Sanchez Date: Thu, 30 Oct 2025 18:29:39 -0300 Subject: [PATCH] feat: add fallback treatments config and improve client ready state handling --- CHANGES.txt | 7 +++++++ package-lock.json | 18 +++++++++--------- package.json | 4 ++-- src/settings/defaults.ts | 2 +- ts-tests/index.ts | 7 +++++++ types/full/index.d.ts | 2 +- types/index.d.ts | 2 +- 7 files changed, 28 insertions(+), 14 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 13f55b3..c1e06db 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,10 @@ +1.5.0 (October 31, 2025) + - Added new configuration for Fallback Treatments, which allows setting a treatment value and optional config to be returned in place of "control", either globally or by flag. Read more in our docs. + - Added `client.getStatus()` method to retrieve the client readiness status properties (`isReady`, `isReadyFromCache`, etc). + - Added `client.whenReady()` and `client.whenReadyFromCache()` methods to replace the deprecated `client.ready()` method, which has an issue causing the returned promise to hang when using async/await syntax if it was rejected. + - Updated the SDK_READY_FROM_CACHE event to be emitted alongside the SDK_READY event if it hasn’t already been emitted. + - Updated @splitsoftware/splitio-commons package to version 2.8.0. + 1.4.1 (October 8, 2025) - Bugfix - Updated @splitsoftware/splitio-commons package to version 2.7.1, which fixes the `debug` option to support log levels when the `logger` option is used. diff --git a/package-lock.json b/package-lock.json index cca5ad5..1625949 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "@splitsoftware/splitio-react-native", - "version": "1.4.1", + "version": "1.5.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@splitsoftware/splitio-react-native", - "version": "1.4.1", + "version": "1.5.0", "license": "Apache-2.0", "dependencies": { - "@splitsoftware/splitio-commons": "2.7.1" + "@splitsoftware/splitio-commons": "2.8.0" }, "devDependencies": { "@react-native-community/eslint-config": "^3.2.0", @@ -4887,9 +4887,9 @@ } }, "node_modules/@splitsoftware/splitio-commons": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-2.7.1.tgz", - "integrity": "sha512-7a4VVMczh0YKVRi35EhD0FOAEwzqfJRcCiKqLLhZCxAvrZBpE2khpGn8pOP+y6TefdPVtblW8GIku4O4r0KRdQ==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-2.8.0.tgz", + "integrity": "sha512-QgHUreMOEDwf4GZzVPu4AzkZJvuaeSoHsiJc4tT3CxSIYl2bKMz1SSDlI1tW/oVbIFeWjkrIp2lCYEyUBgcvyA==", "license": "Apache-2.0", "dependencies": { "@types/ioredis": "^4.28.0", @@ -21659,9 +21659,9 @@ } }, "@splitsoftware/splitio-commons": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-2.7.1.tgz", - "integrity": "sha512-7a4VVMczh0YKVRi35EhD0FOAEwzqfJRcCiKqLLhZCxAvrZBpE2khpGn8pOP+y6TefdPVtblW8GIku4O4r0KRdQ==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-2.8.0.tgz", + "integrity": "sha512-QgHUreMOEDwf4GZzVPu4AzkZJvuaeSoHsiJc4tT3CxSIYl2bKMz1SSDlI1tW/oVbIFeWjkrIp2lCYEyUBgcvyA==", "requires": { "@types/ioredis": "^4.28.0", "tslib": "^2.3.1" diff --git a/package.json b/package.json index cba0b84..0abd107 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-react-native", - "version": "1.4.1", + "version": "1.5.0", "description": "Split SDK for React Native", "main": "lib/commonjs/index.js", "module": "lib/module/index.js", @@ -61,7 +61,7 @@ }, "homepage": "https://github.com/splitio/react-native-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "2.7.1" + "@splitsoftware/splitio-commons": "2.8.0" }, "devDependencies": { "@react-native-community/eslint-config": "^3.2.0", diff --git a/src/settings/defaults.ts b/src/settings/defaults.ts index a2f820d..4b1dbf6 100644 --- a/src/settings/defaults.ts +++ b/src/settings/defaults.ts @@ -1,7 +1,7 @@ import type SplitIO from '@splitsoftware/splitio-commons/types/splitio'; import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants'; -const packageVersion = '1.4.1'; +const packageVersion = '1.5.0'; export const defaults = { startup: { diff --git a/ts-tests/index.ts b/ts-tests/index.ts index 07c5b79..399a8d3 100644 --- a/ts-tests/index.ts +++ b/ts-tests/index.ts @@ -109,6 +109,13 @@ let fullReactNativeSettings: SplitIO.IReactNativeSettings = { }, userConsent: 'GRANTED', mode: 'standalone', + fallbackTreatments: { + global: { treatment: 'global-treatment', config: '{"global": true}' }, + byFlag: { + my_flag: { treatment: 'flag-treatment', config: '{"flag": true}' }, + my_other_flag: 'other-flag-treatment', + }, + }, }; reactNativeSettings.userConsent = 'DECLINED'; diff --git a/types/full/index.d.ts b/types/full/index.d.ts index 5c6de26..bd44b0f 100644 --- a/types/full/index.d.ts +++ b/types/full/index.d.ts @@ -32,7 +32,7 @@ declare module JsSdk { * } * ``` * - * @see {@link https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/client-side-sdks/react-native-sdk/#configuring-cache} + * @see {@link https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/client-side-sdks/react-native-sdk/#configure-cache-behavior} */ export function InLocalStorage(options?: SplitIO.InLocalStorageOptions): SplitIO.StorageSyncFactory; diff --git a/types/index.d.ts b/types/index.d.ts index b9bfaf1..459e7f2 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -32,7 +32,7 @@ declare module JsSdk { * } * ``` * - * @see {@link https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/client-side-sdks/react-native-sdk/#configuring-cache} + * @see {@link https://developer.harness.io/docs/feature-management-experimentation/sdks-and-infrastructure/client-side-sdks/react-native-sdk/#configure-cache-behavior} */ export function InLocalStorage(options?: SplitIO.InLocalStorageOptions): SplitIO.StorageSyncFactory;