@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.
- package/LICENSE +14 -0
- package/README.md +104 -0
- package/dist/adjustment-DTSLM7AN.js +5 -0
- package/dist/adjustment-DTSLM7AN.js.map +1 -0
- package/dist/analytics/index.d.ts +27 -0
- package/dist/analytics/index.js +6 -0
- package/dist/analytics/index.js.map +1 -0
- package/dist/analytics-DMcD-o8w.d.ts +76 -0
- package/dist/api-factory-B_h4RKBm.d.ts +280 -0
- package/dist/auth/index.d.ts +39 -0
- package/dist/auth/index.js +5 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/catalog/index.d.ts +479 -0
- package/dist/catalog/index.js +9 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/chunk-4ZQK3FFN.js +40 -0
- package/dist/chunk-4ZQK3FFN.js.map +1 -0
- package/dist/chunk-5L6EXDGH.js +465 -0
- package/dist/chunk-5L6EXDGH.js.map +1 -0
- package/dist/chunk-5ZFW3FEI.js +183 -0
- package/dist/chunk-5ZFW3FEI.js.map +1 -0
- package/dist/chunk-66OQAZSL.js +94 -0
- package/dist/chunk-66OQAZSL.js.map +1 -0
- package/dist/chunk-6RYGA6MF.js +123 -0
- package/dist/chunk-6RYGA6MF.js.map +1 -0
- package/dist/chunk-B6MPVOV7.js +328 -0
- package/dist/chunk-B6MPVOV7.js.map +1 -0
- package/dist/chunk-BDA2WSJA.js +148 -0
- package/dist/chunk-BDA2WSJA.js.map +1 -0
- package/dist/chunk-EIVYT3HM.js +126 -0
- package/dist/chunk-EIVYT3HM.js.map +1 -0
- package/dist/chunk-EPQN7ZKZ.js +27 -0
- package/dist/chunk-EPQN7ZKZ.js.map +1 -0
- package/dist/chunk-FA7QFJ2G.js +177 -0
- package/dist/chunk-FA7QFJ2G.js.map +1 -0
- package/dist/chunk-I5TIKUIQ.js +261 -0
- package/dist/chunk-I5TIKUIQ.js.map +1 -0
- package/dist/chunk-ILQUH444.js +135 -0
- package/dist/chunk-ILQUH444.js.map +1 -0
- package/dist/chunk-IXMWZJLV.js +616 -0
- package/dist/chunk-IXMWZJLV.js.map +1 -0
- package/dist/chunk-KZIGRIQG.js +75 -0
- package/dist/chunk-KZIGRIQG.js.map +1 -0
- package/dist/chunk-OF5M6R2S.js +769 -0
- package/dist/chunk-OF5M6R2S.js.map +1 -0
- package/dist/chunk-PYYLHUV6.js +3 -0
- package/dist/chunk-PYYLHUV6.js.map +1 -0
- package/dist/chunk-QO5AGZFP.js +159 -0
- package/dist/chunk-QO5AGZFP.js.map +1 -0
- package/dist/chunk-QUMTBLNE.js +76 -0
- package/dist/chunk-QUMTBLNE.js.map +1 -0
- package/dist/chunk-R5Z7NYLH.js +126 -0
- package/dist/chunk-R5Z7NYLH.js.map +1 -0
- package/dist/chunk-SZYWG5IB.js +75 -0
- package/dist/chunk-SZYWG5IB.js.map +1 -0
- package/dist/chunk-U3XT35GZ.js +202 -0
- package/dist/chunk-U3XT35GZ.js.map +1 -0
- package/dist/chunk-UGELTUIZ.js +830 -0
- package/dist/chunk-UGELTUIZ.js.map +1 -0
- package/dist/chunk-VR36QVX2.js +122 -0
- package/dist/chunk-VR36QVX2.js.map +1 -0
- package/dist/chunk-WUOQK7BO.js +13 -0
- package/dist/chunk-WUOQK7BO.js.map +1 -0
- package/dist/chunk-X6PV5MHG.js +582 -0
- package/dist/chunk-X6PV5MHG.js.map +1 -0
- package/dist/chunk-ZWLMFLLH.js +534 -0
- package/dist/chunk-ZWLMFLLH.js.map +1 -0
- package/dist/content/index.d.ts +309 -0
- package/dist/content/index.js +6 -0
- package/dist/content/index.js.map +1 -0
- package/dist/core/index.d.ts +107 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/react.d.ts +107 -0
- package/dist/core/react.js +5 -0
- package/dist/core/react.js.map +1 -0
- package/dist/coupon-CHFcw7cd.d.ts +632 -0
- package/dist/coupon-zGkvO-Xx.d.ts +129 -0
- package/dist/crud.factory-DyKaPHcU.d.ts +181 -0
- package/dist/finance/index.d.ts +81 -0
- package/dist/finance/index.js +5 -0
- package/dist/finance/index.js.map +1 -0
- package/dist/finance-BJdfKRw0.d.ts +135 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/inventory/index.d.ts +512 -0
- package/dist/inventory/index.js +16 -0
- package/dist/inventory/index.js.map +1 -0
- package/dist/inventory-DCiIZh8P.d.ts +742 -0
- package/dist/logistics/index.d.ts +226 -0
- package/dist/logistics/index.js +7 -0
- package/dist/logistics/index.js.map +1 -0
- package/dist/logistics-V8a9lUN3.d.ts +428 -0
- package/dist/media-CNLJK93J.d.ts +721 -0
- package/dist/movement-7MV3ADY5.js +5 -0
- package/dist/movement-7MV3ADY5.js.map +1 -0
- package/dist/payment-BRboLqvU.d.ts +127 -0
- package/dist/payments/index.d.ts +55 -0
- package/dist/payments/index.js +6 -0
- package/dist/payments/index.js.map +1 -0
- package/dist/platform/index.d.ts +645 -0
- package/dist/platform/index.js +8 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/pos-D1jkkFl0.d.ts +885 -0
- package/dist/product-p09zXkXB.d.ts +260 -0
- package/dist/purchase-24BGT2HA.js +5 -0
- package/dist/purchase-24BGT2HA.js.map +1 -0
- package/dist/request-652PS6VR.js +5 -0
- package/dist/request-652PS6VR.js.map +1 -0
- package/dist/sales/index.d.ts +585 -0
- package/dist/sales/index.js +9 -0
- package/dist/sales/index.js.map +1 -0
- package/dist/server.d.ts +120 -0
- package/dist/server.js +27 -0
- package/dist/server.js.map +1 -0
- package/dist/size-guide-DgjzjM5P.d.ts +554 -0
- package/dist/stock-DEApGC-w.d.ts +632 -0
- package/dist/stock-OOUW57VQ.js +5 -0
- package/dist/stock-OOUW57VQ.js.map +1 -0
- package/dist/supplier-OC6JAWV6.js +5 -0
- package/dist/supplier-OC6JAWV6.js.map +1 -0
- package/dist/transaction/index.d.ts +104 -0
- package/dist/transaction/index.js +8 -0
- package/dist/transaction/index.js.map +1 -0
- package/dist/transaction-BTmoHpWh.d.ts +428 -0
- package/dist/transaction-u5oaNuav.d.ts +84 -0
- package/dist/transfer-7SYSH3RG.js +5 -0
- package/dist/transfer-7SYSH3RG.js.map +1 -0
- package/dist/user-data-DdLjAGwO.d.ts +132 -0
- package/package.json +146 -0
|
@@ -0,0 +1,742 @@
|
|
|
1
|
+
import { e as Product, P as ProductImage, b as ProductVariant } from './product-p09zXkXB.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* POS Types
|
|
5
|
+
*
|
|
6
|
+
* Based on: POS_API_GUIDE.md
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
interface VariantStock {
|
|
10
|
+
sku: string;
|
|
11
|
+
attributes: Record<string, string>;
|
|
12
|
+
quantity: number;
|
|
13
|
+
priceModifier?: number;
|
|
14
|
+
costPrice?: number;
|
|
15
|
+
barcode?: string;
|
|
16
|
+
}
|
|
17
|
+
interface BranchStock {
|
|
18
|
+
quantity: number;
|
|
19
|
+
inStock: boolean;
|
|
20
|
+
lowStock: boolean;
|
|
21
|
+
variants?: VariantStock[];
|
|
22
|
+
}
|
|
23
|
+
type PosProduct = Omit<Product, 'costPrice'> & {
|
|
24
|
+
costPrice?: number;
|
|
25
|
+
branchStock?: BranchStock;
|
|
26
|
+
};
|
|
27
|
+
interface PosProductsSummary {
|
|
28
|
+
totalItems: number;
|
|
29
|
+
totalQuantity: number;
|
|
30
|
+
lowStockCount: number;
|
|
31
|
+
outOfStockCount: number;
|
|
32
|
+
}
|
|
33
|
+
interface PosProductsBranch {
|
|
34
|
+
_id: string;
|
|
35
|
+
code: string;
|
|
36
|
+
name: string;
|
|
37
|
+
}
|
|
38
|
+
interface PosProductsResponse {
|
|
39
|
+
success: boolean;
|
|
40
|
+
branch: PosProductsBranch;
|
|
41
|
+
summary: PosProductsSummary;
|
|
42
|
+
docs: PosProduct[];
|
|
43
|
+
hasMore: boolean;
|
|
44
|
+
next: string | null;
|
|
45
|
+
method?: string;
|
|
46
|
+
limit?: number;
|
|
47
|
+
}
|
|
48
|
+
interface PosProductsParams {
|
|
49
|
+
branchId?: string;
|
|
50
|
+
/** Filter by category slug (matches both parent and child categories) */
|
|
51
|
+
category?: string;
|
|
52
|
+
search?: string;
|
|
53
|
+
inStockOnly?: boolean;
|
|
54
|
+
lowStockOnly?: boolean;
|
|
55
|
+
sort?: string;
|
|
56
|
+
after?: string;
|
|
57
|
+
limit?: number;
|
|
58
|
+
}
|
|
59
|
+
interface PosLookupProduct {
|
|
60
|
+
_id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
basePrice: number;
|
|
63
|
+
productType: string;
|
|
64
|
+
slug?: string;
|
|
65
|
+
sku?: string;
|
|
66
|
+
barcode?: string;
|
|
67
|
+
category?: string;
|
|
68
|
+
costPrice?: number;
|
|
69
|
+
images?: ProductImage[];
|
|
70
|
+
variants?: Array<{
|
|
71
|
+
sku: string;
|
|
72
|
+
attributes: Record<string, string>;
|
|
73
|
+
priceModifier?: number;
|
|
74
|
+
}>;
|
|
75
|
+
}
|
|
76
|
+
interface PosLookupData {
|
|
77
|
+
product: PosLookupProduct;
|
|
78
|
+
variantSku?: string;
|
|
79
|
+
matchedVariant?: {
|
|
80
|
+
sku: string;
|
|
81
|
+
attributes: Record<string, string>;
|
|
82
|
+
priceModifier: number;
|
|
83
|
+
};
|
|
84
|
+
quantity: number;
|
|
85
|
+
branchId: string;
|
|
86
|
+
}
|
|
87
|
+
interface PosLookupResponse {
|
|
88
|
+
success: boolean;
|
|
89
|
+
data: PosLookupData;
|
|
90
|
+
message?: string;
|
|
91
|
+
}
|
|
92
|
+
interface PosOrderItem {
|
|
93
|
+
productId: string;
|
|
94
|
+
variantSku?: string;
|
|
95
|
+
quantity: number;
|
|
96
|
+
price?: number;
|
|
97
|
+
}
|
|
98
|
+
interface PosPayment {
|
|
99
|
+
method: PosPaymentMethod;
|
|
100
|
+
amount?: number;
|
|
101
|
+
reference?: string;
|
|
102
|
+
}
|
|
103
|
+
interface PosCustomer {
|
|
104
|
+
name?: string;
|
|
105
|
+
phone?: string;
|
|
106
|
+
id?: string;
|
|
107
|
+
}
|
|
108
|
+
interface PosOrderPayload {
|
|
109
|
+
items: PosOrderItem[];
|
|
110
|
+
branchId?: string;
|
|
111
|
+
branchSlug?: string;
|
|
112
|
+
customer?: PosCustomer;
|
|
113
|
+
membershipCardId?: string;
|
|
114
|
+
pointsToRedeem?: number;
|
|
115
|
+
payment?: PosPayment;
|
|
116
|
+
payments?: PosPayment[];
|
|
117
|
+
discount?: number;
|
|
118
|
+
deliveryMethod?: 'pickup' | 'delivery';
|
|
119
|
+
deliveryAddress?: {
|
|
120
|
+
recipientName: string;
|
|
121
|
+
recipientPhone: string;
|
|
122
|
+
addressLine1?: string;
|
|
123
|
+
city?: string;
|
|
124
|
+
[key: string]: unknown;
|
|
125
|
+
};
|
|
126
|
+
deliveryPrice?: number;
|
|
127
|
+
deliveryAreaId?: number;
|
|
128
|
+
terminalId?: string;
|
|
129
|
+
idempotencyKey?: string;
|
|
130
|
+
notes?: string;
|
|
131
|
+
}
|
|
132
|
+
type PosPaymentMethod = 'cash' | 'bkash' | 'nagad' | 'rocket' | 'upay' | 'bank_transfer' | 'card';
|
|
133
|
+
interface PosReceiptItem {
|
|
134
|
+
name: string;
|
|
135
|
+
variant?: string;
|
|
136
|
+
quantity: number;
|
|
137
|
+
unitPrice: number;
|
|
138
|
+
total: number;
|
|
139
|
+
vatRate?: number;
|
|
140
|
+
vatAmount?: number;
|
|
141
|
+
}
|
|
142
|
+
interface PosReceiptVat {
|
|
143
|
+
applicable: boolean;
|
|
144
|
+
rate: number;
|
|
145
|
+
amount: number;
|
|
146
|
+
taxableAmount: number;
|
|
147
|
+
sellerBin?: string;
|
|
148
|
+
pricesIncludeVat?: boolean;
|
|
149
|
+
}
|
|
150
|
+
interface PosReceiptData {
|
|
151
|
+
orderId: string;
|
|
152
|
+
orderNumber: string;
|
|
153
|
+
invoiceNumber?: string;
|
|
154
|
+
date: string;
|
|
155
|
+
branch: {
|
|
156
|
+
name: string;
|
|
157
|
+
phone?: string;
|
|
158
|
+
};
|
|
159
|
+
cashier?: string;
|
|
160
|
+
customer?: {
|
|
161
|
+
name?: string;
|
|
162
|
+
phone?: string | null;
|
|
163
|
+
};
|
|
164
|
+
membership?: {
|
|
165
|
+
cardId?: string;
|
|
166
|
+
tier?: string;
|
|
167
|
+
pointsEarned?: number;
|
|
168
|
+
tierDiscount?: number;
|
|
169
|
+
};
|
|
170
|
+
items: PosReceiptItem[];
|
|
171
|
+
subtotal: number;
|
|
172
|
+
discount: number;
|
|
173
|
+
deliveryCharge: number;
|
|
174
|
+
vat?: PosReceiptVat;
|
|
175
|
+
total: number;
|
|
176
|
+
payment: {
|
|
177
|
+
method: string;
|
|
178
|
+
amount: number;
|
|
179
|
+
reference?: string;
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
interface PosReceiptResponse {
|
|
183
|
+
success: boolean;
|
|
184
|
+
data: PosReceiptData;
|
|
185
|
+
}
|
|
186
|
+
interface PosReceipt extends PosReceiptData {
|
|
187
|
+
}
|
|
188
|
+
interface PosLookupResult {
|
|
189
|
+
product: PosProduct;
|
|
190
|
+
variant?: ProductVariant;
|
|
191
|
+
scannedCode: string;
|
|
192
|
+
}
|
|
193
|
+
interface PosCartItem {
|
|
194
|
+
productId: string;
|
|
195
|
+
productName: string;
|
|
196
|
+
variantSku?: string;
|
|
197
|
+
variantLabel?: string;
|
|
198
|
+
quantity: number;
|
|
199
|
+
unitPrice: number;
|
|
200
|
+
lineTotal: number;
|
|
201
|
+
image?: string;
|
|
202
|
+
}
|
|
203
|
+
interface SplitPaymentEntry {
|
|
204
|
+
id: string;
|
|
205
|
+
paymentKey: string;
|
|
206
|
+
posMethod: PosPaymentMethod;
|
|
207
|
+
amount: string;
|
|
208
|
+
reference: string;
|
|
209
|
+
error?: string;
|
|
210
|
+
}
|
|
211
|
+
interface PaymentOption {
|
|
212
|
+
key: string;
|
|
213
|
+
posMethod: PosPaymentMethod;
|
|
214
|
+
label: string;
|
|
215
|
+
needsReference: boolean;
|
|
216
|
+
note?: string;
|
|
217
|
+
walletNumber?: string;
|
|
218
|
+
}
|
|
219
|
+
interface PaymentState {
|
|
220
|
+
mode: 'single' | 'split';
|
|
221
|
+
selectedKey: string | null;
|
|
222
|
+
selectedMethod: PosPaymentMethod;
|
|
223
|
+
reference: string;
|
|
224
|
+
cashReceived: string;
|
|
225
|
+
changeAmount: number;
|
|
226
|
+
amountDue: number;
|
|
227
|
+
splitEntries: SplitPaymentEntry[];
|
|
228
|
+
splitTotal: number;
|
|
229
|
+
splitRemaining: number;
|
|
230
|
+
splitIsBalanced: boolean;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Inventory Types
|
|
235
|
+
*
|
|
236
|
+
* Core types for the inventory module including:
|
|
237
|
+
* - Stock entries
|
|
238
|
+
* - Stock movements (audit trail)
|
|
239
|
+
* - Purchases
|
|
240
|
+
* - Transfers (challans)
|
|
241
|
+
* - Stock requests
|
|
242
|
+
* - Adjustments
|
|
243
|
+
*/
|
|
244
|
+
type StockMovementType = 'purchase' | 'sale' | 'transfer_in' | 'transfer_out' | 'adjustment' | 'initial' | 'return' | 'recount';
|
|
245
|
+
type TransferStatus = 'draft' | 'approved' | 'dispatched' | 'in_transit' | 'received' | 'partial_received' | 'cancelled';
|
|
246
|
+
type StockRequestStatus = 'pending' | 'approved' | 'rejected' | 'fulfilled' | 'partial_fulfilled' | 'cancelled';
|
|
247
|
+
type TransferActionType = 'approve' | 'dispatch' | 'in-transit' | 'receive' | 'cancel';
|
|
248
|
+
type StockRequestActionType = 'approve' | 'reject' | 'fulfill' | 'cancel';
|
|
249
|
+
interface StockEntry {
|
|
250
|
+
_id: string;
|
|
251
|
+
product: string;
|
|
252
|
+
variantSku?: string | null;
|
|
253
|
+
branch: string | {
|
|
254
|
+
_id: string;
|
|
255
|
+
name: string;
|
|
256
|
+
code?: string;
|
|
257
|
+
};
|
|
258
|
+
quantity: number;
|
|
259
|
+
reservedQuantity: number;
|
|
260
|
+
/** Weighted Average Cost - admin only */
|
|
261
|
+
costPrice?: number;
|
|
262
|
+
reorderPoint?: number;
|
|
263
|
+
reorderQuantity?: number;
|
|
264
|
+
isActive: boolean;
|
|
265
|
+
lastCountDate?: string;
|
|
266
|
+
availableQuantity?: number;
|
|
267
|
+
needsReorder?: boolean;
|
|
268
|
+
}
|
|
269
|
+
interface StockMovement {
|
|
270
|
+
_id: string;
|
|
271
|
+
stockEntry?: string;
|
|
272
|
+
product: string | {
|
|
273
|
+
_id: string;
|
|
274
|
+
name: string;
|
|
275
|
+
};
|
|
276
|
+
variantSku?: string;
|
|
277
|
+
branch: string | {
|
|
278
|
+
_id: string;
|
|
279
|
+
name: string;
|
|
280
|
+
code?: string;
|
|
281
|
+
};
|
|
282
|
+
type: StockMovementType;
|
|
283
|
+
quantity: number;
|
|
284
|
+
balanceAfter?: number;
|
|
285
|
+
previousQuantity?: number;
|
|
286
|
+
newQuantity?: number;
|
|
287
|
+
reference?: {
|
|
288
|
+
model?: string;
|
|
289
|
+
id?: string;
|
|
290
|
+
} | string;
|
|
291
|
+
referenceType?: 'transfer' | 'order' | 'purchase' | 'adjustment';
|
|
292
|
+
costPrice?: number;
|
|
293
|
+
costPerUnit?: number;
|
|
294
|
+
reason?: string;
|
|
295
|
+
actor?: string | {
|
|
296
|
+
_id: string;
|
|
297
|
+
name: string;
|
|
298
|
+
};
|
|
299
|
+
notes?: string;
|
|
300
|
+
createdBy?: string | {
|
|
301
|
+
_id: string;
|
|
302
|
+
name: string;
|
|
303
|
+
};
|
|
304
|
+
createdAt: string;
|
|
305
|
+
}
|
|
306
|
+
type PurchaseStatus = 'draft' | 'approved' | 'received' | 'cancelled';
|
|
307
|
+
type PurchasePaymentStatus = 'unpaid' | 'partial' | 'paid';
|
|
308
|
+
type PurchasePaymentTerms = 'cash' | 'credit';
|
|
309
|
+
type PurchaseActionType = 'receive' | 'pay' | 'cancel';
|
|
310
|
+
interface PurchasePaymentDetails {
|
|
311
|
+
amount: number;
|
|
312
|
+
method: string;
|
|
313
|
+
reference?: string;
|
|
314
|
+
accountNumber?: string;
|
|
315
|
+
walletNumber?: string;
|
|
316
|
+
bankName?: string;
|
|
317
|
+
accountName?: string;
|
|
318
|
+
proofUrl?: string;
|
|
319
|
+
transactionDate?: string;
|
|
320
|
+
notes?: string;
|
|
321
|
+
}
|
|
322
|
+
interface PurchaseItem {
|
|
323
|
+
productId: string;
|
|
324
|
+
variantSku?: string;
|
|
325
|
+
quantity: number;
|
|
326
|
+
costPrice?: number;
|
|
327
|
+
expiryDate?: string;
|
|
328
|
+
}
|
|
329
|
+
interface PurchaseItemDoc {
|
|
330
|
+
_id?: string;
|
|
331
|
+
product: string | {
|
|
332
|
+
_id: string;
|
|
333
|
+
name: string;
|
|
334
|
+
};
|
|
335
|
+
productName: string;
|
|
336
|
+
variantSku?: string;
|
|
337
|
+
quantity: number;
|
|
338
|
+
costPrice: number;
|
|
339
|
+
discount?: number;
|
|
340
|
+
taxRate?: number;
|
|
341
|
+
lineTotal?: number;
|
|
342
|
+
taxableAmount?: number;
|
|
343
|
+
taxAmount?: number;
|
|
344
|
+
}
|
|
345
|
+
interface PurchaseStatusHistoryEntry {
|
|
346
|
+
status: PurchaseStatus;
|
|
347
|
+
timestamp: string;
|
|
348
|
+
actor?: string | {
|
|
349
|
+
_id: string;
|
|
350
|
+
name: string;
|
|
351
|
+
};
|
|
352
|
+
notes?: string;
|
|
353
|
+
}
|
|
354
|
+
interface Purchase {
|
|
355
|
+
_id: string;
|
|
356
|
+
invoiceNumber: string;
|
|
357
|
+
purchaseOrderNumber?: string;
|
|
358
|
+
supplier?: string | {
|
|
359
|
+
_id: string;
|
|
360
|
+
name: string;
|
|
361
|
+
code?: string;
|
|
362
|
+
};
|
|
363
|
+
branch: string | {
|
|
364
|
+
_id: string;
|
|
365
|
+
name: string;
|
|
366
|
+
code?: string;
|
|
367
|
+
};
|
|
368
|
+
invoiceDate?: string;
|
|
369
|
+
paymentTerms: PurchasePaymentTerms;
|
|
370
|
+
creditDays?: number;
|
|
371
|
+
dueDate?: string;
|
|
372
|
+
status: PurchaseStatus;
|
|
373
|
+
paymentStatus: PurchasePaymentStatus;
|
|
374
|
+
items: PurchaseItemDoc[];
|
|
375
|
+
subTotal?: number;
|
|
376
|
+
discountTotal?: number;
|
|
377
|
+
taxTotal?: number;
|
|
378
|
+
grandTotal: number;
|
|
379
|
+
paidAmount: number;
|
|
380
|
+
dueAmount: number;
|
|
381
|
+
transactionIds?: string[];
|
|
382
|
+
statusHistory?: PurchaseStatusHistoryEntry[];
|
|
383
|
+
notes?: string;
|
|
384
|
+
createdAt: string;
|
|
385
|
+
updatedAt: string;
|
|
386
|
+
createdBy?: string | {
|
|
387
|
+
_id: string;
|
|
388
|
+
name: string;
|
|
389
|
+
};
|
|
390
|
+
updatedBy?: string | {
|
|
391
|
+
_id: string;
|
|
392
|
+
name: string;
|
|
393
|
+
};
|
|
394
|
+
approvedAt?: string;
|
|
395
|
+
approvedBy?: string | {
|
|
396
|
+
_id: string;
|
|
397
|
+
name: string;
|
|
398
|
+
};
|
|
399
|
+
receivedAt?: string;
|
|
400
|
+
receivedBy?: string | {
|
|
401
|
+
_id: string;
|
|
402
|
+
name: string;
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
interface CreatePurchasePayload {
|
|
406
|
+
supplierId?: string;
|
|
407
|
+
purchaseOrderNumber?: string;
|
|
408
|
+
paymentTerms?: PurchasePaymentTerms;
|
|
409
|
+
creditDays?: number;
|
|
410
|
+
items: PurchaseItem[];
|
|
411
|
+
notes?: string;
|
|
412
|
+
autoApprove?: boolean;
|
|
413
|
+
autoReceive?: boolean;
|
|
414
|
+
payment?: PurchasePaymentDetails;
|
|
415
|
+
}
|
|
416
|
+
interface UpdatePurchasePayload {
|
|
417
|
+
supplierId?: string;
|
|
418
|
+
purchaseOrderNumber?: string;
|
|
419
|
+
paymentTerms?: PurchasePaymentTerms;
|
|
420
|
+
creditDays?: number;
|
|
421
|
+
items?: PurchaseItem[];
|
|
422
|
+
notes?: string;
|
|
423
|
+
}
|
|
424
|
+
interface PurchaseReceivePayload {
|
|
425
|
+
action: 'receive';
|
|
426
|
+
}
|
|
427
|
+
interface PurchasePayPayload {
|
|
428
|
+
action: 'pay';
|
|
429
|
+
amount: number;
|
|
430
|
+
method: string;
|
|
431
|
+
reference?: string;
|
|
432
|
+
accountNumber?: string;
|
|
433
|
+
walletNumber?: string;
|
|
434
|
+
bankName?: string;
|
|
435
|
+
accountName?: string;
|
|
436
|
+
proofUrl?: string;
|
|
437
|
+
transactionDate?: string;
|
|
438
|
+
notes?: string;
|
|
439
|
+
}
|
|
440
|
+
interface PurchaseCancelPayload {
|
|
441
|
+
action: 'cancel';
|
|
442
|
+
reason?: string;
|
|
443
|
+
}
|
|
444
|
+
type PurchaseActionPayload = PurchaseReceivePayload | PurchasePayPayload | PurchaseCancelPayload;
|
|
445
|
+
type RecordPurchasePayload = CreatePurchasePayload;
|
|
446
|
+
type TransferType = 'head_to_sub' | 'sub_to_sub' | 'sub_to_head';
|
|
447
|
+
interface TransferItemPayload {
|
|
448
|
+
productId: string;
|
|
449
|
+
variantSku?: string;
|
|
450
|
+
quantity: number;
|
|
451
|
+
cartonNumber?: string;
|
|
452
|
+
}
|
|
453
|
+
interface TransferItem {
|
|
454
|
+
_id?: string;
|
|
455
|
+
product: string | {
|
|
456
|
+
_id: string;
|
|
457
|
+
name: string;
|
|
458
|
+
};
|
|
459
|
+
productName?: string;
|
|
460
|
+
productSku?: string;
|
|
461
|
+
variantSku?: string;
|
|
462
|
+
variantAttributes?: Record<string, string>;
|
|
463
|
+
cartonNumber?: string;
|
|
464
|
+
quantity: number;
|
|
465
|
+
quantityReceived?: number;
|
|
466
|
+
costPrice?: number;
|
|
467
|
+
notes?: string;
|
|
468
|
+
}
|
|
469
|
+
interface TransportDetails {
|
|
470
|
+
vehicleNumber?: string;
|
|
471
|
+
driverName?: string;
|
|
472
|
+
driverPhone?: string;
|
|
473
|
+
estimatedArrival?: string;
|
|
474
|
+
courierName?: string;
|
|
475
|
+
trackingId?: string;
|
|
476
|
+
notes?: string;
|
|
477
|
+
}
|
|
478
|
+
interface TransferStatusHistoryEntry {
|
|
479
|
+
status: TransferStatus;
|
|
480
|
+
timestamp: string;
|
|
481
|
+
actor?: string | {
|
|
482
|
+
_id: string;
|
|
483
|
+
name: string;
|
|
484
|
+
};
|
|
485
|
+
notes?: string | null;
|
|
486
|
+
}
|
|
487
|
+
interface InventoryTransfer {
|
|
488
|
+
_id: string;
|
|
489
|
+
challanNumber: string;
|
|
490
|
+
transferType?: TransferType;
|
|
491
|
+
documentType?: 'delivery_challan' | 'dispatch_note' | 'delivery_slip';
|
|
492
|
+
status: TransferStatus;
|
|
493
|
+
senderBranch: string | {
|
|
494
|
+
_id: string;
|
|
495
|
+
name: string;
|
|
496
|
+
code?: string;
|
|
497
|
+
};
|
|
498
|
+
receiverBranch: string | {
|
|
499
|
+
_id: string;
|
|
500
|
+
name: string;
|
|
501
|
+
code?: string;
|
|
502
|
+
};
|
|
503
|
+
items: TransferItem[];
|
|
504
|
+
totalItems?: number;
|
|
505
|
+
totalQuantity?: number;
|
|
506
|
+
totalValue?: number;
|
|
507
|
+
transport?: TransportDetails;
|
|
508
|
+
remarks?: string;
|
|
509
|
+
internalNotes?: string;
|
|
510
|
+
statusHistory?: TransferStatusHistoryEntry[];
|
|
511
|
+
dispatchMovements?: string[];
|
|
512
|
+
receiveMovements?: string[];
|
|
513
|
+
createdAt: string;
|
|
514
|
+
updatedAt: string;
|
|
515
|
+
createdBy?: string | {
|
|
516
|
+
_id: string;
|
|
517
|
+
name: string;
|
|
518
|
+
};
|
|
519
|
+
approvedBy?: string | {
|
|
520
|
+
_id: string;
|
|
521
|
+
name: string;
|
|
522
|
+
};
|
|
523
|
+
approvedAt?: string;
|
|
524
|
+
dispatchedBy?: string | {
|
|
525
|
+
_id: string;
|
|
526
|
+
name: string;
|
|
527
|
+
};
|
|
528
|
+
dispatchedAt?: string;
|
|
529
|
+
receivedBy?: string | {
|
|
530
|
+
_id: string;
|
|
531
|
+
name: string;
|
|
532
|
+
};
|
|
533
|
+
receivedAt?: string;
|
|
534
|
+
isComplete?: boolean;
|
|
535
|
+
canEdit?: boolean;
|
|
536
|
+
canApprove?: boolean;
|
|
537
|
+
canDispatch?: boolean;
|
|
538
|
+
canReceive?: boolean;
|
|
539
|
+
canCancel?: boolean;
|
|
540
|
+
}
|
|
541
|
+
type Transfer = InventoryTransfer;
|
|
542
|
+
interface CreateTransferPayload {
|
|
543
|
+
senderBranchId?: string;
|
|
544
|
+
receiverBranchId: string;
|
|
545
|
+
documentType?: 'delivery_challan' | 'dispatch_note' | 'delivery_slip';
|
|
546
|
+
items: TransferItemPayload[];
|
|
547
|
+
remarks?: string;
|
|
548
|
+
}
|
|
549
|
+
interface TransferActionPayload {
|
|
550
|
+
action: TransferActionType;
|
|
551
|
+
transport?: TransportDetails;
|
|
552
|
+
items?: {
|
|
553
|
+
itemId?: string;
|
|
554
|
+
productId: string;
|
|
555
|
+
variantSku?: string;
|
|
556
|
+
quantityReceived: number;
|
|
557
|
+
}[];
|
|
558
|
+
reason?: string;
|
|
559
|
+
}
|
|
560
|
+
interface UpdateTransferPayload {
|
|
561
|
+
items?: TransferItemPayload[];
|
|
562
|
+
remarks?: string;
|
|
563
|
+
documentType?: 'delivery_challan' | 'dispatch_note' | 'delivery_slip';
|
|
564
|
+
}
|
|
565
|
+
interface DispatchTransferPayload {
|
|
566
|
+
transport?: TransportDetails;
|
|
567
|
+
}
|
|
568
|
+
interface ReceiveTransferPayload {
|
|
569
|
+
items?: {
|
|
570
|
+
itemId?: string;
|
|
571
|
+
productId: string;
|
|
572
|
+
variantSku?: string;
|
|
573
|
+
quantityReceived: number;
|
|
574
|
+
}[];
|
|
575
|
+
}
|
|
576
|
+
type StockRequestPriority = 'low' | 'normal' | 'high' | 'urgent';
|
|
577
|
+
interface StockRequestItem {
|
|
578
|
+
productId: string;
|
|
579
|
+
variantSku?: string;
|
|
580
|
+
quantity: number;
|
|
581
|
+
approvedQuantity?: number;
|
|
582
|
+
quantityApproved?: number;
|
|
583
|
+
quantityFulfilled?: number;
|
|
584
|
+
notes?: string;
|
|
585
|
+
}
|
|
586
|
+
interface StockRequest {
|
|
587
|
+
_id: string;
|
|
588
|
+
requestNumber: string;
|
|
589
|
+
requestingBranch: string | {
|
|
590
|
+
_id: string;
|
|
591
|
+
name: string;
|
|
592
|
+
code?: string;
|
|
593
|
+
};
|
|
594
|
+
fulfillingBranch?: string | {
|
|
595
|
+
_id: string;
|
|
596
|
+
name: string;
|
|
597
|
+
code?: string;
|
|
598
|
+
};
|
|
599
|
+
items: StockRequestItem[];
|
|
600
|
+
status: StockRequestStatus;
|
|
601
|
+
priority?: StockRequestPriority;
|
|
602
|
+
reason?: string;
|
|
603
|
+
expectedDate?: string;
|
|
604
|
+
notes?: string;
|
|
605
|
+
reviewNotes?: string;
|
|
606
|
+
rejectionReason?: string;
|
|
607
|
+
totalQuantityRequested?: number;
|
|
608
|
+
totalQuantityApproved?: number;
|
|
609
|
+
totalQuantityFulfilled?: number;
|
|
610
|
+
createdAt: string;
|
|
611
|
+
updatedAt: string;
|
|
612
|
+
createdBy?: string | {
|
|
613
|
+
_id: string;
|
|
614
|
+
name: string;
|
|
615
|
+
};
|
|
616
|
+
reviewedBy?: string | {
|
|
617
|
+
_id: string;
|
|
618
|
+
name: string;
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
interface CreateStockRequestPayload {
|
|
622
|
+
requestingBranchId?: string;
|
|
623
|
+
items: {
|
|
624
|
+
productId: string;
|
|
625
|
+
variantSku?: string;
|
|
626
|
+
quantity: number;
|
|
627
|
+
notes?: string;
|
|
628
|
+
}[];
|
|
629
|
+
priority?: StockRequestPriority;
|
|
630
|
+
reason?: string;
|
|
631
|
+
expectedDate?: string;
|
|
632
|
+
notes?: string;
|
|
633
|
+
}
|
|
634
|
+
interface StockRequestActionPayload {
|
|
635
|
+
action: StockRequestActionType;
|
|
636
|
+
items?: {
|
|
637
|
+
productId: string;
|
|
638
|
+
variantSku?: string;
|
|
639
|
+
quantityApproved?: number;
|
|
640
|
+
quantity?: number;
|
|
641
|
+
}[];
|
|
642
|
+
reason?: string;
|
|
643
|
+
remarks?: string;
|
|
644
|
+
reviewNotes?: string;
|
|
645
|
+
documentType?: string;
|
|
646
|
+
}
|
|
647
|
+
interface AdjustmentItem {
|
|
648
|
+
productId: string;
|
|
649
|
+
variantSku?: string;
|
|
650
|
+
quantity: number;
|
|
651
|
+
mode: 'add' | 'remove' | 'set';
|
|
652
|
+
reason?: string;
|
|
653
|
+
}
|
|
654
|
+
interface CreateAdjustmentPayload {
|
|
655
|
+
branchId?: string;
|
|
656
|
+
adjustments?: AdjustmentItem[];
|
|
657
|
+
items?: AdjustmentItem[];
|
|
658
|
+
productId?: string;
|
|
659
|
+
variantSku?: string;
|
|
660
|
+
quantity?: number;
|
|
661
|
+
mode?: 'add' | 'remove' | 'set';
|
|
662
|
+
reason?: string;
|
|
663
|
+
notes?: string;
|
|
664
|
+
lostAmount?: number;
|
|
665
|
+
transactionData?: {
|
|
666
|
+
paymentMethod?: 'cash' | 'bkash' | 'nagad' | 'rocket' | 'bank_transfer';
|
|
667
|
+
reference?: string;
|
|
668
|
+
};
|
|
669
|
+
}
|
|
670
|
+
interface BulkAdjustmentPayload {
|
|
671
|
+
adjustments: AdjustmentItem[];
|
|
672
|
+
branchId?: string;
|
|
673
|
+
reason?: string;
|
|
674
|
+
}
|
|
675
|
+
interface AdjustStockPayload {
|
|
676
|
+
productId: string;
|
|
677
|
+
variantSku?: string;
|
|
678
|
+
quantity: number;
|
|
679
|
+
mode: 'add' | 'remove' | 'set';
|
|
680
|
+
branchId?: string;
|
|
681
|
+
reason?: string;
|
|
682
|
+
notes?: string;
|
|
683
|
+
}
|
|
684
|
+
interface AdjustStockResult {
|
|
685
|
+
processed?: number;
|
|
686
|
+
failed?: number;
|
|
687
|
+
results?: {
|
|
688
|
+
success?: unknown[];
|
|
689
|
+
failed?: {
|
|
690
|
+
productId?: string;
|
|
691
|
+
error?: string;
|
|
692
|
+
}[];
|
|
693
|
+
};
|
|
694
|
+
productId?: string;
|
|
695
|
+
variantSku?: string | null;
|
|
696
|
+
newQuantity?: number;
|
|
697
|
+
message?: string;
|
|
698
|
+
transaction?: {
|
|
699
|
+
_id?: string;
|
|
700
|
+
amount?: number;
|
|
701
|
+
category?: string;
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
interface LowStockItem {
|
|
705
|
+
_id?: string;
|
|
706
|
+
product: {
|
|
707
|
+
_id: string;
|
|
708
|
+
name: string;
|
|
709
|
+
slug?: string;
|
|
710
|
+
sku?: string;
|
|
711
|
+
};
|
|
712
|
+
variantSku?: string | null;
|
|
713
|
+
/** Backend may omit this when querying for a single selected branch */
|
|
714
|
+
branch?: {
|
|
715
|
+
_id: string;
|
|
716
|
+
name: string;
|
|
717
|
+
code?: string;
|
|
718
|
+
};
|
|
719
|
+
quantity: number;
|
|
720
|
+
reorderPoint: number;
|
|
721
|
+
needsReorder?: boolean;
|
|
722
|
+
}
|
|
723
|
+
interface TransferStats {
|
|
724
|
+
total: number;
|
|
725
|
+
byStatus: Record<TransferStatus, number>;
|
|
726
|
+
pending: number;
|
|
727
|
+
inTransit: number;
|
|
728
|
+
}
|
|
729
|
+
interface MovementQueryParams {
|
|
730
|
+
productId?: string;
|
|
731
|
+
branchId?: string;
|
|
732
|
+
type?: StockMovementType;
|
|
733
|
+
startDate?: string;
|
|
734
|
+
endDate?: string;
|
|
735
|
+
page?: number;
|
|
736
|
+
limit?: number;
|
|
737
|
+
sort?: string;
|
|
738
|
+
after?: string;
|
|
739
|
+
cursor?: string;
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
export type { CreateTransferPayload as $, PurchasePaymentTerms as A, BranchStock as B, PurchaseActionType as C, PurchasePaymentDetails as D, PurchaseItem as E, PurchaseItemDoc as F, PurchaseStatusHistoryEntry as G, Purchase as H, CreatePurchasePayload as I, PurchaseReceivePayload as J, PurchasePayPayload as K, PurchaseCancelPayload as L, PurchaseActionPayload as M, TransferType as N, TransferActionType as O, PosProduct as P, TransferItemPayload as Q, RecordPurchasePayload as R, SplitPaymentEntry as S, TransferStatus as T, UpdatePurchasePayload as U, VariantStock as V, TransferItem as W, TransportDetails as X, TransferStatusHistoryEntry as Y, InventoryTransfer as Z, Transfer as _, PosProductsResponse as a, TransferActionPayload as a0, UpdateTransferPayload as a1, DispatchTransferPayload as a2, ReceiveTransferPayload as a3, StockRequestStatus as a4, StockRequestActionType as a5, StockRequestPriority as a6, StockRequestItem as a7, StockRequest as a8, CreateStockRequestPayload as a9, StockRequestActionPayload as aa, AdjustmentItem as ab, CreateAdjustmentPayload as ac, BulkAdjustmentPayload as ad, AdjustStockPayload as ae, AdjustStockResult as af, LowStockItem as ag, TransferStats as ah, MovementQueryParams as ai, PosProductsSummary as b, PosProductsBranch as c, PosProductsParams as d, PosLookupProduct as e, PosLookupData as f, PosLookupResponse as g, PosLookupResult as h, PosOrderItem as i, PosPayment as j, PosCustomer as k, PosOrderPayload as l, PosPaymentMethod as m, PosReceiptItem as n, PosReceiptVat as o, PosReceiptData as p, PosReceiptResponse as q, PosReceipt as r, PosCartItem as s, PaymentOption as t, PaymentState as u, StockEntry as v, StockMovement as w, StockMovementType as x, PurchaseStatus as y, PurchasePaymentStatus as z };
|