@launchdarkly/toolbar 1.3.1 → 1.4.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.
@@ -1,2 +1,3 @@
1
1
  declare const ReactMountContext: import("react").Context<HTMLElement>;
2
+ export declare const useReactMount: () => HTMLElement;
2
3
  export default ReactMountContext;
@@ -1,9 +1,7 @@
1
- import type { LDClient } from 'launchdarkly-js-client-sdk';
2
1
  import { ToolbarAnalytics } from '../../../utils/analytics';
3
2
  interface AnalyticsProviderProps {
4
3
  children: React.ReactNode;
5
- ldClient?: LDClient | null;
6
4
  }
7
- export declare function AnalyticsProvider({ children, ldClient }: AnalyticsProviderProps): import("react/jsx-runtime").JSX.Element;
5
+ export declare function AnalyticsProvider({ children }: AnalyticsProviderProps): import("react/jsx-runtime").JSX.Element;
8
6
  export declare function useAnalytics(): ToolbarAnalytics;
9
7
  export {};
@@ -0,0 +1,76 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { LDClient, LDContext } from 'launchdarkly-js-client-sdk';
3
+ export interface AuthState {
4
+ authenticated: boolean;
5
+ userId?: string;
6
+ email?: string;
7
+ [key: string]: unknown;
8
+ }
9
+ export interface InternalClientContextValue {
10
+ /**
11
+ * The internal LaunchDarkly client for toolbar features and analytics.
12
+ * null if not yet initialized.
13
+ */
14
+ client: LDClient | null;
15
+ /**
16
+ * Whether the internal client is currently initializing.
17
+ */
18
+ loading: boolean;
19
+ /**
20
+ * Error during initialization, if any.
21
+ */
22
+ error: Error | null;
23
+ }
24
+ export interface InternalClientProviderProps {
25
+ children: ReactNode;
26
+ /**
27
+ * Client-side id for the internal toolbar client.
28
+ * This should be LaunchDarkly's internal toolbar client-side id.
29
+ * If not provided, the internal client will not be initialized.
30
+ */
31
+ clientSideId?: string;
32
+ /**
33
+ * Initial context for the internal client.
34
+ * If not provided, an anonymous context will be used.
35
+ */
36
+ initialContext?: LDContext;
37
+ /**
38
+ * Base URL for the LaunchDarkly instance.
39
+ * Defaults to standard LaunchDarkly production environment.
40
+ * Set this if using a custom LaunchDarkly instance.
41
+ */
42
+ baseUrl?: string;
43
+ /**
44
+ * Stream URL for the LaunchDarkly instance.
45
+ * Defaults to standard LaunchDarkly production environment.
46
+ * Set this if using a custom LaunchDarkly instance.
47
+ */
48
+ streamUrl?: string;
49
+ /**
50
+ * Events URL for the LaunchDarkly instance.
51
+ * Defaults to standard LaunchDarkly production environment.
52
+ * Set this if using a custom LaunchDarkly instance.
53
+ */
54
+ eventsUrl?: string;
55
+ }
56
+ /**
57
+ * InternalClientProvider manages the toolbar's internal LaunchDarkly client.
58
+ *
59
+ * This provider handles:
60
+ * - Initializing the internal client for toolbar features and analytics
61
+ * - Updating context when user authenticates
62
+ * - Sending analytics to LaunchDarkly's internal project
63
+ *
64
+ * The external client (user's app client) is accessed separately via plugins.
65
+ */
66
+ export declare function InternalClientProvider({ children, clientSideId, initialContext, baseUrl, streamUrl, eventsUrl, }: InternalClientProviderProps): import("react/jsx-runtime").JSX.Element;
67
+ /**
68
+ * Hook to access the internal LaunchDarkly client.
69
+ */
70
+ export declare function useInternalClient(): InternalClientContextValue;
71
+ /**
72
+ * Hook to get just the client instance (or null if not ready).
73
+ *
74
+ * This is a convenience hook for cases where you don't need loading/error state.
75
+ */
76
+ export declare function useInternalClientInstance(): LDClient | null;
@@ -0,0 +1,17 @@
1
+ import type { LDClient } from 'launchdarkly-js-client-sdk';
2
+ /**
3
+ * Sets the internal client. Called during initialization.
4
+ */
5
+ export declare function setToolbarFlagClient(client: LDClient | null): void;
6
+ /**
7
+ * Gets the current internal client.
8
+ */
9
+ export declare function getToolbarFlagClient(): LDClient | null;
10
+ /**
11
+ * Creates a function that returns the value of a toolbar feature flag.
12
+ *
13
+ * @param flagKey - The LaunchDarkly flag key
14
+ * @param defaultValue - Default value if client isn't initialized or flag doesn't exist
15
+ * @returns A function that returns the current flag value
16
+ */
17
+ export declare function createToolbarFlagFunction<T>(flagKey: string, defaultValue: T): () => T;
@@ -0,0 +1,2 @@
1
+ export * from './toolbarFlags';
2
+ export { createToolbarFlagFunction, getToolbarFlagClient, setToolbarFlagClient } from './createToolbarFlagFunction';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Toolbar feature flags
3
+ *
4
+ * These flags control features within the toolbar itself using the toolbar's
5
+ * internal LaunchDarkly client (not the user's application client).
6
+ *
7
+ * To add a toolbar feature flag, export it here like:
8
+ * export const myFeature = createToolbarFlagFunction('my-feature-key', defaultValue);
9
+ */
10
+ export declare const __placeholder: () => boolean;
package/dist/index.cjs CHANGED
@@ -553,7 +553,7 @@ async function lazyLoad(signal, url) {
553
553
  }
554
554
  }
