@sazito/client-sdk 1.2.0 → 1.2.2
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 +33 -30
- package/dist/index.d.ts +592 -187
- 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;
|
|
@@ -84,7 +90,6 @@ interface Image {
|
|
|
84
90
|
alt?: string;
|
|
85
91
|
width?: number;
|
|
86
92
|
height?: number;
|
|
87
|
-
order?: number;
|
|
88
93
|
createdAt: string;
|
|
89
94
|
updatedAt: string;
|
|
90
95
|
}
|
|
@@ -95,12 +100,29 @@ interface ProductAttribute {
|
|
|
95
100
|
name: string;
|
|
96
101
|
value: string;
|
|
97
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Normalized product snapshot embedded in checkout entities
|
|
105
|
+
* (cart items, invoice items, successful order items).
|
|
106
|
+
*/
|
|
107
|
+
interface CheckoutProductSnapshot {
|
|
108
|
+
variantId: number;
|
|
109
|
+
productId?: number;
|
|
110
|
+
name: string;
|
|
111
|
+
url?: string;
|
|
112
|
+
image?: Image;
|
|
113
|
+
attributes: ProductAttribute[];
|
|
114
|
+
productType?: string;
|
|
115
|
+
hasMaxOrder?: boolean;
|
|
116
|
+
maxOrderQuantity?: number;
|
|
117
|
+
minOrderQuantity?: number;
|
|
118
|
+
}
|
|
98
119
|
/**
|
|
99
120
|
* Region (استان)
|
|
100
121
|
*/
|
|
101
122
|
interface Region$1 {
|
|
102
123
|
id: number;
|
|
103
124
|
name: string;
|
|
125
|
+
cities?: City$1[];
|
|
104
126
|
}
|
|
105
127
|
/**
|
|
106
128
|
* City (شهر)
|
|
@@ -109,6 +131,8 @@ interface City$1 {
|
|
|
109
131
|
id: number;
|
|
110
132
|
name: string;
|
|
111
133
|
regionId?: number;
|
|
134
|
+
latitude?: number;
|
|
135
|
+
longitude?: number;
|
|
112
136
|
}
|
|
113
137
|
|
|
114
138
|
/**
|
|
@@ -133,7 +157,7 @@ interface ProductVariant {
|
|
|
133
157
|
dynamicFormId?: number;
|
|
134
158
|
sortIndex: number;
|
|
135
159
|
imageId?: number;
|
|
136
|
-
commercialFiles?:
|
|
160
|
+
commercialFiles?: JsonValue[];
|
|
137
161
|
createdAt: string;
|
|
138
162
|
updatedAt: string;
|
|
139
163
|
}
|
|
@@ -143,7 +167,7 @@ interface Product {
|
|
|
143
167
|
url: string;
|
|
144
168
|
enabled: boolean;
|
|
145
169
|
productType: string;
|
|
146
|
-
themeConfig?:
|
|
170
|
+
themeConfig?: JsonObject;
|
|
147
171
|
dynamicFormId?: number;
|
|
148
172
|
eventEntityId?: number;
|
|
149
173
|
attributes?: ProductAttribute[];
|
|
@@ -160,7 +184,7 @@ interface ProductCategory {
|
|
|
160
184
|
enabled?: boolean;
|
|
161
185
|
description?: string;
|
|
162
186
|
productsCount?: number;
|
|
163
|
-
themeConfig?:
|
|
187
|
+
themeConfig?: JsonObject;
|
|
164
188
|
attributes?: ProductAttribute[];
|
|
165
189
|
createdAt?: string;
|
|
166
190
|
updatedAt?: string;
|
|
@@ -188,36 +212,39 @@ interface ProductFilters {
|
|
|
188
212
|
* Cart-related types
|
|
189
213
|
*/
|
|
190
214
|
|
|
215
|
+
interface SchedulerBookingAttributes {
|
|
216
|
+
eventEntityId: string | number;
|
|
217
|
+
eventTitle?: string;
|
|
218
|
+
eventId?: string;
|
|
219
|
+
startDateTimeLocal: string;
|
|
220
|
+
endDateTimeLocal: string;
|
|
221
|
+
timezone: string;
|
|
222
|
+
}
|
|
223
|
+
interface UploadedFormFileAttribute {
|
|
224
|
+
serveKey: string;
|
|
225
|
+
fileName: string;
|
|
226
|
+
}
|
|
227
|
+
type FormAttributeValue = string | number | boolean | null | UploadedFormFileAttribute;
|
|
191
228
|
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
|
-
};
|
|
229
|
+
id: number | string;
|
|
230
|
+
productVariantId: number;
|
|
231
|
+
quantity: number;
|
|
203
232
|
unitPrice: number;
|
|
204
233
|
lineTotal: number;
|
|
205
|
-
|
|
206
|
-
formAttributes?: Record<string,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
timezone?: string;
|
|
210
|
-
};
|
|
211
|
-
formFields?: Record<string, any>;
|
|
234
|
+
product: CheckoutProductSnapshot;
|
|
235
|
+
formAttributes?: Record<string, FormAttributeValue>;
|
|
236
|
+
formFields?: JsonObject;
|
|
237
|
+
bookingAttributes?: SchedulerBookingAttributes;
|
|
212
238
|
}
|
|
213
239
|
interface Cart {
|
|
214
240
|
id: number;
|
|
215
241
|
identifier: string;
|
|
216
242
|
items: CartProduct[];
|
|
217
|
-
|
|
218
|
-
|
|
243
|
+
netTotal: number;
|
|
244
|
+
grossTotal?: number;
|
|
219
245
|
needsShipping: boolean;
|
|
220
|
-
|
|
246
|
+
minBasketLimitViolated: boolean;
|
|
247
|
+
deleteCoupon?: boolean;
|
|
221
248
|
}
|
|
222
249
|
interface CartCredentials {
|
|
223
250
|
id: number;
|
|
@@ -226,75 +253,109 @@ interface CartCredentials {
|
|
|
226
253
|
interface AddToCartInput {
|
|
227
254
|
id: number;
|
|
228
255
|
count: number;
|
|
229
|
-
formAttributes?: Record<string,
|
|
230
|
-
schedulerBookingAttributes?: {
|
|
231
|
-
eventEntityId: number;
|
|
232
|
-
timezone: string;
|
|
233
|
-
};
|
|
256
|
+
formAttributes?: Record<string, FormAttributeValue>;
|
|
234
257
|
}
|
|
235
258
|
interface CreateCartInput {
|
|
236
259
|
coupon?: string;
|
|
237
260
|
variants: AddToCartInput[];
|
|
238
|
-
formAttributes?: Record<string,
|
|
239
|
-
schedulerBookingAttributes?:
|
|
240
|
-
eventEntityId: number;
|
|
241
|
-
timezone: string;
|
|
242
|
-
};
|
|
261
|
+
formAttributes?: Record<string, FormAttributeValue>;
|
|
262
|
+
schedulerBookingAttributes?: SchedulerBookingAttributes;
|
|
243
263
|
}
|
|
244
264
|
|
|
245
265
|
/**
|
|
246
266
|
* Invoice and checkout-related types
|
|
247
267
|
*/
|
|
248
268
|
|
|
269
|
+
interface InvoiceItemFormAttributes {
|
|
270
|
+
formId?: number;
|
|
271
|
+
formData: Record<string, {
|
|
272
|
+
label: string;
|
|
273
|
+
value: JsonValue;
|
|
274
|
+
type: string;
|
|
275
|
+
}>;
|
|
276
|
+
}
|
|
249
277
|
interface InvoiceItem {
|
|
250
|
-
id: number;
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
product: any;
|
|
254
|
-
attributes: ProductAttribute[];
|
|
255
|
-
};
|
|
256
|
-
image: Image;
|
|
278
|
+
id: number | string;
|
|
279
|
+
productVariantId: number;
|
|
280
|
+
productId?: number;
|
|
257
281
|
name: string;
|
|
282
|
+
url?: string;
|
|
283
|
+
attributes: ProductAttribute[];
|
|
284
|
+
productType?: string;
|
|
285
|
+
hasMaxOrder?: boolean;
|
|
286
|
+
maxOrderQuantity?: number;
|
|
287
|
+
minOrderQuantity?: number;
|
|
288
|
+
image?: Image;
|
|
289
|
+
quantity: number;
|
|
258
290
|
unitPrice: number;
|
|
259
291
|
lineTotal: number;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
292
|
+
rawPrice: number;
|
|
293
|
+
customerProfit: number;
|
|
294
|
+
commercialFiles?: JsonValue;
|
|
295
|
+
formAttributes?: Record<string, FormAttributeValue> | InvoiceItemFormAttributes;
|
|
296
|
+
bookingAttributes?: SchedulerBookingAttributes;
|
|
297
|
+
formFields?: JsonObject;
|
|
264
298
|
}
|
|
265
299
|
interface ShippingItem {
|
|
266
|
-
invoiceItemIds: number
|
|
300
|
+
invoiceItemIds: Array<number | string>;
|
|
267
301
|
rate: {
|
|
268
302
|
id: number;
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
303
|
+
name: string;
|
|
304
|
+
price: number;
|
|
305
|
+
icon?: string;
|
|
306
|
+
color?: string;
|
|
307
|
+
type?: string;
|
|
274
308
|
};
|
|
275
309
|
}
|
|
310
|
+
interface ShippingAddressRegion {
|
|
311
|
+
id: number;
|
|
312
|
+
name: string;
|
|
313
|
+
}
|
|
314
|
+
interface ShippingAddressCity {
|
|
315
|
+
id: number;
|
|
316
|
+
name: string;
|
|
317
|
+
regionId?: number;
|
|
318
|
+
latitude?: number;
|
|
319
|
+
longitude?: number;
|
|
320
|
+
}
|
|
276
321
|
interface ShippingAddress {
|
|
277
322
|
id: number;
|
|
278
323
|
identifier: string;
|
|
279
324
|
firstName: string;
|
|
280
325
|
lastName: string;
|
|
281
|
-
mobilePhone
|
|
326
|
+
mobilePhone?: string;
|
|
282
327
|
phoneNumber?: string;
|
|
283
328
|
email?: string;
|
|
284
|
-
region
|
|
285
|
-
city:
|
|
329
|
+
region?: ShippingAddressRegion;
|
|
330
|
+
city: ShippingAddressCity;
|
|
331
|
+
address: string;
|
|
332
|
+
postalCode?: string;
|
|
333
|
+
latitude?: number;
|
|
334
|
+
longitude?: number;
|
|
335
|
+
userSetCoordinatesBefore?: boolean;
|
|
336
|
+
}
|
|
337
|
+
interface InvoiceShippingAddressRegion extends ShippingAddressRegion {
|
|
338
|
+
city: ShippingAddressCity;
|
|
339
|
+
}
|
|
340
|
+
interface InvoiceShippingAddress {
|
|
341
|
+
identifier: string;
|
|
342
|
+
firstName: string;
|
|
343
|
+
lastName: string;
|
|
344
|
+
mobilePhone?: string;
|
|
345
|
+
phoneNumber?: string;
|
|
346
|
+
email?: string;
|
|
347
|
+
region?: InvoiceShippingAddressRegion;
|
|
286
348
|
address: string;
|
|
287
349
|
postalCode?: string;
|
|
288
350
|
latitude?: number;
|
|
289
351
|
longitude?: number;
|
|
290
352
|
userSetCoordinatesBefore?: boolean;
|
|
291
|
-
createdAt: string;
|
|
292
|
-
updatedAt: string;
|
|
293
353
|
}
|
|
294
354
|
interface User {
|
|
295
|
-
id
|
|
355
|
+
id?: number;
|
|
296
356
|
email?: string;
|
|
297
357
|
mobilePhone?: string;
|
|
358
|
+
phoneNumber?: string;
|
|
298
359
|
firstName?: string;
|
|
299
360
|
lastName?: string;
|
|
300
361
|
birthDate?: string;
|
|
@@ -303,21 +364,32 @@ interface Invoice {
|
|
|
303
364
|
id: number;
|
|
304
365
|
identifier: string;
|
|
305
366
|
items: InvoiceItem[];
|
|
306
|
-
shippingAddress?:
|
|
367
|
+
shippingAddress?: InvoiceShippingAddress;
|
|
307
368
|
shippingItems: ShippingItem[];
|
|
308
|
-
shippingMethod?: string;
|
|
309
369
|
needsShipping: boolean;
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
subtotal: number;
|
|
313
|
-
total: number;
|
|
370
|
+
userComment?: string;
|
|
371
|
+
netTotal: number;
|
|
314
372
|
finalTotal: number;
|
|
373
|
+
vat: number;
|
|
374
|
+
vatPercent: number;
|
|
375
|
+
itemsDiscount: number;
|
|
315
376
|
discountTotal: number;
|
|
377
|
+
customerProfit: number;
|
|
378
|
+
customerProfitPercentage: number;
|
|
379
|
+
itemsTotalRawPrice: number;
|
|
380
|
+
couponTotal: number;
|
|
316
381
|
shippingTotal: number;
|
|
317
|
-
|
|
382
|
+
creditTotal: number;
|
|
383
|
+
discountUsages: Array<{
|
|
384
|
+
discountCode: {
|
|
385
|
+
code: string;
|
|
386
|
+
userSegment?: string;
|
|
387
|
+
};
|
|
388
|
+
}>;
|
|
389
|
+
coupon?: {
|
|
390
|
+
userSegment?: string;
|
|
391
|
+
};
|
|
318
392
|
discountCode?: string;
|
|
319
|
-
createdAt: string;
|
|
320
|
-
updatedAt: string;
|
|
321
393
|
}
|
|
322
394
|
interface InvoiceCredentials {
|
|
323
395
|
id: number;
|
|
@@ -338,21 +410,25 @@ interface RefreshInvoiceInput {
|
|
|
338
410
|
*/
|
|
339
411
|
interface ShippingMethod {
|
|
340
412
|
id: number;
|
|
341
|
-
code: string;
|
|
342
413
|
name: string;
|
|
343
|
-
|
|
344
|
-
enabled: boolean;
|
|
345
|
-
isFree: boolean;
|
|
346
|
-
isCourier: boolean;
|
|
347
|
-
isPost: boolean;
|
|
414
|
+
type: string;
|
|
348
415
|
}
|
|
349
416
|
interface ShippingRate {
|
|
350
417
|
id: number;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
418
|
+
name: string;
|
|
419
|
+
price: number;
|
|
420
|
+
icon?: string;
|
|
421
|
+
color?: string;
|
|
422
|
+
type?: string;
|
|
423
|
+
}
|
|
424
|
+
interface ItemShippingRate {
|
|
425
|
+
invoiceItemId: number | string;
|
|
426
|
+
shippingRate: ShippingRate;
|
|
427
|
+
}
|
|
428
|
+
interface ApplicableShippingMethods {
|
|
429
|
+
shippingMethods: ShippingMethod[];
|
|
430
|
+
groupedShippingRates: Record<string, ShippingRate[]>;
|
|
431
|
+
itemsShippingRate: ItemShippingRate[];
|
|
356
432
|
}
|
|
357
433
|
interface ShippingAddressInput {
|
|
358
434
|
firstName: string;
|
|
@@ -360,12 +436,13 @@ interface ShippingAddressInput {
|
|
|
360
436
|
mobilePhone: string;
|
|
361
437
|
phoneNumber?: string;
|
|
362
438
|
email?: string;
|
|
363
|
-
regionId
|
|
364
|
-
cityId
|
|
439
|
+
regionId?: number;
|
|
440
|
+
cityId?: number;
|
|
365
441
|
address: string;
|
|
366
442
|
postalCode?: string;
|
|
367
443
|
latitude?: number;
|
|
368
444
|
longitude?: number;
|
|
445
|
+
showMap?: boolean;
|
|
369
446
|
userSetCoordinatesBefore?: boolean;
|
|
370
447
|
}
|
|
371
448
|
interface ShippingAddressCredentials {
|
|
@@ -374,41 +451,63 @@ interface ShippingAddressCredentials {
|
|
|
374
451
|
}
|
|
375
452
|
interface ShippingAssignment {
|
|
376
453
|
rateId: number;
|
|
377
|
-
invoiceItemIds: string
|
|
454
|
+
invoiceItemIds: Array<string | number>;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Order-related types
|
|
459
|
+
*/
|
|
460
|
+
|
|
461
|
+
interface Order {
|
|
462
|
+
id: number;
|
|
463
|
+
orderNumber: string;
|
|
464
|
+
orderIdentifier: string;
|
|
465
|
+
invoice: {
|
|
466
|
+
shippingItems: JsonObject[];
|
|
467
|
+
invoiceItems: InvoiceItem[];
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
interface OrdersListResponse {
|
|
471
|
+
orders: Order[];
|
|
472
|
+
totalCount: number;
|
|
473
|
+
totalCountRaw: number;
|
|
474
|
+
totalNotSeen: number;
|
|
475
|
+
totalSeen: number;
|
|
476
|
+
}
|
|
477
|
+
interface OrderFilters {
|
|
478
|
+
pageNumber?: number;
|
|
479
|
+
pageSize?: number;
|
|
480
|
+
filters?: Array<{
|
|
481
|
+
name: string;
|
|
482
|
+
value: JsonValue;
|
|
483
|
+
}>;
|
|
378
484
|
}
|
|
379
485
|
|
|
380
486
|
/**
|
|
381
487
|
* Payment-related types
|
|
382
488
|
*/
|
|
489
|
+
|
|
383
490
|
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
491
|
type PaymentStatus = 'PENDING' | 'PROCESSING' | 'PAID' | 'FAILED' | 'CANCELLED' | 'REFUNDED';
|
|
385
492
|
interface PaymentMethod {
|
|
386
493
|
id: number;
|
|
387
494
|
code: PaymentGateway;
|
|
388
|
-
|
|
389
|
-
description: {
|
|
390
|
-
description: string;
|
|
391
|
-
cardNumber?: string;
|
|
392
|
-
cardDescription?: string;
|
|
393
|
-
uploadNeeded?: boolean;
|
|
394
|
-
};
|
|
395
|
-
enabled: boolean;
|
|
396
|
-
config?: Record<string, any>;
|
|
495
|
+
isDefault: boolean;
|
|
397
496
|
}
|
|
398
497
|
interface Payment {
|
|
399
498
|
id: number;
|
|
400
499
|
identifier: string;
|
|
401
|
-
paymentType:
|
|
500
|
+
paymentType: {
|
|
501
|
+
id?: number;
|
|
502
|
+
code: PaymentGateway;
|
|
503
|
+
};
|
|
402
504
|
amount: number;
|
|
403
|
-
invoiceId: number;
|
|
404
|
-
status: PaymentStatus;
|
|
405
|
-
createdAt: string;
|
|
406
|
-
updatedAt: string;
|
|
407
505
|
}
|
|
408
506
|
interface PaymentAction {
|
|
409
|
-
action: 'POST' | 'REDIRECT' | 'UPLOAD' | '
|
|
507
|
+
action: 'POST' | 'REDIRECT' | 'UPLOAD' | 'pending' | 'showOrder' | 'StockViolated' | 'FAIL';
|
|
410
508
|
address?: string;
|
|
411
|
-
payload?:
|
|
509
|
+
payload?: JsonObject;
|
|
510
|
+
order?: Order;
|
|
412
511
|
time?: number;
|
|
413
512
|
message?: string;
|
|
414
513
|
}
|
|
@@ -422,39 +521,17 @@ interface CreatePaymentInput {
|
|
|
422
521
|
paymentType: number;
|
|
423
522
|
}
|
|
424
523
|
interface PaymentStepInput {
|
|
425
|
-
|
|
524
|
+
id?: number;
|
|
525
|
+
paymentIdentifier?: string;
|
|
526
|
+
payload?: JsonObject;
|
|
527
|
+
tatoken?: string;
|
|
528
|
+
trackingData?: JsonObject;
|
|
426
529
|
isFailed?: string;
|
|
427
530
|
imageUrl?: string;
|
|
428
531
|
code?: string;
|
|
429
532
|
}
|
|
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
|
-
}
|
|
533
|
+
type PaymentStepFormValue = string | number | boolean | null | undefined;
|
|
534
|
+
type PaymentStepFormFields = Record<string, PaymentStepFormValue>;
|
|
458
535
|
|
|
459
536
|
/**
|
|
460
537
|
* Search-related types
|
|
@@ -476,7 +553,7 @@ interface BlogPage {
|
|
|
476
553
|
content?: string;
|
|
477
554
|
summary?: string;
|
|
478
555
|
image?: Image;
|
|
479
|
-
themeConfig?:
|
|
556
|
+
themeConfig?: JsonObject;
|
|
480
557
|
attributes?: ProductAttribute[];
|
|
481
558
|
createdAt: string;
|
|
482
559
|
updatedAt: string;
|
|
@@ -493,7 +570,7 @@ interface CmsPage {
|
|
|
493
570
|
content?: string;
|
|
494
571
|
summary?: string;
|
|
495
572
|
image?: Image;
|
|
496
|
-
themeConfig?:
|
|
573
|
+
themeConfig?: JsonObject;
|
|
497
574
|
attributes?: ProductAttribute[];
|
|
498
575
|
createdAt: string;
|
|
499
576
|
updatedAt: string;
|
|
@@ -706,6 +783,7 @@ declare class HttpClient {
|
|
|
706
783
|
* Get request headers
|
|
707
784
|
*/
|
|
708
785
|
private getHeaders;
|
|
786
|
+
private isMultipartBody;
|
|
709
787
|
/**
|
|
710
788
|
* Check if status code should trigger a retry
|
|
711
789
|
*/
|
|
@@ -770,7 +848,7 @@ interface CategoryTreeNode {
|
|
|
770
848
|
entityType: 'product_category';
|
|
771
849
|
entityId: number;
|
|
772
850
|
entity: ProductCategory;
|
|
773
|
-
details:
|
|
851
|
+
details: JsonObject;
|
|
774
852
|
children: CategoryTreeNode[];
|
|
775
853
|
createdAt: string;
|
|
776
854
|
updatedAt: string;
|
|
@@ -878,10 +956,21 @@ declare class CredentialsManager {
|
|
|
878
956
|
* Supports both authenticated and guest users via credentials
|
|
879
957
|
*/
|
|
880
958
|
|
|
959
|
+
interface AddItemAttributesInput {
|
|
960
|
+
formAttributes?: Record<string, FormAttributeValue>;
|
|
961
|
+
schedulerBookingAttributes?: CreateCartInput['schedulerBookingAttributes'];
|
|
962
|
+
coupon?: string;
|
|
963
|
+
}
|
|
964
|
+
interface UpdateItemAttributesInput {
|
|
965
|
+
formAttributes?: Record<string, FormAttributeValue>;
|
|
966
|
+
coupon?: string;
|
|
967
|
+
deleteCoupon?: boolean;
|
|
968
|
+
}
|
|
881
969
|
declare class CartAPI {
|
|
882
970
|
private http;
|
|
883
971
|
private credentials;
|
|
884
972
|
constructor(http: HttpClient, credentials: CredentialsManager);
|
|
973
|
+
private persistCartCredentials;
|
|
885
974
|
/**
|
|
886
975
|
* Get current cart
|
|
887
976
|
*/
|
|
@@ -893,15 +982,23 @@ declare class CartAPI {
|
|
|
893
982
|
/**
|
|
894
983
|
* Add item to cart
|
|
895
984
|
*/
|
|
896
|
-
addItem(variantId: number, count: number, formAttributes?: Record<string,
|
|
985
|
+
addItem(variantId: number, count: number, formAttributes?: Record<string, FormAttributeValue>, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
986
|
+
/**
|
|
987
|
+
* Add item to cart with standardized attributes payload.
|
|
988
|
+
*/
|
|
989
|
+
addItemWithAttributes(variantId: number, count: number, attributes?: AddItemAttributesInput, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
897
990
|
/**
|
|
898
991
|
* Update cart item quantity
|
|
899
992
|
*/
|
|
900
|
-
updateItem(cartProductId: number, count: number, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
993
|
+
updateItem(cartProductId: number | string, variantId: number, count: number, formAttributes?: Record<string, FormAttributeValue>, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
994
|
+
/**
|
|
995
|
+
* Update cart item quantity and optional coupon mutations.
|
|
996
|
+
*/
|
|
997
|
+
updateItemWithAttributes(cartProductId: number | string, variantId: number, count: number, attributes?: UpdateItemAttributesInput, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
901
998
|
/**
|
|
902
999
|
* Remove item from cart
|
|
903
1000
|
*/
|
|
904
|
-
removeItem(cartProductId: number, variantId: number, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
1001
|
+
removeItem(cartProductId: number | string, variantId: number, options?: RequestOptions): Promise<SazitoResponse<Cart>>;
|
|
905
1002
|
/**
|
|
906
1003
|
* Clear current cart credentials
|
|
907
1004
|
*/
|
|
@@ -919,7 +1016,7 @@ declare class OrdersAPI {
|
|
|
919
1016
|
/**
|
|
920
1017
|
* List orders (requires authentication)
|
|
921
1018
|
*/
|
|
922
|
-
list(filters?: OrderFilters, options?: RequestOptions): Promise<SazitoResponse<
|
|
1019
|
+
list(filters?: OrderFilters, options?: RequestOptions): Promise<SazitoResponse<OrdersListResponse>>;
|
|
923
1020
|
/**
|
|
924
1021
|
* Get single order by ID (requires authentication)
|
|
925
1022
|
*/
|
|
@@ -930,10 +1027,16 @@ declare class OrdersAPI {
|
|
|
930
1027
|
* Invoices API (Checkout)
|
|
931
1028
|
*/
|
|
932
1029
|
|
|
1030
|
+
interface AddInvoiceFormInput {
|
|
1031
|
+
formAttributes: JsonObject;
|
|
1032
|
+
invoiceIdentifier?: string;
|
|
1033
|
+
identifier?: string;
|
|
1034
|
+
}
|
|
933
1035
|
declare class InvoicesAPI {
|
|
934
1036
|
private http;
|
|
935
1037
|
private credentials;
|
|
936
1038
|
constructor(http: HttpClient, credentials: CredentialsManager);
|
|
1039
|
+
private normalizeInvoiceResponse;
|
|
937
1040
|
/**
|
|
938
1041
|
* Get current invoice
|
|
939
1042
|
*/
|
|
@@ -962,10 +1065,26 @@ declare class InvoicesAPI {
|
|
|
962
1065
|
* Add invoice details (user comment)
|
|
963
1066
|
*/
|
|
964
1067
|
addDetails(comment: string, options?: RequestOptions): Promise<SazitoResponse<Invoice>>;
|
|
1068
|
+
/**
|
|
1069
|
+
* Attach checkout dynamic form data to invoice.
|
|
1070
|
+
*/
|
|
1071
|
+
addForm(input: AddInvoiceFormInput, options?: RequestOptions): Promise<SazitoResponse<Invoice>>;
|
|
1072
|
+
/**
|
|
1073
|
+
* Apply wallet credit to invoice.
|
|
1074
|
+
*/
|
|
1075
|
+
addCredit(options?: RequestOptions): Promise<SazitoResponse<Invoice>>;
|
|
1076
|
+
/**
|
|
1077
|
+
* Remove wallet credit from invoice.
|
|
1078
|
+
*/
|
|
1079
|
+
removeCredit(options?: RequestOptions): Promise<SazitoResponse<Invoice>>;
|
|
1080
|
+
/**
|
|
1081
|
+
* Toggle wallet credit based on current invoice state.
|
|
1082
|
+
*/
|
|
1083
|
+
toggleCredit(options?: RequestOptions): Promise<SazitoResponse<Invoice>>;
|
|
965
1084
|
/**
|
|
966
1085
|
* Get applicable shipping methods for invoice
|
|
967
1086
|
*/
|
|
968
|
-
getApplicableShippingMethods(options?: RequestOptions): Promise<SazitoResponse<
|
|
1087
|
+
getApplicableShippingMethods(options?: RequestOptions): Promise<SazitoResponse<ApplicableShippingMethods>>;
|
|
969
1088
|
/**
|
|
970
1089
|
* Clear current invoice credentials
|
|
971
1090
|
*/
|
|
@@ -980,6 +1099,7 @@ declare class ShippingAPI {
|
|
|
980
1099
|
private http;
|
|
981
1100
|
private credentials;
|
|
982
1101
|
constructor(http: HttpClient, credentials: CredentialsManager);
|
|
1102
|
+
private sanitizeAddressInput;
|
|
983
1103
|
/**
|
|
984
1104
|
* Create shipping address
|
|
985
1105
|
*/
|
|
@@ -1009,6 +1129,7 @@ declare class ShippingAPI {
|
|
|
1009
1129
|
declare class PaymentsAPI {
|
|
1010
1130
|
private http;
|
|
1011
1131
|
private credentials;
|
|
1132
|
+
private readonly pinchedPayments;
|
|
1012
1133
|
constructor(http: HttpClient, credentials: CredentialsManager);
|
|
1013
1134
|
/**
|
|
1014
1135
|
* Get list of payment methods for invoice
|
|
@@ -1025,11 +1146,25 @@ declare class PaymentsAPI {
|
|
|
1025
1146
|
/**
|
|
1026
1147
|
* Process payment step (for card-to-card or multi-step payments)
|
|
1027
1148
|
*/
|
|
1028
|
-
processStep(input: PaymentStepInput, options?: RequestOptions): Promise<SazitoResponse<
|
|
1149
|
+
processStep(input: PaymentStepInput, options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
|
|
1150
|
+
/**
|
|
1151
|
+
* Process payment step in form mode (non-JSON content-type).
|
|
1152
|
+
*/
|
|
1153
|
+
processStepForm(input: FormData | PaymentStepFormFields, options?: RequestOptions): Promise<SazitoResponse<PaymentAction>>;
|
|
1154
|
+
/**
|
|
1155
|
+
* Poll payment state every 15 seconds until action changes from pending.
|
|
1156
|
+
*/
|
|
1157
|
+
pollUntilSettled(options?: RequestOptions, intervalMs?: number): Promise<SazitoResponse<PaymentAction>>;
|
|
1029
1158
|
/**
|
|
1030
1159
|
* Clear payment credentials
|
|
1031
1160
|
*/
|
|
1032
1161
|
clearPayment(): void;
|
|
1162
|
+
private withExactJsonHeader;
|
|
1163
|
+
private buildProcessStepFormData;
|
|
1164
|
+
private appendFormValue;
|
|
1165
|
+
private normalizePayment;
|
|
1166
|
+
private normalizeAction;
|
|
1167
|
+
private callPinchAfterSuccessfulPayment;
|
|
1033
1168
|
}
|
|
1034
1169
|
|
|
1035
1170
|
/**
|
|
@@ -1118,6 +1253,8 @@ interface LoginResponse {
|
|
|
1118
1253
|
declare class UsersAPI {
|
|
1119
1254
|
private http;
|
|
1120
1255
|
constructor(http: HttpClient);
|
|
1256
|
+
private normalizeUserResponse;
|
|
1257
|
+
private normalizeLoginResponse;
|
|
1121
1258
|
/**
|
|
1122
1259
|
* Login with email and password
|
|
1123
1260
|
*/
|
|
@@ -1190,9 +1327,118 @@ declare class SearchAPI {
|
|
|
1190
1327
|
}
|
|
1191
1328
|
|
|
1192
1329
|
/**
|
|
1193
|
-
* Feedbacks API (
|
|
1330
|
+
* Feedbacks API (Tajrobe reviews + legacy feedback methods)
|
|
1194
1331
|
*/
|
|
1195
1332
|
|
|
1333
|
+
type RecommendationStatus = 'RECOMMENDED' | 'NEUTRAL' | 'NOT-RECOMMENDED' | 'NONE';
|
|
1334
|
+
interface FeedbackProductAttribute {
|
|
1335
|
+
name: string;
|
|
1336
|
+
value: string;
|
|
1337
|
+
}
|
|
1338
|
+
interface FeedbackProductImage {
|
|
1339
|
+
url: string;
|
|
1340
|
+
alt: string;
|
|
1341
|
+
}
|
|
1342
|
+
interface FeedbackSeedItem {
|
|
1343
|
+
productId: string;
|
|
1344
|
+
productVariantId: string;
|
|
1345
|
+
productName: string;
|
|
1346
|
+
productAttributes: FeedbackProductAttribute[];
|
|
1347
|
+
productImage: FeedbackProductImage;
|
|
1348
|
+
}
|
|
1349
|
+
interface FeedbackSeed {
|
|
1350
|
+
orderId: string;
|
|
1351
|
+
orderIdentifier: string;
|
|
1352
|
+
hasCommentAlready: boolean;
|
|
1353
|
+
items: FeedbackSeedItem[];
|
|
1354
|
+
}
|
|
1355
|
+
interface CreateOrderRatingInput {
|
|
1356
|
+
orderId: string;
|
|
1357
|
+
orderIdentifier: string;
|
|
1358
|
+
orderRate: number;
|
|
1359
|
+
}
|
|
1360
|
+
interface CommentResponse {
|
|
1361
|
+
id: string;
|
|
1362
|
+
}
|
|
1363
|
+
interface ProductReviewRequest {
|
|
1364
|
+
commentId: string;
|
|
1365
|
+
productId: string;
|
|
1366
|
+
productVariantId: string;
|
|
1367
|
+
productName: string;
|
|
1368
|
+
productAttributes: FeedbackProductAttribute[];
|
|
1369
|
+
productImage: FeedbackProductImage;
|
|
1370
|
+
productRate: number;
|
|
1371
|
+
text: string;
|
|
1372
|
+
pros: string[];
|
|
1373
|
+
cons: string[];
|
|
1374
|
+
recommendationStatus: RecommendationStatus;
|
|
1375
|
+
attachmentsServeKeys: string[];
|
|
1376
|
+
owner: boolean;
|
|
1377
|
+
isAnonymous: boolean;
|
|
1378
|
+
}
|
|
1379
|
+
interface ProductStatistics {
|
|
1380
|
+
productStatistics: {
|
|
1381
|
+
averageRate: number;
|
|
1382
|
+
totalCount: number;
|
|
1383
|
+
recommendations: {
|
|
1384
|
+
recommendedPercentage: number;
|
|
1385
|
+
recommendedTotalCount: number;
|
|
1386
|
+
};
|
|
1387
|
+
};
|
|
1388
|
+
}
|
|
1389
|
+
interface ProductReview {
|
|
1390
|
+
productRate: number;
|
|
1391
|
+
userFirstName: string;
|
|
1392
|
+
userLastName: string;
|
|
1393
|
+
createdAt: string;
|
|
1394
|
+
owner: boolean;
|
|
1395
|
+
text: string;
|
|
1396
|
+
recommendationStatus: RecommendationStatus;
|
|
1397
|
+
pros: string[];
|
|
1398
|
+
cons: string[];
|
|
1399
|
+
isAnonymous: boolean;
|
|
1400
|
+
metadata: {
|
|
1401
|
+
variantOptions: any[];
|
|
1402
|
+
productName: string;
|
|
1403
|
+
variantId: string;
|
|
1404
|
+
};
|
|
1405
|
+
attachments: Array<{
|
|
1406
|
+
serveUrl: string;
|
|
1407
|
+
}>;
|
|
1408
|
+
}
|
|
1409
|
+
interface ProductReviewsFilters {
|
|
1410
|
+
pageNumber?: number;
|
|
1411
|
+
pageSize?: number;
|
|
1412
|
+
}
|
|
1413
|
+
interface ProductReviewsResponse {
|
|
1414
|
+
entities: ProductReview[];
|
|
1415
|
+
pageNumber: number;
|
|
1416
|
+
pageSize: number;
|
|
1417
|
+
totalCount: number;
|
|
1418
|
+
averageRate: number;
|
|
1419
|
+
recommendations: {
|
|
1420
|
+
recommendedPercentage: number;
|
|
1421
|
+
recommendedTotalCount: number;
|
|
1422
|
+
};
|
|
1423
|
+
}
|
|
1424
|
+
interface ReviewAttachmentInput {
|
|
1425
|
+
file: File | Blob;
|
|
1426
|
+
name?: string;
|
|
1427
|
+
alt?: string;
|
|
1428
|
+
}
|
|
1429
|
+
interface ReviewUploadedImage {
|
|
1430
|
+
id: string;
|
|
1431
|
+
url: string;
|
|
1432
|
+
alt: string;
|
|
1433
|
+
serveUrl: string;
|
|
1434
|
+
serveKey: string;
|
|
1435
|
+
}
|
|
1436
|
+
interface ReviewImageUploadResponse {
|
|
1437
|
+
images: ReviewUploadedImage[];
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* Legacy feedback model kept for backwards compatibility.
|
|
1441
|
+
*/
|
|
1196
1442
|
interface Feedback {
|
|
1197
1443
|
id: number;
|
|
1198
1444
|
user?: {
|
|
@@ -1206,11 +1452,17 @@ interface Feedback {
|
|
|
1206
1452
|
createdAt: string;
|
|
1207
1453
|
updatedAt: string;
|
|
1208
1454
|
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Legacy create payload kept for backwards compatibility.
|
|
1457
|
+
*/
|
|
1209
1458
|
interface CreateFeedbackInput {
|
|
1210
1459
|
productId?: number;
|
|
1211
1460
|
rating?: number;
|
|
1212
1461
|
comment: string;
|
|
1213
1462
|
}
|
|
1463
|
+
/**
|
|
1464
|
+
* Legacy filters kept for backwards compatibility.
|
|
1465
|
+
*/
|
|
1214
1466
|
interface FeedbackFilters {
|
|
1215
1467
|
productId?: number;
|
|
1216
1468
|
page?: number;
|
|
@@ -1219,17 +1471,45 @@ interface FeedbackFilters {
|
|
|
1219
1471
|
declare class FeedbacksAPI {
|
|
1220
1472
|
private http;
|
|
1221
1473
|
constructor(http: HttpClient);
|
|
1222
|
-
private
|
|
1474
|
+
private normalizeSeedItem;
|
|
1475
|
+
private normalizeSeed;
|
|
1476
|
+
private normalizeProductReview;
|
|
1477
|
+
private normalizeProductReviewsResponse;
|
|
1478
|
+
private transformLegacyFilters;
|
|
1479
|
+
/**
|
|
1480
|
+
* Validate order and get products that can be reviewed.
|
|
1481
|
+
*/
|
|
1482
|
+
getSeed(orderIdentifier: string, options?: RequestOptions): Promise<SazitoResponse<FeedbackSeed>>;
|
|
1483
|
+
/**
|
|
1484
|
+
* Submit order/shop rating and get a comment identifier for product review steps.
|
|
1485
|
+
*/
|
|
1486
|
+
createOrderRating(input: CreateOrderRatingInput, options?: RequestOptions): Promise<SazitoResponse<CommentResponse>>;
|
|
1487
|
+
/**
|
|
1488
|
+
* Submit product-level review details.
|
|
1489
|
+
*/
|
|
1490
|
+
submitProductReview(input: ProductReviewRequest, options?: RequestOptions): Promise<SazitoResponse<void>>;
|
|
1491
|
+
/**
|
|
1492
|
+
* Fetch product review statistics (without review list).
|
|
1493
|
+
*/
|
|
1494
|
+
getProductStatistics(productId: string, options?: RequestOptions): Promise<SazitoResponse<ProductStatistics>>;
|
|
1223
1495
|
/**
|
|
1224
|
-
*
|
|
1496
|
+
* Fetch paginated product reviews.
|
|
1497
|
+
*/
|
|
1498
|
+
getProductReviews(productId: string, filters?: ProductReviewsFilters, options?: RequestOptions): Promise<SazitoResponse<ProductReviewsResponse>>;
|
|
1499
|
+
/**
|
|
1500
|
+
* Upload review images and get serve keys for attachments.
|
|
1501
|
+
*/
|
|
1502
|
+
uploadReviewImages(images: ReviewAttachmentInput[], options?: RequestOptions): Promise<SazitoResponse<ReviewImageUploadResponse>>;
|
|
1503
|
+
/**
|
|
1504
|
+
* Legacy list method kept for backwards compatibility.
|
|
1225
1505
|
*/
|
|
1226
1506
|
list(filters?: FeedbackFilters, options?: RequestOptions): Promise<SazitoResponse<PaginatedResponse<Feedback>>>;
|
|
1227
1507
|
/**
|
|
1228
|
-
*
|
|
1508
|
+
* Legacy create method kept for backwards compatibility.
|
|
1229
1509
|
*/
|
|
1230
1510
|
create(input: CreateFeedbackInput, options?: RequestOptions): Promise<SazitoResponse<Feedback>>;
|
|
1231
1511
|
/**
|
|
1232
|
-
*
|
|
1512
|
+
* Legacy get method kept for backwards compatibility.
|
|
1233
1513
|
*/
|
|
1234
1514
|
get(feedbackId: number, options?: RequestOptions): Promise<SazitoResponse<Feedback>>;
|
|
1235
1515
|
}
|
|
@@ -1404,69 +1684,114 @@ declare class VisitsAPI {
|
|
|
1404
1684
|
}
|
|
1405
1685
|
|
|
1406
1686
|
/**
|
|
1407
|
-
* Booking API (
|
|
1687
|
+
* Booking API (Scheduler and appointments)
|
|
1408
1688
|
*/
|
|
1409
1689
|
|
|
1690
|
+
/**
|
|
1691
|
+
* Legacy event shape returned by some scheduler list endpoints.
|
|
1692
|
+
*/
|
|
1410
1693
|
interface Event {
|
|
1411
1694
|
id: number;
|
|
1412
1695
|
title: string;
|
|
1413
1696
|
description?: string;
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
capacity
|
|
1417
|
-
|
|
1418
|
-
|
|
1697
|
+
startTime?: string;
|
|
1698
|
+
endTime?: string;
|
|
1699
|
+
capacity?: number;
|
|
1700
|
+
bookedCount?: number;
|
|
1701
|
+
availableSlots?: number;
|
|
1419
1702
|
price?: number;
|
|
1420
1703
|
location?: string;
|
|
1421
|
-
|
|
1704
|
+
createdAt?: string;
|
|
1422
1705
|
}
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1706
|
+
/**
|
|
1707
|
+
* Event details used in product booking flow.
|
|
1708
|
+
*/
|
|
1709
|
+
interface SchedulerEvent {
|
|
1710
|
+
entityId: number;
|
|
1711
|
+
title: string;
|
|
1712
|
+
description: string;
|
|
1713
|
+
durationsMinute: number[];
|
|
1714
|
+
}
|
|
1715
|
+
interface BookingTimeSlot {
|
|
1716
|
+
startTimeLocal: string;
|
|
1717
|
+
endTimeLocal: string;
|
|
1718
|
+
isAvailable: boolean;
|
|
1719
|
+
remainingCapacity: number;
|
|
1720
|
+
}
|
|
1721
|
+
interface BookingAvailableDay {
|
|
1722
|
+
date: string;
|
|
1723
|
+
timeSlots: BookingTimeSlot[];
|
|
1724
|
+
}
|
|
1725
|
+
interface EventAvailabilitiesResponse {
|
|
1726
|
+
availableDays: BookingAvailableDay[];
|
|
1727
|
+
}
|
|
1728
|
+
interface EventAvailabilityFilters {
|
|
1729
|
+
eventEntityId: number;
|
|
1730
|
+
duration: number;
|
|
1731
|
+
fromDate: string;
|
|
1732
|
+
toDate: string;
|
|
1733
|
+
timezone?: string;
|
|
1434
1734
|
}
|
|
1435
1735
|
interface CreateBookingInput {
|
|
1436
|
-
|
|
1736
|
+
eventEntityId?: number;
|
|
1737
|
+
event_entity_id?: number;
|
|
1437
1738
|
timezone: string;
|
|
1438
|
-
|
|
1739
|
+
attendeeName?: string;
|
|
1740
|
+
attendee_name?: string;
|
|
1741
|
+
attendeeEmail?: string;
|
|
1439
1742
|
attendee_email?: string;
|
|
1743
|
+
attendeePhone?: string;
|
|
1440
1744
|
attendee_phone?: string;
|
|
1441
1745
|
}
|
|
1746
|
+
interface Booking {
|
|
1747
|
+
id: number;
|
|
1748
|
+
eventId: number;
|
|
1749
|
+
event: Event;
|
|
1750
|
+
userId?: number;
|
|
1751
|
+
attendeeName: string;
|
|
1752
|
+
attendeeEmail?: string;
|
|
1753
|
+
attendeePhone?: string;
|
|
1754
|
+
status: 'pending' | 'confirmed' | 'cancelled';
|
|
1755
|
+
bookingTime: string;
|
|
1756
|
+
createdAt: string;
|
|
1757
|
+
}
|
|
1442
1758
|
interface EventFilters {
|
|
1759
|
+
startDate?: string;
|
|
1443
1760
|
start_date?: string;
|
|
1761
|
+
endDate?: string;
|
|
1444
1762
|
end_date?: string;
|
|
1763
|
+
availableOnly?: boolean;
|
|
1445
1764
|
available_only?: boolean;
|
|
1446
1765
|
page?: number;
|
|
1766
|
+
pageSize?: number;
|
|
1447
1767
|
page_size?: number;
|
|
1448
1768
|
}
|
|
1449
1769
|
declare class BookingAPI {
|
|
1450
1770
|
private http;
|
|
1451
1771
|
constructor(http: HttpClient);
|
|
1772
|
+
private transformEventFilters;
|
|
1452
1773
|
/**
|
|
1453
|
-
* List available events
|
|
1774
|
+
* List available events (legacy scheduler listing).
|
|
1454
1775
|
*/
|
|
1455
1776
|
listEvents(filters?: EventFilters, options?: RequestOptions): Promise<SazitoResponse<PaginatedResponse<Event>>>;
|
|
1456
1777
|
/**
|
|
1457
|
-
* Get
|
|
1778
|
+
* Get event details used for booking (durations, title, description).
|
|
1458
1779
|
*/
|
|
1459
|
-
getEvent(
|
|
1780
|
+
getEvent(entityId: number, options?: RequestOptions): Promise<SazitoResponse<SchedulerEvent>>;
|
|
1460
1781
|
/**
|
|
1461
|
-
*
|
|
1782
|
+
* Get available days and time slots for an event.
|
|
1783
|
+
*/
|
|
1784
|
+
getEventAvailabilities(filters: EventAvailabilityFilters, options?: RequestOptions): Promise<SazitoResponse<EventAvailabilitiesResponse>>;
|
|
1785
|
+
/**
|
|
1786
|
+
* Create booking (legacy endpoint kept for backward compatibility).
|
|
1462
1787
|
*/
|
|
1463
1788
|
createBooking(input: CreateBookingInput, options?: RequestOptions): Promise<SazitoResponse<Booking>>;
|
|
1464
1789
|
/**
|
|
1465
|
-
* List user bookings (requires authentication)
|
|
1790
|
+
* List user bookings (requires authentication).
|
|
1466
1791
|
*/
|
|
1467
1792
|
listBookings(options?: RequestOptions): Promise<SazitoResponse<PaginatedResponse<Booking>>>;
|
|
1468
1793
|
/**
|
|
1469
|
-
* Cancel booking
|
|
1794
|
+
* Cancel booking.
|
|
1470
1795
|
*/
|
|
1471
1796
|
cancelBooking(bookingId: number, options?: RequestOptions): Promise<SazitoResponse<Booking>>;
|
|
1472
1797
|
}
|
|
@@ -1653,6 +1978,78 @@ declare class GeneralAPI {
|
|
|
1653
1978
|
getTajrobeConfig(options?: RequestOptions): Promise<SazitoResponse<TajrobeConfig>>;
|
|
1654
1979
|
}
|
|
1655
1980
|
|
|
1981
|
+
/**
|
|
1982
|
+
* Dynamic Forms API
|
|
1983
|
+
*/
|
|
1984
|
+
|
|
1985
|
+
type DynamicFormFieldType = 'TextBox' | 'TextArea' | 'Select' | 'Checkbox' | 'StatusBox' | 'Number' | 'Password' | 'NationalId' | 'PhoneNumber' | 'IBAN' | 'Separator' | 'Uploader';
|
|
1986
|
+
interface SelectOption {
|
|
1987
|
+
value: string;
|
|
1988
|
+
label: string;
|
|
1989
|
+
}
|
|
1990
|
+
interface DynamicFormField {
|
|
1991
|
+
key: string;
|
|
1992
|
+
name: string;
|
|
1993
|
+
type: DynamicFormFieldType;
|
|
1994
|
+
label: string;
|
|
1995
|
+
value: any;
|
|
1996
|
+
placeholder: string;
|
|
1997
|
+
required: boolean;
|
|
1998
|
+
inputOptions: SelectOption[];
|
|
1999
|
+
allowedExtensions: string[];
|
|
2000
|
+
}
|
|
2001
|
+
interface DynamicForm {
|
|
2002
|
+
id: number;
|
|
2003
|
+
title: string;
|
|
2004
|
+
description: string;
|
|
2005
|
+
fields: DynamicFormField[];
|
|
2006
|
+
}
|
|
2007
|
+
interface UploadedDynamicFormFile {
|
|
2008
|
+
serveKey: string;
|
|
2009
|
+
}
|
|
2010
|
+
declare class DynamicFormsAPI {
|
|
2011
|
+
private http;
|
|
2012
|
+
constructor(http: HttpClient);
|
|
2013
|
+
private normalizeField;
|
|
2014
|
+
private normalizeForm;
|
|
2015
|
+
/**
|
|
2016
|
+
* Fetch dynamic form definition by ID.
|
|
2017
|
+
*/
|
|
2018
|
+
getForm(formId: number, options?: RequestOptions): Promise<SazitoResponse<DynamicForm>>;
|
|
2019
|
+
/**
|
|
2020
|
+
* Upload file for uploader fields in product dynamic forms.
|
|
2021
|
+
*/
|
|
2022
|
+
uploadProductFormFile(file: File | Blob, options?: RequestOptions): Promise<SazitoResponse<UploadedDynamicFormFile>>;
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
/**
|
|
2026
|
+
* Regions API
|
|
2027
|
+
*/
|
|
2028
|
+
|
|
2029
|
+
interface RegionCity {
|
|
2030
|
+
id: number;
|
|
2031
|
+
name: string;
|
|
2032
|
+
latitude: number;
|
|
2033
|
+
longitude: number;
|
|
2034
|
+
}
|
|
2035
|
+
interface RegionWithCities {
|
|
2036
|
+
id: number;
|
|
2037
|
+
name: string;
|
|
2038
|
+
cities: RegionCity[];
|
|
2039
|
+
}
|
|
2040
|
+
declare class RegionsAPI {
|
|
2041
|
+
private http;
|
|
2042
|
+
constructor(http: HttpClient);
|
|
2043
|
+
private normalizeCity;
|
|
2044
|
+
private normalizeRegion;
|
|
2045
|
+
private extractRegions;
|
|
2046
|
+
private sortAlphabetically;
|
|
2047
|
+
/**
|
|
2048
|
+
* Get all regions with nested cities (sorted by name).
|
|
2049
|
+
*/
|
|
2050
|
+
list(options?: RequestOptions): Promise<SazitoResponse<RegionWithCities[]>>;
|
|
2051
|
+
}
|
|
2052
|
+
|
|
1656
2053
|
/**
|
|
1657
2054
|
* Main Sazito SDK Client
|
|
1658
2055
|
*/
|
|
@@ -1679,6 +2076,8 @@ declare class SazitoClient {
|
|
|
1679
2076
|
readonly entityRoutes: EntityRoutesAPI;
|
|
1680
2077
|
readonly menu: MenuAPI;
|
|
1681
2078
|
readonly general: GeneralAPI;
|
|
2079
|
+
readonly dynamicForms: DynamicFormsAPI;
|
|
2080
|
+
readonly regions: RegionsAPI;
|
|
1682
2081
|
constructor(config: SazitoConfig);
|
|
1683
2082
|
/**
|
|
1684
2083
|
* Set authentication token (stored in localStorage with cookie fallback)
|
|
@@ -1759,54 +2158,60 @@ declare function createMenuAPI(configOrContext: SazitoConfig | ModuleContext): M
|
|
|
1759
2158
|
|
|
1760
2159
|
declare function createGeneralAPI(configOrContext: SazitoConfig | ModuleContext): GeneralAPI;
|
|
1761
2160
|
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
2161
|
+
declare function createDynamicFormsAPI(configOrContext: SazitoConfig | ModuleContext): DynamicFormsAPI;
|
|
2162
|
+
|
|
2163
|
+
declare function createRegionsAPI(configOrContext: SazitoConfig | ModuleContext): RegionsAPI;
|
|
2164
|
+
|
|
2165
|
+
type TransformScalar = string | number | boolean | null | undefined;
|
|
2166
|
+
type TransformValue = TransformScalar | TransformObject | TransformValue[] | object;
|
|
2167
|
+
interface TransformObject {
|
|
2168
|
+
[key: string]: TransformValue;
|
|
2169
|
+
}
|
|
2170
|
+
interface ApiResponseEnvelope {
|
|
2171
|
+
data?: {
|
|
2172
|
+
result?: TransformObject;
|
|
2173
|
+
};
|
|
2174
|
+
}
|
|
1766
2175
|
/**
|
|
1767
2176
|
* Transform object keys from snake_case to camelCase with field name beautification
|
|
1768
2177
|
* @param obj - Object to transform
|
|
1769
2178
|
* @returns Transformed object with camelCase keys and beautiful field names
|
|
1770
2179
|
*/
|
|
1771
|
-
declare function transformResponseKeys(obj:
|
|
2180
|
+
declare function transformResponseKeys(obj: TransformValue | object): TransformValue;
|
|
1772
2181
|
/**
|
|
1773
2182
|
* Transform object keys from camelCase to snake_case for API requests
|
|
1774
2183
|
* @param obj - Object to transform
|
|
1775
2184
|
* @returns Transformed object with snake_case keys
|
|
1776
2185
|
*/
|
|
1777
|
-
declare function transformRequestKeys(obj:
|
|
2186
|
+
declare function transformRequestKeys(obj: TransformValue | object): TransformValue;
|
|
1778
2187
|
/**
|
|
1779
2188
|
* Transform API response data structure
|
|
1780
2189
|
* Unwraps the { data: { result: { ... } } } structure and transforms keys
|
|
1781
2190
|
*/
|
|
1782
|
-
declare function transformApiResponse<T =
|
|
2191
|
+
declare function transformApiResponse<T = TransformObject>(response: TransformValue | ApiResponseEnvelope | object): T;
|
|
1783
2192
|
/**
|
|
1784
2193
|
* Specific transformer for cart responses
|
|
1785
2194
|
* Handles the cart-specific data structure
|
|
1786
2195
|
*/
|
|
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;
|
|
2196
|
+
declare function transformCartResponse<T = TransformObject>(response: TransformValue | ApiResponseEnvelope | object): T;
|
|
2197
|
+
declare function transformInvoiceResponse<T = TransformObject>(response: TransformValue | ApiResponseEnvelope | object): T;
|
|
1793
2198
|
/**
|
|
1794
2199
|
* Specific transformer for product list responses
|
|
1795
2200
|
* Handles paginated product lists
|
|
1796
2201
|
*/
|
|
1797
|
-
declare function transformProductListResponse(response:
|
|
2202
|
+
declare function transformProductListResponse<T = TransformObject>(response: TransformValue | ApiResponseEnvelope | object): T;
|
|
1798
2203
|
/**
|
|
1799
2204
|
* Transform shipping address input for API request
|
|
1800
2205
|
*/
|
|
1801
|
-
declare function transformShippingAddressInput(input:
|
|
2206
|
+
declare function transformShippingAddressInput(input: TransformValue): TransformObject;
|
|
1802
2207
|
/**
|
|
1803
2208
|
* Transform add to cart input for API request
|
|
1804
2209
|
*/
|
|
1805
|
-
declare function transformAddToCartInput(variantId: number, quantity: number, formAttributes?:
|
|
2210
|
+
declare function transformAddToCartInput(variantId: number, quantity: number, formAttributes?: TransformValue): TransformObject;
|
|
1806
2211
|
/**
|
|
1807
2212
|
* Transform create cart input for API request
|
|
1808
2213
|
*/
|
|
1809
|
-
declare function transformCreateCartInput(input:
|
|
2214
|
+
declare function transformCreateCartInput(input: TransformValue): TransformObject;
|
|
1810
2215
|
|
|
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,
|
|
2216
|
+
export { CredentialsManager, HttpClient, 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, transformAddToCartInput, transformApiResponse, transformCartResponse, transformCreateCartInput, transformInvoiceResponse, transformProductListResponse, transformRequestKeys, transformResponseKeys, transformShippingAddressInput, createUsersAPI as users, createVisitsAPI as visits, createWalletAPI as wallet };
|
|
2217
|
+
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, 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, Tag, UnknownEntityRoute, UploadedFormFileAttribute, User };
|