@getopenpay/openpay-js-react 0.0.12-beta → 0.0.13-alpha.fd11f67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +504 -498
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx as
|
|
3
|
-
const jt =
|
|
1
|
+
import _r, { createContext as gr, useContext as xr, useState as N, useMemo as Oe, useCallback as Te, useRef as Zt, useEffect as qe } from "react";
|
|
2
|
+
import { jsx as ae } from "react/jsx-runtime";
|
|
3
|
+
const jt = gr({
|
|
4
4
|
formId: "",
|
|
5
5
|
formHeight: "",
|
|
6
6
|
referer: void 0,
|
|
@@ -15,8 +15,8 @@ const jt = vr({
|
|
|
15
15
|
return r;
|
|
16
16
|
};
|
|
17
17
|
var I = [];
|
|
18
|
-
for (var
|
|
19
|
-
I.push((
|
|
18
|
+
for (var ht = 0; ht < 256; ++ht)
|
|
19
|
+
I.push((ht + 256).toString(16).slice(1));
|
|
20
20
|
function kr(r, e = 0) {
|
|
21
21
|
return (I[r[e + 0]] + I[r[e + 1]] + I[r[e + 2]] + I[r[e + 3]] + "-" + I[r[e + 4]] + I[r[e + 5]] + "-" + I[r[e + 6]] + I[r[e + 7]] + "-" + I[r[e + 8]] + I[r[e + 9]] + "-" + I[r[e + 10]] + I[r[e + 11]] + I[r[e + 12]] + I[r[e + 13]] + I[r[e + 14]] + I[r[e + 15]]).toLowerCase();
|
|
22
22
|
}
|
|
@@ -73,14 +73,14 @@ var x;
|
|
|
73
73
|
}
|
|
74
74
|
r.joinValues = n, r.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
75
75
|
})(x || (x = {}));
|
|
76
|
-
var
|
|
76
|
+
var mt;
|
|
77
77
|
(function(r) {
|
|
78
78
|
r.mergeShapes = (e, t) => ({
|
|
79
79
|
...e,
|
|
80
80
|
...t
|
|
81
81
|
// second overwrites first
|
|
82
82
|
});
|
|
83
|
-
})(
|
|
83
|
+
})(mt || (mt = {}));
|
|
84
84
|
const h = x.arrayToEnum([
|
|
85
85
|
"string",
|
|
86
86
|
"nan",
|
|
@@ -102,7 +102,7 @@ const h = x.arrayToEnum([
|
|
|
102
102
|
"never",
|
|
103
103
|
"map",
|
|
104
104
|
"set"
|
|
105
|
-
]),
|
|
105
|
+
]), se = (r) => {
|
|
106
106
|
switch (typeof r) {
|
|
107
107
|
case "undefined":
|
|
108
108
|
return h.undefined;
|
|
@@ -141,7 +141,7 @@ const h = x.arrayToEnum([
|
|
|
141
141
|
"not_multiple_of",
|
|
142
142
|
"not_finite"
|
|
143
143
|
]), Sr = (r) => JSON.stringify(r, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
144
|
-
class
|
|
144
|
+
class U 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 D extends Error {
|
|
|
178
178
|
return s(this), n;
|
|
179
179
|
}
|
|
180
180
|
static assert(e) {
|
|
181
|
-
if (!(e instanceof
|
|
181
|
+
if (!(e instanceof U))
|
|
182
182
|
throw new Error(`Not a ZodError: ${e}`);
|
|
183
183
|
}
|
|
184
184
|
toString() {
|
|
@@ -200,7 +200,7 @@ class D extends Error {
|
|
|
200
200
|
return this.flatten();
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
|
|
203
|
+
U.create = (r) => new U(r);
|
|
204
204
|
const xe = (r, e) => {
|
|
205
205
|
let t;
|
|
206
206
|
switch (r.code) {
|
|
@@ -257,12 +257,12 @@ const xe = (r, e) => {
|
|
|
257
257
|
}
|
|
258
258
|
return { message: t };
|
|
259
259
|
};
|
|
260
|
-
let
|
|
260
|
+
let Ut = xe;
|
|
261
261
|
function Cr(r) {
|
|
262
|
-
|
|
262
|
+
Ut = r;
|
|
263
263
|
}
|
|
264
264
|
function He() {
|
|
265
|
-
return
|
|
265
|
+
return Ut;
|
|
266
266
|
}
|
|
267
267
|
const Ke = (r) => {
|
|
268
268
|
const { data: e, path: t, errorMaps: n, issueData: s } = r, a = [...t, ...s.path || []], i = {
|
|
@@ -300,7 +300,7 @@ function f(r, e) {
|
|
|
300
300
|
});
|
|
301
301
|
r.common.issues.push(n);
|
|
302
302
|
}
|
|
303
|
-
class
|
|
303
|
+
class A {
|
|
304
304
|
constructor() {
|
|
305
305
|
this.value = "valid";
|
|
306
306
|
}
|
|
@@ -314,7 +314,7 @@ class P {
|
|
|
314
314
|
const n = [];
|
|
315
315
|
for (const s of t) {
|
|
316
316
|
if (s.status === "aborted")
|
|
317
|
-
return
|
|
317
|
+
return v;
|
|
318
318
|
s.status === "dirty" && e.dirty(), n.push(s.value);
|
|
319
319
|
}
|
|
320
320
|
return { status: e.value, value: n };
|
|
@@ -328,27 +328,27 @@ class P {
|
|
|
328
328
|
value: i
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
return
|
|
331
|
+
return A.mergeObjectSync(e, n);
|
|
332
332
|
}
|
|
333
333
|
static mergeObjectSync(e, t) {
|
|
334
334
|
const n = {};
|
|
335
335
|
for (const s of t) {
|
|
336
336
|
const { key: a, value: i } = s;
|
|
337
337
|
if (a.status === "aborted" || i.status === "aborted")
|
|
338
|
-
return
|
|
338
|
+
return v;
|
|
339
339
|
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
|
|
340
340
|
}
|
|
341
341
|
return { status: e.value, value: n };
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
|
-
const
|
|
344
|
+
const v = Object.freeze({
|
|
345
345
|
status: "aborted"
|
|
346
|
-
}),
|
|
346
|
+
}), _e = (r) => ({ status: "dirty", value: r }), Z = (r) => ({ status: "valid", value: r }), yt = (r) => r.status === "aborted", vt = (r) => r.status === "dirty", Re = (r) => r.status === "valid", Ie = (r) => typeof Promise < "u" && r instanceof Promise;
|
|
347
347
|
function Ye(r, e, t, n) {
|
|
348
348
|
if (typeof e == "function" ? r !== e || !n : !e.has(r)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
349
349
|
return e.get(r);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function Dt(r, e, t, n, s) {
|
|
352
352
|
if (typeof e == "function" ? r !== e || !s : !e.has(r)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
353
353
|
return e.set(r, t), t;
|
|
354
354
|
}
|
|
@@ -357,7 +357,7 @@ var m;
|
|
|
357
357
|
r.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, r.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
358
358
|
})(m || (m = {}));
|
|
359
359
|
var Se, Ce;
|
|
360
|
-
class
|
|
360
|
+
class K {
|
|
361
361
|
constructor(e, t, n, s) {
|
|
362
362
|
this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = s;
|
|
363
363
|
}
|
|
@@ -375,12 +375,12 @@ const Rt = (r, e) => {
|
|
|
375
375
|
get error() {
|
|
376
376
|
if (this._error)
|
|
377
377
|
return this._error;
|
|
378
|
-
const t = new
|
|
378
|
+
const t = new U(r.common.issues);
|
|
379
379
|
return this._error = t, this._error;
|
|
380
380
|
}
|
|
381
381
|
};
|
|
382
382
|
};
|
|
383
|
-
function
|
|
383
|
+
function _(r) {
|
|
384
384
|
if (!r)
|
|
385
385
|
return {};
|
|
386
386
|
const { errorMap: e, invalid_type_error: t, required_error: n, description: s } = r;
|
|
@@ -392,7 +392,7 @@ function g(r) {
|
|
|
392
392
|
return i.code === "invalid_enum_value" ? { message: p ?? o.defaultError } : typeof o.data > "u" ? { message: (u = p ?? n) !== null && u !== void 0 ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (c = p ?? t) !== null && c !== void 0 ? c : o.defaultError };
|
|
393
393
|
}, description: s };
|
|
394
394
|
}
|
|
395
|
-
class
|
|
395
|
+
class g {
|
|
396
396
|
constructor(e) {
|
|
397
397
|
this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this);
|
|
398
398
|
}
|
|
@@ -400,13 +400,13 @@ class v {
|
|
|
400
400
|
return this._def.description;
|
|
401
401
|
}
|
|
402
402
|
_getType(e) {
|
|
403
|
-
return
|
|
403
|
+
return se(e.data);
|
|
404
404
|
}
|
|
405
405
|
_getOrReturnCtx(e, t) {
|
|
406
406
|
return t || {
|
|
407
407
|
common: e.parent.common,
|
|
408
408
|
data: e.data,
|
|
409
|
-
parsedType:
|
|
409
|
+
parsedType: se(e.data),
|
|
410
410
|
schemaErrorMap: this._def.errorMap,
|
|
411
411
|
path: e.path,
|
|
412
412
|
parent: e.parent
|
|
@@ -414,11 +414,11 @@ class v {
|
|
|
414
414
|
}
|
|
415
415
|
_processInputParams(e) {
|
|
416
416
|
return {
|
|
417
|
-
status: new
|
|
417
|
+
status: new A(),
|
|
418
418
|
ctx: {
|
|
419
419
|
common: e.parent.common,
|
|
420
420
|
data: e.data,
|
|
421
|
-
parsedType:
|
|
421
|
+
parsedType: se(e.data),
|
|
422
422
|
schemaErrorMap: this._def.errorMap,
|
|
423
423
|
path: e.path,
|
|
424
424
|
parent: e.parent
|
|
@@ -453,7 +453,7 @@ class v {
|
|
|
453
453
|
schemaErrorMap: this._def.errorMap,
|
|
454
454
|
parent: null,
|
|
455
455
|
data: e,
|
|
456
|
-
parsedType:
|
|
456
|
+
parsedType: se(e)
|
|
457
457
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
458
458
|
return Rt(s, a);
|
|
459
459
|
}
|
|
@@ -474,7 +474,7 @@ class v {
|
|
|
474
474
|
schemaErrorMap: this._def.errorMap,
|
|
475
475
|
parent: null,
|
|
476
476
|
data: e,
|
|
477
|
-
parsedType:
|
|
477
|
+
parsedType: se(e)
|
|
478
478
|
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (Ie(s) ? s : Promise.resolve(s));
|
|
479
479
|
return Rt(n, a);
|
|
480
480
|
}
|
|
@@ -492,7 +492,7 @@ class v {
|
|
|
492
492
|
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof t == "function" ? t(n, s) : t), !1));
|
|
493
493
|
}
|
|
494
494
|
_refinement(e) {
|
|
495
|
-
return new
|
|
495
|
+
return new B({
|
|
496
496
|
schema: this,
|
|
497
497
|
typeName: y.ZodEffects,
|
|
498
498
|
effect: { type: "refinement", refinement: e }
|
|
@@ -502,16 +502,16 @@ class v {
|
|
|
502
502
|
return this._refinement(e);
|
|
503
503
|
}
|
|
504
504
|
optional() {
|
|
505
|
-
return
|
|
505
|
+
return H.create(this, this._def);
|
|
506
506
|
}
|
|
507
507
|
nullable() {
|
|
508
|
-
return
|
|
508
|
+
return de.create(this, this._def);
|
|
509
509
|
}
|
|
510
510
|
nullish() {
|
|
511
511
|
return this.nullable().optional();
|
|
512
512
|
}
|
|
513
513
|
array() {
|
|
514
|
-
return
|
|
514
|
+
return F.create(this, this._def);
|
|
515
515
|
}
|
|
516
516
|
promise() {
|
|
517
517
|
return ke.create(this, this._def);
|
|
@@ -523,8 +523,8 @@ class v {
|
|
|
523
523
|
return je.create(this, e, this._def);
|
|
524
524
|
}
|
|
525
525
|
transform(e) {
|
|
526
|
-
return new
|
|
527
|
-
...
|
|
526
|
+
return new B({
|
|
527
|
+
..._(this._def),
|
|
528
528
|
schema: this,
|
|
529
529
|
typeName: y.ZodEffects,
|
|
530
530
|
effect: { type: "transform", transform: e }
|
|
@@ -533,23 +533,23 @@ class v {
|
|
|
533
533
|
default(e) {
|
|
534
534
|
const t = typeof e == "function" ? e : () => e;
|
|
535
535
|
return new $e({
|
|
536
|
-
...
|
|
536
|
+
..._(this._def),
|
|
537
537
|
innerType: this,
|
|
538
538
|
defaultValue: t,
|
|
539
539
|
typeName: y.ZodDefault
|
|
540
540
|
});
|
|
541
541
|
}
|
|
542
542
|
brand() {
|
|
543
|
-
return new
|
|
543
|
+
return new xt({
|
|
544
544
|
typeName: y.ZodBranded,
|
|
545
545
|
type: this,
|
|
546
|
-
...
|
|
546
|
+
..._(this._def)
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
549
|
catch(e) {
|
|
550
550
|
const t = typeof e == "function" ? e : () => e;
|
|
551
551
|
return new Ve({
|
|
552
|
-
...
|
|
552
|
+
..._(this._def),
|
|
553
553
|
innerType: this,
|
|
554
554
|
catchValue: t,
|
|
555
555
|
typeName: y.ZodCatch
|
|
@@ -575,9 +575,9 @@ class v {
|
|
|
575
575
|
return this.safeParse(null).success;
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
|
-
const Rr = /^c[^\s-]{8,}$/i, Ir = /^[0-9a-z]+$/, Nr = /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
579
|
-
let
|
|
580
|
-
const
|
|
578
|
+
const Rr = /^c[^\s-]{8,}$/i, Ir = /^[0-9a-z]+$/, Nr = /^[0-9A-HJKMNP-TV-Z]{26}$/, Ar = /^[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, Pr = /^[a-z0-9_-]{21}$/i, Zr = /^[-+]?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)?)??$/, jr = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Mr = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
579
|
+
let pt;
|
|
580
|
+
const Ur = /^(?:(?: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])$/, Dr = /^(([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})))$/, Lr = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Lt = "((\\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])))", $r = new RegExp(`^${Lt}$`);
|
|
581
581
|
function $t(r) {
|
|
582
582
|
let e = "([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";
|
|
583
583
|
return r.precision ? e = `${e}\\.\\d{${r.precision}}` : r.precision == null && (e = `${e}(\\.\\d+)?`), e;
|
|
@@ -591,9 +591,9 @@ function Vt(r) {
|
|
|
591
591
|
return t.push(r.local ? "Z?" : "Z"), r.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
|
|
592
592
|
}
|
|
593
593
|
function zr(r, e) {
|
|
594
|
-
return !!((e === "v4" || !e) &&
|
|
594
|
+
return !!((e === "v4" || !e) && Ur.test(r) || (e === "v6" || !e) && Dr.test(r));
|
|
595
595
|
}
|
|
596
|
-
class
|
|
596
|
+
class z extends g {
|
|
597
597
|
_parse(e) {
|
|
598
598
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
|
|
599
599
|
const a = this._getOrReturnCtx(e);
|
|
@@ -601,9 +601,9 @@ class F extends v {
|
|
|
601
601
|
code: d.invalid_type,
|
|
602
602
|
expected: h.string,
|
|
603
603
|
received: a.parsedType
|
|
604
|
-
}),
|
|
604
|
+
}), v;
|
|
605
605
|
}
|
|
606
|
-
const n = new
|
|
606
|
+
const n = new A();
|
|
607
607
|
let s;
|
|
608
608
|
for (const a of this._def.checks)
|
|
609
609
|
if (a.kind === "min")
|
|
@@ -648,19 +648,19 @@ class F extends v {
|
|
|
648
648
|
message: a.message
|
|
649
649
|
}), n.dirty());
|
|
650
650
|
else if (a.kind === "emoji")
|
|
651
|
-
|
|
651
|
+
pt || (pt = new RegExp(Mr, "u")), pt.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
652
652
|
validation: "emoji",
|
|
653
653
|
code: d.invalid_string,
|
|
654
654
|
message: a.message
|
|
655
655
|
}), n.dirty());
|
|
656
656
|
else if (a.kind === "uuid")
|
|
657
|
-
|
|
657
|
+
Ar.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
658
658
|
validation: "uuid",
|
|
659
659
|
code: d.invalid_string,
|
|
660
660
|
message: a.message
|
|
661
661
|
}), n.dirty());
|
|
662
662
|
else if (a.kind === "nanoid")
|
|
663
|
-
|
|
663
|
+
Pr.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
|
|
664
664
|
validation: "nanoid",
|
|
665
665
|
code: d.invalid_string,
|
|
666
666
|
message: a.message
|
|
@@ -744,7 +744,7 @@ class F extends v {
|
|
|
744
744
|
});
|
|
745
745
|
}
|
|
746
746
|
_addCheck(e) {
|
|
747
|
-
return new
|
|
747
|
+
return new z({
|
|
748
748
|
...this._def,
|
|
749
749
|
checks: [...this._def.checks, e]
|
|
750
750
|
});
|
|
@@ -870,19 +870,19 @@ class F extends v {
|
|
|
870
870
|
return this.min(1, m.errToObj(e));
|
|
871
871
|
}
|
|
872
872
|
trim() {
|
|
873
|
-
return new
|
|
873
|
+
return new z({
|
|
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 z({
|
|
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 z({
|
|
886
886
|
...this._def,
|
|
887
887
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
888
888
|
});
|
|
@@ -942,20 +942,20 @@ class F extends v {
|
|
|
942
942
|
return e;
|
|
943
943
|
}
|
|
944
944
|
}
|
|
945
|
-
|
|
945
|
+
z.create = (r) => {
|
|
946
946
|
var e;
|
|
947
|
-
return new
|
|
947
|
+
return new z({
|
|
948
948
|
checks: [],
|
|
949
949
|
typeName: y.ZodString,
|
|
950
950
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
951
|
-
...
|
|
951
|
+
..._(r)
|
|
952
952
|
});
|
|
953
953
|
};
|
|
954
954
|
function Fr(r, e) {
|
|
955
955
|
const t = (r.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = t > n ? t : n, a = parseInt(r.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
956
956
|
return a % i / Math.pow(10, s);
|
|
957
957
|
}
|
|
958
|
-
class
|
|
958
|
+
class ie extends g {
|
|
959
959
|
constructor() {
|
|
960
960
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
961
961
|
}
|
|
@@ -966,10 +966,10 @@ class oe extends v {
|
|
|
966
966
|
code: d.invalid_type,
|
|
967
967
|
expected: h.number,
|
|
968
968
|
received: a.parsedType
|
|
969
|
-
}),
|
|
969
|
+
}), v;
|
|
970
970
|
}
|
|
971
971
|
let n;
|
|
972
|
-
const s = new
|
|
972
|
+
const s = new A();
|
|
973
973
|
for (const a of this._def.checks)
|
|
974
974
|
a.kind === "int" ? x.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), f(n, {
|
|
975
975
|
code: d.invalid_type,
|
|
@@ -1013,7 +1013,7 @@ class oe extends v {
|
|
|
1013
1013
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1014
1014
|
}
|
|
1015
1015
|
setLimit(e, t, n, s) {
|
|
1016
|
-
return new
|
|
1016
|
+
return new ie({
|
|
1017
1017
|
...this._def,
|
|
1018
1018
|
checks: [
|
|
1019
1019
|
...this._def.checks,
|
|
@@ -1027,7 +1027,7 @@ class oe extends v {
|
|
|
1027
1027
|
});
|
|
1028
1028
|
}
|
|
1029
1029
|
_addCheck(e) {
|
|
1030
|
-
return new
|
|
1030
|
+
return new ie({
|
|
1031
1031
|
...this._def,
|
|
1032
1032
|
checks: [...this._def.checks, e]
|
|
1033
1033
|
});
|
|
@@ -1121,13 +1121,13 @@ class oe extends v {
|
|
|
1121
1121
|
return Number.isFinite(t) && Number.isFinite(e);
|
|
1122
1122
|
}
|
|
1123
1123
|
}
|
|
1124
|
-
|
|
1124
|
+
ie.create = (r) => new ie({
|
|
1125
1125
|
checks: [],
|
|
1126
1126
|
typeName: y.ZodNumber,
|
|
1127
1127
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1128
|
-
...
|
|
1128
|
+
..._(r)
|
|
1129
1129
|
});
|
|
1130
|
-
class
|
|
1130
|
+
class oe extends g {
|
|
1131
1131
|
constructor() {
|
|
1132
1132
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1133
1133
|
}
|
|
@@ -1138,10 +1138,10 @@ class ce extends v {
|
|
|
1138
1138
|
code: d.invalid_type,
|
|
1139
1139
|
expected: h.bigint,
|
|
1140
1140
|
received: a.parsedType
|
|
1141
|
-
}),
|
|
1141
|
+
}), v;
|
|
1142
1142
|
}
|
|
1143
1143
|
let n;
|
|
1144
|
-
const s = new
|
|
1144
|
+
const s = new A();
|
|
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), f(n, {
|
|
1147
1147
|
code: d.too_small,
|
|
@@ -1175,7 +1175,7 @@ class ce extends v {
|
|
|
1175
1175
|
return this.setLimit("max", e, !1, m.toString(t));
|
|
1176
1176
|
}
|
|
1177
1177
|
setLimit(e, t, n, s) {
|
|
1178
|
-
return new
|
|
1178
|
+
return new oe({
|
|
1179
1179
|
...this._def,
|
|
1180
1180
|
checks: [
|
|
1181
1181
|
...this._def.checks,
|
|
@@ -1189,7 +1189,7 @@ class ce extends v {
|
|
|
1189
1189
|
});
|
|
1190
1190
|
}
|
|
1191
1191
|
_addCheck(e) {
|
|
1192
|
-
return new
|
|
1192
|
+
return new oe({
|
|
1193
1193
|
...this._def,
|
|
1194
1194
|
checks: [...this._def.checks, e]
|
|
1195
1195
|
});
|
|
@@ -1246,16 +1246,16 @@ class ce extends v {
|
|
|
1246
1246
|
return e;
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
|
-
|
|
1249
|
+
oe.create = (r) => {
|
|
1250
1250
|
var e;
|
|
1251
|
-
return new
|
|
1251
|
+
return new oe({
|
|
1252
1252
|
checks: [],
|
|
1253
1253
|
typeName: y.ZodBigInt,
|
|
1254
1254
|
coerce: (e = r == null ? void 0 : r.coerce) !== null && e !== void 0 ? e : !1,
|
|
1255
|
-
...
|
|
1255
|
+
..._(r)
|
|
1256
1256
|
});
|
|
1257
1257
|
};
|
|
1258
|
-
class Ne extends
|
|
1258
|
+
class Ne extends g {
|
|
1259
1259
|
_parse(e) {
|
|
1260
1260
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
|
|
1261
1261
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1263,17 +1263,17 @@ class Ne extends v {
|
|
|
1263
1263
|
code: d.invalid_type,
|
|
1264
1264
|
expected: h.boolean,
|
|
1265
1265
|
received: n.parsedType
|
|
1266
|
-
}),
|
|
1266
|
+
}), v;
|
|
1267
1267
|
}
|
|
1268
|
-
return
|
|
1268
|
+
return Z(e.data);
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
1271
|
Ne.create = (r) => new Ne({
|
|
1272
1272
|
typeName: y.ZodBoolean,
|
|
1273
1273
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1274
|
-
...
|
|
1274
|
+
..._(r)
|
|
1275
1275
|
});
|
|
1276
|
-
class pe extends
|
|
1276
|
+
class pe extends g {
|
|
1277
1277
|
_parse(e) {
|
|
1278
1278
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
|
|
1279
1279
|
const a = this._getOrReturnCtx(e);
|
|
@@ -1281,15 +1281,15 @@ class pe extends v {
|
|
|
1281
1281
|
code: d.invalid_type,
|
|
1282
1282
|
expected: h.date,
|
|
1283
1283
|
received: a.parsedType
|
|
1284
|
-
}),
|
|
1284
|
+
}), v;
|
|
1285
1285
|
}
|
|
1286
1286
|
if (isNaN(e.data.getTime())) {
|
|
1287
1287
|
const a = this._getOrReturnCtx(e);
|
|
1288
1288
|
return f(a, {
|
|
1289
1289
|
code: d.invalid_date
|
|
1290
|
-
}),
|
|
1290
|
+
}), v;
|
|
1291
1291
|
}
|
|
1292
|
-
const n = new
|
|
1292
|
+
const n = new A();
|
|
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), f(s, {
|
|
@@ -1349,9 +1349,9 @@ pe.create = (r) => new pe({
|
|
|
1349
1349
|
checks: [],
|
|
1350
1350
|
coerce: (r == null ? void 0 : r.coerce) || !1,
|
|
1351
1351
|
typeName: y.ZodDate,
|
|
1352
|
-
...
|
|
1352
|
+
..._(r)
|
|
1353
1353
|
});
|
|
1354
|
-
class Je extends
|
|
1354
|
+
class Je extends g {
|
|
1355
1355
|
_parse(e) {
|
|
1356
1356
|
if (this._getType(e) !== h.symbol) {
|
|
1357
1357
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1359,16 +1359,16 @@ class Je extends v {
|
|
|
1359
1359
|
code: d.invalid_type,
|
|
1360
1360
|
expected: h.symbol,
|
|
1361
1361
|
received: n.parsedType
|
|
1362
|
-
}),
|
|
1362
|
+
}), v;
|
|
1363
1363
|
}
|
|
1364
|
-
return
|
|
1364
|
+
return Z(e.data);
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
1367
|
Je.create = (r) => new Je({
|
|
1368
1368
|
typeName: y.ZodSymbol,
|
|
1369
|
-
...
|
|
1369
|
+
..._(r)
|
|
1370
1370
|
});
|
|
1371
|
-
class
|
|
1371
|
+
class Ae extends g {
|
|
1372
1372
|
_parse(e) {
|
|
1373
1373
|
if (this._getType(e) !== h.undefined) {
|
|
1374
1374
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1376,16 +1376,16 @@ class Pe extends v {
|
|
|
1376
1376
|
code: d.invalid_type,
|
|
1377
1377
|
expected: h.undefined,
|
|
1378
1378
|
received: n.parsedType
|
|
1379
|
-
}),
|
|
1379
|
+
}), v;
|
|
1380
1380
|
}
|
|
1381
|
-
return
|
|
1381
|
+
return Z(e.data);
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
|
-
|
|
1384
|
+
Ae.create = (r) => new Ae({
|
|
1385
1385
|
typeName: y.ZodUndefined,
|
|
1386
|
-
...
|
|
1386
|
+
..._(r)
|
|
1387
1387
|
});
|
|
1388
|
-
class
|
|
1388
|
+
class Pe extends g {
|
|
1389
1389
|
_parse(e) {
|
|
1390
1390
|
if (this._getType(e) !== h.null) {
|
|
1391
1391
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1393,54 +1393,54 @@ class Ae extends v {
|
|
|
1393
1393
|
code: d.invalid_type,
|
|
1394
1394
|
expected: h.null,
|
|
1395
1395
|
received: n.parsedType
|
|
1396
|
-
}),
|
|
1396
|
+
}), v;
|
|
1397
1397
|
}
|
|
1398
|
-
return
|
|
1398
|
+
return Z(e.data);
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
1401
|
-
|
|
1401
|
+
Pe.create = (r) => new Pe({
|
|
1402
1402
|
typeName: y.ZodNull,
|
|
1403
|
-
...
|
|
1403
|
+
..._(r)
|
|
1404
1404
|
});
|
|
1405
|
-
class be extends
|
|
1405
|
+
class be extends g {
|
|
1406
1406
|
constructor() {
|
|
1407
1407
|
super(...arguments), this._any = !0;
|
|
1408
1408
|
}
|
|
1409
1409
|
_parse(e) {
|
|
1410
|
-
return
|
|
1410
|
+
return Z(e.data);
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
be.create = (r) => new be({
|
|
1414
1414
|
typeName: y.ZodAny,
|
|
1415
|
-
...
|
|
1415
|
+
..._(r)
|
|
1416
1416
|
});
|
|
1417
|
-
class he extends
|
|
1417
|
+
class he extends g {
|
|
1418
1418
|
constructor() {
|
|
1419
1419
|
super(...arguments), this._unknown = !0;
|
|
1420
1420
|
}
|
|
1421
1421
|
_parse(e) {
|
|
1422
|
-
return
|
|
1422
|
+
return Z(e.data);
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
1425
|
he.create = (r) => new he({
|
|
1426
1426
|
typeName: y.ZodUnknown,
|
|
1427
|
-
...
|
|
1427
|
+
..._(r)
|
|
1428
1428
|
});
|
|
1429
|
-
class
|
|
1429
|
+
class te extends g {
|
|
1430
1430
|
_parse(e) {
|
|
1431
1431
|
const t = this._getOrReturnCtx(e);
|
|
1432
1432
|
return f(t, {
|
|
1433
1433
|
code: d.invalid_type,
|
|
1434
1434
|
expected: h.never,
|
|
1435
1435
|
received: t.parsedType
|
|
1436
|
-
}),
|
|
1436
|
+
}), v;
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
|
-
|
|
1439
|
+
te.create = (r) => new te({
|
|
1440
1440
|
typeName: y.ZodNever,
|
|
1441
|
-
...
|
|
1441
|
+
..._(r)
|
|
1442
1442
|
});
|
|
1443
|
-
class Ge extends
|
|
1443
|
+
class Ge extends g {
|
|
1444
1444
|
_parse(e) {
|
|
1445
1445
|
if (this._getType(e) !== h.undefined) {
|
|
1446
1446
|
const n = this._getOrReturnCtx(e);
|
|
@@ -1448,16 +1448,16 @@ class Ge extends v {
|
|
|
1448
1448
|
code: d.invalid_type,
|
|
1449
1449
|
expected: h.void,
|
|
1450
1450
|
received: n.parsedType
|
|
1451
|
-
}),
|
|
1451
|
+
}), v;
|
|
1452
1452
|
}
|
|
1453
|
-
return
|
|
1453
|
+
return Z(e.data);
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
1456
|
Ge.create = (r) => new Ge({
|
|
1457
1457
|
typeName: y.ZodVoid,
|
|
1458
|
-
...
|
|
1458
|
+
..._(r)
|
|
1459
1459
|
});
|
|
1460
|
-
class
|
|
1460
|
+
class F extends g {
|
|
1461
1461
|
_parse(e) {
|
|
1462
1462
|
const { ctx: t, status: n } = this._processInputParams(e), s = this._def;
|
|
1463
1463
|
if (t.parsedType !== h.array)
|
|
@@ -1465,7 +1465,7 @@ class B extends v {
|
|
|
1465
1465
|
code: d.invalid_type,
|
|
1466
1466
|
expected: h.array,
|
|
1467
1467
|
received: t.parsedType
|
|
1468
|
-
}),
|
|
1468
|
+
}), v;
|
|
1469
1469
|
if (s.exactLength !== null) {
|
|
1470
1470
|
const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
|
|
1471
1471
|
(i || o) && (f(t, {
|
|
@@ -1493,27 +1493,27 @@ class B extends v {
|
|
|
1493
1493
|
exact: !1,
|
|
1494
1494
|
message: s.maxLength.message
|
|
1495
1495
|
}), n.dirty()), t.common.async)
|
|
1496
|
-
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new
|
|
1497
|
-
const a = [...t.data].map((i, o) => s.type._parseSync(new
|
|
1498
|
-
return
|
|
1496
|
+
return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new K(t, i, t.path, o)))).then((i) => A.mergeArray(n, i));
|
|
1497
|
+
const a = [...t.data].map((i, o) => s.type._parseSync(new K(t, i, t.path, o)));
|
|
1498
|
+
return A.mergeArray(n, a);
|
|
1499
1499
|
}
|
|
1500
1500
|
get element() {
|
|
1501
1501
|
return this._def.type;
|
|
1502
1502
|
}
|
|
1503
1503
|
min(e, t) {
|
|
1504
|
-
return new
|
|
1504
|
+
return new F({
|
|
1505
1505
|
...this._def,
|
|
1506
1506
|
minLength: { value: e, message: m.toString(t) }
|
|
1507
1507
|
});
|
|
1508
1508
|
}
|
|
1509
1509
|
max(e, t) {
|
|
1510
|
-
return new
|
|
1510
|
+
return new F({
|
|
1511
1511
|
...this._def,
|
|
1512
1512
|
maxLength: { value: e, message: m.toString(t) }
|
|
1513
1513
|
});
|
|
1514
1514
|
}
|
|
1515
1515
|
length(e, t) {
|
|
1516
|
-
return new
|
|
1516
|
+
return new F({
|
|
1517
1517
|
...this._def,
|
|
1518
1518
|
exactLength: { value: e, message: m.toString(t) }
|
|
1519
1519
|
});
|
|
@@ -1522,31 +1522,31 @@ class B extends v {
|
|
|
1522
1522
|
return this.min(1, e);
|
|
1523
1523
|
}
|
|
1524
1524
|
}
|
|
1525
|
-
|
|
1525
|
+
F.create = (r, e) => new F({
|
|
1526
1526
|
type: r,
|
|
1527
1527
|
minLength: null,
|
|
1528
1528
|
maxLength: null,
|
|
1529
1529
|
exactLength: null,
|
|
1530
1530
|
typeName: y.ZodArray,
|
|
1531
|
-
...
|
|
1531
|
+
..._(e)
|
|
1532
1532
|
});
|
|
1533
|
-
function
|
|
1533
|
+
function ve(r) {
|
|
1534
1534
|
if (r instanceof E) {
|
|
1535
1535
|
const e = {};
|
|
1536
1536
|
for (const t in r.shape) {
|
|
1537
1537
|
const n = r.shape[t];
|
|
1538
|
-
e[t] =
|
|
1538
|
+
e[t] = H.create(ve(n));
|
|
1539
1539
|
}
|
|
1540
1540
|
return new E({
|
|
1541
1541
|
...r._def,
|
|
1542
1542
|
shape: () => e
|
|
1543
1543
|
});
|
|
1544
|
-
} else return r instanceof
|
|
1544
|
+
} else return r instanceof F ? new F({
|
|
1545
1545
|
...r._def,
|
|
1546
|
-
type:
|
|
1547
|
-
}) : r instanceof
|
|
1546
|
+
type: ve(r.element)
|
|
1547
|
+
}) : r instanceof H ? H.create(ve(r.unwrap())) : r instanceof de ? de.create(ve(r.unwrap())) : r instanceof Y ? Y.create(r.items.map((e) => ve(e))) : r;
|
|
1548
1548
|
}
|
|
1549
|
-
class E extends
|
|
1549
|
+
class E extends g {
|
|
1550
1550
|
constructor() {
|
|
1551
1551
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1552
1552
|
}
|
|
@@ -1563,10 +1563,10 @@ class E extends v {
|
|
|
1563
1563
|
code: d.invalid_type,
|
|
1564
1564
|
expected: h.object,
|
|
1565
1565
|
received: c.parsedType
|
|
1566
|
-
}),
|
|
1566
|
+
}), v;
|
|
1567
1567
|
}
|
|
1568
1568
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
1569
|
-
if (!(this._def.catchall instanceof
|
|
1569
|
+
if (!(this._def.catchall instanceof te && this._def.unknownKeys === "strip"))
|
|
1570
1570
|
for (const c in s.data)
|
|
1571
1571
|
i.includes(c) || o.push(c);
|
|
1572
1572
|
const u = [];
|
|
@@ -1574,11 +1574,11 @@ class E extends v {
|
|
|
1574
1574
|
const p = a[c], k = s.data[c];
|
|
1575
1575
|
u.push({
|
|
1576
1576
|
key: { status: "valid", value: c },
|
|
1577
|
-
value: p._parse(new
|
|
1577
|
+
value: p._parse(new K(s, k, s.path, c)),
|
|
1578
1578
|
alwaysSet: c in s.data
|
|
1579
1579
|
});
|
|
1580
1580
|
}
|
|
1581
|
-
if (this._def.catchall instanceof
|
|
1581
|
+
if (this._def.catchall instanceof te) {
|
|
1582
1582
|
const c = this._def.unknownKeys;
|
|
1583
1583
|
if (c === "passthrough")
|
|
1584
1584
|
for (const p of o)
|
|
@@ -1599,7 +1599,7 @@ class E extends v {
|
|
|
1599
1599
|
u.push({
|
|
1600
1600
|
key: { status: "valid", value: p },
|
|
1601
1601
|
value: c._parse(
|
|
1602
|
-
new
|
|
1602
|
+
new K(s, k, s.path, p)
|
|
1603
1603
|
//, ctx.child(key), value, getParsedType(value)
|
|
1604
1604
|
),
|
|
1605
1605
|
alwaysSet: p in s.data
|
|
@@ -1617,7 +1617,7 @@ class E extends v {
|
|
|
1617
1617
|
});
|
|
1618
1618
|
}
|
|
1619
1619
|
return c;
|
|
1620
|
-
}).then((c) =>
|
|
1620
|
+
}).then((c) => A.mergeObjectSync(n, c)) : A.mergeObjectSync(n, u);
|
|
1621
1621
|
}
|
|
1622
1622
|
get shape() {
|
|
1623
1623
|
return this._def.shape();
|
|
@@ -1780,7 +1780,7 @@ class E extends v {
|
|
|
1780
1780
|
* @deprecated
|
|
1781
1781
|
*/
|
|
1782
1782
|
deepPartial() {
|
|
1783
|
-
return
|
|
1783
|
+
return ve(this);
|
|
1784
1784
|
}
|
|
1785
1785
|
partial(e) {
|
|
1786
1786
|
const t = {};
|
|
@@ -1799,7 +1799,7 @@ class E extends v {
|
|
|
1799
1799
|
t[n] = this.shape[n];
|
|
1800
1800
|
else {
|
|
1801
1801
|
let a = this.shape[n];
|
|
1802
|
-
for (; a instanceof
|
|
1802
|
+
for (; a instanceof H; )
|
|
1803
1803
|
a = a._def.innerType;
|
|
1804
1804
|
t[n] = a;
|
|
1805
1805
|
}
|
|
@@ -1815,25 +1815,25 @@ class E extends v {
|
|
|
1815
1815
|
E.create = (r, e) => new E({
|
|
1816
1816
|
shape: () => r,
|
|
1817
1817
|
unknownKeys: "strip",
|
|
1818
|
-
catchall:
|
|
1818
|
+
catchall: te.create(),
|
|
1819
1819
|
typeName: y.ZodObject,
|
|
1820
|
-
...
|
|
1820
|
+
..._(e)
|
|
1821
1821
|
});
|
|
1822
1822
|
E.strictCreate = (r, e) => new E({
|
|
1823
1823
|
shape: () => r,
|
|
1824
1824
|
unknownKeys: "strict",
|
|
1825
|
-
catchall:
|
|
1825
|
+
catchall: te.create(),
|
|
1826
1826
|
typeName: y.ZodObject,
|
|
1827
|
-
...
|
|
1827
|
+
..._(e)
|
|
1828
1828
|
});
|
|
1829
1829
|
E.lazycreate = (r, e) => new E({
|
|
1830
1830
|
shape: r,
|
|
1831
1831
|
unknownKeys: "strip",
|
|
1832
|
-
catchall:
|
|
1832
|
+
catchall: te.create(),
|
|
1833
1833
|
typeName: y.ZodObject,
|
|
1834
|
-
...
|
|
1834
|
+
..._(e)
|
|
1835
1835
|
});
|
|
1836
|
-
class Ze extends
|
|
1836
|
+
class Ze extends g {
|
|
1837
1837
|
_parse(e) {
|
|
1838
1838
|
const { ctx: t } = this._processInputParams(e), n = this._def.options;
|
|
1839
1839
|
function s(a) {
|
|
@@ -1843,11 +1843,11 @@ class Ze extends v {
|
|
|
1843
1843
|
for (const o of a)
|
|
1844
1844
|
if (o.result.status === "dirty")
|
|
1845
1845
|
return t.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1846
|
-
const i = a.map((o) => new
|
|
1846
|
+
const i = a.map((o) => new U(o.ctx.common.issues));
|
|
1847
1847
|
return f(t, {
|
|
1848
1848
|
code: d.invalid_union,
|
|
1849
1849
|
unionErrors: i
|
|
1850
|
-
}),
|
|
1850
|
+
}), v;
|
|
1851
1851
|
}
|
|
1852
1852
|
if (t.common.async)
|
|
1853
1853
|
return Promise.all(n.map(async (a) => {
|
|
@@ -1890,11 +1890,11 @@ class Ze extends v {
|
|
|
1890
1890
|
}
|
|
1891
1891
|
if (a)
|
|
1892
1892
|
return t.common.issues.push(...a.ctx.common.issues), a.result;
|
|
1893
|
-
const o = i.map((u) => new
|
|
1893
|
+
const o = i.map((u) => new U(u));
|
|
1894
1894
|
return f(t, {
|
|
1895
1895
|
code: d.invalid_union,
|
|
1896
1896
|
unionErrors: o
|
|
1897
|
-
}),
|
|
1897
|
+
}), v;
|
|
1898
1898
|
}
|
|
1899
1899
|
}
|
|
1900
1900
|
get options() {
|
|
@@ -1904,10 +1904,10 @@ class Ze extends v {
|
|
|
1904
1904
|
Ze.create = (r, e) => new Ze({
|
|
1905
1905
|
options: r,
|
|
1906
1906
|
typeName: y.ZodUnion,
|
|
1907
|
-
...
|
|
1907
|
+
..._(e)
|
|
1908
1908
|
});
|
|
1909
|
-
const
|
|
1910
|
-
class tt extends
|
|
1909
|
+
const ee = (r) => r instanceof Ue ? ee(r.schema) : r instanceof B ? ee(r.innerType()) : r instanceof De ? [r.value] : r instanceof ce ? r.options : r instanceof Le ? x.objectValues(r.enum) : r instanceof $e ? ee(r._def.innerType) : r instanceof Ae ? [void 0] : r instanceof Pe ? [null] : r instanceof H ? [void 0, ...ee(r.unwrap())] : r instanceof de ? [null, ...ee(r.unwrap())] : r instanceof xt || r instanceof ze ? ee(r.unwrap()) : r instanceof Ve ? ee(r._def.innerType) : [];
|
|
1910
|
+
class tt extends g {
|
|
1911
1911
|
_parse(e) {
|
|
1912
1912
|
const { ctx: t } = this._processInputParams(e);
|
|
1913
1913
|
if (t.parsedType !== h.object)
|
|
@@ -1915,7 +1915,7 @@ class tt extends v {
|
|
|
1915
1915
|
code: d.invalid_type,
|
|
1916
1916
|
expected: h.object,
|
|
1917
1917
|
received: t.parsedType
|
|
1918
|
-
}),
|
|
1918
|
+
}), v;
|
|
1919
1919
|
const n = this.discriminator, s = t.data[n], a = this.optionsMap.get(s);
|
|
1920
1920
|
return a ? t.common.async ? a._parseAsync({
|
|
1921
1921
|
data: t.data,
|
|
@@ -1929,7 +1929,7 @@ class tt extends v {
|
|
|
1929
1929
|
code: d.invalid_union_discriminator,
|
|
1930
1930
|
options: Array.from(this.optionsMap.keys()),
|
|
1931
1931
|
path: [n]
|
|
1932
|
-
}),
|
|
1932
|
+
}), v);
|
|
1933
1933
|
}
|
|
1934
1934
|
get discriminator() {
|
|
1935
1935
|
return this._def.discriminator;
|
|
@@ -1951,7 +1951,7 @@ class tt extends v {
|
|
|
1951
1951
|
static create(e, t, n) {
|
|
1952
1952
|
const s = /* @__PURE__ */ new Map();
|
|
1953
1953
|
for (const a of t) {
|
|
1954
|
-
const i =
|
|
1954
|
+
const i = ee(a.shape[e]);
|
|
1955
1955
|
if (!i.length)
|
|
1956
1956
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1957
1957
|
for (const o of i) {
|
|
@@ -1965,12 +1965,12 @@ class tt extends v {
|
|
|
1965
1965
|
discriminator: e,
|
|
1966
1966
|
options: t,
|
|
1967
1967
|
optionsMap: s,
|
|
1968
|
-
...
|
|
1968
|
+
..._(n)
|
|
1969
1969
|
});
|
|
1970
1970
|
}
|
|
1971
1971
|
}
|
|
1972
1972
|
function _t(r, e) {
|
|
1973
|
-
const t =
|
|
1973
|
+
const t = se(r), n = se(e);
|
|
1974
1974
|
if (r === e)
|
|
1975
1975
|
return { valid: !0, data: r };
|
|
1976
1976
|
if (t === h.object && n === h.object) {
|
|
@@ -1995,15 +1995,15 @@ function _t(r, e) {
|
|
|
1995
1995
|
return { valid: !0, data: s };
|
|
1996
1996
|
} else return t === h.date && n === h.date && +r == +e ? { valid: !0, data: r } : { valid: !1 };
|
|
1997
1997
|
}
|
|
1998
|
-
class je extends
|
|
1998
|
+
class je extends g {
|
|
1999
1999
|
_parse(e) {
|
|
2000
2000
|
const { status: t, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
2001
|
-
if (
|
|
2002
|
-
return
|
|
2001
|
+
if (yt(a) || yt(i))
|
|
2002
|
+
return v;
|
|
2003
2003
|
const o = _t(a.value, i.value);
|
|
2004
|
-
return o.valid ? ((
|
|
2004
|
+
return o.valid ? ((vt(a) || vt(i)) && t.dirty(), { status: t.value, value: o.data }) : (f(n, {
|
|
2005
2005
|
code: d.invalid_intersection_types
|
|
2006
|
-
}),
|
|
2006
|
+
}), v);
|
|
2007
2007
|
};
|
|
2008
2008
|
return n.common.async ? Promise.all([
|
|
2009
2009
|
this._def.left._parseAsync({
|
|
@@ -2031,9 +2031,9 @@ je.create = (r, e, t) => new je({
|
|
|
2031
2031
|
left: r,
|
|
2032
2032
|
right: e,
|
|
2033
2033
|
typeName: y.ZodIntersection,
|
|
2034
|
-
...
|
|
2034
|
+
..._(t)
|
|
2035
2035
|
});
|
|
2036
|
-
class
|
|
2036
|
+
class Y extends g {
|
|
2037
2037
|
_parse(e) {
|
|
2038
2038
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2039
2039
|
if (n.parsedType !== h.array)
|
|
@@ -2041,7 +2041,7 @@ class J extends v {
|
|
|
2041
2041
|
code: d.invalid_type,
|
|
2042
2042
|
expected: h.array,
|
|
2043
2043
|
received: n.parsedType
|
|
2044
|
-
}),
|
|
2044
|
+
}), v;
|
|
2045
2045
|
if (n.data.length < this._def.items.length)
|
|
2046
2046
|
return f(n, {
|
|
2047
2047
|
code: d.too_small,
|
|
@@ -2049,7 +2049,7 @@ class J extends v {
|
|
|
2049
2049
|
inclusive: !0,
|
|
2050
2050
|
exact: !1,
|
|
2051
2051
|
type: "array"
|
|
2052
|
-
}),
|
|
2052
|
+
}), v;
|
|
2053
2053
|
!this._def.rest && n.data.length > this._def.items.length && (f(n, {
|
|
2054
2054
|
code: d.too_big,
|
|
2055
2055
|
maximum: this._def.items.length,
|
|
@@ -2059,31 +2059,31 @@ class J extends v {
|
|
|
2059
2059
|
}), t.dirty());
|
|
2060
2060
|
const a = [...n.data].map((i, o) => {
|
|
2061
2061
|
const u = this._def.items[o] || this._def.rest;
|
|
2062
|
-
return u ? u._parse(new
|
|
2062
|
+
return u ? u._parse(new K(n, i, n.path, o)) : null;
|
|
2063
2063
|
}).filter((i) => !!i);
|
|
2064
|
-
return n.common.async ? Promise.all(a).then((i) =>
|
|
2064
|
+
return n.common.async ? Promise.all(a).then((i) => A.mergeArray(t, i)) : A.mergeArray(t, a);
|
|
2065
2065
|
}
|
|
2066
2066
|
get items() {
|
|
2067
2067
|
return this._def.items;
|
|
2068
2068
|
}
|
|
2069
2069
|
rest(e) {
|
|
2070
|
-
return new
|
|
2070
|
+
return new Y({
|
|
2071
2071
|
...this._def,
|
|
2072
2072
|
rest: e
|
|
2073
2073
|
});
|
|
2074
2074
|
}
|
|
2075
2075
|
}
|
|
2076
|
-
|
|
2076
|
+
Y.create = (r, e) => {
|
|
2077
2077
|
if (!Array.isArray(r))
|
|
2078
2078
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2079
|
-
return new
|
|
2079
|
+
return new Y({
|
|
2080
2080
|
items: r,
|
|
2081
2081
|
typeName: y.ZodTuple,
|
|
2082
2082
|
rest: null,
|
|
2083
|
-
...
|
|
2083
|
+
..._(e)
|
|
2084
2084
|
});
|
|
2085
2085
|
};
|
|
2086
|
-
class Me extends
|
|
2086
|
+
class Me extends g {
|
|
2087
2087
|
get keySchema() {
|
|
2088
2088
|
return this._def.keyType;
|
|
2089
2089
|
}
|
|
@@ -2097,34 +2097,34 @@ class Me extends v {
|
|
|
2097
2097
|
code: d.invalid_type,
|
|
2098
2098
|
expected: h.object,
|
|
2099
2099
|
received: n.parsedType
|
|
2100
|
-
}),
|
|
2100
|
+
}), v;
|
|
2101
2101
|
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2102
2102
|
for (const o in n.data)
|
|
2103
2103
|
s.push({
|
|
2104
|
-
key: a._parse(new
|
|
2105
|
-
value: i._parse(new
|
|
2104
|
+
key: a._parse(new K(n, o, n.path, o)),
|
|
2105
|
+
value: i._parse(new K(n, n.data[o], n.path, o)),
|
|
2106
2106
|
alwaysSet: o in n.data
|
|
2107
2107
|
});
|
|
2108
|
-
return n.common.async ?
|
|
2108
|
+
return n.common.async ? A.mergeObjectAsync(t, s) : A.mergeObjectSync(t, s);
|
|
2109
2109
|
}
|
|
2110
2110
|
get element() {
|
|
2111
2111
|
return this._def.valueType;
|
|
2112
2112
|
}
|
|
2113
2113
|
static create(e, t, n) {
|
|
2114
|
-
return t instanceof
|
|
2114
|
+
return t instanceof g ? new Me({
|
|
2115
2115
|
keyType: e,
|
|
2116
2116
|
valueType: t,
|
|
2117
2117
|
typeName: y.ZodRecord,
|
|
2118
|
-
...
|
|
2118
|
+
..._(n)
|
|
2119
2119
|
}) : new Me({
|
|
2120
|
-
keyType:
|
|
2120
|
+
keyType: z.create(),
|
|
2121
2121
|
valueType: e,
|
|
2122
2122
|
typeName: y.ZodRecord,
|
|
2123
|
-
...
|
|
2123
|
+
..._(t)
|
|
2124
2124
|
});
|
|
2125
2125
|
}
|
|
2126
2126
|
}
|
|
2127
|
-
class Xe extends
|
|
2127
|
+
class Xe extends g {
|
|
2128
2128
|
get keySchema() {
|
|
2129
2129
|
return this._def.keyType;
|
|
2130
2130
|
}
|
|
@@ -2138,10 +2138,10 @@ class Xe extends v {
|
|
|
2138
2138
|
code: d.invalid_type,
|
|
2139
2139
|
expected: h.map,
|
|
2140
2140
|
received: n.parsedType
|
|
2141
|
-
}),
|
|
2141
|
+
}), v;
|
|
2142
2142
|
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, u], c) => ({
|
|
2143
|
-
key: s._parse(new
|
|
2144
|
-
value: a._parse(new
|
|
2143
|
+
key: s._parse(new K(n, o, n.path, [c, "key"])),
|
|
2144
|
+
value: a._parse(new K(n, u, n.path, [c, "value"]))
|
|
2145
2145
|
}));
|
|
2146
2146
|
if (n.common.async) {
|
|
2147
2147
|
const o = /* @__PURE__ */ new Map();
|
|
@@ -2149,7 +2149,7 @@ class Xe extends v {
|
|
|
2149
2149
|
for (const u of i) {
|
|
2150
2150
|
const c = await u.key, p = await u.value;
|
|
2151
2151
|
if (c.status === "aborted" || p.status === "aborted")
|
|
2152
|
-
return
|
|
2152
|
+
return v;
|
|
2153
2153
|
(c.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(c.value, p.value);
|
|
2154
2154
|
}
|
|
2155
2155
|
return { status: t.value, value: o };
|
|
@@ -2159,7 +2159,7 @@ class Xe extends v {
|
|
|
2159
2159
|
for (const u of i) {
|
|
2160
2160
|
const c = u.key, p = u.value;
|
|
2161
2161
|
if (c.status === "aborted" || p.status === "aborted")
|
|
2162
|
-
return
|
|
2162
|
+
return v;
|
|
2163
2163
|
(c.status === "dirty" || p.status === "dirty") && t.dirty(), o.set(c.value, p.value);
|
|
2164
2164
|
}
|
|
2165
2165
|
return { status: t.value, value: o };
|
|
@@ -2170,9 +2170,9 @@ Xe.create = (r, e, t) => new Xe({
|
|
|
2170
2170
|
valueType: e,
|
|
2171
2171
|
keyType: r,
|
|
2172
2172
|
typeName: y.ZodMap,
|
|
2173
|
-
...
|
|
2173
|
+
..._(t)
|
|
2174
2174
|
});
|
|
2175
|
-
class me extends
|
|
2175
|
+
class me extends g {
|
|
2176
2176
|
_parse(e) {
|
|
2177
2177
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2178
2178
|
if (n.parsedType !== h.set)
|
|
@@ -2180,7 +2180,7 @@ class me extends v {
|
|
|
2180
2180
|
code: d.invalid_type,
|
|
2181
2181
|
expected: h.set,
|
|
2182
2182
|
received: n.parsedType
|
|
2183
|
-
}),
|
|
2183
|
+
}), v;
|
|
2184
2184
|
const s = this._def;
|
|
2185
2185
|
s.minSize !== null && n.data.size < s.minSize.value && (f(n, {
|
|
2186
2186
|
code: d.too_small,
|
|
@@ -2202,12 +2202,12 @@ class me extends v {
|
|
|
2202
2202
|
const c = /* @__PURE__ */ new Set();
|
|
2203
2203
|
for (const p of u) {
|
|
2204
2204
|
if (p.status === "aborted")
|
|
2205
|
-
return
|
|
2205
|
+
return v;
|
|
2206
2206
|
p.status === "dirty" && t.dirty(), c.add(p.value);
|
|
2207
2207
|
}
|
|
2208
2208
|
return { status: t.value, value: c };
|
|
2209
2209
|
}
|
|
2210
|
-
const o = [...n.data.values()].map((u, c) => a._parse(new
|
|
2210
|
+
const o = [...n.data.values()].map((u, c) => a._parse(new K(n, u, n.path, c)));
|
|
2211
2211
|
return n.common.async ? Promise.all(o).then((u) => i(u)) : i(o);
|
|
2212
2212
|
}
|
|
2213
2213
|
min(e, t) {
|
|
@@ -2234,9 +2234,9 @@ me.create = (r, e) => new me({
|
|
|
2234
2234
|
minSize: null,
|
|
2235
2235
|
maxSize: null,
|
|
2236
2236
|
typeName: y.ZodSet,
|
|
2237
|
-
...
|
|
2237
|
+
..._(e)
|
|
2238
2238
|
});
|
|
2239
|
-
class
|
|
2239
|
+
class ge extends g {
|
|
2240
2240
|
constructor() {
|
|
2241
2241
|
super(...arguments), this.validate = this.implement;
|
|
2242
2242
|
}
|
|
@@ -2247,7 +2247,7 @@ class ve extends v {
|
|
|
2247
2247
|
code: d.invalid_type,
|
|
2248
2248
|
expected: h.function,
|
|
2249
2249
|
received: t.parsedType
|
|
2250
|
-
}),
|
|
2250
|
+
}), v;
|
|
2251
2251
|
function n(o, u) {
|
|
2252
2252
|
return Ke({
|
|
2253
2253
|
data: o,
|
|
@@ -2283,8 +2283,8 @@ class ve extends v {
|
|
|
2283
2283
|
const a = { errorMap: t.common.contextualErrorMap }, i = t.data;
|
|
2284
2284
|
if (this._def.returns instanceof ke) {
|
|
2285
2285
|
const o = this;
|
|
2286
|
-
return
|
|
2287
|
-
const c = new
|
|
2286
|
+
return Z(async function(...u) {
|
|
2287
|
+
const c = new U([]), p = await o._def.args.parseAsync(u, a).catch(($) => {
|
|
2288
2288
|
throw c.addIssue(n(u, $)), c;
|
|
2289
2289
|
}), k = await Reflect.apply(i, this, p);
|
|
2290
2290
|
return await o._def.returns._def.type.parseAsync(k, a).catch(($) => {
|
|
@@ -2293,13 +2293,13 @@ class ve extends v {
|
|
|
2293
2293
|
});
|
|
2294
2294
|
} else {
|
|
2295
2295
|
const o = this;
|
|
2296
|
-
return
|
|
2296
|
+
return Z(function(...u) {
|
|
2297
2297
|
const c = o._def.args.safeParse(u, a);
|
|
2298
2298
|
if (!c.success)
|
|
2299
|
-
throw new
|
|
2299
|
+
throw new U([n(u, c.error)]);
|
|
2300
2300
|
const p = Reflect.apply(i, this, c.data), k = o._def.returns.safeParse(p, a);
|
|
2301
2301
|
if (!k.success)
|
|
2302
|
-
throw new
|
|
2302
|
+
throw new U([s(p, k.error)]);
|
|
2303
2303
|
return k.data;
|
|
2304
2304
|
});
|
|
2305
2305
|
}
|
|
@@ -2311,13 +2311,13 @@ class ve extends v {
|
|
|
2311
2311
|
return this._def.returns;
|
|
2312
2312
|
}
|
|
2313
2313
|
args(...e) {
|
|
2314
|
-
return new
|
|
2314
|
+
return new ge({
|
|
2315
2315
|
...this._def,
|
|
2316
|
-
args:
|
|
2316
|
+
args: Y.create(e).rest(he.create())
|
|
2317
2317
|
});
|
|
2318
2318
|
}
|
|
2319
2319
|
returns(e) {
|
|
2320
|
-
return new
|
|
2320
|
+
return new ge({
|
|
2321
2321
|
...this._def,
|
|
2322
2322
|
returns: e
|
|
2323
2323
|
});
|
|
@@ -2329,15 +2329,15 @@ class ve extends v {
|
|
|
2329
2329
|
return this.parse(e);
|
|
2330
2330
|
}
|
|
2331
2331
|
static create(e, t, n) {
|
|
2332
|
-
return new
|
|
2333
|
-
args: e ||
|
|
2332
|
+
return new ge({
|
|
2333
|
+
args: e || Y.create([]).rest(he.create()),
|
|
2334
2334
|
returns: t || he.create(),
|
|
2335
2335
|
typeName: y.ZodFunction,
|
|
2336
|
-
...
|
|
2336
|
+
..._(n)
|
|
2337
2337
|
});
|
|
2338
2338
|
}
|
|
2339
2339
|
}
|
|
2340
|
-
class
|
|
2340
|
+
class Ue extends g {
|
|
2341
2341
|
get schema() {
|
|
2342
2342
|
return this._def.getter();
|
|
2343
2343
|
}
|
|
@@ -2346,12 +2346,12 @@ class De extends v {
|
|
|
2346
2346
|
return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
|
|
2347
2347
|
}
|
|
2348
2348
|
}
|
|
2349
|
-
|
|
2349
|
+
Ue.create = (r, e) => new Ue({
|
|
2350
2350
|
getter: r,
|
|
2351
2351
|
typeName: y.ZodLazy,
|
|
2352
|
-
...
|
|
2352
|
+
..._(e)
|
|
2353
2353
|
});
|
|
2354
|
-
class
|
|
2354
|
+
class De extends g {
|
|
2355
2355
|
_parse(e) {
|
|
2356
2356
|
if (e.data !== this._def.value) {
|
|
2357
2357
|
const t = this._getOrReturnCtx(e);
|
|
@@ -2359,7 +2359,7 @@ class Ue extends v {
|
|
|
2359
2359
|
received: t.data,
|
|
2360
2360
|
code: d.invalid_literal,
|
|
2361
2361
|
expected: this._def.value
|
|
2362
|
-
}),
|
|
2362
|
+
}), v;
|
|
2363
2363
|
}
|
|
2364
2364
|
return { status: "valid", value: e.data };
|
|
2365
2365
|
}
|
|
@@ -2367,19 +2367,19 @@ class Ue extends v {
|
|
|
2367
2367
|
return this._def.value;
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
|
-
|
|
2370
|
+
De.create = (r, e) => new De({
|
|
2371
2371
|
value: r,
|
|
2372
2372
|
typeName: y.ZodLiteral,
|
|
2373
|
-
...
|
|
2373
|
+
..._(e)
|
|
2374
2374
|
});
|
|
2375
2375
|
function zt(r, e) {
|
|
2376
|
-
return new
|
|
2376
|
+
return new ce({
|
|
2377
2377
|
values: r,
|
|
2378
2378
|
typeName: y.ZodEnum,
|
|
2379
|
-
...
|
|
2379
|
+
..._(e)
|
|
2380
2380
|
});
|
|
2381
2381
|
}
|
|
2382
|
-
class
|
|
2382
|
+
class ce extends g {
|
|
2383
2383
|
constructor() {
|
|
2384
2384
|
super(...arguments), Se.set(this, void 0);
|
|
2385
2385
|
}
|
|
@@ -2390,17 +2390,17 @@ class de extends v {
|
|
|
2390
2390
|
expected: x.joinValues(n),
|
|
2391
2391
|
received: t.parsedType,
|
|
2392
2392
|
code: d.invalid_type
|
|
2393
|
-
}),
|
|
2393
|
+
}), v;
|
|
2394
2394
|
}
|
|
2395
|
-
if (Ye(this, Se) ||
|
|
2395
|
+
if (Ye(this, Se) || Dt(this, Se, new Set(this._def.values)), !Ye(this, Se).has(e.data)) {
|
|
2396
2396
|
const t = this._getOrReturnCtx(e), n = this._def.values;
|
|
2397
2397
|
return f(t, {
|
|
2398
2398
|
received: t.data,
|
|
2399
2399
|
code: d.invalid_enum_value,
|
|
2400
2400
|
options: n
|
|
2401
|
-
}),
|
|
2401
|
+
}), v;
|
|
2402
2402
|
}
|
|
2403
|
-
return
|
|
2403
|
+
return Z(e.data);
|
|
2404
2404
|
}
|
|
2405
2405
|
get options() {
|
|
2406
2406
|
return this._def.values;
|
|
@@ -2424,21 +2424,21 @@ class de extends v {
|
|
|
2424
2424
|
return e;
|
|
2425
2425
|
}
|
|
2426
2426
|
extract(e, t = this._def) {
|
|
2427
|
-
return
|
|
2427
|
+
return ce.create(e, {
|
|
2428
2428
|
...this._def,
|
|
2429
2429
|
...t
|
|
2430
2430
|
});
|
|
2431
2431
|
}
|
|
2432
2432
|
exclude(e, t = this._def) {
|
|
2433
|
-
return
|
|
2433
|
+
return ce.create(this.options.filter((n) => !e.includes(n)), {
|
|
2434
2434
|
...this._def,
|
|
2435
2435
|
...t
|
|
2436
2436
|
});
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
2439
|
Se = /* @__PURE__ */ new WeakMap();
|
|
2440
|
-
|
|
2441
|
-
class Le extends
|
|
2440
|
+
ce.create = zt;
|
|
2441
|
+
class Le extends g {
|
|
2442
2442
|
constructor() {
|
|
2443
2443
|
super(...arguments), Ce.set(this, void 0);
|
|
2444
2444
|
}
|
|
@@ -2450,17 +2450,17 @@ class Le extends v {
|
|
|
2450
2450
|
expected: x.joinValues(s),
|
|
2451
2451
|
received: n.parsedType,
|
|
2452
2452
|
code: d.invalid_type
|
|
2453
|
-
}),
|
|
2453
|
+
}), v;
|
|
2454
2454
|
}
|
|
2455
|
-
if (Ye(this, Ce) ||
|
|
2455
|
+
if (Ye(this, Ce) || Dt(this, Ce, new Set(x.getValidEnumValues(this._def.values))), !Ye(this, Ce).has(e.data)) {
|
|
2456
2456
|
const s = x.objectValues(t);
|
|
2457
2457
|
return f(n, {
|
|
2458
2458
|
received: n.data,
|
|
2459
2459
|
code: d.invalid_enum_value,
|
|
2460
2460
|
options: s
|
|
2461
|
-
}),
|
|
2461
|
+
}), v;
|
|
2462
2462
|
}
|
|
2463
|
-
return
|
|
2463
|
+
return Z(e.data);
|
|
2464
2464
|
}
|
|
2465
2465
|
get enum() {
|
|
2466
2466
|
return this._def.values;
|
|
@@ -2470,9 +2470,9 @@ Ce = /* @__PURE__ */ new WeakMap();
|
|
|
2470
2470
|
Le.create = (r, e) => new Le({
|
|
2471
2471
|
values: r,
|
|
2472
2472
|
typeName: y.ZodNativeEnum,
|
|
2473
|
-
...
|
|
2473
|
+
..._(e)
|
|
2474
2474
|
});
|
|
2475
|
-
class ke extends
|
|
2475
|
+
class ke extends g {
|
|
2476
2476
|
unwrap() {
|
|
2477
2477
|
return this._def.type;
|
|
2478
2478
|
}
|
|
@@ -2483,9 +2483,9 @@ class ke extends v {
|
|
|
2483
2483
|
code: d.invalid_type,
|
|
2484
2484
|
expected: h.promise,
|
|
2485
2485
|
received: t.parsedType
|
|
2486
|
-
}),
|
|
2486
|
+
}), v;
|
|
2487
2487
|
const n = t.parsedType === h.promise ? t.data : Promise.resolve(t.data);
|
|
2488
|
-
return
|
|
2488
|
+
return Z(n.then((s) => this._def.type.parseAsync(s, {
|
|
2489
2489
|
path: t.path,
|
|
2490
2490
|
errorMap: t.common.contextualErrorMap
|
|
2491
2491
|
})));
|
|
@@ -2494,9 +2494,9 @@ class ke extends v {
|
|
|
2494
2494
|
ke.create = (r, e) => new ke({
|
|
2495
2495
|
type: r,
|
|
2496
2496
|
typeName: y.ZodPromise,
|
|
2497
|
-
...
|
|
2497
|
+
..._(e)
|
|
2498
2498
|
});
|
|
2499
|
-
class
|
|
2499
|
+
class B extends g {
|
|
2500
2500
|
innerType() {
|
|
2501
2501
|
return this._def.schema;
|
|
2502
2502
|
}
|
|
@@ -2517,23 +2517,23 @@ class W extends v {
|
|
|
2517
2517
|
if (n.common.async)
|
|
2518
2518
|
return Promise.resolve(i).then(async (o) => {
|
|
2519
2519
|
if (t.value === "aborted")
|
|
2520
|
-
return
|
|
2520
|
+
return v;
|
|
2521
2521
|
const u = await this._def.schema._parseAsync({
|
|
2522
2522
|
data: o,
|
|
2523
2523
|
path: n.path,
|
|
2524
2524
|
parent: n
|
|
2525
2525
|
});
|
|
2526
|
-
return u.status === "aborted" ?
|
|
2526
|
+
return u.status === "aborted" ? v : u.status === "dirty" || t.value === "dirty" ? _e(u.value) : u;
|
|
2527
2527
|
});
|
|
2528
2528
|
{
|
|
2529
2529
|
if (t.value === "aborted")
|
|
2530
|
-
return
|
|
2530
|
+
return v;
|
|
2531
2531
|
const o = this._def.schema._parseSync({
|
|
2532
2532
|
data: i,
|
|
2533
2533
|
path: n.path,
|
|
2534
2534
|
parent: n
|
|
2535
2535
|
});
|
|
2536
|
-
return o.status === "aborted" ?
|
|
2536
|
+
return o.status === "aborted" ? v : o.status === "dirty" || t.value === "dirty" ? _e(o.value) : o;
|
|
2537
2537
|
}
|
|
2538
2538
|
}
|
|
2539
2539
|
if (s.type === "refinement") {
|
|
@@ -2551,9 +2551,9 @@ class W extends v {
|
|
|
2551
2551
|
path: n.path,
|
|
2552
2552
|
parent: n
|
|
2553
2553
|
});
|
|
2554
|
-
return o.status === "aborted" ?
|
|
2554
|
+
return o.status === "aborted" ? v : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
|
|
2555
2555
|
} else
|
|
2556
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ?
|
|
2556
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? v : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
|
|
2557
2557
|
}
|
|
2558
2558
|
if (s.type === "transform")
|
|
2559
2559
|
if (n.common.async === !1) {
|
|
@@ -2573,45 +2573,45 @@ class W extends v {
|
|
|
2573
2573
|
x.assertNever(s);
|
|
2574
2574
|
}
|
|
2575
2575
|
}
|
|
2576
|
-
|
|
2576
|
+
B.create = (r, e, t) => new B({
|
|
2577
2577
|
schema: r,
|
|
2578
2578
|
typeName: y.ZodEffects,
|
|
2579
2579
|
effect: e,
|
|
2580
|
-
...
|
|
2580
|
+
..._(t)
|
|
2581
2581
|
});
|
|
2582
|
-
|
|
2582
|
+
B.createWithPreprocess = (r, e, t) => new B({
|
|
2583
2583
|
schema: e,
|
|
2584
2584
|
effect: { type: "preprocess", transform: r },
|
|
2585
2585
|
typeName: y.ZodEffects,
|
|
2586
|
-
...
|
|
2586
|
+
..._(t)
|
|
2587
2587
|
});
|
|
2588
|
-
class
|
|
2588
|
+
class H extends g {
|
|
2589
2589
|
_parse(e) {
|
|
2590
|
-
return this._getType(e) === h.undefined ?
|
|
2590
|
+
return this._getType(e) === h.undefined ? Z(void 0) : this._def.innerType._parse(e);
|
|
2591
2591
|
}
|
|
2592
2592
|
unwrap() {
|
|
2593
2593
|
return this._def.innerType;
|
|
2594
2594
|
}
|
|
2595
2595
|
}
|
|
2596
|
-
|
|
2596
|
+
H.create = (r, e) => new H({
|
|
2597
2597
|
innerType: r,
|
|
2598
2598
|
typeName: y.ZodOptional,
|
|
2599
|
-
...
|
|
2599
|
+
..._(e)
|
|
2600
2600
|
});
|
|
2601
|
-
class
|
|
2601
|
+
class de extends g {
|
|
2602
2602
|
_parse(e) {
|
|
2603
|
-
return this._getType(e) === h.null ?
|
|
2603
|
+
return this._getType(e) === h.null ? Z(null) : this._def.innerType._parse(e);
|
|
2604
2604
|
}
|
|
2605
2605
|
unwrap() {
|
|
2606
2606
|
return this._def.innerType;
|
|
2607
2607
|
}
|
|
2608
2608
|
}
|
|
2609
|
-
|
|
2609
|
+
de.create = (r, e) => new de({
|
|
2610
2610
|
innerType: r,
|
|
2611
2611
|
typeName: y.ZodNullable,
|
|
2612
|
-
...
|
|
2612
|
+
..._(e)
|
|
2613
2613
|
});
|
|
2614
|
-
class $e extends
|
|
2614
|
+
class $e extends g {
|
|
2615
2615
|
_parse(e) {
|
|
2616
2616
|
const { ctx: t } = this._processInputParams(e);
|
|
2617
2617
|
let n = t.data;
|
|
@@ -2629,9 +2629,9 @@ $e.create = (r, e) => new $e({
|
|
|
2629
2629
|
innerType: r,
|
|
2630
2630
|
typeName: y.ZodDefault,
|
|
2631
2631
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
2632
|
-
...
|
|
2632
|
+
..._(e)
|
|
2633
2633
|
});
|
|
2634
|
-
class Ve extends
|
|
2634
|
+
class Ve extends g {
|
|
2635
2635
|
_parse(e) {
|
|
2636
2636
|
const { ctx: t } = this._processInputParams(e), n = {
|
|
2637
2637
|
...t,
|
|
@@ -2650,7 +2650,7 @@ class Ve extends v {
|
|
|
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 U(n.common.issues);
|
|
2654
2654
|
},
|
|
2655
2655
|
input: n.data
|
|
2656
2656
|
})
|
|
@@ -2658,7 +2658,7 @@ class Ve extends v {
|
|
|
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 U(n.common.issues);
|
|
2662
2662
|
},
|
|
2663
2663
|
input: n.data
|
|
2664
2664
|
})
|
|
@@ -2672,9 +2672,9 @@ Ve.create = (r, e) => new Ve({
|
|
|
2672
2672
|
innerType: r,
|
|
2673
2673
|
typeName: y.ZodCatch,
|
|
2674
2674
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
2675
|
-
...
|
|
2675
|
+
..._(e)
|
|
2676
2676
|
});
|
|
2677
|
-
class Qe extends
|
|
2677
|
+
class Qe extends g {
|
|
2678
2678
|
_parse(e) {
|
|
2679
2679
|
if (this._getType(e) !== h.nan) {
|
|
2680
2680
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2682,17 +2682,17 @@ class Qe extends v {
|
|
|
2682
2682
|
code: d.invalid_type,
|
|
2683
2683
|
expected: h.nan,
|
|
2684
2684
|
received: n.parsedType
|
|
2685
|
-
}),
|
|
2685
|
+
}), v;
|
|
2686
2686
|
}
|
|
2687
2687
|
return { status: "valid", value: e.data };
|
|
2688
2688
|
}
|
|
2689
2689
|
}
|
|
2690
2690
|
Qe.create = (r) => new Qe({
|
|
2691
2691
|
typeName: y.ZodNaN,
|
|
2692
|
-
...
|
|
2692
|
+
..._(r)
|
|
2693
2693
|
});
|
|
2694
2694
|
const Br = Symbol("zod_brand");
|
|
2695
|
-
class
|
|
2695
|
+
class xt extends g {
|
|
2696
2696
|
_parse(e) {
|
|
2697
2697
|
const { ctx: t } = this._processInputParams(e), n = t.data;
|
|
2698
2698
|
return this._def.type._parse({
|
|
@@ -2705,7 +2705,7 @@ class vt extends v {
|
|
|
2705
2705
|
return this._def.type;
|
|
2706
2706
|
}
|
|
2707
2707
|
}
|
|
2708
|
-
class Fe extends
|
|
2708
|
+
class Fe extends g {
|
|
2709
2709
|
_parse(e) {
|
|
2710
2710
|
const { status: t, ctx: n } = this._processInputParams(e);
|
|
2711
2711
|
if (n.common.async)
|
|
@@ -2715,7 +2715,7 @@ class Fe extends v {
|
|
|
2715
2715
|
path: n.path,
|
|
2716
2716
|
parent: n
|
|
2717
2717
|
});
|
|
2718
|
-
return a.status === "aborted" ?
|
|
2718
|
+
return a.status === "aborted" ? v : a.status === "dirty" ? (t.dirty(), _e(a.value)) : this._def.out._parseAsync({
|
|
2719
2719
|
data: a.value,
|
|
2720
2720
|
path: n.path,
|
|
2721
2721
|
parent: n
|
|
@@ -2727,7 +2727,7 @@ class Fe extends v {
|
|
|
2727
2727
|
path: n.path,
|
|
2728
2728
|
parent: n
|
|
2729
2729
|
});
|
|
2730
|
-
return s.status === "aborted" ?
|
|
2730
|
+
return s.status === "aborted" ? v : s.status === "dirty" ? (t.dirty(), {
|
|
2731
2731
|
status: "dirty",
|
|
2732
2732
|
value: s.value
|
|
2733
2733
|
}) : this._def.out._parseSync({
|
|
@@ -2745,7 +2745,7 @@ class Fe extends v {
|
|
|
2745
2745
|
});
|
|
2746
2746
|
}
|
|
2747
2747
|
}
|
|
2748
|
-
class ze extends
|
|
2748
|
+
class ze extends g {
|
|
2749
2749
|
_parse(e) {
|
|
2750
2750
|
const t = this._def.innerType._parse(e), n = (s) => (Re(s) && (s.value = Object.freeze(s.value)), s);
|
|
2751
2751
|
return Ie(t) ? t.then((s) => n(s)) : n(t);
|
|
@@ -2757,7 +2757,7 @@ class ze extends v {
|
|
|
2757
2757
|
ze.create = (r, e) => new ze({
|
|
2758
2758
|
innerType: r,
|
|
2759
2759
|
typeName: y.ZodReadonly,
|
|
2760
|
-
...
|
|
2760
|
+
..._(e)
|
|
2761
2761
|
});
|
|
2762
2762
|
function Ft(r, e = {}, t) {
|
|
2763
2763
|
return r ? be.create().superRefine((n, s) => {
|
|
@@ -2777,16 +2777,16 @@ var y;
|
|
|
2777
2777
|
})(y || (y = {}));
|
|
2778
2778
|
const qr = (r, e = {
|
|
2779
2779
|
message: `Input not instance of ${r.name}`
|
|
2780
|
-
}) => Ft((t) => t instanceof r, e), Bt =
|
|
2781
|
-
string: (r) =>
|
|
2782
|
-
number: (r) =>
|
|
2780
|
+
}) => Ft((t) => t instanceof r, e), Bt = z.create, Wt = ie.create, Hr = Qe.create, Kr = oe.create, qt = Ne.create, Yr = pe.create, Jr = Je.create, Gr = Ae.create, Xr = Pe.create, Qr = be.create, en = he.create, tn = te.create, rn = Ge.create, nn = F.create, sn = E.create, an = E.strictCreate, on = Ze.create, cn = tt.create, dn = je.create, un = Y.create, ln = Me.create, fn = Xe.create, hn = me.create, pn = ge.create, mn = Ue.create, yn = De.create, vn = ce.create, _n = Le.create, gn = ke.create, It = B.create, xn = H.create, bn = de.create, kn = B.createWithPreprocess, wn = Fe.create, En = () => Bt().optional(), Tn = () => Wt().optional(), Sn = () => qt().optional(), Cn = {
|
|
2781
|
+
string: (r) => z.create({ ...r, coerce: !0 }),
|
|
2782
|
+
number: (r) => ie.create({ ...r, coerce: !0 }),
|
|
2783
2783
|
boolean: (r) => Ne.create({
|
|
2784
2784
|
...r,
|
|
2785
2785
|
coerce: !0
|
|
2786
2786
|
}),
|
|
2787
|
-
bigint: (r) =>
|
|
2787
|
+
bigint: (r) => oe.create({ ...r, coerce: !0 }),
|
|
2788
2788
|
date: (r) => pe.create({ ...r, coerce: !0 })
|
|
2789
|
-
}, On =
|
|
2789
|
+
}, On = v;
|
|
2790
2790
|
var l = /* @__PURE__ */ Object.freeze({
|
|
2791
2791
|
__proto__: null,
|
|
2792
2792
|
defaultErrorMap: xe,
|
|
@@ -2795,65 +2795,65 @@ var l = /* @__PURE__ */ Object.freeze({
|
|
|
2795
2795
|
makeIssue: Ke,
|
|
2796
2796
|
EMPTY_PATH: Or,
|
|
2797
2797
|
addIssueToContext: f,
|
|
2798
|
-
ParseStatus:
|
|
2799
|
-
INVALID:
|
|
2800
|
-
DIRTY:
|
|
2801
|
-
OK:
|
|
2802
|
-
isAborted:
|
|
2803
|
-
isDirty:
|
|
2798
|
+
ParseStatus: A,
|
|
2799
|
+
INVALID: v,
|
|
2800
|
+
DIRTY: _e,
|
|
2801
|
+
OK: Z,
|
|
2802
|
+
isAborted: yt,
|
|
2803
|
+
isDirty: vt,
|
|
2804
2804
|
isValid: Re,
|
|
2805
2805
|
isAsync: Ie,
|
|
2806
2806
|
get util() {
|
|
2807
2807
|
return x;
|
|
2808
2808
|
},
|
|
2809
2809
|
get objectUtil() {
|
|
2810
|
-
return
|
|
2810
|
+
return mt;
|
|
2811
2811
|
},
|
|
2812
2812
|
ZodParsedType: h,
|
|
2813
|
-
getParsedType:
|
|
2814
|
-
ZodType:
|
|
2813
|
+
getParsedType: se,
|
|
2814
|
+
ZodType: g,
|
|
2815
2815
|
datetimeRegex: Vt,
|
|
2816
|
-
ZodString:
|
|
2817
|
-
ZodNumber:
|
|
2818
|
-
ZodBigInt:
|
|
2816
|
+
ZodString: z,
|
|
2817
|
+
ZodNumber: ie,
|
|
2818
|
+
ZodBigInt: oe,
|
|
2819
2819
|
ZodBoolean: Ne,
|
|
2820
2820
|
ZodDate: pe,
|
|
2821
2821
|
ZodSymbol: Je,
|
|
2822
|
-
ZodUndefined:
|
|
2823
|
-
ZodNull:
|
|
2822
|
+
ZodUndefined: Ae,
|
|
2823
|
+
ZodNull: Pe,
|
|
2824
2824
|
ZodAny: be,
|
|
2825
2825
|
ZodUnknown: he,
|
|
2826
|
-
ZodNever:
|
|
2826
|
+
ZodNever: te,
|
|
2827
2827
|
ZodVoid: Ge,
|
|
2828
|
-
ZodArray:
|
|
2828
|
+
ZodArray: F,
|
|
2829
2829
|
ZodObject: E,
|
|
2830
2830
|
ZodUnion: Ze,
|
|
2831
2831
|
ZodDiscriminatedUnion: tt,
|
|
2832
2832
|
ZodIntersection: je,
|
|
2833
|
-
ZodTuple:
|
|
2833
|
+
ZodTuple: Y,
|
|
2834
2834
|
ZodRecord: Me,
|
|
2835
2835
|
ZodMap: Xe,
|
|
2836
2836
|
ZodSet: me,
|
|
2837
|
-
ZodFunction:
|
|
2838
|
-
ZodLazy:
|
|
2839
|
-
ZodLiteral:
|
|
2840
|
-
ZodEnum:
|
|
2837
|
+
ZodFunction: ge,
|
|
2838
|
+
ZodLazy: Ue,
|
|
2839
|
+
ZodLiteral: De,
|
|
2840
|
+
ZodEnum: ce,
|
|
2841
2841
|
ZodNativeEnum: Le,
|
|
2842
2842
|
ZodPromise: ke,
|
|
2843
|
-
ZodEffects:
|
|
2844
|
-
ZodTransformer:
|
|
2845
|
-
ZodOptional:
|
|
2846
|
-
ZodNullable:
|
|
2843
|
+
ZodEffects: B,
|
|
2844
|
+
ZodTransformer: B,
|
|
2845
|
+
ZodOptional: H,
|
|
2846
|
+
ZodNullable: de,
|
|
2847
2847
|
ZodDefault: $e,
|
|
2848
2848
|
ZodCatch: Ve,
|
|
2849
2849
|
ZodNaN: Qe,
|
|
2850
2850
|
BRAND: Br,
|
|
2851
|
-
ZodBranded:
|
|
2851
|
+
ZodBranded: xt,
|
|
2852
2852
|
ZodPipeline: Fe,
|
|
2853
2853
|
ZodReadonly: ze,
|
|
2854
2854
|
custom: Ft,
|
|
2855
|
-
Schema:
|
|
2856
|
-
ZodSchema:
|
|
2855
|
+
Schema: g,
|
|
2856
|
+
ZodSchema: g,
|
|
2857
2857
|
late: Wr,
|
|
2858
2858
|
get ZodFirstPartyTypeKind() {
|
|
2859
2859
|
return y;
|
|
@@ -2866,7 +2866,7 @@ var l = /* @__PURE__ */ Object.freeze({
|
|
|
2866
2866
|
date: Yr,
|
|
2867
2867
|
discriminatedUnion: cn,
|
|
2868
2868
|
effect: It,
|
|
2869
|
-
enum:
|
|
2869
|
+
enum: vn,
|
|
2870
2870
|
function: pn,
|
|
2871
2871
|
instanceof: qr,
|
|
2872
2872
|
intersection: dn,
|
|
@@ -2874,7 +2874,7 @@ var l = /* @__PURE__ */ Object.freeze({
|
|
|
2874
2874
|
literal: yn,
|
|
2875
2875
|
map: fn,
|
|
2876
2876
|
nan: Hr,
|
|
2877
|
-
nativeEnum:
|
|
2877
|
+
nativeEnum: _n,
|
|
2878
2878
|
never: tn,
|
|
2879
2879
|
null: Xr,
|
|
2880
2880
|
nullable: bn,
|
|
@@ -2886,7 +2886,7 @@ var l = /* @__PURE__ */ Object.freeze({
|
|
|
2886
2886
|
ostring: En,
|
|
2887
2887
|
pipeline: wn,
|
|
2888
2888
|
preprocess: kn,
|
|
2889
|
-
promise:
|
|
2889
|
+
promise: gn,
|
|
2890
2890
|
record: ln,
|
|
2891
2891
|
set: hn,
|
|
2892
2892
|
strictObject: an,
|
|
@@ -2901,7 +2901,7 @@ var l = /* @__PURE__ */ Object.freeze({
|
|
|
2901
2901
|
NEVER: On,
|
|
2902
2902
|
ZodIssueCode: d,
|
|
2903
2903
|
quotelessJson: Sr,
|
|
2904
|
-
ZodError:
|
|
2904
|
+
ZodError: U
|
|
2905
2905
|
});
|
|
2906
2906
|
const L = l.string().trim().min(1, { message: "Cannot be blank" }), M = l.string().trim().optional(), Nt = (r) => l.nullable(r.optional());
|
|
2907
2907
|
var et = /* @__PURE__ */ ((r) => (r.FIRST_NAME = "firstName", r.LAST_NAME = "lastName", r.EMAIL = "email", r.ZIP_CODE = "zipCode", r.CITY = "city", r.STATE = "state", r.COUNTRY = "country", r.ADDRESS = "address", r.PHONE = "phone", r.PROMOTION_CODE = "promotionCode", r))(et || {});
|
|
@@ -2928,6 +2928,7 @@ l.object({
|
|
|
2928
2928
|
});
|
|
2929
2929
|
const b = l.enum([
|
|
2930
2930
|
// Element -> Form
|
|
2931
|
+
"LAYOUT",
|
|
2931
2932
|
"LOADED",
|
|
2932
2933
|
"BLUR",
|
|
2933
2934
|
"FOCUS",
|
|
@@ -2946,66 +2947,69 @@ const b = l.enum([
|
|
|
2946
2947
|
"TOKENIZE",
|
|
2947
2948
|
"CHECKOUT",
|
|
2948
2949
|
"START_PAYMENT_FLOW"
|
|
2949
|
-
]), In = b.extract(["TOKENIZE_STARTED", "CHECKOUT_STARTED"]), Nn = l.object({ type: In }),
|
|
2950
|
-
type:
|
|
2950
|
+
]), In = b.extract(["TOKENIZE_STARTED", "CHECKOUT_STARTED"]), Nn = l.object({ type: In }), An = b.extract(["BLUR", "FOCUS", "CHANGE"]), Pn = l.object({
|
|
2951
|
+
type: An,
|
|
2951
2952
|
elementType: Yt
|
|
2952
2953
|
}), Zn = b.extract(["LOAD_ERROR", "TOKENIZE_ERROR", "CHECKOUT_ERROR"]), jn = l.object({
|
|
2953
2954
|
type: Zn,
|
|
2954
2955
|
message: L
|
|
2955
|
-
}), Mn = b.extract(["VALIDATION_ERROR"]),
|
|
2956
|
+
}), Mn = b.extract(["VALIDATION_ERROR"]), Un = l.object({
|
|
2956
2957
|
type: Mn,
|
|
2957
2958
|
elementType: Rn,
|
|
2958
2959
|
errors: l.array(l.string())
|
|
2959
|
-
}),
|
|
2960
|
+
}), Dn = l.object({
|
|
2961
|
+
type: l.literal(b.enum.LAYOUT),
|
|
2962
|
+
height: L
|
|
2963
|
+
}), Ln = l.object({
|
|
2960
2964
|
type: l.literal(b.enum.LOADED),
|
|
2961
2965
|
sessionId: L,
|
|
2962
|
-
height: L,
|
|
2963
2966
|
totalAmountAtoms: l.number(),
|
|
2964
2967
|
currency: M,
|
|
2965
2968
|
checkoutPaymentMethods: l.array(Jt)
|
|
2966
|
-
}),
|
|
2969
|
+
}), $n = l.object({
|
|
2967
2970
|
type: l.literal(b.enum.PAYMENT_FLOW_STARTED),
|
|
2968
2971
|
nextActionMetadata: l.record(l.string(), l.any()),
|
|
2969
2972
|
paymentFlowMetadata: l.any().optional(),
|
|
2970
2973
|
startPFMetadata: l.optional(l.record(l.string(), l.any()))
|
|
2971
|
-
}),
|
|
2974
|
+
}), Vn = l.object({
|
|
2972
2975
|
type: l.literal(b.enum.SETUP_PAYMENT_METHOD_SUCCESS),
|
|
2973
2976
|
paymentMethodId: l.string()
|
|
2974
|
-
}),
|
|
2977
|
+
}), zn = l.object({
|
|
2975
2978
|
firstName: L,
|
|
2976
2979
|
lastName: L,
|
|
2977
2980
|
email: L,
|
|
2978
2981
|
zipCode: L,
|
|
2979
2982
|
country: L,
|
|
2980
2983
|
promotionCode: M
|
|
2981
|
-
}),
|
|
2982
|
-
type:
|
|
2984
|
+
}), Fn = b.extract(["TOKENIZE", "CHECKOUT", "START_PAYMENT_FLOW"]), Gt = l.object({
|
|
2985
|
+
type: Fn,
|
|
2983
2986
|
sessionId: L,
|
|
2984
2987
|
checkoutPaymentMethod: Jt,
|
|
2985
2988
|
paymentFlowMetadata: l.any().optional(),
|
|
2986
2989
|
doNotUseLegacyCCFlow: l.boolean().optional(),
|
|
2987
2990
|
existingCCPMId: M
|
|
2988
|
-
}).extend(
|
|
2991
|
+
}).extend(zn.shape), Bn = l.object({
|
|
2989
2992
|
type: l.literal(b.enum.TOKENIZE_SUCCESS),
|
|
2990
2993
|
isReadyForCheckout: l.boolean()
|
|
2991
|
-
}),
|
|
2994
|
+
}), Wn = l.object({
|
|
2992
2995
|
type: l.literal(b.enum.CHECKOUT_SUCCESS),
|
|
2993
2996
|
invoiceUrls: l.array(l.string()),
|
|
2994
2997
|
subscriptionIds: l.array(l.string()),
|
|
2995
2998
|
customerId: l.string()
|
|
2996
|
-
}),
|
|
2999
|
+
}), qn = l.discriminatedUnion("type", [
|
|
2997
3000
|
Nn,
|
|
2998
|
-
|
|
3001
|
+
Pn,
|
|
2999
3002
|
jn,
|
|
3000
|
-
Dn,
|
|
3001
3003
|
Un,
|
|
3004
|
+
Dn,
|
|
3005
|
+
Ln,
|
|
3002
3006
|
Gt,
|
|
3003
|
-
Fn,
|
|
3004
3007
|
Bn,
|
|
3005
|
-
|
|
3006
|
-
$n
|
|
3007
|
-
|
|
3008
|
-
|
|
3008
|
+
Wn,
|
|
3009
|
+
$n,
|
|
3010
|
+
Vn
|
|
3011
|
+
]), Hn = l.object({
|
|
3012
|
+
payload: qn,
|
|
3009
3013
|
nonce: L,
|
|
3010
3014
|
formId: L,
|
|
3011
3015
|
elementId: L
|
|
@@ -3015,7 +3019,7 @@ l.object({
|
|
|
3015
3019
|
isAvailable: l.boolean(),
|
|
3016
3020
|
startFlow: l.function(l.tuple([]), l.void())
|
|
3017
3021
|
});
|
|
3018
|
-
const
|
|
3022
|
+
const Kn = (r) => {
|
|
3019
3023
|
const e = {};
|
|
3020
3024
|
return Object.entries(r).forEach(([t, n]) => {
|
|
3021
3025
|
try {
|
|
@@ -3041,14 +3045,14 @@ const Hn = (r) => {
|
|
|
3041
3045
|
if (u.success)
|
|
3042
3046
|
return u.data;
|
|
3043
3047
|
{
|
|
3044
|
-
const c = u.error.format(), p =
|
|
3048
|
+
const c = u.error.format(), p = Kn(c);
|
|
3045
3049
|
for (const [k, T] of Object.entries(p))
|
|
3046
3050
|
n(k, T, k);
|
|
3047
3051
|
return null;
|
|
3048
3052
|
}
|
|
3049
|
-
},
|
|
3053
|
+
}, Yn = (r) => {
|
|
3050
3054
|
try {
|
|
3051
|
-
return
|
|
3055
|
+
return Hn.parse(r);
|
|
3052
3056
|
} catch (e) {
|
|
3053
3057
|
throw e;
|
|
3054
3058
|
}
|
|
@@ -3060,17 +3064,17 @@ const Hn = (r) => {
|
|
|
3060
3064
|
elementId: t
|
|
3061
3065
|
};
|
|
3062
3066
|
r.postMessage(JSON.stringify(a), s);
|
|
3063
|
-
},
|
|
3067
|
+
}, Jn = "https://cde.openpaystaging.com", Gn = {
|
|
3064
3068
|
usd: "usd",
|
|
3065
3069
|
brl: "brl"
|
|
3066
|
-
},
|
|
3070
|
+
}, bt = async (r) => {
|
|
3067
3071
|
for (let t = 0; t < 10; t++)
|
|
3068
|
-
|
|
3069
|
-
if (!
|
|
3072
|
+
At() || await Qn(500);
|
|
3073
|
+
if (!At())
|
|
3070
3074
|
throw new Error("Stripe JS not found.");
|
|
3071
3075
|
return new Stripe(r);
|
|
3072
|
-
},
|
|
3073
|
-
const n = await
|
|
3076
|
+
}, Xn = async (r, e, t) => {
|
|
3077
|
+
const n = await bt(r), s = Gn[t];
|
|
3074
3078
|
return n.paymentRequest({
|
|
3075
3079
|
// TODO: replace this with stripe account country as soon as we support it
|
|
3076
3080
|
country: "US",
|
|
@@ -3082,9 +3086,9 @@ const Hn = (r) => {
|
|
|
3082
3086
|
requestPayerName: !0,
|
|
3083
3087
|
requestPayerEmail: !0
|
|
3084
3088
|
});
|
|
3085
|
-
},
|
|
3089
|
+
}, Qn = (r) => new Promise((e) => {
|
|
3086
3090
|
setTimeout(e, r);
|
|
3087
|
-
}),
|
|
3091
|
+
}), At = () => "Stripe" in window, es = async (r) => new Promise((e, t) => {
|
|
3088
3092
|
try {
|
|
3089
3093
|
r.on("paymentmethod", async (n) => {
|
|
3090
3094
|
e(n);
|
|
@@ -3094,12 +3098,12 @@ const Hn = (r) => {
|
|
|
3094
3098
|
} catch (n) {
|
|
3095
3099
|
t(n);
|
|
3096
3100
|
}
|
|
3097
|
-
}),
|
|
3101
|
+
}), ts = (r) => {
|
|
3098
3102
|
const e = r == null ? void 0 : r.stripe_pk;
|
|
3099
3103
|
if (typeof e != "string")
|
|
3100
3104
|
throw new Error("Invalid: stripe_pk not passed in checkout payment method");
|
|
3101
3105
|
return e;
|
|
3102
|
-
},
|
|
3106
|
+
}, rs = async (r, e) => {
|
|
3103
3107
|
const t = r.nextActionMetadata;
|
|
3104
3108
|
if (!r.paymentFlowMetadata || !r.paymentFlowMetadata.stripePmId)
|
|
3105
3109
|
throw new Error(`Invalid payment flow metadata format: ${JSON.stringify(r.paymentFlowMetadata)}`);
|
|
@@ -3107,21 +3111,21 @@ const Hn = (r) => {
|
|
|
3107
3111
|
throw new Error(`Invalid next action metadata format: ${JSON.stringify(t)}`);
|
|
3108
3112
|
if (e.paymentMethod.id !== r.paymentFlowMetadata.stripePmId)
|
|
3109
3113
|
throw new Error(`PM ID mismatch: ${e.paymentMethod.id} != ${r.paymentFlowMetadata.stripePmId}`);
|
|
3110
|
-
const s = await (await
|
|
3114
|
+
const s = await (await bt(t.stripe_pk)).confirmCardSetup(t.client_secret, {
|
|
3111
3115
|
payment_method: r.paymentFlowMetadata.stripePmId
|
|
3112
3116
|
});
|
|
3113
3117
|
if (s.error)
|
|
3114
3118
|
throw e.complete("fail"), new Error(`Payment failed: ${s.error.message ?? "unknown"}`);
|
|
3115
3119
|
e.complete("success");
|
|
3116
|
-
},
|
|
3120
|
+
}, ns = async (r) => {
|
|
3117
3121
|
var a, i, o, u;
|
|
3118
|
-
const e = r.nextActionMetadata, n = await (await
|
|
3122
|
+
const e = r.nextActionMetadata, n = await (await bt(e.stripe_pk)).confirmCardSetup(e.client_secret, {
|
|
3119
3123
|
payment_method: e.stripe_pm_id
|
|
3120
3124
|
}), s = (a = n.setupIntent) == null ? void 0 : a.status;
|
|
3121
3125
|
if (s !== "succeeded") throw s === "canceled" ? new Error("Payment cancelled, please click Submit again to pay") : new Error(
|
|
3122
3126
|
`${((i = n.error) == null ? void 0 : i.message) ?? ((u = (o = n.setupIntent) == null ? void 0 : o.last_setup_error) == null ? void 0 : u.message) ?? "Payment failed, please click submit again to pay."}`
|
|
3123
3127
|
);
|
|
3124
|
-
},
|
|
3128
|
+
}, ss = (r = {}) => {
|
|
3125
3129
|
const [e, t] = N(r), n = Oe(
|
|
3126
3130
|
() => ({
|
|
3127
3131
|
set: (a, i) => {
|
|
@@ -3149,13 +3153,13 @@ const Hn = (r) => {
|
|
|
3149
3153
|
};
|
|
3150
3154
|
return [e, s];
|
|
3151
3155
|
};
|
|
3152
|
-
function
|
|
3156
|
+
function as(r) {
|
|
3153
3157
|
return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r;
|
|
3154
3158
|
}
|
|
3155
|
-
var
|
|
3159
|
+
var kt = { exports: {} }, is = _r;
|
|
3156
3160
|
function Qt(r, e, t) {
|
|
3157
3161
|
var n = typeof e == "function";
|
|
3158
|
-
|
|
3162
|
+
is.useEffect(function() {
|
|
3159
3163
|
var s, a = !0, i = r(function() {
|
|
3160
3164
|
return a;
|
|
3161
3165
|
});
|
|
@@ -3166,38 +3170,38 @@ function Qt(r, e, t) {
|
|
|
3166
3170
|
};
|
|
3167
3171
|
}, n ? t : e);
|
|
3168
3172
|
}
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
var
|
|
3172
|
-
const
|
|
3173
|
+
kt.exports = Qt;
|
|
3174
|
+
kt.exports.useAsyncEffect = Qt;
|
|
3175
|
+
var os = kt.exports;
|
|
3176
|
+
const cs = /* @__PURE__ */ as(os), ds = l.object({
|
|
3173
3177
|
type: l.string(),
|
|
3174
3178
|
loc: l.array(l.string()),
|
|
3175
3179
|
msg: l.string(),
|
|
3176
3180
|
url: l.string()
|
|
3177
|
-
}),
|
|
3181
|
+
}), us = l.array(ds), ls = l.object({
|
|
3178
3182
|
code: l.string(),
|
|
3179
3183
|
message: l.string(),
|
|
3180
3184
|
path: l.array(l.string())
|
|
3181
|
-
}),
|
|
3185
|
+
}), fs = l.array(ls), hs = {
|
|
3182
3186
|
"failed to fetch": "Connection error: please double check if you are connected to the internet, then try again"
|
|
3183
3187
|
}, gt = (r) => {
|
|
3184
3188
|
const e = r.toLowerCase().trim();
|
|
3185
|
-
return
|
|
3186
|
-
},
|
|
3189
|
+
return hs[e] ?? r;
|
|
3190
|
+
}, ps = (r) => {
|
|
3187
3191
|
try {
|
|
3188
3192
|
return typeof JSON.parse(r) == "object";
|
|
3189
3193
|
} catch {
|
|
3190
3194
|
return !1;
|
|
3191
3195
|
}
|
|
3192
|
-
},
|
|
3196
|
+
}, ms = (r) => r.length === 1 ? gt(r[0].msg) : `Please fix the following errors:
|
|
3193
3197
|
${r.map((t) => `• ${gt(t.msg)}`).join(`
|
|
3194
|
-
`)}`,
|
|
3198
|
+
`)}`, ys = (r) => `Encountered the following errors:
|
|
3195
3199
|
${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
3196
3200
|
`)}`, er = (r) => {
|
|
3197
3201
|
if (window.cur_error = r, r instanceof Error)
|
|
3198
|
-
if (
|
|
3202
|
+
if (ps(r.message)) {
|
|
3199
3203
|
const e = JSON.parse(r.message);
|
|
3200
|
-
return
|
|
3204
|
+
return us.safeParse(e).success ? ms(e) : fs.safeParse(e).success ? ys(e) : r.message;
|
|
3201
3205
|
} else
|
|
3202
3206
|
return gt(r.message);
|
|
3203
3207
|
if (typeof r == "object")
|
|
@@ -3208,10 +3212,10 @@ ${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
|
3208
3212
|
}
|
|
3209
3213
|
else
|
|
3210
3214
|
return r + "";
|
|
3211
|
-
},
|
|
3215
|
+
}, vs = l.enum(["apple_pay", "google_pay"]), _s = {
|
|
3212
3216
|
apple_pay: "applePay",
|
|
3213
3217
|
google_pay: "googlePay"
|
|
3214
|
-
},
|
|
3218
|
+
}, Pt = {
|
|
3215
3219
|
isLoading: !0,
|
|
3216
3220
|
isAvailable: !1,
|
|
3217
3221
|
startFlow: () => {
|
|
@@ -3221,21 +3225,21 @@ ${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
|
3221
3225
|
isAvailable: !1,
|
|
3222
3226
|
startFlow: () => {
|
|
3223
3227
|
}
|
|
3224
|
-
},
|
|
3225
|
-
const [o, u] =
|
|
3226
|
-
apple_pay:
|
|
3227
|
-
google_pay:
|
|
3228
|
+
}, xs = (r, e, t, n, s, a, i) => {
|
|
3229
|
+
const [o, u] = ss({
|
|
3230
|
+
apple_pay: Pt,
|
|
3231
|
+
google_pay: Pt
|
|
3228
3232
|
}), c = r === void 0 || e === void 0 || t === void 0 || !n;
|
|
3229
|
-
return
|
|
3233
|
+
return cs(async () => {
|
|
3230
3234
|
if (!c)
|
|
3231
|
-
for (const p of
|
|
3235
|
+
for (const p of vs.options) {
|
|
3232
3236
|
const k = p.replace("_", "");
|
|
3233
3237
|
try {
|
|
3234
|
-
const T = t.find((
|
|
3238
|
+
const T = t.find((re) => re.provider === p && re.processor_name === "stripe");
|
|
3235
3239
|
if (!T)
|
|
3236
3240
|
throw new Error(`${k} is not available as a checkout method`);
|
|
3237
|
-
const $ =
|
|
3238
|
-
if (!
|
|
3241
|
+
const $ = ts(T.metadata), ue = await Xn($, r, e), C = await ue.canMakePayment();
|
|
3242
|
+
if (!C)
|
|
3239
3243
|
throw new Error(`Cannot make payment with ${k} for this session`);
|
|
3240
3244
|
const nt = async () => {
|
|
3241
3245
|
try {
|
|
@@ -3249,16 +3253,16 @@ ${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
|
3249
3253
|
!1
|
|
3250
3254
|
))
|
|
3251
3255
|
return;
|
|
3252
|
-
|
|
3253
|
-
const
|
|
3254
|
-
s(
|
|
3255
|
-
} catch (
|
|
3256
|
-
i(er(
|
|
3256
|
+
ue.show();
|
|
3257
|
+
const re = await es(ue);
|
|
3258
|
+
s(re, T);
|
|
3259
|
+
} catch (re) {
|
|
3260
|
+
i(er(re));
|
|
3257
3261
|
}
|
|
3258
3262
|
};
|
|
3259
3263
|
u.set(p, {
|
|
3260
3264
|
isLoading: !1,
|
|
3261
|
-
isAvailable:
|
|
3265
|
+
isAvailable: C[_s[p]],
|
|
3262
3266
|
startFlow: nt
|
|
3263
3267
|
});
|
|
3264
3268
|
} catch {
|
|
@@ -3266,7 +3270,7 @@ ${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
|
3266
3270
|
}
|
|
3267
3271
|
}
|
|
3268
3272
|
}, [c, t]), o;
|
|
3269
|
-
},
|
|
3273
|
+
}, Es = (r) => {
|
|
3270
3274
|
const {
|
|
3271
3275
|
children: e,
|
|
3272
3276
|
checkoutSecureToken: t,
|
|
@@ -3281,102 +3285,103 @@ ${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
|
3281
3285
|
onCheckoutSuccess: k,
|
|
3282
3286
|
onCheckoutError: T,
|
|
3283
3287
|
onSetupPaymentMethodSuccess: $,
|
|
3284
|
-
baseUrl:
|
|
3285
|
-
} = r,
|
|
3286
|
-
(
|
|
3287
|
-
if (
|
|
3288
|
-
const
|
|
3289
|
-
if (
|
|
3288
|
+
baseUrl: ue
|
|
3289
|
+
} = r, C = ue ?? Jn, [nt, re] = N(void 0), [st, tr] = N([]), [rr, nr] = N("1px"), [at, sr] = N(!1), [J, we] = N(void 0), [wt, ye] = N(!1), [le, ar] = N([]), [ne, ir] = N({}), [Et, it] = N(0), [Tt, G] = N(!1), [W, or] = N(void 0), [ot, cr] = N(void 0), [ct, dr] = N(void 0), [X, ur] = N(void 0), [dt, lr] = N(void 0), Q = Oe(() => `opjs-form-${Mt()}`, []), q = Zt(null), ut = Te(
|
|
3290
|
+
(O) => {
|
|
3291
|
+
if (O.origin !== C || !O.source) return;
|
|
3292
|
+
const D = O.source, R = Yn(JSON.parse(O.data)), V = R.elementId;
|
|
3293
|
+
if (R.formId !== Q || !V || R.nonce in st)
|
|
3290
3294
|
return;
|
|
3291
|
-
tr((
|
|
3292
|
-
const w =
|
|
3293
|
-
if (
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3295
|
+
tr((P) => [...P, R.nonce]);
|
|
3296
|
+
const w = R.payload, j = w.type;
|
|
3297
|
+
if (j === b.enum.LAYOUT) {
|
|
3298
|
+
const P = w.height ? `${w.height}px` : "100%";
|
|
3299
|
+
nr(P);
|
|
3300
|
+
} else if (j === b.enum.FOCUS && s)
|
|
3301
|
+
s(R.elementId);
|
|
3302
|
+
else if (j === b.enum.BLUR && a)
|
|
3303
|
+
a(R.elementId);
|
|
3304
|
+
else if (j === b.enum.CHANGE && i)
|
|
3305
|
+
i(R.elementId);
|
|
3306
|
+
else if (j === b.enum.LOADED) {
|
|
3307
|
+
const P = le.find((S) => S.contentWindow === D);
|
|
3308
|
+
if (ye(!1), !P)
|
|
3302
3309
|
return;
|
|
3303
|
-
ir((
|
|
3304
|
-
|
|
3305
|
-
nr(R), dr(w.totalAmountAtoms), cr(w.currency), ur(w.checkoutPaymentMethods), q || or(w.sessionId);
|
|
3306
|
-
} else if (Z === b.enum.TOKENIZE_STARTED)
|
|
3310
|
+
ir((S) => ({ ...S, [V]: D })), dr(w.totalAmountAtoms), cr(w.currency), ur(w.checkoutPaymentMethods), W || or(w.sessionId);
|
|
3311
|
+
} else if (j === b.enum.TOKENIZE_STARTED)
|
|
3307
3312
|
ye(!0), p && p();
|
|
3308
|
-
else if (
|
|
3309
|
-
if (!
|
|
3313
|
+
else if (j === b.enum.PAYMENT_FLOW_STARTED) {
|
|
3314
|
+
if (!J)
|
|
3310
3315
|
throw new Error("extraData not populated");
|
|
3311
3316
|
(async () => {
|
|
3312
|
-
const
|
|
3313
|
-
if (
|
|
3314
|
-
await
|
|
3315
|
-
else if (
|
|
3316
|
-
if (!
|
|
3317
|
+
const S = w.nextActionMetadata.type;
|
|
3318
|
+
if (S !== void 0) if (S === "stripe_3ds")
|
|
3319
|
+
await ns(w);
|
|
3320
|
+
else if (S === "stripe_payment_request") {
|
|
3321
|
+
if (!dt)
|
|
3317
3322
|
throw new Error("Stripe PM not set");
|
|
3318
|
-
await
|
|
3323
|
+
await rs(w, dt);
|
|
3319
3324
|
} else
|
|
3320
|
-
throw new Error(`Unknown next action type: ${
|
|
3325
|
+
throw new Error(`Unknown next action type: ${S}`);
|
|
3321
3326
|
})().then(() => {
|
|
3322
|
-
var
|
|
3323
|
-
let
|
|
3324
|
-
if (
|
|
3327
|
+
var fe;
|
|
3328
|
+
let S;
|
|
3329
|
+
if (J.checkoutPaymentMethod.provider === "credit_card" && (S = (fe = w.startPFMetadata) == null ? void 0 : fe.cc_pm_id, !S))
|
|
3325
3330
|
throw new Error("CC PM ID not found");
|
|
3326
3331
|
Ee(
|
|
3327
|
-
|
|
3328
|
-
|
|
3332
|
+
D,
|
|
3333
|
+
Q,
|
|
3329
3334
|
V,
|
|
3330
|
-
{ ...
|
|
3331
|
-
|
|
3332
|
-
),
|
|
3333
|
-
}).catch((
|
|
3334
|
-
const
|
|
3335
|
-
ye(!1),
|
|
3335
|
+
{ ...J, type: "CHECKOUT", doNotUseLegacyCCFlow: !0, existingCCPMId: S },
|
|
3336
|
+
C
|
|
3337
|
+
), G(!0), we(void 0), p && p();
|
|
3338
|
+
}).catch((S) => {
|
|
3339
|
+
const fe = er(S);
|
|
3340
|
+
ye(!1), G(!1), T && T(fe);
|
|
3336
3341
|
});
|
|
3337
|
-
} else if (
|
|
3338
|
-
const
|
|
3339
|
-
!Tt && (
|
|
3340
|
-
} else if (
|
|
3341
|
-
ye(!1),
|
|
3342
|
-
else if (
|
|
3343
|
-
ye(!1),
|
|
3344
|
-
else if (
|
|
3342
|
+
} else if (j === b.enum.TOKENIZE_SUCCESS && J) {
|
|
3343
|
+
const P = Et + 1, S = P === Object.keys(ne).length;
|
|
3344
|
+
!Tt && (S || w.isReadyForCheckout) ? (Ee(D, Q, V, J, C), G(!0), we(void 0)) : it(P);
|
|
3345
|
+
} else if (j === b.enum.CHECKOUT_SUCCESS)
|
|
3346
|
+
ye(!1), it(0), G(!1), k && k(w.invoiceUrls, w.subscriptionIds, w.customerId);
|
|
3347
|
+
else if (j === b.enum.SETUP_PAYMENT_METHOD_SUCCESS)
|
|
3348
|
+
ye(!1), it(0), G(!1), $ && $(w.paymentMethodId);
|
|
3349
|
+
else if (j === b.enum.LOAD_ERROR)
|
|
3345
3350
|
u && u(w.message);
|
|
3346
|
-
else if (
|
|
3347
|
-
const
|
|
3348
|
-
(
|
|
3349
|
-
} else if (
|
|
3351
|
+
else if (j === b.enum.VALIDATION_ERROR) {
|
|
3352
|
+
const P = J == null ? void 0 : J.checkoutPaymentMethod.provider;
|
|
3353
|
+
(P === "credit_card" || P === void 0) && c && c(w.elementType, w.errors, V);
|
|
3354
|
+
} else if (j === b.enum.TOKENIZE_ERROR || j === b.enum.CHECKOUT_ERROR)
|
|
3350
3355
|
if (w.message === "3DS_REQUIRED") {
|
|
3351
|
-
const
|
|
3352
|
-
if (!
|
|
3353
|
-
for (const [
|
|
3354
|
-
if (!
|
|
3355
|
-
const
|
|
3356
|
+
const P = X == null ? void 0 : X.find((S) => S.provider === "credit_card");
|
|
3357
|
+
if (!W || !q.current || !c || !P) return;
|
|
3358
|
+
for (const [S, fe] of Object.entries(ne)) {
|
|
3359
|
+
if (!fe) continue;
|
|
3360
|
+
const ft = We(
|
|
3356
3361
|
b.enum.START_PAYMENT_FLOW,
|
|
3357
|
-
|
|
3358
|
-
|
|
3362
|
+
W,
|
|
3363
|
+
q.current,
|
|
3359
3364
|
c,
|
|
3360
3365
|
// Only stripe supports frontend 3DS right now,
|
|
3361
3366
|
// so we pass processor_name: 'stripe' to tell delegator to only use stripe
|
|
3362
|
-
{ ...
|
|
3367
|
+
{ ...P, processor_name: "stripe" },
|
|
3363
3368
|
!1
|
|
3364
3369
|
);
|
|
3365
|
-
if (
|
|
3366
|
-
|
|
3370
|
+
if (ft) {
|
|
3371
|
+
G(!0), we(ft), Ee(fe, Q, S, ft, C);
|
|
3367
3372
|
break;
|
|
3368
3373
|
}
|
|
3369
3374
|
}
|
|
3370
3375
|
} else
|
|
3371
|
-
ye(!1),
|
|
3376
|
+
ye(!1), G(!1), T && T(w.message);
|
|
3372
3377
|
},
|
|
3373
3378
|
[
|
|
3374
|
-
|
|
3375
|
-
|
|
3379
|
+
Q,
|
|
3380
|
+
W,
|
|
3376
3381
|
st,
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3382
|
+
J,
|
|
3383
|
+
le,
|
|
3384
|
+
ne,
|
|
3380
3385
|
Et,
|
|
3381
3386
|
Tt,
|
|
3382
3387
|
a,
|
|
@@ -3388,116 +3393,117 @@ ${r.map((t) => `- ${t.path.join("/")}: ${t.message}`).join(`
|
|
|
3388
3393
|
$,
|
|
3389
3394
|
T,
|
|
3390
3395
|
c,
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3396
|
+
C,
|
|
3397
|
+
dt,
|
|
3398
|
+
X
|
|
3394
3399
|
]
|
|
3395
3400
|
), fr = Te(() => {
|
|
3396
|
-
if (!
|
|
3397
|
-
const
|
|
3398
|
-
if (!
|
|
3401
|
+
if (!q.current || !c || !W || !X) return;
|
|
3402
|
+
const O = X.find((R) => R.provider === "credit_card");
|
|
3403
|
+
if (!O)
|
|
3399
3404
|
throw new Error("Card not available as a payment method in checkout");
|
|
3400
|
-
const
|
|
3405
|
+
const D = We(
|
|
3401
3406
|
b.enum.TOKENIZE,
|
|
3402
|
-
|
|
3403
|
-
|
|
3407
|
+
W,
|
|
3408
|
+
q.current,
|
|
3404
3409
|
c,
|
|
3405
|
-
|
|
3410
|
+
O,
|
|
3406
3411
|
!1
|
|
3407
3412
|
);
|
|
3408
|
-
if (
|
|
3409
|
-
for (const [
|
|
3410
|
-
V && Ee(V,
|
|
3411
|
-
|
|
3413
|
+
if (D) {
|
|
3414
|
+
for (const [R, V] of Object.entries(ne))
|
|
3415
|
+
V && Ee(V, Q, R, D, C);
|
|
3416
|
+
D.type = b.enum.CHECKOUT, we(D);
|
|
3412
3417
|
}
|
|
3413
|
-
}, [
|
|
3414
|
-
(
|
|
3415
|
-
wt &&
|
|
3418
|
+
}, [q, ne, Q, c, W, C, X]), lt = Te(
|
|
3419
|
+
(O) => {
|
|
3420
|
+
wt && O.preventDefault();
|
|
3416
3421
|
},
|
|
3417
3422
|
[wt]
|
|
3418
3423
|
);
|
|
3419
3424
|
qe(() => {
|
|
3420
|
-
if (
|
|
3421
|
-
|
|
3422
|
-
}, [
|
|
3423
|
-
window.removeEventListener("beforeunload",
|
|
3424
|
-
}), [
|
|
3425
|
+
if (at || !q.current) return;
|
|
3426
|
+
le.length > 0 && le.length === Object.keys(ne).length && (sr(!0), o && o(ct, ot));
|
|
3427
|
+
}, [le, ne, at, o, ct, ot]), qe(() => (re(window.location.origin), window.addEventListener("message", ut), window.addEventListener("beforeunload", lt), () => {
|
|
3428
|
+
window.removeEventListener("beforeunload", lt), window.removeEventListener("message", ut);
|
|
3429
|
+
}), [W, ut, lt]);
|
|
3425
3430
|
const hr = Te(
|
|
3426
|
-
(
|
|
3427
|
-
|
|
3431
|
+
(O) => {
|
|
3432
|
+
le.find((R) => R.contentWindow === O.contentWindow) || ar((R) => [...R, O]);
|
|
3428
3433
|
},
|
|
3429
|
-
[
|
|
3430
|
-
), pr = async (
|
|
3431
|
-
if (!(!
|
|
3432
|
-
for (const [
|
|
3434
|
+
[le]
|
|
3435
|
+
), pr = async (O, D) => {
|
|
3436
|
+
if (!(!q.current || !c || !W || !X))
|
|
3437
|
+
for (const [R, V] of Object.entries(ne)) {
|
|
3433
3438
|
if (!V) continue;
|
|
3434
3439
|
const Ct = {
|
|
3435
|
-
stripePmId:
|
|
3440
|
+
stripePmId: O.paymentMethod.id
|
|
3436
3441
|
}, w = We(
|
|
3437
3442
|
b.enum.START_PAYMENT_FLOW,
|
|
3438
|
-
|
|
3439
|
-
|
|
3443
|
+
W,
|
|
3444
|
+
q.current,
|
|
3440
3445
|
c,
|
|
3441
|
-
|
|
3446
|
+
D,
|
|
3442
3447
|
!1,
|
|
3443
3448
|
Ct
|
|
3444
3449
|
);
|
|
3445
3450
|
if (w) {
|
|
3446
|
-
lr(
|
|
3451
|
+
lr(O), G(!0), we(w), Ee(V, Q, R, w, C);
|
|
3447
3452
|
break;
|
|
3448
3453
|
}
|
|
3449
3454
|
}
|
|
3450
|
-
}, mr = (
|
|
3451
|
-
|
|
3455
|
+
}, mr = (O) => {
|
|
3456
|
+
G(!1), T && T(O);
|
|
3452
3457
|
}, yr = {
|
|
3453
|
-
formId:
|
|
3458
|
+
formId: Q,
|
|
3454
3459
|
formHeight: rr,
|
|
3455
3460
|
referer: nt,
|
|
3456
3461
|
checkoutSecureToken: t,
|
|
3457
3462
|
registerIframe: hr,
|
|
3458
|
-
baseUrl:
|
|
3459
|
-
}, St =
|
|
3463
|
+
baseUrl: C
|
|
3464
|
+
}, St = xs(
|
|
3465
|
+
ct,
|
|
3460
3466
|
ot,
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
H.current,
|
|
3467
|
+
X,
|
|
3468
|
+
q.current,
|
|
3464
3469
|
pr,
|
|
3465
3470
|
c,
|
|
3466
3471
|
mr
|
|
3467
|
-
),
|
|
3472
|
+
), vr = {
|
|
3468
3473
|
submit: fr,
|
|
3469
3474
|
applePay: St.apple_pay,
|
|
3470
|
-
googlePay: St.google_pay
|
|
3475
|
+
googlePay: St.google_pay,
|
|
3476
|
+
loaded: at
|
|
3471
3477
|
};
|
|
3472
|
-
return /* @__PURE__ */
|
|
3473
|
-
},
|
|
3474
|
-
const { subPath: e, styles: t } = r, { formId: n, referer: s, formHeight: a, checkoutSecureToken: i, registerIframe: o, baseUrl: u } = br(), [c, p] = N(!1), k = Zt(null), T = Oe(() => t ?
|
|
3478
|
+
return /* @__PURE__ */ ae(jt.Provider, { value: yr, children: /* @__PURE__ */ ae("div", { className: n, ref: q, children: e(vr) }) });
|
|
3479
|
+
}, bs = (r) => JSON.stringify(r), rt = (r) => {
|
|
3480
|
+
const { subPath: e, styles: t } = r, { formId: n, referer: s, formHeight: a, checkoutSecureToken: i, registerIframe: o, baseUrl: u } = br(), [c, p] = N(!1), k = Zt(null), T = Oe(() => t ? bs(t) : "", [t]), $ = Oe(() => ({
|
|
3475
3481
|
border: "none",
|
|
3476
3482
|
width: "100%",
|
|
3477
3483
|
height: a
|
|
3478
|
-
}), [a]),
|
|
3484
|
+
}), [a]), ue = Oe(() => {
|
|
3479
3485
|
if (!i || !s) return "";
|
|
3480
|
-
const
|
|
3481
|
-
return
|
|
3486
|
+
const C = new URLSearchParams();
|
|
3487
|
+
return C.append("referer", s), C.append("styles", T), C.append("formId", n), C.append("secureToken", i), C.toString();
|
|
3482
3488
|
}, [T, n, s, i]);
|
|
3483
3489
|
return qe(() => p(!0), []), qe(() => {
|
|
3484
3490
|
!k.current || !c || o(k.current);
|
|
3485
|
-
}, [c]), i ? /* @__PURE__ */
|
|
3491
|
+
}, [c]), i ? /* @__PURE__ */ ae(
|
|
3486
3492
|
"iframe",
|
|
3487
3493
|
{
|
|
3488
3494
|
name: `${e}-element`,
|
|
3489
|
-
src: `${u}/app/v1/${e}-element/?${
|
|
3495
|
+
src: `${u}/app/v1/${e}-element/?${ue}`,
|
|
3490
3496
|
style: $,
|
|
3491
3497
|
ref: k
|
|
3492
3498
|
}
|
|
3493
|
-
) : /* @__PURE__ */
|
|
3494
|
-
},
|
|
3499
|
+
) : /* @__PURE__ */ ae("div", {});
|
|
3500
|
+
}, Ts = ({ styles: r }) => /* @__PURE__ */ ae(rt, { styles: r, subPath: "card-cvc" }), Ss = ({ styles: r }) => /* @__PURE__ */ ae(rt, { styles: r, subPath: "card" }), Cs = ({ styles: r }) => /* @__PURE__ */ ae(rt, { styles: r, subPath: "card-expiry" }), Os = ({ styles: r }) => /* @__PURE__ */ ae(rt, { styles: r, subPath: "card-number" });
|
|
3495
3501
|
export {
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3502
|
+
Ts as CardCvcElement,
|
|
3503
|
+
Ss as CardElement,
|
|
3504
|
+
Cs as CardExpiryElement,
|
|
3505
|
+
Os as CardNumberElement,
|
|
3506
|
+
Es as ElementsForm,
|
|
3501
3507
|
et as FieldName,
|
|
3502
3508
|
br as useOpenPayElements
|
|
3503
3509
|
};
|