feat(browser-sdk/react-sdk/vue-sdk): end user opt in sdk - #689
Merged
Merged
Conversation
roncohen
marked this pull request as ready for review
August 3, 2026 12:24
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces end-user opt-in support across the Browser SDK, plus React/Vue convenience hooks/composables and documentation so applications can list opt-in-enabled flags and toggle opt-in membership for the current user or company.
Changes:
- Add Browser SDK APIs/types for opt-in (
getOptInFlags,setOptIn,OptInFlag,SetOptInOptions) and persist/parse opt-in metadata from evaluated flags. - Add React hooks (
useOptInFlags,useSetOptIn) and Vue composables (useOptInFlags,useSetOptIn) with corresponding usage tests. - Improve Browser SDK flag refresh concurrency handling/rate limiting and add regression tests for out-of-order refreshes/context changes.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/vue-sdk/test/usage.test.ts | Adds Vue tests covering opt-in composables behavior and delegation. |
| packages/vue-sdk/src/index.ts | Re-exports new opt-in composables and opt-in related types. |
| packages/vue-sdk/src/hooks.ts | Implements useOptInFlags and useSetOptIn composables. |
| packages/vue-sdk/README.md | Documents Vue opt-in composables with an example UI pattern. |
| packages/react-sdk/test/usage.test.tsx | Adds React hook tests for opt-in listing/updates and setOptIn delegation. |
| packages/react-sdk/src/index.tsx | Implements and exports React opt-in hooks and re-exports opt-in types. |
| packages/react-sdk/README.md | Documents React opt-in hooks with example usage and semantics. |
| packages/browser-sdk/test/flags.test.ts | Adds tests for opt-in parsing and refresh concurrency/rate limiting; imports validateFlagsResponse. |
| packages/browser-sdk/test/deferred.ts | Introduces a small deferred helper used by concurrency tests. |
| packages/browser-sdk/test/client.test.ts | Adds end-to-end tests for opt-in flows and related state/concurrency behavior. |
| packages/browser-sdk/src/index.ts | Exports new opt-in-related types from the Browser SDK entrypoint. |
| packages/browser-sdk/src/flag/flags.ts | Adds opt-in flag types and improves refresh behavior for concurrent/out-of-order responses. |
| packages/browser-sdk/src/flag/flagCache.ts | Extends API flag parsing to include opt-in metadata from responses/cached values. |
| packages/browser-sdk/src/client.ts | Implements getOptInFlags and setOptIn, plus context-loading finalization for superseded updates. |
| packages/browser-sdk/README.md | Documents Browser SDK opt-in API usage and expected semantics. |
| .changeset/end-user-opt-in-sdk.md | Publishes minor versions for browser/react/vue SDKs for this feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add end-user opt-in helpers for listing opt-in-enabled flags and setting whether the current user or company has opted into a flag.