@launchdarkly/toolbar 2.3.0-beta.1 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +255 -19
- package/cdn/toolbar.min.js +660 -15
- package/cdn/toolbar.min.js.LICENSE.txt +14 -0
- package/dist/angular/launchdarkly-toolbar.service.d.ts +104 -0
- package/dist/angular.cjs +439 -0
- package/dist/angular.cjs.map +1 -0
- package/dist/angular.d.ts +51 -0
- package/dist/core/index.d.ts +0 -1
- package/dist/core/services/DevServerClient.d.ts +9 -3
- package/dist/core/services/FlagStateManager.d.ts +2 -0
- package/dist/core/styles/constants.d.ts +24 -0
- package/dist/core/styles/index.d.ts +2 -0
- package/dist/core/styles/shadowDomStyles.d.ts +41 -0
- package/dist/core/tests/mocks/providers.d.ts +132 -0
- package/dist/core/ui/Buttons/IconButton.d.ts +2 -1
- package/dist/core/ui/JsonEditor/JsonEditor.d.ts +2 -1
- package/dist/core/ui/Toolbar/LaunchDarklyToolbar.d.ts +2 -8
- package/dist/core/ui/Toolbar/components/AuthenticationModal/AuthenticationModal.d.ts +1 -1
- package/dist/core/ui/Toolbar/components/CircleLogo.d.ts +1 -2
- package/dist/core/ui/Toolbar/components/{FlagKeyWithCopy.css.d.ts → CopyableText.css.d.ts} +1 -1
- package/dist/core/ui/Toolbar/components/CopyableText.d.ts +18 -0
- package/dist/core/ui/Toolbar/components/FilterOptions/FilterOptions.css.d.ts +1 -0
- package/dist/core/ui/Toolbar/components/FilterOptions/FilterOptions.d.ts +1 -0
- package/dist/core/ui/Toolbar/components/FilterOptions/ShareUrlButton.css.d.ts +2 -0
- package/dist/core/ui/Toolbar/components/FilterOptions/ShareUrlButton.d.ts +7 -0
- package/dist/core/ui/Toolbar/components/IFrameErrorScreen/IFrameErrorScreen.css.d.ts +7 -0
- package/dist/core/ui/Toolbar/components/IFrameErrorScreen/IFrameErrorScreen.d.ts +5 -0
- package/dist/core/ui/Toolbar/components/IFrameErrorScreen/index.d.ts +1 -0
- package/dist/core/ui/Toolbar/components/LoadingScreen/LoadingScreen.css.d.ts +7 -0
- package/dist/core/ui/Toolbar/components/LoadingScreen/LoadingScreen.d.ts +5 -0
- package/dist/core/ui/Toolbar/components/LoadingScreen/index.d.ts +1 -0
- package/dist/core/ui/Toolbar/components/ShareStatePopover/ShareStatePopover.css.d.ts +10 -0
- package/dist/core/ui/Toolbar/components/ShareStatePopover/ShareStatePopover.d.ts +15 -0
- package/dist/core/ui/Toolbar/components/ShareStatePopover/index.d.ts +2 -0
- package/dist/core/ui/Toolbar/components/icons/ShareIcon.d.ts +5 -0
- package/dist/core/ui/Toolbar/components/icons/index.d.ts +2 -0
- package/dist/core/ui/Toolbar/components/index.d.ts +1 -2
- package/dist/core/ui/Toolbar/components/new/AnalyticsConsentToast/AnalyticsConsentToast.d.ts +5 -0
- package/dist/core/ui/Toolbar/components/new/AnalyticsConsentToast/AnalyticsConsentToast.module.css.d.ts +13 -0
- package/dist/core/ui/Toolbar/components/new/AnalyticsConsentToast/index.d.ts +1 -0
- package/dist/core/ui/Toolbar/components/new/ContentActions.module.css.d.ts +4 -0
- package/dist/core/ui/Toolbar/components/new/Contexts/AddContextForm.d.ts +6 -0
- package/dist/core/ui/Toolbar/components/new/Contexts/AddContextForm.module.css.d.ts +14 -0
- package/dist/core/ui/Toolbar/components/new/Contexts/ContextItem.d.ts +9 -0
- package/dist/core/ui/Toolbar/components/new/Contexts/ContextItem.module.css.d.ts +19 -0
- package/dist/core/ui/Toolbar/components/new/Contexts/ContextList.d.ts +1 -0
- package/dist/core/ui/Toolbar/components/new/Contexts/ContextList.module.css.d.ts +8 -0
- package/dist/core/ui/Toolbar/components/new/Contexts/ContextListContent.d.ts +1 -0
- package/dist/core/ui/Toolbar/components/new/Contexts/index.d.ts +4 -0
- package/dist/core/ui/Toolbar/components/new/ExpandedToolbarContent.d.ts +4 -3
- package/dist/core/ui/Toolbar/components/new/FeatureFlags/FlagControls.d.ts +5 -5
- package/dist/core/ui/Toolbar/components/new/FeatureFlags/FlagItem.d.ts +2 -1
- package/dist/core/ui/Toolbar/components/new/FeatureFlags/FlagListContent.d.ts +1 -1
- package/dist/core/ui/Toolbar/components/new/FilterOverlay/FilterOverlay.module.css.d.ts +1 -0
- package/dist/core/ui/Toolbar/components/new/Settings/Privacy/PrivacySettings.d.ts +1 -0
- package/dist/core/ui/Toolbar/components/new/Settings/SettingsContent.module.css.d.ts +2 -0
- package/dist/core/ui/Toolbar/components/new/Settings/ShareButton.d.ts +5 -0
- package/dist/core/ui/Toolbar/components/new/Settings/ShareButton.module.css.d.ts +1 -0
- package/dist/core/ui/Toolbar/components/new/Settings/index.d.ts +1 -1
- package/dist/core/ui/Toolbar/components/new/Tooltip.d.ts +3 -1
- package/dist/core/ui/Toolbar/components/new/context/TabSearchProvider.d.ts +7 -5
- package/dist/core/ui/Toolbar/components/new/types.d.ts +2 -2
- package/dist/core/ui/Toolbar/constants/animations.d.ts +14 -0
- package/dist/core/ui/Toolbar/context/DevServerProvider.d.ts +2 -0
- package/dist/core/ui/Toolbar/context/api/AuthProvider.d.ts +1 -0
- package/dist/core/ui/Toolbar/context/api/ContextsProvider.d.ts +19 -0
- package/dist/core/ui/Toolbar/context/api/FlagsProvider.d.ts +1 -0
- package/dist/core/ui/Toolbar/context/api/IFrameProvider.d.ts +2 -0
- package/dist/core/ui/Toolbar/context/api/index.d.ts +1 -0
- package/dist/core/ui/Toolbar/context/state/ToolbarStateProvider.d.ts +6 -0
- package/dist/core/ui/Toolbar/context/telemetry/AnalyticsPreferencesProvider.d.ts +14 -0
- package/dist/core/ui/Toolbar/context/telemetry/InternalClientProvider.d.ts +11 -1
- package/dist/core/ui/Toolbar/context/telemetry/TelemetryBundleProvider.d.ts +2 -0
- package/dist/core/ui/Toolbar/context/telemetry/index.d.ts +1 -0
- package/dist/core/ui/Toolbar/hooks/index.d.ts +2 -0
- package/dist/core/ui/Toolbar/hooks/useLocalStorage.d.ts +10 -0
- package/dist/core/ui/Toolbar/hooks/useReducedMotion.d.ts +5 -0
- package/dist/core/ui/Toolbar/hooks/useToolbarAnimations.d.ts +1 -1
- package/dist/core/ui/Toolbar/types/ldApi.d.ts +1 -0
- package/dist/core/ui/Toolbar/types/toolbar.d.ts +1 -1
- package/dist/core/ui/Toolbar/utils/context.d.ts +33 -0
- package/dist/core/ui/Toolbar/utils/localStorage.d.ts +21 -2
- package/dist/core/utils/analytics.d.ts +48 -2
- package/dist/core/utils/feedback.d.ts +18 -0
- package/dist/core/utils/urlOverrides.d.ts +105 -0
- package/dist/flags/toolbarFlags.d.ts +3 -2
- package/dist/index.cjs +8 -4
- package/dist/index.cjs.map +1 -1
- package/dist/js/374.js +446 -0
- package/dist/js/374.js.map +1 -0
- package/dist/js/816.js +56 -0
- package/dist/js/816.js.map +1 -0
- package/dist/js/96.js +38 -0
- package/dist/js/96.js.map +1 -0
- package/dist/js/angular.js +353 -0
- package/dist/js/angular.js.map +1 -0
- package/dist/js/index.js +3 -527
- package/dist/js/index.js.map +1 -1
- package/dist/js/plugins.js +1 -0
- package/dist/js/react.js +2 -0
- package/dist/js/types-entry.js +0 -0
- package/dist/js/vue.js +34 -0
- package/dist/js/vue.js.map +1 -0
- package/dist/plugins.cjs +483 -0
- package/dist/plugins.cjs.map +1 -0
- package/dist/plugins.d.ts +21 -0
- package/dist/react/useLaunchDarklyToolbar.d.ts +1 -1
- package/dist/react.cjs +127 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.ts +25 -0
- package/dist/types-entry.cjs +20 -0
- package/dist/types-entry.cjs.map +1 -0
- package/dist/types-entry.d.ts +12 -0
- package/dist/vue/useLaunchDarklyToolbar.d.ts +20 -0
- package/dist/vue.cjs +122 -0
- package/dist/vue.cjs.map +1 -0
- package/dist/vue.d.ts +24 -0
- package/package.json +145 -48
- package/dist/core/ui/Toolbar/components/FlagKeyWithCopy.d.ts +0 -6
- package/dist/core/ui/Toolbar/components/legacy/ActionButtonsContainer.css.d.ts +0 -4
- package/dist/core/ui/Toolbar/components/legacy/ActionButtonsContainer.d.ts +0 -6
- package/dist/core/ui/Toolbar/components/legacy/ExpandedToolbarContentLegacy.d.ts +0 -25
- package/dist/core/ui/Toolbar/components/legacy/FlagControls.css.d.ts +0 -12
- package/dist/core/ui/Toolbar/components/legacy/FlagControls.d.ts +0 -20
- package/dist/core/ui/Toolbar/components/legacy/Header/Header.css.d.ts +0 -20
- package/dist/core/ui/Toolbar/components/legacy/Header/Header.d.ts +0 -13
- package/dist/core/ui/Toolbar/components/legacy/Header/components/ActionButtons.d.ts +0 -12
- package/dist/core/ui/Toolbar/components/legacy/Header/components/EnvironmentLabel.d.ts +0 -5
- package/dist/core/ui/Toolbar/components/legacy/Header/components/LogoSection.d.ts +0 -6
- package/dist/core/ui/Toolbar/components/legacy/Header/components/SearchSection.d.ts +0 -8
- package/dist/core/ui/Toolbar/components/legacy/Header/components/index.d.ts +0 -4
- package/dist/core/ui/Toolbar/components/legacy/LocalFlagControls.css.d.ts +0 -5
- package/dist/core/ui/Toolbar/components/legacy/LocalFlagControls.d.ts +0 -25
- package/dist/core/ui/Toolbar/components/legacy/LocalObjectFlagControlListItem.css.d.ts +0 -4
- package/dist/core/ui/Toolbar/components/legacy/LocalObjectFlagControlListItem.d.ts +0 -13
- package/dist/core/ui/Toolbar/components/legacy/TabContent/EventsTabContent.css.d.ts +0 -24
- package/dist/core/ui/Toolbar/components/legacy/TabContent/EventsTabContent.d.ts +0 -7
- package/dist/core/ui/Toolbar/components/legacy/TabContent/FlagDevServerTabContent.css.d.ts +0 -10
- package/dist/core/ui/Toolbar/components/legacy/TabContent/FlagDevServerTabContent.d.ts +0 -5
- package/dist/core/ui/Toolbar/components/legacy/TabContent/FlagSdkOverrideTabContent.d.ts +0 -7
- package/dist/core/ui/Toolbar/components/legacy/TabContent/SettingsTab.css.d.ts +0 -13
- package/dist/core/ui/Toolbar/components/legacy/TabContent/SettingsTabContent.d.ts +0 -10
- package/dist/core/ui/Toolbar/components/legacy/TabContentRenderer.css.d.ts +0 -1
- package/dist/core/ui/Toolbar/components/legacy/TabContentRenderer.d.ts +0 -16
- package/dist/core/ui/Toolbar/components/legacy/index.d.ts +0 -1
- package/dist/core/ui/Toolbar/components/new/Settings/SettingsContent.d.ts +0 -1
- /package/dist/{react → core}/lazyLoadToolbar.d.ts +0 -0
package/README.md
CHANGED
|
@@ -32,14 +32,14 @@ instantiating it will keep it disabled in production environments.
|
|
|
32
32
|
|
|
33
33
|
The Developer Toolbar depends on your LaunchDarkly JS client having a reference to the same `FlagOverridePlugin` and
|
|
34
34
|
`EventInterceptionPlugin` that you pass into the Developer Toolbar. As such, ensure that you instantiate the Developer Toolbar at the same time or immediately after the LaunchDarkly JS client is instantiated.
|
|
35
|
-
Below are a few examples on how to instantiate the toolbar, one using the `useLaunchDarklyToolbar` react hook, and one using the CDN hosted toolbar script.
|
|
36
35
|
|
|
37
|
-
### React Hook
|
|
36
|
+
### React Hook
|
|
38
37
|
|
|
39
38
|
```tsx
|
|
40
39
|
import { render } from 'react-dom';
|
|
41
40
|
import { asyncWithLDProvider } from 'launchdarkly-react-client-sdk';
|
|
42
|
-
import { useLaunchDarklyToolbar
|
|
41
|
+
import { useLaunchDarklyToolbar } from '@launchdarkly/toolbar/react';
|
|
42
|
+
import { FlagOverridePlugin, EventInterceptionPlugin } from '@launchdarkly/toolbar/plugins';
|
|
43
43
|
|
|
44
44
|
const flagOverridePlugin = new FlagOverridePlugin();
|
|
45
45
|
const eventInterceptionPlugin = new EventInterceptionPlugin();
|
|
@@ -90,9 +90,118 @@ const eventInterceptionPlugin = new EventInterceptionPlugin();
|
|
|
90
90
|
})();
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
###
|
|
93
|
+
### Vue Composable
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
```typescript
|
|
96
|
+
import { onMounted } from 'vue';
|
|
97
|
+
import * as LDClient from 'launchdarkly-js-client-sdk';
|
|
98
|
+
import { useLaunchDarklyToolbar } from '@launchdarkly/toolbar/vue';
|
|
99
|
+
import { FlagOverridePlugin, EventInterceptionPlugin } from '@launchdarkly/toolbar/plugins';
|
|
100
|
+
|
|
101
|
+
const flagOverridePlugin = new FlagOverridePlugin();
|
|
102
|
+
const eventInterceptionPlugin = new EventInterceptionPlugin();
|
|
103
|
+
|
|
104
|
+
// Initialize LaunchDarkly client
|
|
105
|
+
const client = LDClient.initialize(
|
|
106
|
+
'client-side-id-123abc',
|
|
107
|
+
{
|
|
108
|
+
kind: 'user',
|
|
109
|
+
key: 'user-key-123abc',
|
|
110
|
+
name: 'Sandy Smith',
|
|
111
|
+
email: 'sandy@example.com',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
plugins: [flagOverridePlugin, eventInterceptionPlugin],
|
|
115
|
+
},
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
// In your Vue component or setup function
|
|
119
|
+
export default {
|
|
120
|
+
setup() {
|
|
121
|
+
onMounted(async () => {
|
|
122
|
+
await client.waitForInitialization();
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// Initialize toolbar with the same plugin instances
|
|
126
|
+
useLaunchDarklyToolbar({
|
|
127
|
+
flagOverridePlugin,
|
|
128
|
+
eventInterceptionPlugin,
|
|
129
|
+
|
|
130
|
+
// OR Dev Server Mode
|
|
131
|
+
devServerUrl: 'http://localhost:8080',
|
|
132
|
+
projectKey: 'my-project',
|
|
133
|
+
|
|
134
|
+
position: 'bottom-right',
|
|
135
|
+
enabled: import.meta.env.DEV, // Vite
|
|
136
|
+
// enabled: process.env.NODE_ENV === 'development', // Webpack
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
// your component data
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Angular Service
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
import { Component, OnInit } from '@angular/core';
|
|
150
|
+
import * as LDClient from 'launchdarkly-js-client-sdk';
|
|
151
|
+
import LaunchDarklyToolbarService from '@launchdarkly/toolbar/angular';
|
|
152
|
+
import { FlagOverridePlugin, EventInterceptionPlugin } from '@launchdarkly/toolbar/plugins';
|
|
153
|
+
import { environment } from '../environments/environment';
|
|
154
|
+
|
|
155
|
+
@Component({
|
|
156
|
+
selector: 'app-root',
|
|
157
|
+
template: `<router-outlet></router-outlet>`,
|
|
158
|
+
providers: [LaunchDarklyToolbarService],
|
|
159
|
+
})
|
|
160
|
+
export class AppComponent implements OnInit {
|
|
161
|
+
private flagOverridePlugin = new FlagOverridePlugin();
|
|
162
|
+
private eventInterceptionPlugin = new EventInterceptionPlugin();
|
|
163
|
+
private ldClient: LDClient.LDClient;
|
|
164
|
+
|
|
165
|
+
constructor(private toolbarService: LaunchDarklyToolbarService) {
|
|
166
|
+
// Initialize LaunchDarkly client
|
|
167
|
+
this.ldClient = LDClient.initialize(
|
|
168
|
+
'client-side-id-123abc',
|
|
169
|
+
{
|
|
170
|
+
kind: 'user',
|
|
171
|
+
key: 'user-key-123abc',
|
|
172
|
+
name: 'Sandy Smith',
|
|
173
|
+
email: 'sandy@example.com',
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
plugins: [this.flagOverridePlugin, this.eventInterceptionPlugin],
|
|
177
|
+
},
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async ngOnInit() {
|
|
182
|
+
await this.ldClient.waitForInitialization();
|
|
183
|
+
|
|
184
|
+
// Initialize toolbar with the same plugin instances
|
|
185
|
+
if (!environment.production) {
|
|
186
|
+
await this.toolbarService.initialize({
|
|
187
|
+
flagOverridePlugin: this.flagOverridePlugin,
|
|
188
|
+
eventInterceptionPlugin: this.eventInterceptionPlugin,
|
|
189
|
+
|
|
190
|
+
// OR Dev Server Mode
|
|
191
|
+
devServerUrl: 'http://localhost:8080',
|
|
192
|
+
projectKey: 'my-project',
|
|
193
|
+
|
|
194
|
+
position: 'bottom-right',
|
|
195
|
+
enabled: true,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### CDN Script Tag
|
|
203
|
+
|
|
204
|
+
Works with any JavaScript framework or vanilla JS. Add this script to your `index.html` file.
|
|
96
205
|
|
|
97
206
|
```html
|
|
98
207
|
<script src="https://unpkg.com/@launchdarkly/toolbar@latest/cdn/toolbar.min.js"></script>
|
|
@@ -150,6 +259,41 @@ declare global {
|
|
|
150
259
|
}
|
|
151
260
|
```
|
|
152
261
|
|
|
262
|
+
## Usage in a Hosted Environment
|
|
263
|
+
|
|
264
|
+
By default, the LaunchDarkly Developer Toolbar is configured to only allow hosting on apps running on localhost. However, if you want to run the toolbar in a hosted environment,
|
|
265
|
+
you can whitelist additional domains to circumvent this limitation. To do so, navigate to the Integrations page of your LaunchDarkly organization settings [here](https://app.launchdarkly.com/settings/integrations).
|
|
266
|
+
Search for the LaunchDarkly Developer Toolbar integration, and click `Add` to configure. When configuring, enter any of the domains you would like to whitelist,
|
|
267
|
+
and click `Save` to save the integration settings. This list can be updated at any time to add additional domains or remove whitelisted domains.
|
|
268
|
+
|
|
269
|
+
Note: After configuring, it may take up to 5 minutes for changes to reflect in the Developer Toolbar, as it caches the list of valid domains.
|
|
270
|
+
|
|
271
|
+
## Framework Support
|
|
272
|
+
|
|
273
|
+
The toolbar provides first-class support for popular frameworks:
|
|
274
|
+
|
|
275
|
+
### Import Paths
|
|
276
|
+
|
|
277
|
+
```typescript
|
|
278
|
+
// Core toolbar (for CDN or vanilla JS)
|
|
279
|
+
import { init } from '@launchdarkly/toolbar';
|
|
280
|
+
|
|
281
|
+
// Plugins (framework-agnostic)
|
|
282
|
+
import { FlagOverridePlugin, EventInterceptionPlugin } from '@launchdarkly/toolbar/plugins';
|
|
283
|
+
|
|
284
|
+
// React hook
|
|
285
|
+
import { useLaunchDarklyToolbar } from '@launchdarkly/toolbar/react';
|
|
286
|
+
|
|
287
|
+
// Vue composable
|
|
288
|
+
import { useLaunchDarklyToolbar } from '@launchdarkly/toolbar/vue';
|
|
289
|
+
|
|
290
|
+
// Angular service
|
|
291
|
+
import LaunchDarklyToolbarService from '@launchdarkly/toolbar/angular';
|
|
292
|
+
|
|
293
|
+
// TypeScript types
|
|
294
|
+
import type { InitializationConfig } from '@launchdarkly/toolbar/types';
|
|
295
|
+
```
|
|
296
|
+
|
|
153
297
|
## Package Structure
|
|
154
298
|
|
|
155
299
|
```
|
|
@@ -161,9 +305,13 @@ declare global {
|
|
|
161
305
|
│ │ ├── ui/ # UI components (Toolbar, Tabs, List, etc.)
|
|
162
306
|
│ │ ├── tests/ # Unit tests
|
|
163
307
|
│ │ └── index.ts # Core entry point (for CDN builds)
|
|
164
|
-
│ ├── react/ # React
|
|
308
|
+
│ ├── react/ # React hook and utilities
|
|
165
309
|
│ │ ├── useLaunchDarklyToolbar.ts # Main React hook
|
|
166
310
|
│ │ └── lazyLoadToolbar.ts # Dynamic CDN loading
|
|
311
|
+
│ ├── vue/ # Vue composable
|
|
312
|
+
│ │ └── useLaunchDarklyToolbar.ts # Main Vue composable
|
|
313
|
+
│ ├── angular/ # Angular service
|
|
314
|
+
│ │ └── launchdarkly-toolbar.service.ts # Injectable service
|
|
167
315
|
│ ├── types/ # TypeScript type definitions
|
|
168
316
|
│ │ ├── config.ts # Configuration types
|
|
169
317
|
│ │ ├── events.ts # Event types
|
|
@@ -171,9 +319,13 @@ declare global {
|
|
|
171
319
|
│ │ └── index.ts # Type exports
|
|
172
320
|
│ └── index.ts # Main entry point (NPM package)
|
|
173
321
|
├── dist/ # NPM package output
|
|
174
|
-
│ ├──
|
|
175
|
-
│ ├── index.
|
|
176
|
-
│
|
|
322
|
+
│ ├── js/ # ES module builds
|
|
323
|
+
│ │ ├── index.js
|
|
324
|
+
│ │ ├── react.js
|
|
325
|
+
│ │ ├── vue.js
|
|
326
|
+
│ │ └── angular.js
|
|
327
|
+
│ ├── *.cjs # CommonJS builds
|
|
328
|
+
│ └── *.d.ts # TypeScript definitions
|
|
177
329
|
├── cdn/ # CDN bundle output
|
|
178
330
|
│ └── toolbar.min.js # IIFE bundle for script tags
|
|
179
331
|
├── .storybook/ # Storybook configuration
|
|
@@ -203,7 +355,9 @@ interface ToolbarConfig {
|
|
|
203
355
|
}
|
|
204
356
|
```
|
|
205
357
|
|
|
206
|
-
###
|
|
358
|
+
### Framework-Specific Options
|
|
359
|
+
|
|
360
|
+
All framework integrations (React, Vue, Angular) support the same configuration options:
|
|
207
361
|
|
|
208
362
|
```typescript
|
|
209
363
|
interface UseLaunchDarklyToolbarConfig extends ToolbarConfig {
|
|
@@ -212,26 +366,73 @@ interface UseLaunchDarklyToolbarConfig extends ToolbarConfig {
|
|
|
212
366
|
}
|
|
213
367
|
```
|
|
214
368
|
|
|
369
|
+
**Example for local development:**
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
// React
|
|
373
|
+
useLaunchDarklyToolbar({
|
|
374
|
+
toolbarBundleUrl: 'http://localhost:5764/toolbar.min.js',
|
|
375
|
+
enabled: process.env.NODE_ENV === 'development',
|
|
376
|
+
// ... other options
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
// Vue
|
|
380
|
+
useLaunchDarklyToolbar({
|
|
381
|
+
toolbarBundleUrl: 'http://localhost:5764/toolbar.min.js',
|
|
382
|
+
enabled: import.meta.env.DEV,
|
|
383
|
+
// ... other options
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
// Angular
|
|
387
|
+
await toolbarService.initialize({
|
|
388
|
+
toolbarBundleUrl: 'http://localhost:5764/toolbar.min.js',
|
|
389
|
+
enabled: !environment.production,
|
|
390
|
+
// ... other options
|
|
391
|
+
});
|
|
392
|
+
```
|
|
393
|
+
|
|
215
394
|
## Modes
|
|
216
395
|
|
|
217
396
|
### Dev Server Mode
|
|
218
397
|
|
|
219
398
|
Connect directly to a LaunchDarkly dev server to manage server-side flags:
|
|
220
399
|
|
|
400
|
+
**React:**
|
|
401
|
+
|
|
221
402
|
```tsx
|
|
222
403
|
useLaunchDarklyToolbar({
|
|
223
|
-
devServerUrl: 'http://localhost:
|
|
404
|
+
devServerUrl: 'http://localhost:5764',
|
|
224
405
|
projectKey: 'my-project', // Optional
|
|
225
406
|
position: 'bottom-right',
|
|
226
407
|
});
|
|
227
408
|
```
|
|
228
409
|
|
|
229
|
-
|
|
410
|
+
**Vue:**
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
useLaunchDarklyToolbar({
|
|
414
|
+
devServerUrl: 'http://localhost:5764',
|
|
415
|
+
projectKey: 'my-project',
|
|
416
|
+
position: 'bottom-right',
|
|
417
|
+
});
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
**Angular:**
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
await toolbarService.initialize({
|
|
424
|
+
devServerUrl: 'http://localhost:5764',
|
|
425
|
+
projectKey: 'my-project',
|
|
426
|
+
position: 'bottom-right',
|
|
427
|
+
});
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
**CDN:**
|
|
230
431
|
|
|
231
432
|
```typescript
|
|
232
433
|
window.LaunchDarklyToolbar.init({
|
|
233
|
-
devServerUrl: 'http://localhost:
|
|
234
|
-
projectKey: 'my-project',
|
|
434
|
+
devServerUrl: 'http://localhost:5764',
|
|
435
|
+
projectKey: 'my-project',
|
|
235
436
|
position: 'bottom-right',
|
|
236
437
|
});
|
|
237
438
|
```
|
|
@@ -245,19 +446,54 @@ window.LaunchDarklyToolbar.init({
|
|
|
245
446
|
|
|
246
447
|
### SDK Mode
|
|
247
448
|
|
|
248
|
-
Integrate with LaunchDarkly
|
|
449
|
+
Integrate with LaunchDarkly JS SDK for client-side flag management:
|
|
450
|
+
|
|
451
|
+
**React:**
|
|
249
452
|
|
|
250
453
|
```tsx
|
|
251
|
-
import {
|
|
454
|
+
import { FlagOverridePlugin, EventInterceptionPlugin } from '@launchdarkly/toolbar/plugins';
|
|
455
|
+
|
|
456
|
+
const flagOverridePlugin = new FlagOverridePlugin();
|
|
457
|
+
const eventInterceptionPlugin = new EventInterceptionPlugin();
|
|
458
|
+
|
|
459
|
+
useLaunchDarklyToolbar({
|
|
460
|
+
flagOverridePlugin,
|
|
461
|
+
eventInterceptionPlugin,
|
|
462
|
+
position: 'bottom-right',
|
|
463
|
+
});
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
**Vue:**
|
|
467
|
+
|
|
468
|
+
```typescript
|
|
469
|
+
import { FlagOverridePlugin, EventInterceptionPlugin } from '@launchdarkly/toolbar/plugins';
|
|
470
|
+
|
|
471
|
+
const flagOverridePlugin = new FlagOverridePlugin();
|
|
472
|
+
const eventInterceptionPlugin = new EventInterceptionPlugin();
|
|
252
473
|
|
|
253
474
|
useLaunchDarklyToolbar({
|
|
254
|
-
flagOverridePlugin
|
|
255
|
-
eventInterceptionPlugin
|
|
475
|
+
flagOverridePlugin,
|
|
476
|
+
eventInterceptionPlugin,
|
|
477
|
+
position: 'bottom-right',
|
|
478
|
+
});
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
**Angular:**
|
|
482
|
+
|
|
483
|
+
```typescript
|
|
484
|
+
import { FlagOverridePlugin, EventInterceptionPlugin } from '@launchdarkly/toolbar/plugins';
|
|
485
|
+
|
|
486
|
+
const flagOverridePlugin = new FlagOverridePlugin();
|
|
487
|
+
const eventInterceptionPlugin = new EventInterceptionPlugin();
|
|
488
|
+
|
|
489
|
+
await toolbarService.initialize({
|
|
490
|
+
flagOverridePlugin,
|
|
491
|
+
eventInterceptionPlugin,
|
|
256
492
|
position: 'bottom-right',
|
|
257
493
|
});
|
|
258
494
|
```
|
|
259
495
|
|
|
260
|
-
|
|
496
|
+
**CDN:**
|
|
261
497
|
|
|
262
498
|
```typescript
|
|
263
499
|
window.LaunchDarklyToolbar.init({
|