@classytic/commerce-sdk 0.1.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.

Potentially problematic release.


This version of @classytic/commerce-sdk might be problematic. Click here for more details.

Files changed (131) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +104 -0
  3. package/dist/adjustment-DTSLM7AN.js +5 -0
  4. package/dist/adjustment-DTSLM7AN.js.map +1 -0
  5. package/dist/analytics/index.d.ts +27 -0
  6. package/dist/analytics/index.js +6 -0
  7. package/dist/analytics/index.js.map +1 -0
  8. package/dist/analytics-DMcD-o8w.d.ts +76 -0
  9. package/dist/api-factory-B_h4RKBm.d.ts +280 -0
  10. package/dist/auth/index.d.ts +39 -0
  11. package/dist/auth/index.js +5 -0
  12. package/dist/auth/index.js.map +1 -0
  13. package/dist/catalog/index.d.ts +479 -0
  14. package/dist/catalog/index.js +9 -0
  15. package/dist/catalog/index.js.map +1 -0
  16. package/dist/chunk-4ZQK3FFN.js +40 -0
  17. package/dist/chunk-4ZQK3FFN.js.map +1 -0
  18. package/dist/chunk-5L6EXDGH.js +465 -0
  19. package/dist/chunk-5L6EXDGH.js.map +1 -0
  20. package/dist/chunk-5ZFW3FEI.js +183 -0
  21. package/dist/chunk-5ZFW3FEI.js.map +1 -0
  22. package/dist/chunk-66OQAZSL.js +94 -0
  23. package/dist/chunk-66OQAZSL.js.map +1 -0
  24. package/dist/chunk-6RYGA6MF.js +123 -0
  25. package/dist/chunk-6RYGA6MF.js.map +1 -0
  26. package/dist/chunk-B6MPVOV7.js +328 -0
  27. package/dist/chunk-B6MPVOV7.js.map +1 -0
  28. package/dist/chunk-BDA2WSJA.js +148 -0
  29. package/dist/chunk-BDA2WSJA.js.map +1 -0
  30. package/dist/chunk-EIVYT3HM.js +126 -0
  31. package/dist/chunk-EIVYT3HM.js.map +1 -0
  32. package/dist/chunk-EPQN7ZKZ.js +27 -0
  33. package/dist/chunk-EPQN7ZKZ.js.map +1 -0
  34. package/dist/chunk-FA7QFJ2G.js +177 -0
  35. package/dist/chunk-FA7QFJ2G.js.map +1 -0
  36. package/dist/chunk-I5TIKUIQ.js +261 -0
  37. package/dist/chunk-I5TIKUIQ.js.map +1 -0
  38. package/dist/chunk-ILQUH444.js +135 -0
  39. package/dist/chunk-ILQUH444.js.map +1 -0
  40. package/dist/chunk-IXMWZJLV.js +616 -0
  41. package/dist/chunk-IXMWZJLV.js.map +1 -0
  42. package/dist/chunk-KZIGRIQG.js +75 -0
  43. package/dist/chunk-KZIGRIQG.js.map +1 -0
  44. package/dist/chunk-OF5M6R2S.js +769 -0
  45. package/dist/chunk-OF5M6R2S.js.map +1 -0
  46. package/dist/chunk-PYYLHUV6.js +3 -0
  47. package/dist/chunk-PYYLHUV6.js.map +1 -0
  48. package/dist/chunk-QO5AGZFP.js +159 -0
  49. package/dist/chunk-QO5AGZFP.js.map +1 -0
  50. package/dist/chunk-QUMTBLNE.js +76 -0
  51. package/dist/chunk-QUMTBLNE.js.map +1 -0
  52. package/dist/chunk-R5Z7NYLH.js +126 -0
  53. package/dist/chunk-R5Z7NYLH.js.map +1 -0
  54. package/dist/chunk-SZYWG5IB.js +75 -0
  55. package/dist/chunk-SZYWG5IB.js.map +1 -0
  56. package/dist/chunk-U3XT35GZ.js +202 -0
  57. package/dist/chunk-U3XT35GZ.js.map +1 -0
  58. package/dist/chunk-UGELTUIZ.js +830 -0
  59. package/dist/chunk-UGELTUIZ.js.map +1 -0
  60. package/dist/chunk-VR36QVX2.js +122 -0
  61. package/dist/chunk-VR36QVX2.js.map +1 -0
  62. package/dist/chunk-WUOQK7BO.js +13 -0
  63. package/dist/chunk-WUOQK7BO.js.map +1 -0
  64. package/dist/chunk-X6PV5MHG.js +582 -0
  65. package/dist/chunk-X6PV5MHG.js.map +1 -0
  66. package/dist/chunk-ZWLMFLLH.js +534 -0
  67. package/dist/chunk-ZWLMFLLH.js.map +1 -0
  68. package/dist/content/index.d.ts +309 -0
  69. package/dist/content/index.js +6 -0
  70. package/dist/content/index.js.map +1 -0
  71. package/dist/core/index.d.ts +107 -0
  72. package/dist/core/index.js +5 -0
  73. package/dist/core/index.js.map +1 -0
  74. package/dist/core/react.d.ts +107 -0
  75. package/dist/core/react.js +5 -0
  76. package/dist/core/react.js.map +1 -0
  77. package/dist/coupon-CHFcw7cd.d.ts +632 -0
  78. package/dist/coupon-zGkvO-Xx.d.ts +129 -0
  79. package/dist/crud.factory-DyKaPHcU.d.ts +181 -0
  80. package/dist/finance/index.d.ts +81 -0
  81. package/dist/finance/index.js +5 -0
  82. package/dist/finance/index.js.map +1 -0
  83. package/dist/finance-BJdfKRw0.d.ts +135 -0
  84. package/dist/index.d.ts +31 -0
  85. package/dist/index.js +29 -0
  86. package/dist/index.js.map +1 -0
  87. package/dist/inventory/index.d.ts +512 -0
  88. package/dist/inventory/index.js +16 -0
  89. package/dist/inventory/index.js.map +1 -0
  90. package/dist/inventory-DCiIZh8P.d.ts +742 -0
  91. package/dist/logistics/index.d.ts +226 -0
  92. package/dist/logistics/index.js +7 -0
  93. package/dist/logistics/index.js.map +1 -0
  94. package/dist/logistics-V8a9lUN3.d.ts +428 -0
  95. package/dist/media-CNLJK93J.d.ts +721 -0
  96. package/dist/movement-7MV3ADY5.js +5 -0
  97. package/dist/movement-7MV3ADY5.js.map +1 -0
  98. package/dist/payment-BRboLqvU.d.ts +127 -0
  99. package/dist/payments/index.d.ts +55 -0
  100. package/dist/payments/index.js +6 -0
  101. package/dist/payments/index.js.map +1 -0
  102. package/dist/platform/index.d.ts +645 -0
  103. package/dist/platform/index.js +8 -0
  104. package/dist/platform/index.js.map +1 -0
  105. package/dist/pos-D1jkkFl0.d.ts +885 -0
  106. package/dist/product-p09zXkXB.d.ts +260 -0
  107. package/dist/purchase-24BGT2HA.js +5 -0
  108. package/dist/purchase-24BGT2HA.js.map +1 -0
  109. package/dist/request-652PS6VR.js +5 -0
  110. package/dist/request-652PS6VR.js.map +1 -0
  111. package/dist/sales/index.d.ts +585 -0
  112. package/dist/sales/index.js +9 -0
  113. package/dist/sales/index.js.map +1 -0
  114. package/dist/server.d.ts +120 -0
  115. package/dist/server.js +27 -0
  116. package/dist/server.js.map +1 -0
  117. package/dist/size-guide-DgjzjM5P.d.ts +554 -0
  118. package/dist/stock-DEApGC-w.d.ts +632 -0
  119. package/dist/stock-OOUW57VQ.js +5 -0
  120. package/dist/stock-OOUW57VQ.js.map +1 -0
  121. package/dist/supplier-OC6JAWV6.js +5 -0
  122. package/dist/supplier-OC6JAWV6.js.map +1 -0
  123. package/dist/transaction/index.d.ts +104 -0
  124. package/dist/transaction/index.js +8 -0
  125. package/dist/transaction/index.js.map +1 -0
  126. package/dist/transaction-BTmoHpWh.d.ts +428 -0
  127. package/dist/transaction-u5oaNuav.d.ts +84 -0
  128. package/dist/transfer-7SYSH3RG.js +5 -0
  129. package/dist/transfer-7SYSH3RG.js.map +1 -0
  130. package/dist/user-data-DdLjAGwO.d.ts +132 -0
  131. package/package.json +146 -0
