@callimacus/thamyr-core 4.3.5 → 4.4.0
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/CHANGELOG.md +25 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.native.js +1 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/types/index.d.ts +364 -8
- package/dist/types/index.native.d.ts +364 -8
- package/package.json +1 -1
|
@@ -401,6 +401,15 @@ type TopicSummary = {
|
|
|
401
401
|
name: string;
|
|
402
402
|
slug: string;
|
|
403
403
|
};
|
|
404
|
+
type PinaxForbidden = {
|
|
405
|
+
code: 'FORBIDDEN';
|
|
406
|
+
message: string;
|
|
407
|
+
retryable: false;
|
|
408
|
+
/**
|
|
409
|
+
* The scopes any one of which would have been accepted; empty when any principal would do
|
|
410
|
+
*/
|
|
411
|
+
required: Array<string>;
|
|
412
|
+
};
|
|
404
413
|
type PublicError = {
|
|
405
414
|
error: string;
|
|
406
415
|
};
|
|
@@ -471,6 +480,64 @@ type ProductMatch = {
|
|
|
471
480
|
};
|
|
472
481
|
product: BcProductOutput;
|
|
473
482
|
};
|
|
483
|
+
type RiveManifestOutput = {
|
|
484
|
+
/**
|
|
485
|
+
* In file order; the first is the one the runtime opens by default.
|
|
486
|
+
*/
|
|
487
|
+
artboards: Array<{
|
|
488
|
+
name: string;
|
|
489
|
+
animations: Array<string>;
|
|
490
|
+
stateMachines: Array<{
|
|
491
|
+
name: string;
|
|
492
|
+
inputs: Array<{
|
|
493
|
+
name: string;
|
|
494
|
+
type: 'boolean' | 'number' | 'trigger';
|
|
495
|
+
}>;
|
|
496
|
+
}>;
|
|
497
|
+
/**
|
|
498
|
+
* The view model the artboard is bound to in the editor.
|
|
499
|
+
*/
|
|
500
|
+
viewModel?: string;
|
|
501
|
+
}>;
|
|
502
|
+
viewModels: Array<{
|
|
503
|
+
name: string;
|
|
504
|
+
instances: Array<string>;
|
|
505
|
+
properties: Array<{
|
|
506
|
+
name: string;
|
|
507
|
+
/**
|
|
508
|
+
* The runtime data type: string, number, boolean, color, enumType, trigger, and the nested kinds (list, viewModel, image, artboard) that no model sets.
|
|
509
|
+
*/
|
|
510
|
+
type: string;
|
|
511
|
+
/**
|
|
512
|
+
* The options of an enumType property.
|
|
513
|
+
*/
|
|
514
|
+
values?: Array<string>;
|
|
515
|
+
}>;
|
|
516
|
+
}>;
|
|
517
|
+
/**
|
|
518
|
+
* Named runs only: an unnamed run cannot be addressed.
|
|
519
|
+
*/
|
|
520
|
+
textRuns: Array<{
|
|
521
|
+
artboard: string;
|
|
522
|
+
name: string;
|
|
523
|
+
/**
|
|
524
|
+
* The text the file ships with.
|
|
525
|
+
*/
|
|
526
|
+
text: string;
|
|
527
|
+
}>;
|
|
528
|
+
events: Array<{
|
|
529
|
+
artboard: string;
|
|
530
|
+
name: string;
|
|
531
|
+
/**
|
|
532
|
+
* Set on an OpenUrl event.
|
|
533
|
+
*/
|
|
534
|
+
url?: string;
|
|
535
|
+
properties: Array<{
|
|
536
|
+
name: string;
|
|
537
|
+
type: 'number' | 'boolean' | 'string';
|
|
538
|
+
}>;
|
|
539
|
+
}>;
|
|
540
|
+
};
|
|
474
541
|
type BcProductOutput = SetProductOutput | MasterProductWithVariationGroupOutput;
|
|
475
542
|
type SetProductOutput = {
|
|
476
543
|
type: {
|
|
@@ -658,11 +725,52 @@ type VariationAttributeOutput = {
|
|
|
658
725
|
value: string;
|
|
659
726
|
}>;
|
|
660
727
|
};
|
|
728
|
+
type BlockPatchOutput = {
|
|
729
|
+
storyId: string;
|
|
730
|
+
chapterId: string;
|
|
731
|
+
/**
|
|
732
|
+
* The block already on screen that changes.
|
|
733
|
+
*/
|
|
734
|
+
blockId: string;
|
|
735
|
+
/**
|
|
736
|
+
* Where in `block.data` the animation sits: the rive content's `into`, else its id.
|
|
737
|
+
*/
|
|
738
|
+
contentId: string;
|
|
739
|
+
/**
|
|
740
|
+
* View model properties to set, merged into `values`.
|
|
741
|
+
*/
|
|
742
|
+
values: {
|
|
743
|
+
[key: string]: string | number | boolean;
|
|
744
|
+
};
|
|
745
|
+
/**
|
|
746
|
+
* State machine inputs to set, merged into `inputs`.
|
|
747
|
+
*/
|
|
748
|
+
inputs: {
|
|
749
|
+
[key: string]: number | boolean;
|
|
750
|
+
};
|
|
751
|
+
/**
|
|
752
|
+
* Text runs to set, merged into `textRuns`.
|
|
753
|
+
*/
|
|
754
|
+
textRuns: {
|
|
755
|
+
[key: string]: string;
|
|
756
|
+
};
|
|
757
|
+
/**
|
|
758
|
+
* Triggers to fire once, in order: `input:<name>` or `vm:<name>`.
|
|
759
|
+
*/
|
|
760
|
+
fire: Array<string>;
|
|
761
|
+
};
|
|
661
762
|
type BlockOutput = LegacyBlockOutput | CustomBlockOutput;
|
|
662
763
|
type ChapterOutput = {
|
|
663
764
|
id: string;
|
|
664
765
|
deleted: boolean;
|
|
665
766
|
language?: string;
|
|
767
|
+
/**
|
|
768
|
+
* The language the round retrieves in: one the project publishes, which differs from `language` (the one it speaks) when the visitor writes in a language the project does not publish.
|
|
769
|
+
*/
|
|
770
|
+
contentLanguage?: string;
|
|
771
|
+
/**
|
|
772
|
+
* The receptor labels the classifier assigned this round (the per-message classification — not the session intent).
|
|
773
|
+
*/
|
|
666
774
|
receptors?: Array<string>;
|
|
667
775
|
/**
|
|
668
776
|
* Deprecated alias of `receptors`.
|
|
@@ -714,9 +822,13 @@ type CustomBlockOutput = {
|
|
|
714
822
|
priority?: number;
|
|
715
823
|
metaJson?: unknown;
|
|
716
824
|
/**
|
|
717
|
-
* Custom block type, always prefixed `custom:`.
|
|
825
|
+
* Custom block type, always prefixed `custom:`. A render hint — not unique across blocks.
|
|
718
826
|
*/
|
|
719
827
|
type: `custom:${string}`;
|
|
828
|
+
/**
|
|
829
|
+
* The block's key — the identity to attribute, pin and link by. Absent only on rounds recorded before keys travelled.
|
|
830
|
+
*/
|
|
831
|
+
key?: string;
|
|
720
832
|
name?: string;
|
|
721
833
|
data: unknown;
|
|
722
834
|
};
|
|
@@ -921,6 +1033,13 @@ type SlDocumentSectionOutput = {
|
|
|
921
1033
|
[key: string]: unknown;
|
|
922
1034
|
};
|
|
923
1035
|
};
|
|
1036
|
+
} | {
|
|
1037
|
+
id: string;
|
|
1038
|
+
document: string;
|
|
1039
|
+
type: 'rive';
|
|
1040
|
+
content?: string;
|
|
1041
|
+
url: string;
|
|
1042
|
+
properties: RiveManifestOutput;
|
|
924
1043
|
} | {
|
|
925
1044
|
id: string;
|
|
926
1045
|
document: string;
|
|
@@ -1066,6 +1185,9 @@ type ThamyrResponse$1 = {
|
|
|
1066
1185
|
storyId: string;
|
|
1067
1186
|
success: boolean;
|
|
1068
1187
|
};
|
|
1188
|
+
} | {
|
|
1189
|
+
type: 'block-patch';
|
|
1190
|
+
data: BlockPatchOutput;
|
|
1069
1191
|
};
|
|
1070
1192
|
type UserInteraction$1 = {
|
|
1071
1193
|
type: 'get-story';
|
|
@@ -1106,6 +1228,13 @@ type UserInteraction$1 = {
|
|
|
1106
1228
|
shareId: string;
|
|
1107
1229
|
language?: string;
|
|
1108
1230
|
};
|
|
1231
|
+
} | {
|
|
1232
|
+
type: 'suggest';
|
|
1233
|
+
payload: {
|
|
1234
|
+
storyId?: string;
|
|
1235
|
+
prefix?: string;
|
|
1236
|
+
language?: string;
|
|
1237
|
+
};
|
|
1109
1238
|
};
|
|
1110
1239
|
/**
|
|
1111
1240
|
* Document representing a basket.
|
|
@@ -2392,6 +2521,10 @@ type ContentGetPageErrors = {
|
|
|
2392
2521
|
* Missing or invalid access token
|
|
2393
2522
|
*/
|
|
2394
2523
|
401: unknown;
|
|
2524
|
+
/**
|
|
2525
|
+
* The caller is not permitted to perform this operation
|
|
2526
|
+
*/
|
|
2527
|
+
403: PinaxForbidden;
|
|
2395
2528
|
/**
|
|
2396
2529
|
* Unknown page id (only `home` exists)
|
|
2397
2530
|
*/
|
|
@@ -2412,6 +2545,10 @@ type ContentListTopicsErrors = {
|
|
|
2412
2545
|
* Missing or invalid access token
|
|
2413
2546
|
*/
|
|
2414
2547
|
401: unknown;
|
|
2548
|
+
/**
|
|
2549
|
+
* The caller is not permitted to perform this operation
|
|
2550
|
+
*/
|
|
2551
|
+
403: PinaxForbidden;
|
|
2415
2552
|
};
|
|
2416
2553
|
type ContentListTopicsResponses = {
|
|
2417
2554
|
/**
|
|
@@ -2428,6 +2565,10 @@ type ContentGetTopicContentsErrors = {
|
|
|
2428
2565
|
* Missing or invalid access token
|
|
2429
2566
|
*/
|
|
2430
2567
|
401: unknown;
|
|
2568
|
+
/**
|
|
2569
|
+
* The caller is not permitted to perform this operation
|
|
2570
|
+
*/
|
|
2571
|
+
403: PinaxForbidden;
|
|
2431
2572
|
/**
|
|
2432
2573
|
* No topic matches idOrSlug
|
|
2433
2574
|
*/
|
|
@@ -2448,6 +2589,10 @@ type ContentGetDocumentBySlugErrors = {
|
|
|
2448
2589
|
* Missing or invalid access token
|
|
2449
2590
|
*/
|
|
2450
2591
|
401: unknown;
|
|
2592
|
+
/**
|
|
2593
|
+
* The caller is not permitted to perform this operation
|
|
2594
|
+
*/
|
|
2595
|
+
403: PinaxForbidden;
|
|
2451
2596
|
/**
|
|
2452
2597
|
* No published document with this slug
|
|
2453
2598
|
*/
|
|
@@ -2468,6 +2613,10 @@ type ContentGetDocumentByGroupErrors = {
|
|
|
2468
2613
|
* Missing or invalid access token
|
|
2469
2614
|
*/
|
|
2470
2615
|
401: unknown;
|
|
2616
|
+
/**
|
|
2617
|
+
* The caller is not permitted to perform this operation
|
|
2618
|
+
*/
|
|
2619
|
+
403: PinaxForbidden;
|
|
2471
2620
|
/**
|
|
2472
2621
|
* No published document in this group
|
|
2473
2622
|
*/
|
|
@@ -2488,6 +2637,10 @@ type ContentGetDocumentByPathErrors = {
|
|
|
2488
2637
|
* Missing or invalid access token
|
|
2489
2638
|
*/
|
|
2490
2639
|
401: unknown;
|
|
2640
|
+
/**
|
|
2641
|
+
* The caller is not permitted to perform this operation
|
|
2642
|
+
*/
|
|
2643
|
+
403: PinaxForbidden;
|
|
2491
2644
|
/**
|
|
2492
2645
|
* Path did not resolve to a published document
|
|
2493
2646
|
*/
|
|
@@ -2508,6 +2661,10 @@ type StoriesGetSharedErrors = {
|
|
|
2508
2661
|
* Missing or invalid access token
|
|
2509
2662
|
*/
|
|
2510
2663
|
401: unknown;
|
|
2664
|
+
/**
|
|
2665
|
+
* The caller is not permitted to perform this operation
|
|
2666
|
+
*/
|
|
2667
|
+
403: PinaxForbidden;
|
|
2511
2668
|
/**
|
|
2512
2669
|
* Share not found
|
|
2513
2670
|
*/
|
|
@@ -2528,6 +2685,10 @@ type StoriesShareErrors = {
|
|
|
2528
2685
|
* Missing or invalid access token
|
|
2529
2686
|
*/
|
|
2530
2687
|
401: unknown;
|
|
2688
|
+
/**
|
|
2689
|
+
* The caller is not permitted to perform this operation
|
|
2690
|
+
*/
|
|
2691
|
+
403: PinaxForbidden;
|
|
2531
2692
|
/**
|
|
2532
2693
|
* Story not found
|
|
2533
2694
|
*/
|
|
@@ -2550,6 +2711,10 @@ type ProductsGetSimilarErrors = {
|
|
|
2550
2711
|
* Missing or invalid access token
|
|
2551
2712
|
*/
|
|
2552
2713
|
401: unknown;
|
|
2714
|
+
/**
|
|
2715
|
+
* The caller is not permitted to perform this operation
|
|
2716
|
+
*/
|
|
2717
|
+
403: PinaxForbidden;
|
|
2553
2718
|
/**
|
|
2554
2719
|
* Product not found or similar products unavailable
|
|
2555
2720
|
*/
|
|
@@ -2570,6 +2735,10 @@ type ProductsGetRecommendationsErrors = {
|
|
|
2570
2735
|
* Missing or invalid access token
|
|
2571
2736
|
*/
|
|
2572
2737
|
401: unknown;
|
|
2738
|
+
/**
|
|
2739
|
+
* The caller is not permitted to perform this operation
|
|
2740
|
+
*/
|
|
2741
|
+
403: PinaxForbidden;
|
|
2573
2742
|
/**
|
|
2574
2743
|
* Product not found or recommendations unavailable
|
|
2575
2744
|
*/
|
|
@@ -2591,9 +2760,9 @@ type WhisperGetLastErrors = {
|
|
|
2591
2760
|
*/
|
|
2592
2761
|
401: unknown;
|
|
2593
2762
|
/**
|
|
2594
|
-
* Whisper preview is not enabled for this tenant
|
|
2763
|
+
* The caller is not permitted to perform this operation; or Whisper preview is not enabled for this tenant
|
|
2595
2764
|
*/
|
|
2596
|
-
403: PublicError;
|
|
2765
|
+
403: PinaxForbidden | PublicError;
|
|
2597
2766
|
/**
|
|
2598
2767
|
* No whisper for this session yet
|
|
2599
2768
|
*/
|
|
@@ -2616,6 +2785,10 @@ type AnalyticsTrackEventErrors = {
|
|
|
2616
2785
|
* Missing or invalid access token
|
|
2617
2786
|
*/
|
|
2618
2787
|
401: unknown;
|
|
2788
|
+
/**
|
|
2789
|
+
* The caller is not permitted to perform this operation
|
|
2790
|
+
*/
|
|
2791
|
+
403: PinaxForbidden;
|
|
2619
2792
|
};
|
|
2620
2793
|
type AnalyticsTrackEventResponses = {
|
|
2621
2794
|
/**
|
|
@@ -2632,6 +2805,10 @@ type CartGetCartErrors = {
|
|
|
2632
2805
|
* No Salesforce shopper session could be resolved (typically a tenant without SFCC integration).
|
|
2633
2806
|
*/
|
|
2634
2807
|
401: PublicError;
|
|
2808
|
+
/**
|
|
2809
|
+
* The caller is not permitted to perform this operation
|
|
2810
|
+
*/
|
|
2811
|
+
403: PinaxForbidden;
|
|
2635
2812
|
};
|
|
2636
2813
|
type CartGetCartResponses = {
|
|
2637
2814
|
/**
|
|
@@ -2648,6 +2825,10 @@ type CartAddItemToCartErrors = {
|
|
|
2648
2825
|
* No Salesforce shopper session could be resolved (typically a tenant without SFCC integration).
|
|
2649
2826
|
*/
|
|
2650
2827
|
401: PublicError;
|
|
2828
|
+
/**
|
|
2829
|
+
* The caller is not permitted to perform this operation
|
|
2830
|
+
*/
|
|
2831
|
+
403: PinaxForbidden;
|
|
2651
2832
|
};
|
|
2652
2833
|
type CartAddItemToCartResponses = {
|
|
2653
2834
|
/**
|
|
@@ -2664,6 +2845,10 @@ type CartRemoveItemFromCartErrors = {
|
|
|
2664
2845
|
* No Salesforce shopper session could be resolved (typically a tenant without SFCC integration).
|
|
2665
2846
|
*/
|
|
2666
2847
|
401: PublicError;
|
|
2848
|
+
/**
|
|
2849
|
+
* The caller is not permitted to perform this operation
|
|
2850
|
+
*/
|
|
2851
|
+
403: PinaxForbidden;
|
|
2667
2852
|
};
|
|
2668
2853
|
type CartRemoveItemFromCartResponses = {
|
|
2669
2854
|
/**
|
|
@@ -2680,6 +2865,10 @@ type CartUpdateProductQuantityErrors = {
|
|
|
2680
2865
|
* No Salesforce shopper session could be resolved (typically a tenant without SFCC integration).
|
|
2681
2866
|
*/
|
|
2682
2867
|
401: PublicError;
|
|
2868
|
+
/**
|
|
2869
|
+
* The caller is not permitted to perform this operation
|
|
2870
|
+
*/
|
|
2871
|
+
403: PinaxForbidden;
|
|
2683
2872
|
};
|
|
2684
2873
|
type CartUpdateProductQuantityResponses = {
|
|
2685
2874
|
/**
|
|
@@ -2696,6 +2885,10 @@ type SkesisSimilarErrors = {
|
|
|
2696
2885
|
* Missing or invalid access token
|
|
2697
2886
|
*/
|
|
2698
2887
|
401: unknown;
|
|
2888
|
+
/**
|
|
2889
|
+
* The caller is not permitted to perform this operation
|
|
2890
|
+
*/
|
|
2891
|
+
403: PinaxForbidden;
|
|
2699
2892
|
/**
|
|
2700
2893
|
* Skesis engine unavailable (rate cap, upstream failure, or not configured); retry later
|
|
2701
2894
|
*/
|
|
@@ -2719,6 +2912,10 @@ type SkesisRelatedErrors = {
|
|
|
2719
2912
|
* Missing or invalid access token
|
|
2720
2913
|
*/
|
|
2721
2914
|
401: unknown;
|
|
2915
|
+
/**
|
|
2916
|
+
* The caller is not permitted to perform this operation
|
|
2917
|
+
*/
|
|
2918
|
+
403: PinaxForbidden;
|
|
2722
2919
|
/**
|
|
2723
2920
|
* Skesis engine unavailable (rate cap, upstream failure, or not configured); retry later
|
|
2724
2921
|
*/
|
|
@@ -3006,6 +3203,15 @@ type Story = StoryOutput;
|
|
|
3006
3203
|
Every `server-response` payload, exactly as the wire carries it.
|
|
3007
3204
|
*/
|
|
3008
3205
|
type ThamyrResponse = ThamyrResponse$1;
|
|
3206
|
+
/**
|
|
3207
|
+
A change to a block already on screen: an interaction the block's rive content
|
|
3208
|
+
declares in `patchOn` re-set its animation in place. Apply it with `applyBlockPatch`.
|
|
3209
|
+
*/
|
|
3210
|
+
type BlockPatch = BlockPatchOutput;
|
|
3211
|
+
/**
|
|
3212
|
+
What a Rive animation exposes to be set: the `properties` of a `rive` document section.
|
|
3213
|
+
*/
|
|
3214
|
+
type RiveManifest = RiveManifestOutput;
|
|
3009
3215
|
type Values<E> = E[keyof E];
|
|
3010
3216
|
declare const ThamyrResponseType: {
|
|
3011
3217
|
readonly ERROR: "error";
|
|
@@ -3014,6 +3220,7 @@ declare const ThamyrResponseType: {
|
|
|
3014
3220
|
readonly STORY_RESET: "story-reset";
|
|
3015
3221
|
readonly STORY_CREATED: "story-created";
|
|
3016
3222
|
readonly STORY_SHARED: "story-shared";
|
|
3223
|
+
readonly BLOCK_PATCH: "block-patch";
|
|
3017
3224
|
};
|
|
3018
3225
|
type ThamyrResponseType = Values<typeof ThamyrResponseType>;
|
|
3019
3226
|
/**
|
|
@@ -3162,7 +3369,11 @@ declare enum UserInteractionType {
|
|
|
3162
3369
|
/**
|
|
3163
3370
|
Request to retrieve a story that has been shared
|
|
3164
3371
|
*/
|
|
3165
|
-
GET_SHARED_STORY = "get-shared-story"
|
|
3372
|
+
GET_SHARED_STORY = "get-shared-story",
|
|
3373
|
+
/**
|
|
3374
|
+
Prompt suggestions — a request/response exchange; send it through `suggest()`, not `sendUserInteraction`
|
|
3375
|
+
*/
|
|
3376
|
+
SUGGEST = "suggest"
|
|
3166
3377
|
}
|
|
3167
3378
|
/**
|
|
3168
3379
|
The contract payload for one interaction type.
|
|
@@ -3178,7 +3389,7 @@ type GetStoryPayload = PayloadOf<UserInteractionType.GET_STORY>;
|
|
|
3178
3389
|
Payload for creating a new round. `context` is stripped and re-added by
|
|
3179
3390
|
{@link InteractionPayloadMap}, which enriches every interaction with it.
|
|
3180
3391
|
*/
|
|
3181
|
-
type CreateRoundPayload = Omit<PayloadOf<UserInteractionType.CREATE_ROUND>, 'context'>;
|
|
3392
|
+
type CreateRoundPayload$1 = Omit<PayloadOf<UserInteractionType.CREATE_ROUND>, 'context'>;
|
|
3182
3393
|
/**
|
|
3183
3394
|
Payload for resetting a story to its initial state.
|
|
3184
3395
|
*/
|
|
@@ -3195,6 +3406,58 @@ type ShareStoryPayload = PayloadOf<UserInteractionType.SHARE_STORY>;
|
|
|
3195
3406
|
Payload for retrieving a shared story.
|
|
3196
3407
|
*/
|
|
3197
3408
|
type GetSharedStoryPayload = PayloadOf<UserInteractionType.GET_SHARED_STORY>;
|
|
3409
|
+
/**
|
|
3410
|
+
Payload for prompt suggestions: the tenant's starter questions on an empty or
|
|
3411
|
+
short prefix, autocomplete while the visitor types. Answered through the
|
|
3412
|
+
socket acknowledgment, so it never appears among the story responses.
|
|
3413
|
+
*/
|
|
3414
|
+
type SuggestPayload = PayloadOf<UserInteractionType.SUGGEST>;
|
|
3415
|
+
/**
|
|
3416
|
+
What every round-creating helper accepts beside its own input: the story to continue, the language to compose in.
|
|
3417
|
+
*/
|
|
3418
|
+
type RoundOptions = Pick<CreateRoundPayload$1, 'storyId' | 'language'>;
|
|
3419
|
+
/**
|
|
3420
|
+
The storefront's interaction registry — empty here, augmented by the storefront
|
|
3421
|
+
with the ids the tenant declared in its configuration document (`interactions`).
|
|
3422
|
+
Once augmented, `sendInteraction` accepts only those ids, each with its payload:
|
|
3423
|
+
|
|
3424
|
+
```ts
|
|
3425
|
+
declare module '@callimacus/thamyr-core' {
|
|
3426
|
+
interface ThamyrInteractionMap {
|
|
3427
|
+
'pick-size': {size: string};
|
|
3428
|
+
reshuffle: undefined;
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
```
|
|
3432
|
+
|
|
3433
|
+
Left empty, any id is accepted with an optional record payload.
|
|
3434
|
+
*/
|
|
3435
|
+
interface ThamyrInteractionMap {
|
|
3436
|
+
}
|
|
3437
|
+
type OpenRegistry = Record<string, Record<string, unknown> | undefined>;
|
|
3438
|
+
type InteractionRegistry = keyof ThamyrInteractionMap extends never ? OpenRegistry : ThamyrInteractionMap;
|
|
3439
|
+
/**
|
|
3440
|
+
An interaction id: any string until the registry is augmented, then exactly the declared ids.
|
|
3441
|
+
*/
|
|
3442
|
+
type InteractionId = Extract<keyof InteractionRegistry, string>;
|
|
3443
|
+
/**
|
|
3444
|
+
The payload the registry declares for an interaction.
|
|
3445
|
+
*/
|
|
3446
|
+
type InteractionPayload<I extends InteractionId> = InteractionRegistry[I];
|
|
3447
|
+
/**
|
|
3448
|
+
What an interaction round carries beside the interaction id.
|
|
3449
|
+
*/
|
|
3450
|
+
type InteractionOptions<I extends InteractionId = InteractionId> = RoundOptions & {
|
|
3451
|
+
/**
|
|
3452
|
+
The block the interaction belongs to (its key). A block whose `patchOn` names the interaction is patched in place when it is sent.
|
|
3453
|
+
*/
|
|
3454
|
+
block?: string;
|
|
3455
|
+
payload?: InteractionPayload<I>;
|
|
3456
|
+
/**
|
|
3457
|
+
A value the interaction carries (a chosen option, a list of them).
|
|
3458
|
+
*/
|
|
3459
|
+
value?: string | string[];
|
|
3460
|
+
};
|
|
3198
3461
|
type WithInteractionContext<T> = T & {
|
|
3199
3462
|
context?: InteractionContext;
|
|
3200
3463
|
};
|
|
@@ -3204,11 +3467,12 @@ type WithInteractionContext<T> = T & {
|
|
|
3204
3467
|
*/
|
|
3205
3468
|
type InteractionPayloadMap = {
|
|
3206
3469
|
[UserInteractionType.GET_STORY]: WithInteractionContext<GetStoryPayload>;
|
|
3207
|
-
[UserInteractionType.CREATE_ROUND]: WithInteractionContext<CreateRoundPayload>;
|
|
3470
|
+
[UserInteractionType.CREATE_ROUND]: WithInteractionContext<CreateRoundPayload$1>;
|
|
3208
3471
|
[UserInteractionType.RESET_STORY]: WithInteractionContext<ResetStoryPayload>;
|
|
3209
3472
|
[UserInteractionType.BACK_FROM_ROUND]: WithInteractionContext<BackFromRoundPayload>;
|
|
3210
3473
|
[UserInteractionType.SHARE_STORY]: WithInteractionContext<ShareStoryPayload>;
|
|
3211
3474
|
[UserInteractionType.GET_SHARED_STORY]: WithInteractionContext<GetSharedStoryPayload>;
|
|
3475
|
+
[UserInteractionType.SUGGEST]: WithInteractionContext<SuggestPayload>;
|
|
3212
3476
|
};
|
|
3213
3477
|
/**
|
|
3214
3478
|
Discriminated union type representing all possible user interactions.
|
|
@@ -3242,6 +3506,12 @@ declare enum CallimacusEvent {
|
|
|
3242
3506
|
*/
|
|
3243
3507
|
ERROR = "error"
|
|
3244
3508
|
}
|
|
3509
|
+
/**
|
|
3510
|
+
The acknowledgment of a `suggest` command. Empty when the tenant disabled suggestions or the request failed.
|
|
3511
|
+
*/
|
|
3512
|
+
type Suggestions = {
|
|
3513
|
+
suggestions: string[];
|
|
3514
|
+
};
|
|
3245
3515
|
|
|
3246
3516
|
/**
|
|
3247
3517
|
Audio descriptor that a `tts` content item injects into a block's `data`.
|
|
@@ -3374,6 +3644,15 @@ declare class CallimacusService {
|
|
|
3374
3644
|
@param payload - The properly typed payload for this interaction type
|
|
3375
3645
|
*/
|
|
3376
3646
|
sendUserInteraction<T extends UserInteractionType>(type: T, payload: InteractionPayloadMap[T]): void;
|
|
3647
|
+
/**
|
|
3648
|
+
Prompt suggestions for the input box: the tenant's starter questions on an
|
|
3649
|
+
empty or short prefix, autocomplete while the visitor types. A request/response
|
|
3650
|
+
exchange through the socket acknowledgment — fail-open like the server: no
|
|
3651
|
+
connection, a timeout or an error all resolve to no suggestions.
|
|
3652
|
+
*/
|
|
3653
|
+
suggest(payload: SuggestPayload, options?: {
|
|
3654
|
+
timeoutMs?: number;
|
|
3655
|
+
}): Promise<Suggestions>;
|
|
3377
3656
|
/**
|
|
3378
3657
|
Collects information about the client's environment.
|
|
3379
3658
|
|
|
@@ -3412,6 +3691,83 @@ declare class CallimacusService {
|
|
|
3412
3691
|
}
|
|
3413
3692
|
declare const callimacusService: CallimacusService;
|
|
3414
3693
|
|
|
3694
|
+
type CreateRoundPayload = InteractionPayloadMap[UserInteractionType.CREATE_ROUND];
|
|
3695
|
+
/**
|
|
3696
|
+
The landing value blocks and conditions read (`{{input.value}}`); the server caps it at 200 characters.
|
|
3697
|
+
*/
|
|
3698
|
+
declare const LANDING_VALUE_MAX_LENGTH = 200;
|
|
3699
|
+
/**
|
|
3700
|
+
The `create-round` payload that opens the landing page: a round with no message,
|
|
3701
|
+
composed from the tenant's landing configuration.
|
|
3702
|
+
@param value - Optional landing value — a page slug, a campaign, whatever the
|
|
3703
|
+
tenant's landing blocks were written to read.
|
|
3704
|
+
@param options - The story to continue and the language to compose in.
|
|
3705
|
+
*/
|
|
3706
|
+
declare function landingRound(value?: string, options?: RoundOptions): CreateRoundPayload;
|
|
3707
|
+
/**
|
|
3708
|
+
The `create-round` payload for a declared interaction. Blocks answer it by
|
|
3709
|
+
naming the id in their condition; the block key it carries lets a block whose
|
|
3710
|
+
`patchOn` names the interaction be patched in place.
|
|
3711
|
+
*/
|
|
3712
|
+
declare function interactionRound<I extends InteractionId>(id: I, options?: InteractionOptions<I>): CreateRoundPayload;
|
|
3713
|
+
/**
|
|
3714
|
+
The receptor labels the classifier assigned a round — the per-message
|
|
3715
|
+
classification, not the session intent. Reads `receptors`, falling back to the
|
|
3716
|
+
`intent` name servers used before the rename (kept one release as an alias).
|
|
3717
|
+
*/
|
|
3718
|
+
declare function receptorsOf(chapter: Pick<Chapter, 'receptors' | 'intent'>): string[];
|
|
3719
|
+
/**
|
|
3720
|
+
A block's key — the identity everything attributes, pins and links by. `type`
|
|
3721
|
+
is a render hint two blocks may share. Only custom blocks carry one, and only
|
|
3722
|
+
on rounds recorded since keys travel on the wire.
|
|
3723
|
+
*/
|
|
3724
|
+
declare function blockKeyOf(block: Block): string | undefined;
|
|
3725
|
+
/**
|
|
3726
|
+
The block the flow emits when adding to cart needs the visitor to pick a size.
|
|
3727
|
+
*/
|
|
3728
|
+
declare const ADD_TO_CART_RESULT_BLOCK = "custom:addToCartResult";
|
|
3729
|
+
/**
|
|
3730
|
+
How an add-to-cart request resolved; the flow attaches it to every block of the round as `data.addToCart`.
|
|
3731
|
+
*/
|
|
3732
|
+
type AddToCartResult = {
|
|
3733
|
+
status: 'resolved';
|
|
3734
|
+
variantId: string;
|
|
3735
|
+
productName: string;
|
|
3736
|
+
size: string;
|
|
3737
|
+
} | {
|
|
3738
|
+
status: 'size_selection_needed';
|
|
3739
|
+
productSku: string;
|
|
3740
|
+
productName: string;
|
|
3741
|
+
availableSizes: Array<{
|
|
3742
|
+
size: string;
|
|
3743
|
+
variantId: string;
|
|
3744
|
+
orderable: boolean;
|
|
3745
|
+
}>;
|
|
3746
|
+
} | {
|
|
3747
|
+
status: 'error';
|
|
3748
|
+
};
|
|
3749
|
+
/**
|
|
3750
|
+
The add-to-cart result a block carries, when the round resolved one.
|
|
3751
|
+
|
|
3752
|
+
Every field is checked, not only the status: the block's data is whatever the round
|
|
3753
|
+
put there, and a half-written result would otherwise reach a caller as a complete one
|
|
3754
|
+
— with `undefined` where the type promises a string.
|
|
3755
|
+
*/
|
|
3756
|
+
declare function addToCartResultOf(block: {
|
|
3757
|
+
data?: unknown;
|
|
3758
|
+
}): AddToCartResult | undefined;
|
|
3759
|
+
/**
|
|
3760
|
+
The round with a `block-patch` applied, as the server stored it: `values`,
|
|
3761
|
+
`inputs` and `textRuns` merged into the animation at `contentId` (a dotted path
|
|
3762
|
+
into `block.data`), everything else left as it was. Returns `chapter` itself
|
|
3763
|
+
when the patch is for another round, a block it does not show, or a place that
|
|
3764
|
+
holds no animation, so a caller can tell nothing changed.
|
|
3765
|
+
|
|
3766
|
+
`fire` is not written: triggers play once, when the patch arrives, and
|
|
3767
|
+
keeping them would replay them on every render and reload.
|
|
3768
|
+
*/
|
|
3769
|
+
declare function applyBlockPatch(chapter: Chapter, patch: BlockPatch): Chapter;
|
|
3770
|
+
|
|
3415
3771
|
/**
|
|
3416
3772
|
Structured payload the server attaches to a refused handshake (SOL-1100):
|
|
3417
3773
|
`code` is an HTTP-style status — 4xx is a deliberate refusal, 5xx means the
|
|
@@ -3632,5 +3988,5 @@ declare function createContractClient(config: {
|
|
|
3632
3988
|
withCredentials?: boolean;
|
|
3633
3989
|
}): ContractClient;
|
|
3634
3990
|
|
|
3635
|
-
export { CallimacusApi, CallimacusEvent, CallimacusService, ChapterStatus, ClientEvents, GalleryMode, MAX_HANDSHAKE_RETRIES, SLInputEventType, ServerEvents, ThamyrHttpError, ThamyrResponseType, UserInteractionType, callimacusService, classifyConnectError, clearIntentSessionId, createContractClient, ensureIntentSessionId, extractTtsAudio, getIntentSessionId, initIntent, isCustomBlock, isMasterProduct, isSetProduct, logger, parseConnectRejection, randomUuid, setConsent, setDebug, setDebugPanel, setGeo, setIntentSessionMaxAge, shouldRetryHandshake, transformImageUrl };
|
|
3636
|
-
export type { BCProduct, Basket, Block, BoundingBox, CallimacusErrorMessage, Chapter, ClientInfo, ConnectRejection, ConnectionStatusCallback, ContractClient, CustomBlock, ErrorCallback, ErrorMessage, Gallery, GenericProduct, HomePage, Image, ImageEdits, ImageFormatEdit, ImageResizeEdit, InitOptions, InteractionContext, InteractionPayloadMap, LegacyBlock, LocalizedEPArtwork, LocalizedEPChapter, LogLevel, LoggerConfig, MasterProduct, MasterProductWithVariationGroup, OptionItem, ProductItem, ProductMatch, RecommendationsResponse, SLDocument, SLDocumentSection, SLInputEvent, ServerResponseCallback, SetProduct, SkesisItem, SkesisRelatedResponse, SkesisSimilarResponse, Story, ThamyrResponse, Topic, TopicContentsPage, TopicSummary, TtsAudio, UiElement, UiObserverConfig, UiSnapshot, UserInteraction, Variant, VariationAttribute, VariationGroup, Video, WhisperPayload };
|
|
3991
|
+
export { ADD_TO_CART_RESULT_BLOCK, CallimacusApi, CallimacusEvent, CallimacusService, ChapterStatus, ClientEvents, GalleryMode, LANDING_VALUE_MAX_LENGTH, MAX_HANDSHAKE_RETRIES, SLInputEventType, ServerEvents, ThamyrHttpError, ThamyrResponseType, UserInteractionType, addToCartResultOf, applyBlockPatch, blockKeyOf, callimacusService, classifyConnectError, clearIntentSessionId, createContractClient, ensureIntentSessionId, extractTtsAudio, getIntentSessionId, initIntent, interactionRound, isCustomBlock, isMasterProduct, isSetProduct, landingRound, logger, parseConnectRejection, randomUuid, receptorsOf, setConsent, setDebug, setDebugPanel, setGeo, setIntentSessionMaxAge, shouldRetryHandshake, transformImageUrl };
|
|
3992
|
+
export type { AddToCartResult, BCProduct, Basket, Block, BlockPatch, BoundingBox, CallimacusErrorMessage, Chapter, ClientInfo, ConnectRejection, ConnectionStatusCallback, ContractClient, CustomBlock, ErrorCallback, ErrorMessage, Gallery, GenericProduct, HomePage, Image, ImageEdits, ImageFormatEdit, ImageResizeEdit, InitOptions, InteractionContext, InteractionId, InteractionOptions, InteractionPayload, InteractionPayloadMap, LegacyBlock, LocalizedEPArtwork, LocalizedEPChapter, LogLevel, LoggerConfig, MasterProduct, MasterProductWithVariationGroup, OptionItem, ProductItem, ProductMatch, RecommendationsResponse, RiveManifest, RoundOptions, SLDocument, SLDocumentSection, SLInputEvent, ServerResponseCallback, SetProduct, SkesisItem, SkesisRelatedResponse, SkesisSimilarResponse, Story, SuggestPayload, Suggestions, ThamyrInteractionMap, ThamyrResponse, Topic, TopicContentsPage, TopicSummary, TtsAudio, UiElement, UiObserverConfig, UiSnapshot, UserInteraction, Variant, VariationAttribute, VariationGroup, Video, WhisperPayload };
|