@launchdarkly/toolbar 2.4.0-beta.1 → 2.5.0-beta.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.
Files changed (30) hide show
  1. package/cdn/toolbar.min.js +38 -34
  2. package/dist/core/ui/Buttons/IconButton.d.ts +2 -1
  3. package/dist/core/ui/JsonEditor/JsonEditor.d.ts +2 -1
  4. package/dist/core/ui/Toolbar/components/{FlagKeyWithCopy.css.d.ts → CopyableText.css.d.ts} +1 -1
  5. package/dist/core/ui/Toolbar/components/CopyableText.d.ts +18 -0
  6. package/dist/core/ui/Toolbar/components/LoadingScreen/LoadingScreen.css.d.ts +7 -0
  7. package/dist/core/ui/Toolbar/components/LoadingScreen/LoadingScreen.d.ts +5 -0
  8. package/dist/core/ui/Toolbar/components/LoadingScreen/index.d.ts +1 -0
  9. package/dist/core/ui/Toolbar/components/icons/index.d.ts +1 -0
  10. package/dist/core/ui/Toolbar/components/index.d.ts +1 -0
  11. package/dist/core/ui/Toolbar/components/new/Contexts/AddContextForm.d.ts +6 -0
  12. package/dist/core/ui/Toolbar/components/new/Contexts/AddContextForm.module.css.d.ts +14 -0
  13. package/dist/core/ui/Toolbar/components/new/Contexts/ContextItem.d.ts +9 -0
  14. package/dist/core/ui/Toolbar/components/new/Contexts/ContextItem.module.css.d.ts +19 -0
  15. package/dist/core/ui/Toolbar/components/new/Contexts/ContextList.d.ts +1 -0
  16. package/dist/core/ui/Toolbar/components/new/Contexts/ContextList.module.css.d.ts +8 -0
  17. package/dist/core/ui/Toolbar/components/new/Contexts/ContextListContent.d.ts +1 -0
  18. package/dist/core/ui/Toolbar/components/new/Contexts/index.d.ts +4 -0
  19. package/dist/core/ui/Toolbar/components/new/context/TabSearchProvider.d.ts +7 -5
  20. package/dist/core/ui/Toolbar/components/new/types.d.ts +1 -1
  21. package/dist/core/ui/Toolbar/context/api/ContextsProvider.d.ts +18 -0
  22. package/dist/core/ui/Toolbar/context/api/index.d.ts +1 -0
  23. package/dist/core/ui/Toolbar/types/ldApi.d.ts +7 -0
  24. package/dist/core/ui/Toolbar/utils/context.d.ts +15 -0
  25. package/dist/core/ui/Toolbar/utils/localStorage.d.ts +7 -0
  26. package/dist/core/utils/analytics.d.ts +28 -0
  27. package/dist/index.cjs +1 -1
  28. package/dist/js/index.js +1 -1
  29. package/package.json +2 -2
  30. package/dist/core/ui/Toolbar/components/FlagKeyWithCopy.d.ts +0 -6
@@ -2,10 +2,11 @@ import React from 'react';
2
2
  interface IconButtonProps {
3
3
  icon: React.ReactNode;
4
4
  label: string;
5
- onClick: () => void;
5
+ onClick: (event: React.MouseEvent) => void;
6
6
  disabled?: boolean;
7
7
  className?: string;
8
8
  size?: 'small' | 'medium' | 'large';
9
+ title?: string;
9
10
  }
10
11
  export declare function IconButton(props: IconButtonProps): import("react/jsx-runtime").JSX.Element;
11
12
  export {};
@@ -6,12 +6,13 @@ interface JsonEditorProps {
6
6
  onFocus?: () => void;
7
7
  onBlur?: (e: React.FocusEvent<HTMLDivElement>, value: string) => void;
8
8
  onChange?: (value: string, viewUpdate: ViewUpdate) => void;
9
- onLintErrors: (errors: Diagnostic[]) => void;
9
+ onLintErrors?: (errors: Diagnostic[]) => void;
10
10
  initialState?: {
11
11
  startCursorAtLine?: number;
12
12
  autoFocus?: boolean;
13
13
  };
14
14
  onEditorHeightChange: (height: number) => void;
15
+ readOnly?: boolean;
15
16
  }
16
17
  export declare function JsonEditor(props: JsonEditorProps): import("react/jsx-runtime").JSX.Element;
17
18
  export {};
@@ -1,4 +1,4 @@
1
1
  export declare const wrapper: string;
2
2
  export declare const container: string;
3
- export declare const flagKeyText: string;
3
+ export declare const text: string;
4
4
  export declare const tooltip: string;
