@callimacus/thamyr-core 4.3.4

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.
@@ -0,0 +1,3577 @@
1
+ /*!
2
+ * Copyright © 2025–2026 Solomei AI SRL. All rights reserved.
3
+ *
4
+ * Proprietary software, licensed for use by Callimacus customers only.
5
+ * See LICENSE.md for the full terms.
6
+ *
7
+ */
8
+ export * from '@callimacus/intent';
9
+
10
+ type AuthToken = string | undefined;
11
+ interface Auth {
12
+ /**
13
+ * Which part of the request do we use to send the auth?
14
+ *
15
+ * @default 'header'
16
+ */
17
+ in?: 'header' | 'query' | 'cookie';
18
+ /**
19
+ * A unique identifier for the security scheme.
20
+ *
21
+ * Defined only when there are multiple security schemes whose `Auth`
22
+ * shape would otherwise be identical.
23
+ */
24
+ key?: string;
25
+ /**
26
+ * Header or query parameter name.
27
+ *
28
+ * @default 'Authorization'
29
+ */
30
+ name?: string;
31
+ scheme?: 'basic' | 'bearer';
32
+ type: 'apiKey' | 'http';
33
+ }
34
+
35
+ interface SerializerOptions<T> {
36
+ /**
37
+ * @default true
38
+ */
39
+ explode: boolean;
40
+ style: T;
41
+ }
42
+ type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
43
+ type ObjectStyle = 'form' | 'deepObject';
44
+
45
+ type QuerySerializer = (query: Record<string, unknown>) => string;
46
+ type BodySerializer = (body: unknown) => unknown;
47
+ type QuerySerializerOptionsObject = {
48
+ allowReserved?: boolean;
49
+ array?: Partial<SerializerOptions<ArrayStyle>>;
50
+ object?: Partial<SerializerOptions<ObjectStyle>>;
51
+ };
52
+ type QuerySerializerOptions = QuerySerializerOptionsObject & {
53
+ /**
54
+ * Per-parameter serialization overrides. When provided, these settings
55
+ * override the global array/object settings for specific parameter names.
56
+ */
57
+ parameters?: Record<string, QuerySerializerOptionsObject>;
58
+ };
59
+
60
+ type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
61
+ type Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
62
+ /**
63
+ * Returns the final request URL.
64
+ */
65
+ buildUrl: BuildUrlFn;
66
+ getConfig: () => Config;
67
+ request: RequestFn;
68
+ setConfig: (config: Config) => Config;
69
+ } & {
70
+ [K in HttpMethod]: MethodFn;
71
+ } & ([SseFn] extends [never] ? {
72
+ sse?: never;
73
+ } : {
74
+ sse: {
75
+ [K in HttpMethod]: SseFn;
76
+ };
77
+ });
78
+ interface Config$1 {
79
+ /**
80
+ * Auth token or a function returning auth token. The resolved value will be
81
+ * added to the request payload as defined by its `security` array.
82
+ */
83
+ auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
84
+ /**
85
+ * A function for serializing request body parameter. By default,
86
+ * {@link JSON.stringify()} will be used.
87
+ */
88
+ bodySerializer?: BodySerializer | null;
89
+ /**
90
+ * An object containing any HTTP headers that you want to pre-populate your
91
+ * `Headers` object with.
92
+ *
93
+ * {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
94
+ */
95
+ headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
96
+ /**
97
+ * The request method.
98
+ *
99
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
100
+ */
101
+ method?: Uppercase<HttpMethod>;
102
+ /**
103
+ * A function for serializing request query parameters. By default, arrays
104
+ * will be exploded in form style, objects will be exploded in deepObject
105
+ * style, and reserved characters are percent-encoded.
106
+ *
107
+ * This method will have no effect if the native `paramsSerializer()` Axios
108
+ * API function is used.
109
+ *
110
+ * {@link https://swagger.io/docs/specification/serialization/#query View examples}
111
+ */
112
+ querySerializer?: QuerySerializer | QuerySerializerOptions;
113
+ /**
114
+ * A function validating request data. This is useful if you want to ensure
115
+ * the request conforms to the desired shape, so it can be safely sent to
116
+ * the server.
117
+ */
118
+ requestValidator?: (data: unknown) => Promise<unknown>;
119
+ /**
120
+ * A function transforming response data before it's returned. This is useful
121
+ * for post-processing data, e.g., converting ISO strings into Date objects.
122
+ */
123
+ responseTransformer?: (data: unknown) => Promise<unknown>;
124
+ /**
125
+ * A function validating response data. This is useful if you want to ensure
126
+ * the response conforms to the desired shape, so it can be safely passed to
127
+ * the transformers and returned to the user.
128
+ */
129
+ responseValidator?: (data: unknown) => Promise<unknown>;
130
+ }
131
+ /**
132
+ * Arbitrary metadata passed through the `meta` request option.
133
+ */
134
+ interface ClientMeta {
135
+ }
136
+
137
+ type ServerSentEventsOptions<TData = unknown> = Omit<RequestInit, 'method'> & Pick<Config$1, 'method' | 'responseTransformer' | 'responseValidator'> & {
138
+ /**
139
+ * Fetch API implementation. You can use this option to provide a custom
140
+ * fetch instance.
141
+ *
142
+ * @default globalThis.fetch
143
+ */
144
+ fetch?: typeof fetch;
145
+ /**
146
+ * Implementing clients can call request interceptors inside this hook.
147
+ */
148
+ onRequest?: (url: string, init: RequestInit) => Promise<Request>;
149
+ /**
150
+ * Callback invoked when a network or parsing error occurs during streaming.
151
+ *
152
+ * This option applies only if the endpoint returns a stream of events.
153
+ *
154
+ * @param error The error that occurred.
155
+ */
156
+ onSseError?: (error: unknown) => void;
157
+ /**
158
+ * Callback invoked when an event is streamed from the server.
159
+ *
160
+ * This option applies only if the endpoint returns a stream of events.
161
+ *
162
+ * @param event Event streamed from the server.
163
+ * @returns Nothing (void).
164
+ */
165
+ onSseEvent?: (event: StreamEvent<TData>) => void;
166
+ serializedBody?: RequestInit['body'];
167
+ /**
168
+ * Default retry delay in milliseconds.
169
+ *
170
+ * This option applies only if the endpoint returns a stream of events.
171
+ *
172
+ * @default 3000
173
+ */
174
+ sseDefaultRetryDelay?: number;
175
+ /**
176
+ * Maximum number of retry attempts before giving up.
177
+ */
178
+ sseMaxRetryAttempts?: number;
179
+ /**
180
+ * Maximum retry delay in milliseconds.
181
+ *
182
+ * Applies only when exponential backoff is used.
183
+ *
184
+ * This option applies only if the endpoint returns a stream of events.
185
+ *
186
+ * @default 30000
187
+ */
188
+ sseMaxRetryDelay?: number;
189
+ /**
190
+ * Optional sleep function for retry backoff.
191
+ *
192
+ * Defaults to using `setTimeout`.
193
+ */
194
+ sseSleepFn?: (ms: number) => Promise<void>;
195
+ url: string;
196
+ };
197
+ interface StreamEvent<TData = unknown> {
198
+ data: TData;
199
+ event?: string;
200
+ id?: string;
201
+ retry?: number;
202
+ }
203
+ type ServerSentEventsResult<TData = unknown, TReturn = void, TNext = unknown> = {
204
+ stream: AsyncGenerator<TData extends Record<string, unknown> ? TData[keyof TData] : TData, TReturn, TNext>;
205
+ };
206
+
207
+ type ErrInterceptor<Err, Res, Req, Options> = (error: Err,
208
+ /** response may be undefined due to a network error where no response object is produced */
209
+ response: Res | undefined,
210
+ /** request may be undefined, because error may be from building the request object itself */
211
+ request: Req | undefined, options: Options) => Err | Promise<Err>;
212
+ type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
213
+ type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
214
+ declare class Interceptors<Interceptor> {
215
+ fns: Array<Interceptor | null>;
216
+ clear(): void;
217
+ eject(id: number | Interceptor): void;
218
+ exists(id: number | Interceptor): boolean;
219
+ getInterceptorIndex(id: number | Interceptor): number;
220
+ update(id: number | Interceptor, fn: Interceptor): number | Interceptor | false;
221
+ use(fn: Interceptor): number;
222
+ }
223
+ interface Middleware<Req, Res, Err, Options> {
224
+ error: Interceptors<ErrInterceptor<Err, Res, Req, Options>>;
225
+ request: Interceptors<ReqInterceptor<Req, Options>>;
226
+ response: Interceptors<ResInterceptor<Res, Req, Options>>;
227
+ }
228
+
229
+ type ResponseStyle = 'data' | 'fields';
230
+ interface Config<T extends ClientOptions = ClientOptions> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
231
+ /**
232
+ * Base URL for all requests made by this client.
233
+ */
234
+ baseUrl?: T['baseUrl'];
235
+ /**
236
+ * Fetch API implementation. You can use this option to provide a custom
237
+ * fetch instance.
238
+ *
239
+ * @default globalThis.fetch
240
+ */
241
+ fetch?: typeof fetch;
242
+ /**
243
+ * Please don't use the Fetch client for Next.js applications. The `next`
244
+ * options won't have any effect.
245
+ *
246
+ * Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
247
+ */
248
+ next?: never;
249
+ /**
250
+ * Return the response data parsed in a specified format. By default, `auto`
251
+ * will infer the appropriate method from the `Content-Type` response header.
252
+ * You can override this behavior with any of the {@link Body} methods.
253
+ * Select `stream` if you don't want to parse response data at all.
254
+ *
255
+ * @default 'auto'
256
+ */
257
+ parseAs?: 'arrayBuffer' | 'auto' | 'blob' | 'formData' | 'json' | 'stream' | 'text';
258
+ /**
259
+ * Should we return only data or multiple fields (data, error, response, etc.)?
260
+ *
261
+ * @default 'fields'
262
+ */
263
+ responseStyle?: ResponseStyle;
264
+ /**
265
+ * Throw an error instead of returning it in the response?
266
+ *
267
+ * @default false
268
+ */
269
+ throwOnError?: T['throwOnError'];
270
+ }
271
+ interface RequestOptions<TData = unknown, TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
272
+ responseStyle: TResponseStyle;
273
+ throwOnError: ThrowOnError;
274
+ }>, Pick<ServerSentEventsOptions<TData>, 'onRequest' | 'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'> {
275
+ /**
276
+ * Any body that you want to add to your request.
277
+ *
278
+ * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
279
+ */
280
+ body?: unknown;
281
+ path?: Record<string, unknown>;
282
+ query?: Record<string, unknown>;
283
+ /**
284
+ * Security mechanism(s) to use for the request.
285
+ */
286
+ security?: ReadonlyArray<Auth>;
287
+ url: Url;
288
+ }
289
+ interface ResolvedRequestOptions<TResponseStyle extends ResponseStyle = 'fields', ThrowOnError extends boolean = boolean, Url extends string = string> extends RequestOptions<unknown, TResponseStyle, ThrowOnError, Url> {
290
+ headers: Headers;
291
+ serializedBody?: string;
292
+ }
293
+ type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean, TResponseStyle extends ResponseStyle = 'fields'> = ThrowOnError extends true ? Promise<TResponseStyle extends 'data' ? TData extends Record<string, unknown> ? TData[keyof TData] : TData : {
294
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
295
+ request: Request;
296
+ response: Response;
297
+ }> : Promise<TResponseStyle extends 'data' ? (TData extends Record<string, unknown> ? TData[keyof TData] : TData) | undefined : ({
298
+ data: TData extends Record<string, unknown> ? TData[keyof TData] : TData;
299
+ error: undefined;
300
+ } | {
301
+ data: undefined;
302
+ error: TError extends Record<string, unknown> ? TError[keyof TError] : TError;
303
+ }) & {
304
+ /** request may be undefined, because error may be from building the request object itself */
305
+ request?: Request;
306
+ /** response may be undefined, because error may be from building the request object itself or from a network error */
307
+ response?: Response;
308
+ }>;
309
+ interface ClientOptions {
310
+ baseUrl?: string;
311
+ responseStyle?: ResponseStyle;
312
+ throwOnError?: boolean;
313
+ }
314
+ type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
315
+ type SseFn = <TData = unknown, _TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<never, TResponseStyle, ThrowOnError>, 'method'>) => Promise<ServerSentEventsResult<TData>>;
316
+ type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false, TResponseStyle extends ResponseStyle = 'fields'>(options: Omit<RequestOptions<TData, TResponseStyle, ThrowOnError>, 'method'> & Pick<Required<RequestOptions<TData, TResponseStyle, ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError, TResponseStyle>;
317
+ type BuildUrlFn = <TData extends {
318
+ body?: unknown;
319
+ path?: Record<string, unknown>;
320
+ query?: Record<string, unknown>;
321
+ url: string;
322
+ }>(options: TData & Options$1<TData>) => string;
323
+ type Client = Client$1<RequestFn, Config, MethodFn, BuildUrlFn, SseFn> & {
324
+ interceptors: Middleware<Request, Response, unknown, ResolvedRequestOptions>;
325
+ };
326
+ interface TDataShape {
327
+ body?: unknown;
328
+ headers?: unknown;
329
+ path?: unknown;
330
+ query?: unknown;
331
+ url: string;
332
+ }
333
+ type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
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
+
336
+ type ChapterStatus$1 = 1 | 2 | 3 | 4;
337
+ type GalleryMode$1 = 'masonry' | 'carousel';
338
+ type SlInputEvent = {
339
+ type: 'question';
340
+ data: {
341
+ value: string;
342
+ /**
343
+ * Optional attachment (a browser File; travels as a socket.io binary payload).
344
+ */
345
+ file?: unknown | null;
346
+ };
347
+ } | {
348
+ type: 'content';
349
+ data: {
350
+ value: string;
351
+ };
352
+ } | {
353
+ type: 'topic';
354
+ data: {
355
+ value: string;
356
+ };
357
+ } | {
358
+ type: 'image';
359
+ data: {
360
+ value: string;
361
+ };
362
+ } | {
363
+ type: 'gallery';
364
+ data: {
365
+ value: string;
366
+ };
367
+ } | {
368
+ type: 'page';
369
+ data: {
370
+ value: string;
371
+ };
372
+ } | {
373
+ type: 'relatedQuestion';
374
+ data: {
375
+ value: string;
376
+ };
377
+ } | {
378
+ type: 'customInteraction';
379
+ data: {
380
+ payload?: {
381
+ [key: string]: unknown;
382
+ };
383
+ nodeKey?: string;
384
+ interactionId: string;
385
+ value?: string | Array<string>;
386
+ };
387
+ } | {
388
+ type: 'customPage';
389
+ data: {
390
+ value?: string;
391
+ };
392
+ };
393
+ type HomePage = {
394
+ topics: Array<{
395
+ topic: TopicSummary;
396
+ contentList: Array<SlDocumentOutput | LocalizedEpArtworkOutput>;
397
+ }>;
398
+ highlight: Array<SlDocumentOutput>;
399
+ ep: Array<LocalizedEpArtworkOutput>;
400
+ };
401
+ type TopicSummary = {
402
+ id: number;
403
+ name: string;
404
+ slug: string;
405
+ };
406
+ type PublicError = {
407
+ error: string;
408
+ };
409
+ type TopicContentsPage = {
410
+ topic: TopicSummary;
411
+ contentList: Array<SlDocumentOutput>;
412
+ totalCount: number;
413
+ offset: number;
414
+ limit: number;
415
+ };
416
+ type RecommendationsResponse = {
417
+ directRecommendations: Array<ProductMatch>;
418
+ inverseRecommendations: Array<ProductMatch>;
419
+ };
420
+ type WhisperPayload = {
421
+ session_id: string;
422
+ tenant_id: string;
423
+ website_context: string;
424
+ behavioral_intelligence: string;
425
+ summary: string;
426
+ behavior_guidance: string;
427
+ content_guidance: string;
428
+ content_focus: {
429
+ categories: Array<string>;
430
+ themes: Array<string>;
431
+ };
432
+ user_guidance: string;
433
+ block_suggestions: Array<{
434
+ component: string;
435
+ confidence: number;
436
+ rationale: string;
437
+ }>;
438
+ anchored_patterns?: Array<{
439
+ id: string;
440
+ description: string;
441
+ score: number;
442
+ }>;
443
+ session_digest: string;
444
+ assembled: string;
445
+ confidence: number;
446
+ degraded?: boolean;
447
+ suppressed?: 'no-behavioral-evidence' | 'no-grounded-guidance';
448
+ stale?: boolean;
449
+ generated_at: number;
450
+ ttl_ms: number;
451
+ };
452
+ type ProductMatch = {
453
+ match?: {
454
+ id: string;
455
+ metadata: {
456
+ c_macrocategoryacme: string;
457
+ c_microcategoryacme: string;
458
+ category: string;
459
+ description: string;
460
+ macroColor: string;
461
+ materials: string;
462
+ microColor: string;
463
+ name: string;
464
+ price: number;
465
+ sku: string;
466
+ subCategory: string;
467
+ taxonomy: string;
468
+ text: string;
469
+ type: string;
470
+ };
471
+ score: number;
472
+ values?: Array<number>;
473
+ };
474
+ product: BcProductOutput;
475
+ };
476
+ type BcProductOutput = SetProductOutput | MasterProductWithVariationGroupOutput;
477
+ type SetProductOutput = {
478
+ type: {
479
+ set: true;
480
+ };
481
+ setProducts: Array<{
482
+ id: string;
483
+ }>;
484
+ fullSetProducts?: Array<MasterProductWithVariationGroupOutput>;
485
+ imageGroups: Array<{
486
+ images: Array<{
487
+ alt?: string;
488
+ disBaseLink?: string;
489
+ url: string;
490
+ title?: string;
491
+ }>;
492
+ }>;
493
+ primaryCategoryId: string;
494
+ assignedCategories?: Array<{
495
+ categoryId: string;
496
+ }>;
497
+ id: string;
498
+ name: string;
499
+ online: boolean;
500
+ c_model: string;
501
+ c_gender: string;
502
+ c_season: string;
503
+ c_macrocategoryacme: string;
504
+ c_searchkeywords?: string;
505
+ hasHowToStyle: boolean;
506
+ };
507
+ type MasterProductWithVariationGroupOutput = MasterProductOutput & {
508
+ selectedVariationGroup: string;
509
+ };
510
+ type MasterProductOutput = {
511
+ type: {
512
+ master: true;
513
+ };
514
+ variationGroups: Array<VariationGroupOutput>;
515
+ variants: Array<VariantOutput>;
516
+ variationAttributes: Array<VariationAttributeOutput>;
517
+ 'c_material-1-percent': number;
518
+ 'c_material-2-percent': number;
519
+ 'c_material-3-percent': number;
520
+ 'c_material-4-percent': number;
521
+ 'c_material-5-percent': number;
522
+ 'c_material-6-percent': number;
523
+ 'c_material-7-percent': number;
524
+ 'c_material-8-percent': number;
525
+ 'c_material-1-desc'?: string;
526
+ 'c_material-2-desc'?: string;
527
+ 'c_material-3-desc'?: string;
528
+ c_short_description?: string;
529
+ c_microcategoryacme: string;
530
+ longDescription: string;
531
+ shortDescription: string;
532
+ 'c_made-in': string;
533
+ c_material: string;
534
+ c_saleline: string;
535
+ c_avalaraCode: string;
536
+ 'c_id-size-grid': string;
537
+ c_material_care: string;
538
+ c_weight: string;
539
+ currency: string;
540
+ c_details?: string;
541
+ productPromotions?: Array<{
542
+ calloutMsg: string;
543
+ promotionId: string;
544
+ c_formattedPrice: string;
545
+ promotionalPrice: number;
546
+ }>;
547
+ c_sku: string;
548
+ c_hscode: string;
549
+ orderable: boolean;
550
+ price: number;
551
+ priceMax?: number | null;
552
+ id: string;
553
+ name: string;
554
+ online: boolean;
555
+ c_model: string;
556
+ c_gender: string;
557
+ c_season: string;
558
+ c_macrocategoryacme: string;
559
+ c_searchkeywords?: string;
560
+ hasHowToStyle: boolean;
561
+ };
562
+ type VariationGroupOutput = {
563
+ c_sku: string;
564
+ c_pfas: string;
565
+ c_color: string;
566
+ c_model: string;
567
+ c_gender: string;
568
+ c_hscode: string;
569
+ c_season: string;
570
+ c_weight: string;
571
+ c_details?: string;
572
+ 'c_made-in': string;
573
+ productId: string;
574
+ c_material: string;
575
+ c_saleline: string;
576
+ assignedCategories?: Array<{
577
+ categoryId: string;
578
+ }>;
579
+ c_avalaraCode: string;
580
+ 'c_macro-color': string;
581
+ 'c_micro-color': string;
582
+ 'c_id-size-grid': string;
583
+ c_material_care: string;
584
+ 'c_material-1-desc'?: string;
585
+ 'c_material-2-desc'?: string;
586
+ 'c_material-3-desc'?: string;
587
+ primaryCategoryId?: string;
588
+ c_macrocategoryacme: string;
589
+ c_microcategoryacme: string;
590
+ c_short_description?: string;
591
+ 'c_material-1-percent': number;
592
+ 'c_material-2-percent': number;
593
+ 'c_material-3-percent': number;
594
+ 'c_material-4-percent': number;
595
+ 'c_material-5-percent': number;
596
+ 'c_material-6-percent': number;
597
+ 'c_material-7-percent': number;
598
+ 'c_material-8-percent': number;
599
+ productPromotions?: Array<{
600
+ calloutMsg: string;
601
+ promotionId: string;
602
+ c_formattedPrice: string;
603
+ promotionalPrice: number;
604
+ }>;
605
+ recommendations: Array<{
606
+ recommendedItemId: string;
607
+ }>;
608
+ variationValues: {
609
+ [key: string]: string;
610
+ };
611
+ imageGroups: Array<{
612
+ images: Array<{
613
+ alt?: string;
614
+ disBaseLink?: string;
615
+ url: string;
616
+ title?: string;
617
+ }>;
618
+ }>;
619
+ orderable: boolean;
620
+ online: boolean;
621
+ };
622
+ type VariantOutput = {
623
+ online: boolean;
624
+ orderable?: boolean;
625
+ price?: number;
626
+ productId: string;
627
+ c_formattedPrice?: string;
628
+ variationValues?: {
629
+ [key: string]: string;
630
+ };
631
+ productPromotions?: Array<{
632
+ calloutMsg: string;
633
+ promotionId: string;
634
+ c_formattedPrice: string;
635
+ promotionalPrice: number;
636
+ }>;
637
+ inventory?: {
638
+ ats: number;
639
+ };
640
+ };
641
+ type VariationAttributeOutput = {
642
+ id: string;
643
+ name?: string;
644
+ values?: Array<{
645
+ description?: string;
646
+ image?: {
647
+ alt?: string;
648
+ disBaseLink?: string;
649
+ url: string;
650
+ title?: string;
651
+ };
652
+ imageSwatch?: {
653
+ alt?: string;
654
+ disBaseLink?: string;
655
+ url: string;
656
+ title?: string;
657
+ };
658
+ name?: string;
659
+ orderable?: boolean;
660
+ value: string;
661
+ }>;
662
+ };
663
+ type BlockOutput = LegacyBlockOutput | CustomBlockOutput;
664
+ type ChapterOutput = {
665
+ id: string;
666
+ deleted: boolean;
667
+ language?: string;
668
+ receptors?: Array<string>;
669
+ /**
670
+ * Deprecated alias of `receptors`.
671
+ *
672
+ * @deprecated
673
+ */
674
+ intent?: Array<string>;
675
+ subCondition?: Array<string>;
676
+ inputEvent?: SlInputEventOutput;
677
+ related?: {
678
+ contentList?: Array<SlDocumentOutput>;
679
+ topicList?: Array<TopicOutput>;
680
+ relatedQuestions?: Array<string>;
681
+ };
682
+ references?: Array<string>;
683
+ blocks?: Array<BlockOutput>;
684
+ status: ChapterStatus$1;
685
+ };
686
+ type CreateRoundContextOutput = {
687
+ uiSnapshot?: {
688
+ timestamp: number;
689
+ viewport: {
690
+ width: number;
691
+ height: number;
692
+ };
693
+ elements?: Array<{
694
+ id: string;
695
+ bounds: {
696
+ x: number;
697
+ y: number;
698
+ width: number;
699
+ height: number;
700
+ top: number;
701
+ left: number;
702
+ right: number;
703
+ bottom: number;
704
+ };
705
+ isVisible?: boolean;
706
+ visibilityRatio?: number;
707
+ }>;
708
+ blockIds?: Array<string>;
709
+ };
710
+ userAgent?: string;
711
+ acceptLanguageLocale?: string;
712
+ [key: string]: unknown;
713
+ };
714
+ type CustomBlockOutput = {
715
+ id: string;
716
+ priority?: number;
717
+ metaJson?: unknown;
718
+ /**
719
+ * Custom block type, always prefixed `custom:`.
720
+ */
721
+ type: `custom:${string}`;
722
+ name?: string;
723
+ data: unknown;
724
+ };
725
+ type GalleryOutput = {
726
+ images: Array<ImageOutput>;
727
+ mode: GalleryMode$1;
728
+ };
729
+ type ImageOutput = {
730
+ type: 'image';
731
+ content?: string;
732
+ url: string;
733
+ properties: {
734
+ size: {
735
+ width: number;
736
+ height: number;
737
+ };
738
+ alt?: string;
739
+ cloudinary?: {
740
+ publicId: string;
741
+ cloudName: string;
742
+ secureDistribution: string;
743
+ [key: string]: unknown;
744
+ };
745
+ };
746
+ id?: string;
747
+ document?: string;
748
+ };
749
+ type LegacyBlockOutput = {
750
+ id: string;
751
+ priority?: number;
752
+ metaJson?: unknown;
753
+ type: 'image';
754
+ data: ImageOutput;
755
+ } | {
756
+ id: string;
757
+ priority?: number;
758
+ metaJson?: unknown;
759
+ type: 'content';
760
+ data: Array<SlDocumentOutput>;
761
+ } | {
762
+ id: string;
763
+ priority?: number;
764
+ metaJson?: unknown;
765
+ type: 'gallery';
766
+ data: GalleryOutput;
767
+ } | {
768
+ id: string;
769
+ priority?: number;
770
+ metaJson?: unknown;
771
+ type: 'video';
772
+ data: Array<VideoOutput>;
773
+ } | {
774
+ id: string;
775
+ priority?: number;
776
+ metaJson?: unknown;
777
+ type: 'topic';
778
+ data: Array<TopicOutput>;
779
+ } | {
780
+ id: string;
781
+ priority?: number;
782
+ metaJson?: unknown;
783
+ type: 'product';
784
+ data: Array<{
785
+ matches?: {
786
+ status: 'success';
787
+ tier?: 'fully' | 'partially' | 'no';
788
+ explanation?: string;
789
+ } | {
790
+ status: 'error';
791
+ };
792
+ hit: {
793
+ match?: {
794
+ id: string;
795
+ metadata: {
796
+ c_macrocategoryacme: string;
797
+ c_microcategoryacme: string;
798
+ category: string;
799
+ description: string;
800
+ macroColor: string;
801
+ materials: string;
802
+ microColor: string;
803
+ name: string;
804
+ price: number;
805
+ sku: string;
806
+ subCategory: string;
807
+ taxonomy: string;
808
+ text: string;
809
+ type: string;
810
+ };
811
+ score: number;
812
+ values?: Array<number>;
813
+ };
814
+ product: BcProductOutput;
815
+ };
816
+ }>;
817
+ } | {
818
+ id: string;
819
+ priority?: number;
820
+ metaJson?: unknown;
821
+ type: 'epicPaper';
822
+ data: Array<LocalizedEpArtworkOutput>;
823
+ } | {
824
+ id: string;
825
+ priority?: number;
826
+ metaJson?: unknown;
827
+ type: 'demosthenesResponse';
828
+ data: {
829
+ text: string;
830
+ traceId?: string;
831
+ };
832
+ };
833
+ type LocalizedEpArtworkOutput = {
834
+ id: string;
835
+ title?: string;
836
+ bookmark?: {
837
+ id: string;
838
+ text: string;
839
+ title: string;
840
+ };
841
+ chapters?: Array<{
842
+ id: string;
843
+ text: string;
844
+ title: string;
845
+ }>;
846
+ language: string;
847
+ type: 'ep';
848
+ };
849
+ type SlDocumentOutput = {
850
+ language: string;
851
+ type: 'content' | 'image' | 'video';
852
+ name: string;
853
+ backgroundKnowledge: boolean;
854
+ topic?: number;
855
+ meta?: {
856
+ title?: string;
857
+ description?: string;
858
+ url?: string;
859
+ [key: string]: string | unknown | string | undefined;
860
+ };
861
+ status?: 'draft' | 'pending_approval' | 'approved';
862
+ publishedAt?: string | null;
863
+ unpublishedAt?: string | null;
864
+ authors?: Array<string>;
865
+ source?: 'backoffice' | 'api' | 'salesforce';
866
+ slug?: string;
867
+ documentGroupId: string;
868
+ id: string;
869
+ lastUpdate: string;
870
+ sections?: Array<SlDocumentSectionOutput>;
871
+ };
872
+ type SlDocumentSectionOutput = {
873
+ id: string;
874
+ document: string;
875
+ type: 'title' | 'header' | 'text';
876
+ content: string;
877
+ properties?: {
878
+ [key: string]: unknown;
879
+ };
880
+ } | {
881
+ id: string;
882
+ document: string;
883
+ type: 'image';
884
+ content?: string;
885
+ url: string;
886
+ properties: {
887
+ size: {
888
+ width: number;
889
+ height: number;
890
+ };
891
+ alt?: string;
892
+ cloudinary?: {
893
+ publicId: string;
894
+ cloudName: string;
895
+ secureDistribution: string;
896
+ } & {
897
+ [key: string]: unknown;
898
+ };
899
+ };
900
+ } | {
901
+ id: string;
902
+ document: string;
903
+ type: 'video';
904
+ content?: string;
905
+ url: string;
906
+ properties?: {
907
+ size?: {
908
+ width: number;
909
+ height: number;
910
+ };
911
+ poster?: string;
912
+ playerConfig?: {
913
+ autoplay: boolean;
914
+ muted: boolean;
915
+ controls: boolean;
916
+ loop: boolean;
917
+ };
918
+ cloudinary?: {
919
+ publicId: string;
920
+ cloudName: string;
921
+ secureDistribution: string;
922
+ } & {
923
+ [key: string]: unknown;
924
+ };
925
+ };
926
+ } | {
927
+ id: string;
928
+ document: string;
929
+ type: 'custom';
930
+ content?: string;
931
+ typeId: string;
932
+ payload: {
933
+ [key: string]: unknown;
934
+ };
935
+ properties?: {
936
+ [key: string]: unknown;
937
+ };
938
+ };
939
+ type SlInputEventOutput = {
940
+ type: 'question';
941
+ data: {
942
+ value: string;
943
+ /**
944
+ * Optional attachment (a browser File; travels as a socket.io binary payload).
945
+ */
946
+ file?: unknown | null;
947
+ };
948
+ } | {
949
+ type: 'content';
950
+ data: {
951
+ value: string;
952
+ };
953
+ } | {
954
+ type: 'topic';
955
+ data: {
956
+ value: string;
957
+ };
958
+ } | {
959
+ type: 'image';
960
+ data: {
961
+ value: string;
962
+ };
963
+ } | {
964
+ type: 'gallery';
965
+ data: {
966
+ value: string;
967
+ };
968
+ } | {
969
+ type: 'page';
970
+ data: {
971
+ value: string;
972
+ };
973
+ } | {
974
+ type: 'relatedQuestion';
975
+ data: {
976
+ value: string;
977
+ };
978
+ } | {
979
+ type: 'customInteraction';
980
+ data: {
981
+ payload?: {
982
+ [key: string]: unknown;
983
+ };
984
+ nodeKey?: string;
985
+ interactionId: string;
986
+ value?: string | Array<string>;
987
+ };
988
+ } | {
989
+ type: 'customPage';
990
+ data: {
991
+ value?: string;
992
+ };
993
+ };
994
+ type StoryOutput = {
995
+ id: string;
996
+ language?: string;
997
+ chapters: Array<ChapterOutput>;
998
+ };
999
+ type TopicOutput = {
1000
+ id: number;
1001
+ slug: string;
1002
+ name: string;
1003
+ description: string;
1004
+ translations: {
1005
+ [key: string]: string;
1006
+ };
1007
+ };
1008
+ type VideoOutput = {
1009
+ type: 'video';
1010
+ content?: string;
1011
+ url: string;
1012
+ properties?: {
1013
+ size?: {
1014
+ width: number;
1015
+ height: number;
1016
+ };
1017
+ poster?: string;
1018
+ playerConfig?: {
1019
+ autoplay: boolean;
1020
+ muted: boolean;
1021
+ controls: boolean;
1022
+ loop: boolean;
1023
+ };
1024
+ cloudinary?: {
1025
+ publicId: string;
1026
+ cloudName: string;
1027
+ secureDistribution: string;
1028
+ [key: string]: unknown;
1029
+ };
1030
+ };
1031
+ id?: string;
1032
+ document?: string;
1033
+ };
1034
+ type ErrorMessage = {
1035
+ code: number;
1036
+ message: string;
1037
+ reason?: string;
1038
+ };
1039
+ type GenericProduct = SetProductOutput | MasterProductOutput;
1040
+ type LocalizedEpChapter = {
1041
+ id: string;
1042
+ text: string;
1043
+ title: string;
1044
+ };
1045
+ type ThamyrResponse$1 = {
1046
+ type: 'chapter-event';
1047
+ chapter: ChapterOutput;
1048
+ } | {
1049
+ type: 'story-created';
1050
+ story: StoryOutput;
1051
+ } | {
1052
+ type: 'story-shared';
1053
+ data: {
1054
+ storyId: string;
1055
+ shareId: string;
1056
+ };
1057
+ } | {
1058
+ type: 'chapter-deleted';
1059
+ data: {
1060
+ storyId: string;
1061
+ chapterId: string;
1062
+ roundId?: string;
1063
+ success: boolean;
1064
+ };
1065
+ } | {
1066
+ type: 'story-reset';
1067
+ data: {
1068
+ storyId: string;
1069
+ success: boolean;
1070
+ };
1071
+ };
1072
+ type UserInteraction$1 = {
1073
+ type: 'get-story';
1074
+ payload: {
1075
+ storyId: string;
1076
+ };
1077
+ } | {
1078
+ type: 'create-round';
1079
+ payload: {
1080
+ storyId?: string | null;
1081
+ /**
1082
+ * Language for rounds with no message of their own (a custom page or interaction). A question round detects its language from the visitor's message, and that wins.
1083
+ */
1084
+ language?: string;
1085
+ inputEvent: SlInputEventOutput;
1086
+ context?: CreateRoundContextOutput;
1087
+ };
1088
+ } | {
1089
+ type: 'reset-story';
1090
+ payload: {
1091
+ storyId: string;
1092
+ };
1093
+ } | {
1094
+ type: 'back-from-round';
1095
+ payload: {
1096
+ storyId: string;
1097
+ chapterId?: string;
1098
+ roundId?: string;
1099
+ };
1100
+ } | {
1101
+ type: 'share-story';
1102
+ payload: {
1103
+ storyId: string;
1104
+ };
1105
+ } | {
1106
+ type: 'get-shared-story';
1107
+ payload: {
1108
+ shareId: string;
1109
+ language?: string;
1110
+ };
1111
+ };
1112
+ /**
1113
+ * Document representing a basket.
1114
+ */
1115
+ type Basket = {
1116
+ /**
1117
+ * The total tax on products in the shipment, including item-level price adjustments but not
1118
+ * including service charges such as shipping. If the Discount Taxation preference is set to Tax
1119
+ * Products and Shipping Only Based on Adjusted Price, this amount also includes prorated
1120
+ * order-level price adjustments. It is read only.
1121
+ */
1122
+ adjustedMerchandizeTotalTax?: number;
1123
+ /**
1124
+ * The total tax on shipping charges in the shipment, including shipping price adjustments. It is read only.
1125
+ */
1126
+ adjustedShippingTotalTax?: number;
1127
+ /**
1128
+ * Is the basket created by an agent? It is read only.
1129
+ */
1130
+ agentBasket?: boolean;
1131
+ /**
1132
+ * The unique identifier for the basket. It is read only.
1133
+ */
1134
+ basketId: string;
1135
+ /**
1136
+ * The billing address.
1137
+ */
1138
+ billingAddress?: OrderAddress;
1139
+ /**
1140
+ * The bonus discount line items.
1141
+ */
1142
+ bonusDiscountLineItems?: Array<BonusDiscountLineItem>;
1143
+ /**
1144
+ * The sales channel. It is read only.
1145
+ */
1146
+ channelType?: 'storefront' | 'callcenter' | 'marketplace' | 'dss' | 'store' | 'pinterest' | 'twitter' | 'facebookads' | 'subscriptions' | 'onlinereservation' | 'customerservicecenter' | 'instagramcommerce' | 'tiktok' | 'snapchat' | 'google' | 'whatsapp' | 'youtube' | 'chatgpt' | 'gemini';
1147
+ /**
1148
+ * The coupon items.
1149
+ */
1150
+ couponItems?: Array<CouponItem>;
1151
+ /**
1152
+ * The timestamp when the basket was created. It is read only.
1153
+ */
1154
+ creationDate?: string;
1155
+ currency?: CurrencyCode;
1156
+ /**
1157
+ * The customer information, if the customer is logged in.
1158
+ */
1159
+ customerInfo?: CustomerInfo;
1160
+ /**
1161
+ * The gift certificate line items.
1162
+ */
1163
+ giftCertificateItems?: Array<GiftCertificateItem>;
1164
+ /**
1165
+ * Tax values that are grouped and summed based on the tax rate. The tax totals of the line items with the same
1166
+ * tax rate are grouped together and summed up. This does not affect the calculation in any way. It is read only.
1167
+ */
1168
+ groupedTaxItems?: Array<GroupedTaxItem>;
1169
+ /**
1170
+ * The expiration datetime of the inventory reservation. It is read only.
1171
+ */
1172
+ inventoryReservationExpiry?: string;
1173
+ /**
1174
+ * The timestamp when the basket was last modified. It is read only.
1175
+ */
1176
+ lastModified?: string;
1177
+ /**
1178
+ * The total products tax in the purchase currency.
1179
+ * Merchandise total price represents the sum of the product prices before
1180
+ * services (such as shipping) or adjustments from promotions have
1181
+ * been added. It is read only.
1182
+ */
1183
+ merchandizeTotalTax?: number;
1184
+ /**
1185
+ * The order-level price adjustments.
1186
+ */
1187
+ orderPriceAdjustments?: Array<PriceAdjustment>;
1188
+ /**
1189
+ * The total price, including products, shipping and tax. It is read only.
1190
+ */
1191
+ orderTotal?: number;
1192
+ /**
1193
+ * The payment instruments list.
1194
+ */
1195
+ paymentInstruments?: Array<OrderPaymentInstrument>;
1196
+ /**
1197
+ * The product items.
1198
+ */
1199
+ productItems?: Array<BasketProductItem>;
1200
+ /**
1201
+ * The total price of all products including item-level adjustments, but not including order-level adjustments or shipping
1202
+ * charges. If the taxation policy is net, it doesn't include tax. If the taxation policy is gross, it includes tax. It is read only.
1203
+ */
1204
+ productSubTotal?: number;
1205
+ /**
1206
+ * The total price of all products including adjustments, but not including shipping charges. If the taxation policy is net,
1207
+ * it doesn't include tax. If the taxation policy is gross, it includes tax. It is read only.
1208
+ */
1209
+ productTotal?: number;
1210
+ /**
1211
+ * The shipments.
1212
+ */
1213
+ shipments?: Array<Shipment>;
1214
+ /**
1215
+ * The shipping items.
1216
+ */
1217
+ shippingItems?: Array<ShippingItem>;
1218
+ /**
1219
+ * The total price of all shipping charges, including shipping adjustments. If the taxation policy is net, it doesn't
1220
+ * include tax. If the taxation policy is gross, it includes tax. It is read only.
1221
+ */
1222
+ shippingTotal?: number;
1223
+ /**
1224
+ * The total tax on all shipping charges, not including shipping adjustments. It is read only.
1225
+ */
1226
+ shippingTotalTax?: number;
1227
+ /**
1228
+ * The source code assigned to the basket. It is read only.
1229
+ */
1230
+ sourceCode?: string;
1231
+ /**
1232
+ * The total tax amount. It is read only.
1233
+ */
1234
+ taxTotal?: number;
1235
+ /**
1236
+ * The taxation policy (gross or net). It is read only.
1237
+ */
1238
+ taxation?: 'gross' | 'net';
1239
+ /**
1240
+ * If the tax is rounded at the group level, this is set to true. If the tax is rounded at the item or unit level, it is set to false.
1241
+ */
1242
+ taxRoundedAtGroup?: boolean;
1243
+ /**
1244
+ * If the created basket is a temporary basket, this is set to true. Otherwise, it is set to false.
1245
+ */
1246
+ temporaryBasket?: boolean;
1247
+ /**
1248
+ * A list of approaching discount objects for the basket. The list includes both order-level and shipping-level promotions. This field is only included when the expand query parameter contains 'approaching_discounts'.
1249
+ */
1250
+ approachingDiscounts?: Array<ApproachingDiscount>;
1251
+ [key: string]: unknown;
1252
+ };
1253
+ type SkesisSimilarResponse = {
1254
+ hits: Array<{
1255
+ id: string;
1256
+ score: number;
1257
+ item: SkesisItem;
1258
+ }>;
1259
+ };
1260
+ type SkesisRelatedResponse = {
1261
+ related: Array<{
1262
+ id: string;
1263
+ item: SkesisItem;
1264
+ }>;
1265
+ siblingColors: Array<{
1266
+ id: string;
1267
+ item: SkesisItem;
1268
+ }>;
1269
+ usedFallback: boolean;
1270
+ };
1271
+ /**
1272
+ * Document representing an order address.
1273
+ */
1274
+ type OrderAddress = {
1275
+ /**
1276
+ * The first address line.
1277
+ */
1278
+ address1?: string;
1279
+ /**
1280
+ * The second address line.
1281
+ */
1282
+ address2?: string;
1283
+ /**
1284
+ * The city.
1285
+ */
1286
+ city?: string;
1287
+ /**
1288
+ * The company name.
1289
+ */
1290
+ companyName?: string;
1291
+ countryCode?: CountryCode;
1292
+ /**
1293
+ * The first name.
1294
+ */
1295
+ firstName?: string;
1296
+ /**
1297
+ * The full name.
1298
+ */
1299
+ fullName?: string;
1300
+ /**
1301
+ * The ID of the address.
1302
+ */
1303
+ id?: string;
1304
+ /**
1305
+ * The job title.
1306
+ */
1307
+ jobTitle?: string;
1308
+ /**
1309
+ * The last name.
1310
+ */
1311
+ lastName?: string;
1312
+ /**
1313
+ * The phone number.
1314
+ */
1315
+ phone?: string;
1316
+ /**
1317
+ * The post office box.
1318
+ */
1319
+ postBox?: string;
1320
+ /**
1321
+ * The postal code.
1322
+ */
1323
+ postalCode?: string;
1324
+ /**
1325
+ * The salutation.
1326
+ */
1327
+ salutation?: string;
1328
+ /**
1329
+ * The second name.
1330
+ */
1331
+ secondName?: string;
1332
+ /**
1333
+ * The state code.
1334
+ */
1335
+ stateCode?: string;
1336
+ /**
1337
+ * The suffix.
1338
+ */
1339
+ suffix?: string;
1340
+ /**
1341
+ * The suite.
1342
+ */
1343
+ suite?: string;
1344
+ /**
1345
+ * The title.
1346
+ */
1347
+ title?: string;
1348
+ [key: string]: unknown;
1349
+ };
1350
+ /**
1351
+ * Document representing a bonus discount line item.
1352
+ */
1353
+ type BonusDiscountLineItem = {
1354
+ /**
1355
+ * The bonus products the customer can choose from.
1356
+ */
1357
+ bonusProducts?: Array<ProductDetailsLink>;
1358
+ /**
1359
+ * The coupon code that triggered the promotion, if applicable.
1360
+ */
1361
+ couponCode?: string;
1362
+ /**
1363
+ * The ID of the line item. It is read only.
1364
+ */
1365
+ id?: string;
1366
+ /**
1367
+ * The maximum number of bonus items the user can select for this promotion.
1368
+ */
1369
+ maxBonusItems?: number;
1370
+ /**
1371
+ * The ID of the promotion that triggered the creation of the line item.
1372
+ */
1373
+ promotionId?: string;
1374
+ [key: string]: unknown;
1375
+ };
1376
+ /**
1377
+ * Document representing a coupon item.
1378
+ */
1379
+ type CouponItem = {
1380
+ /**
1381
+ * The coupon code.
1382
+ */
1383
+ code: string;
1384
+ /**
1385
+ * The coupon item ID. It is read only.
1386
+ */
1387
+ couponItemId?: CouponItemId;
1388
+ /**
1389
+ * The status of the coupon item. It is read only.
1390
+ */
1391
+ statusCode?: 'coupon_code_already_in_basket' | 'coupon_code_already_redeemed' | 'coupon_code_unknown' | 'coupon_disabled' | 'redemption_limit_exceeded' | 'customer_redemption_limit_exceeded' | 'timeframe_redemption_limit_exceeded' | 'no_active_promotion' | 'coupon_already_in_basket' | 'no_applicable_promotion' | 'applied' | 'adhoc';
1392
+ /**
1393
+ * A flag indicating whether the coupon item is valid. A coupon line item is valid if
1394
+ * the status code is "applied" or "no_applicable_promotion". It is read only.
1395
+ */
1396
+ valid?: boolean;
1397
+ [key: string]: unknown;
1398
+ };
1399
+ /**
1400
+ * A three letter uppercase currency code conforming to the [ISO 4217](https://www.iso.org/iso-4217-currency-codes.html) standard, or the string `N/A` indicating that a currency is not applicable.
1401
+ */
1402
+ type CurrencyCode = string;
1403
+ /**
1404
+ * The customer information for guest or logged-in customers.
1405
+ */
1406
+ type CustomerInfo = {
1407
+ /**
1408
+ * The customer ID. It is read only.
1409
+ */
1410
+ customerId?: string;
1411
+ /**
1412
+ * The customer name.
1413
+ */
1414
+ customerName?: string;
1415
+ /**
1416
+ * The customer number.
1417
+ */
1418
+ customerNo?: string;
1419
+ /**
1420
+ * The customer's email address.
1421
+ */
1422
+ email: string;
1423
+ [key: string]: unknown;
1424
+ };
1425
+ /**
1426
+ * A gift certificate item.
1427
+ */
1428
+ type GiftCertificateItem = {
1429
+ /**
1430
+ * The gift certificate item amount.
1431
+ */
1432
+ amount: number;
1433
+ /**
1434
+ * The item ID. It is read only.
1435
+ */
1436
+ giftCertificateItemId?: GiftCertificateItemId;
1437
+ /**
1438
+ * The gift certificate message.
1439
+ */
1440
+ message?: string;
1441
+ /**
1442
+ * The recipient email.
1443
+ */
1444
+ recipientEmail: string;
1445
+ /**
1446
+ * The recipient's name.
1447
+ */
1448
+ recipientName?: string;
1449
+ /**
1450
+ * The sender's name.
1451
+ */
1452
+ senderName?: string;
1453
+ /**
1454
+ * The ID of the shipment this item belongs to.
1455
+ */
1456
+ shipmentId?: string;
1457
+ [key: string]: unknown;
1458
+ };
1459
+ /**
1460
+ * Document representing the grouped tax item.
1461
+ */
1462
+ type GroupedTaxItem = {
1463
+ /**
1464
+ * The tax rate. It is read only.
1465
+ */
1466
+ taxRate?: number;
1467
+ /**
1468
+ * The summed up tax total for the tax rate. It is read only.
1469
+ */
1470
+ taxValue?: number;
1471
+ };
1472
+ /**
1473
+ * Document representing a price adjustment within a basket or order. Price adjustments
1474
+ * can be assigned at the order, product, or shipping level.
1475
+ */
1476
+ type PriceAdjustment = {
1477
+ /**
1478
+ * Details describing the discount this price adjustment is based on. For adjustments
1479
+ * not based on a discount, this value is null.
1480
+ */
1481
+ appliedDiscount?: Discount;
1482
+ /**
1483
+ * The coupon code of the coupon this price adjustment is based on. For adjustments
1484
+ * not based on a coupon, this value is null. It is read only.
1485
+ */
1486
+ couponCode?: string;
1487
+ /**
1488
+ * The user who created the price adjustment. It is read only.
1489
+ */
1490
+ createdBy?: string;
1491
+ /**
1492
+ * The timestamp when the price adjustment was created. It is read only.
1493
+ */
1494
+ creationDate?: string;
1495
+ /**
1496
+ * A flag indicating whether this price adjustment was created by custom logic. This
1497
+ * flag is set to true unless the price adjustment was created by the promotion
1498
+ * engine.
1499
+ */
1500
+ custom?: boolean;
1501
+ /**
1502
+ * The text describing the item.
1503
+ */
1504
+ itemText?: string;
1505
+ /**
1506
+ * The timestamp when the price adjustment was last modified. It is read only.
1507
+ */
1508
+ lastModified?: string;
1509
+ /**
1510
+ * A flag indicating whether this price adjustment was created by a manual process.
1511
+ * If the price adjustment was created by the promotion engine, this value is always
1512
+ * false.
1513
+ */
1514
+ manual?: boolean;
1515
+ /**
1516
+ * The adjustment price. It is read only.
1517
+ */
1518
+ price?: number;
1519
+ /**
1520
+ * The price adjustment ID. It is read only.
1521
+ */
1522
+ priceAdjustmentId?: PriceAdjustmentId;
1523
+ /**
1524
+ * The ID of the related promotion. Custom price adjustments
1525
+ * can be assigned any promotion ID so long it is not
1526
+ * used by a price adjustment belonging to the same item,
1527
+ * and is not used by a promotion defined in the promotion engine.
1528
+ * If not specified, a promotion ID is generated.
1529
+ */
1530
+ promotionId?: string;
1531
+ /**
1532
+ * The reason for the price adjustment.
1533
+ */
1534
+ reasonCode?: string;
1535
+ [key: string]: unknown;
1536
+ };
1537
+ /**
1538
+ * Document representing an order payment instrument.
1539
+ */
1540
+ type OrderPaymentInstrument = {
1541
+ /**
1542
+ * The payment transaction amount.
1543
+ */
1544
+ amount?: number;
1545
+ /**
1546
+ * The authorization status of the payment transaction. It is read only.
1547
+ */
1548
+ authorizationStatus?: Status;
1549
+ /**
1550
+ * The bank routing number.
1551
+ */
1552
+ bankRoutingNumber?: string;
1553
+ /**
1554
+ * The gift certificate code with the last 4 characters not masked.
1555
+ */
1556
+ maskedGiftCertificateCode?: string;
1557
+ /**
1558
+ * The payment card.
1559
+ */
1560
+ paymentCard?: PaymentCard;
1561
+ /**
1562
+ * The gift card.
1563
+ */
1564
+ giftCard?: GiftCardResponse;
1565
+ /**
1566
+ * The payment instrument ID. It is read only.
1567
+ */
1568
+ paymentInstrumentId?: PaymentInstrumentId;
1569
+ /**
1570
+ * The payment method ID. It is read only.
1571
+ */
1572
+ paymentMethodId?: string;
1573
+ /**
1574
+ * Payment reference information for various payment service providers, only when Salesforce Payments is enabled.
1575
+ */
1576
+ paymentReference?: {
1577
+ /**
1578
+ * Payment reference identifier. Can be payment intent ID for Stripe, PSP reference for Adyen, PayPal order ID for PayPal, or similar identifier for other payment providers.
1579
+ */
1580
+ paymentReferenceId?: string;
1581
+ /**
1582
+ * The payment gateway used to process the payment.
1583
+ */
1584
+ gateway?: 'stripe' | 'paypal' | 'adyen';
1585
+ /**
1586
+ * The payment gateway specific properties.
1587
+ */
1588
+ gatewayProperties?: {
1589
+ /**
1590
+ * # Stripe specific properties.
1591
+ *
1592
+ * - setupFutureUsage: Indicates that you intend to make future payments with this payment method.
1593
+ * - **on_session**: The payment method is intended to be used for a future payment on the same website session.
1594
+ * - **off_session**: The payment method is intended to be used for a future payment on a different website session.
1595
+ * - **null**: The payment method is not intended to be used for a future payment.
1596
+ * - clientSecret: Secret for Stripe client-side payment confirmation. Don't store, log, or expose the client secret to anyone other than the customer, and only use it on pages where TLS is enabled.
1597
+ * - type: string
1598
+ * - maxLength: 256
1599
+ * - example: "pi_1J4K5L2eZvKYlo2CyZ8K5L6M_secret_abc123"
1600
+ *
1601
+ */
1602
+ stripe?: {
1603
+ [key: string]: unknown;
1604
+ };
1605
+ /**
1606
+ * # PayPal specific properties.
1607
+ *
1608
+ */
1609
+ paypal?: {
1610
+ [key: string]: unknown;
1611
+ };
1612
+ /**
1613
+ * # Adyen specific properties.
1614
+ *
1615
+ * - adyenError: Error information returned by Adyen if the payment fails. Null on success.
1616
+ * - adyenPaymentIntent: The Adyen payment intent object containing payment details and required actions.
1617
+ * - resultCode: The result of the payment request (for example, "REDIRECT_SHOPPER", "AUTHORISED", "PENDING", "REFUSED").
1618
+ * - accountID: The Adyen merchant account ID.
1619
+ * - adyenPaymentIntentAction: The action object for payment methods requiring additional shopper interaction.
1620
+ * - url: The URL for completing the payment (redirect or 3DS authentication).
1621
+ * - type: The action type (for example, "redirect", "threeDS2", "voucher").
1622
+ * - method: The HTTP method for the action (for example, "GET", "POST").
1623
+ * - successful: A boolean indicating whether the Adyen operation is successful.
1624
+ *
1625
+ */
1626
+ adyen?: {
1627
+ [key: string]: unknown;
1628
+ };
1629
+ };
1630
+ };
1631
+ };
1632
+ /**
1633
+ * Document representing a basket product item.
1634
+ */
1635
+ type BasketProductItem = ProductItem;
1636
+ /**
1637
+ * Document representing a shipment.
1638
+ */
1639
+ type Shipment = {
1640
+ /**
1641
+ * The total tax on products in the shipment, including item-level price adjustments but not including
1642
+ * service charges such as shipping. If the Discount Taxation preference is set to Tax Products and
1643
+ * Shipping Only Based on Adjusted Price, this amount also includes prorated order-level price adjustments. It is read only.
1644
+ */
1645
+ adjustedMerchandizeTotalTax?: number;
1646
+ /**
1647
+ * The total tax on shipping charges in the shipment, including shipping price adjustments. It is read only.
1648
+ */
1649
+ adjustedShippingTotalTax?: number;
1650
+ /**
1651
+ * The estimated delivery window for the shipment. The sfcc.app.shipping.calculate hook populates this value from the selected shipping method. The response omits this field if the hook doesn't return a delivery window. This field is reserved for future use and will be supported in an upcoming release.
1652
+ */
1653
+ deliveryWindow?: DeliveryWindow;
1654
+ /**
1655
+ * A flag indicating whether the shipment is a gift. It is read only.
1656
+ */
1657
+ gift?: boolean;
1658
+ /**
1659
+ * The gift message.
1660
+ */
1661
+ giftMessage?: string;
1662
+ /**
1663
+ * The total tax on products in the shipment, not including price adjustments or service charges such as
1664
+ * shipping. It is read only.
1665
+ */
1666
+ merchandizeTotalTax?: number;
1667
+ /**
1668
+ * The timestamp by which an order must be placed for the deliveryWindow to apply, as an RFC 3339 date-time. The sfcc.app.shipping.calculate hook populates this value from the selected shipping method. The response omits this field if the hook doesn't return a cutoff time. This field is reserved for future use and will be supported in an upcoming release.
1669
+ */
1670
+ orderCutoffAt?: string;
1671
+ /**
1672
+ * The total price of all products in the shipment, including item-level adjustments, but not including
1673
+ * order-level adjustments or shipping charges. If the taxation policy is net, it doesn't include tax. If
1674
+ * the taxation policy is gross, it includes tax. It is read only.
1675
+ */
1676
+ productSubTotal?: number;
1677
+ /**
1678
+ * The total price of all products in the shipment including item-level adjustments and prorated
1679
+ * order-level adjustments, but not including shipping charges. If the taxation policy is net, it doesn't
1680
+ * include tax. If the taxation policy is gross, it includes tax. It is read only.
1681
+ */
1682
+ productTotal?: number;
1683
+ /**
1684
+ * The order-specific ID of the shipment. The default value is 'me'.
1685
+ */
1686
+ shipmentId?: ShipmentId;
1687
+ /**
1688
+ * The shipment number of this shipment. This number is automatically generated. It is read only.
1689
+ */
1690
+ shipmentNo?: string;
1691
+ /**
1692
+ * The total price of all products in the shipment including item-level adjustments, shipping charges,
1693
+ * and tax. It is read only.
1694
+ */
1695
+ shipmentTotal?: number;
1696
+ /**
1697
+ * The shipping address.
1698
+ */
1699
+ shippingAddress?: OrderAddress;
1700
+ shippingMethod?: ShippingMethod;
1701
+ /**
1702
+ * The shipping status of the shipment.
1703
+ */
1704
+ shippingStatus?: 'not_shipped' | 'shipped';
1705
+ /**
1706
+ * The total price of all shipping charges in the shipment, including shipping adjustments. If the
1707
+ * taxation policy is net, it doesn't include tax. If the taxation policy is gross, it includes tax. It is read only.
1708
+ */
1709
+ shippingTotal?: number;
1710
+ /**
1711
+ * The total tax on shipping charges in the shipment, not including shipping price adjustments. It is read only.
1712
+ */
1713
+ shippingTotalTax?: number;
1714
+ /**
1715
+ * The total tax on the shipment, including item-level price adjustments and service charges such as
1716
+ * shipping. If the Discount Taxation preference is set to Tax Products and Shipping Only Based on
1717
+ * Adjusted Price, this amount also includes prorated order-level price adjustments. It is read only.
1718
+ */
1719
+ taxTotal?: number;
1720
+ /**
1721
+ * The tracking number of the shipment.
1722
+ */
1723
+ trackingNumber?: string;
1724
+ [key: string]: unknown;
1725
+ };
1726
+ /**
1727
+ * Document representing a shipping item.
1728
+ */
1729
+ type ShippingItem = {
1730
+ /**
1731
+ * The tax for the shipping item, including price adjustments. It is read only.
1732
+ */
1733
+ adjustedTax?: number;
1734
+ /**
1735
+ * The base price of the shipping item, which is the unit price not including adjustments.
1736
+ * If the taxation policy is net, it doesn't include tax. If the taxation policy is gross, it includes tax. It is read only.
1737
+ */
1738
+ basePrice?: number;
1739
+ /**
1740
+ * The shipping item ID. Use it to identify this shipping item when updating its quantity or creating a
1741
+ * custom price adjustment for it. It is read only.
1742
+ */
1743
+ itemId?: string;
1744
+ /**
1745
+ * The text describing the shipping item.
1746
+ */
1747
+ itemText?: string;
1748
+ /**
1749
+ * The price of the line item before applying any adjustments. If the line item is based on net pricing
1750
+ * then the net price is returned. If the line item is based on gross
1751
+ * pricing then the gross price is returned. It is read only.
1752
+ */
1753
+ price?: number;
1754
+ /**
1755
+ * The price adjustments.
1756
+ */
1757
+ priceAdjustments?: Array<PriceAdjustment>;
1758
+ /**
1759
+ * The price of the shipping item including item-level adjustments, but not including order-level
1760
+ * adjustments or shipping charges. If the taxation policy is net, it doesn't include tax.
1761
+ * If the taxation policy is gross, it includes tax. It is read only.
1762
+ */
1763
+ priceAfterItemDiscount?: number;
1764
+ /**
1765
+ * The identifier of the shipment to which this item belongs.
1766
+ */
1767
+ shipmentId?: ShipmentId;
1768
+ /**
1769
+ * The tax on the product item, not including adjustments. It is read only.
1770
+ */
1771
+ tax?: number;
1772
+ /**
1773
+ * The price used to calculate the tax for this shipping item. It is read only.
1774
+ */
1775
+ taxBasis?: number;
1776
+ /**
1777
+ * The tax class ID for the product item, or null
1778
+ * if no tax class ID is associated with the product item. It is read only.
1779
+ */
1780
+ taxClassId?: string;
1781
+ /**
1782
+ * The tax rate applicable to this product line item. For a 10% tax rate, the value is 0.1. It is read only.
1783
+ */
1784
+ taxRate?: number;
1785
+ [key: string]: unknown;
1786
+ };
1787
+ /**
1788
+ * Document representing an approaching discount for a basket. Contains information about promotions the customer is close to qualifying for.
1789
+ */
1790
+ type ApproachingDiscount = {
1791
+ /**
1792
+ * The type of approaching discount (order-level or shipping-level).
1793
+ */
1794
+ type: 'order' | 'shipping';
1795
+ /**
1796
+ * The total amount needed to receive the discount.
1797
+ */
1798
+ conditionThreshold?: number;
1799
+ /**
1800
+ * The amount the customer basket contributes towards the purchase condition.
1801
+ */
1802
+ merchandiseTotal?: number;
1803
+ /**
1804
+ * The applied discount when the order meets the threshold.
1805
+ */
1806
+ discount?: Discount;
1807
+ /**
1808
+ * Document representing a promotion link.
1809
+ */
1810
+ promotionLink?: PromotionLink;
1811
+ /**
1812
+ * The unique id of the shipment the discount relates to. Only applicable when type = shipping.
1813
+ */
1814
+ shipmentId?: string;
1815
+ /**
1816
+ * The shipping methods the promotion relates to. Only applicable when type = shipping.
1817
+ */
1818
+ shippingMethods?: Array<ShippingMethod>;
1819
+ [key: string]: unknown;
1820
+ };
1821
+ type SkesisItem = {
1822
+ id: string;
1823
+ locale: string;
1824
+ kind: string;
1825
+ fields: {
1826
+ [key: string]: unknown;
1827
+ };
1828
+ [key: string]: unknown;
1829
+ };
1830
+ /**
1831
+ * A two letter uppercase country code conforming to the [ISO 3166-1](https://www.iso.org/iso-3166-country-codes.html) alpha-2 standard.
1832
+ */
1833
+ type CountryCode = string;
1834
+ /**
1835
+ * Document representing a link to the resource for product details.
1836
+ */
1837
+ type ProductDetailsLink = {
1838
+ /**
1839
+ * The description of the product.
1840
+ */
1841
+ productDescription?: string;
1842
+ productId: ProductId;
1843
+ /**
1844
+ * The name of the product.
1845
+ */
1846
+ productName?: string;
1847
+ /**
1848
+ * The link title.
1849
+ */
1850
+ title?: string;
1851
+ };
1852
+ /**
1853
+ * The coupon item ID
1854
+ */
1855
+ type CouponItemId = string;
1856
+ type GiftCertificateItemId = string;
1857
+ /**
1858
+ * Document representing a discount.
1859
+ */
1860
+ type Discount = {
1861
+ /**
1862
+ * The discount amount for discount types that define specific discount amounts. It is read only.
1863
+ */
1864
+ amount?: number;
1865
+ /**
1866
+ * The discount percent for discount types that define percentage discounts. It is read only.
1867
+ */
1868
+ percentage?: number;
1869
+ /**
1870
+ * The price book ID that is used with some types. It is read only.
1871
+ */
1872
+ priceBookId?: string;
1873
+ /**
1874
+ * The type of discount. It is read only.
1875
+ */
1876
+ type: 'percentage' | 'fixed_price' | 'amount' | 'free' | 'price_book_price' | 'bonus' | 'total_fixed_price' | 'bonus_choice' | 'percentage_off_options';
1877
+ [key: string]: unknown;
1878
+ };
1879
+ type PriceAdjustmentId = string;
1880
+ /**
1881
+ * Document representing an object status.
1882
+ */
1883
+ type Status = {
1884
+ /**
1885
+ * The status code.
1886
+ */
1887
+ code?: string;
1888
+ /**
1889
+ * The status message.
1890
+ */
1891
+ message?: string;
1892
+ /**
1893
+ * The status.
1894
+ * For more information on the status values see Status.OK and Status.ERROR.
1895
+ */
1896
+ status?: number;
1897
+ };
1898
+ /**
1899
+ * Document representing a payment card.
1900
+ */
1901
+ type PaymentCard = {
1902
+ /**
1903
+ * The payment card type.
1904
+ */
1905
+ cardType?: string;
1906
+ /**
1907
+ * A flag indicating if the credit card is expired. It is read only.
1908
+ */
1909
+ creditCardExpired?: boolean;
1910
+ /**
1911
+ * A credit card token. If a credit card is tokenized, the token can be used to look up the credit card data
1912
+ * in the token store.
1913
+ */
1914
+ creditCardToken?: string;
1915
+ /**
1916
+ * The month when the payment card expires.
1917
+ */
1918
+ expirationMonth?: number;
1919
+ /**
1920
+ * The year when the payment card expires.
1921
+ */
1922
+ expirationYear?: number;
1923
+ /**
1924
+ * The payment card holder.
1925
+ */
1926
+ holder?: string;
1927
+ /**
1928
+ * The payment card issue number.
1929
+ */
1930
+ issueNumber?: string;
1931
+ /**
1932
+ * The masked payment card number.
1933
+ */
1934
+ maskedNumber?: string;
1935
+ /**
1936
+ * The last digits of the payment card number. It is read only.
1937
+ */
1938
+ numberLastDigits?: string;
1939
+ /**
1940
+ * The month the payment card is valid from.
1941
+ */
1942
+ validFromMonth?: number;
1943
+ /**
1944
+ * The year the payment card is valid from.
1945
+ */
1946
+ validFromYear?: number;
1947
+ };
1948
+ /**
1949
+ * Document representing a gift card response.
1950
+ */
1951
+ type GiftCardResponse = {
1952
+ /**
1953
+ * The gift card brand.
1954
+ */
1955
+ brand?: string;
1956
+ /**
1957
+ * The masked gift card number.
1958
+ */
1959
+ maskedCardNumber?: string;
1960
+ /**
1961
+ * The month when the gift card expires.
1962
+ */
1963
+ expirationMonth?: number;
1964
+ /**
1965
+ * The year when the gift card expires.
1966
+ */
1967
+ expirationYear?: number;
1968
+ };
1969
+ /**
1970
+ * The payment instrument ID
1971
+ */
1972
+ type PaymentInstrumentId = string;
1973
+ /**
1974
+ * Document representing a product item.
1975
+ */
1976
+ type ProductItem = {
1977
+ /**
1978
+ * The tax on the line item, including any adjustments. It is read only.
1979
+ */
1980
+ adjustedTax?: number;
1981
+ /**
1982
+ * The base price of the line item, which is the unit price not including
1983
+ * adjustments. If the taxation policy is net, it doesn't include tax. If the
1984
+ * taxation policy is gross, it includes tax. It is read only.
1985
+ */
1986
+ basePrice?: number;
1987
+ /**
1988
+ * The ID of the bonus discount line item this bonus product relates to. It is read only.
1989
+ */
1990
+ bonusDiscountLineItemId?: string;
1991
+ /**
1992
+ * A flag indicating whether the product item is a bonus.
1993
+ */
1994
+ bonusProductLineItem?: boolean;
1995
+ /**
1996
+ * The bundled product items.
1997
+ */
1998
+ bundledProductItems?: Array<ProductItem>;
1999
+ /**
2000
+ * Returns true if the item is a gift. It is read only.
2001
+ */
2002
+ gift?: boolean;
2003
+ /**
2004
+ * The gift message.
2005
+ */
2006
+ giftMessage?: string;
2007
+ /**
2008
+ * The inventory list ID associated with this item.
2009
+ */
2010
+ inventoryId?: string;
2011
+ /**
2012
+ * The product item ID. Use it to identify this item when updating its quantity or
2013
+ * creating a custom price adjustment for it. It is read only.
2014
+ */
2015
+ itemId?: ItemId;
2016
+ /**
2017
+ * The text describing the item.
2018
+ */
2019
+ itemText?: string;
2020
+ /**
2021
+ * The option items.
2022
+ */
2023
+ optionItems?: Array<OptionItem>;
2024
+ /**
2025
+ * The price of the line item before applying any adjustments. If the line item is based on net pricing
2026
+ * then the net price is returned. If the line item is based on gross
2027
+ * pricing then the gross price is returned. It is read only.
2028
+ */
2029
+ price?: number;
2030
+ /**
2031
+ * The price adjustments.
2032
+ */
2033
+ priceAdjustments?: Array<PriceAdjustment>;
2034
+ /**
2035
+ * The price of the product line item including item-level adjustments, but not
2036
+ * including order-level adjustments or shipping charges. If the taxation policy is
2037
+ * net, it doesn't include tax. If the taxation policy is gross, it includes tax. It is read only.
2038
+ */
2039
+ priceAfterItemDiscount?: number;
2040
+ /**
2041
+ * The price of the product line item including item-level adjustments and prorated
2042
+ * order-level adjustments, but not including shipping charges. If the taxation
2043
+ * policy is net, it doesn't include tax. If the taxation policy is gross, it
2044
+ * includes tax. It is read only.
2045
+ */
2046
+ priceAfterOrderDiscount?: number;
2047
+ /**
2048
+ * The ID of the product.
2049
+ */
2050
+ productId?: string;
2051
+ /**
2052
+ * If this product line item was added from a product list, this value is a reference
2053
+ * to the corresponding product list item.
2054
+ */
2055
+ productListItem?: ProductListItemReference;
2056
+ /**
2057
+ * The name of the product.
2058
+ */
2059
+ productName?: string;
2060
+ /**
2061
+ * Returns the id of the ProductLineItem that qualified the basket for this bonus product.
2062
+ * This method is only applicable if the product line item is a bonus product line item, and if the promotion is a
2063
+ * product promotion with number of qualifying products granting a bonus-product discount. If these conditions
2064
+ * aren't met, the method returns null. If there are multiple product line items that triggered this bonus product,
2065
+ * this method returns the last one by position within the order.
2066
+ */
2067
+ qualifyingProductItemId?: string;
2068
+ /**
2069
+ * The quantity of the products represented by this item.
2070
+ */
2071
+ quantity?: number;
2072
+ /**
2073
+ * The ID of the shipment this item belongs to.
2074
+ */
2075
+ shipmentId?: string;
2076
+ /**
2077
+ * If the product line item has a related shipping item, this value is its ID. A
2078
+ * related shipping item represents a surcharge applied to individual products using
2079
+ * a particular shipping method. It is read only.
2080
+ */
2081
+ shippingItemId?: string;
2082
+ /**
2083
+ * The tax for the product item, not including price adjustments. It is read only.
2084
+ */
2085
+ tax?: number;
2086
+ /**
2087
+ * The price used to calculate the tax for this product item. It is read only.
2088
+ */
2089
+ taxBasis?: number;
2090
+ /**
2091
+ * The tax class ID for the product item, or null
2092
+ * if no tax class ID is associated with the product item. It is read only.
2093
+ */
2094
+ taxClassId?: string;
2095
+ /**
2096
+ * The tax rate, which is the decimal tax rate to be applied
2097
+ * to the product represented by this item. It is read only.
2098
+ */
2099
+ taxRate?: number;
2100
+ [key: string]: unknown;
2101
+ };
2102
+ /**
2103
+ * The range describing when an item is expected to be delivered. Both bounds are RFC 3339 date-time timestamps. The API preserves sub-day precision end-to-end.
2104
+ */
2105
+ type DeliveryWindow = {
2106
+ /**
2107
+ * The earliest expected delivery time, as an RFC 3339 date-time.
2108
+ */
2109
+ startAt?: string;
2110
+ /**
2111
+ * The latest expected delivery time, as an RFC 3339 date-time.
2112
+ */
2113
+ endAt?: string;
2114
+ };
2115
+ /**
2116
+ * The identifier of the shipment
2117
+ */
2118
+ type ShipmentId = string;
2119
+ /**
2120
+ * Document representing a shipping method.
2121
+ */
2122
+ type ShippingMethod = {
2123
+ /**
2124
+ * The estimated delivery window for this shipping method. The sfcc.app.shipping.quote hook populates this value. The response omits this field if the hook doesn't return a delivery window.
2125
+ */
2126
+ deliveryWindow?: DeliveryWindow;
2127
+ /**
2128
+ * The localized description of the shipping method.
2129
+ */
2130
+ description?: string;
2131
+ /**
2132
+ * The external shipping method.
2133
+ */
2134
+ externalShippingMethod?: string;
2135
+ /**
2136
+ * The shipping method ID.
2137
+ */
2138
+ id: string;
2139
+ /**
2140
+ * The localized name of the shipping method.
2141
+ */
2142
+ name?: string;
2143
+ /**
2144
+ * The timestamp by which an order must be placed for the deliveryWindow to apply, as an RFC 3339 date-time. The sfcc.app.shipping.quote hook populates this value. The response omits this field if the hook doesn't return a cutoff time.
2145
+ */
2146
+ orderCutoffAt?: string;
2147
+ /**
2148
+ * The shipping cost total, including shipment level costs,
2149
+ * product level fix, and surcharge costs. It is read only.
2150
+ */
2151
+ price?: number;
2152
+ /**
2153
+ * The array of active customer shipping promotions for this shipping
2154
+ * method. This array can be empty.
2155
+ */
2156
+ shippingPromotions?: Array<ShippingPromotion>;
2157
+ [key: string]: unknown;
2158
+ };
2159
+ /**
2160
+ * Document representing a promotion link.
2161
+ */
2162
+ type PromotionLink = {
2163
+ /**
2164
+ * The unique id of the promotion.
2165
+ */
2166
+ promotionId?: string;
2167
+ /**
2168
+ * The localized name of the promotion.
2169
+ */
2170
+ name?: string;
2171
+ /**
2172
+ * The localized call-out message of the promotion.
2173
+ */
2174
+ calloutMsg?: string;
2175
+ /**
2176
+ * The link title.
2177
+ */
2178
+ title?: string;
2179
+ /**
2180
+ * The URL addressing the promotion.
2181
+ */
2182
+ link?: string;
2183
+ [key: string]: unknown;
2184
+ };
2185
+ /**
2186
+ * The id (SKU) of the product.
2187
+ */
2188
+ type ProductId = string;
2189
+ /**
2190
+ * The item id.
2191
+ */
2192
+ type ItemId = string;
2193
+ /**
2194
+ * An option item represents an optional purchase related to a product item, and is always associated with that parent product
2195
+ * item. An option item can have different values from which to select. For example, a refrigerator item can have an option item representing an extended warranty, with a set of option item values representing different warranty lengths. When a shopper purchases the warranty option item together with the parent refrigerator item, they select one of the available warranty option item values.
2196
+ */
2197
+ type OptionItem = {
2198
+ /**
2199
+ * The tax on the line item, including any adjustments. It is read only.
2200
+ */
2201
+ adjustedTax?: number;
2202
+ /**
2203
+ * The base price of the line item, which is the unit price not including adjustments.
2204
+ * If the taxation policy is net, it doesn't include tax. If the taxation policy is gross, it includes tax. It is read only.
2205
+ */
2206
+ basePrice?: number;
2207
+ /**
2208
+ * The ID of the bonus discount line item this bonus product relates to. It is read only.
2209
+ */
2210
+ bonusDiscountLineItemId?: string;
2211
+ /**
2212
+ * A flag indicating whether the product item is a bonus. It is read only.
2213
+ */
2214
+ bonusProductLineItem?: boolean;
2215
+ /**
2216
+ * The bundled product items.
2217
+ */
2218
+ bundledProductItems?: Array<ProductItem>;
2219
+ /**
2220
+ * Returns true if the item is a gift. It is read only.
2221
+ */
2222
+ gift?: boolean;
2223
+ /**
2224
+ * The gift message.
2225
+ */
2226
+ giftMessage?: string;
2227
+ /**
2228
+ * The inventory list ID associated with this item. It is read only.
2229
+ */
2230
+ inventoryId?: string;
2231
+ /**
2232
+ * The product item ID. Use it to identify this item when updating its quantity or creating a custom price adjustment for it. It is read only.
2233
+ */
2234
+ itemId?: ItemId;
2235
+ /**
2236
+ * The text describing the item.
2237
+ */
2238
+ itemText?: string;
2239
+ /**
2240
+ * The ID of the option. It is read only.
2241
+ */
2242
+ optionId: string;
2243
+ /**
2244
+ * The option items.
2245
+ */
2246
+ optionItems?: Array<OptionItem>;
2247
+ /**
2248
+ * The ID of the option value. It is read only.
2249
+ */
2250
+ optionValueId: string;
2251
+ /**
2252
+ * The price of the line item before applying any adjustments. If the taxation policy is net, it doesn't include tax.
2253
+ * If the taxation policy is gross, it includes tax. It is read only.
2254
+ */
2255
+ price?: number;
2256
+ /**
2257
+ * The price adjustments.
2258
+ */
2259
+ priceAdjustments?: Array<PriceAdjustment>;
2260
+ /**
2261
+ * The price of the product line item including item-level adjustments, but not including order-level adjustments or
2262
+ * shipping charges. If the taxation policy is net, it doesn't include tax. If the taxation policy is gross, it includes tax. It is read only.
2263
+ */
2264
+ priceAfterItemDiscount?: number;
2265
+ /**
2266
+ * The price of the product line item including item-level adjustments and prorated order-level adjustments, but not
2267
+ * including shipping charges. If the taxation policy is net, it doesn't include tax. If the taxation policy is gross, it
2268
+ * includes tax. It is read only.
2269
+ */
2270
+ priceAfterOrderDiscount?: number;
2271
+ productId?: ProductId;
2272
+ /**
2273
+ * If this product line item was added from a product list, this value is a reference to the corresponding product list item.
2274
+ */
2275
+ productListItem?: ProductListItemReference;
2276
+ /**
2277
+ * The name of the product.
2278
+ */
2279
+ productName?: string;
2280
+ /**
2281
+ * The ordered quantity of the products represented by this item.
2282
+ */
2283
+ quantity?: number;
2284
+ /**
2285
+ * The ID of the shipment this item belongs to.
2286
+ */
2287
+ shipmentId?: string;
2288
+ /**
2289
+ * If the product line item has a related shipping item, this value is its ID. A related shipping item represents a
2290
+ * surcharge applied to individual products using a particular shipping method. It is read only.
2291
+ */
2292
+ shippingItemId?: string;
2293
+ /**
2294
+ * The tax on the line item before applying any adjustments. It is read only.
2295
+ */
2296
+ tax?: number;
2297
+ /**
2298
+ * The amount used to calculate the tax for this item. It is read only.
2299
+ */
2300
+ taxBasis?: number;
2301
+ /**
2302
+ * The tax class ID for the product item, or null
2303
+ * if no tax class ID is associated with the product item. It is read only.
2304
+ */
2305
+ taxClassId?: string;
2306
+ /**
2307
+ * The tax rate, which is the decimal tax rate to be applied
2308
+ * to the product represented by this item. It is read only.
2309
+ */
2310
+ taxRate?: number;
2311
+ [key: string]: unknown;
2312
+ };
2313
+ /**
2314
+ * Document representing product list item details.
2315
+ */
2316
+ type ProductListItemReference = {
2317
+ /**
2318
+ * The ID of the product list item. It is read only.
2319
+ */
2320
+ id: ItemId;
2321
+ /**
2322
+ * The priority of the product list item.
2323
+ */
2324
+ priority?: number;
2325
+ productDetailsLink?: ProductDetailsLink;
2326
+ /**
2327
+ * A reference to the associated product list. It is read only.
2328
+ */
2329
+ productList?: ProductListLink;
2330
+ public?: boolean;
2331
+ /**
2332
+ * The total quantity of this item purchased from the product list.
2333
+ */
2334
+ purchasedQuantity?: number;
2335
+ /**
2336
+ * The number of products or gift certificates that get shipped when purchasing this product list item.
2337
+ */
2338
+ quantity?: number;
2339
+ /**
2340
+ * Specifies whether the item is a product or a gift certificate.
2341
+ */
2342
+ type?: 'product' | 'gift_certificate';
2343
+ };
2344
+ /**
2345
+ * Document representing a shipping promotion.
2346
+ */
2347
+ type ShippingPromotion = {
2348
+ /**
2349
+ * The localized callout message of the promotion.
2350
+ */
2351
+ calloutMsg?: string;
2352
+ /**
2353
+ * The unique ID of the promotion.
2354
+ */
2355
+ promotionId?: string;
2356
+ /**
2357
+ * The localized promotion name.
2358
+ */
2359
+ promotionName?: string;
2360
+ [key: string]: unknown;
2361
+ };
2362
+ /**
2363
+ * Document representing a link to a product list.
2364
+ */
2365
+ type ProductListLink = {
2366
+ /**
2367
+ * The description of this product list.
2368
+ */
2369
+ description?: string;
2370
+ /**
2371
+ * The name of this product list.
2372
+ */
2373
+ name?: string;
2374
+ /**
2375
+ * A flag indicating whether the owner made this product list available for access
2376
+ * by other customers. It is read only.
2377
+ */
2378
+ public?: boolean;
2379
+ /**
2380
+ * The link title.
2381
+ */
2382
+ title?: string;
2383
+ /**
2384
+ * The type of the product list.
2385
+ */
2386
+ type?: 'wish_list' | 'gift_registry' | 'shopping_list' | 'custom_1' | 'custom_2' | 'custom_3';
2387
+ };
2388
+ type ContentGetPageErrors = {
2389
+ /**
2390
+ * Validation error
2391
+ */
2392
+ 400: unknown;
2393
+ /**
2394
+ * Missing or invalid access token
2395
+ */
2396
+ 401: unknown;
2397
+ /**
2398
+ * Unknown page id (only `home` exists)
2399
+ */
2400
+ 404: PublicError;
2401
+ };
2402
+ type ContentGetPageResponses = {
2403
+ /**
2404
+ * Success
2405
+ */
2406
+ 200: HomePage;
2407
+ };
2408
+ type ContentListTopicsErrors = {
2409
+ /**
2410
+ * Validation error
2411
+ */
2412
+ 400: unknown;
2413
+ /**
2414
+ * Missing or invalid access token
2415
+ */
2416
+ 401: unknown;
2417
+ };
2418
+ type ContentListTopicsResponses = {
2419
+ /**
2420
+ * Success
2421
+ */
2422
+ 200: Array<TopicSummary>;
2423
+ };
2424
+ type ContentGetTopicContentsErrors = {
2425
+ /**
2426
+ * Validation error
2427
+ */
2428
+ 400: unknown;
2429
+ /**
2430
+ * Missing or invalid access token
2431
+ */
2432
+ 401: unknown;
2433
+ /**
2434
+ * No topic matches idOrSlug
2435
+ */
2436
+ 404: PublicError;
2437
+ };
2438
+ type ContentGetTopicContentsResponses = {
2439
+ /**
2440
+ * Success
2441
+ */
2442
+ 200: TopicContentsPage;
2443
+ };
2444
+ type ContentGetDocumentBySlugErrors = {
2445
+ /**
2446
+ * Validation error
2447
+ */
2448
+ 400: unknown;
2449
+ /**
2450
+ * Missing or invalid access token
2451
+ */
2452
+ 401: unknown;
2453
+ /**
2454
+ * No published document with this slug
2455
+ */
2456
+ 404: PublicError;
2457
+ };
2458
+ type ContentGetDocumentBySlugResponses = {
2459
+ /**
2460
+ * Success
2461
+ */
2462
+ 200: SlDocumentOutput;
2463
+ };
2464
+ type ContentGetDocumentByGroupErrors = {
2465
+ /**
2466
+ * Validation error
2467
+ */
2468
+ 400: unknown;
2469
+ /**
2470
+ * Missing or invalid access token
2471
+ */
2472
+ 401: unknown;
2473
+ /**
2474
+ * No published document in this group
2475
+ */
2476
+ 404: PublicError;
2477
+ };
2478
+ type ContentGetDocumentByGroupResponses = {
2479
+ /**
2480
+ * Success
2481
+ */
2482
+ 200: SlDocumentOutput;
2483
+ };
2484
+ type ContentGetDocumentByPathErrors = {
2485
+ /**
2486
+ * Validation error
2487
+ */
2488
+ 400: unknown;
2489
+ /**
2490
+ * Missing or invalid access token
2491
+ */
2492
+ 401: unknown;
2493
+ /**
2494
+ * Path did not resolve to a published document
2495
+ */
2496
+ 404: PublicError;
2497
+ };
2498
+ type ContentGetDocumentByPathResponses = {
2499
+ /**
2500
+ * Success
2501
+ */
2502
+ 200: SlDocumentOutput;
2503
+ };
2504
+ type StoriesGetSharedErrors = {
2505
+ /**
2506
+ * Validation error
2507
+ */
2508
+ 400: unknown;
2509
+ /**
2510
+ * Missing or invalid access token
2511
+ */
2512
+ 401: unknown;
2513
+ /**
2514
+ * Share not found
2515
+ */
2516
+ 404: PublicError;
2517
+ };
2518
+ type StoriesGetSharedResponses = {
2519
+ /**
2520
+ * Success
2521
+ */
2522
+ 200: StoryOutput;
2523
+ };
2524
+ type StoriesShareErrors = {
2525
+ /**
2526
+ * Validation error
2527
+ */
2528
+ 400: unknown;
2529
+ /**
2530
+ * Missing or invalid access token
2531
+ */
2532
+ 401: unknown;
2533
+ /**
2534
+ * Story not found
2535
+ */
2536
+ 404: PublicError;
2537
+ };
2538
+ type StoriesShareResponses = {
2539
+ /**
2540
+ * Success
2541
+ */
2542
+ 200: {
2543
+ id: string;
2544
+ };
2545
+ };
2546
+ type ProductsGetSimilarErrors = {
2547
+ /**
2548
+ * Validation error
2549
+ */
2550
+ 400: unknown;
2551
+ /**
2552
+ * Missing or invalid access token
2553
+ */
2554
+ 401: unknown;
2555
+ /**
2556
+ * Product not found or similar products unavailable
2557
+ */
2558
+ 404: PublicError;
2559
+ };
2560
+ type ProductsGetSimilarResponses = {
2561
+ /**
2562
+ * Success
2563
+ */
2564
+ 200: Array<ProductMatch>;
2565
+ };
2566
+ type ProductsGetRecommendationsErrors = {
2567
+ /**
2568
+ * Validation error
2569
+ */
2570
+ 400: unknown;
2571
+ /**
2572
+ * Missing or invalid access token
2573
+ */
2574
+ 401: unknown;
2575
+ /**
2576
+ * Product not found or recommendations unavailable
2577
+ */
2578
+ 404: PublicError;
2579
+ };
2580
+ type ProductsGetRecommendationsResponses = {
2581
+ /**
2582
+ * Success
2583
+ */
2584
+ 200: RecommendationsResponse;
2585
+ };
2586
+ type WhisperGetLastErrors = {
2587
+ /**
2588
+ * Validation error
2589
+ */
2590
+ 400: unknown;
2591
+ /**
2592
+ * Missing or invalid access token
2593
+ */
2594
+ 401: unknown;
2595
+ /**
2596
+ * Whisper preview is not enabled for this tenant
2597
+ */
2598
+ 403: PublicError;
2599
+ /**
2600
+ * No whisper for this session yet
2601
+ */
2602
+ 404: PublicError;
2603
+ };
2604
+ type WhisperGetLastResponses = {
2605
+ /**
2606
+ * Success
2607
+ */
2608
+ 200: {
2609
+ whisper: WhisperPayload;
2610
+ };
2611
+ };
2612
+ type AnalyticsTrackEventErrors = {
2613
+ /**
2614
+ * Validation error
2615
+ */
2616
+ 400: unknown;
2617
+ /**
2618
+ * Missing or invalid access token
2619
+ */
2620
+ 401: unknown;
2621
+ };
2622
+ type AnalyticsTrackEventResponses = {
2623
+ /**
2624
+ * No content
2625
+ */
2626
+ 204: void;
2627
+ };
2628
+ type CartGetCartErrors = {
2629
+ /**
2630
+ * Validation error
2631
+ */
2632
+ 400: unknown;
2633
+ /**
2634
+ * No Salesforce shopper session could be resolved (typically a tenant without SFCC integration).
2635
+ */
2636
+ 401: PublicError;
2637
+ };
2638
+ type CartGetCartResponses = {
2639
+ /**
2640
+ * Success
2641
+ */
2642
+ 200: Basket;
2643
+ };
2644
+ type CartAddItemToCartErrors = {
2645
+ /**
2646
+ * Validation error
2647
+ */
2648
+ 400: unknown;
2649
+ /**
2650
+ * No Salesforce shopper session could be resolved (typically a tenant without SFCC integration).
2651
+ */
2652
+ 401: PublicError;
2653
+ };
2654
+ type CartAddItemToCartResponses = {
2655
+ /**
2656
+ * Success
2657
+ */
2658
+ 200: Basket;
2659
+ };
2660
+ type CartRemoveItemFromCartErrors = {
2661
+ /**
2662
+ * Validation error
2663
+ */
2664
+ 400: unknown;
2665
+ /**
2666
+ * No Salesforce shopper session could be resolved (typically a tenant without SFCC integration).
2667
+ */
2668
+ 401: PublicError;
2669
+ };
2670
+ type CartRemoveItemFromCartResponses = {
2671
+ /**
2672
+ * Success
2673
+ */
2674
+ 200: Basket;
2675
+ };
2676
+ type CartUpdateProductQuantityErrors = {
2677
+ /**
2678
+ * Validation error
2679
+ */
2680
+ 400: unknown;
2681
+ /**
2682
+ * No Salesforce shopper session could be resolved (typically a tenant without SFCC integration).
2683
+ */
2684
+ 401: PublicError;
2685
+ };
2686
+ type CartUpdateProductQuantityResponses = {
2687
+ /**
2688
+ * Success
2689
+ */
2690
+ 200: Basket;
2691
+ };
2692
+ type SkesisSimilarErrors = {
2693
+ /**
2694
+ * Validation error
2695
+ */
2696
+ 400: unknown;
2697
+ /**
2698
+ * Missing or invalid access token
2699
+ */
2700
+ 401: unknown;
2701
+ /**
2702
+ * Skesis engine unavailable (rate cap, upstream failure, or not configured); retry later
2703
+ */
2704
+ 502: {
2705
+ error: string;
2706
+ errorId: string;
2707
+ };
2708
+ };
2709
+ type SkesisSimilarResponses = {
2710
+ /**
2711
+ * Success
2712
+ */
2713
+ 200: SkesisSimilarResponse;
2714
+ };
2715
+ type SkesisRelatedErrors = {
2716
+ /**
2717
+ * Validation error
2718
+ */
2719
+ 400: unknown;
2720
+ /**
2721
+ * Missing or invalid access token
2722
+ */
2723
+ 401: unknown;
2724
+ /**
2725
+ * Skesis engine unavailable (rate cap, upstream failure, or not configured); retry later
2726
+ */
2727
+ 502: {
2728
+ error: string;
2729
+ errorId: string;
2730
+ };
2731
+ };
2732
+ type SkesisRelatedResponses = {
2733
+ /**
2734
+ * Success
2735
+ */
2736
+ 200: SkesisRelatedResponse;
2737
+ };
2738
+
2739
+ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options$1<TData, ThrowOnError, TResponse> & {
2740
+ /**
2741
+ * You can provide a client instance returned by `createClient()` instead of
2742
+ * individual options. This might be also useful if you want to implement a
2743
+ * custom client.
2744
+ */
2745
+ client?: Client;
2746
+ /**
2747
+ * You can pass arbitrary values through the `meta` object. This can be
2748
+ * used to access values that aren't defined as part of the SDK function.
2749
+ */
2750
+ meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
2751
+ };
2752
+ declare class HeyApiClient {
2753
+ protected client: Client;
2754
+ constructor(args: {
2755
+ client: Client;
2756
+ });
2757
+ }
2758
+ declare class HeyApiRegistry<T> {
2759
+ private readonly defaultKey;
2760
+ private readonly instances;
2761
+ get(key?: string): T;
2762
+ set(value: T, key?: string): void;
2763
+ }
2764
+ declare class Content extends HeyApiClient {
2765
+ /**
2766
+ * Get a composed page
2767
+ *
2768
+ * The only page id today is `home`; any other id is a 404.
2769
+ */
2770
+ getPage<ThrowOnError extends boolean = false>(parameters: {
2771
+ language: string;
2772
+ id: string;
2773
+ }, options?: Options<never, ThrowOnError>): RequestResult<ContentGetPageResponses, ContentGetPageErrors, ThrowOnError>;
2774
+ /**
2775
+ * List topics
2776
+ *
2777
+ * Every topic of the tenant as a localized summary (name resolved to the requested language). Empty array when none exist.
2778
+ */
2779
+ listTopics<ThrowOnError extends boolean = false>(parameters: {
2780
+ language: string;
2781
+ }, options?: Options<never, ThrowOnError>): RequestResult<ContentListTopicsResponses, ContentListTopicsErrors, ThrowOnError>;
2782
+ /**
2783
+ * Get a topic with its published contents
2784
+ *
2785
+ * Resolves `idOrSlug` as the numeric topic id when it is all digits, as the slug otherwise. Contents are publication-window and approval filtered, ordered by publishedAt DESC; media URLs are public CDN URLs.
2786
+ */
2787
+ getTopicContents<ThrowOnError extends boolean = false>(parameters: {
2788
+ language: string;
2789
+ idOrSlug: string;
2790
+ offset?: number;
2791
+ limit?: number;
2792
+ }, options?: Options<never, ThrowOnError>): RequestResult<ContentGetTopicContentsResponses, ContentGetTopicContentsErrors, ThrowOnError>;
2793
+ /**
2794
+ * Get a published document by slug
2795
+ */
2796
+ getDocumentBySlug<ThrowOnError extends boolean = false>(parameters: {
2797
+ language: string;
2798
+ slug: string;
2799
+ }, options?: Options<never, ThrowOnError>): RequestResult<ContentGetDocumentBySlugResponses, ContentGetDocumentBySlugErrors, ThrowOnError>;
2800
+ /**
2801
+ * Get a published document by its document group
2802
+ */
2803
+ getDocumentByGroup<ThrowOnError extends boolean = false>(parameters: {
2804
+ language: string;
2805
+ groupId: string;
2806
+ }, options?: Options<never, ThrowOnError>): RequestResult<ContentGetDocumentByGroupResponses, ContentGetDocumentByGroupErrors, ThrowOnError>;
2807
+ /**
2808
+ * Get a published document by sitemap path
2809
+ *
2810
+ * Accepts the `/map/{language}/{slug}` paths emitted in the sitemap (leading slash optional; the slug may contain slashes). A path that does not match that shape is a 404, not a 400.
2811
+ */
2812
+ getDocumentByPath<ThrowOnError extends boolean = false>(parameters: {
2813
+ path: string;
2814
+ }, options?: Options<never, ThrowOnError>): RequestResult<ContentGetDocumentByPathResponses, ContentGetDocumentByPathErrors, ThrowOnError>;
2815
+ }
2816
+ declare class Stories extends HeyApiClient {
2817
+ /**
2818
+ * Open a shared story
2819
+ *
2820
+ * Materializes a FRESH copy of the shared story (new story and chapter ids on every call — this read writes). `language` may be absent; content blocks are rehydrated with full documents where their ids still resolve.
2821
+ */
2822
+ getShared<ThrowOnError extends boolean = false>(parameters: {
2823
+ id: string;
2824
+ }, options?: Options<never, ThrowOnError>): RequestResult<StoriesGetSharedResponses, StoriesGetSharedErrors, ThrowOnError>;
2825
+ /**
2826
+ * Share a story
2827
+ *
2828
+ * Snapshots the story identified by `id` and returns the share id. No request body.
2829
+ */
2830
+ share<ThrowOnError extends boolean = false>(parameters: {
2831
+ id: string;
2832
+ }, options?: Options<never, ThrowOnError>): RequestResult<StoriesShareResponses, StoriesShareErrors, ThrowOnError>;
2833
+ }
2834
+ declare class Products extends HeyApiClient {
2835
+ /**
2836
+ * Similar products
2837
+ *
2838
+ * Superseded by skesis.similar (/skesis/query/similar). Kept for the whole of thamyr 4.x; removed only after a skesis read that returns product payloads exists, in a major announced ahead of time.
2839
+ *
2840
+ * @deprecated
2841
+ */
2842
+ getSimilar<ThrowOnError extends boolean = false>(parameters: {
2843
+ productId: string;
2844
+ topK?: number;
2845
+ language?: string;
2846
+ }, options?: Options<never, ThrowOnError>): RequestResult<ProductsGetSimilarResponses, ProductsGetSimilarErrors, ThrowOnError>;
2847
+ /**
2848
+ * Product recommendations
2849
+ *
2850
+ * Superseded by skesis.related (/skesis/query/related). Kept for the whole of thamyr 4.x; removed only after a skesis read that returns product payloads exists, in a major announced ahead of time.
2851
+ *
2852
+ * @deprecated
2853
+ */
2854
+ getRecommendations<ThrowOnError extends boolean = false>(parameters: {
2855
+ productId: string;
2856
+ language?: string;
2857
+ }, options?: Options<never, ThrowOnError>): RequestResult<ProductsGetRecommendationsResponses, ProductsGetRecommendationsErrors, ThrowOnError>;
2858
+ }
2859
+ declare class Whisper extends HeyApiClient {
2860
+ /**
2861
+ * Last whisper for a story
2862
+ */
2863
+ getLast<ThrowOnError extends boolean = false>(parameters: {
2864
+ storyId: string;
2865
+ }, options?: Options<never, ThrowOnError>): RequestResult<WhisperGetLastResponses, WhisperGetLastErrors, ThrowOnError>;
2866
+ }
2867
+ declare class Analytics extends HeyApiClient {
2868
+ /**
2869
+ * Record a custom analytics event
2870
+ *
2871
+ * Fire-and-forget: always 204 on a valid body (dev-origin requests are dropped without insert).
2872
+ */
2873
+ trackEvent<ThrowOnError extends boolean = false>(parameters: {
2874
+ storyId: string;
2875
+ eventName: string;
2876
+ content?: string;
2877
+ payload?: {
2878
+ [key: string]: string | number | boolean;
2879
+ };
2880
+ }, options?: Options<never, ThrowOnError>): RequestResult<AnalyticsTrackEventResponses, AnalyticsTrackEventErrors, ThrowOnError>;
2881
+ }
2882
+ declare class Cart extends HeyApiClient {
2883
+ /**
2884
+ * Current cart
2885
+ *
2886
+ * The shopper's current basket, created on first access. The shopper locale is derived from the Referer header.
2887
+ */
2888
+ getCart<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): RequestResult<CartGetCartResponses, CartGetCartErrors, ThrowOnError>;
2889
+ /**
2890
+ * Add a product to the cart
2891
+ *
2892
+ * Adds one unit of the given product (variant) to the current basket and returns the updated basket.
2893
+ */
2894
+ addItemToCart<ThrowOnError extends boolean = false>(parameters: {
2895
+ productId: string;
2896
+ }, options?: Options<never, ThrowOnError>): RequestResult<CartAddItemToCartResponses, CartAddItemToCartErrors, ThrowOnError>;
2897
+ /**
2898
+ * Remove a product from the cart
2899
+ *
2900
+ * Removes the line item holding the given product (variant) from the current basket and returns the updated basket.
2901
+ */
2902
+ removeItemFromCart<ThrowOnError extends boolean = false>(parameters: {
2903
+ productId: string;
2904
+ }, options?: Options<never, ThrowOnError>): RequestResult<CartRemoveItemFromCartResponses, CartRemoveItemFromCartErrors, ThrowOnError>;
2905
+ /**
2906
+ * Update a product's quantity in the cart
2907
+ *
2908
+ * Sets the quantity of the line item holding the given product (variant) and returns the updated basket.
2909
+ */
2910
+ updateProductQuantity<ThrowOnError extends boolean = false>(parameters: {
2911
+ productId: string;
2912
+ quantity: number;
2913
+ }, options?: Options<never, ThrowOnError>): RequestResult<CartUpdateProductQuantityResponses, CartUpdateProductQuantityErrors, ThrowOnError>;
2914
+ }
2915
+ declare class Skesis extends HeyApiClient {
2916
+ /**
2917
+ * Similar items
2918
+ *
2919
+ * Vector neighbours of an item ("more like this"). `anchorId` is the full skesis item id, e.g. `sfcc:product:123`. `locale` defaults to the storefront locale derived from the Referer.
2920
+ */
2921
+ similar<ThrowOnError extends boolean = false>(parameters: {
2922
+ anchorId: string;
2923
+ topK?: number;
2924
+ locale?: string;
2925
+ }, options?: Options<never, ThrowOnError>): RequestResult<SkesisSimilarResponses, SkesisSimilarErrors, ThrowOnError>;
2926
+ /**
2927
+ * Related items
2928
+ *
2929
+ * Graph-related items plus the sibling colour variants of an item. When the anchor itself has no edges, the engine falls back to the nearest vector neighbour's edge set (`usedFallback: true`). `locale` defaults to the storefront locale derived from the Referer.
2930
+ */
2931
+ related<ThrowOnError extends boolean = false>(parameters: {
2932
+ anchorId: string;
2933
+ locale?: string;
2934
+ }, options?: Options<never, ThrowOnError>): RequestResult<SkesisRelatedResponses, SkesisRelatedErrors, ThrowOnError>;
2935
+ }
2936
+ declare class CallimacusApi extends HeyApiClient {
2937
+ static readonly __registry: HeyApiRegistry<CallimacusApi>;
2938
+ constructor(args: {
2939
+ client: Client;
2940
+ key?: string;
2941
+ });
2942
+ private _content?;
2943
+ get content(): Content;
2944
+ private _stories?;
2945
+ get stories(): Stories;
2946
+ private _products?;
2947
+ get products(): Products;
2948
+ private _whisper?;
2949
+ get whisper(): Whisper;
2950
+ private _analytics?;
2951
+ get analytics(): Analytics;
2952
+ private _cart?;
2953
+ get cart(): Cart;
2954
+ private _skesis?;
2955
+ get skesis(): Skesis;
2956
+ }
2957
+
2958
+ /**
2959
+ The wire types of the public API contract, re-exported from ./generated/
2960
+ under their published names, plus the protocol constants and guards the spec
2961
+ cannot carry. Must stay fully type-erasable (const objects, not TS enums):
2962
+ the node test runner imports this file from source. The alignment checks
2963
+ below stop compilation if the vendored spec drifts from the declarations.
2964
+ */
2965
+
2966
+ type BCProduct = BcProductOutput;
2967
+ type SetProduct = SetProductOutput;
2968
+ type MasterProduct = MasterProductOutput;
2969
+ type MasterProductWithVariationGroup = MasterProductWithVariationGroupOutput;
2970
+ type VariationGroup = VariationGroupOutput;
2971
+ /**
2972
+ A variant PRODUCT (`productId`, `orderable`, `variationValues`, `productPromotions`):
2973
+ the items of `MasterProduct.variants`, as in v3. Anchored to the parent's field
2974
+ rather than to a component id: for a while the document called the variation
2975
+ ATTRIBUTE `Variant` (fixed in `@callimacus/db` 5.5.1), and this alias — like
2976
+ {@link VariationAttribute} — stays correct whatever the components are named.
2977
+ */
2978
+ type Variant = MasterProductOutput['variants'][number];
2979
+ /**
2980
+ A variation attribute (`id`, `name`, `values`): the items of `MasterProduct.variationAttributes`.
2981
+ */
2982
+ type VariationAttribute = MasterProductOutput['variationAttributes'][number];
2983
+ type LocalizedEPChapter = LocalizedEpChapter;
2984
+ type ContractUserInteraction = UserInteraction$1;
2985
+ type SLDocumentSection = SlDocumentSectionOutput;
2986
+ type SLInputEvent = SlInputEvent;
2987
+ type SLDocument = SlDocumentOutput;
2988
+ type Image = ImageOutput;
2989
+ type Video = VideoOutput;
2990
+ type Gallery = GalleryOutput;
2991
+ type Topic = TopicOutput;
2992
+ type LocalizedEPArtwork = LocalizedEpArtworkOutput;
2993
+ type LegacyBlock = LegacyBlockOutput;
2994
+ /**
2995
+ Custom (tenant-defined) block. The `custom:` template-literal narrowing comes
2996
+ straight from the generated types (the spec's `pattern: "^custom:"` via the
2997
+ typeTransformer in openapi-ts.config.ts) — it is what lets
2998
+ `block.type === 'image'` style switches keep narrowing `Block`. The alias
2999
+ only adds the `data` type parameter for tenant payloads.
3000
+ */
3001
+ type CustomBlock<T = unknown> = Omit<CustomBlockOutput, 'data'> & {
3002
+ data: T;
3003
+ };
3004
+ type Block = BlockOutput;
3005
+ type Chapter = ChapterOutput;
3006
+ type Story = StoryOutput;
3007
+ /**
3008
+ Every `server-response` payload, exactly as the wire carries it.
3009
+ */
3010
+ type ThamyrResponse = ThamyrResponse$1;
3011
+ type Values<E> = E[keyof E];
3012
+ declare const ThamyrResponseType: {
3013
+ readonly ERROR: "error";
3014
+ readonly CHAPTER_EVENT: "chapter-event";
3015
+ readonly CHAPTER_DELETED: "chapter-deleted";
3016
+ readonly STORY_RESET: "story-reset";
3017
+ readonly STORY_CREATED: "story-created";
3018
+ readonly STORY_SHARED: "story-shared";
3019
+ };
3020
+ type ThamyrResponseType = Values<typeof ThamyrResponseType>;
3021
+ /**
3022
+ Events received from the server.
3023
+ */
3024
+ declare const ServerEvents: {
3025
+ readonly ERROR: "error";
3026
+ readonly SYSTEM_MESSAGE: "system-message";
3027
+ readonly SERVER_STATUS: "server-status";
3028
+ readonly SERVER_RESPONSE: "server-response";
3029
+ };
3030
+ type ServerEvents = Values<typeof ServerEvents>;
3031
+ /**
3032
+ Events sent to the server.
3033
+ */
3034
+ declare const ClientEvents: {
3035
+ readonly CLIENT_READY: "client-ready";
3036
+ readonly USER_INTERACTION: "user-interaction";
3037
+ };
3038
+ type ClientEvents = Values<typeof ClientEvents>;
3039
+ declare const SLInputEventType: {
3040
+ readonly question: "question";
3041
+ readonly content: "content";
3042
+ readonly topic: "topic";
3043
+ readonly tag: "tag";
3044
+ readonly image: "image";
3045
+ readonly video: "video";
3046
+ readonly gallery: "gallery";
3047
+ readonly relatedQuestion: "relatedQuestion";
3048
+ readonly page: "page";
3049
+ readonly customInteraction: "customInteraction";
3050
+ readonly customPage: "customPage";
3051
+ };
3052
+ type SLInputEventType = Values<typeof SLInputEventType>;
3053
+ declare const GalleryMode: {
3054
+ readonly masonry: "masonry";
3055
+ readonly carousel: "carousel";
3056
+ };
3057
+ type GalleryMode = Values<typeof GalleryMode>;
3058
+ declare const ChapterStatus: {
3059
+ readonly understandingQuery: 1;
3060
+ readonly craftingAnswer: 2;
3061
+ readonly curatingContent: 3;
3062
+ readonly done: 4;
3063
+ };
3064
+ type ChapterStatus = Values<typeof ChapterStatus>;
3065
+ /**
3066
+ Narrow a block to a tenant-defined custom block. `type.startsWith('custom:')`
3067
+ alone does not narrow the union — this is the guard form of the `custom:`
3068
+ template-literal refinement above.
3069
+ */
3070
+ declare function isCustomBlock(block: Block): block is CustomBlock;
3071
+ declare function isSetProduct(product: GenericProduct): product is SetProductOutput;
3072
+ declare function isMasterProduct(product: GenericProduct): product is MasterProductOutput;
3073
+
3074
+ /**
3075
+ Contains information about the client's environment and system
3076
+ */
3077
+ type ClientInfo = {
3078
+ /**
3079
+ The browser's user agent string. Empty on platforms that do not expose one (React Native).
3080
+ */
3081
+ userAgent: string;
3082
+ /**
3083
+ The client's preferred language. Empty on platforms that do not expose one (React Native).
3084
+ */
3085
+ language: string;
3086
+ /**
3087
+ The client's timezone identifier
3088
+ */
3089
+ timezone: string;
3090
+ /**
3091
+ The client's screen dimensions (width x height). Empty where there is no `window.screen` (React Native).
3092
+ */
3093
+ screenResolution: string;
3094
+ /**
3095
+ The client's local time as a formatted string
3096
+ */
3097
+ localTime: string;
3098
+ /**
3099
+ Optional geographic coordinates of the client
3100
+ */
3101
+ location?: GeolocationPosition;
3102
+ };
3103
+
3104
+ type BoundingBox = {
3105
+ x: number;
3106
+ y: number;
3107
+ width: number;
3108
+ height: number;
3109
+ top: number;
3110
+ left: number;
3111
+ right: number;
3112
+ bottom: number;
3113
+ };
3114
+ type UiElement = {
3115
+ id: string;
3116
+ bounds: BoundingBox;
3117
+ isVisible: boolean;
3118
+ visibilityRatio: number;
3119
+ };
3120
+ type UiSnapshot = {
3121
+ timestamp: number;
3122
+ viewport: {
3123
+ width: number;
3124
+ height: number;
3125
+ };
3126
+ blockIds: string[];
3127
+ elements: UiElement[];
3128
+ };
3129
+ type InteractionContext = {
3130
+ uiSnapshot?: UiSnapshot;
3131
+ };
3132
+ type UiObserverConfig = {
3133
+ enabled?: boolean;
3134
+ productSelector?: string;
3135
+ blockSelector?: string;
3136
+ maxTrackedElements?: number;
3137
+ minVisibilityRatio?: number;
3138
+ };
3139
+
3140
+ /**
3141
+ Enum representing the different types of user interactions with the Callimacus service.
3142
+ */
3143
+ declare enum UserInteractionType {
3144
+ /**
3145
+ Request to retrieve an existing story
3146
+ */
3147
+ GET_STORY = "get-story",
3148
+ /**
3149
+ Request to create a new round in a story
3150
+ */
3151
+ CREATE_ROUND = "create-round",
3152
+ /**
3153
+ Request to reset a story to its initial state
3154
+ */
3155
+ RESET_STORY = "reset-story",
3156
+ /**
3157
+ Request to navigate back from a round to the story
3158
+ */
3159
+ BACK_FROM_ROUND = "back-from-round",
3160
+ /**
3161
+ Request to share a story with others
3162
+ */
3163
+ SHARE_STORY = "share-story",
3164
+ /**
3165
+ Request to retrieve a story that has been shared
3166
+ */
3167
+ GET_SHARED_STORY = "get-shared-story"
3168
+ }
3169
+ /**
3170
+ The contract payload for one interaction type.
3171
+ */
3172
+ type PayloadOf<K extends UserInteractionType> = Extract<ContractUserInteraction, {
3173
+ type: `${K}`;
3174
+ }>['payload'];
3175
+ /**
3176
+ Payload for retrieving an existing story.
3177
+ */
3178
+ type GetStoryPayload = PayloadOf<UserInteractionType.GET_STORY>;
3179
+ /**
3180
+ Payload for creating a new round. `context` is stripped and re-added by
3181
+ {@link InteractionPayloadMap}, which enriches every interaction with it.
3182
+ */
3183
+ type CreateRoundPayload = Omit<PayloadOf<UserInteractionType.CREATE_ROUND>, 'context'>;
3184
+ /**
3185
+ Payload for resetting a story to its initial state.
3186
+ */
3187
+ type ResetStoryPayload = PayloadOf<UserInteractionType.RESET_STORY>;
3188
+ /**
3189
+ Payload for navigating back from a round (the deprecated `roundId` wire alias is neither exposed nor sent).
3190
+ */
3191
+ type BackFromRoundPayload = Omit<PayloadOf<UserInteractionType.BACK_FROM_ROUND>, 'roundId'>;
3192
+ /**
3193
+ Payload for sharing a story with others.
3194
+ */
3195
+ type ShareStoryPayload = PayloadOf<UserInteractionType.SHARE_STORY>;
3196
+ /**
3197
+ Payload for retrieving a shared story.
3198
+ */
3199
+ type GetSharedStoryPayload = PayloadOf<UserInteractionType.GET_SHARED_STORY>;
3200
+ type WithInteractionContext<T> = T & {
3201
+ context?: InteractionContext;
3202
+ };
3203
+ /**
3204
+ Map of interaction types to their corresponding payload types.
3205
+ This ensures type safety when working with different interaction types.
3206
+ */
3207
+ type InteractionPayloadMap = {
3208
+ [UserInteractionType.GET_STORY]: WithInteractionContext<GetStoryPayload>;
3209
+ [UserInteractionType.CREATE_ROUND]: WithInteractionContext<CreateRoundPayload>;
3210
+ [UserInteractionType.RESET_STORY]: WithInteractionContext<ResetStoryPayload>;
3211
+ [UserInteractionType.BACK_FROM_ROUND]: WithInteractionContext<BackFromRoundPayload>;
3212
+ [UserInteractionType.SHARE_STORY]: WithInteractionContext<ShareStoryPayload>;
3213
+ [UserInteractionType.GET_SHARED_STORY]: WithInteractionContext<GetSharedStoryPayload>;
3214
+ };
3215
+ /**
3216
+ Discriminated union type representing all possible user interactions.
3217
+ Each interaction has a type and a corresponding payload based on the interaction type.
3218
+ */
3219
+ type UserInteraction = {
3220
+ [E in UserInteractionType]: {
3221
+ type: E;
3222
+ payload: InteractionPayloadMap[E];
3223
+ };
3224
+ }[UserInteractionType];
3225
+
3226
+ /**
3227
+ Enum representing the different types of events emitted by the Callimacus service.
3228
+ */
3229
+ declare enum CallimacusEvent {
3230
+ /**
3231
+ Event emitted when a new processing round is created
3232
+ */
3233
+ ROUND_CREATED = "round-created",
3234
+ /**
3235
+ Event emitted during a processing round with intermediate results
3236
+ */
3237
+ ROUND_EVENT = "round-event",
3238
+ /**
3239
+ Event emitted when a processing round is completed
3240
+ */
3241
+ ROUND_COMPLETED = "round-completed",
3242
+ /**
3243
+ Event emitted when an error occurs during processing
3244
+ */
3245
+ ERROR = "error"
3246
+ }
3247
+
3248
+ /**
3249
+ Audio descriptor that a `tts` content item injects into a block's `data`.
3250
+ Mirrors the shape produced by callimacus-core's tts runner.
3251
+
3252
+ `audioUrl` points at a streaming proxy: the clip is synthesized, streamed, and
3253
+ cached lazily on the first GET, so fetching it (i.e. playing) is what triggers
3254
+ synthesis — creating an element with `preload="none"` costs nothing.
3255
+ */
3256
+ type TtsAudio = {
3257
+ /**
3258
+ Playable URL (mp3). Stream-on-first-play; safe to use as an <audio> src.
3259
+ */
3260
+ audioUrl: string;
3261
+ /**
3262
+ MIME type of the audio, e.g. `audio/mpeg`.
3263
+ */
3264
+ mimeType: string;
3265
+ /**
3266
+ ElevenLabs voice the clip was rendered with.
3267
+ */
3268
+ voiceId: string;
3269
+ /**
3270
+ The spoken text.
3271
+ */
3272
+ text: string;
3273
+ };
3274
+ /**
3275
+ Find the audio descriptor a `tts` content item dropped into a block's `data`.
3276
+ The block author chooses the key (the content item's id), so we scan the
3277
+ top-level data values and return the first audio descriptor, or `undefined`
3278
+ when the block carries none.
3279
+ */
3280
+ declare function extractTtsAudio(data: unknown): TtsAudio | undefined;
3281
+
3282
+ /**
3283
+ The error surface hosts subscribe to via `onError`: server `error`-channel
3284
+ messages plus terminal connection refusals. `reason` is present only on
3285
+ refusals that carried the server's machine-readable slug (see
3286
+ {@link ConnectRejection}), plus the SDK's own `retries_exhausted`.
3287
+
3288
+ An alias since the contract's ErrorMessage grew `reason?` itself; kept as
3289
+ the name the callback types below always exposed.
3290
+ */
3291
+ type CallimacusErrorMessage = ErrorMessage;
3292
+ /**
3293
+ Callbacks for different socket events
3294
+ */
3295
+ type ServerResponseCallback<T = ThamyrResponse> = (response: T) => void;
3296
+ type ConnectionStatusCallback = (isConnected: boolean) => void;
3297
+ type ErrorCallback = (error: CallimacusErrorMessage) => void;
3298
+ declare class CallimacusService {
3299
+ private socket?;
3300
+ private readonly serverResponseListeners;
3301
+ private readonly connectionStatusListeners;
3302
+ private readonly errorListeners;
3303
+ private uiObserver?;
3304
+ private uiObserverConfig;
3305
+ private handshakeRetryAttempts;
3306
+ private handshakeRetryTimer?;
3307
+ private setupEventListeners;
3308
+ /**
3309
+ Notifies all server response listeners about a new response.
3310
+
3311
+ @param response - The response to notify listeners about
3312
+ */
3313
+ private notifyServerResponseListeners;
3314
+ /**
3315
+ Updates all connection status listeners about a connection status change.
3316
+
3317
+ @param isConnected - The new connection status
3318
+ */
3319
+ private updateConnectionStatus;
3320
+ private notifyRejection;
3321
+ /**
3322
+ Schedules a manual reconnection attempt after a retryable handshake
3323
+ refusal (see {@link shouldRetryHandshake}), with exponential backoff.
3324
+ On exhaustion it emits a final, distinguishable error — "retrying" and
3325
+ "gave up" must never look the same to the host, and the logger is
3326
+ disabled by default so listeners are the only reliable channel.
3327
+ */
3328
+ private scheduleHandshakeRetry;
3329
+ private clearHandshakeRetry;
3330
+ /**
3331
+ Notifies all error listeners about an error message.
3332
+
3333
+ @param error - The error to notify listeners about
3334
+ */
3335
+ private notifyErrorListeners;
3336
+ /**
3337
+ Retrieves the user's current geolocation coordinates.
3338
+
3339
+ Uses the browser's Geolocation API to get the current position. React Native
3340
+ has no `navigator.geolocation` unless the app installs one, so the API is
3341
+ feature-detected rather than assumed — the caller already treats a missing
3342
+ position as normal (permission may simply be denied).
3343
+
3344
+ @returns A promise that resolves to the current position, or `undefined` when geolocation access is denied or unavailable
3345
+ */
3346
+ private getLocation;
3347
+ private enrichPayloadWithUiContext;
3348
+ private ensureUiObserver;
3349
+ socketEndpoint(endpoint: string): {
3350
+ origin: string;
3351
+ path: string;
3352
+ };
3353
+ /**
3354
+ Initializes the Callimacus connection to the server.
3355
+
3356
+ WebSocket is preferred, with a genuine fallback to HTTP long-polling;
3357
+ reconnection behavior and timeouts use socket.io defaults.
3358
+
3359
+ @param url - The URL of the Callimacus server
3360
+ @param headers - Optional headers to pass with the connection
3361
+ @param auth - Optional auth payload sent with the socket handshake, merged with the page referrer
3362
+ */
3363
+ connect(url?: string, headers?: Record<string, string>, auth?: Record<string, string>): void;
3364
+ /**
3365
+ Disconnects from the Callimacus server.
3366
+
3367
+ Closes the socket, and updates the connection status.
3368
+ */
3369
+ disconnect(): void;
3370
+ configureUiObserver(config?: UiObserverConfig): void;
3371
+ /**
3372
+ Sends a typed user interaction to the server with full type assistance.
3373
+
3374
+ @template T - The specific interaction type
3375
+ @param type - Which interaction to send; selects the payload shape
3376
+ @param payload - The properly typed payload for this interaction type
3377
+ */
3378
+ sendUserInteraction<T extends UserInteractionType>(type: T, payload: InteractionPayloadMap[T]): void;
3379
+ /**
3380
+ Collects information about the client's environment.
3381
+
3382
+ Gathers browser details, system information, and geolocation data
3383
+ to provide context about the client's environment.
3384
+
3385
+ Every field is feature-detected. React Native defines `navigator` but not
3386
+ `navigator.userAgent` / `.language`, and has no `window.screen` at all
3387
+ (dimensions come from `Dimensions`, which core cannot reach without importing
3388
+ `react-native`). Rather than throw a `ReferenceError` mid-call, the fields it
3389
+ cannot determine come back as empty strings — an unambiguous "this platform
3390
+ did not report it", as opposed to a plausible-looking wrong value. `timezone`
3391
+ and `localTime` come from `Intl`/`Date` and are available on Hermes.
3392
+
3393
+ @returns A promise that resolves to a ClientInfo object containing user agent, language, timezone, local time, screen resolution, and geolocation data. Fields the platform does not expose are empty strings.
3394
+ */
3395
+ gatherClientInfo(): Promise<ClientInfo>;
3396
+ onServerResponse(callback: ServerResponseCallback): () => void;
3397
+ /**
3398
+ Registers a callback for connection status changes. The callback fires on
3399
+ future changes only — it is NOT invoked with the current status at
3400
+ registration time (the react store relies on this to preserve its
3401
+ 'connecting' state).
3402
+
3403
+ @param callback - Function to call when connection status changes
3404
+ @returns Unsubscribe function to remove the listener
3405
+ */
3406
+ onConnectionStatus(callback: ConnectionStatusCallback): () => void;
3407
+ /**
3408
+ Registers a callback for error messages.
3409
+
3410
+ @param callback - Function to call when an error is received
3411
+ @returns Unsubscribe function to remove the listener
3412
+ */
3413
+ onError(callback: ErrorCallback): () => void;
3414
+ }
3415
+ declare const callimacusService: CallimacusService;
3416
+
3417
+ /**
3418
+ Structured payload the server attaches to a refused handshake (SOL-1100):
3419
+ `code` is an HTTP-style status — 4xx is a deliberate refusal, 5xx means the
3420
+ server could not evaluate the handshake — and `reason` is a machine-readable
3421
+ slug such as `invalid_token`, `origin_not_allowed`, `auth_unavailable`.
3422
+ */
3423
+ type ConnectRejection = {
3424
+ code: number;
3425
+ reason?: string;
3426
+ };
3427
+ /**
3428
+ Extracts the server's structured rejection from a `connect_error`. Returns
3429
+ undefined for errors that carry no such payload (engine-level failures, or
3430
+ servers older than connect-time auth).
3431
+ */
3432
+ declare function parseConnectRejection(error: Error): ConnectRejection | undefined;
3433
+ declare const MAX_HANDSHAKE_RETRIES = 3;
3434
+ /**
3435
+ Whether a refused handshake deserves another attempt. 4xx refusals (bad key,
3436
+ blocked origin) are deliberate and permanent — retrying them is exactly the
3437
+ reconnect storm connect-time auth is designed to avoid. Only 5xx (the server
3438
+ could not evaluate the handshake at all) earns a few spaced retries.
3439
+ */
3440
+ declare function shouldRetryHandshake(code: number, attemptsSoFar: number): boolean;
3441
+ /**
3442
+ Classifies a `connect_error` event. Returns undefined while the socket is
3443
+ still `active` — an engine-level/network failure that socket.io-client
3444
+ retries on its own and hosts must not be alarmed about. Otherwise the
3445
+ connection was refused terminally: the result carries the server's code and
3446
+ reason when present, or `code: 0` for refusals with no structured payload
3447
+ (e.g. socket.io's own "Invalid namespace") so a locally-assigned code can
3448
+ never be mistaken for a server-sent one.
3449
+ */
3450
+ declare function classifyConnectError(error: Error, isActive: boolean): ConnectRejection | undefined;
3451
+
3452
+ /**
3453
+ Logger utility for Thamyr SDK
3454
+ Provides configurable logging that can be enabled/disabled to avoid console spam
3455
+ Browser-compatible implementation using native console API
3456
+ */
3457
+ type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'silent';
3458
+ type LoggerConfig = {
3459
+ enabled: boolean;
3460
+ level: LogLevel;
3461
+ prefix?: string;
3462
+ };
3463
+ declare class Logger {
3464
+ private config;
3465
+ debug: (...args: unknown[]) => void;
3466
+ info: (...args: unknown[]) => void;
3467
+ warn: (...args: unknown[]) => void;
3468
+ error: (...args: unknown[]) => void;
3469
+ private log;
3470
+ /**
3471
+ Merge the given options into the current logger configuration.
3472
+
3473
+ @param config - Options to override; omitted fields keep their current values
3474
+ */
3475
+ configure(config: Partial<LoggerConfig>): void;
3476
+ /**
3477
+ Get current logger configuration
3478
+ */
3479
+ getConfig(): LoggerConfig;
3480
+ }
3481
+ declare const logger: Logger;
3482
+
3483
+ /**
3484
+ Published image/video block `url`s resolve through cdn.callimacus.ai. This
3485
+ builds a second URL requesting a transformed variant (resize, format
3486
+ conversion, rotate, grayscale, ...) instead of the original file.
3487
+ */
3488
+ type ImageResizeEdit = {
3489
+ width?: number;
3490
+ height?: number;
3491
+ /**
3492
+ `cover` (default, crops to fill), `contain` (letterboxes), `fill` (stretches), `inside`/`outside` (bounds only, no crop).
3493
+ */
3494
+ fit?: 'cover' | 'contain' | 'fill' | 'inside' | 'outside';
3495
+ };
3496
+ type ImageFormatEdit = {
3497
+ /**
3498
+ 1-100.
3499
+ */
3500
+ quality?: number;
3501
+ };
3502
+ type ImageEdits = {
3503
+ resize?: ImageResizeEdit;
3504
+ /**
3505
+ Forces a specific output format; omit entirely to auto-negotiate WebP/AVIF from the browser's `Accept` header.
3506
+ */
3507
+ webp?: ImageFormatEdit;
3508
+ avif?: ImageFormatEdit;
3509
+ jpeg?: ImageFormatEdit;
3510
+ png?: ImageFormatEdit;
3511
+ /**
3512
+ Degrees.
3513
+ */
3514
+ rotate?: number;
3515
+ grayscale?: true;
3516
+ [edit: string]: unknown;
3517
+ };
3518
+ /**
3519
+ Build a CDN URL requesting a transformed variant of a published
3520
+ image/video block's `url`, instead of the original file. Omitting `edits`
3521
+ entirely (or an empty object) is pointless: just render `cdnUrl` directly
3522
+ in that case.
3523
+ */
3524
+ declare function transformImageUrl(cdnUrl: string, edits: ImageEdits): string;
3525
+
3526
+ /**
3527
+ Generates an RFC 4122 version 4 UUID.
3528
+
3529
+ Prefers the native `crypto.randomUUID()` when available (browsers, Node, and
3530
+ React Native runtimes that polyfill it). Falls back to `crypto.getRandomValues()`
3531
+ — which React Native apps commonly provide via `react-native-get-random-values`
3532
+ — and finally to `Math.random()` so the SDK never throws on a runtime that lacks
3533
+ the Web Crypto API. Hermes ships with no global `crypto` whatsoever, hence the
3534
+ `typeof` probe: a bare `crypto` reference would throw a `ReferenceError` there,
3535
+ while `typeof` on an undeclared identifier is always safe.
3536
+
3537
+ The id correlates interactions for the lifetime of a session; it is not a
3538
+ security token, so the non-crypto fallback is acceptable.
3539
+ */
3540
+ declare function randomUuid(): string;
3541
+
3542
+ type ContractClient = Client;
3543
+ /**
3544
+ What a contract call rejects with under `{throwOnError: true}`.
3545
+
3546
+ - `status` is the HTTP status of the failed response, `undefined` when no response arrived (network or
3547
+ CORS failure). It can be 2xx when the response arrived but its body could not be parsed or validated.
3548
+ - `body` is the parsed error body the server sent — `{error, errorId}` on the public API, a string for
3549
+ non-JSON bodies, `{}` for an empty body — or, when no response arrived, the underlying `TypeError`
3550
+ (also exposed as `cause`).
3551
+
3552
+ Aborting a call through its `signal` is not a failure of the call: the abort reason is rethrown as is. The
3553
+ request signal decides, and it does so whether the abort landed before or after the response headers arrived.
3554
+ */
3555
+ declare class ThamyrHttpError extends Error {
3556
+ readonly status: number | undefined;
3557
+ readonly body: unknown;
3558
+ readonly response: Response | undefined;
3559
+ readonly request: Request | undefined;
3560
+ constructor(body: unknown, response?: Response, request?: Request);
3561
+ }
3562
+ /**
3563
+ Client for the generated {@link CallimacusApi}: the client id doubles as bearer token and x-sl-access-token.
3564
+ Calls made with `{throwOnError: true}` (per call, or through `setConfig`) reject with a
3565
+ {@link ThamyrHttpError}; the envelope's `error` stays the parsed body, as documented.
3566
+ */
3567
+ declare function createContractClient(config: {
3568
+ endpoint: string;
3569
+ accessToken: string;
3570
+ /**
3571
+ Send cookies cross-origin (the old axios `withCredentials`).
3572
+ */
3573
+ withCredentials?: boolean;
3574
+ }): ContractClient;
3575
+
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 };