@instockng/api-client 1.0.0 → 1.0.2

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.
Files changed (90) hide show
  1. package/dist/backend-types.d.ts +10 -0
  2. package/dist/backend-types.js +10 -0
  3. package/dist/client.d.ts +20 -0
  4. package/dist/client.js +40 -0
  5. package/dist/fetchers/brands.d.ts +25 -0
  6. package/dist/fetchers/brands.js +26 -0
  7. package/dist/fetchers/carts.d.ts +2339 -0
  8. package/dist/fetchers/carts.js +167 -0
  9. package/dist/fetchers/delivery-zones.d.ts +28 -0
  10. package/{src/fetchers/delivery-zones.ts → dist/fetchers/delivery-zones.js} +9 -12
  11. package/{src/fetchers/index.ts → dist/fetchers/index.d.ts} +1 -1
  12. package/dist/fetchers/index.js +22 -0
  13. package/dist/fetchers/orders.d.ts +283 -0
  14. package/dist/fetchers/orders.js +44 -0
  15. package/dist/fetchers/products.d.ts +386 -0
  16. package/dist/fetchers/products.js +42 -0
  17. package/dist/hooks/admin/abandoned-carts.d.ts +535 -0
  18. package/dist/hooks/admin/abandoned-carts.js +79 -0
  19. package/dist/hooks/admin/brands.d.ts +79 -0
  20. package/dist/hooks/admin/brands.js +103 -0
  21. package/dist/hooks/admin/customers.d.ts +278 -0
  22. package/dist/hooks/admin/customers.js +25 -0
  23. package/dist/hooks/admin/delivery-zones.d.ts +270 -0
  24. package/dist/hooks/admin/delivery-zones.js +168 -0
  25. package/dist/hooks/admin/discount-codes.d.ts +299 -0
  26. package/dist/hooks/admin/discount-codes.js +157 -0
  27. package/{src/hooks/admin/index.ts → dist/hooks/admin/index.d.ts} +0 -1
  28. package/dist/hooks/admin/index.js +16 -0
  29. package/dist/hooks/admin/inventory.d.ts +224 -0
  30. package/dist/hooks/admin/inventory.js +102 -0
  31. package/dist/hooks/admin/orders.d.ts +1380 -0
  32. package/dist/hooks/admin/orders.js +169 -0
  33. package/dist/hooks/admin/products.d.ts +374 -0
  34. package/dist/hooks/admin/products.js +84 -0
  35. package/dist/hooks/admin/stats.d.ts +277 -0
  36. package/dist/hooks/admin/stats.js +24 -0
  37. package/dist/hooks/admin/variants.d.ts +115 -0
  38. package/dist/hooks/admin/variants.js +121 -0
  39. package/dist/hooks/admin/warehouses.d.ts +277 -0
  40. package/dist/hooks/admin/warehouses.js +103 -0
  41. package/dist/hooks/public/brands.d.ts +33 -0
  42. package/dist/hooks/public/brands.js +30 -0
  43. package/dist/hooks/public/carts.d.ts +2407 -0
  44. package/dist/hooks/public/carts.js +213 -0
  45. package/dist/hooks/public/delivery-zones.d.ts +34 -0
  46. package/{src/hooks/public/delivery-zones.ts → dist/hooks/public/delivery-zones.js} +6 -12
  47. package/{src/hooks/public/index.ts → dist/hooks/public/index.d.ts} +1 -1
  48. package/dist/hooks/public/index.js +10 -0
  49. package/dist/hooks/public/orders.d.ts +302 -0
  50. package/{src/hooks/public/orders.ts → dist/hooks/public/orders.js} +12 -28
  51. package/dist/hooks/public/products.d.ts +398 -0
  52. package/{src/hooks/public/products.ts → dist/hooks/public/products.js} +12 -22
  53. package/dist/hooks/use-query-unwrapped.d.ts +20 -0
  54. package/dist/hooks/use-query-unwrapped.js +22 -0
  55. package/dist/hooks/useApiConfig.d.ts +11 -0
  56. package/dist/hooks/useApiConfig.js +14 -0
  57. package/dist/index.d.ts +20 -0
  58. package/{src/index.ts → dist/index.js} +0 -17
  59. package/dist/provider.d.ts +33 -0
  60. package/dist/provider.js +52 -0
  61. package/dist/rpc-client.d.ts +9043 -0
  62. package/dist/rpc-client.js +78 -0
  63. package/{src/rpc-types.ts → dist/rpc-types.d.ts} +35 -80
  64. package/dist/rpc-types.js +7 -0
  65. package/{src/types.ts → dist/types.d.ts} +0 -6
  66. package/dist/types.js +16 -0
  67. package/dist/utils/query-keys.d.ts +106 -0
  68. package/dist/utils/query-keys.js +108 -0
  69. package/package.json +24 -13
  70. package/src/client.ts +0 -57
  71. package/src/fetchers/carts.ts +0 -202
  72. package/src/fetchers/orders.ts +0 -48
  73. package/src/fetchers/products.ts +0 -46
  74. package/src/hooks/admin/abandoned-carts.ts +0 -102
  75. package/src/hooks/admin/brands.ts +0 -134
  76. package/src/hooks/admin/customers.ts +0 -31
  77. package/src/hooks/admin/delivery-zones.ts +0 -236
  78. package/src/hooks/admin/discount-codes.ts +0 -222
  79. package/src/hooks/admin/inventory.ts +0 -137
  80. package/src/hooks/admin/orders.ts +0 -229
  81. package/src/hooks/admin/products.ts +0 -116
  82. package/src/hooks/admin/stats.ts +0 -30
  83. package/src/hooks/admin/variants.ts +0 -173
  84. package/src/hooks/admin/warehouses.ts +0 -143
  85. package/src/hooks/public/carts.ts +0 -298
  86. package/src/hooks/use-query-unwrapped.ts +0 -30
  87. package/src/hooks/useApiConfig.ts +0 -22
  88. package/src/provider.tsx +0 -89
  89. package/src/rpc-client.ts +0 -106
  90. package/src/utils/query-keys.ts +0 -121
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Type-safe RPC hooks for cart operations
3
+ *
4
+ * These hooks use Hono RPC client with types directly from the backend,
5
+ * providing end-to-end type safety without code generation.
6
+ */
7
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
8
+ import { useQueryUnwrapped } from '../use-query-unwrapped';
9
+ import { queryKeys } from '../../utils/query-keys';
10
+ import { fetchCart, updateCart, createCart, addCartItem, updateCartItem, removeCartItem, applyDiscount, removeDiscount, checkoutCart, } from '../../fetchers/carts';
11
+ /**
12
+ * Hook to get cart by ID using RPC
13
+ *
14
+ * @param cartId - Cart UUID
15
+ * @param options - React Query options
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * const { data: cart, isLoading } = useGetCart('cart-123');
20
+ * console.log(cart?.cart.brand.name); // Fully typed!
21
+ * ```
22
+ */
23
+ export function useGetCart(cartId, options) {
24
+ return useQueryUnwrapped({
25
+ queryKey: queryKeys.public.carts.detail(cartId),
26
+ queryFn: () => fetchCart(cartId),
27
+ ...options,
28
+ });
29
+ }
30
+ /**
31
+ * Hook to update cart using RPC
32
+ *
33
+ * @param cartId - Cart UUID
34
+ * @param options - React Query mutation options
35
+ *
36
+ * @example
37
+ * ```tsx
38
+ * const updateCart = useUpdateCart('cart-123');
39
+ * updateCart.mutate({
40
+ * customerEmail: 'user@example.com',
41
+ * deliveryZoneId: 'zone-123'
42
+ * });
43
+ * ```
44
+ */
45
+ export function useUpdateCart(cartId, options) {
46
+ const queryClient = useQueryClient();
47
+ return useMutation({
48
+ mutationFn: (data) => updateCart(cartId, data),
49
+ onSuccess: () => {
50
+ queryClient.invalidateQueries({ queryKey: queryKeys.public.carts.detail(cartId) });
51
+ },
52
+ ...options,
53
+ });
54
+ }
55
+ /**
56
+ * Hook to create a new cart using RPC
57
+ *
58
+ * @param options - React Query mutation options
59
+ *
60
+ * @example
61
+ * ```tsx
62
+ * const createCart = useCreateCart();
63
+ * createCart.mutate('my-brand');
64
+ * ```
65
+ */
66
+ export function useCreateCart(options) {
67
+ return useMutation({
68
+ mutationFn: (brandSlug) => createCart(brandSlug),
69
+ ...options,
70
+ });
71
+ }
72
+ /**
73
+ * Hook to apply discount code to cart using RPC
74
+ *
75
+ * @param cartId - Cart UUID
76
+ * @param options - React Query mutation options
77
+ *
78
+ * @example
79
+ * ```tsx
80
+ * const applyDiscount = useApplyDiscount('cart-123');
81
+ * applyDiscount.mutate({ code: 'SAVE10' });
82
+ * ```
83
+ */
84
+ export function useApplyDiscount(cartId, options) {
85
+ const queryClient = useQueryClient();
86
+ return useMutation({
87
+ mutationFn: (data) => applyDiscount(cartId, data.code),
88
+ onSuccess: () => {
89
+ queryClient.invalidateQueries({ queryKey: queryKeys.public.carts.detail(cartId) });
90
+ },
91
+ ...options,
92
+ });
93
+ }
94
+ /**
95
+ * Hook to remove discount code from cart using RPC
96
+ *
97
+ * @param cartId - Cart UUID
98
+ * @param options - React Query mutation options
99
+ *
100
+ * @example
101
+ * ```tsx
102
+ * const removeDiscount = useRemoveDiscount('cart-123');
103
+ * removeDiscount.mutate();
104
+ * ```
105
+ */
106
+ export function useRemoveDiscount(cartId, options) {
107
+ const queryClient = useQueryClient();
108
+ return useMutation({
109
+ mutationFn: () => removeDiscount(cartId),
110
+ onSuccess: () => {
111
+ queryClient.invalidateQueries({ queryKey: queryKeys.public.carts.detail(cartId) });
112
+ },
113
+ ...options,
114
+ });
115
+ }
116
+ /**
117
+ * Hook to add item to cart using RPC
118
+ *
119
+ * @param cartId - Cart UUID
120
+ * @param options - React Query mutation options
121
+ *
122
+ * @example
123
+ * ```tsx
124
+ * const addItem = useAddCartItem('cart-123');
125
+ * addItem.mutate({ sku: 'PROD-001', quantity: 2 });
126
+ * ```
127
+ */
128
+ export function useAddCartItem(cartId, options) {
129
+ const queryClient = useQueryClient();
130
+ return useMutation({
131
+ mutationFn: (data) => addCartItem(cartId, data.sku, data.quantity),
132
+ onSuccess: () => {
133
+ queryClient.invalidateQueries({ queryKey: queryKeys.public.carts.detail(cartId) });
134
+ },
135
+ ...options,
136
+ });
137
+ }
138
+ /**
139
+ * Hook to update cart item quantity using RPC
140
+ *
141
+ * @param cartId - Cart UUID
142
+ * @param options - React Query mutation options
143
+ *
144
+ * @example
145
+ * ```tsx
146
+ * const updateItem = useUpdateCartItem('cart-123');
147
+ * updateItem.mutate({ itemId: 'item-456', quantity: 3 });
148
+ * ```
149
+ */
150
+ export function useUpdateCartItem(cartId, options) {
151
+ const queryClient = useQueryClient();
152
+ return useMutation({
153
+ mutationFn: ({ itemId, quantity }) => updateCartItem(cartId, itemId, quantity),
154
+ onSuccess: () => {
155
+ queryClient.invalidateQueries({ queryKey: queryKeys.public.carts.detail(cartId) });
156
+ },
157
+ ...options,
158
+ });
159
+ }
160
+ /**
161
+ * Hook to remove item from cart using RPC
162
+ *
163
+ * @param cartId - Cart UUID
164
+ * @param options - React Query mutation options
165
+ *
166
+ * @example
167
+ * ```tsx
168
+ * const removeItem = useRemoveCartItem('cart-123');
169
+ * removeItem.mutate('item-456'); // Pass itemId in mutate call
170
+ * ```
171
+ */
172
+ export function useRemoveCartItem(cartId, options) {
173
+ const queryClient = useQueryClient();
174
+ return useMutation({
175
+ mutationFn: (itemId) => removeCartItem(cartId, itemId),
176
+ onSuccess: () => {
177
+ queryClient.invalidateQueries({ queryKey: queryKeys.public.carts.detail(cartId) });
178
+ },
179
+ ...options,
180
+ });
181
+ }
182
+ /**
183
+ * Hook to checkout a cart and create an order using RPC
184
+ *
185
+ * @param cartId - Cart UUID
186
+ * @param options - React Query mutation options
187
+ *
188
+ * @example
189
+ * ```tsx
190
+ * const checkout = useCheckoutCart('cart-123');
191
+ * checkout.mutate({
192
+ * firstName: 'John',
193
+ * lastName: 'Doe',
194
+ * email: 'john@example.com',
195
+ * phone: '+1234567890',
196
+ * address: '123 Main St',
197
+ * city: 'New York',
198
+ * deliveryZoneId: 'zone-123',
199
+ * paymentMethod: 'cod'
200
+ * });
201
+ * ```
202
+ */
203
+ export function useCheckoutCart(cartId, options) {
204
+ const queryClient = useQueryClient();
205
+ return useMutation({
206
+ mutationFn: (data) => checkoutCart(cartId, data),
207
+ onSuccess: () => {
208
+ // Invalidate cart query since it's now converted to an order
209
+ queryClient.invalidateQueries({ queryKey: queryKeys.public.carts.detail(cartId) });
210
+ },
211
+ ...options,
212
+ });
213
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Type-safe RPC hooks for delivery zone operations
3
+ *
4
+ * These hooks use Hono RPC client with types directly from the backend,
5
+ * providing end-to-end type safety without code generation.
6
+ */
7
+ import { UseQueryOptions } from '@tanstack/react-query';
8
+ import { fetchDeliveryZones } from '../../fetchers/delivery-zones';
9
+ /**
10
+ * Hook to get delivery zones using RPC
11
+ *
12
+ * @param brandId - Optional brand UUID to filter brand-specific zones
13
+ * @param options - React Query options
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * const { data: zones, isLoading } = useGetDeliveryZones(undefined);
18
+ * console.log(zones?.data[0].name); // Fully typed!
19
+ * ```
20
+ */
21
+ export declare function useGetDeliveryZones(brandId: string | undefined, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchDeliveryZones>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
22
+ id: string;
23
+ name: string;
24
+ zones: {
25
+ id: string;
26
+ name: string;
27
+ deliveryCost: number;
28
+ freeShippingThreshold: number;
29
+ allowCOD: boolean;
30
+ allowOnline: boolean;
31
+ waybillOnly: boolean;
32
+ estimatedDays: number;
33
+ }[];
34
+ }[], Error>;
@@ -4,12 +4,9 @@
4
4
  * These hooks use Hono RPC client with types directly from the backend,
5
5
  * providing end-to-end type safety without code generation.
6
6
  */
7
-
8
- import { UseQueryOptions } from '@tanstack/react-query';
9
7
  import { useQueryUnwrapped } from '../use-query-unwrapped';
10
8
  import { queryKeys } from '../../utils/query-keys';
11
9
  import { fetchDeliveryZones } from '../../fetchers/delivery-zones';
12
-
13
10
  /**
14
11
  * Hook to get delivery zones using RPC
15
12
  *
@@ -22,13 +19,10 @@ import { fetchDeliveryZones } from '../../fetchers/delivery-zones';
22
19
  * console.log(zones?.data[0].name); // Fully typed!
23
20
  * ```
24
21
  */
25
- export function useGetDeliveryZones(
26
- brandId: string | undefined,
27
- options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchDeliveryZones>>, Error>, 'queryKey' | 'queryFn'>
28
- ) {
29
- return useQueryUnwrapped({
30
- queryKey: queryKeys.public.deliveryZones.list(brandId),
31
- queryFn: () => fetchDeliveryZones(brandId),
32
- ...options,
33
- });
22
+ export function useGetDeliveryZones(brandId, options) {
23
+ return useQueryUnwrapped({
24
+ queryKey: queryKeys.public.deliveryZones.list(brandId),
25
+ queryFn: () => fetchDeliveryZones(brandId),
26
+ ...options,
27
+ });
34
28
  }
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Export all RPC hooks for use in applications
5
5
  */
6
-
7
6
  export * from './carts';
8
7
  export * from './orders';
9
8
  export * from './products';
10
9
  export * from './delivery-zones';
10
+ export * from './brands';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Type-safe RPC hooks
3
+ *
4
+ * Export all RPC hooks for use in applications
5
+ */
6
+ export * from './carts';
7
+ export * from './orders';
8
+ export * from './products';
9
+ export * from './delivery-zones';
10
+ export * from './brands';
@@ -0,0 +1,302 @@
1
+ /**
2
+ * Type-safe RPC hooks for order operations
3
+ *
4
+ * These hooks use Hono RPC client with types directly from the backend,
5
+ * providing end-to-end type safety without code generation.
6
+ */
7
+ import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
8
+ import { fetchOrder, confirmOrder } from '../../fetchers/orders';
9
+ /**
10
+ * Hook to get order by ID and token using RPC
11
+ *
12
+ * @param orderId - Order UUID
13
+ * @param token - User action token
14
+ * @param options - React Query options
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const { data: order, isLoading } = useGetOrder('order-123', 'token-456');
19
+ * console.log(order?.order.status); // Fully typed!
20
+ * ```
21
+ */
22
+ export declare function useGetOrder(orderId: string, token: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchOrder>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
23
+ canConfirm: boolean;
24
+ confirmationMessage: string;
25
+ subtotal: number;
26
+ deliveryCharge: number;
27
+ totalPrice: number;
28
+ discountAmount: number;
29
+ createdAt: string;
30
+ updatedAt: string;
31
+ deletedAt: string;
32
+ prospectSince: string;
33
+ lastRecoveryAttemptAt: string;
34
+ brand: {
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ deletedAt: string;
38
+ name: string;
39
+ id: string;
40
+ slug: string;
41
+ logoUrl: string | null;
42
+ siteUrl: string;
43
+ domain: string;
44
+ metaPixelId: string | null;
45
+ };
46
+ deliveryZone: {
47
+ deliveryCost: number;
48
+ freeShippingThreshold: number;
49
+ createdAt: string;
50
+ updatedAt: string;
51
+ deletedAt: string;
52
+ state: {
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ deletedAt: string;
56
+ name: string;
57
+ id: string;
58
+ isActive: boolean;
59
+ };
60
+ name: string;
61
+ id: string;
62
+ brandId: string | null;
63
+ stateId: string;
64
+ allowCOD: boolean;
65
+ allowOnline: boolean;
66
+ waybillOnly: boolean;
67
+ estimatedDays: number | null;
68
+ isActive: boolean;
69
+ };
70
+ items: {
71
+ priceAtPurchase: number;
72
+ variant: {
73
+ price: number;
74
+ createdAt: string;
75
+ updatedAt: string;
76
+ deletedAt: string;
77
+ product: {
78
+ createdAt: string;
79
+ updatedAt: string;
80
+ deletedAt: string;
81
+ name: string;
82
+ id: string;
83
+ slug: string;
84
+ brandId: string;
85
+ isActive: boolean;
86
+ description: string | null;
87
+ thumbnailUrl: string | null;
88
+ quantityDiscounts: string | number | boolean | {
89
+ [x: string]: string | number | boolean | /*elided*/ any | {
90
+ [x: number]: string | number | boolean | /*elided*/ any | /*elided*/ any;
91
+ length: number;
92
+ toString: never;
93
+ toLocaleString: never;
94
+ pop: never;
95
+ push: never;
96
+ concat: never;
97
+ join: never;
98
+ reverse: never;
99
+ shift: never;
100
+ slice: never;
101
+ sort: never;
102
+ splice: never;
103
+ unshift: never;
104
+ indexOf: never;
105
+ lastIndexOf: never;
106
+ every: never;
107
+ some: never;
108
+ forEach: never;
109
+ map: never;
110
+ filter: never;
111
+ reduce: never;
112
+ reduceRight: never;
113
+ find: never;
114
+ findIndex: never;
115
+ fill: never;
116
+ copyWithin: never;
117
+ entries: never;
118
+ keys: never;
119
+ values: never;
120
+ includes: never;
121
+ flatMap: never;
122
+ flat: never;
123
+ [Symbol.iterator]: never;
124
+ readonly [Symbol.unscopables]: {
125
+ [x: number]: boolean;
126
+ length?: boolean;
127
+ toString?: boolean;
128
+ toLocaleString?: boolean;
129
+ pop?: boolean;
130
+ push?: boolean;
131
+ concat?: boolean;
132
+ join?: boolean;
133
+ reverse?: boolean;
134
+ shift?: boolean;
135
+ slice?: boolean;
136
+ sort?: boolean;
137
+ splice?: boolean;
138
+ unshift?: boolean;
139
+ indexOf?: boolean;
140
+ lastIndexOf?: boolean;
141
+ every?: boolean;
142
+ some?: boolean;
143
+ forEach?: boolean;
144
+ map?: boolean;
145
+ filter?: boolean;
146
+ reduce?: boolean;
147
+ reduceRight?: boolean;
148
+ find?: boolean;
149
+ findIndex?: boolean;
150
+ fill?: boolean;
151
+ copyWithin?: boolean;
152
+ entries?: boolean;
153
+ keys?: boolean;
154
+ values?: boolean;
155
+ includes?: boolean;
156
+ flatMap?: boolean;
157
+ flat?: boolean;
158
+ };
159
+ };
160
+ } | {
161
+ [x: number]: string | number | boolean | {
162
+ [x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
163
+ } | /*elided*/ any;
164
+ length: number;
165
+ toString: never;
166
+ toLocaleString: never;
167
+ pop: never;
168
+ push: never;
169
+ concat: never;
170
+ join: never;
171
+ reverse: never;
172
+ shift: never;
173
+ slice: never;
174
+ sort: never;
175
+ splice: never;
176
+ unshift: never;
177
+ indexOf: never;
178
+ lastIndexOf: never;
179
+ every: never;
180
+ some: never;
181
+ forEach: never;
182
+ map: never;
183
+ filter: never;
184
+ reduce: never;
185
+ reduceRight: never;
186
+ find: never;
187
+ findIndex: never;
188
+ fill: never;
189
+ copyWithin: never;
190
+ entries: never;
191
+ keys: never;
192
+ values: never;
193
+ includes: never;
194
+ flatMap: never;
195
+ flat: never;
196
+ [Symbol.iterator]: never;
197
+ readonly [Symbol.unscopables]: {
198
+ [x: number]: boolean;
199
+ length?: boolean;
200
+ toString?: boolean;
201
+ toLocaleString?: boolean;
202
+ pop?: boolean;
203
+ push?: boolean;
204
+ concat?: boolean;
205
+ join?: boolean;
206
+ reverse?: boolean;
207
+ shift?: boolean;
208
+ slice?: boolean;
209
+ sort?: boolean;
210
+ splice?: boolean;
211
+ unshift?: boolean;
212
+ indexOf?: boolean;
213
+ lastIndexOf?: boolean;
214
+ every?: boolean;
215
+ some?: boolean;
216
+ forEach?: boolean;
217
+ map?: boolean;
218
+ filter?: boolean;
219
+ reduce?: boolean;
220
+ reduceRight?: boolean;
221
+ find?: boolean;
222
+ findIndex?: boolean;
223
+ fill?: boolean;
224
+ copyWithin?: boolean;
225
+ entries?: boolean;
226
+ keys?: boolean;
227
+ values?: boolean;
228
+ includes?: boolean;
229
+ flatMap?: boolean;
230
+ flat?: boolean;
231
+ };
232
+ };
233
+ };
234
+ name: string | null;
235
+ id: string;
236
+ isActive: boolean;
237
+ thumbnailUrl: string | null;
238
+ productId: string;
239
+ sku: string;
240
+ trackInventory: boolean;
241
+ lowStockThreshold: number | null;
242
+ };
243
+ warehouse: {
244
+ createdAt: string;
245
+ updatedAt: string;
246
+ deletedAt: string;
247
+ name: string;
248
+ id: string;
249
+ isActive: boolean;
250
+ address: string | null;
251
+ city: string | null;
252
+ state: string | null;
253
+ };
254
+ id: string;
255
+ orderId: string;
256
+ variantId: string;
257
+ warehouseId: string | null;
258
+ quantity: number;
259
+ }[];
260
+ id: string;
261
+ email: string | null;
262
+ brandId: string;
263
+ deliveryZoneId: string;
264
+ recoveryAttempts: number;
265
+ recoveryDiscountCodeId: string | null;
266
+ wasRecovered: boolean;
267
+ estimatedDays: number | null;
268
+ orderNumber: number;
269
+ firstName: string;
270
+ lastName: string;
271
+ phone: string;
272
+ address: string;
273
+ city: string;
274
+ discountCodeId: string | null;
275
+ paymentMethod: import("@prisma/client").$Enums.PaymentMethod;
276
+ paystackReference: string | null;
277
+ status: import("@prisma/client").$Enums.OrderStatus;
278
+ cancellationReason: string | null;
279
+ prospectReason: import("@prisma/client").$Enums.ProspectReason | null;
280
+ userActionToken: string;
281
+ }, Error>;
282
+ /**
283
+ * Hook to confirm a prospect order using RPC
284
+ *
285
+ * @param options - React Query mutation options
286
+ *
287
+ * @example
288
+ * ```tsx
289
+ * const confirmOrder = useConfirmOrder();
290
+ * confirmOrder.mutate({
291
+ * orderId: 'order-123',
292
+ * token: 'token-456'
293
+ * });
294
+ * ```
295
+ */
296
+ export declare function useConfirmOrder(options?: UseMutationOptions<Awaited<ReturnType<typeof confirmOrder>>, Error, {
297
+ orderId: string;
298
+ token: string;
299
+ }>): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
300
+ orderId: string;
301
+ token: string;
302
+ }, unknown>;
@@ -4,12 +4,10 @@
4
4
  * These hooks use Hono RPC client with types directly from the backend,
5
5
  * providing end-to-end type safety without code generation.
6
6
  */
7
-
8
- import { useMutation, UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
7
+ import { useMutation } from '@tanstack/react-query';
9
8
  import { useQueryUnwrapped } from '../use-query-unwrapped';
10
9
  import { queryKeys } from '../../utils/query-keys';
11
10
  import { fetchOrder, confirmOrder } from '../../fetchers/orders';
12
-
13
11
  /**
14
12
  * Hook to get order by ID and token using RPC
15
13
  *
@@ -23,18 +21,13 @@ import { fetchOrder, confirmOrder } from '../../fetchers/orders';
23
21
  * console.log(order?.order.status); // Fully typed!
24
22
  * ```
25
23
  */
26
- export function useGetOrder(
27
- orderId: string,
28
- token: string,
29
- options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchOrder>>, Error>, 'queryKey' | 'queryFn'>
30
- ) {
31
- return useQueryUnwrapped({
32
- queryKey: queryKeys.public.orders.detail(orderId, token),
33
- queryFn: () => fetchOrder(orderId, token),
34
- ...options,
35
- });
24
+ export function useGetOrder(orderId, token, options) {
25
+ return useQueryUnwrapped({
26
+ queryKey: queryKeys.public.orders.detail(orderId, token),
27
+ queryFn: () => fetchOrder(orderId, token),
28
+ ...options,
29
+ });
36
30
  }
37
-
38
31
  /**
39
32
  * Hook to confirm a prospect order using RPC
40
33
  *
@@ -49,18 +42,9 @@ export function useGetOrder(
49
42
  * });
50
43
  * ```
51
44
  */
52
- export function useConfirmOrder(
53
- options?: UseMutationOptions<
54
- Awaited<ReturnType<typeof confirmOrder>>,
55
- Error,
56
- {
57
- orderId: string;
58
- token: string;
59
- }
60
- >
61
- ) {
62
- return useMutation({
63
- mutationFn: (data) => confirmOrder(data.orderId, data.token),
64
- ...options,
65
- });
45
+ export function useConfirmOrder(options) {
46
+ return useMutation({
47
+ mutationFn: (data) => confirmOrder(data.orderId, data.token),
48
+ ...options,
49
+ });
66
50
  }