@instockng/storefront-ui 1.0.10 → 1.0.11

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 (97) hide show
  1. package/README.md +26 -0
  2. package/dist/components/Checkout.d.ts.map +1 -1
  3. package/dist/contexts/CartContext.d.ts.map +1 -1
  4. package/dist/index10.mjs +144 -141
  5. package/dist/index101.mjs +1 -1
  6. package/dist/index102.mjs +3 -3
  7. package/dist/index103.mjs +3 -3
  8. package/dist/index111.mjs +1 -1
  9. package/dist/index20.mjs +2 -2
  10. package/dist/index21.mjs +1 -1
  11. package/dist/index28.mjs +11 -11
  12. package/dist/index29.mjs +1 -1
  13. package/dist/index3.mjs +83 -73
  14. package/dist/index30.mjs +1 -1
  15. package/dist/index31.mjs +1 -1
  16. package/dist/index32.mjs +1 -1
  17. package/dist/index37.mjs +1 -1
  18. package/dist/index41.mjs +36 -23
  19. package/dist/index42.mjs +44 -36
  20. package/dist/index43.mjs +99 -44
  21. package/dist/index44.mjs +112 -99
  22. package/dist/index45.mjs +44 -80
  23. package/dist/index46.mjs +64 -53
  24. package/dist/index47.mjs +66 -49
  25. package/dist/index48.mjs +54 -73
  26. package/dist/index49.mjs +52 -63
  27. package/dist/index50.mjs +14 -70
  28. package/dist/index51.mjs +13 -14
  29. package/dist/index52.mjs +58 -13
  30. package/dist/index53.mjs +101 -34
  31. package/dist/index54.mjs +99 -95
  32. package/dist/index55.mjs +22 -132
  33. package/dist/index58.mjs +2 -2
  34. package/dist/index59.mjs +4 -3
  35. package/dist/index60.mjs +4 -2
  36. package/dist/index61.mjs +2 -5
  37. package/dist/index62.mjs +30 -231
  38. package/dist/index63.mjs +42 -5
  39. package/dist/index64.mjs +228 -127
  40. package/dist/index65.mjs +4 -66
  41. package/dist/index66.mjs +124 -77
  42. package/dist/index67.mjs +65 -26
  43. package/dist/index68.mjs +84 -6
  44. package/dist/index69.mjs +26 -72
  45. package/dist/index70.mjs +8 -3
  46. package/dist/index71.mjs +75 -2
  47. package/dist/index72.mjs +3 -82
  48. package/dist/index73.mjs +2 -54
  49. package/dist/index74.mjs +82 -5
  50. package/dist/index75.mjs +53 -4
  51. package/dist/index76.mjs +5 -178
  52. package/dist/index77.mjs +5 -53
  53. package/dist/index78.mjs +178 -68
  54. package/dist/index79.mjs +50 -31
  55. package/dist/index80.mjs +69 -43
  56. package/dist/index81.mjs +1 -1
  57. package/dist/index82.mjs +1 -1
  58. package/dist/index83.mjs +5 -5
  59. package/dist/index85.mjs +2 -2
  60. package/dist/index87.mjs +2 -2
  61. package/dist/index89.mjs +1 -1
  62. package/dist/index91.mjs +4 -4
  63. package/dist/index92.mjs +3 -3
  64. package/dist/index93.mjs +1 -1
  65. package/dist/index94.mjs +3 -3
  66. package/dist/index99.mjs +1 -1
  67. package/dist/styles.css +1 -0
  68. package/package.json +14 -13
  69. package/src/components/CartItem.stories.tsx +94 -0
  70. package/src/components/CartItem.tsx +141 -0
  71. package/src/components/Checkout.stories.tsx +380 -0
  72. package/src/components/Checkout.tsx +954 -0
  73. package/src/components/DiscountCodeInput.stories.tsx +76 -0
  74. package/src/components/DiscountCodeInput.tsx +162 -0
  75. package/src/components/OrderConfirmation.stories.tsx +142 -0
  76. package/src/components/OrderConfirmation.tsx +301 -0
  77. package/src/components/ProductCard.stories.tsx +112 -0
  78. package/src/components/ProductCard.tsx +195 -0
  79. package/src/components/ProductGrid.stories.tsx +137 -0
  80. package/src/components/ProductGrid.tsx +141 -0
  81. package/src/components/ShoppingCart.stories.tsx +459 -0
  82. package/src/components/ShoppingCart.tsx +262 -0
  83. package/src/components/ui/badge.tsx +37 -0
  84. package/src/components/ui/button.tsx +71 -0
  85. package/src/components/ui/card.tsx +79 -0
  86. package/src/components/ui/form-input.tsx +78 -0
  87. package/src/components/ui/form-select.tsx +73 -0
  88. package/src/components/ui/modal.tsx +181 -0
  89. package/src/contexts/CartContext.tsx +305 -0
  90. package/src/hooks/usePaystackPayment.ts +137 -0
  91. package/src/index.ts +51 -0
  92. package/src/lib/utils.ts +45 -0
  93. package/src/paystack.svg +67 -0
  94. package/src/providers/StorefrontProvider.tsx +70 -0
  95. package/src/styles.css +1 -0
  96. package/src/test-utils/MockCartProvider.tsx +424 -0
  97. package/src/vite-env.d.ts +12 -0
