@getopenpay/openpay-js-react 0.0.6-alpha.2dd4240 → 0.0.6-alpha.6cf2f5e

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 (2) hide show
  1. package/dist/index.js +40 -40
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -16,8 +16,8 @@ const wt = tr({
16
16
  return r;
17
17
  };
18
18
  var T = [];
19
- for (var tt = 0; tt < 256; ++tt)
20
- T.push((tt + 256).toString(16).slice(1));
19
+ for (var rt = 0; rt < 256; ++rt)
20
+ T.push((rt + 256).toString(16).slice(1));
21
21
  function sr(r, e = 0) {
22
22
  return (T[r[e + 0]] + T[r[e + 1]] + T[r[e + 2]] + T[r[e + 3]] + "-" + T[r[e + 4]] + T[r[e + 5]] + "-" + T[r[e + 6]] + T[r[e + 7]] + "-" + T[r[e + 8]] + T[r[e + 9]] + "-" + T[r[e + 10]] + T[r[e + 11]] + T[r[e + 12]] + T[r[e + 13]] + T[r[e + 14]] + T[r[e + 15]]).toLowerCase();
23
23
  }
@@ -74,14 +74,14 @@ var x;
74
74
  }
75
75
  r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
76
76
  })(x || (x = {}));
77
- var nt;
77
+ var st;
78
78
  (function(r) {
79
79
  r.mergeShapes = (e, t) => ({
80
80
  ...e,
81
81
  ...t
82
82
  // second overwrites first
83
83
  });
84
- })(nt || (nt = {}));
84
+ })(st || (st = {}));
85
85
  const f = x.arrayToEnum([
86
86
  "string",
87
87
  "nan",
@@ -344,7 +344,7 @@ class S {
344
344
  }
345
345
  const y = Object.freeze({
346
346
  status: "aborted"
347
- }), de = (r) => ({ status: "dirty", value: r }), O = (r) => ({ status: "valid", value: r }), st = (r) => r.status === "aborted", at = (r) => r.status === "dirty", ge = (r) => r.status === "valid", _e = (r) => typeof Promise < "u" && r instanceof Promise;
347
+ }), de = (r) => ({ status: "dirty", value: r }), O = (r) => ({ status: "valid", value: r }), at = (r) => r.status === "aborted", it = (r) => r.status === "dirty", ge = (r) => r.status === "valid", _e = (r) => typeof Promise < "u" && r instanceof Promise;
348
348
  function ze(r, e, t, n) {
349
349
  if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
350
350
  return e.get(r);
@@ -541,7 +541,7 @@ class g {
541
541
  });
542
542
  }
