Skip to content

Commit e4af332

Browse files
author
Emmanuel Zamora
committed
[SDKS-6947][DW] Update public methods splitName param
1 parent 557f2df commit e4af332

8 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/SplitTreatments.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function evaluateFeatureFlags(client: SplitIO.IBrowserClient, lastUpdate: number
1818
}
1919

2020
/**
21-
* SplitTreatments accepts a list of split names and optional attributes. It access the client at SplitContext to
21+
* SplitTreatments accepts a list of feature flag names and optional attributes. It access the client at SplitContext to
2222
* call 'client.getTreatmentsWithConfig()' method, and passes the returned treatments to a child as a function.
2323
*
2424
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#get-treatments-with-configurations}
@@ -28,7 +28,7 @@ class SplitTreatments extends React.Component<ISplitTreatmentsProps> {
2828
private logWarning?: boolean;
2929

3030
// Attaching a memoized `client.getTreatmentsWithConfig` function to the component instance, to avoid duplicated impressions because
31-
// the function result is the same given the same `client` instance, `lastUpdate` timestamp, and list of split `names` and `attributes`.
31+
// the function result is the same given the same `client` instance, `lastUpdate` timestamp, and list of feature flag `names` and `attributes`.
3232
private evaluateFeatureFlags = memoizeOne(evaluateFeatureFlags, argsAreEqual);
3333

3434
render() {

src/constants.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ export const CONTROL_WITH_CONFIG: SplitIO.TreatmentWithConfig = {
1515
config: null,
1616
};
1717

18-
export const getControlTreatmentsWithConfig = (splitNames: unknown): SplitIO.TreatmentsWithConfig => {
18+
export const getControlTreatmentsWithConfig = (featureFlagNames: unknown): SplitIO.TreatmentsWithConfig => {
1919
// validate featureFlags Names
20-
const validatedFeatureFlagNames = validateFeatureFlags(splitNames);
20+
const validatedFeatureFlagNames = validateFeatureFlags(featureFlagNames);
2121

2222
// return empty object if the returned value is false
2323
if (!validatedFeatureFlagNames) return {};
2424

25-
// return control treatments for each validated split name
25+
// return control treatments for each validated feature flag name
2626
return validatedFeatureFlagNames.reduce((pValue: SplitIO.TreatmentsWithConfig, cValue: string) => {
2727
pValue[cValue] = CONTROL_WITH_CONFIG;
2828
return pValue;

src/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export interface ISplitFactoryProps extends IUpdateProps {
117117
factory?: SplitIO.IBrowserSDK;
118118

119119
/**
120-
* An object of type Attributes used to evaluate the splits.
120+
* An object of type Attributes used to evaluate the feature flags.
121121
*/
122122
attributes?: SplitIO.Attributes;
123123

@@ -185,7 +185,7 @@ export interface ISplitTreatmentsChildProps extends ISplitContextValues {
185185
export interface ISplitTreatmentsProps {
186186

187187
/**
188-
* list of Split names
188+
* list of feature flag names
189189
*/
190190
names: string[];
191191

src/useTreatments.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import { checkHooks, IClientWithContext } from './utils';
1010
* @return A TreatmentsWithConfig instance, that might contain control treatments if the client is not available or ready, or if split names do not exist.
1111
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#get-treatments-with-configurations}
1212
*/
13-
const useTreatments = (splitNames: string[], attributes?: SplitIO.Attributes, key?: SplitIO.SplitKey): SplitIO.TreatmentsWithConfig => {
13+
const useTreatments = (featureFlagNames: string[], attributes?: SplitIO.Attributes, key?: SplitIO.SplitKey): SplitIO.TreatmentsWithConfig => {
1414
const client = checkHooks(ERROR_UT_NO_USECONTEXT) ? useClient(key) : null;
1515
return client && (client as IClientWithContext).__getStatus().isOperational ?
16-
client.getTreatmentsWithConfig(splitNames, attributes) :
17-
getControlTreatmentsWithConfig(splitNames);
16+
client.getTreatmentsWithConfig(featureFlagNames, attributes) :
17+
getControlTreatmentsWithConfig(featureFlagNames);
1818
};
1919

2020
export default useTreatments;

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function validateFeatureFlags(maybeFeatureFlags: unknown, listName = 'spl
112112
if (featureFlagName) validatedArray.push(featureFlagName);
113113
});
114114

115-
// Strip off duplicated values if we have valid split names then return
115+
// Strip off duplicated values if we have valid feature flag names then return
116116
if (validatedArray.length) return uniq(validatedArray);
117117
}
118118

src/withSplitTreatments.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import SplitTreatments from './SplitTreatments';
77
* The wrapped component receives all the props of the container,
88
* along with the passed props from SplitTreatments (see ISplitTreatmentsChildProps).
99
*
10-
* @param names list of Split names
10+
* @param names list of feature flag names
1111
* @param attributes An object of type Attributes used to evaluate the splits.
1212
*/
1313
function withSplitTreatments(names: string[], attributes?: SplitIO.Attributes) {

types/SplitTreatments.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import { ISplitTreatmentsProps } from './types';
77
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#get-treatments-with-configurations}
88
*/
99
declare class SplitTreatments extends React.Component<ISplitTreatmentsProps> {
10-
private logWarning?;
11-
private evaluateSplits;
12-
render(): JSX.Element;
13-
componentDidMount(): void;
10+
private logWarning?;
11+
private evaluateFeatureFlags;
12+
render(): JSX.Element;
13+
componentDidMount(): void;
1414
}
1515
export default SplitTreatments;

types/utils.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export declare function getStatus(client: SplitIO.IBrowserClient | null): IClien
3636
* @returns boolean indicating if React.useContext is available
3737
*/
3838
export declare function checkHooks(message: string): boolean;
39-
export declare function validateFeatureFlags(maybeFeatureFlag: unknown, listName?: string): false | string[];
39+
export declare function validateFeatureFlags(maybeFeatureFlags: unknown, listName?: string): false | string[];
4040
/**
4141
* Manage client attributes binding
4242
*/

0 commit comments

Comments
 (0)