@basedone/core 0.1.10 → 0.2.1

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 (54) hide show
  1. package/dist/chunk-4UEJOM6W.mjs +1 -3
  2. package/dist/chunk-MVFO4WRF.mjs +2091 -0
  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 +3986 -0
  7. package/dist/ecommerce.d.ts +3986 -0
  8. package/dist/ecommerce.js +2135 -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 +2795 -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/FLASH_SALES.md +340 -0
  29. package/lib/ecommerce/QUICK_REFERENCE.md +211 -0
  30. package/lib/ecommerce/README.md +391 -0
  31. package/lib/ecommerce/USAGE_EXAMPLES.md +704 -0
  32. package/lib/ecommerce/client/base.ts +272 -0
  33. package/lib/ecommerce/client/customer.ts +639 -0
  34. package/lib/ecommerce/client/merchant.ts +1341 -0
  35. package/lib/ecommerce/index.ts +51 -0
  36. package/lib/ecommerce/types/entities.ts +791 -0
  37. package/lib/ecommerce/types/enums.ts +270 -0
  38. package/lib/ecommerce/types/index.ts +18 -0
  39. package/lib/ecommerce/types/requests.ts +580 -0
  40. package/lib/ecommerce/types/responses.ts +857 -0
  41. package/lib/ecommerce/utils/errors.ts +113 -0
  42. package/lib/ecommerce/utils/helpers.ts +131 -0
  43. package/lib/hip3/market-info.ts +1 -1
  44. package/lib/instrument/client.ts +351 -0
  45. package/lib/meta/data/mainnet/perpDexs.json +34 -4
  46. package/lib/meta/data/mainnet/spotMeta.json +21 -3
  47. package/lib/meta/data/testnet/meta.json +1 -3
  48. package/lib/meta/data/testnet/perpDexs.json +174 -28
  49. package/lib/meta/data/testnet/spotMeta.json +51 -0
  50. package/lib/react/InstrumentProvider.tsx +69 -0
  51. package/lib/utils/flooredDateTime.ts +55 -0
  52. package/lib/utils/time.ts +51 -0
  53. package/package.json +37 -11
  54. package/react.ts +1 -0
