@marketrix.ai/widget 3.8.40 → 3.8.117

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/src/components/base/Dialog.d.ts +4 -6
  2. package/dist/src/components/base/icons.d.ts +0 -267
  3. package/dist/src/components/blocks/WidgetDialog.d.ts +0 -12
  4. package/dist/src/components/navigation/MessengerShell.d.ts +1 -2
  5. package/dist/src/components/views/ChatView.d.ts +1 -2
  6. package/dist/src/context/ConversationContext.d.ts +56 -0
  7. package/dist/src/context/WidgetProviders.d.ts +8 -6
  8. package/dist/src/context/sseReducer.d.ts +3 -3
  9. package/dist/src/hooks/useWidget.d.ts +2 -5
  10. package/dist/src/index.d.ts +0 -4
  11. package/dist/src/services/ApiService.d.ts +0 -6
  12. package/dist/src/services/ChatService.d.ts +1 -2
  13. package/dist/src/services/DomService.d.ts +0 -62
  14. package/dist/src/services/ScreenShareService.d.ts +0 -7
  15. package/dist/src/services/SessionManager.d.ts +0 -6
  16. package/dist/src/services/SessionRecorder.d.ts +0 -15
  17. package/dist/src/services/StorageService.d.ts +3 -25
  18. package/dist/src/services/ValidationService.d.ts +0 -7
  19. package/dist/src/types/browserTools.d.ts +2 -2
  20. package/dist/src/types/index.d.ts +0 -16
  21. package/dist/src/utils/apiUtils.d.ts +0 -3
  22. package/dist/src/utils/bootstrap.d.ts +0 -44
  23. package/dist/src/utils/chat.d.ts +0 -24
  24. package/dist/src/utils/{format.d.ts → color.d.ts} +0 -9
  25. package/dist/src/utils/dom.d.ts +0 -7
  26. package/dist/src/utils/{common.d.ts → logger.d.ts} +0 -3
  27. package/dist/src/utils/validation.d.ts +0 -13
  28. package/dist/widget.mjs +62 -65
  29. package/dist/widget.mjs.map +1 -1
  30. package/package.json +10 -10
  31. package/dist/src/components/blocks/TabBar.d.ts +0 -12
  32. package/dist/src/constants/config.d.ts +0 -7
  33. package/dist/src/context/ChatContext.d.ts +0 -33
  34. 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' | 'info';
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' | 'info';
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
- interface DialogCloseProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
23
- variant?: 'default' | 'info';
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,15 +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
- /** FaCheckCircle */
26
17
  readonly checkCircle: {
27
18
  readonly viewBox: "0 0 512 512";
28
19
  readonly paths: [{
@@ -30,7 +21,6 @@ export declare const icons: {
30
21
  readonly fill: "currentColor";
31
22
  }];
32
23
  };
33
- /** FaCircle */
34
24
  readonly circle: {
35
25
  readonly viewBox: "0 0 512 512";
36
26
  readonly paths: [{
@@ -38,7 +28,6 @@ export declare const icons: {
38
28
  readonly fill: "currentColor";
39
29
  }];
40
30
  };
41
- /** FaExclamationCircle */
42
31
  readonly exclamationCircle: {
43
32
  readonly viewBox: "0 0 512 512";
44
33
  readonly paths: [{
@@ -46,7 +35,6 @@ export declare const icons: {
46
35
  readonly fill: "currentColor";
47
36
  }];
48
37
  };
49
- /** FaTimesCircle */
50
38
  readonly timesCircle: {
51
39
  readonly viewBox: "0 0 512 512";
52
40
  readonly paths: [{
@@ -54,7 +42,6 @@ export declare const icons: {
54
42
  readonly fill: "currentColor";
55
43
  }];
56
44
  };
57
- /** FaBan */
58
45
  readonly ban: {
59
46
  readonly viewBox: "0 0 512 512";
60
47
  readonly paths: [{
@@ -62,7 +49,6 @@ export declare const icons: {
62
49
  readonly fill: "currentColor";
63
50
  }];
64
51
  };
65
- /** FaArrowUp */
66
52
  readonly arrowUp: {
67
53
  readonly viewBox: "0 0 448 512";
68
54
  readonly paths: [{
@@ -70,7 +56,6 @@ export declare const icons: {
70
56
  readonly fill: "currentColor";
71
57
  }];
72
58
  };
73
- /** FaArrowDown */
74
59
  readonly arrowDown: {
75
60
  readonly viewBox: "0 0 448 512";
76
61
  readonly paths: [{
@@ -78,68 +63,6 @@ export declare const icons: {
78
63
  readonly fill: "currentColor";
79
64
  }];
80
65
  };
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
- /** FiX */
143
66
  readonly x: {
144
67
  readonly viewBox: "0 0 24 24";
145
68
  readonly paths: [{
@@ -158,7 +81,6 @@ export declare const icons: {
158
81
  readonly strokeLinejoin: "round";
159
82
  }];
160
83
  };
161
- /** IoChatbubbleEllipsesOutline */
162
84
  readonly chatBubble: {
163
85
  readonly viewBox: "0 0 512 512";
164
86
  readonly paths: [{
@@ -178,7 +100,6 @@ export declare const icons: {
178
100
  readonly fill: "currentColor";
179
101
  }];
180
102
  };
181
- /** IoStop */
182
103
  readonly stop: {
183
104
  readonly viewBox: "0 0 512 512";
184
105
  readonly paths: [{
@@ -186,7 +107,6 @@ export declare const icons: {
186
107
  readonly fill: "currentColor";
187
108
  }];
188
109
  };
189
- /** LuMousePointerClick */
190
110
  readonly mousePointerClick: {
191
111
  readonly viewBox: "0 0 24 24";
192
112
  readonly paths: [{
@@ -226,26 +146,6 @@ export declare const icons: {
226
146
  readonly strokeLinejoin: "round";
227
147
  }];
228
148
  };
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
- /** SiTicktick */
249
149
  readonly ticktick: {
250
150
  readonly viewBox: "0 0 24 24";
251
151
  readonly paths: [{
@@ -253,141 +153,6 @@ export declare const icons: {
253
153
  readonly fill: "currentColor";
254
154
  }];
255
155
  };
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
156
  /** Home icon — from MessengerShell TAB_ICONS.home, viewBox 0 0 24 24 */
392
157
  readonly home: {
393
158
  readonly viewBox: "0 0 24 24";
@@ -412,18 +177,6 @@ export declare const icons: {
412
177
  readonly strokeLinejoin: "round";
413
178
  }];
414
179
  };
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
180
  /** Send / arrow right — from MessageInput send button */
428
181
  readonly send: {
429
182
  readonly viewBox: "0 0 24 24";
@@ -482,26 +235,6 @@ export declare const icons: {
482
235
  readonly strokeLinejoin: "round";
483
236
  }];
484
237
  };
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
238
  /** Alert circle / error — from VideoStreamDisplay stream error state */
506
239
  readonly alertCircle: {
507
240
  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, TaskProgress, WidgetView } from '../../types';
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, TaskProgress } from '../../types';
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, ChatProvider,
3
- * and TaskProvider together.
2
+ * WidgetProviders — composition root that wires UIStateProvider and
3
+ * ConversationProvider together.
4
4
  *
5
- * Initialization (SSE connection, ChatService hydration) and persistence both
6
- * live in inner bridge components that have access to all three contexts.
7
- * React context is the single source of truth; ChatService is the load/persist
8
- * boundary only, driven by one effect here.
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 TaskContext effect wires this up,
5
- * runs the returned effects (tool exec, wsClient.send, setLoading), and re-enters
6
- * via `applyToolResult` once an async tool finishes.
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, TaskProgress, WidgetSettingsData, WidgetState, WidgetView } from '../types';
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, ChatContext, and TaskContext into the unified
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
  */
@@ -33,10 +33,6 @@ export { getCurrentConfig };
33
33
  * Renders widget into parent container with shadow DOM
34
34
  */
35
35
  export declare const MarketrixWidget: React.FC<MarketrixWidgetProps>;
36
- /**
37
- * addWidget - Function that auto-detects mode and initializes widget
38
- * Supports preview, production, and dev modes
39
- */
40
36
  export declare const mountWidget: (config: AddWidgetConfig) => Promise<void>;
41
37
  export type { InstructionType } from './sdk';
42
38
  export type { AddWidgetConfig, ChatMessage, MarketrixConfig, MarketrixWidgetProps, WidgetState } from './types';
@@ -2,17 +2,11 @@ import type { MarketrixConfig, SendMessageRequest, SendMessageResponse } from '.
2
2
  export declare class ApiService {
3
3
  private config;
4
4
  constructor(config: MarketrixConfig);
5
- /**
6
- * Get the current chat ID (does not create if missing)
7
- */
8
5
  getChatId(): string | null;
9
6
  /**
10
7
  * Get user_id from various sources (config, localStorage, sessionStorage)
11
8
  */
12
9
  private getUserId;
13
- /**
14
- * Log widget question to action_log
15
- */
16
10
  logWidgetQuestion(question: string, mode: string): Promise<void>;
17
11
  /**
18
12
  * Send a message via the typed stream (fire-and-forget).
@@ -1,4 +1,4 @@
1
- import type { ChatMessage, InstructionType, TaskProgress } from '../types';
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;