diff --git a/CHANGES.txt b/CHANGES.txt index b7cb516..5244d04 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,5 +1,7 @@ +0.3.0 (April 7, 2022) + - Added user consent feature to allow delaying or disabling the data tracking from SDK until user consent is explicitly granted or declined. Read more in our docs. + 0.2.0 (March 31, 2022) - - Added support for user consent, a way to control if the SDK tracks impressions and events or not, based on users granting or rejecting consent for it. - Added support to SDK clients to optionally bind attributes, keeping these loaded within the SDK along with the user ID, for easier usage when requesting flag. - Added `scheduler.impressionsQueueSize` property to SDK configuration (See https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK#configuration). - Updated some NPM dependencies for vulnerability fixes. diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 2b4aa99..89d22bb 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -316,7 +316,7 @@ PODS: - React-cxxreact (= 0.64.1) - React-jsi (= 0.64.1) - React-perflogger (= 0.64.1) - - RNSplit (0.2.0): + - RNSplit (0.3.0): - React - Yoga (1.14.0) - YogaKit (1.18.1): @@ -488,7 +488,7 @@ SPEC CHECKSUMS: React-RCTVibration: 4b99a7f5c6c0abbc5256410cc5425fb8531986e1 React-runtimeexecutor: ff951a0c241bfaefc4940a3f1f1a229e7cb32fa6 ReactCommon: bedc99ed4dae329c4fcf128d0c31b9115e5365ca - RNSplit: c04b293ec271725d77729f8d4703a189bbf5b8a3 + RNSplit: f4a2929c402a525a1a9ab2fa26b9843ec1409957 Yoga: a7de31c64fe738607e7a3803e3f591a4b1df7393 YogaKit: f782866e155069a2cca2517aafea43200b01fd5a diff --git a/package-lock.json b/package-lock.json index 0b936d2..f2ed624 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-react-native", - "version": "0.2.0", + "version": "0.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -3555,9 +3555,9 @@ } }, "@splitsoftware/splitio-commons": { - "version": "1.2.1-rc.11", - "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.2.1-rc.11.tgz", - "integrity": "sha512-kiba0u5Fnn9O+MBKhM140KnVm7zsY77sIyBrTodOo2EKNHTw8p88eBPnLiR5rRyurQ8AJpMosdrlRphGuQLMYQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@splitsoftware/splitio-commons/-/splitio-commons-1.3.0.tgz", + "integrity": "sha512-jwthiLCgN4DOiLjxn7RIGoEArTonpLUMcHgKMhka1rIzu9R8z+4qkvYPC+Eb5zLK/EIBViyf+sZJFUmBny3Ckw==", "requires": { "tslib": "^2.3.1" }, diff --git a/package.json b/package.json index ee7ee02..2359463 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/splitio-react-native", - "version": "0.2.0", + "version": "0.3.0", "description": "Split SDK for React Native", "main": "lib/commonjs/index.js", "module": "lib/module/index.js", @@ -54,7 +54,7 @@ }, "homepage": "https://github.com/splitio/react-native-client#readme", "dependencies": { - "@splitsoftware/splitio-commons": "1.2.1-rc.11" + "@splitsoftware/splitio-commons": "1.3.0" }, "devDependencies": { "@react-native-community/eslint-config": "^2.0.0", diff --git a/src/platform/getModules.ts b/src/platform/getModules.ts index 76650af..816ba5f 100644 --- a/src/platform/getModules.ts +++ b/src/platform/getModules.ts @@ -11,7 +11,7 @@ import { shouldAddPt } from '@splitsoftware/splitio-commons/src/trackers/impress import { ISdkFactoryParams } from '@splitsoftware/splitio-commons/src/sdkFactory/types'; import { ISettings } from '@splitsoftware/splitio-commons/src/types'; import { LOCALHOST_MODE } from '@splitsoftware/splitio-commons/src/utils/constants'; -import { userConsentProps } from '@splitsoftware/splitio-commons/src/sdkFactory/userConsentProps'; +import { createUserConsentAPI } from '@splitsoftware/splitio-commons/src/consent/sdkUserConsent'; import { RNSignalListener } from './RNSignalListener'; import { getEventSource } from './getEventSource'; @@ -47,7 +47,11 @@ export function getModules(settings: ISettings): ISdkFactoryParams { impressionsObserverFactory: shouldAddPt(settings) ? impressionObserverCSFactory : undefined, - extraProps: userConsentProps, + extraProps: (params) => { + return { + UserConsent: createUserConsentAPI(params), + }; + }, }; if (settings.mode === LOCALHOST_MODE) { diff --git a/src/settings/defaults.ts b/src/settings/defaults.ts index 1419a4a..bab6e9e 100644 --- a/src/settings/defaults.ts +++ b/src/settings/defaults.ts @@ -1,7 +1,7 @@ import { ConsentStatus } from '@splitsoftware/splitio-commons/src/types'; import { CONSENT_GRANTED } from '@splitsoftware/splitio-commons/src/utils/constants'; -const packageVersion = '0.2.0'; +const packageVersion = '0.3.0'; export const defaults = { startup: { diff --git a/types/splitio.d.ts b/types/splitio.d.ts index 05e04b2..aa36500 100644 --- a/types/splitio.d.ts +++ b/types/splitio.d.ts @@ -117,7 +117,38 @@ interface ILoggerAPI { * Log level constants. Use this to pass them to setLogLevel function. */ LogLevel: { - [level: string]: LogLevel + [level in LogLevel]: LogLevel + } +} +/** + * User consent API + * @interface IUserConsentAPI + */ +interface IUserConsentAPI { + /** + * Set or update the user consent status. Possible values are `true` and `false`, which represent user consent `'GRANTED'` and `'DECLINED'` respectively. + * - `true ('GRANTED')`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud. + * - `false ('DECLINED')`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud. + * + * NOTE: calling this method updates the user consent at a factory level, affecting all clients of the same factory. + * + * @function setStatus + * @param {boolean} userConsent The user consent status, true for 'GRANTED' and false for 'DECLINED'. + * @returns {boolean} Whether the provided param is a valid value (i.e., a boolean value) or not. + */ + setStatus(userConsent: boolean): boolean; + /** + * Get the user consent status. + * + * @function getStatus + * @returns {ConsentStatus} The user consent status. + */ + getStatus(): SplitIO.ConsentStatus; + /** + * Consent status constants. Use this to compare with the getStatus function result. + */ + Status: { + [status in SplitIO.ConsentStatus]: SplitIO.ConsentStatus } } /** @@ -784,24 +815,10 @@ declare namespace SplitIO { */ manager(): IManager, /** - * Set or update the user consent status. Possible values are `true` and `false`, which represent user consent `'GRANTED'` and `'DECLINED'` respectively. - * - `true ('GRANTED')`: the user has granted consent for tracking events and impressions. The SDK will send them to Split cloud. - * - `false ('DECLINED')`: the user has declined consent for tracking events and impressions. The SDK will not send them to Split cloud. - * - * NOTE: calling this method updates the user consent at a factory level, affecting all clients of the same factory. - * - * @function setUserConsent - * @param {boolean} userConsent The user consent status, true for 'GRANTED' and false for 'DECLINED'. - * @returns {boolean} Whether the provided param is a valid value (i.e., a boolean value) or not. - */ - setUserConsent(userConsent: boolean): boolean; - /** - * Get the user consent status. - * - * @function getUserConsent - * @returns {ConsentStatus} The user consent status. + * User consent API. + * @property UserConsent */ - getUserConsent(): SplitIO.ConsentStatus; + UserConsent: IUserConsentAPI } /**