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