@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,585 @@
1
+ import { C as Cart, a as CartItem, A as AddCartItemPayload, U as UpdateCartItemPayload, h as Order, s as CreateOrderPayload, F as FulfillOrderPayload, x as RequestShippingPayload, n as OrderShipping, y as UpdateShippingPayload, z as Customer, G as CustomerPayload } from '../pos-D1jkkFl0.js';
2
+ export { c as AddToCartPayload, u as CancelOrderPayload, v as CancelRequestPayload, q as CancellationRequest, e as CartItemVariation, d as CartResponse, b as CartSummary, B as CustomerAddress, T as CustomerApi, K as CustomerGender, I as CustomerListResponse, E as CustomerMembership, H as CustomerQueryParams, J as CustomerResponse, D as CustomerStats, L as CustomerTier, k as OrderAddress, j as OrderDelivery, i as OrderItem, p as OrderParcel, m as OrderPayment, o as OrderShippingHistory, O as OrderStatus, l as OrderVat, r as PaymentData, f as PaymentStatus, P as PopulatedCartItem, w as RefundOrderPayload, R as RemoveCartItemPayload, g as ShippingProvider, S as ShippingStatus, t as UpdateStatusPayload, M as cartApi, Q as customerApi, N as orderApi, N as orderApiDefault, V as posApi, V as posApiDefault } from '../pos-D1jkkFl0.js';
3
+ import { P as PosProduct, a as PosProductsResponse, g as PosLookupResponse, q as PosReceiptResponse, l as PosOrderPayload, ac as CreateAdjustmentPayload, ad as BulkAdjustmentPayload } from '../inventory-DCiIZh8P.js';
4
+ export { B as BranchStock, t as PaymentOption, u as PaymentState, s as PosCartItem, k as PosCustomer, f as PosLookupData, e as PosLookupProduct, h as PosLookupResult, i as PosOrderItem, j as PosPayment, m as PosPaymentMethod, c as PosProductsBranch, d as PosProductsParams, b as PosProductsSummary, r as PosReceipt, p as PosReceiptData, n as PosReceiptItem, o as PosReceiptVat, S as SplitPaymentEntry, V as VariantStock } from '../inventory-DCiIZh8P.js';
5
+ import { b as ProductVariant } from '../product-p09zXkXB.js';
6
+ import { k as QueryKeys, b as CrudHooksReturn, L as ListOptions, l as ListQueryResult, D as DetailOptions, m as DetailQueryResult, d as CrudActions, N as NavigateFn } from '../crud.factory-DyKaPHcU.js';
7
+ import * as _tanstack_react_query from '@tanstack/react-query';
8
+ import '../api-factory-B_h4RKBm.js';
9
+
10
+ declare const CART_KEYS: QueryKeys;
11
+ /**
12
+ * Calculate unit price for a cart item
13
+ * Handles both simple products and variant products
14
+ */
15
+ declare function calculateItemPrice(item: CartItem): number;
16
+ /**
17
+ * Calculate total for a cart item
18
+ */
19
+ declare function calculateItemTotal(item: CartItem): number;
20
+ /**
21
+ * Calculate cart subtotal
22
+ */
23
+ declare function calculateCartSubtotal(items: CartItem[]): number;
24
+ /**
25
+ * Get total item count in cart
26
+ */
27
+ declare function getCartItemCount(items: CartItem[]): number;
28
+ /**
29
+ * Get variant details from a cart item
30
+ */
31
+ declare function getCartItemVariant(item: CartItem): ProductVariant | null;
32
+ /**
33
+ * Format variant attributes for display
34
+ * @example "Size: M, Color: Red"
35
+ */
36
+ declare function formatVariantAttributes(attributes?: Record<string, string> | null): string;
37
+ interface UseCartReturn {
38
+ cart: Cart | null | undefined;
39
+ items: CartItem[];
40
+ itemCount: number;
41
+ subtotal: number;
42
+ isLoading: boolean;
43
+ isFetching: boolean;
44
+ isUpdating: boolean;
45
+ error: Error | null;
46
+ addToCart: (data: AddCartItemPayload) => void;
47
+ addToCartAsync: (data: AddCartItemPayload) => Promise<Cart>;
48
+ updateCartItem: (data: UpdateCartItemPayload) => void;
49
+ updateCartItemAsync: (data: UpdateCartItemPayload) => Promise<Cart>;
50
+ removeCartItem: (itemId: string) => void;
51
+ removeCartItemAsync: (itemId: string) => Promise<Cart>;
52
+ clearCart: () => void;
53
+ clearCartAsync: () => Promise<Cart>;
54
+ refetch: () => void;
55
+ getItemPrice: typeof calculateItemPrice;
56
+ }
57
+ interface UseCartCountReturn {
58
+ count: number;
59
+ isLoading: boolean;
60
+ }
61
+ interface CartOptions {
62
+ enabled?: boolean;
63
+ staleTime?: number;
64
+ gcTime?: number;
65
+ }
66
+ /**
67
+ * Full cart hook with optimistic updates
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * function CartPage() {
72
+ * const {
73
+ * items,
74
+ * itemCount,
75
+ * subtotal,
76
+ * addToCart,
77
+ * updateCartItem,
78
+ * removeCartItem,
79
+ * clearCart,
80
+ * isLoading,
81
+ * isUpdating,
82
+ * } = useCart(token);
83
+ *
84
+ * // Add item
85
+ * addToCart({ productId: "123", quantity: 2 });
86
+ *
87
+ * // Add variant item
88
+ * addToCart({ productId: "123", variantSku: "SIZE-M", quantity: 1 });
89
+ *
90
+ * // Update quantity
91
+ * updateCartItem({ itemId: "item_id", quantity: 3 });
92
+ *
93
+ * // Remove item
94
+ * removeCartItem("item_id");
95
+ *
96
+ * // Clear cart
97
+ * clearCart();
98
+ * }
99
+ * ```
100
+ */
101
+ declare function useCart(token: string | null | undefined, options?: CartOptions): UseCartReturn;
102
+ /**
103
+ * Lightweight hook for cart count (header badge)
104
+ *
105
+ * @example
106
+ * ```tsx
107
+ * function CartBadge() {
108
+ * const { count, isLoading } = useCartCount(token);
109
+ * return <Badge>{isLoading ? "..." : count}</Badge>;
110
+ * }
111
+ * ```
112
+ */
113
+ declare function useCartCount(token: string | null | undefined, options?: CartOptions): UseCartCountReturn;
114
+
115
+ /**
116
+ * Order hooks using createCrudHooks factory
117
+ *
118
+ * Provides:
119
+ * - useOrders: List orders with filtering/pagination
120
+ * - useOrderDetail: Get single order
121
+ * - useOrderActions: Create, update, delete mutations
122
+ * - useOrderNavigation: Navigation between orders
123
+ */
124
+ declare const orderHooks: CrudHooksReturn<Order, CreateOrderPayload, Partial<Order>>;
125
+ declare const ORDER_KEYS: {
126
+ all: readonly ["orders"];
127
+ lists: () => readonly ["orders", "list"];
128
+ list: (params?: Record<string, unknown>) => readonly ["orders", "list", Record<string, unknown> | undefined];
129
+ details: () => readonly ["orders", "detail"];
130
+ detail: (id: string) => readonly ["orders", "detail", string];
131
+ myOrders: (params?: Record<string, unknown>) => readonly ["orders", "my", Record<string, unknown> | undefined];
132
+ myDetail: (id: string) => readonly ["orders", "my", "detail", string];
133
+ };
134
+ declare const useOrders: (token: string | null, params?: Record<string, unknown>, options?: ListOptions) => ListQueryResult<Order>;
135
+ declare const useOrderDetail: (id: string | null, token: string | null, options?: DetailOptions) => DetailQueryResult<Order>;
136
+ declare const useOrderActions: () => CrudActions<CreateOrderPayload, Partial<Order>>;
137
+ declare const useOrderNavigation: () => NavigateFn<Order>;
138
+ interface QueryOptions$2 {
139
+ enabled?: boolean;
140
+ staleTime?: number;
141
+ }
142
+ interface UseMyOrdersReturn {
143
+ orders: Order[];
144
+ total: number;
145
+ page: number;
146
+ limit: number;
147
+ hasMore: boolean;
148
+ isLoading: boolean;
149
+ isFetching: boolean;
150
+ error: Error | null;
151
+ refetch: () => void;
152
+ }
153
+ interface UseCustomerOrderActionsReturn {
154
+ checkout: (data: CreateOrderPayload) => Promise<Order>;
155
+ isCheckingOut: boolean;
156
+ requestCancel: (params: {
157
+ orderId: string;
158
+ reason?: string;
159
+ }) => Promise<Order>;
160
+ isRequestingCancel: boolean;
161
+ isLoading: boolean;
162
+ }
163
+ interface UseAdminOrderActionsReturn {
164
+ updateStatus: (params: {
165
+ orderId: string;
166
+ status: string;
167
+ note?: string;
168
+ }) => Promise<Order>;
169
+ isUpdatingStatus: boolean;
170
+ fulfillOrder: (params: FulfillOrderPayload & {
171
+ orderId: string;
172
+ }) => Promise<Order>;
173
+ isFulfilling: boolean;
174
+ refundOrder: (params: {
175
+ orderId: string;
176
+ amount?: number;
177
+ reason?: string;
178
+ }) => Promise<Order>;
179
+ isRefunding: boolean;
180
+ cancelOrder: (params: {
181
+ orderId: string;
182
+ reason?: string;
183
+ refund?: boolean;
184
+ }) => Promise<Order>;
185
+ isCancelling: boolean;
186
+ requestShipping: (params: RequestShippingPayload & {
187
+ orderId: string;
188
+ }) => Promise<OrderShipping>;
189
+ isRequestingShipping: boolean;
190
+ updateShipping: (params: UpdateShippingPayload & {
191
+ orderId: string;
192
+ }) => Promise<OrderShipping>;
193
+ isUpdatingShipping: boolean;
194
+ isLoading: boolean;
195
+ }
196
+ /**
197
+ * Get customer's own orders
198
+ *
199
+ * @param token - Auth token
200
+ * @param params - Query params { page, limit, status, sort }
201
+ * @param options - Query options
202
+ *
203
+ * @example
204
+ * ```tsx
205
+ * function MyOrdersPage() {
206
+ * const { orders, isLoading, hasMore } = useMyOrders(token, { limit: 10 });
207
+ *
208
+ * return (
209
+ * <OrderList orders={orders} loading={isLoading} />
210
+ * );
211
+ * }
212
+ * ```
213
+ */
214
+ declare function useMyOrders(token: string, params?: Record<string, unknown>, options?: QueryOptions$2): UseMyOrdersReturn;
215
+ /**
216
+ * Get customer's own order detail
217
+ *
218
+ * @param token - Auth token
219
+ * @param orderId - Order ID
220
+ * @param options - Query options
221
+ *
222
+ * @example
223
+ * ```tsx
224
+ * function OrderDetailPage({ orderId }) {
225
+ * const { data: order, isLoading } = useMyOrderDetail(token, orderId);
226
+ *
227
+ * if (isLoading) return <Skeleton />;
228
+ * return <OrderDetail order={order} />;
229
+ * }
230
+ * ```
231
+ */
232
+ declare function useMyOrderDetail(token: string, orderId: string, options?: QueryOptions$2): _tanstack_react_query.UseQueryResult<Order, Error>;
233
+ /**
234
+ * Customer order actions (checkout, request cancellation)
235
+ *
236
+ * @param token - Customer auth token
237
+ *
238
+ * @example
239
+ * ```tsx
240
+ * function CheckoutButton({ cart }) {
241
+ * const { checkout, isCheckingOut } = useCustomerOrderActions(token);
242
+ *
243
+ * const handleCheckout = async () => {
244
+ * const order = await checkout({
245
+ * items: cart.items,
246
+ * shipping: shippingAddress,
247
+ * payment: { method: 'bkash' },
248
+ * });
249
+ * router.push(`/orders/${order._id}`);
250
+ * };
251
+ *
252
+ * return (
253
+ * <Button onClick={handleCheckout} disabled={isCheckingOut}>
254
+ * {isCheckingOut ? 'Processing...' : 'Place Order'}
255
+ * </Button>
256
+ * );
257
+ * }
258
+ * ```
259
+ */
260
+ declare function useCustomerOrderActions(token: string): UseCustomerOrderActionsReturn;
261
+ /**
262
+ * Admin order actions (status, fulfill, refund, cancel, shipping)
263
+ *
264
+ * @param token - Admin auth token
265
+ *
266
+ * @example
267
+ * ```tsx
268
+ * function OrderActions({ order }) {
269
+ * const {
270
+ * updateStatus,
271
+ * fulfillOrder,
272
+ * cancelOrder,
273
+ * isLoading,
274
+ * } = useAdminOrderActions(token);
275
+ *
276
+ * return (
277
+ * <>
278
+ * <Button onClick={() => updateStatus({ orderId: order._id, status: 'processing' })}>
279
+ * Mark Processing
280
+ * </Button>
281
+ * <Button onClick={() => fulfillOrder({ orderId: order._id, branchId: 'branch_123' })}>
282
+ * Fulfill Order
283
+ * </Button>
284
+ * </>
285
+ * );
286
+ * }
287
+ * ```
288
+ */
289
+ declare function useAdminOrderActions(token: string): UseAdminOrderActionsReturn;
290
+
291
+ interface QueryOptions$1 {
292
+ enabled?: boolean;
293
+ staleTime?: number;
294
+ }
295
+ type MembershipAction = "enroll" | "deactivate" | "reactivate" | "adjust";
296
+ type PointsType = "bonus" | "correction" | "manual_redemption" | "redemption" | "expiry";
297
+ interface MembershipActionParams {
298
+ id: string;
299
+ action: MembershipAction;
300
+ points?: number;
301
+ reason?: string;
302
+ type?: PointsType;
303
+ }
304
+ interface UseCustomerMembershipReturn {
305
+ membershipAction: (params: MembershipActionParams) => Promise<Customer>;
306
+ isPending: boolean;
307
+ }
308
+ /**
309
+ * Customer hooks using createCrudHooks factory
310
+ *
311
+ * Provides:
312
+ * - useCustomers: List customers with filtering/pagination
313
+ * - useCustomerDetail: Get single customer
314
+ * - useCustomerActions: Create, update, delete mutations
315
+ * - useCustomerNavigation: Navigation between customers
316
+ */
317
+ declare const customerHooks: CrudHooksReturn<Customer, CustomerPayload, CustomerPayload>;
318
+ declare const CUSTOMER_KEYS: QueryKeys;
319
+ declare const useCustomers: (token: string | null, params?: Record<string, unknown>, options?: ListOptions) => ListQueryResult<Customer>;
320
+ declare const useCustomerDetail: (id: string | null, token: string | null, options?: DetailOptions) => DetailQueryResult<Customer>;
321
+ declare const useCustomerActions: () => CrudActions<CustomerPayload, CustomerPayload>;
322
+ declare const useCustomerNavigation: () => NavigateFn<Customer>;
323
+ /**
324
+ * Get current user's customer profile
325
+ *
326
+ * @param token - Auth token
327
+ * @param options - Query options
328
+ *
329
+ * @example
330
+ * ```tsx
331
+ * function ProfilePage() {
332
+ * const { data: customer, isLoading } = useCurrentCustomer(token);
333
+ *
334
+ * if (isLoading) return <Skeleton />;
335
+ * return (
336
+ * <div>
337
+ * <h1>{customer?.name}</h1>
338
+ * <p>Points: {customer?.membership?.points || 0}</p>
339
+ * </div>
340
+ * );
341
+ * }
342
+ * ```
343
+ */
344
+ declare function useCurrentCustomer(token: string, options?: QueryOptions$1): _tanstack_react_query.UseQueryResult<Customer, Error>;
345
+ /**
346
+ * Customer membership actions (enroll, deactivate, reactivate, adjust points)
347
+ *
348
+ * @param token - Admin auth token
349
+ *
350
+ * @example
351
+ * ```tsx
352
+ * function MembershipManager({ customer }) {
353
+ * const { membershipAction, isPending } = useCustomerMembership(token);
354
+ *
355
+ * const handleEnroll = async () => {
356
+ * await membershipAction({
357
+ * id: customer._id,
358
+ * action: 'enroll',
359
+ * });
360
+ * };
361
+ *
362
+ * const handleAdjustPoints = async (points: number) => {
363
+ * await membershipAction({
364
+ * id: customer._id,
365
+ * action: 'adjust',
366
+ * points,
367
+ * type: 'bonus',
368
+ * reason: 'Birthday bonus',
369
+ * });
370
+ * };
371
+ *
372
+ * return (
373
+ * <Button onClick={handleEnroll} disabled={isPending}>
374
+ * Enroll in Membership
375
+ * </Button>
376
+ * );
377
+ * }
378
+ * ```
379
+ */
380
+ declare function useCustomerMembership(token: string): UseCustomerMembershipReturn;
381
+
382
+ declare const POS_KEYS: {
383
+ all: readonly ["pos"];
384
+ products: (branchId?: string) => readonly ["pos", "products", string | undefined];
385
+ productsList: (branchId?: string, params?: Record<string, unknown>) => readonly ["pos", "products", string | undefined, Record<string, unknown> | undefined];
386
+ lookup: (code: string, branchId?: string) => readonly ["pos", "lookup", string, string | undefined];
387
+ orders: () => readonly ["pos", "orders"];
388
+ receipt: (orderId: string) => readonly ["pos", "orders", string, "receipt"];
389
+ };
390
+ interface PosProductFilters {
391
+ category?: string;
392
+ search?: string;
393
+ inStockOnly?: boolean;
394
+ lowStockOnly?: boolean;
395
+ after?: string;
396
+ limit?: number;
397
+ sort?: string;
398
+ [key: string]: unknown;
399
+ }
400
+ interface UsePosProductsReturn {
401
+ products: PosProduct[];
402
+ summary: PosProductsResponse["summary"];
403
+ branch: PosProductsResponse["branch"];
404
+ hasMore: boolean;
405
+ nextCursor: string | null;
406
+ isLoading: boolean;
407
+ isFetching: boolean;
408
+ error: Error | null;
409
+ refetch: () => void;
410
+ }
411
+ interface QueryOptions {
412
+ enabled?: boolean;
413
+ }
414
+ /**
415
+ * Fetch POS products with branch-specific stock
416
+ *
417
+ * @param token - Auth token
418
+ * @param branchId - Branch to get stock for
419
+ * @param filters - Product filters
420
+ * @param options - Query options
421
+ *
422
+ * @example
423
+ * ```tsx
424
+ * function ProductGrid({ branchId }) {
425
+ * const { products, isLoading, summary } = usePosProducts(token, branchId, {
426
+ * category: 'electronics',
427
+ * inStockOnly: true,
428
+ * });
429
+ *
430
+ * return (
431
+ * <Grid>
432
+ * {products.map(product => (
433
+ * <ProductCard key={product._id} product={product} />
434
+ * ))}
435
+ * </Grid>
436
+ * );
437
+ * }
438
+ * ```
439
+ */
440
+ declare function usePosProducts(token: string, branchId: string | undefined, filters?: PosProductFilters, options?: QueryOptions): UsePosProductsReturn;
441
+ /**
442
+ * Lookup product by barcode/SKU (query-based)
443
+ *
444
+ * @param token - Auth token
445
+ * @param code - Barcode or SKU to lookup
446
+ * @param branchId - Branch for stock info
447
+ * @param options - Query options
448
+ */
449
+ declare function usePosLookup(token: string, code: string, branchId?: string, options?: QueryOptions): _tanstack_react_query.UseQueryResult<PosLookupResponse, Error>;
450
+ /**
451
+ * Lookup product by barcode/SKU (mutation-based)
452
+ * Preferred for "scan -> act" flows
453
+ *
454
+ * @param token - Auth token
455
+ *
456
+ * @example
457
+ * ```tsx
458
+ * function BarcodeScanner() {
459
+ * const { lookup, isLooking } = usePosLookupMutation(token);
460
+ *
461
+ * const handleScan = async (code: string) => {
462
+ * const result = await lookup({ code, branchId });
463
+ * if (result) addToCart(result.data);
464
+ * };
465
+ * }
466
+ * ```
467
+ */
468
+ declare function usePosLookupMutation(token: string): {
469
+ lookup: _tanstack_react_query.UseMutateAsyncFunction<PosLookupResponse, Error, {
470
+ code: string;
471
+ branchId?: string;
472
+ }, unknown>;
473
+ isLooking: boolean;
474
+ error: Error | null;
475
+ };
476
+ /**
477
+ * Get receipt for an order
478
+ *
479
+ * @param token - Auth token
480
+ * @param orderId - Order ID
481
+ * @param options - Query options
482
+ */
483
+ declare function usePosReceipt(token: string, orderId: string, options?: QueryOptions): _tanstack_react_query.UseQueryResult<PosReceiptResponse, Error>;
484
+ interface UsePosOrdersReturn {
485
+ createOrder: (data: PosOrderPayload) => Promise<unknown>;
486
+ isCreatingOrder: boolean;
487
+ }
488
+ /**
489
+ * POS order operations
490
+ *
491
+ * @param token - Auth token
492
+ *
493
+ * @example
494
+ * ```tsx
495
+ * function Checkout({ cart, branchId }) {
496
+ * const { createOrder, isCreatingOrder } = usePosOrders(token);
497
+ *
498
+ * const handleCheckout = async () => {
499
+ * const order = await createOrder({
500
+ * items: cart.items,
501
+ * branchId,
502
+ * payment: { method: 'cash' },
503
+ * });
504
+ * // Handle success (show receipt, clear cart, etc.)
505
+ * };
506
+ * }
507
+ * ```
508
+ */
509
+ declare function usePosOrders(token: string): UsePosOrdersReturn;
510
+ interface UsePosStockActionsReturn {
511
+ adjustStock: (data: CreateAdjustmentPayload) => Promise<unknown>;
512
+ isAdjusting: boolean;
513
+ setStock: (params: {
514
+ productId: string;
515
+ quantity: number;
516
+ branchId?: string;
517
+ variantSku?: string;
518
+ reason?: string;
519
+ }) => Promise<unknown>;
520
+ isSetting: boolean;
521
+ bulkAdjust: (data: BulkAdjustmentPayload) => Promise<unknown>;
522
+ isBulkAdjusting: boolean;
523
+ isLoading: boolean;
524
+ }
525
+ /**
526
+ * POS stock adjustment actions
527
+ *
528
+ * @param token - Auth token
529
+ * @param branchId - Branch for cache invalidation
530
+ *
531
+ * @example
532
+ * ```tsx
533
+ * function StockAdjuster({ product, branchId }) {
534
+ * const { setStock, isSetting } = usePosStockActions(token, branchId);
535
+ *
536
+ * const handleSetStock = async (newQuantity: number) => {
537
+ * await setStock({
538
+ * productId: product._id,
539
+ * quantity: newQuantity,
540
+ * reason: 'Inventory count',
541
+ * });
542
+ * };
543
+ * }
544
+ * ```
545
+ */
546
+ declare function usePosStockActions(token: string, branchId?: string): UsePosStockActionsReturn;
547
+ /**
548
+ * Generate idempotency key for POS orders
549
+ * Format: pos_{terminal}_{timestamp}_{counter}
550
+ */
551
+ declare function generateIdempotencyKey(terminalId?: string): string;
552
+ /**
553
+ * Calculate price for variant product
554
+ */
555
+ declare function calculateVariantPrice(basePrice: number, priceModifier?: number): number;
556
+ /**
557
+ * Format variant attributes for display
558
+ */
559
+ declare function formatVariantLabel(attributes?: Record<string, string>): string;
560
+ /**
561
+ * Check if product has variants
562
+ */
563
+ declare function isVariantProduct(product: PosProduct): boolean;
564
+ /**
565
+ * Get available (active) variants for a product
566
+ */
567
+ declare function getAvailableVariants(product: PosProduct): ProductVariant[];
568
+ /**
569
+ * Find variant by SKU
570
+ */
571
+ declare function findVariantBySku(product: PosProduct, sku: string): ProductVariant | null;
572
+ /**
573
+ * Get variant stock for branch
574
+ */
575
+ declare function getVariantStock(product: PosProduct, variantSku: string): number;
576
+ /**
577
+ * Check if product/variant is in stock
578
+ */
579
+ declare function isInStock(product: PosProduct, variantSku?: string): boolean;
580
+ /**
581
+ * Get product image URL (thumbnail preferred)
582
+ */
583
+ declare function getPosProductImage(product: PosProduct): string;
584
+
585
+ export { AddCartItemPayload, CART_KEYS, CUSTOMER_KEYS, Cart, CartItem, type CartOptions, CreateOrderPayload, Customer, CustomerPayload, FulfillOrderPayload, type MembershipActionParams, ORDER_KEYS, Order, OrderShipping, POS_KEYS, PosLookupResponse, PosOrderPayload, PosProduct, type PosProductFilters, PosProductsResponse, PosReceiptResponse, RequestShippingPayload, UpdateCartItemPayload, UpdateShippingPayload, type UseAdminOrderActionsReturn, type UseCartCountReturn, type UseCartReturn, type UseCustomerMembershipReturn, type UseCustomerOrderActionsReturn, type UseMyOrdersReturn, type UsePosOrdersReturn, type UsePosProductsReturn, type UsePosStockActionsReturn, calculateCartSubtotal, calculateItemPrice, calculateItemTotal, calculateVariantPrice, customerHooks, findVariantBySku, formatVariantAttributes, formatVariantLabel, generateIdempotencyKey, getAvailableVariants, getCartItemCount, getCartItemVariant, getPosProductImage, getVariantStock, isInStock, isVariantProduct, orderHooks, useAdminOrderActions, useCart, useCartCount, useCurrentCustomer, useCustomerActions, useCustomerDetail, useCustomerMembership, useCustomerNavigation, useCustomerOrderActions, useCustomers, useMyOrderDetail, useMyOrders, useOrderActions, useOrderDetail, useOrderNavigation, useOrders, usePosLookup, usePosLookupMutation, usePosOrders, usePosProducts, usePosReceipt, usePosStockActions };
@@ -0,0 +1,9 @@
1
+ "use client";
2
+ export { CART_KEYS, CUSTOMER_KEYS, CustomerApi, ORDER_KEYS, OrderStatus, POS_KEYS, PaymentStatus, calculateCartSubtotal, calculateItemPrice, calculateItemTotal, calculateVariantPrice, cartApi, customerApi, customerHooks, findVariantBySku, formatVariantAttributes, formatVariantLabel, generateIdempotencyKey, getAvailableVariants, getCartItemCount, getCartItemVariant, getPosProductImage, getVariantStock, isInStock, isVariantProduct, orderApi, order_default as orderApiDefault, orderHooks, useAdminOrderActions, useCart, useCartCount, useCurrentCustomer, useCustomerActions, useCustomerDetail, useCustomerMembership, useCustomerNavigation, useCustomerOrderActions, useCustomers, useMyOrderDetail, useMyOrders, useOrderActions, useOrderDetail, useOrderNavigation, useOrders, usePosLookup, usePosLookupMutation, usePosOrders, usePosProducts, usePosReceipt, usePosStockActions } from '../chunk-UGELTUIZ.js';
3
+ export { posApi, pos_default as posApiDefault } from '../chunk-66OQAZSL.js';
4
+ import '../chunk-I5TIKUIQ.js';
5
+ import '../chunk-B6MPVOV7.js';
6
+ import '../chunk-U3XT35GZ.js';
7
+ import '../chunk-VR36QVX2.js';
8
+ //# sourceMappingURL=index.js.map
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}