@launchdarkly/toolbar 0.17.0-beta.1 → 0.21.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.
- package/README.md +8 -8
- package/dist/index.d.ts +1 -0
- package/dist/js/index.js +1082 -692
- package/dist/js/plugins/index.js +14 -2
- package/dist/plugins/EventInterceptionPlugin.d.ts +4 -1
- package/dist/tests/plugins/EventInterceptionPlugin.test.d.ts +1 -0
- package/dist/types/events.d.ts +5 -1
- package/dist/types/plugin.d.ts +5 -0
- package/dist/ui/Toolbar/LaunchDarklyToolbar.css.d.ts +4 -2
- package/dist/ui/Toolbar/LaunchDarklyToolbar.d.ts +2 -0
- package/dist/ui/Toolbar/TabContent/EventsTabContent.css.d.ts +3 -0
- package/dist/ui/Toolbar/TabContent/EventsTabContent.d.ts +1 -0
- package/dist/ui/Toolbar/TabContent/SettingsTab.css.d.ts +1 -0
- package/dist/ui/Toolbar/TabContent/SettingsTabContent.d.ts +2 -0
- package/dist/ui/Toolbar/components/CircleLogo.d.ts +3 -2
- package/dist/ui/Toolbar/components/ExpandedToolbarContent.d.ts +6 -3
- package/dist/ui/Toolbar/components/TabContentRenderer.d.ts +3 -0
- package/dist/ui/Toolbar/components/icons/AddIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/ChevronUpIcon.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/LaunchDarklyLogo.d.ts +5 -0
- package/dist/ui/Toolbar/components/icons/index.d.ts +1 -0
- package/dist/ui/Toolbar/constants/animations.d.ts +68 -26
- package/dist/ui/Toolbar/context/AnalyticsProvider.d.ts +9 -0
- package/dist/ui/Toolbar/context/DevServerProvider.d.ts +0 -4
- package/dist/ui/Toolbar/context/ToolbarUIProvider.d.ts +13 -0
- package/dist/ui/Toolbar/context/index.d.ts +2 -0
- package/dist/ui/Toolbar/hooks/index.d.ts +0 -1
- package/dist/ui/Toolbar/hooks/useToolbarAnimations.d.ts +6 -3
- package/dist/ui/Toolbar/hooks/useToolbarDrag.d.ts +2 -1
- package/dist/ui/Toolbar/hooks/useToolbarState.d.ts +7 -6
- package/dist/ui/Toolbar/types/toolbar.d.ts +1 -1
- package/dist/ui/Toolbar/utils/localStorage.d.ts +8 -1
- package/dist/utils/analytics.d.ts +54 -0
- package/package.json +10 -10
- package/dist/static/font/Audimat3000-Regulier.var-subset.woff2 +0 -0
- package/dist/static/font/Inter.var-subset.woff2 +0 -0
- package/dist/ui/Toolbar/hooks/useKeyPressed.d.ts +0 -1
package/dist/js/plugins/index.js
CHANGED
|
@@ -366,12 +366,14 @@ class AfterEvaluationHook {
|
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
+
const ANALYTICS_EVENT_PREFIX = 'ld.toolbar';
|
|
369
370
|
class EventInterceptionPlugin {
|
|
370
371
|
afterTrackHook;
|
|
371
372
|
afterIdentifyHook;
|
|
372
373
|
afterEvaluationHook;
|
|
373
374
|
eventStore;
|
|
374
375
|
config;
|
|
376
|
+
ldClient = null;
|
|
375
377
|
constructor(config = {}){
|
|
376
378
|
this.config = {
|
|
377
379
|
enableLogging: false,
|
|
@@ -382,7 +384,9 @@ class EventInterceptionPlugin {
|
|
|
382
384
|
maxEvents: this.config.eventCapacity
|
|
383
385
|
});
|
|
384
386
|
const onNewEvent = (event)=>{
|
|
385
|
-
|
|
387
|
+
const isToolbarEvent = this.isToolbarEvent(event);
|
|
388
|
+
if (isToolbarEvent) return;
|
|
389
|
+
if (this.config.enableLogging) console.log("\uD83C\uDFAF Event intercepted:", {
|
|
386
390
|
kind: event.kind,
|
|
387
391
|
key: event.key,
|
|
388
392
|
category: event.category,
|
|
@@ -403,6 +407,9 @@ class EventInterceptionPlugin {
|
|
|
403
407
|
onNewEvent
|
|
404
408
|
});
|
|
405
409
|
}
|
|
410
|
+
isToolbarEvent(event) {
|
|
411
|
+
return event.key?.startsWith(ANALYTICS_EVENT_PREFIX) ?? false;
|
|
412
|
+
}
|
|
406
413
|
getMetadata() {
|
|
407
414
|
return {
|
|
408
415
|
name: 'EventInterceptionPlugin'
|
|
@@ -415,7 +422,12 @@ class EventInterceptionPlugin {
|
|
|
415
422
|
this.afterEvaluationHook
|
|
416
423
|
];
|
|
417
424
|
}
|
|
418
|
-
register(
|
|
425
|
+
register(ldClient) {
|
|
426
|
+
this.ldClient = ldClient;
|
|
427
|
+
}
|
|
428
|
+
getClient() {
|
|
429
|
+
return this.ldClient;
|
|
430
|
+
}
|
|
419
431
|
getEvents() {
|
|
420
432
|
return this.eventStore.getEvents();
|
|
421
433
|
}
|
|
@@ -21,10 +21,13 @@ export declare class EventInterceptionPlugin implements IEventInterceptionPlugin
|
|
|
21
21
|
private afterEvaluationHook;
|
|
22
22
|
private eventStore;
|
|
23
23
|
private config;
|
|
24
|
+
private ldClient;
|
|
24
25
|
constructor(config?: EventInterceptionPluginConfig);
|
|
26
|
+
isToolbarEvent(event: ProcessedEvent): boolean;
|
|
25
27
|
getMetadata(): LDPluginMetadata;
|
|
26
28
|
getHooks(_metadata: LDPluginEnvironmentMetadata): Hook[];
|
|
27
|
-
register(
|
|
29
|
+
register(ldClient: LDClient): void;
|
|
30
|
+
getClient(): LDClient | null;
|
|
28
31
|
getEvents(): ProcessedEvent[];
|
|
29
32
|
subscribe(listener: () => void): () => void;
|
|
30
33
|
clearEvents(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/events.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export interface LDEvaluationReason {
|
|
2
|
+
readonly kind?: string;
|
|
3
|
+
readonly errorKind?: string;
|
|
4
|
+
}
|
|
1
5
|
export interface SyntheticEventContext {
|
|
2
6
|
readonly kind: EventKind;
|
|
3
7
|
readonly key?: string;
|
|
@@ -9,7 +13,7 @@ export interface SyntheticEventContext {
|
|
|
9
13
|
readonly value?: any;
|
|
10
14
|
readonly variation?: number | null;
|
|
11
15
|
readonly default?: any;
|
|
12
|
-
readonly reason?:
|
|
16
|
+
readonly reason?: LDEvaluationReason;
|
|
13
17
|
readonly version?: number;
|
|
14
18
|
readonly trackEvents?: boolean;
|
|
15
19
|
readonly debugEventsUntilDate?: number;
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -49,4 +49,9 @@ export interface IEventInterceptionPlugin extends LDPlugin {
|
|
|
49
49
|
* Clears all events from the event store
|
|
50
50
|
*/
|
|
51
51
|
clearEvents(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Returns the LaunchDarkly client instance
|
|
54
|
+
* @returns The LaunchDarkly client with allFlags method
|
|
55
|
+
*/
|
|
56
|
+
getClient(): LDClient | null;
|
|
52
57
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const toolbarContainer: string;
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
2
|
+
export declare const positionBottomRight: string;
|
|
3
|
+
export declare const positionBottomLeft: string;
|
|
4
|
+
export declare const positionTopRight: string;
|
|
5
|
+
export declare const positionTopLeft: string;
|
|
4
6
|
export declare const toolbarCircle: string;
|
|
5
7
|
export declare const toolbarExpanded: string;
|
|
6
8
|
export declare const circleContent: string;
|
|
@@ -2,11 +2,13 @@ import { ToolbarMode, ToolbarPosition } from './types/toolbar';
|
|
|
2
2
|
import type { IEventInterceptionPlugin, IFlagOverridePlugin } from '../../types/plugin';
|
|
3
3
|
export interface LdToolbarProps {
|
|
4
4
|
mode: ToolbarMode;
|
|
5
|
+
baseUrl: string;
|
|
5
6
|
flagOverridePlugin?: IFlagOverridePlugin;
|
|
6
7
|
eventInterceptionPlugin?: IEventInterceptionPlugin;
|
|
7
8
|
}
|
|
8
9
|
export declare function LdToolbar(props: LdToolbarProps): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export interface LaunchDarklyToolbarProps {
|
|
11
|
+
baseUrl?: string;
|
|
10
12
|
devServerUrl?: string;
|
|
11
13
|
projectKey?: string;
|
|
12
14
|
flagOverridePlugin?: IFlagOverridePlugin;
|
|
@@ -5,6 +5,9 @@ export declare const eventName: string;
|
|
|
5
5
|
export declare const eventMeta: string;
|
|
6
6
|
export declare const eventBadge: string;
|
|
7
7
|
export declare const eventBadgeFeature: string;
|
|
8
|
+
export declare const eventBadgeFeatureNotFound: string;
|
|
9
|
+
export declare const addButtonContainer: string;
|
|
10
|
+
export declare const addButton: string;
|
|
8
11
|
export declare const eventBadgeIdentify: string;
|
|
9
12
|
export declare const eventBadgeCustom: string;
|
|
10
13
|
export declare const eventBadgeDebug: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IEventInterceptionPlugin } from '../../../types/plugin';
|
|
2
2
|
interface EventsTabContentProps {
|
|
3
|
+
baseUrl: string;
|
|
3
4
|
eventInterceptionPlugin?: IEventInterceptionPlugin;
|
|
4
5
|
}
|
|
5
6
|
export declare function EventsTabContent(props: EventsTabContentProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type ToolbarMode } from '../types/toolbar';
|
|
2
2
|
interface SettingsTabContentProps {
|
|
3
3
|
mode: ToolbarMode;
|
|
4
|
+
isPinned: boolean;
|
|
5
|
+
onTogglePin: () => void;
|
|
4
6
|
}
|
|
5
7
|
export declare function SettingsTabContent(props: SettingsTabContentProps): import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface CircleLogoProps {
|
|
2
|
-
|
|
2
|
+
onClick: () => void;
|
|
3
|
+
onMouseDown: (event: React.MouseEvent) => void;
|
|
3
4
|
}
|
|
4
|
-
export declare
|
|
5
|
+
export declare const CircleLogo: import("react").ForwardRefExoticComponent<CircleLogoProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
6
|
export {};
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
1
|
+
import React, { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { ActiveTabId, ToolbarMode } from '../types';
|
|
3
3
|
import type { IFlagOverridePlugin, IEventInterceptionPlugin } from '../../../types/plugin';
|
|
4
4
|
interface ExpandedToolbarContentProps {
|
|
5
|
-
isExpanded: boolean;
|
|
6
5
|
activeTab: ActiveTabId;
|
|
7
6
|
slideDirection: number;
|
|
8
7
|
searchTerm: string;
|
|
9
8
|
searchIsExpanded: boolean;
|
|
10
9
|
onSearch: (searchTerm: string) => void;
|
|
11
10
|
onClose: () => void;
|
|
11
|
+
onTogglePin: () => void;
|
|
12
|
+
isPinned: boolean;
|
|
12
13
|
onTabChange: (tabId: string) => void;
|
|
13
14
|
setSearchIsExpanded: Dispatch<SetStateAction<boolean>>;
|
|
14
15
|
mode: ToolbarMode;
|
|
16
|
+
baseUrl: string;
|
|
17
|
+
defaultActiveTab: ActiveTabId;
|
|
15
18
|
flagOverridePlugin?: IFlagOverridePlugin;
|
|
16
19
|
eventInterceptionPlugin?: IEventInterceptionPlugin;
|
|
17
20
|
}
|
|
18
|
-
export declare
|
|
21
|
+
export declare const ExpandedToolbarContent: React.ForwardRefExoticComponent<ExpandedToolbarContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
19
22
|
export {};
|
|
@@ -2,10 +2,13 @@ import { TabId, ToolbarMode } from '../types';
|
|
|
2
2
|
import type { IFlagOverridePlugin, IEventInterceptionPlugin } from '../../../types/plugin';
|
|
3
3
|
interface TabContentRendererProps {
|
|
4
4
|
activeTab: TabId;
|
|
5
|
+
baseUrl: string;
|
|
5
6
|
slideDirection: number;
|
|
6
7
|
mode: ToolbarMode;
|
|
7
8
|
flagOverridePlugin?: IFlagOverridePlugin;
|
|
8
9
|
eventInterceptionPlugin?: IEventInterceptionPlugin;
|
|
10
|
+
isPinned: boolean;
|
|
11
|
+
onTogglePin: () => void;
|
|
9
12
|
}
|
|
10
13
|
export declare function TabContentRenderer(props: TabContentRendererProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
14
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { SearchIcon } from './SearchIcon';
|
|
2
2
|
export { ChevronDownIcon } from './ChevronDownIcon';
|
|
3
|
+
export { ChevronUpIcon } from './ChevronUpIcon';
|
|
3
4
|
export { EditIcon } from './EditIcon';
|
|
4
5
|
export { SyncIcon } from './SyncIcon';
|
|
5
6
|
export { ArrowUndoIcon } from './ArrowUndoIcon';
|
|
@@ -4,60 +4,98 @@ export declare const EASING: {
|
|
|
4
4
|
readonly elastic: readonly [0.22, 1, 0.36, 1];
|
|
5
5
|
};
|
|
6
6
|
export declare const ANIMATION_CONFIG: {
|
|
7
|
+
readonly containerExpand: {
|
|
8
|
+
readonly width: {
|
|
9
|
+
readonly duration: 0.25;
|
|
10
|
+
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
11
|
+
};
|
|
12
|
+
readonly height: {
|
|
13
|
+
readonly duration: 0.25;
|
|
14
|
+
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
15
|
+
};
|
|
16
|
+
readonly borderRadius: {
|
|
17
|
+
readonly duration: 0.2;
|
|
18
|
+
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
19
|
+
};
|
|
20
|
+
readonly boxShadow: {
|
|
21
|
+
readonly duration: 0.2;
|
|
22
|
+
readonly ease: "easeInOut";
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
readonly containerCollapse: {
|
|
26
|
+
readonly width: {
|
|
27
|
+
readonly duration: 0.35;
|
|
28
|
+
readonly ease: readonly [0.22, 1, 0.36, 1];
|
|
29
|
+
};
|
|
30
|
+
readonly height: {
|
|
31
|
+
readonly duration: 0.35;
|
|
32
|
+
readonly ease: readonly [0.22, 1, 0.36, 1];
|
|
33
|
+
};
|
|
34
|
+
readonly borderRadius: {
|
|
35
|
+
readonly duration: 0.25;
|
|
36
|
+
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
37
|
+
};
|
|
38
|
+
readonly boxShadow: {
|
|
39
|
+
readonly duration: 0.25;
|
|
40
|
+
readonly ease: "easeInOut";
|
|
41
|
+
};
|
|
42
|
+
};
|
|
7
43
|
readonly container: {
|
|
8
44
|
readonly width: {
|
|
9
|
-
readonly duration: 0.
|
|
10
|
-
readonly ease: readonly [0.
|
|
45
|
+
readonly duration: 0.25;
|
|
46
|
+
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
11
47
|
};
|
|
12
48
|
readonly height: {
|
|
13
|
-
readonly duration: 0.
|
|
14
|
-
readonly ease: readonly [0.
|
|
49
|
+
readonly duration: 0.25;
|
|
50
|
+
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
15
51
|
};
|
|
16
52
|
readonly borderRadius: {
|
|
17
|
-
readonly duration: 0.
|
|
53
|
+
readonly duration: 0.2;
|
|
18
54
|
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
19
55
|
};
|
|
20
56
|
readonly boxShadow: {
|
|
21
|
-
readonly duration: 0.
|
|
57
|
+
readonly duration: 0.2;
|
|
22
58
|
readonly ease: "easeInOut";
|
|
23
59
|
};
|
|
24
60
|
};
|
|
25
61
|
readonly circleLogo: {
|
|
26
62
|
readonly opacity: {
|
|
27
|
-
readonly duration: 0.
|
|
63
|
+
readonly duration: 0.15;
|
|
28
64
|
readonly ease: "easeOut";
|
|
29
65
|
};
|
|
30
66
|
readonly scale: {
|
|
31
|
-
readonly duration: 0.
|
|
67
|
+
readonly duration: 0.2;
|
|
32
68
|
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
33
69
|
};
|
|
34
70
|
readonly rotate: {
|
|
35
|
-
readonly duration: 0.
|
|
71
|
+
readonly duration: 0.2;
|
|
36
72
|
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
37
73
|
};
|
|
38
74
|
};
|
|
39
75
|
readonly toolbarContent: {
|
|
40
76
|
readonly opacity: {
|
|
41
|
-
readonly duration: 0.
|
|
77
|
+
readonly duration: 0.2;
|
|
42
78
|
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
43
79
|
};
|
|
44
80
|
readonly y: {
|
|
45
|
-
readonly duration: 0.
|
|
46
|
-
readonly ease: readonly [0.
|
|
81
|
+
readonly duration: 0.25;
|
|
82
|
+
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
47
83
|
};
|
|
48
84
|
readonly scale: {
|
|
49
|
-
readonly duration: 0.
|
|
50
|
-
readonly ease: readonly [0.
|
|
85
|
+
readonly duration: 0.25;
|
|
86
|
+
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
51
87
|
};
|
|
52
88
|
};
|
|
53
89
|
readonly contentArea: {
|
|
54
90
|
readonly opacity: {
|
|
55
|
-
readonly duration: 0.
|
|
91
|
+
readonly duration: 0.2;
|
|
56
92
|
readonly ease: "easeInOut";
|
|
93
|
+
readonly delay: 0.1;
|
|
57
94
|
};
|
|
58
|
-
readonly
|
|
59
|
-
readonly duration: 0.
|
|
60
|
-
readonly ease: readonly [0.
|
|
95
|
+
readonly y: {
|
|
96
|
+
readonly duration: 0.25;
|
|
97
|
+
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
98
|
+
readonly delay: 0.1;
|
|
61
99
|
};
|
|
62
100
|
};
|
|
63
101
|
readonly tabContent: {
|
|
@@ -66,14 +104,14 @@ export declare const ANIMATION_CONFIG: {
|
|
|
66
104
|
};
|
|
67
105
|
readonly tabsContainer: {
|
|
68
106
|
readonly opacity: {
|
|
69
|
-
readonly duration: 0.
|
|
70
|
-
readonly ease: readonly [0.
|
|
107
|
+
readonly duration: 0.2;
|
|
108
|
+
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
71
109
|
};
|
|
72
110
|
readonly y: {
|
|
73
|
-
readonly duration: 0.
|
|
74
|
-
readonly ease: readonly [0.
|
|
111
|
+
readonly duration: 0.2;
|
|
112
|
+
readonly ease: readonly [0.25, 0.46, 0.45, 0.94];
|
|
75
113
|
};
|
|
76
|
-
readonly delay: 0.
|
|
114
|
+
readonly delay: 0.05;
|
|
77
115
|
};
|
|
78
116
|
readonly eventList: {
|
|
79
117
|
readonly liveTail: {
|
|
@@ -105,9 +143,9 @@ export declare const ANIMATION_CONFIG: {
|
|
|
105
143
|
};
|
|
106
144
|
export declare const DIMENSIONS: {
|
|
107
145
|
readonly collapsed: {
|
|
108
|
-
readonly width:
|
|
109
|
-
readonly height:
|
|
110
|
-
readonly borderRadius:
|
|
146
|
+
readonly width: 48;
|
|
147
|
+
readonly height: 48;
|
|
148
|
+
readonly borderRadius: 24;
|
|
111
149
|
};
|
|
112
150
|
readonly expanded: {
|
|
113
151
|
readonly width: 400;
|
|
@@ -124,3 +162,7 @@ export declare const SHADOWS: {
|
|
|
124
162
|
readonly hoveredCollapsed: "0 8px 40px rgba(0, 0, 0, 0.4)";
|
|
125
163
|
readonly collapsed: "0 4px 16px rgba(0, 0, 0, 0.3)";
|
|
126
164
|
};
|
|
165
|
+
export declare const DRAG_CONSTANTS: {
|
|
166
|
+
readonly THRESHOLD_PIXELS: 3;
|
|
167
|
+
readonly CLICK_RESET_DELAY_MS: 50;
|
|
168
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LDClient } from 'launchdarkly-js-client-sdk';
|
|
2
|
+
import { ToolbarAnalytics } from '../../../utils/analytics';
|
|
3
|
+
interface AnalyticsProviderProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
ldClient?: LDClient | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function AnalyticsProvider({ children, ldClient }: AnalyticsProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function useAnalytics(): ToolbarAnalytics;
|
|
9
|
+
export {};
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import type { FC, ReactNode } from 'react';
|
|
2
2
|
import { LdToolbarConfig, ToolbarState } from '../../../types/devServer';
|
|
3
|
-
import { ToolbarPosition } from '../types/toolbar';
|
|
4
3
|
interface DevServerContextValue {
|
|
5
4
|
state: ToolbarState & {
|
|
6
5
|
availableProjects: string[];
|
|
7
6
|
currentProjectKey: string | null;
|
|
8
|
-
position: ToolbarPosition;
|
|
9
7
|
};
|
|
10
8
|
setOverride: (flagKey: string, value: any) => Promise<void>;
|
|
11
9
|
clearOverride: (flagKey: string) => Promise<void>;
|
|
12
10
|
clearAllOverrides: () => Promise<void>;
|
|
13
11
|
refresh: () => Promise<void>;
|
|
14
12
|
switchProject: (projectKey: string) => Promise<void>;
|
|
15
|
-
handlePositionChange: (position: ToolbarPosition) => void;
|
|
16
13
|
}
|
|
17
14
|
export declare const useDevServerContext: () => DevServerContextValue;
|
|
18
15
|
export interface DevServerProviderProps {
|
|
19
16
|
children: ReactNode;
|
|
20
17
|
config: LdToolbarConfig;
|
|
21
|
-
initialPosition?: ToolbarPosition;
|
|
22
18
|
}
|
|
23
19
|
export declare const DevServerProvider: FC<DevServerProviderProps>;
|
|
24
20
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import type { ToolbarPosition } from '../types/toolbar';
|
|
3
|
+
interface ToolbarUIContextValue {
|
|
4
|
+
position: ToolbarPosition;
|
|
5
|
+
handlePositionChange: (position: ToolbarPosition) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const useToolbarUIContext: () => ToolbarUIContextValue;
|
|
8
|
+
export interface ToolbarUIProviderProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
initialPosition?: ToolbarPosition;
|
|
11
|
+
}
|
|
12
|
+
export declare const ToolbarUIProvider: FC<ToolbarUIProviderProps>;
|
|
13
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { DevServerProvider, useDevServerContext } from './DevServerProvider';
|
|
2
2
|
export { SearchProvider, useSearchContext } from './SearchProvider';
|
|
3
|
+
export { ToolbarUIProvider, useToolbarUIContext } from './ToolbarUIProvider';
|
|
3
4
|
export { FlagSdkOverrideProvider, useFlagSdkOverrideContext, type LocalFlag, type FlagSdkOverrideContextType, } from './FlagSdkOverrideProvider';
|
|
5
|
+
export { AnalyticsProvider, useAnalytics } from './AnalyticsProvider';
|
|
@@ -2,6 +2,5 @@ export { useToolbarState } from './useToolbarState';
|
|
|
2
2
|
export { useToolbarAnimations } from './useToolbarAnimations';
|
|
3
3
|
export { useToolbarVisibility } from './useToolbarVisibility';
|
|
4
4
|
export { useToolbarDrag } from './useToolbarDrag';
|
|
5
|
-
export { useKeyPressed } from './useKeyPressed';
|
|
6
5
|
export { useEvents } from './useEvents';
|
|
7
6
|
export { useCurrentDate } from './useCurrentDate';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { ANIMATION_CONFIG } from '../constants';
|
|
3
3
|
export interface UseToolbarAnimationsProps {
|
|
4
|
-
|
|
5
|
-
isHovered: boolean;
|
|
4
|
+
isExpanded: boolean;
|
|
6
5
|
setIsAnimating: Dispatch<SetStateAction<boolean>>;
|
|
6
|
+
onExpandComplete?: () => void;
|
|
7
|
+
onCollapseComplete?: () => void;
|
|
7
8
|
}
|
|
9
|
+
type AnimationConfig = typeof ANIMATION_CONFIG.containerExpand | typeof ANIMATION_CONFIG.containerCollapse;
|
|
8
10
|
export interface UseToolbarAnimationsReturn {
|
|
9
11
|
containerAnimations: {
|
|
10
12
|
width: number;
|
|
@@ -13,8 +15,9 @@ export interface UseToolbarAnimationsReturn {
|
|
|
13
15
|
scale: number;
|
|
14
16
|
boxShadow: string;
|
|
15
17
|
};
|
|
16
|
-
animationConfig:
|
|
18
|
+
animationConfig: AnimationConfig;
|
|
17
19
|
handleAnimationStart: () => void;
|
|
18
20
|
handleAnimationComplete: () => void;
|
|
19
21
|
}
|
|
20
22
|
export declare function useToolbarAnimations(props: UseToolbarAnimationsProps): UseToolbarAnimationsReturn;
|
|
23
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
interface UseToolbarDragOptions {
|
|
2
2
|
enabled: boolean;
|
|
3
|
-
onDragEnd: (clientX: number) => void;
|
|
3
|
+
onDragEnd: (clientX: number, clientY: number) => void;
|
|
4
4
|
elementRef: React.RefObject<HTMLDivElement | null>;
|
|
5
5
|
}
|
|
6
6
|
interface UseToolbarDragReturn {
|
|
7
7
|
handleMouseDown: (event: React.MouseEvent) => void;
|
|
8
|
+
isDragging: () => boolean;
|
|
8
9
|
}
|
|
9
10
|
export declare function useToolbarDrag({ enabled, onDragEnd, elementRef }: UseToolbarDragOptions): UseToolbarDragReturn;
|
|
10
11
|
export {};
|
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { ActiveTabId } from '../types';
|
|
3
|
+
export interface UseToolbarStateProps {
|
|
4
|
+
defaultActiveTab: ActiveTabId;
|
|
5
|
+
}
|
|
3
6
|
export interface UseToolbarStateReturn {
|
|
4
7
|
isExpanded: boolean;
|
|
5
|
-
isHovered: boolean;
|
|
6
8
|
activeTab: ActiveTabId;
|
|
7
9
|
previousTab: ActiveTabId;
|
|
8
10
|
isAnimating: boolean;
|
|
9
11
|
searchIsExpanded: boolean;
|
|
10
|
-
showFullToolbar: boolean;
|
|
11
12
|
slideDirection: number;
|
|
12
13
|
hasBeenExpanded: boolean;
|
|
13
|
-
|
|
14
|
+
isPinned: boolean;
|
|
14
15
|
toolbarRef: React.RefObject<HTMLDivElement | null>;
|
|
15
16
|
handleTabChange: (tabId: string) => void;
|
|
16
|
-
handleMouseEnter: () => void;
|
|
17
|
-
handleMouseLeave: () => void;
|
|
18
17
|
handleClose: () => void;
|
|
19
18
|
handleSearch: (newSearchTerm: string) => void;
|
|
19
|
+
handleTogglePin: () => void;
|
|
20
|
+
handleCircleClick: () => void;
|
|
20
21
|
setIsAnimating: Dispatch<SetStateAction<boolean>>;
|
|
21
22
|
setSearchIsExpanded: Dispatch<SetStateAction<boolean>>;
|
|
22
23
|
}
|
|
23
|
-
export declare function useToolbarState(): UseToolbarStateReturn;
|
|
24
|
+
export declare function useToolbarState(props: UseToolbarStateProps): UseToolbarStateReturn;
|
|
@@ -16,5 +16,5 @@ export interface FeatureFlag {
|
|
|
16
16
|
lastModified?: Date;
|
|
17
17
|
environment?: string;
|
|
18
18
|
}
|
|
19
|
-
export declare const TOOLBAR_POSITIONS: readonly ["left", "right"];
|
|
19
|
+
export declare const TOOLBAR_POSITIONS: readonly ["top-left", "top-right", "bottom-left", "bottom-right"];
|
|
20
20
|
export type ToolbarPosition = (typeof TOOLBAR_POSITIONS)[number];
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { ToolbarPosition } from '../types/toolbar';
|
|
2
2
|
export declare const TOOLBAR_STORAGE_KEYS: {
|
|
3
|
-
readonly
|
|
3
|
+
readonly SETTINGS: "ld-toolbar-settings";
|
|
4
4
|
readonly DISABLED: "ld-toolbar-disabled";
|
|
5
5
|
readonly PROJECT: "ld-toolbar-project";
|
|
6
6
|
};
|
|
7
|
+
export interface ToolbarSettings {
|
|
8
|
+
position: ToolbarPosition;
|
|
9
|
+
pinned: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_SETTINGS: ToolbarSettings;
|
|
7
12
|
export declare function saveToolbarPosition(position: ToolbarPosition): void;
|
|
8
13
|
export declare function loadToolbarPosition(): ToolbarPosition | null;
|
|
14
|
+
export declare function saveToolbarPinned(isPinned: boolean): void;
|
|
15
|
+
export declare function loadToolbarPinned(): boolean;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { LDClient } from 'launchdarkly-js-client-sdk';
|
|
2
|
+
export declare const ANALYTICS_EVENT_PREFIX = "ld.toolbar";
|
|
3
|
+
/**
|
|
4
|
+
* Analytics utility for tracking toolbar usage events
|
|
5
|
+
*/
|
|
6
|
+
export declare class ToolbarAnalytics {
|
|
7
|
+
private ldClient;
|
|
8
|
+
private searchDebounceTimer;
|
|
9
|
+
constructor(ldClient?: LDClient | null);
|
|
10
|
+
/**
|
|
11
|
+
* Internal method to send tracking events
|
|
12
|
+
*/
|
|
13
|
+
private track;
|
|
14
|
+
/**
|
|
15
|
+
* Track toolbar initialization
|
|
16
|
+
*/
|
|
17
|
+
trackInitialization(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Track toolbar position changes
|
|
20
|
+
*/
|
|
21
|
+
trackPositionChange(oldPosition: string, newPosition: string, source: 'drag' | 'settings'): void;
|
|
22
|
+
/**
|
|
23
|
+
* Track toolbar pin/unpin actions
|
|
24
|
+
*/
|
|
25
|
+
trackPinToggle(action: 'pin' | 'unpin'): void;
|
|
26
|
+
/**
|
|
27
|
+
* Track toolbar tab navigation
|
|
28
|
+
*/
|
|
29
|
+
trackTabChange(fromTab: string | null, toTab: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Track search usage
|
|
32
|
+
*/
|
|
33
|
+
trackSearch(query: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Track toolbar expand/collapse events
|
|
36
|
+
*/
|
|
37
|
+
trackToolbarToggle(action: 'expand' | 'collapse', trigger: 'close_button' | 'click_outside' | 'tab_toggle'): void;
|
|
38
|
+
/**
|
|
39
|
+
* Track flag override events
|
|
40
|
+
*/
|
|
41
|
+
trackFlagOverride(flagKey: string, value: unknown, action: 'set' | 'remove' | 'clear_all'): void;
|
|
42
|
+
/**
|
|
43
|
+
* Track opening a flag deeplink
|
|
44
|
+
*/
|
|
45
|
+
trackOpenFlagDeeplink(flagKey: string, baseUrl: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Track 'Show overrides only' clicks
|
|
48
|
+
*/
|
|
49
|
+
trackShowOverridesOnlyClick(enabled: boolean): void;
|
|
50
|
+
/**
|
|
51
|
+
* Track Event clicks
|
|
52
|
+
*/
|
|
53
|
+
trackEventClick(eventName: string): void;
|
|
54
|
+
}
|