@basedone/core 0.1.10 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/chunk-4GAKANLT.mjs +1987 -0
  2. package/dist/chunk-4UEJOM6W.mjs +1 -3
  3. package/dist/chunk-VBC6EQ7Q.mjs +235 -0
  4. package/dist/client-CgmiTuEX.d.mts +179 -0
  5. package/dist/client-CgmiTuEX.d.ts +179 -0
  6. package/dist/ecommerce.d.mts +3732 -0
  7. package/dist/ecommerce.d.ts +3732 -0
  8. package/dist/ecommerce.js +2031 -0
  9. package/dist/ecommerce.mjs +2 -0
  10. package/dist/index.d.mts +51 -43
  11. package/dist/index.d.ts +51 -43
  12. package/dist/index.js +2691 -205
  13. package/dist/index.mjs +68 -90
  14. package/dist/{meta-FVJIMALT.mjs → meta-JB5ITE27.mjs} +4 -10
  15. package/dist/meta-UOGUG3OW.mjs +3 -7
  16. package/dist/{perpDexs-GGL32HT4.mjs → perpDexs-3LRJ5ZHM.mjs} +37 -8
  17. package/dist/{perpDexs-G7V2QIM6.mjs → perpDexs-4ISLD7NX.mjs} +177 -32
  18. package/dist/react.d.mts +39 -0
  19. package/dist/react.d.ts +39 -0
  20. package/dist/react.js +268 -0
  21. package/dist/react.mjs +31 -0
  22. package/dist/{spotMeta-OD7S6HGW.mjs → spotMeta-GHXX7C5M.mjs} +24 -9
  23. package/dist/{spotMeta-PCN4Z4R3.mjs → spotMeta-IBBUP2SG.mjs} +54 -6
  24. package/dist/staticMeta-GM7T3OYL.mjs +3 -6
  25. package/dist/staticMeta-QV2KMX57.mjs +3 -6
  26. package/ecommerce.ts +15 -0
  27. package/index.ts +6 -0
  28. package/lib/ecommerce/QUICK_REFERENCE.md +211 -0
  29. package/lib/ecommerce/README.md +385 -0
  30. package/lib/ecommerce/USAGE_EXAMPLES.md +704 -0
  31. package/lib/ecommerce/client/base.ts +272 -0
  32. package/lib/ecommerce/client/customer.ts +522 -0
  33. package/lib/ecommerce/client/merchant.ts +1341 -0
  34. package/lib/ecommerce/index.ts +51 -0
  35. package/lib/ecommerce/types/entities.ts +722 -0
  36. package/lib/ecommerce/types/enums.ts +270 -0
  37. package/lib/ecommerce/types/index.ts +18 -0
  38. package/lib/ecommerce/types/requests.ts +525 -0
  39. package/lib/ecommerce/types/responses.ts +805 -0
  40. package/lib/ecommerce/utils/errors.ts +113 -0
  41. package/lib/ecommerce/utils/helpers.ts +131 -0
  42. package/lib/hip3/market-info.ts +1 -1
  43. package/lib/instrument/client.ts +351 -0
  44. package/lib/meta/data/mainnet/perpDexs.json +34 -4
  45. package/lib/meta/data/mainnet/spotMeta.json +21 -3
  46. package/lib/meta/data/testnet/meta.json +1 -3
  47. package/lib/meta/data/testnet/perpDexs.json +174 -28
  48. package/lib/meta/data/testnet/spotMeta.json +51 -0
  49. package/lib/react/InstrumentProvider.tsx +69 -0
  50. package/lib/utils/flooredDateTime.ts +55 -0
  51. package/lib/utils/time.ts +51 -0
  52. package/package.json +37 -11
  53. package/react.ts +1 -0
