@instockng/api-client 1.0.16 → 1.0.17
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/fetchers/carts.d.ts
CHANGED
|
@@ -794,9 +794,11 @@ export declare function updateCart(cartId: string, data: {
|
|
|
794
794
|
* @param quantity - Quantity to add
|
|
795
795
|
* @param fbc - Facebook Click ID (optional)
|
|
796
796
|
* @param fbp - Facebook Browser ID (optional)
|
|
797
|
+
* @param ttp - TikTok Click ID (_ttp cookie) (optional)
|
|
798
|
+
* @param ttclid - TikTok Click ID (URL parameter) (optional)
|
|
797
799
|
* @returns Updated cart
|
|
798
800
|
*/
|
|
799
|
-
export declare function addCartItem(cartId: string, sku: string, quantity: number, fbc?: string, fbp?: string): Promise<{
|
|
801
|
+
export declare function addCartItem(cartId: string, sku: string, quantity: number, fbc?: string, fbp?: string, ttp?: string, ttclid?: string): Promise<{
|
|
800
802
|
id: string;
|
|
801
803
|
brand: {
|
|
802
804
|
createdAt: string;
|
|
@@ -2099,6 +2101,8 @@ export declare function checkoutCart(cartId: string, checkoutData: {
|
|
|
2099
2101
|
ifUnmodifiedSince?: string;
|
|
2100
2102
|
fbc?: string;
|
|
2101
2103
|
fbp?: string;
|
|
2104
|
+
ttp?: string;
|
|
2105
|
+
ttclid?: string;
|
|
2102
2106
|
}): Promise<{
|
|
2103
2107
|
subtotal: number;
|
|
2104
2108
|
deliveryCharge: number;
|
package/dist/fetchers/carts.js
CHANGED
|
@@ -67,14 +67,16 @@ export async function updateCart(cartId, data) {
|
|
|
67
67
|
* @param quantity - Quantity to add
|
|
68
68
|
* @param fbc - Facebook Click ID (optional)
|
|
69
69
|
* @param fbp - Facebook Browser ID (optional)
|
|
70
|
+
* @param ttp - TikTok Click ID (_ttp cookie) (optional)
|
|
71
|
+
* @param ttclid - TikTok Click ID (URL parameter) (optional)
|
|
70
72
|
* @returns Updated cart
|
|
71
73
|
*/
|
|
72
|
-
export async function addCartItem(cartId, sku, quantity, fbc, fbp) {
|
|
74
|
+
export async function addCartItem(cartId, sku, quantity, fbc, fbp, ttp, ttclid) {
|
|
73
75
|
const clients = createRpcClients(API_URL);
|
|
74
76
|
const res = await clients.carts[':id'].items.$post({
|
|
75
77
|
param: { id: cartId },
|
|
76
78
|
// @ts-expect-error - Hono RPC type inference issue
|
|
77
|
-
json: { sku, quantity, fbc, fbp },
|
|
79
|
+
json: { sku, quantity, fbc, fbp, ttp, ttclid },
|
|
78
80
|
});
|
|
79
81
|
if (!res.ok) {
|
|
80
82
|
throw new Error(`Failed to add item to cart: ${res.statusText}`);
|
|
@@ -1343,7 +1343,7 @@ export declare function useRemoveDiscount(cartId: string, options?: UseMutationO
|
|
|
1343
1343
|
* @example
|
|
1344
1344
|
* ```tsx
|
|
1345
1345
|
* const addItem = useAddCartItem('cart-123');
|
|
1346
|
-
* addItem.mutate({ sku: 'PROD-001', quantity: 2, fbc: '_fbc_cookie', fbp: '_fbp_cookie' });
|
|
1346
|
+
* addItem.mutate({ sku: 'PROD-001', quantity: 2, fbc: '_fbc_cookie', fbp: '_fbp_cookie', ttp: '_ttp_cookie', ttclid: 'tiktok_click_id' });
|
|
1347
1347
|
* ```
|
|
1348
1348
|
*/
|
|
1349
1349
|
export declare function useAddCartItem(cartId: string, options?: UseMutationOptions<Awaited<ReturnType<typeof addCartItem>>, Error, {
|
|
@@ -1351,6 +1351,8 @@ export declare function useAddCartItem(cartId: string, options?: UseMutationOpti
|
|
|
1351
1351
|
quantity: number;
|
|
1352
1352
|
fbc?: string;
|
|
1353
1353
|
fbp?: string;
|
|
1354
|
+
ttp?: string;
|
|
1355
|
+
ttclid?: string;
|
|
1354
1356
|
}>): import("@tanstack/react-query").UseMutationResult<{
|
|
1355
1357
|
id: string;
|
|
1356
1358
|
brand: {
|
|
@@ -1608,6 +1610,8 @@ export declare function useAddCartItem(cartId: string, options?: UseMutationOpti
|
|
|
1608
1610
|
quantity: number;
|
|
1609
1611
|
fbc?: string;
|
|
1610
1612
|
fbp?: string;
|
|
1613
|
+
ttp?: string;
|
|
1614
|
+
ttclid?: string;
|
|
1611
1615
|
}, unknown>;
|
|
1612
1616
|
/**
|
|
1613
1617
|
* Hook to update cart item quantity using RPC
|
|
@@ -2431,4 +2435,6 @@ export declare function useCheckoutCart(cartId: string, options?: UseMutationOpt
|
|
|
2431
2435
|
ifUnmodifiedSince?: string;
|
|
2432
2436
|
fbc?: string;
|
|
2433
2437
|
fbp?: string;
|
|
2438
|
+
ttp?: string;
|
|
2439
|
+
ttclid?: string;
|
|
2434
2440
|
}, unknown>;
|
|
@@ -122,13 +122,13 @@ export function useRemoveDiscount(cartId, options) {
|
|
|
122
122
|
* @example
|
|
123
123
|
* ```tsx
|
|
124
124
|
* const addItem = useAddCartItem('cart-123');
|
|
125
|
-
* addItem.mutate({ sku: 'PROD-001', quantity: 2, fbc: '_fbc_cookie', fbp: '_fbp_cookie' });
|
|
125
|
+
* addItem.mutate({ sku: 'PROD-001', quantity: 2, fbc: '_fbc_cookie', fbp: '_fbp_cookie', ttp: '_ttp_cookie', ttclid: 'tiktok_click_id' });
|
|
126
126
|
* ```
|
|
127
127
|
*/
|
|
128
128
|
export function useAddCartItem(cartId, options) {
|
|
129
129
|
const queryClient = useQueryClient();
|
|
130
130
|
return useMutation({
|
|
131
|
-
mutationFn: (data) => addCartItem(cartId, data.sku, data.quantity, data.fbc, data.fbp),
|
|
131
|
+
mutationFn: (data) => addCartItem(cartId, data.sku, data.quantity, data.fbc, data.fbp, data.ttp, data.ttclid),
|
|
132
132
|
onSuccess: () => {
|
|
133
133
|
queryClient.invalidateQueries({ queryKey: queryKeys.public.carts.detail(cartId) });
|
|
134
134
|
},
|