@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.
Files changed (75) hide show
  1. package/dist/components/Checkout.d.ts.map +1 -1
  2. package/dist/components/ShoppingCart.d.ts.map +1 -1
  3. package/dist/contexts/CartContext.d.ts +2 -0
  4. package/dist/contexts/CartContext.d.ts.map +1 -1
  5. package/dist/index10.mjs +70 -70
  6. package/dist/index101.mjs +1 -1
  7. package/dist/index102.mjs +3 -3
  8. package/dist/index103.mjs +3 -3
  9. package/dist/index105.mjs +1 -1
  10. package/dist/index111.mjs +1 -1
  11. package/dist/index29.mjs +1 -1
  12. package/dist/index3.mjs +83 -78
  13. package/dist/index30.mjs +1 -1
  14. package/dist/index31.mjs +1 -1
  15. package/dist/index32.mjs +1 -1
  16. package/dist/index42.mjs +17 -17
  17. package/dist/index43.mjs +2 -2
  18. package/dist/index44.mjs +1 -1
  19. package/dist/index45.mjs +1 -1
  20. package/dist/index46.mjs +1 -1
  21. package/dist/index47.mjs +1 -1
  22. package/dist/index48.mjs +1 -1
  23. package/dist/index49.mjs +1 -1
  24. package/dist/index50.mjs +1 -1
  25. package/dist/index51.mjs +1 -1
  26. package/dist/index52.mjs +1 -1
  27. package/dist/index53.mjs +1 -1
  28. package/dist/index54.mjs +1 -1
  29. package/dist/index58.mjs +2 -2
  30. package/dist/index59.mjs +3 -4
  31. package/dist/index60.mjs +2 -4
  32. package/dist/index61.mjs +5 -2
  33. package/dist/index62.mjs +231 -30
  34. package/dist/index63.mjs +5 -42
  35. package/dist/index64.mjs +127 -228
  36. package/dist/index65.mjs +66 -4
  37. package/dist/index66.mjs +77 -124
  38. package/dist/index67.mjs +26 -65
  39. package/dist/index68.mjs +6 -84
  40. package/dist/index69.mjs +72 -26
  41. package/dist/index70.mjs +3 -8
  42. package/dist/index71.mjs +2 -75
  43. package/dist/index72.mjs +82 -3
  44. package/dist/index73.mjs +54 -2
  45. package/dist/index74.mjs +5 -82
  46. package/dist/index75.mjs +4 -53
  47. package/dist/index76.mjs +178 -5
  48. package/dist/index77.mjs +53 -5
  49. package/dist/index78.mjs +68 -178
  50. package/dist/index79.mjs +31 -50
  51. package/dist/index8.mjs +8 -7
  52. package/dist/index80.mjs +43 -69
  53. package/dist/index81.mjs +2 -2
  54. package/dist/index82.mjs +1 -1
  55. package/dist/index83.mjs +6 -6
  56. package/dist/index84.mjs +2 -2
  57. package/dist/index85.mjs +2 -2
  58. package/dist/index87.mjs +2 -2
  59. package/dist/index88.mjs +2 -2
  60. package/dist/index89.mjs +1 -1
  61. package/dist/index91.mjs +4 -4
  62. package/dist/index92.mjs +3 -3
  63. package/dist/index93.mjs +12 -30
  64. package/dist/index94.mjs +7 -11
  65. package/dist/index95.mjs +30 -3
  66. package/dist/index96.mjs +10 -3
  67. package/dist/index97.mjs +4 -13
  68. package/dist/index98.mjs +4 -7
  69. package/dist/index99.mjs +1 -1
  70. package/dist/test-utils/MockCartProvider.d.ts.map +1 -1
  71. package/package.json +1 -1
  72. package/src/components/Checkout.tsx +9 -1
  73. package/src/components/ShoppingCart.tsx +1 -0
  74. package/src/contexts/CartContext.tsx +51 -24
  75. 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(), [D, u] = Y(!1);
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 F = ((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, P = () => {
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
- }, S = () => {
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(F) })
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: P,
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: S,
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: D,
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
- const e = {
3
- Continue: 100,
4
- SwitchingProtocols: 101,
5
- Processing: 102,
6
- EarlyHints: 103,
7
- Ok: 200,
8
- Created: 201,
9
- Accepted: 202,
10
- NonAuthoritativeInformation: 203,
11
- NoContent: 204,
12
- ResetContent: 205,
13
- PartialContent: 206,
14
- MultiStatus: 207,
15
- AlreadyReported: 208,
16
- ImUsed: 226,
17
- MultipleChoices: 300,
18
- MovedPermanently: 301,
19
- Found: 302,
20
- SeeOther: 303,
21
- NotModified: 304,
22
- UseProxy: 305,
23
- Unused: 306,
24
- TemporaryRedirect: 307,
25
- PermanentRedirect: 308,
26
- BadRequest: 400,
27
- Unauthorized: 401,
28
- PaymentRequired: 402,
29
- Forbidden: 403,
30
- NotFound: 404,
31
- MethodNotAllowed: 405,
32
- NotAcceptable: 406,
33
- ProxyAuthenticationRequired: 407,
34
- RequestTimeout: 408,
35
- Conflict: 409,
36
- Gone: 410,
37
- LengthRequired: 411,
38
- PreconditionFailed: 412,
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
- e as default
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 "./index64.mjs";
3
- import d from "./index93.mjs";
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
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import n from "./index64.mjs";
2
+ import n from "./index62.mjs";
3
3
  class a {
4
4
  constructor() {
5
5
  this.handlers = [];
package/dist/index83.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  'use client';
2
- import r from "./index94.mjs";
3
- import p from "./index72.mjs";
4
- import l from "./index68.mjs";
5
- import m from "./index70.mjs";
6
- import a from "./index78.mjs";
7
- import o from "./index79.mjs";
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
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import r from "./index95.mjs";
3
- import f from "./index96.mjs";
2
+ import r from "./index97.mjs";
3
+ import f from "./index98.mjs";
4
4
  function u(l, i, t) {
5
5
  let o = !r(i);
6
6
  return l && (o || t == !1) ? f(l, i) : i;
package/dist/index85.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import { VERSION as w } from "./index73.mjs";
3
- import s from "./index75.mjs";
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
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import s from "./index64.mjs";
3
- import f from "./index74.mjs";
2
+ import s from "./index62.mjs";
3
+ import f from "./index72.mjs";
4
4
  import r from "./index88.mjs";
5
5
  function d(o, i) {
6
6
  return f(o, new r.classes.URLSearchParams(), {
package/dist/index88.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use client';
2
- import o from "./index97.mjs";
3
- import * as t from "./index98.mjs";
2
+ import o from "./index93.mjs";
3
+ import * as t from "./index94.mjs";
4
4
  const m = {
5
5
  ...t,
6
6
  ...o
package/dist/index89.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import n from "./index64.mjs";
2
+ import n from "./index62.mjs";
3
3
  const a = n.toObjectSet([
4
4
  "age",
5
5
  "authorization",
package/dist/index91.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use client';
2
- import H from "./index64.mjs";
2
+ import H from "./index62.mjs";
3
3
  import D from "./index99.mjs";
4
4
  import L from "./index86.mjs";
5
- import n from "./index75.mjs";
6
- import y from "./index70.mjs";
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 "./index78.mjs";
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 "./index64.mjs";
4
- import b from "./index75.mjs";
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 "./index78.mjs";
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 p from "./index74.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
- });
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
- a as default
15
+ l as default
34
16
  };
package/dist/index94.mjs CHANGED
@@ -1,14 +1,10 @@
1
1
  'use client';
2
- import i from "./index64.mjs";
3
- import m from "./index68.mjs";
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
- h as default
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
- function e(t) {
3
- return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
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
- e as default
33
+ a as default
7
34
  };
package/dist/index96.mjs CHANGED
@@ -1,7 +1,14 @@
1
1
  'use client';
2
- function n(e, c) {
3
- return c ? e.replace(/\/?\/$/, "") + "/" + c.replace(/^\/+/, "") : e;
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
- n as default
13
+ h as default
7
14
  };
package/dist/index97.mjs CHANGED
@@ -1,16 +1,7 @@
1
1
  'use client';
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"]
13
- };
2
+ function e(t) {
3
+ return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
4
+ }
14
5
  export {
15
- l as default
6
+ e as default
16
7
  };
package/dist/index98.mjs CHANGED
@@ -1,10 +1,7 @@
1
1
  'use client';
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";
2
+ function n(e, c) {
3
+ return c ? e.replace(/\/?\/$/, "") + "/" + c.replace(/^\/+/, "") : e;
4
+ }
4
5
  export {
5
- e as hasBrowserEnv,
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,5 +1,5 @@
1
1
  'use client';
2
- import a from "./index75.mjs";
2
+ import a from "./index73.mjs";
3
3
  function E(i, f, t) {
4
4
  const u = t.config.validateStatus;
5
5
  !t.status || !u || u(t.status) ? i(t) : f(new a(
@@ -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,2CA0RvB"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instockng/storefront-ui",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Pre-built UI components for OMS e-commerce sites",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -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);
@@ -255,6 +255,7 @@ export function ShoppingCart({
255
255
  {/* Checkout Modal */}
256
256
  <Checkout
257
257
  isOpen={isCheckoutOpen}
258
+ onSuccess={() => onClose()}
258
259
  onClose={() => setIsCheckoutOpen(false)}
259
260
  />
260
261
  </>