@marketrix.ai/widget 4.0.109 → 4.0.111

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.
@@ -1,27 +1,21 @@
1
1
  /**
2
2
  * `Surface` is the canonical container primitive: a polymorphic `forwardRef` element (`as`, default
3
3
  * `div`) that composes the shared layout-token vocabulary with a `background` token, a `SHADOW`
4
- * `elevation` token and a `paddingPreset`, all emitted as inline style. `SurfaceBackground` and
5
- * `SurfacePadding` are those token unions, `backgroundStyles` and `paddingPresetStyles` their lookup
6
- * tables the `default`/`none` entries are empty, so a bare `Surface` is a plain element and
7
- * `SurfaceProps` the prop surface: `LayoutProps` plus the host element's HTML attributes.
4
+ * `elevation` token and a `paddingPreset`, all emitted as inline style — the `default`/`none` lookup
5
+ * entries are empty, so a bare `Surface` is a plain element. `className` is dropped from the host
6
+ * attributes and re-declared because it is INTERNAL to `blocks/`: layout props are the styling API
7
+ * everywhere else, and the only legitimate classes are the `index.css` hooks the block components key on.
8
8
  *
9
9
  * `floatingCard` is a `variant` shorthand for the card-background/border/card-elevation/card-padding/xl-
10
10
  * rounded/margin bundle both `HomeView`'s recent-conversation card and `ChatView`'s composer card use —
11
11
  * the margin lives in `variantStyles` since both call sites want it, while `ChatView`'s extra
12
12
  * `marginTop: 'auto'` stays an override on its own `style` prop rather than joining the preset.
13
13
  *
14
- * `className` is dropped from those attributes and re-declared because it is INTERNAL to `blocks/`:
15
- * layout props are the styling API everywhere else, and the only legitimate classes are the
16
- * `index.css` hooks the block components key on.
17
- *
18
- * Style order is fixed and load-bearing: background padding preset elevation layout props
19
- * the caller's own `style` last, so an inline style always wins. `Flex` depends on that tail
20
- * position, resolving `display` itself because `resolveLayoutStyle` is applied ahead of it.
21
- *
22
- * `resolveLayoutStyle` is handed the whole `props` (it reads only layout keys), while the DOM spread
23
- * goes through `stripLayoutProps` — a layout token left on the props bag reaches the element as an
24
- * unknown attribute.
14
+ * Style order is fixed and load-bearing: background padding preset elevation layout props → the
15
+ * caller's own `style` last, so an inline style always wins; `Flex` depends on that tail position,
16
+ * resolving `display` itself because `resolveLayoutStyle` is applied ahead of it. `resolveLayoutStyle`
17
+ * is handed the whole `props` (it reads only layout keys), while the DOM spread goes through
18
+ * `stripLayoutProps` a layout token left on the props bag reaches the element as an unknown attribute.
25
19
  */
26
20
  import { type ElementType } from 'react';
27
21
  import { type ShadowToken } from '../../design-system/component-tokens';
@@ -3,25 +3,23 @@
3
3
  * `resolveLayoutStyle` which reduces them to a `CSSProperties` object, and `stripLayoutProps` which
4
4
  * removes them from a props bag so the remainder can be spread onto a DOM element. `SPACING_SCALE` is
5
5
  * the exported `SpacingToken`→pixel table, declared smallest-first so a token name orders the same way
6
- * as the pixels it emits (`__tests__/layoutProps.test.ts` pins that); `ALIGN`, `JUSTIFY`, `ANIMATION`
7
- * and `BORDER_SIDE` are the private lookups for the remaining token families.
6
+ * as the pixels it emits.
8
7
  *
9
8
  * Layout props resolve to a style object rather than class names: as classes they were interpolated
10
- * (`p-${token}`), which no scanner could see, so a build-time safelist emitting the whole 8x7 matrix
11
- * was the only thing keeping them alive and a missing entry failed silently at runtime.
12
- * `resolveLayoutStyle` emits a property only for a prop set to a non-default value `grow: false`,
13
- * `shrink: true`, `border: false`, `rounded: false` and `animate: 'none'` deliberately emit nothing
14
- * and its `ANIMATION` values name `mtx-*` keyframes `index.css` must define
15
- * (`__tests__/stylesheet-contract.test.ts` pins the pairing).
9
+ * (`p-${token}`), which no scanner could see, so a build-time safelist emitting the whole 8x7 matrix was
10
+ * the only thing keeping them alive and a missing entry failed silently at runtime. `resolveLayoutStyle`
11
+ * emits a property only for a prop set to a non-default value (`grow: false`, `shrink: true`, `border:
12
+ * false`, `rounded: false` and `animate: 'none'` deliberately emit nothing), and its `ANIMATION` values
13
+ * name `mtx-*` keyframes `index.css` must define.
16
14
  *
17
15
  * `LAYOUT_KEYS` must list every key of `LayoutProps`: `stripLayoutProps` filters by that set, so a
18
16
  * layout prop missing from it reaches the DOM as an unknown attribute. `as` and `style` are in it
19
17
  * because the consuming component (`Surface`) applies them itself rather than forwarding them.
20
18
  *
21
- * `withClass(base, extra)` appends an optional caller `className` to a component's fixed base class
22
- * (`Button`, `Icon`, `Avatar`). It is NOT the banned `cn()`: there is no variant list to merge or
23
- * dedup, just a plain conditional concat of one fixed string and one optional string — variants stay
24
- * on `data-*` attributes per the styling rule in `../../../CLAUDE.md`.
19
+ * `withClass(base, extra)` appends an optional caller `className` to a component's fixed base class. It
20
+ * is NOT the banned `cn()`: there is no variant list to merge or dedup, just a plain conditional concat
21
+ * of one fixed string and one optional string — variants stay on `data-*` attributes per the styling
22
+ * rule in `../../../CLAUDE.md`.
25
23
  */
26
24
  import type { CSSProperties, ElementType } from 'react';
27
25
  import { type RadiusToken } from '../../design-system/component-tokens';