@@ -0,0 +1,885 @@
1
+ import { e as Product, b as ProductVariant } from './product-p09zXkXB.js';
2
+ import { P as PaginatedResponse, A as ApiResponse, B as BaseApi, R as RequestOptions } from './api-factory-B_h4RKBm.js';
3
+ import { a as PosProductsResponse, g as PosLookupResponse, l as PosOrderPayload, ac as CreateAdjustmentPayload, ad as BulkAdjustmentPayload } from './inventory-DCiIZh8P.js';
4
+
5
+ /**
6
+ * Cart Types
7
+ *
8
+ * Type definitions for shopping cart matching the backend cart schema.
9
+ */
10
+
11
+ /**
12
+ * Cart Item (Backend Response Format)
13
+ * Represents a single item in the shopping cart as returned by API
14
+ */
15
+ interface CartItem {
16
+ /** Cart item ID (for update/remove operations via PATCH/DELETE /cart/items/:itemId) */
17
+ _id: string;
18
+ /** Product reference (fully populated Product object from backend) */
19
+ product: Product;
20
+ /**
21
+ * Variant SKU (optional)
22
+ * - null/undefined for simple products
23
+ * - Required for variant products (e.g., "TSHIRT-M-RED")
24
+ * - Must match a valid variant.sku from product.variants[]
25
+ */
26
+ variantSku?: string | null;
27
+ /** Quantity of this item (minimum: 1) */
28
+ quantity: number;
29
+ }
30
+ /**
31
+ * Shopping Cart
32
+ * Represents a user's shopping cart
33
+ */
34
+ interface Cart {
35
+ /** Cart ID */
36
+ _id: string;
37
+ /** User/Customer ID */
38
+ user: string;
39
+ /** Cart items */
40
+ items: CartItem[];
41
+ /** Creation timestamp */
42
+ createdAt: string;
43
+ /** Last update timestamp */
44
+ updatedAt: string;
45
+ }
46
+ /**
47
+ * Populated Cart Item
48
+ * Cart item with fully populated product for display
49
+ */
50
+ interface PopulatedCartItem {
51
+ /** Fully populated product */
52
+ product: Product;
53
+ /** Variant SKU */
54
+ variantSku?: string | null;
55
+ /** Quantity */
56
+ quantity: number;
57
+ /** Resolved variant (if variantSku is provided) */
58
+ variant?: ProductVariant;
59
+ /** Final price (basePrice + variant.priceModifier) */
60
+ finalPrice: number;
61
+ /** Line total (finalPrice * quantity) */
62
+ lineTotal: number;
63
+ }
64
+ /**
65
+ * Cart Summary
66
+ * Complete cart with computed totals
67
+ */
68
+ interface CartSummary {
69
+ /** Populated cart items with derived fields */
70
+ items: PopulatedCartItem[];
71
+ /** Total item count (sum of all quantities) */
72
+ itemCount: number;
73
+ /** Subtotal (sum of all line totals) */
74
+ subtotal: number;
75
+ }
76
+ /**
77
+ * Add Item Payload
78
+ * Data required to add an item to cart via POST /api/v1/cart/items
79
+ */
80
+ interface AddCartItemPayload {
81
+ /** Product ID (required) */
82
+ productId: string;
83
+ /**
84
+ * Variant SKU (required for variant products, omit for simple products)
85
+ * - For simple products: omit this field
86
+ * - For variant products: must match a valid variant.sku from product.variants[]
87
+ */
88
+ variantSku?: string | null;
89
+ /** Quantity to add (minimum: 1, required) */
90
+ quantity: number;
91
+ }
92
+ /** Alias for AddCartItemPayload (for consistency with hooks) */
93
+ type AddToCartPayload = AddCartItemPayload;
94
+ /**
95
+ * Update Item Payload
96
+ * Data required to update cart item quantity
97
+ */
98
+ interface UpdateCartItemPayload {
99
+ /** Cart item ID */
100
+ itemId: string;
101
+ /** New quantity (0 to remove) */
102
+ quantity: number;
103
+ }
104
+ /**
105
+ * Remove Item Payload
106
+ * Data required to remove an item from cart
107
+ */
108
+ interface RemoveCartItemPayload {
109
+ /** Cart item ID */
110
+ itemId: string;
111
+ }
112
+ /**
113
+ * Cart API Response
114
+ */
115
+ interface CartResponse {
116
+ success: boolean;
117
+ data: Cart;
118
+ }
119
+ /**
120
+ * @deprecated Use the new variant system instead
121
+ * Legacy type for old variation system - kept for backwards compatibility
122
+ */
123
+ interface CartItemVariation {
124
+ name: string;
125
+ option: {
126
+ value: string;
127
+ priceModifier: number;
128
+ };
129
+ }
130
+
131
+ /**
132
+ * Order Types
133
+ *
134
+ * Source of truth: modules/commerce/order/order.model.js
135
+ */
136
+ type ShippingStatus = 'pending' | 'pickup-requested' | 'picked-up' | 'in-transit' | 'out-for-delivery' | 'delivered' | 'failed-attempt' | 'returning' | 'returned' | 'cancelled';
137
+ type ShippingProvider = 'redx' | 'pathao' | 'steadfast' | 'paperfly' | 'sundarban' | 'manual';
138
+ declare enum OrderStatus {
139
+ PENDING = "pending",
140
+ PROCESSING = "processing",
141
+ CONFIRMED = "confirmed",
142
+ SHIPPED = "shipped",
143
+ DELIVERED = "delivered",
144
+ CANCELLED = "cancelled"
145
+ }
146
+ declare enum PaymentStatus {
147
+ PENDING = "pending",
148
+ VERIFIED = "verified",
149
+ FAILED = "failed",
150
+ REFUNDED = "refunded",
151
+ PARTIALLY_REFUNDED = "partially_refunded",
152
+ CANCELLED = "cancelled"
153
+ }
154
+ /**
155
+ * Order Item
156
+ */
157
+ interface OrderItem {
158
+ _id?: string;
159
+ product: string;
160
+ productName: string;
161
+ productSlug?: string;
162
+ variantSku?: string;
163
+ variantAttributes?: Record<string, string>;
164
+ variantPriceModifier?: number;
165
+ quantity: number;
166
+ price: number;
167
+ /**
168
+ * System field: Cost of Goods Sold at time of sale
169
+ * Used for profit calculation. Read-only.
170
+ */
171
+ costPriceAtSale?: number;
172
+ vatRate?: number;
173
+ vatAmount?: number;
174
+ lineTotal?: number;
175
+ lineTotalExVat?: number;
176
+ profit?: number | null;
177
+ profitMargin?: number | null;
178
+ }
179
+ interface OrderDelivery {
180
+ method: string;
181
+ price: number;
182
+ estimatedDays?: number;
183
+ }
184
+ /**
185
+ * Order Delivery Address
186
+ */
187
+ interface OrderAddress {
188
+ /** Address label (e.g., "Home", "Office") - optional */
189
+ label?: string;
190
+ /** Recipient name for delivery label */
191
+ recipientName?: string;
192
+ /** Contact phone for delivery (format: 01XXXXXXXXX) */
193
+ recipientPhone?: string;
194
+ /** Street address (required for checkout) */
195
+ addressLine1?: string;
196
+ /** Additional address details (apartment, floor, etc.) */
197
+ addressLine2?: string;
198
+ /** Area ID from @classytic/bd-areas constants */
199
+ areaId?: number;
200
+ /** Area display name (e.g., "Mohammadpur", "Dhanmondi") */
201
+ areaName?: string;
202
+ /** Zone ID for delivery pricing (1-6) */
203
+ zoneId?: number;
204
+ /** Provider-specific area IDs for logistics integration */
205
+ providerAreaIds?: {
206
+ redx?: number;
207
+ pathao?: number;
208
+ steadfast?: number;
209
+ };
210
+ /** City/District name */
211
+ city?: string;
212
+ /** Division/State */
213
+ division?: string;
214
+ /** Postal code */
215
+ postalCode?: string;
216
+ /** Country (defaults to "Bangladesh") */
217
+ country?: string;
218
+ }
219
+ interface OrderVat {
220
+ applicable: boolean;
221
+ rate: number;
222
+ amount: number;
223
+ pricesIncludeVat: boolean;
224
+ taxableAmount: number;
225
+ sellerBin?: string;
226
+ invoiceNumber?: string;
227
+ invoiceIssuedAt?: string;
228
+ invoiceBranch?: string;
229
+ invoiceDateKey?: string;
230
+ }
231
+ interface OrderPayment {
232
+ transactionId?: string;
233
+ /** Amount in paisa (smallest unit). Divide by 100 for BDT display. */
234
+ amount: number;
235
+ status: PaymentStatus | string;
236
+ method: string;
237
+ reference?: string;
238
+ verifiedAt?: string;
239
+ verifiedBy?: string;
240
+ }
241
+ interface OrderShippingHistory {
242
+ status: ShippingStatus | string;
243
+ note?: string;
244
+ actor?: string;
245
+ timestamp: string;
246
+ }
247
+ interface OrderShipping {
248
+ provider?: ShippingProvider | string;
249
+ status?: ShippingStatus | string;
250
+ trackingNumber?: string;
251
+ trackingUrl?: string;
252
+ consignmentId?: string;
253
+ labelUrl?: string;
254
+ estimatedDelivery?: string;
255
+ requestedAt?: string;
256
+ pickedUpAt?: string;
257
+ deliveredAt?: string;
258
+ metadata?: Record<string, unknown>;
259
+ history?: OrderShippingHistory[];
260
+ }
261
+ /**
262
+ * Parcel metrics for delivery estimation
263
+ */
264
+ interface OrderParcel {
265
+ /** Total weight in grams */
266
+ weightGrams: number;
267
+ /** Package dimensions in centimeters */
268
+ dimensionsCm?: {
269
+ length: number;
270
+ width: number;
271
+ height: number;
272
+ };
273
+ /** Number of items without weight data */
274
+ missingWeightItems: number;
275
+ /** Number of items without dimension data */
276
+ missingDimensionItems: number;
277
+ }
278
+ /**
279
+ * Cancellation request details
280
+ */
281
+ interface CancellationRequest {
282
+ requested: boolean;
283
+ reason?: string;
284
+ requestedAt?: string;
285
+ requestedBy?: string;
286
+ }
287
+ /**
288
+ * Main Order Interface
289
+ */
290
+ interface Order {
291
+ _id: string;
292
+ /** Virtual: last 8 chars of _id (uppercase) */
293
+ orderNumber?: string;
294
+ customer?: string;
295
+ customerName: string;
296
+ customerPhone?: string;
297
+ customerEmail?: string;
298
+ userId?: string;
299
+ items: OrderItem[];
300
+ subtotal: number;
301
+ discountAmount: number;
302
+ deliveryCharge: number;
303
+ totalAmount: number;
304
+ vat?: OrderVat;
305
+ delivery?: OrderDelivery;
306
+ deliveryAddress?: OrderAddress;
307
+ /** True if ordering on behalf of someone else (gift order) */
308
+ isGift?: boolean;
309
+ status: OrderStatus | string;
310
+ source: 'web' | 'pos' | 'api';
311
+ branch?: string;
312
+ terminalId?: string;
313
+ cashier?: string;
314
+ /** Idempotency key for safe retries */
315
+ idempotencyKey?: string;
316
+ /** Reservation ID for stock hold */
317
+ stockReservationId?: string;
318
+ stockReservationExpiresAt?: string;
319
+ currentPayment?: OrderPayment;
320
+ shipping?: OrderShipping;
321
+ /** Parcel metrics for delivery estimation */
322
+ parcel?: OrderParcel;
323
+ /** Customer cancellation request (awaiting admin review) */
324
+ cancellationRequest?: CancellationRequest;
325
+ /** Final cancellation reason (after cancelled) */
326
+ cancellationReason?: string;
327
+ notes?: string;
328
+ createdAt: string;
329
+ updatedAt: string;
330
+ canCancel?: boolean;
331
+ isCompleted?: boolean;
332
+ paymentStatus?: string;
333
+ paymentMethod?: string;
334
+ netAmount?: number;
335
+ grossAmount?: number;
336
+ trackingNumber?: string;
337
+ shippedAt?: string;
338
+ deliveredAt?: string;
339
+ shippingStatus?: string;
340
+ }
341
+ /**
342
+ * Payment Data for checkout
343
+ */
344
+ interface PaymentData {
345
+ /**
346
+ * Payment method (optional, defaults to 'cash')
347
+ */
348
+ type?: 'cash' | 'bkash' | 'nagad' | 'rocket' | 'bank_transfer' | 'card' | string;
349
+ /**
350
+ * Payment gateway (default: 'manual')
351
+ */
352
+ gateway?: string;
353
+ /**
354
+ * Transaction ID/reference (recommended for verification)
355
+ */
356
+ reference?: string;
357
+ /**
358
+ * Mobile wallet sender phone (REQUIRED for bkash/nagad/rocket)
359
+ */
360
+ senderPhone?: string;
361
+ /**
362
+ * Additional payment verification details
363
+ */
364
+ paymentDetails?: {
365
+ walletNumber?: string;
366
+ walletType?: 'personal' | 'merchant';
367
+ bankName?: string;
368
+ accountNumber?: string;
369
+ accountName?: string;
370
+ proofUrl?: string;
371
+ };
372
+ /** Additional payment notes */
373
+ notes?: string;
374
+ }
375
+ /**
376
+ * Payload for Creating an Order (Web/API)
377
+ */
378
+ interface CreateOrderPayload {
379
+ /** Delivery address (required) */
380
+ deliveryAddress: OrderAddress & {
381
+ recipientName: string;
382
+ recipientPhone: string;
383
+ addressLine1: string;
384
+ areaId: number;
385
+ areaName: string;
386
+ zoneId: number;
387
+ city: string;
388
+ };
389
+ /** Delivery method and pricing (required) */
390
+ delivery: OrderDelivery & {
391
+ method: string;
392
+ price: number;
393
+ };
394
+ /**
395
+ * Payment details for verification (optional, defaults to cash)
396
+ */
397
+ paymentData?: PaymentData;
398
+ /** True if ordering on behalf of someone else (gift order) */
399
+ isGift?: boolean;
400
+ /** Coupon code to apply */
401
+ couponCode?: string;
402
+ /** Order notes */
403
+ notes?: string;
404
+ /** Preferred branch ID for fulfillment */
405
+ branchId?: string;
406
+ /** Preferred branch slug (alternative to branchId) */
407
+ branchSlug?: string;
408
+ /** Idempotency key for safe retries (prevents duplicate orders) */
409
+ idempotencyKey?: string;
410
+ }
411
+ /**
412
+ * Payload for Updating Order Status (Admin)
413
+ */
414
+ interface UpdateStatusPayload {
415
+ status: OrderStatus;
416
+ /** Optional note for status change */
417
+ note?: string;
418
+ }
419
+ /**
420
+ * Payload for Cancelling an Order
421
+ */
422
+ interface CancelOrderPayload {
423
+ /** Cancellation reason */
424
+ reason?: string;
425
+ /** Process refund if payment was verified */
426
+ refund?: boolean;
427
+ }
428
+ /**
429
+ * Payload for Requesting Cancellation (awaits admin review)
430
+ */
431
+ interface CancelRequestPayload {
432
+ /** Reason for cancellation request */
433
+ reason?: string;
434
+ }
435
+ /**
436
+ * Payload for Fulfilling/Shipping an Order (Admin)
437
+ */
438
+ interface FulfillOrderPayload {
439
+ /** Shipping tracking number */
440
+ trackingNumber?: string;
441
+ /** Shipping carrier (e.g., Pathao, Redx) */
442
+ carrier?: string;
443
+ /** Fulfillment notes */
444
+ notes?: string;
445
+ /** Shipping date */
446
+ shippedAt?: string;
447
+ /** Estimated delivery date */
448
+ estimatedDelivery?: string;
449
+ /** Branch ID for inventory decrement (overrides order.branch) */
450
+ branchId?: string;
451
+ /** Branch slug (alternative to branchId) */
452
+ branchSlug?: string;
453
+ /**
454
+ * Record COGS expense transaction (default: false)
455
+ */
456
+ recordCogs?: boolean;
457
+ }
458
+ /**
459
+ * Payload for Refunding an Order (Admin)
460
+ */
461
+ interface RefundOrderPayload {
462
+ /** Refund amount in smallest unit (paisa). Omit for full refund. */
463
+ amount?: number;
464
+ /** Refund reason */
465
+ reason?: string;
466
+ }
467
+ /**
468
+ * Payload for Requesting Shipping Pickup (Admin)
469
+ */
470
+ interface RequestShippingPayload {
471
+ /** Shipping provider (required) */
472
+ provider: string;
473
+ /** Additional shipping options */
474
+ options?: Record<string, unknown>;
475
+ }
476
+ /**
477
+ * Payload for Updating Shipping Status (Admin/Webhook)
478
+ */
479
+ interface UpdateShippingPayload {
480
+ /** Shipping status (required) */
481
+ status: string;
482
+ /** Status note */
483
+ note?: string;
484
+ /** Tracking number */
485
+ trackingNumber?: string;
486
+ /** Tracking URL */
487
+ trackingUrl?: string;
488
+ }
489
+
490
+ /**
491
+ * Customer Types
492
+ *
493
+ * Matches backend `modules/customer/customer.model.js`.
494
+ * Customer is the profile entity (addresses, phone, etc.) linked to auth `User` via `userId`.
495
+ */
496
+
497
+ type CustomerGender = 'male' | 'female' | 'other' | 'prefer-not-to-say';
498
+ type CustomerTier = 'bronze' | 'silver' | 'gold' | 'platinum';
499
+ /**
500
+ * Customer Address
501
+ *
502
+ * Stores user's saved addresses with area info for delivery.
503
+ */
504
+ interface CustomerAddress {
505
+ _id?: string;
506
+ recipientName?: string;
507
+ /** Contact phone for delivery */
508
+ recipientPhone?: string;
509
+ label?: string;
510
+ addressLine1?: string;
511
+ addressLine2?: string;
512
+ city?: string;
513
+ division?: string;
514
+ postalCode?: string;
515
+ country?: string;
516
+ /** @deprecated Use recipientPhone instead */
517
+ phone?: string;
518
+ isDefault?: boolean;
519
+ /** Area internalId from @classytic/bd-areas */
520
+ areaId?: number;
521
+ /** Area name for display */
522
+ areaName?: string;
523
+ /** Delivery zone (1-6) for pricing tier */
524
+ zoneId?: number;
525
+ /** Provider-specific area IDs for logistics */
526
+ providerAreaIds?: {
527
+ redx?: number;
528
+ pathao?: number;
529
+ };
530
+ }
531
+ interface CustomerStats {
532
+ orders?: {
533
+ total?: number;
534
+ completed?: number;
535
+ cancelled?: number;
536
+ refunded?: number;
537
+ };
538
+ revenue?: {
539
+ total?: number;
540
+ lifetime?: number;
541
+ };
542
+ firstOrderDate?: string;
543
+ lastOrderDate?: string;
544
+ /**
545
+ * Some deployments may include subscription stats; keep optional to avoid breaking.
546
+ */
547
+ subscriptions?: {
548
+ active?: number;
549
+ cancelled?: number;
550
+ };
551
+ }
552
+ interface CustomerMembership {
553
+ cardId: string;
554
+ isActive: boolean;
555
+ enrolledAt?: string;
556
+ points?: {
557
+ current?: number;
558
+ lifetime?: number;
559
+ redeemed?: number;
560
+ };
561
+ tier?: string;
562
+ tierOverride?: string;
563
+ tierOverrideReason?: string;
564
+ tierOverrideBy?: string;
565
+ }
566
+ interface Customer {
567
+ _id: string;
568
+ id?: string;
569
+ userId?: string;
570
+ name: string;
571
+ phone: string;
572
+ email?: string;
573
+ dateOfBirth?: string;
574
+ gender?: CustomerGender;
575
+ addresses?: CustomerAddress[];
576
+ stats?: CustomerStats;
577
+ tags?: string[];
578
+ notes?: string;
579
+ isActive?: boolean;
580
+ membership?: CustomerMembership | null;
581
+ defaultAddress?: CustomerAddress | null;
582
+ tier?: CustomerTier;
583
+ createdAt?: string;
584
+ updatedAt?: string;
585
+ }
586
+ interface CustomerPayload {
587
+ name?: string;
588
+ phone?: string;
589
+ email?: string;
590
+ dateOfBirth?: string;
591
+ gender?: CustomerGender;
592
+ addresses?: CustomerAddress[];
593
+ tags?: string[];
594
+ notes?: string;
595
+ isActive?: boolean;
596
+ }
597
+ interface CustomerQueryParams {
598
+ page?: number;
599
+ limit?: number;
600
+ after?: string;
601
+ sort?: string | Record<string, 1 | -1 | 'asc' | 'desc'>;
602
+ name?: string;
603
+ phone?: string;
604
+ email?: string;
605
+ userId?: string;
606
+ populate?: 'userId' | Array<'userId'> | string | string[];
607
+ [key: string]: unknown;
608
+ }
609
+ type CustomerListResponse = PaginatedResponse<Customer>;
610
+ type CustomerResponse = ApiResponse<Customer>;
611
+
612
+ /**
613
+ * Cart API Client
614
+ *
615
+ * **Authentication:** Required for all endpoints (use Bearer token)
616
+ *
617
+ * **Base URL:** `/api/v1/cart`
618
+ *
619
+ * **Endpoints:**
620
+ * - `GET /api/v1/cart` - Get current user's cart (auto-creates if doesn't exist)
621
+ * - `POST /api/v1/cart/items` - Add item to cart (productId + quantity + optional variantSku)
622
+ * - `PATCH /api/v1/cart/items/:itemId` - Update cart item quantity
623
+ * - `DELETE /api/v1/cart/items/:itemId` - Remove item from cart
624
+ * - `DELETE /api/v1/cart` - Clear all items from cart
625
+ *
626
+ * **Response Format:** All endpoints return `{ success: true, data: Cart }`
627
+ */
628
+
629
+ declare const cartApi: {
630
+ /**
631
+ * Get current user's cart
632
+ * GET /api/v1/cart
633
+ *
634
+ * Auto-creates cart if it doesn't exist for the user.
635
+ * Returns cart with fully populated product details.
636
+ *
637
+ * @param token - User authentication token
638
+ * @returns Cart with items array
639
+ */
640
+ getCart: (token: string) => Promise<Cart>;
641
+ /**
642
+ * Add item to cart
643
+ * POST /api/v1/cart/items
644
+ *
645
+ * @param token - User authentication token
646
+ * @param data - Product ID, quantity, and optional variant SKU
647
+ * @returns Updated cart
648
+ */
649
+ addToCart: (token: string, data: AddCartItemPayload) => Promise<Cart>;
650
+ /**
651
+ * Update cart item quantity
652
+ * PATCH /api/v1/cart/items/:itemId
653
+ *
654
+ * @param token - User authentication token
655
+ * @param itemId - Cart item ID (from cart.items[]._id)
656
+ * @param quantity - New quantity (minimum: 1)
657
+ * @returns Updated cart
658
+ */
659
+ updateCartItem: (token: string, itemId: string, quantity: number) => Promise<Cart>;
660
+ /**
661
+ * Remove item from cart
662
+ * DELETE /api/v1/cart/items/:itemId
663
+ *
664
+ * @param token - User authentication token
665
+ * @param itemId - Cart item ID (from cart.items[]._id)
666
+ * @returns Updated cart
667
+ */
668
+ removeCartItem: (token: string, itemId: string) => Promise<Cart>;
669
+ /**
670
+ * Clear all items from cart
671
+ * DELETE /api/v1/cart
672
+ *
673
+ * @param token - User authentication token
674
+ * @returns Empty cart
675
+ */
676
+ clearCart: (token: string) => Promise<Cart>;
677
+ };
678
+
679
+ declare class OrderApi extends BaseApi<Order, CreateOrderPayload, Partial<Order>> {
680
+ /**
681
+ * Checkout - create order from cart
682
+ * POST /api/v1/orders
683
+ */
684
+ checkout: ({ token, organizationId, data }: {
685
+ token: string;
686
+ organizationId?: string | null;
687
+ data: CreateOrderPayload;
688
+ }) => Promise<ApiResponse<Order>>;
689
+ /** Get my orders */
690
+ getMyOrders: ({ token, params }: {
691
+ token: string;
692
+ params?: Record<string, unknown>;
693
+ }) => Promise<Order[]>;
694
+ /** Get my order detail */
695
+ getMyOrder: ({ token, id }: {
696
+ token: string;
697
+ id: string;
698
+ }) => Promise<Order>;
699
+ /** Cancel order */
700
+ cancel: ({ token, id, reason, refund }: {
701
+ token: string;
702
+ id: string;
703
+ reason?: string;
704
+ refund?: boolean;
705
+ }) => Promise<Order>;
706
+ /** Request cancellation (awaits admin review) */
707
+ requestCancellation: ({ token, id, reason }: {
708
+ token: string;
709
+ id: string;
710
+ reason?: string;
711
+ }) => Promise<Order>;
712
+ /** Update order status */
713
+ updateStatus: ({ token, organizationId, id, data }: {
714
+ token: string;
715
+ organizationId?: string | null;
716
+ id: string;
717
+ data: UpdateStatusPayload;
718
+ }) => Promise<Order>;
719
+ /**
720
+ * Fulfill order (ship)
721
+ * - Decrements inventory from branch
722
+ * - recordCogs: true -> also creates COGS expense transaction
723
+ */
724
+ fulfill: ({ token, organizationId, id, data }: {
725
+ token: string;
726
+ organizationId?: string | null;
727
+ id: string;
728
+ data?: FulfillOrderPayload;
729
+ }) => Promise<Order>;
730
+ /** Refund order */
731
+ refund: ({ token, organizationId, id, data }: {
732
+ token: string;
733
+ organizationId?: string | null;
734
+ id: string;
735
+ data?: RefundOrderPayload;
736
+ }) => Promise<Order>;
737
+ /** Get shipping info */
738
+ getShipping: ({ token, id }: {
739
+ token: string;
740
+ id: string;
741
+ }) => Promise<OrderShipping>;
742
+ /** Request shipping pickup */
743
+ requestShipping: ({ token, organizationId, id, data }: {
744
+ token: string;
745
+ organizationId?: string | null;
746
+ id: string;
747
+ data: RequestShippingPayload;
748
+ }) => Promise<OrderShipping>;
749
+ /** Update shipping status */
750
+ updateShipping: ({ token, organizationId, id, data }: {
751
+ token: string;
752
+ organizationId?: string | null;
753
+ id: string;
754
+ data: UpdateShippingPayload;
755
+ }) => Promise<OrderShipping>;
756
+ }
757
+ declare const orderApi: OrderApi;
758
+
759
+ /**
760
+ * Customer API - CRUD + helper endpoint
761
+ *
762
+ * Standard CRUD (inherited from BaseApi):
763
+ * - getAll({ token, params }) - list with filtering/search/pagination
764
+ * - getById({ token, id }) - get by ID
765
+ * - update({ token, id, data }) - update (admin/staff rules apply)
766
+ * - delete({ token, id }) - delete (admin only)
767
+ *
768
+ * Notes:
769
+ * - Customers may be auto-created by backend workflows; some environments may not expose create.
770
+ *
771
+ * Extra endpoint:
772
+ * - getMe({ token }) - current user's customer profile
773
+ */
774
+
775
+ type FetchOptions = Omit<RequestOptions, 'token' | 'organizationId'>;
776
+ declare class CustomerApi extends BaseApi<Customer, CustomerPayload, CustomerPayload> {
777
+ constructor(config?: {});
778
+ /**
779
+ * Get current user's customer profile
780
+ * GET /customers/me
781
+ */
782
+ getMe({ token, options, }: {
783
+ token: string;
784
+ options?: FetchOptions;
785
+ }): Promise<ApiResponse<Customer>>;
786
+ /**
787
+ * Membership actions
788
+ * POST /customers/:id/membership
789
+ */
790
+ membershipAction({ token, id, data, }: {
791
+ token: string;
792
+ id: string;
793
+ data: {
794
+ action: 'enroll' | 'deactivate' | 'reactivate' | 'adjust';
795
+ points?: number;
796
+ reason?: string;
797
+ type?: 'bonus' | 'correction' | 'manual_redemption' | 'redemption' | 'expiry';
798
+ };
799
+ }): Promise<ApiResponse<Customer>>;
800
+ }
801
+ declare const customerApi: CustomerApi;
802
+
803
+ /**
804
+ * POS API Client
805
+ *
806
+ * Follows BaseApi pattern: all methods accept { token, ...params/data }
807
+ */
808
+
809
+ declare class PosApi extends BaseApi {
810
+ /**
811
+ * Browse products with branch-specific stock
812
+ * GET /api/v1/pos/products
813
+ */
814
+ getProducts(options: {
815
+ token: string;
816
+ branchId?: string;
817
+ /** Filter by category slug (matches both parent and child categories) */
818
+ category?: string;
819
+ search?: string;
820
+ inStockOnly?: boolean;
821
+ lowStockOnly?: boolean;
822
+ sort?: string;
823
+ after?: string;
824
+ limit?: number;
825
+ }): Promise<PosProductsResponse>;
826
+ /**
827
+ * Fast Lookup by Barcode/SKU
828
+ * GET /api/v1/pos/lookup
829
+ */
830
+ lookup(options: {
831
+ token: string;
832
+ code: string;
833
+ branchId?: string;
834
+ }): Promise<PosLookupResponse>;
835
+ /**
836
+ * Create POS Order
837
+ * POST /api/v1/pos/orders
838
+ */
839
+ createOrder(options: {
840
+ token: string;
841
+ data: PosOrderPayload;
842
+ }): Promise<unknown>;
843
+ /**
844
+ * Get Receipt Data
845
+ * GET /api/v1/pos/orders/:orderId/receipt
846
+ */
847
+ getReceipt(options: {
848
+ token: string;
849
+ orderId: string;
850
+ }): Promise<unknown>;
851
+ /**
852
+ * Adjust Stock (Quick Adjustment from POS)
853
+ * POST /api/v1/pos/stock/adjust
854
+ */
855
+ adjustStock(options: {
856
+ token: string;
857
+ data: CreateAdjustmentPayload;
858
+ }): Promise<unknown>;
859
+ /**
860
+ * Set stock level directly (POS adjustment alias)
861
+ * POST /api/v1/pos/stock/adjust
862
+ */
863
+ setStock(options: {
864
+ token: string;
865
+ productId: string;
866
+ data: {
867
+ quantity: number;
868
+ branchId?: string;
869
+ variantSku?: string;
870
+ reason?: string;
871
+ notes?: string;
872
+ };
873
+ }): Promise<unknown>;
874
+ /**
875
+ * Bulk adjustments (POS adjustment alias)
876
+ * POST /api/v1/pos/stock/adjust
877
+ */
878
+ bulkAdjust(options: {
879
+ token: string;
880
+ data: BulkAdjustmentPayload;
881
+ }): Promise<unknown>;
882
+ }
883
+ declare const posApi: PosApi;
884
+
885
+ export { type AddCartItemPayload as A, type CustomerAddress as B, type Cart as C, type CustomerStats as D, type CustomerMembership as E, type FulfillOrderPayload as F, type CustomerPayload as G, type CustomerQueryParams as H, type CustomerListResponse as I, type CustomerResponse as J, type CustomerGender as K, type CustomerTier as L, cartApi as M, orderApi as N, OrderStatus as O, type PopulatedCartItem as P, customerApi as Q, type RemoveCartItemPayload as R, type ShippingStatus as S, CustomerApi as T, type UpdateCartItemPayload as U, posApi as V, type CartItem as a, type CartSummary as b, type AddToCartPayload as c, type CartResponse as d, type CartItemVariation as e, PaymentStatus as f, type ShippingProvider as g, type Order as h, type OrderItem as i, type OrderDelivery as j, type OrderAddress as k, type OrderVat as l, type OrderPayment as m, type OrderShipping as n, type OrderShippingHistory as o, type OrderParcel as p, type CancellationRequest as q, type PaymentData as r, type CreateOrderPayload as s, type UpdateStatusPayload as t, type CancelOrderPayload as u, type CancelRequestPayload as v, type RefundOrderPayload as w, type RequestShippingPayload as x, type UpdateShippingPayload as y, type Customer as z };