@instockng/api-client 1.0.2 → 1.0.3

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.
@@ -783,9 +783,11 @@ export declare function updateCart(cartId: string, data: {
783
783
  * @param cartId - Cart UUID
784
784
  * @param sku - Product variant SKU
785
785
  * @param quantity - Quantity to add
786
+ * @param fbc - Facebook Click ID (optional)
787
+ * @param fbp - Facebook Browser ID (optional)
786
788
  * @returns Updated cart
787
789
  */
788
- export declare function addCartItem(cartId: string, sku: string, quantity: number): Promise<{
790
+ export declare function addCartItem(cartId: string, sku: string, quantity: number, fbc?: string, fbp?: string): Promise<{
789
791
  error: {
790
792
  code: string;
791
793
  message: string;
@@ -2079,6 +2081,8 @@ export declare function checkoutCart(cartId: string, checkoutData: {
2079
2081
  paymentMethod: 'cod' | 'online';
2080
2082
  paystackReference?: string;
2081
2083
  ifUnmodifiedSince?: string;
2084
+ fbc?: string;
2085
+ fbp?: string;
2082
2086
  }): Promise<{
2083
2087
  subtotal: number;
2084
2088
  deliveryCharge: number;
@@ -64,13 +64,15 @@ export async function updateCart(cartId, data) {
64
64
  * @param cartId - Cart UUID
65
65
  * @param sku - Product variant SKU
66
66
  * @param quantity - Quantity to add
67
+ * @param fbc - Facebook Click ID (optional)
68
+ * @param fbp - Facebook Browser ID (optional)
67
69
  * @returns Updated cart
68
70
  */
69
- export async function addCartItem(cartId, sku, quantity) {
71
+ export async function addCartItem(cartId, sku, quantity, fbc, fbp) {
70
72
  const clients = createRpcClients(API_URL);
71
73
  const res = await clients.carts[':id'].items.$post({
72
74
  param: { id: cartId },
73
- json: { sku, quantity },
75
+ json: { sku, quantity, fbc, fbp },
74
76
  });
75
77
  if (!res.ok) {
76
78
  throw new Error(`Failed to add item to cart: ${res.statusText}`);
@@ -1330,12 +1330,14 @@ export declare function useRemoveDiscount(cartId: string, options?: UseMutationO
1330
1330
  * @example
1331
1331
  * ```tsx
1332
1332
  * const addItem = useAddCartItem('cart-123');
1333
- * addItem.mutate({ sku: 'PROD-001', quantity: 2 });
1333
+ * addItem.mutate({ sku: 'PROD-001', quantity: 2, fbc: '_fbc_cookie', fbp: '_fbp_cookie' });
1334
1334
  * ```
1335
1335
  */
1336
1336
  export declare function useAddCartItem(cartId: string, options?: UseMutationOptions<Awaited<ReturnType<typeof addCartItem>>, Error, {
1337
1337
  sku: string;
1338
1338
  quantity: number;
1339
+ fbc?: string;
1340
+ fbp?: string;
1339
1341
  }>): import("@tanstack/react-query").UseMutationResult<{
1340
1342
  error: {
1341
1343
  code: string;
@@ -1590,6 +1592,8 @@ export declare function useAddCartItem(cartId: string, options?: UseMutationOpti
1590
1592
  }, Error, {
1591
1593
  sku: string;
1592
1594
  quantity: number;
1595
+ fbc?: string;
1596
+ fbp?: string;
1593
1597
  }, unknown>;
1594
1598
  /**
1595
1599
  * Hook to update cart item quantity using RPC
@@ -2404,4 +2408,6 @@ export declare function useCheckoutCart(cartId: string, options?: UseMutationOpt
2404
2408
  paymentMethod: "cod" | "online";
2405
2409
  paystackReference?: string;
2406
2410
  ifUnmodifiedSince?: string;
2411
+ fbc?: string;
2412
+ fbp?: string;
2407
2413
  }, 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 });
125
+ * addItem.mutate({ sku: 'PROD-001', quantity: 2, fbc: '_fbc_cookie', fbp: '_fbp_cookie' });
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),
131
+ mutationFn: (data) => addCartItem(cartId, data.sku, data.quantity, data.fbc, data.fbp),
132
132
  onSuccess: () => {
133
133
  queryClient.invalidateQueries({ queryKey: queryKeys.public.carts.detail(cartId) });
134
134
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instockng/api-client",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
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",
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",
52
+ "generate-types": "node scripts/generate-backend-types.mjs",
53
+ "prebuild": "pnpm run generate-types"
55
54
  }
56
- }
55
+ }