@instockng/api-client 1.0.20 → 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 +197 -0
- package/dist/fetchers/orders.js +20 -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 +204 -1
- package/dist/hooks/public/orders.js +23 -1
- package/dist/hooks/public/products.d.ts +10 -1
- package/dist/hooks/public/products.js +14 -1
- package/dist/rpc-client.d.ts +559 -14
- package/dist/rpc-client.js +2 -0
- package/dist/utils/query-keys.d.ts +3 -0
- package/dist/utils/query-keys.js +5 -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
|
};
|
|
@@ -548,3 +550,198 @@ export declare function confirmOrder(orderId: string, token: string): Promise<{
|
|
|
548
550
|
prospectReason: import("@prisma/client").$Enums.ProspectReason | null;
|
|
549
551
|
userActionToken: string;
|
|
550
552
|
}>;
|
|
553
|
+
/**
|
|
554
|
+
* Fetch order recommendations for post-purchase upsell
|
|
555
|
+
*
|
|
556
|
+
* @param orderId - Order UUID
|
|
557
|
+
* @param token - User action token
|
|
558
|
+
* @param limit - Maximum number of recommendations
|
|
559
|
+
* @returns Array of recommended products
|
|
560
|
+
*/
|
|
561
|
+
export declare function fetchOrderRecommendations(orderId: string, token: string, limit?: number): Promise<{
|
|
562
|
+
brand: {
|
|
563
|
+
createdAt: string;
|
|
564
|
+
updatedAt: string;
|
|
565
|
+
deletedAt: string;
|
|
566
|
+
id: string;
|
|
567
|
+
name: string;
|
|
568
|
+
slug: string;
|
|
569
|
+
logoUrl: string | null;
|
|
570
|
+
siteUrl: string;
|
|
571
|
+
domain: string;
|
|
572
|
+
metaPixelId: string | null;
|
|
573
|
+
tiktokPixelId: string | null;
|
|
574
|
+
paystackPublicKey: string | null;
|
|
575
|
+
paystackSecretKey: string | null;
|
|
576
|
+
};
|
|
577
|
+
variants: {
|
|
578
|
+
createdAt: string;
|
|
579
|
+
updatedAt: string;
|
|
580
|
+
price: number;
|
|
581
|
+
compareAtPrice: number;
|
|
582
|
+
deletedAt: string;
|
|
583
|
+
id: string;
|
|
584
|
+
name: string | null;
|
|
585
|
+
isActive: boolean;
|
|
586
|
+
thumbnailUrl: string | null;
|
|
587
|
+
productId: string;
|
|
588
|
+
sku: string;
|
|
589
|
+
trackInventory: boolean;
|
|
590
|
+
lowStockThreshold: number | null;
|
|
591
|
+
}[];
|
|
592
|
+
id: string;
|
|
593
|
+
name: string;
|
|
594
|
+
slug: string;
|
|
595
|
+
createdAt: string;
|
|
596
|
+
updatedAt: string;
|
|
597
|
+
deletedAt: string;
|
|
598
|
+
brandId: string;
|
|
599
|
+
isActive: boolean;
|
|
600
|
+
description: string | null;
|
|
601
|
+
thumbnailUrl: string | null;
|
|
602
|
+
quantityDiscounts: string | number | boolean | {
|
|
603
|
+
[x: string]: string | number | boolean | /*elided*/ any | {
|
|
604
|
+
[x: number]: string | number | boolean | /*elided*/ any | /*elided*/ any;
|
|
605
|
+
length: number;
|
|
606
|
+
toString: never;
|
|
607
|
+
toLocaleString: never;
|
|
608
|
+
pop: never;
|
|
609
|
+
push: never;
|
|
610
|
+
concat: never;
|
|
611
|
+
join: never;
|
|
612
|
+
reverse: never;
|
|
613
|
+
shift: never;
|
|
614
|
+
slice: never;
|
|
615
|
+
sort: never;
|
|
616
|
+
splice: never;
|
|
617
|
+
unshift: never;
|
|
618
|
+
indexOf: never;
|
|
619
|
+
lastIndexOf: never;
|
|
620
|
+
every: never;
|
|
621
|
+
some: never;
|
|
622
|
+
forEach: never;
|
|
623
|
+
map: never;
|
|
624
|
+
filter: never;
|
|
625
|
+
reduce: never;
|
|
626
|
+
reduceRight: never;
|
|
627
|
+
find: never;
|
|
628
|
+
findIndex: never;
|
|
629
|
+
fill: never;
|
|
630
|
+
copyWithin: never;
|
|
631
|
+
entries: never;
|
|
632
|
+
keys: never;
|
|
633
|
+
values: never;
|
|
634
|
+
includes: never;
|
|
635
|
+
flatMap: never;
|
|
636
|
+
flat: never;
|
|
637
|
+
[Symbol.iterator]: never;
|
|
638
|
+
readonly [Symbol.unscopables]: {
|
|
639
|
+
[x: number]: boolean;
|
|
640
|
+
length?: boolean;
|
|
641
|
+
toString?: boolean;
|
|
642
|
+
toLocaleString?: boolean;
|
|
643
|
+
pop?: boolean;
|
|
644
|
+
push?: boolean;
|
|
645
|
+
concat?: boolean;
|
|
646
|
+
join?: boolean;
|
|
647
|
+
reverse?: boolean;
|
|
648
|
+
shift?: boolean;
|
|
649
|
+
slice?: boolean;
|
|
650
|
+
sort?: boolean;
|
|
651
|
+
splice?: boolean;
|
|
652
|
+
unshift?: boolean;
|
|
653
|
+
indexOf?: boolean;
|
|
654
|
+
lastIndexOf?: boolean;
|
|
655
|
+
every?: boolean;
|
|
656
|
+
some?: boolean;
|
|
657
|
+
forEach?: boolean;
|
|
658
|
+
map?: boolean;
|
|
659
|
+
filter?: boolean;
|
|
660
|
+
reduce?: boolean;
|
|
661
|
+
reduceRight?: boolean;
|
|
662
|
+
find?: boolean;
|
|
663
|
+
findIndex?: boolean;
|
|
664
|
+
fill?: boolean;
|
|
665
|
+
copyWithin?: boolean;
|
|
666
|
+
entries?: boolean;
|
|
667
|
+
keys?: boolean;
|
|
668
|
+
values?: boolean;
|
|
669
|
+
includes?: boolean;
|
|
670
|
+
flatMap?: boolean;
|
|
671
|
+
flat?: boolean;
|
|
672
|
+
};
|
|
673
|
+
};
|
|
674
|
+
} | {
|
|
675
|
+
[x: number]: string | number | boolean | {
|
|
676
|
+
[x: string]: string | number | boolean | /*elided*/ any | /*elided*/ any;
|
|
677
|
+
} | /*elided*/ any;
|
|
678
|
+
length: number;
|
|
679
|
+
toString: never;
|
|
680
|
+
toLocaleString: never;
|
|
681
|
+
pop: never;
|
|
682
|
+
push: never;
|
|
683
|
+
concat: never;
|
|
684
|
+
join: never;
|
|
685
|
+
reverse: never;
|
|
686
|
+
shift: never;
|
|
687
|
+
slice: never;
|
|
688
|
+
sort: never;
|
|
689
|
+
splice: never;
|
|
690
|
+
unshift: never;
|
|
691
|
+
indexOf: never;
|
|
692
|
+
lastIndexOf: never;
|
|
693
|
+
every: never;
|
|
694
|
+
some: never;
|
|
695
|
+
forEach: never;
|
|
696
|
+
map: never;
|
|
697
|
+
filter: never;
|
|
698
|
+
reduce: never;
|
|
699
|
+
reduceRight: never;
|
|
700
|
+
find: never;
|
|
701
|
+
findIndex: never;
|
|
702
|
+
fill: never;
|
|
703
|
+
copyWithin: never;
|
|
704
|
+
entries: never;
|
|
705
|
+
keys: never;
|
|
706
|
+
values: never;
|
|
707
|
+
includes: never;
|
|
708
|
+
flatMap: never;
|
|
709
|
+
flat: never;
|
|
710
|
+
[Symbol.iterator]: never;
|
|
711
|
+
readonly [Symbol.unscopables]: {
|
|
712
|
+
[x: number]: boolean;
|
|
713
|
+
length?: boolean;
|
|
714
|
+
toString?: boolean;
|
|
715
|
+
toLocaleString?: boolean;
|
|
716
|
+
pop?: boolean;
|
|
717
|
+
push?: boolean;
|
|
718
|
+
concat?: boolean;
|
|
719
|
+
join?: boolean;
|
|
720
|
+
reverse?: boolean;
|
|
721
|
+
shift?: boolean;
|
|
722
|
+
slice?: boolean;
|
|
723
|
+
sort?: boolean;
|
|
724
|
+
splice?: boolean;
|
|
725
|
+
unshift?: boolean;
|
|
726
|
+
indexOf?: boolean;
|
|
727
|
+
lastIndexOf?: boolean;
|
|
728
|
+
every?: boolean;
|
|
729
|
+
some?: boolean;
|
|
730
|
+
forEach?: boolean;
|
|
731
|
+
map?: boolean;
|
|
732
|
+
filter?: boolean;
|
|
733
|
+
reduce?: boolean;
|
|
734
|
+
reduceRight?: boolean;
|
|
735
|
+
find?: boolean;
|
|
736
|
+
findIndex?: boolean;
|
|
737
|
+
fill?: boolean;
|
|
738
|
+
copyWithin?: boolean;
|
|
739
|
+
entries?: boolean;
|
|
740
|
+
keys?: boolean;
|
|
741
|
+
values?: boolean;
|
|
742
|
+
includes?: boolean;
|
|
743
|
+
flatMap?: boolean;
|
|
744
|
+
flat?: boolean;
|
|
745
|
+
};
|
|
746
|
+
};
|
|
747
|
+
}[]>;
|
package/dist/fetchers/orders.js
CHANGED
|
@@ -42,3 +42,23 @@ export async function confirmOrder(orderId, token) {
|
|
|
42
42
|
}
|
|
43
43
|
return res.json();
|
|
44
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Fetch order recommendations for post-purchase upsell
|
|
47
|
+
*
|
|
48
|
+
* @param orderId - Order UUID
|
|
49
|
+
* @param token - User action token
|
|
50
|
+
* @param limit - Maximum number of recommendations
|
|
51
|
+
* @returns Array of recommended products
|
|
52
|
+
*/
|
|
53
|
+
export async function fetchOrderRecommendations(orderId, token, limit = 4) {
|
|
54
|
+
const clients = createRpcClients(API_URL);
|
|
55
|
+
const res = await clients.orders[':id'][':token'].recommendations.$get({
|
|
56
|
+
param: { id: orderId, token },
|
|
57
|
+
// @ts-ignore - Hono RPC type inference issue with query parameters
|
|
58
|
+
query: { limit: String(limit) },
|
|
59
|
+
});
|
|
60
|
+
if (!res.ok) {
|
|
61
|
+
throw new Error(`Failed to fetch order recommendations: ${res.statusText}`);
|
|
62
|
+
}
|
|
63
|
+
return res.json();
|
|
64
|
+
}
|
|
@@ -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;
|