@instockng/storefront-ui 1.0.0

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.
Files changed (152) hide show
  1. package/README.md +394 -0
  2. package/dist/components/CartItem.d.ts +15 -0
  3. package/dist/components/CartItem.d.ts.map +1 -0
  4. package/dist/components/Checkout.d.ts +39 -0
  5. package/dist/components/Checkout.d.ts.map +1 -0
  6. package/dist/components/DiscountCodeInput.d.ts +20 -0
  7. package/dist/components/DiscountCodeInput.d.ts.map +1 -0
  8. package/dist/components/OrderConfirmation.d.ts +30 -0
  9. package/dist/components/OrderConfirmation.d.ts.map +1 -0
  10. package/dist/components/ProductCard.d.ts +42 -0
  11. package/dist/components/ProductCard.d.ts.map +1 -0
  12. package/dist/components/ProductGrid.d.ts +33 -0
  13. package/dist/components/ProductGrid.d.ts.map +1 -0
  14. package/dist/components/ShoppingCart.d.ts +28 -0
  15. package/dist/components/ShoppingCart.d.ts.map +1 -0
  16. package/dist/components/ui/badge.d.ts +10 -0
  17. package/dist/components/ui/badge.d.ts.map +1 -0
  18. package/dist/components/ui/button.d.ts +12 -0
  19. package/dist/components/ui/button.d.ts.map +1 -0
  20. package/dist/components/ui/card.d.ts +9 -0
  21. package/dist/components/ui/card.d.ts.map +1 -0
  22. package/dist/components/ui/form-input.d.ts +20 -0
  23. package/dist/components/ui/form-input.d.ts.map +1 -0
  24. package/dist/components/ui/form-select.d.ts +18 -0
  25. package/dist/components/ui/form-select.d.ts.map +1 -0
  26. package/dist/components/ui/modal.d.ts +31 -0
  27. package/dist/components/ui/modal.d.ts.map +1 -0
  28. package/dist/contexts/CartContext.d.ts +60 -0
  29. package/dist/contexts/CartContext.d.ts.map +1 -0
  30. package/dist/hooks/usePaystackPayment.d.ts +46 -0
  31. package/dist/hooks/usePaystackPayment.d.ts.map +1 -0
  32. package/dist/index.d.ts +34 -0
  33. package/dist/index.d.ts.map +1 -0
  34. package/dist/index.mjs +99 -0
  35. package/dist/index10.mjs +644 -0
  36. package/dist/index100.mjs +7 -0
  37. package/dist/index101.mjs +35 -0
  38. package/dist/index102.mjs +33 -0
  39. package/dist/index103.mjs +30 -0
  40. package/dist/index104.mjs +63 -0
  41. package/dist/index105.mjs +5 -0
  42. package/dist/index106.mjs +4 -0
  43. package/dist/index107.mjs +4 -0
  44. package/dist/index108.mjs +19 -0
  45. package/dist/index109.mjs +15 -0
  46. package/dist/index11.mjs +62 -0
  47. package/dist/index110.mjs +8 -0
  48. package/dist/index111.mjs +32 -0
  49. package/dist/index12.mjs +64 -0
  50. package/dist/index13.mjs +26 -0
  51. package/dist/index14.mjs +117 -0
  52. package/dist/index15.mjs +44 -0
  53. package/dist/index16.mjs +44 -0
  54. package/dist/index17.mjs +44 -0
  55. package/dist/index18.mjs +43 -0
  56. package/dist/index19.mjs +11 -0
  57. package/dist/index2.mjs +24 -0
  58. package/dist/index20.mjs +29 -0
  59. package/dist/index21.mjs +34 -0
  60. package/dist/index22.mjs +22 -0
  61. package/dist/index23.mjs +90 -0
  62. package/dist/index24.mjs +22 -0
  63. package/dist/index25.mjs +13 -0
  64. package/dist/index26.mjs +99 -0
  65. package/dist/index27.mjs +20 -0
  66. package/dist/index28.mjs +67 -0
  67. package/dist/index29.mjs +98 -0
  68. package/dist/index3.mjs +121 -0
  69. package/dist/index30.mjs +21 -0
  70. package/dist/index31.mjs +21 -0
  71. package/dist/index32.mjs +13 -0
  72. package/dist/index33.mjs +6 -0
  73. package/dist/index34.mjs +1435 -0
  74. package/dist/index35.mjs +4 -0
  75. package/dist/index36.mjs +59 -0
  76. package/dist/index37.mjs +53 -0
  77. package/dist/index38.mjs +35 -0
  78. package/dist/index39.mjs +17 -0
  79. package/dist/index4.mjs +201 -0
  80. package/dist/index40.mjs +2265 -0
  81. package/dist/index41.mjs +25 -0
  82. package/dist/index42.mjs +38 -0
  83. package/dist/index43.mjs +46 -0
  84. package/dist/index44.mjs +101 -0
  85. package/dist/index45.mjs +114 -0
  86. package/dist/index46.mjs +78 -0
  87. package/dist/index47.mjs +89 -0
  88. package/dist/index48.mjs +106 -0
  89. package/dist/index49.mjs +87 -0
  90. package/dist/index5.mjs +112 -0
  91. package/dist/index50.mjs +76 -0
  92. package/dist/index51.mjs +20 -0
  93. package/dist/index52.mjs +19 -0
  94. package/dist/index53.mjs +64 -0
  95. package/dist/index54.mjs +131 -0
  96. package/dist/index55.mjs +135 -0
  97. package/dist/index56.mjs +77 -0
  98. package/dist/index57.mjs +17 -0
  99. package/dist/index58.mjs +65 -0
  100. package/dist/index59.mjs +6 -0
  101. package/dist/index6.mjs +82 -0
  102. package/dist/index60.mjs +4 -0
  103. package/dist/index61.mjs +7 -0
  104. package/dist/index62.mjs +36 -0
  105. package/dist/index63.mjs +45 -0
  106. package/dist/index64.mjs +237 -0
  107. package/dist/index65.mjs +8 -0
  108. package/dist/index66.mjs +136 -0
  109. package/dist/index67.mjs +70 -0
  110. package/dist/index68.mjs +89 -0
  111. package/dist/index69.mjs +31 -0
  112. package/dist/index7.mjs +100 -0
  113. package/dist/index70.mjs +11 -0
  114. package/dist/index71.mjs +77 -0
  115. package/dist/index72.mjs +6 -0
  116. package/dist/index73.mjs +4 -0
  117. package/dist/index74.mjs +85 -0
  118. package/dist/index75.mjs +56 -0
  119. package/dist/index76.mjs +8 -0
  120. package/dist/index77.mjs +7 -0
  121. package/dist/index78.mjs +181 -0
  122. package/dist/index79.mjs +55 -0
  123. package/dist/index8.mjs +165 -0
  124. package/dist/index80.mjs +71 -0
  125. package/dist/index81.mjs +23 -0
  126. package/dist/index82.mjs +58 -0
  127. package/dist/index83.mjs +31 -0
  128. package/dist/index84.mjs +9 -0
  129. package/dist/index85.mjs +54 -0
  130. package/dist/index86.mjs +8 -0
  131. package/dist/index87.mjs +14 -0
  132. package/dist/index88.mjs +9 -0
  133. package/dist/index89.mjs +30 -0
  134. package/dist/index9.mjs +100 -0
  135. package/dist/index90.mjs +4 -0
  136. package/dist/index91.mjs +72 -0
  137. package/dist/index92.mjs +169 -0
  138. package/dist/index93.mjs +15 -0
  139. package/dist/index94.mjs +9 -0
  140. package/dist/index95.mjs +33 -0
  141. package/dist/index96.mjs +13 -0
  142. package/dist/index97.mjs +6 -0
  143. package/dist/index98.mjs +6 -0
  144. package/dist/index99.mjs +14 -0
  145. package/dist/lib/utils.d.ts +7 -0
  146. package/dist/lib/utils.d.ts.map +1 -0
  147. package/dist/mockServiceWorker.js +349 -0
  148. package/dist/providers/StorefrontProvider.d.ts +47 -0
  149. package/dist/providers/StorefrontProvider.d.ts.map +1 -0
  150. package/dist/test-utils/MockCartProvider.d.ts +21 -0
  151. package/dist/test-utils/MockCartProvider.d.ts.map +1 -0
  152. package/package.json +77 -0
