@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,512 @@
|
|
|
1
|
+
import { S as StockApi, P as PurchaseApi, T as TransferApi, R as RequestApi, M as MovementApi, A as AdjustmentApi, c as SupplierApi, g as Supplier, h as SupplierCreatePayload, i as SupplierUpdatePayload } from '../stock-DEApGC-w.js';
|
|
2
|
+
export { j as SupplierListResponse, f as SupplierPaymentTerms, d as SupplierQueryParams, k as SupplierResponse, e as SupplierType, a as adjustmentApi, m as movementApi, p as purchaseApi, r as requestApi, s as stockApi, b as supplierApi, t as transferApi } from '../stock-DEApGC-w.js';
|
|
3
|
+
import { P as PosProduct, a as PosProductsResponse, g as PosLookupResponse, ac as CreateAdjustmentPayload, ad as BulkAdjustmentPayload, v as StockEntry, H as Purchase, I as CreatePurchasePayload, U as UpdatePurchasePayload, Z as InventoryTransfer, $ as CreateTransferPayload, a1 as UpdateTransferPayload, _ as Transfer, a2 as DispatchTransferPayload, a3 as ReceiveTransferPayload, ah as TransferStats, af as AdjustStockResult, ai as MovementQueryParams, w as StockMovement, ag as LowStockItem, a8 as StockRequest, a9 as CreateStockRequestPayload } from '../inventory-DCiIZh8P.js';
|
|
4
|
+
export { ae as AdjustStockPayload, ab as AdjustmentItem, M as PurchaseActionPayload, C as PurchaseActionType, L as PurchaseCancelPayload, E as PurchaseItem, F as PurchaseItemDoc, K as PurchasePayPayload, D as PurchasePaymentDetails, z as PurchasePaymentStatus, A as PurchasePaymentTerms, J as PurchaseReceivePayload, y as PurchaseStatus, G as PurchaseStatusHistoryEntry, R as RecordPurchasePayload, x as StockMovementType, aa as StockRequestActionPayload, a5 as StockRequestActionType, a7 as StockRequestItem, a6 as StockRequestPriority, a4 as StockRequestStatus, a0 as TransferActionPayload, O as TransferActionType, W as TransferItem, Q as TransferItemPayload, T as TransferStatus, Y as TransferStatusHistoryEntry, N as TransferType, X as TransportDetails } from '../inventory-DCiIZh8P.js';
|
|
5
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
|
+
import { useMutation } from '@tanstack/react-query';
|
|
7
|
+
import { b as CrudHooksReturn, k as QueryKeys, L as ListOptions, l as ListQueryResult, D as DetailOptions, m as DetailQueryResult, N as NavigateFn, d as CrudActions } from '../crud.factory-DyKaPHcU.js';
|
|
8
|
+
import { A as ApiResponse } from '../api-factory-B_h4RKBm.js';
|
|
9
|
+
import '../product-p09zXkXB.js';
|
|
10
|
+
|
|
11
|
+
declare const inventoryApis: {
|
|
12
|
+
readonly stock: () => Promise<StockApi>;
|
|
13
|
+
readonly purchase: () => Promise<PurchaseApi>;
|
|
14
|
+
readonly transfer: () => Promise<TransferApi>;
|
|
15
|
+
readonly request: () => Promise<RequestApi>;
|
|
16
|
+
readonly movement: () => Promise<MovementApi>;
|
|
17
|
+
readonly adjustment: () => Promise<AdjustmentApi>;
|
|
18
|
+
readonly supplier: () => Promise<SupplierApi>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
declare const INVENTORY_KEYS: {
|
|
22
|
+
all: readonly ["inventory"];
|
|
23
|
+
products: (branchId?: string) => readonly ["inventory", "products", string | undefined];
|
|
24
|
+
productsList: (branchId?: string, params?: Record<string, unknown>) => readonly ["inventory", "products", string | undefined, Record<string, unknown> | undefined];
|
|
25
|
+
lookup: (code: string, branchId?: string) => readonly ["inventory", "lookup", string, string | undefined];
|
|
26
|
+
};
|
|
27
|
+
interface InventoryFilters {
|
|
28
|
+
category?: string;
|
|
29
|
+
parentCategory?: string;
|
|
30
|
+
search?: string;
|
|
31
|
+
inStockOnly?: boolean;
|
|
32
|
+
lowStockOnly?: boolean;
|
|
33
|
+
outOfStockOnly?: boolean;
|
|
34
|
+
after?: string;
|
|
35
|
+
limit?: number;
|
|
36
|
+
sort?: string;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
}
|
|
39
|
+
interface InventorySummary {
|
|
40
|
+
totalItems: number;
|
|
41
|
+
totalQuantity: number;
|
|
42
|
+
lowStockCount: number;
|
|
43
|
+
outOfStockCount: number;
|
|
44
|
+
}
|
|
45
|
+
interface UseInventoryReturn {
|
|
46
|
+
items: PosProduct[];
|
|
47
|
+
summary: InventorySummary;
|
|
48
|
+
branch: PosProductsResponse["branch"];
|
|
49
|
+
hasMore: boolean;
|
|
50
|
+
nextCursor: string | null;
|
|
51
|
+
isLoading: boolean;
|
|
52
|
+
isFetching: boolean;
|
|
53
|
+
error: Error | null;
|
|
54
|
+
refetch: () => void;
|
|
55
|
+
}
|
|
56
|
+
interface UseStockActionsReturn {
|
|
57
|
+
adjust: (data: CreateAdjustmentPayload) => Promise<unknown>;
|
|
58
|
+
isAdjusting: boolean;
|
|
59
|
+
setStock: (params: {
|
|
60
|
+
productId: string;
|
|
61
|
+
quantity: number;
|
|
62
|
+
branchId?: string;
|
|
63
|
+
variantSku?: string;
|
|
64
|
+
notes?: string;
|
|
65
|
+
}) => Promise<unknown>;
|
|
66
|
+
isSettingStock: boolean;
|
|
67
|
+
bulkAdjust: (data: BulkAdjustmentPayload) => Promise<unknown>;
|
|
68
|
+
isBulkAdjusting: boolean;
|
|
69
|
+
isLoading: boolean;
|
|
70
|
+
}
|
|
71
|
+
interface QueryOptions$2 {
|
|
72
|
+
enabled?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Hook to fetch inventory products with branch stock
|
|
76
|
+
* Uses POS API: GET /pos/products
|
|
77
|
+
*
|
|
78
|
+
* @param token - Auth token
|
|
79
|
+
* @param branchId - Branch to get stock for
|
|
80
|
+
* @param filters - Product filters
|
|
81
|
+
* @param options - Query options
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* function InventoryTable({ branchId }) {
|
|
86
|
+
* const { items, summary, isLoading } = useInventory(token, branchId, {
|
|
87
|
+
* category: 'electronics',
|
|
88
|
+
* lowStockOnly: true,
|
|
89
|
+
* });
|
|
90
|
+
*
|
|
91
|
+
* return (
|
|
92
|
+
* <Table data={items} />
|
|
93
|
+
* );
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
declare function useInventory(token: string, branchId: string | undefined, filters?: InventoryFilters, options?: QueryOptions$2): UseInventoryReturn;
|
|
98
|
+
/**
|
|
99
|
+
* Hook for barcode/SKU lookup
|
|
100
|
+
*
|
|
101
|
+
* @param token - Auth token
|
|
102
|
+
* @param code - Barcode or SKU to lookup
|
|
103
|
+
* @param branchId - Branch for stock info
|
|
104
|
+
* @param options - Query options
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```tsx
|
|
108
|
+
* function BarcodeScanner({ branchId }) {
|
|
109
|
+
* const [code, setCode] = useState('');
|
|
110
|
+
* const { data, isFetching } = useInventoryLookup(token, code, branchId, {
|
|
111
|
+
* enabled: code.length >= 2,
|
|
112
|
+
* });
|
|
113
|
+
*
|
|
114
|
+
* return <Input value={code} onChange={e => setCode(e.target.value)} />;
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
declare function useInventoryLookup(token: string, code: string, branchId?: string, options?: QueryOptions$2): _tanstack_react_query.UseQueryResult<PosLookupResponse, Error>;
|
|
119
|
+
/**
|
|
120
|
+
* Hook for stock adjustment actions
|
|
121
|
+
*
|
|
122
|
+
* @param token - Auth token
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```tsx
|
|
126
|
+
* function StockAdjuster({ product, branchId }) {
|
|
127
|
+
* const { adjust, isAdjusting } = useStockActions(token);
|
|
128
|
+
*
|
|
129
|
+
* const handleAdjust = async (quantity: number) => {
|
|
130
|
+
* await adjust({
|
|
131
|
+
* productId: product._id,
|
|
132
|
+
* quantity,
|
|
133
|
+
* mode: 'set',
|
|
134
|
+
* branchId,
|
|
135
|
+
* });
|
|
136
|
+
* };
|
|
137
|
+
*
|
|
138
|
+
* return <Button onClick={() => handleAdjust(10)} disabled={isAdjusting}>Set Stock</Button>;
|
|
139
|
+
* }
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
declare function useStockActions(token: string): UseStockActionsReturn;
|
|
143
|
+
/**
|
|
144
|
+
* Helper to determine stock status
|
|
145
|
+
*/
|
|
146
|
+
declare function getStockStatus(quantity: number, lowThreshold?: number): "out" | "low" | "ok";
|
|
147
|
+
/**
|
|
148
|
+
* Helper to format stock status badge props
|
|
149
|
+
*/
|
|
150
|
+
declare function getStockStatusBadge(status: "out" | "low" | "ok"): {
|
|
151
|
+
variant: "destructive";
|
|
152
|
+
label: string;
|
|
153
|
+
} | {
|
|
154
|
+
variant: "warning";
|
|
155
|
+
label: string;
|
|
156
|
+
} | {
|
|
157
|
+
variant: "success";
|
|
158
|
+
label: string;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Stock hooks using createCrudHooks factory
|
|
163
|
+
*
|
|
164
|
+
* Provides:
|
|
165
|
+
* - useStock: List stock entries with filtering/pagination
|
|
166
|
+
* - useStockDetail: Get single stock entry
|
|
167
|
+
* - useStockActions: CRUD mutations (limited for stock)
|
|
168
|
+
* - useStockNavigation: Navigation between stock entries
|
|
169
|
+
*/
|
|
170
|
+
declare const stockHooks: CrudHooksReturn<StockEntry, Partial<StockEntry>, Partial<StockEntry>>;
|
|
171
|
+
declare const STOCK_KEYS: QueryKeys;
|
|
172
|
+
declare const useStock: (token: string | null, params?: Record<string, unknown>, options?: ListOptions) => ListQueryResult<StockEntry>;
|
|
173
|
+
declare const useStockDetail: (id: string | null, token: string | null, options?: DetailOptions) => DetailQueryResult<StockEntry>;
|
|
174
|
+
declare const useStockNavigation: () => NavigateFn<StockEntry>;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Purchase hooks using createCrudHooks factory
|
|
178
|
+
*
|
|
179
|
+
* Provides:
|
|
180
|
+
* - usePurchases: List purchases with filtering/pagination
|
|
181
|
+
* - usePurchaseDetail: Get single purchase
|
|
182
|
+
* - usePurchaseActions: Create, update, delete mutations (basic CRUD)
|
|
183
|
+
* - usePurchaseNavigation: Navigation between purchases
|
|
184
|
+
*/
|
|
185
|
+
declare const purchaseHooks: CrudHooksReturn<Purchase, CreatePurchasePayload, UpdatePurchasePayload>;
|
|
186
|
+
declare const PURCHASE_KEYS: QueryKeys;
|
|
187
|
+
declare const usePurchases: (token: string | null, params?: Record<string, unknown>, options?: ListOptions) => ListQueryResult<Purchase>;
|
|
188
|
+
declare const usePurchaseDetail: (id: string | null, token: string | null, options?: DetailOptions) => DetailQueryResult<Purchase>;
|
|
189
|
+
declare const usePurchaseActions: () => CrudActions<CreatePurchasePayload, UpdatePurchasePayload>;
|
|
190
|
+
declare const usePurchaseNavigation: () => NavigateFn<Purchase>;
|
|
191
|
+
interface UsePurchaseStateActionsReturn {
|
|
192
|
+
receive: ReturnType<typeof useMutation<Purchase, Error, string>>;
|
|
193
|
+
pay: ReturnType<typeof useMutation<Purchase, Error, {
|
|
194
|
+
id: string;
|
|
195
|
+
amount: number;
|
|
196
|
+
method: string;
|
|
197
|
+
reference?: string;
|
|
198
|
+
}>>;
|
|
199
|
+
cancel: ReturnType<typeof useMutation<Purchase, Error, {
|
|
200
|
+
id: string;
|
|
201
|
+
reason?: string;
|
|
202
|
+
}>>;
|
|
203
|
+
isReceiving: boolean;
|
|
204
|
+
isPaying: boolean;
|
|
205
|
+
isCancelling: boolean;
|
|
206
|
+
isLoading: boolean;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Hook for purchase state actions (receive, pay, cancel)
|
|
210
|
+
*
|
|
211
|
+
* @param token - Auth token
|
|
212
|
+
* @returns Purchase state action mutations
|
|
213
|
+
*
|
|
214
|
+
* @example
|
|
215
|
+
* ```tsx
|
|
216
|
+
* const { receive, pay, cancel, isReceiving } = usePurchaseStateActions(token);
|
|
217
|
+
*
|
|
218
|
+
* // Receive a purchase (adds stock)
|
|
219
|
+
* await receive.mutateAsync(purchaseId);
|
|
220
|
+
*
|
|
221
|
+
* // Record payment
|
|
222
|
+
* await pay.mutateAsync({ id: purchaseId, amount: 1000, method: 'cash' });
|
|
223
|
+
*
|
|
224
|
+
* // Cancel purchase
|
|
225
|
+
* await cancel.mutateAsync({ id: purchaseId, reason: 'Duplicate entry' });
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
declare function usePurchaseStateActions(token: string): UsePurchaseStateActionsReturn;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Transfer hooks using createCrudHooks factory
|
|
232
|
+
*
|
|
233
|
+
* Provides:
|
|
234
|
+
* - useTransfers: List transfers with filtering/pagination
|
|
235
|
+
* - useTransferDetail: Get single transfer
|
|
236
|
+
* - useTransferActions: Create, update, delete mutations (basic CRUD)
|
|
237
|
+
* - useTransferNavigation: Navigation between transfers
|
|
238
|
+
*/
|
|
239
|
+
declare const transferHooks: CrudHooksReturn<InventoryTransfer, CreateTransferPayload, UpdateTransferPayload>;
|
|
240
|
+
declare const TRANSFER_KEYS: QueryKeys;
|
|
241
|
+
declare const useTransfers: (token: string | null, params?: Record<string, unknown>, options?: ListOptions) => ListQueryResult<InventoryTransfer>;
|
|
242
|
+
declare const useTransferDetail: (id: string | null, token: string | null, options?: DetailOptions) => DetailQueryResult<InventoryTransfer>;
|
|
243
|
+
declare const useTransferActions: () => CrudActions<CreateTransferPayload, UpdateTransferPayload>;
|
|
244
|
+
declare const useTransferNavigation: () => NavigateFn<InventoryTransfer>;
|
|
245
|
+
interface UseTransferStateActionsReturn {
|
|
246
|
+
approve: (id: string) => Promise<Transfer>;
|
|
247
|
+
isApproving: boolean;
|
|
248
|
+
dispatch: (params: {
|
|
249
|
+
id: string;
|
|
250
|
+
data?: DispatchTransferPayload;
|
|
251
|
+
}) => Promise<Transfer>;
|
|
252
|
+
isDispatching: boolean;
|
|
253
|
+
inTransit: (id: string) => Promise<Transfer>;
|
|
254
|
+
isMarkingInTransit: boolean;
|
|
255
|
+
receive: (params: {
|
|
256
|
+
id: string;
|
|
257
|
+
data?: ReceiveTransferPayload;
|
|
258
|
+
}) => Promise<Transfer>;
|
|
259
|
+
isReceiving: boolean;
|
|
260
|
+
cancel: (params: {
|
|
261
|
+
id: string;
|
|
262
|
+
reason?: string;
|
|
263
|
+
}) => Promise<Transfer>;
|
|
264
|
+
isCancelling: boolean;
|
|
265
|
+
isLoading: boolean;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Hook for transfer state actions (approve, dispatch, inTransit, receive, cancel)
|
|
269
|
+
*
|
|
270
|
+
* @param token - Auth token
|
|
271
|
+
* @returns Transfer state action functions
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```tsx
|
|
275
|
+
* const { approve, dispatch, receive, cancel, isApproving } = useTransferStateActions(token);
|
|
276
|
+
*
|
|
277
|
+
* // Approve a transfer
|
|
278
|
+
* await approve(transferId);
|
|
279
|
+
*
|
|
280
|
+
* // Dispatch with transport details
|
|
281
|
+
* await dispatch({ id: transferId, data: { transport: { vehicleNumber: 'ABC123' } } });
|
|
282
|
+
*
|
|
283
|
+
* // Receive a transfer
|
|
284
|
+
* await receive({ id: transferId, data: {} });
|
|
285
|
+
*
|
|
286
|
+
* // Cancel transfer
|
|
287
|
+
* await cancel({ id: transferId, reason: 'Duplicate entry' });
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
declare function useTransferStateActions(token: string): UseTransferStateActionsReturn;
|
|
291
|
+
declare const TRANSFER_STATS_KEYS: {
|
|
292
|
+
all: readonly ["transfers", "stats"];
|
|
293
|
+
byBranch: (branchId?: string) => readonly ["transfers", "stats", string | undefined];
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* Hook to fetch transfer statistics
|
|
297
|
+
*
|
|
298
|
+
* @param token - Auth token
|
|
299
|
+
* @param branchId - Optional branch filter
|
|
300
|
+
* @param options - React Query options
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```tsx
|
|
304
|
+
* const { data: stats, isLoading } = useTransferStats(token, branchId);
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
declare function useTransferStats(token: string, branchId?: string, options?: {
|
|
308
|
+
enabled?: boolean;
|
|
309
|
+
}): _tanstack_react_query.UseQueryResult<TransferStats, Error>;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Adjustment hooks using createCrudHooks factory
|
|
313
|
+
*
|
|
314
|
+
* Provides:
|
|
315
|
+
* - useAdjustments: List adjustments with filtering/pagination
|
|
316
|
+
* - useAdjustmentDetail: Get single adjustment
|
|
317
|
+
* - useAdjustmentActions: Create mutations
|
|
318
|
+
* - useAdjustmentNavigation: Navigation between adjustments
|
|
319
|
+
*/
|
|
320
|
+
declare const adjustmentHooks: CrudHooksReturn<AdjustStockResult, CreateAdjustmentPayload, Partial<CreateAdjustmentPayload>>;
|
|
321
|
+
declare const ADJUSTMENT_KEYS: QueryKeys;
|
|
322
|
+
declare const useAdjustments: (token: string | null, params?: Record<string, unknown>, options?: ListOptions) => ListQueryResult<AdjustStockResult>;
|
|
323
|
+
declare const useAdjustmentDetail: (id: string | null, token: string | null, options?: DetailOptions) => DetailQueryResult<AdjustStockResult>;
|
|
324
|
+
declare const useAdjustmentActions: () => CrudActions<CreateAdjustmentPayload, Partial<CreateAdjustmentPayload>>;
|
|
325
|
+
declare const useAdjustmentNavigation: () => NavigateFn<AdjustStockResult>;
|
|
326
|
+
|
|
327
|
+
declare const MOVEMENT_KEYS: {
|
|
328
|
+
all: readonly ["inventory", "movements"];
|
|
329
|
+
list: (params?: Record<string, unknown>) => readonly ["inventory", "movements", "list", Record<string, unknown> | undefined];
|
|
330
|
+
lowStock: (params?: Record<string, unknown>) => readonly ["inventory", "movements", "low-stock", Record<string, unknown> | undefined];
|
|
331
|
+
};
|
|
332
|
+
interface QueryOptions$1 {
|
|
333
|
+
enabled?: boolean;
|
|
334
|
+
staleTime?: number;
|
|
335
|
+
}
|
|
336
|
+
interface PaginationData {
|
|
337
|
+
page: number;
|
|
338
|
+
limit: number;
|
|
339
|
+
total: number;
|
|
340
|
+
pages: number;
|
|
341
|
+
hasNext: boolean;
|
|
342
|
+
hasPrev: boolean;
|
|
343
|
+
}
|
|
344
|
+
interface UseMovementsReturn {
|
|
345
|
+
movements: StockMovement[];
|
|
346
|
+
pagination: PaginationData | null;
|
|
347
|
+
isLoading: boolean;
|
|
348
|
+
isFetching: boolean;
|
|
349
|
+
error: Error | null;
|
|
350
|
+
refetch: () => void;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Fetch stock movements (audit trail)
|
|
354
|
+
*
|
|
355
|
+
* @param token - Auth token
|
|
356
|
+
* @param params - Query parameters (productId, branchId, type, dates, etc.)
|
|
357
|
+
* @param options - Query options
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```tsx
|
|
361
|
+
* function MovementHistory({ productId }) {
|
|
362
|
+
* const { movements, isLoading } = useMovements(token, {
|
|
363
|
+
* productId,
|
|
364
|
+
* limit: 50,
|
|
365
|
+
* });
|
|
366
|
+
*
|
|
367
|
+
* return <Timeline events={movements} />;
|
|
368
|
+
* }
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
declare function useMovements(token: string, params?: MovementQueryParams, options?: QueryOptions$1): UseMovementsReturn;
|
|
372
|
+
/**
|
|
373
|
+
* Fetch low stock items
|
|
374
|
+
*
|
|
375
|
+
* @param token - Auth token
|
|
376
|
+
* @param params - Query parameters (branchId, threshold)
|
|
377
|
+
* @param options - Query options
|
|
378
|
+
*/
|
|
379
|
+
declare function useLowStock(token: string, params?: {
|
|
380
|
+
branchId?: string;
|
|
381
|
+
threshold?: number;
|
|
382
|
+
}, options?: QueryOptions$1): _tanstack_react_query.UseQueryResult<ApiResponse<LowStockItem[]>, Error>;
|
|
383
|
+
/**
|
|
384
|
+
* Get all keys that should be invalidated when stock quantities change.
|
|
385
|
+
* Use for: receive transfer, dispatch, adjustments, purchases.
|
|
386
|
+
*/
|
|
387
|
+
declare function getStockChangeInvalidationKeys(): (readonly ["inventory"] | readonly ["inventory", "movements"])[];
|
|
388
|
+
|
|
389
|
+
declare const REQUEST_KEYS: {
|
|
390
|
+
all: readonly ["inventory", "requests"];
|
|
391
|
+
list: (params?: Record<string, unknown>) => readonly ["inventory", "requests", "list", Record<string, unknown> | undefined];
|
|
392
|
+
pending: () => readonly ["inventory", "requests", "pending"];
|
|
393
|
+
detail: (id: string) => readonly ["inventory", "requests", "detail", string];
|
|
394
|
+
};
|
|
395
|
+
interface QueryOptions {
|
|
396
|
+
enabled?: boolean;
|
|
397
|
+
staleTime?: number;
|
|
398
|
+
}
|
|
399
|
+
interface UseStockRequestsReturn {
|
|
400
|
+
requests: StockRequest[];
|
|
401
|
+
isLoading: boolean;
|
|
402
|
+
isFetching: boolean;
|
|
403
|
+
error: Error | null;
|
|
404
|
+
refetch: () => void;
|
|
405
|
+
}
|
|
406
|
+
interface UseStockRequestActionsReturn {
|
|
407
|
+
create: (data: CreateStockRequestPayload) => Promise<StockRequest>;
|
|
408
|
+
isCreating: boolean;
|
|
409
|
+
approve: (params: {
|
|
410
|
+
id: string;
|
|
411
|
+
items?: {
|
|
412
|
+
productId: string;
|
|
413
|
+
variantSku?: string;
|
|
414
|
+
quantityApproved: number;
|
|
415
|
+
}[];
|
|
416
|
+
reviewNotes?: string;
|
|
417
|
+
}) => Promise<StockRequest>;
|
|
418
|
+
isApproving: boolean;
|
|
419
|
+
reject: (params: {
|
|
420
|
+
id: string;
|
|
421
|
+
reason: string;
|
|
422
|
+
}) => Promise<StockRequest>;
|
|
423
|
+
isRejecting: boolean;
|
|
424
|
+
fulfill: (params: {
|
|
425
|
+
id: string;
|
|
426
|
+
remarks?: string;
|
|
427
|
+
items?: {
|
|
428
|
+
productId: string;
|
|
429
|
+
variantSku?: string;
|
|
430
|
+
quantity: number;
|
|
431
|
+
cartonNumber?: string;
|
|
432
|
+
}[];
|
|
433
|
+
transport?: {
|
|
434
|
+
vehicleNumber?: string;
|
|
435
|
+
driverName?: string;
|
|
436
|
+
driverPhone?: string;
|
|
437
|
+
};
|
|
438
|
+
}) => Promise<StockRequest>;
|
|
439
|
+
isFulfilling: boolean;
|
|
440
|
+
cancel: (params: {
|
|
441
|
+
id: string;
|
|
442
|
+
reason?: string;
|
|
443
|
+
}) => Promise<StockRequest>;
|
|
444
|
+
isCancelling: boolean;
|
|
445
|
+
isLoading: boolean;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Fetch stock requests
|
|
449
|
+
*
|
|
450
|
+
* @param token - Auth token
|
|
451
|
+
* @param params - Query parameters (status, branchId, etc.)
|
|
452
|
+
* @param options - Query options
|
|
453
|
+
*/
|
|
454
|
+
declare function useStockRequests(token: string, params?: Record<string, unknown>, options?: QueryOptions): UseStockRequestsReturn;
|
|
455
|
+
/**
|
|
456
|
+
* Fetch pending stock requests
|
|
457
|
+
*
|
|
458
|
+
* @param token - Auth token
|
|
459
|
+
* @param options - Query options
|
|
460
|
+
*/
|
|
461
|
+
declare function usePendingStockRequests(token: string, options?: QueryOptions): UseStockRequestsReturn;
|
|
462
|
+
/**
|
|
463
|
+
* Stock request detail
|
|
464
|
+
*
|
|
465
|
+
* @param token - Auth token
|
|
466
|
+
* @param id - Request ID
|
|
467
|
+
* @param options - Query options
|
|
468
|
+
*/
|
|
469
|
+
declare function useStockRequestDetail(token: string, id: string | null, options?: QueryOptions): _tanstack_react_query.UseQueryResult<ApiResponse<StockRequest>, Error>;
|
|
470
|
+
/**
|
|
471
|
+
* Stock request actions (create, approve, reject, fulfill, cancel)
|
|
472
|
+
*
|
|
473
|
+
* @param token - Auth token
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```tsx
|
|
477
|
+
* function RequestActions({ request }) {
|
|
478
|
+
* const { approve, reject, fulfill, isLoading } = useStockRequestActions(token);
|
|
479
|
+
*
|
|
480
|
+
* return (
|
|
481
|
+
* <>
|
|
482
|
+
* <Button onClick={() => approve({ id: request._id })}>Approve</Button>
|
|
483
|
+
* <Button onClick={() => reject({ id: request._id, reason: 'Out of stock' })}>Reject</Button>
|
|
484
|
+
* </>
|
|
485
|
+
* );
|
|
486
|
+
* }
|
|
487
|
+
* ```
|
|
488
|
+
*/
|
|
489
|
+
declare function useStockRequestActions(token: string): UseStockRequestActionsReturn;
|
|
490
|
+
/**
|
|
491
|
+
* Get all keys that should be invalidated when a transfer state changes.
|
|
492
|
+
* Use for: approve, dispatch, receive, cancel.
|
|
493
|
+
*/
|
|
494
|
+
declare function getTransferStateInvalidationKeys(): (string[] | readonly ["inventory", "requests"])[];
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Supplier hooks using createCrudHooks factory
|
|
498
|
+
*
|
|
499
|
+
* Provides:
|
|
500
|
+
* - useSuppliers: List suppliers with filtering/pagination
|
|
501
|
+
* - useSupplierDetail: Get single supplier
|
|
502
|
+
* - useSupplierActions: Create, update, delete mutations
|
|
503
|
+
* - useSupplierNavigation: Navigation between suppliers
|
|
504
|
+
*/
|
|
505
|
+
declare const supplierHooks: CrudHooksReturn<Supplier, SupplierCreatePayload, SupplierUpdatePayload>;
|
|
506
|
+
declare const SUPPLIER_KEYS: QueryKeys;
|
|
507
|
+
declare const useSuppliers: (token: string | null, params?: Record<string, unknown>, options?: ListOptions) => ListQueryResult<Supplier>;
|
|
508
|
+
declare const useSupplierDetail: (id: string | null, token: string | null, options?: DetailOptions) => DetailQueryResult<Supplier>;
|
|
509
|
+
declare const useSupplierActions: () => CrudActions<SupplierCreatePayload, SupplierUpdatePayload>;
|
|
510
|
+
declare const useSupplierNavigation: () => NavigateFn<Supplier>;
|
|
511
|
+
|
|
512
|
+
export { ADJUSTMENT_KEYS, AdjustStockResult, AdjustmentApi, BulkAdjustmentPayload, CreateAdjustmentPayload, CreatePurchasePayload, CreateStockRequestPayload, CreateTransferPayload, DispatchTransferPayload, INVENTORY_KEYS, type InventoryFilters, type InventorySummary, InventoryTransfer, LowStockItem, MOVEMENT_KEYS, MovementApi, MovementQueryParams, PURCHASE_KEYS, Purchase, PurchaseApi, REQUEST_KEYS, ReceiveTransferPayload, RequestApi, STOCK_KEYS, SUPPLIER_KEYS, StockApi, StockEntry, StockMovement, StockRequest, Supplier, SupplierApi, SupplierCreatePayload, SupplierUpdatePayload, TRANSFER_KEYS, TRANSFER_STATS_KEYS, Transfer, TransferApi, TransferStats, UpdatePurchasePayload, UpdateTransferPayload, type UseInventoryReturn, type UseMovementsReturn, type UsePurchaseStateActionsReturn, type UseStockActionsReturn, type UseStockRequestActionsReturn, type UseStockRequestsReturn, type UseTransferStateActionsReturn, adjustmentHooks, getStockChangeInvalidationKeys, getStockStatus, getStockStatusBadge, getTransferStateInvalidationKeys, inventoryApis, purchaseHooks, stockHooks, supplierHooks, transferHooks, useAdjustmentActions, useAdjustmentDetail, useAdjustmentNavigation, useAdjustments, useInventory, useInventoryLookup, useLowStock, useMovements, usePendingStockRequests, usePurchaseActions, usePurchaseDetail, usePurchaseNavigation, usePurchaseStateActions, usePurchases, useStock, useStockActions, useStockDetail, useStockActions as useStockEntryActions, useStockNavigation, useStockRequestActions, useStockRequestDetail, useStockRequests, useSupplierActions, useSupplierDetail, useSupplierNavigation, useSuppliers, useTransferActions, useTransferDetail, useTransferNavigation, useTransferStateActions, useTransferStats, useTransfers };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export { ADJUSTMENT_KEYS, INVENTORY_KEYS, MOVEMENT_KEYS, PURCHASE_KEYS, REQUEST_KEYS, STOCK_KEYS, SUPPLIER_KEYS, TRANSFER_KEYS, TRANSFER_STATS_KEYS, adjustmentHooks, getStockChangeInvalidationKeys, getStockStatus, getStockStatusBadge, getTransferStateInvalidationKeys, inventoryApis, purchaseHooks, stockHooks, supplierHooks, transferHooks, useAdjustmentActions, useAdjustmentDetail, useAdjustmentNavigation, useAdjustments, useInventory, useInventoryLookup, useLowStock, useMovements, usePendingStockRequests, usePurchaseActions, usePurchaseDetail, usePurchaseNavigation, usePurchaseStateActions, usePurchases, useStock, useStockActions, useStockDetail, useStockActions as useStockEntryActions, useStockNavigation, useStockRequestActions, useStockRequestDetail, useStockRequests, useSupplierActions, useSupplierDetail, useSupplierNavigation, useSuppliers, useTransferActions, useTransferDetail, useTransferNavigation, useTransferStateActions, useTransferStats, useTransfers } from '../chunk-IXMWZJLV.js';
|
|
3
|
+
export { PurchaseApi, purchaseApi } from '../chunk-6RYGA6MF.js';
|
|
4
|
+
export { TransferApi, transferApi } from '../chunk-FA7QFJ2G.js';
|
|
5
|
+
export { RequestApi, requestApi } from '../chunk-QO5AGZFP.js';
|
|
6
|
+
export { MovementApi, movementApi } from '../chunk-SZYWG5IB.js';
|
|
7
|
+
export { AdjustmentApi, adjustmentApi } from '../chunk-R5Z7NYLH.js';
|
|
8
|
+
export { SupplierApi, supplierApi } from '../chunk-WUOQK7BO.js';
|
|
9
|
+
export { StockApi, stockApi } from '../chunk-KZIGRIQG.js';
|
|
10
|
+
import '../chunk-66OQAZSL.js';
|
|
11
|
+
import '../chunk-I5TIKUIQ.js';
|
|
12
|
+
import '../chunk-B6MPVOV7.js';
|
|
13
|
+
import '../chunk-U3XT35GZ.js';
|
|
14
|
+
import '../chunk-VR36QVX2.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|