@getopenpay/openpay-js-react 0.0.21 → 0.0.23-alpha.1
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/index.d.ts +1 -0
- package/dist/index.js +161 -156
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -15,8 +15,8 @@ const nr = Kr({
|
|
|
15
15
|
return t;
|
|
16
16
|
};
|
|
17
17
|
var Z = [];
|
|
18
|
-
for (var
|
|
19
|
-
Z.push((
|
|
18
|
+
for (var Ct = 0; Ct < 256; ++Ct)
|
|
19
|
+
Z.push((Ct + 256).toString(16).slice(1));
|
|
20
20
|
function Gr(t, e = 0) {
|
|
21
21
|
return (Z[t[e + 0]] + Z[t[e + 1]] + Z[t[e + 2]] + Z[t[e + 3]] + "-" + Z[t[e + 4]] + Z[t[e + 5]] + "-" + Z[t[e + 6]] + Z[t[e + 7]] + "-" + Z[t[e + 8]] + Z[t[e + 9]] + "-" + Z[t[e + 10]] + Z[t[e + 11]] + Z[t[e + 12]] + Z[t[e + 13]] + Z[t[e + 14]] + Z[t[e + 15]]).toLowerCase();
|
|
22
22
|
}
|
|
@@ -27,12 +27,12 @@ function Qr() {
|
|
|
27
27
|
return ut(Xr);
|
|
28
28
|
}
|
|
29
29
|
var en = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
30
|
-
const
|
|
30
|
+
const Yt = {
|
|
31
31
|
randomUUID: en
|
|
32
32
|
};
|
|
33
33
|
function sr(t, e, r) {
|
|
34
|
-
if (
|
|
35
|
-
return
|
|
34
|
+
if (Yt.randomUUID && !e && !t)
|
|
35
|
+
return Yt.randomUUID();
|
|
36
36
|
t = t || {};
|
|
37
37
|
var n = t.random || (t.rng || Qr)();
|
|
38
38
|
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Gr(n);
|
|
@@ -73,14 +73,14 @@ var b;
|
|
|
73
73
|
}
|
|
74
74
|
t.joinValues = n, t.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
75
75
|
})(b || (b = {}));
|
|
76
|
-
var
|
|
76
|
+
var Ot;
|
|
77
77
|
(function(t) {
|
|
78
78
|
t.mergeShapes = (e, r) => ({
|
|
79
79
|
...e,
|
|
80
80
|
...r
|
|
81
81
|
// second overwrites first
|
|
82
82
|
});
|
|
83
|
-
})(
|
|
83
|
+
})(Ot || (Ot = {}));
|
|
84
84
|
const p = b.arrayToEnum([
|
|
85
85
|
"string",
|
|
86
86
|
"nan",
|
|
@@ -343,7 +343,7 @@ class D {
|
|
|
343
343
|
}
|
|
344
344
|
const g = Object.freeze({
|
|
345
345
|
status: "aborted"
|
|
346
|
-
}), je = (t) => ({ status: "dirty", value: t }),
|
|
346
|
+
}), je = (t) => ({ status: "dirty", value: t }), V = (t) => ({ status: "valid", value: t }), Pt = (t) => t.status === "aborted", It = (t) => t.status === "dirty", Be = (t) => t.status === "valid", He = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
347
347
|
function pt(t, e, r, n) {
|
|
348
348
|
if (typeof e == "function" ? t !== e || !n : !e.has(t)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
349
349
|
return e.get(t);
|
|
@@ -365,7 +365,7 @@ class de {
|
|
|
365
365
|
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
const
|
|
368
|
+
const Jt = (t, e) => {
|
|
369
369
|
if (Be(e))
|
|
370
370
|
return { success: !0, data: e.value };
|
|
371
371
|
if (!t.common.issues.length)
|
|
@@ -455,7 +455,7 @@ class w {
|
|
|
455
455
|
data: e,
|
|
456
456
|
parsedType: _e(e)
|
|
457
457
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
458
|
-
return
|
|
458
|
+
return Jt(s, a);
|
|
459
459
|
}
|
|
460
460
|
async parseAsync(e, r) {
|
|
461
461
|
const n = await this.safeParseAsync(e, r);
|
|
@@ -476,7 +476,7 @@ class w {
|
|
|
476
476
|
data: e,
|
|
477
477
|
parsedType: _e(e)
|
|
478
478
|
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (He(s) ? s : Promise.resolve(s));
|
|
479
|
-
return
|
|
479
|
+
return Jt(n, a);
|
|
480
480
|
}
|
|
481
481
|
refine(e, r) {
|
|
482
482
|
const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
|
|
@@ -540,7 +540,7 @@ class w {
|
|
|
540
540
|
});
|
|
541
541
|
}
|
|
542
542
|
brand() {
|
|
543
|
-
return new
|
|
543
|
+
return new Zt({
|
|
544
544
|
typeName: y.ZodBranded,
|
|
545
545
|
type: this,
|
|
546
546
|
..._(this._def)
|
|
@@ -576,7 +576,7 @@ class w {
|
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
578
|
const sn = /^c[^\s-]{8,}$/i, an = /^[0-9a-z]+$/, on = /^[0-9A-HJKMNP-TV-Z]{26}$/, cn = /^[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, dn = /^[a-z0-9_-]{21}$/i, un = /^[-+]?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)?)??$/, ln = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, fn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
579
|
-
let
|
|
579
|
+
let St;
|
|
580
580
|
const mn = /^(?:(?: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])$/, pn = /^(([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})))$/, hn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, or = "((\\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])))", yn = new RegExp(`^${or}$`);
|
|
581
581
|
function cr(t) {
|
|
582
582
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
@@ -648,7 +648,7 @@ class ee extends w {
|
|
|
648
648
|
message: a.message
|
|
649
649
|
}), n.dirty());
|
|
650
650
|
else if (a.kind === "emoji")
|
|
651
|
-
|
|
651
|
+
St || (St = new RegExp(fn, "u")), St.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
652
652
|
validation: "emoji",
|
|
653
653
|
code: l.invalid_string,
|
|
654
654
|
message: a.message
|
|
@@ -1265,7 +1265,7 @@ class We extends w {
|
|
|
1265
1265
|
received: n.parsedType
|
|
1266
1266
|
}), g;
|
|
1267
1267
|
}
|
|
1268
|
-
return
|
|
1268
|
+
return V(e.data);
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
1271
|
We.create = (t) => new We({
|
|
@@ -1361,7 +1361,7 @@ class ht extends w {
|
|
|
1361
1361
|
received: n.parsedType
|
|
1362
1362
|
}), g;
|
|
1363
1363
|
}
|
|
1364
|
-
return
|
|
1364
|
+
return V(e.data);
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
1367
|
ht.create = (t) => new ht({
|
|
@@ -1378,7 +1378,7 @@ class Ke extends w {
|
|
|
1378
1378
|
received: n.parsedType
|
|
1379
1379
|
}), g;
|
|
1380
1380
|
}
|
|
1381
|
-
return
|
|
1381
|
+
return V(e.data);
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
1384
|
Ke.create = (t) => new Ke({
|
|
@@ -1395,7 +1395,7 @@ class Ye extends w {
|
|
|
1395
1395
|
received: n.parsedType
|
|
1396
1396
|
}), g;
|
|
1397
1397
|
}
|
|
1398
|
-
return
|
|
1398
|
+
return V(e.data);
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
1401
1401
|
Ye.create = (t) => new Ye({
|
|
@@ -1407,7 +1407,7 @@ class De extends w {
|
|
|
1407
1407
|
super(...arguments), this._any = !0;
|
|
1408
1408
|
}
|
|
1409
1409
|
_parse(e) {
|
|
1410
|
-
return
|
|
1410
|
+
return V(e.data);
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
De.create = (t) => new De({
|
|
@@ -1419,7 +1419,7 @@ class Oe extends w {
|
|
|
1419
1419
|
super(...arguments), this._unknown = !0;
|
|
1420
1420
|
}
|
|
1421
1421
|
_parse(e) {
|
|
1422
|
-
return
|
|
1422
|
+
return V(e.data);
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
1425
|
Oe.create = (t) => new Oe({
|
|
@@ -1450,7 +1450,7 @@ class yt extends w {
|
|
|
1450
1450
|
received: n.parsedType
|
|
1451
1451
|
}), g;
|
|
1452
1452
|
}
|
|
1453
|
-
return
|
|
1453
|
+
return V(e.data);
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
1456
|
yt.create = (t) => new yt({
|
|
@@ -1906,7 +1906,7 @@ Je.create = (t, e) => new Je({
|
|
|
1906
1906
|
typeName: y.ZodUnion,
|
|
1907
1907
|
..._(e)
|
|
1908
1908
|
});
|
|
1909
|
-
const me = (t) => t instanceof Qe ? me(t.schema) : t instanceof re ? me(t.innerType()) : t instanceof et ? [t.value] : t instanceof xe ? t.options : t instanceof tt ? b.objectValues(t.enum) : t instanceof rt ? me(t._def.innerType) : t instanceof Ke ? [void 0] : t instanceof Ye ? [null] : t instanceof oe ? [void 0, ...me(t.unwrap())] : t instanceof ke ? [null, ...me(t.unwrap())] : t instanceof
|
|
1909
|
+
const me = (t) => t instanceof Qe ? me(t.schema) : t instanceof re ? me(t.innerType()) : t instanceof et ? [t.value] : t instanceof xe ? t.options : t instanceof tt ? b.objectValues(t.enum) : t instanceof rt ? me(t._def.innerType) : t instanceof Ke ? [void 0] : t instanceof Ye ? [null] : t instanceof oe ? [void 0, ...me(t.unwrap())] : t instanceof ke ? [null, ...me(t.unwrap())] : t instanceof Zt || t instanceof st ? me(t.unwrap()) : t instanceof nt ? me(t._def.innerType) : [];
|
|
1910
1910
|
class wt extends w {
|
|
1911
1911
|
_parse(e) {
|
|
1912
1912
|
const { ctx: r } = this._processInputParams(e);
|
|
@@ -1969,14 +1969,14 @@ class wt extends w {
|
|
|
1969
1969
|
});
|
|
1970
1970
|
}
|
|
1971
1971
|
}
|
|
1972
|
-
function
|
|
1972
|
+
function At(t, e) {
|
|
1973
1973
|
const r = _e(t), n = _e(e);
|
|
1974
1974
|
if (t === e)
|
|
1975
1975
|
return { valid: !0, data: t };
|
|
1976
1976
|
if (r === p.object && n === p.object) {
|
|
1977
1977
|
const s = b.objectKeys(e), a = b.objectKeys(t).filter((c) => s.indexOf(c) !== -1), o = { ...t, ...e };
|
|
1978
1978
|
for (const c of a) {
|
|
1979
|
-
const u =
|
|
1979
|
+
const u = At(t[c], e[c]);
|
|
1980
1980
|
if (!u.valid)
|
|
1981
1981
|
return { valid: !1 };
|
|
1982
1982
|
o[c] = u.data;
|
|
@@ -1987,7 +1987,7 @@ function Pt(t, e) {
|
|
|
1987
1987
|
return { valid: !1 };
|
|
1988
1988
|
const s = [];
|
|
1989
1989
|
for (let a = 0; a < t.length; a++) {
|
|
1990
|
-
const o = t[a], c = e[a], u =
|
|
1990
|
+
const o = t[a], c = e[a], u = At(o, c);
|
|
1991
1991
|
if (!u.valid)
|
|
1992
1992
|
return { valid: !1 };
|
|
1993
1993
|
s.push(u.data);
|
|
@@ -1998,10 +1998,10 @@ function Pt(t, e) {
|
|
|
1998
1998
|
class Ge extends w {
|
|
1999
1999
|
_parse(e) {
|
|
2000
2000
|
const { status: r, ctx: n } = this._processInputParams(e), s = (a, o) => {
|
|
2001
|
-
if (
|
|
2001
|
+
if (Pt(a) || Pt(o))
|
|
2002
2002
|
return g;
|
|
2003
|
-
const c =
|
|
2004
|
-
return c.valid ? ((
|
|
2003
|
+
const c = At(a.value, o.value);
|
|
2004
|
+
return c.valid ? ((It(a) || It(o)) && r.dirty(), { status: r.value, value: c.data }) : (m(n, {
|
|
2005
2005
|
code: l.invalid_intersection_types
|
|
2006
2006
|
}), g);
|
|
2007
2007
|
};
|
|
@@ -2283,7 +2283,7 @@ class Me extends w {
|
|
|
2283
2283
|
const a = { errorMap: r.common.contextualErrorMap }, o = r.data;
|
|
2284
2284
|
if (this._def.returns instanceof $e) {
|
|
2285
2285
|
const c = this;
|
|
2286
|
-
return
|
|
2286
|
+
return V(async function(...u) {
|
|
2287
2287
|
const d = new H([]), f = await c._def.args.parseAsync(u, a).catch((x) => {
|
|
2288
2288
|
throw d.addIssue(n(u, x)), d;
|
|
2289
2289
|
}), v = await Reflect.apply(o, this, f);
|
|
@@ -2293,7 +2293,7 @@ class Me extends w {
|
|
|
2293
2293
|
});
|
|
2294
2294
|
} else {
|
|
2295
2295
|
const c = this;
|
|
2296
|
-
return
|
|
2296
|
+
return V(function(...u) {
|
|
2297
2297
|
const d = c._def.args.safeParse(u, a);
|
|
2298
2298
|
if (!d.success)
|
|
2299
2299
|
throw new H([n(u, d.error)]);
|
|
@@ -2400,7 +2400,7 @@ class xe extends w {
|
|
|
2400
2400
|
options: n
|
|
2401
2401
|
}), g;
|
|
2402
2402
|
}
|
|
2403
|
-
return
|
|
2403
|
+
return V(e.data);
|
|
2404
2404
|
}
|
|
2405
2405
|
get options() {
|
|
2406
2406
|
return this._def.values;
|
|
@@ -2460,7 +2460,7 @@ class tt extends w {
|
|
|
2460
2460
|
options: s
|
|
2461
2461
|
}), g;
|
|
2462
2462
|
}
|
|
2463
|
-
return
|
|
2463
|
+
return V(e.data);
|
|
2464
2464
|
}
|
|
2465
2465
|
get enum() {
|
|
2466
2466
|
return this._def.values;
|
|
@@ -2485,7 +2485,7 @@ class $e extends w {
|
|
|
2485
2485
|
received: r.parsedType
|
|
2486
2486
|
}), g;
|
|
2487
2487
|
const n = r.parsedType === p.promise ? r.data : Promise.resolve(r.data);
|
|
2488
|
-
return
|
|
2488
|
+
return V(n.then((s) => this._def.type.parseAsync(s, {
|
|
2489
2489
|
path: r.path,
|
|
2490
2490
|
errorMap: r.common.contextualErrorMap
|
|
2491
2491
|
})));
|
|
@@ -2587,7 +2587,7 @@ re.createWithPreprocess = (t, e, r) => new re({
|
|
|
2587
2587
|
});
|
|
2588
2588
|
class oe extends w {
|
|
2589
2589
|
_parse(e) {
|
|
2590
|
-
return this._getType(e) === p.undefined ?
|
|
2590
|
+
return this._getType(e) === p.undefined ? V(void 0) : this._def.innerType._parse(e);
|
|
2591
2591
|
}
|
|
2592
2592
|
unwrap() {
|
|
2593
2593
|
return this._def.innerType;
|
|
@@ -2600,7 +2600,7 @@ oe.create = (t, e) => new oe({
|
|
|
2600
2600
|
});
|
|
2601
2601
|
class ke extends w {
|
|
2602
2602
|
_parse(e) {
|
|
2603
|
-
return this._getType(e) === p.null ?
|
|
2603
|
+
return this._getType(e) === p.null ? V(null) : this._def.innerType._parse(e);
|
|
2604
2604
|
}
|
|
2605
2605
|
unwrap() {
|
|
2606
2606
|
return this._def.innerType;
|
|
@@ -2692,7 +2692,7 @@ _t.create = (t) => new _t({
|
|
|
2692
2692
|
..._(t)
|
|
2693
2693
|
});
|
|
2694
2694
|
const wn = Symbol("zod_brand");
|
|
2695
|
-
class
|
|
2695
|
+
class Zt extends w {
|
|
2696
2696
|
_parse(e) {
|
|
2697
2697
|
const { ctx: r } = this._processInputParams(e), n = r.data;
|
|
2698
2698
|
return this._def.type._parse({
|
|
@@ -2777,7 +2777,7 @@ var y;
|
|
|
2777
2777
|
})(y || (y = {}));
|
|
2778
2778
|
const En = (t, e = {
|
|
2779
2779
|
message: `Input not instance of ${t.name}`
|
|
2780
|
-
}) => lr((r) => r instanceof t, e), fr = ee.create, mr = be.create, xn = _t.create, kn = Ee.create, pr = We.create, Tn = Pe.create, Cn = ht.create, Sn = Ke.create, Rn = Ye.create, On = De.create, Pn = Oe.create, In = he.create, An = yt.create, Nn = te.create, jn = R.create, Mn = R.strictCreate, Zn = Je.create, Dn = wt.create, $n = Ge.create, Ln = ue.create, Un = Xe.create, Vn = gt.create, Fn = Ie.create, zn = Me.create, qn = Qe.create, Bn = et.create, Hn = xe.create, Wn = tt.create, Kn = $e.create,
|
|
2780
|
+
}) => lr((r) => r instanceof t, e), fr = ee.create, mr = be.create, xn = _t.create, kn = Ee.create, pr = We.create, Tn = Pe.create, Cn = ht.create, Sn = Ke.create, Rn = Ye.create, On = De.create, Pn = Oe.create, In = he.create, An = yt.create, Nn = te.create, jn = R.create, Mn = R.strictCreate, Zn = Je.create, Dn = wt.create, $n = Ge.create, Ln = ue.create, Un = Xe.create, Vn = gt.create, Fn = Ie.create, zn = Me.create, qn = Qe.create, Bn = et.create, Hn = xe.create, Wn = tt.create, Kn = $e.create, Gt = re.create, Yn = oe.create, Jn = ke.create, Gn = re.createWithPreprocess, Xn = ot.create, Qn = () => fr().optional(), es = () => mr().optional(), ts = () => pr().optional(), rs = {
|
|
2781
2781
|
string: (t) => ee.create({ ...t, coerce: !0 }),
|
|
2782
2782
|
number: (t) => be.create({ ...t, coerce: !0 }),
|
|
2783
2783
|
boolean: (t) => We.create({
|
|
@@ -2798,16 +2798,16 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2798
2798
|
ParseStatus: D,
|
|
2799
2799
|
INVALID: g,
|
|
2800
2800
|
DIRTY: je,
|
|
2801
|
-
OK:
|
|
2802
|
-
isAborted:
|
|
2803
|
-
isDirty:
|
|
2801
|
+
OK: V,
|
|
2802
|
+
isAborted: Pt,
|
|
2803
|
+
isDirty: It,
|
|
2804
2804
|
isValid: Be,
|
|
2805
2805
|
isAsync: He,
|
|
2806
2806
|
get util() {
|
|
2807
2807
|
return b;
|
|
2808
2808
|
},
|
|
2809
2809
|
get objectUtil() {
|
|
2810
|
-
return
|
|
2810
|
+
return Ot;
|
|
2811
2811
|
},
|
|
2812
2812
|
ZodParsedType: p,
|
|
2813
2813
|
getParsedType: _e,
|
|
@@ -2848,7 +2848,7 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2848
2848
|
ZodCatch: nt,
|
|
2849
2849
|
ZodNaN: _t,
|
|
2850
2850
|
BRAND: wn,
|
|
2851
|
-
ZodBranded:
|
|
2851
|
+
ZodBranded: Zt,
|
|
2852
2852
|
ZodPipeline: ot,
|
|
2853
2853
|
ZodReadonly: st,
|
|
2854
2854
|
custom: lr,
|
|
@@ -2865,7 +2865,7 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2865
2865
|
boolean: pr,
|
|
2866
2866
|
date: Tn,
|
|
2867
2867
|
discriminatedUnion: Dn,
|
|
2868
|
-
effect:
|
|
2868
|
+
effect: Gt,
|
|
2869
2869
|
enum: Hn,
|
|
2870
2870
|
function: zn,
|
|
2871
2871
|
instanceof: En,
|
|
@@ -2892,7 +2892,7 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2892
2892
|
strictObject: Mn,
|
|
2893
2893
|
string: fr,
|
|
2894
2894
|
symbol: Cn,
|
|
2895
|
-
transformer:
|
|
2895
|
+
transformer: Gt,
|
|
2896
2896
|
tuple: Ln,
|
|
2897
2897
|
undefined: Sn,
|
|
2898
2898
|
union: Zn,
|
|
@@ -2903,14 +2903,14 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2903
2903
|
quotelessJson: tn,
|
|
2904
2904
|
ZodError: H
|
|
2905
2905
|
});
|
|
2906
|
-
const B = i.string().trim().min(1, { message: "Cannot be blank" }), q = i.string().trim().optional(),
|
|
2906
|
+
const B = i.string().trim().min(1, { message: "Cannot be blank" }), q = i.string().trim().optional(), Nt = (t) => i.nullable(t.optional());
|
|
2907
2907
|
var at = /* @__PURE__ */ ((t) => (t.FIRST_NAME = "firstName", t.LAST_NAME = "lastName", t.EMAIL = "email", t.ZIP_CODE = "zipCode", t.CITY = "city", t.STATE = "state", t.COUNTRY = "country", t.ADDRESS = "address", t.PHONE = "phone", t.PROMOTION_CODE = "promotionCode", t))(at || {});
|
|
2908
2908
|
const hr = i.nativeEnum(at);
|
|
2909
2909
|
var yr = /* @__PURE__ */ ((t) => (t.CARD_NUMBER = "cardNumber", t.CARD_EXPIRY = "cardExpiry", t.CARD_CVC = "cardCvc", t))(yr || {});
|
|
2910
2910
|
const gr = i.nativeEnum(yr), ss = i.union([hr, gr]), _r = i.object({
|
|
2911
2911
|
provider: i.string(),
|
|
2912
|
-
processor_name:
|
|
2913
|
-
metadata:
|
|
2912
|
+
processor_name: Nt(i.string()),
|
|
2913
|
+
metadata: Nt(i.record(i.string(), i.any()))
|
|
2914
2914
|
}), as = i.object({
|
|
2915
2915
|
id: i.string()
|
|
2916
2916
|
});
|
|
@@ -3026,7 +3026,7 @@ i.object({
|
|
|
3026
3026
|
});
|
|
3027
3027
|
i.object({
|
|
3028
3028
|
secure_token: i.string(),
|
|
3029
|
-
existing_cc_pm_id:
|
|
3029
|
+
existing_cc_pm_id: Nt(i.string())
|
|
3030
3030
|
});
|
|
3031
3031
|
const ks = i.object({
|
|
3032
3032
|
payment_methods: i.array(as)
|
|
@@ -3040,7 +3040,7 @@ const ks = i.object({
|
|
|
3040
3040
|
return;
|
|
3041
3041
|
}
|
|
3042
3042
|
}), e;
|
|
3043
|
-
}, Cs = (t, e) => Array.from(t.querySelectorAll("
|
|
3043
|
+
}, Cs = (t, e) => Array.from(t.querySelectorAll("[data-opid]") ?? []).reduce((s, a) => {
|
|
3044
3044
|
const o = a.getAttribute("data-opid");
|
|
3045
3045
|
return o ? { ...s, [o]: a.value } : s;
|
|
3046
3046
|
}, e), lt = (t, e, r, n, s, a, o) => {
|
|
@@ -3051,7 +3051,7 @@ const ks = i.object({
|
|
|
3051
3051
|
paymentFlowMetadata: o,
|
|
3052
3052
|
doNotUseLegacyCCFlow: a
|
|
3053
3053
|
});
|
|
3054
|
-
(s.provider === "apple_pay" || s.provider === "google_pay") && (c[at.ZIP_CODE] || (c[at.ZIP_CODE] = "00000"));
|
|
3054
|
+
(s.provider === "apple_pay" || s.provider === "google_pay" || s.provider === "stripe_link") && (c[at.ZIP_CODE] || (c[at.ZIP_CODE] = "00000"));
|
|
3055
3055
|
const u = vr.safeParse(c);
|
|
3056
3056
|
if (u.success)
|
|
3057
3057
|
return u.data;
|
|
@@ -3075,17 +3075,17 @@ const ks = i.object({
|
|
|
3075
3075
|
elementId: r
|
|
3076
3076
|
};
|
|
3077
3077
|
t.postMessage(JSON.stringify(a), s);
|
|
3078
|
-
}, Rs = "https://cde.
|
|
3078
|
+
}, Rs = "https://cde.openpaystaging.com", Os = {
|
|
3079
3079
|
usd: "usd",
|
|
3080
3080
|
brl: "brl"
|
|
3081
|
-
},
|
|
3081
|
+
}, Dt = async (t) => {
|
|
3082
3082
|
for (let r = 0; r < 10; r++)
|
|
3083
|
-
|
|
3084
|
-
if (!
|
|
3083
|
+
Xt() || await wr(500);
|
|
3084
|
+
if (!Xt())
|
|
3085
3085
|
throw new Error("Stripe JS not found.");
|
|
3086
3086
|
return new Stripe(t);
|
|
3087
3087
|
}, Ps = async (t, e, r, n) => {
|
|
3088
|
-
const s = await
|
|
3088
|
+
const s = await Dt(t), a = Os[r.toLowerCase().trim()];
|
|
3089
3089
|
return s.paymentRequest({
|
|
3090
3090
|
// TODO: replace this with stripe account country as soon as we support it
|
|
3091
3091
|
country: "US",
|
|
@@ -3100,7 +3100,7 @@ const ks = i.object({
|
|
|
3100
3100
|
});
|
|
3101
3101
|
}, wr = (t) => new Promise((e) => {
|
|
3102
3102
|
setTimeout(e, t);
|
|
3103
|
-
}),
|
|
3103
|
+
}), Xt = () => "Stripe" in window, Is = async (t) => new Promise((e, r) => {
|
|
3104
3104
|
try {
|
|
3105
3105
|
t.on("paymentmethod", async (n) => {
|
|
3106
3106
|
e(n);
|
|
@@ -3123,7 +3123,7 @@ const ks = i.object({
|
|
|
3123
3123
|
throw new Error(`Invalid next action metadata format: ${JSON.stringify(r)}`);
|
|
3124
3124
|
if (e.paymentMethod.id !== t.paymentFlowMetadata.stripePmId)
|
|
3125
3125
|
throw new Error(`PM ID mismatch: ${e.paymentMethod.id} != ${t.paymentFlowMetadata.stripePmId}`);
|
|
3126
|
-
const s = await (await
|
|
3126
|
+
const s = await (await Dt(r.stripe_pk)).confirmCardSetup(r.client_secret, {
|
|
3127
3127
|
payment_method: t.paymentFlowMetadata.stripePmId
|
|
3128
3128
|
});
|
|
3129
3129
|
if (s.error)
|
|
@@ -3131,7 +3131,7 @@ const ks = i.object({
|
|
|
3131
3131
|
e.complete("success");
|
|
3132
3132
|
}, js = async (t) => {
|
|
3133
3133
|
var a, o, c, u;
|
|
3134
|
-
const e = t.nextActionMetadata, n = await (await
|
|
3134
|
+
const e = t.nextActionMetadata, n = await (await Dt(e.stripe_pk)).confirmCardSetup(e.client_secret, {
|
|
3135
3135
|
payment_method: e.stripe_pm_id
|
|
3136
3136
|
}), s = (a = n.setupIntent) == null ? void 0 : a.status;
|
|
3137
3137
|
if (s !== "succeeded") throw s === "canceled" ? new Error("Payment cancelled, please click Submit again to pay") : new Error(
|
|
@@ -3168,7 +3168,7 @@ const ks = i.object({
|
|
|
3168
3168
|
function Zs(t) {
|
|
3169
3169
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
3170
3170
|
}
|
|
3171
|
-
var
|
|
3171
|
+
var $t = { exports: {} }, Ds = Wr;
|
|
3172
3172
|
function br(t, e, r) {
|
|
3173
3173
|
var n = typeof e == "function";
|
|
3174
3174
|
Ds.useEffect(function() {
|
|
@@ -3182,9 +3182,9 @@ function br(t, e, r) {
|
|
|
3182
3182
|
};
|
|
3183
3183
|
}, n ? r : e);
|
|
3184
3184
|
}
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
var $s =
|
|
3185
|
+
$t.exports = br;
|
|
3186
|
+
$t.exports.useAsyncEffect = br;
|
|
3187
|
+
var $s = $t.exports;
|
|
3188
3188
|
const vt = /* @__PURE__ */ Zs($s), Ls = i.object({
|
|
3189
3189
|
type: i.string(),
|
|
3190
3190
|
loc: i.array(i.string()),
|
|
@@ -3196,7 +3196,7 @@ const vt = /* @__PURE__ */ Zs($s), Ls = i.object({
|
|
|
3196
3196
|
path: i.array(i.string())
|
|
3197
3197
|
}), Fs = i.array(Vs), zs = {
|
|
3198
3198
|
"failed to fetch": "Connection error: please double check if you are connected to the internet, then try again"
|
|
3199
|
-
},
|
|
3199
|
+
}, jt = (t) => {
|
|
3200
3200
|
const e = t.toLowerCase().trim();
|
|
3201
3201
|
return zs[e] ?? t;
|
|
3202
3202
|
}, qs = (t) => {
|
|
@@ -3205,17 +3205,17 @@ const vt = /* @__PURE__ */ Zs($s), Ls = i.object({
|
|
|
3205
3205
|
} catch {
|
|
3206
3206
|
return !1;
|
|
3207
3207
|
}
|
|
3208
|
-
}, Bs = (t) => t.length === 1 ?
|
|
3209
|
-
${t.map((r) => `• ${
|
|
3208
|
+
}, Bs = (t) => t.length === 1 ? jt(t[0].msg) : `Please fix the following errors:
|
|
3209
|
+
${t.map((r) => `• ${jt(r.msg)}`).join(`
|
|
3210
3210
|
`)}`, Hs = (t) => `Encountered the following errors:
|
|
3211
3211
|
${t.map((r) => `- ${r.path.join("/")}: ${r.message}`).join(`
|
|
3212
|
-
`)}`,
|
|
3212
|
+
`)}`, Lt = (t) => {
|
|
3213
3213
|
if (window.cur_error = t, t instanceof Error)
|
|
3214
3214
|
if (qs(t.message)) {
|
|
3215
3215
|
const e = JSON.parse(t.message);
|
|
3216
3216
|
return Us.safeParse(e).success ? Bs(e) : Fs.safeParse(e).success ? Hs(e) : t.message;
|
|
3217
3217
|
} else
|
|
3218
|
-
return
|
|
3218
|
+
return jt(t.message);
|
|
3219
3219
|
if (typeof t == "object")
|
|
3220
3220
|
try {
|
|
3221
3221
|
return JSON.stringify(t);
|
|
@@ -3297,14 +3297,14 @@ const Ys = i.object({
|
|
|
3297
3297
|
tax_amount_atom: i.number(),
|
|
3298
3298
|
total_amount_atom: i.number(),
|
|
3299
3299
|
total_discount_amount_atoms: i.array(xr)
|
|
3300
|
-
}),
|
|
3300
|
+
}), Qt = i.object({
|
|
3301
3301
|
created: i.array(ra),
|
|
3302
3302
|
invoices: i.array(aa)
|
|
3303
3303
|
}), kr = i.object({
|
|
3304
|
-
preview:
|
|
3305
|
-
preview_post_trial: N(
|
|
3304
|
+
preview: Qt,
|
|
3305
|
+
preview_post_trial: N(Qt),
|
|
3306
3306
|
coupons: i.array(Er)
|
|
3307
|
-
}),
|
|
3307
|
+
}), er = i.object({
|
|
3308
3308
|
status: i.literal("open"),
|
|
3309
3309
|
token: i.string(),
|
|
3310
3310
|
email: N(i.string()),
|
|
@@ -3319,11 +3319,11 @@ const Ys = i.object({
|
|
|
3319
3319
|
i.object({
|
|
3320
3320
|
mode: i.literal("setup"),
|
|
3321
3321
|
currency: i.nullable(i.undefined())
|
|
3322
|
-
}).extend(
|
|
3322
|
+
}).extend(er.shape),
|
|
3323
3323
|
i.object({
|
|
3324
3324
|
mode: i.enum(["payment", "subscription"]),
|
|
3325
3325
|
currency: Js
|
|
3326
|
-
}).extend(
|
|
3326
|
+
}).extend(er.shape)
|
|
3327
3327
|
]), ia = i.object({
|
|
3328
3328
|
status: i.literal("complete")
|
|
3329
3329
|
}), oa = i.object({
|
|
@@ -3362,7 +3362,7 @@ i.object({
|
|
|
3362
3362
|
required_user_actions: i.array(i.record(i.string(), i.any())),
|
|
3363
3363
|
cc_pm_id: i.string()
|
|
3364
3364
|
});
|
|
3365
|
-
const
|
|
3365
|
+
const Ut = async (t, e, r) => {
|
|
3366
3366
|
const n = await t.send(e);
|
|
3367
3367
|
if (ua(n))
|
|
3368
3368
|
throw new Error(`[cde-client] Error querying CDE: ${n.message}`);
|
|
@@ -3371,7 +3371,7 @@ const $t = async (t, e, r) => {
|
|
|
3371
3371
|
throw s.success ? new Error("Invalid state") : s.error;
|
|
3372
3372
|
}
|
|
3373
3373
|
return n;
|
|
3374
|
-
}, da = (t, e) => e.safeParse(t).success, ua = (t) => Ys.safeParse(t).success, la = async (t, e) => await
|
|
3374
|
+
}, da = (t, e) => e.safeParse(t).success, ua = (t) => Ys.safeParse(t).success, la = async (t, e) => await Ut(t, { type: "get_checkout_preview", payload: e }, kr), Vt = async (t) => await Ut(t, { type: "get_prefill", payload: {} }, Tr), fa = async (t, e) => await Ut(t, { type: "confirm_payment_flow", payload: e }, ks), ma = (t) => t.reduce((e, r) => e + r, 0), pa = (t, e, r, n) => {
|
|
3375
3375
|
const [s, a] = S(""), [o, c] = S(""), [u, d] = S(null), [f, v] = S(!1), [E, x] = S(null);
|
|
3376
3376
|
return vt(async () => {
|
|
3377
3377
|
if (!n || !t)
|
|
@@ -3391,10 +3391,10 @@ const $t = async (t, e, r) => {
|
|
|
3391
3391
|
try {
|
|
3392
3392
|
if (!e || !r || !t)
|
|
3393
3393
|
return;
|
|
3394
|
-
const C = (await
|
|
3394
|
+
const C = (await Vt(e)).mode === "setup", $ = await Cr(e, r, C, o);
|
|
3395
3395
|
T() && (x(null), d($));
|
|
3396
3396
|
} catch (I) {
|
|
3397
|
-
T() && x(
|
|
3397
|
+
T() && x(Lt(I));
|
|
3398
3398
|
} finally {
|
|
3399
3399
|
T() && v(!1);
|
|
3400
3400
|
}
|
|
@@ -3437,10 +3437,11 @@ const $t = async (t, e, r) => {
|
|
|
3437
3437
|
const s = await ya(t, e, n);
|
|
3438
3438
|
return { amountAtom: s.amountAtom, currency: s.currency };
|
|
3439
3439
|
}
|
|
3440
|
-
},
|
|
3440
|
+
}, tr = i.enum(["apple_pay", "google_pay", "stripe_link"]), ga = {
|
|
3441
3441
|
apple_pay: "applePay",
|
|
3442
|
-
google_pay: "googlePay"
|
|
3443
|
-
|
|
3442
|
+
google_pay: "googlePay",
|
|
3443
|
+
stripe_link: "link"
|
|
3444
|
+
}, Rt = {
|
|
3444
3445
|
isLoading: !0,
|
|
3445
3446
|
isAvailable: !1,
|
|
3446
3447
|
startFlow: async () => {
|
|
@@ -3452,8 +3453,9 @@ const $t = async (t, e, r) => {
|
|
|
3452
3453
|
}
|
|
3453
3454
|
}, va = (t, e, r, n, s, a, o, c) => {
|
|
3454
3455
|
const [u, d] = Ms({
|
|
3455
|
-
apple_pay:
|
|
3456
|
-
google_pay:
|
|
3456
|
+
apple_pay: Rt,
|
|
3457
|
+
google_pay: Rt,
|
|
3458
|
+
stripe_link: Rt
|
|
3457
3459
|
}), f = e === void 0 || r === void 0 || !n || !t, v = c.amount, [E, x] = S(null);
|
|
3458
3460
|
return pe(() => {
|
|
3459
3461
|
if (!Sr() || !v || E === null)
|
|
@@ -3464,21 +3466,21 @@ const $t = async (t, e, r) => {
|
|
|
3464
3466
|
if (f)
|
|
3465
3467
|
return;
|
|
3466
3468
|
const T = r.filter(
|
|
3467
|
-
(j) => j.processor_name === "stripe" &&
|
|
3469
|
+
(j) => j.processor_name === "stripe" && tr.options.map((Y) => String(Y)).includes(j.provider)
|
|
3468
3470
|
);
|
|
3469
3471
|
if (T.length === 0)
|
|
3470
3472
|
throw new Error("Stripe is not available as a checkout method");
|
|
3471
|
-
const I = As(T[0].metadata), $ = (await
|
|
3473
|
+
const I = As(T[0].metadata), $ = (await Vt(t)).mode === "setup";
|
|
3472
3474
|
x($);
|
|
3473
|
-
const
|
|
3475
|
+
const F = await Cr(t, e, $, void 0), O = await Ps(
|
|
3474
3476
|
I,
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
+
F.amountAtom,
|
|
3478
|
+
F.currency,
|
|
3477
3479
|
$
|
|
3478
3480
|
);
|
|
3479
3481
|
Ea(O);
|
|
3480
3482
|
const W = await O.canMakePayment();
|
|
3481
|
-
for (const j of
|
|
3483
|
+
for (const j of tr.options) {
|
|
3482
3484
|
j.replace("_", "");
|
|
3483
3485
|
try {
|
|
3484
3486
|
const Y = T.find((J) => J.provider === j);
|
|
@@ -3518,7 +3520,7 @@ const $t = async (t, e, r) => {
|
|
|
3518
3520
|
const u = await Is(c);
|
|
3519
3521
|
o("[startFlow] PR fulfilled. Completing flow..."), r(u, e);
|
|
3520
3522
|
} catch (o) {
|
|
3521
|
-
window.console.error("[startFlow] Error:", o), s(
|
|
3523
|
+
window.console.error("[startFlow] Error:", o), s(Lt(o));
|
|
3522
3524
|
}
|
|
3523
3525
|
}, Ea = (t) => {
|
|
3524
3526
|
if ("ojs_pr" in window)
|
|
@@ -3543,10 +3545,10 @@ var it;
|
|
|
3543
3545
|
(function(t) {
|
|
3544
3546
|
t.ConnectionDestroyed = "ConnectionDestroyed", t.ConnectionTimeout = "ConnectionTimeout", t.NoIframeSrc = "NoIframeSrc";
|
|
3545
3547
|
})(it || (it = {}));
|
|
3546
|
-
var
|
|
3548
|
+
var Mt;
|
|
3547
3549
|
(function(t) {
|
|
3548
3550
|
t.DataCloneError = "DataCloneError";
|
|
3549
|
-
})(
|
|
3551
|
+
})(Mt || (Mt = {}));
|
|
3550
3552
|
var Te;
|
|
3551
3553
|
(function(t) {
|
|
3552
3554
|
t.Message = "message";
|
|
@@ -3600,17 +3602,17 @@ const xa = (t, e) => {
|
|
|
3600
3602
|
r(`${n}: Unable to send ${E}() reply due to destroyed connection`);
|
|
3601
3603
|
return;
|
|
3602
3604
|
}
|
|
3603
|
-
const
|
|
3605
|
+
const F = {
|
|
3604
3606
|
penpal: ce.Reply,
|
|
3605
3607
|
id: T,
|
|
3606
3608
|
resolution: C,
|
|
3607
3609
|
returnValue: $
|
|
3608
3610
|
};
|
|
3609
|
-
C === Re.Rejected && $ instanceof Error && (
|
|
3611
|
+
C === Re.Rejected && $ instanceof Error && (F.returnValue = rr($), F.returnValueIsError = !0);
|
|
3610
3612
|
try {
|
|
3611
|
-
a.postMessage(
|
|
3613
|
+
a.postMessage(F, o);
|
|
3612
3614
|
} catch (O) {
|
|
3613
|
-
if (O.name ===
|
|
3615
|
+
if (O.name === Mt.DataCloneError) {
|
|
3614
3616
|
const W = {
|
|
3615
3617
|
penpal: ce.Reply,
|
|
3616
3618
|
id: T,
|
|
@@ -3664,8 +3666,8 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3664
3666
|
throw C.code = it.ConnectionDestroyed, C;
|
|
3665
3667
|
}
|
|
3666
3668
|
return new Promise((C, $) => {
|
|
3667
|
-
const
|
|
3668
|
-
if (j.source !== c || j.data.penpal !== ce.Reply || j.data.id !==
|
|
3669
|
+
const F = Aa(), O = (j) => {
|
|
3670
|
+
if (j.source !== c || j.data.penpal !== ce.Reply || j.data.id !== F)
|
|
3669
3671
|
return;
|
|
3670
3672
|
if (d !== "*" && j.origin !== d) {
|
|
3671
3673
|
s(`${a} received message from origin ${j.origin} which did not match expected origin ${d}`);
|
|
@@ -3679,7 +3681,7 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3679
3681
|
o.addEventListener(Te.Message, O);
|
|
3680
3682
|
const W = {
|
|
3681
3683
|
penpal: ce.Call,
|
|
3682
|
-
id:
|
|
3684
|
+
id: F,
|
|
3683
3685
|
methodName: x,
|
|
3684
3686
|
args: T
|
|
3685
3687
|
};
|
|
@@ -3752,7 +3754,7 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3752
3754
|
const f = n === "null" ? "*" : n, v = Ar(r), E = La(o, v, n, f), x = $a(v, n, f, c, o);
|
|
3753
3755
|
return {
|
|
3754
3756
|
promise: new Promise((I, C) => {
|
|
3755
|
-
const $ = Fa(s, d),
|
|
3757
|
+
const $ = Fa(s, d), F = (O) => {
|
|
3756
3758
|
if (!(O.source !== e.contentWindow || !O.data)) {
|
|
3757
3759
|
if (O.data.penpal === ce.Syn) {
|
|
3758
3760
|
E(O);
|
|
@@ -3765,8 +3767,8 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3765
3767
|
}
|
|
3766
3768
|
}
|
|
3767
3769
|
};
|
|
3768
|
-
window.addEventListener(Te.Message,
|
|
3769
|
-
window.removeEventListener(Te.Message,
|
|
3770
|
+
window.addEventListener(Te.Message, F), o("Parent: Awaiting handshake"), Va(e, c), u((O) => {
|
|
3771
|
+
window.removeEventListener(Te.Message, F), O && C(O);
|
|
3770
3772
|
});
|
|
3771
3773
|
}),
|
|
3772
3774
|
destroy() {
|
|
@@ -3828,12 +3830,12 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3828
3830
|
onSetupPaymentMethodSuccess: x,
|
|
3829
3831
|
baseUrl: T,
|
|
3830
3832
|
enableDynamicPreviews: I
|
|
3831
|
-
} = t, C = T ?? Rs, [$,
|
|
3833
|
+
} = t, C = T ?? Rs, [$, F] = S(void 0), [O, W] = S([]), [j, Y] = S("1px"), [J, Nr] = S(!1), [ne, Le] = S(void 0), [Ft, Ce] = S(!1), [ye, jr] = S([]), [ge, Mr] = S({}), [zt, ct] = S(0), [qt, se] = S(!1), [ae, Zr] = S(void 0), [Bt, Dr] = S(void 0), [Ht, $r] = S(void 0), [le, Lr] = S(void 0), [Et, Ur] = S(void 0), fe = ze(() => `opjs-form-${sr()}`, []), G = qe(null);
|
|
3832
3834
|
pe(() => {
|
|
3833
|
-
const P = { version: "0.0.
|
|
3835
|
+
const P = { version: "0.0.23", release_version: "local_build" };
|
|
3834
3836
|
window.ojs_version = P;
|
|
3835
3837
|
}, []);
|
|
3836
|
-
const { cdeConn: Ae, connectToCdeIframe:
|
|
3838
|
+
const { cdeConn: Ae, connectToCdeIframe: Wt } = Ba(), Kt = pa(
|
|
3837
3839
|
I ?? !1,
|
|
3838
3840
|
Ae,
|
|
3839
3841
|
r,
|
|
@@ -3844,28 +3846,30 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3844
3846
|
const K = P.source;
|
|
3845
3847
|
if (!Ka(P.data))
|
|
3846
3848
|
return;
|
|
3847
|
-
const X = JSON.parse(P.data),
|
|
3848
|
-
if (
|
|
3849
|
+
const X = JSON.parse(P.data), z = Ss(X), Se = z.elementId;
|
|
3850
|
+
if (z.formId !== fe || !Se || z.nonce in O)
|
|
3849
3851
|
return;
|
|
3850
|
-
W((
|
|
3851
|
-
const A =
|
|
3852
|
-
if (
|
|
3853
|
-
const
|
|
3854
|
-
Y(
|
|
3855
|
-
} else if (
|
|
3856
|
-
s(
|
|
3857
|
-
else if (
|
|
3858
|
-
a(
|
|
3859
|
-
else if (
|
|
3860
|
-
o(
|
|
3861
|
-
else if (
|
|
3862
|
-
const
|
|
3863
|
-
if (Ce(!1), !
|
|
3852
|
+
W((U) => [...U, z.nonce]);
|
|
3853
|
+
const A = z.payload, L = A.type;
|
|
3854
|
+
if (L === k.enum.LAYOUT) {
|
|
3855
|
+
const U = A.height ? `${A.height}px` : "100%";
|
|
3856
|
+
Y(U);
|
|
3857
|
+
} else if (L === k.enum.FOCUS && s)
|
|
3858
|
+
s(z.elementId);
|
|
3859
|
+
else if (L === k.enum.BLUR && a)
|
|
3860
|
+
a(z.elementId);
|
|
3861
|
+
else if (L === k.enum.CHANGE && o)
|
|
3862
|
+
o(z.elementId);
|
|
3863
|
+
else if (L === k.enum.LOADED) {
|
|
3864
|
+
const U = ye.find((M) => M.contentWindow === K);
|
|
3865
|
+
if (Ce(!1), !U)
|
|
3864
3866
|
return;
|
|
3865
3867
|
Mr((M) => ({ ...M, [Se]: K })), $r(A.totalAmountAtoms), Dr(A.currency), Lr(A.checkoutPaymentMethods), ae || Zr(A.sessionId);
|
|
3866
|
-
} else if (
|
|
3867
|
-
Ce(!0)
|
|
3868
|
-
else if (
|
|
3868
|
+
} else if (L === k.enum.TOKENIZE_STARTED)
|
|
3869
|
+
Ce(!0);
|
|
3870
|
+
else if (L === k.enum.CHECKOUT_STARTED)
|
|
3871
|
+
f && f();
|
|
3872
|
+
else if (L === k.enum.PAYMENT_FLOW_STARTED) {
|
|
3869
3873
|
if (!ne)
|
|
3870
3874
|
throw new Error("extraData not populated");
|
|
3871
3875
|
if (!Ae)
|
|
@@ -3880,7 +3884,7 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3880
3884
|
await Ns(A, Et);
|
|
3881
3885
|
} else
|
|
3882
3886
|
throw new Error(`Unknown next action type: ${M}`);
|
|
3883
|
-
const Q = await
|
|
3887
|
+
const Q = await Vt(Ae);
|
|
3884
3888
|
if (Q.mode === "setup") {
|
|
3885
3889
|
const { payment_methods: ie } = await fa(Ae, {
|
|
3886
3890
|
secure_token: Q.token,
|
|
@@ -3910,25 +3914,25 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3910
3914
|
C
|
|
3911
3915
|
), se(!0), Le(void 0), f && f();
|
|
3912
3916
|
}).catch((M) => {
|
|
3913
|
-
const Q =
|
|
3917
|
+
const Q = Lt(M);
|
|
3914
3918
|
Ce(!1), se(!1), E && E(Q);
|
|
3915
3919
|
});
|
|
3916
|
-
} else if (
|
|
3917
|
-
const
|
|
3918
|
-
!
|
|
3919
|
-
} else if (
|
|
3920
|
+
} else if (L === k.enum.TOKENIZE_SUCCESS && ne) {
|
|
3921
|
+
const U = zt + 1, M = U === Object.keys(ge).length;
|
|
3922
|
+
!qt && (M || A.isReadyForCheckout) ? (Ue(K, fe, Se, ne, C), se(!0), Le(void 0)) : ct(U);
|
|
3923
|
+
} else if (L === k.enum.CHECKOUT_SUCCESS)
|
|
3920
3924
|
Ce(!1), ct(0), se(!1), v && v(A.invoiceUrls, A.subscriptionIds, A.customerId);
|
|
3921
|
-
else if (
|
|
3925
|
+
else if (L === k.enum.SETUP_PAYMENT_METHOD_SUCCESS)
|
|
3922
3926
|
Ce(!1), ct(0), se(!1), x && x(A.paymentMethodId);
|
|
3923
|
-
else if (
|
|
3927
|
+
else if (L === k.enum.LOAD_ERROR)
|
|
3924
3928
|
u && u(A.message);
|
|
3925
|
-
else if (
|
|
3926
|
-
const
|
|
3927
|
-
(
|
|
3928
|
-
} else if (
|
|
3929
|
+
else if (L === k.enum.VALIDATION_ERROR) {
|
|
3930
|
+
const U = ne == null ? void 0 : ne.checkoutPaymentMethod.provider;
|
|
3931
|
+
(U === "credit_card" || U === void 0) && d && d(A.elementType, A.errors, Se);
|
|
3932
|
+
} else if (L === k.enum.TOKENIZE_ERROR || L === k.enum.CHECKOUT_ERROR)
|
|
3929
3933
|
if (A.message === "3DS_REQUIRED") {
|
|
3930
|
-
const
|
|
3931
|
-
if (!ae || !G.current || !d || !
|
|
3934
|
+
const U = le == null ? void 0 : le.find((M) => M.provider === "credit_card");
|
|
3935
|
+
if (!ae || !G.current || !d || !U) return;
|
|
3932
3936
|
for (const [M, Q] of Object.entries(ge)) {
|
|
3933
3937
|
if (!Q) continue;
|
|
3934
3938
|
const ie = lt(
|
|
@@ -3938,7 +3942,7 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3938
3942
|
d,
|
|
3939
3943
|
// Only stripe supports frontend 3DS right now,
|
|
3940
3944
|
// so we pass processor_name: 'stripe' to tell delegator to only use stripe
|
|
3941
|
-
{ ...
|
|
3945
|
+
{ ...U, processor_name: "stripe" },
|
|
3942
3946
|
!1
|
|
3943
3947
|
);
|
|
3944
3948
|
if (ie) {
|
|
@@ -3956,8 +3960,8 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3956
3960
|
ne,
|
|
3957
3961
|
ye,
|
|
3958
3962
|
ge,
|
|
3959
|
-
|
|
3960
|
-
|
|
3963
|
+
zt,
|
|
3964
|
+
qt,
|
|
3961
3965
|
a,
|
|
3962
3966
|
o,
|
|
3963
3967
|
s,
|
|
@@ -3986,31 +3990,31 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3986
3990
|
!1
|
|
3987
3991
|
);
|
|
3988
3992
|
if (K) {
|
|
3989
|
-
for (const [X,
|
|
3990
|
-
|
|
3993
|
+
for (const [X, z] of Object.entries(ge))
|
|
3994
|
+
z && Ue(z, fe, X, K, C);
|
|
3991
3995
|
K.type = k.enum.CHECKOUT, Le(K);
|
|
3992
3996
|
}
|
|
3993
3997
|
}, [G, ge, fe, d, ae, C, le]), kt = ve(
|
|
3994
3998
|
(P) => {
|
|
3995
|
-
|
|
3999
|
+
Ft && P.preventDefault();
|
|
3996
4000
|
},
|
|
3997
|
-
[
|
|
4001
|
+
[Ft]
|
|
3998
4002
|
);
|
|
3999
4003
|
pe(() => {
|
|
4000
4004
|
if (J || !G.current) return;
|
|
4001
|
-
ye.length > 0 && ye.length === Object.keys(ge).length && (Nr(!0), c && c(
|
|
4002
|
-
}, [ye, ge, J, c,
|
|
4005
|
+
ye.length > 0 && ye.length === Object.keys(ge).length && (Nr(!0), c && c(Ht, Bt));
|
|
4006
|
+
}, [ye, ge, J, c, Ht, Bt]), pe(() => (F(window.location.origin), window.addEventListener("message", xt), window.addEventListener("beforeunload", kt), () => {
|
|
4003
4007
|
window.removeEventListener("beforeunload", kt), window.removeEventListener("message", xt);
|
|
4004
4008
|
}), [ae, xt, kt]);
|
|
4005
4009
|
const Fr = ve(
|
|
4006
4010
|
(P) => {
|
|
4007
|
-
ye.find((X) => X.contentWindow === P.contentWindow) || (ye.length === 0 &&
|
|
4011
|
+
ye.find((X) => X.contentWindow === P.contentWindow) || (ye.length === 0 && Wt(P), jr((X) => [...X, P]));
|
|
4008
4012
|
},
|
|
4009
|
-
[ye,
|
|
4013
|
+
[ye, Wt]
|
|
4010
4014
|
), zr = async (P, K) => {
|
|
4011
4015
|
if (!(!G.current || !d || !ae || !le))
|
|
4012
|
-
for (const [X,
|
|
4013
|
-
if (!
|
|
4016
|
+
for (const [X, z] of Object.entries(ge)) {
|
|
4017
|
+
if (!z) continue;
|
|
4014
4018
|
const Se = {
|
|
4015
4019
|
stripePmId: P.paymentMethod.id
|
|
4016
4020
|
}, dt = lt(
|
|
@@ -4023,7 +4027,7 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
4023
4027
|
Se
|
|
4024
4028
|
);
|
|
4025
4029
|
if (dt) {
|
|
4026
|
-
Ur(P), se(!0), Le(dt), Ue(
|
|
4030
|
+
Ur(P), se(!0), Le(dt), Ue(z, fe, X, dt, C);
|
|
4027
4031
|
break;
|
|
4028
4032
|
}
|
|
4029
4033
|
}
|
|
@@ -4036,7 +4040,7 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
4036
4040
|
checkoutSecureToken: r,
|
|
4037
4041
|
registerIframe: Fr,
|
|
4038
4042
|
baseUrl: C
|
|
4039
|
-
},
|
|
4043
|
+
}, Tt = va(
|
|
4040
4044
|
Ae,
|
|
4041
4045
|
r,
|
|
4042
4046
|
le,
|
|
@@ -4044,13 +4048,14 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
4044
4048
|
zr,
|
|
4045
4049
|
d,
|
|
4046
4050
|
qr,
|
|
4047
|
-
|
|
4051
|
+
Kt
|
|
4048
4052
|
), Hr = {
|
|
4049
4053
|
submit: Vr,
|
|
4050
|
-
applePay:
|
|
4051
|
-
googlePay:
|
|
4054
|
+
applePay: Tt.apple_pay,
|
|
4055
|
+
googlePay: Tt.google_pay,
|
|
4056
|
+
stripeLink: Tt.stripe_link,
|
|
4052
4057
|
loaded: J,
|
|
4053
|
-
preview:
|
|
4058
|
+
preview: Kt
|
|
4054
4059
|
};
|
|
4055
4060
|
return /* @__PURE__ */ we(nr.Provider, { value: Br, children: /* @__PURE__ */ we("div", { className: n, ref: G, children: e(Hr) }) });
|
|
4056
4061
|
}, Ya = (t) => JSON.stringify(t), bt = (t) => {
|
package/package.json
CHANGED