@callimacus/thamyr-core 4.8.3 → 4.9.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 +7 -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 +139 -37
- package/dist/types/index.native.d.ts +139 -37
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -333,6 +333,7 @@ interface TDataShape {
|
|
|
333
333
|
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
334
334
|
type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
335
335
|
|
|
336
|
+
type LanguageCode = 'aa' | 'ab' | 'ae' | 'af' | 'ak' | 'am' | 'an' | 'ar' | 'as' | 'av' | 'ay' | 'az' | 'ba' | 'be' | 'bg' | 'bi' | 'bm' | 'bn' | 'bo' | 'br' | 'bs' | 'ca' | 'ce' | 'ch' | 'co' | 'cr' | 'cs' | 'cu' | 'cv' | 'cy' | 'da' | 'de' | 'dv' | 'dz' | 'ee' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'ff' | 'fi' | 'fj' | 'fo' | 'fr' | 'fy' | 'ga' | 'gd' | 'gl' | 'gn' | 'gu' | 'gv' | 'ha' | 'he' | 'hi' | 'ho' | 'hr' | 'ht' | 'hu' | 'hy' | 'hz' | 'ia' | 'id' | 'ie' | 'ig' | 'ii' | 'ik' | 'io' | 'is' | 'it' | 'iu' | 'ja' | 'jv' | 'ka' | 'kg' | 'ki' | 'kj' | 'kk' | 'kl' | 'km' | 'kn' | 'ko' | 'kr' | 'ks' | 'ku' | 'kv' | 'kw' | 'ky' | 'la' | 'lb' | 'lg' | 'li' | 'ln' | 'lo' | 'lt' | 'lu' | 'lv' | 'mg' | 'mh' | 'mi' | 'mk' | 'ml' | 'mn' | 'mr' | 'ms' | 'mt' | 'my' | 'na' | 'nb' | 'nd' | 'ne' | 'ng' | 'nl' | 'nn' | 'no' | 'nr' | 'nv' | 'ny' | 'oc' | 'oj' | 'om' | 'or' | 'os' | 'pa' | 'pi' | 'pl' | 'ps' | 'pt' | 'qu' | 'rm' | 'rn' | 'ro' | 'ru' | 'rw' | 'sa' | 'sc' | 'sd' | 'se' | 'sg' | 'si' | 'sk' | 'sl' | 'sm' | 'sn' | 'so' | 'sq' | 'sr' | 'ss' | 'st' | 'su' | 'sv' | 'sw' | 'ta' | 'te' | 'tg' | 'th' | 'ti' | 'tk' | 'tl' | 'tn' | 'to' | 'tr' | 'ts' | 'tt' | 'tw' | 'ty' | 'ug' | 'uk' | 'ur' | 'uz' | 've' | 'vi' | 'vo' | 'wa' | 'wo' | 'xh' | 'yi' | 'yo' | 'za' | 'zh' | 'zu';
|
|
336
337
|
type ChapterStatus$1 = 1 | 2 | 3 | 4;
|
|
337
338
|
type GalleryMode$1 = 'masonry' | 'carousel';
|
|
338
339
|
type SlInputEvent = {
|
|
@@ -426,6 +427,21 @@ type TopicContentsPage = {
|
|
|
426
427
|
offset: number;
|
|
427
428
|
limit: number;
|
|
428
429
|
};
|
|
430
|
+
type DocumentIndexEntry = {
|
|
431
|
+
/**
|
|
432
|
+
* The page path, `/map/{language}/{slug}` — what a link to the document points at
|
|
433
|
+
*/
|
|
434
|
+
path: string;
|
|
435
|
+
slug: string;
|
|
436
|
+
/**
|
|
437
|
+
* The meta title, or the document name when none is set
|
|
438
|
+
*/
|
|
439
|
+
title: string;
|
|
440
|
+
/**
|
|
441
|
+
* The meta description, when set
|
|
442
|
+
*/
|
|
443
|
+
description?: string;
|
|
444
|
+
};
|
|
429
445
|
type RecommendationsResponse = {
|
|
430
446
|
directRecommendations: Array<ProductMatch>;
|
|
431
447
|
inverseRecommendations: Array<ProductMatch>;
|
|
@@ -793,6 +809,19 @@ type ChapterOutput = {
|
|
|
793
809
|
};
|
|
794
810
|
references?: Array<string>;
|
|
795
811
|
blocks?: Array<BlockOutput>;
|
|
812
|
+
/**
|
|
813
|
+
* The blocks this round will show, in page order, sent as soon as the page is decided and before their contents are ready, so a storefront can hold their places. A block whose contents find nothing is still dropped: `blocks` is the page; the outline is the shape it is expected to take. Sent only when the round asked for it (`context.outline`).
|
|
814
|
+
*/
|
|
815
|
+
outline?: Array<{
|
|
816
|
+
/**
|
|
817
|
+
* The block's key, as its block will carry it.
|
|
818
|
+
*/
|
|
819
|
+
key: string;
|
|
820
|
+
/**
|
|
821
|
+
* The block's type, as its block will carry it (`custom:<type>`).
|
|
822
|
+
*/
|
|
823
|
+
type: string;
|
|
824
|
+
}>;
|
|
796
825
|
status: ChapterStatus$1;
|
|
797
826
|
};
|
|
798
827
|
type CreateRoundContextOutput = {
|
|
@@ -825,6 +854,10 @@ type CreateRoundContextOutput = {
|
|
|
825
854
|
* The page title, carried in a delivered interaction's envelope.
|
|
826
855
|
*/
|
|
827
856
|
title?: string;
|
|
857
|
+
/**
|
|
858
|
+
* Ask for the round's `outline`: the blocks it will show, in page order, sent before their contents are ready. Without it, no outline is sent.
|
|
859
|
+
*/
|
|
860
|
+
outline?: boolean;
|
|
828
861
|
[key: string]: unknown;
|
|
829
862
|
};
|
|
830
863
|
type CustomBlockOutput = {
|
|
@@ -967,7 +1000,7 @@ type LocalizedEpArtworkOutput = {
|
|
|
967
1000
|
type: 'ep';
|
|
968
1001
|
};
|
|
969
1002
|
type SlDocumentOutput = {
|
|
970
|
-
language:
|
|
1003
|
+
language: LanguageCode;
|
|
971
1004
|
type: 'content' | 'image' | 'video';
|
|
972
1005
|
name: string;
|
|
973
1006
|
backgroundKnowledge: boolean;
|
|
@@ -2678,6 +2711,26 @@ type ContentGetDocumentByPathResponses = {
|
|
|
2678
2711
|
*/
|
|
2679
2712
|
200: SlDocumentOutput;
|
|
2680
2713
|
};
|
|
2714
|
+
type ContentListDocumentsErrors = {
|
|
2715
|
+
/**
|
|
2716
|
+
* Validation error
|
|
2717
|
+
*/
|
|
2718
|
+
400: unknown;
|
|
2719
|
+
/**
|
|
2720
|
+
* Missing or invalid access token
|
|
2721
|
+
*/
|
|
2722
|
+
401: unknown;
|
|
2723
|
+
/**
|
|
2724
|
+
* The caller is not permitted to perform this operation
|
|
2725
|
+
*/
|
|
2726
|
+
403: PinaxForbidden;
|
|
2727
|
+
};
|
|
2728
|
+
type ContentListDocumentsResponses = {
|
|
2729
|
+
/**
|
|
2730
|
+
* Success
|
|
2731
|
+
*/
|
|
2732
|
+
200: Array<DocumentIndexEntry>;
|
|
2733
|
+
};
|
|
2681
2734
|
type StoriesGetSharedErrors = {
|
|
2682
2735
|
/**
|
|
2683
2736
|
* Validation error
|
|
@@ -3033,6 +3086,14 @@ declare class Content extends HeyApiClient {
|
|
|
3033
3086
|
getDocumentByPath<ThrowOnError extends boolean = false>(parameters: {
|
|
3034
3087
|
path: string;
|
|
3035
3088
|
}, options?: Options<never, ThrowOnError>): RequestResult<ContentGetDocumentByPathResponses, ContentGetDocumentByPathErrors, ThrowOnError>;
|
|
3089
|
+
/**
|
|
3090
|
+
* List the published documents in a language
|
|
3091
|
+
*
|
|
3092
|
+
* The entries of the per-language index at `/map/{language}`: every approved, published document with a slug, newest first, each with the path of its page and the title a link to it should carry. A language with no published document lists nothing, it is not a 404.
|
|
3093
|
+
*/
|
|
3094
|
+
listDocuments<ThrowOnError extends boolean = false>(parameters: {
|
|
3095
|
+
language: string;
|
|
3096
|
+
}, options?: Options<never, ThrowOnError>): RequestResult<ContentListDocumentsResponses, ContentListDocumentsErrors, ThrowOnError>;
|
|
3036
3097
|
}
|
|
3037
3098
|
declare class Stories extends HeyApiClient {
|
|
3038
3099
|
/**
|
|
@@ -3802,6 +3863,81 @@ declare function addToCartResultOf(block: {
|
|
|
3802
3863
|
*/
|
|
3803
3864
|
declare function applyBlockPatch(chapter: Chapter, patch: BlockPatch): Chapter;
|
|
3804
3865
|
|
|
3866
|
+
type ContractClient = Client;
|
|
3867
|
+
/**
|
|
3868
|
+
What a contract call rejects with under `{throwOnError: true}`.
|
|
3869
|
+
|
|
3870
|
+
- `status` is the HTTP status of the failed response, `undefined` when no response arrived (network or
|
|
3871
|
+
CORS failure). It can be 2xx when the response arrived but its body could not be parsed or validated.
|
|
3872
|
+
- `body` is the parsed error body the server sent — `{error, errorId}` on the public API, a string for
|
|
3873
|
+
non-JSON bodies, `{}` for an empty body — or, when no response arrived, the underlying `TypeError`
|
|
3874
|
+
(also exposed as `cause`).
|
|
3875
|
+
|
|
3876
|
+
Aborting a call through its `signal` is not a failure of the call: the abort reason is rethrown as is. The
|
|
3877
|
+
request signal decides, and it does so whether the abort landed before or after the response headers arrived.
|
|
3878
|
+
*/
|
|
3879
|
+
declare class ThamyrHttpError extends Error {
|
|
3880
|
+
readonly status: number | undefined;
|
|
3881
|
+
readonly body: unknown;
|
|
3882
|
+
readonly response: Response | undefined;
|
|
3883
|
+
readonly request: Request | undefined;
|
|
3884
|
+
constructor(body: unknown, response?: Response, request?: Request);
|
|
3885
|
+
}
|
|
3886
|
+
/**
|
|
3887
|
+
Client for the generated {@link CallimacusApi}: the client id doubles as bearer token and x-sl-access-token.
|
|
3888
|
+
Calls made with `{throwOnError: true}` (per call, or through `setConfig`) reject with a
|
|
3889
|
+
{@link ThamyrHttpError}; the envelope's `error` stays the parsed body, as documented.
|
|
3890
|
+
*/
|
|
3891
|
+
declare function createContractClient(config: {
|
|
3892
|
+
endpoint: string;
|
|
3893
|
+
accessToken: string;
|
|
3894
|
+
/**
|
|
3895
|
+
Send cookies cross-origin (the old axios `withCredentials`).
|
|
3896
|
+
*/
|
|
3897
|
+
withCredentials?: boolean;
|
|
3898
|
+
}): ContractClient;
|
|
3899
|
+
|
|
3900
|
+
/**
|
|
3901
|
+
What a `/map/…` pathname names: the index of a language, or one of its documents.
|
|
3902
|
+
*/
|
|
3903
|
+
type MapPath = {
|
|
3904
|
+
language: string;
|
|
3905
|
+
slug?: string;
|
|
3906
|
+
};
|
|
3907
|
+
/**
|
|
3908
|
+
Parses a `/map/{language}` or `/map/{language}/{slug}` pathname the way the
|
|
3909
|
+
server does: the leading slash is optional, the slug may contain slashes, and
|
|
3910
|
+
a trailing slash after the language still means the index. Anything else —
|
|
3911
|
+
another route, a bare `/map` — is `undefined`. Pass `location.pathname`, not
|
|
3912
|
+
the full URL: a query string or a hash would end up in the slug.
|
|
3913
|
+
*/
|
|
3914
|
+
declare function parseMapPath(pathname: string): MapPath | undefined;
|
|
3915
|
+
/**
|
|
3916
|
+
What a `/map/…` pathname shows: one document, or the per-language index.
|
|
3917
|
+
*/
|
|
3918
|
+
type MapPage = {
|
|
3919
|
+
kind: 'document';
|
|
3920
|
+
language: string;
|
|
3921
|
+
slug: string;
|
|
3922
|
+
document: SLDocument;
|
|
3923
|
+
} | {
|
|
3924
|
+
kind: 'index';
|
|
3925
|
+
language: string;
|
|
3926
|
+
entries: DocumentIndexEntry[];
|
|
3927
|
+
};
|
|
3928
|
+
/**
|
|
3929
|
+
Resolves what to show at a `/map/…` pathname: the document at
|
|
3930
|
+
`/map/{language}/{slug}`, or the entries of the per-language index at
|
|
3931
|
+
`/map/{language}` — the same list the crawler is served, newest first.
|
|
3932
|
+
@param api - A `Thamyr` instance, or the React package's `thamyrApi`.
|
|
3933
|
+
@param pathname - `location.pathname`.
|
|
3934
|
+
@returns `undefined` when the pathname is not a `/map/` path or names no
|
|
3935
|
+
published document, so the caller renders its own not-found. Any other
|
|
3936
|
+
failure (network, a 5xx, an SDK not initialized) rejects — with a
|
|
3937
|
+
`ThamyrHttpError` when a response arrived.
|
|
3938
|
+
*/
|
|
3939
|
+
declare function resolveMapPage(api: Pick<CallimacusApi, 'content'>, pathname: string): Promise<MapPage | undefined>;
|
|
3940
|
+
|
|
3805
3941
|
/**
|
|
3806
3942
|
Structured payload the server attaches to a refused handshake (SOL-1100):
|
|
3807
3943
|
`code` is an HTTP-style status — 4xx is a deliberate refusal, 5xx means the
|
|
@@ -4016,39 +4152,5 @@ declare function transformImageUrl(cdnUrl: string, edits: ImageEdits): string;
|
|
|
4016
4152
|
*/
|
|
4017
4153
|
declare function randomUuid(): string;
|
|
4018
4154
|
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
What a contract call rejects with under `{throwOnError: true}`.
|
|
4022
|
-
|
|
4023
|
-
- `status` is the HTTP status of the failed response, `undefined` when no response arrived (network or
|
|
4024
|
-
CORS failure). It can be 2xx when the response arrived but its body could not be parsed or validated.
|
|
4025
|
-
- `body` is the parsed error body the server sent — `{error, errorId}` on the public API, a string for
|
|
4026
|
-
non-JSON bodies, `{}` for an empty body — or, when no response arrived, the underlying `TypeError`
|
|
4027
|
-
(also exposed as `cause`).
|
|
4028
|
-
|
|
4029
|
-
Aborting a call through its `signal` is not a failure of the call: the abort reason is rethrown as is. The
|
|
4030
|
-
request signal decides, and it does so whether the abort landed before or after the response headers arrived.
|
|
4031
|
-
*/
|
|
4032
|
-
declare class ThamyrHttpError extends Error {
|
|
4033
|
-
readonly status: number | undefined;
|
|
4034
|
-
readonly body: unknown;
|
|
4035
|
-
readonly response: Response | undefined;
|
|
4036
|
-
readonly request: Request | undefined;
|
|
4037
|
-
constructor(body: unknown, response?: Response, request?: Request);
|
|
4038
|
-
}
|
|
4039
|
-
/**
|
|
4040
|
-
Client for the generated {@link CallimacusApi}: the client id doubles as bearer token and x-sl-access-token.
|
|
4041
|
-
Calls made with `{throwOnError: true}` (per call, or through `setConfig`) reject with a
|
|
4042
|
-
{@link ThamyrHttpError}; the envelope's `error` stays the parsed body, as documented.
|
|
4043
|
-
*/
|
|
4044
|
-
declare function createContractClient(config: {
|
|
4045
|
-
endpoint: string;
|
|
4046
|
-
accessToken: string;
|
|
4047
|
-
/**
|
|
4048
|
-
Send cookies cross-origin (the old axios `withCredentials`).
|
|
4049
|
-
*/
|
|
4050
|
-
withCredentials?: boolean;
|
|
4051
|
-
}): ContractClient;
|
|
4052
|
-
|
|
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 };
|
|
4155
|
+
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, parseMapPath, randomUuid, receptorsOf, resolveMapPage, shouldRetryHandshake, transformImageUrl };
|
|
4156
|
+
export type { Action, ActionType, AddToCartResult, BCProduct, Basket, Block, BlockPatch, BoundingBox, CallimacusErrorMessage, Chapter, ClientInfo, ConnectRejection, ConnectionStatusCallback, ContractClient, CustomBlock, DeliverResult, DocumentIndexEntry, ErrorCallback, ErrorMessage, Gallery, GenericProduct, HomePage, Image, ImageEdits, ImageFormatEdit, ImageResizeEdit, InteractionContext, InteractionId, InteractionOptions, InteractionPayload, InteractionPayloadMap, LegacyBlock, LocalizedEPArtwork, LocalizedEPChapter, LogLevel, LoggerConfig, MapPage, MapPath, 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 };
|
|
@@ -331,6 +331,7 @@ interface TDataShape {
|
|
|
331
331
|
type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
|
332
332
|
type Options$1<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown, TResponseStyle extends ResponseStyle = 'fields'> = OmitKeys<RequestOptions<TResponse, TResponseStyle, ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & ([TData] extends [never] ? unknown : Omit<TData, 'url'>);
|
|
333
333
|
|
|
334
|
+
type LanguageCode = 'aa' | 'ab' | 'ae' | 'af' | 'ak' | 'am' | 'an' | 'ar' | 'as' | 'av' | 'ay' | 'az' | 'ba' | 'be' | 'bg' | 'bi' | 'bm' | 'bn' | 'bo' | 'br' | 'bs' | 'ca' | 'ce' | 'ch' | 'co' | 'cr' | 'cs' | 'cu' | 'cv' | 'cy' | 'da' | 'de' | 'dv' | 'dz' | 'ee' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'ff' | 'fi' | 'fj' | 'fo' | 'fr' | 'fy' | 'ga' | 'gd' | 'gl' | 'gn' | 'gu' | 'gv' | 'ha' | 'he' | 'hi' | 'ho' | 'hr' | 'ht' | 'hu' | 'hy' | 'hz' | 'ia' | 'id' | 'ie' | 'ig' | 'ii' | 'ik' | 'io' | 'is' | 'it' | 'iu' | 'ja' | 'jv' | 'ka' | 'kg' | 'ki' | 'kj' | 'kk' | 'kl' | 'km' | 'kn' | 'ko' | 'kr' | 'ks' | 'ku' | 'kv' | 'kw' | 'ky' | 'la' | 'lb' | 'lg' | 'li' | 'ln' | 'lo' | 'lt' | 'lu' | 'lv' | 'mg' | 'mh' | 'mi' | 'mk' | 'ml' | 'mn' | 'mr' | 'ms' | 'mt' | 'my' | 'na' | 'nb' | 'nd' | 'ne' | 'ng' | 'nl' | 'nn' | 'no' | 'nr' | 'nv' | 'ny' | 'oc' | 'oj' | 'om' | 'or' | 'os' | 'pa' | 'pi' | 'pl' | 'ps' | 'pt' | 'qu' | 'rm' | 'rn' | 'ro' | 'ru' | 'rw' | 'sa' | 'sc' | 'sd' | 'se' | 'sg' | 'si' | 'sk' | 'sl' | 'sm' | 'sn' | 'so' | 'sq' | 'sr' | 'ss' | 'st' | 'su' | 'sv' | 'sw' | 'ta' | 'te' | 'tg' | 'th' | 'ti' | 'tk' | 'tl' | 'tn' | 'to' | 'tr' | 'ts' | 'tt' | 'tw' | 'ty' | 'ug' | 'uk' | 'ur' | 'uz' | 've' | 'vi' | 'vo' | 'wa' | 'wo' | 'xh' | 'yi' | 'yo' | 'za' | 'zh' | 'zu';
|
|
334
335
|
type ChapterStatus$1 = 1 | 2 | 3 | 4;
|
|
335
336
|
type GalleryMode$1 = 'masonry' | 'carousel';
|
|
336
337
|
type SlInputEvent = {
|
|
@@ -424,6 +425,21 @@ type TopicContentsPage = {
|
|
|
424
425
|
offset: number;
|
|
425
426
|
limit: number;
|
|
426
427
|
};
|
|
428
|
+
type DocumentIndexEntry = {
|
|
429
|
+
/**
|
|
430
|
+
* The page path, `/map/{language}/{slug}` — what a link to the document points at
|
|
431
|
+
*/
|
|
432
|
+
path: string;
|
|
433
|
+
slug: string;
|
|
434
|
+
/**
|
|
435
|
+
* The meta title, or the document name when none is set
|
|
436
|
+
*/
|
|
437
|
+
title: string;
|
|
438
|
+
/**
|
|
439
|
+
* The meta description, when set
|
|
440
|
+
*/
|
|
441
|
+
description?: string;
|
|
442
|
+
};
|
|
427
443
|
type RecommendationsResponse = {
|
|
428
444
|
directRecommendations: Array<ProductMatch>;
|
|
429
445
|
inverseRecommendations: Array<ProductMatch>;
|
|
@@ -791,6 +807,19 @@ type ChapterOutput = {
|
|
|
791
807
|
};
|
|
792
808
|
references?: Array<string>;
|
|
793
809
|
blocks?: Array<BlockOutput>;
|
|
810
|
+
/**
|
|
811
|
+
* The blocks this round will show, in page order, sent as soon as the page is decided and before their contents are ready, so a storefront can hold their places. A block whose contents find nothing is still dropped: `blocks` is the page; the outline is the shape it is expected to take. Sent only when the round asked for it (`context.outline`).
|
|
812
|
+
*/
|
|
813
|
+
outline?: Array<{
|
|
814
|
+
/**
|
|
815
|
+
* The block's key, as its block will carry it.
|
|
816
|
+
*/
|
|
817
|
+
key: string;
|
|
818
|
+
/**
|
|
819
|
+
* The block's type, as its block will carry it (`custom:<type>`).
|
|
820
|
+
*/
|
|
821
|
+
type: string;
|
|
822
|
+
}>;
|
|
794
823
|
status: ChapterStatus$1;
|
|
795
824
|
};
|
|
796
825
|
type CreateRoundContextOutput = {
|
|
@@ -823,6 +852,10 @@ type CreateRoundContextOutput = {
|
|
|
823
852
|
* The page title, carried in a delivered interaction's envelope.
|
|
824
853
|
*/
|
|
825
854
|
title?: string;
|
|
855
|
+
/**
|
|
856
|
+
* Ask for the round's `outline`: the blocks it will show, in page order, sent before their contents are ready. Without it, no outline is sent.
|
|
857
|
+
*/
|
|
858
|
+
outline?: boolean;
|
|
826
859
|
[key: string]: unknown;
|
|
827
860
|
};
|
|
828
861
|
type CustomBlockOutput = {
|
|
@@ -965,7 +998,7 @@ type LocalizedEpArtworkOutput = {
|
|
|
965
998
|
type: 'ep';
|
|
966
999
|
};
|
|
967
1000
|
type SlDocumentOutput = {
|
|
968
|
-
language:
|
|
1001
|
+
language: LanguageCode;
|
|
969
1002
|
type: 'content' | 'image' | 'video';
|
|
970
1003
|
name: string;
|
|
971
1004
|
backgroundKnowledge: boolean;
|
|
@@ -2676,6 +2709,26 @@ type ContentGetDocumentByPathResponses = {
|
|
|
2676
2709
|
*/
|
|
2677
2710
|
200: SlDocumentOutput;
|
|
2678
2711
|
};
|
|
2712
|
+
type ContentListDocumentsErrors = {
|
|
2713
|
+
/**
|
|
2714
|
+
* Validation error
|
|
2715
|
+
*/
|
|
2716
|
+
400: unknown;
|
|
2717
|
+
/**
|
|
2718
|
+
* Missing or invalid access token
|
|
2719
|
+
*/
|
|
2720
|
+
401: unknown;
|
|
2721
|
+
/**
|
|
2722
|
+
* The caller is not permitted to perform this operation
|
|
2723
|
+
*/
|
|
2724
|
+
403: PinaxForbidden;
|
|
2725
|
+
};
|
|
2726
|
+
type ContentListDocumentsResponses = {
|
|
2727
|
+
/**
|
|
2728
|
+
* Success
|
|
2729
|
+
*/
|
|
2730
|
+
200: Array<DocumentIndexEntry>;
|
|
2731
|
+
};
|
|
2679
2732
|
type StoriesGetSharedErrors = {
|
|
2680
2733
|
/**
|
|
2681
2734
|
* Validation error
|
|
@@ -3031,6 +3084,14 @@ declare class Content extends HeyApiClient {
|
|
|
3031
3084
|
getDocumentByPath<ThrowOnError extends boolean = false>(parameters: {
|
|
3032
3085
|
path: string;
|
|
3033
3086
|
}, options?: Options<never, ThrowOnError>): RequestResult<ContentGetDocumentByPathResponses, ContentGetDocumentByPathErrors, ThrowOnError>;
|
|
3087
|
+
/**
|
|
3088
|
+
* List the published documents in a language
|
|
3089
|
+
*
|
|
3090
|
+
* The entries of the per-language index at `/map/{language}`: every approved, published document with a slug, newest first, each with the path of its page and the title a link to it should carry. A language with no published document lists nothing, it is not a 404.
|
|
3091
|
+
*/
|
|
3092
|
+
listDocuments<ThrowOnError extends boolean = false>(parameters: {
|
|
3093
|
+
language: string;
|
|
3094
|
+
}, options?: Options<never, ThrowOnError>): RequestResult<ContentListDocumentsResponses, ContentListDocumentsErrors, ThrowOnError>;
|
|
3034
3095
|
}
|
|
3035
3096
|
declare class Stories extends HeyApiClient {
|
|
3036
3097
|
/**
|
|
@@ -3800,6 +3861,81 @@ declare function addToCartResultOf(block: {
|
|
|
3800
3861
|
*/
|
|
3801
3862
|
declare function applyBlockPatch(chapter: Chapter, patch: BlockPatch): Chapter;
|
|
3802
3863
|
|
|
3864
|
+
type ContractClient = Client;
|
|
3865
|
+
/**
|
|
3866
|
+
What a contract call rejects with under `{throwOnError: true}`.
|
|
3867
|
+
|
|
3868
|
+
- `status` is the HTTP status of the failed response, `undefined` when no response arrived (network or
|
|
3869
|
+
CORS failure). It can be 2xx when the response arrived but its body could not be parsed or validated.
|
|
3870
|
+
- `body` is the parsed error body the server sent — `{error, errorId}` on the public API, a string for
|
|
3871
|
+
non-JSON bodies, `{}` for an empty body — or, when no response arrived, the underlying `TypeError`
|
|
3872
|
+
(also exposed as `cause`).
|
|
3873
|
+
|
|
3874
|
+
Aborting a call through its `signal` is not a failure of the call: the abort reason is rethrown as is. The
|
|
3875
|
+
request signal decides, and it does so whether the abort landed before or after the response headers arrived.
|
|
3876
|
+
*/
|
|
3877
|
+
declare class ThamyrHttpError extends Error {
|
|
3878
|
+
readonly status: number | undefined;
|
|
3879
|
+
readonly body: unknown;
|
|
3880
|
+
readonly response: Response | undefined;
|
|
3881
|
+
readonly request: Request | undefined;
|
|
3882
|
+
constructor(body: unknown, response?: Response, request?: Request);
|
|
3883
|
+
}
|
|
3884
|
+
/**
|
|
3885
|
+
Client for the generated {@link CallimacusApi}: the client id doubles as bearer token and x-sl-access-token.
|
|
3886
|
+
Calls made with `{throwOnError: true}` (per call, or through `setConfig`) reject with a
|
|
3887
|
+
{@link ThamyrHttpError}; the envelope's `error` stays the parsed body, as documented.
|
|
3888
|
+
*/
|
|
3889
|
+
declare function createContractClient(config: {
|
|
3890
|
+
endpoint: string;
|
|
3891
|
+
accessToken: string;
|
|
3892
|
+
/**
|
|
3893
|
+
Send cookies cross-origin (the old axios `withCredentials`).
|
|
3894
|
+
*/
|
|
3895
|
+
withCredentials?: boolean;
|
|
3896
|
+
}): ContractClient;
|
|
3897
|
+
|
|
3898
|
+
/**
|
|
3899
|
+
What a `/map/…` pathname names: the index of a language, or one of its documents.
|
|
3900
|
+
*/
|
|
3901
|
+
type MapPath = {
|
|
3902
|
+
language: string;
|
|
3903
|
+
slug?: string;
|
|
3904
|
+
};
|
|
3905
|
+
/**
|
|
3906
|
+
Parses a `/map/{language}` or `/map/{language}/{slug}` pathname the way the
|
|
3907
|
+
server does: the leading slash is optional, the slug may contain slashes, and
|
|
3908
|
+
a trailing slash after the language still means the index. Anything else —
|
|
3909
|
+
another route, a bare `/map` — is `undefined`. Pass `location.pathname`, not
|
|
3910
|
+
the full URL: a query string or a hash would end up in the slug.
|
|
3911
|
+
*/
|
|
3912
|
+
declare function parseMapPath(pathname: string): MapPath | undefined;
|
|
3913
|
+
/**
|
|
3914
|
+
What a `/map/…` pathname shows: one document, or the per-language index.
|
|
3915
|
+
*/
|
|
3916
|
+
type MapPage = {
|
|
3917
|
+
kind: 'document';
|
|
3918
|
+
language: string;
|
|
3919
|
+
slug: string;
|
|
3920
|
+
document: SLDocument;
|
|
3921
|
+
} | {
|
|
3922
|
+
kind: 'index';
|
|
3923
|
+
language: string;
|
|
3924
|
+
entries: DocumentIndexEntry[];
|
|
3925
|
+
};
|
|
3926
|
+
/**
|
|
3927
|
+
Resolves what to show at a `/map/…` pathname: the document at
|
|
3928
|
+
`/map/{language}/{slug}`, or the entries of the per-language index at
|
|
3929
|
+
`/map/{language}` — the same list the crawler is served, newest first.
|
|
3930
|
+
@param api - A `Thamyr` instance, or the React package's `thamyrApi`.
|
|
3931
|
+
@param pathname - `location.pathname`.
|
|
3932
|
+
@returns `undefined` when the pathname is not a `/map/` path or names no
|
|
3933
|
+
published document, so the caller renders its own not-found. Any other
|
|
3934
|
+
failure (network, a 5xx, an SDK not initialized) rejects — with a
|
|
3935
|
+
`ThamyrHttpError` when a response arrived.
|
|
3936
|
+
*/
|
|
3937
|
+
declare function resolveMapPage(api: Pick<CallimacusApi, 'content'>, pathname: string): Promise<MapPage | undefined>;
|
|
3938
|
+
|
|
3803
3939
|
/**
|
|
3804
3940
|
Structured payload the server attaches to a refused handshake (SOL-1100):
|
|
3805
3941
|
`code` is an HTTP-style status — 4xx is a deliberate refusal, 5xx means the
|
|
@@ -4075,39 +4211,5 @@ declare function ensureIntentSessionId(): void;
|
|
|
4075
4211
|
declare function clearIntentSessionId(): void;
|
|
4076
4212
|
declare function setIntentSessionMaxAge(_seconds: number): void;
|
|
4077
4213
|
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
What a contract call rejects with under `{throwOnError: true}`.
|
|
4081
|
-
|
|
4082
|
-
- `status` is the HTTP status of the failed response, `undefined` when no response arrived (network or
|
|
4083
|
-
CORS failure). It can be 2xx when the response arrived but its body could not be parsed or validated.
|
|
4084
|
-
- `body` is the parsed error body the server sent — `{error, errorId}` on the public API, a string for
|
|
4085
|
-
non-JSON bodies, `{}` for an empty body — or, when no response arrived, the underlying `TypeError`
|
|
4086
|
-
(also exposed as `cause`).
|
|
4087
|
-
|
|
4088
|
-
Aborting a call through its `signal` is not a failure of the call: the abort reason is rethrown as is. The
|
|
4089
|
-
request signal decides, and it does so whether the abort landed before or after the response headers arrived.
|
|
4090
|
-
*/
|
|
4091
|
-
declare class ThamyrHttpError extends Error {
|
|
4092
|
-
readonly status: number | undefined;
|
|
4093
|
-
readonly body: unknown;
|
|
4094
|
-
readonly response: Response | undefined;
|
|
4095
|
-
readonly request: Request | undefined;
|
|
4096
|
-
constructor(body: unknown, response?: Response, request?: Request);
|
|
4097
|
-
}
|
|
4098
|
-
/**
|
|
4099
|
-
Client for the generated {@link CallimacusApi}: the client id doubles as bearer token and x-sl-access-token.
|
|
4100
|
-
Calls made with `{throwOnError: true}` (per call, or through `setConfig`) reject with a
|
|
4101
|
-
{@link ThamyrHttpError}; the envelope's `error` stays the parsed body, as documented.
|
|
4102
|
-
*/
|
|
4103
|
-
declare function createContractClient(config: {
|
|
4104
|
-
endpoint: string;
|
|
4105
|
-
accessToken: string;
|
|
4106
|
-
/**
|
|
4107
|
-
Send cookies cross-origin (the old axios `withCredentials`).
|
|
4108
|
-
*/
|
|
4109
|
-
withCredentials?: boolean;
|
|
4110
|
-
}): ContractClient;
|
|
4111
|
-
|
|
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 };
|
|
4214
|
+
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, parseMapPath, randomUuid, receptorsOf, resolveMapPage, setConsent, setDebug, setDebugPanel, setGeo, setIntentSessionMaxAge, shouldRetryHandshake, transformImageUrl };
|
|
4215
|
+
export type { Action, ActionType, AddToCartResult, BCProduct, Basket, Block, BlockPatch, BoundingBox, CallimacusErrorMessage, Chapter, ClientInfo, ConnectRejection, ConnectionStatusCallback, ContractClient, CustomBlock, DeliverResult, DocumentIndexEntry, ErrorCallback, ErrorMessage, Gallery, GenericProduct, HomePage, Image, ImageEdits, ImageFormatEdit, ImageResizeEdit, InitOptions, InteractionContext, InteractionId, InteractionOptions, InteractionPayload, InteractionPayloadMap, LegacyBlock, LocalizedEPArtwork, LocalizedEPChapter, LogLevel, LoggerConfig, MapPage, MapPath, 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 };
|