@@ -0,0 +1,43 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { createContext as p, useEffect as C, useMemo as f, useContext as m } from "react";
3
+ import { QueryClient as d, QueryClientProvider as x } from "@tanstack/react-query";
4
+ import { initializeApiClient as u } from "./index20.mjs";
5
+ const s = p(null);
6
+ function a({
7
+ children: e,
8
+ baseURL: t = "https://oms-api.instock.ng",
9
+ authToken: l,
10
+ onError: i,
11
+ queryClient: n
12
+ }) {
13
+ const o = {
14
+ baseURL: t,
15
+ onError: i
16
+ };
17
+ u(o), C(() => {
18
+ u(o);
19
+ }, [t, i]);
20
+ const c = f(
21
+ () => n || new d({
22
+ defaultOptions: {
23
+ queries: {
24
+ retry: 1,
25
+ refetchOnWindowFocus: !1,
26
+ staleTime: 5e3
27
+ }
28
+ }
29
+ }),
30
+ [n]
31
+ );
32
+ return /* @__PURE__ */ r(x, { client: c, children: /* @__PURE__ */ r(s.Provider, { value: { baseURL: t, authToken: l }, children: e }) });
33
+ }
34
+ function y() {
35
+ const e = m(s);
36
+ if (!e)
37
+ throw new Error("useApiClientContext must be used within ApiClientProvider");
38
+ return e;
39
+ }
40
+ export {
41
+ a as ApiClientProvider,
42
+ y as useApiClientContext
43
+ };
@@ -0,0 +1,11 @@
1
+ import { useApiClientContext as n } from "./index18.mjs";
2
+ function i() {
3
+ const { baseURL: t, authToken: e } = n();
4
+ return {
5
+ baseURL: t,
6
+ authToken: e || ""
7
+ };
8
+ }
9
+ export {
10
+ i as useApiConfig
11
+ };
@@ -0,0 +1,24 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { ApiClientProvider as n } from "./index18.mjs";
3
+ import "@tanstack/react-query";
4
+ import { CartProvider as f } from "./index3.mjs";
5
+ function c({
6
+ children: t,
7
+ brandSlug: i,
8
+ apiUrl: r,
9
+ initialCartId: e,
10
+ shoppingCartProps: m
11
+ }) {
12
+ return /* @__PURE__ */ o(n, { ...r && { baseURL: r }, children: /* @__PURE__ */ o(
13
+ f,
14
+ {
15
+ brandSlug: i,
16
+ initialCartId: e,
17
+ shoppingCartProps: m,
18
+ children: t
19
+ }
20
+ ) });
21
+ }
22
+ export {
23
+ c as StorefrontProvider
24
+ };
@@ -0,0 +1,29 @@
1
+ import "./index42.mjs";
2
+ import r from "./index43.mjs";
3
+ let e = null;
4
+ function p(t) {
5
+ return e = r.create({
6
+ baseURL: t.baseURL,
7
+ headers: {
8
+ "Content-Type": "application/json"
9
+ }
10
+ }), e.interceptors.response.use(
11
+ (i) => i,
12
+ (i) => (t.onError && t.onError(i), Promise.reject(i))
13
+ ), e;
14
+ }
15
+ function l() {
16
+ if (!e)
17
+ throw new Error(
18
+ "API client not initialized. Make sure to wrap your app with ApiClientProvider."
19
+ );
20
+ return e;
21
+ }
22
+ function a() {
23
+ e = null;
24
+ }
25
+ export {
26
+ l as getApiClient,
27
+ p as initializeApiClient,
28
+ a as resetApiClient
29
+ };
@@ -0,0 +1,34 @@
1
+ import { hc as e } from "./index44.mjs";
2
+ function n(s) {
3
+ const r = `${s}/v1`;
4
+ return {
5
+ carts: e(`${r}/carts`),
6
+ orders: e(`${r}/orders`),
7
+ products: e(`${r}/products`),
8
+ deliveryZones: e(`${r}/delivery-zones`)
9
+ };
10
+ }
11
+ function o(s) {
12
+ const r = `${s}/v1/admin`;
13
+ return {
14
+ orders: e(`${r}/orders`),
15
+ brands: e(`${r}/brands`),
16
+ products: e(`${r}/products`),
17
+ variants: e(`${r}/variants`),
18
+ warehouses: e(`${r}/warehouses`),
19
+ inventory: e(`${r}/inventory`),
20
+ customers: e(`${r}/customers`),
21
+ stats: e(`${r}/stats`),
22
+ abandonedCarts: e(`${r}/abandoned-carts`),
23
+ discountCodes: e(`${r}/discount-codes`),
24
+ deliveryZones: e(`${r}/delivery-zones`)
25
+ };
26
+ }
27
+ function a(s) {
28
+ return { headers: { Authorization: `Bearer ${s}` } };
29
+ }
30
+ export {
31
+ a as authHeaders,
32
+ o as createAdminRpcClients,
33
+ n as createRpcClients
34
+ };
@@ -0,0 +1,22 @@
1
+ import { createRpcClients as r } from "./index21.mjs";
2
+ const s = "https://oms-api.instock.ng";
3
+ async function e(o) {
4
+ const t = await r(s).products[":brandId"].$get({
5
+ param: { brandId: o }
6
+ });
7
+ if (!t.ok)
8
+ throw new Error(`Failed to fetch products: ${t.statusText}`);
9
+ return t.json();
10
+ }
11
+ async function a(o) {
12
+ const t = await r(s).products.product[":slug"].$get({
13
+ param: { slug: o }
14
+ });
15
+ if (!t.ok)
16
+ throw new Error(`Failed to fetch product: ${t.statusText}`);
17
+ return t.json();
18
+ }
19
+ export {
20
+ a as fetchProductBySlug,
21
+ e as fetchProductsByBrand
22
+ };
@@ -0,0 +1,90 @@
1
+ import { createRpcClients as r } from "./index21.mjs";
2
+ const o = "https://oms-api.instock.ng";
3
+ async function i(s) {
4
+ const t = await r(o).carts[":id"].$get({
5
+ param: { id: s }
6
+ });
7
+ if (!t.ok)
8
+ throw new Error(`Failed to fetch cart: ${t.statusText}`);
9
+ return t.json();
10
+ }
11
+ async function d(s) {
12
+ const t = await r(o).carts.index.$post({
13
+ json: { brandSlug: s }
14
+ });
15
+ if (!t.ok)
16
+ throw new Error(`Failed to create cart: ${t.statusText}`);
17
+ return t.json();
18
+ }
19
+ async function u(s, e) {
20
+ const n = await r(o).carts[":id"].$patch({
21
+ param: { id: s },
22
+ json: e
23
+ });
24
+ if (!n.ok)
25
+ throw new Error(`Failed to update cart: ${n.statusText}`);
26
+ return n.json();
27
+ }
28
+ async function l(s, e, t) {
29
+ const a = await r(o).carts[":id"].items.$post({
30
+ param: { id: s },
31
+ json: { sku: e, quantity: t }
32
+ });
33
+ if (!a.ok)
34
+ throw new Error(`Failed to add item to cart: ${a.statusText}`);
35
+ return a.json();
36
+ }
37
+ async function p(s, e, t) {
38
+ const a = await r(o).carts[":id"].items[":itemId"].$patch({
39
+ param: { id: s, itemId: e },
40
+ json: { quantity: t }
41
+ });
42
+ if (!a.ok)
43
+ throw new Error(`Failed to update cart item: ${a.statusText}`);
44
+ return a.json();
45
+ }
46
+ async function m(s, e) {
47
+ const n = await r(o).carts[":id"].items[":itemId"].$delete({
48
+ param: { id: s, itemId: e }
49
+ });
50
+ if (!n.ok)
51
+ throw new Error(`Failed to remove cart item: ${n.statusText}`);
52
+ return n.json();
53
+ }
54
+ async function w(s, e) {
55
+ const n = await r(o).carts[":id"]["apply-discount"].$post({
56
+ param: { id: s },
57
+ json: { code: e }
58
+ });
59
+ if (!n.ok)
60
+ throw new Error(`Failed to apply discount: ${n.statusText}`);
61
+ return n.json();
62
+ }
63
+ async function f(s) {
64
+ const t = await r(o).carts[":id"]["remove-discount"].$post({
65
+ param: { id: s }
66
+ });
67
+ if (!t.ok)
68
+ throw new Error(`Failed to remove discount: ${t.statusText}`);
69
+ return t.json();
70
+ }
71
+ async function $(s, e) {
72
+ const n = await r(o).carts[":id"].checkout.$post({
73
+ param: { id: s },
74
+ json: e
75
+ });
76
+ if (!n.ok)
77
+ throw new Error(`Failed to checkout cart: ${n.statusText}`);
78
+ return n.json();
79
+ }
80
+ export {
81
+ l as addCartItem,
82
+ w as applyDiscount,
83
+ $ as checkoutCart,
84
+ d as createCart,
85
+ i as fetchCart,
86
+ m as removeCartItem,
87
+ f as removeDiscount,
88
+ u as updateCart,
89
+ p as updateCartItem
90
+ };
@@ -0,0 +1,22 @@
1
+ import { createRpcClients as n } from "./index21.mjs";
2
+ const e = "https://oms-api.instock.ng";
3
+ async function i(r, o) {
4
+ const t = await n(e).orders[":id"][":token"].$get({
5
+ param: { id: r, token: o }
6
+ });
7
+ if (!t.ok)
8
+ throw new Error(`Failed to fetch order: ${t.statusText}`);
9
+ return t.json();
10
+ }
11
+ async function a(r, o) {
12
+ const t = await n(e).orders.confirm.$post({
13
+ json: { orderId: r, token: o }
14
+ });
15
+ if (!t.ok)
16
+ throw new Error(`Failed to confirm order: ${t.statusText}`);
17
+ return t.json();
18
+ }
19
+ export {
20
+ a as confirmOrder,
21
+ i as fetchOrder
22
+ };
@@ -0,0 +1,13 @@
1
+ import { createRpcClients as n } from "./index21.mjs";
2
+ const o = "https://oms-api.instock.ng";
3
+ async function r(t) {
4
+ const e = await n(o).deliveryZones.index.$get({
5
+ query: t ? { brandId: t } : {}
6
+ });
7
+ if (!e.ok)
8
+ throw new Error(`Failed to fetch delivery zones: ${e.statusText}`);
9
+ return e.json();
10
+ }
11
+ export {
12
+ r as fetchDeliveryZones
13
+ };
@@ -0,0 +1,99 @@
1
+ const s = {
2
+ // Public API keys (RPC is now the default)
3
+ public: {
4
+ all: ["public"],
5
+ carts: {
6
+ all: ["public", "carts"],
7
+ detail: (a) => ["public", "carts", a]
8
+ },
9
+ orders: {
10
+ all: ["public", "orders"],
11
+ detail: (a, i) => ["public", "orders", a, i]
12
+ },
13
+ products: {
14
+ all: ["public", "products"],
15
+ list: (a) => ["public", "products", a],
16
+ detail: (a) => ["public", "products", a]
17
+ },
18
+ deliveryZones: {
19
+ all: ["public", "delivery-zones"],
20
+ list: (a) => ["public", "delivery-zones", a]
21
+ }
22
+ },
23
+ // Admin API keys (RPC is now the default)
24
+ admin: {
25
+ all: ["admin"],
26
+ orders: {
27
+ all: ["admin", "orders"],
28
+ list: () => ["admin", "orders", "list"],
29
+ detail: (a) => ["admin", "orders", a]
30
+ },
31
+ brands: {
32
+ all: ["admin", "brands"],
33
+ list: () => ["admin", "brands", "list"],
34
+ detail: (a) => ["admin", "brands", a]
35
+ },
36
+ products: {
37
+ all: ["admin", "products"],
38
+ list: (a) => ["admin", "products", "list", a],
39
+ detail: (a) => ["admin", "products", a]
40
+ },
41
+ variants: {
42
+ all: ["admin", "variants"],
43
+ list: () => ["admin", "variants", "list"],
44
+ detail: (a) => ["admin", "variants", a],
45
+ search: (a) => ["admin", "variants", "search", a],
46
+ byProduct: (a) => ["admin", "variants", "product", a],
47
+ inventory: (a) => ["admin", "variants", a, "inventory"]
48
+ },
49
+ warehouses: {
50
+ all: ["admin", "warehouses"],
51
+ list: () => ["admin", "warehouses", "list"],
52
+ detail: (a) => ["admin", "warehouses", a],
53
+ inventory: (a) => ["admin", "warehouses", a, "inventory"]
54
+ },
55
+ inventory: {
56
+ all: ["admin", "inventory"],
57
+ list: (a) => ["admin", "inventory", "list", a],
58
+ transactions: (a) => ["admin", "inventory", "transactions", a],
59
+ lowStock: (a) => ["admin", "inventory", "low-stock", a]
60
+ },
61
+ customers: {
62
+ all: ["admin", "customers"],
63
+ history: (a) => ["admin", "customers", "history", a]
64
+ },
65
+ stats: {
66
+ all: ["admin", "stats"],
67
+ overview: (a) => ["admin", "stats", "overview", a]
68
+ },
69
+ abandonedCarts: {
70
+ all: ["admin", "abandoned-carts"],
71
+ list: (a) => ["admin", "abandoned-carts", "list", a],
72
+ detail: (a) => ["admin", "abandoned-carts", a],
73
+ stats: (a) => ["admin", "abandoned-carts", "stats", a]
74
+ },
75
+ discountCodes: {
76
+ all: ["admin", "discount-codes"],
77
+ list: (a) => ["admin", "discount-codes", "list", a],
78
+ detail: (a) => ["admin", "discount-codes", a],
79
+ analytics: (a) => ["admin", "discount-codes", a, "analytics"],
80
+ overviewStats: () => ["admin", "discount-codes", "stats", "overview"]
81
+ },
82
+ deliveryZones: {
83
+ all: ["admin", "delivery-zones"],
84
+ states: {
85
+ all: ["admin", "delivery-zones", "states"],
86
+ list: () => ["admin", "delivery-zones", "states", "list"],
87
+ detail: (a) => ["admin", "delivery-zones", "states", a]
88
+ },
89
+ zones: {
90
+ all: ["admin", "delivery-zones", "zones"],
91
+ list: (a) => ["admin", "delivery-zones", "zones", "list", a],
92
+ detail: (a) => ["admin", "delivery-zones", "zones", a]
93
+ }
94
+ }
95
+ }
96
+ };
97
+ export {
98
+ s as queryKeys
99
+ };
@@ -0,0 +1,20 @@
1
+ import { useAddCartItem as r, useApplyDiscount as u, useCheckoutCart as s, useCreateCart as o, useGetCart as a, useRemoveCartItem as m, useRemoveDiscount as C, useUpdateCart as d, useUpdateCartItem as p } from "./index29.mjs";
2
+ import { useConfirmOrder as f, useGetOrder as G } from "./index30.mjs";
3
+ import { useGetProduct as n, useGetProducts as x } from "./index31.mjs";
4
+ import { useGetDeliveryZones as D } from "./index32.mjs";
5
+ export {
6
+ r as useAddCartItem,
7
+ u as useApplyDiscount,
8
+ s as useCheckoutCart,
9
+ f as useConfirmOrder,
10
+ o as useCreateCart,
11
+ a as useGetCart,
12
+ D as useGetDeliveryZones,
13
+ G as useGetOrder,
14
+ n as useGetProduct,
15
+ x as useGetProducts,
16
+ m as useRemoveCartItem,
17
+ C as useRemoveDiscount,
18
+ d as useUpdateCart,
19
+ p as useUpdateCartItem
20
+ };
@@ -0,0 +1,67 @@
1
+ import { useCreateOrder as s, useDeleteOrder as r, useGetOrder as u, useListOrders as o, useUpdateOrder as a, useUpdateOrderStatus as n } from "./index45.mjs";
2
+ import { useCreateBrand as i, useDeleteBrand as p, useGetBrand as C, useListBrands as D, useUpdateBrand as c } from "./index46.mjs";
3
+ import { useCreateProduct as G, useDeleteProduct as f, useGetProduct as m, useListProducts as v, useUpdateProduct as x } from "./index47.mjs";
4
+ import { useCreateVariant as L, useDeleteVariant as S, useGetVariantInventory as U, useListProductVariants as O, useSearchVariants as V, useUpdateVariant as h } from "./index48.mjs";
5
+ import { useCreateWarehouse as I, useDeleteWarehouse as P, useGetWarehouseInventory as A, useListWarehouses as W, useUpdateWarehouse as Z } from "./index49.mjs";
6
+ import { useAdjustInventory as k, useGetInventoryTransactions as w, useGetLowStockVariants as T, useListInventory as j, useTransferInventory as E } from "./index50.mjs";
7
+ import { useGetCustomerHistory as g } from "./index51.mjs";
8
+ import { useGetStats as z } from "./index52.mjs";
9
+ import { useCleanupExpiredCarts as J, useGetAbandonedCart as K, useGetAbandonedCartStats as M, useListAbandonedCarts as N } from "./index53.mjs";
10
+ import { useBulkGenerateDiscountCodes as R, useCreateDiscountCode as X, useDeleteDiscountCode as Y, useGetDiscountCode as _, useGetDiscountCodeAnalytics as $, useGetDiscountCodeOverviewStats as ee, useListDiscountCodes as te, useUpdateDiscountCode as se } from "./index54.mjs";
11
+ import { useCreateDeliveryZone as ue, useCreateState as oe, useDeleteDeliveryZone as ae, useDeleteState as ne, useListDeliveryZones as de, useListStates as ie, useUpdateDeliveryZone as pe, useUpdateState as Ce } from "./index55.mjs";
12
+ export {
13
+ k as useAdjustInventory,
14
+ R as useBulkGenerateDiscountCodes,
15
+ J as useCleanupExpiredCarts,
16
+ i as useCreateBrand,
17
+ ue as useCreateDeliveryZone,
18
+ X as useCreateDiscountCode,
19
+ s as useCreateOrder,
20
+ G as useCreateProduct,
21
+ oe as useCreateState,
22
+ L as useCreateVariant,
23
+ I as useCreateWarehouse,
24
+ p as useDeleteBrand,
25
+ ae as useDeleteDeliveryZone,
26
+ Y as useDeleteDiscountCode,
27
+ r as useDeleteOrder,
28
+ f as useDeleteProduct,
29
+ ne as useDeleteState,
30
+ S as useDeleteVariant,
31
+ P as useDeleteWarehouse,
32
+ K as useGetAbandonedCart,
33
+ M as useGetAbandonedCartStats,
34
+ C as useGetBrand,
35
+ g as useGetCustomerHistory,
36
+ _ as useGetDiscountCode,
37
+ $ as useGetDiscountCodeAnalytics,
38
+ ee as useGetDiscountCodeOverviewStats,
39
+ w as useGetInventoryTransactions,
40
+ T as useGetLowStockVariants,
41
+ u as useGetOrder,
42
+ m as useGetProduct,
43
+ z as useGetStats,
44
+ U as useGetVariantInventory,
45
+ A as useGetWarehouseInventory,
46
+ N as useListAbandonedCarts,
47
+ D as useListBrands,
48
+ de as useListDeliveryZones,
49
+ te as useListDiscountCodes,
50
+ j as useListInventory,
51
+ o as useListOrders,
52
+ O as useListProductVariants,
53
+ v as useListProducts,
54
+ ie as useListStates,
55
+ W as useListWarehouses,
56
+ V as useSearchVariants,
57
+ E as useTransferInventory,
58
+ c as useUpdateBrand,
59
+ pe as useUpdateDeliveryZone,
60
+ se as useUpdateDiscountCode,
61
+ a as useUpdateOrder,
62
+ n as useUpdateOrderStatus,
63
+ x as useUpdateProduct,
64
+ Ce as useUpdateState,
65
+ h as useUpdateVariant,
66
+ Z as useUpdateWarehouse
67
+ };
@@ -0,0 +1,98 @@
1
+ import { useQueryClient as s, useMutation as i } from "@tanstack/react-query";
2
+ import { useQueryUnwrapped as o } from "./index61.mjs";
3
+ import { queryKeys as r } from "./index26.mjs";
4
+ import { updateCart as c, createCart as l, applyDiscount as y, removeDiscount as m, addCartItem as C, updateCartItem as p, removeCartItem as q, checkoutCart as d, fetchCart as f } from "./index23.mjs";
5
+ function b(e, t) {
6
+ return o({
7
+ queryKey: r.public.carts.detail(e),
8
+ queryFn: () => f(e),
9
+ ...t
10
+ });
11
+ }
12
+ function S(e, t) {
13
+ const u = s();
14
+ return i({
15
+ mutationFn: (n) => c(e, n),
16
+ onSuccess: () => {
17
+ u.invalidateQueries({ queryKey: r.public.carts.detail(e) });
18
+ },
19
+ ...t
20
+ });
21
+ }
22
+ function D(e) {
23
+ return i({
24
+ mutationFn: (t) => l(t),
25
+ ...e
26
+ });
27
+ }
28
+ function h(e, t) {
29
+ const u = s();
30
+ return i({
31
+ mutationFn: (n) => y(e, n.code),
32
+ onSuccess: () => {
33
+ u.invalidateQueries({ queryKey: r.public.carts.detail(e) });
34
+ },
35
+ ...t
36
+ });
37
+ }
38
+ function k(e, t) {
39
+ const u = s();
40
+ return i({
41
+ mutationFn: () => m(e),
42
+ onSuccess: () => {
43
+ u.invalidateQueries({ queryKey: r.public.carts.detail(e) });
44
+ },
45
+ ...t
46
+ });
47
+ }
48
+ function U(e, t) {
49
+ const u = s();
50
+ return i({
51
+ mutationFn: (n) => C(e, n.sku, n.quantity),
52
+ onSuccess: () => {
53
+ u.invalidateQueries({ queryKey: r.public.carts.detail(e) });
54
+ },
55
+ ...t
56
+ });
57
+ }
58
+ function A(e, t) {
59
+ const u = s();
60
+ return i({
61
+ mutationFn: ({ itemId: n, quantity: a }) => p(e, n, a),
62
+ onSuccess: () => {
63
+ u.invalidateQueries({ queryKey: r.public.carts.detail(e) });
64
+ },
65
+ ...t
66
+ });
67
+ }
68
+ function R(e, t) {
69
+ const u = s();
70
+ return i({
71
+ mutationFn: (n) => q(e, n),
72
+ onSuccess: () => {
73
+ u.invalidateQueries({ queryKey: r.public.carts.detail(e) });
74
+ },
75
+ ...t
76
+ });
77
+ }
78
+ function w(e, t) {
79
+ const u = s();
80
+ return i({
81
+ mutationFn: (n) => d(e, n),
82
+ onSuccess: () => {
83
+ u.invalidateQueries({ queryKey: r.public.carts.detail(e) });
84
+ },
85
+ ...t
86
+ });
87
+ }
88
+ export {
89
+ U as useAddCartItem,
90
+ h as useApplyDiscount,
91
+ w as useCheckoutCart,
92
+ D as useCreateCart,
93
+ b as useGetCart,
94
+ R as useRemoveCartItem,
95
+ k as useRemoveDiscount,
96
+ S as useUpdateCart,
97
+ A as useUpdateCartItem
98
+ };