@@ -1,23 +1,20 @@
1
1
  /**
2
2
  * Focus trap for the messenger panel: while `isActive`, focus starts inside `containerRef`, Tab cycles
3
3
  * within it, Escape calls `onEscape`, and on deactivation focus returns to whatever held it before.
4
- *
5
- * The tabbable candidates come from `utils/dom`'s shared `focusablesIn` (built on `TABBABLE_SELECTOR`,
6
- * visibility and `aria-hidden` ancestry the same filter `keySimulation`'s Tab simulation uses, so the
7
- * widget's own tab order and the host page's can't re-diverge); `activeElementIn` reads the focused
8
- * element as seen from a container's own root; and `useFocusTrap(containerRef, isActive, {onEscape,
9
- * focusTargetRef})` focuses `focusTargetRef` (else the first focusable), installs one capture-phase
10
- * `keydown` listener on `document`, and restores focus on the active→inactive edge.
4
+ * `useFocusTrap(containerRef, isActive, {onEscape, focusTargetRef})` focuses `focusTargetRef` (else the
5
+ * first focusable), installs one capture-phase `keydown` listener on `document`, and restores focus on
6
+ * the active→inactive edge. The tabbable candidates come from `utils/dom`'s shared `focusablesIn`, the
7
+ * same filter `keySimulation`'s Tab simulation uses, so the widget's own tab order and the host page's
8
+ * can't re-diverge.
11
9
  *
12
10
  * Inside the widget's closed shadow root `document.activeElement` retargets to the HOST, never naming
13
11
  * an element of the widget's own tree; `activeElementIn` reads through `container.getRootNode()`
14
12
  * instead and is the ONE home for that retargeting — eslint's `no-restricted-properties` bans the bare
15
- * read everywhere else. Hand-rolled on purpose: `MessengerShell` is a NON-modal panel, not a Dialog,
16
- * and Base UI exposes no standalone focus trap; reaching it by making the panel a Dialog would inert
17
- * the customer's page. Both key arms bail unless focus is currently inside the container, since the
13
+ * read everywhere else. Hand-rolled on purpose: `MessengerShell` is a NON-modal panel, not a Dialog, and
14
+ * Base UI exposes no standalone focus trap; reaching it by making the panel a Dialog would inert the
15
+ * customer's page. Both key arms bail unless focus is currently inside the container, since the
18
16
  * listener sits on `document` ahead of host-page handlers and an unguarded Escape would close the
19
- * widget mid-typing. Tab `preventDefault`s only at the two ends; `previousActiveRef` edge-triggers the
20
- * restore once on close.
17
+ * widget mid-typing.
21
18
  */
