Skip to content

Commit 35133be

Browse files
authored
Merge pull request #136 from splitio/SDKS-6947
[SDKS-6947][DW] Update public methods splitName param
2 parents eb020a7 + b3fdf38 commit 35133be

12 files changed

Lines changed: 22 additions & 22 deletions

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/constants.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export declare const ON: SplitIO.Treatment;
33
export declare const OFF: SplitIO.Treatment;
44
export declare const CONTROL: SplitIO.Treatment;
55
export declare const CONTROL_WITH_CONFIG: SplitIO.TreatmentWithConfig;
6-
export declare const getControlTreatmentsWithConfig: (splitNames: unknown) => SplitIO.TreatmentsWithConfig;
6+
export declare const getControlTreatmentsWithConfig: (featureFlagNames: unknown) => SplitIO.TreatmentsWithConfig;
77
export declare const WARN_SF_CONFIG_AND_FACTORY: string;
88
export declare const ERROR_SF_NO_CONFIG_AND_FACTORY: string;
99
export declare const ERROR_SC_NO_FACTORY: string;

types/types.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export interface ISplitFactoryProps extends IUpdateProps {
9797
*/
9898
factory?: SplitIO.IBrowserSDK;
9999
/**
100-
* An object of type Attributes used to evaluate the splits.
100+
* An object of type Attributes used to evaluate the feature flags.
101101
*/
102102
attributes?: SplitIO.Attributes;
103103
/**
@@ -153,7 +153,7 @@ export interface ISplitTreatmentsChildProps extends ISplitContextValues {
153153
*/
154154
export interface ISplitTreatmentsProps {
155155
/**
156-
* list of Split names
156+
* list of feature flag names
157157
*/
158158
names: string[];
159159
/**

types/useTreatments.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
* @return A TreatmentsWithConfig instance, that might contain control treatments if the client is not available or ready, or if split names do not exist.
77
* @see {@link https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK#get-treatments-with-configurations}
88
*/
9-
declare const useTreatments: (splitNames: string[], attributes?: import("@splitsoftware/splitio/types/splitio").Attributes | undefined, key?: import("@splitsoftware/splitio/types/splitio").SplitKey | undefined) => SplitIO.TreatmentsWithConfig;
9+
declare const useTreatments: (featureFlagNames: string[], attributes?: import("@splitsoftware/splitio/types/splitio").Attributes | undefined, key?: import("@splitsoftware/splitio/types/splitio").SplitKey | undefined) => SplitIO.TreatmentsWithConfig;
1010
export default useTreatments;

0 commit comments

Comments
 (0)