@callimacus/thamyr-core 4.5.0 → 4.7.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.
@@ -380,6 +380,10 @@ type SlInputEvent = {
380
380
  payload?: {
381
381
  [key: string]: unknown;
382
382
  };
383
+ /**
384
+ * Minted by the site for a delivered interaction (a form): a repeated emit gets the stored result back, and the chapter carrying it resolves the site's `run()`.
385
+ */
386
+ submissionId?: string;
383
387
  nodeKey?: string;
384
388
  interactionId: string;
385
389
  value?: string | Array<string>;
@@ -817,6 +821,10 @@ type CreateRoundContextOutput = {
817
821
  };
818
822
  userAgent?: string;
819
823
  acceptLanguageLocale?: string;
824
+ /**
825
+ * The page title, carried in a delivered interaction's envelope.
826
+ */
827
+ title?: string;
820
828
  [key: string]: unknown;
821
829
  };
822
830
  type CustomBlockOutput = {
@@ -1100,6 +1108,10 @@ type SlInputEventOutput = {
1100
1108
  payload?: {
1101
1109
  [key: string]: unknown;
1102
1110
  };
1111
+ /**
1112
+ * Minted by the site for a delivered interaction (a form): a repeated emit gets the stored result back, and the chapter carrying it resolves the site's `run()`.
1113
+ */
1114
+ submissionId?: string;
1103
1115
  nodeKey?: string;
1104
1116
  interactionId: string;
1105
1117
  value?: string | Array<string>;
@@ -1385,6 +1397,12 @@ type SkesisSimilarResponse = {
1385
1397
  score: number;
1386
1398
  item: SkesisItem;
1387
1399
  }>;
1400
+ /**
1401
+ * Present only when the request set `explain: true`: what each stage of the pipeline decided, keyed by stage (search runs plan, route, retrieve, assess, relax and rank; the other pipelines a subset), plus `timings` in milliseconds. Decisions only — never what the engine was told.
1402
+ */
1403
+ trace?: {
1404
+ [key: string]: unknown;
1405
+ };
1388
1406
  };
1389
1407
  type SkesisRelatedResponse = {
1390
1408
  related: Array<{
@@ -1396,6 +1414,12 @@ type SkesisRelatedResponse = {
1396
1414
  item: SkesisItem;
1397
1415
  }>;
1398
1416
  usedFallback: boolean;
1417
+ /**
1418
+ * Present only when the request set `explain: true`: what each stage of the pipeline decided, keyed by stage (search runs plan, route, retrieve, assess, relax and rank; the other pipelines a subset), plus `timings` in milliseconds. Decisions only — never what the engine was told.
1419
+ */
1420
+ trace?: {
1421
+ [key: string]: unknown;
1422
+ };
1399
1423
  };
1400
1424
  /**
1401
1425
  * Document representing an order address.
@@ -3335,6 +3359,10 @@ type UiSnapshot = {
3335
3359
  };
3336
3360
  type InteractionContext = {
3337
3361
  uiSnapshot?: UiSnapshot;
3362
+ /**
3363
+ The page title, carried in a delivered interaction's envelope.
3364
+ */
3365
+ title?: string;
3338
3366
  };
3339
3367
  type UiObserverConfig = {
3340
3368
  enabled?: boolean;
@@ -3456,6 +3484,10 @@ type InteractionOptions<I extends InteractionId = InteractionId> = RoundOptions
3456
3484
  block?: string;
3457
3485
  payload?: InteractionPayload<I>;
3458
3486
  /**
3487
+ Minted by the site for a delivered interaction (a form): a repeated emit gets the stored result back, and the chapter carrying it resolves the site's `run()`.
3488
+ */
3489
+ submissionId?: string;
3490
+ /**
3459
3491
  A value the interaction carries (a chosen option, a list of them).
3460
3492
  */
3461
3493
  value?: string | string[];
@@ -3805,6 +3837,95 @@ declare function shouldRetryHandshake(code: number, attemptsSoFar: number): bool
3805
3837
  */
3806
3838
  declare function classifyConnectError(error: Error, isActive: boolean): ConnectRejection | undefined;
3807
3839
 
3840
+ type Action =
3841
+ /**
3842
+ Opens a URL in the browser; `#section` scrolls the page.
3843
+ */
3844
+ {
3845
+ type: 'link';
3846
+ url: string;
3847
+ newTab?: boolean;
3848
+ }
3849
+ /**
3850
+ A question round, as if the visitor typed it.
3851
+ */
3852
+ | {
3853
+ type: 'ask';
3854
+ value: string;
3855
+ }
3856
+ /**
3857
+ A declared interaction round: open a category, a page, a profile; refresh a block.
3858
+ */
3859
+ | {
3860
+ type: 'interact';
3861
+ id: string;
3862
+ value?: string | string[];
3863
+ payload?: Record<string, unknown>;
3864
+ block?: string;
3865
+ }
3866
+ /**
3867
+ Adds a product to the cart.
3868
+ */
3869
+ | {
3870
+ type: 'cart';
3871
+ productId: string;
3872
+ }
3873
+ /**
3874
+ Sends the component's inputs as a round of the project's `input` interaction of that name — a form — and waits for its delivery result.
3875
+ */
3876
+ | {
3877
+ type: 'submit';
3878
+ form: string;
3879
+ };
3880
+ type ActionType = Action['type'];
3881
+ declare const ACTION_TYPES: readonly ActionType[];
3882
+ /**
3883
+ The action in a value the composer produced — or `undefined` when it is not
3884
+ one: unknown type, missing or mistyped fields, a link that is not http(s), mailto, tel or relative. Read block
3885
+ data through this, never trust it as typed.
3886
+ */
3887
+ declare function actionOf(value: unknown): Action | undefined;
3888
+ /**
3889
+ The fields of a form, as a `submit` sends them: every input by name, a string
3890
+ when the name has one value and a list when it has several (`getAll`). A name
3891
+ ending in `[]` is always a list, the `[]` taken off (`topics[]` → `topics`), so
3892
+ a checkbox group or a multiple select keeps its shape with one box checked.
3893
+ A file is left out — an interaction carries no binary. A checkbox arrives as its
3894
+ `value` (`on` by default), not as a boolean.
3895
+ */
3896
+ declare function fieldsOf(form: HTMLFormElement | FormData): Record<string, string | string[]>;
3897
+ /**
3898
+ The block a delivered interaction (a form) opens its round with: what the submission came to.
3899
+ */
3900
+ declare const DELIVER_RESULT_BLOCK = "custom:deliverResult";
3901
+ /**
3902
+ How a submission resolved. `accepted`: it is in, outages included. `refused`: the primary destination
3903
+ rejected it and nothing fanned out. `results` holds one entry per destination, keyed by its position.
3904
+ */
3905
+ type DeliverResult = {
3906
+ status: 'accepted' | 'refused';
3907
+ submissionId: string;
3908
+ message?: string;
3909
+ redirect?: string;
3910
+ errors?: Array<{
3911
+ field?: string;
3912
+ message: string;
3913
+ }>;
3914
+ results: Record<string, {
3915
+ status: 'done' | 'pending' | 'ambiguous' | 'skipped';
3916
+ ref?: string;
3917
+ }>;
3918
+ };
3919
+ /**
3920
+ The delivery result a block carries — it is the round's `custom:deliverResult` block — or `undefined`
3921
+ for any other block, or a result with a field missing or mistyped. A redirect the site could not hand to
3922
+ `location.assign` (not http(s), mailto, tel or a path) is dropped, the rest of the result kept.
3923
+ */
3924
+ declare function deliverResultOf(block: {
3925
+ type: string;
3926
+ data?: unknown;
3927
+ }): DeliverResult | undefined;
3928
+
3808
3929
  /**
3809
3930
  Logger utility for Thamyr SDK
3810
3931
  Provides configurable logging that can be enabled/disabled to avoid console spam
@@ -3929,5 +4050,5 @@ declare function createContractClient(config: {
3929
4050
  withCredentials?: boolean;
3930
4051
  }): ContractClient;
3931
4052
 
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 };
4053
+ export { ACTION_TYPES, ADD_TO_CART_RESULT_BLOCK, CallimacusApi, CallimacusEvent, CallimacusService, ChapterStatus, ClientEvents, DELIVER_RESULT_BLOCK, GalleryMode, LANDING_VALUE_MAX_LENGTH, MAX_HANDSHAKE_RETRIES, SLInputEventType, ServerEvents, ThamyrHttpError, ThamyrResponseType, UserInteractionType, actionOf, addToCartResultOf, applyBlockPatch, blockKeyOf, callimacusService, classifyConnectError, createContractClient, deliverResultOf, extractTtsAudio, fieldsOf, interactionRound, isCustomBlock, isMasterProduct, isSetProduct, landingRound, logger, parseConnectRejection, randomUuid, receptorsOf, shouldRetryHandshake, transformImageUrl };
4054
+ export type { Action, ActionType, AddToCartResult, BCProduct, Basket, Block, BlockPatch, BoundingBox, CallimacusErrorMessage, Chapter, ClientInfo, ConnectRejection, ConnectionStatusCallback, ContractClient, CustomBlock, DeliverResult, 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 };
@@ -378,6 +378,10 @@ type SlInputEvent = {
378
378
  payload?: {
379
379
  [key: string]: unknown;
380
380
  };
381
+ /**
382
+ * Minted by the site for a delivered interaction (a form): a repeated emit gets the stored result back, and the chapter carrying it resolves the site's `run()`.
383
+ */
384
+ submissionId?: string;
381
385
  nodeKey?: string;
382
386
  interactionId: string;
383
387
  value?: string | Array<string>;
@@ -815,6 +819,10 @@ type CreateRoundContextOutput = {
815
819
  };
816
820
  userAgent?: string;
817
821
  acceptLanguageLocale?: string;
822
+ /**
823
+ * The page title, carried in a delivered interaction's envelope.
824
+ */
825
+ title?: string;
818
826
  [key: string]: unknown;
819
827
  };
820
828
  type CustomBlockOutput = {
@@ -1098,6 +1106,10 @@ type SlInputEventOutput = {
1098
1106
  payload?: {
1099
1107
  [key: string]: unknown;
1100
1108
  };
1109
+ /**
1110
+ * Minted by the site for a delivered interaction (a form): a repeated emit gets the stored result back, and the chapter carrying it resolves the site's `run()`.
1111
+ */
1112
+ submissionId?: string;
1101
1113
  nodeKey?: string;
1102
1114
  interactionId: string;
1103
1115
  value?: string | Array<string>;
@@ -1383,6 +1395,12 @@ type SkesisSimilarResponse = {
1383
1395
  score: number;
1384
1396
  item: SkesisItem;
1385
1397
  }>;
1398
+ /**
1399
+ * Present only when the request set `explain: true`: what each stage of the pipeline decided, keyed by stage (search runs plan, route, retrieve, assess, relax and rank; the other pipelines a subset), plus `timings` in milliseconds. Decisions only — never what the engine was told.
1400
+ */
1401
+ trace?: {
1402
+ [key: string]: unknown;
1403
+ };
1386
1404
  };
1387
1405
  type SkesisRelatedResponse = {
1388
1406
  related: Array<{
@@ -1394,6 +1412,12 @@ type SkesisRelatedResponse = {
1394
1412
  item: SkesisItem;
1395
1413
  }>;
1396
1414
  usedFallback: boolean;
1415
+ /**
1416
+ * Present only when the request set `explain: true`: what each stage of the pipeline decided, keyed by stage (search runs plan, route, retrieve, assess, relax and rank; the other pipelines a subset), plus `timings` in milliseconds. Decisions only — never what the engine was told.
1417
+ */
1418
+ trace?: {
1419
+ [key: string]: unknown;
1420
+ };
1397
1421
  };
1398
1422
  /**
1399
1423
  * Document representing an order address.
@@ -3333,6 +3357,10 @@ type UiSnapshot = {
3333
3357
  };
3334
3358
  type InteractionContext = {
3335
3359
  uiSnapshot?: UiSnapshot;
3360
+ /**
3361
+ The page title, carried in a delivered interaction's envelope.
3362
+ */
3363
+ title?: string;
3336
3364
  };
3337
3365
  type UiObserverConfig = {
3338
3366
  enabled?: boolean;
@@ -3454,6 +3482,10 @@ type InteractionOptions<I extends InteractionId = InteractionId> = RoundOptions
3454
3482
  block?: string;
3455
3483
  payload?: InteractionPayload<I>;
3456
3484
  /**
3485
+ Minted by the site for a delivered interaction (a form): a repeated emit gets the stored result back, and the chapter carrying it resolves the site's `run()`.
3486
+ */
3487
+ submissionId?: string;
3488
+ /**
3457
3489
  A value the interaction carries (a chosen option, a list of them).
3458
3490
  */
3459
3491
  value?: string | string[];
@@ -3803,6 +3835,95 @@ declare function shouldRetryHandshake(code: number, attemptsSoFar: number): bool
3803
3835
  */
3804
3836
  declare function classifyConnectError(error: Error, isActive: boolean): ConnectRejection | undefined;
3805
3837
 
3838
+ type Action =
3839
+ /**
3840
+ Opens a URL in the browser; `#section` scrolls the page.
3841
+ */
3842
+ {
3843
+ type: 'link';
3844
+ url: string;
3845
+ newTab?: boolean;
3846
+ }
3847
+ /**
3848
+ A question round, as if the visitor typed it.
3849
+ */
3850
+ | {
3851
+ type: 'ask';
3852
+ value: string;
3853
+ }
3854
+ /**
3855
+ A declared interaction round: open a category, a page, a profile; refresh a block.
3856
+ */
3857
+ | {
3858
+ type: 'interact';
3859
+ id: string;
3860
+ value?: string | string[];
3861
+ payload?: Record<string, unknown>;
3862
+ block?: string;
3863
+ }
3864
+ /**
3865
+ Adds a product to the cart.
3866
+ */
3867
+ | {
3868
+ type: 'cart';
3869
+ productId: string;
3870
+ }
3871
+ /**
3872
+ Sends the component's inputs as a round of the project's `input` interaction of that name — a form — and waits for its delivery result.
3873
+ */
3874
+ | {
3875
+ type: 'submit';
3876
+ form: string;
3877
+ };
3878
+ type ActionType = Action['type'];
3879
+ declare const ACTION_TYPES: readonly ActionType[];
3880
+ /**
3881
+ The action in a value the composer produced — or `undefined` when it is not
3882
+ one: unknown type, missing or mistyped fields, a link that is not http(s), mailto, tel or relative. Read block
3883
+ data through this, never trust it as typed.
3884
+ */
3885
+ declare function actionOf(value: unknown): Action | undefined;
3886
+ /**
3887
+ The fields of a form, as a `submit` sends them: every input by name, a string
3888
+ when the name has one value and a list when it has several (`getAll`). A name
3889
+ ending in `[]` is always a list, the `[]` taken off (`topics[]` → `topics`), so
3890
+ a checkbox group or a multiple select keeps its shape with one box checked.
3891
+ A file is left out — an interaction carries no binary. A checkbox arrives as its
3892
+ `value` (`on` by default), not as a boolean.
3893
+ */
3894
+ declare function fieldsOf(form: HTMLFormElement | FormData): Record<string, string | string[]>;
3895
+ /**
3896
+ The block a delivered interaction (a form) opens its round with: what the submission came to.
3897
+ */
3898
+ declare const DELIVER_RESULT_BLOCK = "custom:deliverResult";
3899
+ /**
3900
+ How a submission resolved. `accepted`: it is in, outages included. `refused`: the primary destination
3901
+ rejected it and nothing fanned out. `results` holds one entry per destination, keyed by its position.
3902
+ */
3903
+ type DeliverResult = {
3904
+ status: 'accepted' | 'refused';
3905
+ submissionId: string;
3906
+ message?: string;
3907
+ redirect?: string;
3908
+ errors?: Array<{
3909
+ field?: string;
3910
+ message: string;
3911
+ }>;
3912
+ results: Record<string, {
3913
+ status: 'done' | 'pending' | 'ambiguous' | 'skipped';
3914
+ ref?: string;
3915
+ }>;
3916
+ };
3917
+ /**
3918
+ The delivery result a block carries — it is the round's `custom:deliverResult` block — or `undefined`
3919
+ for any other block, or a result with a field missing or mistyped. A redirect the site could not hand to
3920
+ `location.assign` (not http(s), mailto, tel or a path) is dropped, the rest of the result kept.
3921
+ */
3922
+ declare function deliverResultOf(block: {
3923
+ type: string;
3924
+ data?: unknown;
3925
+ }): DeliverResult | undefined;
3926
+
3806
3927
  /**
3807
3928
  Logger utility for Thamyr SDK
3808
3929
  Provides configurable logging that can be enabled/disabled to avoid console spam
@@ -3988,5 +4109,5 @@ declare function createContractClient(config: {
3988
4109
  withCredentials?: boolean;
3989
4110
  }): ContractClient;
3990
4111
 
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 };
4112
+ export { ACTION_TYPES, ADD_TO_CART_RESULT_BLOCK, CallimacusApi, CallimacusEvent, CallimacusService, ChapterStatus, ClientEvents, DELIVER_RESULT_BLOCK, GalleryMode, LANDING_VALUE_MAX_LENGTH, MAX_HANDSHAKE_RETRIES, SLInputEventType, ServerEvents, ThamyrHttpError, ThamyrResponseType, UserInteractionType, actionOf, addToCartResultOf, applyBlockPatch, blockKeyOf, callimacusService, classifyConnectError, clearIntentSessionId, createContractClient, deliverResultOf, ensureIntentSessionId, extractTtsAudio, fieldsOf, getIntentSessionId, initIntent, interactionRound, isCustomBlock, isMasterProduct, isSetProduct, landingRound, logger, parseConnectRejection, randomUuid, receptorsOf, setConsent, setDebug, setDebugPanel, setGeo, setIntentSessionMaxAge, shouldRetryHandshake, transformImageUrl };
4113
+ export type { Action, ActionType, AddToCartResult, BCProduct, Basket, Block, BlockPatch, BoundingBox, CallimacusErrorMessage, Chapter, ClientInfo, ConnectRejection, ConnectionStatusCallback, ContractClient, CustomBlock, DeliverResult, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@callimacus/thamyr-core",
3
- "version": "4.5.0",
3
+ "version": "4.7.0",
4
4
  "private": false,
5
5
  "description": "Core package for Thamyr",
6
6
  "license": "SEE LICENSE IN LICENSE.md",