543
543
  brand() {
544
- return new ot({
544
+ return new ct({
545
545
  typeName: m.ZodBranded,
546
546
  type: this,
547
547
  ...v(this._def)
@@ -577,7 +577,7 @@ class g {
577
577
  }
578
578
  }
579
579
  const lr = /^c[^\s-]{8,}$/i, fr = /^[0-9a-z]+$/, hr = /^[0-9A-HJKMNP-TV-Z]{26}$/, pr = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, mr = /^[a-z0-9_-]{21}$/i, yr = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, vr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, gr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
580
- let rt;
580
+ let nt;
581
581
  const _r = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, xr = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/, br = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Ct = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", kr = new RegExp(`^${Ct}$`);
582
582
  function Rt(r) {
583
583
  let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
@@ -649,7 +649,7 @@ class j extends g {
649
649
  message: a.message
650
650
  }), n.dirty());
651
651
  else if (a.kind === "emoji")
652
- rt || (rt = new RegExp(gr, "u")), rt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
652
+ nt || (nt = new RegExp(gr, "u")), nt.test(e.data) || (s = this._getOrReturnCtx(e, s), l(s, {
653
653
  validation: "emoji",
654
654
  code: c.invalid_string,
655
655
  message: a.message
@@ -1907,7 +1907,7 @@ we.create = (r, e) => new we({
1907
1907
  typeName: m.ZodUnion,
1908
1908
  ...v(e)
1909
1909
  });
1910
- const V = (r) => r instanceof Se ? V(r.schema) : r instanceof D ? V(r.innerType()) : r instanceof Ce ? [r.value] : r instanceof Y ? r.options : r instanceof Re ? x.objectValues(r.enum) : r instanceof Oe ? V(r._def.innerType) : r instanceof be ? [void 0] : r instanceof ke ? [null] : r instanceof U ? [void 0, ...V(r.unwrap())] : r instanceof G ? [null, ...V(r.unwrap())] : r instanceof ot || r instanceof Ze ? V(r.unwrap()) : r instanceof Ie ? V(r._def.innerType) : [];
1910
+ const V = (r) => r instanceof Se ? V(r.schema) : r instanceof D ? V(r.innerType()) : r instanceof Ce ? [r.value] : r instanceof Y ? r.options : r instanceof Re ? x.objectValues(r.enum) : r instanceof Oe ? V(r._def.innerType) : r instanceof be ? [void 0] : r instanceof ke ? [null] : r instanceof U ? [void 0, ...V(r.unwrap())] : r instanceof G ? [null, ...V(r.unwrap())] : r instanceof ct || r instanceof Ze ? V(r.unwrap()) : r instanceof Ie ? V(r._def.innerType) : [];
1911
1911
  class We extends g {
1912
1912
  _parse(e) {
1913
1913
  const { ctx: t } = this._processInputParams(e);
@@ -1970,14 +1970,14 @@ class We extends g {
1970
1970
  });
1971
1971
  }
1972
1972
  }
1973
- function it(r, e) {
1973
+ function ot(r, e) {
1974
1974
  const t = H(r), n = H(e);
1975
1975
  if (r === e)
1976
1976
  return { valid: !0, data: r };
1977
1977
  if (t === f.object && n === f.object) {
1978
1978
  const s = x.objectKeys(e), a = x.objectKeys(r).filter((o) => s.indexOf(o) !== -1), i = { ...r, ...e };
1979
1979
  for (const o of a) {
1980
- const u = it(r[o], e[o]);
1980
+ const u = ot(r[o], e[o]);
1981
1981
  if (!u.valid)
1982
1982
  return { valid: !1 };
1983
1983
  i[o] = u.data;
@@ -1988,7 +1988,7 @@ function it(r, e) {
1988
1988
  return { valid: !1 };
1989
1989
  const s = [];
1990
1990
  for (let a = 0; a < r.length; a++) {
1991
- const i = r[a], o = e[a], u = it(i, o);
1991
+ const i = r[a], o = e[a], u = ot(i, o);
1992
1992
  if (!u.valid)
1993
1993
  return { valid: !1 };
1994
1994
  s.push(u.data);
@@ -1999,10 +1999,10 @@ function it(r, e) {
1999
1999
  class Te extends g {
2000
2000
  _parse(e) {
2001
2001
  const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
2002
- if (st(a) || st(i))
2002
+ if (at(a) || at(i))
2003
2003
  return y;
2004
- const o = it(a.value, i.value);
2005
- return o.valid ? ((at(a) || at(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
2004
+ const o = ot(a.value, i.value);
2005
+ return o.valid ? ((it(a) || it(i)) && t.dirty(), { status: t.value, value: o.data }) : (l(n, {
2006
2006
  code: c.invalid_intersection_types
2007
2007
  }), y);
2008
2008
  };
@@ -2693,7 +2693,7 @@ Ke.create = (r) => new Ke({
2693
2693
  ...v(r)
2694
2694
  });
2695
2695
  const Sr = Symbol("zod_brand");
2696
- class ot extends g {
2696
+ class ct extends g {
2697
2697
  _parse(e) {
2698
2698
  const { ctx: t } = this._processInputParams(e), n = t.data;
2699
2699
  return this._def.type._parse({
@@ -2800,15 +2800,15 @@ var _ = /* @__PURE__ */ Object.freeze({
2800
2800
  INVALID: y,
2801
2801
  DIRTY: de,
2802
2802
  OK: O,
2803
- isAborted: st,
2804
- isDirty: at,
2803
+ isAborted: at,
2804
+ isDirty: it,
2805
2805
  isValid: ge,
2806
2806
  isAsync: _e,
2807
2807
  get util() {
2808
2808
  return x;
2809
2809
  },
2810
2810
  get objectUtil() {
2811
- return nt;
2811
+ return st;
2812
2812
  },
2813
2813
  ZodParsedType: f,
2814
2814
  getParsedType: H,
@@ -2849,7 +2849,7 @@ var _ = /* @__PURE__ */ Object.freeze({
2849
2849
  ZodCatch: Ie,
2850
2850
  ZodNaN: Ke,
2851
2851
  BRAND: Sr,
2852
- ZodBranded: ot,
2852
+ ZodBranded: ct,
2853
2853
  ZodPipeline: Ne,
2854
2854
  ZodReadonly: Ze,
2855
2855
  custom: Zt,
@@ -3101,11 +3101,11 @@ const Sn = (r) => {
3101
3101
  onCheckoutSuccess: w,
3102
3102
  onCheckoutError: $,
3103
3103
  baseUrl: F
3104
- } = r, B = F ?? On, [X, $t] = E(void 0), [ct, Vt] = E([]), [zt, Bt] = E("1px"), [dt, qt] = E(!1), [Ye, ut] = E(void 0), [lt, Ae] = E(!1), [re, Ht] = E([]), [ne, Kt] = E({}), [ft, ht] = E(0), [pt, mt] = E(!1), [se, Wt] = E(void 0), [Ge, Jt] = E(void 0), [je, Yt] = E(void 0), [Pe, Gt] = E(null), Ft = Dn(Pe == null ? void 0 : Pe.stripePubKey, je, Ge), ae = Me(() => `opjs-form-${Tt()}`, []), pe = kt(null), Fe = Ue(
3104
+ } = r, B = F ?? On, [X, $t] = E(void 0), [dt, Vt] = E([]), [zt, Bt] = E("1px"), [ut, qt] = E(!1), [Ye, lt] = E(void 0), [ft, Ae] = E(!1), [re, Ht] = E([]), [ne, Kt] = E({}), [ht, pt] = E(0), [mt, Ge] = E(!1), [se, Wt] = E(void 0), [Fe, Jt] = E(void 0), [je, Yt] = E(void 0), [Pe, Gt] = E(null), Ft = Dn(Pe == null ? void 0 : Pe.stripePubKey, je, Fe), ae = Me(() => `opjs-form-${Tt()}`, []), pe = kt(null), Xe = Ue(
3105
3105
  (I) => {
3106
3106
  if (I.origin !== B || !I.source) return;
3107
3107
  const ie = I.source, C = Rn(JSON.parse(I.data)), De = C.elementId;
3108
- if (C.formId !== ae || !De || C.nonce in ct)
3108
+ if (C.formId !== ae || !De || C.nonce in dt)
3109
3109
  return;
3110
3110
  Vt((oe) => [...oe, C.nonce]);
3111
3111
  const R = C.payload, A = R.type;
@@ -3116,28 +3116,28 @@ const Sn = (r) => {
3116
3116
  else if (A === k.enum.CHANGE && i)
3117
3117
  i(C.elementId);
3118
3118
  else if (A === k.enum.LOADED) {
3119
- const oe = re.find((et) => et.contentWindow === ie);
3119
+ const oe = re.find((tt) => tt.contentWindow === ie);
3120
3120
  if (Ae(!1), !oe)
3121
3121
  return;
3122
- Kt((et) => ({ ...et, [De]: ie }));
3123
- const Qe = R.height ? `${R.height}px` : "100%";
3124
- Bt(Qe), Yt(R.totalAmountAtoms), Jt(R.currency), Gt(Zn(R)), se || Wt(R.sessionId);
3122
+ Kt((tt) => ({ ...tt, [De]: ie }));
3123
+ const et = R.height ? `${R.height}px` : "100%";
3124
+ Bt(et), Yt(R.totalAmountAtoms), Jt(R.currency), Gt(Zn(R)), se || Wt(R.sessionId);
3125
3125
  } else if (A === k.enum.TOKENIZE_STARTED)
3126
3126
  Ae(!0), p && p();
3127
3127
  else if (A === k.enum.TOKENIZE_SUCCESS && Ye) {
3128
- const oe = ft + 1, Qe = oe === Object.keys(ne).length;
3129
- !pt && (Qe || R.isReadyForCheckout) ? (_t(ie, ae, De, Ye, B), mt(!0), ut(void 0)) : ht(oe);
3130
- } else A === k.enum.CHECKOUT_SUCCESS ? (Ae(!1), ht(0), mt(!1), w && w(R.invoiceUrls, R.subscriptionIds, R.customerId)) : A === k.enum.LOAD_ERROR ? u && u(R.message) : A === k.enum.VALIDATION_ERROR ? d && d(R.elementType, R.errors, De) : (A === k.enum.TOKENIZE_ERROR || A === k.enum.CHECKOUT_ERROR) && (Ae(!1), $ && $(R.message));
3128
+ const oe = ht + 1, et = oe === Object.keys(ne).length;
3129
+ !mt && (et || R.isReadyForCheckout) ? (_t(ie, ae, De, Ye, B), Ge(!0), lt(void 0)) : pt(oe);
3130
+ } else A === k.enum.CHECKOUT_SUCCESS ? (Ae(!1), pt(0), Ge(!1), w && w(R.invoiceUrls, R.subscriptionIds, R.customerId)) : A === k.enum.LOAD_ERROR ? u && u(R.message) : A === k.enum.VALIDATION_ERROR ? d && d(R.elementType, R.errors, De) : (A === k.enum.TOKENIZE_ERROR || A === k.enum.CHECKOUT_ERROR) && (Ae(!1), Ge(!1), $ && $(R.message));
3131
3131
  },
3132
3132
  [
3133
3133
  ae,
3134
3134
  se,
3135
- ct,
3135
+ dt,
3136
3136
  Ye,
3137
3137
  re,
3138
3138
  ne,
3139
- ft,
3140
- pt,
3139
+ ht,
3140
+ mt,
3141
3141
  a,
3142
3142
  i,
3143
3143
  s,
@@ -3154,19 +3154,19 @@ const Sn = (r) => {
3154
3154
  if (I) {
3155
3155
  for (const [ie, C] of Object.entries(ne))
3156
3156
  C && _t(C, ae, ie, I, B);
3157
- I.type = k.enum.CHECKOUT, ut(I);
3157
+ I.type = k.enum.CHECKOUT, lt(I);
3158
3158
  }
3159
- }, [pe, ne, ae, d, se, B]), Xe = Ue(
3159
+ }, [pe, ne, ae, d, se, B]), Qe = Ue(
3160
3160
  (I) => {
3161
- lt && I.preventDefault();
3161
+ ft && I.preventDefault();
3162
3162
  },
3163
- [lt]
3163
+ [ft]
3164
3164
  );
3165
3165
  ve(() => {
3166
- dt || !pe.current || !je || re.length === Object.keys(ne).length && (qt(!0), o && o(je, Ge));
3167
- }, [re, ne, dt, o, je, Ge]), ve(() => ($t(window.location.origin), window.addEventListener("message", Fe), window.addEventListener("beforeunload", Xe), () => {
3168
- window.removeEventListener("beforeunload", Xe), window.removeEventListener("message", Fe);
3169
- }), [se, Fe, Xe]);
3166
+ ut || !pe.current || !je || re.length === Object.keys(ne).length && (qt(!0), o && o(je, Fe));
3167
+ }, [re, ne, ut, o, je, Fe]), ve(() => ($t(window.location.origin), window.addEventListener("message", Xe), window.addEventListener("beforeunload", Qe), () => {
3168
+ window.removeEventListener("beforeunload", Qe), window.removeEventListener("message", Xe);
3169
+ }), [se, Xe, Qe]);
3170
3170
  const Qt = Ue(
3171
3171
  (I) => {
3172
3172
  re.find((C) => C.contentWindow === I.contentWindow) || Ht((C) => [...C, I]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getopenpay/openpay-js-react",
3
- "version": "0.0.6-alpha.2dd4240",
3
+ "version": "0.0.6-alpha.6cf2f5e",
4
4
  "description": "Accept payments through OpenPay, right on your site",
5
5
  "author": "OpenPay <info@getopenpay.com> (https://getopenpay.com)",
6
6
  "type": "module",