@instockng/storefront-ui 1.0.3 → 1.0.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"CartContext.d.ts","sourceRoot":"","sources":["../../src/contexts/CartContext.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,EAAkD,SAAS,EAAe,MAAM,OAAO,CAAC;AAC/F,OAAO,EAGL,aAAa,EAMb,eAAe,EACf,KAAK,IAAI,EACV,MAAM,iBAAiB,CAAC;AAKzB,UAAU,gBAAgB;IACxB,wBAAwB;IACxB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,mDAAmD;IACnD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,oBAAoB;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,gDAAgD;IAChD,kBAAkB,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;IACrD,+CAA+C;IAC/C,gBAAgB,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;IACrD,8BAA8B;IAC9B,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,2BAA2B;IAC3B,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,4BAA4B;IAC5B,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,0BAA0B;IAC1B,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,2BAA2B;IAC3B,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;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,iBAAiB,EAAE,EAAE,iBAAiB,2CAgLxG;AAED;;GAEG;AACH,wBAAgB,OAAO,qBAMtB"}
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  'use client';
2
- import { StorefrontProvider as m } from "./index2.mjs";
2
+ import { StorefrontProvider as p } from "./index2.mjs";
3
3
  import { CartProvider as a, useCart as i } from "./index3.mjs";
4
4
  import { OrderConfirmation as C } from "./index4.mjs";
5
5
  import { ProductCard as d } from "./index5.mjs";
6
6
  import { ProductGrid as n } from "./index6.mjs";
7
7
  import { CartItem as c } from "./index7.mjs";
8
- import { ShoppingCart as h } from "./index8.mjs";
9
- import { DiscountCodeInput as v } from "./index9.mjs";
10
- import { Checkout as A } from "./index10.mjs";
8
+ import { ShoppingCart as A } from "./index8.mjs";
9
+ import { DiscountCodeInput as D } from "./index9.mjs";
10
+ import { Checkout as y } from "./index10.mjs";
11
11
  import { Button as P } from "./index11.mjs";
12
12
  import { Card as G, CardContent as B, CardDescription as O, CardFooter as S, CardHeader as R, CardTitle as k } from "./index12.mjs";
13
13
  import { Badge as H } from "./index13.mjs";
@@ -19,10 +19,10 @@ import { ApiClientProvider as L, useApiClientContext as N } from "./index18.mjs"
19
19
  import { useApiConfig as V } from "./index19.mjs";
20
20
  import { getApiClient as X, initializeApiClient as Y, resetApiClient as _ } from "./index20.mjs";
21
21
  import { authHeaders as er, createAdminRpcClients as tr, createRpcClients as or } from "./index21.mjs";
22
- import { fetchProductBySlug as pr, fetchProductsByBrand as ar } from "./index22.mjs";
22
+ import { fetchProductBySlug as mr, fetchProductsByBrand as ar } from "./index22.mjs";
23
23
  import { addCartItem as fr, applyDiscount as Cr, checkoutCart as ur, createCart as dr, fetchCart as sr, removeCartItem as nr, removeDiscount as xr, updateCart as cr, updateCartItem as lr } from "./index23.mjs";
24
- import { confirmOrder as Dr, fetchOrder as vr } from "./index24.mjs";
25
- import { fetchDeliveryZones as Ar } from "./index25.mjs";
24
+ import { confirmOrder as hr, fetchOrder as Dr } from "./index24.mjs";
25
+ import { fetchDeliveryZones as yr } from "./index25.mjs";
26
26
  import { queryKeys as Pr } from "./index26.mjs";
27
27
  import * as r from "./index27.mjs";
28
28
  import * as e from "./index28.mjs";
