@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,525 @@
1
+ /**
2
+ * Ecommerce API Request Types
3
+ *
4
+ * This module contains all request types for the ecommerce API.
5
+ */
6
+
7
+ import {
8
+ OrderStatus,
9
+ PaymentMethod,
10
+ ProductSortBy,
11
+ ReviewSortBy,
12
+ DiscountType,
13
+ DiscountMethod,
14
+ DiscountScope,
15
+ BannerType,
16
+ TaxType,
17
+ TaxBehavior,
18
+ TaxReportPeriodType,
19
+ ShipmentStatus,
20
+ } from "./enums";
21
+ import { ShippingAddress, ProductDimensions } from "./entities";
22
+
23
+ /**
24
+ * Pagination parameters
25
+ */
26
+ export interface PaginationParams {
27
+ /** Number of items to return */
28
+ limit?: number;
29
+ /** Number of items to skip */
30
+ offset?: number;
31
+ }
32
+
33
+ /**
34
+ * List products request parameters
35
+ */
36
+ export interface ListProductsParams extends PaginationParams {
37
+ /** Filter by specific product IDs */
38
+ ids?: string[];
39
+ /** Filter by merchant ID */
40
+ merchantId?: string;
41
+ /** Filter by category slug */
42
+ category?: string;
43
+ /** Search query */
44
+ search?: string;
45
+ /** Filter by tags */
46
+ tags?: string[];
47
+ /** Minimum price */
48
+ minPrice?: number;
49
+ /** Maximum price */
50
+ maxPrice?: number;
51
+ /** Filter by featured status */
52
+ featured?: boolean;
53
+ /** Sort by */
54
+ sortBy?: ProductSortBy;
55
+ /** Filter by active status */
56
+ isActive?: boolean;
57
+ }
58
+
59
+ /**
60
+ * Create product request
61
+ */
62
+ export interface CreateProductRequest {
63
+ /** Product title */
64
+ title: string;
65
+ /** Product images URLs (from media library) */
66
+ images: string[];
67
+ /** Price in USDC */
68
+ priceUSDC: number;
69
+ /** Compare at price */
70
+ compareAtPrice?: number | null;
71
+ /** Inventory count */
72
+ inventory?: number | null;
73
+ /** SKU */
74
+ sku?: string | null;
75
+ /** Minimum order quantity */
76
+ moq?: number;
77
+ /** Category slug */
78
+ category?: string | null;
79
+ /** Rich description (HTML) */
80
+ richDescription?: string | null;
81
+ /** Weight in kg */
82
+ weight?: number | null;
83
+ /** Dimensions */
84
+ dimensions?: ProductDimensions | null;
85
+ /** Is active */
86
+ isActive?: boolean;
87
+ }
88
+
89
+ /**
90
+ * Update product request
91
+ */
92
+ export interface UpdateProductRequest extends Partial<CreateProductRequest> {}
93
+
94
+ /**
95
+ * Create product variant request
96
+ */
97
+ export interface CreateProductVariantRequest {
98
+ /** Variant name */
99
+ name: string;
100
+ /** SKU */
101
+ sku?: string | null;
102
+ /** Price override */
103
+ priceUSDC?: number | null;
104
+ /** Inventory count */
105
+ inventory?: number | null;
106
+ /** Variant attributes */
107
+ attributes: Record<string, string>;
108
+ /** Is active */
109
+ isActive?: boolean;
110
+ /** Sort order */
111
+ sortOrder?: number;
112
+ }
113
+
114
+ /**
115
+ * Update product variant request
116
+ */
117
+ export interface UpdateProductVariantRequest extends Partial<CreateProductVariantRequest> {}
118
+
119
+ /**
120
+ * Cart item
121
+ */
122
+ export interface CartItem {
123
+ /** Product ID */
124
+ productId: string;
125
+ /** Quantity */
126
+ quantity: number;
127
+ /** Variant ID (optional) */
128
+ variantId?: string;
129
+ }
130
+
131
+ /**
132
+ * Create order request
133
+ */
134
+ export interface CreateOrderRequest {
135
+ /** Cart items */
136
+ items: CartItem[];
137
+ /** Payment method */
138
+ paymentMethod: PaymentMethod;
139
+ /** Shipping address */
140
+ shippingAddress: ShippingAddress;
141
+ /** Customer notes */
142
+ customerNotes?: string;
143
+ /** Coupon code */
144
+ couponCode?: string;
145
+ /** Idempotency key */
146
+ idempotencyKey?: string;
147
+ }
148
+
149
+ /**
150
+ * List orders request parameters
151
+ */
152
+ export interface ListOrdersParams extends PaginationParams {
153
+ /** Filter by status */
154
+ status?: OrderStatus;
155
+ }
156
+
157
+ /**
158
+ * Update order status request
159
+ */
160
+ export interface UpdateOrderStatusRequest {
161
+ /** New status */
162
+ status: OrderStatus;
163
+ /** Tracking information (required for SHIPPED status) */
164
+ tracking?: {
165
+ trackingNumber: string;
166
+ carrier: string;
167
+ };
168
+ }
169
+
170
+ /**
171
+ * Create order event request
172
+ */
173
+ export interface CreateOrderEventRequest {
174
+ /** Event type */
175
+ eventType: string;
176
+ /** Event title */
177
+ title: string;
178
+ /** Event description */
179
+ description?: string;
180
+ /** Event metadata */
181
+ metadata?: Record<string, any>;
182
+ }
183
+
184
+ /**
185
+ * Create review request
186
+ */
187
+ export interface CreateReviewRequest {
188
+ /** Rating (1-5) */
189
+ rating: number;
190
+ /** Review title */
191
+ title?: string;
192
+ /** Review comment */
193
+ comment?: string;
194
+ }
195
+
196
+ /**
197
+ * List reviews request parameters
198
+ */
199
+ export interface ListReviewsParams extends PaginationParams {
200
+ /** Sort by */
201
+ sortBy?: ReviewSortBy;
202
+ }
203
+
204
+ /**
205
+ * Respond to review request
206
+ */
207
+ export interface RespondToReviewRequest {
208
+ /** Merchant response */
209
+ merchantResponse: string;
210
+ }
211
+
212
+ /**
213
+ * Create/update shipping address request
214
+ */
215
+ export interface ShippingAddressRequest extends ShippingAddress {
216
+ /** Is default address */
217
+ isDefault?: boolean;
218
+ /** Address label */
219
+ label?: string | null;
220
+ }
221
+
222
+ /**
223
+ * Calculate cart discounts request
224
+ */
225
+ export interface CalculateCartDiscountsRequest {
226
+ /** Cart items */
227
+ items: CartItem[];
228
+ }
229
+
230
+ /**
231
+ * Validate discount code request
232
+ */
233
+ export interface ValidateDiscountRequest {
234
+ /** Discount code */
235
+ code: string;
236
+ /** Cart items */
237
+ items: CartItem[];
238
+ }
239
+
240
+ /**
241
+ * Calculate tax request
242
+ */
243
+ export interface CalculateTaxRequest {
244
+ /** Cart items */
245
+ items: CartItem[];
246
+ /** Shipping address */
247
+ shippingAddress: {
248
+ country: string;
249
+ region?: string;
250
+ postalCode?: string;
251
+ };
252
+ }
253
+
254
+ /**
255
+ * Create/update merchant profile request
256
+ */
257
+ export interface MerchantProfileRequest {
258
+ /** Merchant name */
259
+ name: string;
260
+ /** Description */
261
+ description?: string | null;
262
+ /** Payout address (wallet) */
263
+ payoutAddress: string;
264
+ }
265
+
266
+ /**
267
+ * Create coupon request
268
+ */
269
+ export interface CreateCouponRequest {
270
+ /** Coupon code */
271
+ code?: string;
272
+ /** Title */
273
+ title?: string | null;
274
+ /** Discount method */
275
+ discountMethod?: DiscountMethod;
276
+ /** Discount type */
277
+ discountType: DiscountType;
278
+ /** Discount scope */
279
+ discountScope?: DiscountScope;
280
+ /** Discount value */
281
+ discountValue: number;
282
+ /** Minimum purchase */
283
+ minPurchase?: number | null;
284
+ /** Minimum quantity */
285
+ minQuantity?: number | null;
286
+ /** Buy quantity */
287
+ buyQuantity?: number | null;
288
+ /** Get quantity */
289
+ getQuantity?: number | null;
290
+ /** Get discount value */
291
+ getDiscountValue?: number | null;
292
+ /** Maximum uses */
293
+ maxUses?: number | null;
294
+ /** Uses per customer */
295
+ usesPerCustomer?: number | null;
296
+ /** Applicable products */
297
+ applicableProducts?: string[];
298
+ /** Applicable categories */
299
+ applicableCategories?: string[];
300
+ /** Combinable */
301
+ combinable?: boolean;
302
+ /** Start date */
303
+ startsAt: string;
304
+ /** Expiry date */
305
+ expiresAt: string;
306
+ /** Is active */
307
+ isActive?: boolean;
308
+ }
309
+
310
+ /**
311
+ * Update coupon request
312
+ */
313
+ export interface UpdateCouponRequest extends Partial<CreateCouponRequest> {}
314
+
315
+ /**
316
+ * Create shipping method request
317
+ */
318
+ export interface CreateShippingMethodRequest {
319
+ /** Method name */
320
+ name: string;
321
+ /** Carrier */
322
+ carrier?: string | null;
323
+ /** Estimated delivery days */
324
+ estimatedDays?: string | null;
325
+ /** Flat rate */
326
+ flatRate?: number | null;
327
+ /** Weight-based */
328
+ weightBased?: boolean;
329
+ /** Free threshold */
330
+ freeThreshold?: number | null;
331
+ /** Is active */
332
+ isActive?: boolean;
333
+ }
334
+
335
+ /**
336
+ * Update shipping method request
337
+ */
338
+ export interface UpdateShippingMethodRequest extends Partial<CreateShippingMethodRequest> {}
339
+
340
+ /**
341
+ * Update shipment request
342
+ */
343
+ export interface UpdateShipmentRequest {
344
+ /** Shipment status */
345
+ status?: ShipmentStatus;
346
+ /** Tracking number */
347
+ trackingNumber?: string | null;
348
+ /** Carrier */
349
+ carrier?: string | null;
350
+ /** Shipping label URL */
351
+ shippingLabel?: string | null;
352
+ }
353
+
354
+ /**
355
+ * Create banner request
356
+ */
357
+ export interface CreateBannerRequest {
358
+ /** Banner type */
359
+ type?: BannerType;
360
+ /** Title */
361
+ title: string;
362
+ /** Subtitle */
363
+ subtitle?: string | null;
364
+ /** Image URL */
365
+ imageUrl: string;
366
+ /** Link URL */
367
+ linkUrl?: string | null;
368
+ /** CTA text */
369
+ ctaText?: string | null;
370
+ /** Start date */
371
+ startDate?: string | null;
372
+ /** End date */
373
+ endDate?: string | null;
374
+ /** Priority */
375
+ priority?: number;
376
+ /** Is active */
377
+ isActive?: boolean;
378
+ }
379
+
380
+ /**
381
+ * Update banner request
382
+ */
383
+ export interface UpdateBannerRequest extends Partial<CreateBannerRequest> {}
384
+
385
+ /**
386
+ * Track banner request
387
+ */
388
+ export interface TrackBannerRequest {
389
+ /** Action type */
390
+ action: "impression" | "click";
391
+ }
392
+
393
+ /**
394
+ * Send message request
395
+ */
396
+ export interface SendMessageRequest {
397
+ /** Order ID */
398
+ orderId: string;
399
+ /** Recipient user ID */
400
+ recipientId: string;
401
+ /** Message text */
402
+ message: string;
403
+ }
404
+
405
+ /**
406
+ * Update tax settings request
407
+ */
408
+ export interface UpdateTaxSettingsRequest {
409
+ /** Tax enabled */
410
+ taxEnabled?: boolean;
411
+ /** Prices include tax */
412
+ pricesIncludeTax?: boolean;
413
+ /** Default tax behavior */
414
+ defaultTaxBehavior?: TaxBehavior;
415
+ /** Tax registration number */
416
+ taxRegistrationNumber?: string | null;
417
+ /** Registration country */
418
+ registrationCountry?: string | null;
419
+ }
420
+
421
+ /**
422
+ * Create tax rule request
423
+ */
424
+ export interface CreateTaxRuleRequest {
425
+ /** Country */
426
+ country: string;
427
+ /** Region */
428
+ region?: string | null;
429
+ /** Postal code from */
430
+ postalCodeFrom?: string | null;
431
+ /** Postal code to */
432
+ postalCodeTo?: string | null;
433
+ /** Tax type */
434
+ taxType: TaxType;
435
+ /** Tax name */
436
+ taxName: string;
437
+ /** Tax rate */
438
+ taxRate: number;
439
+ /** Priority */
440
+ priority?: number;
441
+ /** Is compound */
442
+ isCompound?: boolean;
443
+ }
444
+
445
+ /**
446
+ * Update tax rule request
447
+ */
448
+ export interface UpdateTaxRuleRequest extends Partial<CreateTaxRuleRequest> {
449
+ /** Is active */
450
+ isActive?: boolean;
451
+ }
452
+
453
+ /**
454
+ * Create tax nexus request
455
+ */
456
+ export interface CreateTaxNexusRequest {
457
+ /** Country */
458
+ country: string;
459
+ /** Region */
460
+ region?: string | null;
461
+ /** Registration ID */
462
+ registrationId?: string | null;
463
+ }
464
+
465
+ /**
466
+ * Update tax nexus request
467
+ */
468
+ export interface UpdateTaxNexusRequest {
469
+ /** Registration ID */
470
+ registrationId?: string | null;
471
+ /** Is active */
472
+ isActive?: boolean;
473
+ }
474
+
475
+ /**
476
+ * Generate tax report request
477
+ */
478
+ export interface GenerateTaxReportRequest {
479
+ /** Period type */
480
+ periodType: TaxReportPeriodType;
481
+ /** Year */
482
+ year: number;
483
+ /** Period (1-12 for monthly, 1-4 for quarterly, 1 for yearly) */
484
+ period: number;
485
+ }
486
+
487
+ /**
488
+ * Update tax report status request
489
+ */
490
+ export interface UpdateTaxReportStatusRequest {
491
+ /** Report status */
492
+ status: "DRAFT" | "FINALIZED" | "FILED";
493
+ }
494
+
495
+ /**
496
+ * List tax reports params
497
+ */
498
+ export interface ListTaxReportsParams extends PaginationParams {
499
+ /** Filter by year (for summary) */
500
+ year?: number;
501
+ }
502
+
503
+ /**
504
+ * Get analytics params
505
+ */
506
+ export interface GetAnalyticsParams {
507
+ /** Date range */
508
+ range?: "7days" | "30days" | "90days" | "1year";
509
+ }
510
+
511
+ /**
512
+ * List customers params
513
+ */
514
+ export interface ListCustomersParams extends PaginationParams {}
515
+
516
+ /**
517
+ * List active banners params
518
+ */
519
+ export interface ListActiveBannersParams {
520
+ /** Filter by type */
521
+ type?: BannerType;
522
+ /** Filter by merchant ID */
523
+ merchantId?: string;
524
+ }
525
+