mainstack-payments 0.2.3 → 0.2.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.
@@ -2013,12 +2013,12 @@ Ss.exports;
2013
2013
  return g(S(k));
2014
2014
  };
2015
2015
  }
2016
- var Xe = Array.prototype, le = Function.prototype, ut = Object.prototype, qt = U["__core-js_shared__"], T = le.toString, I = ut.hasOwnProperty, L = function() {
2016
+ var Xe = Array.prototype, le = Function.prototype, ut = Object.prototype, qt = U["__core-js_shared__"], T = le.toString, I = ut.hasOwnProperty, z = function() {
2017
2017
  var g = /[^.]+$/.exec(qt && qt.keys && qt.keys.IE_PROTO || "");
2018
2018
  return g ? "Symbol(src)_1." + g : "";
2019
2019
  }(), H = ut.toString, de = T.call(Object), me = RegExp(
2020
2020
  "^" + T.call(I).replace($, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
2021
- ), Be = q ? U.Buffer : void 0, Je = U.Symbol, z = U.Uint8Array, Sn = Be ? Be.allocUnsafe : void 0, xn = ct(Object.getPrototypeOf, Object), wn = Object.create, En = ut.propertyIsEnumerable, Wr = Xe.splice, yt = Je ? Je.toStringTag : void 0, Ln = function() {
2021
+ ), Be = q ? U.Buffer : void 0, Je = U.Symbol, L = U.Uint8Array, Sn = Be ? Be.allocUnsafe : void 0, xn = ct(Object.getPrototypeOf, Object), wn = Object.create, En = ut.propertyIsEnumerable, Wr = Xe.splice, yt = Je ? Je.toStringTag : void 0, Ln = function() {
2022
2022
  try {
2023
2023
  var g = Sl(Object, "defineProperty");
2024
2024
  return g({}, "", {}), g;
@@ -2251,7 +2251,7 @@ Ss.exports;
2251
2251
  }
2252
2252
  function ht(g) {
2253
2253
  var S = new g.constructor(g.byteLength);
2254
- return new z(S).set(new z(g)), S;
2254
+ return new L(S).set(new L(g)), S;
2255
2255
  }
2256
2256
  function wt(g, S) {
2257
2257
  var k = S ? ht(g.buffer) : g.buffer;
@@ -2328,7 +2328,7 @@ Ss.exports;
2328
2328
  return S == "string" || S == "number" || S == "symbol" || S == "boolean" ? g !== "__proto__" : g === null;
2329
2329
  }
2330
2330
  function F0(g) {
2331
- return !!L && L in g;
2331
+ return !!z && z in g;
2332
2332
  }
2333
2333
  function tf(g) {
2334
2334
  var S = g && g.constructor, k = typeof S == "function" && S.prototype || ut;
@@ -17594,20 +17594,20 @@ function Vj(e) {
17594
17594
  submitCount: 0
17595
17595
  }), M = C.current, P = fe(function(T) {
17596
17596
  var I = C.current;
17597
- C.current = zj(I, T), I !== C.current && _(function(L) {
17598
- return L + 1;
17597
+ C.current = zj(I, T), I !== C.current && _(function(z) {
17598
+ return z + 1;
17599
17599
  });
17600
17600
  }, []), B = fe(function(T, I) {
17601
- return new Promise(function(L, H) {
17601
+ return new Promise(function(z, H) {
17602
17602
  var de = f.validate(T, I);
17603
- de == null ? L(fr) : Cc(de) ? de.then(function(me) {
17604
- L(me || fr);
17603
+ de == null ? z(fr) : Cc(de) ? de.then(function(me) {
17604
+ z(me || fr);
17605
17605
  }, function(me) {
17606
17606
  process.env.NODE_ENV !== "production" && console.warn("Warning: An unhandled error was caught during validation in <Formik validate />", me), H(me);
17607
- }) : L(de);
17607
+ }) : z(de);
17608
17608
  });
17609
17609
  }, [f.validate]), D = fe(function(T, I) {
17610
- var L = f.validationSchema, H = Xt(L) ? L(I) : L, de = I && H.validateAt ? H.validateAt(I, T) : Gj(T, H);
17610
+ var z = f.validationSchema, H = Xt(z) ? z(I) : z, de = I && H.validateAt ? H.validateAt(I, T) : Gj(T, H);
17611
17611
  return new Promise(function(me, Be) {
17612
17612
  de.then(function() {
17613
17613
  me(fr);
@@ -17616,23 +17616,23 @@ function Vj(e) {
17616
17616
  });
17617
17617
  });
17618
17618
  }, [f.validationSchema]), oe = fe(function(T, I) {
17619
- return new Promise(function(L) {
17620
- return L(w.current[T].validate(I));
17619
+ return new Promise(function(z) {
17620
+ return z(w.current[T].validate(I));
17621
17621
  });
17622
17622
  }, []), K = fe(function(T) {
17623
17623
  var I = Object.keys(w.current).filter(function(H) {
17624
17624
  return Xt(w.current[H].validate);
17625
- }), L = I.length > 0 ? I.map(function(H) {
17625
+ }), z = I.length > 0 ? I.map(function(H) {
17626
17626
  return oe(H, Ft(T, H));
17627
17627
  }) : [Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];
17628
- return Promise.all(L).then(function(H) {
17628
+ return Promise.all(z).then(function(H) {
17629
17629
  return H.reduce(function(de, me, Be) {
17630
17630
  return me === "DO_NOT_DELETE_YOU_WILL_BE_FIRED" || me && (de = Pr(de, I[Be], me)), de;
17631
17631
  }, {});
17632
17632
  });
17633
17633
  }, [oe]), re = fe(function(T) {
17634
17634
  return Promise.all([K(T), f.validationSchema ? D(T) : {}, f.validate ? B(T) : {}]).then(function(I) {
17635
- var L = I[0], H = I[1], de = I[2], me = pu.all([L, H, de], {
17635
+ var z = I[0], H = I[1], de = I[2], me = pu.all([z, H, de], {
17636
17636
  arrayMerge: Wj
17637
17637
  });
17638
17638
  return me;
@@ -17655,14 +17655,14 @@ function Vj(e) {
17655
17655
  i && y.current === !0 && vr(p.current, f.initialValues) && pe(p.current);
17656
17656
  }, [i, pe]);
17657
17657
  var Y = fe(function(T) {
17658
- var I = T && T.values ? T.values : p.current, L = T && T.errors ? T.errors : m.current ? m.current : f.initialErrors || {}, H = T && T.touched ? T.touched : h.current ? h.current : f.initialTouched || {}, de = T && T.status ? T.status : v.current ? v.current : f.initialStatus;
17659
- p.current = I, m.current = L, h.current = H, v.current = de;
17658
+ var I = T && T.values ? T.values : p.current, z = T && T.errors ? T.errors : m.current ? m.current : f.initialErrors || {}, H = T && T.touched ? T.touched : h.current ? h.current : f.initialTouched || {}, de = T && T.status ? T.status : v.current ? v.current : f.initialStatus;
17659
+ p.current = I, m.current = z, h.current = H, v.current = de;
17660
17660
  var me = function() {
17661
17661
  P({
17662
17662
  type: "RESET_FORM",
17663
17663
  payload: {
17664
17664
  isSubmitting: !!T && !!T.isSubmitting,
17665
- errors: L,
17665
+ errors: z,
17666
17666
  touched: H,
17667
17667
  status: de,
17668
17668
  values: I,
@@ -17697,11 +17697,11 @@ function Vj(e) {
17697
17697
  }, [c, f.initialStatus, f.initialTouched]);
17698
17698
  var ce = Lt(function(T) {
17699
17699
  if (w.current[T] && Xt(w.current[T].validate)) {
17700
- var I = Ft(M.values, T), L = w.current[T].validate(I);
17701
- return Cc(L) ? (P({
17700
+ var I = Ft(M.values, T), z = w.current[T].validate(I);
17701
+ return Cc(z) ? (P({
17702
17702
  type: "SET_ISVALIDATING",
17703
17703
  payload: !0
17704
- }), L.then(function(H) {
17704
+ }), z.then(function(H) {
17705
17705
  return H;
17706
17706
  }).then(function(H) {
17707
17707
  P({
@@ -17718,9 +17718,9 @@ function Vj(e) {
17718
17718
  type: "SET_FIELD_ERROR",
17719
17719
  payload: {
17720
17720
  field: T,
17721
- value: L
17721
+ value: z
17722
17722
  }
17723
- }), Promise.resolve(L));
17723
+ }), Promise.resolve(z));
17724
17724
  } else if (f.validationSchema)
17725
17725
  return P({
17726
17726
  type: "SET_ISVALIDATING",
@@ -17741,9 +17741,9 @@ function Vj(e) {
17741
17741
  });
17742
17742
  return Promise.resolve();
17743
17743
  }), ae = fe(function(T, I) {
17744
- var L = I.validate;
17744
+ var z = I.validate;
17745
17745
  w.current[T] = {
17746
- validate: L
17746
+ validate: z
17747
17747
  };
17748
17748
  }, []), ue = fe(function(T) {
17749
17749
  delete w.current[T];
@@ -17752,21 +17752,21 @@ function Vj(e) {
17752
17752
  type: "SET_TOUCHED",
17753
17753
  payload: T
17754
17754
  });
17755
- var L = I === void 0 ? a : I;
17756
- return L ? pe(M.values) : Promise.resolve();
17755
+ var z = I === void 0 ? a : I;
17756
+ return z ? pe(M.values) : Promise.resolve();
17757
17757
  }), Pe = fe(function(T) {
17758
17758
  P({
17759
17759
  type: "SET_ERRORS",
17760
17760
  payload: T
17761
17761
  });
17762
17762
  }, []), $ = Lt(function(T, I) {
17763
- var L = Xt(T) ? T(M.values) : T;
17763
+ var z = Xt(T) ? T(M.values) : T;
17764
17764
  P({
17765
17765
  type: "SET_VALUES",
17766
- payload: L
17766
+ payload: z
17767
17767
  });
17768
17768
  var H = I === void 0 ? n : I;
17769
- return H ? pe(L) : Promise.resolve();
17769
+ return H ? pe(z) : Promise.resolve();
17770
17770
  }), F = fe(function(T, I) {
17771
17771
  P({
17772
17772
  type: "SET_FIELD_ERROR",
@@ -17775,7 +17775,7 @@ function Vj(e) {
17775
17775
  value: I
17776
17776
  }
17777
17777
  });
17778
- }, []), V = Lt(function(T, I, L) {
17778
+ }, []), V = Lt(function(T, I, z) {
17779
17779
  P({
17780
17780
  type: "SET_FIELD_VALUE",
17781
17781
  payload: {
@@ -17783,27 +17783,27 @@ function Vj(e) {
17783
17783
  value: I
17784
17784
  }
17785
17785
  });
17786
- var H = L === void 0 ? n : L;
17786
+ var H = z === void 0 ? n : z;
17787
17787
  return H ? pe(Pr(M.values, T, I)) : Promise.resolve();
17788
17788
  }), O = fe(function(T, I) {
17789
- var L = I, H = T, de;
17789
+ var z = I, H = T, de;
17790
17790
  if (!Ec(T)) {
17791
17791
  T.persist && T.persist();
17792
- var me = T.target ? T.target : T.currentTarget, Be = me.type, Je = me.name, z = me.id, Sn = me.value, xn = me.checked, wn = me.outerHTML, En = me.options, Wr = me.multiple;
17793
- L = I || Je || z, !L && process.env.NODE_ENV !== "production" && Vm({
17792
+ var me = T.target ? T.target : T.currentTarget, Be = me.type, Je = me.name, L = me.id, Sn = me.value, xn = me.checked, wn = me.outerHTML, En = me.options, Wr = me.multiple;
17793
+ z = I || Je || L, !z && process.env.NODE_ENV !== "production" && Vm({
17794
17794
  htmlContent: wn,
17795
17795
  documentationAnchorLink: "handlechange-e-reactchangeeventany--void",
17796
17796
  handlerName: "handleChange"
17797
- }), H = /number|range/.test(Be) ? (de = parseFloat(Sn), isNaN(de) ? "" : de) : /checkbox/.test(Be) ? Kj(Ft(M.values, L), xn, Sn) : En && Wr ? Hj(En) : Sn;
17797
+ }), H = /number|range/.test(Be) ? (de = parseFloat(Sn), isNaN(de) ? "" : de) : /checkbox/.test(Be) ? Kj(Ft(M.values, z), xn, Sn) : En && Wr ? Hj(En) : Sn;
17798
17798
  }
17799
- L && V(L, H);
17799
+ z && V(z, H);
17800
17800
  }, [V, M.values]), W = Lt(function(T) {
17801
17801
  if (Ec(T))
17802
17802
  return function(I) {
17803
17803
  return O(I, T);
17804
17804
  };
17805
17805
  O(T);
17806
- }), ee = Lt(function(T, I, L) {
17806
+ }), ee = Lt(function(T, I, z) {
17807
17807
  I === void 0 && (I = !0), P({
17808
17808
  type: "SET_FIELD_TOUCHED",
17809
17809
  payload: {
@@ -17811,11 +17811,11 @@ function Vj(e) {
17811
17811
  value: I
17812
17812
  }
17813
17813
  });
17814
- var H = L === void 0 ? a : L;
17814
+ var H = z === void 0 ? a : z;
17815
17815
  return H ? pe(M.values) : Promise.resolve();
17816
17816
  }), U = fe(function(T, I) {
17817
17817
  T.persist && T.persist();
17818
- var L = T.target, H = L.name, de = L.id, me = L.outerHTML, Be = I || H || de;
17818
+ var z = T.target, H = z.name, de = z.id, me = z.outerHTML, Be = I || H || de;
17819
17819
  !Be && process.env.NODE_ENV !== "production" && Vm({
17820
17820
  htmlContent: me,
17821
17821
  documentationAnchorLink: "handleblur-e-any--void",
@@ -17851,8 +17851,8 @@ function Vj(e) {
17851
17851
  return P({
17852
17852
  type: "SUBMIT_ATTEMPT"
17853
17853
  }), pe().then(function(T) {
17854
- var I = T instanceof Error, L = !I && Object.keys(T).length === 0;
17855
- if (L) {
17854
+ var I = T instanceof Error, z = !I && Object.keys(T).length === 0;
17855
+ if (z) {
17856
17856
  var H;
17857
17857
  try {
17858
17858
  if (H = It(), H === void 0)
@@ -17880,8 +17880,8 @@ function Vj(e) {
17880
17880
  var I = Lj();
17881
17881
  I !== null && I instanceof HTMLButtonElement && (I.attributes && I.attributes.getNamedItem("type") || (process.env.NODE_ENV !== "production" ? fa(!1, 'You submitted a Formik form using a button with an unspecified `type` attribute. Most browsers default button elements to `type="submit"`. If this is not a submit button, please add `type="button"`.') : fa(!1)));
17882
17882
  }
17883
- be().catch(function(L) {
17884
- console.warn("Warning: An unhandled error was caught from submitForm()", L);
17883
+ be().catch(function(z) {
17884
+ console.warn("Warning: An unhandled error was caught from submitForm()", z);
17885
17885
  });
17886
17886
  }), Ne = {
17887
17887
  resetForm: Y,
@@ -17912,26 +17912,26 @@ function Vj(e) {
17912
17912
  };
17913
17913
  }, [M.errors, M.touched, M.values]), ct = fe(function(T) {
17914
17914
  return {
17915
- setValue: function(L, H) {
17916
- return V(T, L, H);
17915
+ setValue: function(z, H) {
17916
+ return V(T, z, H);
17917
17917
  },
17918
- setTouched: function(L, H) {
17919
- return ee(T, L, H);
17918
+ setTouched: function(z, H) {
17919
+ return ee(T, z, H);
17920
17920
  },
17921
- setError: function(L) {
17922
- return F(T, L);
17921
+ setError: function(z) {
17922
+ return F(T, z);
17923
17923
  }
17924
17924
  };
17925
17925
  }, [V, ee, F]), Xe = fe(function(T) {
17926
- var I = ul(T), L = I ? T.name : T, H = Ft(M.values, L), de = {
17927
- name: L,
17926
+ var I = ul(T), z = I ? T.name : T, H = Ft(M.values, z), de = {
17927
+ name: z,
17928
17928
  value: H,
17929
17929
  onChange: W,
17930
17930
  onBlur: G
17931
17931
  };
17932
17932
  if (I) {
17933
- var me = T.type, Be = T.value, Je = T.as, z = T.multiple;
17934
- me === "checkbox" ? Be === void 0 ? de.checked = !!H : (de.checked = !!(Array.isArray(H) && ~H.indexOf(Be)), de.value = Be) : me === "radio" ? (de.checked = H === Be, de.value = Be) : Je === "select" && z && (de.value = de.value || [], de.multiple = !0);
17933
+ var me = T.type, Be = T.value, Je = T.as, L = T.multiple;
17934
+ me === "checkbox" ? Be === void 0 ? de.checked = !!H : (de.checked = !!(Array.isArray(H) && ~H.indexOf(Be)), de.value = Be) : me === "radio" ? (de.checked = H === Be, de.value = Be) : Je === "select" && L && (de.value = de.value || [], de.multiple = !0);
17935
17935
  }
17936
17936
  return de;
17937
17937
  }, [G, W, M.values]), le = at(function() {
@@ -25692,22 +25692,14 @@ const ez = "Payment Completed", tz = ({
25692
25692
  handleCloseModal: n
25693
25693
  }) => {
25694
25694
  const [r, a] = se(!1), o = $e(null), [i] = Rd("(max-width: 600px)");
25695
- he(() => {
25695
+ return he(() => {
25696
25696
  const l = (c) => {
25697
25697
  c.data.type === ez && n();
25698
25698
  };
25699
25699
  return window.addEventListener("message", l), () => {
25700
25700
  window.removeEventListener("message", l);
25701
25701
  };
25702
- }, [n]);
25703
- const s = () => {
25704
- var l;
25705
- a(!0), o != null && o.current && ((l = o.current.contentWindow) == null || l.postMessage(
25706
- { type: "iframeLoaded" },
25707
- window.location.origin
25708
- ));
25709
- };
25710
- return /* @__PURE__ */ b(
25702
+ }, [n]), /* @__PURE__ */ b(
25711
25703
  vt,
25712
25704
  {
25713
25705
  display: t ? "block" : "none",
@@ -25766,13 +25758,19 @@ const ez = "Payment Completed", tz = ({
25766
25758
  {
25767
25759
  title: "main-paystack-pay",
25768
25760
  ref: o,
25769
- src: `${e}?embedded=true`,
25761
+ src: e,
25770
25762
  width: "100%",
25771
25763
  height: "400",
25772
25764
  allowFullScreen: !0,
25773
25765
  name: "main-paystack-pay",
25774
25766
  id: "main-paystack-pay",
25775
- onLoad: s,
25767
+ onLoad: () => {
25768
+ var l;
25769
+ a(!0), o != null && o.current && ((l = o.current.contentWindow) == null || l.postMessage(
25770
+ { type: "iframeLoaded" },
25771
+ window.location.origin
25772
+ ));
25773
+ },
25776
25774
  style: {
25777
25775
  opacity: r ? 1 : 0,
25778
25776
  pointerEvents: r ? "auto" : "none",
@@ -26113,11 +26111,11 @@ const ez = "Payment Completed", tz = ({
26113
26111
  apply_tranche_fee: D
26114
26112
  },
26115
26113
  re
26116
- ), { mutate: qt, isLoading: T } = oD(re), { mutate: I, isLoading: L } = jb(re), {
26114
+ ), { mutate: qt, isLoading: T } = oD(re), { mutate: I, isLoading: z } = jb(re), {
26117
26115
  data: H,
26118
26116
  refetch: de,
26119
26117
  isLoading: me
26120
- } = iD(O == null ? void 0 : O.reference, re), [Be, Je] = se(!1), z = Vj({
26118
+ } = iD(O == null ? void 0 : O.reference, re), [Be, Je] = se(!1), L = Vj({
26121
26119
  initialValues: {
26122
26120
  email: (i == null ? void 0 : i.email) ?? "",
26123
26121
  fullname: (i == null ? void 0 : i.fullname) ?? "",
@@ -26192,15 +26190,15 @@ const ez = "Payment Completed", tz = ({
26192
26190
  }
26193
26191
  );
26194
26192
  }
26195
- }), Sn = T || L || me || Be || z.isSubmitting;
26193
+ }), Sn = T || z || me || Be || L.isSubmitting;
26196
26194
  he(() => {
26197
- z.setFieldValue("email", (i == null ? void 0 : i.email) ?? ""), z.setFieldValue("fullname", (i == null ? void 0 : i.fullname) ?? ""), z.setTouched({}, !1);
26195
+ L.setFieldValue("email", (i == null ? void 0 : i.email) ?? ""), L.setFieldValue("fullname", (i == null ? void 0 : i.fullname) ?? ""), L.setTouched({}, !1);
26198
26196
  }, [i]), rS(u, () => ({
26199
26197
  updateCustomFormValues(ie, tt) {
26200
- z.setFieldValue(ie, tt);
26198
+ L.setFieldValue(ie, tt);
26201
26199
  }
26202
26200
  }));
26203
- const xn = ((ni = le == null ? void 0 : le.payload) == null ? void 0 : ni.local_amount) ?? 0, wn = ((ri = le == null ? void 0 : le.payload) == null ? void 0 : ri.local_transaction_fee) ?? 0, En = ((ai = le == null ? void 0 : le.payload) == null ? void 0 : ai.local_international_card_fee) ?? 0, Wr = ((oi = le == null ? void 0 : le.payload) == null ? void 0 : oi.dollar_international_card_fee) ?? 0, yt = parseFloat(xn) + parseFloat(wn) + (d !== Hn.NGN && (z.values.country !== "" || (Xe == null ? void 0 : Xe.currency) !== d) && ct((An = z == null ? void 0 : z.values) == null ? void 0 : An.country) !== d ? Number(En) : 0), Ln = z.values.country !== "" ? ct((ii = z == null ? void 0 : z.values) == null ? void 0 : ii.country) !== d : (Xe == null ? void 0 : Xe.currency) !== d, Dt = at(() => {
26201
+ const xn = ((ni = le == null ? void 0 : le.payload) == null ? void 0 : ni.local_amount) ?? 0, wn = ((ri = le == null ? void 0 : le.payload) == null ? void 0 : ri.local_transaction_fee) ?? 0, En = ((ai = le == null ? void 0 : le.payload) == null ? void 0 : ai.local_international_card_fee) ?? 0, Wr = ((oi = le == null ? void 0 : le.payload) == null ? void 0 : oi.dollar_international_card_fee) ?? 0, yt = parseFloat(xn) + parseFloat(wn) + (d !== Hn.NGN && (L.values.country !== "" || (Xe == null ? void 0 : Xe.currency) !== d) && ct((An = L == null ? void 0 : L.values) == null ? void 0 : An.country) !== d ? Number(En) : 0), Ln = L.values.country !== "" ? ct((ii = L == null ? void 0 : L.values) == null ? void 0 : ii.country) !== d : (Xe == null ? void 0 : Xe.currency) !== d, Dt = at(() => {
26204
26202
  var ie;
26205
26203
  return d === Hn.UGX ? Math.ceil(yt) * 100 : Math.round(
26206
26204
  yt * ((ie = le == null ? void 0 : le.payload) != null && ie.is_zero_decimal_currency ? 1 : 100)
@@ -26213,11 +26211,11 @@ const ez = "Payment Completed", tz = ({
26213
26211
  (Number((si = le == null ? void 0 : le.payload) == null ? void 0 : si.dollar_transaction_fee) + Number(Ln ? Wr : 0)).toFixed(2)
26214
26212
  ), _t = {
26215
26213
  ...e.metadata,
26216
- phone_number: (li = z.values) == null ? void 0 : li.phone,
26214
+ phone_number: (li = L.values) == null ? void 0 : li.phone,
26217
26215
  reference: pe,
26218
- email: z.values.email,
26219
- name: (ci = z.values) == null ? void 0 : ci.fullname,
26220
- country: (ui = z == null ? void 0 : z.values) == null ? void 0 : ui.country,
26216
+ email: L.values.email,
26217
+ name: (ci = L.values) == null ? void 0 : ci.fullname,
26218
+ country: (ui = L == null ? void 0 : L.values) == null ? void 0 : ui.country,
26221
26219
  actual_price: Number((Tn = le == null ? void 0 : le.payload) == null ? void 0 : Tn.dollar_amount),
26222
26220
  transaction_fee: Qo,
26223
26221
  international_fee: Number(
@@ -26256,7 +26254,7 @@ const ez = "Payment Completed", tz = ({
26256
26254
  he(() => {
26257
26255
  const { amount: ie } = q;
26258
26256
  ie !== 0 && G !== "" && (Number(f) - ie > 0 && Number(f) - ie < 1 ? ae(1) : ae(f - ie));
26259
- }, [q, z]);
26257
+ }, [q, L]);
26260
26258
  const ti = at(() => rD(B), [B]);
26261
26259
  he(() => {
26262
26260
  Se(
@@ -26269,15 +26267,15 @@ const ez = "Payment Completed", tz = ({
26269
26267
  Y(ie), Je(!0);
26270
26268
  let tt = {};
26271
26269
  if (l) {
26272
- const ht = await l(z.values);
26273
- if (tt = await z.validateForm(), ht.terminate)
26270
+ const ht = await l(L.values);
26271
+ if (tt = await L.validateForm(), ht.terminate)
26274
26272
  return;
26275
26273
  }
26276
26274
  if (Object.keys(tt).length <= 0) {
26277
26275
  if (U(!0), Dt === 0) {
26278
26276
  c({
26279
- fullname: z.values.fullname,
26280
- email: z.values.email,
26277
+ fullname: L.values.fullname,
26278
+ email: L.values.email,
26281
26279
  reference: ie,
26282
26280
  amount: 0
26283
26281
  });
@@ -26318,13 +26316,13 @@ const ez = "Payment Completed", tz = ({
26318
26316
  try {
26319
26317
  const ie = await de();
26320
26318
  ie.isSuccess ? c({
26321
- fullname: z.values.fullname,
26322
- email: z.values.email,
26319
+ fullname: L.values.fullname,
26320
+ email: L.values.email,
26323
26321
  reference: O == null ? void 0 : O.reference,
26324
26322
  ...ie.data
26325
26323
  }) : Gt(`${ie == null ? void 0 : ie.error}`, Wt.error);
26326
26324
  } catch {
26327
- Gt("Failed to complete transaction", Wt.error);
26325
+ Gt("Failed to complete transaction", Wt.error), L.setSubmitting(!1);
26328
26326
  }
26329
26327
  };
26330
26328
  return /* @__PURE__ */ b(Pn, { children: /* @__PURE__ */ J(
@@ -26338,7 +26336,7 @@ const ez = "Payment Completed", tz = ({
26338
26336
  mx: "auto",
26339
26337
  fontFamily: (m == null ? void 0 : m.font_family) ?? "inherit",
26340
26338
  children: [
26341
- /* @__PURE__ */ b(wa, { order: K ? "2" : { base: "2", lg: "1" }, children: /* @__PURE__ */ b(Nj, { value: z, children: /* @__PURE__ */ J("form", { onSubmit: z.handleSubmit, children: [
26339
+ /* @__PURE__ */ b(wa, { order: K ? "2" : { base: "2", lg: "1" }, children: /* @__PURE__ */ b(Nj, { value: L, children: /* @__PURE__ */ J("form", { onSubmit: L.handleSubmit, children: [
26342
26340
  /* @__PURE__ */ J(nt, { flexDirection: "column", gap: "20px", pb: "40px", children: [
26343
26341
  ng(n) ? /* @__PURE__ */ b(Pn, { children: n }) : /* @__PURE__ */ b(
26344
26342
  Fa,
@@ -26357,12 +26355,12 @@ const ez = "Payment Completed", tz = ({
26357
26355
  id: "fullname",
26358
26356
  label: "Your name",
26359
26357
  name: "fullname",
26360
- onChange: (ie) => z.setFieldValue("fullname", ie.target.value),
26361
- value: (fi = z.values) == null ? void 0 : fi.fullname,
26358
+ onChange: (ie) => L.setFieldValue("fullname", ie.target.value),
26359
+ value: (fi = L.values) == null ? void 0 : fi.fullname,
26362
26360
  placeholder: "name",
26363
26361
  type: "text",
26364
- error: !!((pi = z == null ? void 0 : z.errors) != null && pi.fullname),
26365
- errorMessage: (hi = z == null ? void 0 : z.errors) == null ? void 0 : hi.fullname,
26362
+ error: !!((pi = L == null ? void 0 : L.errors) != null && pi.fullname),
26363
+ errorMessage: (hi = L == null ? void 0 : L.errors) == null ? void 0 : hi.fullname,
26366
26364
  fontFamily: "inherit"
26367
26365
  }
26368
26366
  ),
@@ -26372,12 +26370,12 @@ const ez = "Payment Completed", tz = ({
26372
26370
  id: "email",
26373
26371
  label: "Email address",
26374
26372
  name: "email",
26375
- onChange: (ie) => z.setFieldValue("email", ie.target.value),
26376
- value: (mi = z.values) == null ? void 0 : mi.email,
26373
+ onChange: (ie) => L.setFieldValue("email", ie.target.value),
26374
+ value: (mi = L.values) == null ? void 0 : mi.email,
26377
26375
  placeholder: "email",
26378
26376
  type: "email",
26379
- error: !!((gi = z == null ? void 0 : z.errors) != null && gi.email),
26380
- errorMessage: (Hr = z == null ? void 0 : z.errors) == null ? void 0 : Hr.email,
26377
+ error: !!((gi = L == null ? void 0 : L.errors) != null && gi.email),
26378
+ errorMessage: (Hr = L == null ? void 0 : L.errors) == null ? void 0 : Hr.email,
26381
26379
  fontFamily: "inherit"
26382
26380
  }
26383
26381
  ),
@@ -26400,10 +26398,10 @@ const ez = "Payment Completed", tz = ({
26400
26398
  metadata: _t,
26401
26399
  currency: d,
26402
26400
  amount: Dt,
26403
- formik: z,
26401
+ formik: L,
26404
26402
  checkForErrors: async () => {
26405
- l && await l(z.values);
26406
- const ie = await z.validateForm();
26403
+ l && await l(L.values);
26404
+ const ie = await L.validateForm();
26407
26405
  return Object.keys(ie).length > 0;
26408
26406
  },
26409
26407
  onPaymentComplete: c,
@@ -26465,7 +26463,7 @@ const ez = "Payment Completed", tz = ({
26465
26463
  currency: d,
26466
26464
  amount: Dt,
26467
26465
  discount_code: G,
26468
- formik: z,
26466
+ formik: L,
26469
26467
  isFree: Dt === 0,
26470
26468
  showPayment: F,
26471
26469
  onCancel: gl,
@@ -26507,14 +26505,14 @@ const ez = "Payment Completed", tz = ({
26507
26505
  isLoading: Sn,
26508
26506
  onClick: async (ie) => {
26509
26507
  if (ie.preventDefault(), Je(!0), l) {
26510
- const tt = await l(z.values);
26511
- if (await z.validateForm(), tt != null && tt.terminate) {
26512
- Je(!1);
26508
+ const tt = await l(L.values);
26509
+ if (await L.validateForm(), tt != null && tt.terminate) {
26510
+ Je(!1), L.setSubmitting(!1);
26513
26511
  return;
26514
26512
  }
26515
- z.submitForm(), Je(!1);
26513
+ L.submitForm(), Je(!1);
26516
26514
  } else
26517
- z.submitForm(), Je(!1);
26515
+ L.submitForm(), Je(!1);
26518
26516
  },
26519
26517
  _hover: {
26520
26518
  opacity: 0.8,
@@ -26632,7 +26630,7 @@ const ez = "Payment Completed", tz = ({
26632
26630
  }
26633
26631
  )
26634
26632
  ] }),
26635
- d !== Hn.NGN && (z.values.country !== "" || (Xe == null ? void 0 : Xe.currency) !== d) && ct((Kr = z == null ? void 0 : z.values) == null ? void 0 : Kr.country) !== d && /* @__PURE__ */ J(nt, { width: "100%", justifyContent: "space-between", children: [
26633
+ d !== Hn.NGN && (L.values.country !== "" || (Xe == null ? void 0 : Xe.currency) !== d) && ct((Kr = L == null ? void 0 : L.values) == null ? void 0 : Kr.country) !== d && /* @__PURE__ */ J(nt, { width: "100%", justifyContent: "space-between", children: [
26636
26634
  /* @__PURE__ */ J(nt, { alignItems: "center", children: [
26637
26635
  /* @__PURE__ */ b(
26638
26636
  rt,
@@ -26769,7 +26767,7 @@ const ez = "Payment Completed", tz = ({
26769
26767
  lineHeight: "22px",
26770
26768
  children: [
26771
26769
  "-",
26772
- z.values.currency,
26770
+ L.values.currency,
26773
26771
  " ",
26774
26772
  (Ei = (ja = q.amount) == null ? void 0 : ja.toFixed(2)) == null ? void 0 : Ei.replace(/\B(?=(\d{3})+(?!\d))/g, ",")
26775
26773
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mainstack-payments",
3
3
  "type": "module",
4
- "version": "0.2.3",
4
+ "version": "0.2.5",
5
5
  "main": "build/mainstack-payments.js",
6
6
  "types": "build/src/index.d.ts",
7
7
  "files": [