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