@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
|
@@ -29,14 +29,26 @@ export declare function useListOrders(filters?: {
|
|
|
29
29
|
}, options?: Omit<UseQueryOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['orders']['index']['$get']>>['json']>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
|
|
30
30
|
data: {
|
|
31
31
|
subtotal: number;
|
|
32
|
+
totalCost: number;
|
|
33
|
+
totalProfit: number;
|
|
34
|
+
profitMargin: number;
|
|
32
35
|
deliveryCharge: number;
|
|
33
36
|
totalPrice: number;
|
|
34
37
|
discountAmount: number;
|
|
38
|
+
amountPaid: number;
|
|
39
|
+
flutterwaveAccountBank: string;
|
|
40
|
+
flutterwaveAccountNumber: string;
|
|
41
|
+
flutterwaveAccountExpiry: string;
|
|
35
42
|
createdAt: string;
|
|
36
43
|
updatedAt: string;
|
|
37
44
|
deletedAt: string;
|
|
38
45
|
prospectSince: string;
|
|
39
46
|
lastRecoveryAttemptAt: string;
|
|
47
|
+
shippedAt: string;
|
|
48
|
+
deliveryConfirmationSentAt: string;
|
|
49
|
+
deliveryConfirmedAt: string;
|
|
50
|
+
deliveryConfirmationAttempts: number;
|
|
51
|
+
needsManualCall: boolean;
|
|
40
52
|
brand: {
|
|
41
53
|
id: string;
|
|
42
54
|
name: string;
|
|
@@ -48,6 +60,7 @@ export declare function useListOrders(filters?: {
|
|
|
48
60
|
tiktokPixelId: string;
|
|
49
61
|
paystackPublicKey: string;
|
|
50
62
|
freeShippingThreshold: number;
|
|
63
|
+
upsellDiscountPercent: number;
|
|
51
64
|
createdAt: string;
|
|
52
65
|
updatedAt: string;
|
|
53
66
|
deletedAt: string;
|
|
@@ -80,6 +93,8 @@ export declare function useListOrders(filters?: {
|
|
|
80
93
|
};
|
|
81
94
|
items: {
|
|
82
95
|
priceAtPurchase: number;
|
|
96
|
+
costAtPurchase: number;
|
|
97
|
+
itemProfit: number;
|
|
83
98
|
variant: {
|
|
84
99
|
price: number;
|
|
85
100
|
createdAt: string;
|
|
@@ -539,6 +554,7 @@ export declare function useListOrders(filters?: {
|
|
|
539
554
|
productId: string;
|
|
540
555
|
thumbnailUrl: string | null;
|
|
541
556
|
sku: string;
|
|
557
|
+
costPrice: string;
|
|
542
558
|
compareAtPrice: string;
|
|
543
559
|
trackInventory: boolean;
|
|
544
560
|
lowStockThreshold: number | null;
|
|
@@ -579,8 +595,19 @@ export declare function useListOrders(filters?: {
|
|
|
579
595
|
paystackReference: string | null;
|
|
580
596
|
status: import("@prisma/client").$Enums.OrderStatus;
|
|
581
597
|
cancellationReason: string | null;
|
|
598
|
+
shippingMethod: string | null;
|
|
599
|
+
dispatchRiderId: string | null;
|
|
600
|
+
fezTrackingNumber: string | null;
|
|
601
|
+
flutterwaveOrderRef: string | null;
|
|
602
|
+
flutterwaveCustomerId: string | null;
|
|
582
603
|
prospectReason: import("@prisma/client").$Enums.ProspectReason | null;
|
|
583
604
|
userActionToken: string;
|
|
605
|
+
labelPrintedAt: string;
|
|
606
|
+
dispatchRider?: {
|
|
607
|
+
id: string;
|
|
608
|
+
name: string;
|
|
609
|
+
phone: string;
|
|
610
|
+
};
|
|
584
611
|
}[];
|
|
585
612
|
pagination: {
|
|
586
613
|
page: number;
|
|
@@ -602,14 +629,26 @@ export declare function useListOrders(filters?: {
|
|
|
602
629
|
*/
|
|
603
630
|
export declare function useGetOrder(orderId: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['orders'][':id']['$get']>>['json']>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
|
|
604
631
|
subtotal: number;
|
|
632
|
+
totalCost: number;
|
|
633
|
+
totalProfit: number;
|
|
634
|
+
profitMargin: number;
|
|
605
635
|
deliveryCharge: number;
|
|
606
636
|
totalPrice: number;
|
|
607
637
|
discountAmount: number;
|
|
638
|
+
amountPaid: number;
|
|
639
|
+
flutterwaveAccountBank: string;
|
|
640
|
+
flutterwaveAccountNumber: string;
|
|
641
|
+
flutterwaveAccountExpiry: string;
|
|
608
642
|
createdAt: string;
|
|
609
643
|
updatedAt: string;
|
|
610
644
|
deletedAt: string;
|
|
611
645
|
prospectSince: string;
|
|
612
646
|
lastRecoveryAttemptAt: string;
|
|
647
|
+
shippedAt: string;
|
|
648
|
+
deliveryConfirmationSentAt: string;
|
|
649
|
+
deliveryConfirmedAt: string;
|
|
650
|
+
deliveryConfirmationAttempts: number;
|
|
651
|
+
needsManualCall: boolean;
|
|
613
652
|
brand: {
|
|
614
653
|
id: string;
|
|
615
654
|
name: string;
|
|
@@ -621,6 +660,7 @@ export declare function useGetOrder(orderId: string, options?: Omit<UseQueryOpti
|
|
|
621
660
|
tiktokPixelId: string;
|
|
622
661
|
paystackPublicKey: string;
|
|
623
662
|
freeShippingThreshold: number;
|
|
663
|
+
upsellDiscountPercent: number;
|
|
624
664
|
createdAt: string;
|
|
625
665
|
updatedAt: string;
|
|
626
666
|
deletedAt: string;
|
|
@@ -653,6 +693,8 @@ export declare function useGetOrder(orderId: string, options?: Omit<UseQueryOpti
|
|
|
653
693
|
};
|
|
654
694
|
items: {
|
|
655
695
|
priceAtPurchase: number;
|
|
696
|
+
costAtPurchase: number;
|
|
697
|
+
itemProfit: number;
|
|
656
698
|
variant: {
|
|
657
699
|
price: number;
|
|
658
700
|
createdAt: string;
|
|
@@ -1112,6 +1154,7 @@ export declare function useGetOrder(orderId: string, options?: Omit<UseQueryOpti
|
|
|
1112
1154
|
productId: string;
|
|
1113
1155
|
thumbnailUrl: string | null;
|
|
1114
1156
|
sku: string;
|
|
1157
|
+
costPrice: string;
|
|
1115
1158
|
compareAtPrice: string;
|
|
1116
1159
|
trackInventory: boolean;
|
|
1117
1160
|
lowStockThreshold: number | null;
|
|
@@ -1152,8 +1195,19 @@ export declare function useGetOrder(orderId: string, options?: Omit<UseQueryOpti
|
|
|
1152
1195
|
paystackReference: string | null;
|
|
1153
1196
|
status: import("@prisma/client").$Enums.OrderStatus;
|
|
1154
1197
|
cancellationReason: string | null;
|
|
1198
|
+
shippingMethod: string | null;
|
|
1199
|
+
dispatchRiderId: string | null;
|
|
1200
|
+
fezTrackingNumber: string | null;
|
|
1201
|
+
flutterwaveOrderRef: string | null;
|
|
1202
|
+
flutterwaveCustomerId: string | null;
|
|
1155
1203
|
prospectReason: import("@prisma/client").$Enums.ProspectReason | null;
|
|
1156
1204
|
userActionToken: string;
|
|
1205
|
+
labelPrintedAt: string;
|
|
1206
|
+
dispatchRider?: {
|
|
1207
|
+
id: string;
|
|
1208
|
+
name: string;
|
|
1209
|
+
phone: string;
|
|
1210
|
+
};
|
|
1157
1211
|
}, Error>;
|
|
1158
1212
|
/**
|
|
1159
1213
|
* Hook to create a new order using admin RPC
|
|
@@ -1172,14 +1226,26 @@ export declare function useGetOrder(orderId: string, options?: Omit<UseQueryOpti
|
|
|
1172
1226
|
*/
|
|
1173
1227
|
export declare function useCreateOrder(options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['orders']['index']['$post']>>['json']>>, Error, any>): import("@tanstack/react-query").UseMutationResult<{
|
|
1174
1228
|
subtotal: number;
|
|
1229
|
+
totalCost: number;
|
|
1230
|
+
totalProfit: number;
|
|
1231
|
+
profitMargin: number;
|
|
1175
1232
|
deliveryCharge: number;
|
|
1176
1233
|
totalPrice: number;
|
|
1177
1234
|
discountAmount: number;
|
|
1235
|
+
amountPaid: number;
|
|
1236
|
+
flutterwaveAccountBank: string;
|
|
1237
|
+
flutterwaveAccountNumber: string;
|
|
1238
|
+
flutterwaveAccountExpiry: string;
|
|
1178
1239
|
createdAt: string;
|
|
1179
1240
|
updatedAt: string;
|
|
1180
1241
|
deletedAt: string;
|
|
1181
1242
|
prospectSince: string;
|
|
1182
1243
|
lastRecoveryAttemptAt: string;
|
|
1244
|
+
shippedAt: string;
|
|
1245
|
+
deliveryConfirmationSentAt: string;
|
|
1246
|
+
deliveryConfirmedAt: string;
|
|
1247
|
+
deliveryConfirmationAttempts: number;
|
|
1248
|
+
needsManualCall: boolean;
|
|
1183
1249
|
brand: {
|
|
1184
1250
|
id: string;
|
|
1185
1251
|
name: string;
|
|
@@ -1191,6 +1257,7 @@ export declare function useCreateOrder(options?: UseMutationOptions<Awaited<Retu
|
|
|
1191
1257
|
tiktokPixelId: string;
|
|
1192
1258
|
paystackPublicKey: string;
|
|
1193
1259
|
freeShippingThreshold: number;
|
|
1260
|
+
upsellDiscountPercent: number;
|
|
1194
1261
|
createdAt: string;
|
|
1195
1262
|
updatedAt: string;
|
|
1196
1263
|
deletedAt: string;
|
|
@@ -1223,6 +1290,8 @@ export declare function useCreateOrder(options?: UseMutationOptions<Awaited<Retu
|
|
|
1223
1290
|
};
|
|
1224
1291
|
items: {
|
|
1225
1292
|
priceAtPurchase: number;
|
|
1293
|
+
costAtPurchase: number;
|
|
1294
|
+
itemProfit: number;
|
|
1226
1295
|
variant: {
|
|
1227
1296
|
price: number;
|
|
1228
1297
|
createdAt: string;
|
|
@@ -1682,6 +1751,7 @@ export declare function useCreateOrder(options?: UseMutationOptions<Awaited<Retu
|
|
|
1682
1751
|
productId: string;
|
|
1683
1752
|
thumbnailUrl: string | null;
|
|
1684
1753
|
sku: string;
|
|
1754
|
+
costPrice: string;
|
|
1685
1755
|
compareAtPrice: string;
|
|
1686
1756
|
trackInventory: boolean;
|
|
1687
1757
|
lowStockThreshold: number | null;
|
|
@@ -1722,8 +1792,19 @@ export declare function useCreateOrder(options?: UseMutationOptions<Awaited<Retu
|
|
|
1722
1792
|
paystackReference: string | null;
|
|
1723
1793
|
status: import("@prisma/client").$Enums.OrderStatus;
|
|
1724
1794
|
cancellationReason: string | null;
|
|
1795
|
+
shippingMethod: string | null;
|
|
1796
|
+
dispatchRiderId: string | null;
|
|
1797
|
+
fezTrackingNumber: string | null;
|
|
1798
|
+
flutterwaveOrderRef: string | null;
|
|
1799
|
+
flutterwaveCustomerId: string | null;
|
|
1725
1800
|
prospectReason: import("@prisma/client").$Enums.ProspectReason | null;
|
|
1726
1801
|
userActionToken: string;
|
|
1802
|
+
labelPrintedAt: string;
|
|
1803
|
+
dispatchRider?: {
|
|
1804
|
+
id: string;
|
|
1805
|
+
name: string;
|
|
1806
|
+
phone: string;
|
|
1807
|
+
};
|
|
1727
1808
|
} | {
|
|
1728
1809
|
error: {
|
|
1729
1810
|
code: string;
|
|
@@ -1743,14 +1824,26 @@ export declare function useCreateOrder(options?: UseMutationOptions<Awaited<Retu
|
|
|
1743
1824
|
*/
|
|
1744
1825
|
export declare function useUpdateOrder(orderId: string, options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['orders'][':id']['$patch']>>['json']>>, Error, any>): import("@tanstack/react-query").UseMutationResult<{
|
|
1745
1826
|
subtotal: number;
|
|
1827
|
+
totalCost: number;
|
|
1828
|
+
totalProfit: number;
|
|
1829
|
+
profitMargin: number;
|
|
1746
1830
|
deliveryCharge: number;
|
|
1747
1831
|
totalPrice: number;
|
|
1748
1832
|
discountAmount: number;
|
|
1833
|
+
amountPaid: number;
|
|
1834
|
+
flutterwaveAccountBank: string;
|
|
1835
|
+
flutterwaveAccountNumber: string;
|
|
1836
|
+
flutterwaveAccountExpiry: string;
|
|
1749
1837
|
createdAt: string;
|
|
1750
1838
|
updatedAt: string;
|
|
1751
1839
|
deletedAt: string;
|
|
1752
1840
|
prospectSince: string;
|
|
1753
1841
|
lastRecoveryAttemptAt: string;
|
|
1842
|
+
shippedAt: string;
|
|
1843
|
+
deliveryConfirmationSentAt: string;
|
|
1844
|
+
deliveryConfirmedAt: string;
|
|
1845
|
+
deliveryConfirmationAttempts: number;
|
|
1846
|
+
needsManualCall: boolean;
|
|
1754
1847
|
brand: {
|
|
1755
1848
|
id: string;
|
|
1756
1849
|
name: string;
|
|
@@ -1762,6 +1855,7 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
1762
1855
|
tiktokPixelId: string;
|
|
1763
1856
|
paystackPublicKey: string;
|
|
1764
1857
|
freeShippingThreshold: number;
|
|
1858
|
+
upsellDiscountPercent: number;
|
|
1765
1859
|
createdAt: string;
|
|
1766
1860
|
updatedAt: string;
|
|
1767
1861
|
deletedAt: string;
|
|
@@ -1794,6 +1888,8 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
1794
1888
|
};
|
|
1795
1889
|
items: {
|
|
1796
1890
|
priceAtPurchase: number;
|
|
1891
|
+
costAtPurchase: number;
|
|
1892
|
+
itemProfit: number;
|
|
1797
1893
|
variant: {
|
|
1798
1894
|
price: number;
|
|
1799
1895
|
createdAt: string;
|
|
@@ -2253,6 +2349,7 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
2253
2349
|
productId: string;
|
|
2254
2350
|
thumbnailUrl: string | null;
|
|
2255
2351
|
sku: string;
|
|
2352
|
+
costPrice: string;
|
|
2256
2353
|
compareAtPrice: string;
|
|
2257
2354
|
trackInventory: boolean;
|
|
2258
2355
|
lowStockThreshold: number | null;
|
|
@@ -2293,8 +2390,19 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
2293
2390
|
paystackReference: string | null;
|
|
2294
2391
|
status: import("@prisma/client").$Enums.OrderStatus;
|
|
2295
2392
|
cancellationReason: string | null;
|
|
2393
|
+
shippingMethod: string | null;
|
|
2394
|
+
dispatchRiderId: string | null;
|
|
2395
|
+
fezTrackingNumber: string | null;
|
|
2396
|
+
flutterwaveOrderRef: string | null;
|
|
2397
|
+
flutterwaveCustomerId: string | null;
|
|
2296
2398
|
prospectReason: import("@prisma/client").$Enums.ProspectReason | null;
|
|
2297
2399
|
userActionToken: string;
|
|
2400
|
+
labelPrintedAt: string;
|
|
2401
|
+
dispatchRider?: {
|
|
2402
|
+
id: string;
|
|
2403
|
+
name: string;
|
|
2404
|
+
phone: string;
|
|
2405
|
+
};
|
|
2298
2406
|
} | {
|
|
2299
2407
|
error: {
|
|
2300
2408
|
code: string;
|
|
@@ -2313,6 +2421,7 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
2313
2421
|
paystackPublicKey: string | null;
|
|
2314
2422
|
paystackSecretKey: string | null;
|
|
2315
2423
|
freeShippingThreshold: string;
|
|
2424
|
+
upsellDiscountPercent: number;
|
|
2316
2425
|
createdAt: string;
|
|
2317
2426
|
updatedAt: string;
|
|
2318
2427
|
deletedAt: string;
|
|
@@ -2343,6 +2452,14 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
2343
2452
|
noteTitle: string | null;
|
|
2344
2453
|
noteContent: string | null;
|
|
2345
2454
|
};
|
|
2455
|
+
dispatchRider: {
|
|
2456
|
+
id: string;
|
|
2457
|
+
name: string;
|
|
2458
|
+
createdAt: string;
|
|
2459
|
+
updatedAt: string;
|
|
2460
|
+
deletedAt: string;
|
|
2461
|
+
phone: string;
|
|
2462
|
+
};
|
|
2346
2463
|
items: {
|
|
2347
2464
|
warehouse: {
|
|
2348
2465
|
id: string;
|
|
@@ -2814,6 +2931,7 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
2814
2931
|
thumbnailUrl: string | null;
|
|
2815
2932
|
sku: string;
|
|
2816
2933
|
price: string;
|
|
2934
|
+
costPrice: string;
|
|
2817
2935
|
compareAtPrice: string;
|
|
2818
2936
|
trackInventory: boolean;
|
|
2819
2937
|
lowStockThreshold: number | null;
|
|
@@ -2824,6 +2942,7 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
2824
2942
|
orderId: string;
|
|
2825
2943
|
warehouseId: string | null;
|
|
2826
2944
|
priceAtPurchase: string;
|
|
2945
|
+
costAtPurchase: string;
|
|
2827
2946
|
}[];
|
|
2828
2947
|
notes: {
|
|
2829
2948
|
User: {
|
|
@@ -3013,9 +3132,23 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
3013
3132
|
paystackReference: string | null;
|
|
3014
3133
|
status: import("@prisma/client").$Enums.OrderStatus;
|
|
3015
3134
|
cancellationReason: string | null;
|
|
3135
|
+
shippingMethod: string | null;
|
|
3136
|
+
dispatchRiderId: string | null;
|
|
3137
|
+
fezTrackingNumber: string | null;
|
|
3138
|
+
amountPaid: string;
|
|
3139
|
+
flutterwaveAccountBank: string | null;
|
|
3140
|
+
flutterwaveAccountNumber: string | null;
|
|
3141
|
+
flutterwaveOrderRef: string | null;
|
|
3142
|
+
flutterwaveCustomerId: string | null;
|
|
3143
|
+
flutterwaveAccountExpiry: string;
|
|
3016
3144
|
prospectReason: import("@prisma/client").$Enums.ProspectReason | null;
|
|
3017
3145
|
prospectSince: string;
|
|
3018
3146
|
userActionToken: string;
|
|
3147
|
+
shippedAt: string;
|
|
3148
|
+
labelPrintedAt: string;
|
|
3149
|
+
deliveryConfirmationSentAt: string;
|
|
3150
|
+
deliveryConfirmedAt: string;
|
|
3151
|
+
deliveryConfirmationAttempts: number;
|
|
3019
3152
|
} | {
|
|
3020
3153
|
error: {
|
|
3021
3154
|
code: string;
|
|
@@ -3030,14 +3163,26 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
|
|
|
3030
3163
|
*/
|
|
3031
3164
|
export declare function useUpdateOrderStatus(orderId: string, options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['orders'][':id']['status']['$patch']>>['json']>>, Error, any>): import("@tanstack/react-query").UseMutationResult<{
|
|
3032
3165
|
subtotal: number;
|
|
3166
|
+
totalCost: number;
|
|
3167
|
+
totalProfit: number;
|
|
3168
|
+
profitMargin: number;
|
|
3033
3169
|
deliveryCharge: number;
|
|
3034
3170
|
totalPrice: number;
|
|
3035
3171
|
discountAmount: number;
|
|
3172
|
+
amountPaid: number;
|
|
3173
|
+
flutterwaveAccountBank: string;
|
|
3174
|
+
flutterwaveAccountNumber: string;
|
|
3175
|
+
flutterwaveAccountExpiry: string;
|
|
3036
3176
|
createdAt: string;
|
|
3037
3177
|
updatedAt: string;
|
|
3038
3178
|
deletedAt: string;
|
|
3039
3179
|
prospectSince: string;
|
|
3040
3180
|
lastRecoveryAttemptAt: string;
|
|
3181
|
+
shippedAt: string;
|
|
3182
|
+
deliveryConfirmationSentAt: string;
|
|
3183
|
+
deliveryConfirmedAt: string;
|
|
3184
|
+
deliveryConfirmationAttempts: number;
|
|
3185
|
+
needsManualCall: boolean;
|
|
3041
3186
|
brand: {
|
|
3042
3187
|
id: string;
|
|
3043
3188
|
name: string;
|
|
@@ -3049,6 +3194,7 @@ export declare function useUpdateOrderStatus(orderId: string, options?: UseMutat
|
|
|
3049
3194
|
tiktokPixelId: string;
|
|
3050
3195
|
paystackPublicKey: string;
|
|
3051
3196
|
freeShippingThreshold: number;
|
|
3197
|
+
upsellDiscountPercent: number;
|
|
3052
3198
|
createdAt: string;
|
|
3053
3199
|
updatedAt: string;
|
|
3054
3200
|
deletedAt: string;
|
|
@@ -3081,6 +3227,8 @@ export declare function useUpdateOrderStatus(orderId: string, options?: UseMutat
|
|
|
3081
3227
|
};
|
|
3082
3228
|
items: {
|
|
3083
3229
|
priceAtPurchase: number;
|
|
3230
|
+
costAtPurchase: number;
|
|
3231
|
+
itemProfit: number;
|
|
3084
3232
|
variant: {
|
|
3085
3233
|
price: number;
|
|
3086
3234
|
createdAt: string;
|
|
@@ -3540,6 +3688,7 @@ export declare function useUpdateOrderStatus(orderId: string, options?: UseMutat
|
|
|
3540
3688
|
productId: string;
|
|
3541
3689
|
thumbnailUrl: string | null;
|
|
3542
3690
|
sku: string;
|
|
3691
|
+
costPrice: string;
|
|
3543
3692
|
compareAtPrice: string;
|
|
3544
3693
|
trackInventory: boolean;
|
|
3545
3694
|
lowStockThreshold: number | null;
|
|
@@ -3580,8 +3729,19 @@ export declare function useUpdateOrderStatus(orderId: string, options?: UseMutat
|
|
|
3580
3729
|
paystackReference: string | null;
|
|
3581
3730
|
status: import("@prisma/client").$Enums.OrderStatus;
|
|
3582
3731
|
cancellationReason: string | null;
|
|
3732
|
+
shippingMethod: string | null;
|
|
3733
|
+
dispatchRiderId: string | null;
|
|
3734
|
+
fezTrackingNumber: string | null;
|
|
3735
|
+
flutterwaveOrderRef: string | null;
|
|
3736
|
+
flutterwaveCustomerId: string | null;
|
|
3583
3737
|
prospectReason: import("@prisma/client").$Enums.ProspectReason | null;
|
|
3584
3738
|
userActionToken: string;
|
|
3739
|
+
labelPrintedAt: string;
|
|
3740
|
+
dispatchRider?: {
|
|
3741
|
+
id: string;
|
|
3742
|
+
name: string;
|
|
3743
|
+
phone: string;
|
|
3744
|
+
};
|
|
3585
3745
|
} | {
|
|
3586
3746
|
error: {
|
|
3587
3747
|
code: string;
|
|
@@ -3605,6 +3765,37 @@ export declare function useUpdateOrderStatus(orderId: string, options?: UseMutat
|
|
|
3605
3765
|
* @param options - React Query mutation options
|
|
3606
3766
|
*/
|
|
3607
3767
|
export declare function useDeleteOrder(orderId: string, options?: UseMutationOptions<Awaited<ReturnType<Awaited<ReturnType<ReturnType<typeof createAdminRpcClients>['orders'][':id']['$delete']>>['json']>>, Error, void>): import("@tanstack/react-query").UseMutationResult<unknown, Error, void, unknown>;
|
|
3768
|
+
/**
|
|
3769
|
+
* Hook to regenerate Flutterwave virtual account for a COD order
|
|
3770
|
+
*
|
|
3771
|
+
* @param orderId - Order UUID
|
|
3772
|
+
* @param options - React Query mutation options
|
|
3773
|
+
*/
|
|
3774
|
+
export declare function useRegenerateAccount(orderId: string, options?: UseMutationOptions<any, Error, void>): import("@tanstack/react-query").UseMutationResult<any, Error, void, unknown>;
|
|
3775
|
+
/**
|
|
3776
|
+
* Hook to send delivery confirmation for a single order
|
|
3777
|
+
*/
|
|
3778
|
+
export declare function useSendDeliveryConfirmation(orderId: string, options?: UseMutationOptions<any, Error, void>): import("@tanstack/react-query").UseMutationResult<any, Error, void, unknown>;
|
|
3779
|
+
/**
|
|
3780
|
+
* Hook to send batch delivery confirmation
|
|
3781
|
+
*/
|
|
3782
|
+
export declare function useBatchDeliveryConfirmation(options?: UseMutationOptions<any, Error, {
|
|
3783
|
+
orderIds: string[];
|
|
3784
|
+
}>): import("@tanstack/react-query").UseMutationResult<any, Error, {
|
|
3785
|
+
orderIds: string[];
|
|
3786
|
+
}, unknown>;
|
|
3787
|
+
/**
|
|
3788
|
+
* Hook to fetch aggregate order stats (revenue, cost, profit, margin)
|
|
3789
|
+
*
|
|
3790
|
+
* @param filters - Query parameters for filtering orders
|
|
3791
|
+
* @param options - React Query options
|
|
3792
|
+
*/
|
|
3793
|
+
export declare function useOrderStats(filters?: {
|
|
3794
|
+
status?: string;
|
|
3795
|
+
brandId?: string;
|
|
3796
|
+
startDate?: string;
|
|
3797
|
+
endDate?: string;
|
|
3798
|
+
}, options?: Omit<UseQueryOptions<any, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
3608
3799
|
/**
|
|
3609
3800
|
* Hook to add a note to an order using admin RPC
|
|
3610
3801
|
*
|
|
@@ -176,6 +176,99 @@ export function useDeleteOrder(orderId, options) {
|
|
|
176
176
|
...options,
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Hook to regenerate Flutterwave virtual account for a COD order
|
|
181
|
+
*
|
|
182
|
+
* @param orderId - Order UUID
|
|
183
|
+
* @param options - React Query mutation options
|
|
184
|
+
*/
|
|
185
|
+
export function useRegenerateAccount(orderId, options) {
|
|
186
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
187
|
+
const queryClient = useQueryClient();
|
|
188
|
+
return useMutation({
|
|
189
|
+
mutationFn: async () => {
|
|
190
|
+
const token = await getAuthToken();
|
|
191
|
+
const clients = createAdminRpcClients(baseURL);
|
|
192
|
+
const res = await clients.orders[':id']['regenerate-account'].$post({ param: { id: orderId } }, authHeaders(token));
|
|
193
|
+
if (!res.ok) {
|
|
194
|
+
throw new Error(`Failed to regenerate account: ${res.statusText}`);
|
|
195
|
+
}
|
|
196
|
+
return res.json();
|
|
197
|
+
},
|
|
198
|
+
onSuccess: () => {
|
|
199
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.orders.detail(orderId) });
|
|
200
|
+
},
|
|
201
|
+
...options,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Hook to send delivery confirmation for a single order
|
|
206
|
+
*/
|
|
207
|
+
export function useSendDeliveryConfirmation(orderId, options) {
|
|
208
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
209
|
+
const queryClient = useQueryClient();
|
|
210
|
+
return useMutation({
|
|
211
|
+
mutationFn: async () => {
|
|
212
|
+
const token = await getAuthToken();
|
|
213
|
+
const clients = createAdminRpcClients(baseURL);
|
|
214
|
+
const res = await clients.orders[':id']['send-delivery-confirmation'].$post({ param: { id: orderId } }, authHeaders(token));
|
|
215
|
+
if (!res.ok) {
|
|
216
|
+
throw new Error(`Failed to send delivery confirmation: ${res.statusText}`);
|
|
217
|
+
}
|
|
218
|
+
return res.json();
|
|
219
|
+
},
|
|
220
|
+
onSuccess: () => {
|
|
221
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.orders.detail(orderId) });
|
|
222
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.orders.all });
|
|
223
|
+
},
|
|
224
|
+
...options,
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Hook to send batch delivery confirmation
|
|
229
|
+
*/
|
|
230
|
+
export function useBatchDeliveryConfirmation(options) {
|
|
231
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
232
|
+
const queryClient = useQueryClient();
|
|
233
|
+
return useMutation({
|
|
234
|
+
mutationFn: async (data) => {
|
|
235
|
+
const token = await getAuthToken();
|
|
236
|
+
const clients = createAdminRpcClients(baseURL);
|
|
237
|
+
const res = await clients.orders['batch-delivery-confirmation'].$post({ json: data }, authHeaders(token));
|
|
238
|
+
if (!res.ok) {
|
|
239
|
+
throw new Error(`Failed to send batch delivery confirmation: ${res.statusText}`);
|
|
240
|
+
}
|
|
241
|
+
return res.json();
|
|
242
|
+
},
|
|
243
|
+
onSuccess: () => {
|
|
244
|
+
queryClient.invalidateQueries({ queryKey: queryKeys.admin.orders.all });
|
|
245
|
+
},
|
|
246
|
+
...options,
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Hook to fetch aggregate order stats (revenue, cost, profit, margin)
|
|
251
|
+
*
|
|
252
|
+
* @param filters - Query parameters for filtering orders
|
|
253
|
+
* @param options - React Query options
|
|
254
|
+
*/
|
|
255
|
+
export function useOrderStats(filters, options) {
|
|
256
|
+
const { baseURL, getAuthToken } = useApiConfig();
|
|
257
|
+
return useQueryUnwrapped({
|
|
258
|
+
queryKey: queryKeys.admin.orders.stats(filters),
|
|
259
|
+
queryFn: async () => {
|
|
260
|
+
const token = await getAuthToken();
|
|
261
|
+
const clients = createAdminRpcClients(baseURL);
|
|
262
|
+
const cleanFilters = filters ? Object.fromEntries(Object.entries(filters).filter(([_, v]) => v !== undefined)) : undefined;
|
|
263
|
+
const res = await clients.orders.stats.$get({ query: cleanFilters }, authHeaders(token));
|
|
264
|
+
if (!res.ok) {
|
|
265
|
+
throw new Error(`Failed to fetch order stats: ${res.statusText}`);
|
|
266
|
+
}
|
|
267
|
+
return res.json();
|
|
268
|
+
},
|
|
269
|
+
...options,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
179
272
|
/**
|
|
180
273
|
* Hook to add a note to an order using admin RPC
|
|
181
274
|
*
|
|
@@ -169,6 +169,7 @@ export declare function useListProducts(brandId?: string, options?: Omit<UseQuer
|
|
|
169
169
|
tiktokPixelId: string;
|
|
170
170
|
paystackPublicKey: string;
|
|
171
171
|
freeShippingThreshold: number;
|
|
172
|
+
upsellDiscountPercent: number;
|
|
172
173
|
createdAt: string;
|
|
173
174
|
updatedAt: string;
|
|
174
175
|
deletedAt: string;
|
|
@@ -177,9 +178,11 @@ export declare function useListProducts(brandId?: string, options?: Omit<UseQuer
|
|
|
177
178
|
createdAt: string;
|
|
178
179
|
updatedAt: string;
|
|
179
180
|
price: number;
|
|
181
|
+
costPrice: number;
|
|
180
182
|
compareAtPrice: number;
|
|
181
183
|
deletedAt: string;
|
|
182
184
|
thumbnailUrl: string;
|
|
185
|
+
rawThumbnailUrl: string;
|
|
183
186
|
originalPrice: number;
|
|
184
187
|
id: string;
|
|
185
188
|
name: string | null;
|
|
@@ -671,6 +674,7 @@ export declare function useGetProduct(productId: string, options?: Omit<UseQuery
|
|
|
671
674
|
tiktokPixelId: string;
|
|
672
675
|
paystackPublicKey: string;
|
|
673
676
|
freeShippingThreshold: number;
|
|
677
|
+
upsellDiscountPercent: number;
|
|
674
678
|
createdAt: string;
|
|
675
679
|
updatedAt: string;
|
|
676
680
|
deletedAt: string;
|
|
@@ -679,9 +683,11 @@ export declare function useGetProduct(productId: string, options?: Omit<UseQuery
|
|
|
679
683
|
createdAt: string;
|
|
680
684
|
updatedAt: string;
|
|
681
685
|
price: number;
|
|
686
|
+
costPrice: number;
|
|
682
687
|
compareAtPrice: number;
|
|
683
688
|
deletedAt: string;
|
|
684
689
|
thumbnailUrl: string;
|
|
690
|
+
rawThumbnailUrl: string;
|
|
685
691
|
originalPrice: number;
|
|
686
692
|
id: string;
|
|
687
693
|
name: string | null;
|
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { UseQueryOptions } from '@tanstack/react-query';
|
|
5
5
|
import { createAdminRpcClients } from '../../rpc-client';
|
|
6
|
+
/**
|
|
7
|
+
* Hook to get product order stats grouped by brand
|
|
8
|
+
*/
|
|
9
|
+
export declare function useGetProductOrderStats(params?: {
|
|
10
|
+
statuses?: string;
|
|
11
|
+
period?: string;
|
|
12
|
+
}, options?: Omit<UseQueryOptions<any, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<any, Error>;
|
|
6
13
|
/**
|
|
7
14
|
* Hook to get dashboard statistics using admin RPC
|
|
8
15
|
*/
|
|
@@ -32,14 +39,26 @@ export declare function useGetStats(params?: {
|
|
|
32
39
|
};
|
|
33
40
|
recentOrders: {
|
|
34
41
|
subtotal: number;
|
|
42
|
+
totalCost: number;
|
|
43
|
+
totalProfit: number;
|
|
44
|
+
profitMargin: number;
|
|
35
45
|
deliveryCharge: number;
|
|
36
46
|
totalPrice: number;
|
|
37
47
|
discountAmount: number;
|
|
48
|
+
amountPaid: number;
|
|
49
|
+
flutterwaveAccountBank: string;
|
|
50
|
+
flutterwaveAccountNumber: string;
|
|
51
|
+
flutterwaveAccountExpiry: string;
|
|
38
52
|
createdAt: string;
|
|
39
53
|
updatedAt: string;
|
|
40
54
|
deletedAt: string;
|
|
41
55
|
prospectSince: string;
|
|
42
56
|
lastRecoveryAttemptAt: string;
|
|
57
|
+
shippedAt: string;
|
|
58
|
+
deliveryConfirmationSentAt: string;
|
|
59
|
+
deliveryConfirmedAt: string;
|
|
60
|
+
deliveryConfirmationAttempts: number;
|
|
61
|
+
needsManualCall: boolean;
|
|
43
62
|
brand: {
|
|
44
63
|
id: string;
|
|
45
64
|
name: string;
|
|
@@ -51,6 +70,7 @@ export declare function useGetStats(params?: {
|
|
|
51
70
|
tiktokPixelId: string;
|
|
52
71
|
paystackPublicKey: string;
|
|
53
72
|
freeShippingThreshold: number;
|
|
73
|
+
upsellDiscountPercent: number;
|
|
54
74
|
createdAt: string;
|
|
55
75
|
updatedAt: string;
|
|
56
76
|
deletedAt: string;
|
|
@@ -83,6 +103,8 @@ export declare function useGetStats(params?: {
|
|
|
83
103
|
};
|
|
84
104
|
items: {
|
|
85
105
|
priceAtPurchase: number;
|
|
106
|
+
costAtPurchase: number;
|
|
107
|
+
itemProfit: number;
|
|
86
108
|
variant: {
|
|
87
109
|
price: number;
|
|
88
110
|
createdAt: string;
|
|
@@ -542,6 +564,7 @@ export declare function useGetStats(params?: {
|
|
|
542
564
|
productId: string;
|
|
543
565
|
thumbnailUrl: string | null;
|
|
544
566
|
sku: string;
|
|
567
|
+
costPrice: string;
|
|
545
568
|
compareAtPrice: string;
|
|
546
569
|
trackInventory: boolean;
|
|
547
570
|
lowStockThreshold: number | null;
|
|
@@ -582,7 +605,18 @@ export declare function useGetStats(params?: {
|
|
|
582
605
|
paystackReference: string | null;
|
|
583
606
|
status: import("@prisma/client").$Enums.OrderStatus;
|
|
584
607
|
cancellationReason: string | null;
|
|
608
|
+
shippingMethod: string | null;
|
|
609
|
+
dispatchRiderId: string | null;
|
|
610
|
+
fezTrackingNumber: string | null;
|
|
611
|
+
flutterwaveOrderRef: string | null;
|
|
612
|
+
flutterwaveCustomerId: string | null;
|
|
585
613
|
prospectReason: import("@prisma/client").$Enums.ProspectReason | null;
|
|
586
614
|
userActionToken: string;
|
|
615
|
+
labelPrintedAt: string;
|
|
616
|
+
dispatchRider?: {
|
|
617
|
+
id: string;
|
|
618
|
+
name: string;
|
|
619
|
+
phone: string;
|
|
620
|
+
};
|
|
587
621
|
}[];
|
|
588
622
|
}, Error>;
|