@getopenpay/openpay-js-react 0.0.20-alpha.58849b4 → 0.0.21
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.js +287 -284
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Wr, { createContext as Kr, useContext as Yr, useState as S, useMemo as ze, useCallback as
|
|
2
|
-
import { jsx as
|
|
1
|
+
import Wr, { createContext as Kr, useContext as Yr, useState as S, useMemo as ze, useCallback as ve, useRef as qe, useEffect as pe } from "react";
|
|
2
|
+
import { jsx as we } from "react/jsx-runtime";
|
|
3
3
|
const nr = Kr({
|
|
4
4
|
formId: "",
|
|
5
5
|
formHeight: "",
|
|
@@ -14,11 +14,11 @@ const nr = Kr({
|
|
|
14
14
|
throw new Error("useOpenPayElements must be used within an OpenPayElementsProvider");
|
|
15
15
|
return t;
|
|
16
16
|
};
|
|
17
|
-
var
|
|
17
|
+
var Z = [];
|
|
18
18
|
for (var Tt = 0; Tt < 256; ++Tt)
|
|
19
|
-
|
|
19
|
+
Z.push((Tt + 256).toString(16).slice(1));
|
|
20
20
|
function Gr(t, e = 0) {
|
|
21
|
-
return (
|
|
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
|
}
|
|
23
23
|
var ut, Xr = new Uint8Array(16);
|
|
24
24
|
function Qr() {
|
|
@@ -102,7 +102,7 @@ const p = b.arrayToEnum([
|
|
|
102
102
|
"never",
|
|
103
103
|
"map",
|
|
104
104
|
"set"
|
|
105
|
-
]),
|
|
105
|
+
]), _e = (t) => {
|
|
106
106
|
switch (typeof t) {
|
|
107
107
|
case "undefined":
|
|
108
108
|
return p.undefined;
|
|
@@ -357,7 +357,7 @@ var h;
|
|
|
357
357
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
358
358
|
})(h || (h = {}));
|
|
359
359
|
var Ve, Fe;
|
|
360
|
-
class
|
|
360
|
+
class de {
|
|
361
361
|
constructor(e, r, n, s) {
|
|
362
362
|
this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
|
|
363
363
|
}
|
|
@@ -400,13 +400,13 @@ class w {
|
|
|
400
400
|
return this._def.description;
|
|
401
401
|
}
|
|
402
402
|
_getType(e) {
|
|
403
|
-
return
|
|
403
|
+
return _e(e.data);
|
|
404
404
|
}
|
|
405
405
|
_getOrReturnCtx(e, r) {
|
|
406
406
|
return r || {
|
|
407
407
|
common: e.parent.common,
|
|
408
408
|
data: e.data,
|
|
409
|
-
parsedType:
|
|
409
|
+
parsedType: _e(e.data),
|
|
410
410
|
schemaErrorMap: this._def.errorMap,
|
|
411
411
|
path: e.path,
|
|
412
412
|
parent: e.parent
|
|
@@ -418,7 +418,7 @@ class w {
|
|
|
418
418
|
ctx: {
|
|
419
419
|
common: e.parent.common,
|
|
420
420
|
data: e.data,
|
|
421
|
-
parsedType:
|
|
421
|
+
parsedType: _e(e.data),
|
|
422
422
|
schemaErrorMap: this._def.errorMap,
|
|
423
423
|
path: e.path,
|
|
424
424
|
parent: e.parent
|
|
@@ -453,7 +453,7 @@ class w {
|
|
|
453
453
|
schemaErrorMap: this._def.errorMap,
|
|
454
454
|
parent: null,
|
|
455
455
|
data: e,
|
|
456
|
-
parsedType:
|
|
456
|
+
parsedType: _e(e)
|
|
457
457
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
458
458
|
return Yt(s, a);
|
|
459
459
|
}
|
|
@@ -474,7 +474,7 @@ class w {
|
|
|
474
474
|
schemaErrorMap: this._def.errorMap,
|
|
475
475
|
parent: null,
|
|
476
476
|
data: e,
|
|
477
|
-
parsedType:
|
|
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
479
|
return Yt(n, a);
|
|
480
480
|
}
|
|
@@ -492,7 +492,7 @@ class w {
|
|
|
492
492
|
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
|
|
493
493
|
}
|
|
494
494
|
_refinement(e) {
|
|
495
|
-
return new
|
|
495
|
+
return new re({
|
|
496
496
|
schema: this,
|
|
497
497
|
typeName: y.ZodEffects,
|
|
498
498
|
effect: { type: "refinement", refinement: e }
|
|
@@ -502,16 +502,16 @@ class w {
|
|
|
502
502
|
return this._refinement(e);
|
|
503
503
|
}
|
|
504
504
|
optional() {
|
|
505
|
-
return
|
|
505
|
+
return oe.create(this, this._def);
|
|
506
506
|
}
|
|
507
507
|
nullable() {
|
|
508
|
-
return
|
|
508
|
+
return ke.create(this, this._def);
|
|
509
509
|
}
|
|
510
510
|
nullish() {
|
|
511
511
|
return this.nullable().optional();
|
|
512
512
|
}
|
|
513
513
|
array() {
|
|
514
|
-
return
|
|
514
|
+
return te.create(this, this._def);
|
|
515
515
|
}
|
|
516
516
|
promise() {
|
|
517
517
|
return $e.create(this, this._def);
|
|
@@ -523,7 +523,7 @@ class w {
|
|
|
523
523
|
return Ge.create(this, e, this._def);
|
|
524
524
|
}
|
|
525
525
|
transform(e) {
|
|
526
|
-
return new
|
|
526
|
+
return new re({
|
|
527
527
|
..._(this._def),
|
|
528
528
|
schema: this,
|
|
529
529
|
typeName: y.ZodEffects,
|
|
@@ -593,7 +593,7 @@ function dr(t) {
|
|
|
593
593
|
function _n(t, e) {
|
|
594
594
|
return !!((e === "v4" || !e) && mn.test(t) || (e === "v6" || !e) && pn.test(t));
|
|
595
595
|
}
|
|
596
|
-
class
|
|
596
|
+
class ee extends w {
|
|
597
597
|
_parse(e) {
|
|
598
598
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
599
599
|
const a = this._getOrReturnCtx(e);
|
|
@@ -744,7 +744,7 @@ class X extends w {
|
|
|
744
744
|
});
|
|
745
745
|
}
|
|
746
746
|
_addCheck(e) {
|
|
747
|
-
return new
|
|
747
|
+
return new ee({
|
|
748
748
|
...this._def,
|
|
749
749
|
checks: [...this._def.checks, e]
|
|
750
750
|
});
|
|
@@ -870,19 +870,19 @@ class X extends w {
|
|
|
870
870
|
return this.min(1, h.errToObj(e));
|
|
871
871
|
}
|
|
872
872
|
trim() {
|
|
873
|
-
return new
|
|
873
|
+
return new ee({
|
|
874
874
|
...this._def,
|
|
875
875
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
876
876
|
});
|
|
877
877
|
}
|
|
878
878
|
toLowerCase() {
|
|
879
|
-
return new
|
|
879
|
+
return new ee({
|
|
880
880
|
...this._def,
|
|
881
881
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
882
882
|
});
|
|
883
883
|
}
|
|
884
884
|
toUpperCase() {
|
|
885
|
-
return new
|
|
885
|
+
return new ee({
|
|
886
886
|
...this._def,
|
|
887
887
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
888
888
|
});
|
|
@@ -942,9 +942,9 @@ class X extends w {
|
|
|
942
942
|
return e;
|
|
943
943
|
}
|
|
944
944
|
}
|
|
945
|
-
|
|
945
|
+
ee.create = (t) => {
|
|
946
946
|
var e;
|
|
947
|
-
return new
|
|
947
|
+
return new ee({
|
|
948
948
|
checks: [],
|
|
949
949
|
typeName: y.ZodString,
|
|
950
950
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
|
|
@@ -955,7 +955,7 @@ function vn(t, e) {
|
|
|
955
955
|
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = parseInt(t.toFixed(s).replace(".", "")), o = parseInt(e.toFixed(s).replace(".", ""));
|
|
956
956
|
return a % o / Math.pow(10, s);
|
|
957
957
|
}
|
|
958
|
-
class
|
|
958
|
+
class be extends w {
|
|
959
959
|
constructor() {
|
|
960
960
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
961
961
|
}
|
|
@@ -1013,7 +1013,7 @@ class we extends w {
|
|
|
1013
1013
|
return this.setLimit("max", e, !1, h.toString(r));
|
|
1014
1014
|
}
|
|
1015
1015
|
setLimit(e, r, n, s) {
|
|
1016
|
-
return new
|
|
1016
|
+
return new be({
|
|
1017
1017
|
...this._def,
|
|
1018
1018
|
checks: [
|
|
1019
1019
|
...this._def.checks,
|
|
@@ -1027,7 +1027,7 @@ class we extends w {
|
|
|
1027
1027
|
});
|
|
1028
1028
|
}
|
|
1029
1029
|
_addCheck(e) {
|
|
1030
|
-
return new
|
|
1030
|
+
return new be({
|
|
1031
1031
|
...this._def,
|
|
1032
1032
|
checks: [...this._def.checks, e]
|
|
1033
1033
|
});
|
|
@@ -1121,13 +1121,13 @@ class we extends w {
|
|
|
1121
1121
|
return Number.isFinite(r) && Number.isFinite(e);
|
|
1122
1122
|
}
|
|
1123
1123
|
}
|
|
1124
|
-
|
|
1124
|
+
be.create = (t) => new be({
|
|
1125
1125
|
checks: [],
|
|
1126
1126
|
typeName: y.ZodNumber,
|
|
1127
1127
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1128
1128
|
..._(t)
|
|
1129
1129
|
});
|
|
1130
|
-
class
|
|
1130
|
+
class Ee extends w {
|
|
1131
1131
|
constructor() {
|
|
1132
1132
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1133
1133
|
}
|
|
@@ -1175,7 +1175,7 @@ class be extends w {
|
|
|
1175
1175
|
return this.setLimit("max", e, !1, h.toString(r));
|
|
1176
1176
|
}
|
|
1177
1177
|
setLimit(e, r, n, s) {
|
|
1178
|
-
return new
|
|
1178
|
+
return new Ee({
|
|
1179
1179
|
...this._def,
|
|
1180
1180
|
checks: [
|
|
1181
1181
|
...this._def.checks,
|
|
@@ -1189,7 +1189,7 @@ class be extends w {
|
|
|
1189
1189
|
});
|
|
1190
1190
|
}
|
|
1191
1191
|
_addCheck(e) {
|
|
1192
|
-
return new
|
|
1192
|
+
return new Ee({
|
|
1193
1193
|
...this._def,
|
|
1194
1194
|
checks: [...this._def.checks, e]
|
|
1195
1195
|
});
|
|
@@ -1246,9 +1246,9 @@ class be extends w {
|
|
|
1246
1246
|
return e;
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
|
-
|
|
1249
|
+
Ee.create = (t) => {
|
|
1250
1250
|
var e;
|
|
1251
|
-
return new
|
|
1251
|
+
return new Ee({
|
|
1252
1252
|
checks: [],
|
|
1253
1253
|
typeName: y.ZodBigInt,
|
|
1254
1254
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
|
|
@@ -1426,7 +1426,7 @@ Oe.create = (t) => new Oe({
|
|
|
1426
1426
|
typeName: y.ZodUnknown,
|
|
1427
1427
|
..._(t)
|
|
1428
1428
|
});
|
|
1429
|
-
class
|
|
1429
|
+
class he extends w {
|
|
1430
1430
|
_parse(e) {
|
|
1431
1431
|
const r = this._getOrReturnCtx(e);
|
|
1432
1432
|
return m(r, {
|
|
@@ -1436,7 +1436,7 @@ class pe extends w {
|
|
|
1436
1436
|
}), g;
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
|
-
|
|
1439
|
+
he.create = (t) => new he({
|
|
1440
1440
|
typeName: y.ZodNever,
|
|
1441
1441
|
..._(t)
|
|
1442
1442
|
});
|
|
@@ -1457,7 +1457,7 @@ yt.create = (t) => new yt({
|
|
|
1457
1457
|
typeName: y.ZodVoid,
|
|
1458
1458
|
..._(t)
|
|
1459
1459
|
});
|
|
1460
|
-
class
|
|
1460
|
+
class te extends w {
|
|
1461
1461
|
_parse(e) {
|
|
1462
1462
|
const { ctx: r, status: n } = this._processInputParams(e), s = this._def;
|
|
1463
1463
|
if (r.parsedType !== p.array)
|
|
@@ -1493,27 +1493,27 @@ class Q extends w {
|
|
|
1493
1493
|
exact: !1,
|
|
1494
1494
|
message: s.maxLength.message
|
|
1495
1495
|
}), n.dirty()), r.common.async)
|
|
1496
|
-
return Promise.all([...r.data].map((o, c) => s.type._parseAsync(new
|
|
1497
|
-
const a = [...r.data].map((o, c) => s.type._parseSync(new
|
|
1496
|
+
return Promise.all([...r.data].map((o, c) => s.type._parseAsync(new de(r, o, r.path, c)))).then((o) => D.mergeArray(n, o));
|
|
1497
|
+
const a = [...r.data].map((o, c) => s.type._parseSync(new de(r, o, r.path, c)));
|
|
1498
1498
|
return D.mergeArray(n, a);
|
|
1499
1499
|
}
|
|
1500
1500
|
get element() {
|
|
1501
1501
|
return this._def.type;
|
|
1502
1502
|
}
|
|
1503
1503
|
min(e, r) {
|
|
1504
|
-
return new
|
|
1504
|
+
return new te({
|
|
1505
1505
|
...this._def,
|
|
1506
1506
|
minLength: { value: e, message: h.toString(r) }
|
|
1507
1507
|
});
|
|
1508
1508
|
}
|
|
1509
1509
|
max(e, r) {
|
|
1510
|
-
return new
|
|
1510
|
+
return new te({
|
|
1511
1511
|
...this._def,
|
|
1512
1512
|
maxLength: { value: e, message: h.toString(r) }
|
|
1513
1513
|
});
|
|
1514
1514
|
}
|
|
1515
1515
|
length(e, r) {
|
|
1516
|
-
return new
|
|
1516
|
+
return new te({
|
|
1517
1517
|
...this._def,
|
|
1518
1518
|
exactLength: { value: e, message: h.toString(r) }
|
|
1519
1519
|
});
|
|
@@ -1522,7 +1522,7 @@ class Q extends w {
|
|
|
1522
1522
|
return this.min(1, e);
|
|
1523
1523
|
}
|
|
1524
1524
|
}
|
|
1525
|
-
|
|
1525
|
+
te.create = (t, e) => new te({
|
|
1526
1526
|
type: t,
|
|
1527
1527
|
minLength: null,
|
|
1528
1528
|
maxLength: null,
|
|
@@ -1535,16 +1535,16 @@ function Ne(t) {
|
|
|
1535
1535
|
const e = {};
|
|
1536
1536
|
for (const r in t.shape) {
|
|
1537
1537
|
const n = t.shape[r];
|
|
1538
|
-
e[r] =
|
|
1538
|
+
e[r] = oe.create(Ne(n));
|
|
1539
1539
|
}
|
|
1540
1540
|
return new R({
|
|
1541
1541
|
...t._def,
|
|
1542
1542
|
shape: () => e
|
|
1543
1543
|
});
|
|
1544
|
-
} else return t instanceof
|
|
1544
|
+
} else return t instanceof te ? new te({
|
|
1545
1545
|
...t._def,
|
|
1546
1546
|
type: Ne(t.element)
|
|
1547
|
-
}) : t instanceof
|
|
1547
|
+
}) : t instanceof oe ? oe.create(Ne(t.unwrap())) : t instanceof ke ? ke.create(Ne(t.unwrap())) : t instanceof ue ? ue.create(t.items.map((e) => Ne(e))) : t;
|
|
1548
1548
|
}
|
|
1549
1549
|
class R extends w {
|
|
1550
1550
|
constructor() {
|
|
@@ -1566,7 +1566,7 @@ class R extends w {
|
|
|
1566
1566
|
}), g;
|
|
1567
1567
|
}
|
|
1568
1568
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: o } = this._getCached(), c = [];
|
|
1569
|
-
if (!(this._def.catchall instanceof
|
|
1569
|
+
if (!(this._def.catchall instanceof he && this._def.unknownKeys === "strip"))
|
|
1570
1570
|
for (const d in s.data)
|
|
1571
1571
|
o.includes(d) || c.push(d);
|
|
1572
1572
|
const u = [];
|
|
@@ -1574,11 +1574,11 @@ class R extends w {
|
|
|
1574
1574
|
const f = a[d], v = s.data[d];
|
|
1575
1575
|
u.push({
|
|
1576
1576
|
key: { status: "valid", value: d },
|
|
1577
|
-
value: f._parse(new
|
|
1577
|
+
value: f._parse(new de(s, v, s.path, d)),
|
|
1578
1578
|
alwaysSet: d in s.data
|
|
1579
1579
|
});
|
|
1580
1580
|
}
|
|
1581
|
-
if (this._def.catchall instanceof
|
|
1581
|
+
if (this._def.catchall instanceof he) {
|
|
1582
1582
|
const d = this._def.unknownKeys;
|
|
1583
1583
|
if (d === "passthrough")
|
|
1584
1584
|
for (const f of c)
|
|
@@ -1599,7 +1599,7 @@ class R extends w {
|
|
|
1599
1599
|
u.push({
|
|
1600
1600
|
key: { status: "valid", value: f },
|
|
1601
1601
|
value: d._parse(
|
|
1602
|
-
new
|
|
1602
|
+
new de(s, v, s.path, f)
|
|
1603
1603
|
//, ctx.child(key), value, getParsedType(value)
|
|
1604
1604
|
),
|
|
1605
1605
|
alwaysSet: f in s.data
|
|
@@ -1609,10 +1609,10 @@ class R extends w {
|
|
|
1609
1609
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1610
1610
|
const d = [];
|
|
1611
1611
|
for (const f of u) {
|
|
1612
|
-
const v = await f.key,
|
|
1612
|
+
const v = await f.key, E = await f.value;
|
|
1613
1613
|
d.push({
|
|
1614
1614
|
key: v,
|
|
1615
|
-
value:
|
|
1615
|
+
value: E,
|
|
1616
1616
|
alwaysSet: f.alwaysSet
|
|
1617
1617
|
});
|
|
1618
1618
|
}
|
|
@@ -1799,7 +1799,7 @@ class R extends w {
|
|
|
1799
1799
|
r[n] = this.shape[n];
|
|
1800
1800
|
else {
|
|
1801
1801
|
let a = this.shape[n];
|
|
1802
|
-
for (; a instanceof
|
|
1802
|
+
for (; a instanceof oe; )
|
|
1803
1803
|
a = a._def.innerType;
|
|
1804
1804
|
r[n] = a;
|
|
1805
1805
|
}
|
|
@@ -1815,21 +1815,21 @@ class R extends w {
|
|
|
1815
1815
|
R.create = (t, e) => new R({
|
|
1816
1816
|
shape: () => t,
|
|
1817
1817
|
unknownKeys: "strip",
|
|
1818
|
-
catchall:
|
|
1818
|
+
catchall: he.create(),
|
|
1819
1819
|
typeName: y.ZodObject,
|
|
1820
1820
|
..._(e)
|
|
1821
1821
|
});
|
|
1822
1822
|
R.strictCreate = (t, e) => new R({
|
|
1823
1823
|
shape: () => t,
|
|
1824
1824
|
unknownKeys: "strict",
|
|
1825
|
-
catchall:
|
|
1825
|
+
catchall: he.create(),
|
|
1826
1826
|
typeName: y.ZodObject,
|
|
1827
1827
|
..._(e)
|
|
1828
1828
|
});
|
|
1829
1829
|
R.lazycreate = (t, e) => new R({
|
|
1830
1830
|
shape: t,
|
|
1831
1831
|
unknownKeys: "strip",
|
|
1832
|
-
catchall:
|
|
1832
|
+
catchall: he.create(),
|
|
1833
1833
|
typeName: y.ZodObject,
|
|
1834
1834
|
..._(e)
|
|
1835
1835
|
});
|
|
@@ -1906,7 +1906,7 @@ Je.create = (t, e) => new Je({
|
|
|
1906
1906
|
typeName: y.ZodUnion,
|
|
1907
1907
|
..._(e)
|
|
1908
1908
|
});
|
|
1909
|
-
const
|
|
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 jt || 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);
|
|
@@ -1951,7 +1951,7 @@ class wt extends w {
|
|
|
1951
1951
|
static create(e, r, n) {
|
|
1952
1952
|
const s = /* @__PURE__ */ new Map();
|
|
1953
1953
|
for (const a of r) {
|
|
1954
|
-
const o =
|
|
1954
|
+
const o = me(a.shape[e]);
|
|
1955
1955
|
if (!o.length)
|
|
1956
1956
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1957
1957
|
for (const c of o) {
|
|
@@ -1970,7 +1970,7 @@ class wt extends w {
|
|
|
1970
1970
|
}
|
|
1971
1971
|
}
|
|
1972
1972
|
function Pt(t, e) {
|
|
1973
|
-
const r =
|
|
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) {
|
|
@@ -2033,7 +2033,7 @@ Ge.create = (t, e, r) => new Ge({
|
|
|
2033
2033
|
typeName: y.ZodIntersection,
|
|
2034
2034
|
..._(r)
|
|
2035
2035
|
});
|
|
2036
|
-
class
|
|
2036
|
+
class ue extends w {
|
|
2037
2037
|
_parse(e) {
|
|
2038
2038
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2039
2039
|
if (n.parsedType !== p.array)
|
|
@@ -2059,7 +2059,7 @@ class de extends w {
|
|
|
2059
2059
|
}), r.dirty());
|
|
2060
2060
|
const a = [...n.data].map((o, c) => {
|
|
2061
2061
|
const u = this._def.items[c] || this._def.rest;
|
|
2062
|
-
return u ? u._parse(new
|
|
2062
|
+
return u ? u._parse(new de(n, o, n.path, c)) : null;
|
|
2063
2063
|
}).filter((o) => !!o);
|
|
2064
2064
|
return n.common.async ? Promise.all(a).then((o) => D.mergeArray(r, o)) : D.mergeArray(r, a);
|
|
2065
2065
|
}
|
|
@@ -2067,16 +2067,16 @@ class de extends w {
|
|
|
2067
2067
|
return this._def.items;
|
|
2068
2068
|
}
|
|
2069
2069
|
rest(e) {
|
|
2070
|
-
return new
|
|
2070
|
+
return new ue({
|
|
2071
2071
|
...this._def,
|
|
2072
2072
|
rest: e
|
|
2073
2073
|
});
|
|
2074
2074
|
}
|
|
2075
2075
|
}
|
|
2076
|
-
|
|
2076
|
+
ue.create = (t, e) => {
|
|
2077
2077
|
if (!Array.isArray(t))
|
|
2078
2078
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2079
|
-
return new
|
|
2079
|
+
return new ue({
|
|
2080
2080
|
items: t,
|
|
2081
2081
|
typeName: y.ZodTuple,
|
|
2082
2082
|
rest: null,
|
|
@@ -2101,8 +2101,8 @@ class Xe extends w {
|
|
|
2101
2101
|
const s = [], a = this._def.keyType, o = this._def.valueType;
|
|
2102
2102
|
for (const c in n.data)
|
|
2103
2103
|
s.push({
|
|
2104
|
-
key: a._parse(new
|
|
2105
|
-
value: o._parse(new
|
|
2104
|
+
key: a._parse(new de(n, c, n.path, c)),
|
|
2105
|
+
value: o._parse(new de(n, n.data[c], n.path, c)),
|
|
2106
2106
|
alwaysSet: c in n.data
|
|
2107
2107
|
});
|
|
2108
2108
|
return n.common.async ? D.mergeObjectAsync(r, s) : D.mergeObjectSync(r, s);
|
|
@@ -2117,7 +2117,7 @@ class Xe extends w {
|
|
|
2117
2117
|
typeName: y.ZodRecord,
|
|
2118
2118
|
..._(n)
|
|
2119
2119
|
}) : new Xe({
|
|
2120
|
-
keyType:
|
|
2120
|
+
keyType: ee.create(),
|
|
2121
2121
|
valueType: e,
|
|
2122
2122
|
typeName: y.ZodRecord,
|
|
2123
2123
|
..._(r)
|
|
@@ -2140,8 +2140,8 @@ class gt extends w {
|
|
|
2140
2140
|
received: n.parsedType
|
|
2141
2141
|
}), g;
|
|
2142
2142
|
const s = this._def.keyType, a = this._def.valueType, o = [...n.data.entries()].map(([c, u], d) => ({
|
|
2143
|
-
key: s._parse(new
|
|
2144
|
-
value: a._parse(new
|
|
2143
|
+
key: s._parse(new de(n, c, n.path, [d, "key"])),
|
|
2144
|
+
value: a._parse(new de(n, u, n.path, [d, "value"]))
|
|
2145
2145
|
}));
|
|
2146
2146
|
if (n.common.async) {
|
|
2147
2147
|
const c = /* @__PURE__ */ new Map();
|
|
@@ -2207,7 +2207,7 @@ class Ie extends w {
|
|
|
2207
2207
|
}
|
|
2208
2208
|
return { status: r.value, value: d };
|
|
2209
2209
|
}
|
|
2210
|
-
const c = [...n.data.values()].map((u, d) => a._parse(new
|
|
2210
|
+
const c = [...n.data.values()].map((u, d) => a._parse(new de(n, u, n.path, d)));
|
|
2211
2211
|
return n.common.async ? Promise.all(c).then((u) => o(u)) : o(c);
|
|
2212
2212
|
}
|
|
2213
2213
|
min(e, r) {
|
|
@@ -2284,11 +2284,11 @@ class Me extends w {
|
|
|
2284
2284
|
if (this._def.returns instanceof $e) {
|
|
2285
2285
|
const c = this;
|
|
2286
2286
|
return U(async function(...u) {
|
|
2287
|
-
const d = new H([]), f = await c._def.args.parseAsync(u, a).catch((
|
|
2288
|
-
throw d.addIssue(n(u,
|
|
2287
|
+
const d = new H([]), f = await c._def.args.parseAsync(u, a).catch((x) => {
|
|
2288
|
+
throw d.addIssue(n(u, x)), d;
|
|
2289
2289
|
}), v = await Reflect.apply(o, this, f);
|
|
2290
|
-
return await c._def.returns._def.type.parseAsync(v, a).catch((
|
|
2291
|
-
throw d.addIssue(s(v,
|
|
2290
|
+
return await c._def.returns._def.type.parseAsync(v, a).catch((x) => {
|
|
2291
|
+
throw d.addIssue(s(v, x)), d;
|
|
2292
2292
|
});
|
|
2293
2293
|
});
|
|
2294
2294
|
} else {
|
|
@@ -2313,7 +2313,7 @@ class Me extends w {
|
|
|
2313
2313
|
args(...e) {
|
|
2314
2314
|
return new Me({
|
|
2315
2315
|
...this._def,
|
|
2316
|
-
args:
|
|
2316
|
+
args: ue.create(e).rest(Oe.create())
|
|
2317
2317
|
});
|
|
2318
2318
|
}
|
|
2319
2319
|
returns(e) {
|
|
@@ -2330,7 +2330,7 @@ class Me extends w {
|
|
|
2330
2330
|
}
|
|
2331
2331
|
static create(e, r, n) {
|
|
2332
2332
|
return new Me({
|
|
2333
|
-
args: e ||
|
|
2333
|
+
args: e || ue.create([]).rest(Oe.create()),
|
|
2334
2334
|
returns: r || Oe.create(),
|
|
2335
2335
|
typeName: y.ZodFunction,
|
|
2336
2336
|
..._(n)
|
|
@@ -2496,7 +2496,7 @@ $e.create = (t, e) => new $e({
|
|
|
2496
2496
|
typeName: y.ZodPromise,
|
|
2497
2497
|
..._(e)
|
|
2498
2498
|
});
|
|
2499
|
-
class
|
|
2499
|
+
class re extends w {
|
|
2500
2500
|
innerType() {
|
|
2501
2501
|
return this._def.schema;
|
|
2502
2502
|
}
|
|
@@ -2573,19 +2573,19 @@ class ee extends w {
|
|
|
2573
2573
|
b.assertNever(s);
|
|
2574
2574
|
}
|
|
2575
2575
|
}
|
|
2576
|
-
|
|
2576
|
+
re.create = (t, e, r) => new re({
|
|
2577
2577
|
schema: t,
|
|
2578
2578
|
typeName: y.ZodEffects,
|
|
2579
2579
|
effect: e,
|
|
2580
2580
|
..._(r)
|
|
2581
2581
|
});
|
|
2582
|
-
|
|
2582
|
+
re.createWithPreprocess = (t, e, r) => new re({
|
|
2583
2583
|
schema: e,
|
|
2584
2584
|
effect: { type: "preprocess", transform: t },
|
|
2585
2585
|
typeName: y.ZodEffects,
|
|
2586
2586
|
..._(r)
|
|
2587
2587
|
});
|
|
2588
|
-
class
|
|
2588
|
+
class oe extends w {
|
|
2589
2589
|
_parse(e) {
|
|
2590
2590
|
return this._getType(e) === p.undefined ? U(void 0) : this._def.innerType._parse(e);
|
|
2591
2591
|
}
|
|
@@ -2593,12 +2593,12 @@ class ie extends w {
|
|
|
2593
2593
|
return this._def.innerType;
|
|
2594
2594
|
}
|
|
2595
2595
|
}
|
|
2596
|
-
|
|
2596
|
+
oe.create = (t, e) => new oe({
|
|
2597
2597
|
innerType: t,
|
|
2598
2598
|
typeName: y.ZodOptional,
|
|
2599
2599
|
..._(e)
|
|
2600
2600
|
});
|
|
2601
|
-
class
|
|
2601
|
+
class ke extends w {
|
|
2602
2602
|
_parse(e) {
|
|
2603
2603
|
return this._getType(e) === p.null ? U(null) : this._def.innerType._parse(e);
|
|
2604
2604
|
}
|
|
@@ -2606,7 +2606,7 @@ class Ee extends w {
|
|
|
2606
2606
|
return this._def.innerType;
|
|
2607
2607
|
}
|
|
2608
2608
|
}
|
|
2609
|
-
|
|
2609
|
+
ke.create = (t, e) => new ke({
|
|
2610
2610
|
innerType: t,
|
|
2611
2611
|
typeName: y.ZodNullable,
|
|
2612
2612
|
..._(e)
|
|
@@ -2775,16 +2775,16 @@ var y;
|
|
|
2775
2775
|
(function(t) {
|
|
2776
2776
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
2777
2777
|
})(y || (y = {}));
|
|
2778
|
-
const
|
|
2778
|
+
const En = (t, e = {
|
|
2779
2779
|
message: `Input not instance of ${t.name}`
|
|
2780
|
-
}) => lr((r) => r instanceof t, e), fr =
|
|
2781
|
-
string: (t) =>
|
|
2782
|
-
number: (t) =>
|
|
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, Jt = 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
|
+
string: (t) => ee.create({ ...t, coerce: !0 }),
|
|
2782
|
+
number: (t) => be.create({ ...t, coerce: !0 }),
|
|
2783
2783
|
boolean: (t) => We.create({
|
|
2784
2784
|
...t,
|
|
2785
2785
|
coerce: !0
|
|
2786
2786
|
}),
|
|
2787
|
-
bigint: (t) =>
|
|
2787
|
+
bigint: (t) => Ee.create({ ...t, coerce: !0 }),
|
|
2788
2788
|
date: (t) => Pe.create({ ...t, coerce: !0 })
|
|
2789
2789
|
}, ns = g;
|
|
2790
2790
|
var i = /* @__PURE__ */ Object.freeze({
|
|
@@ -2810,12 +2810,12 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2810
2810
|
return St;
|
|
2811
2811
|
},
|
|
2812
2812
|
ZodParsedType: p,
|
|
2813
|
-
getParsedType:
|
|
2813
|
+
getParsedType: _e,
|
|
2814
2814
|
ZodType: w,
|
|
2815
2815
|
datetimeRegex: dr,
|
|
2816
|
-
ZodString:
|
|
2817
|
-
ZodNumber:
|
|
2818
|
-
ZodBigInt:
|
|
2816
|
+
ZodString: ee,
|
|
2817
|
+
ZodNumber: be,
|
|
2818
|
+
ZodBigInt: Ee,
|
|
2819
2819
|
ZodBoolean: We,
|
|
2820
2820
|
ZodDate: Pe,
|
|
2821
2821
|
ZodSymbol: ht,
|
|
@@ -2823,14 +2823,14 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2823
2823
|
ZodNull: Ye,
|
|
2824
2824
|
ZodAny: De,
|
|
2825
2825
|
ZodUnknown: Oe,
|
|
2826
|
-
ZodNever:
|
|
2826
|
+
ZodNever: he,
|
|
2827
2827
|
ZodVoid: yt,
|
|
2828
|
-
ZodArray:
|
|
2828
|
+
ZodArray: te,
|
|
2829
2829
|
ZodObject: R,
|
|
2830
2830
|
ZodUnion: Je,
|
|
2831
2831
|
ZodDiscriminatedUnion: wt,
|
|
2832
2832
|
ZodIntersection: Ge,
|
|
2833
|
-
ZodTuple:
|
|
2833
|
+
ZodTuple: ue,
|
|
2834
2834
|
ZodRecord: Xe,
|
|
2835
2835
|
ZodMap: gt,
|
|
2836
2836
|
ZodSet: Ie,
|
|
@@ -2840,10 +2840,10 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2840
2840
|
ZodEnum: xe,
|
|
2841
2841
|
ZodNativeEnum: tt,
|
|
2842
2842
|
ZodPromise: $e,
|
|
2843
|
-
ZodEffects:
|
|
2844
|
-
ZodTransformer:
|
|
2845
|
-
ZodOptional:
|
|
2846
|
-
ZodNullable:
|
|
2843
|
+
ZodEffects: re,
|
|
2844
|
+
ZodTransformer: re,
|
|
2845
|
+
ZodOptional: oe,
|
|
2846
|
+
ZodNullable: ke,
|
|
2847
2847
|
ZodDefault: rt,
|
|
2848
2848
|
ZodCatch: nt,
|
|
2849
2849
|
ZodNaN: _t,
|
|
@@ -2868,12 +2868,12 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2868
2868
|
effect: Jt,
|
|
2869
2869
|
enum: Hn,
|
|
2870
2870
|
function: zn,
|
|
2871
|
-
instanceof:
|
|
2871
|
+
instanceof: En,
|
|
2872
2872
|
intersection: $n,
|
|
2873
2873
|
lazy: qn,
|
|
2874
2874
|
literal: Bn,
|
|
2875
2875
|
map: Vn,
|
|
2876
|
-
nan:
|
|
2876
|
+
nan: xn,
|
|
2877
2877
|
nativeEnum: Wn,
|
|
2878
2878
|
never: In,
|
|
2879
2879
|
null: Rn,
|
|
@@ -2998,7 +2998,7 @@ const k = i.enum([
|
|
|
2998
2998
|
invoiceUrls: i.array(i.string()),
|
|
2999
2999
|
subscriptionIds: i.array(i.string()),
|
|
3000
3000
|
customerId: i.string()
|
|
3001
|
-
}),
|
|
3001
|
+
}), Es = i.discriminatedUnion("type", [
|
|
3002
3002
|
os,
|
|
3003
3003
|
ds,
|
|
3004
3004
|
ls,
|
|
@@ -3010,8 +3010,8 @@ const k = i.enum([
|
|
|
3010
3010
|
bs,
|
|
3011
3011
|
ys,
|
|
3012
3012
|
gs
|
|
3013
|
-
]),
|
|
3014
|
-
payload:
|
|
3013
|
+
]), xs = i.object({
|
|
3014
|
+
payload: Es,
|
|
3015
3015
|
nonce: B,
|
|
3016
3016
|
formId: B,
|
|
3017
3017
|
elementId: B
|
|
@@ -3057,13 +3057,13 @@ const ks = i.object({
|
|
|
3057
3057
|
return u.data;
|
|
3058
3058
|
{
|
|
3059
3059
|
const d = u.error.format(), f = Ts(d);
|
|
3060
|
-
for (const [v,
|
|
3061
|
-
n(v,
|
|
3060
|
+
for (const [v, E] of Object.entries(f))
|
|
3061
|
+
n(v, E, v);
|
|
3062
3062
|
return null;
|
|
3063
3063
|
}
|
|
3064
3064
|
}, Ss = (t) => {
|
|
3065
3065
|
try {
|
|
3066
|
-
return
|
|
3066
|
+
return xs.parse(t);
|
|
3067
3067
|
} catch (e) {
|
|
3068
3068
|
throw e;
|
|
3069
3069
|
}
|
|
@@ -3075,7 +3075,7 @@ 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.getopenpay.com", Os = {
|
|
3079
3079
|
usd: "usd",
|
|
3080
3080
|
brl: "brl"
|
|
3081
3081
|
}, Mt = async (t) => {
|
|
@@ -3160,7 +3160,7 @@ const ks = i.object({
|
|
|
3160
3160
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3161
3161
|
[r]
|
|
3162
3162
|
), s = {
|
|
3163
|
-
get:
|
|
3163
|
+
get: ve((a) => e[a], [e]),
|
|
3164
3164
|
...n
|
|
3165
3165
|
};
|
|
3166
3166
|
return [e, s];
|
|
@@ -3226,27 +3226,27 @@ ${t.map((r) => `- ${r.path.join("/")}: ${r.message}`).join(`
|
|
|
3226
3226
|
return t + "";
|
|
3227
3227
|
};
|
|
3228
3228
|
function Ws(t, e = 0) {
|
|
3229
|
-
const r = qe(!1), n = qe(), s = qe(t), a =
|
|
3229
|
+
const r = qe(!1), n = qe(), s = qe(t), a = ve(() => r.current, []), o = ve(() => {
|
|
3230
3230
|
r.current = !1, n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
3231
3231
|
r.current = !0, s.current();
|
|
3232
3232
|
}, e);
|
|
3233
|
-
}, [e]), c =
|
|
3233
|
+
}, [e]), c = ve(() => {
|
|
3234
3234
|
r.current = null, n.current && clearTimeout(n.current);
|
|
3235
3235
|
}, []);
|
|
3236
|
-
return
|
|
3236
|
+
return pe(() => {
|
|
3237
3237
|
s.current = t;
|
|
3238
|
-
}, [t]),
|
|
3238
|
+
}, [t]), pe(() => (o(), c), [e]), [a, c, o];
|
|
3239
3239
|
}
|
|
3240
3240
|
function Ks(t, e = 0, r = []) {
|
|
3241
3241
|
const [n, s, a] = Ws(t, e);
|
|
3242
|
-
return
|
|
3242
|
+
return pe(a, r), [n, s];
|
|
3243
3243
|
}
|
|
3244
3244
|
const N = (t) => i.nullable(t.optional());
|
|
3245
3245
|
i.string().trim().min(1, { message: "Cannot be blank" });
|
|
3246
3246
|
const Ys = i.object({
|
|
3247
3247
|
cde_response_type: i.literal("error"),
|
|
3248
3248
|
message: i.string()
|
|
3249
|
-
}), Js = i.enum(["usd", "brl"]),
|
|
3249
|
+
}), Js = i.enum(["usd", "brl"]), Er = i.object({
|
|
3250
3250
|
name: i.string(),
|
|
3251
3251
|
amount_atom_off: N(i.number()),
|
|
3252
3252
|
percent_off: N(i.number()),
|
|
@@ -3278,16 +3278,16 @@ const Ys = i.object({
|
|
|
3278
3278
|
subscription_items: i.array(ta),
|
|
3279
3279
|
trial_start: N(i.string()),
|
|
3280
3280
|
trial_end: N(i.string())
|
|
3281
|
-
}),
|
|
3281
|
+
}), xr = i.object({
|
|
3282
3282
|
amount_atom: i.number()
|
|
3283
3283
|
}), na = i.object({
|
|
3284
3284
|
amount_atom: i.number(),
|
|
3285
3285
|
amount_atom_considering_discount_applied: i.number(),
|
|
3286
3286
|
currency: i.string(),
|
|
3287
|
-
discount_amount_atoms: i.array(
|
|
3287
|
+
discount_amount_atoms: i.array(xr),
|
|
3288
3288
|
subscription_item_id: i.string()
|
|
3289
3289
|
}), sa = i.object({
|
|
3290
|
-
coupon:
|
|
3290
|
+
coupon: Er
|
|
3291
3291
|
}), aa = i.object({
|
|
3292
3292
|
currency: i.string(),
|
|
3293
3293
|
discounts: i.array(sa),
|
|
@@ -3296,14 +3296,14 @@ const Ys = i.object({
|
|
|
3296
3296
|
remaining_amount_atom: i.number(),
|
|
3297
3297
|
tax_amount_atom: i.number(),
|
|
3298
3298
|
total_amount_atom: i.number(),
|
|
3299
|
-
total_discount_amount_atoms: i.array(
|
|
3299
|
+
total_discount_amount_atoms: i.array(xr)
|
|
3300
3300
|
}), Xt = i.object({
|
|
3301
3301
|
created: i.array(ra),
|
|
3302
3302
|
invoices: i.array(aa)
|
|
3303
3303
|
}), kr = i.object({
|
|
3304
3304
|
preview: Xt,
|
|
3305
3305
|
preview_post_trial: N(Xt),
|
|
3306
|
-
coupons: i.array(
|
|
3306
|
+
coupons: i.array(Er)
|
|
3307
3307
|
}), Qt = i.object({
|
|
3308
3308
|
status: i.literal("open"),
|
|
3309
3309
|
token: i.string(),
|
|
@@ -3372,13 +3372,13 @@ const $t = async (t, e, r) => {
|
|
|
3372
3372
|
}
|
|
3373
3373
|
return n;
|
|
3374
3374
|
}, da = (t, e) => e.safeParse(t).success, ua = (t) => Ys.safeParse(t).success, la = async (t, e) => await $t(t, { type: "get_checkout_preview", payload: e }, kr), Lt = async (t) => await $t(t, { type: "get_prefill", payload: {} }, Tr), fa = async (t, e) => await $t(t, { type: "confirm_payment_flow", payload: e }, ks), ma = (t) => t.reduce((e, r) => e + r, 0), pa = (t, e, r, n) => {
|
|
3375
|
-
const [s, a] = S(""), [o, c] = S(""), [u, d] = S(null), [f, v] = S(!1), [
|
|
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)
|
|
3378
3378
|
return;
|
|
3379
3379
|
const T = await ha(n, at.PROMOTION_CODE);
|
|
3380
3380
|
T == null || T.addEventListener("input", () => {
|
|
3381
|
-
v(!0),
|
|
3381
|
+
v(!0), x(null), a(T.value);
|
|
3382
3382
|
});
|
|
3383
3383
|
}, [!!n, t]), Ks(
|
|
3384
3384
|
() => {
|
|
@@ -3392,9 +3392,9 @@ const $t = async (t, e, r) => {
|
|
|
3392
3392
|
if (!e || !r || !t)
|
|
3393
3393
|
return;
|
|
3394
3394
|
const C = (await Lt(e)).mode === "setup", $ = await Cr(e, r, C, o);
|
|
3395
|
-
T() && (
|
|
3395
|
+
T() && (x(null), d($));
|
|
3396
3396
|
} catch (I) {
|
|
3397
|
-
T() &&
|
|
3397
|
+
T() && x(Dt(I));
|
|
3398
3398
|
} finally {
|
|
3399
3399
|
T() && v(!1);
|
|
3400
3400
|
}
|
|
@@ -3403,7 +3403,7 @@ const $t = async (t, e, r) => {
|
|
|
3403
3403
|
), {
|
|
3404
3404
|
amount: u,
|
|
3405
3405
|
isLoading: f,
|
|
3406
|
-
error:
|
|
3406
|
+
error: E
|
|
3407
3407
|
};
|
|
3408
3408
|
}, ha = async (t, e, r) => {
|
|
3409
3409
|
const n = Date.now();
|
|
@@ -3454,40 +3454,43 @@ const $t = async (t, e, r) => {
|
|
|
3454
3454
|
const [u, d] = Ms({
|
|
3455
3455
|
apple_pay: tr,
|
|
3456
3456
|
google_pay: tr
|
|
3457
|
-
}), f = e === void 0 || r === void 0 || !n || !t, v = c.amount, [
|
|
3458
|
-
return
|
|
3459
|
-
if (!Sr() || !v ||
|
|
3457
|
+
}), f = e === void 0 || r === void 0 || !n || !t, v = c.amount, [E, x] = S(null);
|
|
3458
|
+
return pe(() => {
|
|
3459
|
+
if (!Sr() || !v || E === null)
|
|
3460
3460
|
return;
|
|
3461
3461
|
const T = Rr();
|
|
3462
|
-
Or(T, v,
|
|
3463
|
-
}, [v,
|
|
3462
|
+
Or(T, v, E);
|
|
3463
|
+
}, [v, E]), vt(async () => {
|
|
3464
3464
|
if (f)
|
|
3465
3465
|
return;
|
|
3466
|
-
const T = r.
|
|
3467
|
-
(
|
|
3466
|
+
const T = r.filter(
|
|
3467
|
+
(j) => j.processor_name === "stripe" && er.options.map((Y) => String(Y)).includes(j.provider)
|
|
3468
3468
|
);
|
|
3469
|
-
if (
|
|
3469
|
+
if (T.length === 0)
|
|
3470
3470
|
throw new Error("Stripe is not available as a checkout method");
|
|
3471
|
-
const I = As(T.metadata), $ = (await Lt(t)).mode === "setup";
|
|
3472
|
-
|
|
3471
|
+
const I = As(T[0].metadata), $ = (await Lt(t)).mode === "setup";
|
|
3472
|
+
x($);
|
|
3473
3473
|
const V = await Cr(t, e, $, void 0), O = await Ps(
|
|
3474
3474
|
I,
|
|
3475
3475
|
V.amountAtom,
|
|
3476
3476
|
V.currency,
|
|
3477
3477
|
$
|
|
3478
3478
|
);
|
|
3479
|
-
|
|
3479
|
+
Ea(O);
|
|
3480
3480
|
const W = await O.canMakePayment();
|
|
3481
|
-
for (const
|
|
3482
|
-
|
|
3481
|
+
for (const j of er.options) {
|
|
3482
|
+
j.replace("_", "");
|
|
3483
3483
|
try {
|
|
3484
|
-
|
|
3484
|
+
const Y = T.find((J) => J.provider === j);
|
|
3485
|
+
if (!Y)
|
|
3486
|
+
throw new Error(`${j} is not available as a stripe checkout method`);
|
|
3487
|
+
d.set(j, {
|
|
3485
3488
|
isLoading: !1,
|
|
3486
|
-
isAvailable: (W == null ? void 0 : W[ga[
|
|
3487
|
-
startFlow: (
|
|
3489
|
+
isAvailable: (W == null ? void 0 : W[ga[j]]) ?? !1,
|
|
3490
|
+
startFlow: (J) => ba(n, Y, s, a, o, J)
|
|
3488
3491
|
});
|
|
3489
3492
|
} catch {
|
|
3490
|
-
d.set(
|
|
3493
|
+
d.set(j, _a);
|
|
3491
3494
|
}
|
|
3492
3495
|
}
|
|
3493
3496
|
}, [f]), u;
|
|
@@ -3517,7 +3520,7 @@ const $t = async (t, e, r) => {
|
|
|
3517
3520
|
} catch (o) {
|
|
3518
3521
|
window.console.error("[startFlow] Error:", o), s(Dt(o));
|
|
3519
3522
|
}
|
|
3520
|
-
},
|
|
3523
|
+
}, Ea = (t) => {
|
|
3521
3524
|
if ("ojs_pr" in window)
|
|
3522
3525
|
throw new Error("Attempted to set global PR twice");
|
|
3523
3526
|
window.ojs_pr = t;
|
|
@@ -3528,10 +3531,10 @@ const $t = async (t, e, r) => {
|
|
|
3528
3531
|
}, Or = (t, e, r) => {
|
|
3529
3532
|
t.update({ total: { amount: e.amountAtom, label: "Total", pending: r }, currency: e.currency });
|
|
3530
3533
|
};
|
|
3531
|
-
var
|
|
3534
|
+
var ce;
|
|
3532
3535
|
(function(t) {
|
|
3533
3536
|
t.Call = "call", t.Reply = "reply", t.Syn = "syn", t.SynAck = "synAck", t.Ack = "ack";
|
|
3534
|
-
})(
|
|
3537
|
+
})(ce || (ce = {}));
|
|
3535
3538
|
var Re;
|
|
3536
3539
|
(function(t) {
|
|
3537
3540
|
t.Fulfilled = "fulfilled", t.Rejected = "rejected";
|
|
@@ -3544,11 +3547,11 @@ var Nt;
|
|
|
3544
3547
|
(function(t) {
|
|
3545
3548
|
t.DataCloneError = "DataCloneError";
|
|
3546
3549
|
})(Nt || (Nt = {}));
|
|
3547
|
-
var
|
|
3550
|
+
var Te;
|
|
3548
3551
|
(function(t) {
|
|
3549
3552
|
t.Message = "message";
|
|
3550
|
-
})(
|
|
3551
|
-
const
|
|
3553
|
+
})(Te || (Te = {}));
|
|
3554
|
+
const xa = (t, e) => {
|
|
3552
3555
|
const r = [];
|
|
3553
3556
|
let n = !1;
|
|
3554
3557
|
return {
|
|
@@ -3584,21 +3587,21 @@ const Ea = (t, e) => {
|
|
|
3584
3587
|
const { localName: n, local: s, remote: a, originForSending: o, originForReceiving: c } = t;
|
|
3585
3588
|
let u = !1;
|
|
3586
3589
|
const d = (f) => {
|
|
3587
|
-
if (f.source !== a || f.data.penpal !==
|
|
3590
|
+
if (f.source !== a || f.data.penpal !== ce.Call)
|
|
3588
3591
|
return;
|
|
3589
3592
|
if (c !== "*" && f.origin !== c) {
|
|
3590
3593
|
r(`${n} received message from origin ${f.origin} which did not match expected origin ${c}`);
|
|
3591
3594
|
return;
|
|
3592
3595
|
}
|
|
3593
|
-
const v = f.data, { methodName:
|
|
3594
|
-
r(`${n}: Received ${
|
|
3596
|
+
const v = f.data, { methodName: E, args: x, id: T } = v;
|
|
3597
|
+
r(`${n}: Received ${E}() call`);
|
|
3595
3598
|
const I = (C) => ($) => {
|
|
3596
|
-
if (r(`${n}: Sending ${
|
|
3597
|
-
r(`${n}: Unable to send ${
|
|
3599
|
+
if (r(`${n}: Sending ${E}() reply`), u) {
|
|
3600
|
+
r(`${n}: Unable to send ${E}() reply due to destroyed connection`);
|
|
3598
3601
|
return;
|
|
3599
3602
|
}
|
|
3600
3603
|
const V = {
|
|
3601
|
-
penpal:
|
|
3604
|
+
penpal: ce.Reply,
|
|
3602
3605
|
id: T,
|
|
3603
3606
|
resolution: C,
|
|
3604
3607
|
returnValue: $
|
|
@@ -3609,7 +3612,7 @@ const Ea = (t, e) => {
|
|
|
3609
3612
|
} catch (O) {
|
|
3610
3613
|
if (O.name === Nt.DataCloneError) {
|
|
3611
3614
|
const W = {
|
|
3612
|
-
penpal:
|
|
3615
|
+
penpal: ce.Reply,
|
|
3613
3616
|
id: T,
|
|
3614
3617
|
resolution: Re.Rejected,
|
|
3615
3618
|
returnValue: rr(O),
|
|
@@ -3620,10 +3623,10 @@ const Ea = (t, e) => {
|
|
|
3620
3623
|
throw O;
|
|
3621
3624
|
}
|
|
3622
3625
|
};
|
|
3623
|
-
new Promise((C) => C(e[
|
|
3626
|
+
new Promise((C) => C(e[E].apply(e, x))).then(I(Re.Fulfilled), I(Re.Rejected));
|
|
3624
3627
|
};
|
|
3625
|
-
return s.addEventListener(
|
|
3626
|
-
u = !0, s.removeEventListener(
|
|
3628
|
+
return s.addEventListener(Te.Message, d), () => {
|
|
3629
|
+
u = !0, s.removeEventListener(Te.Message, d);
|
|
3627
3630
|
};
|
|
3628
3631
|
};
|
|
3629
3632
|
let Ia = 0;
|
|
@@ -3648,8 +3651,8 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3648
3651
|
const { localName: a, local: o, remote: c, originForSending: u, originForReceiving: d } = e;
|
|
3649
3652
|
let f = !1;
|
|
3650
3653
|
s(`${a}: Connecting call sender`);
|
|
3651
|
-
const v = (
|
|
3652
|
-
s(`${a}: Sending ${
|
|
3654
|
+
const v = (x) => (...T) => {
|
|
3655
|
+
s(`${a}: Sending ${x}() call`);
|
|
3653
3656
|
let I;
|
|
3654
3657
|
try {
|
|
3655
3658
|
c.closed && (I = !0);
|
|
@@ -3657,33 +3660,33 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3657
3660
|
I = !0;
|
|
3658
3661
|
}
|
|
3659
3662
|
if (I && n(), f) {
|
|
3660
|
-
const C = new Error(`Unable to send ${
|
|
3663
|
+
const C = new Error(`Unable to send ${x}() call due to destroyed connection`);
|
|
3661
3664
|
throw C.code = it.ConnectionDestroyed, C;
|
|
3662
3665
|
}
|
|
3663
3666
|
return new Promise((C, $) => {
|
|
3664
|
-
const V = Aa(), O = (
|
|
3665
|
-
if (
|
|
3667
|
+
const V = Aa(), O = (j) => {
|
|
3668
|
+
if (j.source !== c || j.data.penpal !== ce.Reply || j.data.id !== V)
|
|
3666
3669
|
return;
|
|
3667
|
-
if (d !== "*" &&
|
|
3668
|
-
s(`${a} received message from origin ${
|
|
3670
|
+
if (d !== "*" && j.origin !== d) {
|
|
3671
|
+
s(`${a} received message from origin ${j.origin} which did not match expected origin ${d}`);
|
|
3669
3672
|
return;
|
|
3670
3673
|
}
|
|
3671
|
-
const
|
|
3672
|
-
s(`${a}: Received ${
|
|
3673
|
-
let
|
|
3674
|
-
|
|
3674
|
+
const Y = j.data;
|
|
3675
|
+
s(`${a}: Received ${x}() reply`), o.removeEventListener(Te.Message, O);
|
|
3676
|
+
let J = Y.returnValue;
|
|
3677
|
+
Y.returnValueIsError && (J = Oa(J)), (Y.resolution === Re.Fulfilled ? C : $)(J);
|
|
3675
3678
|
};
|
|
3676
|
-
o.addEventListener(
|
|
3679
|
+
o.addEventListener(Te.Message, O);
|
|
3677
3680
|
const W = {
|
|
3678
|
-
penpal:
|
|
3681
|
+
penpal: ce.Call,
|
|
3679
3682
|
id: V,
|
|
3680
|
-
methodName:
|
|
3683
|
+
methodName: x,
|
|
3681
3684
|
args: T
|
|
3682
3685
|
};
|
|
3683
3686
|
c.postMessage(W, u);
|
|
3684
3687
|
});
|
|
3685
|
-
},
|
|
3686
|
-
return Object.assign(t, Za(
|
|
3688
|
+
}, E = r.reduce((x, T) => (x[T] = v(T), x), {});
|
|
3689
|
+
return Object.assign(t, Za(E)), () => {
|
|
3687
3690
|
f = !0;
|
|
3688
3691
|
};
|
|
3689
3692
|
}, $a = (t, e, r, n, s) => {
|
|
@@ -3703,11 +3706,11 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3703
3706
|
originForSending: r,
|
|
3704
3707
|
originForReceiving: e
|
|
3705
3708
|
};
|
|
3706
|
-
c && c(), c = Pa(v, t, s), o(c), u && u.forEach((
|
|
3707
|
-
delete d[
|
|
3709
|
+
c && c(), c = Pa(v, t, s), o(c), u && u.forEach((x) => {
|
|
3710
|
+
delete d[x];
|
|
3708
3711
|
}), u = f.data.methodNames;
|
|
3709
|
-
const
|
|
3710
|
-
return o(
|
|
3712
|
+
const E = Da(d, v, u, a, s);
|
|
3713
|
+
return o(E), d;
|
|
3711
3714
|
};
|
|
3712
3715
|
}, La = (t, e, r, n) => (s) => {
|
|
3713
3716
|
if (!s.source)
|
|
@@ -3718,7 +3721,7 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3718
3721
|
}
|
|
3719
3722
|
t("Parent: Handshake - Received SYN, responding with SYN-ACK");
|
|
3720
3723
|
const a = {
|
|
3721
|
-
penpal:
|
|
3724
|
+
penpal: ce.SynAck,
|
|
3722
3725
|
methodNames: Object.keys(e)
|
|
3723
3726
|
};
|
|
3724
3727
|
s.source.postMessage(a, n);
|
|
@@ -3744,26 +3747,26 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3744
3747
|
}
|
|
3745
3748
|
}, qa = (t) => {
|
|
3746
3749
|
let { iframe: e, methods: r = {}, childOrigin: n, timeout: s, debug: a = !1 } = t;
|
|
3747
|
-
const o = ka(a), c =
|
|
3750
|
+
const o = ka(a), c = xa("Parent", o), { onDestroy: u, destroy: d } = c;
|
|
3748
3751
|
n || (za(e), n = Ra(e.src));
|
|
3749
|
-
const f = n === "null" ? "*" : n, v = Ar(r),
|
|
3752
|
+
const f = n === "null" ? "*" : n, v = Ar(r), E = La(o, v, n, f), x = $a(v, n, f, c, o);
|
|
3750
3753
|
return {
|
|
3751
3754
|
promise: new Promise((I, C) => {
|
|
3752
3755
|
const $ = Fa(s, d), V = (O) => {
|
|
3753
3756
|
if (!(O.source !== e.contentWindow || !O.data)) {
|
|
3754
|
-
if (O.data.penpal ===
|
|
3755
|
-
|
|
3757
|
+
if (O.data.penpal === ce.Syn) {
|
|
3758
|
+
E(O);
|
|
3756
3759
|
return;
|
|
3757
3760
|
}
|
|
3758
|
-
if (O.data.penpal ===
|
|
3759
|
-
const W =
|
|
3761
|
+
if (O.data.penpal === ce.Ack) {
|
|
3762
|
+
const W = x(O);
|
|
3760
3763
|
W && ($(), I(W));
|
|
3761
3764
|
return;
|
|
3762
3765
|
}
|
|
3763
3766
|
}
|
|
3764
3767
|
};
|
|
3765
|
-
window.addEventListener(
|
|
3766
|
-
window.removeEventListener(
|
|
3768
|
+
window.addEventListener(Te.Message, V), o("Parent: Awaiting handshake"), Va(e, c), u((O) => {
|
|
3769
|
+
window.removeEventListener(Te.Message, V), O && C(O);
|
|
3767
3770
|
});
|
|
3768
3771
|
}),
|
|
3769
3772
|
destroy() {
|
|
@@ -3821,34 +3824,34 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3821
3824
|
onValidationError: d,
|
|
3822
3825
|
onCheckoutStarted: f,
|
|
3823
3826
|
onCheckoutSuccess: v,
|
|
3824
|
-
onCheckoutError:
|
|
3825
|
-
onSetupPaymentMethodSuccess:
|
|
3827
|
+
onCheckoutError: E,
|
|
3828
|
+
onSetupPaymentMethodSuccess: x,
|
|
3826
3829
|
baseUrl: T,
|
|
3827
3830
|
enableDynamicPreviews: I
|
|
3828
|
-
} = t, C = T ?? Rs, [$, V] = S(void 0), [O, W] = S([]), [
|
|
3829
|
-
|
|
3830
|
-
const P = { version: "0.0.
|
|
3831
|
+
} = t, C = T ?? Rs, [$, V] = S(void 0), [O, W] = S([]), [j, Y] = S("1px"), [J, Nr] = S(!1), [ne, Le] = S(void 0), [Ut, Ce] = S(!1), [ye, jr] = S([]), [ge, Mr] = S({}), [Vt, ct] = S(0), [Ft, se] = S(!1), [ae, Zr] = S(void 0), [zt, Dr] = S(void 0), [qt, $r] = S(void 0), [le, Lr] = S(void 0), [Et, Ur] = S(void 0), fe = ze(() => `opjs-form-${sr()}`, []), G = qe(null);
|
|
3832
|
+
pe(() => {
|
|
3833
|
+
const P = { version: "0.0.21", release_version: "local_build" };
|
|
3831
3834
|
window.ojs_version = P;
|
|
3832
3835
|
}, []);
|
|
3833
3836
|
const { cdeConn: Ae, connectToCdeIframe: Bt } = Ba(), Ht = pa(
|
|
3834
3837
|
I ?? !1,
|
|
3835
3838
|
Ae,
|
|
3836
3839
|
r,
|
|
3837
|
-
|
|
3838
|
-
),
|
|
3840
|
+
G.current
|
|
3841
|
+
), xt = ve(
|
|
3839
3842
|
(P) => {
|
|
3840
3843
|
if (P.origin !== C || !P.source) return;
|
|
3841
3844
|
const K = P.source;
|
|
3842
3845
|
if (!Ka(P.data))
|
|
3843
3846
|
return;
|
|
3844
|
-
const
|
|
3845
|
-
if (F.formId !==
|
|
3847
|
+
const X = JSON.parse(P.data), F = Ss(X), Se = F.elementId;
|
|
3848
|
+
if (F.formId !== fe || !Se || F.nonce in O)
|
|
3846
3849
|
return;
|
|
3847
3850
|
W((L) => [...L, F.nonce]);
|
|
3848
3851
|
const A = F.payload, z = A.type;
|
|
3849
3852
|
if (z === k.enum.LAYOUT) {
|
|
3850
3853
|
const L = A.height ? `${A.height}px` : "100%";
|
|
3851
|
-
|
|
3854
|
+
Y(L);
|
|
3852
3855
|
} else if (z === k.enum.FOCUS && s)
|
|
3853
3856
|
s(F.elementId);
|
|
3854
3857
|
else if (z === k.enum.BLUR && a)
|
|
@@ -3856,103 +3859,103 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3856
3859
|
else if (z === k.enum.CHANGE && o)
|
|
3857
3860
|
o(F.elementId);
|
|
3858
3861
|
else if (z === k.enum.LOADED) {
|
|
3859
|
-
const L =
|
|
3862
|
+
const L = ye.find((M) => M.contentWindow === K);
|
|
3860
3863
|
if (Ce(!1), !L)
|
|
3861
3864
|
return;
|
|
3862
|
-
Mr((
|
|
3865
|
+
Mr((M) => ({ ...M, [Se]: K })), $r(A.totalAmountAtoms), Dr(A.currency), Lr(A.checkoutPaymentMethods), ae || Zr(A.sessionId);
|
|
3863
3866
|
} else if (z === k.enum.TOKENIZE_STARTED)
|
|
3864
3867
|
Ce(!0), f && f();
|
|
3865
3868
|
else if (z === k.enum.PAYMENT_FLOW_STARTED) {
|
|
3866
|
-
if (!
|
|
3869
|
+
if (!ne)
|
|
3867
3870
|
throw new Error("extraData not populated");
|
|
3868
3871
|
if (!Ae)
|
|
3869
3872
|
throw new Error("Not connected to CDE");
|
|
3870
3873
|
(async () => {
|
|
3871
|
-
const
|
|
3872
|
-
if (
|
|
3874
|
+
const M = A.nextActionMetadata.type;
|
|
3875
|
+
if (M !== void 0) if (M === "stripe_3ds")
|
|
3873
3876
|
await js(A);
|
|
3874
|
-
else if (
|
|
3875
|
-
if (!
|
|
3877
|
+
else if (M === "stripe_payment_request") {
|
|
3878
|
+
if (!Et)
|
|
3876
3879
|
throw new Error("Stripe PM not set");
|
|
3877
|
-
await Ns(A,
|
|
3880
|
+
await Ns(A, Et);
|
|
3878
3881
|
} else
|
|
3879
|
-
throw new Error(`Unknown next action type: ${
|
|
3880
|
-
const
|
|
3881
|
-
if (
|
|
3882
|
-
const { payment_methods:
|
|
3883
|
-
secure_token:
|
|
3884
|
-
existing_cc_pm_id:
|
|
3882
|
+
throw new Error(`Unknown next action type: ${M}`);
|
|
3883
|
+
const Q = await Lt(Ae);
|
|
3884
|
+
if (Q.mode === "setup") {
|
|
3885
|
+
const { payment_methods: ie } = await fa(Ae, {
|
|
3886
|
+
secure_token: Q.token,
|
|
3887
|
+
existing_cc_pm_id: ne.existingCCPMId
|
|
3885
3888
|
});
|
|
3886
|
-
if (
|
|
3887
|
-
throw new Error(`Expected exactly one payment method, got ${
|
|
3888
|
-
return Ce(!1), ct(0),
|
|
3889
|
+
if (ie.length !== 1)
|
|
3890
|
+
throw new Error(`Expected exactly one payment method, got ${ie.length}`);
|
|
3891
|
+
return Ce(!1), ct(0), se(!1), x && x(ie[0].id), {
|
|
3889
3892
|
proceedToCheckout: !1
|
|
3890
3893
|
};
|
|
3891
3894
|
} else
|
|
3892
3895
|
return {
|
|
3893
3896
|
proceedToCheckout: !0
|
|
3894
3897
|
};
|
|
3895
|
-
})().then(({ proceedToCheckout:
|
|
3896
|
-
var
|
|
3897
|
-
if (!
|
|
3898
|
+
})().then(({ proceedToCheckout: M }) => {
|
|
3899
|
+
var ie;
|
|
3900
|
+
if (!M)
|
|
3898
3901
|
return;
|
|
3899
|
-
let
|
|
3900
|
-
if (
|
|
3902
|
+
let Q;
|
|
3903
|
+
if (ne.checkoutPaymentMethod.provider === "credit_card" && (Q = (ie = A.startPFMetadata) == null ? void 0 : ie.cc_pm_id, !Q))
|
|
3901
3904
|
throw new Error("CC PM ID not found");
|
|
3902
3905
|
Ue(
|
|
3903
3906
|
K,
|
|
3904
|
-
|
|
3907
|
+
fe,
|
|
3905
3908
|
Se,
|
|
3906
|
-
{ ...
|
|
3909
|
+
{ ...ne, type: "CHECKOUT", doNotUseLegacyCCFlow: !0, existingCCPMId: Q },
|
|
3907
3910
|
C
|
|
3908
|
-
),
|
|
3909
|
-
}).catch((
|
|
3910
|
-
const
|
|
3911
|
-
Ce(!1),
|
|
3911
|
+
), se(!0), Le(void 0), f && f();
|
|
3912
|
+
}).catch((M) => {
|
|
3913
|
+
const Q = Dt(M);
|
|
3914
|
+
Ce(!1), se(!1), E && E(Q);
|
|
3912
3915
|
});
|
|
3913
|
-
} else if (z === k.enum.TOKENIZE_SUCCESS &&
|
|
3914
|
-
const L = Vt + 1,
|
|
3915
|
-
!Ft && (
|
|
3916
|
+
} else if (z === k.enum.TOKENIZE_SUCCESS && ne) {
|
|
3917
|
+
const L = Vt + 1, M = L === Object.keys(ge).length;
|
|
3918
|
+
!Ft && (M || A.isReadyForCheckout) ? (Ue(K, fe, Se, ne, C), se(!0), Le(void 0)) : ct(L);
|
|
3916
3919
|
} else if (z === k.enum.CHECKOUT_SUCCESS)
|
|
3917
|
-
Ce(!1), ct(0),
|
|
3920
|
+
Ce(!1), ct(0), se(!1), v && v(A.invoiceUrls, A.subscriptionIds, A.customerId);
|
|
3918
3921
|
else if (z === k.enum.SETUP_PAYMENT_METHOD_SUCCESS)
|
|
3919
|
-
Ce(!1), ct(0),
|
|
3922
|
+
Ce(!1), ct(0), se(!1), x && x(A.paymentMethodId);
|
|
3920
3923
|
else if (z === k.enum.LOAD_ERROR)
|
|
3921
3924
|
u && u(A.message);
|
|
3922
3925
|
else if (z === k.enum.VALIDATION_ERROR) {
|
|
3923
|
-
const L =
|
|
3926
|
+
const L = ne == null ? void 0 : ne.checkoutPaymentMethod.provider;
|
|
3924
3927
|
(L === "credit_card" || L === void 0) && d && d(A.elementType, A.errors, Se);
|
|
3925
3928
|
} else if (z === k.enum.TOKENIZE_ERROR || z === k.enum.CHECKOUT_ERROR)
|
|
3926
3929
|
if (A.message === "3DS_REQUIRED") {
|
|
3927
|
-
const L =
|
|
3928
|
-
if (!
|
|
3929
|
-
for (const [
|
|
3930
|
-
if (!
|
|
3931
|
-
const
|
|
3930
|
+
const L = le == null ? void 0 : le.find((M) => M.provider === "credit_card");
|
|
3931
|
+
if (!ae || !G.current || !d || !L) return;
|
|
3932
|
+
for (const [M, Q] of Object.entries(ge)) {
|
|
3933
|
+
if (!Q) continue;
|
|
3934
|
+
const ie = lt(
|
|
3932
3935
|
k.enum.START_PAYMENT_FLOW,
|
|
3933
|
-
|
|
3934
|
-
|
|
3936
|
+
ae,
|
|
3937
|
+
G.current,
|
|
3935
3938
|
d,
|
|
3936
3939
|
// Only stripe supports frontend 3DS right now,
|
|
3937
3940
|
// so we pass processor_name: 'stripe' to tell delegator to only use stripe
|
|
3938
3941
|
{ ...L, processor_name: "stripe" },
|
|
3939
3942
|
!1
|
|
3940
3943
|
);
|
|
3941
|
-
if (
|
|
3942
|
-
|
|
3944
|
+
if (ie) {
|
|
3945
|
+
se(!0), Le(ie), Ue(Q, fe, M, ie, C);
|
|
3943
3946
|
break;
|
|
3944
3947
|
}
|
|
3945
3948
|
}
|
|
3946
3949
|
} else
|
|
3947
|
-
Ce(!1),
|
|
3950
|
+
Ce(!1), se(!1), E && E(A.message);
|
|
3948
3951
|
},
|
|
3949
3952
|
[
|
|
3950
|
-
|
|
3951
|
-
|
|
3953
|
+
fe,
|
|
3954
|
+
ae,
|
|
3952
3955
|
O,
|
|
3953
|
-
|
|
3954
|
-
he,
|
|
3956
|
+
ne,
|
|
3955
3957
|
ye,
|
|
3958
|
+
ge,
|
|
3956
3959
|
Vt,
|
|
3957
3960
|
Ft,
|
|
3958
3961
|
a,
|
|
@@ -3961,74 +3964,74 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3961
3964
|
u,
|
|
3962
3965
|
f,
|
|
3963
3966
|
v,
|
|
3964
|
-
E,
|
|
3965
3967
|
x,
|
|
3968
|
+
E,
|
|
3966
3969
|
d,
|
|
3967
3970
|
C,
|
|
3968
|
-
|
|
3969
|
-
|
|
3971
|
+
Et,
|
|
3972
|
+
le,
|
|
3970
3973
|
Ae
|
|
3971
3974
|
]
|
|
3972
|
-
), Vr =
|
|
3973
|
-
if (!
|
|
3974
|
-
const P =
|
|
3975
|
+
), Vr = ve(() => {
|
|
3976
|
+
if (!G.current || !d || !ae || !le) return;
|
|
3977
|
+
const P = le.find((X) => X.provider === "credit_card");
|
|
3975
3978
|
if (!P)
|
|
3976
3979
|
throw new Error("Card not available as a payment method in checkout");
|
|
3977
3980
|
const K = lt(
|
|
3978
3981
|
k.enum.TOKENIZE,
|
|
3979
|
-
|
|
3980
|
-
|
|
3982
|
+
ae,
|
|
3983
|
+
G.current,
|
|
3981
3984
|
d,
|
|
3982
3985
|
P,
|
|
3983
3986
|
!1
|
|
3984
3987
|
);
|
|
3985
3988
|
if (K) {
|
|
3986
|
-
for (const [
|
|
3987
|
-
F && Ue(F,
|
|
3989
|
+
for (const [X, F] of Object.entries(ge))
|
|
3990
|
+
F && Ue(F, fe, X, K, C);
|
|
3988
3991
|
K.type = k.enum.CHECKOUT, Le(K);
|
|
3989
3992
|
}
|
|
3990
|
-
}, [
|
|
3993
|
+
}, [G, ge, fe, d, ae, C, le]), kt = ve(
|
|
3991
3994
|
(P) => {
|
|
3992
3995
|
Ut && P.preventDefault();
|
|
3993
3996
|
},
|
|
3994
3997
|
[Ut]
|
|
3995
3998
|
);
|
|
3996
|
-
|
|
3997
|
-
if (
|
|
3998
|
-
|
|
3999
|
-
}, [
|
|
4000
|
-
window.removeEventListener("beforeunload", kt), window.removeEventListener("message",
|
|
4001
|
-
}), [
|
|
4002
|
-
const Fr =
|
|
3999
|
+
pe(() => {
|
|
4000
|
+
if (J || !G.current) return;
|
|
4001
|
+
ye.length > 0 && ye.length === Object.keys(ge).length && (Nr(!0), c && c(qt, zt));
|
|
4002
|
+
}, [ye, ge, J, c, qt, zt]), pe(() => (V(window.location.origin), window.addEventListener("message", xt), window.addEventListener("beforeunload", kt), () => {
|
|
4003
|
+
window.removeEventListener("beforeunload", kt), window.removeEventListener("message", xt);
|
|
4004
|
+
}), [ae, xt, kt]);
|
|
4005
|
+
const Fr = ve(
|
|
4003
4006
|
(P) => {
|
|
4004
|
-
|
|
4007
|
+
ye.find((X) => X.contentWindow === P.contentWindow) || (ye.length === 0 && Bt(P), jr((X) => [...X, P]));
|
|
4005
4008
|
},
|
|
4006
|
-
[
|
|
4009
|
+
[ye, Bt]
|
|
4007
4010
|
), zr = async (P, K) => {
|
|
4008
|
-
if (!(!
|
|
4009
|
-
for (const [
|
|
4011
|
+
if (!(!G.current || !d || !ae || !le))
|
|
4012
|
+
for (const [X, F] of Object.entries(ge)) {
|
|
4010
4013
|
if (!F) continue;
|
|
4011
4014
|
const Se = {
|
|
4012
4015
|
stripePmId: P.paymentMethod.id
|
|
4013
4016
|
}, dt = lt(
|
|
4014
4017
|
k.enum.START_PAYMENT_FLOW,
|
|
4015
|
-
|
|
4016
|
-
|
|
4018
|
+
ae,
|
|
4019
|
+
G.current,
|
|
4017
4020
|
d,
|
|
4018
4021
|
K,
|
|
4019
4022
|
!1,
|
|
4020
4023
|
Se
|
|
4021
4024
|
);
|
|
4022
4025
|
if (dt) {
|
|
4023
|
-
Ur(P),
|
|
4026
|
+
Ur(P), se(!0), Le(dt), Ue(F, fe, X, dt, C);
|
|
4024
4027
|
break;
|
|
4025
4028
|
}
|
|
4026
4029
|
}
|
|
4027
4030
|
}, qr = (P) => {
|
|
4028
|
-
|
|
4031
|
+
se(!1), E && E(P);
|
|
4029
4032
|
}, Br = {
|
|
4030
|
-
formId:
|
|
4031
|
-
formHeight:
|
|
4033
|
+
formId: fe,
|
|
4034
|
+
formHeight: j,
|
|
4032
4035
|
referer: $,
|
|
4033
4036
|
checkoutSecureToken: r,
|
|
4034
4037
|
registerIframe: Fr,
|
|
@@ -4036,8 +4039,8 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
4036
4039
|
}, Wt = va(
|
|
4037
4040
|
Ae,
|
|
4038
4041
|
r,
|
|
4039
|
-
|
|
4040
|
-
|
|
4042
|
+
le,
|
|
4043
|
+
G.current,
|
|
4041
4044
|
zr,
|
|
4042
4045
|
d,
|
|
4043
4046
|
qr,
|
|
@@ -4046,34 +4049,34 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
4046
4049
|
submit: Vr,
|
|
4047
4050
|
applePay: Wt.apple_pay,
|
|
4048
4051
|
googlePay: Wt.google_pay,
|
|
4049
|
-
loaded:
|
|
4052
|
+
loaded: J,
|
|
4050
4053
|
preview: Ht
|
|
4051
4054
|
};
|
|
4052
|
-
return /* @__PURE__ */
|
|
4055
|
+
return /* @__PURE__ */ we(nr.Provider, { value: Br, children: /* @__PURE__ */ we("div", { className: n, ref: G, children: e(Hr) }) });
|
|
4053
4056
|
}, Ya = (t) => JSON.stringify(t), bt = (t) => {
|
|
4054
|
-
const { subPath: e, styles: r } = t, { formId: n, referer: s, formHeight: a, checkoutSecureToken: o, registerIframe: c, baseUrl: u } = Jr(), [d, f] = S(!1), v = qe(null),
|
|
4057
|
+
const { subPath: e, styles: r } = t, { formId: n, referer: s, formHeight: a, checkoutSecureToken: o, registerIframe: c, baseUrl: u } = Jr(), [d, f] = S(!1), v = qe(null), E = ze(() => r ? Ya(r) : "", [r]), x = ze(() => ({
|
|
4055
4058
|
border: "none",
|
|
4056
4059
|
width: "100%",
|
|
4057
4060
|
height: a
|
|
4058
4061
|
}), [a]), T = ze(() => {
|
|
4059
4062
|
if (!o || !s) return "";
|
|
4060
4063
|
const I = new URLSearchParams();
|
|
4061
|
-
return I.append("referer", s), I.append("styles",
|
|
4062
|
-
}, [
|
|
4063
|
-
return
|
|
4064
|
+
return I.append("referer", s), I.append("styles", E), I.append("formId", n), I.append("secureToken", o), I.toString();
|
|
4065
|
+
}, [E, n, s, o]);
|
|
4066
|
+
return pe(() => f(!0), []), pe(() => {
|
|
4064
4067
|
!v.current || !d || c(v.current);
|
|
4065
|
-
}, [d]), o ? /* @__PURE__ */
|
|
4068
|
+
}, [d]), o ? /* @__PURE__ */ we(
|
|
4066
4069
|
"iframe",
|
|
4067
4070
|
{
|
|
4068
4071
|
id: `ojs-${e}-element`,
|
|
4069
4072
|
name: `${e}-element`,
|
|
4070
4073
|
className: "ojs-iframe",
|
|
4071
4074
|
src: `${u}/app/v1/${e}-element/?${T}`,
|
|
4072
|
-
style:
|
|
4075
|
+
style: x,
|
|
4073
4076
|
ref: v
|
|
4074
4077
|
}
|
|
4075
|
-
) : /* @__PURE__ */
|
|
4076
|
-
}, Qa = ({ styles: t }) => /* @__PURE__ */
|
|
4078
|
+
) : /* @__PURE__ */ we("div", {});
|
|
4079
|
+
}, Qa = ({ styles: t }) => /* @__PURE__ */ we(bt, { styles: t, subPath: "card-cvc" }), ei = ({ styles: t }) => /* @__PURE__ */ we(bt, { styles: t, subPath: "card" }), ti = ({ styles: t }) => /* @__PURE__ */ we(bt, { styles: t, subPath: "card-expiry" }), ri = ({ styles: t }) => /* @__PURE__ */ we(bt, { styles: t, subPath: "card-number" });
|
|
4077
4080
|
export {
|
|
4078
4081
|
Qa as CardCvcElement,
|
|
4079
4082
|
ei as CardElement,
|