@instockng/api-client 1.0.36 → 1.0.39
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/brands.js +1 -1
- package/dist/fetchers/carts.d.ts +586 -1
- package/dist/fetchers/carts.js +19 -3
- package/dist/fetchers/delivery-zones.js +1 -1
- package/dist/fetchers/orders.d.ts +82 -0
- package/dist/fetchers/orders.js +38 -1
- package/dist/fetchers/products.js +1 -1
- package/dist/hooks/admin/abandoned-carts.d.ts +8 -0
- package/dist/hooks/admin/brands.d.ts +4 -0
- package/dist/hooks/admin/customers.d.ts +27 -0
- package/dist/hooks/admin/delivery-zones.d.ts +4 -0
- package/dist/hooks/admin/discount-codes.d.ts +5 -0
- package/dist/hooks/admin/dispatch-riders.d.ts +59 -0
- package/dist/hooks/admin/dispatch-riders.js +92 -0
- package/dist/hooks/admin/index.d.ts +1 -0
- package/dist/hooks/admin/index.js +1 -0
- package/dist/hooks/admin/orders.d.ts +191 -0
- package/dist/hooks/admin/orders.js +93 -0
- package/dist/hooks/admin/products.d.ts +6 -0
- package/dist/hooks/admin/stats.d.ts +34 -0
- package/dist/hooks/admin/stats.js +20 -0
- package/dist/hooks/admin/variants.d.ts +10 -0
- package/dist/hooks/admin/warehouses.d.ts +2 -0
- package/dist/hooks/public/carts.d.ts +585 -1
- package/dist/hooks/public/carts.js +20 -2
- package/dist/hooks/public/orders.d.ts +86 -1
- package/dist/hooks/public/orders.js +23 -1
- package/dist/provider.js +1 -1
- package/dist/rpc-client.d.ts +5456 -1769
- package/dist/rpc-client.js +1 -0
- package/dist/rpc-types.d.ts +9 -0
- package/dist/utils/query-keys.d.ts +7 -0
- package/dist/utils/query-keys.js +7 -0
- package/package.json +7 -8
|
@@ -5,6 +5,26 @@ import { useQueryUnwrapped } from '../use-query-unwrapped';
|
|
|
5
5
|
import { createAdminRpcClients, authHeaders } from '../../rpc-client';
|
|
6
6
|
import { queryKeys } from '../../utils/query-keys';
|
|
7
7
|
import { useApiConfig } from '../useApiConfig';
|
|
8
|
+
/**
|
|
9
|
+
* Hook to get product order stats grouped by brand
|
|
10
|
+
*/
|
|
11
|
+
export function useGetProductOrderStats(params, options) {
|
|
12
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
13
|
+
return useQueryUnwrapped({
|
|
14
|
+
queryKey: queryKeys.admin.stats.productOrders(params?.statuses, params?.period),
|
|
15
|
+
queryFn: async () => {
|
|
16
|
+
const token = await getAuthToken();
|
|
17
|
+
const clients = createAdminRpcClients(baseURL);
|
|
18
|
+
const res = await clients.stats['product-orders'].$get({ query: params }, authHeaders(token));
|
|
19
|
+
if (!res.ok)
|
|
20
|
+
throw new Error(`Failed to fetch product order stats: ${res.statusText}`);
|
|
21
|
+
return res.json();
|
|
22
|
+
},
|
|
23
|
+
staleTime: 0,
|
|
24
|
+
gcTime: 0,
|
|
25
|
+
...options,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
8
28
|
/**
|
|
9
29
|
* Hook to get dashboard statistics using admin RPC
|
|
10
30
|
*/
|
|
@@ -13,9 +13,11 @@ export declare function useSearchVariants(params?: {
|
|
|
13
13
|
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
15
|
price: number;
|
|
16
|
+
costPrice: number;
|
|
16
17
|
compareAtPrice: number;
|
|
17
18
|
deletedAt: string;
|
|
18
19
|
thumbnailUrl: string;
|
|
20
|
+
rawThumbnailUrl: string;
|
|
19
21
|
originalPrice: number;
|
|
20
22
|
id: string;
|
|
21
23
|
name: string | null;
|
|
@@ -32,9 +34,11 @@ export declare function useListProductVariants(productId: string, options?: Omit
|
|
|
32
34
|
createdAt: string;
|
|
33
35
|
updatedAt: string;
|
|
34
36
|
price: number;
|
|
37
|
+
costPrice: number;
|
|
35
38
|
compareAtPrice: number;
|
|
36
39
|
deletedAt: string;
|
|
37
40
|
thumbnailUrl: string;
|
|
41
|
+
rawThumbnailUrl: string;
|
|
38
42
|
originalPrice: number;
|
|
39
43
|
id: string;
|
|
40
44
|
name: string | null;
|
|
@@ -51,9 +55,11 @@ export declare function useCreateVariant(productId: string, options?: UseMutatio
|
|
|
51
55
|
createdAt: string;
|
|
52
56
|
updatedAt: string;
|
|
53
57
|
price: number;
|
|
58
|
+
costPrice: number;
|
|
54
59
|
compareAtPrice: number;
|
|
55
60
|
deletedAt: string;
|
|
56
61
|
thumbnailUrl: string;
|
|
62
|
+
rawThumbnailUrl: string;
|
|
57
63
|
originalPrice: number;
|
|
58
64
|
id: string;
|
|
59
65
|
name: string | null;
|
|
@@ -77,9 +83,11 @@ export declare function useUpdateVariant(productId: string, options?: UseMutatio
|
|
|
77
83
|
createdAt: string;
|
|
78
84
|
updatedAt: string;
|
|
79
85
|
price: number;
|
|
86
|
+
costPrice: number;
|
|
80
87
|
compareAtPrice: number;
|
|
81
88
|
deletedAt: string;
|
|
82
89
|
thumbnailUrl: string;
|
|
90
|
+
rawThumbnailUrl: string;
|
|
83
91
|
originalPrice: number;
|
|
84
92
|
id: string;
|
|
85
93
|
name: string | null;
|
|
@@ -102,9 +110,11 @@ export declare function useGetVariantInventory(variantId: string, options?: Omit
|
|
|
102
110
|
createdAt: string;
|
|
103
111
|
updatedAt: string;
|
|
104
112
|
price: number;
|
|
113
|
+
costPrice: number;
|
|
105
114
|
compareAtPrice: number;
|
|
106
115
|
deletedAt: string;
|
|
107
116
|
thumbnailUrl: string;
|
|
117
|
+
rawThumbnailUrl: string;
|
|
108
118
|
originalPrice: number;
|
|
109
119
|
id: string;
|
|
110
120
|
name: string | null;
|
|
@@ -75,6 +75,7 @@ export declare function useGetWarehouseInventory(warehouseId: string, options?:
|
|
|
75
75
|
paystackPublicKey: string | null;
|
|
76
76
|
paystackSecretKey: string | null;
|
|
77
77
|
freeShippingThreshold: string;
|
|
78
|
+
upsellDiscountPercent: number;
|
|
78
79
|
createdAt: string;
|
|
79
80
|
updatedAt: string;
|
|
80
81
|
deletedAt: string;
|
|
@@ -536,6 +537,7 @@ export declare function useGetWarehouseInventory(warehouseId: string, options?:
|
|
|
536
537
|
thumbnailUrl: string | null;
|
|
537
538
|
sku: string;
|
|
538
539
|
price: string;
|
|
540
|
+
costPrice: string;
|
|
539
541
|
compareAtPrice: string;
|
|
540
542
|
trackInventory: boolean;
|
|
541
543
|
lowStockThreshold: number | null;
|