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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This SDK is designed to work with Split, the platform for controlled rollouts, w

This SDK is compatible with React 16.3.0 and above, since it uses [React Context API](https://reactjs.org/docs/context.html).

Some features, such as `useClient` and `useManager`, use [React Hooks API](https://reactjs.org/docs/hooks-overview.html) that requires React 16.8.0 or later.
Some features, such as `useSplitClient` and `useSplitTreatments`, use [React Hooks API](https://reactjs.org/docs/hooks-overview.html) that requires React 16.8.0 or later.

## Getting started
Below is a simple example that describes the instantiation and most basic usage of our SDK:
Expand Down
5 changes: 4 additions & 1 deletion src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
useSplitTreatments as exportedUseSplitTreatments,
useSplitManager as exportedUseSplitManager,
// Checks that types are exported. Otherwise, the test would fail with a TS error.
GetTreatmentsOptions,
ISplitClientChildProps,
ISplitClientProps,
ISplitContextValues,
Expand All @@ -24,7 +25,9 @@ import {
ISplitStatus,
ISplitTreatmentsChildProps,
ISplitTreatmentsProps,
IUpdateProps
IUpdateProps,
IUseSplitClientOptions,
IUseSplitTreatmentsOptions,
} from '../index';
import { SplitContext } from '../SplitContext';
import { SplitFactory as SplitioEntrypoint } from '@splitsoftware/splitio/client';
Expand Down
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export { SplitContext } from './SplitContext';

// Types
export type {
GetTreatmentsOptions,
ISplitClientChildProps,
ISplitClientProps,
ISplitContextValues,
Expand All @@ -33,5 +34,7 @@ export type {
ISplitStatus,
ISplitTreatmentsChildProps,
ISplitTreatmentsProps,
IUpdateProps
IUpdateProps,
IUseSplitClientOptions,
IUseSplitTreatmentsOptions,
} from './types';
13 changes: 8 additions & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ export type GetTreatmentsOptions = ({
}

/**
* useSplitTreatments options interface. This is the options object accepted by useSplitTreatments hook,
* used to call 'client.getTreatmentsWithConfig()', or 'client.getTreatmentsWithConfigByFlagSets()', and retrieve the result together with the Split context.
* useSplitTreatments options interface. This is the options object accepted by useSplitTreatments hook, used to call 'client.getTreatmentsWithConfig()', or 'client.getTreatmentsWithConfigByFlagSets()',
* depending on whether `names` or `flagSets` options are provided, and to retrieve the result along with the Split context.
*/
export type IUseSplitTreatmentsOptions = GetTreatmentsOptions & IUseSplitClientOptions;

Expand All @@ -206,17 +206,20 @@ export interface ISplitTreatmentsChildProps extends ISplitContextValues {
/**
* 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:
*
* ```js
* {
* feature1: { treatment: 'on', config: null }
* feature1: { treatment: 'on', config: null },
* feature2: { treatment: 'off', config: '{"bannerText":"Click here."}' }
* }
* ```
*/
treatments: SplitIO.TreatmentsWithConfig;
}

/**
* SplitTreatments Props interface. These are the props accepted by SplitTreatments component,
* used to call 'client.getTreatmentsWithConfig()', or 'client.getTreatmentsWithConfigByFlagSets()', and pass the result to the child component.
* SplitTreatments Props interface. These are the props accepted by SplitTreatments component, used to call 'client.getTreatmentsWithConfig()', or 'client.getTreatmentsWithConfigByFlagSets()',
* depending on whether `names` or `flagSets` props are provided, and to pass the result to the child component.
*/
export type ISplitTreatmentsProps = GetTreatmentsOptions & {

Expand Down