@instockng/storefront-ui 1.0.11 → 1.0.13
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/components/Checkout.d.ts.map +1 -1
- package/dist/components/ShoppingCart.d.ts.map +1 -1
- package/dist/contexts/CartContext.d.ts +2 -0
- package/dist/contexts/CartContext.d.ts.map +1 -1
- package/dist/index10.mjs +70 -70
- package/dist/index101.mjs +1 -1
- package/dist/index102.mjs +3 -3
- package/dist/index103.mjs +3 -3
- package/dist/index105.mjs +1 -1
- package/dist/index111.mjs +1 -1
- package/dist/index29.mjs +1 -1
- package/dist/index3.mjs +83 -78
- package/dist/index30.mjs +1 -1
- package/dist/index31.mjs +1 -1
- package/dist/index32.mjs +1 -1
- package/dist/index42.mjs +17 -17
- package/dist/index43.mjs +2 -2
- package/dist/index44.mjs +1 -1
- package/dist/index45.mjs +1 -1
- package/dist/index46.mjs +1 -1
- package/dist/index47.mjs +1 -1
- package/dist/index48.mjs +1 -1
- package/dist/index49.mjs +1 -1
- package/dist/index50.mjs +1 -1
- package/dist/index51.mjs +1 -1
- package/dist/index52.mjs +1 -1
- package/dist/index53.mjs +1 -1
- package/dist/index54.mjs +1 -1
- package/dist/index58.mjs +2 -2
- package/dist/index59.mjs +3 -4
- package/dist/index60.mjs +2 -4
- package/dist/index61.mjs +5 -2
- package/dist/index62.mjs +231 -30
- package/dist/index63.mjs +5 -42
- package/dist/index64.mjs +127 -228
- package/dist/index65.mjs +66 -4
- package/dist/index66.mjs +77 -124
- package/dist/index67.mjs +26 -65
- package/dist/index68.mjs +6 -84
- package/dist/index69.mjs +72 -26
- package/dist/index70.mjs +3 -8
- package/dist/index71.mjs +2 -75
- package/dist/index72.mjs +82 -3
- package/dist/index73.mjs +54 -2
- package/dist/index74.mjs +5 -82
- package/dist/index75.mjs +4 -53
- package/dist/index76.mjs +178 -5
- package/dist/index77.mjs +53 -5
- package/dist/index78.mjs +68 -178
- package/dist/index79.mjs +31 -50
- package/dist/index8.mjs +8 -7
- package/dist/index80.mjs +43 -69
- package/dist/index81.mjs +2 -2
- package/dist/index82.mjs +1 -1
- package/dist/index83.mjs +6 -6
- package/dist/index84.mjs +2 -2
- package/dist/index85.mjs +2 -2
- package/dist/index87.mjs +2 -2
- package/dist/index88.mjs +2 -2
- package/dist/index89.mjs +1 -1
- package/dist/index91.mjs +4 -4
- package/dist/index92.mjs +3 -3
- 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/dist/index99.mjs +1 -1
- package/dist/test-utils/MockCartProvider.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Checkout.tsx +9 -1
- package/src/components/ShoppingCart.tsx +1 -0
- package/src/contexts/CartContext.tsx +51 -24
- package/src/test-utils/MockCartProvider.tsx +8 -0
package/dist/index8.mjs
CHANGED
|
@@ -23,7 +23,7 @@ function W({
|
|
|
23
23
|
emptyMessage: I = "Your cart is empty"
|
|
24
24
|
}) {
|
|
25
25
|
var x, y, g;
|
|
26
|
-
const { cart: t, isLoading: i, error: m } = q(), [
|
|
26
|
+
const { cart: t, isLoading: i, error: m } = q(), [S, u] = Y(!1);
|
|
27
27
|
b(() => (s ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
|
|
28
28
|
document.body.style.overflow = "";
|
|
29
29
|
}), [s]), b(() => {
|
|
@@ -32,9 +32,9 @@ function W({
|
|
|
32
32
|
};
|
|
33
33
|
return window.addEventListener("keydown", r), () => window.removeEventListener("keydown", r);
|
|
34
34
|
}, [s, l]);
|
|
35
|
-
const
|
|
35
|
+
const D = ((x = t == null ? void 0 : t.pricing) == null ? void 0 : x.subtotal) || 0, p = ((y = t == null ? void 0 : t.pricing.discount) == null ? void 0 : y.amount) || 0, F = () => {
|
|
36
36
|
u(!0), d == null || d();
|
|
37
|
-
},
|
|
37
|
+
}, P = () => {
|
|
38
38
|
o == null || o(), l();
|
|
39
39
|
};
|
|
40
40
|
return /* @__PURE__ */ a(N, { children: [
|
|
@@ -103,7 +103,7 @@ function W({
|
|
|
103
103
|
/* @__PURE__ */ a("div", { className: "p-4 space-y-2", children: [
|
|
104
104
|
/* @__PURE__ */ a("div", { className: "flex justify-between", children: [
|
|
105
105
|
/* @__PURE__ */ e("span", { className: "text-gray-600", children: "Subtotal" }),
|
|
106
|
-
/* @__PURE__ */ e("span", { className: "font-semibold", children: n(
|
|
106
|
+
/* @__PURE__ */ e("span", { className: "font-semibold", children: n(D) })
|
|
107
107
|
] }),
|
|
108
108
|
p > 0 && /* @__PURE__ */ a("div", { className: "flex justify-between text-green-600", children: [
|
|
109
109
|
/* @__PURE__ */ e("span", { children: "Discount" }),
|
|
@@ -126,7 +126,7 @@ function W({
|
|
|
126
126
|
/* @__PURE__ */ a(
|
|
127
127
|
v,
|
|
128
128
|
{
|
|
129
|
-
onClick:
|
|
129
|
+
onClick: F,
|
|
130
130
|
disabled: z || t.items.length === 0,
|
|
131
131
|
className: c("w-full bg-accent-500 text-white hover:bg-accent-600", E),
|
|
132
132
|
size: "lg",
|
|
@@ -139,7 +139,7 @@ function W({
|
|
|
139
139
|
/* @__PURE__ */ e(
|
|
140
140
|
v,
|
|
141
141
|
{
|
|
142
|
-
onClick:
|
|
142
|
+
onClick: P,
|
|
143
143
|
variant: "outline",
|
|
144
144
|
className: c("w-full border-gray-300 text-gray-600 hover:bg-gray-100", L),
|
|
145
145
|
size: "lg",
|
|
@@ -155,7 +155,8 @@ function W({
|
|
|
155
155
|
/* @__PURE__ */ e(
|
|
156
156
|
X,
|
|
157
157
|
{
|
|
158
|
-
isOpen:
|
|
158
|
+
isOpen: S,
|
|
159
|
+
onSuccess: () => l(),
|
|
159
160
|
onClose: () => u(!1)
|
|
160
161
|
}
|
|
161
162
|
)
|
package/dist/index80.mjs
CHANGED
|
@@ -1,72 +1,46 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
PayloadTooLarge: 413,
|
|
40
|
-
UriTooLong: 414,
|
|
41
|
-
UnsupportedMediaType: 415,
|
|
42
|
-
RangeNotSatisfiable: 416,
|
|
43
|
-
ExpectationFailed: 417,
|
|
44
|
-
ImATeapot: 418,
|
|
45
|
-
MisdirectedRequest: 421,
|
|
46
|
-
UnprocessableEntity: 422,
|
|
47
|
-
Locked: 423,
|
|
48
|
-
FailedDependency: 424,
|
|
49
|
-
TooEarly: 425,
|
|
50
|
-
UpgradeRequired: 426,
|
|
51
|
-
PreconditionRequired: 428,
|
|
52
|
-
TooManyRequests: 429,
|
|
53
|
-
RequestHeaderFieldsTooLarge: 431,
|
|
54
|
-
UnavailableForLegalReasons: 451,
|
|
55
|
-
InternalServerError: 500,
|
|
56
|
-
NotImplemented: 501,
|
|
57
|
-
BadGateway: 502,
|
|
58
|
-
ServiceUnavailable: 503,
|
|
59
|
-
GatewayTimeout: 504,
|
|
60
|
-
HttpVersionNotSupported: 505,
|
|
61
|
-
VariantAlsoNegotiates: 506,
|
|
62
|
-
InsufficientStorage: 507,
|
|
63
|
-
LoopDetected: 508,
|
|
64
|
-
NotExtended: 510,
|
|
65
|
-
NetworkAuthenticationRequired: 511
|
|
66
|
-
};
|
|
67
|
-
Object.entries(e).forEach(([t, o]) => {
|
|
68
|
-
e[o] = t;
|
|
69
|
-
});
|
|
2
|
+
var s = (e, r) => (e = e.replace(/\/+$/, ""), e = e + "/", r = r.replace(/^\/+/, ""), e + r), p = (e, r) => {
|
|
3
|
+
for (const [n, t] of Object.entries(r)) {
|
|
4
|
+
const c = new RegExp("/:" + n + "(?:{[^/]+})?\\??");
|
|
5
|
+
e = e.replace(c, t ? `/${t}` : "");
|
|
6
|
+
}
|
|
7
|
+
return e;
|
|
8
|
+
}, f = (e) => {
|
|
9
|
+
const r = new URLSearchParams();
|
|
10
|
+
for (const [n, t] of Object.entries(e))
|
|
11
|
+
if (t !== void 0)
|
|
12
|
+
if (Array.isArray(t))
|
|
13
|
+
for (const c of t)
|
|
14
|
+
r.append(n, c);
|
|
15
|
+
else
|
|
16
|
+
r.set(n, t);
|
|
17
|
+
return r;
|
|
18
|
+
}, i = (e, r) => {
|
|
19
|
+
switch (r) {
|
|
20
|
+
case "ws":
|
|
21
|
+
return e.replace(/^http/, "ws");
|
|
22
|
+
case "http":
|
|
23
|
+
return e.replace(/^ws/, "http");
|
|
24
|
+
}
|
|
25
|
+
}, l = (e) => /^https?:\/\/[^\/]+?\/index(?=\?|$)/.test(e) ? e.replace(/\/index(?=\?|$)/, "/") : e.replace(/\/index(?=\?|$)/, "");
|
|
26
|
+
function a(e) {
|
|
27
|
+
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
28
|
+
}
|
|
29
|
+
function o(e, r) {
|
|
30
|
+
if (!a(e) && !a(r))
|
|
31
|
+
return r;
|
|
32
|
+
const n = { ...e };
|
|
33
|
+
for (const t in r) {
|
|
34
|
+
const c = r[t];
|
|
35
|
+
a(n[t]) && a(c) ? n[t] = o(n[t], c) : n[t] = c;
|
|
36
|
+
}
|
|
37
|
+
return n;
|
|
38
|
+
}
|
|
70
39
|
export {
|
|
71
|
-
|
|
40
|
+
f as buildSearchParams,
|
|
41
|
+
o as deepMerge,
|
|
42
|
+
s as mergePath,
|
|
43
|
+
l as removeIndexString,
|
|
44
|
+
p as replaceUrlParam,
|
|
45
|
+
i as replaceUrlProtocol
|
|
72
46
|
};
|
package/dist/index81.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import f from "./
|
|
3
|
-
import d from "./
|
|
2
|
+
import f from "./index62.mjs";
|
|
3
|
+
import d from "./index95.mjs";
|
|
4
4
|
function l(e) {
|
|
5
5
|
return encodeURIComponent(e).replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%20/g, "+");
|
|
6
6
|
}
|
package/dist/index82.mjs
CHANGED
package/dist/index83.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import r from "./
|
|
3
|
-
import p from "./
|
|
4
|
-
import l from "./
|
|
5
|
-
import m from "./
|
|
6
|
-
import a from "./
|
|
7
|
-
import o from "./
|
|
2
|
+
import r from "./index96.mjs";
|
|
3
|
+
import p from "./index70.mjs";
|
|
4
|
+
import l from "./index66.mjs";
|
|
5
|
+
import m from "./index68.mjs";
|
|
6
|
+
import a from "./index76.mjs";
|
|
7
|
+
import o from "./index77.mjs";
|
|
8
8
|
function d(e) {
|
|
9
9
|
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted)
|
|
10
10
|
throw new m(null, e);
|
package/dist/index84.mjs
CHANGED
package/dist/index85.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { VERSION as w } from "./
|
|
3
|
-
import s from "./
|
|
2
|
+
import { VERSION as w } from "./index71.mjs";
|
|
3
|
+
import s from "./index73.mjs";
|
|
4
4
|
const l = {};
|
|
5
5
|
["object", "boolean", "number", "function", "string", "symbol"].forEach((n, t) => {
|
|
6
6
|
l[n] = function(o) {
|
package/dist/index87.mjs
CHANGED
package/dist/index88.mjs
CHANGED
package/dist/index89.mjs
CHANGED
package/dist/index91.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import H from "./
|
|
2
|
+
import H from "./index62.mjs";
|
|
3
3
|
import D from "./index99.mjs";
|
|
4
4
|
import L from "./index86.mjs";
|
|
5
|
-
import n from "./
|
|
6
|
-
import y from "./
|
|
5
|
+
import n from "./index73.mjs";
|
|
6
|
+
import y from "./index68.mjs";
|
|
7
7
|
import O from "./index100.mjs";
|
|
8
8
|
import U from "./index88.mjs";
|
|
9
|
-
import q from "./
|
|
9
|
+
import q from "./index76.mjs";
|
|
10
10
|
import { progressEventReducer as A } from "./index101.mjs";
|
|
11
11
|
import v from "./index102.mjs";
|
|
12
12
|
const N = typeof XMLHttpRequest < "u", Q = N && function(s) {
|
package/dist/index92.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import K from "./index88.mjs";
|
|
3
|
-
import t from "./
|
|
4
|
-
import b from "./
|
|
3
|
+
import t from "./index62.mjs";
|
|
4
|
+
import b from "./index73.mjs";
|
|
5
5
|
import ee from "./index103.mjs";
|
|
6
6
|
import { trackStream as z } from "./index104.mjs";
|
|
7
|
-
import te from "./
|
|
7
|
+
import te from "./index76.mjs";
|
|
8
8
|
import { progressEventDecorator as I, progressEventReducer as M, asyncDecorator as j } from "./index101.mjs";
|
|
9
9
|
import se from "./index102.mjs";
|
|
10
10
|
import re from "./index99.mjs";
|
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 "./index78.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
|
};
|
package/dist/index99.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockCartProvider.d.ts","sourceRoot":"","sources":["../../src/test-utils/MockCartProvider.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAyB,MAAM,OAAO,CAAC;AAGzD,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,iBAAiB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAiHpE,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,kDAAkD;IAClD,iBAAiB,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;IAClE,mEAAmE;IACnE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,IAAI,EAAE,YAAY,EAClB,SAAiB,EACjB,KAAY,EACZ,iBAAiB,EACjB,UAAiB,GAClB,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"MockCartProvider.d.ts","sourceRoot":"","sources":["../../src/test-utils/MockCartProvider.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAyB,MAAM,OAAO,CAAC;AAGzD,OAAO,KAAK,EAAE,IAAI,EAAuB,MAAM,iBAAiB,CAAC;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAiHpE,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,kDAAkD;IAClD,iBAAiB,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;IAClE,mEAAmE;IACnE,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,IAAI,EAAE,YAAY,EAClB,SAAiB,EACjB,KAAY,EACZ,iBAAiB,EACjB,UAAiB,GAClB,EAAE,qBAAqB,2CAkSvB"}
|
package/package.json
CHANGED
|
@@ -147,7 +147,7 @@ export function Checkout({
|
|
|
147
147
|
const [completedOrder, setCompletedOrder] = useState<Order | null>(null);
|
|
148
148
|
|
|
149
149
|
// Get cart from CartProvider context (required)
|
|
150
|
-
const { refetch: refetchCart, isLoading: isLoadingCart, cart, updateCartMutation, checkoutMutation } = useCart();
|
|
150
|
+
const { refetch: refetchCart, isLoading: isLoadingCart, cart, updateCartMutation, checkoutMutation, clearAndCreateNewCart } = useCart();
|
|
151
151
|
|
|
152
152
|
// Paystack payment integration
|
|
153
153
|
const paystack = usePaystackPayment({
|
|
@@ -176,6 +176,10 @@ export function Checkout({
|
|
|
176
176
|
|
|
177
177
|
// Store the completed order to show success view
|
|
178
178
|
setCompletedOrder(order as Order);
|
|
179
|
+
|
|
180
|
+
// Clear the cart and create a new one for next purchase
|
|
181
|
+
clearAndCreateNewCart();
|
|
182
|
+
|
|
179
183
|
onSuccess?.(order.id);
|
|
180
184
|
} catch (error) {
|
|
181
185
|
onError?.(error as Error);
|
|
@@ -431,6 +435,10 @@ export function Checkout({
|
|
|
431
435
|
|
|
432
436
|
// Store the completed order to show success view
|
|
433
437
|
setCompletedOrder(order as Order);
|
|
438
|
+
|
|
439
|
+
// Clear the cart and create a new one for next purchase
|
|
440
|
+
clearAndCreateNewCart();
|
|
441
|
+
|
|
434
442
|
onSuccess?.(order.id);
|
|
435
443
|
} catch (error) {
|
|
436
444
|
onError?.(error as Error);
|