cmcts-c-agent-embedding 1.0.35 → 1.0.36-cagent
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/.eslintrc.cjs +1 -0
- package/.idea/{Flowise-share-chatbox.iml → flowise-chatbox.iml} +0 -1
- package/.idea/modules.xml +1 -2
- package/.idea/vcs.xml +5 -6
- package/AGENTS.md +166 -0
- package/README.md +349 -349
- package/auggie_shell_conversation.txt +31 -0
- package/auggie_shell_user_request.txt +5 -0
- package/dist/BubbleChat.d.ts +9 -12
- package/dist/BubbleChat.d.ts.map +1 -1
- package/dist/FullPageChat.d.ts +17 -17
- package/dist/components/Bot.d.ts +9 -0
- package/dist/components/Bot.d.ts.map +1 -1
- package/dist/components/FeedbackContentDialog.d.ts.map +1 -1
- package/dist/components/Toast.d.ts +10 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/bubbles/BotBubble.d.ts +7 -0
- package/dist/components/bubbles/BotBubble.d.ts.map +1 -1
- package/dist/components/bubbles/ChartBubble.d.ts +73 -0
- package/dist/components/bubbles/ChartBubble.d.ts.map +1 -0
- package/dist/components/bubbles/ChartLoadingPlaceholder.d.ts +8 -0
- package/dist/components/bubbles/ChartLoadingPlaceholder.d.ts.map +1 -0
- package/dist/components/bubbles/ChartPlaceholder.d.ts +20 -0
- package/dist/components/bubbles/ChartPlaceholder.d.ts.map +1 -0
- package/dist/components/bubbles/ChartPopupModal.d.ts +4 -0
- package/dist/components/bubbles/ChartPopupModal.d.ts.map +1 -0
- package/dist/components/bubbles/ChartPortalContainer.d.ts +12 -0
- package/dist/components/bubbles/ChartPortalContainer.d.ts.map +1 -0
- package/dist/components/bubbles/LoadingBubble.d.ts +7 -1
- package/dist/components/bubbles/LoadingBubble.d.ts.map +1 -1
- package/dist/components/bubbles/SourceBubble.d.ts.map +1 -1
- package/dist/components/bubbles/StableChartWrapper.d.ts +18 -0
- package/dist/components/bubbles/StableChartWrapper.d.ts.map +1 -0
- package/dist/components/bubbles/StarterPromptBubble.d.ts.map +1 -1
- package/dist/components/buttons/CopyMessageButton.d.ts +10 -0
- package/dist/components/buttons/CopyMessageButton.d.ts.map +1 -0
- package/dist/components/buttons/EditMessageButton.d.ts +8 -0
- package/dist/components/buttons/EditMessageButton.d.ts.map +1 -0
- package/dist/components/buttons/PopupToast.d.ts +7 -0
- package/dist/components/buttons/PopupToast.d.ts.map +1 -0
- package/dist/components/buttons/SendButton.d.ts +1 -0
- package/dist/components/buttons/SendButton.d.ts.map +1 -1
- package/dist/components/dialogs/EditMessageDialog.d.ts +9 -0
- package/dist/components/dialogs/EditMessageDialog.d.ts.map +1 -0
- package/dist/components/icons/AddImageIcon.d.ts.map +1 -1
- package/dist/components/icons/CheckIcon.d.ts +3 -0
- package/dist/components/icons/CheckIcon.d.ts.map +1 -0
- package/dist/components/icons/CmcIcon.d.ts +3 -0
- package/dist/components/icons/CmcIcon.d.ts.map +1 -0
- package/dist/components/icons/CopyIcon.d.ts +5 -0
- package/dist/components/icons/CopyIcon.d.ts.map +1 -0
- package/dist/components/icons/EditIcon.d.ts +5 -0
- package/dist/components/icons/EditIcon.d.ts.map +1 -0
- package/dist/components/icons/FullScreenIcon.d.ts +3 -0
- package/dist/components/icons/FullScreenIcon.d.ts.map +1 -0
- package/dist/components/icons/ResetBtn.d.ts +3 -0
- package/dist/components/icons/ResetBtn.d.ts.map +1 -0
- package/dist/components/icons/ResetZoomIcon.d.ts +3 -0
- package/dist/components/icons/ResetZoomIcon.d.ts.map +1 -0
- package/dist/components/icons/SendIconOff.d.ts +3 -0
- package/dist/components/icons/SendIconOff.d.ts.map +1 -0
- package/dist/components/icons/SendIconOn.d.ts +3 -0
- package/dist/components/icons/SendIconOn.d.ts.map +1 -0
- package/dist/components/icons/ZoomInIcon.d.ts +3 -0
- package/dist/components/icons/ZoomInIcon.d.ts.map +1 -0
- package/dist/components/icons/ZoomOutIcon.d.ts +3 -0
- package/dist/components/icons/ZoomOutIcon.d.ts.map +1 -0
- package/dist/components/icons/index.d.ts +7 -0
- package/dist/components/icons/index.d.ts.map +1 -1
- package/dist/components/image/PreviewImage.d.ts +5 -0
- package/dist/components/image/PreviewImage.d.ts.map +1 -0
- package/dist/components/inputs/textInput/components/ShortTextInput.d.ts +4 -0
- package/dist/components/inputs/textInput/components/ShortTextInput.d.ts.map +1 -1
- package/dist/components/inputs/textInput/components/TextInput.d.ts +16 -1
- package/dist/components/inputs/textInput/components/TextInput.d.ts.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/features/bubble/components/Bubble.d.ts.map +1 -1
- package/dist/features/full/components/Full.d.ts.map +1 -1
- package/dist/features/popup/components/Popup.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/queries/sendMessageQuery.d.ts +19 -1
- package/dist/queries/sendMessageQuery.d.ts.map +1 -1
- package/dist/types/chart.d.ts +86 -0
- package/dist/types/chart.d.ts.map +1 -0
- package/dist/utils/chartConfigManager.d.ts +54 -0
- package/dist/utils/chartConfigManager.d.ts.map +1 -0
- package/dist/utils/chartInstanceManager.d.ts +43 -0
- package/dist/utils/chartInstanceManager.d.ts.map +1 -0
- package/dist/utils/chartPopupManager.d.ts +43 -0
- package/dist/utils/chartPopupManager.d.ts.map +1 -0
- package/dist/utils/chartPortalManager.d.ts +76 -0
- package/dist/utils/chartPortalManager.d.ts.map +1 -0
- package/dist/utils/chartTagParser.d.ts +39 -0
- package/dist/utils/chartTagParser.d.ts.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/security.d.ts +50 -0
- package/dist/utils/security.d.ts.map +1 -0
- package/dist/utils/textStreamSmoother.d.ts +40 -0
- package/dist/utils/textStreamSmoother.d.ts.map +1 -0
- package/dist/utils/transcriptApi.d.ts +8 -0
- package/dist/utils/transcriptApi.d.ts.map +1 -0
- package/dist/utils/ultimateJsonParser.d.ts +2 -0
- package/dist/utils/ultimateJsonParser.d.ts.map +1 -0
- package/dist/web.d.ts +4 -2
- package/dist/web.d.ts.map +1 -1
- package/dist/web.js +1 -1
- package/dist/window.d.ts +2 -1
- package/dist/window.d.ts.map +1 -1
- package/docs/chart-rendering-implementation-plan.md +565 -0
- package/package.json +10 -4
- package/public/index.html +4 -114
- package/server.js +401 -401
- package/.env +0 -36
- package/.husky/pre-commit +0 -18
- package/.idea/AugmentWebviewStateStore.xml +0 -10
- package/.idea/codeStyles/Project.xml +0 -60
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -16
- package/.idea/prettier.xml +0 -6
- package/dist/components/ImageUploadButton.d.ts +0 -11
- package/dist/components/ImageUploadButton.d.ts.map +0 -1
- package/dist/components/RecordAudioButton.d.ts +0 -11
- package/dist/components/RecordAudioButton.d.ts.map +0 -1
- package/dist/components/SendButton.d.ts +0 -12
- package/dist/components/SendButton.d.ts.map +0 -1
|
@@ -83,6 +83,16 @@ export declare const getChatbotConfig: ({ chatflowid, apiHost, onRequest }: Mess
|
|
|
83
83
|
data?: any;
|
|
84
84
|
error?: Error | undefined;
|
|
85
85
|
}>;
|
|
86
|
+
export declare const getMessageById: ({ chatflowid, apiHost, messageId }: BaseRequest & {
|
|
87
|
+
chatflowid?: string | undefined;
|
|
88
|
+
body?: IncomingInput | undefined;
|
|
89
|
+
} & {
|
|
90
|
+
messageId: string;
|
|
91
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
92
|
+
export declare const updateMessage: ({ apiHost, body, onRequest }: MessageRequest) => Promise<{
|
|
93
|
+
data?: any;
|
|
94
|
+
error?: Error | undefined;
|
|
95
|
+
}>;
|
|
86
96
|
export declare const isStreamAvailableQuery: ({ chatflowid, apiHost, onRequest }: MessageRequest) => Promise<{
|
|
87
97
|
data?: any;
|
|
88
98
|
error?: Error | undefined;
|
|
@@ -91,6 +101,14 @@ export declare const sendFileDownloadQuery: ({ apiHost, body, onRequest }: Messa
|
|
|
91
101
|
data?: any;
|
|
92
102
|
error?: Error | undefined;
|
|
93
103
|
}>;
|
|
104
|
+
export declare const popDataFromCache: ({ apiHost, key, onRequest, }: {
|
|
105
|
+
apiHost?: string | undefined;
|
|
106
|
+
key: string;
|
|
107
|
+
onRequest?: ((request: RequestInit) => Promise<void>) | undefined;
|
|
108
|
+
}) => Promise<{
|
|
109
|
+
data?: any;
|
|
110
|
+
error?: Error | undefined;
|
|
111
|
+
}>;
|
|
94
112
|
export declare const addLeadQuery: ({ apiHost, body, onRequest }: LeadCaptureRequest) => Promise<{
|
|
95
113
|
data?: any;
|
|
96
114
|
error?: Error | undefined;
|
|
@@ -113,7 +131,7 @@ export declare const vectorSearchFaqsQuery: ({ chatflowid, apiHost, query, onReq
|
|
|
113
131
|
data?: any;
|
|
114
132
|
error?: Error | undefined;
|
|
115
133
|
}>;
|
|
116
|
-
export declare const getFileContent: ({ apiHost, path, onRequest }: {
|
|
134
|
+
export declare const getFileContent: ({ apiHost, path, onRequest, }: {
|
|
117
135
|
apiHost?: string | undefined;
|
|
118
136
|
path: string;
|
|
119
137
|
onRequest?: ((request: RequestInit) => Promise<void>) | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendMessageQuery.d.ts","sourceRoot":"","sources":["../../src/queries/sendMessageQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"sendMessageQuery.d.ts","sourceRoot":"","sources":["../../src/queries/sendMessageQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIvD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,gBAAgB,CAAC,EAAE,MAAM,CA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AAM,YAAY,iCAA4D,kBAAkB;;;EASnG,CAAC;AAEL,eAAO,MAAM,eAAe;;;WAQnB,MAAM;2BACS,WAAW,KAAK,QAAQ,IAAI,CAAC;;;;EAUpD,CAAC;AAEF,eAAO,MAAM,qBAAqB;gBAMpB,MAAM;;WAEX,MAAM;2BACS,WAAW,KAAK,QAAQ,IAAI,CAAC;;;;EAUpD,CAAC;AAEF,eAAO,MAAM,cAAc;;UAMnB,MAAM;2BACU,WAAW,KAAK,QAAQ,IAAI,CAAC;;;;EAUpD,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { ChartData, ChartOptions, ChartType } from 'chart.js';
|
|
2
|
+
/**
|
|
3
|
+
* Supported chart types for the XML tag parser
|
|
4
|
+
*/
|
|
5
|
+
export type SupportedChartType = 'line' | 'bar' | 'pie' | 'doughnut' | 'radar' | 'polarArea' | 'bubble' | 'scatter';
|
|
6
|
+
/**
|
|
7
|
+
* Chart configuration parsed from XML tag
|
|
8
|
+
*/
|
|
9
|
+
export interface ChartConfig {
|
|
10
|
+
id: string;
|
|
11
|
+
type: SupportedChartType;
|
|
12
|
+
title?: string;
|
|
13
|
+
unit?: string;
|
|
14
|
+
data: ChartData<ChartType>;
|
|
15
|
+
options?: ChartOptions<ChartType>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Result from processing a token through the chart parser
|
|
19
|
+
*/
|
|
20
|
+
export interface ChartParseResult {
|
|
21
|
+
/** Regular text content to render (non-chart content) */
|
|
22
|
+
textContent: string;
|
|
23
|
+
/** IDs of chart placeholders that were added */
|
|
24
|
+
chartPlaceholders: string[];
|
|
25
|
+
/** Fully parsed chart configurations ready to render */
|
|
26
|
+
completedCharts: ChartConfig[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parser state machine states
|
|
30
|
+
*/
|
|
31
|
+
export declare enum ChartParserState {
|
|
32
|
+
/** Normal text parsing mode */
|
|
33
|
+
IDLE = "IDLE",
|
|
34
|
+
/** Detected potential opening tag, buffering */
|
|
35
|
+
OPENING_TAG = "OPENING_TAG",
|
|
36
|
+
/** Inside chart tag, buffering JSON content */
|
|
37
|
+
INSIDE_TAG = "INSIDE_TAG",
|
|
38
|
+
/** Detected potential closing tag */
|
|
39
|
+
CLOSING_TAG = "CLOSING_TAG"
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Chart tag attributes extracted from opening tag
|
|
43
|
+
*/
|
|
44
|
+
export interface ChartTagAttributes {
|
|
45
|
+
type: SupportedChartType;
|
|
46
|
+
title?: string;
|
|
47
|
+
unit?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Partial chart config for pending charts (streaming)
|
|
51
|
+
*/
|
|
52
|
+
export interface PendingChart {
|
|
53
|
+
id: string;
|
|
54
|
+
attributes?: ChartTagAttributes;
|
|
55
|
+
buffer?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Props for ChartBubble component
|
|
59
|
+
*/
|
|
60
|
+
export interface ChartBubbleProps {
|
|
61
|
+
config: ChartConfig;
|
|
62
|
+
backgroundColor?: string;
|
|
63
|
+
textColor?: string;
|
|
64
|
+
/** Enable zoom/pan interactivity (used in popup modal) */
|
|
65
|
+
enableZoom?: boolean;
|
|
66
|
+
/** Callback to open chart in fullscreen popup */
|
|
67
|
+
onOpenFullscreen?: () => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Props for ChartLoadingPlaceholder component
|
|
71
|
+
*/
|
|
72
|
+
export interface ChartLoadingPlaceholderProps {
|
|
73
|
+
chartId: string;
|
|
74
|
+
backgroundColor?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Props for ChartPopupModal component
|
|
78
|
+
*/
|
|
79
|
+
export interface ChartPopupModalProps {
|
|
80
|
+
isOpen: boolean;
|
|
81
|
+
config: ChartConfig;
|
|
82
|
+
onClose: () => void;
|
|
83
|
+
backgroundColor?: string;
|
|
84
|
+
textColor?: string;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.d.ts","sourceRoot":"","sources":["../../src/types/chart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEnE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,UAAU,GAAG,OAAO,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEpH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,wDAAwD;IACxD,eAAe,EAAE,WAAW,EAAE,CAAC;CAChC;AAED;;GAEG;AACH,oBAAY,gBAAgB;IAC1B,+BAA+B;IAC/B,IAAI,SAAS;IACb,gDAAgD;IAChD,WAAW,gBAAgB;IAC3B,+CAA+C;IAC/C,UAAU,eAAe;IACzB,qCAAqC;IACrC,WAAW,gBAAgB;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,kBAAkB,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
import type { ChartConfig } from '@/types/chart';
|
|
3
|
+
/**
|
|
4
|
+
* Global state manager for chart configurations during streaming.
|
|
5
|
+
* This singleton manages chart config state outside of the component tree,
|
|
6
|
+
* preventing reactivity issues when charts complete during SSE streaming.
|
|
7
|
+
*
|
|
8
|
+
* The problem: When using render() from solid-js/web to mount ChartPlaceholder
|
|
9
|
+
* components into DOM slots, the rendered components are in an isolated reactive
|
|
10
|
+
* root that doesn't share the parent's reactive context. Props passed to these
|
|
11
|
+
* components don't update reactively when the parent's signals change.
|
|
12
|
+
*
|
|
13
|
+
* The solution: Use a global manager with SolidJS signals that can be accessed
|
|
14
|
+
* from any component, regardless of which reactive root it's in.
|
|
15
|
+
*/
|
|
16
|
+
declare class ChartConfigManager {
|
|
17
|
+
private _configs;
|
|
18
|
+
private _loadingStates;
|
|
19
|
+
/**
|
|
20
|
+
* Get or create a config signal for a chart
|
|
21
|
+
*/
|
|
22
|
+
getConfigSignal(chartId: string): Accessor<ChartConfig | null>;
|
|
23
|
+
/**
|
|
24
|
+
* Get or create a loading state signal for a chart
|
|
25
|
+
*/
|
|
26
|
+
getLoadingSignal(chartId: string): Accessor<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Set the config for a chart (called when chart streaming completes)
|
|
29
|
+
*/
|
|
30
|
+
setConfig(chartId: string, config: ChartConfig): void;
|
|
31
|
+
/**
|
|
32
|
+
* Set the loading state for a chart
|
|
33
|
+
*/
|
|
34
|
+
setLoading(chartId: string, loading: boolean): void;
|
|
35
|
+
/**
|
|
36
|
+
* Initialize a chart with optional initial config (for historical messages)
|
|
37
|
+
*/
|
|
38
|
+
initChart(chartId: string, config: ChartConfig | null, isLoading: boolean): void;
|
|
39
|
+
/**
|
|
40
|
+
* Check if a chart has a config
|
|
41
|
+
*/
|
|
42
|
+
hasConfig(chartId: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Clear all chart configs (useful for cleanup between conversations)
|
|
45
|
+
*/
|
|
46
|
+
clear(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Remove a specific chart's config
|
|
49
|
+
*/
|
|
50
|
+
removeChart(chartId: string): void;
|
|
51
|
+
}
|
|
52
|
+
export declare const chartConfigManager: ChartConfigManager;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=chartConfigManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartConfigManager.d.ts","sourceRoot":"","sources":["../../src/utils/chartConfigManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,QAAQ,EAAE,MAAM,UAAU,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;;;GAYG;AACH,cAAM,kBAAkB;IAEtB,OAAO,CAAC,QAAQ,CAA2F;IAC3G,OAAO,CAAC,cAAc,CAAsE;IAE5F;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC;IAQ9D;;OAEG;IACH,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC;IAQpD;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;IAWrD;;OAEG;IACH,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IASnD;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAkBhF;;OAEG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAKnC;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAInC;AAGD,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Chart } from 'chart.js';
|
|
2
|
+
/**
|
|
3
|
+
* Singleton manager for Chart.js instances.
|
|
4
|
+
* Tracks all created chart instances and handles proper cleanup to prevent memory leaks.
|
|
5
|
+
*/
|
|
6
|
+
declare class ChartInstanceManager {
|
|
7
|
+
private instances;
|
|
8
|
+
/**
|
|
9
|
+
* Register a new Chart.js instance
|
|
10
|
+
*/
|
|
11
|
+
register(id: string, chart: Chart): void;
|
|
12
|
+
/**
|
|
13
|
+
* Get a Chart.js instance by ID
|
|
14
|
+
*/
|
|
15
|
+
get(id: string): Chart | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Check if an instance exists
|
|
18
|
+
*/
|
|
19
|
+
has(id: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Destroy a Chart.js instance by ID
|
|
22
|
+
*/
|
|
23
|
+
destroy(id: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Destroy multiple Chart.js instances by their IDs
|
|
26
|
+
*/
|
|
27
|
+
destroyMany(ids: string[]): void;
|
|
28
|
+
/**
|
|
29
|
+
* Destroy all registered Chart.js instances
|
|
30
|
+
*/
|
|
31
|
+
destroyAll(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Get count of registered instances
|
|
34
|
+
*/
|
|
35
|
+
get count(): number;
|
|
36
|
+
/**
|
|
37
|
+
* Get all registered instance IDs
|
|
38
|
+
*/
|
|
39
|
+
getIds(): string[];
|
|
40
|
+
}
|
|
41
|
+
export declare const chartManager: ChartInstanceManager;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=chartInstanceManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartInstanceManager.d.ts","sourceRoot":"","sources":["../../src/utils/chartInstanceManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEtC;;;GAGG;AACH,cAAM,oBAAoB;IACxB,OAAO,CAAC,SAAS,CAAiC;IAElD;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IAQxC;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS;IAIlC;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAIxB;;OAEG;IACH,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAYzB;;OAEG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI;IAIhC;;OAEG;IACH,UAAU,IAAI,IAAI;IAWlB;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IAED;;OAEG;IACH,MAAM,IAAI,MAAM,EAAE;CAGnB;AAGD,eAAO,MAAM,YAAY,sBAA6B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ChartConfig } from '@/types/chart';
|
|
2
|
+
/**
|
|
3
|
+
* Global state manager for chart popup modal.
|
|
4
|
+
* This singleton manages popup state outside of the component tree,
|
|
5
|
+
* preventing state loss during DOM re-renders (e.g., during SSE streaming).
|
|
6
|
+
*/
|
|
7
|
+
declare class ChartPopupManager {
|
|
8
|
+
private _isOpen;
|
|
9
|
+
private _config;
|
|
10
|
+
private _backgroundColor;
|
|
11
|
+
private _textColor;
|
|
12
|
+
/**
|
|
13
|
+
* Get the isOpen signal accessor
|
|
14
|
+
*/
|
|
15
|
+
get isOpen(): import("solid-js").Accessor<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Get the config signal accessor
|
|
18
|
+
*/
|
|
19
|
+
get config(): import("solid-js").Accessor<ChartConfig | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Get the backgroundColor signal accessor
|
|
22
|
+
*/
|
|
23
|
+
get backgroundColor(): import("solid-js").Accessor<string | undefined>;
|
|
24
|
+
/**
|
|
25
|
+
* Get the textColor signal accessor
|
|
26
|
+
*/
|
|
27
|
+
get textColor(): import("solid-js").Accessor<string | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Open the popup with the given chart configuration
|
|
30
|
+
*/
|
|
31
|
+
open(config: ChartConfig, backgroundColor?: string, textColor?: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Close the popup
|
|
34
|
+
*/
|
|
35
|
+
close(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Reset all state (useful for cleanup)
|
|
38
|
+
*/
|
|
39
|
+
reset(): void;
|
|
40
|
+
}
|
|
41
|
+
export declare const chartPopupManager: ChartPopupManager;
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=chartPopupManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartPopupManager.d.ts","sourceRoot":"","sources":["../../src/utils/chartPopupManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;GAIG;AACH,cAAM,iBAAiB;IAErB,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,OAAO,CAA0C;IACzD,OAAO,CAAC,gBAAgB,CAA+C;IACvE,OAAO,CAAC,UAAU,CAA+C;IAEjE;;OAEG;IACH,IAAI,MAAM,yCAET;IAED;;OAEG;IACH,IAAI,MAAM,oDAET;IAED;;OAEG;IACH,IAAI,eAAe,oDAElB;IAED;;OAEG;IACH,IAAI,SAAS,oDAEZ;IAED;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAO7E;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,KAAK,IAAI,IAAI;CAMd;AAGD,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ChartConfig } from '@/types/chart';
|
|
2
|
+
/**
|
|
3
|
+
* Position and visibility information for a chart placeholder
|
|
4
|
+
*/
|
|
5
|
+
export interface ChartPlaceholderInfo {
|
|
6
|
+
chartId: string;
|
|
7
|
+
rect: DOMRect | null;
|
|
8
|
+
isVisible: boolean;
|
|
9
|
+
config: ChartConfig | null;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Singleton manager for portal-based chart rendering.
|
|
14
|
+
* Coordinates between inline placeholders and portal-rendered charts.
|
|
15
|
+
* Uses SolidJS signals to manage state outside the streaming reactive flow.
|
|
16
|
+
*/
|
|
17
|
+
declare class ChartPortalManager {
|
|
18
|
+
private placeholderInfoMap;
|
|
19
|
+
private chartRegistrySignal;
|
|
20
|
+
private renderedChartIds;
|
|
21
|
+
private updateScheduled;
|
|
22
|
+
private lastUpdateTime;
|
|
23
|
+
constructor();
|
|
24
|
+
/**
|
|
25
|
+
* Get the signal accessor for chart registry
|
|
26
|
+
*/
|
|
27
|
+
getChartRegistry(): import("solid-js").Accessor<Map<string, ChartPlaceholderInfo>>;
|
|
28
|
+
/**
|
|
29
|
+
* Register a chart placeholder
|
|
30
|
+
*/
|
|
31
|
+
registerPlaceholder(chartId: string, isLoading?: boolean): void;
|
|
32
|
+
/**
|
|
33
|
+
* Update placeholder position and visibility
|
|
34
|
+
* Uses throttling to prevent excessive signal updates during scroll
|
|
35
|
+
*/
|
|
36
|
+
updatePlaceholderPosition(chartId: string, rect: DOMRect | null, isVisible: boolean): void;
|
|
37
|
+
/**
|
|
38
|
+
* Schedule a throttled signal update
|
|
39
|
+
*/
|
|
40
|
+
private scheduleUpdate;
|
|
41
|
+
/**
|
|
42
|
+
* Perform the actual signal update
|
|
43
|
+
*/
|
|
44
|
+
private performUpdate;
|
|
45
|
+
/**
|
|
46
|
+
* Set chart config when data is complete
|
|
47
|
+
*/
|
|
48
|
+
setChartConfig(chartId: string, config: ChartConfig): void;
|
|
49
|
+
/**
|
|
50
|
+
* Check if a chart has already been rendered
|
|
51
|
+
*/
|
|
52
|
+
isChartRendered(chartId: string): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Mark a chart as rendered
|
|
55
|
+
*/
|
|
56
|
+
markChartRendered(chartId: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Unregister a chart placeholder
|
|
59
|
+
*/
|
|
60
|
+
unregisterPlaceholder(chartId: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Get placeholder info
|
|
63
|
+
*/
|
|
64
|
+
getPlaceholderInfo(chartId: string): ChartPlaceholderInfo | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* Clear all placeholders
|
|
67
|
+
*/
|
|
68
|
+
clearAll(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Notify signal subscribers of update
|
|
71
|
+
*/
|
|
72
|
+
private notifyUpdate;
|
|
73
|
+
}
|
|
74
|
+
export declare const chartPortalManager: ChartPortalManager;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=chartPortalManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartPortalManager.d.ts","sourceRoot":"","sources":["../../src/utils/chartPortalManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;CACpB;AAKD;;;;GAIG;AACH,cAAM,kBAAkB;IAEtB,OAAO,CAAC,kBAAkB,CAA2C;IAGrE,OAAO,CAAC,mBAAmB,CAAsE;IAGjG,OAAO,CAAC,gBAAgB,CAAqB;IAG7C,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,cAAc,CAAK;;IAS3B;;OAEG;IACH,gBAAgB;IAIhB;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,IAAI;IAe5D;;;OAGG;IACH,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI;IAqB1F;;OAEG;IACH,OAAO,CAAC,cAAc;IAoBtB;;OAEG;IACH,OAAO,CAAC,aAAa;IAMrB;;OAEG;IACH,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;IAoB1D;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAIzC;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIxC;;OAEG;IACH,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAM5C;;OAEG;IACH,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAIrE;;OAEG;IACH,QAAQ,IAAI,IAAI;IAMhB;;OAEG;IACH,OAAO,CAAC,YAAY;CAIrB;AAGD,eAAO,MAAM,kBAAkB,oBAA2B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ChartParseResult } from '@/types/chart';
|
|
2
|
+
/**
|
|
3
|
+
* State machine parser for extracting chart XML tags from streaming tokens.
|
|
4
|
+
* Handles partial tags split across multiple tokens.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ChartTagParser {
|
|
7
|
+
private state;
|
|
8
|
+
private buffer;
|
|
9
|
+
private pendingChart;
|
|
10
|
+
private textOutput;
|
|
11
|
+
private chartPlaceholders;
|
|
12
|
+
private completedCharts;
|
|
13
|
+
/**
|
|
14
|
+
* Process a single token from the SSE stream
|
|
15
|
+
*/
|
|
16
|
+
processToken(token: string): ChartParseResult;
|
|
17
|
+
/**
|
|
18
|
+
* Process a single character through the state machine
|
|
19
|
+
*/
|
|
20
|
+
private processChar;
|
|
21
|
+
private handleIdleState;
|
|
22
|
+
private handleOpeningTagState;
|
|
23
|
+
private handleInsideTagState;
|
|
24
|
+
private handleClosingTagState;
|
|
25
|
+
private parseOpeningTag;
|
|
26
|
+
private finalizeChart;
|
|
27
|
+
private parseChartJson;
|
|
28
|
+
private getDefaultOptions;
|
|
29
|
+
/**
|
|
30
|
+
* Flush any remaining buffered content when stream ends.
|
|
31
|
+
* Incomplete chart tags are treated as plain text.
|
|
32
|
+
*/
|
|
33
|
+
flush(): ChartParseResult;
|
|
34
|
+
/**
|
|
35
|
+
* Reset parser state for a new message
|
|
36
|
+
*/
|
|
37
|
+
reset(): void;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=chartTagParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chartTagParser.d.ts","sourceRoot":"","sources":["../../src/utils/chartTagParser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,gBAAgB,EAAwD,MAAM,eAAe,CAAC;AAOzH;;;GAGG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,KAAK,CAA2C;IACxD,OAAO,CAAC,MAAM,CAAM;IACpB,OAAO,CAAC,YAAY,CAA6B;IACjD,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,eAAe,CAAqB;IAE5C;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAiB7C;;OAEG;IACH,OAAO,CAAC,WAAW;IAiBnB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,qBAAqB;IAwC7B,OAAO,CAAC,oBAAoB;IAU5B,OAAO,CAAC,qBAAqB;IA2B7B,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,cAAc;IAwCtB,OAAO,CAAC,iBAAiB;IAyBzB;;;OAGG;IACH,KAAK,IAAI,gBAAgB;IAsBzB;;OAEG;IACH,KAAK,IAAI,IAAI;CAQd"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ export declare const isNotDefined: <T>(value: T | null | undefined) => value is
|
|
|
2
2
|
export declare const isDefined: <T>(value: T | null | undefined) => value is NonNullable<T>;
|
|
3
3
|
export declare const isEmpty: (value: string | undefined | null) => value is undefined;
|
|
4
4
|
export declare const isNotEmpty: (value: string | undefined | null) => value is string;
|
|
5
|
+
/**
|
|
6
|
+
* Clears authentication data from localStorage
|
|
7
|
+
* Used when 401 errors are detected or user logs out
|
|
8
|
+
*/
|
|
5
9
|
export declare const sendRequest: <ResponseData>(params: string | {
|
|
6
10
|
url: string;
|
|
7
11
|
method: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d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AAI,CAAC;;;;EAuD1D,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,MAAM,UAAU,MAAM,YAAW,OAAO,MAAM,EAAE,GAAG,CAAC,SAiBvG,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,MAAM,QAQzD,CAAC;AAEF,eAAO,MAAM,6BAA6B,eAAgB,MAAM,SAyB/D,CAAC;AAEF,eAAO,MAAM,mBAAmB,SAAU,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,WAO1F,CAAC;AAEF,eAAO,MAAM,SAAS,UAAW,MAAM,UAAU,MAAM,UAAU,MAAM,SAKtE,CAAC;AAEF,eAAO,MAAM,SAAS,UAAW,MAAM,KAAG,MAczC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security utilities for XSS prevention and URL validation
|
|
3
|
+
* Provides centralized functions for safe URL handling and input sanitization
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Validates if a URL is safe to use (only allows http and https protocols)
|
|
7
|
+
* Prevents javascript: and other dangerous URL schemes
|
|
8
|
+
*/
|
|
9
|
+
export declare const isValidUrl: (url: string) => boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Safely encodes URL parameters to prevent injection attacks
|
|
12
|
+
* Encodes special characters that could be used for URL manipulation
|
|
13
|
+
*/
|
|
14
|
+
export declare const safeEncodeURIComponent: (str: string) => string;
|
|
15
|
+
/**
|
|
16
|
+
* Validates and sanitizes external URLs from user input
|
|
17
|
+
* Returns null if URL is invalid or dangerous
|
|
18
|
+
*/
|
|
19
|
+
export declare const validateExternalUrl: (url: string) => string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Sanitizes CSS content to prevent CSS injection attacks
|
|
22
|
+
* Removes dangerous CSS properties and values that could be used for attacks
|
|
23
|
+
*/
|
|
24
|
+
export declare const sanitizeCSS: (css: string) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Validates phone numbers with timeout protection against ReDoS attacks
|
|
27
|
+
* Uses a simple, efficient pattern that prevents catastrophic backtracking
|
|
28
|
+
*/
|
|
29
|
+
export declare const validatePhoneNumber: (phone: string) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Validates and sanitizes string inputs with length and content restrictions
|
|
32
|
+
* Prevents injection attacks and ensures data integrity
|
|
33
|
+
*/
|
|
34
|
+
export declare const validateStringInput: (input: unknown, maxLength?: number, allowedChars?: RegExp) => string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Validates numeric inputs with range constraints
|
|
37
|
+
* Ensures numbers are within safe bounds and prevents NaN/Infinity
|
|
38
|
+
*/
|
|
39
|
+
export declare const validateNumericInput: (input: unknown, min?: number, max?: number) => number | null;
|
|
40
|
+
/**
|
|
41
|
+
* Validates boolean inputs and converts string representations
|
|
42
|
+
* Safely handles various boolean representations
|
|
43
|
+
*/
|
|
44
|
+
export declare const validateBooleanInput: (input: unknown) => boolean | null;
|
|
45
|
+
/**
|
|
46
|
+
* Validates color values (hex, rgb, rgba, named colors)
|
|
47
|
+
* Prevents CSS injection through color values
|
|
48
|
+
*/
|
|
49
|
+
export declare const validateColorInput: (input: unknown) => string | null;
|
|
50
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/utils/security.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,OAOxC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAS,MAAM,KAAG,MAIpD,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,MAAM,GAAG,IAW1D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,QAAS,MAAM,KAAG,MA6HzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,KAAG,OAkBnD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,UAAW,OAAO,qCAAmC,MAAM,KAAG,MAAM,GAAG,IAkCtG,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,UAAW,OAAO,QAAQ,MAAM,QAAQ,MAAM,KAAG,MAAM,GAAG,IAyB1F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,UAAW,OAAO,KAAG,OAAO,GAAG,IAqB/D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAAW,OAAO,KAAG,MAAM,GAAG,IAyB5D,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface TextStreamSmootherConfig {
|
|
2
|
+
charsPerSecond?: number;
|
|
3
|
+
minUpdateInterval?: number;
|
|
4
|
+
maxBufferSize?: number;
|
|
5
|
+
enableAdaptiveSpeed?: boolean;
|
|
6
|
+
adaptiveSpeedThreshold?: number;
|
|
7
|
+
maxSpeedMultiplier?: number;
|
|
8
|
+
onTextUpdate: (text: string) => void;
|
|
9
|
+
onStreamComplete?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare class TextStreamSmoother {
|
|
12
|
+
private buffer;
|
|
13
|
+
private displayedText;
|
|
14
|
+
private isStreaming;
|
|
15
|
+
private animationFrameId;
|
|
16
|
+
private lastUpdateTime;
|
|
17
|
+
private config;
|
|
18
|
+
private streamEnded;
|
|
19
|
+
private currentSpeedMultiplier;
|
|
20
|
+
constructor(config: TextStreamSmootherConfig);
|
|
21
|
+
addText(text: string): void;
|
|
22
|
+
endStream(): void;
|
|
23
|
+
reset(): void;
|
|
24
|
+
private startStreaming;
|
|
25
|
+
private stopStreaming;
|
|
26
|
+
private streamLoop;
|
|
27
|
+
private calculateAdaptiveSpeedMultiplier;
|
|
28
|
+
private updateSpeedMultiplier;
|
|
29
|
+
private calculateCharsToRelease;
|
|
30
|
+
private releaseChars;
|
|
31
|
+
private flushBuffer;
|
|
32
|
+
getState(): {
|
|
33
|
+
bufferLength: number;
|
|
34
|
+
displayedLength: number;
|
|
35
|
+
isStreaming: boolean;
|
|
36
|
+
currentSpeedMultiplier: number;
|
|
37
|
+
effectiveCharsPerSecond: number;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=textStreamSmoother.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textStreamSmoother.d.ts","sourceRoot":"","sources":["../../src/utils/textStreamSmoother.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,wBAAwB;IAEvC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,cAAc,CAAa;IACnC,OAAO,CAAC,MAAM,CAAoH;IAClI,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,sBAAsB,CAAe;gBAEjC,MAAM,EAAE,wBAAwB;IAerC,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAmB3B,SAAS,IAAI,IAAI;IAcjB,KAAK,IAAI,IAAI;IAWpB,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,UAAU,CAsBhB;IAUF,OAAO,CAAC,gCAAgC;IA4BxC,OAAO,CAAC,qBAAqB;IAqB7B,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,WAAW;IAYZ,QAAQ,IAAI;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,eAAe,EAAE,MAAM,CAAC;QACxB,WAAW,EAAE,OAAO,CAAC;QACrB,sBAAsB,EAAE,MAAM,CAAC;QAC/B,uBAAuB,EAAE,MAAM,CAAC;KACjC;CASF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload audio blob to server and get transcription
|
|
3
|
+
* @param blob - Audio blob to transcribe
|
|
4
|
+
* @param transcriptApiEndpoint - API endpoint for transcription service
|
|
5
|
+
* @returns Promise<string> - Transcribed text
|
|
6
|
+
*/
|
|
7
|
+
export declare const uploadAndTranscriptAudio: (blob: Blob, transcriptApiEndpoint?: string) => Promise<string>;
|
|
8
|
+
//# sourceMappingURL=transcriptApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcriptApi.d.ts","sourceRoot":"","sources":["../../src/utils/transcriptApi.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,SAAgB,IAAI,0BAA0B,MAAM,KAAG,QAAQ,MAAM,CAoCzG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ultimateJsonParser.d.ts","sourceRoot":"","sources":["../../src/utils/ultimateJsonParser.ts"],"names":[],"mappings":"AAsBA,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,GAAG,CAkDzD"}
|
package/dist/web.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ declare const chatbot: {
|
|
|
8
8
|
theme?: import("./features/bubble/types").BubbleTheme | undefined;
|
|
9
9
|
chatwootUrl?: string | undefined;
|
|
10
10
|
roomIds?: Record<string, string> | undefined;
|
|
11
|
-
isUseFAQ?: undefined;
|
|
11
|
+
isUseFAQ?: boolean | undefined;
|
|
12
|
+
onResetChat?: (() => Promise<void>) | undefined;
|
|
12
13
|
} & {
|
|
13
14
|
id?: string | undefined;
|
|
14
15
|
}) => void;
|
|
@@ -21,7 +22,8 @@ declare const chatbot: {
|
|
|
21
22
|
theme?: import("./features/bubble/types").BubbleTheme | undefined;
|
|
22
23
|
chatwootUrl?: string | undefined;
|
|
23
24
|
roomIds?: Record<string, string> | undefined;
|
|
24
|
-
isUseFAQ?: undefined;
|
|
25
|
+
isUseFAQ?: boolean | undefined;
|
|
26
|
+
onResetChat?: (() => Promise<void>) | undefined;
|
|
25
27
|
}) => void;
|
|
26
28
|
destroy: () => void;
|
|
27
29
|
};
|
package/dist/web.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../src/web.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAiB,CAAC;AAI/B,eAAe,OAAO,CAAC"}
|