-
Notifications
You must be signed in to change notification settings - Fork 1
feat: make toolbar compatible with js client sdk v4 #459
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
Open
joker23
wants to merge
12
commits into
main
Choose a base branch
from
skz/sdk-1565/update-browser-sdk
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1da3eda
chore(deps): update LaunchDarkly SDK to @launchdarkly/js-client-sdk@0…
joker23 3b55316
refactor(tests): update imports to use @launchdarkly/js-client-sdk
joker23 fb4db14
chore: update test and script references
joker23 cfd0f65
refactor: adding new compat interfaces
joker23 20a9407
styles: fix lint issues
joker23 9af8a58
fix: intellisense for plugin compat
joker23 99ee833
test: adding tests for handling v4 change payload
joker23 306b443
chore: update browser sdk again
joker23 172e3eb
docs: adding comments on how the change handler is adapting the payload
joker23 a414987
Update packages/toolbar/src/core/ui/Toolbar/context/FlagSdkOverridePr…
joker23 86367e7
fix: typing to align with browser sdk v4
joker23 55c2016
chore: update js-client-sdk to GA version
joker23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
2 changes: 1 addition & 1 deletion
2
packages/toolbar/src/core/ui/Toolbar/components/new/Contexts/AddContextForm.tsx
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
2 changes: 1 addition & 1 deletion
2
packages/toolbar/src/core/ui/Toolbar/components/new/Contexts/ContextItem.tsx
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
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
2 changes: 1 addition & 1 deletion
2
packages/toolbar/src/core/ui/Toolbar/context/api/ContextsProvider.tsx
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import { LDFlagSet, LDPluginEnvironmentMetadata } from 'launchdarkly-js-client-sdk'; | ||
| import { LDIdentifyResult, Hook } from '@launchdarkly/js-client-sdk'; | ||
|
|
||
| /** | ||
| * LDClient based on the LDClient type in the SDK package with | ||
| * a narrower structure to ensure that they can be used by | ||
| * our plugins. | ||
| */ | ||
| export interface LDClient { | ||
| track(key: string, data?: any, metricValue?: number): void; | ||
| identify(ctx: any): Promise<LDIdentifyResult> | Promise<LDFlagSet> | Promise<void>; | ||
| addHook(hook: Hook): void; | ||
| getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[]; | ||
| allFlags(): LDFlagSet; | ||
| getContext(): any; | ||
|
pranjal-jately-ld marked this conversation as resolved.
|
||
| on(key: string, callback: (...args: any[]) => void): void; | ||
| off(key: string, callback: (...args: any[]) => void): void; | ||
| flush(): void; | ||
| } | ||
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
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.
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.
We can use the
LDContexttype here.Uh oh!
There was an error while loading. Please reload this page.
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.
The problem with using
LDContextdirectly here is that it conflicts with the type definition inlaunchdarkly-react-client-sdkwhich is very old at this point... structurally, it is hard to compatlaunchdarkly-react-client-sdk,launchdarkly-js-client-sdkand@launchdarkly/react-client-sdkwhich is why I put the compat client to accept any... we can probably still maintain type safety if we narrow the context when it is being used?We are looking at updating the React SDK soon so it should be more compatible in the future.
I don't think this suggestion will build.