package/dist/index101.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import i from "./index108.mjs";
3
3
  import m from "./index109.mjs";
4
- import f from "./index62.mjs";
4
+ import f from "./index64.mjs";
5
5
  const h = (t, o, a = 3) => {
6
6
  let r = 0;
7
7
  const c = i(50, 250);
package/dist/index102.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
  import n from "./index88.mjs";
3
- import m from "./index62.mjs";
3
+ import m from "./index64.mjs";
4
4
  import c from "./index110.mjs";
5
5
  import h from "./index111.mjs";
6
6
  import w from "./index84.mjs";
7
- import b from "./index65.mjs";
8
- import C from "./index76.mjs";
7
+ import b from "./index67.mjs";
8
+ import C from "./index78.mjs";
9
9
  import g from "./index81.mjs";
10
10
  const E = (a) => {
11
11
  const e = b({}, a);
package/dist/index103.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client';
2
- import a from "./index68.mjs";
3
- import s from "./index73.mjs";
4
- import m from "./index62.mjs";
2
+ import a from "./index70.mjs";
3
+ import s from "./index75.mjs";
4
+ import m from "./index64.mjs";
5
5
  const h = (e, t) => {
6
6
  const { length: l } = e = e ? e.filter(Boolean) : [];
7
7
  if (t || l) {
package/dist/index111.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import r from "./index62.mjs";
2
+ import r from "./index64.mjs";
3
3
  import c from "./index88.mjs";
4
4
  const p = c.hasStandardBrowserEnv ? (
5
5
  // Standard browser envs support document.cookie
package/dist/index20.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import "./index42.mjs";
3
- import r from "./index43.mjs";
2
+ import "./index41.mjs";
3
+ import r from "./index42.mjs";
4
4
  let e = null;
5
5
  function p(t) {
6
6
  return e = r.create({
package/dist/index21.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { hc as e } from "./index44.mjs";
2
+ import { hc as e } from "./index43.mjs";
3
3
  function n(s) {
4
4
  const r = `${s}/v1`;
5
5
  return {
package/dist/index28.mjs CHANGED
@@ -1,15 +1,15 @@
1
1
  'use client';
2
- import { useCreateOrder as s, useDeleteOrder as r, useGetOrder as u, useListOrders as o, useUpdateOrder as a, useUpdateOrderStatus as n } from "./index45.mjs";
3
- import { useCreateBrand as i, useDeleteBrand as p, useGetBrand as C, useListBrands as D, useUpdateBrand as c } from "./index46.mjs";
4
- import { useCreateProduct as G, useDeleteProduct as f, useGetProduct as m, useListProducts as v, useUpdateProduct as x } from "./index47.mjs";
5
- import { useCreateVariant as L, useDeleteVariant as S, useGetVariantInventory as U, useListProductVariants as O, useSearchVariants as V, useUpdateVariant as h } from "./index48.mjs";
6
- import { useCreateWarehouse as I, useDeleteWarehouse as P, useGetWarehouseInventory as A, useListWarehouses as W, useUpdateWarehouse as Z } from "./index49.mjs";
7
- import { useAdjustInventory as k, useGetInventoryTransactions as w, useGetLowStockVariants as T, useListInventory as j, useTransferInventory as E } from "./index50.mjs";
8
- import { useGetCustomerHistory as g } from "./index51.mjs";
9
- import { useGetStats as z } from "./index52.mjs";
10
- import { useCleanupExpiredCarts as J, useGetAbandonedCart as K, useGetAbandonedCartStats as M, useListAbandonedCarts as N } from "./index53.mjs";
11
- 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";
12
- 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";
2
+ import { useCreateOrder as s, useDeleteOrder as r, useGetOrder as u, useListOrders as o, useUpdateOrder as a, useUpdateOrderStatus as n } from "./index44.mjs";
3
+ import { useCreateBrand as i, useDeleteBrand as p, useGetBrand as C, useListBrands as D, useUpdateBrand as c } from "./index45.mjs";
4
+ import { useCreateProduct as G, useDeleteProduct as f, useGetProduct as m, useListProducts as v, useUpdateProduct as x } from "./index46.mjs";
5
+ import { useCreateVariant as L, useDeleteVariant as S, useGetVariantInventory as U, useListProductVariants as O, useSearchVariants as V, useUpdateVariant as h } from "./index47.mjs";
6
+ import { useCreateWarehouse as I, useDeleteWarehouse as P, useGetWarehouseInventory as A, useListWarehouses as W, useUpdateWarehouse as Z } from "./index48.mjs";
7
+ import { useAdjustInventory as k, useGetInventoryTransactions as w, useGetLowStockVariants as T, useListInventory as j, useTransferInventory as E } from "./index49.mjs";
8
+ import { useGetCustomerHistory as g } from "./index50.mjs";
9
+ import { useGetStats as z } from "./index51.mjs";
10
+ import { useCleanupExpiredCarts as J, useGetAbandonedCart as K, useGetAbandonedCartStats as M, useListAbandonedCarts as N } from "./index52.mjs";
11
+ import { useBulkGenerateDiscountCodes as R, useCreateDiscountCode as X, useDeleteDiscountCode as Y, useGetDiscountCode as _, useGetDiscountCodeAnalytics as $, useGetDiscountCodeOverviewStats as ee, useListDiscountCodes as te, useUpdateDiscountCode as se } from "./index53.mjs";
12
+ 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 "./index54.mjs";
13
13
  export {
14
14
  k as useAdjustInventory,
15
15
  R as useBulkGenerateDiscountCodes,
package/dist/index29.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { useQueryClient as s, useMutation as i } from "@tanstack/react-query";
3
- import { useQueryUnwrapped as o } from "./index61.mjs";
3
+ import { useQueryUnwrapped as o } from "./index59.mjs";
4
4
  import { queryKeys as r } from "./index26.mjs";
5
5
  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";
6
6
  function b(e, t) {
package/dist/index3.mjs CHANGED
@@ -1,135 +1,145 @@
1
1
  'use client';
2
- import { jsxs as T, jsx as z } from "react/jsx-runtime";
3
- import { createContext as G, useState as C, useRef as I, useEffect as m, useCallback as r, useContext as H } from "react";
2
+ import { jsxs as H, jsx as K } from "react/jsx-runtime";
3
+ import { createContext as Y, useState as d, useRef as h, useEffect as c, useCallback as r, useContext as q } from "react";
4
4
  import "./index18.mjs";
5
- import { useGetCart as K, useCreateCart as Y, useAddCartItem as q, useUpdateCartItem as B, useRemoveCartItem as J, useApplyDiscount as Q, useRemoveDiscount as V, useUpdateCart as W, useCheckoutCart as X } from "./index29.mjs";
5
+ import { useGetCart as B, useCreateCart as J, useAddCartItem as Q, useUpdateCartItem as V, useRemoveCartItem as W, useApplyDiscount as X, useRemoveDiscount as Z, useUpdateCart as $, useCheckoutCart as tt } from "./index29.mjs";
6
6
  import "@tanstack/react-query";
7
- import { ShoppingCart as Z } from "./index8.mjs";
8
- const c = "oms_cart_id", y = G(null);
9
- function at({ children: a, brandSlug: h, initialCartId: u, shoppingCartProps: v }) {
10
- const [t, i] = C(() => {
11
- if (u) return u;
12
- if (typeof window < "u") {
13
- const n = new URLSearchParams(window.location.search).get("cartId");
14
- return n || localStorage.getItem(c);
7
+ import { ShoppingCart as et } from "./index8.mjs";
8
+ const m = "oms_cart_id", y = Y(null);
9
+ function ut({ children: a, brandSlug: v, initialCartId: u, shoppingCartProps: S }) {
10
+ const [t, s] = d(u || null), [w, p] = d(!1), [D, g] = d(!1), i = h(!1), f = h(!1);
11
+ c(() => {
12
+ g(!0);
13
+ }, []), c(() => {
14
+ if (u || i.current) return;
15
+ const n = new URLSearchParams(window.location.search).get("cartId");
16
+ if (n) {
17
+ s(n);
18
+ return;
15
19
  }
16
- return null;
17
- }), [f, d] = C(!1), { data: S, isLoading: D, error: s, refetch: o } = K(t || "", {
20
+ const C = localStorage.getItem(m);
21
+ C && s(C);
22
+ }, [u]);
23
+ const { data: E, isLoading: M, error: l, refetch: o } = B(t || "", {
18
24
  enabled: !!t,
19
25
  retry: !1
20
26
  // Don't retry on failure - cart might be invalid/expired
21
- }), w = I(!1), l = I(!1), g = Y({
27
+ }), A = J({
22
28
  onSuccess: (e) => {
23
29
  if ("error" in e) {
24
30
  console.error("Failed to create cart:", e.error);
25
31
  return;
26
32
  }
27
- i(e.id);
33
+ s(e.id);
28
34
  },
29
35
  onError: (e) => {
30
36
  console.error("Failed to create cart:", e);
31
37
  }
32
38
  });
33
- m(() => {
34
- !w.current && !t && !u && (w.current = !0, setTimeout(() => {
35
- g.mutate(h);
36
- }, 0));
37
- }, []), m(() => {
38
- s && t && !l.current && (l.current = !0, console.warn("Cart fetch failed, clearing invalid cart:", s), Promise.resolve().then(() => {
39
- i(null), typeof window < "u" && localStorage.removeItem(c), l.current = !1;
39
+ c(() => {
40
+ if (!i.current && !t && !u) {
41
+ i.current = !0;
42
+ const e = setTimeout(() => {
43
+ i.current && A.mutate(v);
44
+ }, 0);
45
+ return () => clearTimeout(e);
46
+ }
47
+ }, []), c(() => {
48
+ l && t && !f.current && (f.current = !0, console.warn("Cart fetch failed, clearing invalid cart:", l), Promise.resolve().then(() => {
49
+ s(null), typeof window < "u" && localStorage.removeItem(m), f.current = !1;
40
50
  }));
41
- }, [s, t]);
42
- const E = q(t || "", {
51
+ }, [l, t]);
52
+ const x = Q(t || "", {
43
53
  onSuccess: () => o()
44
- }), A = B(t || "", {
54
+ }), P = V(t || "", {
45
55
  onSuccess: () => o()
46
- }), M = J(t || "", {
56
+ }), R = W(t || "", {
47
57
  onSuccess: () => o()
48
- }), x = Q(t || "", {
58
+ }), N = X(t || "", {
49
59
  onSuccess: () => o()
50
- }), P = V(t || "", {
60
+ }), U = Z(t || "", {
51
61
  onSuccess: () => o()
52
- }), R = W(t || "", {
62
+ }), _ = $(t || "", {
53
63
  onSuccess: () => o()
54
- }), N = X(t || "");
55
- m(() => {
56
- t && typeof window < "u" && localStorage.setItem(c, t);
64
+ }), b = tt(t || "");
65
+ c(() => {
66
+ t && typeof window < "u" && localStorage.setItem(m, t);
57
67
  }, [t]);
58
- const U = r(
68
+ const k = r(
59
69
  async (e, n) => {
60
70
  if (!t) throw new Error("No cart ID");
61
- await E.mutateAsync({ sku: e, quantity: n });
71
+ await x.mutateAsync({ sku: e, quantity: n });
62
72
  },
63
73
  // eslint-disable-next-line react-hooks/exhaustive-deps
64
74
  [t]
65
- ), _ = r(
75
+ ), F = r(
66
76
  async (e, n) => {
67
77
  if (!t) throw new Error("No cart ID");
68
- await A.mutateAsync({ itemId: e, quantity: n });
78
+ await P.mutateAsync({ itemId: e, quantity: n });
69
79
  },
70
80
  // eslint-disable-next-line react-hooks/exhaustive-deps
71
81
  [t]
72
- ), b = r(
82
+ ), T = r(
73
83
  async (e) => {
74
84
  if (!t) throw new Error("No cart ID");
75
- await M.mutateAsync(e);
85
+ await R.mutateAsync(e);
76
86
  },
77
87
  // eslint-disable-next-line react-hooks/exhaustive-deps
78
88
  [t]
79
- ), k = r(
89
+ ), j = r(
80
90
  async (e) => {
81
91
  if (!t) throw new Error("No cart ID");
82
- await x.mutateAsync({ code: e });
92
+ await N.mutateAsync({ code: e });
83
93
  },
84
94
  // eslint-disable-next-line react-hooks/exhaustive-deps
85
95
  [t]
86
- ), F = r(async () => {
96
+ ), L = r(async () => {
87
97
  if (!t) throw new Error("No cart ID");
88
- await P.mutateAsync();
89
- }, [t]), j = r(() => {
90
- i(null), typeof window < "u" && localStorage.removeItem(c);
91
- }, []), L = r(() => {
92
- d(!0);
93
- }, []), p = r(() => {
94
- d(!1);
95
- }, []), O = {
96
- cart: S || null,
98
+ await U.mutateAsync();
99
+ }, [t]), O = r(() => {
100
+ s(null), typeof window < "u" && localStorage.removeItem(m);
101
+ }, []), z = r(() => {
102
+ p(!0);
103
+ }, []), I = r(() => {
104
+ p(!1);
105
+ }, []), G = {
106
+ cart: E || null,
97
107
  cartId: t,
98
- isLoading: D,
99
- error: s,
100
- updateCartMutation: R,
101
- checkoutMutation: N,
102
- addItem: U,
103
- updateItem: _,
104
- removeItem: b,
105
- applyDiscount: k,
106
- removeDiscount: F,
107
- clearCart: j,
108
+ isLoading: M,
109
+ error: l,
110
+ updateCartMutation: _,
111
+ checkoutMutation: b,
112
+ addItem: k,
113
+ updateItem: F,
114
+ removeItem: T,
115
+ applyDiscount: j,
116
+ removeDiscount: L,
117
+ clearCart: O,
108
118
  refetch: o,
109
- isOpen: f,
110
- open: L,
111
- close: p
119
+ isOpen: w,
120
+ open: z,
121
+ close: I
112
122
  };
113
- return /* @__PURE__ */ T(y.Provider, { value: O, children: [
123
+ return /* @__PURE__ */ H(y.Provider, { value: G, children: [
114
124
  a,
115
- /* @__PURE__ */ z(
116
- Z,
125
+ D && /* @__PURE__ */ K(
126
+ et,
117
127
  {
118
- isOpen: f,
119
- onClose: p,
120
- ...v
128
+ isOpen: w,
129
+ onClose: I,
130
+ ...S
121
131
  }
122
132
  )
123
133
  ] });
124
134
  }
125
- function st() {
126
- const a = H(y);
135
+ function it() {
136
+ const a = q(y);
127
137
  if (!a)
128
138
  throw new Error("useCart must be used within CartProvider");
129
139
  return a;
130
140
  }
131
141
  export {
132
142
  y as CartContext,
133
- at as CartProvider,
134
- st as useCart
143
+ ut as CartProvider,
144
+ it as useCart
135
145
  };
package/dist/index30.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { useMutation as t } from "@tanstack/react-query";
3
- import { useQueryUnwrapped as u } from "./index61.mjs";
3
+ import { useQueryUnwrapped as u } from "./index59.mjs";
4
4
  import { queryKeys as n } from "./index26.mjs";
5
5
  import { confirmOrder as i, fetchOrder as m } from "./index24.mjs";
6
6
  function y(e, r, o) {
package/dist/index31.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { useQueryUnwrapped as u } from "./index61.mjs";
2
+ import { useQueryUnwrapped as u } from "./index59.mjs";
3
3
  import { queryKeys as t } from "./index26.mjs";
4
4
  import { fetchProductsByBrand as o, fetchProductBySlug as c } from "./index22.mjs";
5
5
  function n(r, e) {
package/dist/index32.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { useQueryUnwrapped as o } from "./index61.mjs";
2
+ import { useQueryUnwrapped as o } from "./index59.mjs";
3
3
  import { queryKeys as i } from "./index26.mjs";
4
4
  import { fetchDeliveryZones as t } from "./index25.mjs";
5
5
  function p(e, r) {
package/dist/index37.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import * as l from "react";
3
- import { composeRefs as m } from "./index41.mjs";
3
+ import { composeRefs as m } from "./index55.mjs";
4
4
  import { jsx as u } from "react/jsx-runtime";
5
5
  // @__NO_SIDE_EFFECTS__
6
6
  function y(e) {
package/dist/index41.mjs CHANGED
@@ -1,26 +1,39 @@
1
1
  'use client';
2
- import "react";
3
- function i(n, o) {
4
- if (typeof n == "function")
5
- return n(o);
6
- n != null && (n.current = o);
7
- }
8
- function f(...n) {
9
- return (o) => {
10
- let u = !1;
11
- const c = n.map((t) => {
12
- const e = i(t, o);
13
- return !u && typeof e == "function" && (u = !0), e;
14
- });
15
- if (u)
16
- return () => {
17
- for (let t = 0; t < c.length; t++) {
18
- const e = c[t];
19
- typeof e == "function" ? e() : i(n[t], null);
20
- }
21
- };
22
- };
23
- }
2
+ import o from "./index42.mjs";
3
+ const {
4
+ Axios: e,
5
+ AxiosError: a,
6
+ CanceledError: s,
7
+ isCancel: t,
8
+ CancelToken: i,
9
+ VERSION: l,
10
+ all: n,
11
+ Cancel: d,
12
+ isAxiosError: x,
13
+ spread: C,
14
+ toFormData: c,
15
+ AxiosHeaders: m,
16
+ HttpStatusCode: p,
17
+ formToJSON: A,
18
+ getAdapter: f,
19
+ mergeConfig: E
20
+ } = o;
24
21
  export {
25
- f as composeRefs
22
+ e as Axios,
23
+ a as AxiosError,
24
+ m as AxiosHeaders,
25
+ d as Cancel,
26
+ i as CancelToken,
27
+ s as CanceledError,
28
+ p as HttpStatusCode,
29
+ l as VERSION,
30
+ n as all,
31
+ o as default,
32
+ A as formToJSON,
33
+ f as getAdapter,
34
+ x as isAxiosError,
35
+ t as isCancel,
36
+ E as mergeConfig,
37
+ C as spread,
38
+ c as toFormData
26
39
  };
package/dist/index42.mjs CHANGED
@@ -1,39 +1,47 @@
1
1
  'use client';
2
- import o from "./index43.mjs";
3
- const {
4
- Axios: e,
5
- AxiosError: a,
6
- CanceledError: s,
7
- isCancel: t,
8
- CancelToken: i,
9
- VERSION: l,
10
- all: n,
11
- Cancel: d,
12
- isAxiosError: x,
13
- spread: C,
14
- toFormData: c,
15
- AxiosHeaders: m,
16
- HttpStatusCode: p,
17
- formToJSON: A,
18
- getAdapter: f,
19
- mergeConfig: E
20
- } = o;
2
+ import a from "./index64.mjs";
3
+ import p from "./index65.mjs";
4
+ import m from "./index66.mjs";
5
+ import i from "./index67.mjs";
6
+ import f from "./index68.mjs";
7
+ import l from "./index69.mjs";
8
+ import c from "./index70.mjs";
9
+ import d from "./index71.mjs";
10
+ import u from "./index72.mjs";
11
+ import { VERSION as x } from "./index73.mjs";
12
+ import C from "./index74.mjs";
13
+ import A from "./index75.mjs";
14
+ import E from "./index76.mjs";
15
+ import O from "./index77.mjs";
16
+ import S from "./index78.mjs";
17
+ import H from "./index79.mjs";
18
+ import T from "./index80.mjs";
19
+ function n(o) {
20
+ const t = new m(o), e = p(m.prototype.request, t);
21
+ return a.extend(e, m.prototype, t, { allOwnKeys: !0 }), a.extend(e, t, null, { allOwnKeys: !0 }), e.create = function(s) {
22
+ return n(i(o, s));
23
+ }, e;
24
+ }
25
+ const r = n(f);
26
+ r.Axios = m;
27
+ r.CanceledError = c;
28
+ r.CancelToken = d;
29
+ r.isCancel = u;
30
+ r.VERSION = x;
31
+ r.toFormData = C;
32
+ r.AxiosError = A;
33
+ r.Cancel = r.CanceledError;
34
+ r.all = function(t) {
35
+ return Promise.all(t);
36
+ };
37
+ r.spread = E;
38
+ r.isAxiosError = O;
39
+ r.mergeConfig = i;
40
+ r.AxiosHeaders = S;
41
+ r.formToJSON = (o) => l(a.isHTMLForm(o) ? new FormData(o) : o);
42
+ r.getAdapter = H.getAdapter;
43
+ r.HttpStatusCode = T;
44
+ r.default = r;
21
45
  export {
22
- e as Axios,
23
- a as AxiosError,
24
- m as AxiosHeaders,
25
- d as Cancel,
26
- i as CancelToken,
27
- s as CanceledError,
28
- p as HttpStatusCode,
29
- l as VERSION,
30
- n as all,
31
- o as default,
32
- A as formToJSON,
33
- f as getAdapter,
34
- x as isAxiosError,
35
- t as isCancel,
36
- E as mergeConfig,
37
- C as spread,
38
- c as toFormData
46
+ r as default
39
47
  };
package/dist/index43.mjs CHANGED
@@ -1,47 +1,102 @@
1
1
  'use client';
2
- import a from "./index62.mjs";
3
- import p from "./index63.mjs";
4
- import m from "./index64.mjs";
5
- import i from "./index65.mjs";
6
- import f from "./index66.mjs";
7
- import l from "./index67.mjs";
8
- import c from "./index68.mjs";
9
- import d from "./index69.mjs";
10
- import u from "./index70.mjs";
11
- import { VERSION as x } from "./index71.mjs";
12
- import C from "./index72.mjs";
13
- import A from "./index73.mjs";
14
- import E from "./index74.mjs";
15
- import O from "./index75.mjs";
16
- import S from "./index76.mjs";
17
- import H from "./index77.mjs";
18
- import T from "./index78.mjs";
19
- function n(o) {
20
- const t = new m(o), e = p(m.prototype.request, t);
21
- return a.extend(e, m.prototype, t, { allOwnKeys: !0 }), a.extend(e, t, null, { allOwnKeys: !0 }), e.create = function(s) {
22
- return n(i(o, s));
23
- }, e;
24
- }
25
- const r = n(f);
26
- r.Axios = m;
27
- r.CanceledError = c;
28
- r.CancelToken = d;
29
- r.isCancel = u;
30
- r.VERSION = x;
31
- r.toFormData = C;
32
- r.AxiosError = A;
33
- r.Cancel = r.CanceledError;
34
- r.all = function(t) {
35
- return Promise.all(t);
36
- };
37
- r.spread = E;
38
- r.isAxiosError = O;
39
- r.mergeConfig = i;
40
- r.AxiosHeaders = S;
41
- r.formToJSON = (o) => l(a.isHTMLForm(o) ? new FormData(o) : o);
42
- r.getAdapter = H.getAdapter;
43
- r.HttpStatusCode = T;
44
- r.default = r;
2
+ var p = Object.defineProperty;
3
+ var k = (r, e, i) => e in r ? p(r, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[e] = i;
4
+ var h = (r, e, i) => k(r, typeof e != "symbol" ? e + "" : e, i);
5
+ import { serialize as j } from "./index62.mjs";
6
+ import { mergePath as U, replaceUrlParam as P, buildSearchParams as S, removeIndexString as w, replaceUrlProtocol as x, deepMerge as C } from "./index63.mjs";
7
+ var v = (r, e) => new Proxy(() => {
8
+ }, {
9
+ get(t, s) {
10
+ if (!(typeof s != "string" || s === "then"))
11
+ return v(r, [...e, s]);
12
+ },
13
+ apply(t, s, a) {
14
+ return r({
15
+ path: e,
16
+ args: a
17
+ });
18
+ }
19
+ }), T = class {
20
+ constructor(r, e) {
21
+ h(this, "url");
22
+ h(this, "method");
23
+ h(this, "queryParams");
24
+ h(this, "pathParams", {});
25
+ h(this, "rBody");
26
+ h(this, "cType");
27
+ h(this, "fetch", async (r, e) => {
28
+ if (r) {
29
+ if (r.query && (this.queryParams = S(r.query)), r.form) {
30
+ const o = new FormData();
31
+ for (const [c, f] of Object.entries(r.form))
32
+ if (Array.isArray(f))
33
+ for (const l of f)
34
+ o.append(c, l);
35
+ else
36
+ o.append(c, f);
37
+ this.rBody = o;
38
+ }
39
+ r.json && (this.rBody = JSON.stringify(r.json), this.cType = "application/json"), r.param && (this.pathParams = r.param);
40
+ }
41
+ let i = this.method.toUpperCase();
42
+ const t = {
43
+ ...r == null ? void 0 : r.header,
44
+ ...typeof (e == null ? void 0 : e.headers) == "function" ? await e.headers() : e == null ? void 0 : e.headers
45
+ };
46
+ if (r != null && r.cookie) {
47
+ const o = [];
48
+ for (const [c, f] of Object.entries(r.cookie))
49
+ o.push(j(c, f, { path: "/" }));
50
+ t.Cookie = o.join(",");
51
+ }
52
+ this.cType && (t["Content-Type"] = this.cType);
53
+ const s = new Headers(t ?? void 0);
54
+ let a = this.url;
55
+ a = w(a), a = P(a, this.pathParams), this.queryParams && (a = a + "?" + this.queryParams.toString()), i = this.method.toUpperCase();
56
+ const u = !(i === "GET" || i === "HEAD");
57
+ return ((e == null ? void 0 : e.fetch) || fetch)(a, {
58
+ body: u ? this.rBody : void 0,
59
+ method: i,
60
+ headers: s,
61
+ ...e == null ? void 0 : e.init
62
+ });
63
+ });
64
+ this.url = r, this.method = e;
65
+ }
66
+ }, E = (r, e) => v(function i(t) {
67
+ var l;
68
+ const s = [...t.path], a = s.slice(-3).reverse();
69
+ if (a[0] === "toString")
70
+ return a[1] === "name" ? a[2] || "" : i.toString();
71
+ if (a[0] === "valueOf")
72
+ return a[1] === "name" ? a[2] || "" : i;
73
+ let u = "";
74
+ if (/^\$/.test(a[0])) {
75
+ const n = s.pop();
76
+ n && (u = n.replace(/^\$/, ""));
77
+ }
78
+ const o = s.join("/"), c = U(r, o);
79
+ if (u === "url") {
80
+ let n = c;
81
+ return t.args[0] && (t.args[0].param && (n = P(c, t.args[0].param)), t.args[0].query && (n = n + "?" + S(t.args[0].query).toString())), n = w(n), new URL(n);
82
+ }
83
+ if (u === "ws") {
84
+ const n = x(
85
+ t.args[0] && t.args[0].param ? P(c, t.args[0].param) : c,
86
+ "ws"
87
+ ), y = new URL(n), b = (l = t.args[0]) == null ? void 0 : l.query;
88
+ return b && Object.entries(b).forEach(([m, d]) => {
89
+ Array.isArray(d) ? d.forEach((q) => y.searchParams.append(m, q)) : y.searchParams.set(m, d);
90
+ }), ((...m) => (e == null ? void 0 : e.webSocket) !== void 0 && typeof e.webSocket == "function" ? e.webSocket(...m) : new WebSocket(...m))(y.toString());
91
+ }
92
+ const f = new T(c, u);
93
+ if (u) {
94
+ e ?? (e = {});
95
+ const n = C(e, { ...t.args[1] });
96
+ return f.fetch(t.args[0], n);
97
+ }
98
+ return f;
99
+ }, []);
45
100
  export {
46
- r as default
101
+ E as hc
47
102
  };