@instockng/api-client 1.0.8 → 1.0.10
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.
- package/dist/fetchers/brands.d.ts +1 -1
- package/dist/fetchers/carts.d.ts +85 -47
- package/dist/fetchers/delivery-zones.d.ts +2 -0
- package/dist/fetchers/orders.d.ts +26 -14
- package/dist/fetchers/products.d.ts +14 -6
- package/dist/hooks/admin/abandoned-carts.d.ts +18 -10
- package/dist/hooks/admin/brands.d.ts +4 -4
- package/dist/hooks/admin/customers.d.ts +13 -7
- package/dist/hooks/admin/delivery-zones.d.ts +23 -15
- package/dist/hooks/admin/discount-codes.d.ts +10 -10
- package/dist/hooks/admin/inventory.d.ts +4 -0
- package/dist/hooks/admin/orders.d.ts +78 -42
- package/dist/hooks/admin/products.d.ts +14 -6
- package/dist/hooks/admin/stats.d.ts +13 -7
- package/dist/hooks/admin/variants.d.ts +5 -5
- package/dist/hooks/admin/warehouses.d.ts +11 -7
- package/dist/hooks/public/brands.d.ts +1 -1
- package/dist/hooks/public/carts.d.ts +85 -47
- package/dist/hooks/public/delivery-zones.d.ts +2 -0
- package/dist/hooks/public/orders.d.ts +26 -14
- package/dist/hooks/public/products.d.ts +14 -6
- package/dist/rpc-client.d.ts +335 -187
- package/package.json +1 -1
- package/dist/apps/backend/src/generated/zod/index.d.ts +0 -1114
- package/dist/apps/backend/src/generated/zod/index.js +0 -670
- package/dist/apps/backend/src/http-app.d.ts +0 -40
- package/dist/apps/backend/src/http-app.js +0 -134
- package/dist/apps/backend/src/lib/brand-response.d.ts +0 -14
- package/dist/apps/backend/src/lib/brand-response.js +0 -8
- package/dist/apps/backend/src/lib/cart-helpers.d.ts +0 -282
- package/dist/apps/backend/src/lib/cart-helpers.js +0 -121
- package/dist/apps/backend/src/lib/cart-recovery.d.ts +0 -30
- package/dist/apps/backend/src/lib/cart-recovery.js +0 -147
- package/dist/apps/backend/src/lib/cart-response.d.ts +0 -121
- package/dist/apps/backend/src/lib/cart-response.js +0 -150
- package/dist/apps/backend/src/lib/clerk.d.ts +0 -18
- package/dist/apps/backend/src/lib/clerk.js +0 -190
- package/dist/apps/backend/src/lib/delivery-zone-response.d.ts +0 -64
- package/dist/apps/backend/src/lib/delivery-zone-response.js +0 -24
- package/dist/apps/backend/src/lib/discount-code-response.d.ts +0 -42
- package/dist/apps/backend/src/lib/discount-code-response.js +0 -19
- package/dist/apps/backend/src/lib/discount.d.ts +0 -20
- package/dist/apps/backend/src/lib/discount.js +0 -35
- package/dist/apps/backend/src/lib/inventory.d.ts +0 -26
- package/dist/apps/backend/src/lib/inventory.js +0 -160
- package/dist/apps/backend/src/lib/meta-capi.d.ts +0 -53
- package/dist/apps/backend/src/lib/meta-capi.js +0 -151
- package/dist/apps/backend/src/lib/openapi.d.ts +0 -36
- package/dist/apps/backend/src/lib/openapi.js +0 -69
- package/dist/apps/backend/src/lib/order-recovery.d.ts +0 -459
- package/dist/apps/backend/src/lib/order-recovery.js +0 -378
- package/dist/apps/backend/src/lib/order-response.d.ts +0 -138
- package/dist/apps/backend/src/lib/order-response.js +0 -61
- package/dist/apps/backend/src/lib/pricing.d.ts +0 -39
- package/dist/apps/backend/src/lib/pricing.js +0 -62
- package/dist/apps/backend/src/lib/prisma.d.ts +0 -9
- package/dist/apps/backend/src/lib/prisma.js +0 -30
- package/dist/apps/backend/src/lib/product-response.d.ts +0 -82
- package/dist/apps/backend/src/lib/product-response.js +0 -29
- package/dist/apps/backend/src/lib/sentry.d.ts +0 -48
- package/dist/apps/backend/src/lib/sentry.js +0 -180
- package/dist/apps/backend/src/lib/utils.d.ts +0 -32
- package/dist/apps/backend/src/lib/utils.js +0 -63
- package/dist/apps/backend/src/middleware/clerk-auth.d.ts +0 -8
- package/dist/apps/backend/src/middleware/clerk-auth.js +0 -89
- package/dist/apps/backend/src/middleware/cors.d.ts +0 -8
- package/dist/apps/backend/src/middleware/cors.js +0 -11
- package/dist/apps/backend/src/notifications/producers/meta-capi-producer.d.ts +0 -62
- package/dist/apps/backend/src/notifications/producers/meta-capi-producer.js +0 -180
- package/dist/apps/backend/src/notifications/producers/order-notification.d.ts +0 -9
- package/dist/apps/backend/src/notifications/producers/order-notification.js +0 -18
- package/dist/apps/backend/src/notifications/producers/prospect-recovery-notification.d.ts +0 -10
- package/dist/apps/backend/src/notifications/producers/prospect-recovery-notification.js +0 -11
- package/dist/apps/backend/src/routes/admin/abandoned-carts.d.ts +0 -605
- package/dist/apps/backend/src/routes/admin/abandoned-carts.js +0 -194
- package/dist/apps/backend/src/routes/admin/brands.d.ts +0 -175
- package/dist/apps/backend/src/routes/admin/brands.js +0 -118
- package/dist/apps/backend/src/routes/admin/customers.d.ts +0 -308
- package/dist/apps/backend/src/routes/admin/customers.js +0 -39
- package/dist/apps/backend/src/routes/admin/delivery-zones.d.ts +0 -446
- package/dist/apps/backend/src/routes/admin/delivery-zones.js +0 -300
- package/dist/apps/backend/src/routes/admin/discount-codes.d.ts +0 -478
- package/dist/apps/backend/src/routes/admin/discount-codes.js +0 -418
- package/dist/apps/backend/src/routes/admin/inventory.d.ts +0 -273
- package/dist/apps/backend/src/routes/admin/inventory.js +0 -199
- package/dist/apps/backend/src/routes/admin/orders.d.ts +0 -1780
- package/dist/apps/backend/src/routes/admin/orders.js +0 -552
- package/dist/apps/backend/src/routes/admin/products.d.ts +0 -860
- package/dist/apps/backend/src/routes/admin/products.js +0 -126
- package/dist/apps/backend/src/routes/admin/stats.d.ts +0 -290
- package/dist/apps/backend/src/routes/admin/stats.js +0 -55
- package/dist/apps/backend/src/routes/admin/variants.d.ts +0 -239
- package/dist/apps/backend/src/routes/admin/variants.js +0 -197
- package/dist/apps/backend/src/routes/admin/warehouses.d.ts +0 -373
- package/dist/apps/backend/src/routes/admin/warehouses.js +0 -123
- package/dist/apps/backend/src/routes/public/brands.d.ts +0 -40
- package/dist/apps/backend/src/routes/public/brands.js +0 -38
- package/dist/apps/backend/src/routes/public/carts.d.ts +0 -2657
- package/dist/apps/backend/src/routes/public/carts.js +0 -778
- package/dist/apps/backend/src/routes/public/delivery-zones.d.ts +0 -37
- package/dist/apps/backend/src/routes/public/delivery-zones.js +0 -64
- package/dist/apps/backend/src/routes/public/orders.d.ts +0 -609
- package/dist/apps/backend/src/routes/public/orders.js +0 -184
- package/dist/apps/backend/src/routes/public/products.d.ts +0 -449
- package/dist/apps/backend/src/routes/public/products.js +0 -133
- package/dist/apps/backend/src/types/index.d.ts +0 -43
- package/dist/apps/backend/src/types/index.js +0 -2
- package/dist/apps/backend/src/validators/brand.d.ts +0 -17
- package/dist/apps/backend/src/validators/brand.js +0 -15
- package/dist/apps/backend/src/validators/delivery-zone.d.ts +0 -35
- package/dist/apps/backend/src/validators/delivery-zone.js +0 -55
- package/dist/apps/backend/src/validators/discount-code.d.ts +0 -74
- package/dist/apps/backend/src/validators/discount-code.js +0 -50
- package/dist/apps/backend/src/validators/inventory.d.ts +0 -20
- package/dist/apps/backend/src/validators/inventory.js +0 -15
- package/dist/apps/backend/src/validators/order.d.ts +0 -58
- package/dist/apps/backend/src/validators/order.js +0 -62
- package/dist/apps/backend/src/validators/product.d.ts +0 -18
- package/dist/apps/backend/src/validators/product.js +0 -19
- package/dist/apps/backend/src/validators/variant.d.ts +0 -19
- package/dist/apps/backend/src/validators/variant.js +0 -19
- package/dist/apps/backend/src/validators/warehouse.d.ts +0 -15
- package/dist/apps/backend/src/validators/warehouse.js +0 -15
- package/dist/packages/api-client/src/backend-types.d.ts +0 -10
- package/dist/packages/api-client/src/backend-types.js +0 -10
- package/dist/packages/api-client/src/client.d.ts +0 -20
- package/dist/packages/api-client/src/client.js +0 -40
- package/dist/packages/api-client/src/enum-types.d.ts +0 -8
- package/dist/packages/api-client/src/enum-types.js +0 -5
- package/dist/packages/api-client/src/fetchers/brands.d.ts +0 -25
- package/dist/packages/api-client/src/fetchers/brands.js +0 -26
- package/dist/packages/api-client/src/fetchers/carts.d.ts +0 -2337
- package/dist/packages/api-client/src/fetchers/carts.js +0 -174
- package/dist/packages/api-client/src/fetchers/delivery-zones.d.ts +0 -30
- package/dist/packages/api-client/src/fetchers/delivery-zones.js +0 -26
- package/dist/packages/api-client/src/fetchers/index.d.ts +0 -22
- package/dist/packages/api-client/src/fetchers/index.js +0 -22
- package/dist/packages/api-client/src/fetchers/orders.d.ts +0 -544
- package/dist/packages/api-client/src/fetchers/orders.js +0 -44
- package/dist/packages/api-client/src/fetchers/products.d.ts +0 -386
- package/dist/packages/api-client/src/fetchers/products.js +0 -42
- package/dist/packages/api-client/src/hooks/admin/abandoned-carts.d.ts +0 -535
- package/dist/packages/api-client/src/hooks/admin/abandoned-carts.js +0 -83
- package/dist/packages/api-client/src/hooks/admin/brands.d.ts +0 -79
- package/dist/packages/api-client/src/hooks/admin/brands.js +0 -108
- package/dist/packages/api-client/src/hooks/admin/customers.d.ts +0 -280
- package/dist/packages/api-client/src/hooks/admin/customers.js +0 -26
- package/dist/packages/api-client/src/hooks/admin/delivery-zones.d.ts +0 -278
- package/dist/packages/api-client/src/hooks/admin/delivery-zones.js +0 -176
- package/dist/packages/api-client/src/hooks/admin/discount-codes.d.ts +0 -299
- package/dist/packages/api-client/src/hooks/admin/discount-codes.js +0 -165
- package/dist/packages/api-client/src/hooks/admin/index.d.ts +0 -16
- package/dist/packages/api-client/src/hooks/admin/index.js +0 -16
- package/dist/packages/api-client/src/hooks/admin/inventory.d.ts +0 -224
- package/dist/packages/api-client/src/hooks/admin/inventory.js +0 -107
- package/dist/packages/api-client/src/hooks/admin/orders.d.ts +0 -1674
- package/dist/packages/api-client/src/hooks/admin/orders.js +0 -178
- package/dist/packages/api-client/src/hooks/admin/products.d.ts +0 -374
- package/dist/packages/api-client/src/hooks/admin/products.js +0 -89
- package/dist/packages/api-client/src/hooks/admin/stats.d.ts +0 -279
- package/dist/packages/api-client/src/hooks/admin/stats.js +0 -25
- package/dist/packages/api-client/src/hooks/admin/variants.d.ts +0 -115
- package/dist/packages/api-client/src/hooks/admin/variants.js +0 -127
- package/dist/packages/api-client/src/hooks/admin/warehouses.d.ts +0 -277
- package/dist/packages/api-client/src/hooks/admin/warehouses.js +0 -108
- package/dist/packages/api-client/src/hooks/public/brands.d.ts +0 -33
- package/dist/packages/api-client/src/hooks/public/brands.js +0 -30
- package/dist/packages/api-client/src/hooks/public/carts.d.ts +0 -2407
- package/dist/packages/api-client/src/hooks/public/carts.js +0 -213
- package/dist/packages/api-client/src/hooks/public/delivery-zones.d.ts +0 -36
- package/dist/packages/api-client/src/hooks/public/delivery-zones.js +0 -28
- package/dist/packages/api-client/src/hooks/public/index.d.ts +0 -10
- package/dist/packages/api-client/src/hooks/public/index.js +0 -10
- package/dist/packages/api-client/src/hooks/public/orders.d.ts +0 -563
- package/dist/packages/api-client/src/hooks/public/orders.js +0 -50
- package/dist/packages/api-client/src/hooks/public/products.d.ts +0 -398
- package/dist/packages/api-client/src/hooks/public/products.js +0 -47
- package/dist/packages/api-client/src/hooks/use-query-unwrapped.d.ts +0 -20
- package/dist/packages/api-client/src/hooks/use-query-unwrapped.js +0 -22
- package/dist/packages/api-client/src/hooks/useApiConfig.d.ts +0 -12
- package/dist/packages/api-client/src/hooks/useApiConfig.js +0 -14
- package/dist/packages/api-client/src/index.d.ts +0 -20
- package/dist/packages/api-client/src/index.js +0 -25
- package/dist/packages/api-client/src/provider.d.ts +0 -36
- package/dist/packages/api-client/src/provider.js +0 -54
- package/dist/packages/api-client/src/rpc-client.d.ts +0 -9639
- package/dist/packages/api-client/src/rpc-client.js +0 -78
- package/dist/packages/api-client/src/rpc-types.d.ts +0 -76
- package/dist/packages/api-client/src/rpc-types.js +0 -7
- package/dist/packages/api-client/src/types.d.ts +0 -34
- package/dist/packages/api-client/src/types.js +0 -16
- package/dist/packages/api-client/src/utils/query-keys.d.ts +0 -106
- package/dist/packages/api-client/src/utils/query-keys.js +0 -108
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type-safe admin RPC hooks for delivery zone and state management
|
|
3
|
-
*/
|
|
4
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
5
|
-
import { useQueryUnwrapped } from '../use-query-unwrapped';
|
|
6
|
-
import { createAdminRpcClients, authHeaders } from '../../rpc-client';
|
|
7
|
-
import { queryKeys } from '../../utils/query-keys';
|
|
8
|
-
import { useApiConfig } from '../useApiConfig';
|
|
9
|
-
// ============ STATES ============
|
|
10
|
-
/**
|
|
11
|
-
* Hook to list all states using admin RPC
|
|
12
|
-
*/
|
|
13
|
-
export function useListStates(options) {
|
|
14
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
15
|
-
return useQueryUnwrapped({
|
|
16
|
-
queryKey: queryKeys.admin.deliveryZones.states.list(),
|
|
17
|
-
queryFn: async () => {
|
|
18
|
-
const token = await getAuthToken();
|
|
19
|
-
const clients = createAdminRpcClients(baseURL);
|
|
20
|
-
const res = await clients.deliveryZones.states.$get({}, authHeaders(token));
|
|
21
|
-
if (!res.ok)
|
|
22
|
-
throw new Error(`Failed to fetch states: ${res.statusText}`);
|
|
23
|
-
return res.json();
|
|
24
|
-
},
|
|
25
|
-
...options,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Hook to create a state using admin RPC
|
|
30
|
-
*/
|
|
31
|
-
export function useCreateState(options) {
|
|
32
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
33
|
-
const queryClient = useQueryClient();
|
|
34
|
-
return useMutation({
|
|
35
|
-
mutationFn: async (data) => {
|
|
36
|
-
const token = await getAuthToken();
|
|
37
|
-
const clients = createAdminRpcClients(baseURL);
|
|
38
|
-
const res = await clients.deliveryZones.states.$post({ json: data }, authHeaders(token));
|
|
39
|
-
if (!res.ok)
|
|
40
|
-
throw new Error(`Failed to create state: ${res.statusText}`);
|
|
41
|
-
return res.json();
|
|
42
|
-
},
|
|
43
|
-
onSuccess: () => {
|
|
44
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.deliveryZones.states.all });
|
|
45
|
-
},
|
|
46
|
-
...options,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Hook to update a state using admin RPC
|
|
51
|
-
*/
|
|
52
|
-
export function useUpdateState(stateId, options) {
|
|
53
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
54
|
-
const queryClient = useQueryClient();
|
|
55
|
-
return useMutation({
|
|
56
|
-
mutationFn: async (data) => {
|
|
57
|
-
const token = await getAuthToken();
|
|
58
|
-
const clients = createAdminRpcClients(baseURL);
|
|
59
|
-
const res = await clients.deliveryZones.states[':id'].$patch({ json: data, param: { id: stateId } }, authHeaders(token));
|
|
60
|
-
if (!res.ok)
|
|
61
|
-
throw new Error(`Failed to update state: ${res.statusText}`);
|
|
62
|
-
return res.json();
|
|
63
|
-
},
|
|
64
|
-
onSuccess: () => {
|
|
65
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.deliveryZones.states.detail(stateId) });
|
|
66
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.deliveryZones.states.all });
|
|
67
|
-
},
|
|
68
|
-
...options,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Hook to delete a state using admin RPC
|
|
73
|
-
*/
|
|
74
|
-
export function useDeleteState(stateId, options) {
|
|
75
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
76
|
-
const queryClient = useQueryClient();
|
|
77
|
-
return useMutation({
|
|
78
|
-
mutationFn: async () => {
|
|
79
|
-
const token = await getAuthToken();
|
|
80
|
-
const clients = createAdminRpcClients(baseURL);
|
|
81
|
-
const res = await clients.deliveryZones.states[':id'].$delete({ param: { id: stateId } }, authHeaders(token));
|
|
82
|
-
if (!res.ok)
|
|
83
|
-
throw new Error(`Failed to delete state: ${res.statusText}`);
|
|
84
|
-
return res.json();
|
|
85
|
-
},
|
|
86
|
-
onSuccess: () => {
|
|
87
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.deliveryZones.states.all });
|
|
88
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.deliveryZones.zones.all });
|
|
89
|
-
},
|
|
90
|
-
...options,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
// ============ DELIVERY ZONES ============
|
|
94
|
-
/**
|
|
95
|
-
* Hook to list delivery zones using admin RPC
|
|
96
|
-
*/
|
|
97
|
-
export function useListDeliveryZones(params, options) {
|
|
98
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
99
|
-
return useQueryUnwrapped({
|
|
100
|
-
queryKey: queryKeys.admin.deliveryZones.zones.list(params),
|
|
101
|
-
queryFn: async () => {
|
|
102
|
-
const token = await getAuthToken();
|
|
103
|
-
const clients = createAdminRpcClients(baseURL);
|
|
104
|
-
const res = await clients.deliveryZones.zones.$get({ query: params }, authHeaders(token));
|
|
105
|
-
if (!res.ok)
|
|
106
|
-
throw new Error(`Failed to fetch delivery zones: ${res.statusText}`);
|
|
107
|
-
return res.json();
|
|
108
|
-
},
|
|
109
|
-
...options,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Hook to create a delivery zone using admin RPC
|
|
114
|
-
*/
|
|
115
|
-
export function useCreateDeliveryZone(options) {
|
|
116
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
117
|
-
const queryClient = useQueryClient();
|
|
118
|
-
return useMutation({
|
|
119
|
-
mutationFn: async (data) => {
|
|
120
|
-
const token = await getAuthToken();
|
|
121
|
-
const clients = createAdminRpcClients(baseURL);
|
|
122
|
-
const res = await clients.deliveryZones.zones.$post({ json: data }, authHeaders(token));
|
|
123
|
-
if (!res.ok)
|
|
124
|
-
throw new Error(`Failed to create delivery zone: ${res.statusText}`);
|
|
125
|
-
return res.json();
|
|
126
|
-
},
|
|
127
|
-
onSuccess: () => {
|
|
128
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.deliveryZones.zones.all });
|
|
129
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.deliveryZones.states.all });
|
|
130
|
-
},
|
|
131
|
-
...options,
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* Hook to update a delivery zone using admin RPC
|
|
136
|
-
*/
|
|
137
|
-
export function useUpdateDeliveryZone(zoneId, options) {
|
|
138
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
139
|
-
const queryClient = useQueryClient();
|
|
140
|
-
return useMutation({
|
|
141
|
-
mutationFn: async (data) => {
|
|
142
|
-
const token = await getAuthToken();
|
|
143
|
-
const clients = createAdminRpcClients(baseURL);
|
|
144
|
-
const res = await clients.deliveryZones.zones[':id'].$patch({ json: data, param: { id: zoneId } }, authHeaders(token));
|
|
145
|
-
if (!res.ok)
|
|
146
|
-
throw new Error(`Failed to update delivery zone: ${res.statusText}`);
|
|
147
|
-
return res.json();
|
|
148
|
-
},
|
|
149
|
-
onSuccess: () => {
|
|
150
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.deliveryZones.zones.detail(zoneId) });
|
|
151
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.deliveryZones.zones.all });
|
|
152
|
-
},
|
|
153
|
-
...options,
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Hook to delete a delivery zone using admin RPC
|
|
158
|
-
*/
|
|
159
|
-
export function useDeleteDeliveryZone(zoneId, options) {
|
|
160
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
161
|
-
const queryClient = useQueryClient();
|
|
162
|
-
return useMutation({
|
|
163
|
-
mutationFn: async () => {
|
|
164
|
-
const token = await getAuthToken();
|
|
165
|
-
const clients = createAdminRpcClients(baseURL);
|
|
166
|
-
const res = await clients.deliveryZones.zones[':id'].$delete({ param: { id: zoneId } }, authHeaders(token));
|
|
167
|
-
if (!res.ok)
|
|
168
|
-
throw new Error(`Failed to delete delivery zone: ${res.statusText}`);
|
|
169
|
-
return res.json();
|
|
170
|
-
},
|
|
171
|
-
onSuccess: () => {
|
|
172
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.deliveryZones.zones.all });
|
|
173
|
-
},
|
|
174
|
-
...options,
|
|
175
|
-
});
|
|
176
|
-
}
|
|
@@ -1,299 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type-safe admin RPC hooks for discount code management
|
|
3
|
-
*/
|
|
4
|
-
import { UseQueryOptions, UseMutationOptions } from '@tanstack/react-query';
|
|
5
|
-
import { createAdminRpcClients } from '../../rpc-client';
|
|
6
|
-
/**
|
|
7
|
-
* Hook to list discount codes using admin RPC
|
|
8
|
-
*/
|
|
9
|
-
export declare function useListDiscountCodes(params?: {
|
|
10
|
-
page?: number;
|
|
11
|
-
limit?: number;
|
|
12
|
-
category?: string;
|
|
13
|
-
brandId?: string;
|
|
14
|
-
isActive?: string;
|
|
15
|
-
search?: string;
|
|
16
|
-
}, options?: Omit<UseQueryOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['discountCodes']['index']['$get']>>['json']>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
|
|
17
|
-
data: {
|
|
18
|
-
value: number;
|
|
19
|
-
minPurchase: number;
|
|
20
|
-
maxDiscount: number;
|
|
21
|
-
createdAt: string;
|
|
22
|
-
updatedAt: string;
|
|
23
|
-
deletedAt: string;
|
|
24
|
-
brand: {
|
|
25
|
-
createdAt: string;
|
|
26
|
-
updatedAt: string;
|
|
27
|
-
deletedAt: string;
|
|
28
|
-
id: string;
|
|
29
|
-
name: string;
|
|
30
|
-
slug: string;
|
|
31
|
-
logoUrl: string | null;
|
|
32
|
-
siteUrl: string;
|
|
33
|
-
domain: string;
|
|
34
|
-
metaPixelId: string | null;
|
|
35
|
-
};
|
|
36
|
-
isExpired: boolean;
|
|
37
|
-
usagePercentage: number;
|
|
38
|
-
id: string;
|
|
39
|
-
type: string;
|
|
40
|
-
brandId: string | null;
|
|
41
|
-
isActive: boolean;
|
|
42
|
-
code: string;
|
|
43
|
-
usageLimit: number | null;
|
|
44
|
-
usageCount: number;
|
|
45
|
-
perCustomerLimit: number | null;
|
|
46
|
-
validFrom: string;
|
|
47
|
-
validUntil: string;
|
|
48
|
-
isAutoApply: boolean;
|
|
49
|
-
description: string | null;
|
|
50
|
-
category: string;
|
|
51
|
-
createdBy: string | null;
|
|
52
|
-
}[];
|
|
53
|
-
pagination: {
|
|
54
|
-
page: number;
|
|
55
|
-
limit: number;
|
|
56
|
-
total: number;
|
|
57
|
-
totalPages: number;
|
|
58
|
-
};
|
|
59
|
-
}, Error>;
|
|
60
|
-
/**
|
|
61
|
-
* Hook to get discount code by ID using admin RPC
|
|
62
|
-
*/
|
|
63
|
-
export declare function useGetDiscountCode(codeId: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['discountCodes'][':id']['$get']>>['json']>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
|
|
64
|
-
_count: {
|
|
65
|
-
usageLog: number;
|
|
66
|
-
orders: number;
|
|
67
|
-
};
|
|
68
|
-
value: number;
|
|
69
|
-
minPurchase: number;
|
|
70
|
-
maxDiscount: number;
|
|
71
|
-
createdAt: string;
|
|
72
|
-
updatedAt: string;
|
|
73
|
-
deletedAt: string;
|
|
74
|
-
brand: {
|
|
75
|
-
createdAt: string;
|
|
76
|
-
updatedAt: string;
|
|
77
|
-
deletedAt: string;
|
|
78
|
-
id: string;
|
|
79
|
-
name: string;
|
|
80
|
-
slug: string;
|
|
81
|
-
logoUrl: string | null;
|
|
82
|
-
siteUrl: string;
|
|
83
|
-
domain: string;
|
|
84
|
-
metaPixelId: string | null;
|
|
85
|
-
};
|
|
86
|
-
isExpired: boolean;
|
|
87
|
-
usagePercentage: number;
|
|
88
|
-
id: string;
|
|
89
|
-
type: string;
|
|
90
|
-
brandId: string | null;
|
|
91
|
-
isActive: boolean;
|
|
92
|
-
code: string;
|
|
93
|
-
usageLimit: number | null;
|
|
94
|
-
usageCount: number;
|
|
95
|
-
perCustomerLimit: number | null;
|
|
96
|
-
validFrom: string;
|
|
97
|
-
validUntil: string;
|
|
98
|
-
isAutoApply: boolean;
|
|
99
|
-
description: string | null;
|
|
100
|
-
category: string;
|
|
101
|
-
createdBy: string | null;
|
|
102
|
-
}, Error>;
|
|
103
|
-
/**
|
|
104
|
-
* Hook to create a discount code using admin RPC
|
|
105
|
-
*/
|
|
106
|
-
export declare function useCreateDiscountCode(options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['discountCodes']['index']['$post']>>['json']>>, Error, any>): import("@tanstack/react-query").UseMutationResult<{
|
|
107
|
-
error: {
|
|
108
|
-
code: string;
|
|
109
|
-
message: string;
|
|
110
|
-
};
|
|
111
|
-
} | {
|
|
112
|
-
error: {
|
|
113
|
-
code: string;
|
|
114
|
-
message: string;
|
|
115
|
-
};
|
|
116
|
-
} | {
|
|
117
|
-
value: number;
|
|
118
|
-
minPurchase: number;
|
|
119
|
-
maxDiscount: number;
|
|
120
|
-
createdAt: string;
|
|
121
|
-
updatedAt: string;
|
|
122
|
-
deletedAt: string;
|
|
123
|
-
brand: {
|
|
124
|
-
createdAt: string;
|
|
125
|
-
updatedAt: string;
|
|
126
|
-
deletedAt: string;
|
|
127
|
-
id: string;
|
|
128
|
-
name: string;
|
|
129
|
-
slug: string;
|
|
130
|
-
logoUrl: string | null;
|
|
131
|
-
siteUrl: string;
|
|
132
|
-
domain: string;
|
|
133
|
-
metaPixelId: string | null;
|
|
134
|
-
};
|
|
135
|
-
isExpired: boolean;
|
|
136
|
-
usagePercentage: number;
|
|
137
|
-
id: string;
|
|
138
|
-
type: string;
|
|
139
|
-
brandId: string | null;
|
|
140
|
-
isActive: boolean;
|
|
141
|
-
code: string;
|
|
142
|
-
usageLimit: number | null;
|
|
143
|
-
usageCount: number;
|
|
144
|
-
perCustomerLimit: number | null;
|
|
145
|
-
validFrom: string;
|
|
146
|
-
validUntil: string;
|
|
147
|
-
isAutoApply: boolean;
|
|
148
|
-
description: string | null;
|
|
149
|
-
category: string;
|
|
150
|
-
createdBy: string | null;
|
|
151
|
-
} | {
|
|
152
|
-
error: {
|
|
153
|
-
code: string;
|
|
154
|
-
message: any;
|
|
155
|
-
};
|
|
156
|
-
}, Error, any, unknown>;
|
|
157
|
-
/**
|
|
158
|
-
* Hook to update a discount code using admin RPC
|
|
159
|
-
*/
|
|
160
|
-
export declare function useUpdateDiscountCode(codeId: string, options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['discountCodes'][':id']['$patch']>>['json']>>, Error, any>): import("@tanstack/react-query").UseMutationResult<{
|
|
161
|
-
value: number;
|
|
162
|
-
minPurchase: number;
|
|
163
|
-
maxDiscount: number;
|
|
164
|
-
createdAt: string;
|
|
165
|
-
updatedAt: string;
|
|
166
|
-
deletedAt: string;
|
|
167
|
-
brand: {
|
|
168
|
-
createdAt: string;
|
|
169
|
-
updatedAt: string;
|
|
170
|
-
deletedAt: string;
|
|
171
|
-
id: string;
|
|
172
|
-
name: string;
|
|
173
|
-
slug: string;
|
|
174
|
-
logoUrl: string | null;
|
|
175
|
-
siteUrl: string;
|
|
176
|
-
domain: string;
|
|
177
|
-
metaPixelId: string | null;
|
|
178
|
-
};
|
|
179
|
-
isExpired: boolean;
|
|
180
|
-
usagePercentage: number;
|
|
181
|
-
id: string;
|
|
182
|
-
type: string;
|
|
183
|
-
brandId: string | null;
|
|
184
|
-
isActive: boolean;
|
|
185
|
-
code: string;
|
|
186
|
-
usageLimit: number | null;
|
|
187
|
-
usageCount: number;
|
|
188
|
-
perCustomerLimit: number | null;
|
|
189
|
-
validFrom: string;
|
|
190
|
-
validUntil: string;
|
|
191
|
-
isAutoApply: boolean;
|
|
192
|
-
description: string | null;
|
|
193
|
-
category: string;
|
|
194
|
-
createdBy: string | null;
|
|
195
|
-
} | {
|
|
196
|
-
error: {
|
|
197
|
-
code: string;
|
|
198
|
-
message: string;
|
|
199
|
-
};
|
|
200
|
-
} | {
|
|
201
|
-
error: {
|
|
202
|
-
code: string;
|
|
203
|
-
message: string;
|
|
204
|
-
};
|
|
205
|
-
} | {
|
|
206
|
-
error: {
|
|
207
|
-
code: string;
|
|
208
|
-
message: any;
|
|
209
|
-
};
|
|
210
|
-
}, Error, any, unknown>;
|
|
211
|
-
/**
|
|
212
|
-
* Hook to delete a discount code using admin RPC
|
|
213
|
-
*/
|
|
214
|
-
export declare function useDeleteDiscountCode(codeId: string, options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['discountCodes'][':id']['$delete']>>['json']>>, Error, void>): import("@tanstack/react-query").UseMutationResult<unknown, Error, void, unknown>;
|
|
215
|
-
/**
|
|
216
|
-
* Hook to get discount code analytics using admin RPC
|
|
217
|
-
*/
|
|
218
|
-
export declare function useGetDiscountCodeAnalytics(codeId: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['discountCodes'][':id']['analytics']['$get']>>['json']>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
|
|
219
|
-
totalUses: number;
|
|
220
|
-
usagePercentage: number;
|
|
221
|
-
totalDiscountGiven: number;
|
|
222
|
-
totalRevenue: number;
|
|
223
|
-
averageOrderValue: number;
|
|
224
|
-
averageDiscount: number;
|
|
225
|
-
uniqueCustomers: number;
|
|
226
|
-
usageByDate: import("hono/utils/types").JSONValue[];
|
|
227
|
-
topCustomers: import("hono/utils/types").JSONValue[];
|
|
228
|
-
recentUsages: {
|
|
229
|
-
id: string;
|
|
230
|
-
orderId: string;
|
|
231
|
-
customerPhone: string;
|
|
232
|
-
usedAt: string;
|
|
233
|
-
discountAmount: string;
|
|
234
|
-
orderTotal: string;
|
|
235
|
-
order: {
|
|
236
|
-
id: string;
|
|
237
|
-
phone: string;
|
|
238
|
-
};
|
|
239
|
-
}[];
|
|
240
|
-
value: number;
|
|
241
|
-
minPurchase: number;
|
|
242
|
-
maxDiscount: number;
|
|
243
|
-
createdAt: string;
|
|
244
|
-
updatedAt: string;
|
|
245
|
-
deletedAt: string;
|
|
246
|
-
brand: {
|
|
247
|
-
createdAt: string;
|
|
248
|
-
updatedAt: string;
|
|
249
|
-
deletedAt: string;
|
|
250
|
-
id: string;
|
|
251
|
-
name: string;
|
|
252
|
-
slug: string;
|
|
253
|
-
logoUrl: string | null;
|
|
254
|
-
siteUrl: string;
|
|
255
|
-
domain: string;
|
|
256
|
-
metaPixelId: string | null;
|
|
257
|
-
};
|
|
258
|
-
isExpired: boolean;
|
|
259
|
-
id: string;
|
|
260
|
-
type: string;
|
|
261
|
-
brandId: string | null;
|
|
262
|
-
isActive: boolean;
|
|
263
|
-
code: string;
|
|
264
|
-
usageLimit: number | null;
|
|
265
|
-
usageCount: number;
|
|
266
|
-
perCustomerLimit: number | null;
|
|
267
|
-
validFrom: string;
|
|
268
|
-
validUntil: string;
|
|
269
|
-
isAutoApply: boolean;
|
|
270
|
-
description: string | null;
|
|
271
|
-
category: string;
|
|
272
|
-
createdBy: string | null;
|
|
273
|
-
}, Error>;
|
|
274
|
-
/**
|
|
275
|
-
* Hook to bulk generate discount codes using admin RPC
|
|
276
|
-
*/
|
|
277
|
-
export declare function useBulkGenerateDiscountCodes(options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['discountCodes']['bulk-generate']['$post']>>['json']>>, Error, any>): import("@tanstack/react-query").UseMutationResult<{
|
|
278
|
-
codes: string[];
|
|
279
|
-
count: number;
|
|
280
|
-
} | {
|
|
281
|
-
error: {
|
|
282
|
-
code: string;
|
|
283
|
-
message: any;
|
|
284
|
-
};
|
|
285
|
-
}, Error, any, unknown>;
|
|
286
|
-
/**
|
|
287
|
-
* Hook to get discount code overview stats using admin RPC
|
|
288
|
-
*/
|
|
289
|
-
export declare function useGetDiscountCodeOverviewStats(options?: Omit<UseQueryOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['discountCodes']['stats']['overview']['$get']>>['json']>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
|
|
290
|
-
totalCodes: number;
|
|
291
|
-
activeCodes: number;
|
|
292
|
-
totalUsage: number;
|
|
293
|
-
totalDiscountGiven: string | number;
|
|
294
|
-
totalRevenue: string | number;
|
|
295
|
-
codesByCategory: {
|
|
296
|
-
category: string;
|
|
297
|
-
_count: number;
|
|
298
|
-
}[];
|
|
299
|
-
}, Error>;
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type-safe admin RPC hooks for discount code management
|
|
3
|
-
*/
|
|
4
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
5
|
-
import { useQueryUnwrapped } from '../use-query-unwrapped';
|
|
6
|
-
import { createAdminRpcClients, authHeaders } from '../../rpc-client';
|
|
7
|
-
import { queryKeys } from '../../utils/query-keys';
|
|
8
|
-
import { useApiConfig } from '../useApiConfig';
|
|
9
|
-
/**
|
|
10
|
-
* Hook to list discount codes using admin RPC
|
|
11
|
-
*/
|
|
12
|
-
export function useListDiscountCodes(params, options) {
|
|
13
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
14
|
-
return useQueryUnwrapped({
|
|
15
|
-
queryKey: queryKeys.admin.discountCodes.list(params),
|
|
16
|
-
queryFn: async () => {
|
|
17
|
-
const token = await getAuthToken();
|
|
18
|
-
const clients = createAdminRpcClients(baseURL);
|
|
19
|
-
const res = await clients.discountCodes.index.$get({ query: params }, authHeaders(token));
|
|
20
|
-
if (!res.ok)
|
|
21
|
-
throw new Error(`Failed to fetch discount codes: ${res.statusText}`);
|
|
22
|
-
return res.json();
|
|
23
|
-
},
|
|
24
|
-
...options,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Hook to get discount code by ID using admin RPC
|
|
29
|
-
*/
|
|
30
|
-
export function useGetDiscountCode(codeId, options) {
|
|
31
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
32
|
-
return useQueryUnwrapped({
|
|
33
|
-
queryKey: queryKeys.admin.discountCodes.detail(codeId),
|
|
34
|
-
queryFn: async () => {
|
|
35
|
-
const token = await getAuthToken();
|
|
36
|
-
const clients = createAdminRpcClients(baseURL);
|
|
37
|
-
const res = await clients.discountCodes[':id'].$get({ param: { id: codeId } }, authHeaders(token));
|
|
38
|
-
if (!res.ok)
|
|
39
|
-
throw new Error(`Failed to fetch discount code: ${res.statusText}`);
|
|
40
|
-
return res.json();
|
|
41
|
-
},
|
|
42
|
-
...options,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Hook to create a discount code using admin RPC
|
|
47
|
-
*/
|
|
48
|
-
export function useCreateDiscountCode(options) {
|
|
49
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
50
|
-
const queryClient = useQueryClient();
|
|
51
|
-
return useMutation({
|
|
52
|
-
mutationFn: async (data) => {
|
|
53
|
-
const token = await getAuthToken();
|
|
54
|
-
const clients = createAdminRpcClients(baseURL);
|
|
55
|
-
const res = await clients.discountCodes.index.$post({ json: data }, authHeaders(token));
|
|
56
|
-
if (!res.ok)
|
|
57
|
-
throw new Error(`Failed to create discount code: ${res.statusText}`);
|
|
58
|
-
return res.json();
|
|
59
|
-
},
|
|
60
|
-
onSuccess: () => {
|
|
61
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.discountCodes.all });
|
|
62
|
-
},
|
|
63
|
-
...options,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Hook to update a discount code using admin RPC
|
|
68
|
-
*/
|
|
69
|
-
export function useUpdateDiscountCode(codeId, options) {
|
|
70
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
71
|
-
const queryClient = useQueryClient();
|
|
72
|
-
return useMutation({
|
|
73
|
-
mutationFn: async (data) => {
|
|
74
|
-
const token = await getAuthToken();
|
|
75
|
-
const clients = createAdminRpcClients(baseURL);
|
|
76
|
-
const res = await clients.discountCodes[':id'].$patch({ json: data, param: { id: codeId } }, authHeaders(token));
|
|
77
|
-
if (!res.ok)
|
|
78
|
-
throw new Error(`Failed to update discount code: ${res.statusText}`);
|
|
79
|
-
return res.json();
|
|
80
|
-
},
|
|
81
|
-
onSuccess: () => {
|
|
82
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.discountCodes.detail(codeId) });
|
|
83
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.discountCodes.all });
|
|
84
|
-
},
|
|
85
|
-
...options,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Hook to delete a discount code using admin RPC
|
|
90
|
-
*/
|
|
91
|
-
export function useDeleteDiscountCode(codeId, options) {
|
|
92
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
93
|
-
const queryClient = useQueryClient();
|
|
94
|
-
return useMutation({
|
|
95
|
-
mutationFn: async () => {
|
|
96
|
-
const token = await getAuthToken();
|
|
97
|
-
const clients = createAdminRpcClients(baseURL);
|
|
98
|
-
const res = await clients.discountCodes[':id'].$delete({ param: { id: codeId } }, authHeaders(token));
|
|
99
|
-
if (!res.ok)
|
|
100
|
-
throw new Error(`Failed to delete discount code: ${res.statusText}`);
|
|
101
|
-
return res.json();
|
|
102
|
-
},
|
|
103
|
-
onSuccess: () => {
|
|
104
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.discountCodes.all });
|
|
105
|
-
},
|
|
106
|
-
...options,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Hook to get discount code analytics using admin RPC
|
|
111
|
-
*/
|
|
112
|
-
export function useGetDiscountCodeAnalytics(codeId, options) {
|
|
113
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
114
|
-
return useQueryUnwrapped({
|
|
115
|
-
queryKey: queryKeys.admin.discountCodes.analytics(codeId),
|
|
116
|
-
queryFn: async () => {
|
|
117
|
-
const token = await getAuthToken();
|
|
118
|
-
const clients = createAdminRpcClients(baseURL);
|
|
119
|
-
const res = await clients.discountCodes[':id'].analytics.$get({ param: { id: codeId } }, authHeaders(token));
|
|
120
|
-
if (!res.ok)
|
|
121
|
-
throw new Error(`Failed to fetch discount code analytics: ${res.statusText}`);
|
|
122
|
-
return res.json();
|
|
123
|
-
},
|
|
124
|
-
...options,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Hook to bulk generate discount codes using admin RPC
|
|
129
|
-
*/
|
|
130
|
-
export function useBulkGenerateDiscountCodes(options) {
|
|
131
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
132
|
-
const queryClient = useQueryClient();
|
|
133
|
-
return useMutation({
|
|
134
|
-
mutationFn: async (data) => {
|
|
135
|
-
const token = await getAuthToken();
|
|
136
|
-
const clients = createAdminRpcClients(baseURL);
|
|
137
|
-
const res = await clients.discountCodes['bulk-generate'].$post({ json: data }, authHeaders(token));
|
|
138
|
-
if (!res.ok)
|
|
139
|
-
throw new Error(`Failed to bulk generate discount codes: ${res.statusText}`);
|
|
140
|
-
return res.json();
|
|
141
|
-
},
|
|
142
|
-
onSuccess: () => {
|
|
143
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.discountCodes.all });
|
|
144
|
-
},
|
|
145
|
-
...options,
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Hook to get discount code overview stats using admin RPC
|
|
150
|
-
*/
|
|
151
|
-
export function useGetDiscountCodeOverviewStats(options) {
|
|
152
|
-
const { baseURL, getAuthToken } = useApiConfig();
|
|
153
|
-
return useQueryUnwrapped({
|
|
154
|
-
queryKey: queryKeys.admin.discountCodes.overviewStats(),
|
|
155
|
-
queryFn: async () => {
|
|
156
|
-
const token = await getAuthToken();
|
|
157
|
-
const clients = createAdminRpcClients(baseURL);
|
|
158
|
-
const res = await clients.discountCodes.stats.overview.$get({}, authHeaders(token));
|
|
159
|
-
if (!res.ok)
|
|
160
|
-
throw new Error(`Failed to fetch discount code overview stats: ${res.statusText}`);
|
|
161
|
-
return res.json();
|
|
162
|
-
},
|
|
163
|
-
...options,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type-safe admin RPC hooks
|
|
3
|
-
*
|
|
4
|
-
* Export all admin RPC hooks for use in admin dashboards
|
|
5
|
-
*/
|
|
6
|
-
export * from './orders';
|
|
7
|
-
export * from './brands';
|
|
8
|
-
export * from './products';
|
|
9
|
-
export * from './variants';
|
|
10
|
-
export * from './warehouses';
|
|
11
|
-
export * from './inventory';
|
|
12
|
-
export * from './customers';
|
|
13
|
-
export * from './stats';
|
|
14
|
-
export * from './abandoned-carts';
|
|
15
|
-
export * from './discount-codes';
|
|
16
|
-
export * from './delivery-zones';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type-safe admin RPC hooks
|
|
3
|
-
*
|
|
4
|
-
* Export all admin RPC hooks for use in admin dashboards
|
|
5
|
-
*/
|
|
6
|
-
export * from './orders';
|
|
7
|
-
export * from './brands';
|
|
8
|
-
export * from './products';
|
|
9
|
-
export * from './variants';
|
|
10
|
-
export * from './warehouses';
|
|
11
|
-
export * from './inventory';
|
|
12
|
-
export * from './customers';
|
|
13
|
-
export * from './stats';
|
|
14
|
-
export * from './abandoned-carts';
|
|
15
|
-
export * from './discount-codes';
|
|
16
|
-
export * from './delivery-zones';
|