@marketrix.ai/widget 3.8.40 → 3.8.53
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/dist/src/components/base/Dialog.d.ts +4 -6
- package/dist/src/components/base/icons.d.ts +0 -255
- package/dist/src/components/blocks/WidgetDialog.d.ts +0 -12
- package/dist/src/components/navigation/MessengerShell.d.ts +1 -2
- package/dist/src/components/views/ChatView.d.ts +1 -2
- package/dist/src/context/ConversationContext.d.ts +56 -0
- package/dist/src/context/WidgetProviders.d.ts +8 -6
- package/dist/src/context/sseReducer.d.ts +3 -3
- package/dist/src/hooks/useWidget.d.ts +2 -5
- package/dist/src/services/ChatService.d.ts +1 -2
- package/dist/src/services/DomService.d.ts +0 -29
- package/dist/src/services/StorageService.d.ts +3 -4
- package/dist/src/types/browserTools.d.ts +2 -2
- package/dist/src/types/index.d.ts +0 -9
- package/dist/src/utils/bootstrap.d.ts +0 -10
- package/dist/src/utils/dom.d.ts +0 -7
- package/dist/src/utils/validation.d.ts +0 -4
- package/dist/widget.mjs +62 -65
- package/dist/widget.mjs.map +1 -1
- package/package.json +10 -10
- package/dist/src/components/blocks/TabBar.d.ts +0 -12
- package/dist/src/constants/config.d.ts +0 -7
- package/dist/src/context/ChatContext.d.ts +0 -33
- package/dist/src/context/TaskContext.d.ts +0 -38
|
@@ -6,21 +6,19 @@ interface DialogProps {
|
|
|
6
6
|
}
|
|
7
7
|
interface DialogContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
8
|
children: React.ReactNode;
|
|
9
|
-
variant?: 'default' | 'confirm'
|
|
9
|
+
variant?: 'default' | 'confirm';
|
|
10
10
|
}
|
|
11
11
|
export declare function Dialog({ children, defaultOpen, onOpenChange, open }: DialogProps): import("react").JSX.Element;
|
|
12
12
|
export declare function DialogTrigger({ children, onClick, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>): import("react").JSX.Element;
|
|
13
13
|
export declare function DialogContent({ children, className, onKeyDown, ...props }: DialogContentProps): import("react").JSX.Element | null;
|
|
14
14
|
interface DialogTitleProps extends React.HTMLAttributes<HTMLHeadingElement> {
|
|
15
|
-
variant?: 'default' | 'confirm'
|
|
15
|
+
variant?: 'default' | 'confirm';
|
|
16
16
|
}
|
|
17
17
|
export declare function DialogTitle({ className, variant, ...props }: DialogTitleProps): import("react").JSX.Element;
|
|
18
18
|
interface DialogDescriptionProps extends React.HTMLAttributes<HTMLParagraphElement> {
|
|
19
19
|
variant?: 'default' | 'confirm';
|
|
20
20
|
}
|
|
21
21
|
export declare function DialogDescription({ className, variant, ...props }: DialogDescriptionProps): import("react").JSX.Element;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
export declare function DialogClose({ children, className, onClick, variant, ...props }: DialogCloseProps): import("react").JSX.Element;
|
|
22
|
+
type DialogCloseProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
23
|
+
export declare function DialogClose({ children, className, onClick, ...props }: DialogCloseProps): import("react").JSX.Element;
|
|
26
24
|
export {};
|
|
@@ -14,14 +14,6 @@ export interface IconData {
|
|
|
14
14
|
paths: IconPath[];
|
|
15
15
|
}
|
|
16
16
|
export declare const icons: {
|
|
17
|
-
/** FaSpinner */
|
|
18
|
-
readonly spinner: {
|
|
19
|
-
readonly viewBox: "0 0 512 512";
|
|
20
|
-
readonly paths: [{
|
|
21
|
-
readonly d: "M304 48c0 26.51-21.49 48-48 48s-48-21.49-48-48 21.49-48 48-48 48 21.49 48 48zm-48 368c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zm208-208c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.49-48-48-48zM96 256c0-26.51-21.49-48-48-48S0 229.49 0 256s21.49 48 48 48 48-21.49 48-48zm12.922 99.078c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.491-48-48-48zm294.156 0c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48c0-26.509-21.49-48-48-48zM108.922 60.922c-26.51 0-48 21.49-48 48s21.49 48 48 48 48-21.49 48-48-21.491-48-48-48z";
|
|
22
|
-
readonly fill: "currentColor";
|
|
23
|
-
}];
|
|
24
|
-
};
|
|
25
17
|
/** FaCheckCircle */
|
|
26
18
|
readonly checkCircle: {
|
|
27
19
|
readonly viewBox: "0 0 512 512";
|
|
@@ -78,67 +70,6 @@ export declare const icons: {
|
|
|
78
70
|
readonly fill: "currentColor";
|
|
79
71
|
}];
|
|
80
72
|
};
|
|
81
|
-
/** FiInfo — circle + two lines rendered via path-equivalent description.
|
|
82
|
-
* The original uses <circle> and <line> child elements; represented here
|
|
83
|
-
* as separate path entries with equivalent geometry. */
|
|
84
|
-
readonly info: {
|
|
85
|
-
readonly viewBox: "0 0 24 24";
|
|
86
|
-
readonly paths: [{
|
|
87
|
-
readonly d: "M 12 2 A 10 10 0 1 1 11.9999 2 Z";
|
|
88
|
-
readonly fill: "none";
|
|
89
|
-
readonly stroke: "currentColor";
|
|
90
|
-
readonly strokeWidth: 2;
|
|
91
|
-
readonly strokeLinecap: "round";
|
|
92
|
-
readonly strokeLinejoin: "round";
|
|
93
|
-
}, {
|
|
94
|
-
readonly d: "M12 16L12 12";
|
|
95
|
-
readonly fill: "none";
|
|
96
|
-
readonly stroke: "currentColor";
|
|
97
|
-
readonly strokeWidth: 2;
|
|
98
|
-
readonly strokeLinecap: "round";
|
|
99
|
-
readonly strokeLinejoin: "round";
|
|
100
|
-
}, {
|
|
101
|
-
readonly d: "M12 8L12.01 8";
|
|
102
|
-
readonly fill: "none";
|
|
103
|
-
readonly stroke: "currentColor";
|
|
104
|
-
readonly strokeWidth: 2;
|
|
105
|
-
readonly strokeLinecap: "round";
|
|
106
|
-
readonly strokeLinejoin: "round";
|
|
107
|
-
}];
|
|
108
|
-
};
|
|
109
|
-
/** FiTrash2 */
|
|
110
|
-
readonly trash: {
|
|
111
|
-
readonly viewBox: "0 0 24 24";
|
|
112
|
-
readonly paths: [{
|
|
113
|
-
readonly d: "M3 6L5 6L21 6";
|
|
114
|
-
readonly fill: "none";
|
|
115
|
-
readonly stroke: "currentColor";
|
|
116
|
-
readonly strokeWidth: 2;
|
|
117
|
-
readonly strokeLinecap: "round";
|
|
118
|
-
readonly strokeLinejoin: "round";
|
|
119
|
-
}, {
|
|
120
|
-
readonly d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2";
|
|
121
|
-
readonly fill: "none";
|
|
122
|
-
readonly stroke: "currentColor";
|
|
123
|
-
readonly strokeWidth: 2;
|
|
124
|
-
readonly strokeLinecap: "round";
|
|
125
|
-
readonly strokeLinejoin: "round";
|
|
126
|
-
}, {
|
|
127
|
-
readonly d: "M10 11L10 17";
|
|
128
|
-
readonly fill: "none";
|
|
129
|
-
readonly stroke: "currentColor";
|
|
130
|
-
readonly strokeWidth: 2;
|
|
131
|
-
readonly strokeLinecap: "round";
|
|
132
|
-
readonly strokeLinejoin: "round";
|
|
133
|
-
}, {
|
|
134
|
-
readonly d: "M14 11L14 17";
|
|
135
|
-
readonly fill: "none";
|
|
136
|
-
readonly stroke: "currentColor";
|
|
137
|
-
readonly strokeWidth: 2;
|
|
138
|
-
readonly strokeLinecap: "round";
|
|
139
|
-
readonly strokeLinejoin: "round";
|
|
140
|
-
}];
|
|
141
|
-
};
|
|
142
73
|
/** FiX */
|
|
143
74
|
readonly x: {
|
|
144
75
|
readonly viewBox: "0 0 24 24";
|
|
@@ -226,25 +157,6 @@ export declare const icons: {
|
|
|
226
157
|
readonly strokeLinejoin: "round";
|
|
227
158
|
}];
|
|
228
159
|
};
|
|
229
|
-
/** LuScroll */
|
|
230
|
-
readonly scroll: {
|
|
231
|
-
readonly viewBox: "0 0 24 24";
|
|
232
|
-
readonly paths: [{
|
|
233
|
-
readonly d: "M19 17V5a2 2 0 0 0-2-2H4";
|
|
234
|
-
readonly fill: "none";
|
|
235
|
-
readonly stroke: "currentColor";
|
|
236
|
-
readonly strokeWidth: 2;
|
|
237
|
-
readonly strokeLinecap: "round";
|
|
238
|
-
readonly strokeLinejoin: "round";
|
|
239
|
-
}, {
|
|
240
|
-
readonly d: "M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3";
|
|
241
|
-
readonly fill: "none";
|
|
242
|
-
readonly stroke: "currentColor";
|
|
243
|
-
readonly strokeWidth: 2;
|
|
244
|
-
readonly strokeLinecap: "round";
|
|
245
|
-
readonly strokeLinejoin: "round";
|
|
246
|
-
}];
|
|
247
|
-
};
|
|
248
160
|
/** SiTicktick */
|
|
249
161
|
readonly ticktick: {
|
|
250
162
|
readonly viewBox: "0 0 24 24";
|
|
@@ -253,141 +165,6 @@ export declare const icons: {
|
|
|
253
165
|
readonly fill: "currentColor";
|
|
254
166
|
}];
|
|
255
167
|
};
|
|
256
|
-
/** HiOutlineArrowRight */
|
|
257
|
-
readonly arrowRight: {
|
|
258
|
-
readonly viewBox: "0 0 24 24";
|
|
259
|
-
readonly paths: [{
|
|
260
|
-
readonly d: "M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3";
|
|
261
|
-
readonly fill: "none";
|
|
262
|
-
readonly stroke: "currentColor";
|
|
263
|
-
readonly strokeWidth: 1.5;
|
|
264
|
-
readonly strokeLinecap: "round";
|
|
265
|
-
readonly strokeLinejoin: "round";
|
|
266
|
-
}];
|
|
267
|
-
};
|
|
268
|
-
/** HiOutlineDocumentText */
|
|
269
|
-
readonly documentText: {
|
|
270
|
-
readonly viewBox: "0 0 24 24";
|
|
271
|
-
readonly paths: [{
|
|
272
|
-
readonly d: "M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z";
|
|
273
|
-
readonly fill: "none";
|
|
274
|
-
readonly stroke: "currentColor";
|
|
275
|
-
readonly strokeWidth: 1.5;
|
|
276
|
-
readonly strokeLinecap: "round";
|
|
277
|
-
readonly strokeLinejoin: "round";
|
|
278
|
-
}];
|
|
279
|
-
};
|
|
280
|
-
/** HiOutlineGlobeAlt */
|
|
281
|
-
readonly globe: {
|
|
282
|
-
readonly viewBox: "0 0 24 24";
|
|
283
|
-
readonly paths: [{
|
|
284
|
-
readonly d: "M12 21a9.004 9.004 0 0 0 8.716-6.747M12 21a9.004 9.004 0 0 1-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 0 1 7.843 4.582M12 3a8.997 8.997 0 0 0-7.843 4.582m15.686 0A11.953 11.953 0 0 1 12 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0 1 21 12c0 .778-.099 1.533-.284 2.253";
|
|
285
|
-
readonly fill: "none";
|
|
286
|
-
readonly stroke: "currentColor";
|
|
287
|
-
readonly strokeWidth: 1.5;
|
|
288
|
-
readonly strokeLinecap: "round";
|
|
289
|
-
readonly strokeLinejoin: "round";
|
|
290
|
-
}];
|
|
291
|
-
};
|
|
292
|
-
/** HiOutlineMagnifyingGlass */
|
|
293
|
-
readonly magnifyingGlass: {
|
|
294
|
-
readonly viewBox: "0 0 24 24";
|
|
295
|
-
readonly paths: [{
|
|
296
|
-
readonly d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z";
|
|
297
|
-
readonly fill: "none";
|
|
298
|
-
readonly stroke: "currentColor";
|
|
299
|
-
readonly strokeWidth: 1.5;
|
|
300
|
-
readonly strokeLinecap: "round";
|
|
301
|
-
readonly strokeLinejoin: "round";
|
|
302
|
-
}];
|
|
303
|
-
};
|
|
304
|
-
/** HiOutlineXMark */
|
|
305
|
-
readonly xMark: {
|
|
306
|
-
readonly viewBox: "0 0 24 24";
|
|
307
|
-
readonly paths: [{
|
|
308
|
-
readonly d: "M6 18 18 6M6 6l12 12";
|
|
309
|
-
readonly fill: "none";
|
|
310
|
-
readonly stroke: "currentColor";
|
|
311
|
-
readonly strokeWidth: 1.5;
|
|
312
|
-
readonly strokeLinecap: "round";
|
|
313
|
-
readonly strokeLinejoin: "round";
|
|
314
|
-
}];
|
|
315
|
-
};
|
|
316
|
-
/** MdOutlineKeyboard */
|
|
317
|
-
readonly keyboard: {
|
|
318
|
-
readonly viewBox: "0 0 24 24";
|
|
319
|
-
readonly paths: [{
|
|
320
|
-
readonly d: "M20 7v10H4V7h16m0-2H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-9 3h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-3 0h2v2H5zm0-3h2v2H5zm3 6h8v2H8zm6-3h2v2h-2zm0-3h2v2h-2zm3 3h2v2h-2zm0-3h2v2h-2z";
|
|
321
|
-
readonly fill: "currentColor";
|
|
322
|
-
}];
|
|
323
|
-
};
|
|
324
|
-
/** MdOutlineSelectAll */
|
|
325
|
-
readonly selectAll: {
|
|
326
|
-
readonly viewBox: "0 0 24 24";
|
|
327
|
-
readonly paths: [{
|
|
328
|
-
readonly d: "M3 5h2V3c-1.1 0-2 .9-2 2zm0 8h2v-2H3v2zm4 8h2v-2H7v2zM3 9h2V7H3v2zm10-6h-2v2h2V3zm6 0v2h2c0-1.1-.9-2-2-2zM5 21v-2H3c0 1.1.9 2 2 2zm-2-4h2v-2H3v2zM9 3H7v2h2V3zm2 18h2v-2h-2v2zm8-8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2zm0-12h2V7h-2v2zm0 8h2v-2h-2v2zm-4 4h2v-2h-2v2zm0-16h2V3h-2v2zM7 17h10V7H7v10zm2-8h6v6H9V9z";
|
|
329
|
-
readonly fill: "currentColor";
|
|
330
|
-
}];
|
|
331
|
-
};
|
|
332
|
-
/** TbArrowDown */
|
|
333
|
-
readonly tablerArrowDown: {
|
|
334
|
-
readonly viewBox: "0 0 24 24";
|
|
335
|
-
readonly paths: [{
|
|
336
|
-
readonly d: "M12 5l0 14";
|
|
337
|
-
readonly fill: "none";
|
|
338
|
-
readonly stroke: "currentColor";
|
|
339
|
-
readonly strokeWidth: 2;
|
|
340
|
-
readonly strokeLinecap: "round";
|
|
341
|
-
readonly strokeLinejoin: "round";
|
|
342
|
-
}, {
|
|
343
|
-
readonly d: "M18 13l-6 6";
|
|
344
|
-
readonly fill: "none";
|
|
345
|
-
readonly stroke: "currentColor";
|
|
346
|
-
readonly strokeWidth: 2;
|
|
347
|
-
readonly strokeLinecap: "round";
|
|
348
|
-
readonly strokeLinejoin: "round";
|
|
349
|
-
}, {
|
|
350
|
-
readonly d: "M6 13l6 6";
|
|
351
|
-
readonly fill: "none";
|
|
352
|
-
readonly stroke: "currentColor";
|
|
353
|
-
readonly strokeWidth: 2;
|
|
354
|
-
readonly strokeLinecap: "round";
|
|
355
|
-
readonly strokeLinejoin: "round";
|
|
356
|
-
}];
|
|
357
|
-
};
|
|
358
|
-
/** TbFileUpload */
|
|
359
|
-
readonly fileUpload: {
|
|
360
|
-
readonly viewBox: "0 0 24 24";
|
|
361
|
-
readonly paths: [{
|
|
362
|
-
readonly d: "M14 3v4a1 1 0 0 0 1 1h4";
|
|
363
|
-
readonly fill: "none";
|
|
364
|
-
readonly stroke: "currentColor";
|
|
365
|
-
readonly strokeWidth: 2;
|
|
366
|
-
readonly strokeLinecap: "round";
|
|
367
|
-
readonly strokeLinejoin: "round";
|
|
368
|
-
}, {
|
|
369
|
-
readonly d: "M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z";
|
|
370
|
-
readonly fill: "none";
|
|
371
|
-
readonly stroke: "currentColor";
|
|
372
|
-
readonly strokeWidth: 2;
|
|
373
|
-
readonly strokeLinecap: "round";
|
|
374
|
-
readonly strokeLinejoin: "round";
|
|
375
|
-
}, {
|
|
376
|
-
readonly d: "M12 11v6";
|
|
377
|
-
readonly fill: "none";
|
|
378
|
-
readonly stroke: "currentColor";
|
|
379
|
-
readonly strokeWidth: 2;
|
|
380
|
-
readonly strokeLinecap: "round";
|
|
381
|
-
readonly strokeLinejoin: "round";
|
|
382
|
-
}, {
|
|
383
|
-
readonly d: "M9.5 13.5l2.5 -2.5l2.5 2.5";
|
|
384
|
-
readonly fill: "none";
|
|
385
|
-
readonly stroke: "currentColor";
|
|
386
|
-
readonly strokeWidth: 2;
|
|
387
|
-
readonly strokeLinecap: "round";
|
|
388
|
-
readonly strokeLinejoin: "round";
|
|
389
|
-
}];
|
|
390
|
-
};
|
|
391
168
|
/** Home icon — from MessengerShell TAB_ICONS.home, viewBox 0 0 24 24 */
|
|
392
169
|
readonly home: {
|
|
393
170
|
readonly viewBox: "0 0 24 24";
|
|
@@ -412,18 +189,6 @@ export declare const icons: {
|
|
|
412
189
|
readonly strokeLinejoin: "round";
|
|
413
190
|
}];
|
|
414
191
|
};
|
|
415
|
-
/** Help / question mark circle — from MessengerShell TAB_ICONS.help */
|
|
416
|
-
readonly help: {
|
|
417
|
-
readonly viewBox: "0 0 24 24";
|
|
418
|
-
readonly paths: [{
|
|
419
|
-
readonly d: "M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z";
|
|
420
|
-
readonly fill: "none";
|
|
421
|
-
readonly stroke: "currentColor";
|
|
422
|
-
readonly strokeWidth: 2;
|
|
423
|
-
readonly strokeLinecap: "round";
|
|
424
|
-
readonly strokeLinejoin: "round";
|
|
425
|
-
}];
|
|
426
|
-
};
|
|
427
192
|
/** Send / arrow right — from MessageInput send button */
|
|
428
193
|
readonly send: {
|
|
429
194
|
readonly viewBox: "0 0 24 24";
|
|
@@ -482,26 +247,6 @@ export declare const icons: {
|
|
|
482
247
|
readonly strokeLinejoin: "round";
|
|
483
248
|
}];
|
|
484
249
|
};
|
|
485
|
-
/** More vertical (three dots) — from MessengerShell more options menu */
|
|
486
|
-
readonly moreVertical: {
|
|
487
|
-
readonly viewBox: "0 0 20 20";
|
|
488
|
-
readonly paths: [{
|
|
489
|
-
readonly d: "M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z";
|
|
490
|
-
readonly fill: "currentColor";
|
|
491
|
-
}];
|
|
492
|
-
};
|
|
493
|
-
/** Chevron right — from HomeView "Ask a question" CTA */
|
|
494
|
-
readonly chevronRight: {
|
|
495
|
-
readonly viewBox: "0 0 24 24";
|
|
496
|
-
readonly paths: [{
|
|
497
|
-
readonly d: "M9 5l7 7-7 7";
|
|
498
|
-
readonly fill: "none";
|
|
499
|
-
readonly stroke: "currentColor";
|
|
500
|
-
readonly strokeWidth: 2;
|
|
501
|
-
readonly strokeLinecap: "round";
|
|
502
|
-
readonly strokeLinejoin: "round";
|
|
503
|
-
}];
|
|
504
|
-
};
|
|
505
250
|
/** Alert circle / error — from VideoStreamDisplay stream error state */
|
|
506
251
|
readonly alertCircle: {
|
|
507
252
|
readonly viewBox: "0 0 24 24";
|
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export interface WidgetDialogRow {
|
|
3
|
-
label: string;
|
|
4
|
-
value: string;
|
|
5
|
-
copyable?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface WidgetDialogStatus {
|
|
8
|
-
label: string;
|
|
9
|
-
color: 'green' | 'blue' | 'yellow' | 'gray';
|
|
10
|
-
}
|
|
11
2
|
export interface WidgetDialogProps {
|
|
12
|
-
variant: 'confirm' | 'info';
|
|
13
3
|
open: boolean;
|
|
14
4
|
onClose: () => void;
|
|
15
5
|
title: string;
|
|
@@ -17,7 +7,5 @@ export interface WidgetDialogProps {
|
|
|
17
7
|
onConfirm?: () => void;
|
|
18
8
|
confirmLabel?: string;
|
|
19
9
|
cancelLabel?: string;
|
|
20
|
-
rows?: WidgetDialogRow[];
|
|
21
|
-
status?: WidgetDialogStatus;
|
|
22
10
|
}
|
|
23
11
|
export declare const WidgetDialog: React.FC<WidgetDialogProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ChatMessage, InstructionType, MarketrixConfig,
|
|
2
|
+
import type { ChatMessage, InstructionType, MarketrixConfig, WidgetView } from '../../types';
|
|
3
3
|
export interface MessengerShellProps {
|
|
4
4
|
config: MarketrixConfig;
|
|
5
5
|
isOpen: boolean;
|
|
@@ -7,7 +7,6 @@ export interface MessengerShellProps {
|
|
|
7
7
|
messages: ChatMessage[];
|
|
8
8
|
currentMode: InstructionType;
|
|
9
9
|
isTaskRunning?: boolean;
|
|
10
|
-
taskProgress?: TaskProgress[];
|
|
11
10
|
activeView: WidgetView;
|
|
12
11
|
onClose: () => void;
|
|
13
12
|
onSendMessage: (message: string, mode?: InstructionType, applicationId?: number, question?: string, skipUserMessage?: boolean) => void;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { InstructionType } from '../../sdk';
|
|
3
|
-
import type { ChatMessage, MarketrixConfig
|
|
3
|
+
import type { ChatMessage, MarketrixConfig } from '../../types';
|
|
4
4
|
export interface ChatViewProps {
|
|
5
5
|
config: MarketrixConfig;
|
|
6
6
|
messages: ChatMessage[];
|
|
7
7
|
currentMode: InstructionType;
|
|
8
8
|
isTaskRunning?: boolean;
|
|
9
|
-
taskProgress?: TaskProgress[];
|
|
10
9
|
onSendMessage: (message: string, mode?: InstructionType, applicationId?: number, question?: string, skipUserMessage?: boolean) => void;
|
|
11
10
|
onSetMode: (mode: InstructionType) => void;
|
|
12
11
|
onAddMessage: (message: ChatMessage) => void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ChatMessage, InstructionType } from '../types';
|
|
3
|
+
import type { UIStateActions } from './UIStateContext';
|
|
4
|
+
/**
|
|
5
|
+
* ConversationContext — the single store for the widget's conversation.
|
|
6
|
+
*
|
|
7
|
+
* Holds `{ messages, task }` as ONE `SseState`, so the SSE effect commits each
|
|
8
|
+
* transition through a single atomic `setState(prev => transition(prev))`. This
|
|
9
|
+
* removes the previous two-store split (ChatContext + TaskContext), which forced
|
|
10
|
+
* a raw-setState escape hatch and `messagesRef`/`taskRef` snapshots and could
|
|
11
|
+
* tear (messages updating while task lagged across an await). UIStateContext
|
|
12
|
+
* (open/minimized/mode/loading/error) stays separate — a genuinely different
|
|
13
|
+
* concern.
|
|
14
|
+
*/
|
|
15
|
+
export interface TaskState {
|
|
16
|
+
activeTaskId: string | null;
|
|
17
|
+
isTaskRunning: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ChatState {
|
|
20
|
+
messages: ChatMessage[];
|
|
21
|
+
}
|
|
22
|
+
export interface ChatActions {
|
|
23
|
+
addMessage: (message: ChatMessage) => void;
|
|
24
|
+
updateMessage: (messageId: string, updates: Partial<ChatMessage>) => void;
|
|
25
|
+
removeMessage: (messageId: string) => void;
|
|
26
|
+
setMessages: (messages: ChatMessage[]) => void;
|
|
27
|
+
clearMessages: () => void;
|
|
28
|
+
sendMessage: (content: string, mode?: InstructionType, applicationId?: number, question?: string, skipUserMessage?: boolean) => Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export interface TaskActions {
|
|
31
|
+
setTaskState: (payload: {
|
|
32
|
+
activeTaskId: string | null;
|
|
33
|
+
isTaskRunning: boolean;
|
|
34
|
+
}) => void;
|
|
35
|
+
stopTask: () => Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
interface ConversationContextType {
|
|
38
|
+
chatState: ChatState;
|
|
39
|
+
chatActions: ChatActions;
|
|
40
|
+
taskState: TaskState;
|
|
41
|
+
taskActions: TaskActions;
|
|
42
|
+
}
|
|
43
|
+
interface ConversationProviderProps {
|
|
44
|
+
children: React.ReactNode;
|
|
45
|
+
previewMode?: boolean;
|
|
46
|
+
/** Current mode from UIState — fallback for sendMessage and progress-line logic. */
|
|
47
|
+
currentMode: InstructionType;
|
|
48
|
+
/** Injected UI actions so the conversation store drives loading/availability/error without nesting contexts. */
|
|
49
|
+
uiActions: Pick<UIStateActions, 'setLoading' | 'setAgentAvailable' | 'setError'>;
|
|
50
|
+
/** One-time hydrated snapshot to seed the store (messages + task) on mount. */
|
|
51
|
+
initialMessages?: ChatMessage[];
|
|
52
|
+
initialTask?: TaskState;
|
|
53
|
+
}
|
|
54
|
+
export declare const ConversationProvider: React.FC<ConversationProviderProps>;
|
|
55
|
+
export declare const useConversationContext: () => ConversationContextType;
|
|
56
|
+
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* WidgetProviders — composition root that wires UIStateProvider
|
|
3
|
-
*
|
|
2
|
+
* WidgetProviders — composition root that wires UIStateProvider and
|
|
3
|
+
* ConversationProvider together.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* Conversation state ({ messages, task }) lives in ONE store (ConversationProvider);
|
|
6
|
+
* UI state (open/minimized/mode/loading/error) lives in UIStateProvider. Both
|
|
7
|
+
* one-time initialization (SSE connection, ChatService hydration) and persistence
|
|
8
|
+
* live in inner bridge components that can read every context. React context is
|
|
9
|
+
* the single source of truth; ChatService is the load/persist boundary only,
|
|
10
|
+
* driven by one effect here.
|
|
9
11
|
*/
|
|
10
12
|
import React from 'react';
|
|
11
13
|
interface WidgetProvidersProps {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pure SSE reducer — the single place where a `WidgetEvent` turns into the next
|
|
3
3
|
* widget state. No transport, no tool execution, no localStorage: just
|
|
4
|
-
* `(state, event) => { state, effects }`. The
|
|
5
|
-
* runs the returned effects (tool exec, wsClient.send, setLoading), and
|
|
6
|
-
* via
|
|
4
|
+
* `(state, event) => { state, effects }`. The ConversationContext effect wires
|
|
5
|
+
* this up, runs the returned effects (tool exec, wsClient.send, setLoading), and
|
|
6
|
+
* re-enters via the tool-progress helpers once an async tool finishes.
|
|
7
7
|
*
|
|
8
8
|
* Keeping this pure makes the previously-untestable ~180-line SSE handler unit
|
|
9
9
|
* testable and removes the nested setState-within-setState that hid bugs.
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { ChatMessage, InstructionType, MarketrixConfig,
|
|
1
|
+
import type { ChatMessage, InstructionType, MarketrixConfig, WidgetSettingsData, WidgetState, WidgetView } from '../types';
|
|
2
2
|
export type ValidWidgetConfig = MarketrixConfig & Required<Pick<MarketrixConfig, keyof WidgetSettingsData>>;
|
|
3
3
|
interface UseWidgetProps {
|
|
4
4
|
config?: MarketrixConfig;
|
|
5
5
|
}
|
|
6
6
|
interface UseWidgetActions {
|
|
7
|
-
setState: (payload: Partial<WidgetState>) => void;
|
|
8
7
|
setActiveView: (view: WidgetView) => void;
|
|
9
8
|
toggleWidget: () => void;
|
|
10
9
|
closeWidget: () => void;
|
|
@@ -16,19 +15,17 @@ interface UseWidgetActions {
|
|
|
16
15
|
setTaskState: (payload: {
|
|
17
16
|
activeTaskId: string | null;
|
|
18
17
|
isTaskRunning: boolean;
|
|
19
|
-
taskProgress?: TaskProgress[];
|
|
20
18
|
}) => void;
|
|
21
19
|
addMessage: (message: ChatMessage) => void;
|
|
22
20
|
updateMessage: (messageId: string, updates: Partial<ChatMessage>) => void;
|
|
23
21
|
removeMessage: (messageId: string) => void;
|
|
24
22
|
setMessages: (messages: ChatMessage[]) => void;
|
|
25
|
-
resetState: () => void;
|
|
26
23
|
stopTask: () => Promise<void>;
|
|
27
24
|
clearChatHistory: () => void;
|
|
28
25
|
sendMessage: (content: string, mode?: InstructionType, applicationId?: number, question?: string, skipUserMessage?: boolean) => Promise<void>;
|
|
29
26
|
}
|
|
30
27
|
/**
|
|
31
|
-
* Composes UIStateContext
|
|
28
|
+
* Composes UIStateContext and ConversationContext into the unified
|
|
32
29
|
* `{ state, actions, config, … }` shape that the widget UI consumes. New code
|
|
33
30
|
* can either keep using this hook or read the focused contexts directly.
|
|
34
31
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChatMessage, InstructionType
|
|
1
|
+
import type { ChatMessage, InstructionType } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Snapshot of widget state persisted to / restored from localStorage.
|
|
4
4
|
* React context is the single source of truth at runtime — this is the
|
|
@@ -8,7 +8,6 @@ export interface ChatSnapshot {
|
|
|
8
8
|
messages: ChatMessage[];
|
|
9
9
|
isTaskRunning: boolean;
|
|
10
10
|
activeTaskId: string | null;
|
|
11
|
-
taskProgress: TaskProgress[];
|
|
12
11
|
currentMode: InstructionType;
|
|
13
12
|
isOpen: boolean;
|
|
14
13
|
isMinimized: boolean;
|
|
@@ -39,7 +39,6 @@ export declare class DomService {
|
|
|
39
39
|
private elementToSequence;
|
|
40
40
|
private selectorMap;
|
|
41
41
|
private fingerprintMap;
|
|
42
|
-
private isIndexed;
|
|
43
42
|
private indexingInProgress;
|
|
44
43
|
private indexVersion;
|
|
45
44
|
private constructor();
|
|
@@ -62,20 +61,6 @@ export declare class DomService {
|
|
|
62
61
|
* No recovery - just check if element exists and matches.
|
|
63
62
|
*/
|
|
64
63
|
private validateElementAtIndex;
|
|
65
|
-
/**
|
|
66
|
-
* Export state for external persistence (selectors and fingerprints)
|
|
67
|
-
*/
|
|
68
|
-
exportState(): {
|
|
69
|
-
selectors: Array<[number, string]>;
|
|
70
|
-
fingerprints: Array<[number, ElementFingerprint]>;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Import state from external persistence (selectors and fingerprints)
|
|
74
|
-
*/
|
|
75
|
-
importState(state: {
|
|
76
|
-
selectors?: Array<[number, string]>;
|
|
77
|
-
fingerprints?: Array<[number, ElementFingerprint]>;
|
|
78
|
-
}): void;
|
|
79
64
|
/**
|
|
80
65
|
* Index all interactable elements in the live DOM.
|
|
81
66
|
* Always clears previous index first.
|
|
@@ -116,9 +101,7 @@ export declare class DomService {
|
|
|
116
101
|
};
|
|
117
102
|
cssClasses: string[];
|
|
118
103
|
}>;
|
|
119
|
-
getElementByDataId(id: number): Element | undefined;
|
|
120
104
|
getSequenceForElement(element: Element): number | undefined;
|
|
121
|
-
isIndexActive(): boolean;
|
|
122
105
|
clearIndex(): void;
|
|
123
106
|
/**
|
|
124
107
|
* Check if an element is interactable (visible, not hidden, not obscured).
|
|
@@ -141,17 +124,5 @@ export declare class DomService {
|
|
|
141
124
|
* Returns element only if it's interactable.
|
|
142
125
|
*/
|
|
143
126
|
getValidatedElement(index: number): ValidatedElementResult;
|
|
144
|
-
/**
|
|
145
|
-
* Get fingerprint for a given index (for debugging/testing)
|
|
146
|
-
*/
|
|
147
|
-
getFingerprint(index: number): ElementFingerprint | undefined;
|
|
148
|
-
/**
|
|
149
|
-
* Get all fingerprints (for debugging/testing)
|
|
150
|
-
*/
|
|
151
|
-
getAllFingerprints(): Array<[number, ElementFingerprint]>;
|
|
152
|
-
/**
|
|
153
|
-
* Get current index version
|
|
154
|
-
*/
|
|
155
|
-
getIndexVersion(): number;
|
|
156
127
|
}
|
|
157
128
|
export declare const domService: DomService;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* widget owns the read/write lifecycle, and the dashboard only ever reads
|
|
16
16
|
* the same shape for parity.
|
|
17
17
|
*/
|
|
18
|
-
import type { ChatMessage, InstructionType, MarketrixConfig
|
|
18
|
+
import type { ChatMessage, InstructionType, MarketrixConfig } from '../types';
|
|
19
19
|
/**
|
|
20
20
|
* Serializable version of ChatMessage (timestamp as string, no videoStream)
|
|
21
21
|
*/
|
|
@@ -30,7 +30,6 @@ export interface MarketrixChatContext {
|
|
|
30
30
|
messages: StoredMessage[];
|
|
31
31
|
isTaskRunning: boolean;
|
|
32
32
|
activeTaskId: string | null;
|
|
33
|
-
taskProgress: TaskProgress[];
|
|
34
33
|
currentMode: InstructionType;
|
|
35
34
|
isOpen: boolean;
|
|
36
35
|
isMinimized: boolean;
|
|
@@ -81,8 +80,8 @@ declare class StorageService {
|
|
|
81
80
|
setChatId(chatId: string | null): void;
|
|
82
81
|
getMessages(): StoredMessage[];
|
|
83
82
|
setMessages(messages: StoredMessage[]): void;
|
|
84
|
-
getChatState(): Pick<MarketrixChatContext, 'isTaskRunning' | 'activeTaskId' | '
|
|
85
|
-
setChatState(state: Partial<Pick<MarketrixChatContext, 'isTaskRunning' | 'activeTaskId' | '
|
|
83
|
+
getChatState(): Pick<MarketrixChatContext, 'isTaskRunning' | 'activeTaskId' | 'currentMode' | 'isOpen' | 'isMinimized' | 'isLoading'>;
|
|
84
|
+
setChatState(state: Partial<Pick<MarketrixChatContext, 'isTaskRunning' | 'activeTaskId' | 'currentMode' | 'isOpen' | 'isMinimized' | 'isLoading'>>): void;
|
|
86
85
|
getConfig(): MarketrixConfig | null;
|
|
87
86
|
setConfig(config: MarketrixConfig | null): void;
|
|
88
87
|
clear(): void;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Browser Use Tools - widget tool registry.
|
|
3
3
|
*
|
|
4
4
|
* IMPORTANT: This file is the single source of truth for widget tool metadata.
|
|
5
|
-
* ALLOWED_TOOLS in
|
|
6
|
-
* from BROWSER_TOOLS below.
|
|
5
|
+
* ALLOWED_TOOLS in ConversationContext.tsx and TOOL_NAME_MAPPING in chat.ts are
|
|
6
|
+
* derived from BROWSER_TOOLS below.
|
|
7
7
|
*/
|
|
8
8
|
interface BrowserToolMetadata {
|
|
9
9
|
id: string;
|
|
@@ -56,14 +56,6 @@ export interface MessagePart {
|
|
|
56
56
|
hideIcon?: boolean;
|
|
57
57
|
textStyle?: 'default' | 'muted';
|
|
58
58
|
}
|
|
59
|
-
export interface TaskProgress {
|
|
60
|
-
tool_name: string;
|
|
61
|
-
tool_params: Record<string, unknown>;
|
|
62
|
-
step: number;
|
|
63
|
-
explanation: string;
|
|
64
|
-
mode: string;
|
|
65
|
-
timestamp: number;
|
|
66
|
-
}
|
|
67
59
|
export type WidgetView = 'home' | 'chat';
|
|
68
60
|
export interface WidgetState {
|
|
69
61
|
isOpen: boolean;
|
|
@@ -75,7 +67,6 @@ export interface WidgetState {
|
|
|
75
67
|
error?: string;
|
|
76
68
|
activeTaskId: string | null;
|
|
77
69
|
isTaskRunning: boolean;
|
|
78
|
-
taskProgress: TaskProgress[];
|
|
79
70
|
activeView: WidgetView;
|
|
80
71
|
}
|
|
81
72
|
export interface SendMessageRequest {
|
|
@@ -62,16 +62,6 @@ export declare const setProgrammaticInitInProgress: (inProgress: boolean) => voi
|
|
|
62
62
|
* Check if programmatic initialization is in progress
|
|
63
63
|
*/
|
|
64
64
|
export declare const isProgrammaticInitInProgress: () => boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Check if a production widget is already active on this page
|
|
67
|
-
* Production widgets (non-preview) should be singletons - only one per page
|
|
68
|
-
*/
|
|
69
|
-
export declare const isProductionWidgetActive: () => boolean;
|
|
70
|
-
/**
|
|
71
|
-
* Set production widget active state
|
|
72
|
-
* Call with true when initializing a production widget, false when unmounting
|
|
73
|
-
*/
|
|
74
|
-
export declare const setProductionWidgetActive: (active: boolean) => void;
|
|
75
65
|
/**
|
|
76
66
|
* Show widget settings loader with optional message
|
|
77
67
|
*/
|
package/dist/src/utils/dom.d.ts
CHANGED
|
@@ -4,11 +4,4 @@
|
|
|
4
4
|
* Centralized utilities for common DOM operations to reduce code duplication
|
|
5
5
|
* and ensure consistent error handling.
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
8
|
-
* Get an interactive element by its index.
|
|
9
|
-
* First tries to use data-id from get_html indexing, then falls back to current behavior.
|
|
10
|
-
* @param index The zero-based index of the element
|
|
11
|
-
* @returns The element at the given index, or null if not found
|
|
12
|
-
*/
|
|
13
|
-
export declare function getElementByIndex(index: number): HTMLElement | null;
|
|
14
7
|
export declare function isInteractable(el: Element | null): boolean;
|