-
Notifications
You must be signed in to change notification settings - Fork 36
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested some changes.
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 {} }), |
There was a problem hiding this comment.
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?
Zeeshan took over this PR as the author
Summary
Implemented getFeatureVariableJson, getFeatureVariable and getAllFeatureVariables wrappers of JS SDK
Deprecated in Readme
Test plan
Added unit tests for getFeatureVariableJson, getFeatureVariable and getAllFeatureVariables