@instockng/api-client 1.0.1 → 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.
@@ -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, 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, } from '../../../apps/backend/src/http-app';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Brand fetcher functions
3
+ *
4
+ * These are the actual data-fetching functions used by hooks.
5
+ * They can also be imported directly in Server Components.
6
+ *
7
+ * API URL is hardcoded to https://oms-api.instock.ng
8
+ */
9
+ /**
10
+ * Fetch brand configuration by slug
11
+ *
12
+ * @param slug - Brand slug (e.g., 'my-brand')
13
+ * @returns Brand with metaPixelId and other configuration
14
+ */
15
+ export declare function fetchBrandBySlug(slug: string): Promise<{
16
+ name: string;
17
+ id: string;
18
+ slug: string;
19
+ logoUrl: string;
20
+ siteUrl: string;
21
+ domain: string;
22
+ metaPixelId: string;
23
+ createdAt: string;
24
+ updatedAt: string;
25
+ }>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Brand fetcher functions
3
+ *
4
+ * These are the actual data-fetching functions used by hooks.
5
+ * They can also be imported directly in Server Components.
6
+ *
7
+ * API URL is hardcoded to https://oms-api.instock.ng
8
+ */
9
+ import { createRpcClients } from '../rpc-client';
10
+ const API_URL = 'https://oms-api.instock.ng';
11
+ /**
12
+ * Fetch brand configuration by slug
13
+ *
14
+ * @param slug - Brand slug (e.g., 'my-brand')
15
+ * @returns Brand with metaPixelId and other configuration
16
+ */
17
+ export async function fetchBrandBySlug(slug) {
18
+ const clients = createRpcClients(API_URL);
19
+ const res = await clients.brands[':slug'].$get({
20
+ param: { slug },
21
+ });
22
+ if (!res.ok) {
23
+ throw new Error(`Failed to fetch brand: ${res.statusText}`);
24
+ }
25
+ return res.json();
26
+ }
@@ -24,6 +24,7 @@ export declare function fetchCart(cartId: string): Promise<{
24
24
  logoUrl: string | null;
25
25
  siteUrl: string;
26
26
  domain: string;
27
+ metaPixelId: string | null;
27
28
  };
28
29
  customerPhone: string;
29
30
  customerEmail: string;
@@ -279,6 +280,7 @@ export declare function createCart(brandSlug: string): Promise<{
279
280
  logoUrl: string | null;
280
281
  siteUrl: string;
281
282
  domain: string;
283
+ metaPixelId: string | null;
282
284
  };
283
285
  customerPhone: string;
284
286
  customerEmail: string;