22
19
  export declare function useFocusTrap(containerRef: React.RefObject<HTMLElement | null>, isActive: boolean, options?: {
23
20
  onEscape?: () => void;
@@ -60,6 +60,13 @@ export declare const ToolCallRecordSchema: z.ZodObject<{
60
60
  params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
61
61
  result: z.ZodRecord<z.ZodString, z.ZodUnknown>;
62
62
  }, z.core.$strict>;
63
+ export declare const SessionStateSchema: z.ZodObject<{
64
+ cookies: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
65
+ local_storage: z.ZodArray<z.ZodObject<{
66
+ origin: z.ZodString;
67
+ items: z.ZodRecord<z.ZodString, z.ZodString>;
68
+ }, z.core.$strict>>;
69
+ }, z.core.$strict>;
63
70
  export declare const SlackWebhookUrlSchema: z.ZodURL;
64
71
  export declare const GraphEdgeSchema: z.ZodObject<{
65
72
  start: z.ZodString;
@@ -362,7 +362,391 @@ export declare const WidgetPublicSchema: z.ZodObject<{
362
362
  }, z.core.$strip>;
363
363
  }, z.core.$strip>;
364
364
  export type WidgetPublicData = z.infer<typeof WidgetPublicSchema>;
365
- export declare const ActivityLogMetadataSchema: z.ZodUnion<[z.ZodTypeAny<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodTypeAny<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, ...z.ZodTypeAny<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[]]>;
365
+ export declare const ActivityLogMetadataSchema: z.ZodUnion<[z.ZodObject<{
366
+ details: z.ZodString;
367
+ }, z.core.$strict> | z.ZodUnion<readonly [z.ZodObject<{
368
+ target_user_id: z.ZodNumber;
369
+ target_user_email: z.ZodString;
370
+ reason: z.ZodString;
371
+ details: z.ZodString;
372
+ }, z.core.$strict>, z.ZodObject<{
373
+ target_user_id: z.ZodNumber;
374
+ details: z.ZodString;
375
+ }, z.core.$strict>]> | z.ZodObject<{
376
+ id: z.ZodNumber;
377
+ name: z.ZodString;
378
+ type: z.ZodEnum<{
379
+ app: "app";
380
+ website: "website";
381
+ }>;
382
+ }, z.core.$strict> | z.ZodObject<{
383
+ application_id: z.ZodNumber;
384
+ widget_type: z.ZodEnum<{
385
+ widget: "widget";
386
+ }>;
387
+ details: z.ZodString;
388
+ }, z.core.$strict> | z.ZodObject<{
389
+ application_id: z.ZodNumber;
390
+ file_name: z.ZodString;
391
+ file_size: z.ZodNumber;
392
+ file_type: z.ZodString;
393
+ file_url: z.ZodString;
394
+ source_url: z.ZodOptional<z.ZodString>;
395
+ }, z.core.$strict> | z.ZodObject<{
396
+ id: z.ZodNumber;
397
+ file_name: z.ZodString;
398
+ source_url: z.ZodString;
399
+ action: z.ZodLiteral<"refreshed">;
400
+ }, z.core.$strict> | z.ZodObject<{
401
+ id: z.ZodNumber;
402
+ file_name: z.ZodString;
403
+ file_type: z.ZodString;
404
+ }, z.core.$strict> | z.ZodObject<{
405
+ target_user_email: z.ZodString;
406
+ reminder: z.ZodOptional<z.ZodLiteral<true>>;
407
+ details: z.ZodString;
408
+ }, z.core.$strict> | z.ZodObject<{
409
+ target_user_email: z.ZodString;
410
+ details: z.ZodString;
411
+ }, z.core.$strict> | z.ZodObject<{
412
+ slug: z.ZodString;
413
+ details: z.ZodString;
414
+ }, z.core.$strict> | z.ZodObject<{
415
+ subscription_id: z.ZodString;
416
+ plan: z.ZodOptional<z.ZodString>;
417
+ details: z.ZodString;
418
+ }, z.core.$strict> | z.ZodObject<{
419
+ subscription_id: z.ZodString;
420
+ plan: z.ZodOptional<z.ZodString>;
421
+ details: z.ZodString;
422
+ }, z.core.$strict> | z.ZodObject<{
423
+ subscription_id: z.ZodString;
424
+ plan: z.ZodOptional<z.ZodString>;
425
+ details: z.ZodString;
426
+ }, z.core.$strict> | z.ZodObject<{
427
+ subscription_id: z.ZodString;
428
+ plan: z.ZodOptional<z.ZodString>;
429
+ details: z.ZodString;
430
+ }, z.core.$strict> | z.ZodObject<{
431
+ subscription_id: z.ZodString;
432
+ plan: z.ZodOptional<z.ZodString>;
433
+ details: z.ZodString;
434
+ }, z.core.$strict> | z.ZodObject<{
435
+ session_id: z.ZodString;
436
+ plan: z.ZodOptional<z.ZodString>;
437
+ details: z.ZodString;
438
+ }, z.core.$strict> | z.ZodObject<{
439
+ invoice_id: z.ZodString;
440
+ plan: z.ZodOptional<z.ZodString>;
441
+ details: z.ZodString;
442
+ }, z.core.$strict> | z.ZodObject<{
443
+ invoice_id: z.ZodString;
444
+ plan: z.ZodOptional<z.ZodString>;
445
+ details: z.ZodString;
446
+ }, z.core.$strict> | z.ZodObject<{
447
+ application_id: z.ZodNumber;
448
+ chat_id: z.ZodString;
449
+ mode: z.ZodString;
450
+ question: z.ZodString;
451
+ timestamp: z.ZodString;
452
+ user_id: z.ZodOptional<z.ZodNumber>;
453
+ }, z.core.$strict> | z.ZodObject<{
454
+ application_id: z.ZodNumber;
455
+ simulation_id: z.ZodNumber;
456
+ }, z.core.$strict> | z.ZodObject<{
457
+ id: z.ZodNumber;
458
+ name: z.ZodString;
459
+ details: z.ZodString;
460
+ }, z.core.$strict> | z.ZodObject<{
461
+ enabled: z.ZodBoolean;
462
+ id: z.ZodNumber;
463
+ name: z.ZodString;
464
+ details: z.ZodString;
465
+ }, z.core.$strict> | z.ZodObject<{
466
+ slack_user_id: z.ZodString;
467
+ slack_channel_id: z.ZodNullable<z.ZodString>;
468
+ raw_text: z.ZodString;
469
+ detected_intent: z.ZodString;
470
+ extracted_params: z.ZodObject<{
471
+ qaFlowId: z.ZodOptional<z.ZodNumber>;
472
+ appId: z.ZodOptional<z.ZodNumber>;
473
+ instructions: z.ZodOptional<z.ZodString>;
474
+ query: z.ZodOptional<z.ZodString>;
475
+ channel: z.ZodOptional<z.ZodString>;
476
+ text: z.ZodOptional<z.ZodString>;
477
+ name: z.ZodOptional<z.ZodString>;
478
+ workflowName: z.ZodOptional<z.ZodString>;
479
+ }, z.core.$strict>;
480
+ status: z.ZodEnum<{
481
+ received: "received";
482
+ classifying: "classifying";
483
+ dispatched: "dispatched";
484
+ completed: "completed";
485
+ failed: "failed";
486
+ }>;
487
+ response_text: z.ZodNullable<z.ZodString>;
488
+ error_message: z.ZodNullable<z.ZodString>;
489
+ duration_ms: z.ZodNullable<z.ZodNumber>;
490
+ }, z.core.$strict> | z.ZodObject<{
491
+ survey_id: z.ZodNumber;
492
+ details: z.ZodString;
493
+ }, z.core.$strict>, z.ZodObject<{
494
+ details: z.ZodString;
495
+ }, z.core.$strict> | z.ZodUnion<readonly [z.ZodObject<{
496
+ target_user_id: z.ZodNumber;
497
+ target_user_email: z.ZodString;
498
+ reason: z.ZodString;
499
+ details: z.ZodString;
500
+ }, z.core.$strict>, z.ZodObject<{
501
+ target_user_id: z.ZodNumber;
502
+ details: z.ZodString;
503
+ }, z.core.$strict>]> | z.ZodObject<{
504
+ id: z.ZodNumber;
505
+ name: z.ZodString;
506
+ type: z.ZodEnum<{
507
+ app: "app";
508
+ website: "website";
509
+ }>;
510
+ }, z.core.$strict> | z.ZodObject<{
511
+ application_id: z.ZodNumber;
512
+ widget_type: z.ZodEnum<{
513
+ widget: "widget";
514
+ }>;
515
+ details: z.ZodString;
516
+ }, z.core.$strict> | z.ZodObject<{
517
+ application_id: z.ZodNumber;
518
+ file_name: z.ZodString;
519
+ file_size: z.ZodNumber;
520
+ file_type: z.ZodString;
521
+ file_url: z.ZodString;
522
+ source_url: z.ZodOptional<z.ZodString>;
523
+ }, z.core.$strict> | z.ZodObject<{
524
+ id: z.ZodNumber;
525
+ file_name: z.ZodString;
526
+ source_url: z.ZodString;
527
+ action: z.ZodLiteral<"refreshed">;
528
+ }, z.core.$strict> | z.ZodObject<{
529
+ id: z.ZodNumber;
530
+ file_name: z.ZodString;
531
+ file_type: z.ZodString;
532
+ }, z.core.$strict> | z.ZodObject<{
533
+ target_user_email: z.ZodString;
534
+ reminder: z.ZodOptional<z.ZodLiteral<true>>;
535
+ details: z.ZodString;
536
+ }, z.core.$strict> | z.ZodObject<{
537
+ target_user_email: z.ZodString;
538
+ details: z.ZodString;
539
+ }, z.core.$strict> | z.ZodObject<{
540
+ slug: z.ZodString;
541
+ details: z.ZodString;
542
+ }, z.core.$strict> | z.ZodObject<{
543
+ subscription_id: z.ZodString;
544
+ plan: z.ZodOptional<z.ZodString>;
545
+ details: z.ZodString;
546
+ }, z.core.$strict> | z.ZodObject<{
547
+ subscription_id: z.ZodString;
548
+ plan: z.ZodOptional<z.ZodString>;
549
+ details: z.ZodString;
550
+ }, z.core.$strict> | z.ZodObject<{
551
+ subscription_id: z.ZodString;
552
+ plan: z.ZodOptional<z.ZodString>;
553
+ details: z.ZodString;
554
+ }, z.core.$strict> | z.ZodObject<{
555
+ subscription_id: z.ZodString;
556
+ plan: z.ZodOptional<z.ZodString>;
557
+ details: z.ZodString;
558
+ }, z.core.$strict> | z.ZodObject<{
559
+ subscription_id: z.ZodString;
560
+ plan: z.ZodOptional<z.ZodString>;
561
+ details: z.ZodString;
562
+ }, z.core.$strict> | z.ZodObject<{
563
+ session_id: z.ZodString;
564
+ plan: z.ZodOptional<z.ZodString>;
565
+ details: z.ZodString;
566
+ }, z.core.$strict> | z.ZodObject<{
567
+ invoice_id: z.ZodString;
568
+ plan: z.ZodOptional<z.ZodString>;
569
+ details: z.ZodString;
570
+ }, z.core.$strict> | z.ZodObject<{
571
+ invoice_id: z.ZodString;
572
+ plan: z.ZodOptional<z.ZodString>;
573
+ details: z.ZodString;
574
+ }, z.core.$strict> | z.ZodObject<{
575
+ application_id: z.ZodNumber;
576
+ chat_id: z.ZodString;
577
+ mode: z.ZodString;
578
+ question: z.ZodString;
579
+ timestamp: z.ZodString;
580
+ user_id: z.ZodOptional<z.ZodNumber>;
581
+ }, z.core.$strict> | z.ZodObject<{
582
+ application_id: z.ZodNumber;
583
+ simulation_id: z.ZodNumber;
584
+ }, z.core.$strict> | z.ZodObject<{
585
+ id: z.ZodNumber;
586
+ name: z.ZodString;
587
+ details: z.ZodString;
588
+ }, z.core.$strict> | z.ZodObject<{
589
+ enabled: z.ZodBoolean;
590
+ id: z.ZodNumber;
591
+ name: z.ZodString;
592
+ details: z.ZodString;
593
+ }, z.core.$strict> | z.ZodObject<{
594
+ slack_user_id: z.ZodString;
595
+ slack_channel_id: z.ZodNullable<z.ZodString>;
596
+ raw_text: z.ZodString;
597
+ detected_intent: z.ZodString;
598
+ extracted_params: z.ZodObject<{
599
+ qaFlowId: z.ZodOptional<z.ZodNumber>;
600
+ appId: z.ZodOptional<z.ZodNumber>;
601
+ instructions: z.ZodOptional<z.ZodString>;
602
+ query: z.ZodOptional<z.ZodString>;
603
+ channel: z.ZodOptional<z.ZodString>;
604
+ text: z.ZodOptional<z.ZodString>;
605
+ name: z.ZodOptional<z.ZodString>;
606
+ workflowName: z.ZodOptional<z.ZodString>;
607
+ }, z.core.$strict>;
608
+ status: z.ZodEnum<{
609
+ received: "received";
610
+ classifying: "classifying";
611
+ dispatched: "dispatched";
612
+ completed: "completed";
613
+ failed: "failed";
614
+ }>;
615
+ response_text: z.ZodNullable<z.ZodString>;
616
+ error_message: z.ZodNullable<z.ZodString>;
617
+ duration_ms: z.ZodNullable<z.ZodNumber>;
618
+ }, z.core.$strict> | z.ZodObject<{
619
+ survey_id: z.ZodNumber;
620
+ details: z.ZodString;
621
+ }, z.core.$strict>, ...(z.ZodObject<{
622
+ details: z.ZodString;
623
+ }, z.core.$strict> | z.ZodUnion<readonly [z.ZodObject<{
624
+ target_user_id: z.ZodNumber;
625
+ target_user_email: z.ZodString;
626
+ reason: z.ZodString;
627
+ details: z.ZodString;
628
+ }, z.core.$strict>, z.ZodObject<{
629
+ target_user_id: z.ZodNumber;
630
+ details: z.ZodString;
631
+ }, z.core.$strict>]> | z.ZodObject<{
632
+ id: z.ZodNumber;
633
+ name: z.ZodString;
634
+ type: z.ZodEnum<{
635
+ app: "app";
636
+ website: "website";
637
+ }>;
638
+ }, z.core.$strict> | z.ZodObject<{
639
+ application_id: z.ZodNumber;
640
+ widget_type: z.ZodEnum<{
641
+ widget: "widget";
642
+ }>;
643
+ details: z.ZodString;
644
+ }, z.core.$strict> | z.ZodObject<{
645
+ application_id: z.ZodNumber;
646
+ file_name: z.ZodString;
647
+ file_size: z.ZodNumber;
648
+ file_type: z.ZodString;
649
+ file_url: z.ZodString;
650
+ source_url: z.ZodOptional<z.ZodString>;
651
+ }, z.core.$strict> | z.ZodObject<{
652
+ id: z.ZodNumber;
653
+ file_name: z.ZodString;
654
+ source_url: z.ZodString;
655
+ action: z.ZodLiteral<"refreshed">;
656
+ }, z.core.$strict> | z.ZodObject<{
657
+ id: z.ZodNumber;
658
+ file_name: z.ZodString;
659
+ file_type: z.ZodString;
660
+ }, z.core.$strict> | z.ZodObject<{
661
+ target_user_email: z.ZodString;
662
+ reminder: z.ZodOptional<z.ZodLiteral<true>>;
663
+ details: z.ZodString;
664
+ }, z.core.$strict> | z.ZodObject<{
665
+ target_user_email: z.ZodString;
666
+ details: z.ZodString;
667
+ }, z.core.$strict> | z.ZodObject<{
668
+ slug: z.ZodString;
669
+ details: z.ZodString;
670
+ }, z.core.$strict> | z.ZodObject<{
671
+ subscription_id: z.ZodString;
672
+ plan: z.ZodOptional<z.ZodString>;
673
+ details: z.ZodString;
674
+ }, z.core.$strict> | z.ZodObject<{
675
+ subscription_id: z.ZodString;
676
+ plan: z.ZodOptional<z.ZodString>;
677
+ details: z.ZodString;
678
+ }, z.core.$strict> | z.ZodObject<{
679
+ subscription_id: z.ZodString;
680
+ plan: z.ZodOptional<z.ZodString>;
681
+ details: z.ZodString;
682
+ }, z.core.$strict> | z.ZodObject<{
683
+ subscription_id: z.ZodString;
684
+ plan: z.ZodOptional<z.ZodString>;
685
+ details: z.ZodString;
686
+ }, z.core.$strict> | z.ZodObject<{
687
+ subscription_id: z.ZodString;
688
+ plan: z.ZodOptional<z.ZodString>;
689
+ details: z.ZodString;
690
+ }, z.core.$strict> | z.ZodObject<{
691
+ session_id: z.ZodString;
692
+ plan: z.ZodOptional<z.ZodString>;
693
+ details: z.ZodString;
694
+ }, z.core.$strict> | z.ZodObject<{
695
+ invoice_id: z.ZodString;
696
+ plan: z.ZodOptional<z.ZodString>;
697
+ details: z.ZodString;
698
+ }, z.core.$strict> | z.ZodObject<{
699
+ invoice_id: z.ZodString;
700
+ plan: z.ZodOptional<z.ZodString>;
701
+ details: z.ZodString;
702
+ }, z.core.$strict> | z.ZodObject<{
703
+ application_id: z.ZodNumber;
704
+ chat_id: z.ZodString;
705
+ mode: z.ZodString;
706
+ question: z.ZodString;
707
+ timestamp: z.ZodString;
708
+ user_id: z.ZodOptional<z.ZodNumber>;
709
+ }, z.core.$strict> | z.ZodObject<{
710
+ application_id: z.ZodNumber;
711
+ simulation_id: z.ZodNumber;
712
+ }, z.core.$strict> | z.ZodObject<{
713
+ id: z.ZodNumber;
714
+ name: z.ZodString;
715
+ details: z.ZodString;
716
+ }, z.core.$strict> | z.ZodObject<{
717
+ enabled: z.ZodBoolean;
718
+ id: z.ZodNumber;
719
+ name: z.ZodString;
720
+ details: z.ZodString;
721
+ }, z.core.$strict> | z.ZodObject<{
722
+ slack_user_id: z.ZodString;
723
+ slack_channel_id: z.ZodNullable<z.ZodString>;
724
+ raw_text: z.ZodString;
725
+ detected_intent: z.ZodString;
726
+ extracted_params: z.ZodObject<{
727
+ qaFlowId: z.ZodOptional<z.ZodNumber>;
728
+ appId: z.ZodOptional<z.ZodNumber>;
729
+ instructions: z.ZodOptional<z.ZodString>;
730
+ query: z.ZodOptional<z.ZodString>;
731
+ channel: z.ZodOptional<z.ZodString>;
732
+ text: z.ZodOptional<z.ZodString>;
733
+ name: z.ZodOptional<z.ZodString>;
734
+ workflowName: z.ZodOptional<z.ZodString>;
735
+ }, z.core.$strict>;
736
+ status: z.ZodEnum<{
737
+ received: "received";
738
+ classifying: "classifying";
739
+ dispatched: "dispatched";
740
+ completed: "completed";
741
+ failed: "failed";
742
+ }>;
743
+ response_text: z.ZodNullable<z.ZodString>;
744
+ error_message: z.ZodNullable<z.ZodString>;
745
+ duration_ms: z.ZodNullable<z.ZodNumber>;
746
+ }, z.core.$strict> | z.ZodObject<{
747
+ survey_id: z.ZodNumber;
748
+ details: z.ZodString;
749
+ }, z.core.$strict>)[]]>;
366
750
  export declare const ActivityLogEntitySchema: z.ZodObject<{
367
751
  id: z.ZodNumber;
368
752
  created_at: z.ZodCoercedDate<unknown>;
@@ -402,7 +786,391 @@ export declare const ActivityLogEntitySchema: z.ZodObject<{
402
786
  unpublish_survey: "unpublish_survey";
403
787
  delete_survey_response: "delete_survey_response";
404
788
  }>;
405
- metadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodTypeAny<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, z.ZodTypeAny<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>, ...z.ZodTypeAny<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>[]]>>>;
789
+ metadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
790
+ details: z.ZodString;
791
+ }, z.core.$strict> | z.ZodUnion<readonly [z.ZodObject<{
792
+ target_user_id: z.ZodNumber;
793
+ target_user_email: z.ZodString;
794
+ reason: z.ZodString;
795
+ details: z.ZodString;
796
+ }, z.core.$strict>, z.ZodObject<{
797
+ target_user_id: z.ZodNumber;
798
+ details: z.ZodString;
799
+ }, z.core.$strict>]> | z.ZodObject<{
800
+ id: z.ZodNumber;
801
+ name: z.ZodString;
802
+ type: z.ZodEnum<{
803
+ app: "app";
804
+ website: "website";
805
+ }>;
806
+ }, z.core.$strict> | z.ZodObject<{
807
+ application_id: z.ZodNumber;
808
+ widget_type: z.ZodEnum<{
809
+ widget: "widget";
810
+ }>;
811
+ details: z.ZodString;
812
+ }, z.core.$strict> | z.ZodObject<{
813
+ application_id: z.ZodNumber;
814
+ file_name: z.ZodString;
815
+ file_size: z.ZodNumber;
816
+ file_type: z.ZodString;
817
+ file_url: z.ZodString;
818
+ source_url: z.ZodOptional<z.ZodString>;
819
+ }, z.core.$strict> | z.ZodObject<{
820
+ id: z.ZodNumber;
821
+ file_name: z.ZodString;
822
+ source_url: z.ZodString;
823
+ action: z.ZodLiteral<"refreshed">;
824
+ }, z.core.$strict> | z.ZodObject<{
825
+ id: z.ZodNumber;
826
+ file_name: z.ZodString;
827
+ file_type: z.ZodString;
828
+ }, z.core.$strict> | z.ZodObject<{
829
+ target_user_email: z.ZodString;
830
+ reminder: z.ZodOptional<z.ZodLiteral<true>>;
831
+ details: z.ZodString;
832
+ }, z.core.$strict> | z.ZodObject<{
833
+ target_user_email: z.ZodString;
834
+ details: z.ZodString;
835
+ }, z.core.$strict> | z.ZodObject<{
836
+ slug: z.ZodString;
837
+ details: z.ZodString;
838
+ }, z.core.$strict> | z.ZodObject<{
839
+ subscription_id: z.ZodString;
840
+ plan: z.ZodOptional<z.ZodString>;
841
+ details: z.ZodString;
842
+ }, z.core.$strict> | z.ZodObject<{
843
+ subscription_id: z.ZodString;
844
+ plan: z.ZodOptional<z.ZodString>;
845
+ details: z.ZodString;
846
+ }, z.core.$strict> | z.ZodObject<{
847
+ subscription_id: z.ZodString;
848
+ plan: z.ZodOptional<z.ZodString>;
849
+ details: z.ZodString;
850
+ }, z.core.$strict> | z.ZodObject<{
851
+ subscription_id: z.ZodString;
852
+ plan: z.ZodOptional<z.ZodString>;
853
+ details: z.ZodString;
854
+ }, z.core.$strict> | z.ZodObject<{
855
+ subscription_id: z.ZodString;
856
+ plan: z.ZodOptional<z.ZodString>;
857
+ details: z.ZodString;
858
+ }, z.core.$strict> | z.ZodObject<{
859
+ session_id: z.ZodString;
860
+ plan: z.ZodOptional<z.ZodString>;
861
+ details: z.ZodString;
862
+ }, z.core.$strict> | z.ZodObject<{
863
+ invoice_id: z.ZodString;
864
+ plan: z.ZodOptional<z.ZodString>;
865
+ details: z.ZodString;
866
+ }, z.core.$strict> | z.ZodObject<{
867
+ invoice_id: z.ZodString;
868
+ plan: z.ZodOptional<z.ZodString>;
869
+ details: z.ZodString;
870
+ }, z.core.$strict> | z.ZodObject<{
871
+ application_id: z.ZodNumber;
872
+ chat_id: z.ZodString;
873
+ mode: z.ZodString;
874
+ question: z.ZodString;
875
+ timestamp: z.ZodString;
876
+ user_id: z.ZodOptional<z.ZodNumber>;
877
+ }, z.core.$strict> | z.ZodObject<{
878
+ application_id: z.ZodNumber;
879
+ simulation_id: z.ZodNumber;
880
+ }, z.core.$strict> | z.ZodObject<{
881
+ id: z.ZodNumber;
882
+ name: z.ZodString;
883
+ details: z.ZodString;
884
+ }, z.core.$strict> | z.ZodObject<{
885
+ enabled: z.ZodBoolean;
886
+ id: z.ZodNumber;
887
+ name: z.ZodString;
888
+ details: z.ZodString;
889
+ }, z.core.$strict> | z.ZodObject<{
890
+ slack_user_id: z.ZodString;
891
+ slack_channel_id: z.ZodNullable<z.ZodString>;
892
+ raw_text: z.ZodString;
893
+ detected_intent: z.ZodString;
894
+ extracted_params: z.ZodObject<{
895
+ qaFlowId: z.ZodOptional<z.ZodNumber>;
896
+ appId: z.ZodOptional<z.ZodNumber>;
897
+ instructions: z.ZodOptional<z.ZodString>;
898
+ query: z.ZodOptional<z.ZodString>;
899
+ channel: z.ZodOptional<z.ZodString>;
900
+ text: z.ZodOptional<z.ZodString>;
901
+ name: z.ZodOptional<z.ZodString>;
902
+ workflowName: z.ZodOptional<z.ZodString>;
903
+ }, z.core.$strict>;
904
+ status: z.ZodEnum<{
905
+ received: "received";
906
+ classifying: "classifying";
907
+ dispatched: "dispatched";
908
+ completed: "completed";
909
+ failed: "failed";
910
+ }>;
911
+ response_text: z.ZodNullable<z.ZodString>;
912
+ error_message: z.ZodNullable<z.ZodString>;
913
+ duration_ms: z.ZodNullable<z.ZodNumber>;
914
+ }, z.core.$strict> | z.ZodObject<{
915
+ survey_id: z.ZodNumber;
916
+ details: z.ZodString;
917
+ }, z.core.$strict>, z.ZodObject<{
918
+ details: z.ZodString;
919
+ }, z.core.$strict> | z.ZodUnion<readonly [z.ZodObject<{
920
+ target_user_id: z.ZodNumber;
921
+ target_user_email: z.ZodString;
922
+ reason: z.ZodString;
923
+ details: z.ZodString;
924
+ }, z.core.$strict>, z.ZodObject<{
925
+ target_user_id: z.ZodNumber;
926
+ details: z.ZodString;
927
+ }, z.core.$strict>]> | z.ZodObject<{
928
+ id: z.ZodNumber;
929
+ name: z.ZodString;
930
+ type: z.ZodEnum<{
931
+ app: "app";
932
+ website: "website";
933
+ }>;
934
+ }, z.core.$strict> | z.ZodObject<{
935
+ application_id: z.ZodNumber;
936
+ widget_type: z.ZodEnum<{
937
+ widget: "widget";
938
+ }>;
939
+ details: z.ZodString;
940
+ }, z.core.$strict> | z.ZodObject<{
941
+ application_id: z.ZodNumber;
942
+ file_name: z.ZodString;
943
+ file_size: z.ZodNumber;
944
+ file_type: z.ZodString;
945
+ file_url: z.ZodString;
946
+ source_url: z.ZodOptional<z.ZodString>;
947
+ }, z.core.$strict> | z.ZodObject<{
948
+ id: z.ZodNumber;
949
+ file_name: z.ZodString;
950
+ source_url: z.ZodString;
951
+ action: z.ZodLiteral<"refreshed">;
952
+ }, z.core.$strict> | z.ZodObject<{
953
+ id: z.ZodNumber;
954
+ file_name: z.ZodString;
955
+ file_type: z.ZodString;
956
+ }, z.core.$strict> | z.ZodObject<{
957
+ target_user_email: z.ZodString;
958
+ reminder: z.ZodOptional<z.ZodLiteral<true>>;
959
+ details: z.ZodString;
960
+ }, z.core.$strict> | z.ZodObject<{
961
+ target_user_email: z.ZodString;
962
+ details: z.ZodString;
963
+ }, z.core.$strict> | z.ZodObject<{
964
+ slug: z.ZodString;
965
+ details: z.ZodString;
966
+ }, z.core.$strict> | z.ZodObject<{
967
+ subscription_id: z.ZodString;
968
+ plan: z.ZodOptional<z.ZodString>;
969
+ details: z.ZodString;
970
+ }, z.core.$strict> | z.ZodObject<{
971
+ subscription_id: z.ZodString;
972
+ plan: z.ZodOptional<z.ZodString>;
973
+ details: z.ZodString;
974
+ }, z.core.$strict> | z.ZodObject<{
975
+ subscription_id: z.ZodString;
976
+ plan: z.ZodOptional<z.ZodString>;
977
+ details: z.ZodString;
978
+ }, z.core.$strict> | z.ZodObject<{
979
+ subscription_id: z.ZodString;
980
+ plan: z.ZodOptional<z.ZodString>;
981
+ details: z.ZodString;
982
+ }, z.core.$strict> | z.ZodObject<{
983
+ subscription_id: z.ZodString;
984
+ plan: z.ZodOptional<z.ZodString>;
985
+ details: z.ZodString;
986
+ }, z.core.$strict> | z.ZodObject<{
987
+ session_id: z.ZodString;
988
+ plan: z.ZodOptional<z.ZodString>;
989
+ details: z.ZodString;
990
+ }, z.core.$strict> | z.ZodObject<{
991
+ invoice_id: z.ZodString;
992
+ plan: z.ZodOptional<z.ZodString>;
993
+ details: z.ZodString;
994
+ }, z.core.$strict> | z.ZodObject<{
995
+ invoice_id: z.ZodString;
996
+ plan: z.ZodOptional<z.ZodString>;
997
+ details: z.ZodString;
998
+ }, z.core.$strict> | z.ZodObject<{
999
+ application_id: z.ZodNumber;
1000
+ chat_id: z.ZodString;
1001
+ mode: z.ZodString;
1002
+ question: z.ZodString;
1003
+ timestamp: z.ZodString;
1004
+ user_id: z.ZodOptional<z.ZodNumber>;
1005
+ }, z.core.$strict> | z.ZodObject<{
1006
+ application_id: z.ZodNumber;
1007
+ simulation_id: z.ZodNumber;
1008
+ }, z.core.$strict> | z.ZodObject<{
1009
+ id: z.ZodNumber;
1010
+ name: z.ZodString;
1011
+ details: z.ZodString;
1012
+ }, z.core.$strict> | z.ZodObject<{
1013
+ enabled: z.ZodBoolean;
1014
+ id: z.ZodNumber;
1015
+ name: z.ZodString;
1016
+ details: z.ZodString;
1017
+ }, z.core.$strict> | z.ZodObject<{
1018
+ slack_user_id: z.ZodString;
1019
+ slack_channel_id: z.ZodNullable<z.ZodString>;
1020
+ raw_text: z.ZodString;
1021
+ detected_intent: z.ZodString;
1022
+ extracted_params: z.ZodObject<{
1023
+ qaFlowId: z.ZodOptional<z.ZodNumber>;
1024
+ appId: z.ZodOptional<z.ZodNumber>;
1025
+ instructions: z.ZodOptional<z.ZodString>;
1026
+ query: z.ZodOptional<z.ZodString>;
1027
+ channel: z.ZodOptional<z.ZodString>;
1028
+ text: z.ZodOptional<z.ZodString>;
1029
+ name: z.ZodOptional<z.ZodString>;
1030
+ workflowName: z.ZodOptional<z.ZodString>;
1031
+ }, z.core.$strict>;
1032
+ status: z.ZodEnum<{
1033
+ received: "received";
1034
+ classifying: "classifying";
1035
+ dispatched: "dispatched";
1036
+ completed: "completed";
1037
+ failed: "failed";
1038
+ }>;
1039
+ response_text: z.ZodNullable<z.ZodString>;
1040
+ error_message: z.ZodNullable<z.ZodString>;
1041
+ duration_ms: z.ZodNullable<z.ZodNumber>;
1042
+ }, z.core.$strict> | z.ZodObject<{
1043
+ survey_id: z.ZodNumber;
1044
+ details: z.ZodString;
1045
+ }, z.core.$strict>, ...(z.ZodObject<{
1046
+ details: z.ZodString;
1047
+ }, z.core.$strict> | z.ZodUnion<readonly [z.ZodObject<{
1048
+ target_user_id: z.ZodNumber;
1049
+ target_user_email: z.ZodString;
1050
+ reason: z.ZodString;
1051
+ details: z.ZodString;
1052
+ }, z.core.$strict>, z.ZodObject<{
1053
+ target_user_id: z.ZodNumber;
1054
+ details: z.ZodString;
1055
+ }, z.core.$strict>]> | z.ZodObject<{
1056
+ id: z.ZodNumber;
1057
+ name: z.ZodString;
1058
+ type: z.ZodEnum<{
1059
+ app: "app";
1060
+ website: "website";
1061
+ }>;
1062
+ }, z.core.$strict> | z.ZodObject<{
1063
+ application_id: z.ZodNumber;
1064
+ widget_type: z.ZodEnum<{
1065
+ widget: "widget";
1066
+ }>;
1067
+ details: z.ZodString;
1068
+ }, z.core.$strict> | z.ZodObject<{
1069
+ application_id: z.ZodNumber;
1070
+ file_name: z.ZodString;
1071
+ file_size: z.ZodNumber;
1072
+ file_type: z.ZodString;
1073
+ file_url: z.ZodString;
1074
+ source_url: z.ZodOptional<z.ZodString>;
1075
+ }, z.core.$strict> | z.ZodObject<{
1076
+ id: z.ZodNumber;
1077
+ file_name: z.ZodString;
1078
+ source_url: z.ZodString;
1079
+ action: z.ZodLiteral<"refreshed">;
1080
+ }, z.core.$strict> | z.ZodObject<{
1081
+ id: z.ZodNumber;
1082
+ file_name: z.ZodString;
1083
+ file_type: z.ZodString;
1084
+ }, z.core.$strict> | z.ZodObject<{
1085
+ target_user_email: z.ZodString;
1086
+ reminder: z.ZodOptional<z.ZodLiteral<true>>;
1087
+ details: z.ZodString;
1088
+ }, z.core.$strict> | z.ZodObject<{
1089
+ target_user_email: z.ZodString;
1090
+ details: z.ZodString;
1091
+ }, z.core.$strict> | z.ZodObject<{
1092
+ slug: z.ZodString;
1093
+ details: z.ZodString;
1094
+ }, z.core.$strict> | z.ZodObject<{
1095
+ subscription_id: z.ZodString;
1096
+ plan: z.ZodOptional<z.ZodString>;
1097
+ details: z.ZodString;
1098
+ }, z.core.$strict> | z.ZodObject<{
1099
+ subscription_id: z.ZodString;
1100
+ plan: z.ZodOptional<z.ZodString>;
1101
+ details: z.ZodString;
1102
+ }, z.core.$strict> | z.ZodObject<{
1103
+ subscription_id: z.ZodString;
1104
+ plan: z.ZodOptional<z.ZodString>;
1105
+ details: z.ZodString;
1106
+ }, z.core.$strict> | z.ZodObject<{
1107
+ subscription_id: z.ZodString;
1108
+ plan: z.ZodOptional<z.ZodString>;
1109
+ details: z.ZodString;
1110
+ }, z.core.$strict> | z.ZodObject<{
1111
+ subscription_id: z.ZodString;
1112
+ plan: z.ZodOptional<z.ZodString>;
1113
+ details: z.ZodString;
1114
+ }, z.core.$strict> | z.ZodObject<{
1115
+ session_id: z.ZodString;
1116
+ plan: z.ZodOptional<z.ZodString>;
1117
+ details: z.ZodString;
1118
+ }, z.core.$strict> | z.ZodObject<{
1119
+ invoice_id: z.ZodString;
1120
+ plan: z.ZodOptional<z.ZodString>;
1121
+ details: z.ZodString;
1122
+ }, z.core.$strict> | z.ZodObject<{
1123
+ invoice_id: z.ZodString;
1124
+ plan: z.ZodOptional<z.ZodString>;
1125
+ details: z.ZodString;
1126
+ }, z.core.$strict> | z.ZodObject<{
1127
+ application_id: z.ZodNumber;
1128
+ chat_id: z.ZodString;
1129
+ mode: z.ZodString;
1130
+ question: z.ZodString;
1131
+ timestamp: z.ZodString;
1132
+ user_id: z.ZodOptional<z.ZodNumber>;
1133
+ }, z.core.$strict> | z.ZodObject<{
1134
+ application_id: z.ZodNumber;
1135
+ simulation_id: z.ZodNumber;
1136
+ }, z.core.$strict> | z.ZodObject<{
1137
+ id: z.ZodNumber;
1138
+ name: z.ZodString;
1139
+ details: z.ZodString;
1140
+ }, z.core.$strict> | z.ZodObject<{
1141
+ enabled: z.ZodBoolean;
1142
+ id: z.ZodNumber;
1143
+ name: z.ZodString;
1144
+ details: z.ZodString;
1145
+ }, z.core.$strict> | z.ZodObject<{
1146
+ slack_user_id: z.ZodString;
1147
+ slack_channel_id: z.ZodNullable<z.ZodString>;
1148
+ raw_text: z.ZodString;
1149
+ detected_intent: z.ZodString;
1150
+ extracted_params: z.ZodObject<{
1151
+ qaFlowId: z.ZodOptional<z.ZodNumber>;
1152
+ appId: z.ZodOptional<z.ZodNumber>;
1153
+ instructions: z.ZodOptional<z.ZodString>;
1154
+ query: z.ZodOptional<z.ZodString>;
1155
+ channel: z.ZodOptional<z.ZodString>;
1156
+ text: z.ZodOptional<z.ZodString>;
1157
+ name: z.ZodOptional<z.ZodString>;
1158
+ workflowName: z.ZodOptional<z.ZodString>;
1159
+ }, z.core.$strict>;
1160
+ status: z.ZodEnum<{
1161
+ received: "received";
1162
+ classifying: "classifying";
1163
+ dispatched: "dispatched";
1164
+ completed: "completed";
1165
+ failed: "failed";
1166
+ }>;
1167
+ response_text: z.ZodNullable<z.ZodString>;
1168
+ error_message: z.ZodNullable<z.ZodString>;
1169
+ duration_ms: z.ZodNullable<z.ZodNumber>;
1170
+ }, z.core.$strict> | z.ZodObject<{
1171
+ survey_id: z.ZodNumber;
1172
+ details: z.ZodString;
1173
+ }, z.core.$strict>)[]]>>>;
406
1174
  }, z.core.$strip>;
