@instockng/storefront-ui 1.0.7 → 1.0.9
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.
- package/dist/contexts/CartContext.d.ts.map +1 -1
- package/dist/index105.mjs +1 -1
- package/dist/index3.mjs +71 -73
- package/dist/index81.mjs +1 -1
- package/dist/index83.mjs +1 -1
- package/dist/index84.mjs +2 -2
- package/dist/index88.mjs +2 -2
- package/dist/index93.mjs +12 -30
- package/dist/index94.mjs +7 -11
- package/dist/index95.mjs +30 -3
- package/dist/index96.mjs +10 -3
- package/dist/index97.mjs +4 -13
- package/dist/index98.mjs +4 -7
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CartContext.d.ts","sourceRoot":"","sources":["../../src/contexts/CartContext.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,EAAkD,SAAS,
|
|
1
|
+
{"version":3,"file":"CartContext.d.ts","sourceRoot":"","sources":["../../src/contexts/CartContext.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,EAAkD,SAAS,EAAuB,MAAM,OAAO,CAAC;AACvG,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,EA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,131 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { createContext as
|
|
2
|
+
import { jsxs as L, jsx as O } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as z, useState as p, useRef as G, useEffect as l, useCallback as r, useContext as K } from "react";
|
|
4
4
|
import "./index18.mjs";
|
|
5
|
-
import { useCreateCart as
|
|
5
|
+
import { useCreateCart as T, useGetCart as Y, useAddCartItem as q, useUpdateCartItem as B, useRemoveCartItem as H, useApplyDiscount as J, useRemoveDiscount as Q, useUpdateCart as V, useCheckoutCart as W } from "./index29.mjs";
|
|
6
6
|
import "@tanstack/react-query";
|
|
7
7
|
import { ShoppingCart as X } from "./index8.mjs";
|
|
8
|
-
const
|
|
9
|
-
function nt({ children: a, brandSlug:
|
|
10
|
-
const [t,
|
|
11
|
-
if (
|
|
8
|
+
const s = "oms_cart_id", C = z(null);
|
|
9
|
+
function nt({ children: a, brandSlug: I, initialCartId: u, shoppingCartProps: y }) {
|
|
10
|
+
const [t, i] = p(() => {
|
|
11
|
+
if (u) return u;
|
|
12
12
|
if (typeof window < "u") {
|
|
13
13
|
const n = new URLSearchParams(window.location.search).get("cartId");
|
|
14
|
-
return n || localStorage.getItem(
|
|
14
|
+
return n || localStorage.getItem(s);
|
|
15
15
|
}
|
|
16
16
|
return null;
|
|
17
|
-
}), [
|
|
17
|
+
}), [m, f] = p(!1), d = G(!1), h = T({
|
|
18
18
|
onSuccess: (e) => {
|
|
19
19
|
if ("error" in e) {
|
|
20
|
-
|
|
20
|
+
console.error("Failed to create cart:", e.error);
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
i(e.id);
|
|
24
24
|
},
|
|
25
|
-
onError: () => {
|
|
26
|
-
|
|
25
|
+
onError: (e) => {
|
|
26
|
+
console.error("Failed to create cart:", e);
|
|
27
27
|
}
|
|
28
|
-
})
|
|
29
|
-
d(() => {
|
|
30
|
-
!t && !s && !f && (c(!0), S.mutate(w));
|
|
31
|
-
}, [t, s, w]);
|
|
32
|
-
const { data: v, isLoading: D, error: u, refetch: r } = q(t || "", {
|
|
28
|
+
}), { data: S, isLoading: v, error: c, refetch: o } = Y(t || "", {
|
|
33
29
|
enabled: !!t,
|
|
34
30
|
retry: !1
|
|
35
31
|
// Don't retry on failure - cart might be invalid/expired
|
|
36
32
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
onSuccess: () =>
|
|
44
|
-
}),
|
|
45
|
-
onSuccess: () =>
|
|
46
|
-
}),
|
|
47
|
-
onSuccess: () =>
|
|
48
|
-
}),
|
|
49
|
-
onSuccess: () =>
|
|
50
|
-
}),
|
|
51
|
-
onSuccess: () =>
|
|
52
|
-
}),
|
|
53
|
-
|
|
54
|
-
|
|
33
|
+
l(() => {
|
|
34
|
+
!d.current && !t && !u && (d.current = !0, h.mutate(I));
|
|
35
|
+
}, []), l(() => {
|
|
36
|
+
c && t && (console.warn("Cart fetch failed, clearing invalid cart:", c), i(null), typeof window < "u" && localStorage.removeItem(s));
|
|
37
|
+
}, [c, t]);
|
|
38
|
+
const D = q(t || "", {
|
|
39
|
+
onSuccess: () => o()
|
|
40
|
+
}), g = B(t || "", {
|
|
41
|
+
onSuccess: () => o()
|
|
42
|
+
}), E = H(t || "", {
|
|
43
|
+
onSuccess: () => o()
|
|
44
|
+
}), A = J(t || "", {
|
|
45
|
+
onSuccess: () => o()
|
|
46
|
+
}), M = Q(t || "", {
|
|
47
|
+
onSuccess: () => o()
|
|
48
|
+
}), x = V(t || "", {
|
|
49
|
+
onSuccess: () => o()
|
|
50
|
+
}), P = W(t || "");
|
|
51
|
+
l(() => {
|
|
52
|
+
t && typeof window < "u" && localStorage.setItem(s, t);
|
|
55
53
|
}, [t]);
|
|
56
|
-
const R =
|
|
54
|
+
const R = r(
|
|
57
55
|
async (e, n) => {
|
|
58
56
|
if (!t) throw new Error("No cart ID");
|
|
59
|
-
await
|
|
57
|
+
await D.mutateAsync({ sku: e, quantity: n });
|
|
60
58
|
},
|
|
61
59
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
62
60
|
[t]
|
|
63
|
-
),
|
|
61
|
+
), N = r(
|
|
64
62
|
async (e, n) => {
|
|
65
63
|
if (!t) throw new Error("No cart ID");
|
|
66
|
-
await
|
|
64
|
+
await g.mutateAsync({ itemId: e, quantity: n });
|
|
67
65
|
},
|
|
68
66
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
67
|
[t]
|
|
70
|
-
),
|
|
68
|
+
), U = r(
|
|
71
69
|
async (e) => {
|
|
72
70
|
if (!t) throw new Error("No cart ID");
|
|
73
|
-
await
|
|
71
|
+
await E.mutateAsync(e);
|
|
74
72
|
},
|
|
75
73
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
76
74
|
[t]
|
|
77
|
-
),
|
|
75
|
+
), _ = r(
|
|
78
76
|
async (e) => {
|
|
79
77
|
if (!t) throw new Error("No cart ID");
|
|
80
|
-
await
|
|
78
|
+
await A.mutateAsync({ code: e });
|
|
81
79
|
},
|
|
82
80
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
83
81
|
[t]
|
|
84
|
-
), b =
|
|
82
|
+
), b = r(async () => {
|
|
85
83
|
if (!t) throw new Error("No cart ID");
|
|
86
|
-
await
|
|
87
|
-
}, [t]),
|
|
88
|
-
|
|
89
|
-
}, []),
|
|
90
|
-
|
|
91
|
-
}, []),
|
|
92
|
-
|
|
93
|
-
}, []),
|
|
94
|
-
cart:
|
|
84
|
+
await M.mutateAsync();
|
|
85
|
+
}, [t]), k = r(() => {
|
|
86
|
+
i(null), typeof window < "u" && localStorage.removeItem(s);
|
|
87
|
+
}, []), F = r(() => {
|
|
88
|
+
f(!0);
|
|
89
|
+
}, []), w = r(() => {
|
|
90
|
+
f(!1);
|
|
91
|
+
}, []), j = {
|
|
92
|
+
cart: S || null,
|
|
95
93
|
cartId: t,
|
|
96
|
-
isLoading:
|
|
97
|
-
error:
|
|
98
|
-
updateCartMutation:
|
|
99
|
-
checkoutMutation:
|
|
94
|
+
isLoading: v,
|
|
95
|
+
error: c,
|
|
96
|
+
updateCartMutation: x,
|
|
97
|
+
checkoutMutation: P,
|
|
100
98
|
addItem: R,
|
|
101
|
-
updateItem:
|
|
102
|
-
removeItem:
|
|
103
|
-
applyDiscount:
|
|
99
|
+
updateItem: N,
|
|
100
|
+
removeItem: U,
|
|
101
|
+
applyDiscount: _,
|
|
104
102
|
removeDiscount: b,
|
|
105
|
-
clearCart:
|
|
106
|
-
refetch:
|
|
107
|
-
isOpen:
|
|
108
|
-
open:
|
|
109
|
-
close:
|
|
103
|
+
clearCart: k,
|
|
104
|
+
refetch: o,
|
|
105
|
+
isOpen: m,
|
|
106
|
+
open: F,
|
|
107
|
+
close: w
|
|
110
108
|
};
|
|
111
|
-
return /* @__PURE__ */
|
|
109
|
+
return /* @__PURE__ */ L(C.Provider, { value: j, children: [
|
|
112
110
|
a,
|
|
113
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ O(
|
|
114
112
|
X,
|
|
115
113
|
{
|
|
116
|
-
isOpen:
|
|
117
|
-
onClose:
|
|
118
|
-
...
|
|
114
|
+
isOpen: m,
|
|
115
|
+
onClose: w,
|
|
116
|
+
...y
|
|
119
117
|
}
|
|
120
118
|
)
|
|
121
119
|
] });
|
|
122
120
|
}
|
|
123
121
|
function at() {
|
|
124
|
-
const a =
|
|
122
|
+
const a = K(C);
|
|
125
123
|
if (!a)
|
|
126
124
|
throw new Error("useCart must be used within CartProvider");
|
|
127
125
|
return a;
|
|
128
126
|
}
|
|
129
127
|
export {
|
|
130
|
-
|
|
128
|
+
C as CartContext,
|
|
131
129
|
nt as CartProvider,
|
|
132
130
|
at as useCart
|
|
133
131
|
};
|
package/dist/index81.mjs
CHANGED
package/dist/index83.mjs
CHANGED
package/dist/index84.mjs
CHANGED
package/dist/index88.mjs
CHANGED
package/dist/index93.mjs
CHANGED
|
@@ -1,34 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g, function(r) {
|
|
14
|
-
return t[r];
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
function a(n, t) {
|
|
18
|
-
this._pairs = [], n && p(n, this, t);
|
|
19
|
-
}
|
|
20
|
-
const c = a.prototype;
|
|
21
|
-
c.append = function(t, o) {
|
|
22
|
-
this._pairs.push([t, o]);
|
|
23
|
-
};
|
|
24
|
-
c.toString = function(t) {
|
|
25
|
-
const o = t ? function(r) {
|
|
26
|
-
return t.call(this, r, i);
|
|
27
|
-
} : i;
|
|
28
|
-
return this._pairs.map(function(e) {
|
|
29
|
-
return o(e[0]) + "=" + o(e[1]);
|
|
30
|
-
}, "").join("&");
|
|
2
|
+
import o from "./index105.mjs";
|
|
3
|
+
import r from "./index106.mjs";
|
|
4
|
+
import t from "./index107.mjs";
|
|
5
|
+
const l = {
|
|
6
|
+
isBrowser: !0,
|
|
7
|
+
classes: {
|
|
8
|
+
URLSearchParams: o,
|
|
9
|
+
FormData: r,
|
|
10
|
+
Blob: t
|
|
11
|
+
},
|
|
12
|
+
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
31
13
|
};
|
|
32
14
|
export {
|
|
33
|
-
|
|
15
|
+
l as default
|
|
34
16
|
};
|
package/dist/index94.mjs
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import s from "./index76.mjs";
|
|
5
|
-
function h(f, t) {
|
|
6
|
-
const o = this || m, r = t || o, n = s.from(r.headers);
|
|
7
|
-
let a = r.data;
|
|
8
|
-
return i.forEach(f, function(e) {
|
|
9
|
-
a = e.call(o, a, n.normalize(), t ? t.status : void 0);
|
|
10
|
-
}), n.normalize(), a;
|
|
11
|
-
}
|
|
2
|
+
const e = typeof window < "u" && typeof document < "u", o = typeof navigator == "object" && navigator || void 0, n = e && (!o || ["ReactNative", "NativeScript", "NS"].indexOf(o.product) < 0), t = typeof WorkerGlobalScope < "u" && // eslint-disable-next-line no-undef
|
|
3
|
+
self instanceof WorkerGlobalScope && typeof self.importScripts == "function", r = e && window.location.href || "http://localhost";
|
|
12
4
|
export {
|
|
13
|
-
|
|
5
|
+
e as hasBrowserEnv,
|
|
6
|
+
n as hasStandardBrowserEnv,
|
|
7
|
+
t as hasStandardBrowserWebWorkerEnv,
|
|
8
|
+
o as navigator,
|
|
9
|
+
r as origin
|
|
14
10
|
};
|
package/dist/index95.mjs
CHANGED
|
@@ -1,7 +1,34 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import p from "./index72.mjs";
|
|
3
|
+
function i(n) {
|
|
4
|
+
const t = {
|
|
5
|
+
"!": "%21",
|
|
6
|
+
"'": "%27",
|
|
7
|
+
"(": "%28",
|
|
8
|
+
")": "%29",
|
|
9
|
+
"~": "%7E",
|
|
10
|
+
"%20": "+",
|
|
11
|
+
"%00": "\0"
|
|
12
|
+
};
|
|
13
|
+
return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g, function(r) {
|
|
14
|
+
return t[r];
|
|
15
|
+
});
|
|
4
16
|
}
|
|
17
|
+
function a(n, t) {
|
|
18
|
+
this._pairs = [], n && p(n, this, t);
|
|
19
|
+
}
|
|
20
|
+
const c = a.prototype;
|
|
21
|
+
c.append = function(t, o) {
|
|
22
|
+
this._pairs.push([t, o]);
|
|
23
|
+
};
|
|
24
|
+
c.toString = function(t) {
|
|
25
|
+
const o = t ? function(r) {
|
|
26
|
+
return t.call(this, r, i);
|
|
27
|
+
} : i;
|
|
28
|
+
return this._pairs.map(function(e) {
|
|
29
|
+
return o(e[0]) + "=" + o(e[1]);
|
|
30
|
+
}, "").join("&");
|
|
31
|
+
};
|
|
5
32
|
export {
|
|
6
|
-
|
|
33
|
+
a as default
|
|
7
34
|
};
|
package/dist/index96.mjs
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import i from "./index62.mjs";
|
|
3
|
+
import m from "./index66.mjs";
|
|
4
|
+
import s from "./index76.mjs";
|
|
5
|
+
function h(f, t) {
|
|
6
|
+
const o = this || m, r = t || o, n = s.from(r.headers);
|
|
7
|
+
let a = r.data;
|
|
8
|
+
return i.forEach(f, function(e) {
|
|
9
|
+
a = e.call(o, a, n.normalize(), t ? t.status : void 0);
|
|
10
|
+
}), n.normalize(), a;
|
|
4
11
|
}
|
|
5
12
|
export {
|
|
6
|
-
|
|
13
|
+
h as default
|
|
7
14
|
};
|
package/dist/index97.mjs
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const l = {
|
|
6
|
-
isBrowser: !0,
|
|
7
|
-
classes: {
|
|
8
|
-
URLSearchParams: o,
|
|
9
|
-
FormData: r,
|
|
10
|
-
Blob: t
|
|
11
|
-
},
|
|
12
|
-
protocols: ["http", "https", "file", "blob", "url", "data"]
|
|
13
|
-
};
|
|
2
|
+
function e(t) {
|
|
3
|
+
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
|
|
4
|
+
}
|
|
14
5
|
export {
|
|
15
|
-
|
|
6
|
+
e as default
|
|
16
7
|
};
|
package/dist/index98.mjs
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
function n(e, c) {
|
|
3
|
+
return c ? e.replace(/\/?\/$/, "") + "/" + c.replace(/^\/+/, "") : e;
|
|
4
|
+
}
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
-
n as hasStandardBrowserEnv,
|
|
7
|
-
t as hasStandardBrowserWebWorkerEnv,
|
|
8
|
-
o as navigator,
|
|
9
|
-
r as origin
|
|
6
|
+
n as default
|
|
10
7
|
};
|