@basedone/core 0.1.10 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/chunk-4GAKANLT.mjs +1987 -0
  2. package/dist/chunk-4UEJOM6W.mjs +1 -3
  3. package/dist/chunk-VBC6EQ7Q.mjs +235 -0
  4. package/dist/client-CgmiTuEX.d.mts +179 -0
  5. package/dist/client-CgmiTuEX.d.ts +179 -0
  6. package/dist/ecommerce.d.mts +3732 -0
  7. package/dist/ecommerce.d.ts +3732 -0
  8. package/dist/ecommerce.js +2031 -0
  9. package/dist/ecommerce.mjs +2 -0
  10. package/dist/index.d.mts +51 -43
  11. package/dist/index.d.ts +51 -43
  12. package/dist/index.js +2691 -205
  13. package/dist/index.mjs +68 -90
  14. package/dist/{meta-FVJIMALT.mjs → meta-JB5ITE27.mjs} +4 -10
  15. package/dist/meta-UOGUG3OW.mjs +3 -7
  16. package/dist/{perpDexs-GGL32HT4.mjs → perpDexs-3LRJ5ZHM.mjs} +37 -8
  17. package/dist/{perpDexs-G7V2QIM6.mjs → perpDexs-4ISLD7NX.mjs} +177 -32
  18. package/dist/react.d.mts +39 -0
  19. package/dist/react.d.ts +39 -0
  20. package/dist/react.js +268 -0
  21. package/dist/react.mjs +31 -0
  22. package/dist/{spotMeta-OD7S6HGW.mjs → spotMeta-GHXX7C5M.mjs} +24 -9
  23. package/dist/{spotMeta-PCN4Z4R3.mjs → spotMeta-IBBUP2SG.mjs} +54 -6
  24. package/dist/staticMeta-GM7T3OYL.mjs +3 -6
  25. package/dist/staticMeta-QV2KMX57.mjs +3 -6
  26. package/ecommerce.ts +15 -0
  27. package/index.ts +6 -0
  28. package/lib/ecommerce/QUICK_REFERENCE.md +211 -0
  29. package/lib/ecommerce/README.md +385 -0
  30. package/lib/ecommerce/USAGE_EXAMPLES.md +704 -0
  31. package/lib/ecommerce/client/base.ts +272 -0
  32. package/lib/ecommerce/client/customer.ts +522 -0
  33. package/lib/ecommerce/client/merchant.ts +1341 -0
  34. package/lib/ecommerce/index.ts +51 -0
  35. package/lib/ecommerce/types/entities.ts +722 -0
  36. package/lib/ecommerce/types/enums.ts +270 -0
  37. package/lib/ecommerce/types/index.ts +18 -0
  38. package/lib/ecommerce/types/requests.ts +525 -0
  39. package/lib/ecommerce/types/responses.ts +805 -0
  40. package/lib/ecommerce/utils/errors.ts +113 -0
  41. package/lib/ecommerce/utils/helpers.ts +131 -0
  42. package/lib/hip3/market-info.ts +1 -1
  43. package/lib/instrument/client.ts +351 -0
  44. package/lib/meta/data/mainnet/perpDexs.json +34 -4
  45. package/lib/meta/data/mainnet/spotMeta.json +21 -3
  46. package/lib/meta/data/testnet/meta.json +1 -3
  47. package/lib/meta/data/testnet/perpDexs.json +174 -28
  48. package/lib/meta/data/testnet/spotMeta.json +51 -0
  49. package/lib/react/InstrumentProvider.tsx +69 -0
  50. package/lib/utils/flooredDateTime.ts +55 -0
  51. package/lib/utils/time.ts +51 -0
  52. package/package.json +37 -11
  53. package/react.ts +1 -0
