@instockng/api-client 1.0.34 → 1.0.35
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/backend-types.d.ts +1 -1
- package/dist/fetchers/carts.d.ts +73 -41
- package/dist/fetchers/orders.d.ts +25 -1
- package/dist/hooks/admin/abandoned-carts.d.ts +12 -10
- package/dist/hooks/admin/index.d.ts +1 -0
- package/dist/hooks/admin/index.js +1 -0
- package/dist/hooks/admin/products.d.ts +50 -2
- package/dist/hooks/admin/sales.d.ts +46 -0
- package/dist/hooks/admin/sales.js +180 -0
- package/dist/hooks/admin/variants.d.ts +13 -6
- package/dist/hooks/admin/variants.js +6 -5
- package/dist/hooks/public/carts.d.ts +73 -41
- package/dist/hooks/public/orders.d.ts +25 -1
- package/dist/rpc-client.d.ts +793 -123
- package/dist/rpc-client.js +1 -0
- package/dist/rpc-types.d.ts +75 -3
- package/dist/utils/query-keys.d.ts +6 -0
- package/dist/utils/query-keys.js +6 -0
- package/package.json +1 -1
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-safe admin RPC hooks for sales 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 sales using admin RPC
|
|
11
|
+
*/
|
|
12
|
+
export function useListSales(params, options) {
|
|
13
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
14
|
+
return useQueryUnwrapped({
|
|
15
|
+
queryKey: queryKeys.admin.sales.list(params),
|
|
16
|
+
queryFn: async () => {
|
|
17
|
+
const token = await getAuthToken();
|
|
18
|
+
const clients = createAdminRpcClients(baseURL);
|
|
19
|
+
const res = await clients.sales.index.$get({ query: params }, authHeaders(token));
|
|
20
|
+
if (!res.ok)
|
|
21
|
+
throw new Error(`Failed to fetch sales: ${res.statusText}`);
|
|
22
|
+
return res.json();
|
|
23
|
+
},
|
|
24
|
+
...options,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Hook to get sale by ID using admin RPC
|
|
29
|
+
*/
|
|
30
|
+
export function useGetSale(saleId, options) {
|
|
31
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
32
|
+
return useQueryUnwrapped({
|
|
33
|
+
queryKey: queryKeys.admin.sales.detail(saleId),
|
|
34
|
+
queryFn: async () => {
|
|
35
|
+
const token = await getAuthToken();
|
|
36
|
+
const clients = createAdminRpcClients(baseURL);
|
|
37
|
+
const res = await clients.sales[':id'].$get({ param: { id: saleId } }, authHeaders(token));
|
|
38
|
+
if (!res.ok)
|
|
39
|
+
throw new Error(`Failed to fetch sale: ${res.statusText}`);
|
|
40
|
+
return res.json();
|
|
41
|
+
},
|
|
42
|
+
enabled: !!saleId,
|
|
43
|
+
...options,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Hook to create a sale using admin RPC
|
|
48
|
+
*/
|
|
49
|
+
export function useCreateSale(options) {
|
|
50
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
51
|
+
const queryClient = useQueryClient();
|
|
52
|
+
return useMutation({
|
|
53
|
+
mutationFn: async (data) => {
|
|
54
|
+
const token = await getAuthToken();
|
|
55
|
+
const clients = createAdminRpcClients(baseURL);
|
|
56
|
+
const res = await clients.sales.index.$post({ json: data }, authHeaders(token));
|
|
57
|
+
if (!res.ok) {
|
|
58
|
+
const errorData = await res.json();
|
|
59
|
+
throw new Error(errorData?.error?.message || `Failed to create sale: ${res.statusText}`);
|
|
60
|
+
}
|
|
61
|
+
return res.json();
|
|
62
|
+
},
|
|
63
|
+
onSuccess: () => {
|
|
64
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.sales.all });
|
|
65
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.products.all });
|
|
66
|
+
},
|
|
67
|
+
...options,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Hook to update a sale using admin RPC
|
|
72
|
+
*/
|
|
73
|
+
export function useUpdateSale(saleId, options) {
|
|
74
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
75
|
+
const queryClient = useQueryClient();
|
|
76
|
+
return useMutation({
|
|
77
|
+
mutationFn: async (data) => {
|
|
78
|
+
const token = await getAuthToken();
|
|
79
|
+
const clients = createAdminRpcClients(baseURL);
|
|
80
|
+
const res = await clients.sales[':id'].$patch({ json: data, param: { id: saleId } }, authHeaders(token));
|
|
81
|
+
if (!res.ok) {
|
|
82
|
+
const errorData = await res.json();
|
|
83
|
+
throw new Error(errorData?.error?.message || `Failed to update sale: ${res.statusText}`);
|
|
84
|
+
}
|
|
85
|
+
return res.json();
|
|
86
|
+
},
|
|
87
|
+
onSuccess: () => {
|
|
88
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.sales.detail(saleId) });
|
|
89
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.sales.all });
|
|
90
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.products.all });
|
|
91
|
+
},
|
|
92
|
+
...options,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Hook to delete a sale using admin RPC
|
|
97
|
+
*/
|
|
98
|
+
export function useDeleteSale(saleId, options) {
|
|
99
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
100
|
+
const queryClient = useQueryClient();
|
|
101
|
+
return useMutation({
|
|
102
|
+
mutationFn: async () => {
|
|
103
|
+
const token = await getAuthToken();
|
|
104
|
+
const clients = createAdminRpcClients(baseURL);
|
|
105
|
+
const res = await clients.sales[':id'].$delete({ param: { id: saleId } }, authHeaders(token));
|
|
106
|
+
if (!res.ok)
|
|
107
|
+
throw new Error(`Failed to delete sale: ${res.statusText}`);
|
|
108
|
+
},
|
|
109
|
+
onSuccess: () => {
|
|
110
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.sales.all });
|
|
111
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.products.all });
|
|
112
|
+
},
|
|
113
|
+
...options,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Hook to add products to a sale using admin RPC
|
|
118
|
+
*/
|
|
119
|
+
export function useAddProductsToSale(saleId, options) {
|
|
120
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
121
|
+
const queryClient = useQueryClient();
|
|
122
|
+
return useMutation({
|
|
123
|
+
mutationFn: async (data) => {
|
|
124
|
+
const token = await getAuthToken();
|
|
125
|
+
const clients = createAdminRpcClients(baseURL);
|
|
126
|
+
const res = await clients.sales[':id']['products'].$post({ json: data, param: { id: saleId } }, authHeaders(token));
|
|
127
|
+
if (!res.ok) {
|
|
128
|
+
const errorData = await res.json();
|
|
129
|
+
throw new Error(errorData?.error?.message || `Failed to add products to sale: ${res.statusText}`);
|
|
130
|
+
}
|
|
131
|
+
return res.json();
|
|
132
|
+
},
|
|
133
|
+
onSuccess: () => {
|
|
134
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.sales.detail(saleId) });
|
|
135
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.sales.all });
|
|
136
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.products.all });
|
|
137
|
+
},
|
|
138
|
+
...options,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Hook to remove a product from a sale using admin RPC
|
|
143
|
+
*/
|
|
144
|
+
export function useRemoveProductFromSale(saleId, options) {
|
|
145
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
146
|
+
const queryClient = useQueryClient();
|
|
147
|
+
return useMutation({
|
|
148
|
+
mutationFn: async (productId) => {
|
|
149
|
+
const token = await getAuthToken();
|
|
150
|
+
const clients = createAdminRpcClients(baseURL);
|
|
151
|
+
const res = await clients.sales[':id']['products'][':productId'].$delete({ param: { id: saleId, productId } }, authHeaders(token));
|
|
152
|
+
if (!res.ok)
|
|
153
|
+
throw new Error(`Failed to remove product from sale: ${res.statusText}`);
|
|
154
|
+
},
|
|
155
|
+
onSuccess: () => {
|
|
156
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.sales.detail(saleId) });
|
|
157
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.sales.all });
|
|
158
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.products.all });
|
|
159
|
+
},
|
|
160
|
+
...options,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Hook to get sales overview stats using admin RPC
|
|
165
|
+
*/
|
|
166
|
+
export function useGetSalesOverviewStats(options) {
|
|
167
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
168
|
+
return useQueryUnwrapped({
|
|
169
|
+
queryKey: queryKeys.admin.sales.overviewStats(),
|
|
170
|
+
queryFn: async () => {
|
|
171
|
+
const token = await getAuthToken();
|
|
172
|
+
const clients = createAdminRpcClients(baseURL);
|
|
173
|
+
const res = await clients.sales['stats']['overview'].$get({}, authHeaders(token));
|
|
174
|
+
if (!res.ok)
|
|
175
|
+
throw new Error(`Failed to fetch sales stats: ${res.statusText}`);
|
|
176
|
+
return res.json();
|
|
177
|
+
},
|
|
178
|
+
...options,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
@@ -15,10 +15,11 @@ export declare function useSearchVariants(params?: {
|
|
|
15
15
|
price: number;
|
|
16
16
|
compareAtPrice: number;
|
|
17
17
|
deletedAt: string;
|
|
18
|
+
thumbnailUrl: string;
|
|
19
|
+
originalPrice: number;
|
|
18
20
|
id: string;
|
|
19
21
|
name: string | null;
|
|
20
22
|
isActive: boolean;
|
|
21
|
-
thumbnailUrl: string | null;
|
|
22
23
|
productId: string;
|
|
23
24
|
sku: string;
|
|
24
25
|
trackInventory: boolean;
|
|
@@ -33,10 +34,11 @@ export declare function useListProductVariants(productId: string, options?: Omit
|
|
|
33
34
|
price: number;
|
|
34
35
|
compareAtPrice: number;
|
|
35
36
|
deletedAt: string;
|
|
37
|
+
thumbnailUrl: string;
|
|
38
|
+
originalPrice: number;
|
|
36
39
|
id: string;
|
|
37
40
|
name: string | null;
|
|
38
41
|
isActive: boolean;
|
|
39
|
-
thumbnailUrl: string | null;
|
|
40
42
|
productId: string;
|
|
41
43
|
sku: string;
|
|
42
44
|
trackInventory: boolean;
|
|
@@ -51,10 +53,11 @@ export declare function useCreateVariant(productId: string, options?: UseMutatio
|
|
|
51
53
|
price: number;
|
|
52
54
|
compareAtPrice: number;
|
|
53
55
|
deletedAt: string;
|
|
56
|
+
thumbnailUrl: string;
|
|
57
|
+
originalPrice: number;
|
|
54
58
|
id: string;
|
|
55
59
|
name: string | null;
|
|
56
60
|
isActive: boolean;
|
|
57
|
-
thumbnailUrl: string | null;
|
|
58
61
|
productId: string;
|
|
59
62
|
sku: string;
|
|
60
63
|
trackInventory: boolean;
|
|
@@ -68,16 +71,19 @@ export declare function useCreateVariant(productId: string, options?: UseMutatio
|
|
|
68
71
|
/**
|
|
69
72
|
* Hook to update a variant using admin RPC
|
|
70
73
|
*/
|
|
71
|
-
export declare function useUpdateVariant(
|
|
74
|
+
export declare function useUpdateVariant(productId: string, options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['variants']['products'][':productId']['variants'][':variantId']['$patch']>>['json']>>, Error, {
|
|
75
|
+
variantId: string;
|
|
76
|
+
} & any>): import("@tanstack/react-query").UseMutationResult<{
|
|
72
77
|
createdAt: string;
|
|
73
78
|
updatedAt: string;
|
|
74
79
|
price: number;
|
|
75
80
|
compareAtPrice: number;
|
|
76
81
|
deletedAt: string;
|
|
82
|
+
thumbnailUrl: string;
|
|
83
|
+
originalPrice: number;
|
|
77
84
|
id: string;
|
|
78
85
|
name: string | null;
|
|
79
86
|
isActive: boolean;
|
|
80
|
-
thumbnailUrl: string | null;
|
|
81
87
|
productId: string;
|
|
82
88
|
sku: string;
|
|
83
89
|
trackInventory: boolean;
|
|
@@ -98,10 +104,11 @@ export declare function useGetVariantInventory(variantId: string, options?: Omit
|
|
|
98
104
|
price: number;
|
|
99
105
|
compareAtPrice: number;
|
|
100
106
|
deletedAt: string;
|
|
107
|
+
thumbnailUrl: string;
|
|
108
|
+
originalPrice: number;
|
|
101
109
|
id: string;
|
|
102
110
|
name: string | null;
|
|
103
111
|
isActive: boolean;
|
|
104
|
-
thumbnailUrl: string | null;
|
|
105
112
|
productId: string;
|
|
106
113
|
sku: string;
|
|
107
114
|
trackInventory: boolean;
|
|
@@ -67,21 +67,22 @@ export function useCreateVariant(productId, options) {
|
|
|
67
67
|
/**
|
|
68
68
|
* Hook to update a variant using admin RPC
|
|
69
69
|
*/
|
|
70
|
-
export function useUpdateVariant(
|
|
70
|
+
export function useUpdateVariant(productId, options) {
|
|
71
71
|
const { baseURL, getAuthToken } = useApiConfig();
|
|
72
72
|
const queryClient = useQueryClient();
|
|
73
73
|
return useMutation({
|
|
74
|
-
mutationFn: async (data) => {
|
|
74
|
+
mutationFn: async ({ variantId, ...data }) => {
|
|
75
75
|
const token = await getAuthToken();
|
|
76
76
|
const clients = createAdminRpcClients(baseURL);
|
|
77
|
-
const res = await clients.variants[':
|
|
77
|
+
const res = await clients.variants.products[':productId'].variants[':variantId'].$patch({ json: data, param: { productId, variantId } }, authHeaders(token));
|
|
78
78
|
if (!res.ok)
|
|
79
79
|
throw new Error(`Failed to update variant: ${res.statusText}`);
|
|
80
80
|
return res.json();
|
|
81
81
|
},
|
|
82
|
-
onSuccess: () => {
|
|
83
|
-
queryClient.invalidateQueries({ queryKey: queryKeys.admin.variants.detail(variantId) });
|
|
82
|
+
onSuccess: (_data, variables) => {
|
|
83
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.variants.detail(variables.variantId) });
|
|
84
84
|
queryClient.invalidateQueries({ queryKey: queryKeys.admin.variants.all });
|
|
85
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.products.detail(productId) });
|
|
85
86
|
},
|
|
86
87
|
...options,
|
|
87
88
|
});
|
|
@@ -71,7 +71,6 @@ export declare function useGetCart(cartId: string, options?: Omit<UseQueryOption
|
|
|
71
71
|
items: {
|
|
72
72
|
id: string;
|
|
73
73
|
variant: {
|
|
74
|
-
price: number;
|
|
75
74
|
product: {
|
|
76
75
|
id: string;
|
|
77
76
|
name: string;
|
|
@@ -520,16 +519,18 @@ export declare function useGetCart(cartId: string, options?: Omit<UseQueryOption
|
|
|
520
519
|
};
|
|
521
520
|
};
|
|
522
521
|
};
|
|
523
|
-
id: string;
|
|
524
|
-
name: string | null;
|
|
525
522
|
createdAt: string;
|
|
526
523
|
updatedAt: string;
|
|
524
|
+
price: number;
|
|
525
|
+
compareAtPrice: number;
|
|
527
526
|
deletedAt: string;
|
|
527
|
+
thumbnailUrl: string;
|
|
528
|
+
originalPrice: number;
|
|
529
|
+
id: string;
|
|
530
|
+
name: string | null;
|
|
528
531
|
isActive: boolean;
|
|
529
|
-
thumbnailUrl: string | null;
|
|
530
532
|
productId: string;
|
|
531
533
|
sku: string;
|
|
532
|
-
compareAtPrice: string;
|
|
533
534
|
trackInventory: boolean;
|
|
534
535
|
lowStockThreshold: number | null;
|
|
535
536
|
};
|
|
@@ -626,7 +627,6 @@ export declare function useUpdateCart(cartId: string, options?: UseMutationOptio
|
|
|
626
627
|
items: {
|
|
627
628
|
id: string;
|
|
628
629
|
variant: {
|
|
629
|
-
price: number;
|
|
630
630
|
product: {
|
|
631
631
|
id: string;
|
|
632
632
|
name: string;
|
|
@@ -1075,16 +1075,18 @@ export declare function useUpdateCart(cartId: string, options?: UseMutationOptio
|
|
|
1075
1075
|
};
|
|
1076
1076
|
};
|
|
1077
1077
|
};
|
|
1078
|
-
id: string;
|
|
1079
|
-
name: string | null;
|
|
1080
1078
|
createdAt: string;
|
|
1081
1079
|
updatedAt: string;
|
|
1080
|
+
price: number;
|
|
1081
|
+
compareAtPrice: number;
|
|
1082
1082
|
deletedAt: string;
|
|
1083
|
+
thumbnailUrl: string;
|
|
1084
|
+
originalPrice: number;
|
|
1085
|
+
id: string;
|
|
1086
|
+
name: string | null;
|
|
1083
1087
|
isActive: boolean;
|
|
1084
|
-
thumbnailUrl: string | null;
|
|
1085
1088
|
productId: string;
|
|
1086
1089
|
sku: string;
|
|
1087
|
-
compareAtPrice: string;
|
|
1088
1090
|
trackInventory: boolean;
|
|
1089
1091
|
lowStockThreshold: number | null;
|
|
1090
1092
|
};
|
|
@@ -1189,7 +1191,6 @@ export declare function useCreateCart(options?: UseMutationOptions<Awaited<Retur
|
|
|
1189
1191
|
items: {
|
|
1190
1192
|
id: string;
|
|
1191
1193
|
variant: {
|
|
1192
|
-
price: number;
|
|
1193
1194
|
product: {
|
|
1194
1195
|
id: string;
|
|
1195
1196
|
name: string;
|
|
@@ -1638,16 +1639,18 @@ export declare function useCreateCart(options?: UseMutationOptions<Awaited<Retur
|
|
|
1638
1639
|
};
|
|
1639
1640
|
};
|
|
1640
1641
|
};
|
|
1641
|
-
id: string;
|
|
1642
|
-
name: string | null;
|
|
1643
1642
|
createdAt: string;
|
|
1644
1643
|
updatedAt: string;
|
|
1644
|
+
price: number;
|
|
1645
|
+
compareAtPrice: number;
|
|
1645
1646
|
deletedAt: string;
|
|
1647
|
+
thumbnailUrl: string;
|
|
1648
|
+
originalPrice: number;
|
|
1649
|
+
id: string;
|
|
1650
|
+
name: string | null;
|
|
1646
1651
|
isActive: boolean;
|
|
1647
|
-
thumbnailUrl: string | null;
|
|
1648
1652
|
productId: string;
|
|
1649
1653
|
sku: string;
|
|
1650
|
-
compareAtPrice: string;
|
|
1651
1654
|
trackInventory: boolean;
|
|
1652
1655
|
lowStockThreshold: number | null;
|
|
1653
1656
|
};
|
|
@@ -1743,7 +1746,6 @@ export declare function useApplyDiscount(cartId: string, options?: UseMutationOp
|
|
|
1743
1746
|
items: {
|
|
1744
1747
|
id: string;
|
|
1745
1748
|
variant: {
|
|
1746
|
-
price: number;
|
|
1747
1749
|
product: {
|
|
1748
1750
|
id: string;
|
|
1749
1751
|
name: string;
|
|
@@ -2192,16 +2194,18 @@ export declare function useApplyDiscount(cartId: string, options?: UseMutationOp
|
|
|
2192
2194
|
};
|
|
2193
2195
|
};
|
|
2194
2196
|
};
|
|
2195
|
-
id: string;
|
|
2196
|
-
name: string | null;
|
|
2197
2197
|
createdAt: string;
|
|
2198
2198
|
updatedAt: string;
|
|
2199
|
+
price: number;
|
|
2200
|
+
compareAtPrice: number;
|
|
2199
2201
|
deletedAt: string;
|
|
2202
|
+
thumbnailUrl: string;
|
|
2203
|
+
originalPrice: number;
|
|
2204
|
+
id: string;
|
|
2205
|
+
name: string | null;
|
|
2200
2206
|
isActive: boolean;
|
|
2201
|
-
thumbnailUrl: string | null;
|
|
2202
2207
|
productId: string;
|
|
2203
2208
|
sku: string;
|
|
2204
|
-
compareAtPrice: string;
|
|
2205
2209
|
trackInventory: boolean;
|
|
2206
2210
|
lowStockThreshold: number | null;
|
|
2207
2211
|
};
|
|
@@ -2302,7 +2306,6 @@ export declare function useRemoveDiscount(cartId: string, options?: UseMutationO
|
|
|
2302
2306
|
items: {
|
|
2303
2307
|
id: string;
|
|
2304
2308
|
variant: {
|
|
2305
|
-
price: number;
|
|
2306
2309
|
product: {
|
|
2307
2310
|
id: string;
|
|
2308
2311
|
name: string;
|
|
@@ -2751,16 +2754,18 @@ export declare function useRemoveDiscount(cartId: string, options?: UseMutationO
|
|
|
2751
2754
|
};
|
|
2752
2755
|
};
|
|
2753
2756
|
};
|
|
2754
|
-
id: string;
|
|
2755
|
-
name: string | null;
|
|
2756
2757
|
createdAt: string;
|
|
2757
2758
|
updatedAt: string;
|
|
2759
|
+
price: number;
|
|
2760
|
+
compareAtPrice: number;
|
|
2758
2761
|
deletedAt: string;
|
|
2762
|
+
thumbnailUrl: string;
|
|
2763
|
+
originalPrice: number;
|
|
2764
|
+
id: string;
|
|
2765
|
+
name: string | null;
|
|
2759
2766
|
isActive: boolean;
|
|
2760
|
-
thumbnailUrl: string | null;
|
|
2761
2767
|
productId: string;
|
|
2762
2768
|
sku: string;
|
|
2763
|
-
compareAtPrice: string;
|
|
2764
2769
|
trackInventory: boolean;
|
|
2765
2770
|
lowStockThreshold: number | null;
|
|
2766
2771
|
};
|
|
@@ -2867,7 +2872,6 @@ export declare function useAddCartItem(cartId: string, options?: UseMutationOpti
|
|
|
2867
2872
|
items: {
|
|
2868
2873
|
id: string;
|
|
2869
2874
|
variant: {
|
|
2870
|
-
price: number;
|
|
2871
2875
|
product: {
|
|
2872
2876
|
id: string;
|
|
2873
2877
|
name: string;
|
|
@@ -3316,16 +3320,18 @@ export declare function useAddCartItem(cartId: string, options?: UseMutationOpti
|
|
|
3316
3320
|
};
|
|
3317
3321
|
};
|
|
3318
3322
|
};
|
|
3319
|
-
id: string;
|
|
3320
|
-
name: string | null;
|
|
3321
3323
|
createdAt: string;
|
|
3322
3324
|
updatedAt: string;
|
|
3325
|
+
price: number;
|
|
3326
|
+
compareAtPrice: number;
|
|
3323
3327
|
deletedAt: string;
|
|
3328
|
+
thumbnailUrl: string;
|
|
3329
|
+
originalPrice: number;
|
|
3330
|
+
id: string;
|
|
3331
|
+
name: string | null;
|
|
3324
3332
|
isActive: boolean;
|
|
3325
|
-
thumbnailUrl: string | null;
|
|
3326
3333
|
productId: string;
|
|
3327
3334
|
sku: string;
|
|
3328
|
-
compareAtPrice: string;
|
|
3329
3335
|
trackInventory: boolean;
|
|
3330
3336
|
lowStockThreshold: number | null;
|
|
3331
3337
|
};
|
|
@@ -3435,7 +3441,6 @@ export declare function useUpdateCartItem(cartId: string, options?: UseMutationO
|
|
|
3435
3441
|
items: {
|
|
3436
3442
|
id: string;
|
|
3437
3443
|
variant: {
|
|
3438
|
-
price: number;
|
|
3439
3444
|
product: {
|
|
3440
3445
|
id: string;
|
|
3441
3446
|
name: string;
|
|
@@ -3884,16 +3889,18 @@ export declare function useUpdateCartItem(cartId: string, options?: UseMutationO
|
|
|
3884
3889
|
};
|
|
3885
3890
|
};
|
|
3886
3891
|
};
|
|
3887
|
-
id: string;
|
|
3888
|
-
name: string | null;
|
|
3889
3892
|
createdAt: string;
|
|
3890
3893
|
updatedAt: string;
|
|
3894
|
+
price: number;
|
|
3895
|
+
compareAtPrice: number;
|
|
3891
3896
|
deletedAt: string;
|
|
3897
|
+
thumbnailUrl: string;
|
|
3898
|
+
originalPrice: number;
|
|
3899
|
+
id: string;
|
|
3900
|
+
name: string | null;
|
|
3892
3901
|
isActive: boolean;
|
|
3893
|
-
thumbnailUrl: string | null;
|
|
3894
3902
|
productId: string;
|
|
3895
3903
|
sku: string;
|
|
3896
|
-
compareAtPrice: string;
|
|
3897
3904
|
trackInventory: boolean;
|
|
3898
3905
|
lowStockThreshold: number | null;
|
|
3899
3906
|
};
|
|
@@ -3990,7 +3997,6 @@ export declare function useRemoveCartItem(cartId: string, options?: UseMutationO
|
|
|
3990
3997
|
items: {
|
|
3991
3998
|
id: string;
|
|
3992
3999
|
variant: {
|
|
3993
|
-
price: number;
|
|
3994
4000
|
product: {
|
|
3995
4001
|
id: string;
|
|
3996
4002
|
name: string;
|
|
@@ -4439,16 +4445,18 @@ export declare function useRemoveCartItem(cartId: string, options?: UseMutationO
|
|
|
4439
4445
|
};
|
|
4440
4446
|
};
|
|
4441
4447
|
};
|
|
4442
|
-
id: string;
|
|
4443
|
-
name: string | null;
|
|
4444
4448
|
createdAt: string;
|
|
4445
4449
|
updatedAt: string;
|
|
4450
|
+
price: number;
|
|
4451
|
+
compareAtPrice: number;
|
|
4446
4452
|
deletedAt: string;
|
|
4453
|
+
thumbnailUrl: string;
|
|
4454
|
+
originalPrice: number;
|
|
4455
|
+
id: string;
|
|
4456
|
+
name: string | null;
|
|
4447
4457
|
isActive: boolean;
|
|
4448
|
-
thumbnailUrl: string | null;
|
|
4449
4458
|
productId: string;
|
|
4450
4459
|
sku: string;
|
|
4451
|
-
compareAtPrice: string;
|
|
4452
4460
|
trackInventory: boolean;
|
|
4453
4461
|
lowStockThreshold: number | null;
|
|
4454
4462
|
};
|
|
@@ -5104,6 +5112,10 @@ export declare function useInitiateCheckout(cartId: string, options?: UseMutatio
|
|
|
5104
5112
|
* ```
|
|
5105
5113
|
*/
|
|
5106
5114
|
export declare function useGetCartRecommendations(cartId: string | null | undefined, limit: number, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchCartRecommendations>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
|
|
5115
|
+
isOnSale: boolean;
|
|
5116
|
+
saleId: string;
|
|
5117
|
+
saleName: string;
|
|
5118
|
+
saleEndsAt: string;
|
|
5107
5119
|
id: string;
|
|
5108
5120
|
name: string;
|
|
5109
5121
|
slug: string;
|
|
@@ -5274,10 +5286,11 @@ export declare function useGetCartRecommendations(cartId: string | null | undefi
|
|
|
5274
5286
|
price: number;
|
|
5275
5287
|
compareAtPrice: number;
|
|
5276
5288
|
deletedAt: string;
|
|
5289
|
+
thumbnailUrl: string;
|
|
5290
|
+
originalPrice: number;
|
|
5277
5291
|
id: string;
|
|
5278
5292
|
name: string | null;
|
|
5279
5293
|
isActive: boolean;
|
|
5280
|
-
thumbnailUrl: string | null;
|
|
5281
5294
|
productId: string;
|
|
5282
5295
|
sku: string;
|
|
5283
5296
|
trackInventory: boolean;
|
|
@@ -5574,6 +5587,25 @@ export declare function useGetCartRecommendations(cartId: string | null | undefi
|
|
|
5574
5587
|
flat?: boolean;
|
|
5575
5588
|
};
|
|
5576
5589
|
};
|
|
5590
|
+
sales: {
|
|
5591
|
+
sale: {
|
|
5592
|
+
id: string;
|
|
5593
|
+
name: string;
|
|
5594
|
+
createdAt: string;
|
|
5595
|
+
updatedAt: string;
|
|
5596
|
+
deletedAt: string;
|
|
5597
|
+
brandId: string;
|
|
5598
|
+
isActive: boolean;
|
|
5599
|
+
discountType: import("@prisma/client").$Enums.DiscountType;
|
|
5600
|
+
discountValue: string;
|
|
5601
|
+
startDate: string;
|
|
5602
|
+
endDate: string;
|
|
5603
|
+
};
|
|
5604
|
+
id: string;
|
|
5605
|
+
createdAt: string;
|
|
5606
|
+
productId: string;
|
|
5607
|
+
saleId: string;
|
|
5608
|
+
}[];
|
|
5577
5609
|
createdAt: string;
|
|
5578
5610
|
updatedAt: string;
|
|
5579
5611
|
deletedAt: string;
|
|
@@ -1166,6 +1166,10 @@ export declare function useConfirmOrder(options?: UseMutationOptions<Awaited<Ret
|
|
|
1166
1166
|
* ```
|
|
1167
1167
|
*/
|
|
1168
1168
|
export declare function useGetOrderRecommendations(orderId: string | null | undefined, token: string | null | undefined, limit?: number, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchOrderRecommendations>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
|
|
1169
|
+
isOnSale: boolean;
|
|
1170
|
+
saleId: string;
|
|
1171
|
+
saleName: string;
|
|
1172
|
+
saleEndsAt: string;
|
|
1169
1173
|
id: string;
|
|
1170
1174
|
name: string;
|
|
1171
1175
|
slug: string;
|
|
@@ -1336,10 +1340,11 @@ export declare function useGetOrderRecommendations(orderId: string | null | unde
|
|
|
1336
1340
|
price: number;
|
|
1337
1341
|
compareAtPrice: number;
|
|
1338
1342
|
deletedAt: string;
|
|
1343
|
+
thumbnailUrl: string;
|
|
1344
|
+
originalPrice: number;
|
|
1339
1345
|
id: string;
|
|
1340
1346
|
name: string | null;
|
|
1341
1347
|
isActive: boolean;
|
|
1342
|
-
thumbnailUrl: string | null;
|
|
1343
1348
|
productId: string;
|
|
1344
1349
|
sku: string;
|
|
1345
1350
|
trackInventory: boolean;
|
|
@@ -1636,6 +1641,25 @@ export declare function useGetOrderRecommendations(orderId: string | null | unde
|
|
|
1636
1641
|
flat?: boolean;
|
|
1637
1642
|
};
|
|
1638
1643
|
};
|
|
1644
|
+
sales: {
|
|
1645
|
+
sale: {
|
|
1646
|
+
id: string;
|
|
1647
|
+
name: string;
|
|
1648
|
+
createdAt: string;
|
|
1649
|
+
updatedAt: string;
|
|
1650
|
+
deletedAt: string;
|
|
1651
|
+
brandId: string;
|
|
1652
|
+
isActive: boolean;
|
|
1653
|
+
discountType: import("@prisma/client").$Enums.DiscountType;
|
|
1654
|
+
discountValue: string;
|
|
1655
|
+
startDate: string;
|
|
1656
|
+
endDate: string;
|
|
1657
|
+
};
|
|
1658
|
+
id: string;
|
|
1659
|
+
createdAt: string;
|
|
1660
|
+
productId: string;
|
|
1661
|
+
saleId: string;
|
|
1662
|
+
}[];
|
|
1639
1663
|
createdAt: string;
|
|
1640
1664
|
updatedAt: string;
|
|
1641
1665
|
deletedAt: string;
|