@@ -537,6 +539,7 @@ export declare function updateCart(cartId: string, data: {
537
539
  logoUrl: string | null;
538
540
  siteUrl: string;
539
541
  domain: string;
542
+ metaPixelId: string | null;
540
543
  };
541
544
  customerPhone: string;
542
545
  customerEmail: string;
@@ -780,9 +783,11 @@ export declare function updateCart(cartId: string, data: {
780
783
  * @param cartId - Cart UUID
781
784
  * @param sku - Product variant SKU
782
785
  * @param quantity - Quantity to add
786
+ * @param fbc - Facebook Click ID (optional)
787
+ * @param fbp - Facebook Browser ID (optional)
783
788
  * @returns Updated cart
784
789
  */
785
- 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<{
786
791
  error: {
787
792
  code: string;
788
793
  message: string;
@@ -800,6 +805,7 @@ export declare function addCartItem(cartId: string, sku: string, quantity: numbe
800
805
  logoUrl: string | null;
801
806
  siteUrl: string;
802
807
  domain: string;
808
+ metaPixelId: string | null;
803
809
  };
804
810
  customerPhone: string;
805
811
  customerEmail: string;
@@ -1054,6 +1060,7 @@ export declare function updateCartItem(cartId: string, itemId: string, quantity:
1054
1060
  logoUrl: string | null;
1055
1061
  siteUrl: string;
1056
1062
  domain: string;
1063
+ metaPixelId: string | null;
1057
1064
  };
1058
1065
  customerPhone: string;
1059
1066
  customerEmail: string;
@@ -1307,6 +1314,7 @@ export declare function removeCartItem(cartId: string, itemId: string): Promise<
1307
1314
  logoUrl: string | null;
1308
1315
  siteUrl: string;
1309
1316
  domain: string;
1317
+ metaPixelId: string | null;
1310
1318
  };
1311
1319
  customerPhone: string;
1312
1320
  customerEmail: string;
@@ -1559,6 +1567,7 @@ export declare function applyDiscount(cartId: string, code: string): Promise<{
1559
1567
  logoUrl: string | null;
1560
1568
  siteUrl: string;
1561
1569
  domain: string;
1570
+ metaPixelId: string | null;
1562
1571
  };
1563
1572
  customerPhone: string;
1564
1573
  customerEmail: string;
@@ -1820,6 +1829,7 @@ export declare function removeDiscount(cartId: string): Promise<{
1820
1829
  logoUrl: string | null;
1821
1830
  siteUrl: string;
1822
1831
  domain: string;
1832
+ metaPixelId: string | null;
1823
1833
  };
1824
1834
  customerPhone: string;
1825
1835
  customerEmail: string;
@@ -2071,6 +2081,8 @@ export declare function checkoutCart(cartId: string, checkoutData: {
2071
2081
  paymentMethod: 'cod' | 'online';
2072
2082
  paystackReference?: string;
2073
2083
  ifUnmodifiedSince?: string;
2084
+ fbc?: string;
2085
+ fbp?: string;
2074
2086
  }): Promise<{
2075
2087
  subtotal: number;
2076
2088
  deliveryCharge: number;
@@ -2091,6 +2103,7 @@ export declare function checkoutCart(cartId: string, checkoutData: {
2091
2103
  logoUrl: string | null;
2092
2104
  siteUrl: string;
2093
2105
  domain: string;
2106
+ metaPixelId: string | null;
2094
2107
  };
2095
2108
  deliveryZone: {
2096
2109
  deliveryCost: 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}`);
@@ -19,3 +19,4 @@ export * from './products';
19
19
  export * from './carts';
20
20
  export * from './orders';
21
21
  export * from './delivery-zones';
22
+ export * from './brands';
@@ -19,3 +19,4 @@ export * from './products';
19
19
  export * from './carts';
20
20
  export * from './orders';
21
21
  export * from './delivery-zones';
22
+ export * from './brands';
@@ -35,6 +35,7 @@ export declare function fetchOrder(orderId: string, token: string): Promise<{
35
35
  logoUrl: string | null;
36
36
  siteUrl: string;
37
37
  domain: string;
38
+ metaPixelId: string | null;
38
39
  };
39
40
  deliveryZone: {
40
41
  deliveryCost: number;
@@ -23,6 +23,7 @@ export declare function fetchProductsByBrand(brandId: string): Promise<{
23
23
  logoUrl: string | null;
24
24
  siteUrl: string;
25
25
  domain: string;
26
+ metaPixelId: string | null;
26
27
  };
27
28
  variants: {
28
29
  createdAt: string;
@@ -211,6 +212,7 @@ export declare function fetchProductBySlug(slug: string): Promise<{
211
212
  logoUrl: string | null;
212
213
  siteUrl: string;
213
214
  domain: string;
215
+ metaPixelId: string | null;
214
216
  };
215
217
  variants: {
216
218
  createdAt: string;
@@ -22,6 +22,7 @@ export declare function useListAbandonedCarts(params?: {
22
22
  logoUrl: string | null;
23
23
  siteUrl: string;
24
24
  domain: string;
25
+ metaPixelId: string | null;
25
26
  };
26
27
  customerPhone: string;
27
28
  customerEmail: string;
@@ -287,6 +288,7 @@ export declare function useGetAbandonedCart(cartId: string, options?: Omit<UseQu
287
288
  logoUrl: string | null;
288
289
  siteUrl: string;
289
290
  domain: string;
291
+ metaPixelId: string | null;
290
292
  };
291
293
  customerPhone: string;
292
294
  customerEmail: string;
@@ -13,6 +13,7 @@ export declare function useListBrands(options?: Omit<UseQueryOptions<Awaited<Ret
13
13
  logoUrl: string | null;
14
14
  siteUrl: string;
15
15
  domain: string;
16
+ metaPixelId: string | null;
16
17
  createdAt: string;
17
18
  updatedAt: string;
18
19
  deletedAt: string;
@@ -27,6 +28,7 @@ export declare function useGetBrand(brandId: string, options?: Omit<UseQueryOpti
27
28
  logoUrl: string | null;
28
29
  siteUrl: string;
29
30
  domain: string;
31
+ metaPixelId: string | null;
30
32
  createdAt: string;
31
33
  updatedAt: string;
32
34
  deletedAt: string;
@@ -41,6 +43,7 @@ export declare function useCreateBrand(options?: UseMutationOptions<Awaited<Retu
41
43
  logoUrl: string | null;
42
44
  siteUrl: string;
43
45
  domain: string;
46
+ metaPixelId: string | null;
44
47
  createdAt: string;
45
48
  updatedAt: string;
46
49
  deletedAt: string;
@@ -60,6 +63,7 @@ export declare function useUpdateBrand(brandId: string, options?: UseMutationOpt
60
63
  logoUrl: string | null;
61
64
  siteUrl: string;
62
65
  domain: string;
66
+ metaPixelId: string | null;
63
67
  createdAt: string;
64
68
  updatedAt: string;
65
69
  deletedAt: string;
@@ -37,6 +37,7 @@ export declare function useGetCustomerHistory(phone: string, options?: Omit<UseQ
37
37
  logoUrl: string | null;
38
38
  siteUrl: string;
39
39
  domain: string;
40
+ metaPixelId: string | null;
40
41
  };
41
42
  deliveryZone: {
42
43
  deliveryCost: number;
@@ -23,6 +23,7 @@ export declare function useListStates(options?: Omit<UseQueryOptions<Awaited<Ret
23
23
  logoUrl: string | null;
24
24
  siteUrl: string;
25
25
  domain: string;
26
+ metaPixelId: string | null;
26
27
  };
27
28
  stateName: string;
28
29
  brandName: string;
@@ -129,6 +130,7 @@ export declare function useListDeliveryZones(params?: {
129
130
  logoUrl: string | null;
130
131
  siteUrl: string;
131
132
  domain: string;
133
+ metaPixelId: string | null;
132
134
  };
133
135
  stateName: string;
134
136
  brandName: string;
@@ -169,6 +171,7 @@ export declare function useCreateDeliveryZone(options?: UseMutationOptions<Await
169
171
  logoUrl: string | null;
170
172
  siteUrl: string;
171
173
  domain: string;
174
+ metaPixelId: string | null;
172
175
  };
173
176
  stateName: string;
174
177
  brandName: string;
@@ -224,6 +227,7 @@ export declare function useUpdateDeliveryZone(zoneId: string, options?: UseMutat
224
227
  logoUrl: string | null;
225
228
  siteUrl: string;
226
229
  domain: string;
230
+ metaPixelId: string | null;
227
231
  };
228
232
  stateName: string;
229
233
  brandName: string;
@@ -31,6 +31,7 @@ export declare function useListDiscountCodes(params?: {
31
31
  logoUrl: string | null;
32
32
  siteUrl: string;
33
33
  domain: string;
34
+ metaPixelId: string | null;
34
35
  };
35
36
  isExpired: boolean;
36
37
  usagePercentage: number;
@@ -80,6 +81,7 @@ export declare function useGetDiscountCode(codeId: string, options?: Omit<UseQue
80
81
  logoUrl: string | null;
81
82
  siteUrl: string;
82
83
  domain: string;
84
+ metaPixelId: string | null;
83
85
  };
84
86
  isExpired: boolean;
85
87
  usagePercentage: number;
@@ -128,6 +130,7 @@ export declare function useCreateDiscountCode(options?: UseMutationOptions<Await
128
130
  logoUrl: string | null;
129
131
  siteUrl: string;
130
132
  domain: string;
133
+ metaPixelId: string | null;
131
134
  };
132
135
  isExpired: boolean;
133
136
  usagePercentage: number;
@@ -171,6 +174,7 @@ export declare function useUpdateDiscountCode(codeId: string, options?: UseMutat
171
174
  logoUrl: string | null;
172
175
  siteUrl: string;
173
176
  domain: string;
177
+ metaPixelId: string | null;
174
178
  };
175
179
  isExpired: boolean;
176
180
  usagePercentage: number;
@@ -249,6 +253,7 @@ export declare function useGetDiscountCodeAnalytics(codeId: string, options?: Om
249
253
  logoUrl: string | null;
250
254
  siteUrl: string;
251
255
  domain: string;
256
+ metaPixelId: string | null;
252
257
  };
253
258
  isExpired: boolean;
254
259
  id: string;
@@ -37,6 +37,7 @@ export declare function useListOrders(options?: Omit<UseQueryOptions<Awaited<Ret
37
37
  logoUrl: string | null;
38
38
  siteUrl: string;
39
39
  domain: string;
40
+ metaPixelId: string | null;
40
41
  };
41
42
  deliveryZone: {
42
43
  deliveryCost: number;
@@ -312,6 +313,7 @@ export declare function useGetOrder(orderId: string, options?: Omit<UseQueryOpti
312
313
  logoUrl: string | null;
313
314
  siteUrl: string;
314
315
  domain: string;
316
+ metaPixelId: string | null;
315
317
  };
316
318
  deliveryZone: {
317
319
  deliveryCost: number;
@@ -584,6 +586,7 @@ export declare function useCreateOrder(options?: UseMutationOptions<Awaited<Retu
584
586
  logoUrl: string | null;
585
587
  siteUrl: string;
586
588
  domain: string;
589
+ metaPixelId: string | null;
587
590
  };
588
591
  deliveryZone: {
589
592
  deliveryCost: number;
@@ -857,6 +860,7 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
857
860
  logoUrl: string | null;
858
861
  siteUrl: string;
859
862
  domain: string;
863
+ metaPixelId: string | null;
860
864
  };
861
865
  deliveryZone: {
862
866
  deliveryCost: number;
@@ -1106,6 +1110,7 @@ export declare function useUpdateOrder(orderId: string, options?: UseMutationOpt
1106
1110
  logoUrl: string | null;
1107
1111
  siteUrl: string;
1108
1112
  domain: string;
1113
+ metaPixelId: string | null;
1109
1114
  createdAt: string;
1110
1115
  updatedAt: string;
1111
1116
  deletedAt: string;
@@ -14,6 +14,7 @@ export declare function useListProducts(brandId?: string, options?: Omit<UseQuer
14
14
  logoUrl: string | null;
15
15
  siteUrl: string;
16
16
  domain: string;
17
+ metaPixelId: string | null;
17
18
  };
18
19
  variants: {
19
20
  createdAt: string;
@@ -196,6 +197,7 @@ export declare function useGetProduct(productId: string, options?: Omit<UseQuery
196
197
  logoUrl: string | null;
197
198
  siteUrl: string;
198
199
  domain: string;
200
+ metaPixelId: string | null;
199
201
  };
200
202
  variants: {
201
203
  createdAt: string;
@@ -36,6 +36,7 @@ export declare function useGetStats(params?: {
36
36
  logoUrl: string | null;
37
37
  siteUrl: string;
38
38
  domain: string;
39
+ metaPixelId: string | null;
39
40
  };
40
41
  deliveryZone: {
41
42
  deliveryCost: number;
@@ -70,6 +70,7 @@ export declare function useGetWarehouseInventory(warehouseId: string, options?:
70
70
  logoUrl: string | null;
71
71
  siteUrl: string;
72
72
  domain: string;
73
+ metaPixelId: string | null;
73
74
  createdAt: string;
74
75
  updatedAt: string;
75
76
  deletedAt: string;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Type-safe RPC hooks for brand operations
3
+ *
4
+ * These hooks use Hono RPC client with types directly from the backend,
5
+ * providing end-to-end type safety without code generation.
6
+ */
7
+ import { UseQueryOptions } from '@tanstack/react-query';
8
+ import { fetchBrandBySlug } from '../../fetchers/brands';
9
+ /**
10
+ * Hook to get brand configuration by slug using RPC
11
+ *
12
+ * @param slug - Brand slug (e.g., 'my-brand')
13
+ * @param options - React Query options
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * const { data: brand } = useGetBrand('my-brand');
18
+ * if (brand?.metaPixelId) {
19
+ * // Initialize Meta Pixel tracking
20
+ * }
21
+ * ```
22
+ */
23
+ export declare function useGetBrand(slug: string, options?: Omit<UseQueryOptions<Awaited<ReturnType<typeof fetchBrandBySlug>>, Error>, 'queryKey' | 'queryFn'>): import("@tanstack/react-query").UseQueryResult<{
24
+ name: string;
25
+ id: string;
26
+ slug: string;
27
+ logoUrl: string;
28
+ siteUrl: string;
29
+ domain: string;
30
+ metaPixelId: string;
31
+ createdAt: string;
32
+ updatedAt: string;
33
+ }, Error>;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Type-safe RPC hooks for brand operations
3
+ *
4
+ * These hooks use Hono RPC client with types directly from the backend,
5
+ * providing end-to-end type safety without code generation.
6
+ */
7
+ import { useQueryUnwrapped } from '../use-query-unwrapped';
8
+ import { queryKeys } from '../../utils/query-keys';
9
+ import { fetchBrandBySlug } from '../../fetchers/brands';
10
+ /**
11
+ * Hook to get brand configuration by slug using RPC
12
+ *
13
+ * @param slug - Brand slug (e.g., 'my-brand')
14
+ * @param options - React Query options
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const { data: brand } = useGetBrand('my-brand');
19
+ * if (brand?.metaPixelId) {
20
+ * // Initialize Meta Pixel tracking
21
+ * }
22
+ * ```
23
+ */
24
+ export function useGetBrand(slug, options) {
25
+ return useQueryUnwrapped({
26
+ queryKey: queryKeys.public.brands.detail(slug),
27
+ queryFn: () => fetchBrandBySlug(slug),
28
+ ...options,
29
+ });
30
+ }
@@ -30,6 +30,7 @@ export declare function useGetCart(cartId: string, options?: Omit<UseQueryOption
30
30
  logoUrl: string | null;
31
31
  siteUrl: string;
32
32
  domain: string;
33
+ metaPixelId: string | null;
33
34
  };
34
35
  customerPhone: string;
35
36
  customerEmail: string;
@@ -289,6 +290,7 @@ export declare function useUpdateCart(cartId: string, options?: UseMutationOptio
289
290
  logoUrl: string | null;
290
291
  siteUrl: string;
291
292
  domain: string;
293
+ metaPixelId: string | null;
292
294
  };
293
295
  customerPhone: string;
294
296
  customerEmail: string;
@@ -556,6 +558,7 @@ export declare function useCreateCart(options?: UseMutationOptions<Awaited<Retur
556
558
  logoUrl: string | null;
557
559
  siteUrl: string;
558
560
  domain: string;
561
+ metaPixelId: string | null;
559
562
  };
560
563
  customerPhone: string;
561
564
  customerEmail: string;
@@ -814,6 +817,7 @@ export declare function useApplyDiscount(cartId: string, options?: UseMutationOp
814
817
  logoUrl: string | null;
815
818
  siteUrl: string;
816
819
  domain: string;
820
+ metaPixelId: string | null;
817
821
  };
818
822
  customerPhone: string;
819
823
  customerEmail: string;
@@ -1083,6 +1087,7 @@ export declare function useRemoveDiscount(cartId: string, options?: UseMutationO
1083
1087
  logoUrl: string | null;
1084
1088
  siteUrl: string;
1085
1089
  domain: string;
1090
+ metaPixelId: string | null;
1086
1091
  };
1087
1092
  customerPhone: string;
1088
1093
  customerEmail: string;
@@ -1325,12 +1330,14 @@ export declare function useRemoveDiscount(cartId: string, options?: UseMutationO
1325
1330
  * @example
1326
1331
  * ```tsx
1327
1332
  * const addItem = useAddCartItem('cart-123');
1328
- * addItem.mutate({ sku: 'PROD-001', quantity: 2 });
1333
+ * addItem.mutate({ sku: 'PROD-001', quantity: 2, fbc: '_fbc_cookie', fbp: '_fbp_cookie' });
1329
1334
  * ```
1330
1335
  */
1331
1336
  export declare function useAddCartItem(cartId: string, options?: UseMutationOptions<Awaited<ReturnType<typeof addCartItem>>, Error, {
1332
1337
  sku: string;
1333
1338
  quantity: number;
1339
+ fbc?: string;
1340
+ fbp?: string;
1334
1341
  }>): import("@tanstack/react-query").UseMutationResult<{
1335
1342
  error: {
1336
1343
  code: string;
@@ -1349,6 +1356,7 @@ export declare function useAddCartItem(cartId: string, options?: UseMutationOpti
1349
1356
  logoUrl: string | null;
1350
1357
  siteUrl: string;
1351
1358
  domain: string;
1359
+ metaPixelId: string | null;
1352
1360
  };
1353
1361
  customerPhone: string;
1354
1362
  customerEmail: string;
@@ -1584,6 +1592,8 @@ export declare function useAddCartItem(cartId: string, options?: UseMutationOpti
1584
1592
  }, Error, {
1585
1593
  sku: string;
1586
1594
  quantity: number;
1595
+ fbc?: string;
1596
+ fbp?: string;
1587
1597
  }, unknown>;
1588
1598
  /**
1589
1599
  * Hook to update cart item quantity using RPC
@@ -1613,6 +1623,7 @@ export declare function useUpdateCartItem(cartId: string, options?: UseMutationO
1613
1623
  logoUrl: string | null;
1614
1624
  siteUrl: string;
1615
1625
  domain: string;
1626
+ metaPixelId: string | null;
1616
1627
  };
1617
1628
  customerPhone: string;
1618
1629
  customerEmail: string;
@@ -1874,6 +1885,7 @@ export declare function useRemoveCartItem(cartId: string, options?: UseMutationO
1874
1885
  logoUrl: string | null;
1875
1886
  siteUrl: string;
1876
1887
  domain: string;
1888
+ metaPixelId: string | null;
1877
1889
  };
1878
1890
  customerPhone: string;
1879
1891
  customerEmail: string;
@@ -2148,6 +2160,7 @@ export declare function useCheckoutCart(cartId: string, options?: UseMutationOpt
2148
2160
  logoUrl: string | null;
2149
2161
  siteUrl: string;
2150
2162
  domain: string;
2163
+ metaPixelId: string | null;
2151
2164
  };
2152
2165
  deliveryZone: {
2153
2166
  deliveryCost: number;
@@ -2395,4 +2408,6 @@ export declare function useCheckoutCart(cartId: string, options?: UseMutationOpt
2395
2408
  paymentMethod: "cod" | "online";
2396
2409
  paystackReference?: string;
2397
2410
  ifUnmodifiedSince?: string;
2411
+ fbc?: string;
2412
+ fbp?: string;
2398
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
  },
@@ -7,3 +7,4 @@ export * from './carts';
7
7
  export * from './orders';
8
8
  export * from './products';
9
9
  export * from './delivery-zones';
10
+ export * from './brands';
@@ -7,3 +7,4 @@ export * from './carts';
7
7
  export * from './orders';
8
8
  export * from './products';
9
9
  export * from './delivery-zones';
10
+ export * from './brands';
@@ -41,6 +41,7 @@ export declare function useGetOrder(orderId: string, token: string, options?: Om
41
41
  logoUrl: string | null;
42
42
  siteUrl: string;
43
43
  domain: string;
44
+ metaPixelId: string | null;
44
45
  };
45
46
  deliveryZone: {
46
47
  deliveryCost: number;
@@ -29,6 +29,7 @@ export declare function useGetProducts(brandId: string, options?: Omit<UseQueryO
29
29
  logoUrl: string | null;
30
30
  siteUrl: string;
31
31
  domain: string;
32
+ metaPixelId: string | null;
32
33
  };
33
34
  variants: {
34
35
  createdAt: string;
@@ -223,6 +224,7 @@ export declare function useGetProduct(slug: string, options?: Omit<UseQueryOptio
223
224
  logoUrl: string | null;
224
225
  siteUrl: string;
225
226
  domain: string;
227
+ metaPixelId: string | null;
226
228
  };
227
229
  variants: {
228
230
  createdAt: string;
@@ -44,6 +44,7 @@ export declare function createRpcClients(baseURL: string): {
44
44
  logoUrl: string | null;
45
45
  siteUrl: string;
46
46
  domain: string;
47
+ metaPixelId: string | null;
47
48
  };
48
49
  customerPhone: string;
49
50
  customerEmail: string;
@@ -324,6 +325,7 @@ export declare function createRpcClients(baseURL: string): {
324
325
  logoUrl: string | null;
325
326
  siteUrl: string;
326
327
  domain: string;
328
+ metaPixelId: string | null;
327
329
  };
328
330
  customerPhone: string;
329
331
  customerEmail: string;
@@ -592,6 +594,7 @@ export declare function createRpcClients(baseURL: string): {
592
594
  logoUrl: string | null;
593
595
  siteUrl: string;
594
596
  domain: string;
597
+ metaPixelId: string | null;
595
598
  };
596
599
  customerPhone: string;
597
600
  customerEmail: string;
@@ -877,6 +880,7 @@ export declare function createRpcClients(baseURL: string): {
877
880
  logoUrl: string | null;
878
881
  siteUrl: string;
879
882
  domain: string;
883
+ metaPixelId: string | null;
880
884
  };
881
885
  customerPhone: string;
882
886
  customerEmail: string;
@@ -1178,6 +1182,7 @@ export declare function createRpcClients(baseURL: string): {
1178
1182
  logoUrl: string | null;
1179
1183
  siteUrl: string;
1180
1184
  domain: string;
1185
+ metaPixelId: string | null;
1181
1186
  };
1182
1187
  customerPhone: string;
1183
1188
  customerEmail: string;
@@ -1466,6 +1471,7 @@ export declare function createRpcClients(baseURL: string): {
1466
1471
  logoUrl: string | null;
1467
1472
  siteUrl: string;
1468
1473
  domain: string;
1474
+ metaPixelId: string | null;
1469
1475
  };
1470
1476
  customerPhone: string;
1471
1477
  customerEmail: string;
@@ -1775,6 +1781,7 @@ export declare function createRpcClients(baseURL: string): {
1775
1781
  logoUrl: string | null;
1776
1782
  siteUrl: string;
1777
1783
  domain: string;
1784
+ metaPixelId: string | null;
1778
1785
  };
1779
1786
  customerPhone: string;
1780
1787
  customerEmail: string;
@@ -2081,6 +2088,7 @@ export declare function createRpcClients(baseURL: string): {
2081
2088
  logoUrl: string | null;
2082
2089
  siteUrl: string;
2083
2090
  domain: string;
2091
+ metaPixelId: string | null;
2084
2092
  };
2085
2093
  customerPhone: string;
2086
2094
  customerEmail: string;
@@ -2421,6 +2429,7 @@ export declare function createRpcClients(baseURL: string): {
2421
2429
  logoUrl: string | null;
2422
2430
  siteUrl: string;
2423
2431
  domain: string;
2432
+ metaPixelId: string | null;
2424
2433
  };
2425
2434
  deliveryZone: {
2426
2435
  deliveryCost: number;
@@ -2727,6 +2736,7 @@ export declare function createRpcClients(baseURL: string): {
2727
2736
  logoUrl: string | null;
2728
2737
  siteUrl: string;
2729
2738
  domain: string;
2739
+ metaPixelId: string | null;
2730
2740
  };
2731
2741
  deliveryZone: {
2732
2742
  deliveryCost: number;
@@ -3034,6 +3044,7 @@ export declare function createRpcClients(baseURL: string): {
3034
3044
  logoUrl: string | null;
3035
3045
  siteUrl: string;
3036
3046
  domain: string;
3047
+ metaPixelId: string | null;
3037
3048
  };
3038
3049
  variants: {
3039
3050
  createdAt: string;
@@ -3257,6 +3268,7 @@ export declare function createRpcClients(baseURL: string): {
3257
3268
  logoUrl: string | null;
3258
3269
  siteUrl: string;
3259
3270
  domain: string;
3271
+ metaPixelId: string | null;
3260
3272
  };
3261
3273
  variants: {
3262
3274
  createdAt: string;
@@ -3480,6 +3492,44 @@ export declare function createRpcClients(baseURL: string): {
3480
3492
  };
3481
3493
  }>;
3482
3494
  };
3495
+ brands: {
3496
+ ":slug": import("hono/client").ClientRequest<{
3497
+ $get: {
3498
+ input: {
3499
+ param: {
3500
+ slug: string;
3501
+ };
3502
+ };
3503
+ output: {
3504
+ error: {
3505
+ code: string;
3506
+ message: string;
3507
+ };
3508
+ };
3509
+ outputFormat: "json";
3510
+ status: 404;
3511
+ } | {
3512
+ input: {
3513
+ param: {
3514
+ slug: string;
3515
+ };
3516
+ };
3517
+ output: {
3518
+ name: string;
3519
+ id: string;
3520
+ slug: string;
3521
+ logoUrl: string;
3522
+ siteUrl: string;
3523
+ domain: string;
3524
+ metaPixelId: string;
3525
+ createdAt: string;
3526
+ updatedAt: string;
3527
+ };
3528
+ outputFormat: "json";
3529
+ status: 200;
3530
+ };
3531
+ }>;
3532
+ };
3483
3533
  };
3484
3534
  /**
3485
3535
  * Create typed RPC clients for all admin endpoints
@@ -3521,6 +3571,7 @@ export declare function createAdminRpcClients(baseURL: string): {
3521
3571
  logoUrl: string | null;
3522
3572
  siteUrl: string;
3523
3573
  domain: string;
3574
+ metaPixelId: string | null;
3524
3575
  };
3525
3576
  deliveryZone: {
3526
3577
  deliveryCost: number;
@@ -3805,6 +3856,7 @@ export declare function createAdminRpcClients(baseURL: string): {
3805
3856
  logoUrl: string | null;
3806
3857
  siteUrl: string;
3807
3858
  domain: string;
3859
+ metaPixelId: string | null;
3808
3860
  };
3809
3861
  deliveryZone: {
3810
3862
  deliveryCost: number;
@@ -4105,6 +4157,7 @@ export declare function createAdminRpcClients(baseURL: string): {
4105
4157
  logoUrl: string | null;
4106
4158
  siteUrl: string;
4107
4159
  domain: string;
4160
+ metaPixelId: string | null;
4108
4161
  };
4109
4162
  deliveryZone: {
4110
4163
  deliveryCost: number;
@@ -4386,6 +4439,7 @@ export declare function createAdminRpcClients(baseURL: string): {
4386
4439
  logoUrl: string | null;
4387
4440
  siteUrl: string;
4388
4441
  domain: string;
4442
+ metaPixelId: string | null;
4389
4443
  };
4390
4444
  deliveryZone: {
4391
4445
  deliveryCost: number;
@@ -4653,6 +4707,7 @@ export declare function createAdminRpcClients(baseURL: string): {
4653
4707
  logoUrl: string | null;
4654
4708
  siteUrl: string;
4655
4709
  domain: string;
4710
+ metaPixelId: string | null;
4656
4711
  createdAt: string;
4657
4712
  updatedAt: string;
4658
4713
  deletedAt: string;
@@ -4975,6 +5030,7 @@ export declare function createAdminRpcClients(baseURL: string): {
4975
5030
  logoUrl: string | null;
4976
5031
  siteUrl: string;
4977
5032
  domain: string;
5033
+ metaPixelId: string | null;
4978
5034
  createdAt: string;
4979
5035
  updatedAt: string;
4980
5036
  deletedAt: string;
@@ -5002,6 +5058,7 @@ export declare function createAdminRpcClients(baseURL: string): {
5002
5058
  logoUrl: string | null;
5003
5059
  siteUrl: string;
5004
5060
  domain: string;
5061
+ metaPixelId: string | null;
5005
5062
  createdAt: string;
5006
5063
  updatedAt: string;
5007
5064
  deletedAt: string;
@@ -5049,6 +5106,7 @@ export declare function createAdminRpcClients(baseURL: string): {
5049
5106
  logoUrl: string | null;
5050
5107
  siteUrl: string;
5051
5108
  domain: string;
5109
+ metaPixelId: string | null;
5052
5110
  createdAt: string;
5053
5111
  updatedAt: string;
5054
5112
  deletedAt: string;
@@ -5084,6 +5142,7 @@ export declare function createAdminRpcClients(baseURL: string): {
5084
5142
  logoUrl: string | null;
5085
5143
  siteUrl: string;
5086
5144
  domain: string;
5145
+ metaPixelId: string | null;
5087
5146
  createdAt: string;
5088
5147
  updatedAt: string;
5089
5148
  deletedAt: string;
@@ -5142,6 +5201,7 @@ export declare function createAdminRpcClients(baseURL: string): {
5142
5201
  logoUrl: string | null;
5143
5202
  siteUrl: string;
5144
5203
  domain: string;
5204
+ metaPixelId: string | null;
5145
5205
  };
5146
5206
  variants: {
5147
5207
  createdAt: string;
@@ -5340,6 +5400,7 @@ export declare function createAdminRpcClients(baseURL: string): {
5340
5400
  logoUrl: string | null;
5341
5401
  siteUrl: string;
5342
5402
  domain: string;
5403
+ metaPixelId: string | null;
5343
5404
  };
5344
5405
  variants: {
5345
5406
  createdAt: string;
@@ -5559,6 +5620,7 @@ export declare function createAdminRpcClients(baseURL: string): {
5559
5620
  logoUrl: string | null;
5560
5621
  siteUrl: string;
5561
5622
  domain: string;
5623
+ metaPixelId: string | null;
5562
5624
  };
5563
5625
  variants: {
5564
5626
  createdAt: string;
@@ -5765,6 +5827,7 @@ export declare function createAdminRpcClients(baseURL: string): {
5765
5827
  logoUrl: string | null;
5766
5828
  siteUrl: string;
5767
5829
  domain: string;
5830
+ metaPixelId: string | null;
5768
5831
  };
5769
5832
  variants: {
5770
5833
  createdAt: string;
@@ -6362,6 +6425,7 @@ export declare function createAdminRpcClients(baseURL: string): {
6362
6425
  logoUrl: string | null;
6363
6426
  siteUrl: string;
6364
6427
  domain: string;
6428
+ metaPixelId: string | null;
6365
6429
  createdAt: string;
6366
6430
  updatedAt: string;
6367
6431
  deletedAt: string;
@@ -6903,6 +6967,7 @@ export declare function createAdminRpcClients(baseURL: string): {
6903
6967
  logoUrl: string | null;
6904
6968
  siteUrl: string;
6905
6969
  domain: string;
6970
+ metaPixelId: string | null;
6906
6971
  };
6907
6972
  deliveryZone: {
6908
6973
  deliveryCost: number;
@@ -7188,6 +7253,7 @@ export declare function createAdminRpcClients(baseURL: string): {
7188
7253
  logoUrl: string | null;
7189
7254
  siteUrl: string;
7190
7255
  domain: string;
7256
+ metaPixelId: string | null;
7191
7257
  };
7192
7258
  deliveryZone: {
7193
7259
  deliveryCost: number;
@@ -7458,6 +7524,7 @@ export declare function createAdminRpcClients(baseURL: string): {
7458
7524
  logoUrl: string | null;
7459
7525
  siteUrl: string;
7460
7526
  domain: string;
7527
+ metaPixelId: string | null;
7461
7528
  };
7462
7529
  customerPhone: string;
7463
7530
  customerEmail: string;
@@ -7740,6 +7807,7 @@ export declare function createAdminRpcClients(baseURL: string): {
7740
7807
  logoUrl: string | null;
7741
7808
  siteUrl: string;
7742
7809
  domain: string;
7810
+ metaPixelId: string | null;
7743
7811
  };
7744
7812
  customerPhone: string;
7745
7813
  customerEmail: string;
@@ -8064,6 +8132,7 @@ export declare function createAdminRpcClients(baseURL: string): {
8064
8132
  logoUrl: string | null;
8065
8133
  siteUrl: string;
8066
8134
  domain: string;
8135
+ metaPixelId: string | null;
8067
8136
  };
8068
8137
  isExpired: boolean;
8069
8138
  usagePercentage: number;
@@ -8142,6 +8211,7 @@ export declare function createAdminRpcClients(baseURL: string): {
8142
8211
  logoUrl: string | null;
8143
8212
  siteUrl: string;
8144
8213
  domain: string;
8214
+ metaPixelId: string | null;
8145
8215
  };
8146
8216
  isExpired: boolean;
8147
8217
  usagePercentage: number;
@@ -8217,6 +8287,7 @@ export declare function createAdminRpcClients(baseURL: string): {
8217
8287
  logoUrl: string | null;
8218
8288
  siteUrl: string;
8219
8289
  domain: string;
8290
+ metaPixelId: string | null;
8220
8291
  };
8221
8292
  isExpired: boolean;
8222
8293
  usagePercentage: number;
@@ -8304,6 +8375,7 @@ export declare function createAdminRpcClients(baseURL: string): {
8304
8375
  logoUrl: string | null;
8305
8376
  siteUrl: string;
8306
8377
  domain: string;
8378
+ metaPixelId: string | null;
8307
8379
  };
8308
8380
  isExpired: boolean;
8309
8381
  usagePercentage: number;
@@ -8421,6 +8493,7 @@ export declare function createAdminRpcClients(baseURL: string): {
8421
8493
  logoUrl: string | null;
8422
8494
  siteUrl: string;
8423
8495
  domain: string;
8496
+ metaPixelId: string | null;
8424
8497
  };
8425
8498
  isExpired: boolean;
8426
8499
  id: string;
@@ -8532,6 +8605,7 @@ export declare function createAdminRpcClients(baseURL: string): {
8532
8605
  logoUrl: string | null;
8533
8606
  siteUrl: string;
8534
8607
  domain: string;
8608
+ metaPixelId: string | null;
8535
8609
  };
8536
8610
  stateName: string;
8537
8611
  brandName: string;
@@ -8717,6 +8791,7 @@ export declare function createAdminRpcClients(baseURL: string): {
8717
8791
  logoUrl: string | null;
8718
8792
  siteUrl: string;
8719
8793
  domain: string;
8794
+ metaPixelId: string | null;
8720
8795
  };
8721
8796
  stateName: string;
8722
8797
  brandName: string;
@@ -8790,6 +8865,7 @@ export declare function createAdminRpcClients(baseURL: string): {
8790
8865
  logoUrl: string | null;
8791
8866
  siteUrl: string;
8792
8867
  domain: string;
8868
+ metaPixelId: string | null;
8793
8869
  };
8794
8870
  stateName: string;
8795
8871
  brandName: string;
@@ -8878,6 +8954,7 @@ export declare function createAdminRpcClients(baseURL: string): {
8878
8954
  logoUrl: string | null;
8879
8955
  siteUrl: string;
8880
8956
  domain: string;
8957
+ metaPixelId: string | null;
8881
8958
  };
8882
8959
  stateName: string;
8883
8960
  brandName: string;
@@ -18,7 +18,6 @@ import { hc } from 'hono/client';
18
18
  * const data = await res.json(); // Fully typed!
19
19
  * ```
20
20
  */
21
- // @ts-expect-error - Prisma types leak through Hono RPC but types are correct
22
21
  export function createRpcClients(baseURL) {
23
22
  const fullBaseUrl = `${baseURL}/v1`;
24
23
  return {
@@ -26,6 +25,7 @@ export function createRpcClients(baseURL) {
26
25
  orders: hc(`${fullBaseUrl}/orders`),
27
26
  products: hc(`${fullBaseUrl}/products`),
28
27
  deliveryZones: hc(`${fullBaseUrl}/delivery-zones`),
28
+ brands: hc(`${fullBaseUrl}/brands`),
29
29
  };
30
30
  }
31
31
  /**
@@ -43,7 +43,6 @@ export function createRpcClients(baseURL) {
43
43
  * const data = await res.json(); // Fully typed!
44
44
  * ```
45
45
  */
46
- // @ts-expect-error - Prisma types leak through Hono RPC but types are correct
47
46
  export function createAdminRpcClients(baseURL) {
48
47
  const fullBaseUrl = `${baseURL}/v1/admin`;
49
48
  return {
@@ -26,6 +26,10 @@ export declare const queryKeys: {
26
26
  all: readonly ["public", "delivery-zones"];
27
27
  list: (brandId?: string) => readonly ["public", "delivery-zones", string];
28
28
  };
29
+ brands: {
30
+ all: readonly ["public", "brands"];
31
+ detail: (slug: string) => readonly ["public", "brands", string];
32
+ };
29
33
  };
30
34
  admin: {
31
35
  all: readonly ["admin"];
@@ -27,6 +27,10 @@ export const queryKeys = {
27
27
  all: ['public', 'delivery-zones'],
28
28
  list: (brandId) => ['public', 'delivery-zones', brandId],
29
29
  },
30
+ brands: {
31
+ all: ['public', 'brands'],
32
+ detail: (slug) => ['public', 'brands', slug],
33
+ },
30
34
  },
31
35
  // Admin API keys (RPC is now the default)
32
36
  admin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instockng/api-client",
3
- "version": "1.0.1",
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",
@@ -12,19 +12,16 @@
12
12
  "./fetchers": {
13
13
  "types": "./dist/fetchers/index.d.ts",
14
14
  "import": "./dist/fetchers/index.js"
15
+ },
16
+ "./admin": {
17
+ "types": "./dist/hooks/admin/index.d.ts",
18
+ "import": "./dist/hooks/admin/index.js"
15
19
  }
16
20
  },
17
21
  "files": [
18
22
  "dist",
19
23
  "README.md"
20
24
  ],
21
- "scripts": {
22
- "type-check": "tsc --noEmit",
23
- "build": "tsc --project tsconfig.build.json --noEmitOnError false",
24
- "generate-types": "node scripts/generate-backend-types.mjs",
25
- "prebuild": "pnpm run generate-types",
26
- "prepublishOnly": "pnpm run generate-types"
27
- },
28
25
  "keywords": [
29
26
  "api",
30
27
  "react-query",
@@ -48,5 +45,11 @@
48
45
  "axios": "^1.6.5",
49
46
  "react": "^19.0.0",
50
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"
51
54
  }
52
- }
55
+ }