@sazito/client-sdk 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +91 -34
- package/dist/index.d.ts +731 -255
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +10 -9
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,12 @@ interface SazitoConfig {
|
|
|
31
31
|
/**
|
|
32
32
|
* Common types used throughout the SDK
|
|
33
33
|
*/
|
|
34
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
35
|
+
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
|
|
36
|
+
interface JsonObject {
|
|
37
|
+
[key: string]: JsonValue;
|
|
38
|
+
}
|
|
39
|
+
type JsonArray = JsonValue[];
|
|
34
40
|
/**
|
|
35
41
|
* Unified response pattern for all API calls
|
|
36
42
|
* No exceptions are thrown - errors are returned in the error field
|
|
@@ -41,7 +47,7 @@ interface SazitoResponse<T> {
|
|
|
41
47
|
status?: number;
|
|
42
48
|
message: string;
|
|
43
49
|
type: 'network' | 'api' | 'validation';
|
|
44
|
-
details?:
|
|
50
|
+
details?: JsonValue;
|
|
45
51
|
};
|
|
46
52
|
}
|
|
47
53
|
/**
|
|
@@ -54,7 +60,7 @@ interface PaginatedResponse<T> {
|
|
|
54
60
|
pageSize: number;
|
|
55
61
|
}
|
|
56
62
|
/**
|
|
57
|
-
* Request options that can be passed to
|
|
63
|
+
* Request options that can be passed to an API call
|
|
58
64
|
*/
|
|
59
65
|
interface RequestOptions {
|
|
60
66
|
retries?: number;
|
|
@@ -62,6 +68,7 @@ interface RequestOptions {
|
|
|
62
68
|
cache?: boolean;
|
|
63
69
|
headers?: Record<string, string>;
|
|
64
70
|
signal?: AbortSignal;
|
|
71
|
+
skipTransform?: boolean;
|
|
65
72
|
}
|
|
66
73
|
/**
|
|
67
74
|
* Cookie options for token storage
|
|
@@ -84,16 +91,41 @@ interface Image {
|
|
|
84
91
|
alt?: string;
|
|
85
92
|
width?: number;
|
|
86
93
|
height?: number;
|
|
87
|
-
order?: number;
|
|
88
94
|
createdAt: string;
|
|
89
95
|
updatedAt: string;
|
|
90
96
|
}
|
|
91
97
|
/**
|
|
92
98
|
* Product attribute (e.g., color, size)
|
|
93
99
|
*/
|
|
100
|
+
/**
|
|
101
|
+
* Rich attribute value for typed fields like color swatches.
|
|
102
|
+
* `value` is the human-readable label; `extra` carries the payload
|
|
103
|
+
* (e.g. a hex color when `fieldType` is `'color'`).
|
|
104
|
+
*/
|
|
105
|
+
interface ProductAttributeValueObject {
|
|
106
|
+
value: string;
|
|
107
|
+
extra?: string;
|
|
108
|
+
fieldType?: string;
|
|
109
|
+
}
|
|
94
110
|
interface ProductAttribute {
|
|
95
111
|
name: string;
|
|
96
|
-
value: string;
|
|
112
|
+
value: string | ProductAttributeValueObject;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Normalized product snapshot embedded in checkout entities
|
|
116
|
+
* (cart items, invoice items, successful order items).
|
|
117
|
+
*/
|
|
118
|
+
interface CheckoutProductSnapshot {
|
|
119
|
+
variantId: number;
|
|
120
|
+
productId?: number;
|
|
121
|
+
name: string;
|
|
122
|
+
url?: string;
|
|
123
|
+
image?: Image;
|
|
124
|
+
attributes: ProductAttribute[];
|
|
125
|
+
productType?: string;
|
|
126
|
+
hasMaxOrder?: boolean;
|
|
127
|
+
maxOrderQuantity?: number;
|
|
128
|
+
minOrderQuantity?: number;
|
|
97
129
|
}
|
|
98
130
|
/**
|
|
99
131
|
* Region (استان)
|
|
@@ -101,6 +133,7 @@ interface ProductAttribute {
|
|
|
101
133
|
interface Region$1 {
|
|
102
134
|
id: number;
|
|
103
135
|
name: string;
|
|
136
|
+
cities?: City$1[];
|
|
104
137
|
}
|
|
105
138
|
/**
|
|
106
139
|
* City (شهر)
|
|
@@ -109,6 +142,8 @@ interface City$1 {
|
|
|
109
142
|
id: number;
|
|
110
143
|
name: string;
|
|
111
144
|
regionId?: number;
|
|
145
|
+
latitude?: number;
|
|
146
|
+
longitude?: number;
|
|
112
147
|
}
|
|
113
148
|
|
|
114
149
|
/**
|
|
@@ -133,7 +168,7 @@ interface ProductVariant {
|
|
|
133
168
|
dynamicFormId?: number;
|
|
134
169
|
sortIndex: number;
|
|
135
170
|
imageId?: number;
|
|
136
|
-
commercialFiles?:
|
|
171
|
+
commercialFiles?: JsonValue[];
|
|
137
172
|
createdAt: string;
|
|
138
173
|
updatedAt: string;
|
|
139
174
|
}
|
|
@@ -143,7 +178,7 @@ interface Product {
|
|
|
143
178
|
url: string;
|
|
144
179
|
enabled: boolean;
|
|
145
180
|
productType: string;
|
|
146
|
-
themeConfig?:
|
|
181
|
+
themeConfig?: JsonObject;
|
|
147
182
|
dynamicFormId?: number;
|
|
148
183
|
eventEntityId?: number;
|
|
149
184
|
attributes?: ProductAttribute[];
|
|
@@ -160,7 +195,7 @@ interface ProductCategory {
|
|
|
160
195
|
enabled?: boolean;
|
|
161
196
|
description?: string;
|
|
162
197
|
productsCount?: number;
|
|
163
|
-
themeConfig?:
|
|
198
|
+
themeConfig?: JsonObject;
|
|
164
199
|
attributes?: ProductAttribute[];
|
|
165
200
|
createdAt?: string;
|
|
166
201
|
updatedAt?: string;
|
|
@@ -188,113 +223,151 @@ interface ProductFilters {
|
|
|
188
223
|
* Cart-related types
|
|
189
224
|
*/
|
|
190
225
|
|
|
226
|
+
interface SchedulerBookingAttributes {
|
|
227
|
+
eventEntityId: string | number;
|
|
228
|
+
eventTitle?: string;
|
|
229
|
+
eventId?: string;
|
|
230
|
+
startDateTimeLocal: string;
|
|
231
|
+
endDateTimeLocal: string;
|
|
232
|
+
timezone: string;
|
|
233
|
+
}
|
|
234
|
+
interface UploadedFormFileAttribute {
|
|
235
|
+
serveKey: string;
|
|
236
|
+
fileName: string;
|
|
237
|
+
}
|
|
238
|
+
type FormAttributeValue = string | number | boolean | null | UploadedFormFileAttribute;
|
|
191
239
|
interface CartProduct {
|
|
192
|
-
id: number;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
name: string;
|
|
196
|
-
url: string;
|
|
197
|
-
image: Image;
|
|
198
|
-
attributes: ProductAttribute[];
|
|
199
|
-
hasMaxOrder: boolean;
|
|
200
|
-
maxOrderQuantity: number;
|
|
201
|
-
minOrderQuantity: number;
|
|
202
|
-
};
|
|
240
|
+
id: number | string;
|
|
241
|
+
productVariantId: number;
|
|
242
|
+
quantity: number;
|
|
203
243
|
unitPrice: number;
|
|
204
244
|
lineTotal: number;
|
|
205
|
-
|
|
206
|
-
formAttributes?: Record<string,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
timezone?: string;
|
|
210
|
-
};
|
|
211
|
-
formFields?: Record<string, any>;
|
|
245
|
+
product: CheckoutProductSnapshot;
|
|
246
|
+
formAttributes?: Record<string, FormAttributeValue>;
|
|
247
|
+
formFields?: JsonObject;
|
|
248
|
+
bookingAttributes?: SchedulerBookingAttributes;
|
|
212
249
|
}
|
|
213
250
|
interface Cart {
|
|
214
251
|
id: number;
|
|
215
252
|
identifier: string;
|
|
216
253
|
items: CartProduct[];
|
|
217
|
-
|
|
218
|
-
|
|
254
|
+
netTotal: number;
|
|
255
|
+
grossTotal?: number;
|
|
219
256
|
needsShipping: boolean;
|
|
220
|
-
|
|
257
|
+
minBasketLimitViolated: boolean;
|
|
258
|
+
deleteCoupon?: boolean;
|
|
221
259
|
}
|
|
222
260
|
interface CartCredentials {
|
|
223
|
-
id: number;
|
|
224
261
|
identifier: string;
|
|
225
262
|
}
|
|
226
263
|
interface AddToCartInput {
|
|
227
264
|
id: number;
|
|
228
265
|
count: number;
|
|
229
|
-
formAttributes?: Record<string,
|
|
230
|
-
schedulerBookingAttributes?: {
|
|
231
|
-
eventEntityId: number;
|
|
232
|
-
timezone: string;
|
|
233
|
-
};
|
|
266
|
+
formAttributes?: Record<string, FormAttributeValue>;
|
|
234
267
|
}
|
|
235
268
|
interface CreateCartInput {
|
|
236
269
|
coupon?: string;
|
|
237
270
|
variants: AddToCartInput[];
|
|
238
|
-
formAttributes?: Record<string,
|
|
239
|
-
schedulerBookingAttributes?:
|
|
240
|
-
eventEntityId: number;
|
|
241
|
-
timezone: string;
|
|
242
|
-
};
|
|
271
|
+
formAttributes?: Record<string, FormAttributeValue>;
|
|
272
|
+
schedulerBookingAttributes?: SchedulerBookingAttributes;
|
|
243
273
|
}
|
|
244
274
|
|
|
245
275
|
/**
|
|
246
276
|
* Invoice and checkout-related types
|
|
247
277
|
*/
|
|
248
278
|
|
|
279
|
+
interface InvoiceItemFormAttributes {
|
|
280
|
+
formId?: number;
|
|
281
|
+
formData: Record<string, {
|
|
282
|
+
label: string;
|
|
283
|
+
value: JsonValue;
|
|
284
|
+
type: string;
|
|
285
|
+
}>;
|
|
286
|
+
}
|
|
249
287
|
interface InvoiceItem {
|
|
250
|
-
id: number;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
product: any;
|
|
254
|
-
attributes: ProductAttribute[];
|
|
255
|
-
};
|
|
256
|
-
image: Image;
|
|
288
|
+
id: number | string;
|
|
289
|
+
productVariantId: number;
|
|
290
|
+
productId?: number;
|
|
257
291
|
name: string;
|
|
292
|
+
url?: string;
|
|
293
|
+
attributes: ProductAttribute[];
|
|
294
|
+
productType?: string;
|
|
295
|
+
hasMaxOrder?: boolean;
|
|
296
|
+
maxOrderQuantity?: number;
|
|
297
|
+
minOrderQuantity?: number;
|
|
298
|
+
image?: Image;
|
|
299
|
+
quantity: number;
|
|
258
300
|
unitPrice: number;
|
|
259
301
|
lineTotal: number;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
302
|
+
rawPrice: number;
|
|
303
|
+
customerProfit: number;
|
|
304
|
+
commercialFiles?: JsonValue;
|
|
305
|
+
formAttributes?: Record<string, FormAttributeValue> | InvoiceItemFormAttributes;
|
|
306
|
+
bookingAttributes?: SchedulerBookingAttributes;
|
|
307
|
+
formFields?: JsonObject;
|
|
264
308
|
}
|
|
265
309
|
interface ShippingItem {
|
|
266
|
-
invoiceItemIds: number
|
|
310
|
+
invoiceItemIds: Array<number | string>;
|
|
267
311
|
rate: {
|
|
268
312
|
id: number;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
313
|
+
name: string;
|
|
314
|
+
price: number;
|
|
315
|
+
icon?: string;
|
|
316
|
+
color?: string;
|
|
317
|
+
type?: string;
|
|
274
318
|
};
|
|
275
319
|
}
|
|
320
|
+
interface ShippingAddressRegion {
|
|
321
|
+
id: number;
|
|
322
|
+
name: string;
|
|
323
|
+
}
|
|
324
|
+
interface ShippingAddressCity {
|
|
325
|
+
id: number;
|
|
326
|
+
name: string;
|
|
327
|
+
regionId?: number;
|
|
328
|
+
latitude?: number;
|
|
329
|
+
longitude?: number;
|
|
330
|
+
}
|
|
276
331
|
interface ShippingAddress {
|
|
277
332
|
id: number;
|
|
278
333
|
identifier: string;
|
|
279
334
|
firstName: string;
|
|
280
335
|
lastName: string;
|
|
281
|
-
mobilePhone
|
|
336
|
+
mobilePhone?: string;
|
|
282
337
|
phoneNumber?: string;
|
|
283
338
|
email?: string;
|
|
284
|
-
region
|
|
285
|
-
city:
|
|
339
|
+
region?: ShippingAddressRegion;
|
|
340
|
+
city: ShippingAddressCity;
|
|
286
341
|
address: string;
|
|
287
342
|
postalCode?: string;
|
|
343
|
+
description?: string;
|
|
344
|
+
latitude?: number;
|
|
345
|
+
longitude?: number;
|
|
346
|
+
userSetCoordinatesBefore?: boolean;
|
|
347
|
+
}
|
|
348
|
+
interface InvoiceShippingAddressRegion extends ShippingAddressRegion {
|
|
349
|
+
city: ShippingAddressCity;
|
|
350
|
+
}
|
|
351
|
+
interface InvoiceShippingAddress {
|
|
352
|
+
identifier: string;
|
|
353
|
+
firstName: string;
|
|
354
|
+
lastName: string;
|
|
355
|
+
mobilePhone?: string;
|
|
356
|
+
phoneNumber?: string;
|
|
357
|
+
email?: string;
|
|
358
|
+
region?: InvoiceShippingAddressRegion;
|
|
359
|
+
address: string;
|
|
360
|
+
postalCode?: string;
|
|
361
|
+
description?: string;
|
|
288
362
|
latitude?: number;
|
|
289
363
|
longitude?: number;
|
|
290
364
|
userSetCoordinatesBefore?: boolean;
|
|
291
|
-
createdAt: string;
|
|
292
|
-
updatedAt: string;
|
|
293
365
|
}
|
|
294
366
|
interface User {
|
|
295
|
-
id
|
|
367
|
+
id?: number;
|
|
296
368
|
email?: string;
|
|
297
369
|
mobilePhone?: string;
|
|
370
|
+
phoneNumber?: string;
|
|
298
371
|
firstName?: string;
|
|
299
372
|
lastName?: string;
|
|
300
373
|
birthDate?: string;
|
|
@@ -303,32 +376,41 @@ interface Invoice {
|
|
|
303
376
|
id: number;
|
|
304
377
|
identifier: string;
|
|
305
378
|
items: InvoiceItem[];
|
|
306
|
-
shippingAddress?:
|
|
379
|
+
shippingAddress?: InvoiceShippingAddress;
|
|
307
380
|
shippingItems: ShippingItem[];
|
|
308
|
-
shippingMethod?: string;
|
|
309
381
|
needsShipping: boolean;
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
subtotal: number;
|
|
313
|
-
total: number;
|
|
382
|
+
userComment?: string;
|
|
383
|
+
netTotal: number;
|
|
314
384
|
finalTotal: number;
|
|
385
|
+
vat: number;
|
|
386
|
+
vatPercent: number;
|
|
387
|
+
itemsDiscount: number;
|
|
315
388
|
discountTotal: number;
|
|
389
|
+
customerProfit: number;
|
|
390
|
+
customerProfitPercentage: number;
|
|
391
|
+
itemsTotalRawPrice: number;
|
|
392
|
+
couponTotal: number;
|
|
316
393
|
shippingTotal: number;
|
|
317
|
-
|
|
394
|
+
creditTotal: number;
|
|
395
|
+
discountUsages: Array<{
|
|
396
|
+
discountCode: {
|
|
397
|
+
code: string;
|
|
398
|
+
userSegment?: string;
|
|
399
|
+
};
|
|
400
|
+
}>;
|
|
401
|
+
coupon?: {
|
|
402
|
+
userSegment?: string;
|
|
403
|
+
};
|
|
318
404
|
discountCode?: string;
|
|
319
|
-
createdAt: string;
|
|
320
|
-
updatedAt: string;
|
|
321
405
|
}
|
|
322
406
|
interface InvoiceCredentials {
|
|
323
407
|
id: number;
|
|
324
408
|
identifier: string;
|
|
325
409
|
}
|
|
326
410
|
interface CreateInvoiceInput {
|
|
327
|
-
cartId: number;
|
|
328
411
|
cartIdentifier: string;
|
|
329
412
|
}
|
|
330
413
|
interface RefreshInvoiceInput {
|
|
331
|
-
cartId: number;
|
|
332
414
|
cartIdentifier: string;
|
|
333
415
|
identifier: string;
|
|
334
416
|
}
|
|
@@ -338,21 +420,26 @@ interface RefreshInvoiceInput {
|
|
|
338
420
|
*/
|
|
339
421
|
interface ShippingMethod {
|
|
340
422
|
id: number;
|
|
341
|
-
code: string;
|
|
342
423
|
name: string;
|
|
343
|
-
|
|
344
|
-
enabled: boolean;
|
|
345
|
-
isFree: boolean;
|
|
346
|
-
isCourier: boolean;
|
|
347
|
-
isPost: boolean;
|
|
424
|
+
type: string;
|
|
348
425
|
}
|
|
349
426
|
interface ShippingRate {
|
|
350
427
|
id: number;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
428
|
+
name: string;
|
|
429
|
+
price: number;
|
|
430
|
+
description?: string;
|
|
431
|
+
icon?: string;
|
|
432
|
+
color?: string;
|
|
433
|
+
type?: string;
|
|
434
|
+
}
|
|
435
|
+
interface ItemShippingRate {
|
|
436
|
+
invoiceItemId: number | string;
|
|
437
|
+
shippingRate: ShippingRate;
|
|
438
|
+
}
|
|
439
|
+
interface ApplicableShippingMethods {
|
|
440
|
+
shippingMethods: ShippingMethod[];
|
|
441
|
+
groupedShippingRates: Record<string, ShippingRate[]>;
|
|
442
|
+
itemsShippingRate: ItemShippingRate[];
|
|
356
443
|
}
|
|
357
444
|
interface ShippingAddressInput {
|
|
358
445
|
firstName: string;
|
|
@@ -360,12 +447,14 @@ interface ShippingAddressInput {
|
|
|
360
447
|
mobilePhone: string;
|
|
361
448
|
phoneNumber?: string;
|
|
362
449
|
email?: string;
|
|
363
|
-
regionId
|
|
364
|
-
cityId
|
|
450
|
+
regionId?: number;
|
|
451
|
+
cityId?: number;
|
|
365
452
|
address: string;
|
|
366
453
|
postalCode?: string;
|
|
454
|
+
description?: string;
|
|
367
455
|
latitude?: number;
|
|
368
456
|
longitude?: number;
|
|
457
|
+
showMap?: boolean;
|
|
369
458
|
userSetCoordinatesBefore?: boolean;
|
|
370
459
|
}
|
|
371
460
|
interface ShippingAddressCredentials {
|
|
@@ -374,41 +463,73 @@ interface ShippingAddressCredentials {
|
|
|
374
463
|
}
|
|
375
464
|
interface ShippingAssignment {
|
|
376
465
|
rateId: number;
|
|
377
|
-
invoiceItemIds: string
|
|
466
|
+
invoiceItemIds: Array<string | number>;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Order-related types
|
|
471
|
+
*/
|
|
472
|
+
|
|
473
|
+
interface Order {
|
|
474
|
+
id: number;
|
|
475
|
+
orderNumber: string;
|
|
476
|
+
orderIdentifier: string;
|
|
477
|
+
invoice: {
|
|
478
|
+
shippingItems: JsonObject[];
|
|
479
|
+
invoiceItems: InvoiceItem[];
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
interface OrdersListResponse {
|
|
483
|
+
orders: Order[];
|
|
484
|
+
totalCount: number;
|
|
485
|
+
totalCountRaw: number;
|
|
486
|
+
totalNotSeen: number;
|
|
487
|
+
totalSeen: number;
|
|
488
|
+
}
|
|
489
|
+
interface OrderFilters {
|
|
490
|
+
pageNumber?: number;
|
|
491
|
+
pageSize?: number;
|
|
492
|
+
filters?: Array<{
|
|
493
|
+
name: string;
|
|
494
|
+
value: JsonValue;
|
|
495
|
+
}>;
|
|
378
496
|
}
|
|
379
497
|
|
|
380
498
|
/**
|
|
381
499
|
* Payment-related types
|
|
382
500
|
*/
|
|
501
|
+
|
|
383
502
|
type PaymentGateway = 'mellatpayment' | 'pecpayment' | 'sadadpayment' | 'zarinpalpayment' | 'paypingpayment' | 'podpayment' | 'uppayment' | 'seppayment' | 'vandarpayment' | 'yourgatepayment' | 'bazarpayment' | 'zifypayment' | 'zibalpayment' | 'snapppayment' | 'torobpaypayment' | 'azkipayment' | 'digipaypayment' | 'novapaypayment' | 'zarinpluspayment' | 'tomanpayment' | 'tarapayment' | 'ozonpayment' | 'millipaypayment' | 'ayriapayment' | 'sabinpayment' | 'paymentinplace' | 'cardtocardpayment' | 'freepayment';
|
|
384
503
|
type PaymentStatus = 'PENDING' | 'PROCESSING' | 'PAID' | 'FAILED' | 'CANCELLED' | 'REFUNDED';
|
|
385
504
|
interface PaymentMethod {
|
|
386
505
|
id: number;
|
|
387
506
|
code: PaymentGateway;
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
507
|
+
/** Backend display title (English). */
|
|
508
|
+
title: string;
|
|
509
|
+
/** Backend display title (Persian). */
|
|
510
|
+
titleFa: string;
|
|
511
|
+
/** Backend description; often null. */
|
|
512
|
+
description: string | null;
|
|
513
|
+
/** Backend payment sub-type id; null when not provided. */
|
|
514
|
+
paymentSubType: number | null;
|
|
515
|
+
/** Display order from backend. */
|
|
516
|
+
order: number;
|
|
517
|
+
isDefault: boolean;
|
|
397
518
|
}
|
|
398
519
|
interface Payment {
|
|
399
520
|
id: number;
|
|
400
521
|
identifier: string;
|
|
401
|
-
paymentType:
|
|
522
|
+
paymentType: {
|
|
523
|
+
id?: number;
|
|
524
|
+
code: PaymentGateway;
|
|
525
|
+
};
|
|
402
526
|
amount: number;
|
|
403
|
-
invoiceId: number;
|
|
404
|
-
status: PaymentStatus;
|
|
405
|
-
createdAt: string;
|
|
406
|
-
updatedAt: string;
|
|
407
527
|
}
|
|
408
528
|
interface PaymentAction {
|
|
409
|
-
action: 'POST' | 'REDIRECT' | 'UPLOAD' | '
|
|
529
|
+
action: 'POST' | 'REDIRECT' | 'UPLOAD' | 'pending' | 'showOrder' | 'StockViolated' | 'FAIL';
|
|
410
530
|
address?: string;
|
|
411
|
-
payload?:
|
|
531
|
+
payload?: JsonObject;
|
|
532
|
+
order?: Order;
|
|
412
533
|
time?: number;
|
|
413
534
|
message?: string;
|
|
414
535
|
}
|
|
@@ -422,39 +543,17 @@ interface CreatePaymentInput {
|
|
|
422
543
|
paymentType: number;
|
|
423
544
|
}
|
|
424
545
|
interface PaymentStepInput {
|
|
425
|
-
|
|
546
|
+
id?: number;
|
|
547
|
+
paymentIdentifier?: string;
|
|
548
|
+
payload?: JsonObject;
|
|
549
|
+
tatoken?: string;
|
|
550
|
+
trackingData?: JsonObject;
|
|
426
551
|
isFailed?: string;
|
|
427
552
|
imageUrl?: string;
|
|
428
553
|
code?: string;
|
|
429
554
|
}
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
* Order-related types
|
|
433
|
-
*/
|
|
434
|
-
|
|
435
|
-
type OrderStatus = 'PENDING' | 'PROCESSING' | 'SHIPPED' | 'DELIVERED' | 'CANCELLED' | 'REFUNDED';
|
|
436
|
-
interface Order {
|
|
437
|
-
id: number;
|
|
438
|
-
orderNumber: string;
|
|
439
|
-
status: OrderStatus;
|
|
440
|
-
items: InvoiceItem[];
|
|
441
|
-
shippingAddress?: ShippingAddress;
|
|
442
|
-
paymentMethod?: PaymentMethod;
|
|
443
|
-
subtotal: number;
|
|
444
|
-
discountTotal: number;
|
|
445
|
-
shippingTotal: number;
|
|
446
|
-
taxTotal: number;
|
|
447
|
-
total: number;
|
|
448
|
-
trackingNumber?: string;
|
|
449
|
-
notes?: string;
|
|
450
|
-
createdAt: string;
|
|
451
|
-
updatedAt: string;
|
|
452
|
-
}
|
|
453
|
-
interface OrderFilters {
|
|
454
|
-
status?: OrderStatus;
|
|
455
|
-
page?: number;
|
|
456
|
-
pageSize?: number;
|
|
457
|
-
}
|
|
555
|
+
type PaymentStepFormValue = string | number | boolean | null | undefined;
|
|
556
|
+
type PaymentStepFormFields = Record<string, PaymentStepFormValue>;
|
|
458
557
|
|
|
459
558
|
/**
|
|
460
559
|
* Search-related types
|
|
@@ -476,7 +575,7 @@ interface BlogPage {
|
|
|
476
575
|
content?: string;
|
|
477
576
|
summary?: string;
|
|
478
577
|
image?: Image;
|
|
479
|
-
themeConfig?:
|
|
578
|
+
themeConfig?: JsonObject;
|
|
480
579
|
attributes?: ProductAttribute[];
|
|
481
580
|
createdAt: string;
|
|
482
581
|
updatedAt: string;
|
|
@@ -493,7 +592,7 @@ interface CmsPage {
|
|
|
493
592
|
content?: string;
|
|
494
593
|
summary?: string;
|
|
495
594
|
image?: Image;
|
|
496
|
-
themeConfig?:
|
|
595
|
+
themeConfig?: JsonObject;
|
|
497
596
|
attributes?: ProductAttribute[];
|
|
498
597
|
createdAt: string;
|
|
499
598
|
updatedAt: string;
|
|
@@ -631,6 +730,73 @@ interface MenuNode {
|
|
|
631
730
|
children: MenuNode[];
|
|
632
731
|
}
|
|
633
732
|
|
|
733
|
+
/**
|
|
734
|
+
* Credentials Manager for guest users
|
|
735
|
+
* Manages cart, invoice, shipping, and payment credentials.
|
|
736
|
+
* Accepts an optional StorageAdapter — defaults to localStorage in browsers,
|
|
737
|
+
* in-memory otherwise (SSR / server actions).
|
|
738
|
+
*/
|
|
739
|
+
|
|
740
|
+
interface StorageAdapter {
|
|
741
|
+
getItem(key: string): string | null;
|
|
742
|
+
setItem(key: string, value: string): void;
|
|
743
|
+
removeItem(key: string): void;
|
|
744
|
+
}
|
|
745
|
+
declare class MemoryStorage implements StorageAdapter {
|
|
746
|
+
private data;
|
|
747
|
+
getItem(key: string): string | null;
|
|
748
|
+
setItem(key: string, value: string): void;
|
|
749
|
+
removeItem(key: string): void;
|
|
750
|
+
}
|
|
751
|
+
declare class CredentialsManager {
|
|
752
|
+
private readonly CART_KEY;
|
|
753
|
+
private readonly INVOICE_KEY;
|
|
754
|
+
private readonly SHIPPING_KEY;
|
|
755
|
+
private readonly PAYMENT_KEY;
|
|
756
|
+
private readonly DISCOUNT_KEY;
|
|
757
|
+
private storage;
|
|
758
|
+
constructor(storage?: StorageAdapter);
|
|
759
|
+
/**
|
|
760
|
+
* Cart Credentials
|
|
761
|
+
*/
|
|
762
|
+
getCartCredentials(): CartCredentials | null;
|
|
763
|
+
setCartCredentials(credentials: CartCredentials & {
|
|
764
|
+
id?: number;
|
|
765
|
+
}): void;
|
|
766
|
+
clearCartCredentials(): void;
|
|
767
|
+
/**
|
|
768
|
+
* Invoice Credentials
|
|
769
|
+
*/
|
|
770
|
+
getInvoiceCredentials(): InvoiceCredentials | null;
|
|
771
|
+
setInvoiceCredentials(credentials: InvoiceCredentials): void;
|
|
772
|
+
clearInvoiceCredentials(): void;
|
|
773
|
+
/**
|
|
774
|
+
* Shipping Address Credentials
|
|
775
|
+
*/
|
|
776
|
+
getShippingCredentials(): ShippingAddressCredentials | null;
|
|
777
|
+
setShippingCredentials(credentials: ShippingAddressCredentials): void;
|
|
778
|
+
clearShippingCredentials(): void;
|
|
779
|
+
/**
|
|
780
|
+
* Payment Credentials
|
|
781
|
+
*/
|
|
782
|
+
getPaymentCredentials(): PaymentCredentials | null;
|
|
783
|
+
setPaymentCredentials(credentials: PaymentCredentials): void;
|
|
784
|
+
clearPaymentCredentials(): void;
|
|
785
|
+
/**
|
|
786
|
+
* Discount Code
|
|
787
|
+
*/
|
|
788
|
+
getDiscountCode(): string | null;
|
|
789
|
+
setDiscountCode(code: string): void;
|
|
790
|
+
clearDiscountCode(): void;
|
|
791
|
+
/**
|
|
792
|
+
* Clear all credentials
|
|
793
|
+
*/
|
|
794
|
+
clearAll(): void;
|
|
795
|
+
private getItem;
|
|
796
|
+
private setItem;
|
|
797
|
+
private removeItem;
|
|
798
|
+
}
|
|
799
|
+
|
|
634
800
|
/**
|
|
635
801
|
* Token storage for auth token persistence
|
|
636
802
|
* Primary storage: localStorage (user_id_token), with cookie fallback.
|
|
@@ -706,6 +872,7 @@ declare class HttpClient {
|
|
|
706
872
|
* Get request headers
|
|
707
873
|
*/
|
|
708
874
|
private getHeaders;
|
|
875
|
+
private isMultipartBody;
|
|
709
876
|
/**
|
|
710
877
|
* Check if status code should trigger a retry
|
|
711
878
|
*/
|
|
@@ -770,7 +937,7 @@ interface CategoryTreeNode {
|
|
|
770
937
|
entityType: 'product_category';
|
|
771
938
|
entityId: number;
|
|
772
939
|
entity: ProductCategory;
|
|
773
|
-
details:
|
|
940
|
+
details: JsonObject;
|
|
774
941
|
children: CategoryTreeNode[];
|
|
775
942
|
createdAt: string;
|
|
776
943
|
updatedAt: string;
|
|
@@ -814,74 +981,26 @@ declare class CategoriesAPI {
|
|
|
814
981
|
list(filters?: CategoryFilters, options?: RequestOptions): Promise<SazitoResponse<CategoryListResponse>>;
|
|
815
982
|
}
|
|
816
983
|
|
|
817
|
-
/**
|
|
818
|
-
* Credentials Manager for guest users
|
|
819
|
-
* Manages cart, invoice, shipping, and payment credentials in localStorage
|
|
820
|
-
*/
|
|
821
|
-
|
|
822
|
-
declare class CredentialsManager {
|
|
823
|
-
private readonly CART_KEY;
|
|
824
|
-
private readonly INVOICE_KEY;
|
|
825
|
-
private readonly SHIPPING_KEY;
|
|
826
|
-
private readonly PAYMENT_KEY;
|
|
827
|
-
private readonly DISCOUNT_KEY;
|
|
828
|
-
/**
|
|
829
|
-
* Cart Credentials
|
|
830
|
-
*/
|
|
831
|
-
getCartCredentials(): CartCredentials | null;
|
|
832
|
-
setCartCredentials(credentials: CartCredentials): void;
|
|
833
|
-
clearCartCredentials(): void;
|
|
834
|
-
/**
|
|
835
|
-
* Invoice Credentials
|
|
836
|
-
*/
|
|
837
|
-
getInvoiceCredentials(): InvoiceCredentials | null;
|
|
838
|
-
setInvoiceCredentials(credentials: InvoiceCredentials): void;
|
|
839
|
-
clearInvoiceCredentials(): void;
|
|
840
|
-
/**
|
|
841
|
-
* Shipping Address Credentials
|
|
842
|
-
*/
|
|
843
|
-
getShippingCredentials(): ShippingAddressCredentials | null;
|
|
844
|
-
setShippingCredentials(credentials: ShippingAddressCredentials): void;
|
|
845
|
-
clearShippingCredentials(): void;
|
|
846
|
-
/**
|
|
847
|
-
* Payment Credentials
|
|
848
|
-
*/
|
|
849
|
-
getPaymentCredentials(): PaymentCredentials | null;
|
|
850
|
-
setPaymentCredentials(credentials: PaymentCredentials): void;
|
|
851
|
-
clearPaymentCredentials(): void;
|
|
852
|
-
/**
|
|
853
|
-
* Discount Code
|
|
854
|
-
*/
|
|
855
|
-
getDiscountCode(): string | null;
|
|
856
|
-
setDiscountCode(code: string): void;
|
|
857
|
-
clearDiscountCode(): void;
|
|
858
|
-
/**
|
|
859
|
-
* Clear all credentials
|
|
860
|
-
*/
|
|
861
|
-
clearAll(): void;
|
|
862
|
-
/**
|
|
863
|
-
* Get item from localStorage
|
|
864
|
-
*/
|
|
865
|
-
private getItem;
|
|
866
|
-
/**
|
|
867
|
-
* Set item in localStorage
|
|
868
|
-
*/
|
|
869
|
-
private setItem;
|
|
870
|
-
/**
|
|
871
|
-
* Remove item from localStorage
|
|
872
|
-
*/
|
|
873
|
-
private removeItem;
|
|
874
|
-
}
|
|
875
|
-
|
|
876
984
|
/**
|
|
877
985
|
* Cart API
|
|
878
986
|
* Supports both authenticated and guest users via credentials
|
|
879
987
|
*/
|
|
880
988
|
|
|
989
|
+
interface AddItemAttributesInput {
|
|
990
|
+
formAttributes?: Record<string, FormAttributeValue>;
|
|
991
|
+
schedulerBookingAttributes?: CreateCartInput['schedulerBookingAttributes'];
|
|
992
|
+
coupon?: string;
|
|
993
|
+
}
|
|
994
|
+
interface UpdateItemAttributesInput {
|
|
995
|
+
formAttributes?: Record<string, FormAttributeValue>;
|
|
996
|
+
coupon?: string;
|
|
997
|
+
deleteCoupon?: boolean;
|
|
998
|
+
}
|
|
881
999
|
declare class CartAPI {
|
|
882
1000
|
private http;
|
|
883
1001
|
private credentials;
|
|
884
1002
|
constructor(http: HttpClient, credentials: CredentialsManager);
|
|
1003
|
+
private persistCartCredentials;
|
|
885
1004
|
/**
|
|
886
1005
|
* Get current cart
|
|
887
1006
|
*/
|
|
@@ -893,15 +1012,23 @@ declare class CartAPI {
|
|
|
893
1012
|
/**
|
|
894
1013
|
* Add item to cart
|
|
895
1014
|
*/
|
|
896
|
-
addItem(variantId: number, count: number, formAttributes?: Record<string,
|
|
1015
|
+
addItem(variantId: number, count: number, formAttributes?: Record<string, FormAttributeValue>, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
1016
|
+
/**
|
|
1017
|
+
* Add item to cart with standardized attributes payload.
|
|
1018
|
+
*/
|
|
1019
|
+
addItemWithAttributes(variantId: number, count: number, attributes?: AddItemAttributesInput, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
897
1020
|
/**
|
|
898
1021
|
* Update cart item quantity
|
|
899
1022
|
*/
|
|
900
|
-
updateItem(cartProductId: number, count: number, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
1023
|
+
updateItem(cartProductId: number | string, variantId: number, count: number, formAttributes?: Record<string, FormAttributeValue>, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
1024
|
+
/**
|
|
1025
|
+
* Update cart item quantity and optional coupon mutations.
|
|
1026
|
+
*/
|
|
1027
|
+
updateItemWithAttributes(cartProductId: number | string, variantId: number, count: number, attributes?: UpdateItemAttributesInput, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
901
1028
|
/**
|
|
902
1029
|
* Remove item from cart
|
|
903
1030
|
*/
|
|
904
|
-
removeItem(cartProductId: number, variantId: number, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
1031
|
+
removeItem(cartProductId: number | string, variantId: number, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
905
1032
|
/**
|
|
906
1033
|
* Clear current cart credentials
|
|
907
1034
|
*/
|
|
@@ -919,7 +1046,7 @@ declare class OrdersAPI {
|
|
|
919
1046
|
/**
|
|
920
1047
|
* List orders (requires authentication)
|
|
921
1048
|
*/
|
|
922
|
-
list(filters?: OrderFilters, options?: RequestOptions): Promise<SazitoResponse<
|
|
1049
|
+
list(filters?: OrderFilters, options?: RequestOptions): Promise<SazitoResponse<OrdersListResponse>>;
|
|
923
1050
|
/**
|
|
924
1051
|
* Get single order by ID (requires authentication)
|
|
925
1052
|
*/
|
|
@@ -930,10 +1057,16 @@ declare class OrdersAPI {
|
|
|
930
1057
|
* Invoices API (Checkout)
|
|
931
1058
|
*/
|
|
932
1059
|
|
|
1060
|
+
interface AddInvoiceFormInput {
|
|
1061
|
+
formAttributes: JsonObject;
|
|
1062
|
+
invoiceIdentifier?: string;
|
|
1063
|
+
identifier?: string;
|
|
1064
|
+
}
|
|
933
1065
|
declare class InvoicesAPI {
|
|
934
1066
|
private http;
|
|
935
1067
|
private credentials;
|
|
936
1068
|
constructor(http: HttpClient, credentials: CredentialsManager);
|
|
1069
|
+
private normalizeInvoiceResponse;
|
|
937
1070
|
/**
|
|
938
1071
|
* Get current invoice
|
|
939
1072
|
*/
|
|
@@ -962,10 +1095,26 @@ declare class InvoicesAPI {
|
|
|
962
1095
|
* Add invoice details (user comment)
|
|
963
1096
|
*/
|
|
964
1097
|
addDetails(comment: string, options?: RequestOptions): Promise<SazitoResponse<Invoice>>;
|
|
1098
|
+
/**
|
|
1099
|
+
* Attach checkout dynamic form data to invoice.
|
|
1100
|
+
*/
|
|
1101
|
+
addForm(input: AddInvoiceFormInput, options?: RequestOptions): Promise<SazitoResponse<Invoice>>;
|
|
1102
|
+
/**
|
|
1103
|
+
* Apply wallet credit to invoice.
|
|
1104
|
+
*/
|
|
1105
|
+
addCredit(options?: RequestOptions): Promise<SazitoResponse<Invoice>>;
|
|
1106
|
+
/**
|
|
1107
|
+
* Remove wallet credit from invoice.
|
|
1108
|
+
*/
|
|
1109
|
+
removeCredit(options?: RequestOptions): Promise<SazitoResponse<Invoice>>;
|
|
1110
|
+
/**
|
|
1111
|
+
* Toggle wallet credit based on current invoice state.
|
|
1112
|
+
*/
|
|
1113
|
+
toggleCredit(options?: RequestOptions): Promise<SazitoResponse<Invoice>>;
|
|
965
1114
|
/**
|
|
966
1115
|
* Get applicable shipping methods for invoice
|
|
967
1116
|
*/
|
|
968
|
-
getApplicableShippingMethods(options?: RequestOptions): Promise<SazitoResponse<
|
|
1117
|
+
getApplicableShippingMethods(options?: RequestOptions): Promise<SazitoResponse<ApplicableShippingMethods>>;
|
|
969
1118
|
/**
|
|
970
1119
|
* Clear current invoice credentials
|
|
971
1120
|
*/
|
|
@@ -980,14 +1129,26 @@ declare class ShippingAPI {
|
|
|
980
1129
|
private http;
|
|
981
1130
|
private credentials;
|
|
982
1131
|
constructor(http: HttpClient, credentials: CredentialsManager);
|
|
1132
|
+
private sanitizeAddressInput;
|
|
1133
|
+
private unwrapAddressPayload;
|
|
1134
|
+
private extractAddressList;
|
|
983
1135
|
/**
|
|
984
1136
|
* Create shipping address
|
|
985
1137
|
*/
|
|
986
1138
|
createAddress(address: ShippingAddressInput, options?: RequestOptions): Promise<SazitoResponse<ShippingAddress>>;
|
|
987
1139
|
/**
|
|
988
|
-
* Update
|
|
1140
|
+
* Update the address referenced by the currently stored credentials.
|
|
1141
|
+
* @deprecated Do not use during checkout. Existing invoices can reference
|
|
1142
|
+
* this row, so mutation can rewrite address data shown on previous orders.
|
|
1143
|
+
* Create a new address snapshot with createAddress instead.
|
|
989
1144
|
*/
|
|
990
1145
|
updateAddress(address: ShippingAddressInput, options?: RequestOptions): Promise<SazitoResponse<ShippingAddress>>;
|
|
1146
|
+
/**
|
|
1147
|
+
* Get the authenticated user's shipping addresses, newest first.
|
|
1148
|
+
* This endpoint is intentionally not cached: checkout must see an address
|
|
1149
|
+
* created by the user's most recent order immediately.
|
|
1150
|
+
*/
|
|
1151
|
+
listAddresses(options?: RequestOptions): Promise<SazitoResponse<ShippingAddress[]>>;
|
|
991
1152
|
/**
|
|
992
1153
|
* Get shipping address
|
|
993
1154
|
*/
|
|
@@ -1009,6 +1170,7 @@ declare class ShippingAPI {
|
|
|
1009
1170
|
declare class PaymentsAPI {
|
|
1010
1171
|
private http;
|
|
1011
1172
|
private credentials;
|
|
1173
|
+
private readonly pinchedPayments;
|
|
1012
1174
|
constructor(http: HttpClient, credentials: CredentialsManager);
|
|
1013
1175
|
/**
|
|
1014
1176
|
* Get list of payment methods for invoice
|
|
@@ -1019,17 +1181,53 @@ declare class PaymentsAPI {
|
|
|
1019
1181
|
*/
|
|
1020
1182
|
create(paymentTypeId: number, options?: RequestOptions): Promise<SazitoResponse<Payment>>;
|
|
1021
1183
|
/**
|
|
1022
|
-
* Initialize payment
|
|
1184
|
+
* Initialize payment: start the payment step before redirecting the user to
|
|
1185
|
+
* the gateway. Returns the next {@link PaymentAction} (typically REDIRECT or
|
|
1186
|
+
* POST for hosted gateways, or showOrder for zero-amount/instant payments).
|
|
1023
1187
|
*/
|
|
1024
1188
|
initialize(options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
|
|
1025
1189
|
/**
|
|
1026
|
-
*
|
|
1190
|
+
* Verify payment after the user returns from the gateway. Forwards the
|
|
1191
|
+
* gateway callback parameters (e.g. `tatoken`, `trackingData`, `isFailed`,
|
|
1192
|
+
* `code`) to the same payment-step endpoint and returns the settled
|
|
1193
|
+
* {@link PaymentAction} (showOrder on success, FAIL/StockViolated otherwise,
|
|
1194
|
+
* or pending if the gateway has not reported back yet).
|
|
1195
|
+
*/
|
|
1196
|
+
verify(input?: PaymentStepInput, options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
|
|
1197
|
+
/**
|
|
1198
|
+
* Process payment step (for card-to-card or multi-step payments).
|
|
1199
|
+
*
|
|
1200
|
+
* @deprecated Prefer {@link verify} for gateway-return verification.
|
|
1201
|
+
*/
|
|
1202
|
+
processStep(input: PaymentStepInput, options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
|
|
1203
|
+
/**
|
|
1204
|
+
* Shared core for the `process_payment_step` endpoint used by
|
|
1205
|
+
* {@link initialize}, {@link verify} and {@link processStep}.
|
|
1027
1206
|
*/
|
|
1028
|
-
|
|
1207
|
+
private submitPaymentStep;
|
|
1208
|
+
/**
|
|
1209
|
+
* Process payment step in form mode (non-JSON content-type).
|
|
1210
|
+
*/
|
|
1211
|
+
processStepForm(input: FormData | PaymentStepFormFields, options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Poll payment state every 15 seconds until action changes from pending.
|
|
1214
|
+
*/
|
|
1215
|
+
pollUntilSettled(options?: RequestOptions, intervalMs?: number): Promise<SazitoResponse<PaymentAction>>;
|
|
1029
1216
|
/**
|
|
1030
1217
|
* Clear payment credentials
|
|
1031
1218
|
*/
|
|
1032
1219
|
clearPayment(): void;
|
|
1220
|
+
private withExactJsonHeader;
|
|
1221
|
+
private buildProcessStepFormData;
|
|
1222
|
+
private appendFormValue;
|
|
1223
|
+
/**
|
|
1224
|
+
* Post-process a `process_payment_step` response. The exact-JSON endpoint
|
|
1225
|
+
* returns an envelope `{ result: PaymentAction, error, error_code, status }`;
|
|
1226
|
+
* unwrap `result`, surface envelope-level errors, and run the pinch hook.
|
|
1227
|
+
*/
|
|
1228
|
+
private finalizeStepResponse;
|
|
1229
|
+
private normalizeAction;
|
|
1230
|
+
private callPinchAfterSuccessfulPayment;
|
|
1033
1231
|
}
|
|
1034
1232
|
|
|
1035
1233
|
/**
|
|
@@ -1118,6 +1316,8 @@ interface LoginResponse {
|
|
|
1118
1316
|
declare class UsersAPI {
|
|
1119
1317
|
private http;
|
|
1120
1318
|
constructor(http: HttpClient);
|
|
1319
|
+
private normalizeUserResponse;
|
|
1320
|
+
private normalizeLoginResponse;
|
|
1121
1321
|
/**
|
|
1122
1322
|
* Login with email and password
|
|
1123
1323
|
*/
|
|
@@ -1190,9 +1390,118 @@ declare class SearchAPI {
|
|
|
1190
1390
|
}
|
|
1191
1391
|
|
|
1192
1392
|
/**
|
|
1193
|
-
* Feedbacks API (
|
|
1393
|
+
* Feedbacks API (Tajrobe reviews + legacy feedback methods)
|
|
1194
1394
|
*/
|
|
1195
1395
|
|
|
1396
|
+
type RecommendationStatus = 'RECOMMENDED' | 'NEUTRAL' | 'NOT-RECOMMENDED' | 'NONE';
|
|
1397
|
+
interface FeedbackProductAttribute {
|
|
1398
|
+
name: string;
|
|
1399
|
+
value: string;
|
|
1400
|
+
}
|
|
1401
|
+
interface FeedbackProductImage {
|
|
1402
|
+
url: string;
|
|
1403
|
+
alt: string;
|
|
1404
|
+
}
|
|
1405
|
+
interface FeedbackSeedItem {
|
|
1406
|
+
productId: string;
|
|
1407
|
+
productVariantId: string;
|
|
1408
|
+
productName: string;
|
|
1409
|
+
productAttributes: FeedbackProductAttribute[];
|
|
1410
|
+
productImage: FeedbackProductImage;
|
|
1411
|
+
}
|
|
1412
|
+
interface FeedbackSeed {
|
|
1413
|
+
orderId: string;
|
|
1414
|
+
orderIdentifier: string;
|
|
1415
|
+
hasCommentAlready: boolean;
|
|
1416
|
+
items: FeedbackSeedItem[];
|
|
1417
|
+
}
|
|
1418
|
+
interface CreateOrderRatingInput {
|
|
1419
|
+
orderId: string;
|
|
1420
|
+
orderIdentifier: string;
|
|
1421
|
+
orderRate: number;
|
|
1422
|
+
}
|
|
1423
|
+
interface CommentResponse {
|
|
1424
|
+
id: string;
|
|
1425
|
+
}
|
|
1426
|
+
interface ProductReviewRequest {
|
|
1427
|
+
commentId: string;
|
|
1428
|
+
productId: string;
|
|
1429
|
+
productVariantId: string;
|
|
1430
|
+
productName: string;
|
|
1431
|
+
productAttributes: FeedbackProductAttribute[];
|
|
1432
|
+
productImage: FeedbackProductImage;
|
|
1433
|
+
productRate: number;
|
|
1434
|
+
text: string;
|
|
1435
|
+
pros: string[];
|
|
1436
|
+
cons: string[];
|
|
1437
|
+
recommendationStatus: RecommendationStatus;
|
|
1438
|
+
attachmentsServeKeys: string[];
|
|
1439
|
+
owner: boolean;
|
|
1440
|
+
isAnonymous: boolean;
|
|
1441
|
+
}
|
|
1442
|
+
interface ProductStatistics {
|
|
1443
|
+
productStatistics: {
|
|
1444
|
+
averageRate: number;
|
|
1445
|
+
totalCount: number;
|
|
1446
|
+
recommendations: {
|
|
1447
|
+
recommendedPercentage: number;
|
|
1448
|
+
recommendedTotalCount: number;
|
|
1449
|
+
};
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
interface ProductReview {
|
|
1453
|
+
productRate: number;
|
|
1454
|
+
userFirstName: string;
|
|
1455
|
+
userLastName: string;
|
|
1456
|
+
createdAt: string;
|
|
1457
|
+
owner: boolean;
|
|
1458
|
+
text: string;
|
|
1459
|
+
recommendationStatus: RecommendationStatus;
|
|
1460
|
+
pros: string[];
|
|
1461
|
+
cons: string[];
|
|
1462
|
+
isAnonymous: boolean;
|
|
1463
|
+
metadata: {
|
|
1464
|
+
variantOptions: any[];
|
|
1465
|
+
productName: string;
|
|
1466
|
+
variantId: string;
|
|
1467
|
+
};
|
|
1468
|
+
attachments: Array<{
|
|
1469
|
+
serveUrl: string;
|
|
1470
|
+
}>;
|
|
1471
|
+
}
|
|
1472
|
+
interface ProductReviewsFilters {
|
|
1473
|
+
pageNumber?: number;
|
|
1474
|
+
pageSize?: number;
|
|
1475
|
+
}
|
|
1476
|
+
interface ProductReviewsResponse {
|
|
1477
|
+
entities: ProductReview[];
|
|
1478
|
+
pageNumber: number;
|
|
1479
|
+
pageSize: number;
|
|
1480
|
+
totalCount: number;
|
|
1481
|
+
averageRate: number;
|
|
1482
|
+
recommendations: {
|
|
1483
|
+
recommendedPercentage: number;
|
|
1484
|
+
recommendedTotalCount: number;
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
interface ReviewAttachmentInput {
|
|
1488
|
+
file: File | Blob;
|
|
1489
|
+
name?: string;
|
|
1490
|
+
alt?: string;
|
|
1491
|
+
}
|
|
1492
|
+
interface ReviewUploadedImage {
|
|
1493
|
+
id: string;
|
|
1494
|
+
url: string;
|
|
1495
|
+
alt: string;
|
|
1496
|
+
serveUrl: string;
|
|
1497
|
+
serveKey: string;
|
|
1498
|
+
}
|
|
1499
|
+
interface ReviewImageUploadResponse {
|
|
1500
|
+
images: ReviewUploadedImage[];
|
|
1501
|
+
}
|
|
1502
|
+
/**
|
|
1503
|
+
* Legacy feedback model kept for backwards compatibility.
|
|
1504
|
+
*/
|
|
1196
1505
|
interface Feedback {
|
|
1197
1506
|
id: number;
|
|
1198
1507
|
user?: {
|
|
@@ -1206,11 +1515,17 @@ interface Feedback {
|
|
|
1206
1515
|
createdAt: string;
|
|
1207
1516
|
updatedAt: string;
|
|
1208
1517
|
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Legacy create payload kept for backwards compatibility.
|
|
1520
|
+
*/
|
|
1209
1521
|
interface CreateFeedbackInput {
|
|
1210
1522
|
productId?: number;
|
|
1211
1523
|
rating?: number;
|
|
1212
1524
|
comment: string;
|
|
1213
1525
|
}
|
|
1526
|
+
/**
|
|
1527
|
+
* Legacy filters kept for backwards compatibility.
|
|
1528
|
+
*/
|
|
1214
1529
|
interface FeedbackFilters {
|
|
1215
1530
|
productId?: number;
|
|
1216
1531
|
page?: number;
|
|
@@ -1219,17 +1534,45 @@ interface FeedbackFilters {
|
|
|
1219
1534
|
declare class FeedbacksAPI {
|
|
1220
1535
|
private http;
|
|
1221
1536
|
constructor(http: HttpClient);
|
|
1222
|
-
private
|
|
1537
|
+
private normalizeSeedItem;
|
|
1538
|
+
private normalizeSeed;
|
|
1539
|
+
private normalizeProductReview;
|
|
1540
|
+
private normalizeProductReviewsResponse;
|
|
1541
|
+
private transformLegacyFilters;
|
|
1542
|
+
/**
|
|
1543
|
+
* Validate order and get products that can be reviewed.
|
|
1544
|
+
*/
|
|
1545
|
+
getSeed(orderIdentifier: string, options?: RequestOptions): Promise<SazitoResponse<FeedbackSeed>>;
|
|
1546
|
+
/**
|
|
1547
|
+
* Submit order/shop rating and get a comment identifier for product review steps.
|
|
1548
|
+
*/
|
|
1549
|
+
createOrderRating(input: CreateOrderRatingInput, options?: RequestOptions): Promise<SazitoResponse<CommentResponse>>;
|
|
1550
|
+
/**
|
|
1551
|
+
* Submit product-level review details.
|
|
1552
|
+
*/
|
|
1553
|
+
submitProductReview(input: ProductReviewRequest, options?: RequestOptions): Promise<SazitoResponse<void>>;
|
|
1223
1554
|
/**
|
|
1224
|
-
*
|
|
1555
|
+
* Fetch product review statistics (without review list).
|
|
1556
|
+
*/
|
|
1557
|
+
getProductStatistics(productId: string, options?: RequestOptions): Promise<SazitoResponse<ProductStatistics>>;
|
|
1558
|
+
/**
|
|
1559
|
+
* Fetch paginated product reviews.
|
|
1560
|
+
*/
|
|
1561
|
+
getProductReviews(productId: string, filters?: ProductReviewsFilters, options?: RequestOptions): Promise<SazitoResponse<ProductReviewsResponse>>;
|
|
1562
|
+
/**
|
|
1563
|
+
* Upload review images and get serve keys for attachments.
|
|
1564
|
+
*/
|
|
1565
|
+
uploadReviewImages(images: ReviewAttachmentInput[], options?: RequestOptions): Promise<SazitoResponse<ReviewImageUploadResponse>>;
|
|
1566
|
+
/**
|
|
1567
|
+
* Legacy list method kept for backwards compatibility.
|
|
1225
1568
|
*/
|
|
1226
1569
|
list(filters?: FeedbackFilters, options?: RequestOptions): Promise<SazitoResponse<PaginatedResponse<Feedback>>>;
|
|
1227
1570
|
/**
|
|
1228
|
-
*
|
|
1571
|
+
* Legacy create method kept for backwards compatibility.
|
|
1229
1572
|
*/
|
|
1230
1573
|
create(input: CreateFeedbackInput, options?: RequestOptions): Promise<SazitoResponse<Feedback>>;
|
|
1231
1574
|
/**
|
|
1232
|
-
*
|
|
1575
|
+
* Legacy get method kept for backwards compatibility.
|
|
1233
1576
|
*/
|
|
1234
1577
|
get(feedbackId: number, options?: RequestOptions): Promise<SazitoResponse<Feedback>>;
|
|
1235
1578
|
}
|
|
@@ -1404,69 +1747,114 @@ declare class VisitsAPI {
|
|
|
1404
1747
|
}
|
|
1405
1748
|
|
|
1406
1749
|
/**
|
|
1407
|
-
* Booking API (
|
|
1750
|
+
* Booking API (Scheduler and appointments)
|
|
1408
1751
|
*/
|
|
1409
1752
|
|
|
1753
|
+
/**
|
|
1754
|
+
* Legacy event shape returned by some scheduler list endpoints.
|
|
1755
|
+
*/
|
|
1410
1756
|
interface Event {
|
|
1411
1757
|
id: number;
|
|
1412
1758
|
title: string;
|
|
1413
1759
|
description?: string;
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
capacity
|
|
1417
|
-
|
|
1418
|
-
|
|
1760
|
+
startTime?: string;
|
|
1761
|
+
endTime?: string;
|
|
1762
|
+
capacity?: number;
|
|
1763
|
+
bookedCount?: number;
|
|
1764
|
+
availableSlots?: number;
|
|
1419
1765
|
price?: number;
|
|
1420
1766
|
location?: string;
|
|
1421
|
-
|
|
1767
|
+
createdAt?: string;
|
|
1422
1768
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1769
|
+
/**
|
|
1770
|
+
* Event details used in product booking flow.
|
|
1771
|
+
*/
|
|
1772
|
+
interface SchedulerEvent {
|
|
1773
|
+
entityId: number;
|
|
1774
|
+
title: string;
|
|
1775
|
+
description: string;
|
|
1776
|
+
durationsMinute: number[];
|
|
1777
|
+
}
|
|
1778
|
+
interface BookingTimeSlot {
|
|
1779
|
+
startTimeLocal: string;
|
|
1780
|
+
endTimeLocal: string;
|
|
1781
|
+
isAvailable: boolean;
|
|
1782
|
+
remainingCapacity: number;
|
|
1783
|
+
}
|
|
1784
|
+
interface BookingAvailableDay {
|
|
1785
|
+
date: string;
|
|
1786
|
+
timeSlots: BookingTimeSlot[];
|
|
1787
|
+
}
|
|
1788
|
+
interface EventAvailabilitiesResponse {
|
|
1789
|
+
availableDays: BookingAvailableDay[];
|
|
1790
|
+
}
|
|
1791
|
+
interface EventAvailabilityFilters {
|
|
1792
|
+
eventEntityId: number;
|
|
1793
|
+
duration: number;
|
|
1794
|
+
fromDate: string;
|
|
1795
|
+
toDate: string;
|
|
1796
|
+
timezone?: string;
|
|
1434
1797
|
}
|
|
1435
1798
|
interface CreateBookingInput {
|
|
1436
|
-
|
|
1799
|
+
eventEntityId?: number;
|
|
1800
|
+
event_entity_id?: number;
|
|
1437
1801
|
timezone: string;
|
|
1438
|
-
|
|
1802
|
+
attendeeName?: string;
|
|
1803
|
+
attendee_name?: string;
|
|
1804
|
+
attendeeEmail?: string;
|
|
1439
1805
|
attendee_email?: string;
|
|
1806
|
+
attendeePhone?: string;
|
|
1440
1807
|
attendee_phone?: string;
|
|
1441
1808
|
}
|
|
1809
|
+
interface Booking {
|
|
1810
|
+
id: number;
|
|
1811
|
+
eventId: number;
|
|
1812
|
+
event: Event;
|
|
1813
|
+
userId?: number;
|
|
1814
|
+
attendeeName: string;
|
|
1815
|
+
attendeeEmail?: string;
|
|
1816
|
+
attendeePhone?: string;
|
|
1817
|
+
status: 'pending' | 'confirmed' | 'cancelled';
|
|
1818
|
+
bookingTime: string;
|
|
1819
|
+
createdAt: string;
|
|
1820
|
+
}
|
|
1442
1821
|
interface EventFilters {
|
|
1822
|
+
startDate?: string;
|
|
1443
1823
|
start_date?: string;
|
|
1824
|
+
endDate?: string;
|
|
1444
1825
|
end_date?: string;
|
|
1826
|
+
availableOnly?: boolean;
|
|
1445
1827
|
available_only?: boolean;
|
|
1446
1828
|
page?: number;
|
|
1829
|
+
pageSize?: number;
|
|
1447
1830
|
page_size?: number;
|
|
1448
1831
|
}
|
|
1449
1832
|
declare class BookingAPI {
|
|
1450
1833
|
private http;
|
|
1451
1834
|
constructor(http: HttpClient);
|
|
1835
|
+
private transformEventFilters;
|
|
1452
1836
|
/**
|
|
1453
|
-
* List available events
|
|
1837
|
+
* List available events (legacy scheduler listing).
|
|
1454
1838
|
*/
|
|
1455
1839
|
listEvents(filters?: EventFilters, options?: RequestOptions): Promise<SazitoResponse<PaginatedResponse<Event>>>;
|
|
1456
1840
|
/**
|
|
1457
|
-
* Get
|
|
1841
|
+
* Get event details used for booking (durations, title, description).
|
|
1842
|
+
*/
|
|
1843
|
+
getEvent(entityId: number, options?: RequestOptions): Promise<SazitoResponse<SchedulerEvent>>;
|
|
1844
|
+
/**
|
|
1845
|
+
* Get available days and time slots for an event.
|
|
1458
1846
|
*/
|
|
1459
|
-
|
|
1847
|
+
getEventAvailabilities(filters: EventAvailabilityFilters, options?: RequestOptions): Promise<SazitoResponse<EventAvailabilitiesResponse>>;
|
|
1460
1848
|
/**
|
|
1461
|
-
* Create booking
|
|
1849
|
+
* Create booking (legacy endpoint kept for backward compatibility).
|
|
1462
1850
|
*/
|
|
1463
1851
|
createBooking(input: CreateBookingInput, options?: RequestOptions): Promise<SazitoResponse<Booking>>;
|
|
1464
1852
|
/**
|
|
1465
|
-
* List user bookings (requires authentication)
|
|
1853
|
+
* List user bookings (requires authentication).
|
|
1466
1854
|
*/
|
|
1467
1855
|
listBookings(options?: RequestOptions): Promise<SazitoResponse<PaginatedResponse<Booking>>>;
|
|
1468
1856
|
/**
|
|
1469
|
-
* Cancel booking
|
|
1857
|
+
* Cancel booking.
|
|
1470
1858
|
*/
|
|
1471
1859
|
cancelBooking(bookingId: number, options?: RequestOptions): Promise<SazitoResponse<Booking>>;
|
|
1472
1860
|
}
|
|
@@ -1653,6 +2041,78 @@ declare class GeneralAPI {
|
|
|
1653
2041
|
getTajrobeConfig(options?: RequestOptions): Promise<SazitoResponse<TajrobeConfig>>;
|
|
1654
2042
|
}
|
|
1655
2043
|
|
|
2044
|
+
/**
|
|
2045
|
+
* Dynamic Forms API
|
|
2046
|
+
*/
|
|
2047
|
+
|
|
2048
|
+
type DynamicFormFieldType = 'TextBox' | 'TextArea' | 'Select' | 'Checkbox' | 'StatusBox' | 'Number' | 'Password' | 'NationalId' | 'PhoneNumber' | 'IBAN' | 'Separator' | 'Uploader';
|
|
2049
|
+
interface SelectOption {
|
|
2050
|
+
value: string;
|
|
2051
|
+
label: string;
|
|
2052
|
+
}
|
|
2053
|
+
interface DynamicFormField {
|
|
2054
|
+
key: string;
|
|
2055
|
+
name: string;
|
|
2056
|
+
type: DynamicFormFieldType;
|
|
2057
|
+
label: string;
|
|
2058
|
+
value: any;
|
|
2059
|
+
placeholder: string;
|
|
2060
|
+
required: boolean;
|
|
2061
|
+
inputOptions: SelectOption[];
|
|
2062
|
+
allowedExtensions: string[];
|
|
2063
|
+
}
|
|
2064
|
+
interface DynamicForm {
|
|
2065
|
+
id: number;
|
|
2066
|
+
title: string;
|
|
2067
|
+
description: string;
|
|
2068
|
+
fields: DynamicFormField[];
|
|
2069
|
+
}
|
|
2070
|
+
interface UploadedDynamicFormFile {
|
|
2071
|
+
serveKey: string;
|
|
2072
|
+
}
|
|
2073
|
+
declare class DynamicFormsAPI {
|
|
2074
|
+
private http;
|
|
2075
|
+
constructor(http: HttpClient);
|
|
2076
|
+
private normalizeField;
|
|
2077
|
+
private normalizeForm;
|
|
2078
|
+
/**
|
|
2079
|
+
* Fetch dynamic form definition by ID.
|
|
2080
|
+
*/
|
|
2081
|
+
getForm(formId: number, options?: RequestOptions): Promise<SazitoResponse<DynamicForm>>;
|
|
2082
|
+
/**
|
|
2083
|
+
* Upload file for uploader fields in product dynamic forms.
|
|
2084
|
+
*/
|
|
2085
|
+
uploadProductFormFile(file: File | Blob, options?: RequestOptions): Promise<SazitoResponse<UploadedDynamicFormFile>>;
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
/**
|
|
2089
|
+
* Regions API
|
|
2090
|
+
*/
|
|
2091
|
+
|
|
2092
|
+
interface RegionCity {
|
|
2093
|
+
id: number;
|
|
2094
|
+
name: string;
|
|
2095
|
+
latitude: number;
|
|
2096
|
+
longitude: number;
|
|
2097
|
+
}
|
|
2098
|
+
interface RegionWithCities {
|
|
2099
|
+
id: number;
|
|
2100
|
+
name: string;
|
|
2101
|
+
cities: RegionCity[];
|
|
2102
|
+
}
|
|
2103
|
+
declare class RegionsAPI {
|
|
2104
|
+
private http;
|
|
2105
|
+
constructor(http: HttpClient);
|
|
2106
|
+
private normalizeCity;
|
|
2107
|
+
private normalizeRegion;
|
|
2108
|
+
private extractRegions;
|
|
2109
|
+
private sortAlphabetically;
|
|
2110
|
+
/**
|
|
2111
|
+
* Get all regions with nested cities (sorted by name).
|
|
2112
|
+
*/
|
|
2113
|
+
list(options?: RequestOptions): Promise<SazitoResponse<RegionWithCities[]>>;
|
|
2114
|
+
}
|
|
2115
|
+
|
|
1656
2116
|
/**
|
|
1657
2117
|
* Main Sazito SDK Client
|
|
1658
2118
|
*/
|
|
@@ -1679,7 +2139,9 @@ declare class SazitoClient {
|
|
|
1679
2139
|
readonly entityRoutes: EntityRoutesAPI;
|
|
1680
2140
|
readonly menu: MenuAPI;
|
|
1681
2141
|
readonly general: GeneralAPI;
|
|
1682
|
-
|
|
2142
|
+
readonly dynamicForms: DynamicFormsAPI;
|
|
2143
|
+
readonly regions: RegionsAPI;
|
|
2144
|
+
constructor(config: SazitoConfig, credentialsManager?: CredentialsManager);
|
|
1683
2145
|
/**
|
|
1684
2146
|
* Set authentication token (stored in localStorage with cookie fallback)
|
|
1685
2147
|
*/
|
|
@@ -1704,6 +2166,12 @@ declare class SazitoClient {
|
|
|
1704
2166
|
* Clear all guest credentials
|
|
1705
2167
|
*/
|
|
1706
2168
|
clearCredentials(): void;
|
|
2169
|
+
/**
|
|
2170
|
+
* Access the guest credential store used by checkout-related modules.
|
|
2171
|
+
* Useful for integrations that receive an SDK client from the host app and
|
|
2172
|
+
* need to restore cart/invoice/payment credentials on that same instance.
|
|
2173
|
+
*/
|
|
2174
|
+
getCredentialsManager(): CredentialsManager;
|
|
1707
2175
|
/**
|
|
1708
2176
|
* Clear everything (auth + cache + credentials)
|
|
1709
2177
|
*/
|
|
@@ -1716,7 +2184,7 @@ declare class SazitoClient {
|
|
|
1716
2184
|
/**
|
|
1717
2185
|
* Create a new Sazito SDK client instance
|
|
1718
2186
|
*/
|
|
1719
|
-
declare function createSazitoClient(config: SazitoConfig): SazitoClient;
|
|
2187
|
+
declare function createSazitoClient(config: SazitoConfig, credentialsManager?: CredentialsManager): SazitoClient;
|
|
1720
2188
|
|
|
1721
2189
|
interface ModuleContext {
|
|
1722
2190
|
http: HttpClient;
|
|
@@ -1759,54 +2227,62 @@ declare function createMenuAPI(configOrContext: SazitoConfig | ModuleContext): M
|
|
|
1759
2227
|
|
|
1760
2228
|
declare function createGeneralAPI(configOrContext: SazitoConfig | ModuleContext): GeneralAPI;
|
|
1761
2229
|
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
2230
|
+
declare function createDynamicFormsAPI(configOrContext: SazitoConfig | ModuleContext): DynamicFormsAPI;
|
|
2231
|
+
|
|
2232
|
+
declare function createRegionsAPI(configOrContext: SazitoConfig | ModuleContext): RegionsAPI;
|
|
2233
|
+
|
|
2234
|
+
type TransformScalar = string | number | boolean | null | undefined;
|
|
2235
|
+
type TransformValue = TransformScalar | TransformObject | TransformValue[] | object;
|
|
2236
|
+
interface TransformObject {
|
|
2237
|
+
[key: string]: TransformValue;
|
|
2238
|
+
}
|
|
2239
|
+
interface ApiResponseEnvelope {
|
|
2240
|
+
data?: {
|
|
2241
|
+
result?: TransformObject;
|
|
2242
|
+
};
|
|
2243
|
+
}
|
|
2244
|
+
/** Convert Persian and Arabic-Indic numerals to ASCII digits. */
|
|
2245
|
+
declare function toEnglishDigits(input: string): string;
|
|
1766
2246
|
/**
|
|
1767
2247
|
* Transform object keys from snake_case to camelCase with field name beautification
|
|
1768
2248
|
* @param obj - Object to transform
|
|
1769
2249
|
* @returns Transformed object with camelCase keys and beautiful field names
|
|
1770
2250
|
*/
|
|
1771
|
-
declare function transformResponseKeys(obj:
|
|
2251
|
+
declare function transformResponseKeys(obj: TransformValue | object): TransformValue;
|
|
1772
2252
|
/**
|
|
1773
2253
|
* Transform object keys from camelCase to snake_case for API requests
|
|
1774
2254
|
* @param obj - Object to transform
|
|
1775
2255
|
* @returns Transformed object with snake_case keys
|
|
1776
2256
|
*/
|
|
1777
|
-
declare function transformRequestKeys(obj:
|
|
2257
|
+
declare function transformRequestKeys(obj: TransformValue | object): TransformValue;
|
|
1778
2258
|
/**
|
|
1779
2259
|
* Transform API response data structure
|
|
1780
2260
|
* Unwraps the { data: { result: { ... } } } structure and transforms keys
|
|
1781
2261
|
*/
|
|
1782
|
-
declare function transformApiResponse<T =
|
|
2262
|
+
declare function transformApiResponse<T = TransformObject>(response: TransformValue | ApiResponseEnvelope | object): T;
|
|
1783
2263
|
/**
|
|
1784
2264
|
* Specific transformer for cart responses
|
|
1785
2265
|
* Handles the cart-specific data structure
|
|
1786
2266
|
*/
|
|
1787
|
-
declare function transformCartResponse(response:
|
|
1788
|
-
|
|
1789
|
-
* Specific transformer for invoice responses
|
|
1790
|
-
* Handles the invoice-specific data structure
|
|
1791
|
-
*/
|
|
1792
|
-
declare function transformInvoiceResponse(response: any): any;
|
|
2267
|
+
declare function transformCartResponse<T = TransformObject>(response: TransformValue | ApiResponseEnvelope | object): T;
|
|
2268
|
+
declare function transformInvoiceResponse<T = TransformObject>(response: TransformValue | ApiResponseEnvelope | object): T;
|
|
1793
2269
|
/**
|
|
1794
2270
|
* Specific transformer for product list responses
|
|
1795
2271
|
* Handles paginated product lists
|
|
1796
2272
|
*/
|
|
1797
|
-
declare function transformProductListResponse(response:
|
|
2273
|
+
declare function transformProductListResponse<T = TransformObject>(response: TransformValue | ApiResponseEnvelope | object): T;
|
|
1798
2274
|
/**
|
|
1799
2275
|
* Transform shipping address input for API request
|
|
1800
2276
|
*/
|
|
1801
|
-
declare function transformShippingAddressInput(input:
|
|
2277
|
+
declare function transformShippingAddressInput(input: TransformValue): TransformObject;
|
|
1802
2278
|
/**
|
|
1803
2279
|
* Transform add to cart input for API request
|
|
1804
2280
|
*/
|
|
1805
|
-
declare function transformAddToCartInput(variantId: number, quantity: number, formAttributes?:
|
|
2281
|
+
declare function transformAddToCartInput(variantId: number, quantity: number, formAttributes?: TransformValue): TransformObject;
|
|
1806
2282
|
/**
|
|
1807
2283
|
* Transform create cart input for API request
|
|
1808
2284
|
*/
|
|
1809
|
-
declare function transformCreateCartInput(input:
|
|
2285
|
+
declare function transformCreateCartInput(input: TransformValue): TransformObject;
|
|
1810
2286
|
|
|
1811
|
-
export { CredentialsManager, HttpClient, SazitoClient, TokenStorage, createBookingAPI as booking, createCartAPI as cart, createCategoriesAPI as categories, createCMSAPI as cms, createBookingAPI, createCMSAPI, createCartAPI, createCategoriesAPI, createEntityRoutesAPI, createFeedbacksAPI, createGeneralAPI, createImagesAPI, createInvoicesAPI, createMenuAPI, createOrdersAPI, createPaymentsAPI, createProductsAPI, createSazitoClient, createSearchAPI, createShippingAPI, createUsersAPI, createVisitsAPI, createWalletAPI, createEntityRoutesAPI as entityRoutes, createFeedbacksAPI as feedbacks, createGeneralAPI as general, createImagesAPI as images, createInvoicesAPI as invoices, createMenuAPI as menu, createOrdersAPI as orders, createPaymentsAPI as payments, createProductsAPI as products, createSearchAPI as search, createShippingAPI as shipping, transformAddToCartInput, transformApiResponse, transformCartResponse, transformCreateCartInput, transformInvoiceResponse, transformProductListResponse, transformRequestKeys, transformResponseKeys, transformShippingAddressInput, createUsersAPI as users, createVisitsAPI as visits, createWalletAPI as wallet };
|
|
1812
|
-
export type { AddToCartInput, BlogPage, BlogPageEntityRoute, CMSPageEntityRoute, CMSPageType, CacheConfig, Cart, CartCredentials, CartProduct, City$1 as City, CmsPage, CookieOptions, CreateCartInput, CreateInvoiceInput, CreatePaymentInput, EntityRoute, EntityRouteResponse, EntityType, Image, Invoice, InvoiceCredentials, InvoiceItem, MenuItem, MenuNode, MenuTree, Order, OrderFilters,
|
|
2287
|
+
export { CredentialsManager, HttpClient, MemoryStorage, SazitoClient, TokenStorage, createBookingAPI as booking, createCartAPI as cart, createCategoriesAPI as categories, createCMSAPI as cms, createBookingAPI, createCMSAPI, createCartAPI, createCategoriesAPI, createDynamicFormsAPI, createEntityRoutesAPI, createFeedbacksAPI, createGeneralAPI, createImagesAPI, createInvoicesAPI, createMenuAPI, createOrdersAPI, createPaymentsAPI, createProductsAPI, createRegionsAPI, createSazitoClient, createSearchAPI, createShippingAPI, createUsersAPI, createVisitsAPI, createWalletAPI, createDynamicFormsAPI as dynamicForms, createEntityRoutesAPI as entityRoutes, createFeedbacksAPI as feedbacks, createGeneralAPI as general, createImagesAPI as images, createInvoicesAPI as invoices, createMenuAPI as menu, createOrdersAPI as orders, createPaymentsAPI as payments, createProductsAPI as products, createRegionsAPI as regions, createSearchAPI as search, createShippingAPI as shipping, toEnglishDigits, transformAddToCartInput, transformApiResponse, transformCartResponse, transformCreateCartInput, transformInvoiceResponse, transformProductListResponse, transformRequestKeys, transformResponseKeys, transformShippingAddressInput, createUsersAPI as users, createVisitsAPI as visits, createWalletAPI as wallet };
|
|
2288
|
+
export type { AddToCartInput, ApplicableShippingMethods, BlogPage, BlogPageEntityRoute, CMSPageEntityRoute, CMSPageType, CacheConfig, Cart, CartCredentials, CartProduct, CheckoutProductSnapshot, City$1 as City, CmsPage, CookieOptions, CreateCartInput, CreateInvoiceInput, CreatePaymentInput, EntityRoute, EntityRouteResponse, EntityType, FormAttributeValue, Image, Invoice, InvoiceCredentials, InvoiceItem, InvoiceItemFormAttributes, InvoiceShippingAddress, InvoiceShippingAddressRegion, ItemShippingRate, JsonArray, JsonObject, JsonPrimitive, JsonValue, MenuItem, MenuNode, MenuTree, Order, OrderFilters, OrdersListResponse, PaginatedResponse, Payment, PaymentAction, PaymentCredentials, PaymentGateway, PaymentMethod, PaymentStatus, PaymentStepFormFields, PaymentStepFormValue, PaymentStepInput, Product, ProductAttribute, ProductAttributeValueObject, ProductCategory, ProductCategoryEntityRoute, ProductEntityRoute, ProductFilters, ProductSort, ProductVariant, RefreshInvoiceInput, Region$1 as Region, RequestOptions, RetryConfig, SazitoConfig, SazitoResponse, SchedulerBookingAttributes, SearchFilters, SearchResponse, ShippingAddress, ShippingAddressCity, ShippingAddressCredentials, ShippingAddressInput, ShippingAddressRegion, ShippingAssignment, ShippingItem, ShippingMethod, ShippingRate, StorageAdapter, Tag, UnknownEntityRoute, UploadedFormFileAttribute, User };
|