@@ -0,0 +1,3986 @@
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
+ * Flash sale item entity
1098
+ */
1099
+ interface FlashSaleItem {
1100
+ /** Item ID */
1101
+ id: string;
1102
+ /** Product ID */
1103
+ productId: string;
1104
+ /** Sale price in USDC */
1105
+ salePrice: string;
1106
+ /** Original price in USDC */
1107
+ originalPrice: string;
1108
+ /** Discount percentage */
1109
+ discountPercent: number;
1110
+ /** Maximum quantity available at this price */
1111
+ maxQuantity: number | null;
1112
+ /** Quantity sold at flash price */
1113
+ soldQuantity: number;
1114
+ /** Remaining quantity */
1115
+ remainingQuantity: number | null;
1116
+ /** Limit per customer */
1117
+ limitPerCustomer: number | null;
1118
+ /** Product details */
1119
+ product: {
1120
+ id: string;
1121
+ title: string;
1122
+ description?: string | null;
1123
+ images: string[];
1124
+ priceUSDC: string;
1125
+ inventory: number | null;
1126
+ soldCount: number;
1127
+ averageRating: number | null;
1128
+ reviewCount: number;
1129
+ merchant?: {
1130
+ id: string;
1131
+ name: string;
1132
+ };
1133
+ };
1134
+ }
1135
+ /**
1136
+ * Flash sale entity
1137
+ */
1138
+ interface FlashSale {
1139
+ /** Flash sale ID */
1140
+ id: string;
1141
+ /** Sale name */
1142
+ name: string;
1143
+ /** Description */
1144
+ description?: string | null;
1145
+ /** Start timestamp */
1146
+ startsAt: string;
1147
+ /** End timestamp */
1148
+ endsAt: string;
1149
+ /** Badge text (e.g., "Mall", "Hot Deal") */
1150
+ badgeText?: string | null;
1151
+ /** Badge color (hex) */
1152
+ badgeColor?: string | null;
1153
+ /** Priority (higher = shown first) */
1154
+ priority: number;
1155
+ /** Merchant information */
1156
+ merchant?: {
1157
+ id: string;
1158
+ name: string;
1159
+ } | null;
1160
+ /** Flash sale items */
1161
+ items: FlashSaleItem[];
1162
+ }
1163
+
1164
+ /**
1165
+ * Ecommerce API Request Types
1166
+ *
1167
+ * This module contains all request types for the ecommerce API.
1168
+ */
1169
+
1170
+ /**
1171
+ * Pagination parameters
1172
+ */
1173
+ interface PaginationParams {
1174
+ /** Number of items to return */
1175
+ limit?: number;
1176
+ /** Number of items to skip */
1177
+ offset?: number;
1178
+ }
1179
+ /**
1180
+ * List products request parameters
1181
+ */
1182
+ interface ListProductsParams extends PaginationParams {
1183
+ /** Filter by specific product IDs */
1184
+ ids?: string[];
1185
+ /** Filter by merchant ID */
1186
+ merchantId?: string;
1187
+ /** Filter by category slug */
1188
+ category?: string;
1189
+ /** Search query */
1190
+ search?: string;
1191
+ /** Filter by tags */
1192
+ tags?: string[];
1193
+ /** Minimum price */
1194
+ minPrice?: number;
1195
+ /** Maximum price */
1196
+ maxPrice?: number;
1197
+ /** Filter by featured status */
1198
+ featured?: boolean;
1199
+ /** Sort by */
1200
+ sortBy?: ProductSortBy;
1201
+ /** Filter by active status */
1202
+ isActive?: boolean;
1203
+ }
1204
+ /**
1205
+ * Create product request
1206
+ */
1207
+ interface CreateProductRequest {
1208
+ /** Product title */
1209
+ title: string;
1210
+ /** Product images URLs (from media library) */
1211
+ images: string[];
1212
+ /** Price in USDC */
1213
+ priceUSDC: number;
1214
+ /** Compare at price */
1215
+ compareAtPrice?: number | null;
1216
+ /** Inventory count */
1217
+ inventory?: number | null;
1218
+ /** SKU */
1219
+ sku?: string | null;
1220
+ /** Minimum order quantity */
1221
+ moq?: number;
1222
+ /** Category slug */
1223
+ category?: string | null;
1224
+ /** Rich description (HTML) */
1225
+ richDescription?: string | null;
1226
+ /** Weight in kg */
1227
+ weight?: number | null;
1228
+ /** Dimensions */
1229
+ dimensions?: ProductDimensions | null;
1230
+ /** Is active */
1231
+ isActive?: boolean;
1232
+ }
1233
+ /**
1234
+ * Update product request
1235
+ */
1236
+ interface UpdateProductRequest extends Partial<CreateProductRequest> {
1237
+ }
1238
+ /**
1239
+ * Create product variant request
1240
+ */
1241
+ interface CreateProductVariantRequest {
1242
+ /** Variant name */
1243
+ name: string;
1244
+ /** SKU */
1245
+ sku?: string | null;
1246
+ /** Price override */
1247
+ priceUSDC?: number | null;
1248
+ /** Inventory count */
1249
+ inventory?: number | null;
1250
+ /** Variant attributes */
1251
+ attributes: Record<string, string>;
1252
+ /** Is active */
1253
+ isActive?: boolean;
1254
+ /** Sort order */
1255
+ sortOrder?: number;
1256
+ }
1257
+ /**
1258
+ * Update product variant request
1259
+ */
1260
+ interface UpdateProductVariantRequest extends Partial<CreateProductVariantRequest> {
1261
+ }
1262
+ /**
1263
+ * Cart item
1264
+ */
1265
+ interface CartItem {
1266
+ /** Product ID */
1267
+ productId: string;
1268
+ /** Quantity */
1269
+ quantity: number;
1270
+ /** Variant ID (optional) */
1271
+ variantId?: string;
1272
+ }
1273
+ /**
1274
+ * Create order request
1275
+ */
1276
+ interface CreateOrderRequest {
1277
+ /** Cart items */
1278
+ items: CartItem[];
1279
+ /** Payment method */
1280
+ paymentMethod: PaymentMethod;
1281
+ /** Shipping address */
1282
+ shippingAddress: ShippingAddress;
1283
+ /** Customer notes */
1284
+ customerNotes?: string;
1285
+ /** Coupon code */
1286
+ couponCode?: string;
1287
+ /** Idempotency key */
1288
+ idempotencyKey?: string;
1289
+ }
1290
+ /**
1291
+ * List orders request parameters
1292
+ */
1293
+ interface ListOrdersParams extends PaginationParams {
1294
+ /** Filter by status */
1295
+ status?: OrderStatus;
1296
+ }
1297
+ /**
1298
+ * Update order status request
1299
+ */
1300
+ interface UpdateOrderStatusRequest {
1301
+ /** New status */
1302
+ status: OrderStatus;
1303
+ /** Tracking information (required for SHIPPED status) */
1304
+ tracking?: {
1305
+ trackingNumber: string;
1306
+ carrier: string;
1307
+ };
1308
+ }
1309
+ /**
1310
+ * Create order event request
1311
+ */
1312
+ interface CreateOrderEventRequest {
1313
+ /** Event type */
1314
+ eventType: string;
1315
+ /** Event title */
1316
+ title: string;
1317
+ /** Event description */
1318
+ description?: string;
1319
+ /** Event metadata */
1320
+ metadata?: Record<string, any>;
1321
+ }
1322
+ /**
1323
+ * Create review request
1324
+ */
1325
+ interface CreateReviewRequest {
1326
+ /** Rating (1-5) */
1327
+ rating: number;
1328
+ /** Review title */
1329
+ title?: string;
1330
+ /** Review comment */
1331
+ comment?: string;
1332
+ }
1333
+ /**
1334
+ * List reviews request parameters
1335
+ */
1336
+ interface ListReviewsParams extends PaginationParams {
1337
+ /** Sort by */
1338
+ sortBy?: ReviewSortBy;
1339
+ }
1340
+ /**
1341
+ * Respond to review request
1342
+ */
1343
+ interface RespondToReviewRequest {
1344
+ /** Merchant response */
1345
+ merchantResponse: string;
1346
+ }
1347
+ /**
1348
+ * Create/update shipping address request
1349
+ */
1350
+ interface ShippingAddressRequest extends ShippingAddress {
1351
+ /** Is default address */
1352
+ isDefault?: boolean;
1353
+ /** Address label */
1354
+ label?: string | null;
1355
+ }
1356
+ /**
1357
+ * Calculate cart discounts request
1358
+ */
1359
+ interface CalculateCartDiscountsRequest {
1360
+ /** Cart items */
1361
+ items: CartItem[];
1362
+ }
1363
+ /**
1364
+ * Validate discount code request
1365
+ */
1366
+ interface ValidateDiscountRequest {
1367
+ /** Discount code */
1368
+ code: string;
1369
+ /** Cart items */
1370
+ items: CartItem[];
1371
+ }
1372
+ /**
1373
+ * Calculate tax request
1374
+ */
1375
+ interface CalculateTaxRequest {
1376
+ /** Cart items */
1377
+ items: CartItem[];
1378
+ /** Shipping address */
1379
+ shippingAddress: {
1380
+ country: string;
1381
+ region?: string;
1382
+ postalCode?: string;
1383
+ };
1384
+ }
1385
+ /**
1386
+ * Create/update merchant profile request
1387
+ */
1388
+ interface MerchantProfileRequest {
1389
+ /** Merchant name */
1390
+ name: string;
1391
+ /** Description */
1392
+ description?: string | null;
1393
+ /** Payout address (wallet) */
1394
+ payoutAddress: string;
1395
+ }
1396
+ /**
1397
+ * Create coupon request
1398
+ */
1399
+ interface CreateCouponRequest {
1400
+ /** Coupon code */
1401
+ code?: string;
1402
+ /** Title */
1403
+ title?: string | null;
1404
+ /** Discount method */
1405
+ discountMethod?: DiscountMethod;
1406
+ /** Discount type */
1407
+ discountType: DiscountType;
1408
+ /** Discount scope */
1409
+ discountScope?: DiscountScope;
1410
+ /** Discount value */
1411
+ discountValue: number;
1412
+ /** Minimum purchase */
1413
+ minPurchase?: number | null;
1414
+ /** Minimum quantity */
1415
+ minQuantity?: number | null;
1416
+ /** Buy quantity */
1417
+ buyQuantity?: number | null;
1418
+ /** Get quantity */
1419
+ getQuantity?: number | null;
1420
+ /** Get discount value */
1421
+ getDiscountValue?: number | null;
1422
+ /** Maximum uses */
1423
+ maxUses?: number | null;
1424
+ /** Uses per customer */
1425
+ usesPerCustomer?: number | null;
1426
+ /** Applicable products */
1427
+ applicableProducts?: string[];
1428
+ /** Applicable categories */
1429
+ applicableCategories?: string[];
1430
+ /** Combinable */
1431
+ combinable?: boolean;
1432
+ /** Start date */
1433
+ startsAt: string;
1434
+ /** Expiry date */
1435
+ expiresAt: string;
1436
+ /** Is active */
1437
+ isActive?: boolean;
1438
+ }
1439
+ /**
1440
+ * Update coupon request
1441
+ */
1442
+ interface UpdateCouponRequest extends Partial<CreateCouponRequest> {
1443
+ }
1444
+ /**
1445
+ * Create shipping method request
1446
+ */
1447
+ interface CreateShippingMethodRequest {
1448
+ /** Method name */
1449
+ name: string;
1450
+ /** Carrier */
1451
+ carrier?: string | null;
1452
+ /** Estimated delivery days */
1453
+ estimatedDays?: string | null;
1454
+ /** Flat rate */
1455
+ flatRate?: number | null;
1456
+ /** Weight-based */
1457
+ weightBased?: boolean;
1458
+ /** Free threshold */
1459
+ freeThreshold?: number | null;
1460
+ /** Is active */
1461
+ isActive?: boolean;
1462
+ }
1463
+ /**
1464
+ * Update shipping method request
1465
+ */
1466
+ interface UpdateShippingMethodRequest extends Partial<CreateShippingMethodRequest> {
1467
+ }
1468
+ /**
1469
+ * Update shipment request
1470
+ */
1471
+ interface UpdateShipmentRequest {
1472
+ /** Shipment status */
1473
+ status?: ShipmentStatus;
1474
+ /** Tracking number */
1475
+ trackingNumber?: string | null;
1476
+ /** Carrier */
1477
+ carrier?: string | null;
1478
+ /** Shipping label URL */
1479
+ shippingLabel?: string | null;
1480
+ }
1481
+ /**
1482
+ * Create banner request
1483
+ */
1484
+ interface CreateBannerRequest {
1485
+ /** Banner type */
1486
+ type?: BannerType;
1487
+ /** Title */
1488
+ title: string;
1489
+ /** Subtitle */
1490
+ subtitle?: string | null;
1491
+ /** Image URL */
1492
+ imageUrl: string;
1493
+ /** Link URL */
1494
+ linkUrl?: string | null;
1495
+ /** CTA text */
1496
+ ctaText?: string | null;
1497
+ /** Start date */
1498
+ startDate?: string | null;
1499
+ /** End date */
1500
+ endDate?: string | null;
1501
+ /** Priority */
1502
+ priority?: number;
1503
+ /** Is active */
1504
+ isActive?: boolean;
1505
+ }
1506
+ /**
1507
+ * Update banner request
1508
+ */
1509
+ interface UpdateBannerRequest extends Partial<CreateBannerRequest> {
1510
+ }
1511
+ /**
1512
+ * Track banner request
1513
+ */
1514
+ interface TrackBannerRequest {
1515
+ /** Action type */
1516
+ action: "impression" | "click";
1517
+ }
1518
+ /**
1519
+ * Send message request
1520
+ */
1521
+ interface SendMessageRequest {
1522
+ /** Order ID */
1523
+ orderId: string;
1524
+ /** Recipient user ID */
1525
+ recipientId: string;
1526
+ /** Message text */
1527
+ message: string;
1528
+ }
1529
+ /**
1530
+ * Update tax settings request
1531
+ */
1532
+ interface UpdateTaxSettingsRequest {
1533
+ /** Tax enabled */
1534
+ taxEnabled?: boolean;
1535
+ /** Prices include tax */
1536
+ pricesIncludeTax?: boolean;
1537
+ /** Default tax behavior */
1538
+ defaultTaxBehavior?: TaxBehavior;
1539
+ /** Tax registration number */
1540
+ taxRegistrationNumber?: string | null;
1541
+ /** Registration country */
1542
+ registrationCountry?: string | null;
1543
+ }
1544
+ /**
1545
+ * Create tax rule request
1546
+ */
1547
+ interface CreateTaxRuleRequest {
1548
+ /** Country */
1549
+ country: string;
1550
+ /** Region */
1551
+ region?: string | null;
1552
+ /** Postal code from */
1553
+ postalCodeFrom?: string | null;
1554
+ /** Postal code to */
1555
+ postalCodeTo?: string | null;
1556
+ /** Tax type */
1557
+ taxType: TaxType;
1558
+ /** Tax name */
1559
+ taxName: string;
1560
+ /** Tax rate */
1561
+ taxRate: number;
1562
+ /** Priority */
1563
+ priority?: number;
1564
+ /** Is compound */
1565
+ isCompound?: boolean;
1566
+ }
1567
+ /**
1568
+ * Update tax rule request
1569
+ */
1570
+ interface UpdateTaxRuleRequest extends Partial<CreateTaxRuleRequest> {
1571
+ /** Is active */
1572
+ isActive?: boolean;
1573
+ }
1574
+ /**
1575
+ * Create tax nexus request
1576
+ */
1577
+ interface CreateTaxNexusRequest {
1578
+ /** Country */
1579
+ country: string;
1580
+ /** Region */
1581
+ region?: string | null;
1582
+ /** Registration ID */
1583
+ registrationId?: string | null;
1584
+ }
1585
+ /**
1586
+ * Update tax nexus request
1587
+ */
1588
+ interface UpdateTaxNexusRequest {
1589
+ /** Registration ID */
1590
+ registrationId?: string | null;
1591
+ /** Is active */
1592
+ isActive?: boolean;
1593
+ }
1594
+ /**
1595
+ * Generate tax report request
1596
+ */
1597
+ interface GenerateTaxReportRequest {
1598
+ /** Period type */
1599
+ periodType: TaxReportPeriodType;
1600
+ /** Year */
1601
+ year: number;
1602
+ /** Period (1-12 for monthly, 1-4 for quarterly, 1 for yearly) */
1603
+ period: number;
1604
+ }
1605
+ /**
1606
+ * Update tax report status request
1607
+ */
1608
+ interface UpdateTaxReportStatusRequest {
1609
+ /** Report status */
1610
+ status: "DRAFT" | "FINALIZED" | "FILED";
1611
+ }
1612
+ /**
1613
+ * List tax reports params
1614
+ */
1615
+ interface ListTaxReportsParams extends PaginationParams {
1616
+ /** Filter by year (for summary) */
1617
+ year?: number;
1618
+ }
1619
+ /**
1620
+ * Get analytics params
1621
+ */
1622
+ interface GetAnalyticsParams {
1623
+ /** Date range */
1624
+ range?: "7days" | "30days" | "90days" | "1year";
1625
+ }
1626
+ /**
1627
+ * List customers params
1628
+ */
1629
+ interface ListCustomersParams extends PaginationParams {
1630
+ }
1631
+ /**
1632
+ * List active banners params
1633
+ */
1634
+ interface ListActiveBannersParams {
1635
+ /** Filter by type */
1636
+ type?: BannerType;
1637
+ /** Filter by merchant ID */
1638
+ merchantId?: string;
1639
+ }
1640
+ /**
1641
+ * List active flash sales params
1642
+ */
1643
+ interface ListActiveFlashSalesParams {
1644
+ /** Maximum number of flash sales to return */
1645
+ limit?: number;
1646
+ /** Filter by merchant ID */
1647
+ merchantId?: string;
1648
+ }
1649
+ /**
1650
+ * Flash sale item input
1651
+ */
1652
+ interface FlashSaleItemInput {
1653
+ /** Product ID */
1654
+ productId: string;
1655
+ /** Sale price in USDC */
1656
+ salePrice: number;
1657
+ /** Maximum quantity available */
1658
+ maxQuantity?: number | null;
1659
+ /** Limit per customer */
1660
+ limitPerCustomer?: number;
1661
+ /** Sort order */
1662
+ sortOrder?: number;
1663
+ }
1664
+ /**
1665
+ * Create flash sale request
1666
+ */
1667
+ interface CreateFlashSaleRequest {
1668
+ /** Sale name */
1669
+ name: string;
1670
+ /** Description */
1671
+ description?: string | null;
1672
+ /** Start timestamp */
1673
+ startsAt: string;
1674
+ /** End timestamp */
1675
+ endsAt: string;
1676
+ /** Badge text */
1677
+ badgeText?: string;
1678
+ /** Badge color (hex) */
1679
+ badgeColor?: string;
1680
+ /** Priority (higher = shown first) */
1681
+ priority?: number;
1682
+ /** Is active */
1683
+ isActive?: boolean;
1684
+ /** Flash sale items */
1685
+ items?: FlashSaleItemInput[];
1686
+ }
1687
+ /**
1688
+ * Update flash sale request
1689
+ */
1690
+ interface UpdateFlashSaleRequest extends Partial<CreateFlashSaleRequest> {
1691
+ }
1692
+
1693
+ /**
1694
+ * Ecommerce API Response Types
1695
+ *
1696
+ * This module contains all response types for the ecommerce API.
1697
+ */
1698
+
1699
+ /**
1700
+ * Base API response
1701
+ */
1702
+ interface ApiResponse<T = any> {
1703
+ /** Response data */
1704
+ data?: T;
1705
+ /** Error message */
1706
+ error?: string;
1707
+ /** Success flag */
1708
+ success?: boolean;
1709
+ }
1710
+ /**
1711
+ * Paginated response
1712
+ */
1713
+ interface PaginatedResponse<T> {
1714
+ /** Items */
1715
+ items: T[];
1716
+ /** Total count */
1717
+ total: number;
1718
+ /** Limit */
1719
+ limit: number;
1720
+ /** Offset */
1721
+ offset: number;
1722
+ }
1723
+ /**
1724
+ * List products response
1725
+ */
1726
+ interface ListProductsResponse extends PaginatedResponse<Product> {
1727
+ }
1728
+ /**
1729
+ * Get product response
1730
+ *
1731
+ * Note: The API returns the product object directly, not wrapped in a `product` field.
1732
+ * This type extends Product to be compatible with the actual API response.
1733
+ */
1734
+ type GetProductResponse = Product;
1735
+ /**
1736
+ * Create/Update product response
1737
+ */
1738
+ interface ProductResponse {
1739
+ /** Product */
1740
+ product: Product;
1741
+ }
1742
+ /**
1743
+ * List product variants response
1744
+ */
1745
+ interface ListProductVariantsResponse {
1746
+ /** Variants */
1747
+ variants: ProductVariant[];
1748
+ }
1749
+ /**
1750
+ * Product variant response
1751
+ */
1752
+ interface ProductVariantResponse {
1753
+ /** Variant */
1754
+ variant: ProductVariant;
1755
+ }
1756
+ /**
1757
+ * List orders response
1758
+ */
1759
+ interface ListOrdersResponse extends PaginatedResponse<Order> {
1760
+ /** Merchant information (for merchant endpoints) */
1761
+ merchant?: Merchant;
1762
+ }
1763
+ /**
1764
+ * Get order response
1765
+ */
1766
+ interface GetOrderResponse {
1767
+ /** Order */
1768
+ order: Order;
1769
+ }
1770
+ /**
1771
+ * Create order response
1772
+ */
1773
+ interface CreateOrderResponse {
1774
+ /** Created orders (array for multi-merchant checkout) */
1775
+ orders: Order[];
1776
+ /** Summary */
1777
+ summary: {
1778
+ /** Total amount */
1779
+ totalAmount: string;
1780
+ /** Order count */
1781
+ orderCount: number;
1782
+ /** Merchant names */
1783
+ merchantNames: string[];
1784
+ };
1785
+ /** Escrow payment instructions (for USDC_ESCROW) */
1786
+ escrow?: {
1787
+ /** Escrow address */
1788
+ address: string;
1789
+ /** Amount in USDC */
1790
+ amountUSDC: string;
1791
+ };
1792
+ /** Test mode flag */
1793
+ testMode?: boolean;
1794
+ }
1795
+ /**
1796
+ * Update order response
1797
+ */
1798
+ interface UpdateOrderResponse {
1799
+ /** Updated order */
1800
+ order: Order;
1801
+ }
1802
+ /**
1803
+ * Confirm escrow deposit response
1804
+ */
1805
+ interface ConfirmEscrowDepositResponse {
1806
+ /** Success flag */
1807
+ ok: boolean;
1808
+ /** Order ID */
1809
+ orderId: string;
1810
+ /** Order status */
1811
+ status: string;
1812
+ /** Deposit transaction hash */
1813
+ depositTxHash: string | null;
1814
+ }
1815
+ /**
1816
+ * Order receipt response
1817
+ */
1818
+ interface OrderReceiptResponse {
1819
+ /** Receipt */
1820
+ receipt: {
1821
+ /** Order number */
1822
+ orderNumber: string;
1823
+ /** Order ID */
1824
+ orderId: string;
1825
+ /** Order date */
1826
+ orderDate: string;
1827
+ /** Status */
1828
+ status: string;
1829
+ /** Customer */
1830
+ customer: {
1831
+ name: string;
1832
+ email?: string;
1833
+ };
1834
+ /** Merchant */
1835
+ merchant: {
1836
+ name: string;
1837
+ };
1838
+ /** Shipping address */
1839
+ shippingAddress: any;
1840
+ /** Items */
1841
+ items: Array<{
1842
+ title: string;
1843
+ quantity: number;
1844
+ unitPrice: string;
1845
+ totalPrice: string;
1846
+ }>;
1847
+ /** Subtotal */
1848
+ subtotal: string;
1849
+ /** Tax */
1850
+ tax: string;
1851
+ /** Shipping */
1852
+ shipping: string;
1853
+ /** Total */
1854
+ total: string;
1855
+ /** Payment */
1856
+ payment: {
1857
+ method: string;
1858
+ status?: string;
1859
+ transactionHash?: string | null;
1860
+ };
1861
+ };
1862
+ }
1863
+ /**
1864
+ * List reviews response
1865
+ */
1866
+ interface ListReviewsResponse extends PaginatedResponse<ProductReview> {
1867
+ }
1868
+ /**
1869
+ * Create/Update review response
1870
+ */
1871
+ interface ReviewResponse {
1872
+ /** Review */
1873
+ review: ProductReview;
1874
+ }
1875
+ /**
1876
+ * List shipping addresses response
1877
+ */
1878
+ interface ListShippingAddressesResponse {
1879
+ /** Addresses */
1880
+ addresses: UserShippingAddress[];
1881
+ }
1882
+ /**
1883
+ * Shipping address response
1884
+ */
1885
+ interface ShippingAddressResponse {
1886
+ /** Address */
1887
+ address: UserShippingAddress;
1888
+ }
1889
+ /**
1890
+ * Applied discount
1891
+ */
1892
+ interface AppliedDiscount {
1893
+ /** Coupon/discount ID */
1894
+ id: string;
1895
+ /** Code */
1896
+ code: string;
1897
+ /** Title */
1898
+ title?: string | null;
1899
+ /** Discount type */
1900
+ discountType: string;
1901
+ /** Discount amount */
1902
+ discountAmount: number;
1903
+ /** Description */
1904
+ description?: string;
1905
+ }
1906
+ /**
1907
+ * Calculate cart discounts response
1908
+ */
1909
+ interface CalculateCartDiscountsResponse {
1910
+ /** Subtotal */
1911
+ subtotal: number;
1912
+ /** Discount amount */
1913
+ discountAmount: number;
1914
+ /** Total */
1915
+ total: number;
1916
+ /** Applied discounts */
1917
+ appliedDiscounts: AppliedDiscount[];
1918
+ }
1919
+ /**
1920
+ * Validate discount response
1921
+ */
1922
+ interface ValidateDiscountResponse {
1923
+ /** Is valid */
1924
+ valid: boolean;
1925
+ /** Error message */
1926
+ error?: string;
1927
+ /** Discount */
1928
+ discount?: {
1929
+ /** Coupon ID */
1930
+ id: string;
1931
+ /** Code */
1932
+ code: string;
1933
+ /** Title */
1934
+ title?: string | null;
1935
+ /** Discount type */
1936
+ discountType: string;
1937
+ /** Discount amount */
1938
+ discountAmount: number;
1939
+ };
1940
+ /** Subtotal */
1941
+ subtotal?: number;
1942
+ /** Total */
1943
+ total?: number;
1944
+ }
1945
+ /**
1946
+ * Tax breakdown item
1947
+ */
1948
+ interface TaxBreakdownItem {
1949
+ /** Tax type */
1950
+ taxType: string;
1951
+ /** Tax name */
1952
+ taxName: string;
1953
+ /** Tax rate */
1954
+ taxRate: number;
1955
+ /** Tax amount */
1956
+ taxAmount: number;
1957
+ /** Country */
1958
+ country: string;
1959
+ /** Region */
1960
+ region?: string;
1961
+ }
1962
+ /**
1963
+ * Calculate tax response
1964
+ */
1965
+ interface CalculateTaxResponse {
1966
+ /** Subtotal */
1967
+ subtotal: number;
1968
+ /** Tax amount */
1969
+ taxAmount: number;
1970
+ /** Total */
1971
+ total: number;
1972
+ /** Tax breakdown */
1973
+ breakdown: TaxBreakdownItem[];
1974
+ /** Merchant tax details (for multi-merchant) */
1975
+ merchantTaxDetails?: Array<{
1976
+ merchantId: string;
1977
+ subtotal: number;
1978
+ taxAmount: number;
1979
+ hasNexus: boolean;
1980
+ breakdown: TaxBreakdownItem[];
1981
+ }>;
1982
+ }
1983
+ /**
1984
+ * Merchant profile response
1985
+ */
1986
+ interface MerchantProfileResponse {
1987
+ /** Merchant */
1988
+ merchant: Merchant;
1989
+ }
1990
+ /**
1991
+ * List coupons response
1992
+ */
1993
+ interface ListCouponsResponse {
1994
+ /** Coupons */
1995
+ coupons: Coupon[];
1996
+ /** Stats */
1997
+ stats: {
1998
+ total: number;
1999
+ active: number;
2000
+ totalUsages: number;
2001
+ totalDiscount: number;
2002
+ };
2003
+ }
2004
+ /**
2005
+ * Coupon response
2006
+ */
2007
+ interface CouponResponse {
2008
+ /** Coupon */
2009
+ coupon: Coupon;
2010
+ }
2011
+ /**
2012
+ * Get coupon with usages response
2013
+ */
2014
+ interface GetCouponResponse {
2015
+ /** Coupon with usages */
2016
+ coupon: Coupon & {
2017
+ usages: Array<CouponUsage & {
2018
+ user: {
2019
+ username?: string;
2020
+ };
2021
+ }>;
2022
+ };
2023
+ }
2024
+ /**
2025
+ * List shipping methods response
2026
+ */
2027
+ interface ListShippingMethodsResponse {
2028
+ /** Methods */
2029
+ methods: ShippingMethod[];
2030
+ }
2031
+ /**
2032
+ * Shipping method response
2033
+ */
2034
+ interface ShippingMethodResponse {
2035
+ /** Method */
2036
+ method: ShippingMethod;
2037
+ }
2038
+ /**
2039
+ * List shipments response
2040
+ */
2041
+ interface ListShipmentsResponse {
2042
+ /** Shipments */
2043
+ shipments: Array<Shipment & {
2044
+ order: {
2045
+ id: string;
2046
+ totalUSDC: string;
2047
+ shippingAddress: any;
2048
+ user: {
2049
+ id: string;
2050
+ username?: string;
2051
+ };
2052
+ };
2053
+ }>;
2054
+ }
2055
+ /**
2056
+ * Shipment response
2057
+ */
2058
+ interface ShipmentResponse {
2059
+ /** Shipment */
2060
+ shipment: Shipment;
2061
+ }
2062
+ /**
2063
+ * List returns response
2064
+ */
2065
+ interface ListReturnsResponse {
2066
+ /** Returns */
2067
+ returns: Array<Return & {
2068
+ user: {
2069
+ id: string;
2070
+ username?: string;
2071
+ };
2072
+ order: {
2073
+ id: string;
2074
+ totalUSDC: string;
2075
+ };
2076
+ }>;
2077
+ }
2078
+ /**
2079
+ * Return response
2080
+ */
2081
+ interface ReturnResponse {
2082
+ /** Return */
2083
+ return: Return;
2084
+ }
2085
+ /**
2086
+ * List banners response
2087
+ */
2088
+ interface ListBannersResponse {
2089
+ /** Banners */
2090
+ banners: Banner[];
2091
+ }
2092
+ /**
2093
+ * Banner response
2094
+ */
2095
+ interface BannerResponse {
2096
+ /** Banner */
2097
+ banner: Banner;
2098
+ }
2099
+ /**
2100
+ * List media assets response
2101
+ */
2102
+ interface ListMediaAssetsResponse extends PaginatedResponse<MediaAsset> {
2103
+ }
2104
+ /**
2105
+ * Media asset response
2106
+ */
2107
+ interface MediaAssetResponse {
2108
+ /** Asset */
2109
+ asset: MediaAsset;
2110
+ }
2111
+ /**
2112
+ * List messages response
2113
+ */
2114
+ interface ListMessagesResponse {
2115
+ /** Conversations */
2116
+ conversations: Array<{
2117
+ orderId: string;
2118
+ orderNumber: string;
2119
+ customer: {
2120
+ id: string;
2121
+ name?: string;
2122
+ username?: string;
2123
+ };
2124
+ lastMessage: Message;
2125
+ unreadCount: number;
2126
+ messages: Message[];
2127
+ }>;
2128
+ /** Stats */
2129
+ stats: {
2130
+ total: number;
2131
+ unread: number;
2132
+ };
2133
+ }
2134
+ /**
2135
+ * Message response
2136
+ */
2137
+ interface MessageResponse {
2138
+ /** Message */
2139
+ message: Message;
2140
+ }
2141
+ /**
2142
+ * Customer messages response (for retail users)
2143
+ *
2144
+ * Groups messages by order, where each order represents a conversation with a merchant.
2145
+ */
2146
+ interface CustomerMessagesResponse {
2147
+ /** Conversations grouped by order */
2148
+ conversations: Array<{
2149
+ orderId: string;
2150
+ orderNumber: string;
2151
+ merchant: {
2152
+ id: string;
2153
+ name: string;
2154
+ ownerUserId: string;
2155
+ };
2156
+ lastMessage: Message;
2157
+ unreadCount: number;
2158
+ messages: Message[];
2159
+ }>;
2160
+ /** Stats */
2161
+ stats: {
2162
+ total: number;
2163
+ unread: number;
2164
+ };
2165
+ }
2166
+ /**
2167
+ * Message stats response (for notification badges)
2168
+ */
2169
+ interface MessageStatsResponse {
2170
+ /** Unread message count */
2171
+ unread: number;
2172
+ }
2173
+ /**
2174
+ * Analytics overview
2175
+ */
2176
+ interface AnalyticsOverview {
2177
+ /** Total revenue */
2178
+ totalRevenue: number;
2179
+ /** Revenue change percentage */
2180
+ revenueChange: number;
2181
+ /** Total orders */
2182
+ totalOrders: number;
2183
+ /** Orders change percentage */
2184
+ ordersChange: number;
2185
+ /** Average order value */
2186
+ averageOrderValue: number;
2187
+ /** AOV change percentage */
2188
+ aovChange: number;
2189
+ /** Total customers */
2190
+ totalCustomers: number;
2191
+ /** Customers change percentage */
2192
+ customersChange: number;
2193
+ }
2194
+ /**
2195
+ * Revenue by day
2196
+ */
2197
+ interface RevenueByDay {
2198
+ /** Date */
2199
+ date: string;
2200
+ /** Revenue */
2201
+ revenue: number;
2202
+ /** Orders */
2203
+ orders: number;
2204
+ }
2205
+ /**
2206
+ * Top product
2207
+ */
2208
+ interface TopProduct {
2209
+ /** Product ID */
2210
+ id: string;
2211
+ /** Name */
2212
+ name: string;
2213
+ /** Image */
2214
+ image: string | null;
2215
+ /** Sold count */
2216
+ soldCount: number;
2217
+ /** Revenue */
2218
+ revenue: number;
2219
+ /** View count */
2220
+ viewCount: number;
2221
+ }
2222
+ /**
2223
+ * Orders by status
2224
+ */
2225
+ interface OrdersByStatus {
2226
+ /** Status */
2227
+ status: string;
2228
+ /** Count */
2229
+ count: number;
2230
+ /** Percentage */
2231
+ percentage: number;
2232
+ }
2233
+ /**
2234
+ * Recent order summary
2235
+ */
2236
+ interface RecentOrderSummary {
2237
+ /** Order ID */
2238
+ id: string;
2239
+ /** Order number */
2240
+ orderNumber: string;
2241
+ /** Total amount */
2242
+ totalAmount: number;
2243
+ /** Status */
2244
+ status: string;
2245
+ /** Created at */
2246
+ createdAt: string;
2247
+ /** Buyer */
2248
+ buyer: {
2249
+ username?: string;
2250
+ };
2251
+ }
2252
+ /**
2253
+ * Get analytics response
2254
+ */
2255
+ interface GetAnalyticsResponse {
2256
+ /** Overview */
2257
+ overview: AnalyticsOverview;
2258
+ /** Revenue by day */
2259
+ revenueByDay: RevenueByDay[];
2260
+ /** Top products */
2261
+ topProducts: TopProduct[];
2262
+ /** Orders by status */
2263
+ ordersByStatus: OrdersByStatus[];
2264
+ /** Recent orders */
2265
+ recentOrders: RecentOrderSummary[];
2266
+ }
2267
+ /**
2268
+ * Product metrics
2269
+ */
2270
+ interface ProductMetrics {
2271
+ /** Product ID */
2272
+ id: string;
2273
+ /** Name */
2274
+ name: string;
2275
+ /** Images */
2276
+ images: string[];
2277
+ /** View count */
2278
+ viewCount: number;
2279
+ /** Sold count */
2280
+ soldCount: number;
2281
+ /** Revenue */
2282
+ revenue: number;
2283
+ /** Average rating */
2284
+ averageRating: number;
2285
+ /** Review count */
2286
+ reviewCount: number;
2287
+ /** Wishlist count */
2288
+ wishlistCount: number;
2289
+ /** Conversion rate */
2290
+ conversionRate: number;
2291
+ /** Stock */
2292
+ stock: number;
2293
+ /** Is active */
2294
+ isActive: boolean;
2295
+ /** Featured */
2296
+ featured: boolean;
2297
+ /** Created at */
2298
+ createdAt: string;
2299
+ }
2300
+ /**
2301
+ * Get product metrics response
2302
+ */
2303
+ interface GetProductMetricsResponse {
2304
+ /** Products */
2305
+ products: ProductMetrics[];
2306
+ /** Summary */
2307
+ summary: {
2308
+ totalProducts: number;
2309
+ totalViews: number;
2310
+ totalSales: number;
2311
+ totalRevenue: number;
2312
+ averageConversion: number;
2313
+ };
2314
+ }
2315
+ /**
2316
+ * List inventory audit response
2317
+ */
2318
+ interface ListInventoryAuditResponse {
2319
+ /** Entries */
2320
+ entries: Array<InventoryAuditEntry & {
2321
+ product: {
2322
+ id: string;
2323
+ title: string;
2324
+ images: string[];
2325
+ };
2326
+ variant?: {
2327
+ id: string;
2328
+ name: string;
2329
+ };
2330
+ }>;
2331
+ }
2332
+ /**
2333
+ * List customers response
2334
+ */
2335
+ interface ListCustomersResponse extends PaginatedResponse<CustomerSummary> {
2336
+ }
2337
+ /**
2338
+ * Tax settings response
2339
+ */
2340
+ interface TaxSettingsResponse {
2341
+ /** Settings */
2342
+ settings: TaxSettings;
2343
+ }
2344
+ /**
2345
+ * List tax rules response
2346
+ */
2347
+ interface ListTaxRulesResponse {
2348
+ /** Rules */
2349
+ rules: TaxRule[];
2350
+ }
2351
+ /**
2352
+ * Tax rule response
2353
+ */
2354
+ interface TaxRuleResponse {
2355
+ /** Rule */
2356
+ rule: TaxRule;
2357
+ }
2358
+ /**
2359
+ * List tax nexus response
2360
+ */
2361
+ interface ListTaxNexusResponse {
2362
+ /** Nexus */
2363
+ nexus: TaxNexus[];
2364
+ }
2365
+ /**
2366
+ * Tax nexus response
2367
+ */
2368
+ interface TaxNexusResponse {
2369
+ /** Nexus */
2370
+ nexus: TaxNexus;
2371
+ }
2372
+ /**
2373
+ * List tax reports response
2374
+ */
2375
+ interface ListTaxReportsResponse extends PaginatedResponse<TaxReport> {
2376
+ /** Summary (if year filter is provided) */
2377
+ summary?: {
2378
+ year: number;
2379
+ totalTaxable: string;
2380
+ totalTax: string;
2381
+ reportCount: number;
2382
+ };
2383
+ }
2384
+ /**
2385
+ * Tax report details
2386
+ */
2387
+ interface TaxReportDetails {
2388
+ /** Order ID */
2389
+ orderId: string;
2390
+ /** Order date */
2391
+ orderDate: string;
2392
+ /** Customer */
2393
+ customer: string;
2394
+ /** Subtotal */
2395
+ subtotal: string;
2396
+ /** Tax amount */
2397
+ taxAmount: string;
2398
+ /** Total */
2399
+ total: string;
2400
+ /** Tax breakdown */
2401
+ breakdown: TaxBreakdownItem[];
2402
+ }
2403
+ /**
2404
+ * Get tax report response
2405
+ */
2406
+ interface GetTaxReportResponse {
2407
+ /** Report */
2408
+ report: TaxReport;
2409
+ /** Details */
2410
+ details: TaxReportDetails[];
2411
+ }
2412
+ /**
2413
+ * Tax report response
2414
+ */
2415
+ interface TaxReportResponse {
2416
+ /** Report */
2417
+ report: TaxReport;
2418
+ }
2419
+ /**
2420
+ * Success response
2421
+ */
2422
+ interface SuccessResponse {
2423
+ /** Success flag */
2424
+ success: boolean;
2425
+ }
2426
+ /**
2427
+ * Product discounts response
2428
+ */
2429
+ interface ProductDiscountsResponse {
2430
+ /** Discounts */
2431
+ discounts: Array<{
2432
+ id: string;
2433
+ title: string;
2434
+ description: string;
2435
+ badge: string;
2436
+ discountType: string;
2437
+ discountValue: number;
2438
+ discountAmount: number;
2439
+ minPurchase: number | null;
2440
+ minQuantity: number | null;
2441
+ expiresAt: string;
2442
+ }>;
2443
+ }
2444
+ /**
2445
+ * Create order event response
2446
+ */
2447
+ interface CreateOrderEventResponse {
2448
+ /** Event */
2449
+ event: any;
2450
+ }
2451
+ /**
2452
+ * Active flash sales response
2453
+ */
2454
+ interface ActiveFlashSalesResponse {
2455
+ /** Flash sales */
2456
+ flashSales: FlashSale[];
2457
+ /** Time remaining for the featured/first sale */
2458
+ timeRemaining: {
2459
+ /** End timestamp */
2460
+ endsAt: string;
2461
+ /** Remaining seconds */
2462
+ remainingSeconds: number;
2463
+ } | null;
2464
+ /** Server time (for client-side sync) */
2465
+ serverTime: string;
2466
+ }
2467
+
2468
+ /**
2469
+ * Customer/End-User Ecommerce API Client
2470
+ *
2471
+ * This module provides methods for customer-facing ecommerce operations including
2472
+ * browsing products, placing orders, managing reviews, and more.
2473
+ */
2474
+
2475
+ /**
2476
+ * Customer API client for end-user ecommerce operations
2477
+ *
2478
+ * Provides methods for browsing products, placing orders, managing reviews,
2479
+ * and other customer-facing operations.
2480
+ *
2481
+ * @example
2482
+ * ```typescript
2483
+ * const client = new CustomerEcommerceClient({
2484
+ * baseURL: "https://api.example.com",
2485
+ * authToken: "user-auth-token"
2486
+ * });
2487
+ *
2488
+ * // Browse products
2489
+ * const products = await client.listProducts({ limit: 20, category: "electronics" });
2490
+ *
2491
+ * // Place an order
2492
+ * const order = await client.createOrder({
2493
+ * items: [{ productId: "123", quantity: 1 }],
2494
+ * paymentMethod: "USDC_ESCROW",
2495
+ * shippingAddress: { ... }
2496
+ * });
2497
+ * ```
2498
+ */
2499
+ declare class CustomerEcommerceClient extends BaseEcommerceClient {
2500
+ /**
2501
+ * List products with filtering and pagination
2502
+ *
2503
+ * @param params - Query parameters for filtering
2504
+ * @returns Paginated list of products
2505
+ *
2506
+ * @example
2507
+ * ```typescript
2508
+ * const products = await client.listProducts({
2509
+ * limit: 20,
2510
+ * offset: 0,
2511
+ * category: "electronics",
2512
+ * search: "laptop",
2513
+ * minPrice: 500,
2514
+ * maxPrice: 2000,
2515
+ * sortBy: "price_asc"
2516
+ * });
2517
+ * ```
2518
+ */
2519
+ listProducts(params?: ListProductsParams): Promise<ListProductsResponse>;
2520
+ /**
2521
+ * Get product details by ID
2522
+ *
2523
+ * @param productId - Product ID
2524
+ * @returns Product details with merchant info, variants, and reviews
2525
+ *
2526
+ * @example
2527
+ * ```typescript
2528
+ * const product = await client.getProduct("prod_123");
2529
+ * console.log(product.title, product.priceUSDC);
2530
+ * ```
2531
+ */
2532
+ getProduct(productId: string): Promise<GetProductResponse>;
2533
+ /**
2534
+ * Track product view (increment view count)
2535
+ *
2536
+ * @param productId - Product ID
2537
+ * @returns Success response
2538
+ *
2539
+ * @example
2540
+ * ```typescript
2541
+ * await client.trackProductView("prod_123");
2542
+ * ```
2543
+ */
2544
+ trackProductView(productId: string): Promise<SuccessResponse>;
2545
+ /**
2546
+ * Get active automatic discounts for a product
2547
+ *
2548
+ * @param productId - Product ID
2549
+ * @returns List of applicable discounts
2550
+ *
2551
+ * @example
2552
+ * ```typescript
2553
+ * const discounts = await client.getProductDiscounts("prod_123");
2554
+ * discounts.discounts.forEach(d => console.log(d.description));
2555
+ * ```
2556
+ */
2557
+ getProductDiscounts(productId: string): Promise<ProductDiscountsResponse>;
2558
+ /**
2559
+ * Create order from cart checkout
2560
+ *
2561
+ * Supports multi-merchant checkout - automatically splits orders by merchant.
2562
+ *
2563
+ * @param request - Order creation request
2564
+ * @returns Created order(s) with payment instructions
2565
+ *
2566
+ * @example
2567
+ * ```typescript
2568
+ * const result = await client.createOrder({
2569
+ * items: [
2570
+ * { productId: "prod_123", quantity: 2 },
2571
+ * { productId: "prod_456", quantity: 1, variantId: "var_789" }
2572
+ * ],
2573
+ * paymentMethod: "USDC_ESCROW",
2574
+ * shippingAddress: {
2575
+ * fullName: "John Doe",
2576
+ * phone: "+1234567890",
2577
+ * addressLine1: "123 Main St",
2578
+ * city: "New York",
2579
+ * stateProvince: "NY",
2580
+ * postalCode: "10001",
2581
+ * country: "US"
2582
+ * },
2583
+ * couponCode: "SAVE10"
2584
+ * });
2585
+ *
2586
+ * // For USDC escrow, deposit to the escrow address
2587
+ * if (result.escrow) {
2588
+ * console.log("Deposit", result.escrow.amountUSDC, "USDC to", result.escrow.address);
2589
+ * }
2590
+ * ```
2591
+ */
2592
+ createOrder(request: CreateOrderRequest): Promise<CreateOrderResponse>;
2593
+ /**
2594
+ * List user's orders
2595
+ *
2596
+ * @param params - Query parameters for filtering
2597
+ * @returns Paginated list of orders
2598
+ *
2599
+ * @example
2600
+ * ```typescript
2601
+ * const orders = await client.listOrders({
2602
+ * limit: 10,
2603
+ * offset: 0,
2604
+ * status: "SHIPPED"
2605
+ * });
2606
+ * ```
2607
+ */
2608
+ listOrders(params?: ListOrdersParams): Promise<ListOrdersResponse>;
2609
+ /**
2610
+ * Get order details by ID
2611
+ *
2612
+ * @param orderId - Order ID
2613
+ * @returns Order details with items, payment, and shipment info
2614
+ *
2615
+ * @example
2616
+ * ```typescript
2617
+ * const order = await client.getOrder("ord_123");
2618
+ * console.log(order.order.status, order.order.totalUSDC);
2619
+ * ```
2620
+ */
2621
+ getOrder(orderId: string): Promise<GetOrderResponse>;
2622
+ /**
2623
+ * Confirm USDC escrow deposit for order payment
2624
+ *
2625
+ * Verifies the Hyperliquid transaction and updates order status.
2626
+ *
2627
+ * @param orderId - Order ID
2628
+ * @returns Confirmation response with transaction hash
2629
+ *
2630
+ * @example
2631
+ * ```typescript
2632
+ * // After depositing USDC to escrow address
2633
+ * const result = await client.confirmEscrowDeposit("ord_123");
2634
+ * console.log("Payment confirmed:", result.depositTxHash);
2635
+ * ```
2636
+ */
2637
+ confirmEscrowDeposit(orderId: string): Promise<ConfirmEscrowDepositResponse>;
2638
+ /**
2639
+ * Get order receipt
2640
+ *
2641
+ * @param orderId - Order ID
2642
+ * @returns Order receipt for download/display
2643
+ *
2644
+ * @example
2645
+ * ```typescript
2646
+ * const receipt = await client.getOrderReceipt("ord_123");
2647
+ * console.log("Order #", receipt.receipt.orderNumber);
2648
+ * ```
2649
+ */
2650
+ getOrderReceipt(orderId: string): Promise<OrderReceiptResponse>;
2651
+ /**
2652
+ * List reviews for a product
2653
+ *
2654
+ * @param productId - Product ID
2655
+ * @param params - Query parameters
2656
+ * @returns Paginated list of reviews
2657
+ *
2658
+ * @example
2659
+ * ```typescript
2660
+ * const reviews = await client.listProductReviews("prod_123", {
2661
+ * limit: 10,
2662
+ * sortBy: "highest"
2663
+ * });
2664
+ * ```
2665
+ */
2666
+ listProductReviews(productId: string, params?: ListReviewsParams): Promise<ListReviewsResponse>;
2667
+ /**
2668
+ * Create a product review
2669
+ *
2670
+ * Requires authenticated user who has purchased the product.
2671
+ *
2672
+ * @param productId - Product ID
2673
+ * @param request - Review creation request
2674
+ * @returns Created review
2675
+ *
2676
+ * @example
2677
+ * ```typescript
2678
+ * const review = await client.createReview("prod_123", {
2679
+ * rating: 5,
2680
+ * title: "Great product!",
2681
+ * comment: "Exactly what I needed. Fast shipping too!"
2682
+ * });
2683
+ * ```
2684
+ */
2685
+ createReview(productId: string, request: CreateReviewRequest): Promise<ReviewResponse>;
2686
+ /**
2687
+ * List saved shipping addresses
2688
+ *
2689
+ * @returns List of user's saved shipping addresses
2690
+ *
2691
+ * @example
2692
+ * ```typescript
2693
+ * const addresses = await client.listShippingAddresses();
2694
+ * const defaultAddress = addresses.addresses.find(a => a.isDefault);
2695
+ * ```
2696
+ */
2697
+ listShippingAddresses(): Promise<ListShippingAddressesResponse>;
2698
+ /**
2699
+ * Create a new shipping address
2700
+ *
2701
+ * @param request - Shipping address data
2702
+ * @returns Created address
2703
+ *
2704
+ * @example
2705
+ * ```typescript
2706
+ * const address = await client.createShippingAddress({
2707
+ * fullName: "John Doe",
2708
+ * phone: "+1234567890",
2709
+ * addressLine1: "123 Main St",
2710
+ * city: "New York",
2711
+ * stateProvince: "NY",
2712
+ * postalCode: "10001",
2713
+ * country: "US",
2714
+ * isDefault: true,
2715
+ * label: "Home"
2716
+ * });
2717
+ * ```
2718
+ */
2719
+ createShippingAddress(request: ShippingAddressRequest): Promise<ShippingAddressResponse>;
2720
+ /**
2721
+ * Update a shipping address
2722
+ *
2723
+ * @param addressId - Address ID
2724
+ * @param request - Updated address data
2725
+ * @returns Updated address
2726
+ *
2727
+ * @example
2728
+ * ```typescript
2729
+ * const address = await client.updateShippingAddress("addr_123", {
2730
+ * phone: "+0987654321"
2731
+ * });
2732
+ * ```
2733
+ */
2734
+ updateShippingAddress(addressId: string, request: Partial<ShippingAddressRequest>): Promise<ShippingAddressResponse>;
2735
+ /**
2736
+ * Delete a shipping address
2737
+ *
2738
+ * @param addressId - Address ID
2739
+ * @returns Success response
2740
+ *
2741
+ * @example
2742
+ * ```typescript
2743
+ * await client.deleteShippingAddress("addr_123");
2744
+ * ```
2745
+ */
2746
+ deleteShippingAddress(addressId: string): Promise<SuccessResponse>;
2747
+ /**
2748
+ * Calculate automatic discounts for cart items
2749
+ *
2750
+ * @param request - Cart items
2751
+ * @returns Calculated discounts and totals
2752
+ *
2753
+ * @example
2754
+ * ```typescript
2755
+ * const result = await client.calculateCartDiscounts({
2756
+ * items: [
2757
+ * { productId: "prod_123", quantity: 2 },
2758
+ * { productId: "prod_456", quantity: 1 }
2759
+ * ]
2760
+ * });
2761
+ * console.log("Subtotal:", result.subtotal);
2762
+ * console.log("Discount:", result.discountAmount);
2763
+ * console.log("Total:", result.total);
2764
+ * ```
2765
+ */
2766
+ calculateCartDiscounts(request: CalculateCartDiscountsRequest): Promise<CalculateCartDiscountsResponse>;
2767
+ /**
2768
+ * Validate a discount code for cart items
2769
+ *
2770
+ * @param request - Discount code and cart items
2771
+ * @returns Validation result with discount details
2772
+ *
2773
+ * @example
2774
+ * ```typescript
2775
+ * const result = await client.validateDiscountCode({
2776
+ * code: "SAVE10",
2777
+ * items: [
2778
+ * { productId: "prod_123", quantity: 2 }
2779
+ * ]
2780
+ * });
2781
+ *
2782
+ * if (result.valid) {
2783
+ * console.log("Discount:", result.discount?.discountAmount);
2784
+ * } else {
2785
+ * console.log("Error:", result.error);
2786
+ * }
2787
+ * ```
2788
+ */
2789
+ validateDiscountCode(request: ValidateDiscountRequest): Promise<ValidateDiscountResponse>;
2790
+ /**
2791
+ * Calculate tax for cart items based on shipping address
2792
+ *
2793
+ * @param request - Cart items and shipping address
2794
+ * @returns Tax calculation with breakdown
2795
+ *
2796
+ * @example
2797
+ * ```typescript
2798
+ * const result = await client.calculateTax({
2799
+ * items: [
2800
+ * { productId: "prod_123", quantity: 2 }
2801
+ * ],
2802
+ * shippingAddress: {
2803
+ * country: "US",
2804
+ * region: "NY",
2805
+ * postalCode: "10001"
2806
+ * }
2807
+ * });
2808
+ * console.log("Tax:", result.taxAmount);
2809
+ * console.log("Total:", result.total);
2810
+ * ```
2811
+ */
2812
+ calculateTax(request: CalculateTaxRequest): Promise<CalculateTaxResponse>;
2813
+ /**
2814
+ * Get active promotional banners
2815
+ *
2816
+ * @param params - Query parameters
2817
+ * @returns List of active banners
2818
+ *
2819
+ * @example
2820
+ * ```typescript
2821
+ * const banners = await client.getActiveBanners({
2822
+ * type: "HERO",
2823
+ * merchantId: "merchant_123"
2824
+ * });
2825
+ * ```
2826
+ */
2827
+ getActiveBanners(params?: ListActiveBannersParams): Promise<ListBannersResponse>;
2828
+ /**
2829
+ * Track banner impression or click
2830
+ *
2831
+ * @param bannerId - Banner ID
2832
+ * @param request - Track action (impression or click)
2833
+ * @returns Success response
2834
+ *
2835
+ * @example
2836
+ * ```typescript
2837
+ * // Track impression
2838
+ * await client.trackBanner("banner_123", { action: "impression" });
2839
+ *
2840
+ * // Track click
2841
+ * await client.trackBanner("banner_123", { action: "click" });
2842
+ * ```
2843
+ */
2844
+ trackBanner(bannerId: string, request: TrackBannerRequest): Promise<SuccessResponse>;
2845
+ /**
2846
+ * List messages for customer
2847
+ *
2848
+ * Returns all conversations grouped by order, where each order represents
2849
+ * a conversation with a merchant.
2850
+ *
2851
+ * @returns List of conversations with messages and stats
2852
+ *
2853
+ * @example
2854
+ * ```typescript
2855
+ * const result = await client.listMessages();
2856
+ * console.log("Unread:", result.stats.unread);
2857
+ * result.conversations.forEach(conv => {
2858
+ * console.log(`Order ${conv.orderNumber}: ${conv.unreadCount} unread`);
2859
+ * });
2860
+ * ```
2861
+ */
2862
+ listMessages(): Promise<CustomerMessagesResponse>;
2863
+ /**
2864
+ * Get message stats (unread count)
2865
+ *
2866
+ * Lightweight endpoint for notification badges.
2867
+ *
2868
+ * @returns Unread message count
2869
+ *
2870
+ * @example
2871
+ * ```typescript
2872
+ * const stats = await client.getMessageStats();
2873
+ * console.log("Unread messages:", stats.unread);
2874
+ * ```
2875
+ */
2876
+ getMessageStats(): Promise<MessageStatsResponse>;
2877
+ /**
2878
+ * Send a message to a merchant about an order
2879
+ *
2880
+ * @param request - Message data including orderId, recipientId (merchant user ID), and message
2881
+ * @returns Sent message
2882
+ *
2883
+ * @example
2884
+ * ```typescript
2885
+ * await client.sendMessage({
2886
+ * orderId: "ord_123",
2887
+ * recipientId: "user_merchant_456",
2888
+ * message: "When will my order ship?"
2889
+ * });
2890
+ * ```
2891
+ */
2892
+ sendMessage(request: SendMessageRequest): Promise<MessageResponse>;
2893
+ /**
2894
+ * Mark a message as read
2895
+ *
2896
+ * @param messageId - Message ID
2897
+ * @returns Updated message
2898
+ *
2899
+ * @example
2900
+ * ```typescript
2901
+ * await client.markMessageAsRead("msg_123");
2902
+ * ```
2903
+ */
2904
+ markMessageAsRead(messageId: string): Promise<MessageResponse>;
2905
+ /**
2906
+ * Get active flash sales
2907
+ *
2908
+ * Returns currently running flash sales with their discounted products.
2909
+ * Includes countdown timer information for UI display.
2910
+ *
2911
+ * @param params - Query parameters
2912
+ * @returns List of active flash sales with time remaining
2913
+ *
2914
+ * @example
2915
+ * ```typescript
2916
+ * const result = await client.getActiveFlashSales({ limit: 5 });
2917
+ *
2918
+ * result.flashSales.forEach(sale => {
2919
+ * console.log(`${sale.name} - ends at ${sale.endsAt}`);
2920
+ * sale.items.forEach(item => {
2921
+ * console.log(` ${item.product.title}: $${item.salePrice} (${item.discountPercent}% off)`);
2922
+ * });
2923
+ * });
2924
+ *
2925
+ * // Use timeRemaining for countdown UI
2926
+ * if (result.timeRemaining) {
2927
+ * console.log(`Featured sale ends in ${result.timeRemaining.remainingSeconds} seconds`);
2928
+ * }
2929
+ * ```
2930
+ */
2931
+ getActiveFlashSales(params?: ListActiveFlashSalesParams): Promise<ActiveFlashSalesResponse>;
2932
+ }
2933
+
2934
+ /**
2935
+ * Merchant Ecommerce API Client
2936
+ *
2937
+ * This module provides methods for merchant operations including product management,
2938
+ * order fulfillment, customer management, analytics, and more.
2939
+ */
2940
+
2941
+ /**
2942
+ * Merchant API client for merchant operations
2943
+ *
2944
+ * Provides comprehensive methods for managing products, orders, customers,
2945
+ * shipping, returns, reviews, analytics, and more.
2946
+ *
2947
+ * @example
2948
+ * ```typescript
2949
+ * const client = new MerchantEcommerceClient({
2950
+ * baseURL: "https://api.example.com",
2951
+ * authToken: "merchant-auth-token"
2952
+ * });
2953
+ *
2954
+ * // Create a product
2955
+ * const product = await client.createProduct({
2956
+ * title: "New Product",
2957
+ * images: ["https://..."],
2958
+ * priceUSDC: 99.99,
2959
+ * inventory: 100
2960
+ * });
2961
+ *
2962
+ * // Get analytics
2963
+ * const analytics = await client.getAnalytics({ range: "30days" });
2964
+ * ```
2965
+ */
2966
+ declare class MerchantEcommerceClient extends BaseEcommerceClient {
2967
+ /**
2968
+ * Get merchant profile
2969
+ *
2970
+ * @returns Merchant profile
2971
+ *
2972
+ * @example
2973
+ * ```typescript
2974
+ * const profile = await client.getMerchantProfile();
2975
+ * console.log(profile.merchant.name);
2976
+ * ```
2977
+ */
2978
+ getMerchantProfile(): Promise<MerchantProfileResponse>;
2979
+ /**
2980
+ * Get merchant profile (alias for getMerchantProfile)
2981
+ *
2982
+ * @returns Merchant profile
2983
+ *
2984
+ * @example
2985
+ * ```typescript
2986
+ * const profile = await client.getProfile();
2987
+ * console.log(profile.merchant.name);
2988
+ * ```
2989
+ */
2990
+ getProfile(): Promise<MerchantProfileResponse>;
2991
+ /**
2992
+ * Create or update merchant profile
2993
+ *
2994
+ * @param request - Profile data
2995
+ * @returns Updated merchant profile
2996
+ *
2997
+ * @example
2998
+ * ```typescript
2999
+ * const profile = await client.upsertMerchantProfile({
3000
+ * name: "My Store",
3001
+ * description: "We sell great products",
3002
+ * payoutAddress: "0x1234..."
3003
+ * });
3004
+ * ```
3005
+ */
3006
+ upsertMerchantProfile(request: MerchantProfileRequest): Promise<MerchantProfileResponse>;
3007
+ /**
3008
+ * List merchant's products
3009
+ *
3010
+ * @param params - Query parameters
3011
+ * @returns Paginated list of products
3012
+ *
3013
+ * @example
3014
+ * ```typescript
3015
+ * const products = await client.listMerchantProducts({ limit: 20, offset: 0 });
3016
+ * ```
3017
+ */
3018
+ listMerchantProducts(params?: PaginationParams): Promise<ListProductsResponse>;
3019
+ /**
3020
+ * Get a single product by ID
3021
+ *
3022
+ * @param productId - Product ID
3023
+ * @returns Product details
3024
+ *
3025
+ * @example
3026
+ * ```typescript
3027
+ * const product = await client.getProduct("prod_123");
3028
+ * console.log(product.product?.title, product.product?.priceUSDC);
3029
+ * ```
3030
+ */
3031
+ getProduct(productId: string): Promise<GetProductResponse>;
3032
+ /**
3033
+ * Create a new product
3034
+ *
3035
+ * @param request - Product data
3036
+ * @returns Created product
3037
+ *
3038
+ * @example
3039
+ * ```typescript
3040
+ * const product = await client.createProduct({
3041
+ * title: "Awesome Product",
3042
+ * images: ["https://..."],
3043
+ * priceUSDC: 49.99,
3044
+ * inventory: 50,
3045
+ * category: "electronics",
3046
+ * moq: 1
3047
+ * });
3048
+ * ```
3049
+ */
3050
+ createProduct(request: CreateProductRequest): Promise<ProductResponse>;
3051
+ /**
3052
+ * Update a product
3053
+ *
3054
+ * @param productId - Product ID
3055
+ * @param request - Updated product data
3056
+ * @returns Updated product
3057
+ *
3058
+ * @example
3059
+ * ```typescript
3060
+ * const product = await client.updateProduct("prod_123", {
3061
+ * priceUSDC: 39.99,
3062
+ * inventory: 75
3063
+ * });
3064
+ * ```
3065
+ */
3066
+ updateProduct(productId: string, request: UpdateProductRequest): Promise<ProductResponse>;
3067
+ /**
3068
+ * Delete a product
3069
+ *
3070
+ * @param productId - Product ID
3071
+ * @returns Success response
3072
+ *
3073
+ * @example
3074
+ * ```typescript
3075
+ * await client.deleteProduct("prod_123");
3076
+ * ```
3077
+ */
3078
+ deleteProduct(productId: string): Promise<SuccessResponse>;
3079
+ /**
3080
+ * Toggle product featured status
3081
+ *
3082
+ * @param productId - Product ID
3083
+ * @param featured - Featured status
3084
+ * @returns Updated product
3085
+ *
3086
+ * @example
3087
+ * ```typescript
3088
+ * await client.setProductFeatured("prod_123", true);
3089
+ * ```
3090
+ */
3091
+ setProductFeatured(productId: string, featured: boolean): Promise<ProductResponse>;
3092
+ /**
3093
+ * List product variants
3094
+ *
3095
+ * @param productId - Product ID
3096
+ * @returns List of variants
3097
+ *
3098
+ * @example
3099
+ * ```typescript
3100
+ * const variants = await client.listProductVariants("prod_123");
3101
+ * ```
3102
+ */
3103
+ listProductVariants(productId: string): Promise<ListProductVariantsResponse>;
3104
+ /**
3105
+ * Create a product variant
3106
+ *
3107
+ * @param productId - Product ID
3108
+ * @param request - Variant data
3109
+ * @returns Created variant
3110
+ *
3111
+ * @example
3112
+ * ```typescript
3113
+ * const variant = await client.createProductVariant("prod_123", {
3114
+ * name: "Large / Red",
3115
+ * attributes: { size: "L", color: "Red" },
3116
+ * priceUSDC: 54.99,
3117
+ * inventory: 20
3118
+ * });
3119
+ * ```
3120
+ */
3121
+ createProductVariant(productId: string, request: CreateProductVariantRequest): Promise<ProductVariantResponse>;
3122
+ /**
3123
+ * Get a product variant
3124
+ *
3125
+ * @param productId - Product ID
3126
+ * @param variantId - Variant ID
3127
+ * @returns Variant details
3128
+ *
3129
+ * @example
3130
+ * ```typescript
3131
+ * const variant = await client.getProductVariant("prod_123", "var_456");
3132
+ * ```
3133
+ */
3134
+ getProductVariant(productId: string, variantId: string): Promise<ProductVariantResponse>;
3135
+ /**
3136
+ * Update a product variant
3137
+ *
3138
+ * @param productId - Product ID
3139
+ * @param variantId - Variant ID
3140
+ * @param request - Updated variant data
3141
+ * @returns Updated variant
3142
+ *
3143
+ * @example
3144
+ * ```typescript
3145
+ * const variant = await client.updateProductVariant("prod_123", "var_456", {
3146
+ * inventory: 30
3147
+ * });
3148
+ * ```
3149
+ */
3150
+ updateProductVariant(productId: string, variantId: string, request: UpdateProductVariantRequest): Promise<ProductVariantResponse>;
3151
+ /**
3152
+ * Delete a product variant
3153
+ *
3154
+ * @param productId - Product ID
3155
+ * @param variantId - Variant ID
3156
+ * @returns Success response
3157
+ *
3158
+ * @example
3159
+ * ```typescript
3160
+ * await client.deleteProductVariant("prod_123", "var_456");
3161
+ * ```
3162
+ */
3163
+ deleteProductVariant(productId: string, variantId: string): Promise<SuccessResponse>;
3164
+ /**
3165
+ * Get product metrics
3166
+ *
3167
+ * @returns Product performance metrics
3168
+ *
3169
+ * @example
3170
+ * ```typescript
3171
+ * const metrics = await client.getProductMetrics();
3172
+ * console.log("Total revenue:", metrics.summary.totalRevenue);
3173
+ * ```
3174
+ */
3175
+ getProductMetrics(): Promise<GetProductMetricsResponse>;
3176
+ /**
3177
+ * List merchant's orders
3178
+ *
3179
+ * @param params - Query parameters
3180
+ * @returns Paginated list of orders
3181
+ *
3182
+ * @example
3183
+ * ```typescript
3184
+ * const orders = await client.listMerchantOrders({ limit: 20, offset: 0 });
3185
+ * ```
3186
+ */
3187
+ listMerchantOrders(params?: ListOrdersParams): Promise<ListOrdersResponse>;
3188
+ /**
3189
+ * Get order details
3190
+ *
3191
+ * @param orderId - Order ID
3192
+ * @returns Order details with full information
3193
+ *
3194
+ * @example
3195
+ * ```typescript
3196
+ * const order = await client.getMerchantOrder("ord_123");
3197
+ * console.log(order.order.status, order.order.items);
3198
+ * ```
3199
+ */
3200
+ getMerchantOrder(orderId: string): Promise<GetOrderResponse>;
3201
+ /**
3202
+ * Update order status
3203
+ *
3204
+ * @param orderId - Order ID
3205
+ * @param request - Status update request
3206
+ * @returns Updated order
3207
+ *
3208
+ * @example
3209
+ * ```typescript
3210
+ * // Accept order
3211
+ * await client.updateOrderStatus("ord_123", {
3212
+ * status: "MERCHANT_ACCEPTED"
3213
+ * });
3214
+ *
3215
+ * // Mark as shipped
3216
+ * await client.updateOrderStatus("ord_123", {
3217
+ * status: "SHIPPED",
3218
+ * tracking: {
3219
+ * trackingNumber: "1Z999AA10123456784",
3220
+ * carrier: "UPS"
3221
+ * }
3222
+ * });
3223
+ * ```
3224
+ */
3225
+ updateOrderStatus(orderId: string, request: UpdateOrderStatusRequest): Promise<UpdateOrderResponse>;
3226
+ /**
3227
+ * Create a custom order event
3228
+ *
3229
+ * @param orderId - Order ID
3230
+ * @param request - Event data
3231
+ * @returns Created event
3232
+ *
3233
+ * @example
3234
+ * ```typescript
3235
+ * await client.createOrderEvent("ord_123", {
3236
+ * eventType: "CUSTOM",
3237
+ * title: "Package delayed",
3238
+ * description: "Shipment delayed due to weather"
3239
+ * });
3240
+ * ```
3241
+ */
3242
+ createOrderEvent(orderId: string, request: CreateOrderEventRequest): Promise<CreateOrderEventResponse>;
3243
+ /**
3244
+ * List customers with order history and stats
3245
+ *
3246
+ * @param params - Query parameters
3247
+ * @returns Paginated list of customers
3248
+ *
3249
+ * @example
3250
+ * ```typescript
3251
+ * const customers = await client.listCustomers({ limit: 50, offset: 0 });
3252
+ * customers.items.forEach(c => {
3253
+ * console.log(c.username, "Total spent:", c.totalSpent);
3254
+ * });
3255
+ * ```
3256
+ */
3257
+ listCustomers(params?: ListCustomersParams): Promise<ListCustomersResponse>;
3258
+ /**
3259
+ * List merchant's coupons
3260
+ *
3261
+ * @returns List of coupons with stats
3262
+ *
3263
+ * @example
3264
+ * ```typescript
3265
+ * const result = await client.listCoupons();
3266
+ * console.log("Total coupons:", result.stats.total);
3267
+ * console.log("Active:", result.stats.active);
3268
+ * ```
3269
+ */
3270
+ listCoupons(): Promise<ListCouponsResponse>;
3271
+ /**
3272
+ * Create a coupon
3273
+ *
3274
+ * @param request - Coupon data
3275
+ * @returns Created coupon
3276
+ *
3277
+ * @example
3278
+ * ```typescript
3279
+ * const coupon = await client.createCoupon({
3280
+ * code: "SAVE20",
3281
+ * discountType: "PERCENTAGE",
3282
+ * discountValue: 20,
3283
+ * startsAt: "2025-01-01T00:00:00Z",
3284
+ * expiresAt: "2025-12-31T23:59:59Z",
3285
+ * maxUses: 100
3286
+ * });
3287
+ * ```
3288
+ */
3289
+ createCoupon(request: CreateCouponRequest): Promise<CouponResponse>;
3290
+ /**
3291
+ * Get coupon details with usage history
3292
+ *
3293
+ * @param couponId - Coupon ID
3294
+ * @returns Coupon with usages
3295
+ *
3296
+ * @example
3297
+ * ```typescript
3298
+ * const coupon = await client.getCoupon("coupon_123");
3299
+ * console.log("Used", coupon.coupon.usedCount, "times");
3300
+ * ```
3301
+ */
3302
+ getCoupon(couponId: string): Promise<GetCouponResponse>;
3303
+ /**
3304
+ * Update a coupon
3305
+ *
3306
+ * @param couponId - Coupon ID
3307
+ * @param request - Updated coupon data
3308
+ * @returns Updated coupon
3309
+ *
3310
+ * @example
3311
+ * ```typescript
3312
+ * await client.updateCoupon("coupon_123", {
3313
+ * isActive: false
3314
+ * });
3315
+ * ```
3316
+ */
3317
+ updateCoupon(couponId: string, request: UpdateCouponRequest): Promise<CouponResponse>;
3318
+ /**
3319
+ * Delete a coupon
3320
+ *
3321
+ * @param couponId - Coupon ID
3322
+ * @returns Success response
3323
+ *
3324
+ * @example
3325
+ * ```typescript
3326
+ * await client.deleteCoupon("coupon_123");
3327
+ * ```
3328
+ */
3329
+ deleteCoupon(couponId: string): Promise<SuccessResponse>;
3330
+ /**
3331
+ * List shipping methods
3332
+ *
3333
+ * @returns List of shipping methods
3334
+ *
3335
+ * @example
3336
+ * ```typescript
3337
+ * const methods = await client.listShippingMethods();
3338
+ * ```
3339
+ */
3340
+ listShippingMethods(): Promise<ListShippingMethodsResponse>;
3341
+ /**
3342
+ * Create a shipping method
3343
+ *
3344
+ * @param request - Shipping method data
3345
+ * @returns Created method
3346
+ *
3347
+ * @example
3348
+ * ```typescript
3349
+ * const method = await client.createShippingMethod({
3350
+ * name: "Standard Shipping",
3351
+ * carrier: "USPS",
3352
+ * estimatedDays: "3-5 business days",
3353
+ * flatRate: 5.99
3354
+ * });
3355
+ * ```
3356
+ */
3357
+ createShippingMethod(request: CreateShippingMethodRequest): Promise<ShippingMethodResponse>;
3358
+ /**
3359
+ * Update a shipping method
3360
+ *
3361
+ * @param methodId - Method ID
3362
+ * @param request - Updated method data
3363
+ * @returns Updated method
3364
+ *
3365
+ * @example
3366
+ * ```typescript
3367
+ * await client.updateShippingMethod("method_123", {
3368
+ * flatRate: 6.99
3369
+ * });
3370
+ * ```
3371
+ */
3372
+ updateShippingMethod(methodId: string, request: UpdateShippingMethodRequest): Promise<ShippingMethodResponse>;
3373
+ /**
3374
+ * Delete a shipping method
3375
+ *
3376
+ * @param methodId - Method ID
3377
+ * @returns Success response
3378
+ *
3379
+ * @example
3380
+ * ```typescript
3381
+ * await client.deleteShippingMethod("method_123");
3382
+ * ```
3383
+ */
3384
+ deleteShippingMethod(methodId: string): Promise<SuccessResponse>;
3385
+ /**
3386
+ * List shipments
3387
+ *
3388
+ * @returns List of shipments for merchant's orders
3389
+ *
3390
+ * @example
3391
+ * ```typescript
3392
+ * const shipments = await client.listShipments();
3393
+ * ```
3394
+ */
3395
+ listShipments(): Promise<ListShipmentsResponse>;
3396
+ /**
3397
+ * Update shipment status and tracking
3398
+ *
3399
+ * @param shipmentId - Shipment ID
3400
+ * @param request - Updated shipment data
3401
+ * @returns Updated shipment
3402
+ *
3403
+ * @example
3404
+ * ```typescript
3405
+ * await client.updateShipment("ship_123", {
3406
+ * status: "SHIPPED",
3407
+ * trackingNumber: "1Z999AA10123456784",
3408
+ * carrier: "UPS"
3409
+ * });
3410
+ * ```
3411
+ */
3412
+ updateShipment(shipmentId: string, request: UpdateShipmentRequest): Promise<ShipmentResponse>;
3413
+ /**
3414
+ * List returns
3415
+ *
3416
+ * @returns List of returns for merchant's orders
3417
+ *
3418
+ * @example
3419
+ * ```typescript
3420
+ * const returns = await client.listReturns();
3421
+ * ```
3422
+ */
3423
+ listReturns(): Promise<ListReturnsResponse>;
3424
+ /**
3425
+ * Approve a return request
3426
+ *
3427
+ * @param returnId - Return ID
3428
+ * @returns Updated return
3429
+ *
3430
+ * @example
3431
+ * ```typescript
3432
+ * await client.approveReturn("return_123");
3433
+ * ```
3434
+ */
3435
+ approveReturn(returnId: string): Promise<ReturnResponse>;
3436
+ /**
3437
+ * Reject a return request
3438
+ *
3439
+ * @param returnId - Return ID
3440
+ * @returns Updated return
3441
+ *
3442
+ * @example
3443
+ * ```typescript
3444
+ * await client.rejectReturn("return_123");
3445
+ * ```
3446
+ */
3447
+ rejectReturn(returnId: string): Promise<ReturnResponse>;
3448
+ /**
3449
+ * Mark return as received
3450
+ *
3451
+ * @param returnId - Return ID
3452
+ * @returns Updated return
3453
+ *
3454
+ * @example
3455
+ * ```typescript
3456
+ * await client.markReturnReceived("return_123");
3457
+ * ```
3458
+ */
3459
+ markReturnReceived(returnId: string): Promise<ReturnResponse>;
3460
+ /**
3461
+ * Process refund for return
3462
+ *
3463
+ * @param returnId - Return ID
3464
+ * @returns Updated return
3465
+ *
3466
+ * @example
3467
+ * ```typescript
3468
+ * await client.processRefund("return_123");
3469
+ * ```
3470
+ */
3471
+ processRefund(returnId: string): Promise<ReturnResponse>;
3472
+ /**
3473
+ * List reviews for merchant's products
3474
+ *
3475
+ * @returns List of reviews
3476
+ *
3477
+ * @example
3478
+ * ```typescript
3479
+ * const reviews = await client.listMerchantReviews();
3480
+ * ```
3481
+ */
3482
+ listMerchantReviews(): Promise<ListReviewsResponse>;
3483
+ /**
3484
+ * Respond to a review
3485
+ *
3486
+ * @param reviewId - Review ID
3487
+ * @param request - Response data
3488
+ * @returns Updated review
3489
+ *
3490
+ * @example
3491
+ * ```typescript
3492
+ * await client.respondToReview("review_123", {
3493
+ * merchantResponse: "Thank you for your feedback!"
3494
+ * });
3495
+ * ```
3496
+ */
3497
+ respondToReview(reviewId: string, request: RespondToReviewRequest): Promise<ReviewResponse>;
3498
+ /**
3499
+ * Flag a review as inappropriate
3500
+ *
3501
+ * @param reviewId - Review ID
3502
+ * @returns Updated review
3503
+ *
3504
+ * @example
3505
+ * ```typescript
3506
+ * await client.flagReview("review_123");
3507
+ * ```
3508
+ */
3509
+ flagReview(reviewId: string): Promise<ReviewResponse>;
3510
+ /**
3511
+ * List messages/conversations
3512
+ *
3513
+ * @returns List of conversations grouped by order
3514
+ *
3515
+ * @example
3516
+ * ```typescript
3517
+ * const messages = await client.listMessages();
3518
+ * console.log("Unread:", messages.stats.unread);
3519
+ * ```
3520
+ */
3521
+ listMessages(): Promise<ListMessagesResponse>;
3522
+ /**
3523
+ * Send a message to customer
3524
+ *
3525
+ * @param request - Message data
3526
+ * @returns Sent message
3527
+ *
3528
+ * @example
3529
+ * ```typescript
3530
+ * await client.sendMessage({
3531
+ * orderId: "ord_123",
3532
+ * recipientId: "user_456",
3533
+ * message: "Your order has been shipped!"
3534
+ * });
3535
+ * ```
3536
+ */
3537
+ sendMessage(request: SendMessageRequest): Promise<MessageResponse>;
3538
+ /**
3539
+ * Mark message as read
3540
+ *
3541
+ * @param messageId - Message ID
3542
+ * @returns Updated message
3543
+ *
3544
+ * @example
3545
+ * ```typescript
3546
+ * await client.markMessageRead("msg_123");
3547
+ * ```
3548
+ */
3549
+ markMessageRead(messageId: string): Promise<MessageResponse>;
3550
+ /**
3551
+ * List media assets
3552
+ *
3553
+ * @param params - Query parameters
3554
+ * @returns Paginated list of media assets
3555
+ *
3556
+ * @example
3557
+ * ```typescript
3558
+ * const media = await client.listMediaAssets({ limit: 50, offset: 0 });
3559
+ * ```
3560
+ */
3561
+ listMediaAssets(params?: PaginationParams): Promise<ListMediaAssetsResponse>;
3562
+ /**
3563
+ * Upload a media asset
3564
+ *
3565
+ * @param file - File to upload (max 10MB, images only)
3566
+ * @returns Uploaded asset
3567
+ *
3568
+ * @example
3569
+ * ```typescript
3570
+ * const formData = new FormData();
3571
+ * formData.append("file", imageFile);
3572
+ *
3573
+ * const asset = await client.uploadMediaAsset(formData);
3574
+ * console.log("Uploaded:", asset.asset.blobUrl);
3575
+ * ```
3576
+ */
3577
+ uploadMediaAsset(formData: FormData): Promise<MediaAssetResponse>;
3578
+ /**
3579
+ * Delete a media asset
3580
+ *
3581
+ * @param assetId - Asset ID
3582
+ * @returns Success response
3583
+ *
3584
+ * @example
3585
+ * ```typescript
3586
+ * await client.deleteMediaAsset("asset_123");
3587
+ * ```
3588
+ */
3589
+ deleteMediaAsset(assetId: string): Promise<SuccessResponse>;
3590
+ /**
3591
+ * List merchant's banners
3592
+ *
3593
+ * @returns List of banners
3594
+ *
3595
+ * @example
3596
+ * ```typescript
3597
+ * const banners = await client.listMerchantBanners();
3598
+ * ```
3599
+ */
3600
+ listMerchantBanners(): Promise<ListBannersResponse>;
3601
+ /**
3602
+ * Create a promotional banner
3603
+ *
3604
+ * @param request - Banner data
3605
+ * @returns Created banner
3606
+ *
3607
+ * @example
3608
+ * ```typescript
3609
+ * const banner = await client.createBanner({
3610
+ * title: "Summer Sale",
3611
+ * imageUrl: "https://...",
3612
+ * linkUrl: "/products?category=summer",
3613
+ * ctaText: "Shop Now",
3614
+ * priority: 10
3615
+ * });
3616
+ * ```
3617
+ */
3618
+ createBanner(request: CreateBannerRequest): Promise<BannerResponse>;
3619
+ /**
3620
+ * Get banner details
3621
+ *
3622
+ * @param bannerId - Banner ID
3623
+ * @returns Banner details
3624
+ *
3625
+ * @example
3626
+ * ```typescript
3627
+ * const banner = await client.getBanner("banner_123");
3628
+ * ```
3629
+ */
3630
+ getBanner(bannerId: string): Promise<BannerResponse>;
3631
+ /**
3632
+ * Update a banner
3633
+ *
3634
+ * @param bannerId - Banner ID
3635
+ * @param request - Updated banner data
3636
+ * @returns Updated banner
3637
+ *
3638
+ * @example
3639
+ * ```typescript
3640
+ * await client.updateBanner("banner_123", {
3641
+ * isActive: false
3642
+ * });
3643
+ * ```
3644
+ */
3645
+ updateBanner(bannerId: string, request: UpdateBannerRequest): Promise<BannerResponse>;
3646
+ /**
3647
+ * Delete a banner
3648
+ *
3649
+ * @param bannerId - Banner ID
3650
+ * @returns Success response
3651
+ *
3652
+ * @example
3653
+ * ```typescript
3654
+ * await client.deleteBanner("banner_123");
3655
+ * ```
3656
+ */
3657
+ deleteBanner(bannerId: string): Promise<SuccessResponse>;
3658
+ /**
3659
+ * Get merchant analytics
3660
+ *
3661
+ * @param params - Query parameters
3662
+ * @returns Analytics data with overview, charts, and insights
3663
+ *
3664
+ * @example
3665
+ * ```typescript
3666
+ * const analytics = await client.getAnalytics({ range: "30days" });
3667
+ * console.log("Revenue:", analytics.overview.totalRevenue);
3668
+ * console.log("Orders:", analytics.overview.totalOrders);
3669
+ * ```
3670
+ */
3671
+ getAnalytics(params?: GetAnalyticsParams): Promise<GetAnalyticsResponse>;
3672
+ /**
3673
+ * Get inventory audit log
3674
+ *
3675
+ * @returns Recent inventory audit entries (last 500)
3676
+ *
3677
+ * @example
3678
+ * ```typescript
3679
+ * const audit = await client.getInventoryAudit();
3680
+ * audit.entries.forEach(e => {
3681
+ * console.log(e.action, e.product.title, e.changeAmount);
3682
+ * });
3683
+ * ```
3684
+ */
3685
+ getInventoryAudit(): Promise<ListInventoryAuditResponse>;
3686
+ /**
3687
+ * Get tax settings
3688
+ *
3689
+ * @returns Tax settings
3690
+ *
3691
+ * @example
3692
+ * ```typescript
3693
+ * const settings = await client.getTaxSettings();
3694
+ * console.log("Tax enabled:", settings.settings.taxEnabled);
3695
+ * ```
3696
+ */
3697
+ getTaxSettings(): Promise<TaxSettingsResponse>;
3698
+ /**
3699
+ * Update tax settings
3700
+ *
3701
+ * @param request - Updated settings
3702
+ * @returns Updated tax settings
3703
+ *
3704
+ * @example
3705
+ * ```typescript
3706
+ * await client.updateTaxSettings({
3707
+ * taxEnabled: true,
3708
+ * pricesIncludeTax: false,
3709
+ * defaultTaxBehavior: "CHARGE"
3710
+ * });
3711
+ * ```
3712
+ */
3713
+ updateTaxSettings(request: UpdateTaxSettingsRequest): Promise<TaxSettingsResponse>;
3714
+ /**
3715
+ * List tax rules
3716
+ *
3717
+ * @returns List of tax rules
3718
+ *
3719
+ * @example
3720
+ * ```typescript
3721
+ * const rules = await client.listTaxRules();
3722
+ * ```
3723
+ */
3724
+ listTaxRules(): Promise<ListTaxRulesResponse>;
3725
+ /**
3726
+ * Create a tax rule
3727
+ *
3728
+ * @param request - Tax rule data
3729
+ * @returns Created tax rule
3730
+ *
3731
+ * @example
3732
+ * ```typescript
3733
+ * const rule = await client.createTaxRule({
3734
+ * country: "US",
3735
+ * region: "NY",
3736
+ * taxType: "SALES_TAX",
3737
+ * taxName: "NY Sales Tax",
3738
+ * taxRate: 8.875
3739
+ * });
3740
+ * ```
3741
+ */
3742
+ createTaxRule(request: CreateTaxRuleRequest): Promise<TaxRuleResponse>;
3743
+ /**
3744
+ * Get tax rule details
3745
+ *
3746
+ * @param ruleId - Rule ID
3747
+ * @returns Tax rule details
3748
+ *
3749
+ * @example
3750
+ * ```typescript
3751
+ * const rule = await client.getTaxRule("rule_123");
3752
+ * ```
3753
+ */
3754
+ getTaxRule(ruleId: string): Promise<TaxRuleResponse>;
3755
+ /**
3756
+ * Update a tax rule
3757
+ *
3758
+ * @param ruleId - Rule ID
3759
+ * @param request - Updated rule data
3760
+ * @returns Updated tax rule
3761
+ *
3762
+ * @example
3763
+ * ```typescript
3764
+ * await client.updateTaxRule("rule_123", {
3765
+ * taxRate: 9.0
3766
+ * });
3767
+ * ```
3768
+ */
3769
+ updateTaxRule(ruleId: string, request: UpdateTaxRuleRequest): Promise<TaxRuleResponse>;
3770
+ /**
3771
+ * Delete a tax rule
3772
+ *
3773
+ * @param ruleId - Rule ID
3774
+ * @returns Success response
3775
+ *
3776
+ * @example
3777
+ * ```typescript
3778
+ * await client.deleteTaxRule("rule_123");
3779
+ * ```
3780
+ */
3781
+ deleteTaxRule(ruleId: string): Promise<SuccessResponse>;
3782
+ /**
3783
+ * List tax nexus locations
3784
+ *
3785
+ * @returns List of nexus locations
3786
+ *
3787
+ * @example
3788
+ * ```typescript
3789
+ * const nexus = await client.listTaxNexus();
3790
+ * ```
3791
+ */
3792
+ listTaxNexus(): Promise<ListTaxNexusResponse>;
3793
+ /**
3794
+ * Add a tax nexus location
3795
+ *
3796
+ * @param request - Nexus data
3797
+ * @returns Created nexus
3798
+ *
3799
+ * @example
3800
+ * ```typescript
3801
+ * const nexus = await client.createTaxNexus({
3802
+ * country: "US",
3803
+ * region: "CA",
3804
+ * registrationId: "123456789"
3805
+ * });
3806
+ * ```
3807
+ */
3808
+ createTaxNexus(request: CreateTaxNexusRequest): Promise<TaxNexusResponse>;
3809
+ /**
3810
+ * Update a tax nexus location
3811
+ *
3812
+ * @param nexusId - Nexus ID
3813
+ * @param request - Updated nexus data
3814
+ * @returns Updated nexus
3815
+ *
3816
+ * @example
3817
+ * ```typescript
3818
+ * await client.updateTaxNexus("nexus_123", {
3819
+ * registrationId: "987654321"
3820
+ * });
3821
+ * ```
3822
+ */
3823
+ updateTaxNexus(nexusId: string, request: UpdateTaxNexusRequest): Promise<TaxNexusResponse>;
3824
+ /**
3825
+ * Delete a tax nexus location
3826
+ *
3827
+ * @param nexusId - Nexus ID
3828
+ * @returns Success response
3829
+ *
3830
+ * @example
3831
+ * ```typescript
3832
+ * await client.deleteTaxNexus("nexus_123");
3833
+ * ```
3834
+ */
3835
+ deleteTaxNexus(nexusId: string): Promise<SuccessResponse>;
3836
+ /**
3837
+ * List tax reports
3838
+ *
3839
+ * @param params - Query parameters
3840
+ * @returns Paginated list of tax reports
3841
+ *
3842
+ * @example
3843
+ * ```typescript
3844
+ * const reports = await client.listTaxReports({ limit: 20, offset: 0 });
3845
+ *
3846
+ * // Get summary for a specific year
3847
+ * const summary = await client.listTaxReports({ year: 2025 });
3848
+ * ```
3849
+ */
3850
+ listTaxReports(params?: ListTaxReportsParams): Promise<ListTaxReportsResponse>;
3851
+ /**
3852
+ * Generate a tax report
3853
+ *
3854
+ * @param request - Report generation request
3855
+ * @returns Generated report
3856
+ *
3857
+ * @example
3858
+ * ```typescript
3859
+ * const report = await client.generateTaxReport({
3860
+ * periodType: "MONTHLY",
3861
+ * year: 2025,
3862
+ * period: 1 // January
3863
+ * });
3864
+ * ```
3865
+ */
3866
+ generateTaxReport(request: GenerateTaxReportRequest): Promise<TaxReportResponse>;
3867
+ /**
3868
+ * Get tax report details
3869
+ *
3870
+ * @param reportId - Report ID
3871
+ * @returns Report with detailed records
3872
+ *
3873
+ * @example
3874
+ * ```typescript
3875
+ * const report = await client.getTaxReport("report_123");
3876
+ * console.log("Total tax:", report.report.totalTax);
3877
+ * ```
3878
+ */
3879
+ getTaxReport(reportId: string): Promise<GetTaxReportResponse>;
3880
+ /**
3881
+ * Update tax report status
3882
+ *
3883
+ * @param reportId - Report ID
3884
+ * @param request - Status update
3885
+ * @returns Updated report
3886
+ *
3887
+ * @example
3888
+ * ```typescript
3889
+ * await client.updateTaxReportStatus("report_123", {
3890
+ * status: "FINALIZED"
3891
+ * });
3892
+ * ```
3893
+ */
3894
+ updateTaxReportStatus(reportId: string, request: UpdateTaxReportStatusRequest): Promise<TaxReportResponse>;
3895
+ /**
3896
+ * Export tax report as CSV
3897
+ *
3898
+ * @param reportId - Report ID
3899
+ * @returns CSV file data
3900
+ *
3901
+ * @example
3902
+ * ```typescript
3903
+ * const csv = await client.exportTaxReport("report_123");
3904
+ * // Save or download the CSV
3905
+ * ```
3906
+ */
3907
+ exportTaxReport(reportId: string): Promise<string>;
3908
+ }
3909
+
3910
+ /**
3911
+ * Ecommerce API Error Utilities
3912
+ *
3913
+ * This module contains error handling utilities for the ecommerce API.
3914
+ */
3915
+ /**
3916
+ * Ecommerce API error class
3917
+ */
3918
+ declare class EcommerceApiError extends Error {
3919
+ /** HTTP status code */
3920
+ statusCode?: number;
3921
+ /** Response data */
3922
+ data?: any;
3923
+ /** Is network error */
3924
+ isNetworkError: boolean;
3925
+ /** Is timeout error */
3926
+ isTimeoutError: boolean;
3927
+ /** Is authentication error */
3928
+ isAuthError: boolean;
3929
+ constructor(message: string, statusCode?: number, data?: any, isNetworkError?: boolean, isTimeoutError?: boolean);
3930
+ }
3931
+ /**
3932
+ * Parse error from axios error or API response
3933
+ */
3934
+ declare function parseError(error: any): EcommerceApiError;
3935
+ /**
3936
+ * Check if error is retryable
3937
+ */
3938
+ declare function isRetryableError(error: EcommerceApiError): boolean;
3939
+
3940
+ /**
3941
+ * Ecommerce API Helper Utilities
3942
+ *
3943
+ * This module contains helper functions for the ecommerce API.
3944
+ */
3945
+ /**
3946
+ * Build query string from params object
3947
+ */
3948
+ declare function buildQueryString(params: Record<string, any>): string;
3949
+ /**
3950
+ * Sleep for specified milliseconds
3951
+ */
3952
+ declare function sleep(ms: number): Promise<void>;
3953
+ /**
3954
+ * Calculate exponential backoff delay
3955
+ */
3956
+ declare function getBackoffDelay(attempt: number, baseDelay?: number): number;
3957
+ /**
3958
+ * Retry function with exponential backoff
3959
+ */
3960
+ declare function retryWithBackoff<T>(fn: () => Promise<T>, maxRetries?: number, baseDelay?: number, shouldRetry?: (error: any) => boolean): Promise<T>;
3961
+ /**
3962
+ * Format price for display
3963
+ */
3964
+ declare function formatPrice(price: string | number, decimals?: number): string;
3965
+ /**
3966
+ * Validate email address
3967
+ */
3968
+ declare function isValidEmail(email: string): boolean;
3969
+ /**
3970
+ * Validate Ethereum address
3971
+ */
3972
+ declare function isValidAddress(address: string): boolean;
3973
+ /**
3974
+ * Truncate address for display
3975
+ */
3976
+ declare function truncateAddress(address: string, start?: number, end?: number): string;
3977
+ /**
3978
+ * Calculate discount amount
3979
+ */
3980
+ declare function calculateDiscountAmount(price: number, discountType: "PERCENTAGE" | "FIXED_AMOUNT", discountValue: number): number;
3981
+ /**
3982
+ * Calculate final price after discount
3983
+ */
3984
+ declare function calculateFinalPrice(price: number, discountType: "PERCENTAGE" | "FIXED_AMOUNT", discountValue: number): number;
3985
+
3986
+ export { type ActiveFlashSalesResponse, 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 CreateFlashSaleRequest, type CreateOrderEventRequest, type CreateOrderEventResponse, type CreateOrderRequest, type CreateOrderResponse, type CreateProductRequest, type CreateProductVariantRequest, type CreateReviewRequest, type CreateShippingMethodRequest, type CreateTaxNexusRequest, type CreateTaxRuleRequest, CustomerEcommerceClient, type CustomerMessagesResponse, type CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, type EcommerceClientConfig, type FlashSale, type FlashSaleItem, type FlashSaleItemInput, type GenerateTaxReportRequest, type GetAnalyticsParams, type GetAnalyticsResponse, type GetCouponResponse, type GetOrderResponse, type GetProductMetricsResponse, type GetProductResponse, type GetTaxReportResponse, InventoryAuditAction, type InventoryAuditEntry, type ListActiveBannersParams, type ListActiveFlashSalesParams, 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 MessageStatsResponse, 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 UpdateFlashSaleRequest, 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 };