555
555
  var package_namespaceObject = {
556
- rE: "1.3.1"
556
+ rE: "1.4.1"
557
557
  };
558
558
  function useLaunchDarklyToolbar(args) {
559
559
  const { toolbarBundleUrl, enabled, ...initConfig } = args;
package/dist/js/index.js CHANGED
@@ -519,7 +519,7 @@ async function lazyLoad(signal, url) {
519
519
  }
520
520
  }
521
521
  var package_namespaceObject = {
522
- rE: "1.3.1"
522
+ rE: "1.4.1"
523
523
  };
524
524
  function useLaunchDarklyToolbar(args) {
525
525
  const { toolbarBundleUrl, enabled, ...initConfig } = args;
@@ -0,0 +1 @@
1
+ export declare const TOOLBAR_DOM_ID = "ld-toolbar";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@launchdarkly/toolbar",
4
- "version": "1.3.1",
4
+ "version": "1.4.1",
5
5
  "description": "A React component that provides a developer-friendly toolbar for interacting with LaunchDarkly during development",
6
6
  "keywords": [
7
7
  "launchdarkly",
@@ -51,30 +51,30 @@
51
51
  "@codemirror/language": "^6.11.3",
52
52
  "@codemirror/lint": "^6.9.2",
53
53
  "@codemirror/state": "^6.5.2",
54
- "@codemirror/view": "^6.38.6",
54
+ "@codemirror/view": "^6.38.8",
55
55
  "@launchpad-ui/components": "^0.17.5",
56
56
  "@launchpad-ui/tokens": "^0.15.1",
57
57
  "@lezer/highlight": "^1.2.3",
58
58
  "@react-aria/focus": "^3.21.2",
59
59
  "@react-stately/flags": "^3.1.2",
60
- "@rsbuild/core": "^1.6.6",
60
+ "@rsbuild/core": "^1.6.7",
61
61
  "@rsbuild/plugin-react": "^1.4.2",
62
- "@rslib/core": "^0.17.0",
63
- "@storybook/addon-docs": "^10.0.7",
62
+ "@rslib/core": "^0.18.0",
63
+ "@storybook/addon-docs": "^10.0.8",
64
64
  "@storybook/addon-essentials": "^9.0.0-alpha.12",
65
65
  "@storybook/addon-interactions": "^9.0.0-alpha.10",
66
- "@storybook/addon-links": "^10.0.7",
67
- "@storybook/addon-onboarding": "^10.0.7",
66
+ "@storybook/addon-links": "^10.0.8",
67
+ "@storybook/addon-onboarding": "^10.0.8",
68
68
  "@storybook/blocks": "^9.0.0-alpha.17",
69
- "@storybook/react": "^10.0.7",
70
- "@storybook/react-vite": "^9.0.5",
69
+ "@storybook/react": "^10.0.8",
70
+ "@storybook/react-vite": "^10.0.8",
71
71
  "@storybook/test": "^9.0.0-alpha.2",
72
72
  "@tanstack/react-virtual": "^3.13.12",
73
73
  "@testing-library/jest-dom": "^6.9.1",
74
74
  "@testing-library/react": "^16.3.0",
75
75
  "@types/node": "^24.10.1",
76
76
  "@types/react": "19.2.4",
77
- "@types/react-dom": "19.2.2",
77
+ "@types/react-dom": "19.2.3",
78
78
  "@vanilla-extract/css": "^1.17.4",
79
79
  "@vanilla-extract/vite-plugin": "^5.1.1",
80
80
  "@vanilla-extract/webpack-plugin": "^2.3.22",
@@ -83,14 +83,14 @@
83
83
  "jsdom": "^27.2.0",
84
84
  "launchdarkly-js-client-sdk": "^3.9.0",
85
85
  "motion": "^12.19.2",
86
- "oxlint": "^1.24.0",
86
+ "oxlint": "^1.29.0",
87
87
  "react": "^19.2.0",
88
88
  "react-dom": "^19.2.0",
89
- "storybook": "^9.1.16",
90
- "storybook-addon-rslib": "^2.1.4",
91
- "storybook-react-rsbuild": "^2.1.4",
89
+ "storybook": "^10.0.8",
90
+ "storybook-addon-rslib": "^2.1.6",
91
+ "storybook-react-rsbuild": "^2.1.6",
92
92
  "typescript": "^5.9.3",
93
- "vitest": "^4.0.8"
93
+ "vitest": "^4.0.12"
94
94
  },
95
95
  "peerDependencies": {
96
96
  "launchdarkly-js-client-sdk": ">=3.9.0 <4.0.0",