@@ -0,0 +1,2031 @@
1
+ 'use strict';
2
+
3
+ var axios = require('axios');
4
+
5
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
+
7
+ var axios__default = /*#__PURE__*/_interopDefault(axios);
8
+
9
+ // lib/ecommerce/client/base.ts
10
+
11
+ // lib/ecommerce/utils/errors.ts
12
+ var EcommerceApiError = class _EcommerceApiError extends Error {
13
+ constructor(message, statusCode, data, isNetworkError = false, isTimeoutError = false) {
14
+ super(message);
15
+ this.name = "EcommerceApiError";
16
+ this.statusCode = statusCode;
17
+ this.data = data;
18
+ this.isNetworkError = isNetworkError;
19
+ this.isTimeoutError = isTimeoutError;
20
+ this.isAuthError = statusCode === 401 || statusCode === 403;
21
+ if (Error.captureStackTrace) {
22
+ Error.captureStackTrace(this, _EcommerceApiError);
23
+ }
24
+ }
25
+ };
26
+ function parseError(error) {
27
+ if (error.code === "ECONNABORTED" || error.code === "ETIMEDOUT") {
28
+ return new EcommerceApiError(
29
+ "Request timeout",
30
+ void 0,
31
+ void 0,
32
+ false,
33
+ true
34
+ );
35
+ }
36
+ if (error.code === "ERR_NETWORK" || !error.response) {
37
+ return new EcommerceApiError(
38
+ error.message || "Network error",
39
+ void 0,
40
+ void 0,
41
+ true,
42
+ false
43
+ );
44
+ }
45
+ const response = error.response;
46
+ const statusCode = response?.status;
47
+ const data = response?.data;
48
+ const message = data?.error || data?.message || error.message || `API error (${statusCode})`;
49
+ return new EcommerceApiError(message, statusCode, data);
50
+ }
51
+ function isRetryableError(error) {
52
+ if (error.isNetworkError) {
53
+ return true;
54
+ }
55
+ if (error.isTimeoutError) {
56
+ return true;
57
+ }
58
+ if (error.statusCode && error.statusCode >= 500) {
59
+ return true;
60
+ }
61
+ if (error.statusCode === 429) {
62
+ return true;
63
+ }
64
+ return false;
65
+ }
66
+
67
+ // lib/ecommerce/utils/helpers.ts
68
+ function buildQueryString(params) {
69
+ const searchParams = new URLSearchParams();
70
+ Object.entries(params).forEach(([key, value]) => {
71
+ if (value !== void 0 && value !== null) {
72
+ if (Array.isArray(value)) {
73
+ searchParams.append(key, value.join(","));
74
+ } else {
75
+ searchParams.append(key, String(value));
76
+ }
77
+ }
78
+ });
79
+ const queryString = searchParams.toString();
80
+ return queryString ? `?${queryString}` : "";
81
+ }
82
+ function sleep(ms) {
83
+ return new Promise((resolve) => setTimeout(resolve, ms));
84
+ }
85
+ function getBackoffDelay(attempt, baseDelay = 1e3) {
86
+ return Math.min(baseDelay * Math.pow(2, attempt), 3e4);
87
+ }
88
+ async function retryWithBackoff(fn, maxRetries = 3, baseDelay = 1e3, shouldRetry) {
89
+ let lastError;
90
+ for (let attempt = 0; attempt <= maxRetries; attempt++) {
91
+ try {
92
+ return await fn();
93
+ } catch (error) {
94
+ lastError = error;
95
+ if (attempt < maxRetries && (!shouldRetry || shouldRetry(error))) {
96
+ const delay = getBackoffDelay(attempt, baseDelay);
97
+ await sleep(delay);
98
+ continue;
99
+ }
100
+ throw error;
101
+ }
102
+ }
103
+ throw lastError;
104
+ }
105
+ function formatPrice(price, decimals = 2) {
106
+ const num = typeof price === "string" ? parseFloat(price) : price;
107
+ return num.toFixed(decimals);
108
+ }
109
+ function isValidEmail(email) {
110
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
111
+ return emailRegex.test(email);
112
+ }
113
+ function isValidAddress(address) {
114
+ return /^0x[a-fA-F0-9]{40}$/.test(address);
115
+ }
116
+ function truncateAddress(address, start = 6, end = 4) {
117
+ if (!address || address.length < start + end) {
118
+ return address;
119
+ }
120
+ return `${address.slice(0, start)}...${address.slice(-end)}`;
121
+ }
122
+ function calculateDiscountAmount(price, discountType, discountValue) {
123
+ if (discountType === "PERCENTAGE") {
124
+ return price * discountValue / 100;
125
+ }
126
+ return Math.min(discountValue, price);
127
+ }
128
+ function calculateFinalPrice(price, discountType, discountValue) {
129
+ const discountAmount = calculateDiscountAmount(price, discountType, discountValue);
130
+ return Math.max(0, price - discountAmount);
131
+ }
132
+
133
+ // lib/ecommerce/client/base.ts
134
+ var BaseEcommerceClient = class {
135
+ constructor(config) {
136
+ this.config = {
137
+ baseURL: config.baseURL,
138
+ authToken: config.authToken,
139
+ timeout: config.timeout || 3e4,
140
+ maxRetries: config.maxRetries || 3,
141
+ retryBaseDelay: config.retryBaseDelay || 1e3,
142
+ headers: config.headers,
143
+ enableRetry: config.enableRetry !== false
144
+ };
145
+ this.axiosInstance = axios__default.default.create({
146
+ baseURL: this.config.baseURL,
147
+ timeout: this.config.timeout,
148
+ headers: {
149
+ "Content-Type": "application/json",
150
+ ...this.config.headers
151
+ }
152
+ });
153
+ this.axiosInstance.interceptors.request.use(
154
+ (config2) => {
155
+ if (this.config.authToken) {
156
+ config2.headers.Authorization = `Bearer ${this.config.authToken}`;
157
+ }
158
+ return config2;
159
+ },
160
+ (error) => Promise.reject(error)
161
+ );
162
+ this.axiosInstance.interceptors.response.use(
163
+ (response) => response,
164
+ (error) => Promise.reject(parseError(error))
165
+ );
166
+ }
167
+ /**
168
+ * Update authentication token
169
+ *
170
+ * @param token - New authentication token
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * client.setAuthToken("new-auth-token");
175
+ * ```
176
+ */
177
+ setAuthToken(token) {
178
+ this.config.authToken = token;
179
+ }
180
+ /**
181
+ * Clear authentication token
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * client.clearAuthToken();
186
+ * ```
187
+ */
188
+ clearAuthToken() {
189
+ this.config.authToken = void 0;
190
+ }
191
+ /**
192
+ * Make a GET request
193
+ *
194
+ * @param url - Request URL
195
+ * @param config - Axios request config
196
+ * @returns Response data
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * const products = await client.get("/api/marketplace/products", {
201
+ * params: { limit: 20, offset: 0 }
202
+ * });
203
+ * ```
204
+ */
205
+ async get(url, config) {
206
+ return this.request({ ...config, method: "GET", url });
207
+ }
208
+ /**
209
+ * Make a POST request
210
+ *
211
+ * @param url - Request URL
212
+ * @param data - Request body data
213
+ * @param config - Axios request config
214
+ * @returns Response data
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * const order = await client.post("/api/marketplace/orders", {
219
+ * items: [{ productId: "123", quantity: 1 }],
220
+ * paymentMethod: "USDC_ESCROW"
221
+ * });
222
+ * ```
223
+ */
224
+ async post(url, data, config) {
225
+ return this.request({ ...config, method: "POST", url, data });
226
+ }
227
+ /**
228
+ * Make a PUT request
229
+ *
230
+ * @param url - Request URL
231
+ * @param data - Request body data
232
+ * @param config - Axios request config
233
+ * @returns Response data
234
+ *
235
+ * @example
236
+ * ```typescript
237
+ * const product = await client.put("/api/marketplace/products/123", {
238
+ * title: "Updated Product"
239
+ * });
240
+ * ```
241
+ */
242
+ async put(url, data, config) {
243
+ return this.request({ ...config, method: "PUT", url, data });
244
+ }
245
+ /**
246
+ * Make a PATCH request
247
+ *
248
+ * @param url - Request URL
249
+ * @param data - Request body data
250
+ * @param config - Axios request config
251
+ * @returns Response data
252
+ *
253
+ * @example
254
+ * ```typescript
255
+ * const order = await client.patch("/api/marketplace/merchant/orders/123", {
256
+ * status: "SHIPPED",
257
+ * tracking: { trackingNumber: "123456", carrier: "UPS" }
258
+ * });
259
+ * ```
260
+ */
261
+ async patch(url, data, config) {
262
+ return this.request({ ...config, method: "PATCH", url, data });
263
+ }
264
+ /**
265
+ * Make a DELETE request
266
+ *
267
+ * @param url - Request URL
268
+ * @param config - Axios request config
269
+ * @returns Response data
270
+ *
271
+ * @example
272
+ * ```typescript
273
+ * await client.delete("/api/marketplace/products/123");
274
+ * ```
275
+ */
276
+ async delete(url, config) {
277
+ return this.request({ ...config, method: "DELETE", url });
278
+ }
279
+ /**
280
+ * Make a request with retry logic
281
+ *
282
+ * @param config - Axios request config
283
+ * @returns Response data
284
+ */
285
+ async request(config) {
286
+ const makeRequest = async () => {
287
+ return this.axiosInstance.request(config);
288
+ };
289
+ if (this.config.enableRetry) {
290
+ const response = await retryWithBackoff(
291
+ makeRequest,
292
+ this.config.maxRetries,
293
+ this.config.retryBaseDelay,
294
+ (error) => isRetryableError(error)
295
+ );
296
+ return response.data;
297
+ } else {
298
+ const response = await makeRequest();
299
+ return response.data;
300
+ }
301
+ }
302
+ /**
303
+ * Get the underlying axios instance
304
+ *
305
+ * @returns Axios instance
306
+ *
307
+ * @example
308
+ * ```typescript
309
+ * const axios = client.getAxiosInstance();
310
+ * // Use axios directly for advanced use cases
311
+ * ```
312
+ */
313
+ getAxiosInstance() {
314
+ return this.axiosInstance;
315
+ }
316
+ };
317
+
318
+ // lib/ecommerce/client/customer.ts
319
+ var CustomerEcommerceClient = class extends BaseEcommerceClient {
320
+ // ============================================================================
321
+ // Products API
322
+ // ============================================================================
323
+ /**
324
+ * List products with filtering and pagination
325
+ *
326
+ * @param params - Query parameters for filtering
327
+ * @returns Paginated list of products
328
+ *
329
+ * @example
330
+ * ```typescript
331
+ * const products = await client.listProducts({
332
+ * limit: 20,
333
+ * offset: 0,
334
+ * category: "electronics",
335
+ * search: "laptop",
336
+ * minPrice: 500,
337
+ * maxPrice: 2000,
338
+ * sortBy: "price_asc"
339
+ * });
340
+ * ```
341
+ */
342
+ async listProducts(params) {
343
+ const queryString = params ? buildQueryString(params) : "";
344
+ return this.get(`/api/marketplace/products${queryString}`);
345
+ }
346
+ /**
347
+ * Get product details by ID
348
+ *
349
+ * @param productId - Product ID
350
+ * @returns Product details with merchant info, variants, and reviews
351
+ *
352
+ * @example
353
+ * ```typescript
354
+ * const product = await client.getProduct("prod_123");
355
+ * console.log(product.title, product.priceUSDC);
356
+ * ```
357
+ */
358
+ async getProduct(productId) {
359
+ return this.get(`/api/marketplace/products/${productId}`);
360
+ }
361
+ /**
362
+ * Track product view (increment view count)
363
+ *
364
+ * @param productId - Product ID
365
+ * @returns Success response
366
+ *
367
+ * @example
368
+ * ```typescript
369
+ * await client.trackProductView("prod_123");
370
+ * ```
371
+ */
372
+ async trackProductView(productId) {
373
+ return this.post(`/api/marketplace/products/${productId}/view`);
374
+ }
375
+ /**
376
+ * Get active automatic discounts for a product
377
+ *
378
+ * @param productId - Product ID
379
+ * @returns List of applicable discounts
380
+ *
381
+ * @example
382
+ * ```typescript
383
+ * const discounts = await client.getProductDiscounts("prod_123");
384
+ * discounts.discounts.forEach(d => console.log(d.description));
385
+ * ```
386
+ */
387
+ async getProductDiscounts(productId) {
388
+ return this.get(`/api/marketplace/products/${productId}/discounts`);
389
+ }
390
+ // ============================================================================
391
+ // Orders API
392
+ // ============================================================================
393
+ /**
394
+ * Create order from cart checkout
395
+ *
396
+ * Supports multi-merchant checkout - automatically splits orders by merchant.
397
+ *
398
+ * @param request - Order creation request
399
+ * @returns Created order(s) with payment instructions
400
+ *
401
+ * @example
402
+ * ```typescript
403
+ * const result = await client.createOrder({
404
+ * items: [
405
+ * { productId: "prod_123", quantity: 2 },
406
+ * { productId: "prod_456", quantity: 1, variantId: "var_789" }
407
+ * ],
408
+ * paymentMethod: "USDC_ESCROW",
409
+ * shippingAddress: {
410
+ * fullName: "John Doe",
411
+ * phone: "+1234567890",
412
+ * addressLine1: "123 Main St",
413
+ * city: "New York",
414
+ * stateProvince: "NY",
415
+ * postalCode: "10001",
416
+ * country: "US"
417
+ * },
418
+ * couponCode: "SAVE10"
419
+ * });
420
+ *
421
+ * // For USDC escrow, deposit to the escrow address
422
+ * if (result.escrow) {
423
+ * console.log("Deposit", result.escrow.amountUSDC, "USDC to", result.escrow.address);
424
+ * }
425
+ * ```
426
+ */
427
+ async createOrder(request) {
428
+ return this.post("/api/marketplace/orders", request);
429
+ }
430
+ /**
431
+ * List user's orders
432
+ *
433
+ * @param params - Query parameters for filtering
434
+ * @returns Paginated list of orders
435
+ *
436
+ * @example
437
+ * ```typescript
438
+ * const orders = await client.listOrders({
439
+ * limit: 10,
440
+ * offset: 0,
441
+ * status: "SHIPPED"
442
+ * });
443
+ * ```
444
+ */
445
+ async listOrders(params) {
446
+ const queryString = params ? buildQueryString(params) : "";
447
+ return this.get(`/api/marketplace/orders${queryString}`);
448
+ }
449
+ /**
450
+ * Get order details by ID
451
+ *
452
+ * @param orderId - Order ID
453
+ * @returns Order details with items, payment, and shipment info
454
+ *
455
+ * @example
456
+ * ```typescript
457
+ * const order = await client.getOrder("ord_123");
458
+ * console.log(order.order.status, order.order.totalUSDC);
459
+ * ```
460
+ */
461
+ async getOrder(orderId) {
462
+ return this.get(`/api/marketplace/orders/${orderId}`);
463
+ }
464
+ /**
465
+ * Confirm USDC escrow deposit for order payment
466
+ *
467
+ * Verifies the Hyperliquid transaction and updates order status.
468
+ *
469
+ * @param orderId - Order ID
470
+ * @returns Confirmation response with transaction hash
471
+ *
472
+ * @example
473
+ * ```typescript
474
+ * // After depositing USDC to escrow address
475
+ * const result = await client.confirmEscrowDeposit("ord_123");
476
+ * console.log("Payment confirmed:", result.depositTxHash);
477
+ * ```
478
+ */
479
+ async confirmEscrowDeposit(orderId) {
480
+ return this.post(`/api/marketplace/orders/${orderId}/confirm-escrow-deposit`);
481
+ }
482
+ /**
483
+ * Get order receipt
484
+ *
485
+ * @param orderId - Order ID
486
+ * @returns Order receipt for download/display
487
+ *
488
+ * @example
489
+ * ```typescript
490
+ * const receipt = await client.getOrderReceipt("ord_123");
491
+ * console.log("Order #", receipt.receipt.orderNumber);
492
+ * ```
493
+ */
494
+ async getOrderReceipt(orderId) {
495
+ return this.get(`/api/marketplace/orders/${orderId}/receipt`);
496
+ }
497
+ // ============================================================================
498
+ // Reviews API
499
+ // ============================================================================
500
+ /**
501
+ * List reviews for a product
502
+ *
503
+ * @param productId - Product ID
504
+ * @param params - Query parameters
505
+ * @returns Paginated list of reviews
506
+ *
507
+ * @example
508
+ * ```typescript
509
+ * const reviews = await client.listProductReviews("prod_123", {
510
+ * limit: 10,
511
+ * sortBy: "highest"
512
+ * });
513
+ * ```
514
+ */
515
+ async listProductReviews(productId, params) {
516
+ const queryString = params ? buildQueryString(params) : "";
517
+ return this.get(`/api/marketplace/products/${productId}/reviews${queryString}`);
518
+ }
519
+ /**
520
+ * Create a product review
521
+ *
522
+ * Requires authenticated user who has purchased the product.
523
+ *
524
+ * @param productId - Product ID
525
+ * @param request - Review creation request
526
+ * @returns Created review
527
+ *
528
+ * @example
529
+ * ```typescript
530
+ * const review = await client.createReview("prod_123", {
531
+ * rating: 5,
532
+ * title: "Great product!",
533
+ * comment: "Exactly what I needed. Fast shipping too!"
534
+ * });
535
+ * ```
536
+ */
537
+ async createReview(productId, request) {
538
+ return this.post(`/api/marketplace/products/${productId}/reviews`, request);
539
+ }
540
+ // ============================================================================
541
+ // Shipping Addresses API
542
+ // ============================================================================
543
+ /**
544
+ * List saved shipping addresses
545
+ *
546
+ * @returns List of user's saved shipping addresses
547
+ *
548
+ * @example
549
+ * ```typescript
550
+ * const addresses = await client.listShippingAddresses();
551
+ * const defaultAddress = addresses.addresses.find(a => a.isDefault);
552
+ * ```
553
+ */
554
+ async listShippingAddresses() {
555
+ return this.get("/api/user/shipping-addresses");
556
+ }
557
+ /**
558
+ * Create a new shipping address
559
+ *
560
+ * @param request - Shipping address data
561
+ * @returns Created address
562
+ *
563
+ * @example
564
+ * ```typescript
565
+ * const address = await client.createShippingAddress({
566
+ * fullName: "John Doe",
567
+ * phone: "+1234567890",
568
+ * addressLine1: "123 Main St",
569
+ * city: "New York",
570
+ * stateProvince: "NY",
571
+ * postalCode: "10001",
572
+ * country: "US",
573
+ * isDefault: true,
574
+ * label: "Home"
575
+ * });
576
+ * ```
577
+ */
578
+ async createShippingAddress(request) {
579
+ return this.post("/api/user/shipping-addresses", request);
580
+ }
581
+ /**
582
+ * Update a shipping address
583
+ *
584
+ * @param addressId - Address ID
585
+ * @param request - Updated address data
586
+ * @returns Updated address
587
+ *
588
+ * @example
589
+ * ```typescript
590
+ * const address = await client.updateShippingAddress("addr_123", {
591
+ * phone: "+0987654321"
592
+ * });
593
+ * ```
594
+ */
595
+ async updateShippingAddress(addressId, request) {
596
+ return this.patch(`/api/user/shipping-addresses/${addressId}`, request);
597
+ }
598
+ /**
599
+ * Delete a shipping address
600
+ *
601
+ * @param addressId - Address ID
602
+ * @returns Success response
603
+ *
604
+ * @example
605
+ * ```typescript
606
+ * await client.deleteShippingAddress("addr_123");
607
+ * ```
608
+ */
609
+ async deleteShippingAddress(addressId) {
610
+ return this.delete(`/api/user/shipping-addresses/${addressId}`);
611
+ }
612
+ // ============================================================================
613
+ // Cart & Discounts API
614
+ // ============================================================================
615
+ /**
616
+ * Calculate automatic discounts for cart items
617
+ *
618
+ * @param request - Cart items
619
+ * @returns Calculated discounts and totals
620
+ *
621
+ * @example
622
+ * ```typescript
623
+ * const result = await client.calculateCartDiscounts({
624
+ * items: [
625
+ * { productId: "prod_123", quantity: 2 },
626
+ * { productId: "prod_456", quantity: 1 }
627
+ * ]
628
+ * });
629
+ * console.log("Subtotal:", result.subtotal);
630
+ * console.log("Discount:", result.discountAmount);
631
+ * console.log("Total:", result.total);
632
+ * ```
633
+ */
634
+ async calculateCartDiscounts(request) {
635
+ return this.post("/api/marketplace/cart/discounts", request);
636
+ }
637
+ /**
638
+ * Validate a discount code for cart items
639
+ *
640
+ * @param request - Discount code and cart items
641
+ * @returns Validation result with discount details
642
+ *
643
+ * @example
644
+ * ```typescript
645
+ * const result = await client.validateDiscountCode({
646
+ * code: "SAVE10",
647
+ * items: [
648
+ * { productId: "prod_123", quantity: 2 }
649
+ * ]
650
+ * });
651
+ *
652
+ * if (result.valid) {
653
+ * console.log("Discount:", result.discount?.discountAmount);
654
+ * } else {
655
+ * console.log("Error:", result.error);
656
+ * }
657
+ * ```
658
+ */
659
+ async validateDiscountCode(request) {
660
+ return this.post("/api/marketplace/discounts/validate", request);
661
+ }
662
+ // ============================================================================
663
+ // Tax Calculation API
664
+ // ============================================================================
665
+ /**
666
+ * Calculate tax for cart items based on shipping address
667
+ *
668
+ * @param request - Cart items and shipping address
669
+ * @returns Tax calculation with breakdown
670
+ *
671
+ * @example
672
+ * ```typescript
673
+ * const result = await client.calculateTax({
674
+ * items: [
675
+ * { productId: "prod_123", quantity: 2 }
676
+ * ],
677
+ * shippingAddress: {
678
+ * country: "US",
679
+ * region: "NY",
680
+ * postalCode: "10001"
681
+ * }
682
+ * });
683
+ * console.log("Tax:", result.taxAmount);
684
+ * console.log("Total:", result.total);
685
+ * ```
686
+ */
687
+ async calculateTax(request) {
688
+ return this.post("/api/marketplace/tax/calculate", request);
689
+ }
690
+ // ============================================================================
691
+ // Banners API
692
+ // ============================================================================
693
+ /**
694
+ * Get active promotional banners
695
+ *
696
+ * @param params - Query parameters
697
+ * @returns List of active banners
698
+ *
699
+ * @example
700
+ * ```typescript
701
+ * const banners = await client.getActiveBanners({
702
+ * type: "HERO",
703
+ * merchantId: "merchant_123"
704
+ * });
705
+ * ```
706
+ */
707
+ async getActiveBanners(params) {
708
+ const queryString = params ? buildQueryString(params) : "";
709
+ return this.get(`/api/marketplace/banners/active${queryString}`);
710
+ }
711
+ /**
712
+ * Track banner impression or click
713
+ *
714
+ * @param bannerId - Banner ID
715
+ * @param request - Track action (impression or click)
716
+ * @returns Success response
717
+ *
718
+ * @example
719
+ * ```typescript
720
+ * // Track impression
721
+ * await client.trackBanner("banner_123", { action: "impression" });
722
+ *
723
+ * // Track click
724
+ * await client.trackBanner("banner_123", { action: "click" });
725
+ * ```
726
+ */
727
+ async trackBanner(bannerId, request) {
728
+ return this.post(`/api/marketplace/banners/${bannerId}/track`, request);
729
+ }
730
+ };
731
+
732
+ // lib/ecommerce/client/merchant.ts
733
+ var MerchantEcommerceClient = class extends BaseEcommerceClient {
734
+ // ============================================================================
735
+ // Profile Management
736
+ // ============================================================================
737
+ /**
738
+ * Get merchant profile
739
+ *
740
+ * @returns Merchant profile
741
+ *
742
+ * @example
743
+ * ```typescript
744
+ * const profile = await client.getMerchantProfile();
745
+ * console.log(profile.merchant.name);
746
+ * ```
747
+ */
748
+ async getMerchantProfile() {
749
+ return this.get("/api/marketplace/merchant/profile");
750
+ }
751
+ /**
752
+ * Get merchant profile (alias for getMerchantProfile)
753
+ *
754
+ * @returns Merchant profile
755
+ *
756
+ * @example
757
+ * ```typescript
758
+ * const profile = await client.getProfile();
759
+ * console.log(profile.merchant.name);
760
+ * ```
761
+ */
762
+ async getProfile() {
763
+ return this.getMerchantProfile();
764
+ }
765
+ /**
766
+ * Create or update merchant profile
767
+ *
768
+ * @param request - Profile data
769
+ * @returns Updated merchant profile
770
+ *
771
+ * @example
772
+ * ```typescript
773
+ * const profile = await client.upsertMerchantProfile({
774
+ * name: "My Store",
775
+ * description: "We sell great products",
776
+ * payoutAddress: "0x1234..."
777
+ * });
778
+ * ```
779
+ */
780
+ async upsertMerchantProfile(request) {
781
+ return this.post("/api/marketplace/merchant/profile", request);
782
+ }
783
+ // ============================================================================
784
+ // Products Management
785
+ // ============================================================================
786
+ /**
787
+ * List merchant's products
788
+ *
789
+ * @param params - Query parameters
790
+ * @returns Paginated list of products
791
+ *
792
+ * @example
793
+ * ```typescript
794
+ * const products = await client.listMerchantProducts({ limit: 20, offset: 0 });
795
+ * ```
796
+ */
797
+ async listMerchantProducts(params) {
798
+ const queryString = params ? buildQueryString(params) : "";
799
+ return this.get(`/api/marketplace/merchant/products${queryString}`);
800
+ }
801
+ /**
802
+ * Get a single product by ID
803
+ *
804
+ * @param productId - Product ID
805
+ * @returns Product details
806
+ *
807
+ * @example
808
+ * ```typescript
809
+ * const product = await client.getProduct("prod_123");
810
+ * console.log(product.product?.title, product.product?.priceUSDC);
811
+ * ```
812
+ */
813
+ async getProduct(productId) {
814
+ return this.get(`/api/marketplace/products/${productId}`);
815
+ }
816
+ /**
817
+ * Create a new product
818
+ *
819
+ * @param request - Product data
820
+ * @returns Created product
821
+ *
822
+ * @example
823
+ * ```typescript
824
+ * const product = await client.createProduct({
825
+ * title: "Awesome Product",
826
+ * images: ["https://..."],
827
+ * priceUSDC: 49.99,
828
+ * inventory: 50,
829
+ * category: "electronics",
830
+ * moq: 1
831
+ * });
832
+ * ```
833
+ */
834
+ async createProduct(request) {
835
+ return this.post("/api/marketplace/merchant/products", request);
836
+ }
837
+ /**
838
+ * Update a product
839
+ *
840
+ * @param productId - Product ID
841
+ * @param request - Updated product data
842
+ * @returns Updated product
843
+ *
844
+ * @example
845
+ * ```typescript
846
+ * const product = await client.updateProduct("prod_123", {
847
+ * priceUSDC: 39.99,
848
+ * inventory: 75
849
+ * });
850
+ * ```
851
+ */
852
+ async updateProduct(productId, request) {
853
+ return this.put(`/api/marketplace/products/${productId}`, request);
854
+ }
855
+ /**
856
+ * Delete a product
857
+ *
858
+ * @param productId - Product ID
859
+ * @returns Success response
860
+ *
861
+ * @example
862
+ * ```typescript
863
+ * await client.deleteProduct("prod_123");
864
+ * ```
865
+ */
866
+ async deleteProduct(productId) {
867
+ return this.delete(`/api/marketplace/products/${productId}`);
868
+ }
869
+ /**
870
+ * Toggle product featured status
871
+ *
872
+ * @param productId - Product ID
873
+ * @param featured - Featured status
874
+ * @returns Updated product
875
+ *
876
+ * @example
877
+ * ```typescript
878
+ * await client.setProductFeatured("prod_123", true);
879
+ * ```
880
+ */
881
+ async setProductFeatured(productId, featured) {
882
+ return this.patch(`/api/marketplace/merchant/products/${productId}/featured`, { featured });
883
+ }
884
+ /**
885
+ * List product variants
886
+ *
887
+ * @param productId - Product ID
888
+ * @returns List of variants
889
+ *
890
+ * @example
891
+ * ```typescript
892
+ * const variants = await client.listProductVariants("prod_123");
893
+ * ```
894
+ */
895
+ async listProductVariants(productId) {
896
+ return this.get(`/api/marketplace/merchant/products/${productId}/variants`);
897
+ }
898
+ /**
899
+ * Create a product variant
900
+ *
901
+ * @param productId - Product ID
902
+ * @param request - Variant data
903
+ * @returns Created variant
904
+ *
905
+ * @example
906
+ * ```typescript
907
+ * const variant = await client.createProductVariant("prod_123", {
908
+ * name: "Large / Red",
909
+ * attributes: { size: "L", color: "Red" },
910
+ * priceUSDC: 54.99,
911
+ * inventory: 20
912
+ * });
913
+ * ```
914
+ */
915
+ async createProductVariant(productId, request) {
916
+ return this.post(`/api/marketplace/merchant/products/${productId}/variants`, request);
917
+ }
918
+ /**
919
+ * Get a product variant
920
+ *
921
+ * @param productId - Product ID
922
+ * @param variantId - Variant ID
923
+ * @returns Variant details
924
+ *
925
+ * @example
926
+ * ```typescript
927
+ * const variant = await client.getProductVariant("prod_123", "var_456");
928
+ * ```
929
+ */
930
+ async getProductVariant(productId, variantId) {
931
+ return this.get(`/api/marketplace/merchant/products/${productId}/variants/${variantId}`);
932
+ }
933
+ /**
934
+ * Update a product variant
935
+ *
936
+ * @param productId - Product ID
937
+ * @param variantId - Variant ID
938
+ * @param request - Updated variant data
939
+ * @returns Updated variant
940
+ *
941
+ * @example
942
+ * ```typescript
943
+ * const variant = await client.updateProductVariant("prod_123", "var_456", {
944
+ * inventory: 30
945
+ * });
946
+ * ```
947
+ */
948
+ async updateProductVariant(productId, variantId, request) {
949
+ return this.put(`/api/marketplace/merchant/products/${productId}/variants/${variantId}`, request);
950
+ }
951
+ /**
952
+ * Delete a product variant
953
+ *
954
+ * @param productId - Product ID
955
+ * @param variantId - Variant ID
956
+ * @returns Success response
957
+ *
958
+ * @example
959
+ * ```typescript
960
+ * await client.deleteProductVariant("prod_123", "var_456");
961
+ * ```
962
+ */
963
+ async deleteProductVariant(productId, variantId) {
964
+ return this.delete(`/api/marketplace/merchant/products/${productId}/variants/${variantId}`);
965
+ }
966
+ /**
967
+ * Get product metrics
968
+ *
969
+ * @returns Product performance metrics
970
+ *
971
+ * @example
972
+ * ```typescript
973
+ * const metrics = await client.getProductMetrics();
974
+ * console.log("Total revenue:", metrics.summary.totalRevenue);
975
+ * ```
976
+ */
977
+ async getProductMetrics() {
978
+ return this.get("/api/marketplace/merchant/products/metrics");
979
+ }
980
+ // ============================================================================
981
+ // Orders Management
982
+ // ============================================================================
983
+ /**
984
+ * List merchant's orders
985
+ *
986
+ * @param params - Query parameters
987
+ * @returns Paginated list of orders
988
+ *
989
+ * @example
990
+ * ```typescript
991
+ * const orders = await client.listMerchantOrders({ limit: 20, offset: 0 });
992
+ * ```
993
+ */
994
+ async listMerchantOrders(params) {
995
+ const queryString = params ? buildQueryString(params) : "";
996
+ return this.get(`/api/marketplace/merchant/orders${queryString}`);
997
+ }
998
+ /**
999
+ * Get order details
1000
+ *
1001
+ * @param orderId - Order ID
1002
+ * @returns Order details with full information
1003
+ *
1004
+ * @example
1005
+ * ```typescript
1006
+ * const order = await client.getMerchantOrder("ord_123");
1007
+ * console.log(order.order.status, order.order.items);
1008
+ * ```
1009
+ */
1010
+ async getMerchantOrder(orderId) {
1011
+ return this.get(`/api/marketplace/merchant/orders/${orderId}`);
1012
+ }
1013
+ /**
1014
+ * Update order status
1015
+ *
1016
+ * @param orderId - Order ID
1017
+ * @param request - Status update request
1018
+ * @returns Updated order
1019
+ *
1020
+ * @example
1021
+ * ```typescript
1022
+ * // Accept order
1023
+ * await client.updateOrderStatus("ord_123", {
1024
+ * status: "MERCHANT_ACCEPTED"
1025
+ * });
1026
+ *
1027
+ * // Mark as shipped
1028
+ * await client.updateOrderStatus("ord_123", {
1029
+ * status: "SHIPPED",
1030
+ * tracking: {
1031
+ * trackingNumber: "1Z999AA10123456784",
1032
+ * carrier: "UPS"
1033
+ * }
1034
+ * });
1035
+ * ```
1036
+ */
1037
+ async updateOrderStatus(orderId, request) {
1038
+ return this.patch(`/api/marketplace/merchant/orders/${orderId}`, request);
1039
+ }
1040
+ /**
1041
+ * Create a custom order event
1042
+ *
1043
+ * @param orderId - Order ID
1044
+ * @param request - Event data
1045
+ * @returns Created event
1046
+ *
1047
+ * @example
1048
+ * ```typescript
1049
+ * await client.createOrderEvent("ord_123", {
1050
+ * eventType: "CUSTOM",
1051
+ * title: "Package delayed",
1052
+ * description: "Shipment delayed due to weather"
1053
+ * });
1054
+ * ```
1055
+ */
1056
+ async createOrderEvent(orderId, request) {
1057
+ return this.post(`/api/marketplace/merchant/orders/${orderId}/events`, request);
1058
+ }
1059
+ // ============================================================================
1060
+ // Customers Management
1061
+ // ============================================================================
1062
+ /**
1063
+ * List customers with order history and stats
1064
+ *
1065
+ * @param params - Query parameters
1066
+ * @returns Paginated list of customers
1067
+ *
1068
+ * @example
1069
+ * ```typescript
1070
+ * const customers = await client.listCustomers({ limit: 50, offset: 0 });
1071
+ * customers.items.forEach(c => {
1072
+ * console.log(c.username, "Total spent:", c.totalSpent);
1073
+ * });
1074
+ * ```
1075
+ */
1076
+ async listCustomers(params) {
1077
+ const queryString = params ? buildQueryString(params) : "";
1078
+ return this.get(`/api/marketplace/merchant/customers${queryString}`);
1079
+ }
1080
+ // ============================================================================
1081
+ // Coupons & Discounts Management
1082
+ // ============================================================================
1083
+ /**
1084
+ * List merchant's coupons
1085
+ *
1086
+ * @returns List of coupons with stats
1087
+ *
1088
+ * @example
1089
+ * ```typescript
1090
+ * const result = await client.listCoupons();
1091
+ * console.log("Total coupons:", result.stats.total);
1092
+ * console.log("Active:", result.stats.active);
1093
+ * ```
1094
+ */
1095
+ async listCoupons() {
1096
+ return this.get("/api/marketplace/merchant/coupons");
1097
+ }
1098
+ /**
1099
+ * Create a coupon
1100
+ *
1101
+ * @param request - Coupon data
1102
+ * @returns Created coupon
1103
+ *
1104
+ * @example
1105
+ * ```typescript
1106
+ * const coupon = await client.createCoupon({
1107
+ * code: "SAVE20",
1108
+ * discountType: "PERCENTAGE",
1109
+ * discountValue: 20,
1110
+ * startsAt: "2025-01-01T00:00:00Z",
1111
+ * expiresAt: "2025-12-31T23:59:59Z",
1112
+ * maxUses: 100
1113
+ * });
1114
+ * ```
1115
+ */
1116
+ async createCoupon(request) {
1117
+ return this.post("/api/marketplace/merchant/coupons", request);
1118
+ }
1119
+ /**
1120
+ * Get coupon details with usage history
1121
+ *
1122
+ * @param couponId - Coupon ID
1123
+ * @returns Coupon with usages
1124
+ *
1125
+ * @example
1126
+ * ```typescript
1127
+ * const coupon = await client.getCoupon("coupon_123");
1128
+ * console.log("Used", coupon.coupon.usedCount, "times");
1129
+ * ```
1130
+ */
1131
+ async getCoupon(couponId) {
1132
+ return this.get(`/api/marketplace/merchant/coupons/${couponId}`);
1133
+ }
1134
+ /**
1135
+ * Update a coupon
1136
+ *
1137
+ * @param couponId - Coupon ID
1138
+ * @param request - Updated coupon data
1139
+ * @returns Updated coupon
1140
+ *
1141
+ * @example
1142
+ * ```typescript
1143
+ * await client.updateCoupon("coupon_123", {
1144
+ * isActive: false
1145
+ * });
1146
+ * ```
1147
+ */
1148
+ async updateCoupon(couponId, request) {
1149
+ return this.put(`/api/marketplace/merchant/coupons/${couponId}`, request);
1150
+ }
1151
+ /**
1152
+ * Delete a coupon
1153
+ *
1154
+ * @param couponId - Coupon ID
1155
+ * @returns Success response
1156
+ *
1157
+ * @example
1158
+ * ```typescript
1159
+ * await client.deleteCoupon("coupon_123");
1160
+ * ```
1161
+ */
1162
+ async deleteCoupon(couponId) {
1163
+ return this.delete(`/api/marketplace/merchant/coupons/${couponId}`);
1164
+ }
1165
+ // ============================================================================
1166
+ // Shipping & Fulfillment
1167
+ // ============================================================================
1168
+ /**
1169
+ * List shipping methods
1170
+ *
1171
+ * @returns List of shipping methods
1172
+ *
1173
+ * @example
1174
+ * ```typescript
1175
+ * const methods = await client.listShippingMethods();
1176
+ * ```
1177
+ */
1178
+ async listShippingMethods() {
1179
+ return this.get("/api/marketplace/merchant/shipping/methods");
1180
+ }
1181
+ /**
1182
+ * Create a shipping method
1183
+ *
1184
+ * @param request - Shipping method data
1185
+ * @returns Created method
1186
+ *
1187
+ * @example
1188
+ * ```typescript
1189
+ * const method = await client.createShippingMethod({
1190
+ * name: "Standard Shipping",
1191
+ * carrier: "USPS",
1192
+ * estimatedDays: "3-5 business days",
1193
+ * flatRate: 5.99
1194
+ * });
1195
+ * ```
1196
+ */
1197
+ async createShippingMethod(request) {
1198
+ return this.post("/api/marketplace/merchant/shipping/methods", request);
1199
+ }
1200
+ /**
1201
+ * Update a shipping method
1202
+ *
1203
+ * @param methodId - Method ID
1204
+ * @param request - Updated method data
1205
+ * @returns Updated method
1206
+ *
1207
+ * @example
1208
+ * ```typescript
1209
+ * await client.updateShippingMethod("method_123", {
1210
+ * flatRate: 6.99
1211
+ * });
1212
+ * ```
1213
+ */
1214
+ async updateShippingMethod(methodId, request) {
1215
+ return this.put(`/api/marketplace/merchant/shipping/methods/${methodId}`, request);
1216
+ }
1217
+ /**
1218
+ * Delete a shipping method
1219
+ *
1220
+ * @param methodId - Method ID
1221
+ * @returns Success response
1222
+ *
1223
+ * @example
1224
+ * ```typescript
1225
+ * await client.deleteShippingMethod("method_123");
1226
+ * ```
1227
+ */
1228
+ async deleteShippingMethod(methodId) {
1229
+ return this.delete(`/api/marketplace/merchant/shipping/methods/${methodId}`);
1230
+ }
1231
+ /**
1232
+ * List shipments
1233
+ *
1234
+ * @returns List of shipments for merchant's orders
1235
+ *
1236
+ * @example
1237
+ * ```typescript
1238
+ * const shipments = await client.listShipments();
1239
+ * ```
1240
+ */
1241
+ async listShipments() {
1242
+ return this.get("/api/marketplace/merchant/shipping/shipments");
1243
+ }
1244
+ /**
1245
+ * Update shipment status and tracking
1246
+ *
1247
+ * @param shipmentId - Shipment ID
1248
+ * @param request - Updated shipment data
1249
+ * @returns Updated shipment
1250
+ *
1251
+ * @example
1252
+ * ```typescript
1253
+ * await client.updateShipment("ship_123", {
1254
+ * status: "SHIPPED",
1255
+ * trackingNumber: "1Z999AA10123456784",
1256
+ * carrier: "UPS"
1257
+ * });
1258
+ * ```
1259
+ */
1260
+ async updateShipment(shipmentId, request) {
1261
+ return this.patch(`/api/marketplace/merchant/shipping/shipments/${shipmentId}`, request);
1262
+ }
1263
+ // ============================================================================
1264
+ // Returns & Refunds
1265
+ // ============================================================================
1266
+ /**
1267
+ * List returns
1268
+ *
1269
+ * @returns List of returns for merchant's orders
1270
+ *
1271
+ * @example
1272
+ * ```typescript
1273
+ * const returns = await client.listReturns();
1274
+ * ```
1275
+ */
1276
+ async listReturns() {
1277
+ return this.get("/api/marketplace/merchant/returns");
1278
+ }
1279
+ /**
1280
+ * Approve a return request
1281
+ *
1282
+ * @param returnId - Return ID
1283
+ * @returns Updated return
1284
+ *
1285
+ * @example
1286
+ * ```typescript
1287
+ * await client.approveReturn("return_123");
1288
+ * ```
1289
+ */
1290
+ async approveReturn(returnId) {
1291
+ return this.post(`/api/marketplace/merchant/returns/${returnId}/approve`);
1292
+ }
1293
+ /**
1294
+ * Reject a return request
1295
+ *
1296
+ * @param returnId - Return ID
1297
+ * @returns Updated return
1298
+ *
1299
+ * @example
1300
+ * ```typescript
1301
+ * await client.rejectReturn("return_123");
1302
+ * ```
1303
+ */
1304
+ async rejectReturn(returnId) {
1305
+ return this.post(`/api/marketplace/merchant/returns/${returnId}/reject`);
1306
+ }
1307
+ /**
1308
+ * Mark return as received
1309
+ *
1310
+ * @param returnId - Return ID
1311
+ * @returns Updated return
1312
+ *
1313
+ * @example
1314
+ * ```typescript
1315
+ * await client.markReturnReceived("return_123");
1316
+ * ```
1317
+ */
1318
+ async markReturnReceived(returnId) {
1319
+ return this.post(`/api/marketplace/merchant/returns/${returnId}/received`);
1320
+ }
1321
+ /**
1322
+ * Process refund for return
1323
+ *
1324
+ * @param returnId - Return ID
1325
+ * @returns Updated return
1326
+ *
1327
+ * @example
1328
+ * ```typescript
1329
+ * await client.processRefund("return_123");
1330
+ * ```
1331
+ */
1332
+ async processRefund(returnId) {
1333
+ return this.post(`/api/marketplace/merchant/returns/${returnId}/refunded`);
1334
+ }
1335
+ // ============================================================================
1336
+ // Reviews Management
1337
+ // ============================================================================
1338
+ /**
1339
+ * List reviews for merchant's products
1340
+ *
1341
+ * @returns List of reviews
1342
+ *
1343
+ * @example
1344
+ * ```typescript
1345
+ * const reviews = await client.listMerchantReviews();
1346
+ * ```
1347
+ */
1348
+ async listMerchantReviews() {
1349
+ return this.get("/api/marketplace/merchant/reviews");
1350
+ }
1351
+ /**
1352
+ * Respond to a review
1353
+ *
1354
+ * @param reviewId - Review ID
1355
+ * @param request - Response data
1356
+ * @returns Updated review
1357
+ *
1358
+ * @example
1359
+ * ```typescript
1360
+ * await client.respondToReview("review_123", {
1361
+ * merchantResponse: "Thank you for your feedback!"
1362
+ * });
1363
+ * ```
1364
+ */
1365
+ async respondToReview(reviewId, request) {
1366
+ return this.post(`/api/marketplace/merchant/reviews/${reviewId}/respond`, request);
1367
+ }
1368
+ /**
1369
+ * Flag a review as inappropriate
1370
+ *
1371
+ * @param reviewId - Review ID
1372
+ * @returns Updated review
1373
+ *
1374
+ * @example
1375
+ * ```typescript
1376
+ * await client.flagReview("review_123");
1377
+ * ```
1378
+ */
1379
+ async flagReview(reviewId) {
1380
+ return this.post(`/api/marketplace/merchant/reviews/${reviewId}/flag`);
1381
+ }
1382
+ // ============================================================================
1383
+ // Messages
1384
+ // ============================================================================
1385
+ /**
1386
+ * List messages/conversations
1387
+ *
1388
+ * @returns List of conversations grouped by order
1389
+ *
1390
+ * @example
1391
+ * ```typescript
1392
+ * const messages = await client.listMessages();
1393
+ * console.log("Unread:", messages.stats.unread);
1394
+ * ```
1395
+ */
1396
+ async listMessages() {
1397
+ return this.get("/api/marketplace/merchant/messages");
1398
+ }
1399
+ /**
1400
+ * Send a message to customer
1401
+ *
1402
+ * @param request - Message data
1403
+ * @returns Sent message
1404
+ *
1405
+ * @example
1406
+ * ```typescript
1407
+ * await client.sendMessage({
1408
+ * orderId: "ord_123",
1409
+ * recipientId: "user_456",
1410
+ * message: "Your order has been shipped!"
1411
+ * });
1412
+ * ```
1413
+ */
1414
+ async sendMessage(request) {
1415
+ return this.post("/api/marketplace/merchant/messages/send", request);
1416
+ }
1417
+ /**
1418
+ * Mark message as read
1419
+ *
1420
+ * @param messageId - Message ID
1421
+ * @returns Updated message
1422
+ *
1423
+ * @example
1424
+ * ```typescript
1425
+ * await client.markMessageRead("msg_123");
1426
+ * ```
1427
+ */
1428
+ async markMessageRead(messageId) {
1429
+ return this.patch(`/api/marketplace/merchant/messages/${messageId}/read`);
1430
+ }
1431
+ // ============================================================================
1432
+ // Media Library
1433
+ // ============================================================================
1434
+ /**
1435
+ * List media assets
1436
+ *
1437
+ * @param params - Query parameters
1438
+ * @returns Paginated list of media assets
1439
+ *
1440
+ * @example
1441
+ * ```typescript
1442
+ * const media = await client.listMediaAssets({ limit: 50, offset: 0 });
1443
+ * ```
1444
+ */
1445
+ async listMediaAssets(params) {
1446
+ const queryString = params ? buildQueryString(params) : "";
1447
+ return this.get(`/api/marketplace/merchant/media${queryString}`);
1448
+ }
1449
+ /**
1450
+ * Upload a media asset
1451
+ *
1452
+ * @param file - File to upload (max 10MB, images only)
1453
+ * @returns Uploaded asset
1454
+ *
1455
+ * @example
1456
+ * ```typescript
1457
+ * const formData = new FormData();
1458
+ * formData.append("file", imageFile);
1459
+ *
1460
+ * const asset = await client.uploadMediaAsset(formData);
1461
+ * console.log("Uploaded:", asset.asset.blobUrl);
1462
+ * ```
1463
+ */
1464
+ async uploadMediaAsset(formData) {
1465
+ return this.post("/api/marketplace/merchant/media/upload", formData, {
1466
+ headers: { "Content-Type": "multipart/form-data" }
1467
+ });
1468
+ }
1469
+ /**
1470
+ * Delete a media asset
1471
+ *
1472
+ * @param assetId - Asset ID
1473
+ * @returns Success response
1474
+ *
1475
+ * @example
1476
+ * ```typescript
1477
+ * await client.deleteMediaAsset("asset_123");
1478
+ * ```
1479
+ */
1480
+ async deleteMediaAsset(assetId) {
1481
+ return this.delete(`/api/marketplace/merchant/media?id=${assetId}`);
1482
+ }
1483
+ // ============================================================================
1484
+ // Banners
1485
+ // ============================================================================
1486
+ /**
1487
+ * List merchant's banners
1488
+ *
1489
+ * @returns List of banners
1490
+ *
1491
+ * @example
1492
+ * ```typescript
1493
+ * const banners = await client.listMerchantBanners();
1494
+ * ```
1495
+ */
1496
+ async listMerchantBanners() {
1497
+ return this.get("/api/marketplace/merchant/banners");
1498
+ }
1499
+ /**
1500
+ * Create a promotional banner
1501
+ *
1502
+ * @param request - Banner data
1503
+ * @returns Created banner
1504
+ *
1505
+ * @example
1506
+ * ```typescript
1507
+ * const banner = await client.createBanner({
1508
+ * title: "Summer Sale",
1509
+ * imageUrl: "https://...",
1510
+ * linkUrl: "/products?category=summer",
1511
+ * ctaText: "Shop Now",
1512
+ * priority: 10
1513
+ * });
1514
+ * ```
1515
+ */
1516
+ async createBanner(request) {
1517
+ return this.post("/api/marketplace/merchant/banners", request);
1518
+ }
1519
+ /**
1520
+ * Get banner details
1521
+ *
1522
+ * @param bannerId - Banner ID
1523
+ * @returns Banner details
1524
+ *
1525
+ * @example
1526
+ * ```typescript
1527
+ * const banner = await client.getBanner("banner_123");
1528
+ * ```
1529
+ */
1530
+ async getBanner(bannerId) {
1531
+ return this.get(`/api/marketplace/merchant/banners/${bannerId}`);
1532
+ }
1533
+ /**
1534
+ * Update a banner
1535
+ *
1536
+ * @param bannerId - Banner ID
1537
+ * @param request - Updated banner data
1538
+ * @returns Updated banner
1539
+ *
1540
+ * @example
1541
+ * ```typescript
1542
+ * await client.updateBanner("banner_123", {
1543
+ * isActive: false
1544
+ * });
1545
+ * ```
1546
+ */
1547
+ async updateBanner(bannerId, request) {
1548
+ return this.put(`/api/marketplace/merchant/banners/${bannerId}`, request);
1549
+ }
1550
+ /**
1551
+ * Delete a banner
1552
+ *
1553
+ * @param bannerId - Banner ID
1554
+ * @returns Success response
1555
+ *
1556
+ * @example
1557
+ * ```typescript
1558
+ * await client.deleteBanner("banner_123");
1559
+ * ```
1560
+ */
1561
+ async deleteBanner(bannerId) {
1562
+ return this.delete(`/api/marketplace/merchant/banners/${bannerId}`);
1563
+ }
1564
+ // ============================================================================
1565
+ // Analytics
1566
+ // ============================================================================
1567
+ /**
1568
+ * Get merchant analytics
1569
+ *
1570
+ * @param params - Query parameters
1571
+ * @returns Analytics data with overview, charts, and insights
1572
+ *
1573
+ * @example
1574
+ * ```typescript
1575
+ * const analytics = await client.getAnalytics({ range: "30days" });
1576
+ * console.log("Revenue:", analytics.overview.totalRevenue);
1577
+ * console.log("Orders:", analytics.overview.totalOrders);
1578
+ * ```
1579
+ */
1580
+ async getAnalytics(params) {
1581
+ const queryString = params ? buildQueryString(params) : "";
1582
+ return this.get(`/api/marketplace/merchant/analytics${queryString}`);
1583
+ }
1584
+ // ============================================================================
1585
+ // Inventory
1586
+ // ============================================================================
1587
+ /**
1588
+ * Get inventory audit log
1589
+ *
1590
+ * @returns Recent inventory audit entries (last 500)
1591
+ *
1592
+ * @example
1593
+ * ```typescript
1594
+ * const audit = await client.getInventoryAudit();
1595
+ * audit.entries.forEach(e => {
1596
+ * console.log(e.action, e.product.title, e.changeAmount);
1597
+ * });
1598
+ * ```
1599
+ */
1600
+ async getInventoryAudit() {
1601
+ return this.get("/api/marketplace/merchant/inventory/audit");
1602
+ }
1603
+ // ============================================================================
1604
+ // Tax Management
1605
+ // ============================================================================
1606
+ /**
1607
+ * Get tax settings
1608
+ *
1609
+ * @returns Tax settings
1610
+ *
1611
+ * @example
1612
+ * ```typescript
1613
+ * const settings = await client.getTaxSettings();
1614
+ * console.log("Tax enabled:", settings.settings.taxEnabled);
1615
+ * ```
1616
+ */
1617
+ async getTaxSettings() {
1618
+ return this.get("/api/marketplace/merchant/tax-settings");
1619
+ }
1620
+ /**
1621
+ * Update tax settings
1622
+ *
1623
+ * @param request - Updated settings
1624
+ * @returns Updated tax settings
1625
+ *
1626
+ * @example
1627
+ * ```typescript
1628
+ * await client.updateTaxSettings({
1629
+ * taxEnabled: true,
1630
+ * pricesIncludeTax: false,
1631
+ * defaultTaxBehavior: "CHARGE"
1632
+ * });
1633
+ * ```
1634
+ */
1635
+ async updateTaxSettings(request) {
1636
+ return this.put("/api/marketplace/merchant/tax-settings", request);
1637
+ }
1638
+ /**
1639
+ * List tax rules
1640
+ *
1641
+ * @returns List of tax rules
1642
+ *
1643
+ * @example
1644
+ * ```typescript
1645
+ * const rules = await client.listTaxRules();
1646
+ * ```
1647
+ */
1648
+ async listTaxRules() {
1649
+ return this.get("/api/marketplace/merchant/tax-rules");
1650
+ }
1651
+ /**
1652
+ * Create a tax rule
1653
+ *
1654
+ * @param request - Tax rule data
1655
+ * @returns Created tax rule
1656
+ *
1657
+ * @example
1658
+ * ```typescript
1659
+ * const rule = await client.createTaxRule({
1660
+ * country: "US",
1661
+ * region: "NY",
1662
+ * taxType: "SALES_TAX",
1663
+ * taxName: "NY Sales Tax",
1664
+ * taxRate: 8.875
1665
+ * });
1666
+ * ```
1667
+ */
1668
+ async createTaxRule(request) {
1669
+ return this.post("/api/marketplace/merchant/tax-rules", request);
1670
+ }
1671
+ /**
1672
+ * Get tax rule details
1673
+ *
1674
+ * @param ruleId - Rule ID
1675
+ * @returns Tax rule details
1676
+ *
1677
+ * @example
1678
+ * ```typescript
1679
+ * const rule = await client.getTaxRule("rule_123");
1680
+ * ```
1681
+ */
1682
+ async getTaxRule(ruleId) {
1683
+ return this.get(`/api/marketplace/merchant/tax-rules/${ruleId}`);
1684
+ }
1685
+ /**
1686
+ * Update a tax rule
1687
+ *
1688
+ * @param ruleId - Rule ID
1689
+ * @param request - Updated rule data
1690
+ * @returns Updated tax rule
1691
+ *
1692
+ * @example
1693
+ * ```typescript
1694
+ * await client.updateTaxRule("rule_123", {
1695
+ * taxRate: 9.0
1696
+ * });
1697
+ * ```
1698
+ */
1699
+ async updateTaxRule(ruleId, request) {
1700
+ return this.put(`/api/marketplace/merchant/tax-rules/${ruleId}`, request);
1701
+ }
1702
+ /**
1703
+ * Delete a tax rule
1704
+ *
1705
+ * @param ruleId - Rule ID
1706
+ * @returns Success response
1707
+ *
1708
+ * @example
1709
+ * ```typescript
1710
+ * await client.deleteTaxRule("rule_123");
1711
+ * ```
1712
+ */
1713
+ async deleteTaxRule(ruleId) {
1714
+ return this.delete(`/api/marketplace/merchant/tax-rules/${ruleId}`);
1715
+ }
1716
+ /**
1717
+ * List tax nexus locations
1718
+ *
1719
+ * @returns List of nexus locations
1720
+ *
1721
+ * @example
1722
+ * ```typescript
1723
+ * const nexus = await client.listTaxNexus();
1724
+ * ```
1725
+ */
1726
+ async listTaxNexus() {
1727
+ return this.get("/api/marketplace/merchant/tax-nexus");
1728
+ }
1729
+ /**
1730
+ * Add a tax nexus location
1731
+ *
1732
+ * @param request - Nexus data
1733
+ * @returns Created nexus
1734
+ *
1735
+ * @example
1736
+ * ```typescript
1737
+ * const nexus = await client.createTaxNexus({
1738
+ * country: "US",
1739
+ * region: "CA",
1740
+ * registrationId: "123456789"
1741
+ * });
1742
+ * ```
1743
+ */
1744
+ async createTaxNexus(request) {
1745
+ return this.post("/api/marketplace/merchant/tax-nexus", request);
1746
+ }
1747
+ /**
1748
+ * Update a tax nexus location
1749
+ *
1750
+ * @param nexusId - Nexus ID
1751
+ * @param request - Updated nexus data
1752
+ * @returns Updated nexus
1753
+ *
1754
+ * @example
1755
+ * ```typescript
1756
+ * await client.updateTaxNexus("nexus_123", {
1757
+ * registrationId: "987654321"
1758
+ * });
1759
+ * ```
1760
+ */
1761
+ async updateTaxNexus(nexusId, request) {
1762
+ return this.put(`/api/marketplace/merchant/tax-nexus/${nexusId}`, request);
1763
+ }
1764
+ /**
1765
+ * Delete a tax nexus location
1766
+ *
1767
+ * @param nexusId - Nexus ID
1768
+ * @returns Success response
1769
+ *
1770
+ * @example
1771
+ * ```typescript
1772
+ * await client.deleteTaxNexus("nexus_123");
1773
+ * ```
1774
+ */
1775
+ async deleteTaxNexus(nexusId) {
1776
+ return this.delete(`/api/marketplace/merchant/tax-nexus/${nexusId}`);
1777
+ }
1778
+ /**
1779
+ * List tax reports
1780
+ *
1781
+ * @param params - Query parameters
1782
+ * @returns Paginated list of tax reports
1783
+ *
1784
+ * @example
1785
+ * ```typescript
1786
+ * const reports = await client.listTaxReports({ limit: 20, offset: 0 });
1787
+ *
1788
+ * // Get summary for a specific year
1789
+ * const summary = await client.listTaxReports({ year: 2025 });
1790
+ * ```
1791
+ */
1792
+ async listTaxReports(params) {
1793
+ const queryString = params ? buildQueryString(params) : "";
1794
+ return this.get(`/api/marketplace/merchant/tax-reports${queryString}`);
1795
+ }
1796
+ /**
1797
+ * Generate a tax report
1798
+ *
1799
+ * @param request - Report generation request
1800
+ * @returns Generated report
1801
+ *
1802
+ * @example
1803
+ * ```typescript
1804
+ * const report = await client.generateTaxReport({
1805
+ * periodType: "MONTHLY",
1806
+ * year: 2025,
1807
+ * period: 1 // January
1808
+ * });
1809
+ * ```
1810
+ */
1811
+ async generateTaxReport(request) {
1812
+ return this.post("/api/marketplace/merchant/tax-reports/generate", request);
1813
+ }
1814
+ /**
1815
+ * Get tax report details
1816
+ *
1817
+ * @param reportId - Report ID
1818
+ * @returns Report with detailed records
1819
+ *
1820
+ * @example
1821
+ * ```typescript
1822
+ * const report = await client.getTaxReport("report_123");
1823
+ * console.log("Total tax:", report.report.totalTax);
1824
+ * ```
1825
+ */
1826
+ async getTaxReport(reportId) {
1827
+ return this.get(`/api/marketplace/merchant/tax-reports/${reportId}`);
1828
+ }
1829
+ /**
1830
+ * Update tax report status
1831
+ *
1832
+ * @param reportId - Report ID
1833
+ * @param request - Status update
1834
+ * @returns Updated report
1835
+ *
1836
+ * @example
1837
+ * ```typescript
1838
+ * await client.updateTaxReportStatus("report_123", {
1839
+ * status: "FINALIZED"
1840
+ * });
1841
+ * ```
1842
+ */
1843
+ async updateTaxReportStatus(reportId, request) {
1844
+ return this.put(`/api/marketplace/merchant/tax-reports/${reportId}`, request);
1845
+ }
1846
+ /**
1847
+ * Export tax report as CSV
1848
+ *
1849
+ * @param reportId - Report ID
1850
+ * @returns CSV file data
1851
+ *
1852
+ * @example
1853
+ * ```typescript
1854
+ * const csv = await client.exportTaxReport("report_123");
1855
+ * // Save or download the CSV
1856
+ * ```
1857
+ */
1858
+ async exportTaxReport(reportId) {
1859
+ return this.get(`/api/marketplace/merchant/tax-reports/${reportId}/export`);
1860
+ }
1861
+ };
1862
+
1863
+ // lib/ecommerce/types/enums.ts
1864
+ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
1865
+ OrderStatus2["CREATED"] = "CREATED";
1866
+ OrderStatus2["AWAITING_DEPOSIT"] = "AWAITING_DEPOSIT";
1867
+ OrderStatus2["PAYMENT_RESERVED"] = "PAYMENT_RESERVED";
1868
+ OrderStatus2["MERCHANT_ACCEPTED"] = "MERCHANT_ACCEPTED";
1869
+ OrderStatus2["SHIPPED"] = "SHIPPED";
1870
+ OrderStatus2["DELIVERED"] = "DELIVERED";
1871
+ OrderStatus2["CANCELLED"] = "CANCELLED";
1872
+ OrderStatus2["CONFIRMED"] = "CONFIRMED";
1873
+ OrderStatus2["COMPLETED"] = "COMPLETED";
1874
+ return OrderStatus2;
1875
+ })(OrderStatus || {});
1876
+ var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
1877
+ PaymentMethod2["USDC_ESCROW"] = "USDC_ESCROW";
1878
+ PaymentMethod2["POINTS"] = "POINTS";
1879
+ return PaymentMethod2;
1880
+ })(PaymentMethod || {});
1881
+ var PaymentStatus = /* @__PURE__ */ ((PaymentStatus2) => {
1882
+ PaymentStatus2["PENDING"] = "PENDING";
1883
+ PaymentStatus2["RESERVED"] = "RESERVED";
1884
+ PaymentStatus2["COMPLETED"] = "COMPLETED";
1885
+ PaymentStatus2["FAILED"] = "FAILED";
1886
+ PaymentStatus2["REFUNDED"] = "REFUNDED";
1887
+ return PaymentStatus2;
1888
+ })(PaymentStatus || {});
1889
+ var MerchantStatus = /* @__PURE__ */ ((MerchantStatus2) => {
1890
+ MerchantStatus2["ACTIVE"] = "ACTIVE";
1891
+ MerchantStatus2["SUSPENDED"] = "SUSPENDED";
1892
+ MerchantStatus2["PENDING"] = "PENDING";
1893
+ return MerchantStatus2;
1894
+ })(MerchantStatus || {});
1895
+ var ShipmentStatus = /* @__PURE__ */ ((ShipmentStatus2) => {
1896
+ ShipmentStatus2["PENDING"] = "PENDING";
1897
+ ShipmentStatus2["SHIPPED"] = "SHIPPED";
1898
+ ShipmentStatus2["DELIVERED"] = "DELIVERED";
1899
+ ShipmentStatus2["FAILED"] = "FAILED";
1900
+ return ShipmentStatus2;
1901
+ })(ShipmentStatus || {});
1902
+ var ReturnStatus = /* @__PURE__ */ ((ReturnStatus2) => {
1903
+ ReturnStatus2["REQUESTED"] = "REQUESTED";
1904
+ ReturnStatus2["APPROVED"] = "APPROVED";
1905
+ ReturnStatus2["REJECTED"] = "REJECTED";
1906
+ ReturnStatus2["SHIPPED_BACK"] = "SHIPPED_BACK";
1907
+ ReturnStatus2["RECEIVED"] = "RECEIVED";
1908
+ ReturnStatus2["REFUNDED"] = "REFUNDED";
1909
+ return ReturnStatus2;
1910
+ })(ReturnStatus || {});
1911
+ var ReviewStatus = /* @__PURE__ */ ((ReviewStatus2) => {
1912
+ ReviewStatus2["PENDING"] = "PENDING";
1913
+ ReviewStatus2["RESPONDED"] = "RESPONDED";
1914
+ ReviewStatus2["FLAGGED"] = "FLAGGED";
1915
+ return ReviewStatus2;
1916
+ })(ReviewStatus || {});
1917
+ var DiscountType = /* @__PURE__ */ ((DiscountType2) => {
1918
+ DiscountType2["PERCENTAGE"] = "PERCENTAGE";
1919
+ DiscountType2["FIXED_AMOUNT"] = "FIXED_AMOUNT";
1920
+ DiscountType2["BUY_X_GET_Y"] = "BUY_X_GET_Y";
1921
+ DiscountType2["FREE_SHIPPING"] = "FREE_SHIPPING";
1922
+ return DiscountType2;
1923
+ })(DiscountType || {});
1924
+ var DiscountMethod = /* @__PURE__ */ ((DiscountMethod2) => {
1925
+ DiscountMethod2["CODE"] = "CODE";
1926
+ DiscountMethod2["AUTOMATIC"] = "AUTOMATIC";
1927
+ return DiscountMethod2;
1928
+ })(DiscountMethod || {});
1929
+ var DiscountScope = /* @__PURE__ */ ((DiscountScope2) => {
1930
+ DiscountScope2["ORDER"] = "ORDER";
1931
+ DiscountScope2["PRODUCT"] = "PRODUCT";
1932
+ DiscountScope2["CATEGORY"] = "CATEGORY";
1933
+ DiscountScope2["SHIPPING"] = "SHIPPING";
1934
+ return DiscountScope2;
1935
+ })(DiscountScope || {});
1936
+ var BannerType = /* @__PURE__ */ ((BannerType2) => {
1937
+ BannerType2["HERO"] = "HERO";
1938
+ BannerType2["PROMO"] = "PROMO";
1939
+ BannerType2["FEATURED"] = "FEATURED";
1940
+ return BannerType2;
1941
+ })(BannerType || {});
1942
+ var TaxType = /* @__PURE__ */ ((TaxType2) => {
1943
+ TaxType2["SALES_TAX"] = "SALES_TAX";
1944
+ TaxType2["VAT"] = "VAT";
1945
+ TaxType2["GST"] = "GST";
1946
+ TaxType2["PST"] = "PST";
1947
+ TaxType2["HST"] = "HST";
1948
+ return TaxType2;
1949
+ })(TaxType || {});
1950
+ var TaxBehavior = /* @__PURE__ */ ((TaxBehavior2) => {
1951
+ TaxBehavior2["CHARGE"] = "CHARGE";
1952
+ TaxBehavior2["INCLUSIVE"] = "INCLUSIVE";
1953
+ TaxBehavior2["EXEMPT"] = "EXEMPT";
1954
+ return TaxBehavior2;
1955
+ })(TaxBehavior || {});
1956
+ var TaxReportPeriodType = /* @__PURE__ */ ((TaxReportPeriodType2) => {
1957
+ TaxReportPeriodType2["MONTHLY"] = "MONTHLY";
1958
+ TaxReportPeriodType2["QUARTERLY"] = "QUARTERLY";
1959
+ TaxReportPeriodType2["YEARLY"] = "YEARLY";
1960
+ return TaxReportPeriodType2;
1961
+ })(TaxReportPeriodType || {});
1962
+ var TaxReportStatus = /* @__PURE__ */ ((TaxReportStatus2) => {
1963
+ TaxReportStatus2["DRAFT"] = "DRAFT";
1964
+ TaxReportStatus2["FINALIZED"] = "FINALIZED";
1965
+ TaxReportStatus2["FILED"] = "FILED";
1966
+ return TaxReportStatus2;
1967
+ })(TaxReportStatus || {});
1968
+ var InventoryAuditAction = /* @__PURE__ */ ((InventoryAuditAction2) => {
1969
+ InventoryAuditAction2["CREATED"] = "CREATED";
1970
+ InventoryAuditAction2["UPDATED"] = "UPDATED";
1971
+ InventoryAuditAction2["RESERVED"] = "RESERVED";
1972
+ InventoryAuditAction2["DEDUCTED"] = "DEDUCTED";
1973
+ InventoryAuditAction2["RESTORED"] = "RESTORED";
1974
+ return InventoryAuditAction2;
1975
+ })(InventoryAuditAction || {});
1976
+ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
1977
+ SortOrder2["ASC"] = "asc";
1978
+ SortOrder2["DESC"] = "desc";
1979
+ return SortOrder2;
1980
+ })(SortOrder || {});
1981
+ var ProductSortBy = /* @__PURE__ */ ((ProductSortBy2) => {
1982
+ ProductSortBy2["DATE_DESC"] = "date_desc";
1983
+ ProductSortBy2["DATE_ASC"] = "date_asc";
1984
+ ProductSortBy2["PRICE_ASC"] = "price_asc";
1985
+ ProductSortBy2["PRICE_DESC"] = "price_desc";
1986
+ ProductSortBy2["POPULAR"] = "popular";
1987
+ ProductSortBy2["FEATURED"] = "featured";
1988
+ return ProductSortBy2;
1989
+ })(ProductSortBy || {});
1990
+ var ReviewSortBy = /* @__PURE__ */ ((ReviewSortBy2) => {
1991
+ ReviewSortBy2["NEWEST"] = "newest";
1992
+ ReviewSortBy2["HIGHEST"] = "highest";
1993
+ ReviewSortBy2["LOWEST"] = "lowest";
1994
+ return ReviewSortBy2;
1995
+ })(ReviewSortBy || {});
1996
+
1997
+ exports.BannerType = BannerType;
1998
+ exports.BaseEcommerceClient = BaseEcommerceClient;
1999
+ exports.CustomerEcommerceClient = CustomerEcommerceClient;
2000
+ exports.DiscountMethod = DiscountMethod;
2001
+ exports.DiscountScope = DiscountScope;
2002
+ exports.DiscountType = DiscountType;
2003
+ exports.EcommerceApiError = EcommerceApiError;
2004
+ exports.InventoryAuditAction = InventoryAuditAction;
2005
+ exports.MerchantEcommerceClient = MerchantEcommerceClient;
2006
+ exports.MerchantStatus = MerchantStatus;
2007
+ exports.OrderStatus = OrderStatus;
2008
+ exports.PaymentMethod = PaymentMethod;
2009
+ exports.PaymentStatus = PaymentStatus;
2010
+ exports.ProductSortBy = ProductSortBy;
2011
+ exports.ReturnStatus = ReturnStatus;
2012
+ exports.ReviewSortBy = ReviewSortBy;
2013
+ exports.ReviewStatus = ReviewStatus;
2014
+ exports.ShipmentStatus = ShipmentStatus;
2015
+ exports.SortOrder = SortOrder;
2016
+ exports.TaxBehavior = TaxBehavior;
2017
+ exports.TaxReportPeriodType = TaxReportPeriodType;
2018
+ exports.TaxReportStatus = TaxReportStatus;
2019
+ exports.TaxType = TaxType;
2020
+ exports.buildQueryString = buildQueryString;
2021
+ exports.calculateDiscountAmount = calculateDiscountAmount;
2022
+ exports.calculateFinalPrice = calculateFinalPrice;
2023
+ exports.formatPrice = formatPrice;
2024
+ exports.getBackoffDelay = getBackoffDelay;
2025
+ exports.isRetryableError = isRetryableError;
2026
+ exports.isValidAddress = isValidAddress;
2027
+ exports.isValidEmail = isValidEmail;
2028
+ exports.parseError = parseError;
2029
+ exports.retryWithBackoff = retryWithBackoff;
2030
+ exports.sleep = sleep;
2031
+ exports.truncateAddress = truncateAddress;