@@ -0,0 +1,18 @@
1
+ interface CopyableTextProps {
2
+ /** The text to display and copy to clipboard */
3
+ text: string;
4
+ /** Optional callback fired after copying (useful for analytics) */
5
+ onCopy?: (text: string) => void;
6
+ /** Custom aria-label for accessibility. Defaults to "Copy {text} to clipboard" */
7
+ ariaLabel?: string;
8
+ /** Custom title tooltip. Defaults to "Copy {text} to clipboard" */
9
+ title?: string;
10
+ /** Additional CSS class name */
11
+ className?: string;
12
+ /** Custom tooltip text shown after copying. Defaults to "Copied!" */
13
+ copiedMessage?: string;
14
+ /** Duration in ms to show the copied tooltip. Defaults to 2000 */
15
+ copiedDuration?: number;
16
+ }
17
+ export declare function CopyableText({ text, onCopy, ariaLabel, title, className, copiedMessage, copiedDuration, }: CopyableTextProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare const loadingContainer: string;
2
+ export declare const loadingHeader: string;
3
+ export declare const headerLogo: string;
4
+ export declare const loadingMainContent: string;
5
+ export declare const loadingContent: string;
6
+ export declare const spinner: string;
7
+ export declare const loadingText: string;
@@ -0,0 +1,5 @@
1
+ interface LoadingScreenProps {
2
+ onMouseDown?: (event: React.MouseEvent) => void;
3
+ }
4
+ export declare function LoadingScreen(props: LoadingScreenProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1 @@
1
+ export { LoadingScreen } from './LoadingScreen';
@@ -23,3 +23,4 @@ export { FlaskIcon } from './FlaskIcon';
23
23
  export { ExternalLinkIcon } from './ExternalLinkIcon';
24
24
  export { CursorIcon } from './CursorIcon';
25
25
  export { InfoIcon } from './InfoIcon';
26
+ export { AddIcon } from './AddIcon';
@@ -1,6 +1,7 @@
1
1
  export { ActionButtonsContainer } from './legacy/ActionButtonsContainer';
2
2
  export { CircleLogo } from './CircleLogo';
3
3
  export { ConnectionStatus } from './ConnectionStatus';
4
+ export { CopyableText } from './CopyableText';
4
5
  export { DoNotTrackWarning } from './DoNotTrackWarning';
5
6
  export { LaunchDarklyIcon } from './icons/LaunchDarklyIcon';
6
7
  export { StatusDot } from './StatusDot';
@@ -0,0 +1,6 @@
1
+ interface AddContextFormProps {
2
+ isOpen: boolean;
3
+ onClose: () => void;
4
+ }
5
+ export declare function AddContextForm({ isOpen, onClose }: AddContextFormProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,14 @@
1
+ export declare const container: string;
2
+ export declare const header: string;
3
+ export declare const title: string;
4
+ export declare const closeButton: string;
5
+ export declare const form: string;
6
+ export declare const field: string;
7
+ export declare const label: string;
8
+ export declare const required: string;
9
+ export declare const input: string;
10
+ export declare const jsonEditorContainer: string;
11
+ export declare const errorText: string;
12
+ export declare const actions: string;
13
+ export declare const cancelButton: string;
14
+ export declare const submitButton: string;
@@ -0,0 +1,9 @@
1
+ import { Context } from '../../../types/ldApi';
2
+ interface ContextItemProps {
3
+ context: Context;
4
+ isActiveContext: boolean;
5
+ handleHeightChange?: (index: number, height: number) => void;
6
+ index?: number;
7
+ }
8
+ export declare function ContextItem({ context, isActiveContext, handleHeightChange, index }: ContextItemProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,19 @@
1
+ export declare const container: string;
2
+ export declare const header: string;
3
+ export declare const containerActive: string;
4
+ export declare const containerClickable: string;
5
+ export declare const info: string;
6
+ export declare const nameRow: string;
7
+ export declare const name: string;
8
+ export declare const keyRow: string;
9
+ export declare const key: string;
10
+ export declare const kindBadge: string;
11
+ export declare const anonymousBadge: string;
12
+ export declare const activeDot: string;
13
+ export declare const actions: string;
14
+ export declare const deleteButton: string;
15
+ export declare const iconButton: string;
16
+ export declare const expandButton: string;
17
+ export declare const chevron: string;
18
+ export declare const chevronExpanded: string;
19
+ export declare const editActions: string;
@@ -0,0 +1 @@
1
+ export declare function ContextList(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ export declare const container: string;
2
+ export declare const statsHeader: string;
3
+ export declare const statsText: string;
4
+ export declare const addButton: string;
5
+ export declare const scrollContainer: string;
6
+ export declare const virtualInner: string;
7
+ export declare const loadingMore: string;
8
+ export declare const loadingMoreText: string;
@@ -0,0 +1 @@
1
+ export declare function ContextListContent(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { ContextListContent } from './ContextListContent';
2
+ export { ContextList } from './ContextList';
3
+ export { ContextItem } from './ContextItem';
4
+ export { AddContextForm } from './AddContextForm';
@@ -1,10 +1,12 @@
1
- import { TabId } from '../../../types';
2
- type TabSearchContextType = {
3
- searchTerms: Record<TabId, string>;
4
- setSearchTerm: (tab: TabId, searchTerm: string) => void;
1
+ import { SubTab } from '../types';
2
+ type SubTabSearchContextType = {
3
+ searchTerms: Record<SubTab, string>;
4
+ setSearchTerm: (subtab: SubTab, searchTerm: string) => void;
5
+ clearSearchTerm: (subtab: SubTab) => void;
6
+ clearAllSearchTerms: () => void;
5
7
  };
6
8
  export declare function TabSearchProvider({ children }: {
7
9
  children: React.ReactNode;
8
10
  }): import("react/jsx-runtime").JSX.Element;
9
- export declare function useTabSearchContext(): TabSearchContextType;
11
+ export declare function useTabSearchContext(): SubTabSearchContextType;
10
12
  export {};
@@ -1,4 +1,4 @@
1
- export type FlagsSubtab = 'flags' | 'context';
1
+ export type FlagsSubtab = 'flags' | 'contexts';
2
2
  export type MonitoringSubtab = 'events';
3
3
  export type SettingsSubtab = 'general';
4
4
  export type InteractiveSubtab = 'workflows';
@@ -0,0 +1,18 @@
1
+ import { Context } from '../../types/ldApi';
2
+ interface ContextsContextType {
3
+ contexts: Context[];
4
+ filter: string;
5
+ setFilter: (filter: string) => void;
6
+ addContext: (context: Context) => void;
7
+ removeContext: (id: string) => void;
8
+ updateContext: (id: string, newContext: Context) => void;
9
+ setContext: (context: Context) => Promise<void>;
10
+ activeContext: Context | null;
11
+ isAddFormOpen: boolean;
12
+ setIsAddFormOpen: (isOpen: boolean) => void;
13
+ }
14
+ export declare const ContextsProvider: ({ children }: {
15
+ children: React.ReactNode;
16
+ }) => import("react/jsx-runtime").JSX.Element;
17
+ export declare function useContextsContext(): ContextsContextType;
18
+ export {};
@@ -1,6 +1,7 @@
1
1
  export * from './ApiBundleProvider';
2
2
  export * from './ApiProvider';
3
3
  export * from './AuthProvider';
4
+ export * from './ContextsProvider';
4
5
  export * from './EnvironmentProvider';
5
6
  export * from './FlagsProvider';
6
7
  export * from './IFrameProvider';
@@ -38,3 +38,10 @@ export interface FlagsPaginationParams {
38
38
  offset?: number;
39
39
  query?: string;
40
40
  }
41
+ export interface Context {
42
+ id: string;
43
+ kind: string;
44
+ key?: string;
45
+ name: string;
46
+ anonymous?: boolean;
47
+ }
@@ -0,0 +1,15 @@
1
+ import type { LDContext } from 'launchdarkly-js-client-sdk';
2
+ import { Context } from '../types/ldApi';
3
+ /**
4
+ * Generates a unique ID for a context
5
+ */
6
+ export declare function generateContextId(): string;
7
+ /**
8
+ * Extracts normalized context info from an LDContext
9
+ * Handles both single-kind and multi-kind contexts
10
+ */
11
+ export declare function extractContextInfo(ldContext: LDContext | undefined): Context | null;
12
+ /**
13
+ * Helper function to check if a given context matches the current SDK context
14
+ */
15
+ export declare function isCurrentContext(currentContext: Context | null, contextKind: string, contextKey: string): boolean;
@@ -1,3 +1,4 @@
1
+ import { Context } from '../types/ldApi';
1
2
  import { ToolbarPosition } from '../types/toolbar';
2
3
  export declare const TOOLBAR_STORAGE_KEYS: {
3
4
  readonly ENVIRONMENT: "ld-toolbar-environment";
@@ -6,6 +7,8 @@ export declare const TOOLBAR_STORAGE_KEYS: {
6
7
  readonly PROJECT: "ld-toolbar-project";
7
8
  readonly STARRED_FLAGS: "ld-toolbar-starred-flags";
8
9
  readonly MCP_ALERT_DISMISSED: "ld-toolbar-mcp-alert-dismissed";
10
+ readonly CONTEXTS: "ld-toolbar-contexts";
11
+ readonly ACTIVE_CONTEXT: "ld-toolbar-active-context";
9
12
  };
10
13
  export type PreferredIde = 'cursor' | 'windsurf' | 'vscode' | 'github-copilot';
11
14
  export declare const PREFERRED_IDES: PreferredIde[];
@@ -28,3 +31,7 @@ export declare function savePreferredIde(ide: PreferredIde): void;
28
31
  export declare function loadPreferredIde(): PreferredIde;
29
32
  export declare function saveMCPAlertDismissed(dismissed: boolean): void;
30
33
  export declare function loadMCPAlertDismissed(): boolean;
34
+ export declare function loadContexts(): Array<Context>;
35
+ export declare function saveContexts(contexts: Array<Context>): void;
36
+ export declare function loadActiveContext(): Context | null;
37
+ export declare function saveActiveContext(context: Context | null): void;
@@ -102,4 +102,32 @@ export declare class ToolbarAnalytics {
102
102
  * Track flag key copy
103
103
  */
104
104
  trackFlagKeyCopy(flagKey: string): void;
105
+ /**
106
+ * Track context added
107
+ */
108
+ trackContextAdded(contextKind: string, contextKey: string, isMultiKind: boolean): void;
109
+ /**
110
+ * Track context removed
111
+ */
112
+ trackContextRemoved(contextKind: string, contextKey: string): void;
113
+ /**
114
+ * Track context updated
115
+ */
116
+ trackContextUpdated(oldKind: string, oldKey: string, newKind: string, newKey: string): void;
117
+ /**
118
+ * Track context selected/activated
119
+ */
120
+ trackContextSelected(contextKind: string, contextKey: string): void;
121
+ /**
122
+ * Track context edit started
123
+ */
124
+ trackContextEditStarted(contextKind: string, contextKey: string): void;
125
+ /**
126
+ * Track context edit cancelled
127
+ */
128
+ trackContextEditCancelled(contextKind: string, contextKey: string): void;
129
+ /**
130
+ * Track context key copy
131
+ */
132
+ trackContextKeyCopy(contextKey: string): void;
105
133
  }
package/dist/index.cjs CHANGED
@@ -552,7 +552,7 @@ async function lazyLoad(signal, url) {
552
552
  throw new Error(`Could not load LaunchDarkly developer toolbar bundle from ${url}`);
553
553
  }
554
554
  }
555
- var package_namespaceObject = JSON.parse('{"rE":"2.4.0-beta.1"}');
555
+ var package_namespaceObject = JSON.parse('{"rE":"2.5.0-beta.1"}');
556
556
  function useLaunchDarklyToolbar(args) {
557
557
  const { toolbarBundleUrl, enabled, ...initConfig } = args;
558
558
  const configRef = (0, external_react_namespaceObject.useRef)(null);
package/dist/js/index.js CHANGED
@@ -518,7 +518,7 @@ async function lazyLoad(signal, url) {
518
518
  throw new Error(`Could not load LaunchDarkly developer toolbar bundle from ${url}`);
519
519
  }
520
520
  }
521
- var package_namespaceObject = JSON.parse('{"rE":"2.4.0-beta.1"}');
521
+ var package_namespaceObject = JSON.parse('{"rE":"2.5.0-beta.1"}');
522
522
  function useLaunchDarklyToolbar(args) {
523
523
  const { toolbarBundleUrl, enabled, ...initConfig } = args;
524
524
  const configRef = useRef(null);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@launchdarkly/toolbar",
4
- "version": "2.4.0-beta.1",
4
+ "version": "2.5.0-beta.1",
5
5
  "description": "A framework-agnostic developer toolbar for interacting with LaunchDarkly during development",
6
6
  "keywords": [
7
7
  "launchdarkly",
@@ -71,7 +71,7 @@
71
71
  "@storybook/addon-onboarding": "^10.1.7",
72
72
  "@storybook/blocks": "^9.0.0-alpha.17",
73
73
  "@storybook/react": "^10.0.8",
74
- "@storybook/react-vite": "^10.1.7",
74
+ "@storybook/react-vite": "^10.1.8",
75
75
  "@storybook/test": "^9.0.0-alpha.2",
76
76
  "@tanstack/react-virtual": "^3.13.13",
77
77
  "@testing-library/jest-dom": "^6.9.1",
@@ -1,6 +0,0 @@
1
- interface FlagKeyWithCopyProps {
2
- flagKey: string;
3
- className?: string;
4
- }
5
- export declare function FlagKeyWithCopy({ flagKey, className }: FlagKeyWithCopyProps): import("react/jsx-runtime").JSX.Element;
6
- export {};