Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added getFeatureVariableJson, getFeatureVariable and getAllFeatureVariables #53

Merged
merged 6 commits into from
Jul 8, 2020

Conversation

fayyazarshad
Copy link
Contributor

@fayyazarshad fayyazarshad commented Jul 6, 2020

Summary

Implemented getFeatureVariableJson, getFeatureVariable and getAllFeatureVariables wrappers of JS SDK

Deprecated in Readme
image

Test plan

Added unit tests for getFeatureVariableJson, getFeatureVariable and getAllFeatureVariables

@fayyazarshad fayyazarshad requested a review from zashraf1985 July 6, 2020 07:32
@fayyazarshad fayyazarshad self-assigned this Jul 6, 2020
Copy link
Contributor

@zashraf1985 zashraf1985 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested some changes.

src/client.spec.ts Outdated Show resolved Hide resolved
src/client.spec.ts Show resolved Hide resolved
src/client.ts Outdated Show resolved Hide resolved
src/client.ts Outdated Show resolved Hide resolved
src/client.ts Outdated Show resolved Hide resolved
src/client.ts Show resolved Hide resolved
src/client.ts Outdated Show resolved Hide resolved
src/client.ts Show resolved Hide resolved
@zashraf1985 zashraf1985 marked this pull request as ready for review July 7, 2020 01:22
Copy link
Contributor

@mjc1283 mjc1283 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Please update deprecation message in README documentation with correct version before merging.

README.md Outdated
@@ -484,7 +484,7 @@ The following type definitions are used in the `ReactSDKClient` interface:
- `onUserUpdate(handler: (userInfo: User) => void): () => void` Subscribe a callback to be called when this instance's current user changes. Returns a function that will unsubscribe the callback.
- `activate(experimentKey: string, overrideUserId?: string, overrideAttributes?: UserAttributes): string | null` Activate an experiment, and return the variation for the given user.
- `getVariation(experimentKey: string, overrideUserId?: string, overrideAttributes?: UserAttributes): string | null` Return the variation for the given experiment and user.
- `getFeatureVariables(featureKey: string, overrideUserId?: string, overrideAttributes?: UserAttributes): VariableValuesObject`: Decide and return variable values for the given feature and user
- `getFeatureVariables(featureKey: string, overrideUserId?: string, overrideAttributes?: UserAttributes): VariableValuesObject`: Decide and return variable values for the given feature and user <br /> <b>Warning:</b> Deprecated since 2.0.1 <br /> `getAllFeatureVariables` is added in JavaScript SDK which is similarly returning all the feature variables, but it sends only single notification of type `all-feature-variables` instead of sending for each variable. As `getFeatureVariables` was added when this functionality wasn't provided by `JavaScript SDK`, so there is no need of it now and it would be removed in next major release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be Deprecated since 2.1.0. This release will be 2.1.0.

@@ -38,6 +38,9 @@ describe('ReactSDKClient', () => {
getForcedVariation: jest.fn(() => null),
getFeatureVariableBoolean: jest.fn(() => null),
getFeatureVariableDouble: jest.fn(() => null),
getFeatureVariableJSON: jest.fn(() => null),
getAllFeatureVariables: jest.fn(() => { return {} }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, interesting that getAllFeatureVariables was not here before. I guess it should be added, but does it affect any test?

@mjc1283 mjc1283 dismissed zashraf1985’s stale review July 8, 2020 21:35

Zeeshan took over this PR as the author

@mjc1283 mjc1283 merged commit 381f54d into master Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants