@getopenpay/openpay-js-react 0.0.23 → 0.0.24
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 +3 -1
- package/dist/index.js +653 -629
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Kr, { createContext as Yr, useContext as Jr, useState as O, useMemo as ze, useCallback as ve, useRef as qe, useEffect as pe } from "react";
|
|
2
2
|
import { jsx as we } from "react/jsx-runtime";
|
|
3
|
-
const
|
|
3
|
+
const ir = Yr({
|
|
4
4
|
formId: "",
|
|
5
5
|
formHeight: "",
|
|
6
6
|
referer: void 0,
|
|
@@ -8,34 +8,34 @@ const nr = Kr({
|
|
|
8
8
|
registerIframe: () => {
|
|
9
9
|
},
|
|
10
10
|
baseUrl: ""
|
|
11
|
-
}),
|
|
12
|
-
const t =
|
|
11
|
+
}), Gr = () => {
|
|
12
|
+
const t = Jr(ir);
|
|
13
13
|
if (!t)
|
|
14
14
|
throw new Error("useOpenPayElements must be used within an OpenPayElementsProvider");
|
|
15
15
|
return t;
|
|
16
16
|
};
|
|
17
|
-
var
|
|
18
|
-
for (var
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
return (
|
|
17
|
+
var M = [];
|
|
18
|
+
for (var St = 0; St < 256; ++St)
|
|
19
|
+
M.push((St + 256).toString(16).slice(1));
|
|
20
|
+
function Xr(t, e = 0) {
|
|
21
|
+
return (M[t[e + 0]] + M[t[e + 1]] + M[t[e + 2]] + M[t[e + 3]] + "-" + M[t[e + 4]] + M[t[e + 5]] + "-" + M[t[e + 6]] + M[t[e + 7]] + "-" + M[t[e + 8]] + M[t[e + 9]] + "-" + M[t[e + 10]] + M[t[e + 11]] + M[t[e + 12]] + M[t[e + 13]] + M[t[e + 14]] + M[t[e + 15]]).toLowerCase();
|
|
22
22
|
}
|
|
23
|
-
var ut,
|
|
24
|
-
function
|
|
23
|
+
var ut, Qr = new Uint8Array(16);
|
|
24
|
+
function en() {
|
|
25
25
|
if (!ut && (ut = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ut))
|
|
26
26
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
27
|
-
return ut(
|
|
27
|
+
return ut(Qr);
|
|
28
28
|
}
|
|
29
|
-
var
|
|
30
|
-
const
|
|
31
|
-
randomUUID:
|
|
29
|
+
var tn = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
30
|
+
const Gt = {
|
|
31
|
+
randomUUID: tn
|
|
32
32
|
};
|
|
33
|
-
function
|
|
34
|
-
if (
|
|
35
|
-
return
|
|
33
|
+
function or(t, e, r) {
|
|
34
|
+
if (Gt.randomUUID && !e && !t)
|
|
35
|
+
return Gt.randomUUID();
|
|
36
36
|
t = t || {};
|
|
37
|
-
var n = t.random || (t.rng ||
|
|
38
|
-
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128,
|
|
37
|
+
var n = t.random || (t.rng || en)();
|
|
38
|
+
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Xr(n);
|
|
39
39
|
}
|
|
40
40
|
var b;
|
|
41
41
|
(function(t) {
|
|
@@ -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 Pt;
|
|
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
|
+
})(Pt || (Pt = {}));
|
|
84
84
|
const p = b.arrayToEnum([
|
|
85
85
|
"string",
|
|
86
86
|
"nan",
|
|
@@ -140,8 +140,8 @@ const p = b.arrayToEnum([
|
|
|
140
140
|
"invalid_intersection_types",
|
|
141
141
|
"not_multiple_of",
|
|
142
142
|
"not_finite"
|
|
143
|
-
]),
|
|
144
|
-
class
|
|
143
|
+
]), rn = (t) => JSON.stringify(t, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
144
|
+
class Y extends Error {
|
|
145
145
|
constructor(e) {
|
|
146
146
|
super(), this.issues = [], this.addIssue = (n) => {
|
|
147
147
|
this.issues = [...this.issues, n];
|
|
@@ -178,7 +178,7 @@ class H extends Error {
|
|
|
178
178
|
return s(this), n;
|
|
179
179
|
}
|
|
180
180
|
static assert(e) {
|
|
181
|
-
if (!(e instanceof
|
|
181
|
+
if (!(e instanceof Y))
|
|
182
182
|
throw new Error(`Not a ZodError: ${e}`);
|
|
183
183
|
}
|
|
184
184
|
toString() {
|
|
@@ -200,7 +200,7 @@ class H extends Error {
|
|
|
200
200
|
return this.flatten();
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
|
|
203
|
+
Y.create = (t) => new Y(t);
|
|
204
204
|
const Ze = (t, e) => {
|
|
205
205
|
let r;
|
|
206
206
|
switch (t.code) {
|
|
@@ -257,12 +257,12 @@ const Ze = (t, e) => {
|
|
|
257
257
|
}
|
|
258
258
|
return { message: r };
|
|
259
259
|
};
|
|
260
|
-
let
|
|
261
|
-
function
|
|
262
|
-
|
|
260
|
+
let cr = Ze;
|
|
261
|
+
function nn(t) {
|
|
262
|
+
cr = t;
|
|
263
263
|
}
|
|
264
264
|
function ft() {
|
|
265
|
-
return
|
|
265
|
+
return cr;
|
|
266
266
|
}
|
|
267
267
|
const mt = (t) => {
|
|
268
268
|
const { data: e, path: r, errorMaps: n, issueData: s } = t, a = [...r, ...s.path || []], o = {
|
|
@@ -284,7 +284,7 @@ const mt = (t) => {
|
|
|
284
284
|
path: a,
|
|
285
285
|
message: c
|
|
286
286
|
};
|
|
287
|
-
},
|
|
287
|
+
}, sn = [];
|
|
288
288
|
function m(t, e) {
|
|
289
289
|
const r = ft(), n = mt({
|
|
290
290
|
issueData: e,
|
|
@@ -300,7 +300,7 @@ function m(t, e) {
|
|
|
300
300
|
});
|
|
301
301
|
t.common.issues.push(n);
|
|
302
302
|
}
|
|
303
|
-
class
|
|
303
|
+
class $ {
|
|
304
304
|
constructor() {
|
|
305
305
|
this.value = "valid";
|
|
306
306
|
}
|
|
@@ -328,7 +328,7 @@ class D {
|
|
|
328
328
|
value: o
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
return
|
|
331
|
+
return $.mergeObjectSync(e, n);
|
|
332
332
|
}
|
|
333
333
|
static mergeObjectSync(e, r) {
|
|
334
334
|
const n = {};
|
|
@@ -343,12 +343,12 @@ 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 }), F = (t) => ({ status: "valid", value: t }), It = (t) => t.status === "aborted", At = (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);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function dr(t, e, r, n, s) {
|
|
352
352
|
if (typeof e == "function" ? t !== e || !s : !e.has(t)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
353
353
|
return e.set(t, r), r;
|
|
354
354
|
}
|
|
@@ -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 Xt = (t, e) => {
|
|
369
369
|
if (Be(e))
|
|
370
370
|
return { success: !0, data: e.value };
|
|
371
371
|
if (!t.common.issues.length)
|
|
@@ -375,12 +375,12 @@ const Jt = (t, e) => {
|
|
|
375
375
|
get error() {
|
|
376
376
|
if (this._error)
|
|
377
377
|
return this._error;
|
|
378
|
-
const r = new
|
|
378
|
+
const r = new Y(t.common.issues);
|
|
379
379
|
return this._error = r, this._error;
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
382
|
};
|
|
383
|
-
function
|
|
383
|
+
function v(t) {
|
|
384
384
|
if (!t)
|
|
385
385
|
return {};
|
|
386
386
|
const { errorMap: e, invalid_type_error: r, required_error: n, description: s } = t;
|
|
@@ -414,7 +414,7 @@ class w {
|
|
|
414
414
|
}
|
|
415
415
|
_processInputParams(e) {
|
|
416
416
|
return {
|
|
417
|
-
status: new
|
|
417
|
+
status: new $(),
|
|
418
418
|
ctx: {
|
|
419
419
|
common: e.parent.common,
|
|
420
420
|
data: e.data,
|
|
@@ -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 Xt(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 Xt(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;
|
|
@@ -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 ne({
|
|
496
496
|
schema: this,
|
|
497
497
|
typeName: y.ZodEffects,
|
|
498
498
|
effect: { type: "refinement", refinement: e }
|
|
@@ -511,7 +511,7 @@ class w {
|
|
|
511
511
|
return this.nullable().optional();
|
|
512
512
|
}
|
|
513
513
|
array() {
|
|
514
|
-
return
|
|
514
|
+
return re.create(this, this._def);
|
|
515
515
|
}
|
|
516
516
|
promise() {
|
|
517
517
|
return $e.create(this, this._def);
|
|
@@ -523,8 +523,8 @@ class w {
|
|
|
523
523
|
return Ge.create(this, e, this._def);
|
|
524
524
|
}
|
|
525
525
|
transform(e) {
|
|
526
|
-
return new
|
|
527
|
-
...
|
|
526
|
+
return new ne({
|
|
527
|
+
...v(this._def),
|
|
528
528
|
schema: this,
|
|
529
529
|
typeName: y.ZodEffects,
|
|
530
530
|
effect: { type: "transform", transform: e }
|
|
@@ -533,23 +533,23 @@ class w {
|
|
|
533
533
|
default(e) {
|
|
534
534
|
const r = typeof e == "function" ? e : () => e;
|
|
535
535
|
return new rt({
|
|
536
|
-
...
|
|
536
|
+
...v(this._def),
|
|
537
537
|
innerType: this,
|
|
538
538
|
defaultValue: r,
|
|
539
539
|
typeName: y.ZodDefault
|
|
540
540
|
});
|
|
541
541
|
}
|
|
542
542
|
brand() {
|
|
543
|
-
return new
|
|
543
|
+
return new $t({
|
|
544
544
|
typeName: y.ZodBranded,
|
|
545
545
|
type: this,
|
|
546
|
-
...
|
|
546
|
+
...v(this._def)
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
549
|
catch(e) {
|
|
550
550
|
const r = typeof e == "function" ? e : () => e;
|
|
551
551
|
return new nt({
|
|
552
|
-
...
|
|
552
|
+
...v(this._def),
|
|
553
553
|
innerType: this,
|
|
554
554
|
catchValue: r,
|
|
555
555
|
typeName: y.ZodCatch
|
|
@@ -575,25 +575,25 @@ class w {
|
|
|
575
575
|
return this.safeParse(null).success;
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
|
-
const
|
|
579
|
-
let
|
|
580
|
-
const
|
|
581
|
-
function
|
|
578
|
+
const an = /^c[^\s-]{8,}$/i, on = /^[0-9a-z]+$/, cn = /^[0-9A-HJKMNP-TV-Z]{26}$/, dn = /^[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, un = /^[a-z0-9_-]{21}$/i, ln = /^[-+]?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)?)??$/, fn = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, mn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
579
|
+
let Rt;
|
|
580
|
+
const pn = /^(?:(?: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])$/, hn = /^(([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})))$/, yn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, ur = "((\\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])))", gn = new RegExp(`^${ur}$`);
|
|
581
|
+
function lr(t) {
|
|
582
582
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
583
583
|
return t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
584
584
|
}
|
|
585
|
-
function
|
|
586
|
-
return new RegExp(`^${
|
|
585
|
+
function _n(t) {
|
|
586
|
+
return new RegExp(`^${lr(t)}$`);
|
|
587
587
|
}
|
|
588
|
-
function
|
|
589
|
-
let e = `${
|
|
588
|
+
function fr(t) {
|
|
589
|
+
let e = `${ur}T${lr(t)}`;
|
|
590
590
|
const r = [];
|
|
591
591
|
return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
|
|
592
592
|
}
|
|
593
|
-
function
|
|
594
|
-
return !!((e === "v4" || !e) &&
|
|
593
|
+
function vn(t, e) {
|
|
594
|
+
return !!((e === "v4" || !e) && pn.test(t) || (e === "v6" || !e) && hn.test(t));
|
|
595
595
|
}
|
|
596
|
-
class
|
|
596
|
+
class te 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);
|
|
@@ -603,7 +603,7 @@ class ee extends w {
|
|
|
603
603
|
received: a.parsedType
|
|
604
604
|
}), g;
|
|
605
605
|
}
|
|
606
|
-
const n = new
|
|
606
|
+
const n = new $();
|
|
607
607
|
let s;
|
|
608
608
|
for (const a of this._def.checks)
|
|
609
609
|
if (a.kind === "min")
|
|
@@ -642,43 +642,43 @@ class ee extends w {
|
|
|
642
642
|
message: a.message
|
|
643
643
|
}), n.dirty());
|
|
644
644
|
} else if (a.kind === "email")
|
|
645
|
-
|
|
645
|
+
fn.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
646
646
|
validation: "email",
|
|
647
647
|
code: l.invalid_string,
|
|
648
648
|
message: a.message
|
|
649
649
|
}), n.dirty());
|
|
650
650
|
else if (a.kind === "emoji")
|
|
651
|
-
|
|
651
|
+
Rt || (Rt = new RegExp(mn, "u")), Rt.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
|
|
655
655
|
}), n.dirty());
|
|
656
656
|
else if (a.kind === "uuid")
|
|
657
|
-
|
|
657
|
+
dn.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
658
658
|
validation: "uuid",
|
|
659
659
|
code: l.invalid_string,
|
|
660
660
|
message: a.message
|
|
661
661
|
}), n.dirty());
|
|
662
662
|
else if (a.kind === "nanoid")
|
|
663
|
-
|
|
663
|
+
un.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
664
664
|
validation: "nanoid",
|
|
665
665
|
code: l.invalid_string,
|
|
666
666
|
message: a.message
|
|
667
667
|
}), n.dirty());
|
|
668
668
|
else if (a.kind === "cuid")
|
|
669
|
-
|
|
669
|
+
an.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
670
670
|
validation: "cuid",
|
|
671
671
|
code: l.invalid_string,
|
|
672
672
|
message: a.message
|
|
673
673
|
}), n.dirty());
|
|
674
674
|
else if (a.kind === "cuid2")
|
|
675
|
-
|
|
675
|
+
on.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
676
676
|
validation: "cuid2",
|
|
677
677
|
code: l.invalid_string,
|
|
678
678
|
message: a.message
|
|
679
679
|
}), n.dirty());
|
|
680
680
|
else if (a.kind === "ulid")
|
|
681
|
-
|
|
681
|
+
cn.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
682
682
|
validation: "ulid",
|
|
683
683
|
code: l.invalid_string,
|
|
684
684
|
message: a.message
|
|
@@ -709,27 +709,27 @@ class ee extends w {
|
|
|
709
709
|
code: l.invalid_string,
|
|
710
710
|
validation: { endsWith: a.value },
|
|
711
711
|
message: a.message
|
|
712
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
712
|
+
}), n.dirty()) : a.kind === "datetime" ? fr(a).test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
713
713
|
code: l.invalid_string,
|
|
714
714
|
validation: "datetime",
|
|
715
715
|
message: a.message
|
|
716
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
716
|
+
}), n.dirty()) : a.kind === "date" ? gn.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
717
717
|
code: l.invalid_string,
|
|
718
718
|
validation: "date",
|
|
719
719
|
message: a.message
|
|
720
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
720
|
+
}), n.dirty()) : a.kind === "time" ? _n(a).test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
721
721
|
code: l.invalid_string,
|
|
722
722
|
validation: "time",
|
|
723
723
|
message: a.message
|
|
724
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
724
|
+
}), n.dirty()) : a.kind === "duration" ? ln.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
725
725
|
validation: "duration",
|
|
726
726
|
code: l.invalid_string,
|
|
727
727
|
message: a.message
|
|
728
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
728
|
+
}), n.dirty()) : a.kind === "ip" ? vn(e.data, a.version) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
729
729
|
validation: "ip",
|
|
730
730
|
code: l.invalid_string,
|
|
731
731
|
message: a.message
|
|
732
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
732
|
+
}), n.dirty()) : a.kind === "base64" ? yn.test(e.data) || (s = this._getOrReturnCtx(e, s), m(s, {
|
|
733
733
|
validation: "base64",
|
|
734
734
|
code: l.invalid_string,
|
|
735
735
|
message: a.message
|
|
@@ -744,7 +744,7 @@ class ee extends w {
|
|
|
744
744
|
});
|
|
745
745
|
}
|
|
746
746
|
_addCheck(e) {
|
|
747
|
-
return new
|
|
747
|
+
return new te({
|
|
748
748
|
...this._def,
|
|
749
749
|
checks: [...this._def.checks, e]
|
|
750
750
|
});
|
|
@@ -870,19 +870,19 @@ class ee extends w {
|
|
|
870
870
|
return this.min(1, h.errToObj(e));
|
|
871
871
|
}
|
|
872
872
|
trim() {
|
|
873
|
-
return new
|
|
873
|
+
return new te({
|
|
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 te({
|
|
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 te({
|
|
886
886
|
...this._def,
|
|
887
887
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
888
888
|
});
|
|
@@ -942,16 +942,16 @@ class ee extends w {
|
|
|
942
942
|
return e;
|
|
943
943
|
}
|
|
944
944
|
}
|
|
945
|
-
|
|
945
|
+
te.create = (t) => {
|
|
946
946
|
var e;
|
|
947
|
-
return new
|
|
947
|
+
return new te({
|
|
948
948
|
checks: [],
|
|
949
949
|
typeName: y.ZodString,
|
|
950
950
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
|
|
951
|
-
...
|
|
951
|
+
...v(t)
|
|
952
952
|
});
|
|
953
953
|
};
|
|
954
|
-
function
|
|
954
|
+
function wn(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
|
}
|
|
@@ -969,7 +969,7 @@ class be extends w {
|
|
|
969
969
|
}), g;
|
|
970
970
|
}
|
|
971
971
|
let n;
|
|
972
|
-
const s = new
|
|
972
|
+
const s = new $();
|
|
973
973
|
for (const a of this._def.checks)
|
|
974
974
|
a.kind === "int" ? b.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), m(n, {
|
|
975
975
|
code: l.invalid_type,
|
|
@@ -990,7 +990,7 @@ class be extends w {
|
|
|
990
990
|
inclusive: a.inclusive,
|
|
991
991
|
exact: !1,
|
|
992
992
|
message: a.message
|
|
993
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
993
|
+
}), s.dirty()) : a.kind === "multipleOf" ? wn(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), m(n, {
|
|
994
994
|
code: l.not_multiple_of,
|
|
995
995
|
multipleOf: a.value,
|
|
996
996
|
message: a.message
|
|
@@ -1125,7 +1125,7 @@ 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
|
+
...v(t)
|
|
1129
1129
|
});
|
|
1130
1130
|
class Ee extends w {
|
|
1131
1131
|
constructor() {
|
|
@@ -1141,7 +1141,7 @@ class Ee extends w {
|
|
|
1141
1141
|
}), g;
|
|
1142
1142
|
}
|
|
1143
1143
|
let n;
|
|
1144
|
-
const s = new
|
|
1144
|
+
const s = new $();
|
|
1145
1145
|
for (const a of this._def.checks)
|
|
1146
1146
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), m(n, {
|
|
1147
1147
|
code: l.too_small,
|
|
@@ -1252,7 +1252,7 @@ Ee.create = (t) => {
|
|
|
1252
1252
|
checks: [],
|
|
1253
1253
|
typeName: y.ZodBigInt,
|
|
1254
1254
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
|
|
1255
|
-
...
|
|
1255
|
+
...v(t)
|
|
1256
1256
|
});
|
|
1257
1257
|
};
|
|
1258
1258
|
class We extends w {
|
|
@@ -1265,13 +1265,13 @@ class We extends w {
|
|
|
1265
1265
|
received: n.parsedType
|
|
1266
1266
|
}), g;
|
|
1267
1267
|
}
|
|
1268
|
-
return
|
|
1268
|
+
return F(e.data);
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
1271
|
We.create = (t) => new We({
|
|
1272
1272
|
typeName: y.ZodBoolean,
|
|
1273
1273
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1274
|
-
...
|
|
1274
|
+
...v(t)
|
|
1275
1275
|
});
|
|
1276
1276
|
class Pe extends w {
|
|
1277
1277
|
_parse(e) {
|
|
@@ -1289,7 +1289,7 @@ class Pe extends w {
|
|
|
1289
1289
|
code: l.invalid_date
|
|
1290
1290
|
}), g;
|
|
1291
1291
|
}
|
|
1292
|
-
const n = new
|
|
1292
|
+
const n = new $();
|
|
1293
1293
|
let s;
|
|
1294
1294
|
for (const a of this._def.checks)
|
|
1295
1295
|
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), m(s, {
|
|
@@ -1349,7 +1349,7 @@ Pe.create = (t) => new Pe({
|
|
|
1349
1349
|
checks: [],
|
|
1350
1350
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1351
1351
|
typeName: y.ZodDate,
|
|
1352
|
-
...
|
|
1352
|
+
...v(t)
|
|
1353
1353
|
});
|
|
1354
1354
|
class ht extends w {
|
|
1355
1355
|
_parse(e) {
|
|
@@ -1361,12 +1361,12 @@ class ht extends w {
|
|
|
1361
1361
|
received: n.parsedType
|
|
1362
1362
|
}), g;
|
|
1363
1363
|
}
|
|
1364
|
-
return
|
|
1364
|
+
return F(e.data);
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
1367
|
ht.create = (t) => new ht({
|
|
1368
1368
|
typeName: y.ZodSymbol,
|
|
1369
|
-
...
|
|
1369
|
+
...v(t)
|
|
1370
1370
|
});
|
|
1371
1371
|
class Ke extends w {
|
|
1372
1372
|
_parse(e) {
|
|
@@ -1378,12 +1378,12 @@ class Ke extends w {
|
|
|
1378
1378
|
received: n.parsedType
|
|
1379
1379
|
}), g;
|
|
1380
1380
|
}
|
|
1381
|
-
return
|
|
1381
|
+
return F(e.data);
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
1384
|
Ke.create = (t) => new Ke({
|
|
1385
1385
|
typeName: y.ZodUndefined,
|
|
1386
|
-
...
|
|
1386
|
+
...v(t)
|
|
1387
1387
|
});
|
|
1388
1388
|
class Ye extends w {
|
|
1389
1389
|
_parse(e) {
|
|
@@ -1395,36 +1395,36 @@ class Ye extends w {
|
|
|
1395
1395
|
received: n.parsedType
|
|
1396
1396
|
}), g;
|
|
1397
1397
|
}
|
|
1398
|
-
return
|
|
1398
|
+
return F(e.data);
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
1401
1401
|
Ye.create = (t) => new Ye({
|
|
1402
1402
|
typeName: y.ZodNull,
|
|
1403
|
-
...
|
|
1403
|
+
...v(t)
|
|
1404
1404
|
});
|
|
1405
1405
|
class De extends w {
|
|
1406
1406
|
constructor() {
|
|
1407
1407
|
super(...arguments), this._any = !0;
|
|
1408
1408
|
}
|
|
1409
1409
|
_parse(e) {
|
|
1410
|
-
return
|
|
1410
|
+
return F(e.data);
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
De.create = (t) => new De({
|
|
1414
1414
|
typeName: y.ZodAny,
|
|
1415
|
-
...
|
|
1415
|
+
...v(t)
|
|
1416
1416
|
});
|
|
1417
1417
|
class Oe extends w {
|
|
1418
1418
|
constructor() {
|
|
1419
1419
|
super(...arguments), this._unknown = !0;
|
|
1420
1420
|
}
|
|
1421
1421
|
_parse(e) {
|
|
1422
|
-
return
|
|
1422
|
+
return F(e.data);
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
1425
|
Oe.create = (t) => new Oe({
|
|
1426
1426
|
typeName: y.ZodUnknown,
|
|
1427
|
-
...
|
|
1427
|
+
...v(t)
|
|
1428
1428
|
});
|
|
1429
1429
|
class he extends w {
|
|
1430
1430
|
_parse(e) {
|
|
@@ -1438,7 +1438,7 @@ class he extends w {
|
|
|
1438
1438
|
}
|
|
1439
1439
|
he.create = (t) => new he({
|
|
1440
1440
|
typeName: y.ZodNever,
|
|
1441
|
-
...
|
|
1441
|
+
...v(t)
|
|
1442
1442
|
});
|
|
1443
1443
|
class yt extends w {
|
|
1444
1444
|
_parse(e) {
|
|
@@ -1450,14 +1450,14 @@ class yt extends w {
|
|
|
1450
1450
|
received: n.parsedType
|
|
1451
1451
|
}), g;
|
|
1452
1452
|
}
|
|
1453
|
-
return
|
|
1453
|
+
return F(e.data);
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
1456
|
yt.create = (t) => new yt({
|
|
1457
1457
|
typeName: y.ZodVoid,
|
|
1458
|
-
...
|
|
1458
|
+
...v(t)
|
|
1459
1459
|
});
|
|
1460
|
-
class
|
|
1460
|
+
class re 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 te 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 de(r, o, r.path, c)))).then((o) =>
|
|
1496
|
+
return Promise.all([...r.data].map((o, c) => s.type._parseAsync(new de(r, o, r.path, c)))).then((o) => $.mergeArray(n, o));
|
|
1497
1497
|
const a = [...r.data].map((o, c) => s.type._parseSync(new de(r, o, r.path, c)));
|
|
1498
|
-
return
|
|
1498
|
+
return $.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 re({
|
|
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 re({
|
|
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 re({
|
|
1517
1517
|
...this._def,
|
|
1518
1518
|
exactLength: { value: e, message: h.toString(r) }
|
|
1519
1519
|
});
|
|
@@ -1522,31 +1522,31 @@ class te extends w {
|
|
|
1522
1522
|
return this.min(1, e);
|
|
1523
1523
|
}
|
|
1524
1524
|
}
|
|
1525
|
-
|
|
1525
|
+
re.create = (t, e) => new re({
|
|
1526
1526
|
type: t,
|
|
1527
1527
|
minLength: null,
|
|
1528
1528
|
maxLength: null,
|
|
1529
1529
|
exactLength: null,
|
|
1530
1530
|
typeName: y.ZodArray,
|
|
1531
|
-
...
|
|
1531
|
+
...v(e)
|
|
1532
1532
|
});
|
|
1533
1533
|
function Ne(t) {
|
|
1534
|
-
if (t instanceof
|
|
1534
|
+
if (t instanceof P) {
|
|
1535
1535
|
const e = {};
|
|
1536
1536
|
for (const r in t.shape) {
|
|
1537
1537
|
const n = t.shape[r];
|
|
1538
1538
|
e[r] = oe.create(Ne(n));
|
|
1539
1539
|
}
|
|
1540
|
-
return new
|
|
1540
|
+
return new P({
|
|
1541
1541
|
...t._def,
|
|
1542
1542
|
shape: () => e
|
|
1543
1543
|
});
|
|
1544
|
-
} else return t instanceof
|
|
1544
|
+
} else return t instanceof re ? new re({
|
|
1545
1545
|
...t._def,
|
|
1546
1546
|
type: Ne(t.element)
|
|
1547
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
|
-
class
|
|
1549
|
+
class P extends w {
|
|
1550
1550
|
constructor() {
|
|
1551
1551
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1552
1552
|
}
|
|
@@ -1571,10 +1571,10 @@ class R extends w {
|
|
|
1571
1571
|
o.includes(d) || c.push(d);
|
|
1572
1572
|
const u = [];
|
|
1573
1573
|
for (const d of o) {
|
|
1574
|
-
const f = a[d],
|
|
1574
|
+
const f = a[d], _ = s.data[d];
|
|
1575
1575
|
u.push({
|
|
1576
1576
|
key: { status: "valid", value: d },
|
|
1577
|
-
value: f._parse(new de(s,
|
|
1577
|
+
value: f._parse(new de(s, _, s.path, d)),
|
|
1578
1578
|
alwaysSet: d in s.data
|
|
1579
1579
|
});
|
|
1580
1580
|
}
|
|
@@ -1595,11 +1595,11 @@ class R extends w {
|
|
|
1595
1595
|
} else {
|
|
1596
1596
|
const d = this._def.catchall;
|
|
1597
1597
|
for (const f of c) {
|
|
1598
|
-
const
|
|
1598
|
+
const _ = s.data[f];
|
|
1599
1599
|
u.push({
|
|
1600
1600
|
key: { status: "valid", value: f },
|
|
1601
1601
|
value: d._parse(
|
|
1602
|
-
new de(s,
|
|
1602
|
+
new de(s, _, s.path, f)
|
|
1603
1603
|
//, ctx.child(key), value, getParsedType(value)
|
|
1604
1604
|
),
|
|
1605
1605
|
alwaysSet: f in s.data
|
|
@@ -1609,21 +1609,21 @@ 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
|
|
1612
|
+
const _ = await f.key, E = await f.value;
|
|
1613
1613
|
d.push({
|
|
1614
|
-
key:
|
|
1614
|
+
key: _,
|
|
1615
1615
|
value: E,
|
|
1616
1616
|
alwaysSet: f.alwaysSet
|
|
1617
1617
|
});
|
|
1618
1618
|
}
|
|
1619
1619
|
return d;
|
|
1620
|
-
}).then((d) =>
|
|
1620
|
+
}).then((d) => $.mergeObjectSync(n, d)) : $.mergeObjectSync(n, u);
|
|
1621
1621
|
}
|
|
1622
1622
|
get shape() {
|
|
1623
1623
|
return this._def.shape();
|
|
1624
1624
|
}
|
|
1625
1625
|
strict(e) {
|
|
1626
|
-
return h.errToObj, new
|
|
1626
|
+
return h.errToObj, new P({
|
|
1627
1627
|
...this._def,
|
|
1628
1628
|
unknownKeys: "strict",
|
|
1629
1629
|
...e !== void 0 ? {
|
|
@@ -1640,13 +1640,13 @@ class R extends w {
|
|
|
1640
1640
|
});
|
|
1641
1641
|
}
|
|
1642
1642
|
strip() {
|
|
1643
|
-
return new
|
|
1643
|
+
return new P({
|
|
1644
1644
|
...this._def,
|
|
1645
1645
|
unknownKeys: "strip"
|
|
1646
1646
|
});
|
|
1647
1647
|
}
|
|
1648
1648
|
passthrough() {
|
|
1649
|
-
return new
|
|
1649
|
+
return new P({
|
|
1650
1650
|
...this._def,
|
|
1651
1651
|
unknownKeys: "passthrough"
|
|
1652
1652
|
});
|
|
@@ -1669,7 +1669,7 @@ class R extends w {
|
|
|
1669
1669
|
// }) as any;
|
|
1670
1670
|
// };
|
|
1671
1671
|
extend(e) {
|
|
1672
|
-
return new
|
|
1672
|
+
return new P({
|
|
1673
1673
|
...this._def,
|
|
1674
1674
|
shape: () => ({
|
|
1675
1675
|
...this._def.shape(),
|
|
@@ -1683,7 +1683,7 @@ class R extends w {
|
|
|
1683
1683
|
* upgrade if you are experiencing issues.
|
|
1684
1684
|
*/
|
|
1685
1685
|
merge(e) {
|
|
1686
|
-
return new
|
|
1686
|
+
return new P({
|
|
1687
1687
|
unknownKeys: e._def.unknownKeys,
|
|
1688
1688
|
catchall: e._def.catchall,
|
|
1689
1689
|
shape: () => ({
|
|
@@ -1753,7 +1753,7 @@ class R extends w {
|
|
|
1753
1753
|
// return merged;
|
|
1754
1754
|
// }
|
|
1755
1755
|
catchall(e) {
|
|
1756
|
-
return new
|
|
1756
|
+
return new P({
|
|
1757
1757
|
...this._def,
|
|
1758
1758
|
catchall: e
|
|
1759
1759
|
});
|
|
@@ -1762,7 +1762,7 @@ class R extends w {
|
|
|
1762
1762
|
const r = {};
|
|
1763
1763
|
return b.objectKeys(e).forEach((n) => {
|
|
1764
1764
|
e[n] && this.shape[n] && (r[n] = this.shape[n]);
|
|
1765
|
-
}), new
|
|
1765
|
+
}), new P({
|
|
1766
1766
|
...this._def,
|
|
1767
1767
|
shape: () => r
|
|
1768
1768
|
});
|
|
@@ -1771,7 +1771,7 @@ class R extends w {
|
|
|
1771
1771
|
const r = {};
|
|
1772
1772
|
return b.objectKeys(this.shape).forEach((n) => {
|
|
1773
1773
|
e[n] || (r[n] = this.shape[n]);
|
|
1774
|
-
}), new
|
|
1774
|
+
}), new P({
|
|
1775
1775
|
...this._def,
|
|
1776
1776
|
shape: () => r
|
|
1777
1777
|
});
|
|
@@ -1787,7 +1787,7 @@ class R extends w {
|
|
|
1787
1787
|
return b.objectKeys(this.shape).forEach((n) => {
|
|
1788
1788
|
const s = this.shape[n];
|
|
1789
1789
|
e && !e[n] ? r[n] = s : r[n] = s.optional();
|
|
1790
|
-
}), new
|
|
1790
|
+
}), new P({
|
|
1791
1791
|
...this._def,
|
|
1792
1792
|
shape: () => r
|
|
1793
1793
|
});
|
|
@@ -1803,35 +1803,35 @@ class R extends w {
|
|
|
1803
1803
|
a = a._def.innerType;
|
|
1804
1804
|
r[n] = a;
|
|
1805
1805
|
}
|
|
1806
|
-
}), new
|
|
1806
|
+
}), new P({
|
|
1807
1807
|
...this._def,
|
|
1808
1808
|
shape: () => r
|
|
1809
1809
|
});
|
|
1810
1810
|
}
|
|
1811
1811
|
keyof() {
|
|
1812
|
-
return
|
|
1812
|
+
return mr(b.objectKeys(this.shape));
|
|
1813
1813
|
}
|
|
1814
1814
|
}
|
|
1815
|
-
|
|
1815
|
+
P.create = (t, e) => new P({
|
|
1816
1816
|
shape: () => t,
|
|
1817
1817
|
unknownKeys: "strip",
|
|
1818
1818
|
catchall: he.create(),
|
|
1819
1819
|
typeName: y.ZodObject,
|
|
1820
|
-
...
|
|
1820
|
+
...v(e)
|
|
1821
1821
|
});
|
|
1822
|
-
|
|
1822
|
+
P.strictCreate = (t, e) => new P({
|
|
1823
1823
|
shape: () => t,
|
|
1824
1824
|
unknownKeys: "strict",
|
|
1825
1825
|
catchall: he.create(),
|
|
1826
1826
|
typeName: y.ZodObject,
|
|
1827
|
-
...
|
|
1827
|
+
...v(e)
|
|
1828
1828
|
});
|
|
1829
|
-
|
|
1829
|
+
P.lazycreate = (t, e) => new P({
|
|
1830
1830
|
shape: t,
|
|
1831
1831
|
unknownKeys: "strip",
|
|
1832
1832
|
catchall: he.create(),
|
|
1833
1833
|
typeName: y.ZodObject,
|
|
1834
|
-
...
|
|
1834
|
+
...v(e)
|
|
1835
1835
|
});
|
|
1836
1836
|
class Je extends w {
|
|
1837
1837
|
_parse(e) {
|
|
@@ -1843,7 +1843,7 @@ class Je extends w {
|
|
|
1843
1843
|
for (const c of a)
|
|
1844
1844
|
if (c.result.status === "dirty")
|
|
1845
1845
|
return r.common.issues.push(...c.ctx.common.issues), c.result;
|
|
1846
|
-
const o = a.map((c) => new
|
|
1846
|
+
const o = a.map((c) => new Y(c.ctx.common.issues));
|
|
1847
1847
|
return m(r, {
|
|
1848
1848
|
code: l.invalid_union,
|
|
1849
1849
|
unionErrors: o
|
|
@@ -1890,7 +1890,7 @@ class Je extends w {
|
|
|
1890
1890
|
}
|
|
1891
1891
|
if (a)
|
|
1892
1892
|
return r.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1893
|
-
const c = o.map((u) => new
|
|
1893
|
+
const c = o.map((u) => new Y(u));
|
|
1894
1894
|
return m(r, {
|
|
1895
1895
|
code: l.invalid_union,
|
|
1896
1896
|
unionErrors: c
|
|
@@ -1904,9 +1904,9 @@ class Je extends w {
|
|
|
1904
1904
|
Je.create = (t, e) => new Je({
|
|
1905
1905
|
options: t,
|
|
1906
1906
|
typeName: y.ZodUnion,
|
|
1907
|
-
...
|
|
1907
|
+
...v(e)
|
|
1908
1908
|
});
|
|
1909
|
-
const me = (t) => t instanceof Qe ? me(t.schema) : t instanceof
|
|
1909
|
+
const me = (t) => t instanceof Qe ? me(t.schema) : t instanceof ne ? 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 $t || 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);
|
|
@@ -1965,18 +1965,18 @@ class wt extends w {
|
|
|
1965
1965
|
discriminator: e,
|
|
1966
1966
|
options: r,
|
|
1967
1967
|
optionsMap: s,
|
|
1968
|
-
...
|
|
1968
|
+
...v(n)
|
|
1969
1969
|
});
|
|
1970
1970
|
}
|
|
1971
1971
|
}
|
|
1972
|
-
function
|
|
1972
|
+
function Nt(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 = Nt(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 At(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 = Nt(o, c);
|
|
1991
1991
|
if (!u.valid)
|
|
1992
1992
|
return { valid: !1 };
|
|
1993
1993
|
s.push(u.data);
|
|
@@ -1998,10 +1998,10 @@ function At(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 (It(a) || It(o))
|
|
2002
2002
|
return g;
|
|
2003
|
-
const c =
|
|
2004
|
-
return c.valid ? ((
|
|
2003
|
+
const c = Nt(a.value, o.value);
|
|
2004
|
+
return c.valid ? ((At(a) || At(o)) && r.dirty(), { status: r.value, value: c.data }) : (m(n, {
|
|
2005
2005
|
code: l.invalid_intersection_types
|
|
2006
2006
|
}), g);
|
|
2007
2007
|
};
|
|
@@ -2031,7 +2031,7 @@ Ge.create = (t, e, r) => new Ge({
|
|
|
2031
2031
|
left: t,
|
|
2032
2032
|
right: e,
|
|
2033
2033
|
typeName: y.ZodIntersection,
|
|
2034
|
-
...
|
|
2034
|
+
...v(r)
|
|
2035
2035
|
});
|
|
2036
2036
|
class ue extends w {
|
|
2037
2037
|
_parse(e) {
|
|
@@ -2061,7 +2061,7 @@ class ue extends w {
|
|
|
2061
2061
|
const u = this._def.items[c] || this._def.rest;
|
|
2062
2062
|
return u ? u._parse(new de(n, o, n.path, c)) : null;
|
|
2063
2063
|
}).filter((o) => !!o);
|
|
2064
|
-
return n.common.async ? Promise.all(a).then((o) =>
|
|
2064
|
+
return n.common.async ? Promise.all(a).then((o) => $.mergeArray(r, o)) : $.mergeArray(r, a);
|
|
2065
2065
|
}
|
|
2066
2066
|
get items() {
|
|
2067
2067
|
return this._def.items;
|
|
@@ -2080,7 +2080,7 @@ ue.create = (t, e) => {
|
|
|
2080
2080
|
items: t,
|
|
2081
2081
|
typeName: y.ZodTuple,
|
|
2082
2082
|
rest: null,
|
|
2083
|
-
...
|
|
2083
|
+
...v(e)
|
|
2084
2084
|
});
|
|
2085
2085
|
};
|
|
2086
2086
|
class Xe extends w {
|
|
@@ -2105,7 +2105,7 @@ class Xe extends w {
|
|
|
2105
2105
|
value: o._parse(new de(n, n.data[c], n.path, c)),
|
|
2106
2106
|
alwaysSet: c in n.data
|
|
2107
2107
|
});
|
|
2108
|
-
return n.common.async ?
|
|
2108
|
+
return n.common.async ? $.mergeObjectAsync(r, s) : $.mergeObjectSync(r, s);
|
|
2109
2109
|
}
|
|
2110
2110
|
get element() {
|
|
2111
2111
|
return this._def.valueType;
|
|
@@ -2115,12 +2115,12 @@ class Xe extends w {
|
|
|
2115
2115
|
keyType: e,
|
|
2116
2116
|
valueType: r,
|
|
2117
2117
|
typeName: y.ZodRecord,
|
|
2118
|
-
...
|
|
2118
|
+
...v(n)
|
|
2119
2119
|
}) : new Xe({
|
|
2120
|
-
keyType:
|
|
2120
|
+
keyType: te.create(),
|
|
2121
2121
|
valueType: e,
|
|
2122
2122
|
typeName: y.ZodRecord,
|
|
2123
|
-
...
|
|
2123
|
+
...v(r)
|
|
2124
2124
|
});
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
@@ -2170,7 +2170,7 @@ gt.create = (t, e, r) => new gt({
|
|
|
2170
2170
|
valueType: e,
|
|
2171
2171
|
keyType: t,
|
|
2172
2172
|
typeName: y.ZodMap,
|
|
2173
|
-
...
|
|
2173
|
+
...v(r)
|
|
2174
2174
|
});
|
|
2175
2175
|
class Ie extends w {
|
|
2176
2176
|
_parse(e) {
|
|
@@ -2234,7 +2234,7 @@ Ie.create = (t, e) => new Ie({
|
|
|
2234
2234
|
minSize: null,
|
|
2235
2235
|
maxSize: null,
|
|
2236
2236
|
typeName: y.ZodSet,
|
|
2237
|
-
...
|
|
2237
|
+
...v(e)
|
|
2238
2238
|
});
|
|
2239
2239
|
class Me extends w {
|
|
2240
2240
|
constructor() {
|
|
@@ -2283,24 +2283,24 @@ 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
|
|
2287
|
-
const d = new
|
|
2286
|
+
return F(async function(...u) {
|
|
2287
|
+
const d = new Y([]), f = await c._def.args.parseAsync(u, a).catch((x) => {
|
|
2288
2288
|
throw d.addIssue(n(u, x)), d;
|
|
2289
|
-
}),
|
|
2290
|
-
return await c._def.returns._def.type.parseAsync(
|
|
2291
|
-
throw d.addIssue(s(
|
|
2289
|
+
}), _ = await Reflect.apply(o, this, f);
|
|
2290
|
+
return await c._def.returns._def.type.parseAsync(_, a).catch((x) => {
|
|
2291
|
+
throw d.addIssue(s(_, x)), d;
|
|
2292
2292
|
});
|
|
2293
2293
|
});
|
|
2294
2294
|
} else {
|
|
2295
2295
|
const c = this;
|
|
2296
|
-
return
|
|
2296
|
+
return F(function(...u) {
|
|
2297
2297
|
const d = c._def.args.safeParse(u, a);
|
|
2298
2298
|
if (!d.success)
|
|
2299
|
-
throw new
|
|
2300
|
-
const f = Reflect.apply(o, this, d.data),
|
|
2301
|
-
if (!
|
|
2302
|
-
throw new
|
|
2303
|
-
return
|
|
2299
|
+
throw new Y([n(u, d.error)]);
|
|
2300
|
+
const f = Reflect.apply(o, this, d.data), _ = c._def.returns.safeParse(f, a);
|
|
2301
|
+
if (!_.success)
|
|
2302
|
+
throw new Y([s(f, _.error)]);
|
|
2303
|
+
return _.data;
|
|
2304
2304
|
});
|
|
2305
2305
|
}
|
|
2306
2306
|
}
|
|
@@ -2333,7 +2333,7 @@ class Me extends w {
|
|
|
2333
2333
|
args: e || ue.create([]).rest(Oe.create()),
|
|
2334
2334
|
returns: r || Oe.create(),
|
|
2335
2335
|
typeName: y.ZodFunction,
|
|
2336
|
-
...
|
|
2336
|
+
...v(n)
|
|
2337
2337
|
});
|
|
2338
2338
|
}
|
|
2339
2339
|
}
|
|
@@ -2349,7 +2349,7 @@ class Qe extends w {
|
|
|
2349
2349
|
Qe.create = (t, e) => new Qe({
|
|
2350
2350
|
getter: t,
|
|
2351
2351
|
typeName: y.ZodLazy,
|
|
2352
|
-
...
|
|
2352
|
+
...v(e)
|
|
2353
2353
|
});
|
|
2354
2354
|
class et extends w {
|
|
2355
2355
|
_parse(e) {
|
|
@@ -2370,13 +2370,13 @@ class et extends w {
|
|
|
2370
2370
|
et.create = (t, e) => new et({
|
|
2371
2371
|
value: t,
|
|
2372
2372
|
typeName: y.ZodLiteral,
|
|
2373
|
-
...
|
|
2373
|
+
...v(e)
|
|
2374
2374
|
});
|
|
2375
|
-
function
|
|
2375
|
+
function mr(t, e) {
|
|
2376
2376
|
return new xe({
|
|
2377
2377
|
values: t,
|
|
2378
2378
|
typeName: y.ZodEnum,
|
|
2379
|
-
...
|
|
2379
|
+
...v(e)
|
|
2380
2380
|
});
|
|
2381
2381
|
}
|
|
2382
2382
|
class xe extends w {
|
|
@@ -2392,7 +2392,7 @@ class xe extends w {
|
|
|
2392
2392
|
code: l.invalid_type
|
|
2393
2393
|
}), g;
|
|
2394
2394
|
}
|
|
2395
|
-
if (pt(this, Ve) ||
|
|
2395
|
+
if (pt(this, Ve) || dr(this, Ve, new Set(this._def.values)), !pt(this, Ve).has(e.data)) {
|
|
2396
2396
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2397
2397
|
return m(r, {
|
|
2398
2398
|
received: r.data,
|
|
@@ -2400,7 +2400,7 @@ class xe extends w {
|
|
|
2400
2400
|
options: n
|
|
2401
2401
|
}), g;
|
|
2402
2402
|
}
|
|
2403
|
-
return
|
|
2403
|
+
return F(e.data);
|
|
2404
2404
|
}
|
|
2405
2405
|
get options() {
|
|
2406
2406
|
return this._def.values;
|
|
@@ -2437,7 +2437,7 @@ class xe extends w {
|
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
2439
|
Ve = /* @__PURE__ */ new WeakMap();
|
|
2440
|
-
xe.create =
|
|
2440
|
+
xe.create = mr;
|
|
2441
2441
|
class tt extends w {
|
|
2442
2442
|
constructor() {
|
|
2443
2443
|
super(...arguments), Fe.set(this, void 0);
|
|
@@ -2452,7 +2452,7 @@ class tt extends w {
|
|
|
2452
2452
|
code: l.invalid_type
|
|
2453
2453
|
}), g;
|
|
2454
2454
|
}
|
|
2455
|
-
if (pt(this, Fe) ||
|
|
2455
|
+
if (pt(this, Fe) || dr(this, Fe, new Set(b.getValidEnumValues(this._def.values))), !pt(this, Fe).has(e.data)) {
|
|
2456
2456
|
const s = b.objectValues(r);
|
|
2457
2457
|
return m(n, {
|
|
2458
2458
|
received: n.data,
|
|
@@ -2460,7 +2460,7 @@ class tt extends w {
|
|
|
2460
2460
|
options: s
|
|
2461
2461
|
}), g;
|
|
2462
2462
|
}
|
|
2463
|
-
return
|
|
2463
|
+
return F(e.data);
|
|
2464
2464
|
}
|
|
2465
2465
|
get enum() {
|
|
2466
2466
|
return this._def.values;
|
|
@@ -2470,7 +2470,7 @@ Fe = /* @__PURE__ */ new WeakMap();
|
|
|
2470
2470
|
tt.create = (t, e) => new tt({
|
|
2471
2471
|
values: t,
|
|
2472
2472
|
typeName: y.ZodNativeEnum,
|
|
2473
|
-
...
|
|
2473
|
+
...v(e)
|
|
2474
2474
|
});
|
|
2475
2475
|
class $e extends w {
|
|
2476
2476
|
unwrap() {
|
|
@@ -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 F(n.then((s) => this._def.type.parseAsync(s, {
|
|
2489
2489
|
path: r.path,
|
|
2490
2490
|
errorMap: r.common.contextualErrorMap
|
|
2491
2491
|
})));
|
|
@@ -2494,9 +2494,9 @@ class $e extends w {
|
|
|
2494
2494
|
$e.create = (t, e) => new $e({
|
|
2495
2495
|
type: t,
|
|
2496
2496
|
typeName: y.ZodPromise,
|
|
2497
|
-
...
|
|
2497
|
+
...v(e)
|
|
2498
2498
|
});
|
|
2499
|
-
class
|
|
2499
|
+
class ne extends w {
|
|
2500
2500
|
innerType() {
|
|
2501
2501
|
return this._def.schema;
|
|
2502
2502
|
}
|
|
@@ -2573,21 +2573,21 @@ class re extends w {
|
|
|
2573
2573
|
b.assertNever(s);
|
|
2574
2574
|
}
|
|
2575
2575
|
}
|
|
2576
|
-
|
|
2576
|
+
ne.create = (t, e, r) => new ne({
|
|
2577
2577
|
schema: t,
|
|
2578
2578
|
typeName: y.ZodEffects,
|
|
2579
2579
|
effect: e,
|
|
2580
|
-
...
|
|
2580
|
+
...v(r)
|
|
2581
2581
|
});
|
|
2582
|
-
|
|
2582
|
+
ne.createWithPreprocess = (t, e, r) => new ne({
|
|
2583
2583
|
schema: e,
|
|
2584
2584
|
effect: { type: "preprocess", transform: t },
|
|
2585
2585
|
typeName: y.ZodEffects,
|
|
2586
|
-
...
|
|
2586
|
+
...v(r)
|
|
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 ? F(void 0) : this._def.innerType._parse(e);
|
|
2591
2591
|
}
|
|
2592
2592
|
unwrap() {
|
|
2593
2593
|
return this._def.innerType;
|
|
@@ -2596,11 +2596,11 @@ class oe extends w {
|
|
|
2596
2596
|
oe.create = (t, e) => new oe({
|
|
2597
2597
|
innerType: t,
|
|
2598
2598
|
typeName: y.ZodOptional,
|
|
2599
|
-
...
|
|
2599
|
+
...v(e)
|
|
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 ? F(null) : this._def.innerType._parse(e);
|
|
2604
2604
|
}
|
|
2605
2605
|
unwrap() {
|
|
2606
2606
|
return this._def.innerType;
|
|
@@ -2609,7 +2609,7 @@ class ke extends w {
|
|
|
2609
2609
|
ke.create = (t, e) => new ke({
|
|
2610
2610
|
innerType: t,
|
|
2611
2611
|
typeName: y.ZodNullable,
|
|
2612
|
-
...
|
|
2612
|
+
...v(e)
|
|
2613
2613
|
});
|
|
2614
2614
|
class rt extends w {
|
|
2615
2615
|
_parse(e) {
|
|
@@ -2629,7 +2629,7 @@ rt.create = (t, e) => new rt({
|
|
|
2629
2629
|
innerType: t,
|
|
2630
2630
|
typeName: y.ZodDefault,
|
|
2631
2631
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2632
|
-
...
|
|
2632
|
+
...v(e)
|
|
2633
2633
|
});
|
|
2634
2634
|
class nt extends w {
|
|
2635
2635
|
_parse(e) {
|
|
@@ -2650,7 +2650,7 @@ class nt extends w {
|
|
|
2650
2650
|
status: "valid",
|
|
2651
2651
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
2652
2652
|
get error() {
|
|
2653
|
-
return new
|
|
2653
|
+
return new Y(n.common.issues);
|
|
2654
2654
|
},
|
|
2655
2655
|
input: n.data
|
|
2656
2656
|
})
|
|
@@ -2658,7 +2658,7 @@ class nt extends w {
|
|
|
2658
2658
|
status: "valid",
|
|
2659
2659
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
2660
2660
|
get error() {
|
|
2661
|
-
return new
|
|
2661
|
+
return new Y(n.common.issues);
|
|
2662
2662
|
},
|
|
2663
2663
|
input: n.data
|
|
2664
2664
|
})
|
|
@@ -2672,7 +2672,7 @@ nt.create = (t, e) => new nt({
|
|
|
2672
2672
|
innerType: t,
|
|
2673
2673
|
typeName: y.ZodCatch,
|
|
2674
2674
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2675
|
-
...
|
|
2675
|
+
...v(e)
|
|
2676
2676
|
});
|
|
2677
2677
|
class _t extends w {
|
|
2678
2678
|
_parse(e) {
|
|
@@ -2689,10 +2689,10 @@ class _t extends w {
|
|
|
2689
2689
|
}
|
|
2690
2690
|
_t.create = (t) => new _t({
|
|
2691
2691
|
typeName: y.ZodNaN,
|
|
2692
|
-
...
|
|
2692
|
+
...v(t)
|
|
2693
2693
|
});
|
|
2694
|
-
const
|
|
2695
|
-
class
|
|
2694
|
+
const bn = Symbol("zod_brand");
|
|
2695
|
+
class $t extends w {
|
|
2696
2696
|
_parse(e) {
|
|
2697
2697
|
const { ctx: r } = this._processInputParams(e), n = r.data;
|
|
2698
2698
|
return this._def.type._parse({
|
|
@@ -2757,9 +2757,9 @@ class st extends w {
|
|
|
2757
2757
|
st.create = (t, e) => new st({
|
|
2758
2758
|
innerType: t,
|
|
2759
2759
|
typeName: y.ZodReadonly,
|
|
2760
|
-
...
|
|
2760
|
+
...v(e)
|
|
2761
2761
|
});
|
|
2762
|
-
function
|
|
2762
|
+
function pr(t, e = {}, r) {
|
|
2763
2763
|
return t ? De.create().superRefine((n, s) => {
|
|
2764
2764
|
var a, o;
|
|
2765
2765
|
if (!t(n)) {
|
|
@@ -2768,17 +2768,17 @@ function lr(t, e = {}, r) {
|
|
|
2768
2768
|
}
|
|
2769
2769
|
}) : De.create();
|
|
2770
2770
|
}
|
|
2771
|
-
const
|
|
2772
|
-
object:
|
|
2771
|
+
const En = {
|
|
2772
|
+
object: P.lazycreate
|
|
2773
2773
|
};
|
|
2774
2774
|
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 xn = (t, e = {
|
|
2779
2779
|
message: `Input not instance of ${t.name}`
|
|
2780
|
-
}) =>
|
|
2781
|
-
string: (t) =>
|
|
2780
|
+
}) => pr((r) => r instanceof t, e), hr = te.create, yr = be.create, kn = _t.create, Tn = Ee.create, gr = We.create, Cn = Pe.create, Sn = ht.create, Rn = Ke.create, On = Ye.create, Pn = De.create, In = Oe.create, An = he.create, Nn = yt.create, jn = re.create, Mn = P.create, Zn = P.strictCreate, Dn = Je.create, $n = wt.create, Ln = Ge.create, Un = ue.create, Vn = Xe.create, Fn = gt.create, zn = Ie.create, qn = Me.create, Bn = Qe.create, Hn = et.create, Wn = xe.create, Kn = tt.create, Yn = $e.create, Qt = ne.create, Jn = oe.create, Gn = ke.create, Xn = ne.createWithPreprocess, Qn = ot.create, es = () => hr().optional(), ts = () => yr().optional(), rs = () => gr().optional(), ns = {
|
|
2781
|
+
string: (t) => te.create({ ...t, coerce: !0 }),
|
|
2782
2782
|
number: (t) => be.create({ ...t, coerce: !0 }),
|
|
2783
2783
|
boolean: (t) => We.create({
|
|
2784
2784
|
...t,
|
|
@@ -2786,34 +2786,34 @@ const En = (t, e = {
|
|
|
2786
2786
|
}),
|
|
2787
2787
|
bigint: (t) => Ee.create({ ...t, coerce: !0 }),
|
|
2788
2788
|
date: (t) => Pe.create({ ...t, coerce: !0 })
|
|
2789
|
-
},
|
|
2789
|
+
}, ss = g;
|
|
2790
2790
|
var i = /* @__PURE__ */ Object.freeze({
|
|
2791
2791
|
__proto__: null,
|
|
2792
2792
|
defaultErrorMap: Ze,
|
|
2793
|
-
setErrorMap:
|
|
2793
|
+
setErrorMap: nn,
|
|
2794
2794
|
getErrorMap: ft,
|
|
2795
2795
|
makeIssue: mt,
|
|
2796
|
-
EMPTY_PATH:
|
|
2796
|
+
EMPTY_PATH: sn,
|
|
2797
2797
|
addIssueToContext: m,
|
|
2798
|
-
ParseStatus:
|
|
2798
|
+
ParseStatus: $,
|
|
2799
2799
|
INVALID: g,
|
|
2800
2800
|
DIRTY: je,
|
|
2801
|
-
OK:
|
|
2802
|
-
isAborted:
|
|
2803
|
-
isDirty:
|
|
2801
|
+
OK: F,
|
|
2802
|
+
isAborted: It,
|
|
2803
|
+
isDirty: At,
|
|
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 Pt;
|
|
2811
2811
|
},
|
|
2812
2812
|
ZodParsedType: p,
|
|
2813
2813
|
getParsedType: _e,
|
|
2814
2814
|
ZodType: w,
|
|
2815
|
-
datetimeRegex:
|
|
2816
|
-
ZodString:
|
|
2815
|
+
datetimeRegex: fr,
|
|
2816
|
+
ZodString: te,
|
|
2817
2817
|
ZodNumber: be,
|
|
2818
2818
|
ZodBigInt: Ee,
|
|
2819
2819
|
ZodBoolean: We,
|
|
@@ -2825,8 +2825,8 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2825
2825
|
ZodUnknown: Oe,
|
|
2826
2826
|
ZodNever: he,
|
|
2827
2827
|
ZodVoid: yt,
|
|
2828
|
-
ZodArray:
|
|
2829
|
-
ZodObject:
|
|
2828
|
+
ZodArray: re,
|
|
2829
|
+
ZodObject: P,
|
|
2830
2830
|
ZodUnion: Je,
|
|
2831
2831
|
ZodDiscriminatedUnion: wt,
|
|
2832
2832
|
ZodIntersection: Ge,
|
|
@@ -2840,93 +2840,93 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
2840
2840
|
ZodEnum: xe,
|
|
2841
2841
|
ZodNativeEnum: tt,
|
|
2842
2842
|
ZodPromise: $e,
|
|
2843
|
-
ZodEffects:
|
|
2844
|
-
ZodTransformer:
|
|
2843
|
+
ZodEffects: ne,
|
|
2844
|
+
ZodTransformer: ne,
|
|
2845
2845
|
ZodOptional: oe,
|
|
2846
2846
|
ZodNullable: ke,
|
|
2847
2847
|
ZodDefault: rt,
|
|
2848
2848
|
ZodCatch: nt,
|
|
2849
2849
|
ZodNaN: _t,
|
|
2850
|
-
BRAND:
|
|
2851
|
-
ZodBranded:
|
|
2850
|
+
BRAND: bn,
|
|
2851
|
+
ZodBranded: $t,
|
|
2852
2852
|
ZodPipeline: ot,
|
|
2853
2853
|
ZodReadonly: st,
|
|
2854
|
-
custom:
|
|
2854
|
+
custom: pr,
|
|
2855
2855
|
Schema: w,
|
|
2856
2856
|
ZodSchema: w,
|
|
2857
|
-
late:
|
|
2857
|
+
late: En,
|
|
2858
2858
|
get ZodFirstPartyTypeKind() {
|
|
2859
2859
|
return y;
|
|
2860
2860
|
},
|
|
2861
|
-
coerce:
|
|
2862
|
-
any:
|
|
2863
|
-
array:
|
|
2864
|
-
bigint:
|
|
2865
|
-
boolean:
|
|
2866
|
-
date:
|
|
2867
|
-
discriminatedUnion:
|
|
2868
|
-
effect:
|
|
2869
|
-
enum:
|
|
2870
|
-
function:
|
|
2871
|
-
instanceof:
|
|
2872
|
-
intersection:
|
|
2873
|
-
lazy:
|
|
2874
|
-
literal:
|
|
2875
|
-
map:
|
|
2876
|
-
nan:
|
|
2877
|
-
nativeEnum:
|
|
2878
|
-
never:
|
|
2879
|
-
null:
|
|
2880
|
-
nullable:
|
|
2881
|
-
number:
|
|
2882
|
-
object:
|
|
2883
|
-
oboolean:
|
|
2884
|
-
onumber:
|
|
2885
|
-
optional:
|
|
2886
|
-
ostring:
|
|
2887
|
-
pipeline:
|
|
2888
|
-
preprocess:
|
|
2889
|
-
promise:
|
|
2890
|
-
record:
|
|
2891
|
-
set:
|
|
2892
|
-
strictObject:
|
|
2893
|
-
string:
|
|
2894
|
-
symbol:
|
|
2895
|
-
transformer:
|
|
2896
|
-
tuple:
|
|
2897
|
-
undefined:
|
|
2898
|
-
union:
|
|
2899
|
-
unknown:
|
|
2900
|
-
void:
|
|
2901
|
-
NEVER:
|
|
2861
|
+
coerce: ns,
|
|
2862
|
+
any: Pn,
|
|
2863
|
+
array: jn,
|
|
2864
|
+
bigint: Tn,
|
|
2865
|
+
boolean: gr,
|
|
2866
|
+
date: Cn,
|
|
2867
|
+
discriminatedUnion: $n,
|
|
2868
|
+
effect: Qt,
|
|
2869
|
+
enum: Wn,
|
|
2870
|
+
function: qn,
|
|
2871
|
+
instanceof: xn,
|
|
2872
|
+
intersection: Ln,
|
|
2873
|
+
lazy: Bn,
|
|
2874
|
+
literal: Hn,
|
|
2875
|
+
map: Fn,
|
|
2876
|
+
nan: kn,
|
|
2877
|
+
nativeEnum: Kn,
|
|
2878
|
+
never: An,
|
|
2879
|
+
null: On,
|
|
2880
|
+
nullable: Gn,
|
|
2881
|
+
number: yr,
|
|
2882
|
+
object: Mn,
|
|
2883
|
+
oboolean: rs,
|
|
2884
|
+
onumber: ts,
|
|
2885
|
+
optional: Jn,
|
|
2886
|
+
ostring: es,
|
|
2887
|
+
pipeline: Qn,
|
|
2888
|
+
preprocess: Xn,
|
|
2889
|
+
promise: Yn,
|
|
2890
|
+
record: Vn,
|
|
2891
|
+
set: zn,
|
|
2892
|
+
strictObject: Zn,
|
|
2893
|
+
string: hr,
|
|
2894
|
+
symbol: Sn,
|
|
2895
|
+
transformer: Qt,
|
|
2896
|
+
tuple: Un,
|
|
2897
|
+
undefined: Rn,
|
|
2898
|
+
union: Dn,
|
|
2899
|
+
unknown: In,
|
|
2900
|
+
void: Nn,
|
|
2901
|
+
NEVER: ss,
|
|
2902
2902
|
ZodIssueCode: l,
|
|
2903
|
-
quotelessJson:
|
|
2904
|
-
ZodError:
|
|
2903
|
+
quotelessJson: rn,
|
|
2904
|
+
ZodError: Y
|
|
2905
2905
|
});
|
|
2906
|
-
const
|
|
2906
|
+
const K = i.string().trim().min(1, { message: "Cannot be blank" }), W = i.string().trim().optional(), jt = (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
|
-
const
|
|
2909
|
-
var
|
|
2910
|
-
const
|
|
2908
|
+
const _r = i.nativeEnum(at);
|
|
2909
|
+
var vr = /* @__PURE__ */ ((t) => (t.CARD_NUMBER = "cardNumber", t.CARD_EXPIRY = "cardExpiry", t.CARD_CVC = "cardCvc", t))(vr || {});
|
|
2910
|
+
const wr = i.nativeEnum(vr), as = i.union([_r, wr]), br = i.object({
|
|
2911
2911
|
provider: i.string(),
|
|
2912
|
-
processor_name:
|
|
2913
|
-
metadata:
|
|
2914
|
-
}),
|
|
2912
|
+
processor_name: jt(i.string()),
|
|
2913
|
+
metadata: jt(i.record(i.string(), i.any()))
|
|
2914
|
+
}), is = i.object({
|
|
2915
2915
|
id: i.string()
|
|
2916
2916
|
});
|
|
2917
2917
|
i.object({
|
|
2918
|
-
cardNumber:
|
|
2919
|
-
expiry:
|
|
2920
|
-
cvc:
|
|
2918
|
+
cardNumber: W,
|
|
2919
|
+
expiry: W,
|
|
2920
|
+
cvc: W
|
|
2921
2921
|
});
|
|
2922
2922
|
i.object({
|
|
2923
|
-
backgroundColor:
|
|
2924
|
-
color:
|
|
2925
|
-
fontFamily:
|
|
2926
|
-
fontSize:
|
|
2927
|
-
fontWeight:
|
|
2928
|
-
margin:
|
|
2929
|
-
padding:
|
|
2923
|
+
backgroundColor: W,
|
|
2924
|
+
color: W,
|
|
2925
|
+
fontFamily: W,
|
|
2926
|
+
fontSize: W,
|
|
2927
|
+
fontWeight: W,
|
|
2928
|
+
margin: W,
|
|
2929
|
+
padding: W
|
|
2930
2930
|
});
|
|
2931
2931
|
const k = i.enum([
|
|
2932
2932
|
// Element -> Form
|
|
@@ -2949,76 +2949,76 @@ const k = i.enum([
|
|
|
2949
2949
|
"TOKENIZE",
|
|
2950
2950
|
"CHECKOUT",
|
|
2951
2951
|
"START_PAYMENT_FLOW"
|
|
2952
|
-
]),
|
|
2953
|
-
type:
|
|
2954
|
-
elementType:
|
|
2955
|
-
}),
|
|
2956
|
-
type:
|
|
2957
|
-
message:
|
|
2958
|
-
}),
|
|
2959
|
-
type:
|
|
2960
|
-
elementType:
|
|
2952
|
+
]), os = k.extract(["TOKENIZE_STARTED", "CHECKOUT_STARTED"]), cs = i.object({ type: os }), ds = k.extract(["BLUR", "FOCUS", "CHANGE"]), us = i.object({
|
|
2953
|
+
type: ds,
|
|
2954
|
+
elementType: wr
|
|
2955
|
+
}), ls = k.extract(["LOAD_ERROR", "TOKENIZE_ERROR", "CHECKOUT_ERROR"]), fs = i.object({
|
|
2956
|
+
type: ls,
|
|
2957
|
+
message: K
|
|
2958
|
+
}), ms = k.extract(["VALIDATION_ERROR"]), ps = i.object({
|
|
2959
|
+
type: ms,
|
|
2960
|
+
elementType: as,
|
|
2961
2961
|
errors: i.array(i.string())
|
|
2962
|
-
}), ps = i.object({
|
|
2963
|
-
type: i.literal(k.enum.LAYOUT),
|
|
2964
|
-
height: B
|
|
2965
2962
|
}), hs = i.object({
|
|
2963
|
+
type: i.literal(k.enum.LAYOUT),
|
|
2964
|
+
height: K
|
|
2965
|
+
}), ys = i.object({
|
|
2966
2966
|
type: i.literal(k.enum.LOADED),
|
|
2967
|
-
sessionId:
|
|
2967
|
+
sessionId: K,
|
|
2968
2968
|
totalAmountAtoms: i.number(),
|
|
2969
|
-
currency:
|
|
2970
|
-
checkoutPaymentMethods: i.array(
|
|
2971
|
-
}),
|
|
2969
|
+
currency: W,
|
|
2970
|
+
checkoutPaymentMethods: i.array(br)
|
|
2971
|
+
}), gs = i.object({
|
|
2972
2972
|
type: i.literal(k.enum.PAYMENT_FLOW_STARTED),
|
|
2973
2973
|
nextActionMetadata: i.record(i.string(), i.any()),
|
|
2974
2974
|
paymentFlowMetadata: i.any().optional(),
|
|
2975
2975
|
startPFMetadata: i.optional(i.record(i.string(), i.any()))
|
|
2976
|
-
}),
|
|
2976
|
+
}), _s = i.object({
|
|
2977
2977
|
type: i.literal(k.enum.SETUP_PAYMENT_METHOD_SUCCESS),
|
|
2978
2978
|
paymentMethodId: i.string()
|
|
2979
|
-
}),
|
|
2980
|
-
firstName:
|
|
2981
|
-
lastName:
|
|
2982
|
-
email:
|
|
2983
|
-
zipCode:
|
|
2984
|
-
country:
|
|
2985
|
-
promotionCode:
|
|
2986
|
-
}),
|
|
2987
|
-
type:
|
|
2988
|
-
sessionId:
|
|
2989
|
-
checkoutPaymentMethod:
|
|
2979
|
+
}), vs = i.object({
|
|
2980
|
+
firstName: K,
|
|
2981
|
+
lastName: K,
|
|
2982
|
+
email: K,
|
|
2983
|
+
zipCode: K,
|
|
2984
|
+
country: K,
|
|
2985
|
+
promotionCode: W
|
|
2986
|
+
}), ws = k.extract(["TOKENIZE", "CHECKOUT", "START_PAYMENT_FLOW"]), Er = i.object({
|
|
2987
|
+
type: ws,
|
|
2988
|
+
sessionId: K,
|
|
2989
|
+
checkoutPaymentMethod: br,
|
|
2990
2990
|
paymentFlowMetadata: i.any().optional(),
|
|
2991
2991
|
doNotUseLegacyCCFlow: i.boolean().optional(),
|
|
2992
|
-
existingCCPMId:
|
|
2993
|
-
}).extend(
|
|
2992
|
+
existingCCPMId: W
|
|
2993
|
+
}).extend(vs.shape), bs = i.object({
|
|
2994
2994
|
type: i.literal(k.enum.TOKENIZE_SUCCESS),
|
|
2995
2995
|
isReadyForCheckout: i.boolean()
|
|
2996
|
-
}),
|
|
2996
|
+
}), Es = i.object({
|
|
2997
2997
|
type: i.literal(k.enum.CHECKOUT_SUCCESS),
|
|
2998
2998
|
invoiceUrls: i.array(i.string()),
|
|
2999
2999
|
subscriptionIds: i.array(i.string()),
|
|
3000
3000
|
customerId: i.string()
|
|
3001
|
-
}),
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
ms,
|
|
3001
|
+
}), xs = i.discriminatedUnion("type", [
|
|
3002
|
+
cs,
|
|
3003
|
+
us,
|
|
3004
|
+
fs,
|
|
3006
3005
|
ps,
|
|
3007
3006
|
hs,
|
|
3008
|
-
vr,
|
|
3009
|
-
ws,
|
|
3010
|
-
bs,
|
|
3011
3007
|
ys,
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3008
|
+
Er,
|
|
3009
|
+
bs,
|
|
3010
|
+
Es,
|
|
3011
|
+
gs,
|
|
3012
|
+
_s
|
|
3013
|
+
]), ks = i.object({
|
|
3014
|
+
payload: xs,
|
|
3015
|
+
nonce: K,
|
|
3016
|
+
formId: K,
|
|
3017
|
+
elementId: K
|
|
3018
3018
|
});
|
|
3019
3019
|
i.object({
|
|
3020
3020
|
amountAtom: i.number(),
|
|
3021
|
-
currency:
|
|
3021
|
+
currency: K
|
|
3022
3022
|
});
|
|
3023
3023
|
i.object({
|
|
3024
3024
|
secure_token: i.string(),
|
|
@@ -3026,25 +3026,25 @@ i.object({
|
|
|
3026
3026
|
});
|
|
3027
3027
|
i.object({
|
|
3028
3028
|
secure_token: i.string(),
|
|
3029
|
-
existing_cc_pm_id:
|
|
3029
|
+
existing_cc_pm_id: jt(i.string())
|
|
3030
3030
|
});
|
|
3031
|
-
const
|
|
3032
|
-
payment_methods: i.array(
|
|
3033
|
-
}),
|
|
3031
|
+
const Ts = i.object({
|
|
3032
|
+
payment_methods: i.array(is)
|
|
3033
|
+
}), Cs = (t) => {
|
|
3034
3034
|
const e = {};
|
|
3035
3035
|
return Object.entries(t).forEach(([r, n]) => {
|
|
3036
3036
|
try {
|
|
3037
|
-
const s =
|
|
3037
|
+
const s = _r.parse(r);
|
|
3038
3038
|
Array.isArray(n) ? e[s] = n : Array.isArray(n._errors) && (e[s] = n._errors);
|
|
3039
3039
|
} catch {
|
|
3040
3040
|
return;
|
|
3041
3041
|
}
|
|
3042
3042
|
}), e;
|
|
3043
|
-
},
|
|
3043
|
+
}, Ss = (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) => {
|
|
3047
|
-
const c =
|
|
3047
|
+
const c = Ss(r, {
|
|
3048
3048
|
type: t,
|
|
3049
3049
|
sessionId: e,
|
|
3050
3050
|
checkoutPaymentMethod: s,
|
|
@@ -3052,55 +3052,56 @@ const ks = i.object({
|
|
|
3052
3052
|
doNotUseLegacyCCFlow: a
|
|
3053
3053
|
});
|
|
3054
3054
|
(s.provider === "apple_pay" || s.provider === "google_pay" || s.provider === "stripe_link") && (c[at.ZIP_CODE] || (c[at.ZIP_CODE] = "00000"));
|
|
3055
|
-
const u =
|
|
3055
|
+
const u = Er.safeParse(c);
|
|
3056
3056
|
if (u.success)
|
|
3057
3057
|
return u.data;
|
|
3058
3058
|
{
|
|
3059
|
-
const d = u.error.format(), f =
|
|
3060
|
-
for (const [
|
|
3061
|
-
n(
|
|
3059
|
+
const d = u.error.format(), f = Cs(d);
|
|
3060
|
+
for (const [_, E] of Object.entries(f))
|
|
3061
|
+
n(_, E, _);
|
|
3062
3062
|
return null;
|
|
3063
3063
|
}
|
|
3064
|
-
},
|
|
3064
|
+
}, Rs = (t) => {
|
|
3065
3065
|
try {
|
|
3066
|
-
return
|
|
3066
|
+
return ks.parse(t);
|
|
3067
3067
|
} catch (e) {
|
|
3068
3068
|
throw e;
|
|
3069
3069
|
}
|
|
3070
3070
|
}, Ue = (t, e, r, n, s) => {
|
|
3071
3071
|
const a = {
|
|
3072
3072
|
payload: n,
|
|
3073
|
-
nonce:
|
|
3073
|
+
nonce: or(),
|
|
3074
3074
|
formId: e,
|
|
3075
3075
|
elementId: r
|
|
3076
3076
|
};
|
|
3077
3077
|
t.postMessage(JSON.stringify(a), s);
|
|
3078
|
-
},
|
|
3078
|
+
}, Os = "https://cde.getopenpay.com", Ps = {
|
|
3079
3079
|
usd: "usd",
|
|
3080
3080
|
brl: "brl"
|
|
3081
|
-
},
|
|
3081
|
+
}, Lt = async (t) => {
|
|
3082
3082
|
for (let r = 0; r < 10; r++)
|
|
3083
|
-
|
|
3084
|
-
if (!
|
|
3083
|
+
tr() || await xr(500);
|
|
3084
|
+
if (!tr())
|
|
3085
3085
|
throw new Error("Stripe JS not found.");
|
|
3086
3086
|
return new Stripe(t);
|
|
3087
|
-
},
|
|
3088
|
-
const
|
|
3089
|
-
return
|
|
3087
|
+
}, er = async (t, e, r, n, s) => {
|
|
3088
|
+
const a = await Lt(t), o = Ps[r.toLowerCase().trim()];
|
|
3089
|
+
return a.paymentRequest({
|
|
3090
3090
|
// TODO: replace this with stripe account country as soon as we support it
|
|
3091
3091
|
country: "US",
|
|
3092
|
-
currency:
|
|
3092
|
+
currency: o,
|
|
3093
3093
|
total: {
|
|
3094
3094
|
label: "Total",
|
|
3095
3095
|
amount: e,
|
|
3096
3096
|
pending: n
|
|
3097
3097
|
},
|
|
3098
3098
|
requestPayerName: !0,
|
|
3099
|
-
requestPayerEmail: !0
|
|
3099
|
+
requestPayerEmail: !0,
|
|
3100
|
+
disableWallets: s ? ["applePay", "browserCard", "googlePay"] : []
|
|
3100
3101
|
});
|
|
3101
|
-
},
|
|
3102
|
+
}, xr = (t) => new Promise((e) => {
|
|
3102
3103
|
setTimeout(e, t);
|
|
3103
|
-
}),
|
|
3104
|
+
}), tr = () => "Stripe" in window, Is = async (t) => new Promise((e, r) => {
|
|
3104
3105
|
try {
|
|
3105
3106
|
t.on("paymentmethod", async (n) => {
|
|
3106
3107
|
e(n);
|
|
@@ -3123,7 +3124,7 @@ const ks = i.object({
|
|
|
3123
3124
|
throw new Error(`Invalid next action metadata format: ${JSON.stringify(r)}`);
|
|
3124
3125
|
if (e.paymentMethod.id !== t.paymentFlowMetadata.stripePmId)
|
|
3125
3126
|
throw new Error(`PM ID mismatch: ${e.paymentMethod.id} != ${t.paymentFlowMetadata.stripePmId}`);
|
|
3126
|
-
const s = await (await
|
|
3127
|
+
const s = await (await Lt(r.stripe_pk)).confirmCardSetup(r.client_secret, {
|
|
3127
3128
|
payment_method: t.paymentFlowMetadata.stripePmId
|
|
3128
3129
|
});
|
|
3129
3130
|
if (s.error)
|
|
@@ -3131,14 +3132,14 @@ const ks = i.object({
|
|
|
3131
3132
|
e.complete("success");
|
|
3132
3133
|
}, js = async (t) => {
|
|
3133
3134
|
var a, o, c, u;
|
|
3134
|
-
const e = t.nextActionMetadata, n = await (await
|
|
3135
|
+
const e = t.nextActionMetadata, n = await (await Lt(e.stripe_pk)).confirmCardSetup(e.client_secret, {
|
|
3135
3136
|
payment_method: e.stripe_pm_id
|
|
3136
3137
|
}), s = (a = n.setupIntent) == null ? void 0 : a.status;
|
|
3137
3138
|
if (s !== "succeeded") throw s === "canceled" ? new Error("Payment cancelled, please click Submit again to pay") : new Error(
|
|
3138
3139
|
`${((o = n.error) == null ? void 0 : o.message) ?? ((u = (c = n.setupIntent) == null ? void 0 : c.last_setup_error) == null ? void 0 : u.message) ?? "Payment failed, please click submit again to pay."}`
|
|
3139
3140
|
);
|
|
3140
3141
|
}, Ms = (t = {}) => {
|
|
3141
|
-
const [e, r] =
|
|
3142
|
+
const [e, r] = O(t), n = ze(
|
|
3142
3143
|
() => ({
|
|
3143
3144
|
set: (a, o) => {
|
|
3144
3145
|
r((c) => ({
|
|
@@ -3168,8 +3169,8 @@ const ks = i.object({
|
|
|
3168
3169
|
function Zs(t) {
|
|
3169
3170
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
3170
3171
|
}
|
|
3171
|
-
var
|
|
3172
|
-
function
|
|
3172
|
+
var Ut = { exports: {} }, Ds = Kr;
|
|
3173
|
+
function kr(t, e, r) {
|
|
3173
3174
|
var n = typeof e == "function";
|
|
3174
3175
|
Ds.useEffect(function() {
|
|
3175
3176
|
var s, a = !0, o = t(function() {
|
|
@@ -3182,9 +3183,9 @@ function br(t, e, r) {
|
|
|
3182
3183
|
};
|
|
3183
3184
|
}, n ? r : e);
|
|
3184
3185
|
}
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
var $s =
|
|
3186
|
+
Ut.exports = kr;
|
|
3187
|
+
Ut.exports.useAsyncEffect = kr;
|
|
3188
|
+
var $s = Ut.exports;
|
|
3188
3189
|
const vt = /* @__PURE__ */ Zs($s), Ls = i.object({
|
|
3189
3190
|
type: i.string(),
|
|
3190
3191
|
loc: i.array(i.string()),
|
|
@@ -3196,7 +3197,7 @@ const vt = /* @__PURE__ */ Zs($s), Ls = i.object({
|
|
|
3196
3197
|
path: i.array(i.string())
|
|
3197
3198
|
}), Fs = i.array(Vs), zs = {
|
|
3198
3199
|
"failed to fetch": "Connection error: please double check if you are connected to the internet, then try again"
|
|
3199
|
-
},
|
|
3200
|
+
}, Mt = (t) => {
|
|
3200
3201
|
const e = t.toLowerCase().trim();
|
|
3201
3202
|
return zs[e] ?? t;
|
|
3202
3203
|
}, qs = (t) => {
|
|
@@ -3205,17 +3206,17 @@ const vt = /* @__PURE__ */ Zs($s), Ls = i.object({
|
|
|
3205
3206
|
} catch {
|
|
3206
3207
|
return !1;
|
|
3207
3208
|
}
|
|
3208
|
-
}, Bs = (t) => t.length === 1 ?
|
|
3209
|
-
${t.map((r) => `• ${
|
|
3209
|
+
}, Bs = (t) => t.length === 1 ? Mt(t[0].msg) : `Please fix the following errors:
|
|
3210
|
+
${t.map((r) => `• ${Mt(r.msg)}`).join(`
|
|
3210
3211
|
`)}`, Hs = (t) => `Encountered the following errors:
|
|
3211
3212
|
${t.map((r) => `- ${r.path.join("/")}: ${r.message}`).join(`
|
|
3212
|
-
`)}`,
|
|
3213
|
+
`)}`, Vt = (t) => {
|
|
3213
3214
|
if (window.cur_error = t, t instanceof Error)
|
|
3214
3215
|
if (qs(t.message)) {
|
|
3215
3216
|
const e = JSON.parse(t.message);
|
|
3216
3217
|
return Us.safeParse(e).success ? Bs(e) : Fs.safeParse(e).success ? Hs(e) : t.message;
|
|
3217
3218
|
} else
|
|
3218
|
-
return
|
|
3219
|
+
return Mt(t.message);
|
|
3219
3220
|
if (typeof t == "object")
|
|
3220
3221
|
try {
|
|
3221
3222
|
return JSON.stringify(t);
|
|
@@ -3246,7 +3247,7 @@ i.string().trim().min(1, { message: "Cannot be blank" });
|
|
|
3246
3247
|
const Ys = i.object({
|
|
3247
3248
|
cde_response_type: i.literal("error"),
|
|
3248
3249
|
message: i.string()
|
|
3249
|
-
}), Js = i.enum(["usd", "brl"]),
|
|
3250
|
+
}), Js = i.enum(["usd", "brl"]), Tr = i.object({
|
|
3250
3251
|
name: i.string(),
|
|
3251
3252
|
amount_atom_off: N(i.number()),
|
|
3252
3253
|
percent_off: N(i.number()),
|
|
@@ -3278,16 +3279,16 @@ const Ys = i.object({
|
|
|
3278
3279
|
subscription_items: i.array(ta),
|
|
3279
3280
|
trial_start: N(i.string()),
|
|
3280
3281
|
trial_end: N(i.string())
|
|
3281
|
-
}),
|
|
3282
|
+
}), Cr = i.object({
|
|
3282
3283
|
amount_atom: i.number()
|
|
3283
3284
|
}), na = i.object({
|
|
3284
3285
|
amount_atom: i.number(),
|
|
3285
3286
|
amount_atom_considering_discount_applied: i.number(),
|
|
3286
3287
|
currency: i.string(),
|
|
3287
|
-
discount_amount_atoms: i.array(
|
|
3288
|
+
discount_amount_atoms: i.array(Cr),
|
|
3288
3289
|
subscription_item_id: i.string()
|
|
3289
3290
|
}), sa = i.object({
|
|
3290
|
-
coupon:
|
|
3291
|
+
coupon: Tr
|
|
3291
3292
|
}), aa = i.object({
|
|
3292
3293
|
currency: i.string(),
|
|
3293
3294
|
discounts: i.array(sa),
|
|
@@ -3296,15 +3297,15 @@ const Ys = i.object({
|
|
|
3296
3297
|
remaining_amount_atom: i.number(),
|
|
3297
3298
|
tax_amount_atom: i.number(),
|
|
3298
3299
|
total_amount_atom: i.number(),
|
|
3299
|
-
total_discount_amount_atoms: i.array(
|
|
3300
|
-
}),
|
|
3300
|
+
total_discount_amount_atoms: i.array(Cr)
|
|
3301
|
+
}), rr = i.object({
|
|
3301
3302
|
created: i.array(ra),
|
|
3302
3303
|
invoices: i.array(aa)
|
|
3303
|
-
}),
|
|
3304
|
-
preview:
|
|
3305
|
-
preview_post_trial: N(
|
|
3306
|
-
coupons: i.array(
|
|
3307
|
-
}),
|
|
3304
|
+
}), Sr = i.object({
|
|
3305
|
+
preview: rr,
|
|
3306
|
+
preview_post_trial: N(rr),
|
|
3307
|
+
coupons: i.array(Tr)
|
|
3308
|
+
}), nr = i.object({
|
|
3308
3309
|
status: i.literal("open"),
|
|
3309
3310
|
token: i.string(),
|
|
3310
3311
|
email: N(i.string()),
|
|
@@ -3312,24 +3313,24 @@ const Ys = i.object({
|
|
|
3312
3313
|
amount_subtotal_atom: i.number().int(),
|
|
3313
3314
|
amount_total_atom: i.number().int(),
|
|
3314
3315
|
brand: Qs,
|
|
3315
|
-
subs_preview: N(
|
|
3316
|
+
subs_preview: N(Sr),
|
|
3316
3317
|
// Null in setup mode
|
|
3317
3318
|
methods_available: i.array(ea)
|
|
3318
|
-
}),
|
|
3319
|
+
}), Rr = i.discriminatedUnion("mode", [
|
|
3319
3320
|
i.object({
|
|
3320
3321
|
mode: i.literal("setup"),
|
|
3321
3322
|
currency: i.nullable(i.undefined())
|
|
3322
|
-
}).extend(
|
|
3323
|
+
}).extend(nr.shape),
|
|
3323
3324
|
i.object({
|
|
3324
3325
|
mode: i.enum(["payment", "subscription"]),
|
|
3325
3326
|
currency: Js
|
|
3326
|
-
}).extend(
|
|
3327
|
+
}).extend(nr.shape)
|
|
3327
3328
|
]), ia = i.object({
|
|
3328
3329
|
status: i.literal("complete")
|
|
3329
3330
|
}), oa = i.object({
|
|
3330
3331
|
status: i.literal("expired")
|
|
3331
3332
|
});
|
|
3332
|
-
i.union([
|
|
3333
|
+
i.union([Rr, ia, oa]);
|
|
3333
3334
|
i.object({
|
|
3334
3335
|
logo: i.string(),
|
|
3335
3336
|
icon: i.string(),
|
|
@@ -3362,7 +3363,7 @@ i.object({
|
|
|
3362
3363
|
required_user_actions: i.array(i.record(i.string(), i.any())),
|
|
3363
3364
|
cc_pm_id: i.string()
|
|
3364
3365
|
});
|
|
3365
|
-
const
|
|
3366
|
+
const Ft = async (t, e, r) => {
|
|
3366
3367
|
const n = await t.send(e);
|
|
3367
3368
|
if (ua(n))
|
|
3368
3369
|
throw new Error(`[cde-client] Error querying CDE: ${n.message}`);
|
|
@@ -3371,14 +3372,14 @@ const Ut = async (t, e, r) => {
|
|
|
3371
3372
|
throw s.success ? new Error("Invalid state") : s.error;
|
|
3372
3373
|
}
|
|
3373
3374
|
return n;
|
|
3374
|
-
}, da = (t, e) => e.safeParse(t).success, ua = (t) => Ys.safeParse(t).success, la = async (t, e) => await
|
|
3375
|
-
const [s, a] =
|
|
3375
|
+
}, da = (t, e) => e.safeParse(t).success, ua = (t) => Ys.safeParse(t).success, la = async (t, e) => await Ft(t, { type: "get_checkout_preview", payload: e }, Sr), zt = async (t) => await Ft(t, { type: "get_prefill", payload: {} }, Rr), fa = async (t, e) => await Ft(t, { type: "confirm_payment_flow", payload: e }, Ts), ma = (t) => t.reduce((e, r) => e + r, 0), pa = (t, e, r, n) => {
|
|
3376
|
+
const [s, a] = O(""), [o, c] = O(""), [u, d] = O(null), [f, _] = O(!1), [E, x] = O(null);
|
|
3376
3377
|
return vt(async () => {
|
|
3377
3378
|
if (!n || !t)
|
|
3378
3379
|
return;
|
|
3379
3380
|
const T = await ha(n, at.PROMOTION_CODE);
|
|
3380
3381
|
T == null || T.addEventListener("input", () => {
|
|
3381
|
-
|
|
3382
|
+
_(!0), x(null), a(T.value);
|
|
3382
3383
|
});
|
|
3383
3384
|
}, [!!n, t]), Ks(
|
|
3384
3385
|
() => {
|
|
@@ -3391,12 +3392,12 @@ const Ut = async (t, e, r) => {
|
|
|
3391
3392
|
try {
|
|
3392
3393
|
if (!e || !r || !t)
|
|
3393
3394
|
return;
|
|
3394
|
-
const C = (await
|
|
3395
|
-
T() && (x(null), d(
|
|
3396
|
-
} catch (
|
|
3397
|
-
T() && x(
|
|
3395
|
+
const C = (await zt(e)).mode === "setup", Z = await Or(e, r, C, o);
|
|
3396
|
+
T() && (x(null), d(Z));
|
|
3397
|
+
} catch (S) {
|
|
3398
|
+
T() && x(Vt(S));
|
|
3398
3399
|
} finally {
|
|
3399
|
-
T() &&
|
|
3400
|
+
T() && _(!1);
|
|
3400
3401
|
}
|
|
3401
3402
|
},
|
|
3402
3403
|
[!e, !r, o, t]
|
|
@@ -3414,7 +3415,7 @@ const Ut = async (t, e, r) => {
|
|
|
3414
3415
|
throw new Error(`Invalid state: matched input element had wrong class: ${s.tagName}`);
|
|
3415
3416
|
return s;
|
|
3416
3417
|
}
|
|
3417
|
-
await
|
|
3418
|
+
await xr(300);
|
|
3418
3419
|
}
|
|
3419
3420
|
return null;
|
|
3420
3421
|
}, ya = async (t, e, r) => {
|
|
@@ -3429,7 +3430,7 @@ const Ut = async (t, e, r) => {
|
|
|
3429
3430
|
currency: a,
|
|
3430
3431
|
amountAtom: o
|
|
3431
3432
|
};
|
|
3432
|
-
},
|
|
3433
|
+
}, Or = async (t, e, r, n) => {
|
|
3433
3434
|
if (r)
|
|
3434
3435
|
return { amountAtom: 0, currency: "usd" };
|
|
3435
3436
|
{
|
|
@@ -3437,11 +3438,11 @@ const Ut = async (t, e, r) => {
|
|
|
3437
3438
|
const s = await ya(t, e, n);
|
|
3438
3439
|
return { amountAtom: s.amountAtom, currency: s.currency };
|
|
3439
3440
|
}
|
|
3440
|
-
},
|
|
3441
|
+
}, sr = i.enum(["apple_pay", "google_pay", "stripe_link"]), ga = {
|
|
3441
3442
|
apple_pay: "applePay",
|
|
3442
3443
|
google_pay: "googlePay",
|
|
3443
3444
|
stripe_link: "link"
|
|
3444
|
-
},
|
|
3445
|
+
}, Ot = {
|
|
3445
3446
|
isLoading: !0,
|
|
3446
3447
|
isAvailable: !1,
|
|
3447
3448
|
startFlow: async () => {
|
|
@@ -3453,46 +3454,53 @@ const Ut = async (t, e, r) => {
|
|
|
3453
3454
|
}
|
|
3454
3455
|
}, va = (t, e, r, n, s, a, o, c) => {
|
|
3455
3456
|
const [u, d] = Ms({
|
|
3456
|
-
apple_pay:
|
|
3457
|
-
google_pay:
|
|
3458
|
-
stripe_link:
|
|
3459
|
-
}), f = e === void 0 || r === void 0 || !n || !t,
|
|
3457
|
+
apple_pay: Ot,
|
|
3458
|
+
google_pay: Ot,
|
|
3459
|
+
stripe_link: Ot
|
|
3460
|
+
}), f = e === void 0 || r === void 0 || !n || !t, _ = c.amount, [E, x] = O(null);
|
|
3460
3461
|
return pe(() => {
|
|
3461
|
-
if (!
|
|
3462
|
+
if (!Pr() || !_ || E === null)
|
|
3462
3463
|
return;
|
|
3463
|
-
const T =
|
|
3464
|
-
|
|
3465
|
-
}, [
|
|
3464
|
+
const { pr: T, linkPr: S } = Ir();
|
|
3465
|
+
Zt(T, _, E), Zt(S, _, E);
|
|
3466
|
+
}, [_, E]), vt(async () => {
|
|
3466
3467
|
if (f)
|
|
3467
3468
|
return;
|
|
3468
3469
|
const T = r.filter(
|
|
3469
|
-
(
|
|
3470
|
+
(L) => L.processor_name === "stripe" && sr.options.map((H) => String(H)).includes(L.provider)
|
|
3470
3471
|
);
|
|
3471
3472
|
if (T.length === 0)
|
|
3472
3473
|
throw new Error("Stripe is not available as a checkout method");
|
|
3473
|
-
const
|
|
3474
|
-
x(
|
|
3475
|
-
const
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3474
|
+
const S = As(T[0].metadata), Z = (await zt(t)).mode === "setup";
|
|
3475
|
+
x(Z);
|
|
3476
|
+
const D = await Or(t, e, Z, void 0), I = await er(
|
|
3477
|
+
S,
|
|
3478
|
+
D.amountAtom,
|
|
3479
|
+
D.currency,
|
|
3480
|
+
Z
|
|
3481
|
+
), G = await er(
|
|
3482
|
+
S,
|
|
3483
|
+
D.amountAtom,
|
|
3484
|
+
D.currency,
|
|
3485
|
+
Z,
|
|
3486
|
+
!0
|
|
3480
3487
|
);
|
|
3481
|
-
Ea(
|
|
3482
|
-
const
|
|
3483
|
-
|
|
3484
|
-
|
|
3488
|
+
Ea(I, G);
|
|
3489
|
+
const J = await I.canMakePayment();
|
|
3490
|
+
await G.canMakePayment();
|
|
3491
|
+
for (const L of sr.options) {
|
|
3492
|
+
L.replace("_", "");
|
|
3485
3493
|
try {
|
|
3486
|
-
const
|
|
3487
|
-
if (!
|
|
3488
|
-
throw new Error(`${
|
|
3489
|
-
d.set(
|
|
3494
|
+
const H = T.find((z) => z.provider === L), Et = (J == null ? void 0 : J[ga[L]]) ?? !1;
|
|
3495
|
+
if (!H)
|
|
3496
|
+
throw new Error(`${L} is not available as a stripe checkout method`);
|
|
3497
|
+
d.set(L, {
|
|
3490
3498
|
isLoading: !1,
|
|
3491
|
-
isAvailable:
|
|
3492
|
-
startFlow: (
|
|
3499
|
+
isAvailable: Et,
|
|
3500
|
+
startFlow: (z) => ba(n, H, s, a, o, z)
|
|
3493
3501
|
});
|
|
3494
3502
|
} catch {
|
|
3495
|
-
d.set(
|
|
3503
|
+
d.set(L, _a);
|
|
3496
3504
|
}
|
|
3497
3505
|
}
|
|
3498
3506
|
}, [f]), u;
|
|
@@ -3511,26 +3519,31 @@ const Ut = async (t, e, r) => {
|
|
|
3511
3519
|
if (o("[startFlow] triggered"), !wa(t, n, e))
|
|
3512
3520
|
return;
|
|
3513
3521
|
o("[startFlow] post-validate");
|
|
3514
|
-
const c =
|
|
3515
|
-
if (o("[startFlow] pr:",
|
|
3516
|
-
const
|
|
3517
|
-
|
|
3522
|
+
const { pr: c, linkPr: u } = Ir(), d = e.provider === "stripe_link" ? u : c;
|
|
3523
|
+
if (o("[startFlow] pr:", d, "override:", a == null ? void 0 : a.overridePaymentRequest), a != null && a.overridePaymentRequest) {
|
|
3524
|
+
const _ = a == null ? void 0 : a.overridePaymentRequest;
|
|
3525
|
+
Zt(d, _.amount, _.pending);
|
|
3518
3526
|
}
|
|
3519
|
-
o("[startFlow] showing PR..."),
|
|
3520
|
-
const
|
|
3521
|
-
o("[startFlow] PR fulfilled. Completing flow..."), r(
|
|
3527
|
+
o("[startFlow] showing PR..."), d.show(), o("[startFlow] PR shown. Waiting...");
|
|
3528
|
+
const f = await Is(d);
|
|
3529
|
+
o("[startFlow] PR fulfilled. Completing flow..."), r(f, e);
|
|
3522
3530
|
} catch (o) {
|
|
3523
|
-
window.console.error("[startFlow] Error:", o), s(
|
|
3531
|
+
window.console.error("[startFlow] Error:", o), s(Vt(o));
|
|
3524
3532
|
}
|
|
3525
|
-
}, Ea = (t) => {
|
|
3533
|
+
}, Ea = (t, e) => {
|
|
3526
3534
|
if ("ojs_pr" in window)
|
|
3527
3535
|
throw new Error("Attempted to set global PR twice");
|
|
3528
|
-
window.ojs_pr = t;
|
|
3529
|
-
},
|
|
3530
|
-
if (!
|
|
3536
|
+
window.ojs_pr = t, window.ojs_link_pr = e;
|
|
3537
|
+
}, Pr = () => "ojs_pr" in window, Ir = () => {
|
|
3538
|
+
if (!Pr())
|
|
3531
3539
|
throw new Error("Global PR not set");
|
|
3532
|
-
return
|
|
3533
|
-
|
|
3540
|
+
return {
|
|
3541
|
+
// @ts-expect-error window typing
|
|
3542
|
+
pr: window.ojs_pr,
|
|
3543
|
+
// @ts-expect-error window typing
|
|
3544
|
+
linkPr: window.ojs_link_pr
|
|
3545
|
+
};
|
|
3546
|
+
}, Zt = (t, e, r) => {
|
|
3534
3547
|
t.update({ total: { amount: e.amountAtom, label: "Total", pending: r }, currency: e.currency });
|
|
3535
3548
|
};
|
|
3536
3549
|
var ce;
|
|
@@ -3545,10 +3558,10 @@ var it;
|
|
|
3545
3558
|
(function(t) {
|
|
3546
3559
|
t.ConnectionDestroyed = "ConnectionDestroyed", t.ConnectionTimeout = "ConnectionTimeout", t.NoIframeSrc = "NoIframeSrc";
|
|
3547
3560
|
})(it || (it = {}));
|
|
3548
|
-
var
|
|
3561
|
+
var Dt;
|
|
3549
3562
|
(function(t) {
|
|
3550
3563
|
t.DataCloneError = "DataCloneError";
|
|
3551
|
-
})(
|
|
3564
|
+
})(Dt || (Dt = {}));
|
|
3552
3565
|
var Te;
|
|
3553
3566
|
(function(t) {
|
|
3554
3567
|
t.Message = "message";
|
|
@@ -3578,7 +3591,7 @@ const xa = (t, e) => {
|
|
|
3578
3591
|
r ? (n = r[1] ? r[1] : e.protocol, s = r[2], a = r[4]) : (n = e.protocol, s = e.hostname, a = e.port);
|
|
3579
3592
|
const o = a && a !== Ta[n] ? `:${a}` : "";
|
|
3580
3593
|
return `${n}//${s}${o}`;
|
|
3581
|
-
},
|
|
3594
|
+
}, ar = ({ name: t, message: e, stack: r }) => ({
|
|
3582
3595
|
name: t,
|
|
3583
3596
|
message: e,
|
|
3584
3597
|
stack: r
|
|
@@ -3595,54 +3608,54 @@ const xa = (t, e) => {
|
|
|
3595
3608
|
r(`${n} received message from origin ${f.origin} which did not match expected origin ${c}`);
|
|
3596
3609
|
return;
|
|
3597
3610
|
}
|
|
3598
|
-
const
|
|
3611
|
+
const _ = f.data, { methodName: E, args: x, id: T } = _;
|
|
3599
3612
|
r(`${n}: Received ${E}() call`);
|
|
3600
|
-
const
|
|
3613
|
+
const S = (C) => (Z) => {
|
|
3601
3614
|
if (r(`${n}: Sending ${E}() reply`), u) {
|
|
3602
3615
|
r(`${n}: Unable to send ${E}() reply due to destroyed connection`);
|
|
3603
3616
|
return;
|
|
3604
3617
|
}
|
|
3605
|
-
const
|
|
3618
|
+
const D = {
|
|
3606
3619
|
penpal: ce.Reply,
|
|
3607
3620
|
id: T,
|
|
3608
3621
|
resolution: C,
|
|
3609
|
-
returnValue:
|
|
3622
|
+
returnValue: Z
|
|
3610
3623
|
};
|
|
3611
|
-
C === Re.Rejected &&
|
|
3624
|
+
C === Re.Rejected && Z instanceof Error && (D.returnValue = ar(Z), D.returnValueIsError = !0);
|
|
3612
3625
|
try {
|
|
3613
|
-
a.postMessage(
|
|
3614
|
-
} catch (
|
|
3615
|
-
if (
|
|
3616
|
-
const
|
|
3626
|
+
a.postMessage(D, o);
|
|
3627
|
+
} catch (I) {
|
|
3628
|
+
if (I.name === Dt.DataCloneError) {
|
|
3629
|
+
const G = {
|
|
3617
3630
|
penpal: ce.Reply,
|
|
3618
3631
|
id: T,
|
|
3619
3632
|
resolution: Re.Rejected,
|
|
3620
|
-
returnValue:
|
|
3633
|
+
returnValue: ar(I),
|
|
3621
3634
|
returnValueIsError: !0
|
|
3622
3635
|
};
|
|
3623
|
-
a.postMessage(
|
|
3636
|
+
a.postMessage(G, o);
|
|
3624
3637
|
}
|
|
3625
|
-
throw
|
|
3638
|
+
throw I;
|
|
3626
3639
|
}
|
|
3627
3640
|
};
|
|
3628
|
-
new Promise((C) => C(e[E].apply(e, x))).then(
|
|
3641
|
+
new Promise((C) => C(e[E].apply(e, x))).then(S(Re.Fulfilled), S(Re.Rejected));
|
|
3629
3642
|
};
|
|
3630
3643
|
return s.addEventListener(Te.Message, d), () => {
|
|
3631
3644
|
u = !0, s.removeEventListener(Te.Message, d);
|
|
3632
3645
|
};
|
|
3633
3646
|
};
|
|
3634
3647
|
let Ia = 0;
|
|
3635
|
-
const Aa = () => ++Ia,
|
|
3636
|
-
const r =
|
|
3648
|
+
const Aa = () => ++Ia, Ar = ".", Nr = (t) => t ? t.split(Ar) : [], Na = (t) => t.join(Ar), ja = (t, e) => {
|
|
3649
|
+
const r = Nr(e || "");
|
|
3637
3650
|
return r.push(t), Na(r);
|
|
3638
3651
|
}, Ma = (t, e, r) => {
|
|
3639
|
-
const n =
|
|
3652
|
+
const n = Nr(e);
|
|
3640
3653
|
return n.reduce((s, a, o) => (typeof s[a] > "u" && (s[a] = {}), o === n.length - 1 && (s[a] = r), s[a]), t), t;
|
|
3641
|
-
},
|
|
3654
|
+
}, jr = (t, e) => {
|
|
3642
3655
|
const r = {};
|
|
3643
3656
|
return Object.keys(t).forEach((n) => {
|
|
3644
3657
|
const s = t[n], a = ja(n, e);
|
|
3645
|
-
typeof s == "object" && Object.assign(r,
|
|
3658
|
+
typeof s == "object" && Object.assign(r, jr(s, a)), typeof s == "function" && (r[a] = s);
|
|
3646
3659
|
}), r;
|
|
3647
3660
|
}, Za = (t) => {
|
|
3648
3661
|
const e = {};
|
|
@@ -3653,41 +3666,41 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3653
3666
|
const { localName: a, local: o, remote: c, originForSending: u, originForReceiving: d } = e;
|
|
3654
3667
|
let f = !1;
|
|
3655
3668
|
s(`${a}: Connecting call sender`);
|
|
3656
|
-
const
|
|
3669
|
+
const _ = (x) => (...T) => {
|
|
3657
3670
|
s(`${a}: Sending ${x}() call`);
|
|
3658
|
-
let
|
|
3671
|
+
let S;
|
|
3659
3672
|
try {
|
|
3660
|
-
c.closed && (
|
|
3673
|
+
c.closed && (S = !0);
|
|
3661
3674
|
} catch {
|
|
3662
|
-
|
|
3675
|
+
S = !0;
|
|
3663
3676
|
}
|
|
3664
|
-
if (
|
|
3677
|
+
if (S && n(), f) {
|
|
3665
3678
|
const C = new Error(`Unable to send ${x}() call due to destroyed connection`);
|
|
3666
3679
|
throw C.code = it.ConnectionDestroyed, C;
|
|
3667
3680
|
}
|
|
3668
|
-
return new Promise((C,
|
|
3669
|
-
const
|
|
3670
|
-
if (
|
|
3681
|
+
return new Promise((C, Z) => {
|
|
3682
|
+
const D = Aa(), I = (J) => {
|
|
3683
|
+
if (J.source !== c || J.data.penpal !== ce.Reply || J.data.id !== D)
|
|
3671
3684
|
return;
|
|
3672
|
-
if (d !== "*" &&
|
|
3673
|
-
s(`${a} received message from origin ${
|
|
3685
|
+
if (d !== "*" && J.origin !== d) {
|
|
3686
|
+
s(`${a} received message from origin ${J.origin} which did not match expected origin ${d}`);
|
|
3674
3687
|
return;
|
|
3675
3688
|
}
|
|
3676
|
-
const
|
|
3677
|
-
s(`${a}: Received ${x}() reply`), o.removeEventListener(Te.Message,
|
|
3678
|
-
let
|
|
3679
|
-
|
|
3689
|
+
const L = J.data;
|
|
3690
|
+
s(`${a}: Received ${x}() reply`), o.removeEventListener(Te.Message, I);
|
|
3691
|
+
let H = L.returnValue;
|
|
3692
|
+
L.returnValueIsError && (H = Oa(H)), (L.resolution === Re.Fulfilled ? C : Z)(H);
|
|
3680
3693
|
};
|
|
3681
|
-
o.addEventListener(Te.Message,
|
|
3682
|
-
const
|
|
3694
|
+
o.addEventListener(Te.Message, I);
|
|
3695
|
+
const G = {
|
|
3683
3696
|
penpal: ce.Call,
|
|
3684
|
-
id:
|
|
3697
|
+
id: D,
|
|
3685
3698
|
methodName: x,
|
|
3686
3699
|
args: T
|
|
3687
3700
|
};
|
|
3688
|
-
c.postMessage(
|
|
3701
|
+
c.postMessage(G, u);
|
|
3689
3702
|
});
|
|
3690
|
-
}, E = r.reduce((x, T) => (x[T] =
|
|
3703
|
+
}, E = r.reduce((x, T) => (x[T] = _(T), x), {});
|
|
3691
3704
|
return Object.assign(t, Za(E)), () => {
|
|
3692
3705
|
f = !0;
|
|
3693
3706
|
};
|
|
@@ -3701,17 +3714,17 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3701
3714
|
return;
|
|
3702
3715
|
}
|
|
3703
3716
|
s("Parent: Handshake - Received ACK");
|
|
3704
|
-
const
|
|
3717
|
+
const _ = {
|
|
3705
3718
|
localName: "Parent",
|
|
3706
3719
|
local: window,
|
|
3707
3720
|
remote: f.source,
|
|
3708
3721
|
originForSending: r,
|
|
3709
3722
|
originForReceiving: e
|
|
3710
3723
|
};
|
|
3711
|
-
c && c(), c = Pa(
|
|
3724
|
+
c && c(), c = Pa(_, t, s), o(c), u && u.forEach((x) => {
|
|
3712
3725
|
delete d[x];
|
|
3713
3726
|
}), u = f.data.methodNames;
|
|
3714
|
-
const E = Da(d,
|
|
3727
|
+
const E = Da(d, _, u, a, s);
|
|
3715
3728
|
return o(E), d;
|
|
3716
3729
|
};
|
|
3717
3730
|
}, La = (t, e, r, n) => (s) => {
|
|
@@ -3751,24 +3764,24 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3751
3764
|
let { iframe: e, methods: r = {}, childOrigin: n, timeout: s, debug: a = !1 } = t;
|
|
3752
3765
|
const o = ka(a), c = xa("Parent", o), { onDestroy: u, destroy: d } = c;
|
|
3753
3766
|
n || (za(e), n = Ra(e.src));
|
|
3754
|
-
const f = n === "null" ? "*" : n,
|
|
3767
|
+
const f = n === "null" ? "*" : n, _ = jr(r), E = La(o, _, n, f), x = $a(_, n, f, c, o);
|
|
3755
3768
|
return {
|
|
3756
|
-
promise: new Promise((
|
|
3757
|
-
const
|
|
3758
|
-
if (!(
|
|
3759
|
-
if (
|
|
3760
|
-
E(
|
|
3769
|
+
promise: new Promise((S, C) => {
|
|
3770
|
+
const Z = Fa(s, d), D = (I) => {
|
|
3771
|
+
if (!(I.source !== e.contentWindow || !I.data)) {
|
|
3772
|
+
if (I.data.penpal === ce.Syn) {
|
|
3773
|
+
E(I);
|
|
3761
3774
|
return;
|
|
3762
3775
|
}
|
|
3763
|
-
if (
|
|
3764
|
-
const
|
|
3765
|
-
|
|
3776
|
+
if (I.data.penpal === ce.Ack) {
|
|
3777
|
+
const G = x(I);
|
|
3778
|
+
G && (Z(), S(G));
|
|
3766
3779
|
return;
|
|
3767
3780
|
}
|
|
3768
3781
|
}
|
|
3769
3782
|
};
|
|
3770
|
-
window.addEventListener(Te.Message,
|
|
3771
|
-
window.removeEventListener(Te.Message,
|
|
3783
|
+
window.addEventListener(Te.Message, D), o("Parent: Awaiting handshake"), Va(e, c), u((I) => {
|
|
3784
|
+
window.removeEventListener(Te.Message, D), I && C(I);
|
|
3772
3785
|
});
|
|
3773
3786
|
}),
|
|
3774
3787
|
destroy() {
|
|
@@ -3776,7 +3789,7 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3776
3789
|
}
|
|
3777
3790
|
};
|
|
3778
3791
|
}, Ba = () => {
|
|
3779
|
-
const [t, e] =
|
|
3792
|
+
const [t, e] = O({ status: "none" }), r = async (n) => {
|
|
3780
3793
|
if (t.status !== "none")
|
|
3781
3794
|
return;
|
|
3782
3795
|
e({ status: "connecting" });
|
|
@@ -3825,68 +3838,70 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3825
3838
|
onLoadError: u,
|
|
3826
3839
|
onValidationError: d,
|
|
3827
3840
|
onCheckoutStarted: f,
|
|
3828
|
-
onCheckoutSuccess:
|
|
3841
|
+
onCheckoutSuccess: _,
|
|
3829
3842
|
onCheckoutError: E,
|
|
3830
3843
|
onSetupPaymentMethodSuccess: x,
|
|
3831
3844
|
baseUrl: T,
|
|
3832
|
-
enableDynamicPreviews:
|
|
3833
|
-
} = t, C = T ??
|
|
3845
|
+
enableDynamicPreviews: S
|
|
3846
|
+
} = t, C = T ?? Os, [Z, D] = O(void 0), [I, G] = O([]), [J, L] = O("1px"), [H, Et] = O(!1), [z, Le] = O(void 0), [qt, Ce] = O(!1), [ye, Mr] = O([]), [ge, Zr] = O({}), [Bt, ct] = O(0), [Ht, se] = O(!1), [ae, Dr] = O(void 0), [Wt, $r] = O(void 0), [Kt, Lr] = O(void 0), [le, Ur] = O(void 0), [xt, Vr] = O(void 0), fe = ze(() => `opjs-form-${or()}`, []), X = qe(null);
|
|
3834
3847
|
pe(() => {
|
|
3835
|
-
const
|
|
3836
|
-
window.ojs_version =
|
|
3848
|
+
const R = { version: "0.0.24", release_version: "local_build" };
|
|
3849
|
+
window.ojs_version = R;
|
|
3837
3850
|
}, []);
|
|
3838
|
-
const { cdeConn: Ae, connectToCdeIframe:
|
|
3839
|
-
|
|
3851
|
+
const { cdeConn: Ae, connectToCdeIframe: Yt } = Ba(), Jt = pa(
|
|
3852
|
+
S ?? !1,
|
|
3840
3853
|
Ae,
|
|
3841
3854
|
r,
|
|
3842
|
-
|
|
3843
|
-
),
|
|
3844
|
-
(
|
|
3845
|
-
if (
|
|
3846
|
-
const
|
|
3847
|
-
if (!Ka(
|
|
3855
|
+
X.current
|
|
3856
|
+
), kt = ve(
|
|
3857
|
+
(R) => {
|
|
3858
|
+
if (R.origin !== C || !R.source) return;
|
|
3859
|
+
const q = R.source;
|
|
3860
|
+
if (!Ka(R.data))
|
|
3848
3861
|
return;
|
|
3849
|
-
const
|
|
3850
|
-
if (
|
|
3862
|
+
const Q = JSON.parse(R.data), B = Rs(Q), Se = B.elementId;
|
|
3863
|
+
if (B.formId !== fe || !Se || B.nonce in I)
|
|
3851
3864
|
return;
|
|
3852
|
-
|
|
3853
|
-
const A =
|
|
3854
|
-
if (
|
|
3855
|
-
const
|
|
3856
|
-
|
|
3857
|
-
} else if (
|
|
3858
|
-
s(
|
|
3859
|
-
else if (
|
|
3860
|
-
a(
|
|
3861
|
-
else if (
|
|
3862
|
-
o(
|
|
3863
|
-
else if (
|
|
3864
|
-
const
|
|
3865
|
-
if (Ce(!1), !
|
|
3865
|
+
G((V) => [...V, B.nonce]);
|
|
3866
|
+
const A = B.payload, U = A.type;
|
|
3867
|
+
if (U === k.enum.LAYOUT) {
|
|
3868
|
+
const V = A.height ? `${A.height}px` : "100%";
|
|
3869
|
+
L(V);
|
|
3870
|
+
} else if (U === k.enum.FOCUS && s)
|
|
3871
|
+
s(B.elementId);
|
|
3872
|
+
else if (U === k.enum.BLUR && a)
|
|
3873
|
+
a(B.elementId);
|
|
3874
|
+
else if (U === k.enum.CHANGE && o)
|
|
3875
|
+
o(B.elementId);
|
|
3876
|
+
else if (U === k.enum.LOADED) {
|
|
3877
|
+
const V = ye.find((j) => j.contentWindow === q);
|
|
3878
|
+
if (Ce(!1), !V)
|
|
3866
3879
|
return;
|
|
3867
|
-
|
|
3868
|
-
} else if (
|
|
3869
|
-
Ce(!0)
|
|
3870
|
-
else if (
|
|
3871
|
-
|
|
3880
|
+
Zr((j) => ({ ...j, [Se]: q })), Lr(A.totalAmountAtoms), $r(A.currency), Ur(A.checkoutPaymentMethods), ae || Dr(A.sessionId);
|
|
3881
|
+
} else if (U === k.enum.TOKENIZE_STARTED)
|
|
3882
|
+
Ce(!0);
|
|
3883
|
+
else if (U === k.enum.CHECKOUT_STARTED)
|
|
3884
|
+
f && f();
|
|
3885
|
+
else if (U === k.enum.PAYMENT_FLOW_STARTED) {
|
|
3886
|
+
if (!z)
|
|
3872
3887
|
throw new Error("extraData not populated");
|
|
3873
3888
|
if (!Ae)
|
|
3874
3889
|
throw new Error("Not connected to CDE");
|
|
3875
3890
|
(async () => {
|
|
3876
|
-
const
|
|
3877
|
-
if (
|
|
3891
|
+
const j = A.nextActionMetadata.type;
|
|
3892
|
+
if (j !== void 0) if (j === "stripe_3ds")
|
|
3878
3893
|
await js(A);
|
|
3879
|
-
else if (
|
|
3880
|
-
if (!
|
|
3894
|
+
else if (j === "stripe_payment_request") {
|
|
3895
|
+
if (!xt)
|
|
3881
3896
|
throw new Error("Stripe PM not set");
|
|
3882
|
-
await Ns(A,
|
|
3897
|
+
await Ns(A, xt);
|
|
3883
3898
|
} else
|
|
3884
|
-
throw new Error(`Unknown next action type: ${
|
|
3885
|
-
const
|
|
3886
|
-
if (
|
|
3899
|
+
throw new Error(`Unknown next action type: ${j}`);
|
|
3900
|
+
const ee = await zt(Ae);
|
|
3901
|
+
if (ee.mode === "setup") {
|
|
3887
3902
|
const { payment_methods: ie } = await fa(Ae, {
|
|
3888
|
-
secure_token:
|
|
3889
|
-
existing_cc_pm_id:
|
|
3903
|
+
secure_token: ee.token,
|
|
3904
|
+
existing_cc_pm_id: z.existingCCPMId
|
|
3890
3905
|
});
|
|
3891
3906
|
if (ie.length !== 1)
|
|
3892
3907
|
throw new Error(`Expected exactly one payment method, got ${ie.length}`);
|
|
@@ -3897,54 +3912,54 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3897
3912
|
return {
|
|
3898
3913
|
proceedToCheckout: !0
|
|
3899
3914
|
};
|
|
3900
|
-
})().then(({ proceedToCheckout:
|
|
3915
|
+
})().then(({ proceedToCheckout: j }) => {
|
|
3901
3916
|
var ie;
|
|
3902
|
-
if (!
|
|
3917
|
+
if (!j)
|
|
3903
3918
|
return;
|
|
3904
|
-
let
|
|
3905
|
-
if (
|
|
3919
|
+
let ee;
|
|
3920
|
+
if (z.checkoutPaymentMethod.provider === "credit_card" && (ee = (ie = A.startPFMetadata) == null ? void 0 : ie.cc_pm_id, !ee))
|
|
3906
3921
|
throw new Error("CC PM ID not found");
|
|
3907
3922
|
Ue(
|
|
3908
|
-
|
|
3923
|
+
q,
|
|
3909
3924
|
fe,
|
|
3910
3925
|
Se,
|
|
3911
|
-
{ ...
|
|
3926
|
+
{ ...z, type: "CHECKOUT", doNotUseLegacyCCFlow: !0, existingCCPMId: ee },
|
|
3912
3927
|
C
|
|
3913
3928
|
), se(!0), Le(void 0), f && f();
|
|
3914
|
-
}).catch((
|
|
3915
|
-
const
|
|
3916
|
-
Ce(!1), se(!1), E && E(
|
|
3929
|
+
}).catch((j) => {
|
|
3930
|
+
const ee = Vt(j);
|
|
3931
|
+
Ce(!1), se(!1), E && E(ee);
|
|
3917
3932
|
});
|
|
3918
|
-
} else if (
|
|
3919
|
-
const
|
|
3920
|
-
!
|
|
3921
|
-
} else if (
|
|
3922
|
-
Ce(!1), ct(0), se(!1),
|
|
3923
|
-
else if (
|
|
3933
|
+
} else if (U === k.enum.TOKENIZE_SUCCESS && z) {
|
|
3934
|
+
const V = Bt + 1, j = V === Object.keys(ge).length;
|
|
3935
|
+
!Ht && (j || A.isReadyForCheckout) ? (Ue(q, fe, Se, z, C), se(!0), Le(void 0)) : ct(V);
|
|
3936
|
+
} else if (U === k.enum.CHECKOUT_SUCCESS)
|
|
3937
|
+
Ce(!1), ct(0), se(!1), _ && _(A.invoiceUrls, A.subscriptionIds, A.customerId);
|
|
3938
|
+
else if (U === k.enum.SETUP_PAYMENT_METHOD_SUCCESS)
|
|
3924
3939
|
Ce(!1), ct(0), se(!1), x && x(A.paymentMethodId);
|
|
3925
|
-
else if (
|
|
3940
|
+
else if (U === k.enum.LOAD_ERROR)
|
|
3926
3941
|
u && u(A.message);
|
|
3927
|
-
else if (
|
|
3928
|
-
const
|
|
3929
|
-
(
|
|
3930
|
-
} else if (
|
|
3942
|
+
else if (U === k.enum.VALIDATION_ERROR) {
|
|
3943
|
+
const V = z == null ? void 0 : z.checkoutPaymentMethod.provider;
|
|
3944
|
+
(V === "credit_card" || V === void 0) && d && d(A.elementType, A.errors, Se);
|
|
3945
|
+
} else if (U === k.enum.TOKENIZE_ERROR || U === k.enum.CHECKOUT_ERROR)
|
|
3931
3946
|
if (A.message === "3DS_REQUIRED") {
|
|
3932
|
-
const
|
|
3933
|
-
if (!ae || !
|
|
3934
|
-
for (const [
|
|
3935
|
-
if (!
|
|
3947
|
+
const V = le == null ? void 0 : le.find((j) => j.provider === "credit_card");
|
|
3948
|
+
if (!ae || !X.current || !d || !V) return;
|
|
3949
|
+
for (const [j, ee] of Object.entries(ge)) {
|
|
3950
|
+
if (!ee) continue;
|
|
3936
3951
|
const ie = lt(
|
|
3937
3952
|
k.enum.START_PAYMENT_FLOW,
|
|
3938
3953
|
ae,
|
|
3939
|
-
|
|
3954
|
+
X.current,
|
|
3940
3955
|
d,
|
|
3941
3956
|
// Only stripe supports frontend 3DS right now,
|
|
3942
3957
|
// so we pass processor_name: 'stripe' to tell delegator to only use stripe
|
|
3943
|
-
{ ...
|
|
3958
|
+
{ ...V, processor_name: "stripe" },
|
|
3944
3959
|
!1
|
|
3945
3960
|
);
|
|
3946
3961
|
if (ie) {
|
|
3947
|
-
se(!0), Le(ie), Ue(
|
|
3962
|
+
se(!0), Le(ie), Ue(ee, fe, j, ie, C);
|
|
3948
3963
|
break;
|
|
3949
3964
|
}
|
|
3950
3965
|
}
|
|
@@ -3954,120 +3969,129 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
3954
3969
|
[
|
|
3955
3970
|
fe,
|
|
3956
3971
|
ae,
|
|
3957
|
-
|
|
3958
|
-
|
|
3972
|
+
I,
|
|
3973
|
+
z,
|
|
3959
3974
|
ye,
|
|
3960
3975
|
ge,
|
|
3961
|
-
|
|
3962
|
-
|
|
3976
|
+
Bt,
|
|
3977
|
+
Ht,
|
|
3963
3978
|
a,
|
|
3964
3979
|
o,
|
|
3965
3980
|
s,
|
|
3966
3981
|
u,
|
|
3967
3982
|
f,
|
|
3968
|
-
|
|
3983
|
+
_,
|
|
3969
3984
|
x,
|
|
3970
3985
|
E,
|
|
3971
3986
|
d,
|
|
3972
3987
|
C,
|
|
3973
|
-
|
|
3988
|
+
xt,
|
|
3974
3989
|
le,
|
|
3975
3990
|
Ae
|
|
3976
3991
|
]
|
|
3977
|
-
),
|
|
3978
|
-
if (!
|
|
3979
|
-
const
|
|
3980
|
-
if (!
|
|
3992
|
+
), Fr = ve(() => {
|
|
3993
|
+
if (!X.current || !d || !ae || !le) return;
|
|
3994
|
+
const R = le.find((Q) => Q.provider === "credit_card");
|
|
3995
|
+
if (!R)
|
|
3981
3996
|
throw new Error("Card not available as a payment method in checkout");
|
|
3982
|
-
const
|
|
3997
|
+
const q = lt(
|
|
3983
3998
|
k.enum.TOKENIZE,
|
|
3984
3999
|
ae,
|
|
3985
|
-
|
|
4000
|
+
X.current,
|
|
3986
4001
|
d,
|
|
3987
|
-
|
|
4002
|
+
R,
|
|
3988
4003
|
!1
|
|
3989
4004
|
);
|
|
3990
|
-
if (
|
|
3991
|
-
for (const [
|
|
3992
|
-
|
|
3993
|
-
|
|
4005
|
+
if (q) {
|
|
4006
|
+
for (const [Q, B] of Object.entries(ge))
|
|
4007
|
+
B && Ue(B, fe, Q, q, C);
|
|
4008
|
+
q.type = k.enum.CHECKOUT, Le(q);
|
|
3994
4009
|
}
|
|
3995
|
-
}, [
|
|
3996
|
-
(
|
|
3997
|
-
|
|
4010
|
+
}, [X, ge, fe, d, ae, C, le]), Tt = ve(
|
|
4011
|
+
(R) => {
|
|
4012
|
+
qt && R.preventDefault();
|
|
3998
4013
|
},
|
|
3999
|
-
[
|
|
4014
|
+
[qt]
|
|
4000
4015
|
);
|
|
4001
4016
|
pe(() => {
|
|
4002
|
-
if (
|
|
4003
|
-
ye.length > 0 && ye.length === Object.keys(ge).length && (
|
|
4004
|
-
}, [ye, ge,
|
|
4005
|
-
window.removeEventListener("beforeunload",
|
|
4006
|
-
}), [ae,
|
|
4007
|
-
const
|
|
4008
|
-
(
|
|
4009
|
-
ye.find((
|
|
4017
|
+
if (H || !X.current) return;
|
|
4018
|
+
ye.length > 0 && ye.length === Object.keys(ge).length && (Et(!0), c && c(Kt, Wt));
|
|
4019
|
+
}, [ye, ge, H, c, Kt, Wt]), pe(() => (D(window.location.origin), window.addEventListener("message", kt), window.addEventListener("beforeunload", Tt), () => {
|
|
4020
|
+
window.removeEventListener("beforeunload", Tt), window.removeEventListener("message", kt);
|
|
4021
|
+
}), [ae, kt, Tt]);
|
|
4022
|
+
const zr = ve(
|
|
4023
|
+
(R) => {
|
|
4024
|
+
ye.find((Q) => Q.contentWindow === R.contentWindow) || (ye.length === 0 && Yt(R), Mr((Q) => [...Q, R]));
|
|
4010
4025
|
},
|
|
4011
|
-
[ye,
|
|
4012
|
-
),
|
|
4013
|
-
if (!(!
|
|
4014
|
-
for (const [
|
|
4015
|
-
if (!
|
|
4016
|
-
const Se = {
|
|
4017
|
-
stripePmId:
|
|
4026
|
+
[ye, Yt]
|
|
4027
|
+
), qr = async (R, q) => {
|
|
4028
|
+
if (!(!X.current || !d || !ae || !le))
|
|
4029
|
+
for (const [Q, B] of Object.entries(ge)) {
|
|
4030
|
+
if (!B) continue;
|
|
4031
|
+
const Se = R ? {
|
|
4032
|
+
stripePmId: R.paymentMethod.id,
|
|
4033
|
+
checkoutPaymentMethod: q
|
|
4034
|
+
} : {
|
|
4035
|
+
checkoutPaymentMethod: q
|
|
4018
4036
|
}, dt = lt(
|
|
4019
4037
|
k.enum.START_PAYMENT_FLOW,
|
|
4020
4038
|
ae,
|
|
4021
|
-
|
|
4039
|
+
X.current,
|
|
4022
4040
|
d,
|
|
4023
|
-
|
|
4041
|
+
q,
|
|
4024
4042
|
!1,
|
|
4025
4043
|
Se
|
|
4026
4044
|
);
|
|
4027
4045
|
if (dt) {
|
|
4028
|
-
|
|
4046
|
+
R && Vr(R), se(!0), Le(dt), Ue(B, fe, Q, dt, C);
|
|
4029
4047
|
break;
|
|
4030
4048
|
}
|
|
4031
4049
|
}
|
|
4032
|
-
},
|
|
4033
|
-
se(!1), E && E(
|
|
4034
|
-
},
|
|
4050
|
+
}, Br = (R) => {
|
|
4051
|
+
se(!1), E && E(R);
|
|
4052
|
+
}, Hr = {
|
|
4035
4053
|
formId: fe,
|
|
4036
|
-
formHeight:
|
|
4037
|
-
referer:
|
|
4054
|
+
formHeight: J,
|
|
4055
|
+
referer: Z,
|
|
4038
4056
|
checkoutSecureToken: r,
|
|
4039
|
-
registerIframe:
|
|
4057
|
+
registerIframe: zr,
|
|
4040
4058
|
baseUrl: C
|
|
4041
|
-
},
|
|
4059
|
+
}, Ct = va(
|
|
4042
4060
|
Ae,
|
|
4043
4061
|
r,
|
|
4044
4062
|
le,
|
|
4045
|
-
|
|
4046
|
-
zr,
|
|
4047
|
-
d,
|
|
4063
|
+
X.current,
|
|
4048
4064
|
qr,
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4065
|
+
d,
|
|
4066
|
+
Br,
|
|
4067
|
+
Jt
|
|
4068
|
+
), Wr = {
|
|
4069
|
+
submit: Fr,
|
|
4070
|
+
applePay: Ct.apple_pay,
|
|
4071
|
+
googlePay: Ct.google_pay,
|
|
4072
|
+
stripeLink: {
|
|
4073
|
+
// TODO: uncomment if we need stripe elements later.
|
|
4074
|
+
// Better if we can make stripe link work in prod without elements.
|
|
4075
|
+
// button: stripeElements.isReady ? StripeLinkButton : NoOpElement,
|
|
4076
|
+
// authElement: stripeElements.isReady ? StripeLinkAuthElement : NoOpElement,
|
|
4077
|
+
pr: Ct.stripe_link
|
|
4078
|
+
},
|
|
4079
|
+
loaded: H,
|
|
4080
|
+
preview: Jt
|
|
4057
4081
|
};
|
|
4058
|
-
return /* @__PURE__ */ we(
|
|
4082
|
+
return /* @__PURE__ */ we(ir.Provider, { value: Hr, children: /* @__PURE__ */ we("div", { className: n, ref: X, children: e(Wr) }) });
|
|
4059
4083
|
}, Ya = (t) => JSON.stringify(t), bt = (t) => {
|
|
4060
|
-
const { subPath: e, styles: r } = t, { formId: n, referer: s, formHeight: a, checkoutSecureToken: o, registerIframe: c, baseUrl: u } =
|
|
4084
|
+
const { subPath: e, styles: r } = t, { formId: n, referer: s, formHeight: a, checkoutSecureToken: o, registerIframe: c, baseUrl: u } = Gr(), [d, f] = O(!1), _ = qe(null), E = ze(() => r ? Ya(r) : "", [r]), x = ze(() => ({
|
|
4061
4085
|
border: "none",
|
|
4062
4086
|
width: "100%",
|
|
4063
4087
|
height: a
|
|
4064
4088
|
}), [a]), T = ze(() => {
|
|
4065
4089
|
if (!o || !s) return "";
|
|
4066
|
-
const
|
|
4067
|
-
return
|
|
4090
|
+
const S = new URLSearchParams();
|
|
4091
|
+
return S.append("referer", s), S.append("styles", E), S.append("formId", n), S.append("secureToken", o), S.toString();
|
|
4068
4092
|
}, [E, n, s, o]);
|
|
4069
4093
|
return pe(() => f(!0), []), pe(() => {
|
|
4070
|
-
!
|
|
4094
|
+
!_.current || !d || c(_.current);
|
|
4071
4095
|
}, [d]), o ? /* @__PURE__ */ we(
|
|
4072
4096
|
"iframe",
|
|
4073
4097
|
{
|
|
@@ -4076,7 +4100,7 @@ const Aa = () => ++Ia, Pr = ".", Ir = (t) => t ? t.split(Pr) : [], Na = (t) => t
|
|
|
4076
4100
|
className: "ojs-iframe",
|
|
4077
4101
|
src: `${u}/app/v1/${e}-element/?${T}`,
|
|
4078
4102
|
style: x,
|
|
4079
|
-
ref:
|
|
4103
|
+
ref: _
|
|
4080
4104
|
}
|
|
4081
4105
|
) : /* @__PURE__ */ we("div", {});
|
|
4082
4106
|
}, 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" });
|
|
@@ -4087,5 +4111,5 @@ export {
|
|
|
4087
4111
|
ri as CardNumberElement,
|
|
4088
4112
|
Xa as ElementsForm,
|
|
4089
4113
|
at as FieldName,
|
|
4090
|
-
|
|
4114
|
+
Gr as useOpenPayElements
|
|
4091
4115
|
};
|