@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.
- package/dist/chunk-4GAKANLT.mjs +1987 -0
- package/dist/chunk-4UEJOM6W.mjs +1 -3
- package/dist/chunk-VBC6EQ7Q.mjs +235 -0
- package/dist/client-CgmiTuEX.d.mts +179 -0
- package/dist/client-CgmiTuEX.d.ts +179 -0
- package/dist/ecommerce.d.mts +3732 -0
- package/dist/ecommerce.d.ts +3732 -0
- package/dist/ecommerce.js +2031 -0
- package/dist/ecommerce.mjs +2 -0
- package/dist/index.d.mts +51 -43
- package/dist/index.d.ts +51 -43
- package/dist/index.js +2691 -205
- package/dist/index.mjs +68 -90
- package/dist/{meta-FVJIMALT.mjs → meta-JB5ITE27.mjs} +4 -10
- package/dist/meta-UOGUG3OW.mjs +3 -7
- package/dist/{perpDexs-GGL32HT4.mjs → perpDexs-3LRJ5ZHM.mjs} +37 -8
- package/dist/{perpDexs-G7V2QIM6.mjs → perpDexs-4ISLD7NX.mjs} +177 -32
- package/dist/react.d.mts +39 -0
- package/dist/react.d.ts +39 -0
- package/dist/react.js +268 -0
- package/dist/react.mjs +31 -0
- package/dist/{spotMeta-OD7S6HGW.mjs → spotMeta-GHXX7C5M.mjs} +24 -9
- package/dist/{spotMeta-PCN4Z4R3.mjs → spotMeta-IBBUP2SG.mjs} +54 -6
- package/dist/staticMeta-GM7T3OYL.mjs +3 -6
- package/dist/staticMeta-QV2KMX57.mjs +3 -6
- package/ecommerce.ts +15 -0
- package/index.ts +6 -0
- package/lib/ecommerce/QUICK_REFERENCE.md +211 -0
- package/lib/ecommerce/README.md +385 -0
- package/lib/ecommerce/USAGE_EXAMPLES.md +704 -0
- package/lib/ecommerce/client/base.ts +272 -0
- package/lib/ecommerce/client/customer.ts +522 -0
- package/lib/ecommerce/client/merchant.ts +1341 -0
- package/lib/ecommerce/index.ts +51 -0
- package/lib/ecommerce/types/entities.ts +722 -0
- package/lib/ecommerce/types/enums.ts +270 -0
- package/lib/ecommerce/types/index.ts +18 -0
- package/lib/ecommerce/types/requests.ts +525 -0
- package/lib/ecommerce/types/responses.ts +805 -0
- package/lib/ecommerce/utils/errors.ts +113 -0
- package/lib/ecommerce/utils/helpers.ts +131 -0
- package/lib/hip3/market-info.ts +1 -1
- package/lib/instrument/client.ts +351 -0
- package/lib/meta/data/mainnet/perpDexs.json +34 -4
- package/lib/meta/data/mainnet/spotMeta.json +21 -3
- package/lib/meta/data/testnet/meta.json +1 -3
- package/lib/meta/data/testnet/perpDexs.json +174 -28
- package/lib/meta/data/testnet/spotMeta.json +51 -0
- package/lib/react/InstrumentProvider.tsx +69 -0
- package/lib/utils/flooredDateTime.ts +55 -0
- package/lib/utils/time.ts +51 -0
- package/package.json +37 -11
- package/react.ts +1 -0
|
@@ -0,0 +1,805 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ecommerce API Response Types
|
|
3
|
+
*
|
|
4
|
+
* This module contains all response types for the ecommerce API.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
Product,
|
|
9
|
+
Order,
|
|
10
|
+
Merchant,
|
|
11
|
+
ProductReview,
|
|
12
|
+
UserShippingAddress,
|
|
13
|
+
Coupon,
|
|
14
|
+
ShippingMethod,
|
|
15
|
+
Shipment,
|
|
16
|
+
Return,
|
|
17
|
+
Banner,
|
|
18
|
+
MediaAsset,
|
|
19
|
+
Message,
|
|
20
|
+
TaxSettings,
|
|
21
|
+
TaxRule,
|
|
22
|
+
TaxNexus,
|
|
23
|
+
TaxReport,
|
|
24
|
+
InventoryAuditEntry,
|
|
25
|
+
CustomerSummary,
|
|
26
|
+
ProductVariant,
|
|
27
|
+
CouponUsage,
|
|
28
|
+
} from "./entities";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Base API response
|
|
32
|
+
*/
|
|
33
|
+
export interface ApiResponse<T = any> {
|
|
34
|
+
/** Response data */
|
|
35
|
+
data?: T;
|
|
36
|
+
/** Error message */
|
|
37
|
+
error?: string;
|
|
38
|
+
/** Success flag */
|
|
39
|
+
success?: boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Paginated response
|
|
44
|
+
*/
|
|
45
|
+
export interface PaginatedResponse<T> {
|
|
46
|
+
/** Items */
|
|
47
|
+
items: T[];
|
|
48
|
+
/** Total count */
|
|
49
|
+
total: number;
|
|
50
|
+
/** Limit */
|
|
51
|
+
limit: number;
|
|
52
|
+
/** Offset */
|
|
53
|
+
offset: number;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* List products response
|
|
58
|
+
*/
|
|
59
|
+
export interface ListProductsResponse extends PaginatedResponse<Product> {}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get product response
|
|
63
|
+
*
|
|
64
|
+
* Note: The API returns the product object directly, not wrapped in a `product` field.
|
|
65
|
+
* This type extends Product to be compatible with the actual API response.
|
|
66
|
+
*/
|
|
67
|
+
export type GetProductResponse = Product;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Create/Update product response
|
|
71
|
+
*/
|
|
72
|
+
export interface ProductResponse {
|
|
73
|
+
/** Product */
|
|
74
|
+
product: Product;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* List product variants response
|
|
79
|
+
*/
|
|
80
|
+
export interface ListProductVariantsResponse {
|
|
81
|
+
/** Variants */
|
|
82
|
+
variants: ProductVariant[];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Product variant response
|
|
87
|
+
*/
|
|
88
|
+
export interface ProductVariantResponse {
|
|
89
|
+
/** Variant */
|
|
90
|
+
variant: ProductVariant;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* List orders response
|
|
95
|
+
*/
|
|
96
|
+
export interface ListOrdersResponse extends PaginatedResponse<Order> {
|
|
97
|
+
/** Merchant information (for merchant endpoints) */
|
|
98
|
+
merchant?: Merchant;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Get order response
|
|
103
|
+
*/
|
|
104
|
+
export interface GetOrderResponse {
|
|
105
|
+
/** Order */
|
|
106
|
+
order: Order;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Create order response
|
|
111
|
+
*/
|
|
112
|
+
export interface CreateOrderResponse {
|
|
113
|
+
/** Created orders (array for multi-merchant checkout) */
|
|
114
|
+
orders: Order[];
|
|
115
|
+
/** Summary */
|
|
116
|
+
summary: {
|
|
117
|
+
/** Total amount */
|
|
118
|
+
totalAmount: string;
|
|
119
|
+
/** Order count */
|
|
120
|
+
orderCount: number;
|
|
121
|
+
/** Merchant names */
|
|
122
|
+
merchantNames: string[];
|
|
123
|
+
};
|
|
124
|
+
/** Escrow payment instructions (for USDC_ESCROW) */
|
|
125
|
+
escrow?: {
|
|
126
|
+
/** Escrow address */
|
|
127
|
+
address: string;
|
|
128
|
+
/** Amount in USDC */
|
|
129
|
+
amountUSDC: string;
|
|
130
|
+
};
|
|
131
|
+
/** Test mode flag */
|
|
132
|
+
testMode?: boolean;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Update order response
|
|
137
|
+
*/
|
|
138
|
+
export interface UpdateOrderResponse {
|
|
139
|
+
/** Updated order */
|
|
140
|
+
order: Order;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Confirm escrow deposit response
|
|
145
|
+
*/
|
|
146
|
+
export interface ConfirmEscrowDepositResponse {
|
|
147
|
+
/** Success flag */
|
|
148
|
+
ok: boolean;
|
|
149
|
+
/** Order ID */
|
|
150
|
+
orderId: string;
|
|
151
|
+
/** Order status */
|
|
152
|
+
status: string;
|
|
153
|
+
/** Deposit transaction hash */
|
|
154
|
+
depositTxHash: string | null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Order receipt response
|
|
159
|
+
*/
|
|
160
|
+
export interface OrderReceiptResponse {
|
|
161
|
+
/** Receipt */
|
|
162
|
+
receipt: {
|
|
163
|
+
/** Order number */
|
|
164
|
+
orderNumber: string;
|
|
165
|
+
/** Order ID */
|
|
166
|
+
orderId: string;
|
|
167
|
+
/** Order date */
|
|
168
|
+
orderDate: string;
|
|
169
|
+
/** Status */
|
|
170
|
+
status: string;
|
|
171
|
+
/** Customer */
|
|
172
|
+
customer: {
|
|
173
|
+
name: string;
|
|
174
|
+
email?: string;
|
|
175
|
+
};
|
|
176
|
+
/** Merchant */
|
|
177
|
+
merchant: {
|
|
178
|
+
name: string;
|
|
179
|
+
};
|
|
180
|
+
/** Shipping address */
|
|
181
|
+
shippingAddress: any;
|
|
182
|
+
/** Items */
|
|
183
|
+
items: Array<{
|
|
184
|
+
title: string;
|
|
185
|
+
quantity: number;
|
|
186
|
+
unitPrice: string;
|
|
187
|
+
totalPrice: string;
|
|
188
|
+
}>;
|
|
189
|
+
/** Subtotal */
|
|
190
|
+
subtotal: string;
|
|
191
|
+
/** Tax */
|
|
192
|
+
tax: string;
|
|
193
|
+
/** Shipping */
|
|
194
|
+
shipping: string;
|
|
195
|
+
/** Total */
|
|
196
|
+
total: string;
|
|
197
|
+
/** Payment */
|
|
198
|
+
payment: {
|
|
199
|
+
method: string;
|
|
200
|
+
status?: string;
|
|
201
|
+
transactionHash?: string | null;
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* List reviews response
|
|
208
|
+
*/
|
|
209
|
+
export interface ListReviewsResponse extends PaginatedResponse<ProductReview> {}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Create/Update review response
|
|
213
|
+
*/
|
|
214
|
+
export interface ReviewResponse {
|
|
215
|
+
/** Review */
|
|
216
|
+
review: ProductReview;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* List shipping addresses response
|
|
221
|
+
*/
|
|
222
|
+
export interface ListShippingAddressesResponse {
|
|
223
|
+
/** Addresses */
|
|
224
|
+
addresses: UserShippingAddress[];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Shipping address response
|
|
229
|
+
*/
|
|
230
|
+
export interface ShippingAddressResponse {
|
|
231
|
+
/** Address */
|
|
232
|
+
address: UserShippingAddress;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Applied discount
|
|
237
|
+
*/
|
|
238
|
+
export interface AppliedDiscount {
|
|
239
|
+
/** Coupon/discount ID */
|
|
240
|
+
id: string;
|
|
241
|
+
/** Code */
|
|
242
|
+
code: string;
|
|
243
|
+
/** Title */
|
|
244
|
+
title?: string | null;
|
|
245
|
+
/** Discount type */
|
|
246
|
+
discountType: string;
|
|
247
|
+
/** Discount amount */
|
|
248
|
+
discountAmount: number;
|
|
249
|
+
/** Description */
|
|
250
|
+
description?: string;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Calculate cart discounts response
|
|
255
|
+
*/
|
|
256
|
+
export interface CalculateCartDiscountsResponse {
|
|
257
|
+
/** Subtotal */
|
|
258
|
+
subtotal: number;
|
|
259
|
+
/** Discount amount */
|
|
260
|
+
discountAmount: number;
|
|
261
|
+
/** Total */
|
|
262
|
+
total: number;
|
|
263
|
+
/** Applied discounts */
|
|
264
|
+
appliedDiscounts: AppliedDiscount[];
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Validate discount response
|
|
269
|
+
*/
|
|
270
|
+
export interface ValidateDiscountResponse {
|
|
271
|
+
/** Is valid */
|
|
272
|
+
valid: boolean;
|
|
273
|
+
/** Error message */
|
|
274
|
+
error?: string;
|
|
275
|
+
/** Discount */
|
|
276
|
+
discount?: {
|
|
277
|
+
/** Coupon ID */
|
|
278
|
+
id: string;
|
|
279
|
+
/** Code */
|
|
280
|
+
code: string;
|
|
281
|
+
/** Title */
|
|
282
|
+
title?: string | null;
|
|
283
|
+
/** Discount type */
|
|
284
|
+
discountType: string;
|
|
285
|
+
/** Discount amount */
|
|
286
|
+
discountAmount: number;
|
|
287
|
+
};
|
|
288
|
+
/** Subtotal */
|
|
289
|
+
subtotal?: number;
|
|
290
|
+
/** Total */
|
|
291
|
+
total?: number;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Tax breakdown item
|
|
296
|
+
*/
|
|
297
|
+
export interface TaxBreakdownItem {
|
|
298
|
+
/** Tax type */
|
|
299
|
+
taxType: string;
|
|
300
|
+
/** Tax name */
|
|
301
|
+
taxName: string;
|
|
302
|
+
/** Tax rate */
|
|
303
|
+
taxRate: number;
|
|
304
|
+
/** Tax amount */
|
|
305
|
+
taxAmount: number;
|
|
306
|
+
/** Country */
|
|
307
|
+
country: string;
|
|
308
|
+
/** Region */
|
|
309
|
+
region?: string;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Calculate tax response
|
|
314
|
+
*/
|
|
315
|
+
export interface CalculateTaxResponse {
|
|
316
|
+
/** Subtotal */
|
|
317
|
+
subtotal: number;
|
|
318
|
+
/** Tax amount */
|
|
319
|
+
taxAmount: number;
|
|
320
|
+
/** Total */
|
|
321
|
+
total: number;
|
|
322
|
+
/** Tax breakdown */
|
|
323
|
+
breakdown: TaxBreakdownItem[];
|
|
324
|
+
/** Merchant tax details (for multi-merchant) */
|
|
325
|
+
merchantTaxDetails?: Array<{
|
|
326
|
+
merchantId: string;
|
|
327
|
+
subtotal: number;
|
|
328
|
+
taxAmount: number;
|
|
329
|
+
hasNexus: boolean;
|
|
330
|
+
breakdown: TaxBreakdownItem[];
|
|
331
|
+
}>;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Merchant profile response
|
|
336
|
+
*/
|
|
337
|
+
export interface MerchantProfileResponse {
|
|
338
|
+
/** Merchant */
|
|
339
|
+
merchant: Merchant;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* List coupons response
|
|
344
|
+
*/
|
|
345
|
+
export interface ListCouponsResponse {
|
|
346
|
+
/** Coupons */
|
|
347
|
+
coupons: Coupon[];
|
|
348
|
+
/** Stats */
|
|
349
|
+
stats: {
|
|
350
|
+
total: number;
|
|
351
|
+
active: number;
|
|
352
|
+
totalUsages: number;
|
|
353
|
+
totalDiscount: number;
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Coupon response
|
|
359
|
+
*/
|
|
360
|
+
export interface CouponResponse {
|
|
361
|
+
/** Coupon */
|
|
362
|
+
coupon: Coupon;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Get coupon with usages response
|
|
367
|
+
*/
|
|
368
|
+
export interface GetCouponResponse {
|
|
369
|
+
/** Coupon with usages */
|
|
370
|
+
coupon: Coupon & {
|
|
371
|
+
usages: Array<CouponUsage & {
|
|
372
|
+
user: {
|
|
373
|
+
username?: string;
|
|
374
|
+
};
|
|
375
|
+
}>;
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* List shipping methods response
|
|
381
|
+
*/
|
|
382
|
+
export interface ListShippingMethodsResponse {
|
|
383
|
+
/** Methods */
|
|
384
|
+
methods: ShippingMethod[];
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Shipping method response
|
|
389
|
+
*/
|
|
390
|
+
export interface ShippingMethodResponse {
|
|
391
|
+
/** Method */
|
|
392
|
+
method: ShippingMethod;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* List shipments response
|
|
397
|
+
*/
|
|
398
|
+
export interface ListShipmentsResponse {
|
|
399
|
+
/** Shipments */
|
|
400
|
+
shipments: Array<Shipment & {
|
|
401
|
+
order: {
|
|
402
|
+
id: string;
|
|
403
|
+
totalUSDC: string;
|
|
404
|
+
shippingAddress: any;
|
|
405
|
+
user: {
|
|
406
|
+
id: string;
|
|
407
|
+
username?: string;
|
|
408
|
+
};
|
|
409
|
+
};
|
|
410
|
+
}>;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* Shipment response
|
|
415
|
+
*/
|
|
416
|
+
export interface ShipmentResponse {
|
|
417
|
+
/** Shipment */
|
|
418
|
+
shipment: Shipment;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* List returns response
|
|
423
|
+
*/
|
|
424
|
+
export interface ListReturnsResponse {
|
|
425
|
+
/** Returns */
|
|
426
|
+
returns: Array<Return & {
|
|
427
|
+
user: {
|
|
428
|
+
id: string;
|
|
429
|
+
username?: string;
|
|
430
|
+
};
|
|
431
|
+
order: {
|
|
432
|
+
id: string;
|
|
433
|
+
totalUSDC: string;
|
|
434
|
+
};
|
|
435
|
+
}>;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Return response
|
|
440
|
+
*/
|
|
441
|
+
export interface ReturnResponse {
|
|
442
|
+
/** Return */
|
|
443
|
+
return: Return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* List banners response
|
|
448
|
+
*/
|
|
449
|
+
export interface ListBannersResponse {
|
|
450
|
+
/** Banners */
|
|
451
|
+
banners: Banner[];
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* Banner response
|
|
456
|
+
*/
|
|
457
|
+
export interface BannerResponse {
|
|
458
|
+
/** Banner */
|
|
459
|
+
banner: Banner;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* List media assets response
|
|
464
|
+
*/
|
|
465
|
+
export interface ListMediaAssetsResponse extends PaginatedResponse<MediaAsset> {}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Media asset response
|
|
469
|
+
*/
|
|
470
|
+
export interface MediaAssetResponse {
|
|
471
|
+
/** Asset */
|
|
472
|
+
asset: MediaAsset;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* List messages response
|
|
477
|
+
*/
|
|
478
|
+
export interface ListMessagesResponse {
|
|
479
|
+
/** Conversations */
|
|
480
|
+
conversations: Array<{
|
|
481
|
+
orderId: string;
|
|
482
|
+
orderNumber: string;
|
|
483
|
+
customer: {
|
|
484
|
+
id: string;
|
|
485
|
+
name?: string;
|
|
486
|
+
username?: string;
|
|
487
|
+
};
|
|
488
|
+
lastMessage: Message;
|
|
489
|
+
unreadCount: number;
|
|
490
|
+
messages: Message[];
|
|
491
|
+
}>;
|
|
492
|
+
/** Stats */
|
|
493
|
+
stats: {
|
|
494
|
+
total: number;
|
|
495
|
+
unread: number;
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Message response
|
|
501
|
+
*/
|
|
502
|
+
export interface MessageResponse {
|
|
503
|
+
/** Message */
|
|
504
|
+
message: Message;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Analytics overview
|
|
509
|
+
*/
|
|
510
|
+
export interface AnalyticsOverview {
|
|
511
|
+
/** Total revenue */
|
|
512
|
+
totalRevenue: number;
|
|
513
|
+
/** Revenue change percentage */
|
|
514
|
+
revenueChange: number;
|
|
515
|
+
/** Total orders */
|
|
516
|
+
totalOrders: number;
|
|
517
|
+
/** Orders change percentage */
|
|
518
|
+
ordersChange: number;
|
|
519
|
+
/** Average order value */
|
|
520
|
+
averageOrderValue: number;
|
|
521
|
+
/** AOV change percentage */
|
|
522
|
+
aovChange: number;
|
|
523
|
+
/** Total customers */
|
|
524
|
+
totalCustomers: number;
|
|
525
|
+
/** Customers change percentage */
|
|
526
|
+
customersChange: number;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Revenue by day
|
|
531
|
+
*/
|
|
532
|
+
export interface RevenueByDay {
|
|
533
|
+
/** Date */
|
|
534
|
+
date: string;
|
|
535
|
+
/** Revenue */
|
|
536
|
+
revenue: number;
|
|
537
|
+
/** Orders */
|
|
538
|
+
orders: number;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Top product
|
|
543
|
+
*/
|
|
544
|
+
export interface TopProduct {
|
|
545
|
+
/** Product ID */
|
|
546
|
+
id: string;
|
|
547
|
+
/** Name */
|
|
548
|
+
name: string;
|
|
549
|
+
/** Image */
|
|
550
|
+
image: string | null;
|
|
551
|
+
/** Sold count */
|
|
552
|
+
soldCount: number;
|
|
553
|
+
/** Revenue */
|
|
554
|
+
revenue: number;
|
|
555
|
+
/** View count */
|
|
556
|
+
viewCount: number;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Orders by status
|
|
561
|
+
*/
|
|
562
|
+
export interface OrdersByStatus {
|
|
563
|
+
/** Status */
|
|
564
|
+
status: string;
|
|
565
|
+
/** Count */
|
|
566
|
+
count: number;
|
|
567
|
+
/** Percentage */
|
|
568
|
+
percentage: number;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Recent order summary
|
|
573
|
+
*/
|
|
574
|
+
export interface RecentOrderSummary {
|
|
575
|
+
/** Order ID */
|
|
576
|
+
id: string;
|
|
577
|
+
/** Order number */
|
|
578
|
+
orderNumber: string;
|
|
579
|
+
/** Total amount */
|
|
580
|
+
totalAmount: number;
|
|
581
|
+
/** Status */
|
|
582
|
+
status: string;
|
|
583
|
+
/** Created at */
|
|
584
|
+
createdAt: string;
|
|
585
|
+
/** Buyer */
|
|
586
|
+
buyer: {
|
|
587
|
+
username?: string;
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* Get analytics response
|
|
593
|
+
*/
|
|
594
|
+
export interface GetAnalyticsResponse {
|
|
595
|
+
/** Overview */
|
|
596
|
+
overview: AnalyticsOverview;
|
|
597
|
+
/** Revenue by day */
|
|
598
|
+
revenueByDay: RevenueByDay[];
|
|
599
|
+
/** Top products */
|
|
600
|
+
topProducts: TopProduct[];
|
|
601
|
+
/** Orders by status */
|
|
602
|
+
ordersByStatus: OrdersByStatus[];
|
|
603
|
+
/** Recent orders */
|
|
604
|
+
recentOrders: RecentOrderSummary[];
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Product metrics
|
|
609
|
+
*/
|
|
610
|
+
export interface ProductMetrics {
|
|
611
|
+
/** Product ID */
|
|
612
|
+
id: string;
|
|
613
|
+
/** Name */
|
|
614
|
+
name: string;
|
|
615
|
+
/** Images */
|
|
616
|
+
images: string[];
|
|
617
|
+
/** View count */
|
|
618
|
+
viewCount: number;
|
|
619
|
+
/** Sold count */
|
|
620
|
+
soldCount: number;
|
|
621
|
+
/** Revenue */
|
|
622
|
+
revenue: number;
|
|
623
|
+
/** Average rating */
|
|
624
|
+
averageRating: number;
|
|
625
|
+
/** Review count */
|
|
626
|
+
reviewCount: number;
|
|
627
|
+
/** Wishlist count */
|
|
628
|
+
wishlistCount: number;
|
|
629
|
+
/** Conversion rate */
|
|
630
|
+
conversionRate: number;
|
|
631
|
+
/** Stock */
|
|
632
|
+
stock: number;
|
|
633
|
+
/** Is active */
|
|
634
|
+
isActive: boolean;
|
|
635
|
+
/** Featured */
|
|
636
|
+
featured: boolean;
|
|
637
|
+
/** Created at */
|
|
638
|
+
createdAt: string;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Get product metrics response
|
|
643
|
+
*/
|
|
644
|
+
export interface GetProductMetricsResponse {
|
|
645
|
+
/** Products */
|
|
646
|
+
products: ProductMetrics[];
|
|
647
|
+
/** Summary */
|
|
648
|
+
summary: {
|
|
649
|
+
totalProducts: number;
|
|
650
|
+
totalViews: number;
|
|
651
|
+
totalSales: number;
|
|
652
|
+
totalRevenue: number;
|
|
653
|
+
averageConversion: number;
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* List inventory audit response
|
|
659
|
+
*/
|
|
660
|
+
export interface ListInventoryAuditResponse {
|
|
661
|
+
/** Entries */
|
|
662
|
+
entries: Array<InventoryAuditEntry & {
|
|
663
|
+
product: {
|
|
664
|
+
id: string;
|
|
665
|
+
title: string;
|
|
666
|
+
images: string[];
|
|
667
|
+
};
|
|
668
|
+
variant?: {
|
|
669
|
+
id: string;
|
|
670
|
+
name: string;
|
|
671
|
+
};
|
|
672
|
+
}>;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* List customers response
|
|
677
|
+
*/
|
|
678
|
+
export interface ListCustomersResponse extends PaginatedResponse<CustomerSummary> {}
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Tax settings response
|
|
682
|
+
*/
|
|
683
|
+
export interface TaxSettingsResponse {
|
|
684
|
+
/** Settings */
|
|
685
|
+
settings: TaxSettings;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* List tax rules response
|
|
690
|
+
*/
|
|
691
|
+
export interface ListTaxRulesResponse {
|
|
692
|
+
/** Rules */
|
|
693
|
+
rules: TaxRule[];
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/**
|
|
697
|
+
* Tax rule response
|
|
698
|
+
*/
|
|
699
|
+
export interface TaxRuleResponse {
|
|
700
|
+
/** Rule */
|
|
701
|
+
rule: TaxRule;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
/**
|
|
705
|
+
* List tax nexus response
|
|
706
|
+
*/
|
|
707
|
+
export interface ListTaxNexusResponse {
|
|
708
|
+
/** Nexus */
|
|
709
|
+
nexus: TaxNexus[];
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Tax nexus response
|
|
714
|
+
*/
|
|
715
|
+
export interface TaxNexusResponse {
|
|
716
|
+
/** Nexus */
|
|
717
|
+
nexus: TaxNexus;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* List tax reports response
|
|
722
|
+
*/
|
|
723
|
+
export interface ListTaxReportsResponse extends PaginatedResponse<TaxReport> {
|
|
724
|
+
/** Summary (if year filter is provided) */
|
|
725
|
+
summary?: {
|
|
726
|
+
year: number;
|
|
727
|
+
totalTaxable: string;
|
|
728
|
+
totalTax: string;
|
|
729
|
+
reportCount: number;
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* Tax report details
|
|
735
|
+
*/
|
|
736
|
+
export interface TaxReportDetails {
|
|
737
|
+
/** Order ID */
|
|
738
|
+
orderId: string;
|
|
739
|
+
/** Order date */
|
|
740
|
+
orderDate: string;
|
|
741
|
+
/** Customer */
|
|
742
|
+
customer: string;
|
|
743
|
+
/** Subtotal */
|
|
744
|
+
subtotal: string;
|
|
745
|
+
/** Tax amount */
|
|
746
|
+
taxAmount: string;
|
|
747
|
+
/** Total */
|
|
748
|
+
total: string;
|
|
749
|
+
/** Tax breakdown */
|
|
750
|
+
breakdown: TaxBreakdownItem[];
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Get tax report response
|
|
755
|
+
*/
|
|
756
|
+
export interface GetTaxReportResponse {
|
|
757
|
+
/** Report */
|
|
758
|
+
report: TaxReport;
|
|
759
|
+
/** Details */
|
|
760
|
+
details: TaxReportDetails[];
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Tax report response
|
|
765
|
+
*/
|
|
766
|
+
export interface TaxReportResponse {
|
|
767
|
+
/** Report */
|
|
768
|
+
report: TaxReport;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Success response
|
|
773
|
+
*/
|
|
774
|
+
export interface SuccessResponse {
|
|
775
|
+
/** Success flag */
|
|
776
|
+
success: boolean;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Product discounts response
|
|
781
|
+
*/
|
|
782
|
+
export interface ProductDiscountsResponse {
|
|
783
|
+
/** Discounts */
|
|
784
|
+
discounts: Array<{
|
|
785
|
+
id: string;
|
|
786
|
+
title: string;
|
|
787
|
+
description: string;
|
|
788
|
+
badge: string;
|
|
789
|
+
discountType: string;
|
|
790
|
+
discountValue: number;
|
|
791
|
+
discountAmount: number;
|
|
792
|
+
minPurchase: number | null;
|
|
793
|
+
minQuantity: number | null;
|
|
794
|
+
expiresAt: string;
|
|
795
|
+
}>;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
/**
|
|
799
|
+
* Create order event response
|
|
800
|
+
*/
|
|
801
|
+
export interface CreateOrderEventResponse {
|
|
802
|
+
/** Event */
|
|
803
|
+
event: any;
|
|
804
|
+
}
|
|
805
|
+
|