@@ -42,30 +42,30 @@ export {
42
42
  k as CardTitle,
43
43
  c as CartItem,
44
44
  a as CartProvider,
45
- A as Checkout,
46
- v as DiscountCodeInput,
45
+ y as Checkout,
46
+ D as DiscountCodeInput,
47
47
  b as FormInput,
48
48
  z as FormSelect,
49
49
  U as Modal,
50
50
  C as OrderConfirmation,
51
51
  d as ProductCard,
52
52
  n as ProductGrid,
53
- h as ShoppingCart,
54
- m as StorefrontProvider,
53
+ A as ShoppingCart,
54
+ p as StorefrontProvider,
55
55
  fr as addCartItem,
56
- e as admin,
56
+ e as adminApi,
57
57
  Cr as applyDiscount,
58
58
  er as authHeaders,
59
59
  ur as checkoutCart,
60
60
  M as cn,
61
- Dr as confirmOrder,
61
+ hr as confirmOrder,
62
62
  tr as createAdminRpcClients,
63
63
  dr as createCart,
64
64
  or as createRpcClients,
65
65
  sr as fetchCart,
66
- Ar as fetchDeliveryZones,
67
- vr as fetchOrder,
68
- pr as fetchProductBySlug,
66
+ yr as fetchDeliveryZones,
67
+ Dr as fetchOrder,
68
+ mr as fetchProductBySlug,
69
69
  ar as fetchProductsByBrand,
70
70
  $ as formatCurrency,
71
71
  j as formatDate,
@@ -73,7 +73,7 @@ export {
73
73
  X as getApiClient,
74
74
  E as getStatusColor,
75
75
  Y as initializeApiClient,
76
- r as public,
76
+ r as publicApi,
77
77
  Pr as queryKeys,
78
78
  nr as removeCartItem,
79
79
  xr as removeDiscount,
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/index3.mjs CHANGED
@@ -1,28 +1,28 @@
1
1
  'use client';
2
2
  import { jsxs as L, jsx as O } from "react/jsx-runtime";
3
- import { createContext as F, useState as v, useEffect as m, useCallback as o, useContext as G } from "react";
3
+ import { createContext as F, useState as p, useEffect as m, useCallback as o, useContext as G } from "react";
4
4
  import "./index18.mjs";
5
5
  import { useCreateCart as K, useGetCart as T, useAddCartItem as Y, useUpdateCartItem as q, useRemoveCartItem as z, useApplyDiscount as B, useRemoveDiscount as H, useUpdateCart as J, useCheckoutCart as Q } from "./index29.mjs";
6
6
  import "@tanstack/react-query";
7
7
  import { ShoppingCart as V } from "./index8.mjs";
8
- const u = "oms_cart_id", D = F(null);
9
- function ot({ children: a, brandSlug: f, initialCartId: s, shoppingCartProps: g }) {
10
- const [t, i] = v(() => {
8
+ const u = "oms_cart_id", C = F(null);
9
+ function ot({ children: a, brandSlug: f, initialCartId: s, shoppingCartProps: I }) {
10
+ const [t, i] = p(() => {
11
11
  if (s) return s;
12
12
  if (typeof window < "u") {
13
13
  const n = new URLSearchParams(window.location.search).get("cartId");
14
14
  return n || localStorage.getItem(u);
15
15
  }
16
16
  return null;
17
- }), [d, l] = v(!1), w = K({
17
+ }), [d, l] = p(!1), y = K({
18
18
  onSuccess: (e) => {
19
19
  "error" in e || i(e.id);
20
20
  }
21
21
  });
22
22
  m(() => {
23
- !t && !s && w.mutate(f);
24
- }, [t, s, f, w]);
25
- const { data: A, isLoading: E, error: c, refetch: r } = T(t || "", {
23
+ !t && !s && y.mutate(f);
24
+ }, [t, s, f]);
25
+ const { data: h, isLoading: S, error: c, refetch: r } = T(t || "", {
26
26
  enabled: !!t,
27
27
  retry: !1
28
28
  // Don't retry on failure - cart might be invalid/expired
@@ -30,15 +30,15 @@ function ot({ children: a, brandSlug: f, initialCartId: s, shoppingCartProps: g
30
30
  m(() => {
31
31
  c && t && (console.warn("Cart fetch failed, creating new cart:", c), i(null), typeof window < "u" && localStorage.removeItem(u));
32
32
  }, [c, t]);
33
- const p = Y(t || "", {
33
+ const v = Y(t || "", {
34
34
  onSuccess: () => r()
35
- }), C = q(t || "", {
35
+ }), D = q(t || "", {
36
36
  onSuccess: () => r()
37
- }), I = z(t || "", {
37
+ }), g = z(t || "", {
38
38
  onSuccess: () => r()
39
- }), y = B(t || "", {
39
+ }), A = B(t || "", {
40
40
  onSuccess: () => r()
41
- }), h = H(t || "", {
41
+ }), E = H(t || "", {
42
42
  onSuccess: () => r()
43
43
  }), M = J(t || "", {
44
44
  onSuccess: () => r()
@@ -49,40 +49,44 @@ function ot({ children: a, brandSlug: f, initialCartId: s, shoppingCartProps: g
49
49
  const P = o(
50
50
  async (e, n) => {
51
51
  if (!t) throw new Error("No cart ID");
52
- await p.mutateAsync({ sku: e, quantity: n });
52
+ await v.mutateAsync({ sku: e, quantity: n });
53
53
  },
54
- [t, p]
54
+ // eslint-disable-next-line react-hooks/exhaustive-deps
55
+ [t]
55
56
  ), N = o(
56
57
  async (e, n) => {
57
58
  if (!t) throw new Error("No cart ID");
58
- await C.mutateAsync({ itemId: e, quantity: n });
59
+ await D.mutateAsync({ itemId: e, quantity: n });
59
60
  },
60
- [t, C]
61
+ // eslint-disable-next-line react-hooks/exhaustive-deps
62
+ [t]
61
63
  ), R = o(
62
64
  async (e) => {
63
65
  if (!t) throw new Error("No cart ID");
64
- await I.mutateAsync(e);
66
+ await g.mutateAsync(e);
65
67
  },
66
- [t, I]
68
+ // eslint-disable-next-line react-hooks/exhaustive-deps
69
+ [t]
67
70
  ), U = o(
68
71
  async (e) => {
69
72
  if (!t) throw new Error("No cart ID");
70
- await y.mutateAsync({ code: e });
73
+ await A.mutateAsync({ code: e });
71
74
  },
72
- [t, y]
75
+ // eslint-disable-next-line react-hooks/exhaustive-deps
76
+ [t]
73
77
  ), _ = o(async () => {
74
78
  if (!t) throw new Error("No cart ID");
75
- await h.mutateAsync();
76
- }, [t, h]), k = o(() => {
79
+ await E.mutateAsync();
80
+ }, [t]), k = o(() => {
77
81
  i(null), typeof window < "u" && localStorage.removeItem(u);
78
82
  }, []), b = o(() => {
79
83
  l(!0);
80
- }, []), S = o(() => {
84
+ }, []), w = o(() => {
81
85
  l(!1);
82
86
  }, []), j = {
83
- cart: A || null,
87
+ cart: h || null,
84
88
  cartId: t,
85
- isLoading: E,
89
+ isLoading: S,
86
90
  error: c,
87
91
  updateCartMutation: M,
88
92
  checkoutMutation: x,
@@ -95,28 +99,28 @@ function ot({ children: a, brandSlug: f, initialCartId: s, shoppingCartProps: g
95
99
  refetch: r,
96
100
  isOpen: d,
97
101
  open: b,
98
- close: S
102
+ close: w
99
103
  };
100
- return /* @__PURE__ */ L(D.Provider, { value: j, children: [
104
+ return /* @__PURE__ */ L(C.Provider, { value: j, children: [
101
105
  a,
102
106
  /* @__PURE__ */ O(
103
107
  V,
104
108
  {
105
109
  isOpen: d,
106
- onClose: S,
107
- ...g
110
+ onClose: w,
111
+ ...I
108
112
  }
109
113
  )
110
114
  ] });
111
115
  }
112
116
  function rt() {
113
- const a = G(D);
117
+ const a = G(C);
114
118
  if (!a)
115
119
  throw new Error("useCart must be used within CartProvider");
116
120
  return a;
117
121
  }
118
122
  export {
119
- D as CartContext,
123
+ C as CartContext,
120
124
  ot as CartProvider,
121
125
  rt as useCart
122
126
  };
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 "./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;
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 "./index79.mjs";
6
+ import { mergePath as U, replaceUrlParam as P, buildSearchParams as S, removeIndexString as w, replaceUrlProtocol as x, deepMerge as C } from "./index80.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
  };