diff --git a/CHANGES.txt b/CHANGES.txt index 8bf471e..2c3e67c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -30,7 +30,7 @@ - Updated submitters logic, to avoid duplicating the post of impressions to Split cloud when the SDK is destroyed while its periodic post of impressions is running. 1.5.0 (June 13, 2022) - - Bugfixing - Fixed issue with useTreatments hooks, to return control treatments without evaluating splits when the SDK client is not ready or is destroyed, to avoid not ready impressions and warning log. + - Bugfixing - Fixed issue with useTreatments hooks, to return control treatments without evaluating feature flags when the SDK client is not ready or is destroyed, to avoid not ready impressions and warning log. - Updated @splitsoftware/splitio dependency to version 10.19.1, which includes: - Added `scheduler.telemetryRefreshRate` property to SDK configuration, and deprecated `scheduler.metricsRefreshRate` property. - Updated SDK telemetry storage, metrics and updater to be more effective and send less often. @@ -74,15 +74,15 @@ 1.2.3 (February 8, 2021) - Updated React peer dependency range to include React@17.x.x. - Added `memoize-one` dependency for basic memoization utilities. - - Bugfixing - Optimizing splits evaluation via memoization in order to remove `shouldComponentUpdate` method of `SplitTreatments` component and avoid stopping render propagation (issue #42). + - Bugfixing - Optimizing feature flags evaluation via memoization in order to remove `shouldComponentUpdate` method of `SplitTreatments` component and avoid stopping render propagation (issue #42). 1.2.2 (December 15, 2020) - Updated @splitsoftware/splitio dependency to version 10.15.2. - - Updated internal validation to avoid errors when passing an invalid list of split names to `SplitTreatments` component and `useTreatments` hook. + - Updated internal validation to avoid errors when passing an invalid list of feature flag names to `SplitTreatments` component and `useTreatments` hook. - Updated node-fetch and init dev dependencies for vulnerability fixes 1.2.1 (Oct 7, 2020) - - Updated @splitsoftware/splitio dependency to version 10.15.0, which uses the optimized impressions sending and supports filtering the splits to be synced. Learn more in our javascript-client changelog or documentation. + - Updated @splitsoftware/splitio dependency to version 10.15.0, which uses the optimized impressions sending and supports filtering the feature flags to be synced. Learn more in our javascript-client changelog or documentation. - Updated some NPM dependencies mostly for vulnerability fixes. 1.2.0 (July 23, 2020) diff --git a/README.md b/README.md index 417f293..2b1da09 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![npm version](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-react.svg)](https://badge.fury.io/js/%40splitsoftware%2Fsplitio-react) [![Build Status](https://github.com/splitio/react-client/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/splitio/react-client/actions/workflows/ci-cd.yml) ## Overview -This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via a Split feature flag to manage your complete customer experience. +This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via feature flag to manage your complete customer experience. [![Twitter Follow](https://img.shields.io/twitter/follow/splitsoftware.svg?style=social&label=Follow&maxAge=1529000)](https://twitter.com/intent/follow?screen_name=splitsoftware) @@ -25,7 +25,7 @@ import { SplitFactory, SplitTreatments } from '@splitsoftware/splitio-react'; // Define your config object const CONFIG = { core: { - authorizationKey: 'YOUR_BROWSER_API_KEY', + authorizationKey: 'YOUR_BROWSER_SDK_KEY', key: 'CUSTOMER_ID' } }; diff --git a/src/__tests__/SplitTreatments.test.tsx b/src/__tests__/SplitTreatments.test.tsx index 3ef0354..9aecb1e 100644 --- a/src/__tests__/SplitTreatments.test.tsx +++ b/src/__tests__/SplitTreatments.test.tsx @@ -95,7 +95,7 @@ describe('SplitTreatments', () => { }); /** - * Input validation. Passing invalid split names or attributes while the Sdk + * Input validation. Passing invalid feature flag names or attributes while the Sdk * is not ready doesn't emit errors, and logs meaningful messages instead. */ it('Input validation: invalid "names" and "attributes" props in SplitTreatments.', (done) => { @@ -214,7 +214,7 @@ describe('SplitTreatments optimization', () => { expect(renderTimes).toBe(2); expect(outerFactory.client().getTreatmentsWithConfig).toBeCalledTimes(2); - // If passing same reference but mutated (bad practice), the component re-renders but doesn't re-evaluate splits + // If passing same reference but mutated (bad practice), the component re-renders but doesn't re-evaluate feature flags attributesRef.att2 = 'att2_val2'; wrapper.rerender(); expect(renderTimes).toBe(3); diff --git a/src/__tests__/testUtils/sdkConfigs.ts b/src/__tests__/testUtils/sdkConfigs.ts index d9693da..a3421a5 100644 --- a/src/__tests__/testUtils/sdkConfigs.ts +++ b/src/__tests__/testUtils/sdkConfigs.ts @@ -2,7 +2,7 @@ import SplitIO from '@splitsoftware/splitio/types/splitio'; export const sdkBrowser: SplitIO.IBrowserSettings = { core: { - authorizationKey: 'api-key', + authorizationKey: 'sdk-key', key: 'customer-key', }, }; diff --git a/src/types.ts b/src/types.ts index bd2872d..d716fb7 100644 --- a/src/types.ts +++ b/src/types.ts @@ -152,7 +152,7 @@ export interface ISplitClientProps extends IUpdateProps { trafficType?: string; /** - * An object of type Attributes used to evaluate the splits. + * An object of type Attributes used to evaluate the feature flags. */ attributes?: SplitIO.Attributes; @@ -168,8 +168,8 @@ export interface ISplitClientProps extends IUpdateProps { export interface ISplitTreatmentsChildProps extends ISplitContextValues { /** - * An object with the treatments with configs for a bulk of splits, returned by client.getTreatmentsWithConfig(). - * Each existing configuration is a stringified version of the JSON you defined on the Split web console. For example: + * An object with the treatments with configs for a bulk of feature flags, returned by client.getTreatmentsWithConfig(). + * Each existing configuration is a stringified version of the JSON you defined on the Split user interface. For example: * { * split1: { treatment: 'on', config: null } * split2: { treatment: 'off', config: '{"bannerText":"Click here."}' } @@ -190,7 +190,7 @@ export interface ISplitTreatmentsProps { names: string[]; /** - * An object of type Attributes used to evaluate the splits. + * An object of type Attributes used to evaluate the feature flags. */ attributes?: SplitIO.Attributes; diff --git a/src/useTreatments.ts b/src/useTreatments.ts index d2a73ea..55373ec 100644 --- a/src/useTreatments.ts +++ b/src/useTreatments.ts @@ -7,7 +7,7 @@ import { checkHooks, IClientWithContext } from './utils'; * It uses the 'useContext' hook to access the client from the Split context, * and invokes the 'getTreatmentsWithConfig' method. * - * @return A TreatmentsWithConfig instance, that might contain control treatments if the client is not available or ready, or if split names do not exist. + * @return A TreatmentsWithConfig instance, that might contain control treatments if the client is not available or ready, or if feature flag names do not exist. * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#get-treatments-with-configurations} */ const useTreatments = (featureFlagNames: string[], attributes?: SplitIO.Attributes, key?: SplitIO.SplitKey): SplitIO.TreatmentsWithConfig => { diff --git a/src/withSplitTreatments.tsx b/src/withSplitTreatments.tsx index ac2f796..4ec0c0d 100644 --- a/src/withSplitTreatments.tsx +++ b/src/withSplitTreatments.tsx @@ -8,7 +8,7 @@ import SplitTreatments from './SplitTreatments'; * along with the passed props from SplitTreatments (see ISplitTreatmentsChildProps). * * @param names list of feature flag names - * @param attributes An object of type Attributes used to evaluate the splits. + * @param attributes An object of type Attributes used to evaluate the feature flags. */ function withSplitTreatments(names: string[], attributes?: SplitIO.Attributes) { diff --git a/types/SplitTreatments.d.ts b/types/SplitTreatments.d.ts index c430419..8b1b59d 100644 --- a/types/SplitTreatments.d.ts +++ b/types/SplitTreatments.d.ts @@ -1,7 +1,7 @@ import React from 'react'; import { ISplitTreatmentsProps } from './types'; /** - * SplitTreatments accepts a list of split names and optional attributes. It access the client at SplitContext to + * SplitTreatments accepts a list of feature flag names and optional attributes. It access the client at SplitContext to * call 'client.getTreatmentsWithConfig()' method, and passes the returned treatments to a child as a function. * * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#get-treatments-with-configurations} diff --git a/types/types.d.ts b/types/types.d.ts index e4bfdd0..4bcef48 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -125,7 +125,7 @@ export interface ISplitClientProps extends IUpdateProps { */ trafficType?: string; /** - * An object of type Attributes used to evaluate the splits. + * An object of type Attributes used to evaluate the feature flags. */ attributes?: SplitIO.Attributes; /** @@ -138,8 +138,8 @@ export interface ISplitClientProps extends IUpdateProps { */ export interface ISplitTreatmentsChildProps extends ISplitContextValues { /** - * An object with the treatments with configs for a bulk of splits, returned by client.getTreatmentsWithConfig(). - * Each existing configuration is a stringified version of the JSON you defined on the Split web console. For example: + * An object with the treatments with configs for a bulk of feature flags, returned by client.getTreatmentsWithConfig(). + * Each existing configuration is a stringified version of the JSON you defined on the Split user interface. For example: * { * split1: { treatment: 'on', config: null } * split2: { treatment: 'off', config: '{"bannerText":"Click here."}' } @@ -157,7 +157,7 @@ export interface ISplitTreatmentsProps { */ names: string[]; /** - * An object of type Attributes used to evaluate the splits. + * An object of type Attributes used to evaluate the feature flags. */ attributes?: SplitIO.Attributes; /** diff --git a/types/useTreatments.d.ts b/types/useTreatments.d.ts index 05e1c50..fc6f28c 100644 --- a/types/useTreatments.d.ts +++ b/types/useTreatments.d.ts @@ -3,7 +3,7 @@ * It uses the 'useContext' hook to access the client from the Split context, * and invokes the 'getTreatmentsWithConfig' method. * - * @return A TreatmentsWithConfig instance, that might contain control treatments if the client is not available or ready, or if split names do not exist. + * @return A TreatmentsWithConfig instance, that might contain control treatments if the client is not available or ready, or if feature flag names do not exist. * @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#get-treatments-with-configurations} */ declare const useTreatments: (featureFlagNames: string[], attributes?: import("@splitsoftware/splitio/types/splitio").Attributes | undefined, key?: import("@splitsoftware/splitio/types/splitio").SplitKey | undefined) => SplitIO.TreatmentsWithConfig; diff --git a/types/withSplitTreatments.d.ts b/types/withSplitTreatments.d.ts index 674e5fd..cc51c49 100644 --- a/types/withSplitTreatments.d.ts +++ b/types/withSplitTreatments.d.ts @@ -6,7 +6,7 @@ import { ISplitTreatmentsChildProps } from './types'; * along with the passed props from SplitTreatments (see ISplitTreatmentsChildProps). * * @param names list of feature flag names - * @param attributes An object of type Attributes used to evaluate the splits. + * @param attributes An object of type Attributes used to evaluate the feature flags. */ declare function withSplitTreatments(names: string[], attributes?: SplitIO.Attributes): (WrappedComponent: React.ComponentType) => (props: OuterProps) => JSX.Element; export default withSplitTreatments;