407
1175
  export type ActivityLogData = z.infer<typeof ActivityLogEntitySchema>;
408
1176
  export declare const WidgetQuestionLogSchema: z.ZodObject<{
@@ -1,31 +1,28 @@
1
1
  /**
2
- * Browser-local persistence for the widget: the one door to `localStorage`, and the per-tenant chat context
3
- * (chat_id, transcript, composer mode, open state, resolved config) behind the `storageService` singleton.
4
- * `tenantScope` is the scope suffix for every browser-local key — the credential id, else the application id, else
5
- * `default` shared with the drag-position and resize keys so all of them partition the same way. `readLocal` /
6
- * `writeLocal` are the only `localStorage` access in `src/`; a host page can deny storage outright (third-party
7
- * cookies off, sandboxed iframe) where even reading throws, so both degrade to a warn and the widget keeps working
8
- * unpersisted. `loadContext` parses one key merged over `DEFAULT_CONTEXT`, so a payload from an older widget
9
- * version reads as incomplete rather than corrupt, and discards anything older than `CONTEXT_EXPIRY_MS` (7 days).
10
- * `StorageService`'s `getContext`, `updateContext` (merges, restamps `timestamp`, writes through), `getChatId` /
11
- * `setChatId`, `getCredentialedConfig` (null unless both `mtxId` and `mtxKey` are present, so callers cannot
12
- * dispatch half-credentialed) and `setConfig` sit behind the singleton; `readChatSnapshot` / `writeChatSnapshot`
13
- * are the UI-facing view of the context. `setConfig` re-keys storage to `${STORAGE_KEY}_${tenantScope}` and
14
- * reloads from that key, since without it two applications embedded on one origin would share a stored chat_id and
15
- * one tenant's transcript would leak into another's.
2
+ * Browser-local persistence for the widget: the one door to `localStorage`, and the per-tenant chat
3
+ * context (chat_id, transcript, composer mode, open state, resolved config) behind the `storageService`
4
+ * singleton. `tenantScope` (credential id, else application id, else `default`) is the scope suffix every
5
+ * browser-local key shares via `scopedKey`, so the chat-context, drag-position and resize keys all
6
+ * partition by tenant identically. `readLocal`/`writeLocal` are the only `localStorage` access in `src/`;
7
+ * a host page can deny storage outright (third-party cookies off, sandboxed iframe), so both degrade to
8
+ * a warn and the widget keeps working unpersisted.
16
9
  *
17
- * The snapshot is `{messages, currentMode, isOpen}` chat_id, config and timestamp are deliberately excluded.
18
- * Reading revives `timestamp` to a `Date` and backfills a text part for messages stored before `parts` existed;
19
- * writing drops `videoStream` (unserializable, dead on reload), rewriting it as `Screen sharing ended`.
10
+ * `loadContext` merges one parsed key over `DEFAULT_CONTEXT`, so an older widget version's payload reads
11
+ * as incomplete rather than corrupt, and discards anything past `CONTEXT_EXPIRY_MS` (7 days).
12
+ * `getCredentialedConfig` is null unless both `mtxId` and `mtxKey` are present, so callers cannot
13
+ * dispatch half-credentialed. `setConfig` re-keys storage to `${STORAGE_KEY}_${tenantScope}` and reloads
14
+ * from it, since without that two applications on one origin would leak one tenant's transcript into
15
+ * another's.
20
16
  *
21
- * `scopedKey(name, config)` is the one place `<name>_<tenantScope>` is assembled the position and resize-size
22
- * keys share it with the chat context key, so all three browser-local entries partition by tenant identically.
17
+ * The chat snapshot is `{messages, currentMode, isOpen}` chat_id, config and timestamp are deliberately
18
+ * excluded. Reading revives `timestamp` to a `Date` and backfills a text part for messages stored before
19
+ * `parts` existed; writing drops `videoStream` (unserializable, dead on reload), rewriting it as "Screen
20
+ * sharing ended".
23
21
  *
24
- * `sanitizeStoredContext` is the boundary guard for the parsed JSON: hand-rolled (not zod) per the
25
- * package-level rule that a schema imported as a VALUE anywhere reachable from `src/index.tsx` pulls
26
- * zod's whole runtime into the bundle. Each field is checked against its own type and falls back to
27
- * `DEFAULT_CONTEXT`'s value individually, so a partially-corrupt payload (e.g. a bad `currentMode` from
28
- * an older widget version) keeps the fields that DID parse rather than discarding the whole context.
22
+ * `sanitizeStoredContext` is hand-rolled, not zod, per the package-level rule that a schema imported as a
23
+ * VALUE anywhere reachable from `src/index.tsx` pulls zod's whole runtime into the bundle. Each field
24
+ * falls back to `DEFAULT_CONTEXT`'s value individually, so a partially-corrupt payload keeps the fields
25
+ * that DID parse rather than discarding the whole context.
29
26
  */
30
27
  import type { ChatMessage, InstructionType, MarketrixConfig, ValidWidgetConfig } from '../types';
31
28
  type StoredMessage = Omit<ChatMessage, 'videoStream' | 'timestamp'> & {
@@ -1,29 +1,27 @@
1
1
  /**
2
2
  * Predicates the agent's element index runs against the HOST page's DOM — what counts as a control and
3
- * whether it is reachable — plus `WIDGET_SHADOW_HOST_CLASS`, set by `bootstrap` on the shadow host so
4
- * `DomService` can recognise its own overlay chrome instead of reporting it as obscuring the host page, and
5
- * `TABBABLE_SELECTOR`, the one tab-order candidate query: `send_keys`' Tab simulation walks the host page
6
- * with it and `useFocusTrap` the widget's own tree, and they must agree on what the browser would focus next.
3
+ * whether it is reachable. `TABBABLE_SELECTOR` is the one tab-order candidate query: `send_keys`'s Tab
4
+ * simulation walks the host page with it and `useFocusTrap` the widget's own tree, and they must agree
5
+ * on what the browser would focus next. `WIDGET_SHADOW_HOST_CLASS`, set by `bootstrap` on the shadow
6
+ * host, lets `DomService` recognise its own overlay chrome instead of reporting it as obscuring the host
7
+ * page.
7
8
  *
8
- * `ancestry` walks element → `parentElement`, crossing each shadow boundary at its host; a bare
9
- * `parentElement` walk stops dead at a `ShadowRoot`, so a control inside a host-page web component
10
- * would read as top-level. `disabledReason` names why an element cannot be operated (disabled control,
11
- * `aria-disabled`, or an `inert` ancestor) as a sentence fragment completing `DomService`'s
12
- * `Element <n> …` message — reword both together; `disabled` is read duck-typed since it sits on
13
- * several unrelated control interfaces. `isIndexable`, checked against `INTERACTIVE_ROLES`, is
14
- * `DomService`'s geometry-aware fallback after its cheap selector/handler checks. Visibility there is more
15
- * than computed style: an element scrolled out of an `overflow: hidden|clip` ancestor is unreachable despite
16
- * a non-zero rect (that walk stops at `document.body`), and a zero-size shadow host hides its whole tree, so
17
- * both chains are climbed. Its one `try` is deliberate — the host page owns this DOM and may have patched
18
- * anything on it, so a poisoned element is logged with the real error and skipped rather than aborting the
19
- * whole indexing pass.
9
+ * `ancestry` walks element → `parentElement`, crossing each shadow boundary at its host, since a bare
10
+ * `parentElement` walk stops dead at a `ShadowRoot` and a control inside a host-page web component would
11
+ * read as top-level. `disabledReason` names why an element cannot be operated (disabled control,
12
+ * `aria-disabled`, or an `inert` ancestor) as a sentence fragment completing `DomService`'s `Element
13
+ * <n> …` message — reword both together. `isIndexable` is `DomService`'s geometry-aware fallback after
14
+ * its cheap selector/handler checks; visibility there climbs both the `overflow: hidden|clip` chain
15
+ * (that walk stops at `document.body`) and the shadow-host size, since either can hide an element
16
+ * despite a non-zero rect. Its one `try` is deliberate the host page owns this DOM and may have
17
+ * patched anything on it, so a poisoned element is logged with the real error and skipped rather than
18
+ * aborting the whole indexing pass.
20
19
  *
21
20
  * `focusablesIn` is the one home for "which `TABBABLE_SELECTOR` matches are actually reachable" —
22
- * `useFocusTrap` (the widget's own tree) and `keySimulation`'s Tab simulation (the host page) both call
23
- * it so they can't re-diverge. Per WAI-ARIA, `aria-hidden="true"` removes an element (and its whole
24
- * subtree) from the accessibility tree, so it must not receive focus `isAriaHidden` walks ancestors,
25
- * not just the element itself, since a hidden container hides everything under it even though none of
26
- * those descendants carry the attribute.
21
+ * `useFocusTrap` and `keySimulation`'s Tab simulation both call it so they can't re-diverge.
22
+ * `isAriaHidden` walks ancestors, not just the element itself, since a hidden container hides everything
23
+ * under it (per WAI-ARIA, `aria-hidden="true"` removes an element and its whole subtree from the
24
+ * accessibility tree) even though none of those descendants carry the attribute.
27
25
  */
28
26
  export declare const WIDGET_SHADOW_HOST_CLASS = "marketrix-widget-container";
29
27
  export declare const TABBABLE_SELECTOR = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marketrix.ai/widget",
3
- "version": "4.0.109",
3
+ "version": "4.0.111",
4
4
  "type": "module",
5
5
  "packageManager": "bun@1.4.2",
6
6
  "sideEffects": false,