@instockng/api-client 1.0.21 → 1.0.22
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 +10 -0
- package/dist/fetchers/orders.d.ts +3 -0
- package/dist/fetchers/products.d.ts +10 -0
- package/dist/fetchers/products.js +18 -0
- package/dist/hooks/admin/abandoned-carts.d.ts +2 -0
- package/dist/hooks/admin/customers.d.ts +1 -0
- package/dist/hooks/admin/orders.d.ts +6 -0
- package/dist/hooks/admin/products.d.ts +4 -0
- package/dist/hooks/admin/products.js +33 -0
- package/dist/hooks/admin/stats.d.ts +1 -0
- package/dist/hooks/admin/variants.d.ts +5 -0
- package/dist/hooks/admin/warehouses.d.ts +1 -0
- package/dist/hooks/public/carts.d.ts +10 -0
- package/dist/hooks/public/orders.d.ts +3 -0
- package/dist/hooks/public/products.d.ts +10 -1
- package/dist/hooks/public/products.js +14 -1
- package/dist/rpc-client.d.ts +309 -0
- package/dist/rpc-client.js +2 -0
- package/dist/utils/query-keys.d.ts +2 -0
- package/dist/utils/query-keys.js +2 -0
- package/package.json +8 -9
package/dist/backend-types.d.ts
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* These types provide end-to-end type safety between the backend API
|
|
8
8
|
* and the frontend hooks/fetchers.
|
|
9
9
|
*/
|
|
10
|
-
export type { CartsRPC, OrdersRPC, ProductsRPC, DeliveryZonesRPC, BrandsRPC, AdminOrdersRPC, AdminBrandsRPC, AdminProductsRPC, AdminVariantsRPC, AdminWarehousesRPC, AdminInventoryRPC, AdminCustomersRPC, AdminStatsRPC, AdminAbandonedCartsRPC, AdminDiscountCodesRPC, AdminDeliveryZonesRPC, } from '../../../apps/backend/src/http-app';
|
|
10
|
+
export type { CartsRPC, OrdersRPC, ProductsRPC, DeliveryZonesRPC, BrandsRPC, AdminOrdersRPC, AdminBrandsRPC, AdminProductsRPC, AdminVariantsRPC, AdminWarehousesRPC, AdminInventoryRPC, AdminCustomersRPC, AdminStatsRPC, AdminAbandonedCartsRPC, AdminDiscountCodesRPC, AdminDeliveryZonesRPC, ProductAddonsRPC, AdminProductAddonsRPC, } from '../../../apps/backend/src/http-app';
|
package/dist/fetchers/carts.d.ts
CHANGED
|
@@ -232,6 +232,7 @@ export declare function fetchCart(cartId: string): Promise<{
|
|
|
232
232
|
thumbnailUrl: string | null;
|
|
233
233
|
productId: string;
|
|
234
234
|
sku: string;
|
|
235
|
+
compareAtPrice: string;
|
|
235
236
|
trackInventory: boolean;
|
|
236
237
|
lowStockThreshold: number | null;
|
|
237
238
|
};
|
|
@@ -491,6 +492,7 @@ export declare function createCart(brandSlug: string): Promise<{
|
|
|
491
492
|
thumbnailUrl: string | null;
|
|
492
493
|
productId: string;
|
|
493
494
|
sku: string;
|
|
495
|
+
compareAtPrice: string;
|
|
494
496
|
trackInventory: boolean;
|
|
495
497
|
lowStockThreshold: number | null;
|
|
496
498
|
};
|
|
@@ -753,6 +755,7 @@ export declare function updateCart(cartId: string, data: {
|
|
|
753
755
|
thumbnailUrl: string | null;
|
|
754
756
|
productId: string;
|
|
755
757
|
sku: string;
|
|
758
|
+
compareAtPrice: string;
|
|
756
759
|
trackInventory: boolean;
|
|
757
760
|
lowStockThreshold: number | null;
|
|
758
761
|
};
|
|
@@ -1018,6 +1021,7 @@ export declare function addCartItem(cartId: string, sku: string, quantity: numbe
|
|
|
1018
1021
|
thumbnailUrl: string | null;
|
|
1019
1022
|
productId: string;
|
|
1020
1023
|
sku: string;
|
|
1024
|
+
compareAtPrice: string;
|
|
1021
1025
|
trackInventory: boolean;
|
|
1022
1026
|
lowStockThreshold: number | null;
|
|
1023
1027
|
};
|
|
@@ -1279,6 +1283,7 @@ export declare function updateCartItem(cartId: string, itemId: string, quantity:
|
|
|
1279
1283
|
thumbnailUrl: string | null;
|
|
1280
1284
|
productId: string;
|
|
1281
1285
|
sku: string;
|
|
1286
|
+
compareAtPrice: string;
|
|
1282
1287
|
trackInventory: boolean;
|
|
1283
1288
|
lowStockThreshold: number | null;
|
|
1284
1289
|
};
|
|
@@ -1534,6 +1539,7 @@ export declare function removeCartItem(cartId: string, itemId: string): Promise<
|
|
|
1534
1539
|
thumbnailUrl: string | null;
|
|
1535
1540
|
productId: string;
|
|
1536
1541
|
sku: string;
|
|
1542
|
+
compareAtPrice: string;
|
|
1537
1543
|
trackInventory: boolean;
|
|
1538
1544
|
lowStockThreshold: number | null;
|
|
1539
1545
|
};
|
|
@@ -1789,6 +1795,7 @@ export declare function applyDiscount(cartId: string, code: string): Promise<{
|
|
|
1789
1795
|
thumbnailUrl: string | null;
|
|
1790
1796
|
productId: string;
|
|
1791
1797
|
sku: string;
|
|
1798
|
+
compareAtPrice: string;
|
|
1792
1799
|
trackInventory: boolean;
|
|
1793
1800
|
lowStockThreshold: number | null;
|
|
1794
1801
|
};
|
|
@@ -2048,6 +2055,7 @@ export declare function removeDiscount(cartId: string): Promise<{
|
|
|
2048
2055
|
thumbnailUrl: string | null;
|
|
2049
2056
|
productId: string;
|
|
2050
2057
|
sku: string;
|
|
2058
|
+
compareAtPrice: string;
|
|
2051
2059
|
trackInventory: boolean;
|
|
2052
2060
|
lowStockThreshold: number | null;
|
|
2053
2061
|
};
|
|
@@ -2324,6 +2332,7 @@ export declare function checkoutCart(cartId: string, checkoutData: {
|
|
|
2324
2332
|
thumbnailUrl: string | null;
|
|
2325
2333
|
productId: string;
|
|
2326
2334
|
sku: string;
|
|
2335
|
+
compareAtPrice: string;
|
|
2327
2336
|
trackInventory: boolean;
|
|
2328
2337
|
lowStockThreshold: number | null;
|
|
2329
2338
|
};
|
|
@@ -2393,6 +2402,7 @@ export declare function fetchCartRecommendations(cartId: string, limit: number):
|
|
|
2393
2402
|
createdAt: string;
|
|
2394
2403
|
updatedAt: string;
|
|
2395
2404
|
price: number;
|
|
2405
|
+
compareAtPrice: number;
|
|
2396
2406
|
deletedAt: string;
|
|
2397
2407
|
id: string;
|
|
2398
2408
|
name: string | null;
|
|
@@ -236,6 +236,7 @@ export declare function fetchOrder(orderId: string, token: string): Promise<{
|
|
|
236
236
|
thumbnailUrl: string | null;
|
|
237
237
|
productId: string;
|
|
238
238
|
sku: string;
|
|
239
|
+
compareAtPrice: string;
|
|
239
240
|
trackInventory: boolean;
|
|
240
241
|
lowStockThreshold: number | null;
|
|
241
242
|
};
|
|
@@ -506,6 +507,7 @@ export declare function confirmOrder(orderId: string, token: string): Promise<{
|
|
|
506
507
|
thumbnailUrl: string | null;
|
|
507
508
|
productId: string;
|
|
508
509
|
sku: string;
|
|
510
|
+
compareAtPrice: string;
|
|
509
511
|
trackInventory: boolean;
|
|
510
512
|
lowStockThreshold: number | null;
|
|
511
513
|
};
|
|
@@ -576,6 +578,7 @@ export declare function fetchOrderRecommendations(orderId: string, token: string
|
|
|
576
578
|
createdAt: string;
|
|
577
579
|
updatedAt: string;
|
|
578
580
|
price: number;
|
|
581
|
+
compareAtPrice: number;
|
|
579
582
|
deletedAt: string;
|
|
580
583
|
id: string;
|
|
581
584
|
name: string | null;
|
|
@@ -32,6 +32,7 @@ export declare function fetchProductsByBrand(brandId: string): Promise<{
|
|
|
32
32
|
createdAt: string;
|
|
33
33
|
updatedAt: string;
|
|
34
34
|
price: number;
|
|
35
|
+
compareAtPrice: number;
|
|
35
36
|
deletedAt: string;
|
|
36
37
|
id: string;
|
|
37
38
|
name: string | null;
|
|
@@ -224,6 +225,7 @@ export declare function fetchProductBySlug(slug: string): Promise<{
|
|
|
224
225
|
createdAt: string;
|
|
225
226
|
updatedAt: string;
|
|
226
227
|
price: number;
|
|
228
|
+
compareAtPrice: number;
|
|
227
229
|
deletedAt: string;
|
|
228
230
|
id: string;
|
|
229
231
|
name: string | null;
|
|
@@ -390,3 +392,11 @@ export declare function fetchProductBySlug(slug: string): Promise<{
|
|
|
390
392
|
};
|
|
391
393
|
};
|
|
392
394
|
}>;
|
|
395
|
+
/**
|
|
396
|
+
* Fetch product add-ons
|
|
397
|
+
*
|
|
398
|
+
* @param slug - Product slug
|
|
399
|
+
* @param limit - Max number of add-ons to return (default 6)
|
|
400
|
+
* @returns List of add-on products
|
|
401
|
+
*/
|
|
402
|
+
export declare function fetchProductAddons(slug: string, limit?: number): Promise<any>;
|
|
@@ -40,3 +40,21 @@ export async function fetchProductBySlug(slug) {
|
|
|
40
40
|
}
|
|
41
41
|
return res.json();
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Fetch product add-ons
|
|
45
|
+
*
|
|
46
|
+
* @param slug - Product slug
|
|
47
|
+
* @param limit - Max number of add-ons to return (default 6)
|
|
48
|
+
* @returns List of add-on products
|
|
49
|
+
*/
|
|
50
|
+
export async function fetchProductAddons(slug, limit) {
|
|
51
|
+
const clients = createRpcClients(API_URL);
|
|
52
|
+
const res = await clients.productAddons[':slug'].$get({
|
|
53
|
+
param: { slug },
|
|
54
|
+
query: limit !== undefined ? { limit: String(limit) } : {},
|
|
55
|
+
});
|
|
56
|
+
if (!res.ok) {
|
|
57
|
+
throw new Error(`Failed to fetch product add-ons: ${res.statusText}`);
|
|
58
|
+
}
|
|
59
|
+
return res.json();
|
|
60
|
+
}
|
|
@@ -230,6 +230,7 @@ export declare function useListAbandonedCarts(params?: {
|
|
|
230
230
|
thumbnailUrl: string | null;
|
|
231
231
|
productId: string;
|
|
232
232
|
sku: string;
|
|
233
|
+
compareAtPrice: string;
|
|
233
234
|
trackInventory: boolean;
|
|
234
235
|
lowStockThreshold: number | null;
|
|
235
236
|
};
|
|
@@ -499,6 +500,7 @@ export declare function useGetAbandonedCart(cartId: string, options?: Omit<UseQu
|
|
|
499
500
|
thumbnailUrl: string | null;
|
|
500
501
|
productId: string;
|
|
501
502
|
sku: string;
|
|
503
|
+
compareAtPrice: string;
|
|
502
504
|
trackInventory: boolean;
|
|
503
505
|
lowStockThreshold: number | null;
|
|
504
506
|
};
|
|
@@ -238,6 +238,7 @@ export declare function useGetCustomerHistory(phone: string, options?: Omit<UseQ
|
|
|
238
238
|
thumbnailUrl: string | null;
|
|
239
239
|
productId: string;
|
|
240
240
|
sku: string;
|
|
241
|
+
compareAtPrice: string;
|
|
241
242
|
trackInventory: boolean;
|
|
242
243
|
lowStockThreshold: number | null;
|
|
243
244
|
};
|
|
@@ -248,6 +248,7 @@ export declare function useListOrders(filters?: {
|
|
|
248
248
|
thumbnailUrl: string | null;
|
|
249
249
|
productId: string;
|
|
250
250
|
sku: string;
|
|
251
|
+
compareAtPrice: string;
|
|
251
252
|
trackInventory: boolean;
|
|
252
253
|
lowStockThreshold: number | null;
|
|
253
254
|
};
|
|
@@ -529,6 +530,7 @@ export declare function useGetOrder(orderId: string, options?: Omit<UseQueryOpti
|
|
|
529
530
|
thumbnailUrl: string | null;
|
|
530
531
|
productId: string;
|
|
531
532
|
sku: string;
|
|
533
|
+
compareAtPrice: string;
|
|
532
534
|
trackInventory: boolean;
|
|
533
535
|
lowStockThreshold: number | null;
|
|
534
536
|
};
|
|
@@ -807,6 +809,7 @@ export declare function useCreateOrder(options?: UseMutationOptions<Awaited<Retu
|
|
|
807
809
|
thumbnailUrl: string | null;
|
|
808
810
|
productId: string;
|
|
809
811
|
sku: string;
|
|
812
|
+
compareAtPrice: string;
|
|
810
813
|
trackInventory: boolean;
|
|
811
814
|
lowStockThreshold: number | null;
|
|
812
815
|
};
|
|
@@ -1086,6 +1089,7 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
1086
1089
|
thumbnailUrl: string | null;
|
|
1087
1090
|
productId: string;
|
|
1088
1091
|
sku: string;
|
|
1092
|
+
compareAtPrice: string;
|
|
1089
1093
|
trackInventory: boolean;
|
|
1090
1094
|
lowStockThreshold: number | null;
|
|
1091
1095
|
};
|
|
@@ -1354,6 +1358,7 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
1354
1358
|
productId: string;
|
|
1355
1359
|
sku: string;
|
|
1356
1360
|
price: string;
|
|
1361
|
+
compareAtPrice: string;
|
|
1357
1362
|
trackInventory: boolean;
|
|
1358
1363
|
lowStockThreshold: number | null;
|
|
1359
1364
|
};
|
|
@@ -1788,6 +1793,7 @@ export declare function useUpdateOrderStatus(orderId: string, options?: UseMutat
|
|
|
1788
1793
|
thumbnailUrl: string | null;
|
|
1789
1794
|
productId: string;
|
|
1790
1795
|
sku: string;
|
|
1796
|
+
compareAtPrice: string;
|
|
1791
1797
|
trackInventory: boolean;
|
|
1792
1798
|
lowStockThreshold: number | null;
|
|
1793
1799
|
};
|
|
@@ -23,6 +23,7 @@ export declare function useListProducts(brandId?: string, options?: Omit<UseQuer
|
|
|
23
23
|
createdAt: string;
|
|
24
24
|
updatedAt: string;
|
|
25
25
|
price: number;
|
|
26
|
+
compareAtPrice: number;
|
|
26
27
|
deletedAt: string;
|
|
27
28
|
id: string;
|
|
28
29
|
name: string | null;
|
|
@@ -209,6 +210,7 @@ export declare function useGetProduct(productId: string, options?: Omit<UseQuery
|
|
|
209
210
|
createdAt: string;
|
|
210
211
|
updatedAt: string;
|
|
211
212
|
price: number;
|
|
213
|
+
compareAtPrice: number;
|
|
212
214
|
deletedAt: string;
|
|
213
215
|
id: string;
|
|
214
216
|
name: string | null;
|
|
@@ -378,3 +380,5 @@ export declare function useGetProduct(productId: string, options?: Omit<UseQuery
|
|
|
378
380
|
export declare function useCreateProduct(options?: UseMutationOptions<any, Error, any>): import("@tanstack/react-query").UseMutationResult<any, Error, any, unknown>;
|
|
379
381
|
export declare function useUpdateProduct(productId: string, options?: UseMutationOptions<any, Error, any>): import("@tanstack/react-query").UseMutationResult<any, Error, any, unknown>;
|
|
380
382
|
export declare function useDeleteProduct(productId: string, options?: UseMutationOptions<any, Error, void>): import("@tanstack/react-query").UseMutationResult<any, Error, void, unknown>;
|
|
383
|
+
export declare function useGetProductAddOns(productId: string, options?: Omit<UseQueryOptions<any, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
384
|
+
export declare function useUpdateProductAddOns(productId: string, options?: UseMutationOptions<any, Error, any>): import("@tanstack/react-query").UseMutationResult<any, Error, any, unknown>;
|
|
@@ -87,3 +87,36 @@ export function useDeleteProduct(productId, options) {
|
|
|
87
87
|
...options,
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
+
export function useGetProductAddOns(productId, options) {
|
|
91
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
92
|
+
return useQueryUnwrapped({
|
|
93
|
+
queryKey: queryKeys.admin.products.addons(productId),
|
|
94
|
+
queryFn: async () => {
|
|
95
|
+
const token = await getAuthToken();
|
|
96
|
+
const clients = createAdminRpcClients(baseURL);
|
|
97
|
+
const res = await clients.productAddons[':id'].$get({ param: { id: productId } }, authHeaders(token));
|
|
98
|
+
if (!res.ok)
|
|
99
|
+
throw new Error(`Failed to fetch product add-ons: ${res.statusText}`);
|
|
100
|
+
return res.json();
|
|
101
|
+
},
|
|
102
|
+
...options,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export function useUpdateProductAddOns(productId, options) {
|
|
106
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
107
|
+
const queryClient = useQueryClient();
|
|
108
|
+
return useMutation({
|
|
109
|
+
mutationFn: async (data) => {
|
|
110
|
+
const token = await getAuthToken();
|
|
111
|
+
const clients = createAdminRpcClients(baseURL);
|
|
112
|
+
const res = await clients.productAddons[':id'].$put({ param: { id: productId }, json: data }, authHeaders(token));
|
|
113
|
+
if (!res.ok)
|
|
114
|
+
throw new Error(`Failed to update product add-ons: ${res.statusText}`);
|
|
115
|
+
return res.json();
|
|
116
|
+
},
|
|
117
|
+
onSuccess: () => {
|
|
118
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.products.addons(productId) });
|
|
119
|
+
},
|
|
120
|
+
...options,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
@@ -13,6 +13,7 @@ export declare function useSearchVariants(params?: {
|
|
|
13
13
|
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
15
|
price: number;
|
|
16
|
+
compareAtPrice: number;
|
|
16
17
|
deletedAt: string;
|
|
17
18
|
id: string;
|
|
18
19
|
name: string | null;
|
|
@@ -30,6 +31,7 @@ export declare function useListProductVariants(productId: string, options?: Omit
|
|
|
30
31
|
createdAt: string;
|
|
31
32
|
updatedAt: string;
|
|
32
33
|
price: number;
|
|
34
|
+
compareAtPrice: number;
|
|
33
35
|
deletedAt: string;
|
|
34
36
|
id: string;
|
|
35
37
|
name: string | null;
|
|
@@ -47,6 +49,7 @@ export declare function useCreateVariant(productId: string, options?: UseMutatio
|
|
|
47
49
|
createdAt: string;
|
|
48
50
|
updatedAt: string;
|
|
49
51
|
price: number;
|
|
52
|
+
compareAtPrice: number;
|
|
50
53
|
deletedAt: string;
|
|
51
54
|
id: string;
|
|
52
55
|
name: string | null;
|
|
@@ -69,6 +72,7 @@ export declare function useUpdateVariant(variantId: string, options?: UseMutatio
|
|
|
69
72
|
createdAt: string;
|
|
70
73
|
updatedAt: string;
|
|
71
74
|
price: number;
|
|
75
|
+
compareAtPrice: number;
|
|
72
76
|
deletedAt: string;
|
|
73
77
|
id: string;
|
|
74
78
|
name: string | null;
|
|
@@ -92,6 +96,7 @@ export declare function useGetVariantInventory(variantId: string, options?: Omit
|
|
|
92
96
|
createdAt: string;
|
|
93
97
|
updatedAt: string;
|
|
94
98
|
price: number;
|
|
99
|
+
compareAtPrice: number;
|
|
95
100
|
deletedAt: string;
|
|
96
101
|
id: string;
|
|
97
102
|
name: string | null;
|
|
@@ -238,6 +238,7 @@ export declare function useGetCart(cartId: string, options?: Omit<UseQueryOption
|
|
|
238
238
|
thumbnailUrl: string | null;
|
|
239
239
|
productId: string;
|
|
240
240
|
sku: string;
|
|
241
|
+
compareAtPrice: string;
|
|
241
242
|
trackInventory: boolean;
|
|
242
243
|
lowStockThreshold: number | null;
|
|
243
244
|
};
|
|
@@ -501,6 +502,7 @@ export declare function useUpdateCart(cartId: string, options?: UseMutationOptio
|
|
|
501
502
|
thumbnailUrl: string | null;
|
|
502
503
|
productId: string;
|
|
503
504
|
sku: string;
|
|
505
|
+
compareAtPrice: string;
|
|
504
506
|
trackInventory: boolean;
|
|
505
507
|
lowStockThreshold: number | null;
|
|
506
508
|
};
|
|
@@ -772,6 +774,7 @@ export declare function useCreateCart(options?: UseMutationOptions<Awaited<Retur
|
|
|
772
774
|
thumbnailUrl: string | null;
|
|
773
775
|
productId: string;
|
|
774
776
|
sku: string;
|
|
777
|
+
compareAtPrice: string;
|
|
775
778
|
trackInventory: boolean;
|
|
776
779
|
lowStockThreshold: number | null;
|
|
777
780
|
};
|
|
@@ -1034,6 +1037,7 @@ export declare function useApplyDiscount(cartId: string, options?: UseMutationOp
|
|
|
1034
1037
|
thumbnailUrl: string | null;
|
|
1035
1038
|
productId: string;
|
|
1036
1039
|
sku: string;
|
|
1040
|
+
compareAtPrice: string;
|
|
1037
1041
|
trackInventory: boolean;
|
|
1038
1042
|
lowStockThreshold: number | null;
|
|
1039
1043
|
};
|
|
@@ -1301,6 +1305,7 @@ export declare function useRemoveDiscount(cartId: string, options?: UseMutationO
|
|
|
1301
1305
|
thumbnailUrl: string | null;
|
|
1302
1306
|
productId: string;
|
|
1303
1307
|
sku: string;
|
|
1308
|
+
compareAtPrice: string;
|
|
1304
1309
|
trackInventory: boolean;
|
|
1305
1310
|
lowStockThreshold: number | null;
|
|
1306
1311
|
};
|
|
@@ -1574,6 +1579,7 @@ export declare function useAddCartItem(cartId: string, options?: UseMutationOpti
|
|
|
1574
1579
|
thumbnailUrl: string | null;
|
|
1575
1580
|
productId: string;
|
|
1576
1581
|
sku: string;
|
|
1582
|
+
compareAtPrice: string;
|
|
1577
1583
|
trackInventory: boolean;
|
|
1578
1584
|
lowStockThreshold: number | null;
|
|
1579
1585
|
};
|
|
@@ -1850,6 +1856,7 @@ export declare function useUpdateCartItem(cartId: string, options?: UseMutationO
|
|
|
1850
1856
|
thumbnailUrl: string | null;
|
|
1851
1857
|
productId: string;
|
|
1852
1858
|
sku: string;
|
|
1859
|
+
compareAtPrice: string;
|
|
1853
1860
|
trackInventory: boolean;
|
|
1854
1861
|
lowStockThreshold: number | null;
|
|
1855
1862
|
};
|
|
@@ -2113,6 +2120,7 @@ export declare function useRemoveCartItem(cartId: string, options?: UseMutationO
|
|
|
2113
2120
|
thumbnailUrl: string | null;
|
|
2114
2121
|
productId: string;
|
|
2115
2122
|
sku: string;
|
|
2123
|
+
compareAtPrice: string;
|
|
2116
2124
|
trackInventory: boolean;
|
|
2117
2125
|
lowStockThreshold: number | null;
|
|
2118
2126
|
};
|
|
@@ -2383,6 +2391,7 @@ export declare function useCheckoutCart(cartId: string, options?: UseMutationOpt
|
|
|
2383
2391
|
thumbnailUrl: string | null;
|
|
2384
2392
|
productId: string;
|
|
2385
2393
|
sku: string;
|
|
2394
|
+
compareAtPrice: string;
|
|
2386
2395
|
trackInventory: boolean;
|
|
2387
2396
|
lowStockThreshold: number | null;
|
|
2388
2397
|
};
|
|
@@ -2473,6 +2482,7 @@ export declare function useGetCartRecommendations(cartId: string | null | undefi
|
|
|
2473
2482
|
createdAt: string;
|
|
2474
2483
|
updatedAt: string;
|
|
2475
2484
|
price: number;
|
|
2485
|
+
compareAtPrice: number;
|
|
2476
2486
|
deletedAt: string;
|
|
2477
2487
|
id: string;
|
|
2478
2488
|
name: string | null;
|
|
@@ -242,6 +242,7 @@ export declare function useGetOrder(orderId: string, token: string, options?: Om
|
|
|
242
242
|
thumbnailUrl: string | null;
|
|
243
243
|
productId: string;
|
|
244
244
|
sku: string;
|
|
245
|
+
compareAtPrice: string;
|
|
245
246
|
trackInventory: boolean;
|
|
246
247
|
lowStockThreshold: number | null;
|
|
247
248
|
};
|
|
@@ -522,6 +523,7 @@ export declare function useConfirmOrder(options?: UseMutationOptions<Awaited<Ret
|
|
|
522
523
|
thumbnailUrl: string | null;
|
|
523
524
|
productId: string;
|
|
524
525
|
sku: string;
|
|
526
|
+
compareAtPrice: string;
|
|
525
527
|
trackInventory: boolean;
|
|
526
528
|
lowStockThreshold: number | null;
|
|
527
529
|
};
|
|
@@ -601,6 +603,7 @@ export declare function useGetOrderRecommendations(orderId: string | null | unde
|
|
|
601
603
|
createdAt: string;
|
|
602
604
|
updatedAt: string;
|
|
603
605
|
price: number;
|
|
606
|
+
compareAtPrice: number;
|
|
604
607
|
deletedAt: string;
|
|
605
608
|
id: string;
|
|
606
609
|
name: string | null;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* providing end-to-end type safety without code generation.
|
|
6
6
|
*/
|
|
7
7
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
8
|
-
import { fetchProductsByBrand, fetchProductBySlug } from '../../fetchers/products';
|
|
8
|
+
import { fetchProductsByBrand, fetchProductBySlug, fetchProductAddons } from '../../fetchers/products';
|
|
9
9
|
/**
|
|
10
10
|
* Hook to get products by brand using RPC
|
|
11
11
|
*
|
|
@@ -38,6 +38,7 @@ export declare function useGetProducts(brandId: string, options?: Omit<UseQueryO
|
|
|
38
38
|
createdAt: string;
|
|
39
39
|
updatedAt: string;
|
|
40
40
|
price: number;
|
|
41
|
+
compareAtPrice: number;
|
|
41
42
|
deletedAt: string;
|
|
42
43
|
id: string;
|
|
43
44
|
name: string | null;
|
|
@@ -236,6 +237,7 @@ export declare function useGetProduct(slug: string, options?: Omit<UseQueryOptio
|
|
|
236
237
|
createdAt: string;
|
|
237
238
|
updatedAt: string;
|
|
238
239
|
price: number;
|
|
240
|
+
compareAtPrice: number;
|
|
239
241
|
deletedAt: string;
|
|
240
242
|
id: string;
|
|
241
243
|
name: string | null;
|
|
@@ -402,3 +404,10 @@ export declare function useGetProduct(slug: string, options?: Omit<UseQueryOptio
|
|
|
402
404
|
};
|
|
403
405
|
};
|
|
404
406
|
}, Error>;
|
|
407
|
+
/**
|
|
408
|
+
* Hook to get product add-ons
|
|
409
|
+
*
|
|
410
|
+
* @param slug - Product slug
|
|
411
|
+
* @param limit - Max number of add-ons
|
|
412
|
+
*/
|
|
413
|
+
export declare function useGetProductAddOns(slug: string, limit?: number, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchProductAddons>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { useQueryUnwrapped } from '../use-query-unwrapped';
|
|
8
8
|
import { queryKeys } from '../../utils/query-keys';
|
|
9
|
-
import { fetchProductsByBrand, fetchProductBySlug } from '../../fetchers/products';
|
|
9
|
+
import { fetchProductsByBrand, fetchProductBySlug, fetchProductAddons } from '../../fetchers/products';
|
|
10
10
|
/**
|
|
11
11
|
* Hook to get products by brand using RPC
|
|
12
12
|
*
|
|
@@ -45,3 +45,16 @@ export function useGetProduct(slug, options) {
|
|
|
45
45
|
...options,
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Hook to get product add-ons
|
|
50
|
+
*
|
|
51
|
+
* @param slug - Product slug
|
|
52
|
+
* @param limit - Max number of add-ons
|
|
53
|
+
*/
|
|
54
|
+
export function useGetProductAddOns(slug, limit, options) {
|
|
55
|
+
return useQueryUnwrapped({
|
|
56
|
+
queryKey: queryKeys.public.products.addons(slug, limit),
|
|
57
|
+
queryFn: () => fetchProductAddons(slug, limit),
|
|
58
|
+
...options,
|
|
59
|
+
});
|
|
60
|
+
}
|
package/dist/rpc-client.d.ts
CHANGED
|
@@ -252,6 +252,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
252
252
|
thumbnailUrl: string | null;
|
|
253
253
|
productId: string;
|
|
254
254
|
sku: string;
|
|
255
|
+
compareAtPrice: string;
|
|
255
256
|
trackInventory: boolean;
|
|
256
257
|
lowStockThreshold: number | null;
|
|
257
258
|
};
|
|
@@ -536,6 +537,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
536
537
|
thumbnailUrl: string | null;
|
|
537
538
|
productId: string;
|
|
538
539
|
sku: string;
|
|
540
|
+
compareAtPrice: string;
|
|
539
541
|
trackInventory: boolean;
|
|
540
542
|
lowStockThreshold: number | null;
|
|
541
543
|
};
|
|
@@ -808,6 +810,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
808
810
|
thumbnailUrl: string | null;
|
|
809
811
|
productId: string;
|
|
810
812
|
sku: string;
|
|
813
|
+
compareAtPrice: string;
|
|
811
814
|
trackInventory: boolean;
|
|
812
815
|
lowStockThreshold: number | null;
|
|
813
816
|
};
|
|
@@ -1097,6 +1100,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
1097
1100
|
thumbnailUrl: string | null;
|
|
1098
1101
|
productId: string;
|
|
1099
1102
|
sku: string;
|
|
1103
|
+
compareAtPrice: string;
|
|
1100
1104
|
trackInventory: boolean;
|
|
1101
1105
|
lowStockThreshold: number | null;
|
|
1102
1106
|
};
|
|
@@ -1387,6 +1391,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
1387
1391
|
thumbnailUrl: string | null;
|
|
1388
1392
|
productId: string;
|
|
1389
1393
|
sku: string;
|
|
1394
|
+
compareAtPrice: string;
|
|
1390
1395
|
trackInventory: boolean;
|
|
1391
1396
|
lowStockThreshold: number | null;
|
|
1392
1397
|
};
|
|
@@ -1677,6 +1682,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
1677
1682
|
thumbnailUrl: string | null;
|
|
1678
1683
|
productId: string;
|
|
1679
1684
|
sku: string;
|
|
1685
|
+
compareAtPrice: string;
|
|
1680
1686
|
trackInventory: boolean;
|
|
1681
1687
|
lowStockThreshold: number | null;
|
|
1682
1688
|
};
|
|
@@ -1970,6 +1976,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
1970
1976
|
thumbnailUrl: string | null;
|
|
1971
1977
|
productId: string;
|
|
1972
1978
|
sku: string;
|
|
1979
|
+
compareAtPrice: string;
|
|
1973
1980
|
trackInventory: boolean;
|
|
1974
1981
|
lowStockThreshold: number | null;
|
|
1975
1982
|
};
|
|
@@ -2278,6 +2285,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
2278
2285
|
thumbnailUrl: string | null;
|
|
2279
2286
|
productId: string;
|
|
2280
2287
|
sku: string;
|
|
2288
|
+
compareAtPrice: string;
|
|
2281
2289
|
trackInventory: boolean;
|
|
2282
2290
|
lowStockThreshold: number | null;
|
|
2283
2291
|
};
|
|
@@ -2391,6 +2399,278 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
2391
2399
|
};
|
|
2392
2400
|
outputFormat: "json";
|
|
2393
2401
|
status: 410;
|
|
2402
|
+
} | {
|
|
2403
|
+
input: {
|
|
2404
|
+
param: {
|
|
2405
|
+
id: string;
|
|
2406
|
+
};
|
|
2407
|
+
};
|
|
2408
|
+
output: {
|
|
2409
|
+
subtotal: number;
|
|
2410
|
+
deliveryCharge: number;
|
|
2411
|
+
totalPrice: number;
|
|
2412
|
+
discountAmount: number;
|
|
2413
|
+
createdAt: string;
|
|
2414
|
+
updatedAt: string;
|
|
2415
|
+
deletedAt: string;
|
|
2416
|
+
prospectSince: string;
|
|
2417
|
+
lastRecoveryAttemptAt: string;
|
|
2418
|
+
brand: {
|
|
2419
|
+
createdAt: string;
|
|
2420
|
+
updatedAt: string;
|
|
2421
|
+
deletedAt: string;
|
|
2422
|
+
id: string;
|
|
2423
|
+
name: string;
|
|
2424
|
+
slug: string;
|
|
2425
|
+
logoUrl: string | null;
|
|
2426
|
+
siteUrl: string;
|
|
2427
|
+
domain: string;
|
|
2428
|
+
metaPixelId: string | null;
|
|
2429
|
+
tiktokPixelId: string | null;
|
|
2430
|
+
paystackPublicKey: string | null;
|
|
2431
|
+
paystackSecretKey: string | null;
|
|
2432
|
+
};
|
|
2433
|
+
deliveryZone: {
|
|
2434
|
+
deliveryCost: number;
|
|
2435
|
+
freeShippingThreshold: number;
|
|
2436
|
+
createdAt: string;
|
|
2437
|
+
updatedAt: string;
|
|
2438
|
+
deletedAt: string;
|
|
2439
|
+
state: {
|
|
2440
|
+
createdAt: string;
|
|
2441
|
+
updatedAt: string;
|
|
2442
|
+
deletedAt: string;
|
|
2443
|
+
id: string;
|
|
2444
|
+
name: string;
|
|
2445
|
+
isActive: boolean;
|
|
2446
|
+
};
|
|
2447
|
+
id: string;
|
|
2448
|
+
name: string;
|
|
2449
|
+
brandId: string | null;
|
|
2450
|
+
stateId: string;
|
|
2451
|
+
allowCOD: boolean;
|
|
2452
|
+
allowOnline: boolean;
|
|
2453
|
+
waybillOnly: boolean;
|
|
2454
|
+
estimatedDays: number | null;
|
|
2455
|
+
noteTitle: string | null;
|
|
2456
|
+
noteContent: string | null;
|
|
2457
|
+
isActive: boolean;
|
|
2458
|
+
};
|
|
2459
|
+
items: {
|
|
2460
|
+
priceAtPurchase: number;
|
|
2461
|
+
variant: {
|
|
2462
|
+
price: number;
|
|
2463
|
+
createdAt: string;
|
|
2464
|
+
updatedAt: string;
|
|
2465
|
+
deletedAt: string;
|
|
2466
|
+
product: {
|
|
2467
|
+
createdAt: string;
|
|
2468
|
+
updatedAt: string;
|
|
2469
|
+
deletedAt: string;
|
|
2470
|
+
id: string;
|
|
2471
|
+
name: string;
|
|
2472
|
+
slug: string;
|
|
2473
|
+
brandId: string;
|
|
2474
|
+
isActive: boolean;
|
|
2475
|
+
description: string | null;
|
|
2476
|
+
thumbnailUrl: string | null;
|
|
2477
|
+
quantityDiscounts: string | number | boolean | {
|
|
2478
|
+
[x: string]: string | number | boolean | /*elided*/ any | {
|
|
2479
|
+
[x: number]: string | number | boolean | /*elided*/ any | /*elided*/ any;
|
|
2480
|
+
length: number;
|
|
2481
|
+
toString: never;
|
|
2482
|
+
toLocaleString: never;
|
|
2483
|
+
pop: never;
|
|
2484
|
+
push: never;
|
|
2485
|
+
concat: never;
|
|
2486
|
+
join: never;
|
|
2487
|
+
reverse: never;
|
|
2488
|
+
shift: never;
|
|
2489
|
+
slice: never;
|
|
2490
|
+
sort: never;
|
|
2491
|
+
splice: never;
|
|
2492
|
+
unshift: never;
|
|
2493
|
+
indexOf: never;
|
|
2494
|
+
lastIndexOf: never;
|
|
2495
|
+
every: never;
|
|
2496
|
+
some: never;
|
|
2497
|
+
forEach: never;
|
|
2498
|
+
map: never;
|
|
2499
|
+
filter: never;
|
|
2500
|
+
reduce: never;
|
|
2501
|
+
reduceRight: never;
|
|
2502
|
+
find: never;
|
|
2503
|
+
findIndex: never;
|
|
2504
|
+
fill: never;
|
|
2505
|
+
copyWithin: never;
|
|
2506
|
+
entries: never;
|
|
2507
|
+
keys: never;
|
|
2508
|
+
values: never;
|
|
2509
|
+
includes: never;
|
|
2510
|
+
flatMap: never;
|
|
2511
|
+
flat: never;
|
|
2512
|
+
[Symbol.iterator]: never;
|
|
2513
|
+
readonly [Symbol.unscopables]: {
|
|
2514
|
+
[x: number]: boolean;
|
|
2515
|
+
length?: boolean;
|
|
2516
|
+
toString?: boolean;
|
|
2517
|
+
toLocaleString?: boolean;
|
|
2518
|
+
pop?: boolean;
|
|
2519
|
+
push?: boolean;
|
|
2520
|
+
concat?: boolean;
|
|
2521
|
+
join?: boolean;
|
|
2522
|
+
reverse?: boolean;
|
|
2523
|
+
shift?: boolean;
|
|
2524
|
+
slice?: boolean;
|
|
2525
|
+
sort?: boolean;
|
|
2526
|
+
splice?: boolean;
|
|
2527
|
+
unshift?: boolean;
|
|
2528
|
+
indexOf?: boolean;
|
|
2529
|
+
lastIndexOf?: boolean;
|
|
2530
|
+
every?: boolean;
|
|
2531
|
+
some?: boolean;
|
|
2532
|
+
forEach?: boolean;
|
|
2533
|
+
map?: boolean;
|
|
2534
|
+
filter?: boolean;
|
|
2535
|
+
reduce?: boolean;
|
|
2536
|
+
reduceRight?: boolean;
|
|
2537
|
+
find?: boolean;
|
|
2538
|
+
findIndex?: boolean;
|
|
2539
|
+
fill?: boolean;
|
|
2540
|
+
copyWithin?: boolean;
|
|
2541
|
+
entries?: boolean;
|
|
2542
|
+
keys?: boolean;
|
|
2543
|
+
values?: boolean;
|
|
2544
|
+
includes?: boolean;
|
|
2545
|
+
flatMap?: boolean;
|
|
2546
|
+
flat?: boolean;
|
|
2547
|
+
};
|
|
2548
|
+
};
|
|
2549
|
+
} | {
|
|
2550
|
+
[x: number]: string | number | boolean | {
|
|
2551
|
+
[x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
|
|
2552
|
+
} | /*elided*/ any;
|
|
2553
|
+
length: number;
|
|
2554
|
+
toString: never;
|
|
2555
|
+
toLocaleString: never;
|
|
2556
|
+
pop: never;
|
|
2557
|
+
push: never;
|
|
2558
|
+
concat: never;
|
|
2559
|
+
join: never;
|
|
2560
|
+
reverse: never;
|
|
2561
|
+
shift: never;
|
|
2562
|
+
slice: never;
|
|
2563
|
+
sort: never;
|
|
2564
|
+
splice: never;
|
|
2565
|
+
unshift: never;
|
|
2566
|
+
indexOf: never;
|
|
2567
|
+
lastIndexOf: never;
|
|
2568
|
+
every: never;
|
|
2569
|
+
some: never;
|
|
2570
|
+
forEach: never;
|
|
2571
|
+
map: never;
|
|
2572
|
+
filter: never;
|
|
2573
|
+
reduce: never;
|
|
2574
|
+
reduceRight: never;
|
|
2575
|
+
find: never;
|
|
2576
|
+
findIndex: never;
|
|
2577
|
+
fill: never;
|
|
2578
|
+
copyWithin: never;
|
|
2579
|
+
entries: never;
|
|
2580
|
+
keys: never;
|
|
2581
|
+
values: never;
|
|
2582
|
+
includes: never;
|
|
2583
|
+
flatMap: never;
|
|
2584
|
+
flat: never;
|
|
2585
|
+
[Symbol.iterator]: never;
|
|
2586
|
+
readonly [Symbol.unscopables]: {
|
|
2587
|
+
[x: number]: boolean;
|
|
2588
|
+
length?: boolean;
|
|
2589
|
+
toString?: boolean;
|
|
2590
|
+
toLocaleString?: boolean;
|
|
2591
|
+
pop?: boolean;
|
|
2592
|
+
push?: boolean;
|
|
2593
|
+
concat?: boolean;
|
|
2594
|
+
join?: boolean;
|
|
2595
|
+
reverse?: boolean;
|
|
2596
|
+
shift?: boolean;
|
|
2597
|
+
slice?: boolean;
|
|
2598
|
+
sort?: boolean;
|
|
2599
|
+
splice?: boolean;
|
|
2600
|
+
unshift?: boolean;
|
|
2601
|
+
indexOf?: boolean;
|
|
2602
|
+
lastIndexOf?: boolean;
|
|
2603
|
+
every?: boolean;
|
|
2604
|
+
some?: boolean;
|
|
2605
|
+
forEach?: boolean;
|
|
2606
|
+
map?: boolean;
|
|
2607
|
+
filter?: boolean;
|
|
2608
|
+
reduce?: boolean;
|
|
2609
|
+
reduceRight?: boolean;
|
|
2610
|
+
find?: boolean;
|
|
2611
|
+
findIndex?: boolean;
|
|
2612
|
+
fill?: boolean;
|
|
2613
|
+
copyWithin?: boolean;
|
|
2614
|
+
entries?: boolean;
|
|
2615
|
+
keys?: boolean;
|
|
2616
|
+
values?: boolean;
|
|
2617
|
+
includes?: boolean;
|
|
2618
|
+
flatMap?: boolean;
|
|
2619
|
+
flat?: boolean;
|
|
2620
|
+
};
|
|
2621
|
+
};
|
|
2622
|
+
};
|
|
2623
|
+
id: string;
|
|
2624
|
+
name: string | null;
|
|
2625
|
+
isActive: boolean;
|
|
2626
|
+
thumbnailUrl: string | null;
|
|
2627
|
+
productId: string;
|
|
2628
|
+
sku: string;
|
|
2629
|
+
compareAtPrice: string;
|
|
2630
|
+
trackInventory: boolean;
|
|
2631
|
+
lowStockThreshold: number | null;
|
|
2632
|
+
};
|
|
2633
|
+
warehouse: {
|
|
2634
|
+
createdAt: string;
|
|
2635
|
+
updatedAt: string;
|
|
2636
|
+
deletedAt: string;
|
|
2637
|
+
id: string;
|
|
2638
|
+
name: string;
|
|
2639
|
+
isActive: boolean;
|
|
2640
|
+
address: string | null;
|
|
2641
|
+
city: string | null;
|
|
2642
|
+
state: string | null;
|
|
2643
|
+
};
|
|
2644
|
+
id: string;
|
|
2645
|
+
orderId: string;
|
|
2646
|
+
variantId: string;
|
|
2647
|
+
warehouseId: string | null;
|
|
2648
|
+
quantity: number;
|
|
2649
|
+
}[];
|
|
2650
|
+
email: string | null;
|
|
2651
|
+
id: string;
|
|
2652
|
+
brandId: string;
|
|
2653
|
+
deliveryZoneId: string;
|
|
2654
|
+
recoveryAttempts: number;
|
|
2655
|
+
recoveryDiscountCodeId: string | null;
|
|
2656
|
+
wasRecovered: boolean;
|
|
2657
|
+
estimatedDays: number | null;
|
|
2658
|
+
orderNumber: number;
|
|
2659
|
+
firstName: string;
|
|
2660
|
+
lastName: string;
|
|
2661
|
+
phone: string;
|
|
2662
|
+
address: string;
|
|
2663
|
+
city: string;
|
|
2664
|
+
discountCodeId: string | null;
|
|
2665
|
+
paymentMethod: import("@prisma/client").$Enums.PaymentMethod;
|
|
2666
|
+
paystackReference: string | null;
|
|
2667
|
+
status: import("@prisma/client").$Enums.OrderStatus;
|
|
2668
|
+
cancellationReason: string | null;
|
|
2669
|
+
prospectReason: import("@prisma/client").$Enums.ProspectReason | null;
|
|
2670
|
+
userActionToken: string;
|
|
2671
|
+
};
|
|
2672
|
+
outputFormat: "json";
|
|
2673
|
+
status: 200;
|
|
2394
2674
|
} | {
|
|
2395
2675
|
input: {
|
|
2396
2676
|
param: {
|
|
@@ -2646,6 +2926,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
2646
2926
|
thumbnailUrl: string | null;
|
|
2647
2927
|
productId: string;
|
|
2648
2928
|
sku: string;
|
|
2929
|
+
compareAtPrice: string;
|
|
2649
2930
|
trackInventory: boolean;
|
|
2650
2931
|
lowStockThreshold: number | null;
|
|
2651
2932
|
};
|
|
@@ -2736,6 +3017,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
2736
3017
|
createdAt: string;
|
|
2737
3018
|
updatedAt: string;
|
|
2738
3019
|
price: number;
|
|
3020
|
+
compareAtPrice: number;
|
|
2739
3021
|
deletedAt: string;
|
|
2740
3022
|
id: string;
|
|
2741
3023
|
name: string | null;
|
|
@@ -3186,6 +3468,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
3186
3468
|
thumbnailUrl: string | null;
|
|
3187
3469
|
productId: string;
|
|
3188
3470
|
sku: string;
|
|
3471
|
+
compareAtPrice: string;
|
|
3189
3472
|
trackInventory: boolean;
|
|
3190
3473
|
lowStockThreshold: number | null;
|
|
3191
3474
|
};
|
|
@@ -3494,6 +3777,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
3494
3777
|
thumbnailUrl: string | null;
|
|
3495
3778
|
productId: string;
|
|
3496
3779
|
sku: string;
|
|
3780
|
+
compareAtPrice: string;
|
|
3497
3781
|
trackInventory: boolean;
|
|
3498
3782
|
lowStockThreshold: number | null;
|
|
3499
3783
|
};
|
|
@@ -3598,6 +3882,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
3598
3882
|
createdAt: string;
|
|
3599
3883
|
updatedAt: string;
|
|
3600
3884
|
price: number;
|
|
3885
|
+
compareAtPrice: number;
|
|
3601
3886
|
deletedAt: string;
|
|
3602
3887
|
id: string;
|
|
3603
3888
|
name: string | null;
|
|
@@ -3830,6 +4115,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
3830
4115
|
createdAt: string;
|
|
3831
4116
|
updatedAt: string;
|
|
3832
4117
|
price: number;
|
|
4118
|
+
compareAtPrice: number;
|
|
3833
4119
|
deletedAt: string;
|
|
3834
4120
|
id: string;
|
|
3835
4121
|
name: string | null;
|
|
@@ -4043,6 +4329,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
4043
4329
|
createdAt: string;
|
|
4044
4330
|
updatedAt: string;
|
|
4045
4331
|
price: number;
|
|
4332
|
+
compareAtPrice: number;
|
|
4046
4333
|
deletedAt: string;
|
|
4047
4334
|
id: string;
|
|
4048
4335
|
name: string | null;
|
|
@@ -4317,6 +4604,7 @@ export declare function createRpcClients(baseURL: string): {
|
|
|
4317
4604
|
};
|
|
4318
4605
|
}>;
|
|
4319
4606
|
};
|
|
4607
|
+
productAddons: unknown;
|
|
4320
4608
|
};
|
|
4321
4609
|
/**
|
|
4322
4610
|
* Create typed RPC clients for all admin endpoints
|
|
@@ -4559,6 +4847,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
4559
4847
|
thumbnailUrl: string | null;
|
|
4560
4848
|
productId: string;
|
|
4561
4849
|
sku: string;
|
|
4850
|
+
compareAtPrice: string;
|
|
4562
4851
|
trackInventory: boolean;
|
|
4563
4852
|
lowStockThreshold: number | null;
|
|
4564
4853
|
};
|
|
@@ -4849,6 +5138,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
4849
5138
|
thumbnailUrl: string | null;
|
|
4850
5139
|
productId: string;
|
|
4851
5140
|
sku: string;
|
|
5141
|
+
compareAtPrice: string;
|
|
4852
5142
|
trackInventory: boolean;
|
|
4853
5143
|
lowStockThreshold: number | null;
|
|
4854
5144
|
};
|
|
@@ -5141,6 +5431,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
5141
5431
|
thumbnailUrl: string | null;
|
|
5142
5432
|
productId: string;
|
|
5143
5433
|
sku: string;
|
|
5434
|
+
compareAtPrice: string;
|
|
5144
5435
|
trackInventory: boolean;
|
|
5145
5436
|
lowStockThreshold: number | null;
|
|
5146
5437
|
};
|
|
@@ -5442,6 +5733,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
5442
5733
|
thumbnailUrl: string | null;
|
|
5443
5734
|
productId: string;
|
|
5444
5735
|
sku: string;
|
|
5736
|
+
compareAtPrice: string;
|
|
5445
5737
|
trackInventory: boolean;
|
|
5446
5738
|
lowStockThreshold: number | null;
|
|
5447
5739
|
};
|
|
@@ -5728,6 +6020,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
5728
6020
|
productId: string;
|
|
5729
6021
|
sku: string;
|
|
5730
6022
|
price: string;
|
|
6023
|
+
compareAtPrice: string;
|
|
5731
6024
|
trackInventory: boolean;
|
|
5732
6025
|
lowStockThreshold: number | null;
|
|
5733
6026
|
};
|
|
@@ -6198,6 +6491,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
6198
6491
|
thumbnailUrl: string | null;
|
|
6199
6492
|
productId: string;
|
|
6200
6493
|
sku: string;
|
|
6494
|
+
compareAtPrice: string;
|
|
6201
6495
|
trackInventory: boolean;
|
|
6202
6496
|
lowStockThreshold: number | null;
|
|
6203
6497
|
};
|
|
@@ -6695,6 +6989,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
6695
6989
|
createdAt: string;
|
|
6696
6990
|
updatedAt: string;
|
|
6697
6991
|
price: number;
|
|
6992
|
+
compareAtPrice: number;
|
|
6698
6993
|
deletedAt: string;
|
|
6699
6994
|
id: string;
|
|
6700
6995
|
name: string | null;
|
|
@@ -6897,6 +7192,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
6897
7192
|
createdAt: string;
|
|
6898
7193
|
updatedAt: string;
|
|
6899
7194
|
price: number;
|
|
7195
|
+
compareAtPrice: number;
|
|
6900
7196
|
deletedAt: string;
|
|
6901
7197
|
id: string;
|
|
6902
7198
|
name: string | null;
|
|
@@ -7120,6 +7416,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
7120
7416
|
createdAt: string;
|
|
7121
7417
|
updatedAt: string;
|
|
7122
7418
|
price: number;
|
|
7419
|
+
compareAtPrice: number;
|
|
7123
7420
|
deletedAt: string;
|
|
7124
7421
|
id: string;
|
|
7125
7422
|
name: string | null;
|
|
@@ -7330,6 +7627,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
7330
7627
|
createdAt: string;
|
|
7331
7628
|
updatedAt: string;
|
|
7332
7629
|
price: number;
|
|
7630
|
+
compareAtPrice: number;
|
|
7333
7631
|
deletedAt: string;
|
|
7334
7632
|
id: string;
|
|
7335
7633
|
name: string | null;
|
|
@@ -7543,6 +7841,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
7543
7841
|
createdAt: string;
|
|
7544
7842
|
updatedAt: string;
|
|
7545
7843
|
price: number;
|
|
7844
|
+
compareAtPrice: number;
|
|
7546
7845
|
deletedAt: string;
|
|
7547
7846
|
id: string;
|
|
7548
7847
|
name: string | null;
|
|
@@ -7579,6 +7878,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
7579
7878
|
createdAt: string;
|
|
7580
7879
|
updatedAt: string;
|
|
7581
7880
|
price: number;
|
|
7881
|
+
compareAtPrice: number;
|
|
7582
7882
|
deletedAt: string;
|
|
7583
7883
|
id: string;
|
|
7584
7884
|
name: string | null;
|
|
@@ -7641,6 +7941,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
7641
7941
|
createdAt: string;
|
|
7642
7942
|
updatedAt: string;
|
|
7643
7943
|
price: number;
|
|
7944
|
+
compareAtPrice: number;
|
|
7644
7945
|
deletedAt: string;
|
|
7645
7946
|
id: string;
|
|
7646
7947
|
name: string | null;
|
|
@@ -7679,6 +7980,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
7679
7980
|
createdAt: string;
|
|
7680
7981
|
updatedAt: string;
|
|
7681
7982
|
price: number;
|
|
7983
|
+
compareAtPrice: number;
|
|
7682
7984
|
deletedAt: string;
|
|
7683
7985
|
id: string;
|
|
7684
7986
|
name: string | null;
|
|
@@ -7737,6 +8039,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
7737
8039
|
createdAt: string;
|
|
7738
8040
|
updatedAt: string;
|
|
7739
8041
|
price: number;
|
|
8042
|
+
compareAtPrice: number;
|
|
7740
8043
|
deletedAt: string;
|
|
7741
8044
|
id: string;
|
|
7742
8045
|
name: string | null;
|
|
@@ -8096,6 +8399,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
8096
8399
|
productId: string;
|
|
8097
8400
|
sku: string;
|
|
8098
8401
|
price: string;
|
|
8402
|
+
compareAtPrice: string;
|
|
8099
8403
|
trackInventory: boolean;
|
|
8100
8404
|
lowStockThreshold: number | null;
|
|
8101
8405
|
};
|
|
@@ -8668,6 +8972,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
8668
8972
|
thumbnailUrl: string | null;
|
|
8669
8973
|
productId: string;
|
|
8670
8974
|
sku: string;
|
|
8975
|
+
compareAtPrice: string;
|
|
8671
8976
|
trackInventory: boolean;
|
|
8672
8977
|
lowStockThreshold: number | null;
|
|
8673
8978
|
};
|
|
@@ -8972,6 +9277,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
8972
9277
|
thumbnailUrl: string | null;
|
|
8973
9278
|
productId: string;
|
|
8974
9279
|
sku: string;
|
|
9280
|
+
compareAtPrice: string;
|
|
8975
9281
|
trackInventory: boolean;
|
|
8976
9282
|
lowStockThreshold: number | null;
|
|
8977
9283
|
};
|
|
@@ -9255,6 +9561,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
9255
9561
|
thumbnailUrl: string | null;
|
|
9256
9562
|
productId: string;
|
|
9257
9563
|
sku: string;
|
|
9564
|
+
compareAtPrice: string;
|
|
9258
9565
|
trackInventory: boolean;
|
|
9259
9566
|
lowStockThreshold: number | null;
|
|
9260
9567
|
};
|
|
@@ -9541,6 +9848,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
9541
9848
|
thumbnailUrl: string | null;
|
|
9542
9849
|
productId: string;
|
|
9543
9850
|
sku: string;
|
|
9851
|
+
compareAtPrice: string;
|
|
9544
9852
|
trackInventory: boolean;
|
|
9545
9853
|
lowStockThreshold: number | null;
|
|
9546
9854
|
};
|
|
@@ -10580,6 +10888,7 @@ export declare function createAdminRpcClients(baseURL: string): {
|
|
|
10580
10888
|
}>;
|
|
10581
10889
|
};
|
|
10582
10890
|
};
|
|
10891
|
+
productAddons: unknown;
|
|
10583
10892
|
};
|
|
10584
10893
|
/**
|
|
10585
10894
|
* Helper to create auth headers for admin RPC requests
|
package/dist/rpc-client.js
CHANGED
|
@@ -26,6 +26,7 @@ export function createRpcClients(baseURL) {
|
|
|
26
26
|
products: hc(`${fullBaseUrl}/products`),
|
|
27
27
|
deliveryZones: hc(`${fullBaseUrl}/delivery-zones`),
|
|
28
28
|
brands: hc(`${fullBaseUrl}/brands`),
|
|
29
|
+
productAddons: hc(`${fullBaseUrl}/product-addons`),
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
@@ -57,6 +58,7 @@ export function createAdminRpcClients(baseURL) {
|
|
|
57
58
|
abandonedCarts: hc(`${fullBaseUrl}/abandoned-carts`),
|
|
58
59
|
discountCodes: hc(`${fullBaseUrl}/discount-codes`),
|
|
59
60
|
deliveryZones: hc(`${fullBaseUrl}/delivery-zones`),
|
|
61
|
+
productAddons: hc(`${fullBaseUrl}/product-addons`),
|
|
60
62
|
};
|
|
61
63
|
}
|
|
62
64
|
/**
|
|
@@ -23,6 +23,7 @@ export declare const queryKeys: {
|
|
|
23
23
|
all: readonly ["public", "products"];
|
|
24
24
|
list: (brandId: string) => readonly ["public", "products", string];
|
|
25
25
|
detail: (productId: string) => readonly ["public", "products", string];
|
|
26
|
+
addons: (slug: string, limit?: number) => readonly ["public", "products", string, "addons", number];
|
|
26
27
|
};
|
|
27
28
|
deliveryZones: {
|
|
28
29
|
all: readonly ["public", "delivery-zones"];
|
|
@@ -49,6 +50,7 @@ export declare const queryKeys: {
|
|
|
49
50
|
all: readonly ["admin", "products"];
|
|
50
51
|
list: (brandId?: string) => readonly ["admin", "products", "list", string];
|
|
51
52
|
detail: (id: string) => readonly ["admin", "products", string];
|
|
53
|
+
addons: (id: string) => readonly ["admin", "products", string, "addons"];
|
|
52
54
|
};
|
|
53
55
|
variants: {
|
|
54
56
|
all: readonly ["admin", "variants"];
|
package/dist/utils/query-keys.js
CHANGED
|
@@ -28,6 +28,7 @@ export const queryKeys = {
|
|
|
28
28
|
all: ['public', 'products'],
|
|
29
29
|
list: (brandId) => ['public', 'products', brandId],
|
|
30
30
|
detail: (productId) => ['public', 'products', productId],
|
|
31
|
+
addons: (slug, limit) => ['public', 'products', slug, 'addons', limit],
|
|
31
32
|
},
|
|
32
33
|
deliveryZones: {
|
|
33
34
|
all: ['public', 'delivery-zones'],
|
|
@@ -55,6 +56,7 @@ export const queryKeys = {
|
|
|
55
56
|
all: ['admin', 'products'],
|
|
56
57
|
list: (brandId) => ['admin', 'products', 'list', brandId],
|
|
57
58
|
detail: (id) => ['admin', 'products', id],
|
|
59
|
+
addons: (id) => ['admin', 'products', id, 'addons'],
|
|
58
60
|
},
|
|
59
61
|
variants: {
|
|
60
62
|
all: ['admin', 'variants'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instockng/api-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "React Query hooks for OMS API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -22,13 +22,6 @@
|
|
|
22
22
|
"dist",
|
|
23
23
|
"README.md"
|
|
24
24
|
],
|
|
25
|
-
"scripts": {
|
|
26
|
-
"type-check": "tsc --noEmit",
|
|
27
|
-
"build": "tsc --project tsconfig.build.json --noEmitOnError false && node scripts/fix-dist.mjs",
|
|
28
|
-
"generate-types": "node scripts/generate-backend-types.mjs",
|
|
29
|
-
"prebuild": "pnpm run generate-types",
|
|
30
|
-
"prepublishOnly": "pnpm run generate-types"
|
|
31
|
-
},
|
|
32
25
|
"keywords": [
|
|
33
26
|
"api",
|
|
34
27
|
"react-query",
|
|
@@ -52,5 +45,11 @@
|
|
|
52
45
|
"axios": "^1.6.5",
|
|
53
46
|
"react": "^19.0.0",
|
|
54
47
|
"typescript": "^5.3.3"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"type-check": "tsc --noEmit",
|
|
51
|
+
"build": "tsc --project tsconfig.build.json --noEmitOnError false && node scripts/fix-dist.mjs",
|
|
52
|
+
"generate-types": "node scripts/generate-backend-types.mjs",
|
|
53
|
+
"prebuild": "pnpm run generate-types"
|
|
55
54
|
}
|
|
56
|
-
}
|
|
55
|
+
}
|