@@ -0,0 +1,3732 @@
1
+ import { AxiosRequestConfig, AxiosInstance } from 'axios';
2
+
3
+ /**
4
+ * Base Ecommerce API Client
5
+ *
6
+ * This module provides the base HTTP client for the ecommerce API with
7
+ * authentication, error handling, and retry logic.
8
+ */
9
+
10
+ /**
11
+ * Client configuration options
12
+ */
13
+ interface EcommerceClientConfig {
14
+ /** Base API URL */
15
+ baseURL: string;
16
+ /** Authentication token (Bearer token) */
17
+ authToken?: string;
18
+ /** Request timeout in milliseconds */
19
+ timeout?: number;
20
+ /** Maximum number of retries for failed requests */
21
+ maxRetries?: number;
22
+ /** Base delay for exponential backoff (ms) */
23
+ retryBaseDelay?: number;
24
+ /** Custom headers */
25
+ headers?: Record<string, string>;
26
+ /** Enable automatic retry on retryable errors */
27
+ enableRetry?: boolean;
28
+ }
29
+ /**
30
+ * Base ecommerce API client class
31
+ *
32
+ * Provides HTTP methods with authentication, error handling, and retry logic.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const client = new BaseEcommerceClient({
37
+ * baseURL: "https://api.example.com",
38
+ * authToken: "your-auth-token",
39
+ * timeout: 30000,
40
+ * maxRetries: 3,
41
+ * });
42
+ *
43
+ * // Make authenticated request
44
+ * const products = await client.get("/api/marketplace/products");
45
+ * ```
46
+ */
47
+ declare class BaseEcommerceClient {
48
+ private axiosInstance;
49
+ private config;
50
+ constructor(config: EcommerceClientConfig);
51
+ /**
52
+ * Update authentication token
53
+ *
54
+ * @param token - New authentication token
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * client.setAuthToken("new-auth-token");
59
+ * ```
60
+ */
61
+ setAuthToken(token: string): void;
62
+ /**
63
+ * Clear authentication token
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * client.clearAuthToken();
68
+ * ```
69
+ */
70
+ clearAuthToken(): void;
71
+ /**
72
+ * Make a GET request
73
+ *
74
+ * @param url - Request URL
75
+ * @param config - Axios request config
76
+ * @returns Response data
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * const products = await client.get("/api/marketplace/products", {
81
+ * params: { limit: 20, offset: 0 }
82
+ * });
83
+ * ```
84
+ */
85
+ get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
86
+ /**
87
+ * Make a POST request
88
+ *
89
+ * @param url - Request URL
90
+ * @param data - Request body data
91
+ * @param config - Axios request config
92
+ * @returns Response data
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * const order = await client.post("/api/marketplace/orders", {
97
+ * items: [{ productId: "123", quantity: 1 }],
98
+ * paymentMethod: "USDC_ESCROW"
99
+ * });
100
+ * ```
101
+ */
102
+ post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
103
+ /**
104
+ * Make a PUT request
105
+ *
106
+ * @param url - Request URL
107
+ * @param data - Request body data
108
+ * @param config - Axios request config
109
+ * @returns Response data
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * const product = await client.put("/api/marketplace/products/123", {
114
+ * title: "Updated Product"
115
+ * });
116
+ * ```
117
+ */
118
+ put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
119
+ /**
120
+ * Make a PATCH request
121
+ *
122
+ * @param url - Request URL
123
+ * @param data - Request body data
124
+ * @param config - Axios request config
125
+ * @returns Response data
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * const order = await client.patch("/api/marketplace/merchant/orders/123", {
130
+ * status: "SHIPPED",
131
+ * tracking: { trackingNumber: "123456", carrier: "UPS" }
132
+ * });
133
+ * ```
134
+ */
135
+ patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
136
+ /**
137
+ * Make a DELETE request
138
+ *
139
+ * @param url - Request URL
140
+ * @param config - Axios request config
141
+ * @returns Response data
142
+ *
143
+ * @example
144
+ * ```typescript
145
+ * await client.delete("/api/marketplace/products/123");
146
+ * ```
147
+ */
148
+ delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
149
+ /**
150
+ * Make a request with retry logic
151
+ *
152
+ * @param config - Axios request config
153
+ * @returns Response data
154
+ */
155
+ private request;
156
+ /**
157
+ * Get the underlying axios instance
158
+ *
159
+ * @returns Axios instance
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * const axios = client.getAxiosInstance();
164
+ * // Use axios directly for advanced use cases
165
+ * ```
166
+ */
167
+ getAxiosInstance(): AxiosInstance;
168
+ }
169
+
170
+ /**
171
+ * Ecommerce Type Enums
172
+ *
173
+ * This module contains all enum types used in the ecommerce API.
174
+ */
175
+ /**
176
+ * Order status enum representing the lifecycle of an order
177
+ */
178
+ declare enum OrderStatus {
179
+ /** Order created but payment not initiated */
180
+ CREATED = "CREATED",
181
+ /** Awaiting escrow deposit from customer */
182
+ AWAITING_DEPOSIT = "AWAITING_DEPOSIT",
183
+ /** Payment reserved in escrow */
184
+ PAYMENT_RESERVED = "PAYMENT_RESERVED",
185
+ /** Merchant has accepted the order */
186
+ MERCHANT_ACCEPTED = "MERCHANT_ACCEPTED",
187
+ /** Order has been shipped */
188
+ SHIPPED = "SHIPPED",
189
+ /** Order has been delivered */
190
+ DELIVERED = "DELIVERED",
191
+ /** Order has been cancelled */
192
+ CANCELLED = "CANCELLED",
193
+ /** Order is confirmed (legacy status) */
194
+ CONFIRMED = "CONFIRMED",
195
+ /** Order is completed (legacy status) */
196
+ COMPLETED = "COMPLETED"
197
+ }
198
+ /**
199
+ * Payment method enum
200
+ */
201
+ declare enum PaymentMethod {
202
+ /** USDC payment via Hyperliquid escrow */
203
+ USDC_ESCROW = "USDC_ESCROW",
204
+ /** Points-based payment */
205
+ POINTS = "POINTS"
206
+ }
207
+ /**
208
+ * Payment status enum
209
+ */
210
+ declare enum PaymentStatus {
211
+ /** Payment is pending */
212
+ PENDING = "PENDING",
213
+ /** Payment is reserved in escrow */
214
+ RESERVED = "RESERVED",
215
+ /** Payment is completed */
216
+ COMPLETED = "COMPLETED",
217
+ /** Payment failed */
218
+ FAILED = "FAILED",
219
+ /** Payment was refunded */
220
+ REFUNDED = "REFUNDED"
221
+ }
222
+ /**
223
+ * Merchant status enum
224
+ */
225
+ declare enum MerchantStatus {
226
+ /** Merchant is active */
227
+ ACTIVE = "ACTIVE",
228
+ /** Merchant is suspended */
229
+ SUSPENDED = "SUSPENDED",
230
+ /** Merchant is pending approval */
231
+ PENDING = "PENDING"
232
+ }
233
+ /**
234
+ * Shipment status enum
235
+ */
236
+ declare enum ShipmentStatus {
237
+ /** Shipment is pending */
238
+ PENDING = "PENDING",
239
+ /** Shipment is in transit */
240
+ SHIPPED = "SHIPPED",
241
+ /** Shipment is delivered */
242
+ DELIVERED = "DELIVERED",
243
+ /** Shipment failed */
244
+ FAILED = "FAILED"
245
+ }
246
+ /**
247
+ * Return status enum
248
+ */
249
+ declare enum ReturnStatus {
250
+ /** Return requested by customer */
251
+ REQUESTED = "REQUESTED",
252
+ /** Return approved by merchant */
253
+ APPROVED = "APPROVED",
254
+ /** Return rejected by merchant */
255
+ REJECTED = "REJECTED",
256
+ /** Return item shipped back */
257
+ SHIPPED_BACK = "SHIPPED_BACK",
258
+ /** Return item received by merchant */
259
+ RECEIVED = "RECEIVED",
260
+ /** Refund processed */
261
+ REFUNDED = "REFUNDED"
262
+ }
263
+ /**
264
+ * Review status enum
265
+ */
266
+ declare enum ReviewStatus {
267
+ /** Review is pending */
268
+ PENDING = "PENDING",
269
+ /** Review has been responded to */
270
+ RESPONDED = "RESPONDED",
271
+ /** Review has been flagged */
272
+ FLAGGED = "FLAGGED"
273
+ }
274
+ /**
275
+ * Discount type enum
276
+ */
277
+ declare enum DiscountType {
278
+ /** Percentage discount */
279
+ PERCENTAGE = "PERCENTAGE",
280
+ /** Fixed amount discount */
281
+ FIXED_AMOUNT = "FIXED_AMOUNT",
282
+ /** Buy X get Y discount */
283
+ BUY_X_GET_Y = "BUY_X_GET_Y",
284
+ /** Free shipping */
285
+ FREE_SHIPPING = "FREE_SHIPPING"
286
+ }
287
+ /**
288
+ * Discount method enum
289
+ */
290
+ declare enum DiscountMethod {
291
+ /** Code-based discount (coupon) */
292
+ CODE = "CODE",
293
+ /** Automatic discount */
294
+ AUTOMATIC = "AUTOMATIC"
295
+ }
296
+ /**
297
+ * Discount scope enum
298
+ */
299
+ declare enum DiscountScope {
300
+ /** Applies to entire order */
301
+ ORDER = "ORDER",
302
+ /** Applies to specific products */
303
+ PRODUCT = "PRODUCT",
304
+ /** Applies to specific categories */
305
+ CATEGORY = "CATEGORY",
306
+ /** Applies to shipping */
307
+ SHIPPING = "SHIPPING"
308
+ }
309
+ /**
310
+ * Banner type enum
311
+ */
312
+ declare enum BannerType {
313
+ /** Hero banner */
314
+ HERO = "HERO",
315
+ /** Promotional banner */
316
+ PROMO = "PROMO",
317
+ /** Featured banner */
318
+ FEATURED = "FEATURED"
319
+ }
320
+ /**
321
+ * Tax type enum
322
+ */
323
+ declare enum TaxType {
324
+ /** Sales tax */
325
+ SALES_TAX = "SALES_TAX",
326
+ /** Value-added tax */
327
+ VAT = "VAT",
328
+ /** Goods and services tax */
329
+ GST = "GST",
330
+ /** Provincial sales tax */
331
+ PST = "PST",
332
+ /** Harmonized sales tax */
333
+ HST = "HST"
334
+ }
335
+ /**
336
+ * Tax behavior enum
337
+ */
338
+ declare enum TaxBehavior {
339
+ /** Charge tax on top of price */
340
+ CHARGE = "CHARGE",
341
+ /** Tax is included in price */
342
+ INCLUSIVE = "INCLUSIVE",
343
+ /** No tax */
344
+ EXEMPT = "EXEMPT"
345
+ }
346
+ /**
347
+ * Tax report period type enum
348
+ */
349
+ declare enum TaxReportPeriodType {
350
+ /** Monthly report */
351
+ MONTHLY = "MONTHLY",
352
+ /** Quarterly report */
353
+ QUARTERLY = "QUARTERLY",
354
+ /** Yearly report */
355
+ YEARLY = "YEARLY"
356
+ }
357
+ /**
358
+ * Tax report status enum
359
+ */
360
+ declare enum TaxReportStatus {
361
+ /** Report is in draft */
362
+ DRAFT = "DRAFT",
363
+ /** Report is finalized */
364
+ FINALIZED = "FINALIZED",
365
+ /** Report has been filed */
366
+ FILED = "FILED"
367
+ }
368
+ /**
369
+ * Inventory audit action enum
370
+ */
371
+ declare enum InventoryAuditAction {
372
+ /** Inventory created */
373
+ CREATED = "CREATED",
374
+ /** Inventory updated */
375
+ UPDATED = "UPDATED",
376
+ /** Inventory reserved */
377
+ RESERVED = "RESERVED",
378
+ /** Inventory deducted */
379
+ DEDUCTED = "DEDUCTED",
380
+ /** Inventory restored */
381
+ RESTORED = "RESTORED"
382
+ }
383
+ /**
384
+ * Sort order enum
385
+ */
386
+ declare enum SortOrder {
387
+ /** Ascending order */
388
+ ASC = "asc",
389
+ /** Descending order */
390
+ DESC = "desc"
391
+ }
392
+ /**
393
+ * Product sort by enum
394
+ */
395
+ declare enum ProductSortBy {
396
+ /** Sort by date (newest first) */
397
+ DATE_DESC = "date_desc",
398
+ /** Sort by date (oldest first) */
399
+ DATE_ASC = "date_asc",
400
+ /** Sort by price (low to high) */
401
+ PRICE_ASC = "price_asc",
402
+ /** Sort by price (high to low) */
403
+ PRICE_DESC = "price_desc",
404
+ /** Sort by popularity */
405
+ POPULAR = "popular",
406
+ /** Sort by featured status */
407
+ FEATURED = "featured"
408
+ }
409
+ /**
410
+ * Review sort by enum
411
+ */
412
+ declare enum ReviewSortBy {
413
+ /** Sort by newest */
414
+ NEWEST = "newest",
415
+ /** Sort by highest rating */
416
+ HIGHEST = "highest",
417
+ /** Sort by lowest rating */
418
+ LOWEST = "lowest"
419
+ }
420
+
421
+ /**
422
+ * Ecommerce Entity Interfaces
423
+ *
424
+ * This module contains all core entity interfaces used in the ecommerce API.
425
+ */
426
+
427
+ /**
428
+ * Base entity interface with common fields
429
+ */
430
+ interface BaseEntity {
431
+ /** Unique identifier */
432
+ id: string;
433
+ /** Creation timestamp */
434
+ createdAt: string;
435
+ /** Last update timestamp */
436
+ updatedAt: string;
437
+ /** Tenant ID for multi-tenancy */
438
+ tenantId?: string | null;
439
+ }
440
+ /**
441
+ * Product dimensions
442
+ */
443
+ interface ProductDimensions {
444
+ /** Length in cm */
445
+ length?: number;
446
+ /** Width in cm */
447
+ width?: number;
448
+ /** Height in cm */
449
+ height?: number;
450
+ }
451
+ /**
452
+ * Product entity
453
+ */
454
+ interface Product extends BaseEntity {
455
+ /** Merchant ID */
456
+ merchantId: string;
457
+ /** Product title */
458
+ title: string;
459
+ /** Product description (plain text) */
460
+ description?: string | null;
461
+ /** Rich description (HTML) */
462
+ richDescription?: string | null;
463
+ /** Product images URLs */
464
+ images: string[];
465
+ /** Legacy single image URL (for backward compatibility) */
466
+ imageUrl?: string | null;
467
+ /** Price in USDC */
468
+ priceUSDC: string;
469
+ /** Compare at price (original price for discount display) */
470
+ compareAtPrice?: string | null;
471
+ /** Stock keeping unit */
472
+ sku?: string | null;
473
+ /** Inventory count */
474
+ inventory?: number | null;
475
+ /** Minimum order quantity */
476
+ moq: number;
477
+ /** Product category slug */
478
+ category?: string | null;
479
+ /** Category ID */
480
+ categoryId?: string | null;
481
+ /** Product tags */
482
+ tags?: string[];
483
+ /** Weight in kg */
484
+ weight?: string | null;
485
+ /** Product dimensions */
486
+ dimensions?: ProductDimensions | null;
487
+ /** Is product active */
488
+ isActive: boolean;
489
+ /** Is product featured */
490
+ featured: boolean;
491
+ /** View count */
492
+ viewCount: number;
493
+ /** Sold count */
494
+ soldCount: number;
495
+ /** Average rating (computed from reviews) */
496
+ averageRating?: number | null;
497
+ /** Review count */
498
+ reviewCount?: number;
499
+ /** Merchant information */
500
+ merchant?: Merchant;
501
+ /** Product variants */
502
+ variants?: ProductVariant[];
503
+ /** Product reviews */
504
+ reviews?: ProductReview[];
505
+ }
506
+ /**
507
+ * Product variant entity
508
+ */
509
+ interface ProductVariant extends BaseEntity {
510
+ /** Product ID */
511
+ productId: string;
512
+ /** Variant name */
513
+ name: string;
514
+ /** SKU */
515
+ sku?: string | null;
516
+ /** Price override (if different from base product) */
517
+ priceUSDC?: string | null;
518
+ /** Inventory count */
519
+ inventory?: number | null;
520
+ /** Variant attributes (e.g., {color: "red", size: "L"}) */
521
+ attributes: Record<string, string>;
522
+ /** Is variant active */
523
+ isActive: boolean;
524
+ /** Sort order */
525
+ sortOrder: number;
526
+ }
527
+ /**
528
+ * Merchant entity
529
+ */
530
+ interface Merchant extends BaseEntity {
531
+ /** Owner user ID */
532
+ ownerUserId: string;
533
+ /** Merchant name */
534
+ name: string;
535
+ /** Merchant description */
536
+ description?: string | null;
537
+ /** Payout address (wallet) */
538
+ payoutAddress: string;
539
+ /** Merchant status */
540
+ status: MerchantStatus;
541
+ }
542
+ /**
543
+ * Shipping address
544
+ */
545
+ interface ShippingAddress {
546
+ /** Full name */
547
+ fullName: string;
548
+ /** Phone number */
549
+ phone: string;
550
+ /** Email address */
551
+ email?: string | null;
552
+ /** Address line 1 */
553
+ addressLine1: string;
554
+ /** Address line 2 */
555
+ addressLine2?: string | null;
556
+ /** City */
557
+ city: string;
558
+ /** State or province */
559
+ stateProvince: string;
560
+ /** Postal code */
561
+ postalCode: string;
562
+ /** Country */
563
+ country: string;
564
+ /** Delivery instructions */
565
+ deliveryInstructions?: string | null;
566
+ }
567
+ /**
568
+ * User shipping address entity (saved addresses)
569
+ */
570
+ interface UserShippingAddress extends BaseEntity, ShippingAddress {
571
+ /** User ID */
572
+ userId: string;
573
+ /** Is default address */
574
+ isDefault: boolean;
575
+ /** Address label (e.g., "Home", "Work") */
576
+ label?: string | null;
577
+ }
578
+ /**
579
+ * Order item
580
+ */
581
+ interface OrderItem extends BaseEntity {
582
+ /** Order ID */
583
+ orderId: string;
584
+ /** Product ID */
585
+ productId: string;
586
+ /** Variant ID */
587
+ variantId?: string | null;
588
+ /** Quantity */
589
+ quantity: number;
590
+ /** Unit price in USDC (snapshot at order time) */
591
+ unitPriceUSDC: string;
592
+ /** Product title snapshot */
593
+ titleSnapshot: string;
594
+ /** Product details (for display) */
595
+ product?: Product;
596
+ /** Variant details (for display) */
597
+ variant?: ProductVariant;
598
+ }
599
+ /**
600
+ * Payment entity
601
+ */
602
+ interface Payment extends BaseEntity {
603
+ /** Order ID */
604
+ orderId: string;
605
+ /** Payment method */
606
+ method: PaymentMethod;
607
+ /** Payment status */
608
+ status: PaymentStatus;
609
+ /** Amount in USDC */
610
+ amountUSDC: string;
611
+ /** Deposit transaction hash */
612
+ depositTxHash?: string | null;
613
+ /** Settlement transaction hash */
614
+ settlementTxHash?: string | null;
615
+ }
616
+ /**
617
+ * Settlement entity
618
+ */
619
+ interface Settlement extends BaseEntity {
620
+ /** Order ID */
621
+ orderId: string;
622
+ /** Merchant ID */
623
+ merchantId: string;
624
+ /** Merchant payout address */
625
+ merchantPayoutAddress: string;
626
+ /** Amount in USDC */
627
+ amountUSDC: string;
628
+ /** Settlement status */
629
+ status: string;
630
+ /** Transaction hash */
631
+ txHash?: string | null;
632
+ /** Next attempt timestamp */
633
+ nextAttemptAt?: string | null;
634
+ /** Attempt count */
635
+ attemptCount: number;
636
+ /** Last error */
637
+ lastError?: string | null;
638
+ }
639
+ /**
640
+ * Shipment entity
641
+ */
642
+ interface Shipment extends BaseEntity {
643
+ /** Order ID */
644
+ orderId: string;
645
+ /** Shipment status */
646
+ status: ShipmentStatus;
647
+ /** Carrier name */
648
+ carrier?: string | null;
649
+ /** Tracking number */
650
+ trackingNumber?: string | null;
651
+ /** Shipping label URL */
652
+ shippingLabel?: string | null;
653
+ /** Shipped timestamp */
654
+ shippedAt?: string | null;
655
+ /** Delivered timestamp */
656
+ deliveredAt?: string | null;
657
+ }
658
+ /**
659
+ * Order entity
660
+ */
661
+ interface Order extends BaseEntity {
662
+ /** User ID (customer) */
663
+ userId: string;
664
+ /** Merchant ID */
665
+ merchantId: string;
666
+ /** Order status */
667
+ status: OrderStatus;
668
+ /** Total amount in USDC */
669
+ totalUSDC: string;
670
+ /** Payment method */
671
+ paymentMethod: PaymentMethod;
672
+ /** Shipping address */
673
+ shippingAddress: ShippingAddress;
674
+ /** Customer notes */
675
+ customerNotes?: string | null;
676
+ /** Order items */
677
+ items: OrderItem[];
678
+ /** Payment information */
679
+ payment?: Payment;
680
+ /** Settlement information */
681
+ settlement?: Settlement;
682
+ /** Shipment information */
683
+ shipment?: Shipment;
684
+ /** Merchant information */
685
+ merchant?: Merchant;
686
+ /** Customer information */
687
+ user?: {
688
+ id: string;
689
+ username?: string;
690
+ email?: string;
691
+ };
692
+ /** Order events */
693
+ events?: OrderEvent[];
694
+ }
695
+ /**
696
+ * Order event entity
697
+ */
698
+ interface OrderEvent extends BaseEntity {
699
+ /** Order ID */
700
+ orderId: string;
701
+ /** Event type */
702
+ eventType: string;
703
+ /** Event title */
704
+ title: string;
705
+ /** Event description */
706
+ description?: string | null;
707
+ /** Event metadata */
708
+ metadata?: Record<string, any> | null;
709
+ /** Performer user ID */
710
+ performedBy?: string | null;
711
+ /** Performer information */
712
+ performer?: {
713
+ id: string;
714
+ username?: string;
715
+ };
716
+ }
717
+ /**
718
+ * Product review entity
719
+ */
720
+ interface ProductReview extends BaseEntity {
721
+ /** Product ID */
722
+ productId: string;
723
+ /** User ID */
724
+ userId: string;
725
+ /** Order ID (for verified purchase) */
726
+ orderId?: string | null;
727
+ /** Rating (1-5) */
728
+ rating: number;
729
+ /** Review title */
730
+ title?: string | null;
731
+ /** Review comment */
732
+ comment?: string | null;
733
+ /** Review images */
734
+ images?: string[];
735
+ /** Merchant response */
736
+ merchantResponse?: string | null;
737
+ /** Merchant responded timestamp */
738
+ merchantRespondedAt?: string | null;
739
+ /** Is verified purchase */
740
+ isVerifiedPurchase: boolean;
741
+ /** Is visible */
742
+ isVisible: boolean;
743
+ /** Review status */
744
+ status: ReviewStatus;
745
+ /** Helpfulness count (thumbs up) */
746
+ helpfulCount: number;
747
+ /** User information */
748
+ user?: {
749
+ id: string;
750
+ address: string;
751
+ };
752
+ /** Product information */
753
+ product?: Product;
754
+ }
755
+ /**
756
+ * Return entity
757
+ */
758
+ interface Return extends BaseEntity {
759
+ /** Order ID */
760
+ orderId: string;
761
+ /** User ID */
762
+ userId: string;
763
+ /** Merchant ID */
764
+ merchantId: string;
765
+ /** Return status */
766
+ status: ReturnStatus;
767
+ /** Return reason */
768
+ reason?: string | null;
769
+ /** Requested timestamp */
770
+ requestedAt: string;
771
+ /** Approved timestamp */
772
+ approvedAt?: string | null;
773
+ /** Rejected timestamp */
774
+ rejectedAt?: string | null;
775
+ /** Received timestamp */
776
+ receivedAt?: string | null;
777
+ /** Completed timestamp */
778
+ completedAt?: string | null;
779
+ /** Return items */
780
+ items: ReturnItem[];
781
+ }
782
+ /**
783
+ * Return item
784
+ */
785
+ interface ReturnItem {
786
+ /** Item ID */
787
+ id: string;
788
+ /** Product ID */
789
+ productId: string;
790
+ /** Quantity */
791
+ quantity: number;
792
+ /** Reason */
793
+ reason?: string | null;
794
+ /** Product information */
795
+ product?: Product;
796
+ }
797
+ /**
798
+ * Coupon entity
799
+ */
800
+ interface Coupon extends BaseEntity {
801
+ /** Merchant ID */
802
+ merchantId: string;
803
+ /** Coupon code */
804
+ code: string;
805
+ /** Coupon title */
806
+ title?: string | null;
807
+ /** Discount method */
808
+ discountMethod: DiscountMethod;
809
+ /** Discount type */
810
+ discountType: DiscountType;
811
+ /** Discount scope */
812
+ discountScope: DiscountScope;
813
+ /** Discount value */
814
+ discountValue: number;
815
+ /** Minimum purchase amount */
816
+ minPurchase?: number | null;
817
+ /** Minimum quantity */
818
+ minQuantity?: number | null;
819
+ /** Buy quantity (for BUY_X_GET_Y) */
820
+ buyQuantity?: number | null;
821
+ /** Get quantity (for BUY_X_GET_Y) */
822
+ getQuantity?: number | null;
823
+ /** Get discount value (for BUY_X_GET_Y) */
824
+ getDiscountValue?: number | null;
825
+ /** Maximum uses */
826
+ maxUses?: number | null;
827
+ /** Uses per customer */
828
+ usesPerCustomer?: number | null;
829
+ /** Used count */
830
+ usedCount: number;
831
+ /** Applicable product IDs */
832
+ applicableProducts: string[];
833
+ /** Applicable category IDs */
834
+ applicableCategories: string[];
835
+ /** Can be combined with other discounts */
836
+ combinable: boolean;
837
+ /** Start timestamp */
838
+ startsAt: string;
839
+ /** Expiry timestamp */
840
+ expiresAt: string;
841
+ /** Is active */
842
+ isActive: boolean;
843
+ /** Coupon usages */
844
+ usages?: CouponUsage[];
845
+ }
846
+ /**
847
+ * Coupon usage entity
848
+ */
849
+ interface CouponUsage extends BaseEntity {
850
+ /** Coupon ID */
851
+ couponId: string;
852
+ /** User ID */
853
+ userId: string;
854
+ /** Order ID */
855
+ orderId: string;
856
+ /** Discount amount */
857
+ discount: string;
858
+ /** Used timestamp */
859
+ usedAt: string;
860
+ /** User information */
861
+ user?: {
862
+ username?: string;
863
+ };
864
+ }
865
+ /**
866
+ * Shipping method entity
867
+ */
868
+ interface ShippingMethod extends BaseEntity {
869
+ /** Merchant ID */
870
+ merchantId: string;
871
+ /** Method name */
872
+ name: string;
873
+ /** Carrier */
874
+ carrier?: string | null;
875
+ /** Estimated delivery days */
876
+ estimatedDays?: string | null;
877
+ /** Flat rate */
878
+ flatRate?: number | null;
879
+ /** Is weight-based */
880
+ weightBased: boolean;
881
+ /** Free shipping threshold */
882
+ freeThreshold?: number | null;
883
+ /** Is active */
884
+ isActive: boolean;
885
+ }
886
+ /**
887
+ * Banner entity
888
+ */
889
+ interface Banner extends BaseEntity {
890
+ /** Merchant ID (null for admin banners) */
891
+ merchantId?: string | null;
892
+ /** Banner type */
893
+ type: BannerType;
894
+ /** Title */
895
+ title: string;
896
+ /** Subtitle */
897
+ subtitle?: string | null;
898
+ /** Image URL */
899
+ imageUrl: string;
900
+ /** Link URL */
901
+ linkUrl?: string | null;
902
+ /** Call-to-action text */
903
+ ctaText?: string | null;
904
+ /** Start date */
905
+ startDate?: string | null;
906
+ /** End date */
907
+ endDate?: string | null;
908
+ /** Priority (higher = shown first) */
909
+ priority: number;
910
+ /** Is active */
911
+ isActive: boolean;
912
+ /** Impressions count */
913
+ impressions: number;
914
+ /** Clicks count */
915
+ clicks: number;
916
+ /** Merchant information */
917
+ merchant?: {
918
+ id: string;
919
+ name: string;
920
+ };
921
+ }
922
+ /**
923
+ * Media asset entity
924
+ */
925
+ interface MediaAsset extends BaseEntity {
926
+ /** Merchant ID */
927
+ merchantId: string;
928
+ /** Blob URL */
929
+ blobUrl: string;
930
+ /** Blob pathname */
931
+ blobPathname: string;
932
+ /** Download URL */
933
+ downloadUrl: string;
934
+ /** Filename */
935
+ filename: string;
936
+ /** Content type */
937
+ contentType: string;
938
+ /** File size in bytes */
939
+ size: number;
940
+ }
941
+ /**
942
+ * Message entity
943
+ */
944
+ interface Message extends BaseEntity {
945
+ /** Order ID */
946
+ orderId: string;
947
+ /** Sender user ID */
948
+ senderId: string;
949
+ /** Recipient user ID */
950
+ recipientId: string;
951
+ /** Message text */
952
+ message: string;
953
+ /** Is read */
954
+ isRead: boolean;
955
+ /** Sender information */
956
+ sender?: {
957
+ id: string;
958
+ username?: string;
959
+ };
960
+ /** Recipient information */
961
+ recipient?: {
962
+ id: string;
963
+ username?: string;
964
+ };
965
+ /** Order information */
966
+ order?: Order;
967
+ }
968
+ /**
969
+ * Tax settings entity
970
+ */
971
+ interface TaxSettings extends BaseEntity {
972
+ /** Merchant ID */
973
+ merchantId: string;
974
+ /** Is tax enabled */
975
+ taxEnabled: boolean;
976
+ /** Prices include tax */
977
+ pricesIncludeTax: boolean;
978
+ /** Default tax behavior */
979
+ defaultTaxBehavior: TaxBehavior;
980
+ /** Tax registration number */
981
+ taxRegistrationNumber?: string | null;
982
+ /** Registration country */
983
+ registrationCountry?: string | null;
984
+ }
985
+ /**
986
+ * Tax rule entity
987
+ */
988
+ interface TaxRule extends BaseEntity {
989
+ /** Merchant ID */
990
+ merchantId: string;
991
+ /** Country */
992
+ country: string;
993
+ /** Region/state */
994
+ region?: string | null;
995
+ /** Postal code from */
996
+ postalCodeFrom?: string | null;
997
+ /** Postal code to */
998
+ postalCodeTo?: string | null;
999
+ /** Tax type */
1000
+ taxType: TaxType;
1001
+ /** Tax name */
1002
+ taxName: string;
1003
+ /** Tax rate (percentage) */
1004
+ taxRate: number;
1005
+ /** Priority (higher = applied first) */
1006
+ priority: number;
1007
+ /** Is compound tax */
1008
+ isCompound: boolean;
1009
+ /** Is active */
1010
+ isActive: boolean;
1011
+ }
1012
+ /**
1013
+ * Tax nexus entity
1014
+ */
1015
+ interface TaxNexus extends BaseEntity {
1016
+ /** Merchant ID */
1017
+ merchantId: string;
1018
+ /** Country */
1019
+ country: string;
1020
+ /** Region/state */
1021
+ region?: string | null;
1022
+ /** Registration ID */
1023
+ registrationId?: string | null;
1024
+ /** Is active */
1025
+ isActive: boolean;
1026
+ }
1027
+ /**
1028
+ * Tax report entity
1029
+ */
1030
+ interface TaxReport extends BaseEntity {
1031
+ /** Merchant ID */
1032
+ merchantId: string;
1033
+ /** Period type */
1034
+ periodType: TaxReportPeriodType;
1035
+ /** Period start */
1036
+ periodStart: string;
1037
+ /** Period end */
1038
+ periodEnd: string;
1039
+ /** Total taxable amount */
1040
+ totalTaxable: string;
1041
+ /** Total tax amount */
1042
+ totalTax: string;
1043
+ /** Report status */
1044
+ status: TaxReportStatus;
1045
+ /** Exported timestamp */
1046
+ exportedAt?: string | null;
1047
+ }
1048
+ /**
1049
+ * Inventory audit entry
1050
+ */
1051
+ interface InventoryAuditEntry extends BaseEntity {
1052
+ /** Product ID */
1053
+ productId: string;
1054
+ /** Variant ID */
1055
+ variantId?: string | null;
1056
+ /** Action */
1057
+ action: InventoryAuditAction;
1058
+ /** Previous quantity */
1059
+ previousQuantity?: number | null;
1060
+ /** New quantity */
1061
+ newQuantity?: number | null;
1062
+ /** Change amount */
1063
+ changeAmount: number;
1064
+ /** Reason */
1065
+ reason?: string | null;
1066
+ /** Reference ID (e.g., order ID) */
1067
+ referenceId?: string | null;
1068
+ /** Product information */
1069
+ product?: Product;
1070
+ /** Variant information */
1071
+ variant?: ProductVariant;
1072
+ }
1073
+ /**
1074
+ * Customer summary (for merchant view)
1075
+ */
1076
+ interface CustomerSummary {
1077
+ /** Customer user ID */
1078
+ id: string;
1079
+ /** Username */
1080
+ username?: string;
1081
+ /** Email */
1082
+ email?: string;
1083
+ /** Wallet address */
1084
+ address?: string;
1085
+ /** Total orders */
1086
+ totalOrders: number;
1087
+ /** Total spent */
1088
+ totalSpent: string;
1089
+ /** Average order value */
1090
+ averageOrderValue: string;
1091
+ /** Last order date */
1092
+ lastOrderDate?: string;
1093
+ /** First order date */
1094
+ firstOrderDate?: string;
1095
+ }
1096
+
1097
+ /**
1098
+ * Ecommerce API Request Types
1099
+ *
1100
+ * This module contains all request types for the ecommerce API.
1101
+ */
1102
+
1103
+ /**
1104
+ * Pagination parameters
1105
+ */
1106
+ interface PaginationParams {
1107
+ /** Number of items to return */
1108
+ limit?: number;
1109
+ /** Number of items to skip */
1110
+ offset?: number;
1111
+ }
1112
+ /**
1113
+ * List products request parameters
1114
+ */
1115
+ interface ListProductsParams extends PaginationParams {
1116
+ /** Filter by specific product IDs */
1117
+ ids?: string[];
1118
+ /** Filter by merchant ID */
1119
+ merchantId?: string;
1120
+ /** Filter by category slug */
1121
+ category?: string;
1122
+ /** Search query */
1123
+ search?: string;
1124
+ /** Filter by tags */
1125
+ tags?: string[];
1126
+ /** Minimum price */
1127
+ minPrice?: number;
1128
+ /** Maximum price */
1129
+ maxPrice?: number;
1130
+ /** Filter by featured status */
1131
+ featured?: boolean;
1132
+ /** Sort by */
1133
+ sortBy?: ProductSortBy;
1134
+ /** Filter by active status */
1135
+ isActive?: boolean;
1136
+ }
1137
+ /**
1138
+ * Create product request
1139
+ */
1140
+ interface CreateProductRequest {
1141
+ /** Product title */
1142
+ title: string;
1143
+ /** Product images URLs (from media library) */
1144
+ images: string[];
1145
+ /** Price in USDC */
1146
+ priceUSDC: number;
1147
+ /** Compare at price */
1148
+ compareAtPrice?: number | null;
1149
+ /** Inventory count */
1150
+ inventory?: number | null;
1151
+ /** SKU */
1152
+ sku?: string | null;
1153
+ /** Minimum order quantity */
1154
+ moq?: number;
1155
+ /** Category slug */
1156
+ category?: string | null;
1157
+ /** Rich description (HTML) */
1158
+ richDescription?: string | null;
1159
+ /** Weight in kg */
1160
+ weight?: number | null;
1161
+ /** Dimensions */
1162
+ dimensions?: ProductDimensions | null;
1163
+ /** Is active */
1164
+ isActive?: boolean;
1165
+ }
1166
+ /**
1167
+ * Update product request
1168
+ */
1169
+ interface UpdateProductRequest extends Partial<CreateProductRequest> {
1170
+ }
1171
+ /**
1172
+ * Create product variant request
1173
+ */
1174
+ interface CreateProductVariantRequest {
1175
+ /** Variant name */
1176
+ name: string;
1177
+ /** SKU */
1178
+ sku?: string | null;
1179
+ /** Price override */
1180
+ priceUSDC?: number | null;
1181
+ /** Inventory count */
1182
+ inventory?: number | null;
1183
+ /** Variant attributes */
1184
+ attributes: Record<string, string>;
1185
+ /** Is active */
1186
+ isActive?: boolean;
1187
+ /** Sort order */
1188
+ sortOrder?: number;
1189
+ }
1190
+ /**
1191
+ * Update product variant request
1192
+ */
1193
+ interface UpdateProductVariantRequest extends Partial<CreateProductVariantRequest> {
1194
+ }
1195
+ /**
1196
+ * Cart item
1197
+ */
1198
+ interface CartItem {
1199
+ /** Product ID */
1200
+ productId: string;
1201
+ /** Quantity */
1202
+ quantity: number;
1203
+ /** Variant ID (optional) */
1204
+ variantId?: string;
1205
+ }
1206
+ /**
1207
+ * Create order request
1208
+ */
1209
+ interface CreateOrderRequest {
1210
+ /** Cart items */
1211
+ items: CartItem[];
1212
+ /** Payment method */
1213
+ paymentMethod: PaymentMethod;
1214
+ /** Shipping address */
1215
+ shippingAddress: ShippingAddress;
1216
+ /** Customer notes */
1217
+ customerNotes?: string;
1218
+ /** Coupon code */
1219
+ couponCode?: string;
1220
+ /** Idempotency key */
1221
+ idempotencyKey?: string;
1222
+ }
1223
+ /**
1224
+ * List orders request parameters
1225
+ */
1226
+ interface ListOrdersParams extends PaginationParams {
1227
+ /** Filter by status */
1228
+ status?: OrderStatus;
1229
+ }
1230
+ /**
1231
+ * Update order status request
1232
+ */
1233
+ interface UpdateOrderStatusRequest {
1234
+ /** New status */
1235
+ status: OrderStatus;
1236
+ /** Tracking information (required for SHIPPED status) */
1237
+ tracking?: {
1238
+ trackingNumber: string;
1239
+ carrier: string;
1240
+ };
1241
+ }
1242
+ /**
1243
+ * Create order event request
1244
+ */
1245
+ interface CreateOrderEventRequest {
1246
+ /** Event type */
1247
+ eventType: string;
1248
+ /** Event title */
1249
+ title: string;
1250
+ /** Event description */
1251
+ description?: string;
1252
+ /** Event metadata */
1253
+ metadata?: Record<string, any>;
1254
+ }
1255
+ /**
1256
+ * Create review request
1257
+ */
1258
+ interface CreateReviewRequest {
1259
+ /** Rating (1-5) */
1260
+ rating: number;
1261
+ /** Review title */
1262
+ title?: string;
1263
+ /** Review comment */
1264
+ comment?: string;
1265
+ }
1266
+ /**
1267
+ * List reviews request parameters
1268
+ */
1269
+ interface ListReviewsParams extends PaginationParams {
1270
+ /** Sort by */
1271
+ sortBy?: ReviewSortBy;
1272
+ }
1273
+ /**
1274
+ * Respond to review request
1275
+ */
1276
+ interface RespondToReviewRequest {
1277
+ /** Merchant response */
1278
+ merchantResponse: string;
1279
+ }
1280
+ /**
1281
+ * Create/update shipping address request
1282
+ */
1283
+ interface ShippingAddressRequest extends ShippingAddress {
1284
+ /** Is default address */
1285
+ isDefault?: boolean;
1286
+ /** Address label */
1287
+ label?: string | null;
1288
+ }
1289
+ /**
1290
+ * Calculate cart discounts request
1291
+ */
1292
+ interface CalculateCartDiscountsRequest {
1293
+ /** Cart items */
1294
+ items: CartItem[];
1295
+ }
1296
+ /**
1297
+ * Validate discount code request
1298
+ */
1299
+ interface ValidateDiscountRequest {
1300
+ /** Discount code */
1301
+ code: string;
1302
+ /** Cart items */
1303
+ items: CartItem[];
1304
+ }
1305
+ /**
1306
+ * Calculate tax request
1307
+ */
1308
+ interface CalculateTaxRequest {
1309
+ /** Cart items */
1310
+ items: CartItem[];
1311
+ /** Shipping address */
1312
+ shippingAddress: {
1313
+ country: string;
1314
+ region?: string;
1315
+ postalCode?: string;
1316
+ };
1317
+ }
1318
+ /**
1319
+ * Create/update merchant profile request
1320
+ */
1321
+ interface MerchantProfileRequest {
1322
+ /** Merchant name */
1323
+ name: string;
1324
+ /** Description */
1325
+ description?: string | null;
1326
+ /** Payout address (wallet) */
1327
+ payoutAddress: string;
1328
+ }
1329
+ /**
1330
+ * Create coupon request
1331
+ */
1332
+ interface CreateCouponRequest {
1333
+ /** Coupon code */
1334
+ code?: string;
1335
+ /** Title */
1336
+ title?: string | null;
1337
+ /** Discount method */
1338
+ discountMethod?: DiscountMethod;
1339
+ /** Discount type */
1340
+ discountType: DiscountType;
1341
+ /** Discount scope */
1342
+ discountScope?: DiscountScope;
1343
+ /** Discount value */
1344
+ discountValue: number;
1345
+ /** Minimum purchase */
1346
+ minPurchase?: number | null;
1347
+ /** Minimum quantity */
1348
+ minQuantity?: number | null;
1349
+ /** Buy quantity */
1350
+ buyQuantity?: number | null;
1351
+ /** Get quantity */
1352
+ getQuantity?: number | null;
1353
+ /** Get discount value */
1354
+ getDiscountValue?: number | null;
1355
+ /** Maximum uses */
1356
+ maxUses?: number | null;
1357
+ /** Uses per customer */
1358
+ usesPerCustomer?: number | null;
1359
+ /** Applicable products */
1360
+ applicableProducts?: string[];
1361
+ /** Applicable categories */
1362
+ applicableCategories?: string[];
1363
+ /** Combinable */
1364
+ combinable?: boolean;
1365
+ /** Start date */
1366
+ startsAt: string;
1367
+ /** Expiry date */
1368
+ expiresAt: string;
1369
+ /** Is active */
1370
+ isActive?: boolean;
1371
+ }
1372
+ /**
1373
+ * Update coupon request
1374
+ */
1375
+ interface UpdateCouponRequest extends Partial<CreateCouponRequest> {
1376
+ }
1377
+ /**
1378
+ * Create shipping method request
1379
+ */
1380
+ interface CreateShippingMethodRequest {
1381
+ /** Method name */
1382
+ name: string;
1383
+ /** Carrier */
1384
+ carrier?: string | null;
1385
+ /** Estimated delivery days */
1386
+ estimatedDays?: string | null;
1387
+ /** Flat rate */
1388
+ flatRate?: number | null;
1389
+ /** Weight-based */
1390
+ weightBased?: boolean;
1391
+ /** Free threshold */
1392
+ freeThreshold?: number | null;
1393
+ /** Is active */
1394
+ isActive?: boolean;
1395
+ }
1396
+ /**
1397
+ * Update shipping method request
1398
+ */
1399
+ interface UpdateShippingMethodRequest extends Partial<CreateShippingMethodRequest> {
1400
+ }
1401
+ /**
1402
+ * Update shipment request
1403
+ */
1404
+ interface UpdateShipmentRequest {
1405
+ /** Shipment status */
1406
+ status?: ShipmentStatus;
1407
+ /** Tracking number */
1408
+ trackingNumber?: string | null;
1409
+ /** Carrier */
1410
+ carrier?: string | null;
1411
+ /** Shipping label URL */
1412
+ shippingLabel?: string | null;
1413
+ }
1414
+ /**
1415
+ * Create banner request
1416
+ */
1417
+ interface CreateBannerRequest {
1418
+ /** Banner type */
1419
+ type?: BannerType;
1420
+ /** Title */
1421
+ title: string;
1422
+ /** Subtitle */
1423
+ subtitle?: string | null;
1424
+ /** Image URL */
1425
+ imageUrl: string;
1426
+ /** Link URL */
1427
+ linkUrl?: string | null;
1428
+ /** CTA text */
1429
+ ctaText?: string | null;
1430
+ /** Start date */
1431
+ startDate?: string | null;
1432
+ /** End date */
1433
+ endDate?: string | null;
1434
+ /** Priority */
1435
+ priority?: number;
1436
+ /** Is active */
1437
+ isActive?: boolean;
1438
+ }
1439
+ /**
1440
+ * Update banner request
1441
+ */
1442
+ interface UpdateBannerRequest extends Partial<CreateBannerRequest> {
1443
+ }
1444
+ /**
1445
+ * Track banner request
1446
+ */
1447
+ interface TrackBannerRequest {
1448
+ /** Action type */
1449
+ action: "impression" | "click";
1450
+ }
1451
+ /**
1452
+ * Send message request
1453
+ */
1454
+ interface SendMessageRequest {
1455
+ /** Order ID */
1456
+ orderId: string;
1457
+ /** Recipient user ID */
1458
+ recipientId: string;
1459
+ /** Message text */
1460
+ message: string;
1461
+ }
1462
+ /**
1463
+ * Update tax settings request
1464
+ */
1465
+ interface UpdateTaxSettingsRequest {
1466
+ /** Tax enabled */
1467
+ taxEnabled?: boolean;
1468
+ /** Prices include tax */
1469
+ pricesIncludeTax?: boolean;
1470
+ /** Default tax behavior */
1471
+ defaultTaxBehavior?: TaxBehavior;
1472
+ /** Tax registration number */
1473
+ taxRegistrationNumber?: string | null;
1474
+ /** Registration country */
1475
+ registrationCountry?: string | null;
1476
+ }
1477
+ /**
1478
+ * Create tax rule request
1479
+ */
1480
+ interface CreateTaxRuleRequest {
1481
+ /** Country */
1482
+ country: string;
1483
+ /** Region */
1484
+ region?: string | null;
1485
+ /** Postal code from */
1486
+ postalCodeFrom?: string | null;
1487
+ /** Postal code to */
1488
+ postalCodeTo?: string | null;
1489
+ /** Tax type */
1490
+ taxType: TaxType;
1491
+ /** Tax name */
1492
+ taxName: string;
1493
+ /** Tax rate */
1494
+ taxRate: number;
1495
+ /** Priority */
1496
+ priority?: number;
1497
+ /** Is compound */
1498
+ isCompound?: boolean;
1499
+ }
1500
+ /**
1501
+ * Update tax rule request
1502
+ */
1503
+ interface UpdateTaxRuleRequest extends Partial<CreateTaxRuleRequest> {
1504
+ /** Is active */
1505
+ isActive?: boolean;
1506
+ }
1507
+ /**
1508
+ * Create tax nexus request
1509
+ */
1510
+ interface CreateTaxNexusRequest {
1511
+ /** Country */
1512
+ country: string;
1513
+ /** Region */
1514
+ region?: string | null;
1515
+ /** Registration ID */
1516
+ registrationId?: string | null;
1517
+ }
1518
+ /**
1519
+ * Update tax nexus request
1520
+ */
1521
+ interface UpdateTaxNexusRequest {
1522
+ /** Registration ID */
1523
+ registrationId?: string | null;
1524
+ /** Is active */
1525
+ isActive?: boolean;
1526
+ }
1527
+ /**
1528
+ * Generate tax report request
1529
+ */
1530
+ interface GenerateTaxReportRequest {
1531
+ /** Period type */
1532
+ periodType: TaxReportPeriodType;
1533
+ /** Year */
1534
+ year: number;
1535
+ /** Period (1-12 for monthly, 1-4 for quarterly, 1 for yearly) */
1536
+ period: number;
1537
+ }
1538
+ /**
1539
+ * Update tax report status request
1540
+ */
1541
+ interface UpdateTaxReportStatusRequest {
1542
+ /** Report status */
1543
+ status: "DRAFT" | "FINALIZED" | "FILED";
1544
+ }
1545
+ /**
1546
+ * List tax reports params
1547
+ */
1548
+ interface ListTaxReportsParams extends PaginationParams {
1549
+ /** Filter by year (for summary) */
1550
+ year?: number;
1551
+ }
1552
+ /**
1553
+ * Get analytics params
1554
+ */
1555
+ interface GetAnalyticsParams {
1556
+ /** Date range */
1557
+ range?: "7days" | "30days" | "90days" | "1year";
1558
+ }
1559
+ /**
1560
+ * List customers params
1561
+ */
1562
+ interface ListCustomersParams extends PaginationParams {
1563
+ }
1564
+ /**
1565
+ * List active banners params
1566
+ */
1567
+ interface ListActiveBannersParams {
1568
+ /** Filter by type */
1569
+ type?: BannerType;
1570
+ /** Filter by merchant ID */
1571
+ merchantId?: string;
1572
+ }
1573
+
1574
+ /**
1575
+ * Ecommerce API Response Types
1576
+ *
1577
+ * This module contains all response types for the ecommerce API.
1578
+ */
1579
+
1580
+ /**
1581
+ * Base API response
1582
+ */
1583
+ interface ApiResponse<T = any> {
1584
+ /** Response data */
1585
+ data?: T;
1586
+ /** Error message */
1587
+ error?: string;
1588
+ /** Success flag */
1589
+ success?: boolean;
1590
+ }
1591
+ /**
1592
+ * Paginated response
1593
+ */
1594
+ interface PaginatedResponse<T> {
1595
+ /** Items */
1596
+ items: T[];
1597
+ /** Total count */
1598
+ total: number;
1599
+ /** Limit */
1600
+ limit: number;
1601
+ /** Offset */
1602
+ offset: number;
1603
+ }
1604
+ /**
1605
+ * List products response
1606
+ */
1607
+ interface ListProductsResponse extends PaginatedResponse<Product> {
1608
+ }
1609
+ /**
1610
+ * Get product response
1611
+ *
1612
+ * Note: The API returns the product object directly, not wrapped in a `product` field.
1613
+ * This type extends Product to be compatible with the actual API response.
1614
+ */
1615
+ type GetProductResponse = Product;
1616
+ /**
1617
+ * Create/Update product response
1618
+ */
1619
+ interface ProductResponse {
1620
+ /** Product */
1621
+ product: Product;
1622
+ }
1623
+ /**
1624
+ * List product variants response
1625
+ */
1626
+ interface ListProductVariantsResponse {
1627
+ /** Variants */
1628
+ variants: ProductVariant[];
1629
+ }
1630
+ /**
1631
+ * Product variant response
1632
+ */
1633
+ interface ProductVariantResponse {
1634
+ /** Variant */
1635
+ variant: ProductVariant;
1636
+ }
1637
+ /**
1638
+ * List orders response
1639
+ */
1640
+ interface ListOrdersResponse extends PaginatedResponse<Order> {
1641
+ /** Merchant information (for merchant endpoints) */
1642
+ merchant?: Merchant;
1643
+ }
1644
+ /**
1645
+ * Get order response
1646
+ */
1647
+ interface GetOrderResponse {
1648
+ /** Order */
1649
+ order: Order;
1650
+ }
1651
+ /**
1652
+ * Create order response
1653
+ */
1654
+ interface CreateOrderResponse {
1655
+ /** Created orders (array for multi-merchant checkout) */
1656
+ orders: Order[];
1657
+ /** Summary */
1658
+ summary: {
1659
+ /** Total amount */
1660
+ totalAmount: string;
1661
+ /** Order count */
1662
+ orderCount: number;
1663
+ /** Merchant names */
1664
+ merchantNames: string[];
1665
+ };
1666
+ /** Escrow payment instructions (for USDC_ESCROW) */
1667
+ escrow?: {
1668
+ /** Escrow address */
1669
+ address: string;
1670
+ /** Amount in USDC */
1671
+ amountUSDC: string;
1672
+ };
1673
+ /** Test mode flag */
1674
+ testMode?: boolean;
1675
+ }
1676
+ /**
1677
+ * Update order response
1678
+ */
1679
+ interface UpdateOrderResponse {
1680
+ /** Updated order */
1681
+ order: Order;
1682
+ }
1683
+ /**
1684
+ * Confirm escrow deposit response
1685
+ */
1686
+ interface ConfirmEscrowDepositResponse {
1687
+ /** Success flag */
1688
+ ok: boolean;
1689
+ /** Order ID */
1690
+ orderId: string;
1691
+ /** Order status */
1692
+ status: string;
1693
+ /** Deposit transaction hash */
1694
+ depositTxHash: string | null;
1695
+ }
1696
+ /**
1697
+ * Order receipt response
1698
+ */
1699
+ interface OrderReceiptResponse {
1700
+ /** Receipt */
1701
+ receipt: {
1702
+ /** Order number */
1703
+ orderNumber: string;
1704
+ /** Order ID */
1705
+ orderId: string;
1706
+ /** Order date */
1707
+ orderDate: string;
1708
+ /** Status */
1709
+ status: string;
1710
+ /** Customer */
1711
+ customer: {
1712
+ name: string;
1713
+ email?: string;
1714
+ };
1715
+ /** Merchant */
1716
+ merchant: {
1717
+ name: string;
1718
+ };
1719
+ /** Shipping address */
1720
+ shippingAddress: any;
1721
+ /** Items */
1722
+ items: Array<{
1723
+ title: string;
1724
+ quantity: number;
1725
+ unitPrice: string;
1726
+ totalPrice: string;
1727
+ }>;
1728
+ /** Subtotal */
1729
+ subtotal: string;
1730
+ /** Tax */
1731
+ tax: string;
1732
+ /** Shipping */
1733
+ shipping: string;
1734
+ /** Total */
1735
+ total: string;
1736
+ /** Payment */
1737
+ payment: {
1738
+ method: string;
1739
+ status?: string;
1740
+ transactionHash?: string | null;
1741
+ };
1742
+ };
1743
+ }
1744
+ /**
1745
+ * List reviews response
1746
+ */
1747
+ interface ListReviewsResponse extends PaginatedResponse<ProductReview> {
1748
+ }
1749
+ /**
1750
+ * Create/Update review response
1751
+ */
1752
+ interface ReviewResponse {
1753
+ /** Review */
1754
+ review: ProductReview;
1755
+ }
1756
+ /**
1757
+ * List shipping addresses response
1758
+ */
1759
+ interface ListShippingAddressesResponse {
1760
+ /** Addresses */
1761
+ addresses: UserShippingAddress[];
1762
+ }
1763
+ /**
1764
+ * Shipping address response
1765
+ */
1766
+ interface ShippingAddressResponse {
1767
+ /** Address */
1768
+ address: UserShippingAddress;
1769
+ }
1770
+ /**
1771
+ * Applied discount
1772
+ */
1773
+ interface AppliedDiscount {
1774
+ /** Coupon/discount ID */
1775
+ id: string;
1776
+ /** Code */
1777
+ code: string;
1778
+ /** Title */
1779
+ title?: string | null;
1780
+ /** Discount type */
1781
+ discountType: string;
1782
+ /** Discount amount */
1783
+ discountAmount: number;
1784
+ /** Description */
1785
+ description?: string;
1786
+ }
1787
+ /**
1788
+ * Calculate cart discounts response
1789
+ */
1790
+ interface CalculateCartDiscountsResponse {
1791
+ /** Subtotal */
1792
+ subtotal: number;
1793
+ /** Discount amount */
1794
+ discountAmount: number;
1795
+ /** Total */
1796
+ total: number;
1797
+ /** Applied discounts */
1798
+ appliedDiscounts: AppliedDiscount[];
1799
+ }
1800
+ /**
1801
+ * Validate discount response
1802
+ */
1803
+ interface ValidateDiscountResponse {
1804
+ /** Is valid */
1805
+ valid: boolean;
1806
+ /** Error message */
1807
+ error?: string;
1808
+ /** Discount */
1809
+ discount?: {
1810
+ /** Coupon ID */
1811
+ id: string;
1812
+ /** Code */
1813
+ code: string;
1814
+ /** Title */
1815
+ title?: string | null;
1816
+ /** Discount type */
1817
+ discountType: string;
1818
+ /** Discount amount */
1819
+ discountAmount: number;
1820
+ };
1821
+ /** Subtotal */
1822
+ subtotal?: number;
1823
+ /** Total */
1824
+ total?: number;
1825
+ }
1826
+ /**
1827
+ * Tax breakdown item
1828
+ */
1829
+ interface TaxBreakdownItem {
1830
+ /** Tax type */
1831
+ taxType: string;
1832
+ /** Tax name */
1833
+ taxName: string;
1834
+ /** Tax rate */
1835
+ taxRate: number;
1836
+ /** Tax amount */
1837
+ taxAmount: number;
1838
+ /** Country */
1839
+ country: string;
1840
+ /** Region */
1841
+ region?: string;
1842
+ }
1843
+ /**
1844
+ * Calculate tax response
1845
+ */
1846
+ interface CalculateTaxResponse {
1847
+ /** Subtotal */
1848
+ subtotal: number;
1849
+ /** Tax amount */
1850
+ taxAmount: number;
1851
+ /** Total */
1852
+ total: number;
1853
+ /** Tax breakdown */
1854
+ breakdown: TaxBreakdownItem[];
1855
+ /** Merchant tax details (for multi-merchant) */
1856
+ merchantTaxDetails?: Array<{
1857
+ merchantId: string;
1858
+ subtotal: number;
1859
+ taxAmount: number;
1860
+ hasNexus: boolean;
1861
+ breakdown: TaxBreakdownItem[];
1862
+ }>;
1863
+ }
1864
+ /**
1865
+ * Merchant profile response
1866
+ */
1867
+ interface MerchantProfileResponse {
1868
+ /** Merchant */
1869
+ merchant: Merchant;
1870
+ }
1871
+ /**
1872
+ * List coupons response
1873
+ */
1874
+ interface ListCouponsResponse {
1875
+ /** Coupons */
1876
+ coupons: Coupon[];
1877
+ /** Stats */
1878
+ stats: {
1879
+ total: number;
1880
+ active: number;
1881
+ totalUsages: number;
1882
+ totalDiscount: number;
1883
+ };
1884
+ }
1885
+ /**
1886
+ * Coupon response
1887
+ */
1888
+ interface CouponResponse {
1889
+ /** Coupon */
1890
+ coupon: Coupon;
1891
+ }
1892
+ /**
1893
+ * Get coupon with usages response
1894
+ */
1895
+ interface GetCouponResponse {
1896
+ /** Coupon with usages */
1897
+ coupon: Coupon & {
1898
+ usages: Array<CouponUsage & {
1899
+ user: {
1900
+ username?: string;
1901
+ };
1902
+ }>;
1903
+ };
1904
+ }
1905
+ /**
1906
+ * List shipping methods response
1907
+ */
1908
+ interface ListShippingMethodsResponse {
1909
+ /** Methods */
1910
+ methods: ShippingMethod[];
1911
+ }
1912
+ /**
1913
+ * Shipping method response
1914
+ */
1915
+ interface ShippingMethodResponse {
1916
+ /** Method */
1917
+ method: ShippingMethod;
1918
+ }
1919
+ /**
1920
+ * List shipments response
1921
+ */
1922
+ interface ListShipmentsResponse {
1923
+ /** Shipments */
1924
+ shipments: Array<Shipment & {
1925
+ order: {
1926
+ id: string;
1927
+ totalUSDC: string;
1928
+ shippingAddress: any;
1929
+ user: {
1930
+ id: string;
1931
+ username?: string;
1932
+ };
1933
+ };
1934
+ }>;
1935
+ }
1936
+ /**
1937
+ * Shipment response
1938
+ */
1939
+ interface ShipmentResponse {
1940
+ /** Shipment */
1941
+ shipment: Shipment;
1942
+ }
1943
+ /**
1944
+ * List returns response
1945
+ */
1946
+ interface ListReturnsResponse {
1947
+ /** Returns */
1948
+ returns: Array<Return & {
1949
+ user: {
1950
+ id: string;
1951
+ username?: string;
1952
+ };
1953
+ order: {
1954
+ id: string;
1955
+ totalUSDC: string;
1956
+ };
1957
+ }>;
1958
+ }
1959
+ /**
1960
+ * Return response
1961
+ */
1962
+ interface ReturnResponse {
1963
+ /** Return */
1964
+ return: Return;
1965
+ }
1966
+ /**
1967
+ * List banners response
1968
+ */
1969
+ interface ListBannersResponse {
1970
+ /** Banners */
1971
+ banners: Banner[];
1972
+ }
1973
+ /**
1974
+ * Banner response
1975
+ */
1976
+ interface BannerResponse {
1977
+ /** Banner */
1978
+ banner: Banner;
1979
+ }
1980
+ /**
1981
+ * List media assets response
1982
+ */
1983
+ interface ListMediaAssetsResponse extends PaginatedResponse<MediaAsset> {
1984
+ }
1985
+ /**
1986
+ * Media asset response
1987
+ */
1988
+ interface MediaAssetResponse {
1989
+ /** Asset */
1990
+ asset: MediaAsset;
1991
+ }
1992
+ /**
1993
+ * List messages response
1994
+ */
1995
+ interface ListMessagesResponse {
1996
+ /** Conversations */
1997
+ conversations: Array<{
1998
+ orderId: string;
1999
+ orderNumber: string;
2000
+ customer: {
2001
+ id: string;
2002
+ name?: string;
2003
+ username?: string;
2004
+ };
2005
+ lastMessage: Message;
2006
+ unreadCount: number;
2007
+ messages: Message[];
2008
+ }>;
2009
+ /** Stats */
2010
+ stats: {
2011
+ total: number;
2012
+ unread: number;
2013
+ };
2014
+ }
2015
+ /**
2016
+ * Message response
2017
+ */
2018
+ interface MessageResponse {
2019
+ /** Message */
2020
+ message: Message;
2021
+ }
2022
+ /**
2023
+ * Analytics overview
2024
+ */
2025
+ interface AnalyticsOverview {
2026
+ /** Total revenue */
2027
+ totalRevenue: number;
2028
+ /** Revenue change percentage */
2029
+ revenueChange: number;
2030
+ /** Total orders */
2031
+ totalOrders: number;
2032
+ /** Orders change percentage */
2033
+ ordersChange: number;
2034
+ /** Average order value */
2035
+ averageOrderValue: number;
2036
+ /** AOV change percentage */
2037
+ aovChange: number;
2038
+ /** Total customers */
2039
+ totalCustomers: number;
2040
+ /** Customers change percentage */
2041
+ customersChange: number;
2042
+ }
2043
+ /**
2044
+ * Revenue by day
2045
+ */
2046
+ interface RevenueByDay {
2047
+ /** Date */
2048
+ date: string;
2049
+ /** Revenue */
2050
+ revenue: number;
2051
+ /** Orders */
2052
+ orders: number;
2053
+ }
2054
+ /**
2055
+ * Top product
2056
+ */
2057
+ interface TopProduct {
2058
+ /** Product ID */
2059
+ id: string;
2060
+ /** Name */
2061
+ name: string;
2062
+ /** Image */
2063
+ image: string | null;
2064
+ /** Sold count */
2065
+ soldCount: number;
2066
+ /** Revenue */
2067
+ revenue: number;
2068
+ /** View count */
2069
+ viewCount: number;
2070
+ }
2071
+ /**
2072
+ * Orders by status
2073
+ */
2074
+ interface OrdersByStatus {
2075
+ /** Status */
2076
+ status: string;
2077
+ /** Count */
2078
+ count: number;
2079
+ /** Percentage */
2080
+ percentage: number;
2081
+ }
2082
+ /**
2083
+ * Recent order summary
2084
+ */
2085
+ interface RecentOrderSummary {
2086
+ /** Order ID */
2087
+ id: string;
2088
+ /** Order number */
2089
+ orderNumber: string;
2090
+ /** Total amount */
2091
+ totalAmount: number;
2092
+ /** Status */
2093
+ status: string;
2094
+ /** Created at */
2095
+ createdAt: string;
2096
+ /** Buyer */
2097
+ buyer: {
2098
+ username?: string;
2099
+ };
2100
+ }
2101
+ /**
2102
+ * Get analytics response
2103
+ */
2104
+ interface GetAnalyticsResponse {
2105
+ /** Overview */
2106
+ overview: AnalyticsOverview;
2107
+ /** Revenue by day */
2108
+ revenueByDay: RevenueByDay[];
2109
+ /** Top products */
2110
+ topProducts: TopProduct[];
2111
+ /** Orders by status */
2112
+ ordersByStatus: OrdersByStatus[];
2113
+ /** Recent orders */
2114
+ recentOrders: RecentOrderSummary[];
2115
+ }
2116
+ /**
2117
+ * Product metrics
2118
+ */
2119
+ interface ProductMetrics {
2120
+ /** Product ID */
2121
+ id: string;
2122
+ /** Name */
2123
+ name: string;
2124
+ /** Images */
2125
+ images: string[];
2126
+ /** View count */
2127
+ viewCount: number;
2128
+ /** Sold count */
2129
+ soldCount: number;
2130
+ /** Revenue */
2131
+ revenue: number;
2132
+ /** Average rating */
2133
+ averageRating: number;
2134
+ /** Review count */
2135
+ reviewCount: number;
2136
+ /** Wishlist count */
2137
+ wishlistCount: number;
2138
+ /** Conversion rate */
2139
+ conversionRate: number;
2140
+ /** Stock */
2141
+ stock: number;
2142
+ /** Is active */
2143
+ isActive: boolean;
2144
+ /** Featured */
2145
+ featured: boolean;
2146
+ /** Created at */
2147
+ createdAt: string;
2148
+ }
2149
+ /**
2150
+ * Get product metrics response
2151
+ */
2152
+ interface GetProductMetricsResponse {
2153
+ /** Products */
2154
+ products: ProductMetrics[];
2155
+ /** Summary */
2156
+ summary: {
2157
+ totalProducts: number;
2158
+ totalViews: number;
2159
+ totalSales: number;
2160
+ totalRevenue: number;
2161
+ averageConversion: number;
2162
+ };
2163
+ }
2164
+ /**
2165
+ * List inventory audit response
2166
+ */
2167
+ interface ListInventoryAuditResponse {
2168
+ /** Entries */
2169
+ entries: Array<InventoryAuditEntry & {
2170
+ product: {
2171
+ id: string;
2172
+ title: string;
2173
+ images: string[];
2174
+ };
2175
+ variant?: {
2176
+ id: string;
2177
+ name: string;
2178
+ };
2179
+ }>;
2180
+ }
2181
+ /**
2182
+ * List customers response
2183
+ */
2184
+ interface ListCustomersResponse extends PaginatedResponse<CustomerSummary> {
2185
+ }
2186
+ /**
2187
+ * Tax settings response
2188
+ */
2189
+ interface TaxSettingsResponse {
2190
+ /** Settings */
2191
+ settings: TaxSettings;
2192
+ }
2193
+ /**
2194
+ * List tax rules response
2195
+ */
2196
+ interface ListTaxRulesResponse {
2197
+ /** Rules */
2198
+ rules: TaxRule[];
2199
+ }
2200
+ /**
2201
+ * Tax rule response
2202
+ */
2203
+ interface TaxRuleResponse {
2204
+ /** Rule */
2205
+ rule: TaxRule;
2206
+ }
2207
+ /**
2208
+ * List tax nexus response
2209
+ */
2210
+ interface ListTaxNexusResponse {
2211
+ /** Nexus */
2212
+ nexus: TaxNexus[];
2213
+ }
2214
+ /**
2215
+ * Tax nexus response
2216
+ */
2217
+ interface TaxNexusResponse {
2218
+ /** Nexus */
2219
+ nexus: TaxNexus;
2220
+ }
2221
+ /**
2222
+ * List tax reports response
2223
+ */
2224
+ interface ListTaxReportsResponse extends PaginatedResponse<TaxReport> {
2225
+ /** Summary (if year filter is provided) */
2226
+ summary?: {
2227
+ year: number;
2228
+ totalTaxable: string;
2229
+ totalTax: string;
2230
+ reportCount: number;
2231
+ };
2232
+ }
2233
+ /**
2234
+ * Tax report details
2235
+ */
2236
+ interface TaxReportDetails {
2237
+ /** Order ID */
2238
+ orderId: string;
2239
+ /** Order date */
2240
+ orderDate: string;
2241
+ /** Customer */
2242
+ customer: string;
2243
+ /** Subtotal */
2244
+ subtotal: string;
2245
+ /** Tax amount */
2246
+ taxAmount: string;
2247
+ /** Total */
2248
+ total: string;
2249
+ /** Tax breakdown */
2250
+ breakdown: TaxBreakdownItem[];
2251
+ }
2252
+ /**
2253
+ * Get tax report response
2254
+ */
2255
+ interface GetTaxReportResponse {
2256
+ /** Report */
2257
+ report: TaxReport;
2258
+ /** Details */
2259
+ details: TaxReportDetails[];
2260
+ }
2261
+ /**
2262
+ * Tax report response
2263
+ */
2264
+ interface TaxReportResponse {
2265
+ /** Report */
2266
+ report: TaxReport;
2267
+ }
2268
+ /**
2269
+ * Success response
2270
+ */
2271
+ interface SuccessResponse {
2272
+ /** Success flag */
2273
+ success: boolean;
2274
+ }
2275
+ /**
2276
+ * Product discounts response
2277
+ */
2278
+ interface ProductDiscountsResponse {
2279
+ /** Discounts */
2280
+ discounts: Array<{
2281
+ id: string;
2282
+ title: string;
2283
+ description: string;
2284
+ badge: string;
2285
+ discountType: string;
2286
+ discountValue: number;
2287
+ discountAmount: number;
2288
+ minPurchase: number | null;
2289
+ minQuantity: number | null;
2290
+ expiresAt: string;
2291
+ }>;
2292
+ }
2293
+ /**
2294
+ * Create order event response
2295
+ */
2296
+ interface CreateOrderEventResponse {
2297
+ /** Event */
2298
+ event: any;
2299
+ }
2300
+
2301
+ /**
2302
+ * Customer/End-User Ecommerce API Client
2303
+ *
2304
+ * This module provides methods for customer-facing ecommerce operations including
2305
+ * browsing products, placing orders, managing reviews, and more.
2306
+ */
2307
+
2308
+ /**
2309
+ * Customer API client for end-user ecommerce operations
2310
+ *
2311
+ * Provides methods for browsing products, placing orders, managing reviews,
2312
+ * and other customer-facing operations.
2313
+ *
2314
+ * @example
2315
+ * ```typescript
2316
+ * const client = new CustomerEcommerceClient({
2317
+ * baseURL: "https://api.example.com",
2318
+ * authToken: "user-auth-token"
2319
+ * });
2320
+ *
2321
+ * // Browse products
2322
+ * const products = await client.listProducts({ limit: 20, category: "electronics" });
2323
+ *
2324
+ * // Place an order
2325
+ * const order = await client.createOrder({
2326
+ * items: [{ productId: "123", quantity: 1 }],
2327
+ * paymentMethod: "USDC_ESCROW",
2328
+ * shippingAddress: { ... }
2329
+ * });
2330
+ * ```
2331
+ */
2332
+ declare class CustomerEcommerceClient extends BaseEcommerceClient {
2333
+ /**
2334
+ * List products with filtering and pagination
2335
+ *
2336
+ * @param params - Query parameters for filtering
2337
+ * @returns Paginated list of products
2338
+ *
2339
+ * @example
2340
+ * ```typescript
2341
+ * const products = await client.listProducts({
2342
+ * limit: 20,
2343
+ * offset: 0,
2344
+ * category: "electronics",
2345
+ * search: "laptop",
2346
+ * minPrice: 500,
2347
+ * maxPrice: 2000,
2348
+ * sortBy: "price_asc"
2349
+ * });
2350
+ * ```
2351
+ */
2352
+ listProducts(params?: ListProductsParams): Promise<ListProductsResponse>;
2353
+ /**
2354
+ * Get product details by ID
2355
+ *
2356
+ * @param productId - Product ID
2357
+ * @returns Product details with merchant info, variants, and reviews
2358
+ *
2359
+ * @example
2360
+ * ```typescript
2361
+ * const product = await client.getProduct("prod_123");
2362
+ * console.log(product.title, product.priceUSDC);
2363
+ * ```
2364
+ */
2365
+ getProduct(productId: string): Promise<GetProductResponse>;
2366
+ /**
2367
+ * Track product view (increment view count)
2368
+ *
2369
+ * @param productId - Product ID
2370
+ * @returns Success response
2371
+ *
2372
+ * @example
2373
+ * ```typescript
2374
+ * await client.trackProductView("prod_123");
2375
+ * ```
2376
+ */
2377
+ trackProductView(productId: string): Promise<SuccessResponse>;
2378
+ /**
2379
+ * Get active automatic discounts for a product
2380
+ *
2381
+ * @param productId - Product ID
2382
+ * @returns List of applicable discounts
2383
+ *
2384
+ * @example
2385
+ * ```typescript
2386
+ * const discounts = await client.getProductDiscounts("prod_123");
2387
+ * discounts.discounts.forEach(d => console.log(d.description));
2388
+ * ```
2389
+ */
2390
+ getProductDiscounts(productId: string): Promise<ProductDiscountsResponse>;
2391
+ /**
2392
+ * Create order from cart checkout
2393
+ *
2394
+ * Supports multi-merchant checkout - automatically splits orders by merchant.
2395
+ *
2396
+ * @param request - Order creation request
2397
+ * @returns Created order(s) with payment instructions
2398
+ *
2399
+ * @example
2400
+ * ```typescript
2401
+ * const result = await client.createOrder({
2402
+ * items: [
2403
+ * { productId: "prod_123", quantity: 2 },
2404
+ * { productId: "prod_456", quantity: 1, variantId: "var_789" }
2405
+ * ],
2406
+ * paymentMethod: "USDC_ESCROW",
2407
+ * shippingAddress: {
2408
+ * fullName: "John Doe",
2409
+ * phone: "+1234567890",
2410
+ * addressLine1: "123 Main St",
2411
+ * city: "New York",
2412
+ * stateProvince: "NY",
2413
+ * postalCode: "10001",
2414
+ * country: "US"
2415
+ * },
2416
+ * couponCode: "SAVE10"
2417
+ * });
2418
+ *
2419
+ * // For USDC escrow, deposit to the escrow address
2420
+ * if (result.escrow) {
2421
+ * console.log("Deposit", result.escrow.amountUSDC, "USDC to", result.escrow.address);
2422
+ * }
2423
+ * ```
2424
+ */
2425
+ createOrder(request: CreateOrderRequest): Promise<CreateOrderResponse>;
2426
+ /**
2427
+ * List user's orders
2428
+ *
2429
+ * @param params - Query parameters for filtering
2430
+ * @returns Paginated list of orders
2431
+ *
2432
+ * @example
2433
+ * ```typescript
2434
+ * const orders = await client.listOrders({
2435
+ * limit: 10,
2436
+ * offset: 0,
2437
+ * status: "SHIPPED"
2438
+ * });
2439
+ * ```
2440
+ */
2441
+ listOrders(params?: ListOrdersParams): Promise<ListOrdersResponse>;
2442
+ /**
2443
+ * Get order details by ID
2444
+ *
2445
+ * @param orderId - Order ID
2446
+ * @returns Order details with items, payment, and shipment info
2447
+ *
2448
+ * @example
2449
+ * ```typescript
2450
+ * const order = await client.getOrder("ord_123");
2451
+ * console.log(order.order.status, order.order.totalUSDC);
2452
+ * ```
2453
+ */
2454
+ getOrder(orderId: string): Promise<GetOrderResponse>;
2455
+ /**
2456
+ * Confirm USDC escrow deposit for order payment
2457
+ *
2458
+ * Verifies the Hyperliquid transaction and updates order status.
2459
+ *
2460
+ * @param orderId - Order ID
2461
+ * @returns Confirmation response with transaction hash
2462
+ *
2463
+ * @example
2464
+ * ```typescript
2465
+ * // After depositing USDC to escrow address
2466
+ * const result = await client.confirmEscrowDeposit("ord_123");
2467
+ * console.log("Payment confirmed:", result.depositTxHash);
2468
+ * ```
2469
+ */
2470
+ confirmEscrowDeposit(orderId: string): Promise<ConfirmEscrowDepositResponse>;
2471
+ /**
2472
+ * Get order receipt
2473
+ *
2474
+ * @param orderId - Order ID
2475
+ * @returns Order receipt for download/display
2476
+ *
2477
+ * @example
2478
+ * ```typescript
2479
+ * const receipt = await client.getOrderReceipt("ord_123");
2480
+ * console.log("Order #", receipt.receipt.orderNumber);
2481
+ * ```
2482
+ */
2483
+ getOrderReceipt(orderId: string): Promise<OrderReceiptResponse>;
2484
+ /**
2485
+ * List reviews for a product
2486
+ *
2487
+ * @param productId - Product ID
2488
+ * @param params - Query parameters
2489
+ * @returns Paginated list of reviews
2490
+ *
2491
+ * @example
2492
+ * ```typescript
2493
+ * const reviews = await client.listProductReviews("prod_123", {
2494
+ * limit: 10,
2495
+ * sortBy: "highest"
2496
+ * });
2497
+ * ```
2498
+ */
2499
+ listProductReviews(productId: string, params?: ListReviewsParams): Promise<ListReviewsResponse>;
2500
+ /**
2501
+ * Create a product review
2502
+ *
2503
+ * Requires authenticated user who has purchased the product.
2504
+ *
2505
+ * @param productId - Product ID
2506
+ * @param request - Review creation request
2507
+ * @returns Created review
2508
+ *
2509
+ * @example
2510
+ * ```typescript
2511
+ * const review = await client.createReview("prod_123", {
2512
+ * rating: 5,
2513
+ * title: "Great product!",
2514
+ * comment: "Exactly what I needed. Fast shipping too!"
2515
+ * });
2516
+ * ```
2517
+ */
2518
+ createReview(productId: string, request: CreateReviewRequest): Promise<ReviewResponse>;
2519
+ /**
2520
+ * List saved shipping addresses
2521
+ *
2522
+ * @returns List of user's saved shipping addresses
2523
+ *
2524
+ * @example
2525
+ * ```typescript
2526
+ * const addresses = await client.listShippingAddresses();
2527
+ * const defaultAddress = addresses.addresses.find(a => a.isDefault);
2528
+ * ```
2529
+ */
2530
+ listShippingAddresses(): Promise<ListShippingAddressesResponse>;
2531
+ /**
2532
+ * Create a new shipping address
2533
+ *
2534
+ * @param request - Shipping address data
2535
+ * @returns Created address
2536
+ *
2537
+ * @example
2538
+ * ```typescript
2539
+ * const address = await client.createShippingAddress({
2540
+ * fullName: "John Doe",
2541
+ * phone: "+1234567890",
2542
+ * addressLine1: "123 Main St",
2543
+ * city: "New York",
2544
+ * stateProvince: "NY",
2545
+ * postalCode: "10001",
2546
+ * country: "US",
2547
+ * isDefault: true,
2548
+ * label: "Home"
2549
+ * });
2550
+ * ```
2551
+ */
2552
+ createShippingAddress(request: ShippingAddressRequest): Promise<ShippingAddressResponse>;
2553
+ /**
2554
+ * Update a shipping address
2555
+ *
2556
+ * @param addressId - Address ID
2557
+ * @param request - Updated address data
2558
+ * @returns Updated address
2559
+ *
2560
+ * @example
2561
+ * ```typescript
2562
+ * const address = await client.updateShippingAddress("addr_123", {
2563
+ * phone: "+0987654321"
2564
+ * });
2565
+ * ```
2566
+ */
2567
+ updateShippingAddress(addressId: string, request: Partial<ShippingAddressRequest>): Promise<ShippingAddressResponse>;
2568
+ /**
2569
+ * Delete a shipping address
2570
+ *
2571
+ * @param addressId - Address ID
2572
+ * @returns Success response
2573
+ *
2574
+ * @example
2575
+ * ```typescript
2576
+ * await client.deleteShippingAddress("addr_123");
2577
+ * ```
2578
+ */
2579
+ deleteShippingAddress(addressId: string): Promise<SuccessResponse>;
2580
+ /**
2581
+ * Calculate automatic discounts for cart items
2582
+ *
2583
+ * @param request - Cart items
2584
+ * @returns Calculated discounts and totals
2585
+ *
2586
+ * @example
2587
+ * ```typescript
2588
+ * const result = await client.calculateCartDiscounts({
2589
+ * items: [
2590
+ * { productId: "prod_123", quantity: 2 },
2591
+ * { productId: "prod_456", quantity: 1 }
2592
+ * ]
2593
+ * });
2594
+ * console.log("Subtotal:", result.subtotal);
2595
+ * console.log("Discount:", result.discountAmount);
2596
+ * console.log("Total:", result.total);
2597
+ * ```
2598
+ */
2599
+ calculateCartDiscounts(request: CalculateCartDiscountsRequest): Promise<CalculateCartDiscountsResponse>;
2600
+ /**
2601
+ * Validate a discount code for cart items
2602
+ *
2603
+ * @param request - Discount code and cart items
2604
+ * @returns Validation result with discount details
2605
+ *
2606
+ * @example
2607
+ * ```typescript
2608
+ * const result = await client.validateDiscountCode({
2609
+ * code: "SAVE10",
2610
+ * items: [
2611
+ * { productId: "prod_123", quantity: 2 }
2612
+ * ]
2613
+ * });
2614
+ *
2615
+ * if (result.valid) {
2616
+ * console.log("Discount:", result.discount?.discountAmount);
2617
+ * } else {
2618
+ * console.log("Error:", result.error);
2619
+ * }
2620
+ * ```
2621
+ */
2622
+ validateDiscountCode(request: ValidateDiscountRequest): Promise<ValidateDiscountResponse>;
2623
+ /**
2624
+ * Calculate tax for cart items based on shipping address
2625
+ *
2626
+ * @param request - Cart items and shipping address
2627
+ * @returns Tax calculation with breakdown
2628
+ *
2629
+ * @example
2630
+ * ```typescript
2631
+ * const result = await client.calculateTax({
2632
+ * items: [
2633
+ * { productId: "prod_123", quantity: 2 }
2634
+ * ],
2635
+ * shippingAddress: {
2636
+ * country: "US",
2637
+ * region: "NY",
2638
+ * postalCode: "10001"
2639
+ * }
2640
+ * });
2641
+ * console.log("Tax:", result.taxAmount);
2642
+ * console.log("Total:", result.total);
2643
+ * ```
2644
+ */
2645
+ calculateTax(request: CalculateTaxRequest): Promise<CalculateTaxResponse>;
2646
+ /**
2647
+ * Get active promotional banners
2648
+ *
2649
+ * @param params - Query parameters
2650
+ * @returns List of active banners
2651
+ *
2652
+ * @example
2653
+ * ```typescript
2654
+ * const banners = await client.getActiveBanners({
2655
+ * type: "HERO",
2656
+ * merchantId: "merchant_123"
2657
+ * });
2658
+ * ```
2659
+ */
2660
+ getActiveBanners(params?: ListActiveBannersParams): Promise<ListBannersResponse>;
2661
+ /**
2662
+ * Track banner impression or click
2663
+ *
2664
+ * @param bannerId - Banner ID
2665
+ * @param request - Track action (impression or click)
2666
+ * @returns Success response
2667
+ *
2668
+ * @example
2669
+ * ```typescript
2670
+ * // Track impression
2671
+ * await client.trackBanner("banner_123", { action: "impression" });
2672
+ *
2673
+ * // Track click
2674
+ * await client.trackBanner("banner_123", { action: "click" });
2675
+ * ```
2676
+ */
2677
+ trackBanner(bannerId: string, request: TrackBannerRequest): Promise<SuccessResponse>;
2678
+ }
2679
+
2680
+ /**
2681
+ * Merchant Ecommerce API Client
2682
+ *
2683
+ * This module provides methods for merchant operations including product management,
2684
+ * order fulfillment, customer management, analytics, and more.
2685
+ */
2686
+
2687
+ /**
2688
+ * Merchant API client for merchant operations
2689
+ *
2690
+ * Provides comprehensive methods for managing products, orders, customers,
2691
+ * shipping, returns, reviews, analytics, and more.
2692
+ *
2693
+ * @example
2694
+ * ```typescript
2695
+ * const client = new MerchantEcommerceClient({
2696
+ * baseURL: "https://api.example.com",
2697
+ * authToken: "merchant-auth-token"
2698
+ * });
2699
+ *
2700
+ * // Create a product
2701
+ * const product = await client.createProduct({
2702
+ * title: "New Product",
2703
+ * images: ["https://..."],
2704
+ * priceUSDC: 99.99,
2705
+ * inventory: 100
2706
+ * });
2707
+ *
2708
+ * // Get analytics
2709
+ * const analytics = await client.getAnalytics({ range: "30days" });
2710
+ * ```
2711
+ */
2712
+ declare class MerchantEcommerceClient extends BaseEcommerceClient {
2713
+ /**
2714
+ * Get merchant profile
2715
+ *
2716
+ * @returns Merchant profile
2717
+ *
2718
+ * @example
2719
+ * ```typescript
2720
+ * const profile = await client.getMerchantProfile();
2721
+ * console.log(profile.merchant.name);
2722
+ * ```
2723
+ */
2724
+ getMerchantProfile(): Promise<MerchantProfileResponse>;
2725
+ /**
2726
+ * Get merchant profile (alias for getMerchantProfile)
2727
+ *
2728
+ * @returns Merchant profile
2729
+ *
2730
+ * @example
2731
+ * ```typescript
2732
+ * const profile = await client.getProfile();
2733
+ * console.log(profile.merchant.name);
2734
+ * ```
2735
+ */
2736
+ getProfile(): Promise<MerchantProfileResponse>;
2737
+ /**
2738
+ * Create or update merchant profile
2739
+ *
2740
+ * @param request - Profile data
2741
+ * @returns Updated merchant profile
2742
+ *
2743
+ * @example
2744
+ * ```typescript
2745
+ * const profile = await client.upsertMerchantProfile({
2746
+ * name: "My Store",
2747
+ * description: "We sell great products",
2748
+ * payoutAddress: "0x1234..."
2749
+ * });
2750
+ * ```
2751
+ */
2752
+ upsertMerchantProfile(request: MerchantProfileRequest): Promise<MerchantProfileResponse>;
2753
+ /**
2754
+ * List merchant's products
2755
+ *
2756
+ * @param params - Query parameters
2757
+ * @returns Paginated list of products
2758
+ *
2759
+ * @example
2760
+ * ```typescript
2761
+ * const products = await client.listMerchantProducts({ limit: 20, offset: 0 });
2762
+ * ```
2763
+ */
2764
+ listMerchantProducts(params?: PaginationParams): Promise<ListProductsResponse>;
2765
+ /**
2766
+ * Get a single product by ID
2767
+ *
2768
+ * @param productId - Product ID
2769
+ * @returns Product details
2770
+ *
2771
+ * @example
2772
+ * ```typescript
2773
+ * const product = await client.getProduct("prod_123");
2774
+ * console.log(product.product?.title, product.product?.priceUSDC);
2775
+ * ```
2776
+ */
2777
+ getProduct(productId: string): Promise<GetProductResponse>;
2778
+ /**
2779
+ * Create a new product
2780
+ *
2781
+ * @param request - Product data
2782
+ * @returns Created product
2783
+ *
2784
+ * @example
2785
+ * ```typescript
2786
+ * const product = await client.createProduct({
2787
+ * title: "Awesome Product",
2788
+ * images: ["https://..."],
2789
+ * priceUSDC: 49.99,
2790
+ * inventory: 50,
2791
+ * category: "electronics",
2792
+ * moq: 1
2793
+ * });
2794
+ * ```
2795
+ */
2796
+ createProduct(request: CreateProductRequest): Promise<ProductResponse>;
2797
+ /**
2798
+ * Update a product
2799
+ *
2800
+ * @param productId - Product ID
2801
+ * @param request - Updated product data
2802
+ * @returns Updated product
2803
+ *
2804
+ * @example
2805
+ * ```typescript
2806
+ * const product = await client.updateProduct("prod_123", {
2807
+ * priceUSDC: 39.99,
2808
+ * inventory: 75
2809
+ * });
2810
+ * ```
2811
+ */
2812
+ updateProduct(productId: string, request: UpdateProductRequest): Promise<ProductResponse>;
2813
+ /**
2814
+ * Delete a product
2815
+ *
2816
+ * @param productId - Product ID
2817
+ * @returns Success response
2818
+ *
2819
+ * @example
2820
+ * ```typescript
2821
+ * await client.deleteProduct("prod_123");
2822
+ * ```
2823
+ */
2824
+ deleteProduct(productId: string): Promise<SuccessResponse>;
2825
+ /**
2826
+ * Toggle product featured status
2827
+ *
2828
+ * @param productId - Product ID
2829
+ * @param featured - Featured status
2830
+ * @returns Updated product
2831
+ *
2832
+ * @example
2833
+ * ```typescript
2834
+ * await client.setProductFeatured("prod_123", true);
2835
+ * ```
2836
+ */
2837
+ setProductFeatured(productId: string, featured: boolean): Promise<ProductResponse>;
2838
+ /**
2839
+ * List product variants
2840
+ *
2841
+ * @param productId - Product ID
2842
+ * @returns List of variants
2843
+ *
2844
+ * @example
2845
+ * ```typescript
2846
+ * const variants = await client.listProductVariants("prod_123");
2847
+ * ```
2848
+ */
2849
+ listProductVariants(productId: string): Promise<ListProductVariantsResponse>;
2850
+ /**
2851
+ * Create a product variant
2852
+ *
2853
+ * @param productId - Product ID
2854
+ * @param request - Variant data
2855
+ * @returns Created variant
2856
+ *
2857
+ * @example
2858
+ * ```typescript
2859
+ * const variant = await client.createProductVariant("prod_123", {
2860
+ * name: "Large / Red",
2861
+ * attributes: { size: "L", color: "Red" },
2862
+ * priceUSDC: 54.99,
2863
+ * inventory: 20
2864
+ * });
2865
+ * ```
2866
+ */
2867
+ createProductVariant(productId: string, request: CreateProductVariantRequest): Promise<ProductVariantResponse>;
2868
+ /**
2869
+ * Get a product variant
2870
+ *
2871
+ * @param productId - Product ID
2872
+ * @param variantId - Variant ID
2873
+ * @returns Variant details
2874
+ *
2875
+ * @example
2876
+ * ```typescript
2877
+ * const variant = await client.getProductVariant("prod_123", "var_456");
2878
+ * ```
2879
+ */
2880
+ getProductVariant(productId: string, variantId: string): Promise<ProductVariantResponse>;
2881
+ /**
2882
+ * Update a product variant
2883
+ *
2884
+ * @param productId - Product ID
2885
+ * @param variantId - Variant ID
2886
+ * @param request - Updated variant data
2887
+ * @returns Updated variant
2888
+ *
2889
+ * @example
2890
+ * ```typescript
2891
+ * const variant = await client.updateProductVariant("prod_123", "var_456", {
2892
+ * inventory: 30
2893
+ * });
2894
+ * ```
2895
+ */
2896
+ updateProductVariant(productId: string, variantId: string, request: UpdateProductVariantRequest): Promise<ProductVariantResponse>;
2897
+ /**
2898
+ * Delete a product variant
2899
+ *
2900
+ * @param productId - Product ID
2901
+ * @param variantId - Variant ID
2902
+ * @returns Success response
2903
+ *
2904
+ * @example
2905
+ * ```typescript
2906
+ * await client.deleteProductVariant("prod_123", "var_456");
2907
+ * ```
2908
+ */
2909
+ deleteProductVariant(productId: string, variantId: string): Promise<SuccessResponse>;
2910
+ /**
2911
+ * Get product metrics
2912
+ *
2913
+ * @returns Product performance metrics
2914
+ *
2915
+ * @example
2916
+ * ```typescript
2917
+ * const metrics = await client.getProductMetrics();
2918
+ * console.log("Total revenue:", metrics.summary.totalRevenue);
2919
+ * ```
2920
+ */
2921
+ getProductMetrics(): Promise<GetProductMetricsResponse>;
2922
+ /**
2923
+ * List merchant's orders
2924
+ *
2925
+ * @param params - Query parameters
2926
+ * @returns Paginated list of orders
2927
+ *
2928
+ * @example
2929
+ * ```typescript
2930
+ * const orders = await client.listMerchantOrders({ limit: 20, offset: 0 });
2931
+ * ```
2932
+ */
2933
+ listMerchantOrders(params?: ListOrdersParams): Promise<ListOrdersResponse>;
2934
+ /**
2935
+ * Get order details
2936
+ *
2937
+ * @param orderId - Order ID
2938
+ * @returns Order details with full information
2939
+ *
2940
+ * @example
2941
+ * ```typescript
2942
+ * const order = await client.getMerchantOrder("ord_123");
2943
+ * console.log(order.order.status, order.order.items);
2944
+ * ```
2945
+ */
2946
+ getMerchantOrder(orderId: string): Promise<GetOrderResponse>;
2947
+ /**
2948
+ * Update order status
2949
+ *
2950
+ * @param orderId - Order ID
2951
+ * @param request - Status update request
2952
+ * @returns Updated order
2953
+ *
2954
+ * @example
2955
+ * ```typescript
2956
+ * // Accept order
2957
+ * await client.updateOrderStatus("ord_123", {
2958
+ * status: "MERCHANT_ACCEPTED"
2959
+ * });
2960
+ *
2961
+ * // Mark as shipped
2962
+ * await client.updateOrderStatus("ord_123", {
2963
+ * status: "SHIPPED",
2964
+ * tracking: {
2965
+ * trackingNumber: "1Z999AA10123456784",
2966
+ * carrier: "UPS"
2967
+ * }
2968
+ * });
2969
+ * ```
2970
+ */
2971
+ updateOrderStatus(orderId: string, request: UpdateOrderStatusRequest): Promise<UpdateOrderResponse>;
2972
+ /**
2973
+ * Create a custom order event
2974
+ *
2975
+ * @param orderId - Order ID
2976
+ * @param request - Event data
2977
+ * @returns Created event
2978
+ *
2979
+ * @example
2980
+ * ```typescript
2981
+ * await client.createOrderEvent("ord_123", {
2982
+ * eventType: "CUSTOM",
2983
+ * title: "Package delayed",
2984
+ * description: "Shipment delayed due to weather"
2985
+ * });
2986
+ * ```
2987
+ */
2988
+ createOrderEvent(orderId: string, request: CreateOrderEventRequest): Promise<CreateOrderEventResponse>;
2989
+ /**
2990
+ * List customers with order history and stats
2991
+ *
2992
+ * @param params - Query parameters
2993
+ * @returns Paginated list of customers
2994
+ *
2995
+ * @example
2996
+ * ```typescript
2997
+ * const customers = await client.listCustomers({ limit: 50, offset: 0 });
2998
+ * customers.items.forEach(c => {
2999
+ * console.log(c.username, "Total spent:", c.totalSpent);
3000
+ * });
3001
+ * ```
3002
+ */
3003
+ listCustomers(params?: ListCustomersParams): Promise<ListCustomersResponse>;
3004
+ /**
3005
+ * List merchant's coupons
3006
+ *
3007
+ * @returns List of coupons with stats
3008
+ *
3009
+ * @example
3010
+ * ```typescript
3011
+ * const result = await client.listCoupons();
3012
+ * console.log("Total coupons:", result.stats.total);
3013
+ * console.log("Active:", result.stats.active);
3014
+ * ```
3015
+ */
3016
+ listCoupons(): Promise<ListCouponsResponse>;
3017
+ /**
3018
+ * Create a coupon
3019
+ *
3020
+ * @param request - Coupon data
3021
+ * @returns Created coupon
3022
+ *
3023
+ * @example
3024
+ * ```typescript
3025
+ * const coupon = await client.createCoupon({
3026
+ * code: "SAVE20",
3027
+ * discountType: "PERCENTAGE",
3028
+ * discountValue: 20,
3029
+ * startsAt: "2025-01-01T00:00:00Z",
3030
+ * expiresAt: "2025-12-31T23:59:59Z",
3031
+ * maxUses: 100
3032
+ * });
3033
+ * ```
3034
+ */
3035
+ createCoupon(request: CreateCouponRequest): Promise<CouponResponse>;
3036
+ /**
3037
+ * Get coupon details with usage history
3038
+ *
3039
+ * @param couponId - Coupon ID
3040
+ * @returns Coupon with usages
3041
+ *
3042
+ * @example
3043
+ * ```typescript
3044
+ * const coupon = await client.getCoupon("coupon_123");
3045
+ * console.log("Used", coupon.coupon.usedCount, "times");
3046
+ * ```
3047
+ */
3048
+ getCoupon(couponId: string): Promise<GetCouponResponse>;
3049
+ /**
3050
+ * Update a coupon
3051
+ *
3052
+ * @param couponId - Coupon ID
3053
+ * @param request - Updated coupon data
3054
+ * @returns Updated coupon
3055
+ *
3056
+ * @example
3057
+ * ```typescript
3058
+ * await client.updateCoupon("coupon_123", {
3059
+ * isActive: false
3060
+ * });
3061
+ * ```
3062
+ */
3063
+ updateCoupon(couponId: string, request: UpdateCouponRequest): Promise<CouponResponse>;
3064
+ /**
3065
+ * Delete a coupon
3066
+ *
3067
+ * @param couponId - Coupon ID
3068
+ * @returns Success response
3069
+ *
3070
+ * @example
3071
+ * ```typescript
3072
+ * await client.deleteCoupon("coupon_123");
3073
+ * ```
3074
+ */
3075
+ deleteCoupon(couponId: string): Promise<SuccessResponse>;
3076
+ /**
3077
+ * List shipping methods
3078
+ *
3079
+ * @returns List of shipping methods
3080
+ *
3081
+ * @example
3082
+ * ```typescript
3083
+ * const methods = await client.listShippingMethods();
3084
+ * ```
3085
+ */
3086
+ listShippingMethods(): Promise<ListShippingMethodsResponse>;
3087
+ /**
3088
+ * Create a shipping method
3089
+ *
3090
+ * @param request - Shipping method data
3091
+ * @returns Created method
3092
+ *
3093
+ * @example
3094
+ * ```typescript
3095
+ * const method = await client.createShippingMethod({
3096
+ * name: "Standard Shipping",
3097
+ * carrier: "USPS",
3098
+ * estimatedDays: "3-5 business days",
3099
+ * flatRate: 5.99
3100
+ * });
3101
+ * ```
3102
+ */
3103
+ createShippingMethod(request: CreateShippingMethodRequest): Promise<ShippingMethodResponse>;
3104
+ /**
3105
+ * Update a shipping method
3106
+ *
3107
+ * @param methodId - Method ID
3108
+ * @param request - Updated method data
3109
+ * @returns Updated method
3110
+ *
3111
+ * @example
3112
+ * ```typescript
3113
+ * await client.updateShippingMethod("method_123", {
3114
+ * flatRate: 6.99
3115
+ * });
3116
+ * ```
3117
+ */
3118
+ updateShippingMethod(methodId: string, request: UpdateShippingMethodRequest): Promise<ShippingMethodResponse>;
3119
+ /**
3120
+ * Delete a shipping method
3121
+ *
3122
+ * @param methodId - Method ID
3123
+ * @returns Success response
3124
+ *
3125
+ * @example
3126
+ * ```typescript
3127
+ * await client.deleteShippingMethod("method_123");
3128
+ * ```
3129
+ */
3130
+ deleteShippingMethod(methodId: string): Promise<SuccessResponse>;
3131
+ /**
3132
+ * List shipments
3133
+ *
3134
+ * @returns List of shipments for merchant's orders
3135
+ *
3136
+ * @example
3137
+ * ```typescript
3138
+ * const shipments = await client.listShipments();
3139
+ * ```
3140
+ */
3141
+ listShipments(): Promise<ListShipmentsResponse>;
3142
+ /**
3143
+ * Update shipment status and tracking
3144
+ *
3145
+ * @param shipmentId - Shipment ID
3146
+ * @param request - Updated shipment data
3147
+ * @returns Updated shipment
3148
+ *
3149
+ * @example
3150
+ * ```typescript
3151
+ * await client.updateShipment("ship_123", {
3152
+ * status: "SHIPPED",
3153
+ * trackingNumber: "1Z999AA10123456784",
3154
+ * carrier: "UPS"
3155
+ * });
3156
+ * ```
3157
+ */
3158
+ updateShipment(shipmentId: string, request: UpdateShipmentRequest): Promise<ShipmentResponse>;
3159
+ /**
3160
+ * List returns
3161
+ *
3162
+ * @returns List of returns for merchant's orders
3163
+ *
3164
+ * @example
3165
+ * ```typescript
3166
+ * const returns = await client.listReturns();
3167
+ * ```
3168
+ */
3169
+ listReturns(): Promise<ListReturnsResponse>;
3170
+ /**
3171
+ * Approve a return request
3172
+ *
3173
+ * @param returnId - Return ID
3174
+ * @returns Updated return
3175
+ *
3176
+ * @example
3177
+ * ```typescript
3178
+ * await client.approveReturn("return_123");
3179
+ * ```
3180
+ */
3181
+ approveReturn(returnId: string): Promise<ReturnResponse>;
3182
+ /**
3183
+ * Reject a return request
3184
+ *
3185
+ * @param returnId - Return ID
3186
+ * @returns Updated return
3187
+ *
3188
+ * @example
3189
+ * ```typescript
3190
+ * await client.rejectReturn("return_123");
3191
+ * ```
3192
+ */
3193
+ rejectReturn(returnId: string): Promise<ReturnResponse>;
3194
+ /**
3195
+ * Mark return as received
3196
+ *
3197
+ * @param returnId - Return ID
3198
+ * @returns Updated return
3199
+ *
3200
+ * @example
3201
+ * ```typescript
3202
+ * await client.markReturnReceived("return_123");
3203
+ * ```
3204
+ */
3205
+ markReturnReceived(returnId: string): Promise<ReturnResponse>;
3206
+ /**
3207
+ * Process refund for return
3208
+ *
3209
+ * @param returnId - Return ID
3210
+ * @returns Updated return
3211
+ *
3212
+ * @example
3213
+ * ```typescript
3214
+ * await client.processRefund("return_123");
3215
+ * ```
3216
+ */
3217
+ processRefund(returnId: string): Promise<ReturnResponse>;
3218
+ /**
3219
+ * List reviews for merchant's products
3220
+ *
3221
+ * @returns List of reviews
3222
+ *
3223
+ * @example
3224
+ * ```typescript
3225
+ * const reviews = await client.listMerchantReviews();
3226
+ * ```
3227
+ */
3228
+ listMerchantReviews(): Promise<ListReviewsResponse>;
3229
+ /**
3230
+ * Respond to a review
3231
+ *
3232
+ * @param reviewId - Review ID
3233
+ * @param request - Response data
3234
+ * @returns Updated review
3235
+ *
3236
+ * @example
3237
+ * ```typescript
3238
+ * await client.respondToReview("review_123", {
3239
+ * merchantResponse: "Thank you for your feedback!"
3240
+ * });
3241
+ * ```
3242
+ */
3243
+ respondToReview(reviewId: string, request: RespondToReviewRequest): Promise<ReviewResponse>;
3244
+ /**
3245
+ * Flag a review as inappropriate
3246
+ *
3247
+ * @param reviewId - Review ID
3248
+ * @returns Updated review
3249
+ *
3250
+ * @example
3251
+ * ```typescript
3252
+ * await client.flagReview("review_123");
3253
+ * ```
3254
+ */
3255
+ flagReview(reviewId: string): Promise<ReviewResponse>;
3256
+ /**
3257
+ * List messages/conversations
3258
+ *
3259
+ * @returns List of conversations grouped by order
3260
+ *
3261
+ * @example
3262
+ * ```typescript
3263
+ * const messages = await client.listMessages();
3264
+ * console.log("Unread:", messages.stats.unread);
3265
+ * ```
3266
+ */
3267
+ listMessages(): Promise<ListMessagesResponse>;
3268
+ /**
3269
+ * Send a message to customer
3270
+ *
3271
+ * @param request - Message data
3272
+ * @returns Sent message
3273
+ *
3274
+ * @example
3275
+ * ```typescript
3276
+ * await client.sendMessage({
3277
+ * orderId: "ord_123",
3278
+ * recipientId: "user_456",
3279
+ * message: "Your order has been shipped!"
3280
+ * });
3281
+ * ```
3282
+ */
3283
+ sendMessage(request: SendMessageRequest): Promise<MessageResponse>;
3284
+ /**
3285
+ * Mark message as read
3286
+ *
3287
+ * @param messageId - Message ID
3288
+ * @returns Updated message
3289
+ *
3290
+ * @example
3291
+ * ```typescript
3292
+ * await client.markMessageRead("msg_123");
3293
+ * ```
3294
+ */
3295
+ markMessageRead(messageId: string): Promise<MessageResponse>;
3296
+ /**
3297
+ * List media assets
3298
+ *
3299
+ * @param params - Query parameters
3300
+ * @returns Paginated list of media assets
3301
+ *
3302
+ * @example
3303
+ * ```typescript
3304
+ * const media = await client.listMediaAssets({ limit: 50, offset: 0 });
3305
+ * ```
3306
+ */
3307
+ listMediaAssets(params?: PaginationParams): Promise<ListMediaAssetsResponse>;
3308
+ /**
3309
+ * Upload a media asset
3310
+ *
3311
+ * @param file - File to upload (max 10MB, images only)
3312
+ * @returns Uploaded asset
3313
+ *
3314
+ * @example
3315
+ * ```typescript
3316
+ * const formData = new FormData();
3317
+ * formData.append("file", imageFile);
3318
+ *
3319
+ * const asset = await client.uploadMediaAsset(formData);
3320
+ * console.log("Uploaded:", asset.asset.blobUrl);
3321
+ * ```
3322
+ */
3323
+ uploadMediaAsset(formData: FormData): Promise<MediaAssetResponse>;
3324
+ /**
3325
+ * Delete a media asset
3326
+ *
3327
+ * @param assetId - Asset ID
3328
+ * @returns Success response
3329
+ *
3330
+ * @example
3331
+ * ```typescript
3332
+ * await client.deleteMediaAsset("asset_123");
3333
+ * ```
3334
+ */
3335
+ deleteMediaAsset(assetId: string): Promise<SuccessResponse>;
3336
+ /**
3337
+ * List merchant's banners
3338
+ *
3339
+ * @returns List of banners
3340
+ *
3341
+ * @example
3342
+ * ```typescript
3343
+ * const banners = await client.listMerchantBanners();
3344
+ * ```
3345
+ */
3346
+ listMerchantBanners(): Promise<ListBannersResponse>;
3347
+ /**
3348
+ * Create a promotional banner
3349
+ *
3350
+ * @param request - Banner data
3351
+ * @returns Created banner
3352
+ *
3353
+ * @example
3354
+ * ```typescript
3355
+ * const banner = await client.createBanner({
3356
+ * title: "Summer Sale",
3357
+ * imageUrl: "https://...",
3358
+ * linkUrl: "/products?category=summer",
3359
+ * ctaText: "Shop Now",
3360
+ * priority: 10
3361
+ * });
3362
+ * ```
3363
+ */
3364
+ createBanner(request: CreateBannerRequest): Promise<BannerResponse>;
3365
+ /**
3366
+ * Get banner details
3367
+ *
3368
+ * @param bannerId - Banner ID
3369
+ * @returns Banner details
3370
+ *
3371
+ * @example
3372
+ * ```typescript
3373
+ * const banner = await client.getBanner("banner_123");
3374
+ * ```
3375
+ */
3376
+ getBanner(bannerId: string): Promise<BannerResponse>;
3377
+ /**
3378
+ * Update a banner
3379
+ *
3380
+ * @param bannerId - Banner ID
3381
+ * @param request - Updated banner data
3382
+ * @returns Updated banner
3383
+ *
3384
+ * @example
3385
+ * ```typescript
3386
+ * await client.updateBanner("banner_123", {
3387
+ * isActive: false
3388
+ * });
3389
+ * ```
3390
+ */
3391
+ updateBanner(bannerId: string, request: UpdateBannerRequest): Promise<BannerResponse>;
3392
+ /**
3393
+ * Delete a banner
3394
+ *
3395
+ * @param bannerId - Banner ID
3396
+ * @returns Success response
3397
+ *
3398
+ * @example
3399
+ * ```typescript
3400
+ * await client.deleteBanner("banner_123");
3401
+ * ```
3402
+ */
3403
+ deleteBanner(bannerId: string): Promise<SuccessResponse>;
3404
+ /**
3405
+ * Get merchant analytics
3406
+ *
3407
+ * @param params - Query parameters
3408
+ * @returns Analytics data with overview, charts, and insights
3409
+ *
3410
+ * @example
3411
+ * ```typescript
3412
+ * const analytics = await client.getAnalytics({ range: "30days" });
3413
+ * console.log("Revenue:", analytics.overview.totalRevenue);
3414
+ * console.log("Orders:", analytics.overview.totalOrders);
3415
+ * ```
3416
+ */
3417
+ getAnalytics(params?: GetAnalyticsParams): Promise<GetAnalyticsResponse>;
3418
+ /**
3419
+ * Get inventory audit log
3420
+ *
3421
+ * @returns Recent inventory audit entries (last 500)
3422
+ *
3423
+ * @example
3424
+ * ```typescript
3425
+ * const audit = await client.getInventoryAudit();
3426
+ * audit.entries.forEach(e => {
3427
+ * console.log(e.action, e.product.title, e.changeAmount);
3428
+ * });
3429
+ * ```
3430
+ */
3431
+ getInventoryAudit(): Promise<ListInventoryAuditResponse>;
3432
+ /**
3433
+ * Get tax settings
3434
+ *
3435
+ * @returns Tax settings
3436
+ *
3437
+ * @example
3438
+ * ```typescript
3439
+ * const settings = await client.getTaxSettings();
3440
+ * console.log("Tax enabled:", settings.settings.taxEnabled);
3441
+ * ```
3442
+ */
3443
+ getTaxSettings(): Promise<TaxSettingsResponse>;
3444
+ /**
3445
+ * Update tax settings
3446
+ *
3447
+ * @param request - Updated settings
3448
+ * @returns Updated tax settings
3449
+ *
3450
+ * @example
3451
+ * ```typescript
3452
+ * await client.updateTaxSettings({
3453
+ * taxEnabled: true,
3454
+ * pricesIncludeTax: false,
3455
+ * defaultTaxBehavior: "CHARGE"
3456
+ * });
3457
+ * ```
3458
+ */
3459
+ updateTaxSettings(request: UpdateTaxSettingsRequest): Promise<TaxSettingsResponse>;
3460
+ /**
3461
+ * List tax rules
3462
+ *
3463
+ * @returns List of tax rules
3464
+ *
3465
+ * @example
3466
+ * ```typescript
3467
+ * const rules = await client.listTaxRules();
3468
+ * ```
3469
+ */
3470
+ listTaxRules(): Promise<ListTaxRulesResponse>;
3471
+ /**
3472
+ * Create a tax rule
3473
+ *
3474
+ * @param request - Tax rule data
3475
+ * @returns Created tax rule
3476
+ *
3477
+ * @example
3478
+ * ```typescript
3479
+ * const rule = await client.createTaxRule({
3480
+ * country: "US",
3481
+ * region: "NY",
3482
+ * taxType: "SALES_TAX",
3483
+ * taxName: "NY Sales Tax",
3484
+ * taxRate: 8.875
3485
+ * });
3486
+ * ```
3487
+ */
3488
+ createTaxRule(request: CreateTaxRuleRequest): Promise<TaxRuleResponse>;
3489
+ /**
3490
+ * Get tax rule details
3491
+ *
3492
+ * @param ruleId - Rule ID
3493
+ * @returns Tax rule details
3494
+ *
3495
+ * @example
3496
+ * ```typescript
3497
+ * const rule = await client.getTaxRule("rule_123");
3498
+ * ```
3499
+ */
3500
+ getTaxRule(ruleId: string): Promise<TaxRuleResponse>;
3501
+ /**
3502
+ * Update a tax rule
3503
+ *
3504
+ * @param ruleId - Rule ID
3505
+ * @param request - Updated rule data
3506
+ * @returns Updated tax rule
3507
+ *
3508
+ * @example
3509
+ * ```typescript
3510
+ * await client.updateTaxRule("rule_123", {
3511
+ * taxRate: 9.0
3512
+ * });
3513
+ * ```
3514
+ */
3515
+ updateTaxRule(ruleId: string, request: UpdateTaxRuleRequest): Promise<TaxRuleResponse>;
3516
+ /**
3517
+ * Delete a tax rule
3518
+ *
3519
+ * @param ruleId - Rule ID
3520
+ * @returns Success response
3521
+ *
3522
+ * @example
3523
+ * ```typescript
3524
+ * await client.deleteTaxRule("rule_123");
3525
+ * ```
3526
+ */
3527
+ deleteTaxRule(ruleId: string): Promise<SuccessResponse>;
3528
+ /**
3529
+ * List tax nexus locations
3530
+ *
3531
+ * @returns List of nexus locations
3532
+ *
3533
+ * @example
3534
+ * ```typescript
3535
+ * const nexus = await client.listTaxNexus();
3536
+ * ```
3537
+ */
3538
+ listTaxNexus(): Promise<ListTaxNexusResponse>;
3539
+ /**
3540
+ * Add a tax nexus location
3541
+ *
3542
+ * @param request - Nexus data
3543
+ * @returns Created nexus
3544
+ *
3545
+ * @example
3546
+ * ```typescript
3547
+ * const nexus = await client.createTaxNexus({
3548
+ * country: "US",
3549
+ * region: "CA",
3550
+ * registrationId: "123456789"
3551
+ * });
3552
+ * ```
3553
+ */
3554
+ createTaxNexus(request: CreateTaxNexusRequest): Promise<TaxNexusResponse>;
3555
+ /**
3556
+ * Update a tax nexus location
3557
+ *
3558
+ * @param nexusId - Nexus ID
3559
+ * @param request - Updated nexus data
3560
+ * @returns Updated nexus
3561
+ *
3562
+ * @example
3563
+ * ```typescript
3564
+ * await client.updateTaxNexus("nexus_123", {
3565
+ * registrationId: "987654321"
3566
+ * });
3567
+ * ```
3568
+ */
3569
+ updateTaxNexus(nexusId: string, request: UpdateTaxNexusRequest): Promise<TaxNexusResponse>;
3570
+ /**
3571
+ * Delete a tax nexus location
3572
+ *
3573
+ * @param nexusId - Nexus ID
3574
+ * @returns Success response
3575
+ *
3576
+ * @example
3577
+ * ```typescript
3578
+ * await client.deleteTaxNexus("nexus_123");
3579
+ * ```
3580
+ */
3581
+ deleteTaxNexus(nexusId: string): Promise<SuccessResponse>;
3582
+ /**
3583
+ * List tax reports
3584
+ *
3585
+ * @param params - Query parameters
3586
+ * @returns Paginated list of tax reports
3587
+ *
3588
+ * @example
3589
+ * ```typescript
3590
+ * const reports = await client.listTaxReports({ limit: 20, offset: 0 });
3591
+ *
3592
+ * // Get summary for a specific year
3593
+ * const summary = await client.listTaxReports({ year: 2025 });
3594
+ * ```
3595
+ */
3596
+ listTaxReports(params?: ListTaxReportsParams): Promise<ListTaxReportsResponse>;
3597
+ /**
3598
+ * Generate a tax report
3599
+ *
3600
+ * @param request - Report generation request
3601
+ * @returns Generated report
3602
+ *
3603
+ * @example
3604
+ * ```typescript
3605
+ * const report = await client.generateTaxReport({
3606
+ * periodType: "MONTHLY",
3607
+ * year: 2025,
3608
+ * period: 1 // January
3609
+ * });
3610
+ * ```
3611
+ */
3612
+ generateTaxReport(request: GenerateTaxReportRequest): Promise<TaxReportResponse>;
3613
+ /**
3614
+ * Get tax report details
3615
+ *
3616
+ * @param reportId - Report ID
3617
+ * @returns Report with detailed records
3618
+ *
3619
+ * @example
3620
+ * ```typescript
3621
+ * const report = await client.getTaxReport("report_123");
3622
+ * console.log("Total tax:", report.report.totalTax);
3623
+ * ```
3624
+ */
3625
+ getTaxReport(reportId: string): Promise<GetTaxReportResponse>;
3626
+ /**
3627
+ * Update tax report status
3628
+ *
3629
+ * @param reportId - Report ID
3630
+ * @param request - Status update
3631
+ * @returns Updated report
3632
+ *
3633
+ * @example
3634
+ * ```typescript
3635
+ * await client.updateTaxReportStatus("report_123", {
3636
+ * status: "FINALIZED"
3637
+ * });
3638
+ * ```
3639
+ */
3640
+ updateTaxReportStatus(reportId: string, request: UpdateTaxReportStatusRequest): Promise<TaxReportResponse>;
3641
+ /**
3642
+ * Export tax report as CSV
3643
+ *
3644
+ * @param reportId - Report ID
3645
+ * @returns CSV file data
3646
+ *
3647
+ * @example
3648
+ * ```typescript
3649
+ * const csv = await client.exportTaxReport("report_123");
3650
+ * // Save or download the CSV
3651
+ * ```
3652
+ */
3653
+ exportTaxReport(reportId: string): Promise<string>;
3654
+ }
3655
+
3656
+ /**
3657
+ * Ecommerce API Error Utilities
3658
+ *
3659
+ * This module contains error handling utilities for the ecommerce API.
3660
+ */
3661
+ /**
3662
+ * Ecommerce API error class
3663
+ */
3664
+ declare class EcommerceApiError extends Error {
3665
+ /** HTTP status code */
3666
+ statusCode?: number;
3667
+ /** Response data */
3668
+ data?: any;
3669
+ /** Is network error */
3670
+ isNetworkError: boolean;
3671
+ /** Is timeout error */
3672
+ isTimeoutError: boolean;
3673
+ /** Is authentication error */
3674
+ isAuthError: boolean;
3675
+ constructor(message: string, statusCode?: number, data?: any, isNetworkError?: boolean, isTimeoutError?: boolean);
3676
+ }
3677
+ /**
3678
+ * Parse error from axios error or API response
3679
+ */
3680
+ declare function parseError(error: any): EcommerceApiError;
3681
+ /**
3682
+ * Check if error is retryable
3683
+ */
3684
+ declare function isRetryableError(error: EcommerceApiError): boolean;
3685
+
3686
+ /**
3687
+ * Ecommerce API Helper Utilities
3688
+ *
3689
+ * This module contains helper functions for the ecommerce API.
3690
+ */
3691
+ /**
3692
+ * Build query string from params object
3693
+ */
3694
+ declare function buildQueryString(params: Record<string, any>): string;
3695
+ /**
3696
+ * Sleep for specified milliseconds
3697
+ */
3698
+ declare function sleep(ms: number): Promise<void>;
3699
+ /**
3700
+ * Calculate exponential backoff delay
3701
+ */
3702
+ declare function getBackoffDelay(attempt: number, baseDelay?: number): number;
3703
+ /**
3704
+ * Retry function with exponential backoff
3705
+ */
3706
+ declare function retryWithBackoff<T>(fn: () => Promise<T>, maxRetries?: number, baseDelay?: number, shouldRetry?: (error: any) => boolean): Promise<T>;
3707
+ /**
3708
+ * Format price for display
3709
+ */
3710
+ declare function formatPrice(price: string | number, decimals?: number): string;
3711
+ /**
3712
+ * Validate email address
3713
+ */
3714
+ declare function isValidEmail(email: string): boolean;
3715
+ /**
3716
+ * Validate Ethereum address
3717
+ */
3718
+ declare function isValidAddress(address: string): boolean;
3719
+ /**
3720
+ * Truncate address for display
3721
+ */
3722
+ declare function truncateAddress(address: string, start?: number, end?: number): string;
3723
+ /**
3724
+ * Calculate discount amount
3725
+ */
3726
+ declare function calculateDiscountAmount(price: number, discountType: "PERCENTAGE" | "FIXED_AMOUNT", discountValue: number): number;
3727
+ /**
3728
+ * Calculate final price after discount
3729
+ */
3730
+ declare function calculateFinalPrice(price: number, discountType: "PERCENTAGE" | "FIXED_AMOUNT", discountValue: number): number;
3731
+
3732
+ export { type AnalyticsOverview, type ApiResponse, type AppliedDiscount, type Banner, type BannerResponse, BannerType, BaseEcommerceClient, type BaseEntity, type CalculateCartDiscountsRequest, type CalculateCartDiscountsResponse, type CalculateTaxRequest, type CalculateTaxResponse, type CartItem, type ConfirmEscrowDepositResponse, type Coupon, type CouponResponse, type CouponUsage, type CreateBannerRequest, type CreateCouponRequest, type CreateOrderEventRequest, type CreateOrderEventResponse, type CreateOrderRequest, type CreateOrderResponse, type CreateProductRequest, type CreateProductVariantRequest, type CreateReviewRequest, type CreateShippingMethodRequest, type CreateTaxNexusRequest, type CreateTaxRuleRequest, CustomerEcommerceClient, type CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, type EcommerceClientConfig, type GenerateTaxReportRequest, type GetAnalyticsParams, type GetAnalyticsResponse, type GetCouponResponse, type GetOrderResponse, type GetProductMetricsResponse, type GetProductResponse, type GetTaxReportResponse, InventoryAuditAction, type InventoryAuditEntry, type ListActiveBannersParams, type ListBannersResponse, type ListCouponsResponse, type ListCustomersParams, type ListCustomersResponse, type ListInventoryAuditResponse, type ListMediaAssetsResponse, type ListMessagesResponse, type ListOrdersParams, type ListOrdersResponse, type ListProductVariantsResponse, type ListProductsParams, type ListProductsResponse, type ListReturnsResponse, type ListReviewsParams, type ListReviewsResponse, type ListShipmentsResponse, type ListShippingAddressesResponse, type ListShippingMethodsResponse, type ListTaxNexusResponse, type ListTaxReportsParams, type ListTaxReportsResponse, type ListTaxRulesResponse, type MediaAsset, type MediaAssetResponse, type Merchant, MerchantEcommerceClient, type MerchantProfileRequest, type MerchantProfileResponse, MerchantStatus, type Message, type MessageResponse, type Order, type OrderEvent, type OrderItem, type OrderReceiptResponse, OrderStatus, type OrdersByStatus, type PaginatedResponse, type PaginationParams, type Payment, PaymentMethod, PaymentStatus, type Product, type ProductDimensions, type ProductDiscountsResponse, type ProductMetrics, type ProductResponse, type ProductReview, ProductSortBy, type ProductVariant, type ProductVariantResponse, type RecentOrderSummary, type RespondToReviewRequest, type Return, type ReturnItem, type ReturnResponse, ReturnStatus, type RevenueByDay, type ReviewResponse, ReviewSortBy, ReviewStatus, type SendMessageRequest, type Settlement, type Shipment, type ShipmentResponse, ShipmentStatus, type ShippingAddress, type ShippingAddressRequest, type ShippingAddressResponse, type ShippingMethod, type ShippingMethodResponse, SortOrder, type SuccessResponse, TaxBehavior, type TaxBreakdownItem, type TaxNexus, type TaxNexusResponse, type TaxReport, type TaxReportDetails, TaxReportPeriodType, type TaxReportResponse, TaxReportStatus, type TaxRule, type TaxRuleResponse, type TaxSettings, type TaxSettingsResponse, TaxType, type TopProduct, type TrackBannerRequest, type UpdateBannerRequest, type UpdateCouponRequest, type UpdateOrderResponse, type UpdateOrderStatusRequest, type UpdateProductRequest, type UpdateProductVariantRequest, type UpdateShipmentRequest, type UpdateShippingMethodRequest, type UpdateTaxNexusRequest, type UpdateTaxReportStatusRequest, type UpdateTaxRuleRequest, type UpdateTaxSettingsRequest, type UserShippingAddress, type ValidateDiscountRequest, type ValidateDiscountResponse, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress };