@getopenpay/openpay-js-react 0.0.16-alpha.a071c74 → 0.0.17-alpha.a0c8fb9
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 +4 -1
- package/dist/index.js +442 -430
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Wr, { createContext as Kr, useContext as Yr, useState as S, useMemo as ze, useCallback as
|
|
2
|
-
import { jsx as
|
|
1
|
+
import Wr, { createContext as Kr, useContext as Yr, useState as S, useMemo as ze, useCallback as ge, useRef as qe, useEffect as _e } from "react";
|
|
2
|
+
import { jsx as ve } from "react/jsx-runtime";
|
|
3
3
|
const nr = Kr({
|
|
4
4
|
formId: "",
|
|
5
5
|
formHeight: "",
|
|
@@ -37,7 +37,7 @@ function sr(t, e, r) {
|
|
|
37
37
|
var n = t.random || (t.rng || Qr)();
|
|
38
38
|
return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Gr(n);
|
|
39
39
|
}
|
|
40
|
-
var
|
|
40
|
+
var b;
|
|
41
41
|
(function(t) {
|
|
42
42
|
t.assertEqual = (s) => s;
|
|
43
43
|
function e(s) {
|
|
@@ -72,7 +72,7 @@ var x;
|
|
|
72
72
|
return s.map((o) => typeof o == "string" ? `'${o}'` : o).join(a);
|
|
73
73
|
}
|
|
74
74
|
t.joinValues = n, t.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
75
|
-
})(
|
|
75
|
+
})(b || (b = {}));
|
|
76
76
|
var St;
|
|
77
77
|
(function(t) {
|
|
78
78
|
t.mergeShapes = (e, r) => ({
|
|
@@ -81,7 +81,7 @@ var St;
|
|
|
81
81
|
// second overwrites first
|
|
82
82
|
});
|
|
83
83
|
})(St || (St = {}));
|
|
84
|
-
const p =
|
|
84
|
+
const p = b.arrayToEnum([
|
|
85
85
|
"string",
|
|
86
86
|
"nan",
|
|
87
87
|
"number",
|
|
@@ -102,7 +102,7 @@ const p = x.arrayToEnum([
|
|
|
102
102
|
"never",
|
|
103
103
|
"map",
|
|
104
104
|
"set"
|
|
105
|
-
]),
|
|
105
|
+
]), ye = (t) => {
|
|
106
106
|
switch (typeof t) {
|
|
107
107
|
case "undefined":
|
|
108
108
|
return p.undefined;
|
|
@@ -123,7 +123,7 @@ const p = x.arrayToEnum([
|
|
|
123
123
|
default:
|
|
124
124
|
return p.unknown;
|
|
125
125
|
}
|
|
126
|
-
}, l =
|
|
126
|
+
}, l = b.arrayToEnum([
|
|
127
127
|
"invalid_type",
|
|
128
128
|
"invalid_literal",
|
|
129
129
|
"custom",
|
|
@@ -185,7 +185,7 @@ class H extends Error {
|
|
|
185
185
|
return this.message;
|
|
186
186
|
}
|
|
187
187
|
get message() {
|
|
188
|
-
return JSON.stringify(this.issues,
|
|
188
|
+
return JSON.stringify(this.issues, b.jsonStringifyReplacer, 2);
|
|
189
189
|
}
|
|
190
190
|
get isEmpty() {
|
|
191
191
|
return this.issues.length === 0;
|
|
@@ -201,26 +201,26 @@ class H extends Error {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
H.create = (t) => new H(t);
|
|
204
|
-
const
|
|
204
|
+
const Ze = (t, e) => {
|
|
205
205
|
let r;
|
|
206
206
|
switch (t.code) {
|
|
207
207
|
case l.invalid_type:
|
|
208
208
|
t.received === p.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
|
|
209
209
|
break;
|
|
210
210
|
case l.invalid_literal:
|
|
211
|
-
r = `Invalid literal value, expected ${JSON.stringify(t.expected,
|
|
211
|
+
r = `Invalid literal value, expected ${JSON.stringify(t.expected, b.jsonStringifyReplacer)}`;
|
|
212
212
|
break;
|
|
213
213
|
case l.unrecognized_keys:
|
|
214
|
-
r = `Unrecognized key(s) in object: ${
|
|
214
|
+
r = `Unrecognized key(s) in object: ${b.joinValues(t.keys, ", ")}`;
|
|
215
215
|
break;
|
|
216
216
|
case l.invalid_union:
|
|
217
217
|
r = "Invalid input";
|
|
218
218
|
break;
|
|
219
219
|
case l.invalid_union_discriminator:
|
|
220
|
-
r = `Invalid discriminator value. Expected ${
|
|
220
|
+
r = `Invalid discriminator value. Expected ${b.joinValues(t.options)}`;
|
|
221
221
|
break;
|
|
222
222
|
case l.invalid_enum_value:
|
|
223
|
-
r = `Invalid enum value. Expected ${
|
|
223
|
+
r = `Invalid enum value. Expected ${b.joinValues(t.options)}, received '${t.received}'`;
|
|
224
224
|
break;
|
|
225
225
|
case l.invalid_arguments:
|
|
226
226
|
r = "Invalid function arguments";
|
|
@@ -232,7 +232,7 @@ const Me = (t, e) => {
|
|
|
232
232
|
r = "Invalid date";
|
|
233
233
|
break;
|
|
234
234
|
case l.invalid_string:
|
|
235
|
-
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` :
|
|
235
|
+
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : b.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
|
|
236
236
|
break;
|
|
237
237
|
case l.too_small:
|
|
238
238
|
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
|
|
@@ -253,11 +253,11 @@ const Me = (t, e) => {
|
|
|
253
253
|
r = "Number must be finite";
|
|
254
254
|
break;
|
|
255
255
|
default:
|
|
256
|
-
r = e.defaultError,
|
|
256
|
+
r = e.defaultError, b.assertNever(t);
|
|
257
257
|
}
|
|
258
258
|
return { message: r };
|
|
259
259
|
};
|
|
260
|
-
let ar =
|
|
260
|
+
let ar = Ze;
|
|
261
261
|
function rn(t) {
|
|
262
262
|
ar = t;
|
|
263
263
|
}
|
|
@@ -294,13 +294,13 @@ function m(t, e) {
|
|
|
294
294
|
t.common.contextualErrorMap,
|
|
295
295
|
t.schemaErrorMap,
|
|
296
296
|
r,
|
|
297
|
-
r ===
|
|
297
|
+
r === Ze ? void 0 : Ze
|
|
298
298
|
// then global default map
|
|
299
299
|
].filter((s) => !!s)
|
|
300
300
|
});
|
|
301
301
|
t.common.issues.push(n);
|
|
302
302
|
}
|
|
303
|
-
class
|
|
303
|
+
class D {
|
|
304
304
|
constructor() {
|
|
305
305
|
this.value = "valid";
|
|
306
306
|
}
|
|
@@ -328,7 +328,7 @@ class Z {
|
|
|
328
328
|
value: o
|
|
329
329
|
});
|
|
330
330
|
}
|
|
331
|
-
return
|
|
331
|
+
return D.mergeObjectSync(e, n);
|
|
332
332
|
}
|
|
333
333
|
static mergeObjectSync(e, r) {
|
|
334
334
|
const n = {};
|
|
@@ -343,7 +343,7 @@ class Z {
|
|
|
343
343
|
}
|
|
344
344
|
const g = Object.freeze({
|
|
345
345
|
status: "aborted"
|
|
346
|
-
}),
|
|
346
|
+
}), je = (t) => ({ status: "dirty", value: t }), U = (t) => ({ status: "valid", value: t }), Rt = (t) => t.status === "aborted", Ot = (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);
|
|
@@ -357,7 +357,7 @@ var h;
|
|
|
357
357
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
358
358
|
})(h || (h = {}));
|
|
359
359
|
var Ve, Fe;
|
|
360
|
-
class
|
|
360
|
+
class ce {
|
|
361
361
|
constructor(e, r, n, s) {
|
|
362
362
|
this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
|
|
363
363
|
}
|
|
@@ -400,13 +400,13 @@ class w {
|
|
|
400
400
|
return this._def.description;
|
|
401
401
|
}
|
|
402
402
|
_getType(e) {
|
|
403
|
-
return
|
|
403
|
+
return ye(e.data);
|
|
404
404
|
}
|
|
405
405
|
_getOrReturnCtx(e, r) {
|
|
406
406
|
return r || {
|
|
407
407
|
common: e.parent.common,
|
|
408
408
|
data: e.data,
|
|
409
|
-
parsedType:
|
|
409
|
+
parsedType: ye(e.data),
|
|
410
410
|
schemaErrorMap: this._def.errorMap,
|
|
411
411
|
path: e.path,
|
|
412
412
|
parent: e.parent
|
|
@@ -414,11 +414,11 @@ class w {
|
|
|
414
414
|
}
|
|
415
415
|
_processInputParams(e) {
|
|
416
416
|
return {
|
|
417
|
-
status: new
|
|
417
|
+
status: new D(),
|
|
418
418
|
ctx: {
|
|
419
419
|
common: e.parent.common,
|
|
420
420
|
data: e.data,
|
|
421
|
-
parsedType:
|
|
421
|
+
parsedType: ye(e.data),
|
|
422
422
|
schemaErrorMap: this._def.errorMap,
|
|
423
423
|
path: e.path,
|
|
424
424
|
parent: e.parent
|
|
@@ -453,7 +453,7 @@ class w {
|
|
|
453
453
|
schemaErrorMap: this._def.errorMap,
|
|
454
454
|
parent: null,
|
|
455
455
|
data: e,
|
|
456
|
-
parsedType:
|
|
456
|
+
parsedType: ye(e)
|
|
457
457
|
}, a = this._parseSync({ data: e, path: s.path, parent: s });
|
|
458
458
|
return Yt(s, a);
|
|
459
459
|
}
|
|
@@ -474,7 +474,7 @@ class w {
|
|
|
474
474
|
schemaErrorMap: this._def.errorMap,
|
|
475
475
|
parent: null,
|
|
476
476
|
data: e,
|
|
477
|
-
parsedType:
|
|
477
|
+
parsedType: ye(e)
|
|
478
478
|
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (He(s) ? s : Promise.resolve(s));
|
|
479
479
|
return Yt(n, a);
|
|
480
480
|
}
|
|
@@ -492,7 +492,7 @@ class w {
|
|
|
492
492
|
return this._refinement((n, s) => e(n) ? !0 : (s.addIssue(typeof r == "function" ? r(n, s) : r), !1));
|
|
493
493
|
}
|
|
494
494
|
_refinement(e) {
|
|
495
|
-
return new
|
|
495
|
+
return new ee({
|
|
496
496
|
schema: this,
|
|
497
497
|
typeName: y.ZodEffects,
|
|
498
498
|
effect: { type: "refinement", refinement: e }
|
|
@@ -502,19 +502,19 @@ class w {
|
|
|
502
502
|
return this._refinement(e);
|
|
503
503
|
}
|
|
504
504
|
optional() {
|
|
505
|
-
return
|
|
505
|
+
return ie.create(this, this._def);
|
|
506
506
|
}
|
|
507
507
|
nullable() {
|
|
508
|
-
return
|
|
508
|
+
return Ee.create(this, this._def);
|
|
509
509
|
}
|
|
510
510
|
nullish() {
|
|
511
511
|
return this.nullable().optional();
|
|
512
512
|
}
|
|
513
513
|
array() {
|
|
514
|
-
return
|
|
514
|
+
return Q.create(this, this._def);
|
|
515
515
|
}
|
|
516
516
|
promise() {
|
|
517
|
-
return
|
|
517
|
+
return $e.create(this, this._def);
|
|
518
518
|
}
|
|
519
519
|
or(e) {
|
|
520
520
|
return Je.create([this, e], this._def);
|
|
@@ -523,7 +523,7 @@ class w {
|
|
|
523
523
|
return Ge.create(this, e, this._def);
|
|
524
524
|
}
|
|
525
525
|
transform(e) {
|
|
526
|
-
return new
|
|
526
|
+
return new ee({
|
|
527
527
|
..._(this._def),
|
|
528
528
|
schema: this,
|
|
529
529
|
typeName: y.ZodEffects,
|
|
@@ -593,7 +593,7 @@ function dr(t) {
|
|
|
593
593
|
function _n(t, e) {
|
|
594
594
|
return !!((e === "v4" || !e) && mn.test(t) || (e === "v6" || !e) && pn.test(t));
|
|
595
595
|
}
|
|
596
|
-
class
|
|
596
|
+
class X 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 G extends w {
|
|
|
603
603
|
received: a.parsedType
|
|
604
604
|
}), g;
|
|
605
605
|
}
|
|
606
|
-
const n = new
|
|
606
|
+
const n = new D();
|
|
607
607
|
let s;
|
|
608
608
|
for (const a of this._def.checks)
|
|
609
609
|
if (a.kind === "min")
|
|
@@ -733,7 +733,7 @@ class G extends w {
|
|
|
733
733
|
validation: "base64",
|
|
734
734
|
code: l.invalid_string,
|
|
735
735
|
message: a.message
|
|
736
|
-
}), n.dirty()) :
|
|
736
|
+
}), n.dirty()) : b.assertNever(a);
|
|
737
737
|
return { status: n.value, value: e.data };
|
|
738
738
|
}
|
|
739
739
|
_regex(e, r, n) {
|
|
@@ -744,7 +744,7 @@ class G extends w {
|
|
|
744
744
|
});
|
|
745
745
|
}
|
|
746
746
|
_addCheck(e) {
|
|
747
|
-
return new
|
|
747
|
+
return new X({
|
|
748
748
|
...this._def,
|
|
749
749
|
checks: [...this._def.checks, e]
|
|
750
750
|
});
|
|
@@ -870,19 +870,19 @@ class G extends w {
|
|
|
870
870
|
return this.min(1, h.errToObj(e));
|
|
871
871
|
}
|
|
872
872
|
trim() {
|
|
873
|
-
return new
|
|
873
|
+
return new X({
|
|
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 X({
|
|
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 X({
|
|
886
886
|
...this._def,
|
|
887
887
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
888
888
|
});
|
|
@@ -942,9 +942,9 @@ class G extends w {
|
|
|
942
942
|
return e;
|
|
943
943
|
}
|
|
944
944
|
}
|
|
945
|
-
|
|
945
|
+
X.create = (t) => {
|
|
946
946
|
var e;
|
|
947
|
-
return new
|
|
947
|
+
return new X({
|
|
948
948
|
checks: [],
|
|
949
949
|
typeName: y.ZodString,
|
|
950
950
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
|
|
@@ -955,7 +955,7 @@ function vn(t, e) {
|
|
|
955
955
|
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = parseInt(t.toFixed(s).replace(".", "")), o = parseInt(e.toFixed(s).replace(".", ""));
|
|
956
956
|
return a % o / Math.pow(10, s);
|
|
957
957
|
}
|
|
958
|
-
class
|
|
958
|
+
class we extends w {
|
|
959
959
|
constructor() {
|
|
960
960
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
961
961
|
}
|
|
@@ -969,9 +969,9 @@ class ve extends w {
|
|
|
969
969
|
}), g;
|
|
970
970
|
}
|
|
971
971
|
let n;
|
|
972
|
-
const s = new
|
|
972
|
+
const s = new D();
|
|
973
973
|
for (const a of this._def.checks)
|
|
974
|
-
a.kind === "int" ?
|
|
974
|
+
a.kind === "int" ? b.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), m(n, {
|
|
975
975
|
code: l.invalid_type,
|
|
976
976
|
expected: "integer",
|
|
977
977
|
received: "float",
|
|
@@ -997,7 +997,7 @@ class ve extends w {
|
|
|
997
997
|
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), m(n, {
|
|
998
998
|
code: l.not_finite,
|
|
999
999
|
message: a.message
|
|
1000
|
-
}), s.dirty()) :
|
|
1000
|
+
}), s.dirty()) : b.assertNever(a);
|
|
1001
1001
|
return { status: s.value, value: e.data };
|
|
1002
1002
|
}
|
|
1003
1003
|
gte(e, r) {
|
|
@@ -1013,7 +1013,7 @@ class ve extends w {
|
|
|
1013
1013
|
return this.setLimit("max", e, !1, h.toString(r));
|
|
1014
1014
|
}
|
|
1015
1015
|
setLimit(e, r, n, s) {
|
|
1016
|
-
return new
|
|
1016
|
+
return new we({
|
|
1017
1017
|
...this._def,
|
|
1018
1018
|
checks: [
|
|
1019
1019
|
...this._def.checks,
|
|
@@ -1027,7 +1027,7 @@ class ve extends w {
|
|
|
1027
1027
|
});
|
|
1028
1028
|
}
|
|
1029
1029
|
_addCheck(e) {
|
|
1030
|
-
return new
|
|
1030
|
+
return new we({
|
|
1031
1031
|
...this._def,
|
|
1032
1032
|
checks: [...this._def.checks, e]
|
|
1033
1033
|
});
|
|
@@ -1109,7 +1109,7 @@ class ve extends w {
|
|
|
1109
1109
|
return e;
|
|
1110
1110
|
}
|
|
1111
1111
|
get isInt() {
|
|
1112
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1112
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && b.isInteger(e.value));
|
|
1113
1113
|
}
|
|
1114
1114
|
get isFinite() {
|
|
1115
1115
|
let e = null, r = null;
|
|
@@ -1121,13 +1121,13 @@ class ve extends w {
|
|
|
1121
1121
|
return Number.isFinite(r) && Number.isFinite(e);
|
|
1122
1122
|
}
|
|
1123
1123
|
}
|
|
1124
|
-
|
|
1124
|
+
we.create = (t) => new we({
|
|
1125
1125
|
checks: [],
|
|
1126
1126
|
typeName: y.ZodNumber,
|
|
1127
1127
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1128
1128
|
..._(t)
|
|
1129
1129
|
});
|
|
1130
|
-
class
|
|
1130
|
+
class be extends w {
|
|
1131
1131
|
constructor() {
|
|
1132
1132
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1133
1133
|
}
|
|
@@ -1141,7 +1141,7 @@ class we extends w {
|
|
|
1141
1141
|
}), g;
|
|
1142
1142
|
}
|
|
1143
1143
|
let n;
|
|
1144
|
-
const s = new
|
|
1144
|
+
const s = new D();
|
|
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,
|
|
@@ -1159,7 +1159,7 @@ class we extends w {
|
|
|
1159
1159
|
code: l.not_multiple_of,
|
|
1160
1160
|
multipleOf: a.value,
|
|
1161
1161
|
message: a.message
|
|
1162
|
-
}), s.dirty()) :
|
|
1162
|
+
}), s.dirty()) : b.assertNever(a);
|
|
1163
1163
|
return { status: s.value, value: e.data };
|
|
1164
1164
|
}
|
|
1165
1165
|
gte(e, r) {
|
|
@@ -1175,7 +1175,7 @@ class we extends w {
|
|
|
1175
1175
|
return this.setLimit("max", e, !1, h.toString(r));
|
|
1176
1176
|
}
|
|
1177
1177
|
setLimit(e, r, n, s) {
|
|
1178
|
-
return new
|
|
1178
|
+
return new be({
|
|
1179
1179
|
...this._def,
|
|
1180
1180
|
checks: [
|
|
1181
1181
|
...this._def.checks,
|
|
@@ -1189,7 +1189,7 @@ class we extends w {
|
|
|
1189
1189
|
});
|
|
1190
1190
|
}
|
|
1191
1191
|
_addCheck(e) {
|
|
1192
|
-
return new
|
|
1192
|
+
return new be({
|
|
1193
1193
|
...this._def,
|
|
1194
1194
|
checks: [...this._def.checks, e]
|
|
1195
1195
|
});
|
|
@@ -1246,9 +1246,9 @@ class we extends w {
|
|
|
1246
1246
|
return e;
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
|
-
|
|
1249
|
+
be.create = (t) => {
|
|
1250
1250
|
var e;
|
|
1251
|
-
return new
|
|
1251
|
+
return new be({
|
|
1252
1252
|
checks: [],
|
|
1253
1253
|
typeName: y.ZodBigInt,
|
|
1254
1254
|
coerce: (e = t == null ? void 0 : t.coerce) !== null && e !== void 0 ? e : !1,
|
|
@@ -1265,7 +1265,7 @@ class We extends w {
|
|
|
1265
1265
|
received: n.parsedType
|
|
1266
1266
|
}), g;
|
|
1267
1267
|
}
|
|
1268
|
-
return
|
|
1268
|
+
return U(e.data);
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
1271
|
We.create = (t) => new We({
|
|
@@ -1273,7 +1273,7 @@ We.create = (t) => new We({
|
|
|
1273
1273
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1274
1274
|
..._(t)
|
|
1275
1275
|
});
|
|
1276
|
-
class
|
|
1276
|
+
class Ie extends w {
|
|
1277
1277
|
_parse(e) {
|
|
1278
1278
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
1279
1279
|
const a = this._getOrReturnCtx(e);
|
|
@@ -1289,7 +1289,7 @@ class Oe extends w {
|
|
|
1289
1289
|
code: l.invalid_date
|
|
1290
1290
|
}), g;
|
|
1291
1291
|
}
|
|
1292
|
-
const n = new
|
|
1292
|
+
const n = new D();
|
|
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, {
|
|
@@ -1306,14 +1306,14 @@ class Oe extends w {
|
|
|
1306
1306
|
exact: !1,
|
|
1307
1307
|
maximum: a.value,
|
|
1308
1308
|
type: "date"
|
|
1309
|
-
}), n.dirty()) :
|
|
1309
|
+
}), n.dirty()) : b.assertNever(a);
|
|
1310
1310
|
return {
|
|
1311
1311
|
status: n.value,
|
|
1312
1312
|
value: new Date(e.data.getTime())
|
|
1313
1313
|
};
|
|
1314
1314
|
}
|
|
1315
1315
|
_addCheck(e) {
|
|
1316
|
-
return new
|
|
1316
|
+
return new Ie({
|
|
1317
1317
|
...this._def,
|
|
1318
1318
|
checks: [...this._def.checks, e]
|
|
1319
1319
|
});
|
|
@@ -1345,7 +1345,7 @@ class Oe extends w {
|
|
|
1345
1345
|
return e != null ? new Date(e) : null;
|
|
1346
1346
|
}
|
|
1347
1347
|
}
|
|
1348
|
-
|
|
1348
|
+
Ie.create = (t) => new Ie({
|
|
1349
1349
|
checks: [],
|
|
1350
1350
|
coerce: (t == null ? void 0 : t.coerce) || !1,
|
|
1351
1351
|
typeName: y.ZodDate,
|
|
@@ -1361,7 +1361,7 @@ class ht extends w {
|
|
|
1361
1361
|
received: n.parsedType
|
|
1362
1362
|
}), g;
|
|
1363
1363
|
}
|
|
1364
|
-
return
|
|
1364
|
+
return U(e.data);
|
|
1365
1365
|
}
|
|
1366
1366
|
}
|
|
1367
1367
|
ht.create = (t) => new ht({
|
|
@@ -1378,7 +1378,7 @@ class Ke extends w {
|
|
|
1378
1378
|
received: n.parsedType
|
|
1379
1379
|
}), g;
|
|
1380
1380
|
}
|
|
1381
|
-
return
|
|
1381
|
+
return U(e.data);
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
1384
1384
|
Ke.create = (t) => new Ke({
|
|
@@ -1395,38 +1395,38 @@ class Ye extends w {
|
|
|
1395
1395
|
received: n.parsedType
|
|
1396
1396
|
}), g;
|
|
1397
1397
|
}
|
|
1398
|
-
return
|
|
1398
|
+
return U(e.data);
|
|
1399
1399
|
}
|
|
1400
1400
|
}
|
|
1401
1401
|
Ye.create = (t) => new Ye({
|
|
1402
1402
|
typeName: y.ZodNull,
|
|
1403
1403
|
..._(t)
|
|
1404
1404
|
});
|
|
1405
|
-
class
|
|
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 U(e.data);
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
|
-
|
|
1413
|
+
De.create = (t) => new De({
|
|
1414
1414
|
typeName: y.ZodAny,
|
|
1415
1415
|
..._(t)
|
|
1416
1416
|
});
|
|
1417
|
-
class
|
|
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 U(e.data);
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
|
-
|
|
1425
|
+
Oe.create = (t) => new Oe({
|
|
1426
1426
|
typeName: y.ZodUnknown,
|
|
1427
1427
|
..._(t)
|
|
1428
1428
|
});
|
|
1429
|
-
class
|
|
1429
|
+
class me extends w {
|
|
1430
1430
|
_parse(e) {
|
|
1431
1431
|
const r = this._getOrReturnCtx(e);
|
|
1432
1432
|
return m(r, {
|
|
@@ -1436,7 +1436,7 @@ class le extends w {
|
|
|
1436
1436
|
}), g;
|
|
1437
1437
|
}
|
|
1438
1438
|
}
|
|
1439
|
-
|
|
1439
|
+
me.create = (t) => new me({
|
|
1440
1440
|
typeName: y.ZodNever,
|
|
1441
1441
|
..._(t)
|
|
1442
1442
|
});
|
|
@@ -1450,14 +1450,14 @@ class yt extends w {
|
|
|
1450
1450
|
received: n.parsedType
|
|
1451
1451
|
}), g;
|
|
1452
1452
|
}
|
|
1453
|
-
return
|
|
1453
|
+
return U(e.data);
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
1456
|
yt.create = (t) => new yt({
|
|
1457
1457
|
typeName: y.ZodVoid,
|
|
1458
1458
|
..._(t)
|
|
1459
1459
|
});
|
|
1460
|
-
class
|
|
1460
|
+
class Q 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 X extends w {
|
|
|
1493
1493
|
exact: !1,
|
|
1494
1494
|
message: s.maxLength.message
|
|
1495
1495
|
}), n.dirty()), r.common.async)
|
|
1496
|
-
return Promise.all([...r.data].map((o, c) => s.type._parseAsync(new
|
|
1497
|
-
const a = [...r.data].map((o, c) => s.type._parseSync(new
|
|
1498
|
-
return
|
|
1496
|
+
return Promise.all([...r.data].map((o, c) => s.type._parseAsync(new ce(r, o, r.path, c)))).then((o) => D.mergeArray(n, o));
|
|
1497
|
+
const a = [...r.data].map((o, c) => s.type._parseSync(new ce(r, o, r.path, c)));
|
|
1498
|
+
return D.mergeArray(n, a);
|
|
1499
1499
|
}
|
|
1500
1500
|
get element() {
|
|
1501
1501
|
return this._def.type;
|
|
1502
1502
|
}
|
|
1503
1503
|
min(e, r) {
|
|
1504
|
-
return new
|
|
1504
|
+
return new Q({
|
|
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 Q({
|
|
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 Q({
|
|
1517
1517
|
...this._def,
|
|
1518
1518
|
exactLength: { value: e, message: h.toString(r) }
|
|
1519
1519
|
});
|
|
@@ -1522,7 +1522,7 @@ class X extends w {
|
|
|
1522
1522
|
return this.min(1, e);
|
|
1523
1523
|
}
|
|
1524
1524
|
}
|
|
1525
|
-
|
|
1525
|
+
Q.create = (t, e) => new Q({
|
|
1526
1526
|
type: t,
|
|
1527
1527
|
minLength: null,
|
|
1528
1528
|
maxLength: null,
|
|
@@ -1530,21 +1530,21 @@ X.create = (t, e) => new X({
|
|
|
1530
1530
|
typeName: y.ZodArray,
|
|
1531
1531
|
..._(e)
|
|
1532
1532
|
});
|
|
1533
|
-
function
|
|
1533
|
+
function Ne(t) {
|
|
1534
1534
|
if (t instanceof R) {
|
|
1535
1535
|
const e = {};
|
|
1536
1536
|
for (const r in t.shape) {
|
|
1537
1537
|
const n = t.shape[r];
|
|
1538
|
-
e[r] =
|
|
1538
|
+
e[r] = ie.create(Ne(n));
|
|
1539
1539
|
}
|
|
1540
1540
|
return new R({
|
|
1541
1541
|
...t._def,
|
|
1542
1542
|
shape: () => e
|
|
1543
1543
|
});
|
|
1544
|
-
} else return t instanceof
|
|
1544
|
+
} else return t instanceof Q ? new Q({
|
|
1545
1545
|
...t._def,
|
|
1546
|
-
type:
|
|
1547
|
-
}) : t instanceof
|
|
1546
|
+
type: Ne(t.element)
|
|
1547
|
+
}) : t instanceof ie ? ie.create(Ne(t.unwrap())) : t instanceof Ee ? Ee.create(Ne(t.unwrap())) : t instanceof de ? de.create(t.items.map((e) => Ne(e))) : t;
|
|
1548
1548
|
}
|
|
1549
1549
|
class R extends w {
|
|
1550
1550
|
constructor() {
|
|
@@ -1553,7 +1553,7 @@ class R extends w {
|
|
|
1553
1553
|
_getCached() {
|
|
1554
1554
|
if (this._cached !== null)
|
|
1555
1555
|
return this._cached;
|
|
1556
|
-
const e = this._def.shape(), r =
|
|
1556
|
+
const e = this._def.shape(), r = b.objectKeys(e);
|
|
1557
1557
|
return this._cached = { shape: e, keys: r };
|
|
1558
1558
|
}
|
|
1559
1559
|
_parse(e) {
|
|
@@ -1566,7 +1566,7 @@ class R extends w {
|
|
|
1566
1566
|
}), g;
|
|
1567
1567
|
}
|
|
1568
1568
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: o } = this._getCached(), c = [];
|
|
1569
|
-
if (!(this._def.catchall instanceof
|
|
1569
|
+
if (!(this._def.catchall instanceof me && this._def.unknownKeys === "strip"))
|
|
1570
1570
|
for (const d in s.data)
|
|
1571
1571
|
o.includes(d) || c.push(d);
|
|
1572
1572
|
const u = [];
|
|
@@ -1574,11 +1574,11 @@ class R extends w {
|
|
|
1574
1574
|
const f = a[d], v = s.data[d];
|
|
1575
1575
|
u.push({
|
|
1576
1576
|
key: { status: "valid", value: d },
|
|
1577
|
-
value: f._parse(new
|
|
1577
|
+
value: f._parse(new ce(s, v, s.path, d)),
|
|
1578
1578
|
alwaysSet: d in s.data
|
|
1579
1579
|
});
|
|
1580
1580
|
}
|
|
1581
|
-
if (this._def.catchall instanceof
|
|
1581
|
+
if (this._def.catchall instanceof me) {
|
|
1582
1582
|
const d = this._def.unknownKeys;
|
|
1583
1583
|
if (d === "passthrough")
|
|
1584
1584
|
for (const f of c)
|
|
@@ -1599,7 +1599,7 @@ class R extends w {
|
|
|
1599
1599
|
u.push({
|
|
1600
1600
|
key: { status: "valid", value: f },
|
|
1601
1601
|
value: d._parse(
|
|
1602
|
-
new
|
|
1602
|
+
new ce(s, v, s.path, f)
|
|
1603
1603
|
//, ctx.child(key), value, getParsedType(value)
|
|
1604
1604
|
),
|
|
1605
1605
|
alwaysSet: f in s.data
|
|
@@ -1609,15 +1609,15 @@ class R extends w {
|
|
|
1609
1609
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
1610
1610
|
const d = [];
|
|
1611
1611
|
for (const f of u) {
|
|
1612
|
-
const v = await f.key,
|
|
1612
|
+
const v = await f.key, x = await f.value;
|
|
1613
1613
|
d.push({
|
|
1614
1614
|
key: v,
|
|
1615
|
-
value:
|
|
1615
|
+
value: x,
|
|
1616
1616
|
alwaysSet: f.alwaysSet
|
|
1617
1617
|
});
|
|
1618
1618
|
}
|
|
1619
1619
|
return d;
|
|
1620
|
-
}).then((d) =>
|
|
1620
|
+
}).then((d) => D.mergeObjectSync(n, d)) : D.mergeObjectSync(n, u);
|
|
1621
1621
|
}
|
|
1622
1622
|
get shape() {
|
|
1623
1623
|
return this._def.shape();
|
|
@@ -1760,7 +1760,7 @@ class R extends w {
|
|
|
1760
1760
|
}
|
|
1761
1761
|
pick(e) {
|
|
1762
1762
|
const r = {};
|
|
1763
|
-
return
|
|
1763
|
+
return b.objectKeys(e).forEach((n) => {
|
|
1764
1764
|
e[n] && this.shape[n] && (r[n] = this.shape[n]);
|
|
1765
1765
|
}), new R({
|
|
1766
1766
|
...this._def,
|
|
@@ -1769,7 +1769,7 @@ class R extends w {
|
|
|
1769
1769
|
}
|
|
1770
1770
|
omit(e) {
|
|
1771
1771
|
const r = {};
|
|
1772
|
-
return
|
|
1772
|
+
return b.objectKeys(this.shape).forEach((n) => {
|
|
1773
1773
|
e[n] || (r[n] = this.shape[n]);
|
|
1774
1774
|
}), new R({
|
|
1775
1775
|
...this._def,
|
|
@@ -1780,11 +1780,11 @@ class R extends w {
|
|
|
1780
1780
|
* @deprecated
|
|
1781
1781
|
*/
|
|
1782
1782
|
deepPartial() {
|
|
1783
|
-
return
|
|
1783
|
+
return Ne(this);
|
|
1784
1784
|
}
|
|
1785
1785
|
partial(e) {
|
|
1786
1786
|
const r = {};
|
|
1787
|
-
return
|
|
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
1790
|
}), new R({
|
|
@@ -1794,12 +1794,12 @@ class R extends w {
|
|
|
1794
1794
|
}
|
|
1795
1795
|
required(e) {
|
|
1796
1796
|
const r = {};
|
|
1797
|
-
return
|
|
1797
|
+
return b.objectKeys(this.shape).forEach((n) => {
|
|
1798
1798
|
if (e && !e[n])
|
|
1799
1799
|
r[n] = this.shape[n];
|
|
1800
1800
|
else {
|
|
1801
1801
|
let a = this.shape[n];
|
|
1802
|
-
for (; a instanceof
|
|
1802
|
+
for (; a instanceof ie; )
|
|
1803
1803
|
a = a._def.innerType;
|
|
1804
1804
|
r[n] = a;
|
|
1805
1805
|
}
|
|
@@ -1809,27 +1809,27 @@ class R extends w {
|
|
|
1809
1809
|
});
|
|
1810
1810
|
}
|
|
1811
1811
|
keyof() {
|
|
1812
|
-
return ur(
|
|
1812
|
+
return ur(b.objectKeys(this.shape));
|
|
1813
1813
|
}
|
|
1814
1814
|
}
|
|
1815
1815
|
R.create = (t, e) => new R({
|
|
1816
1816
|
shape: () => t,
|
|
1817
1817
|
unknownKeys: "strip",
|
|
1818
|
-
catchall:
|
|
1818
|
+
catchall: me.create(),
|
|
1819
1819
|
typeName: y.ZodObject,
|
|
1820
1820
|
..._(e)
|
|
1821
1821
|
});
|
|
1822
1822
|
R.strictCreate = (t, e) => new R({
|
|
1823
1823
|
shape: () => t,
|
|
1824
1824
|
unknownKeys: "strict",
|
|
1825
|
-
catchall:
|
|
1825
|
+
catchall: me.create(),
|
|
1826
1826
|
typeName: y.ZodObject,
|
|
1827
1827
|
..._(e)
|
|
1828
1828
|
});
|
|
1829
1829
|
R.lazycreate = (t, e) => new R({
|
|
1830
1830
|
shape: t,
|
|
1831
1831
|
unknownKeys: "strip",
|
|
1832
|
-
catchall:
|
|
1832
|
+
catchall: me.create(),
|
|
1833
1833
|
typeName: y.ZodObject,
|
|
1834
1834
|
..._(e)
|
|
1835
1835
|
});
|
|
@@ -1906,7 +1906,7 @@ Je.create = (t, e) => new Je({
|
|
|
1906
1906
|
typeName: y.ZodUnion,
|
|
1907
1907
|
..._(e)
|
|
1908
1908
|
});
|
|
1909
|
-
const
|
|
1909
|
+
const fe = (t) => t instanceof Qe ? fe(t.schema) : t instanceof ee ? fe(t.innerType()) : t instanceof et ? [t.value] : t instanceof xe ? t.options : t instanceof tt ? b.objectValues(t.enum) : t instanceof rt ? fe(t._def.innerType) : t instanceof Ke ? [void 0] : t instanceof Ye ? [null] : t instanceof ie ? [void 0, ...fe(t.unwrap())] : t instanceof Ee ? [null, ...fe(t.unwrap())] : t instanceof jt || t instanceof st ? fe(t.unwrap()) : t instanceof nt ? fe(t._def.innerType) : [];
|
|
1910
1910
|
class wt extends w {
|
|
1911
1911
|
_parse(e) {
|
|
1912
1912
|
const { ctx: r } = this._processInputParams(e);
|
|
@@ -1951,7 +1951,7 @@ class wt extends w {
|
|
|
1951
1951
|
static create(e, r, n) {
|
|
1952
1952
|
const s = /* @__PURE__ */ new Map();
|
|
1953
1953
|
for (const a of r) {
|
|
1954
|
-
const o =
|
|
1954
|
+
const o = fe(a.shape[e]);
|
|
1955
1955
|
if (!o.length)
|
|
1956
1956
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1957
1957
|
for (const c of o) {
|
|
@@ -1970,11 +1970,11 @@ class wt extends w {
|
|
|
1970
1970
|
}
|
|
1971
1971
|
}
|
|
1972
1972
|
function It(t, e) {
|
|
1973
|
-
const r =
|
|
1973
|
+
const r = ye(t), n = ye(e);
|
|
1974
1974
|
if (t === e)
|
|
1975
1975
|
return { valid: !0, data: t };
|
|
1976
1976
|
if (r === p.object && n === p.object) {
|
|
1977
|
-
const s =
|
|
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
1979
|
const u = It(t[c], e[c]);
|
|
1980
1980
|
if (!u.valid)
|
|
@@ -2033,7 +2033,7 @@ Ge.create = (t, e, r) => new Ge({
|
|
|
2033
2033
|
typeName: y.ZodIntersection,
|
|
2034
2034
|
..._(r)
|
|
2035
2035
|
});
|
|
2036
|
-
class
|
|
2036
|
+
class de extends w {
|
|
2037
2037
|
_parse(e) {
|
|
2038
2038
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2039
2039
|
if (n.parsedType !== p.array)
|
|
@@ -2059,24 +2059,24 @@ class oe extends w {
|
|
|
2059
2059
|
}), r.dirty());
|
|
2060
2060
|
const a = [...n.data].map((o, c) => {
|
|
2061
2061
|
const u = this._def.items[c] || this._def.rest;
|
|
2062
|
-
return u ? u._parse(new
|
|
2062
|
+
return u ? u._parse(new ce(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) => D.mergeArray(r, o)) : D.mergeArray(r, 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 de({
|
|
2071
2071
|
...this._def,
|
|
2072
2072
|
rest: e
|
|
2073
2073
|
});
|
|
2074
2074
|
}
|
|
2075
2075
|
}
|
|
2076
|
-
|
|
2076
|
+
de.create = (t, e) => {
|
|
2077
2077
|
if (!Array.isArray(t))
|
|
2078
2078
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2079
|
-
return new
|
|
2079
|
+
return new de({
|
|
2080
2080
|
items: t,
|
|
2081
2081
|
typeName: y.ZodTuple,
|
|
2082
2082
|
rest: null,
|
|
@@ -2101,11 +2101,11 @@ class Xe extends w {
|
|
|
2101
2101
|
const s = [], a = this._def.keyType, o = this._def.valueType;
|
|
2102
2102
|
for (const c in n.data)
|
|
2103
2103
|
s.push({
|
|
2104
|
-
key: a._parse(new
|
|
2105
|
-
value: o._parse(new
|
|
2104
|
+
key: a._parse(new ce(n, c, n.path, c)),
|
|
2105
|
+
value: o._parse(new ce(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 ? D.mergeObjectAsync(r, s) : D.mergeObjectSync(r, s);
|
|
2109
2109
|
}
|
|
2110
2110
|
get element() {
|
|
2111
2111
|
return this._def.valueType;
|
|
@@ -2117,7 +2117,7 @@ class Xe extends w {
|
|
|
2117
2117
|
typeName: y.ZodRecord,
|
|
2118
2118
|
..._(n)
|
|
2119
2119
|
}) : new Xe({
|
|
2120
|
-
keyType:
|
|
2120
|
+
keyType: X.create(),
|
|
2121
2121
|
valueType: e,
|
|
2122
2122
|
typeName: y.ZodRecord,
|
|
2123
2123
|
..._(r)
|
|
@@ -2140,8 +2140,8 @@ class gt extends w {
|
|
|
2140
2140
|
received: n.parsedType
|
|
2141
2141
|
}), g;
|
|
2142
2142
|
const s = this._def.keyType, a = this._def.valueType, o = [...n.data.entries()].map(([c, u], d) => ({
|
|
2143
|
-
key: s._parse(new
|
|
2144
|
-
value: a._parse(new
|
|
2143
|
+
key: s._parse(new ce(n, c, n.path, [d, "key"])),
|
|
2144
|
+
value: a._parse(new ce(n, u, n.path, [d, "value"]))
|
|
2145
2145
|
}));
|
|
2146
2146
|
if (n.common.async) {
|
|
2147
2147
|
const c = /* @__PURE__ */ new Map();
|
|
@@ -2172,7 +2172,7 @@ gt.create = (t, e, r) => new gt({
|
|
|
2172
2172
|
typeName: y.ZodMap,
|
|
2173
2173
|
..._(r)
|
|
2174
2174
|
});
|
|
2175
|
-
class
|
|
2175
|
+
class Pe extends w {
|
|
2176
2176
|
_parse(e) {
|
|
2177
2177
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2178
2178
|
if (n.parsedType !== p.set)
|
|
@@ -2207,17 +2207,17 @@ class Ie extends w {
|
|
|
2207
2207
|
}
|
|
2208
2208
|
return { status: r.value, value: d };
|
|
2209
2209
|
}
|
|
2210
|
-
const c = [...n.data.values()].map((u, d) => a._parse(new
|
|
2210
|
+
const c = [...n.data.values()].map((u, d) => a._parse(new ce(n, u, n.path, d)));
|
|
2211
2211
|
return n.common.async ? Promise.all(c).then((u) => o(u)) : o(c);
|
|
2212
2212
|
}
|
|
2213
2213
|
min(e, r) {
|
|
2214
|
-
return new
|
|
2214
|
+
return new Pe({
|
|
2215
2215
|
...this._def,
|
|
2216
2216
|
minSize: { value: e, message: h.toString(r) }
|
|
2217
2217
|
});
|
|
2218
2218
|
}
|
|
2219
2219
|
max(e, r) {
|
|
2220
|
-
return new
|
|
2220
|
+
return new Pe({
|
|
2221
2221
|
...this._def,
|
|
2222
2222
|
maxSize: { value: e, message: h.toString(r) }
|
|
2223
2223
|
});
|
|
@@ -2229,14 +2229,14 @@ class Ie extends w {
|
|
|
2229
2229
|
return this.min(1, e);
|
|
2230
2230
|
}
|
|
2231
2231
|
}
|
|
2232
|
-
|
|
2232
|
+
Pe.create = (t, e) => new Pe({
|
|
2233
2233
|
valueType: t,
|
|
2234
2234
|
minSize: null,
|
|
2235
2235
|
maxSize: null,
|
|
2236
2236
|
typeName: y.ZodSet,
|
|
2237
2237
|
..._(e)
|
|
2238
2238
|
});
|
|
2239
|
-
class
|
|
2239
|
+
class Me extends w {
|
|
2240
2240
|
constructor() {
|
|
2241
2241
|
super(...arguments), this.validate = this.implement;
|
|
2242
2242
|
}
|
|
@@ -2256,7 +2256,7 @@ class je extends w {
|
|
|
2256
2256
|
r.common.contextualErrorMap,
|
|
2257
2257
|
r.schemaErrorMap,
|
|
2258
2258
|
ft(),
|
|
2259
|
-
|
|
2259
|
+
Ze
|
|
2260
2260
|
].filter((d) => !!d),
|
|
2261
2261
|
issueData: {
|
|
2262
2262
|
code: l.invalid_arguments,
|
|
@@ -2272,7 +2272,7 @@ class je extends w {
|
|
|
2272
2272
|
r.common.contextualErrorMap,
|
|
2273
2273
|
r.schemaErrorMap,
|
|
2274
2274
|
ft(),
|
|
2275
|
-
|
|
2275
|
+
Ze
|
|
2276
2276
|
].filter((d) => !!d),
|
|
2277
2277
|
issueData: {
|
|
2278
2278
|
code: l.invalid_return_type,
|
|
@@ -2281,9 +2281,9 @@ class je extends w {
|
|
|
2281
2281
|
});
|
|
2282
2282
|
}
|
|
2283
2283
|
const a = { errorMap: r.common.contextualErrorMap }, o = r.data;
|
|
2284
|
-
if (this._def.returns instanceof
|
|
2284
|
+
if (this._def.returns instanceof $e) {
|
|
2285
2285
|
const c = this;
|
|
2286
|
-
return
|
|
2286
|
+
return U(async function(...u) {
|
|
2287
2287
|
const d = new H([]), f = await c._def.args.parseAsync(u, a).catch((E) => {
|
|
2288
2288
|
throw d.addIssue(n(u, E)), d;
|
|
2289
2289
|
}), v = await Reflect.apply(o, this, f);
|
|
@@ -2293,7 +2293,7 @@ class je extends w {
|
|
|
2293
2293
|
});
|
|
2294
2294
|
} else {
|
|
2295
2295
|
const c = this;
|
|
2296
|
-
return
|
|
2296
|
+
return U(function(...u) {
|
|
2297
2297
|
const d = c._def.args.safeParse(u, a);
|
|
2298
2298
|
if (!d.success)
|
|
2299
2299
|
throw new H([n(u, d.error)]);
|
|
@@ -2311,13 +2311,13 @@ class je extends w {
|
|
|
2311
2311
|
return this._def.returns;
|
|
2312
2312
|
}
|
|
2313
2313
|
args(...e) {
|
|
2314
|
-
return new
|
|
2314
|
+
return new Me({
|
|
2315
2315
|
...this._def,
|
|
2316
|
-
args:
|
|
2316
|
+
args: de.create(e).rest(Oe.create())
|
|
2317
2317
|
});
|
|
2318
2318
|
}
|
|
2319
2319
|
returns(e) {
|
|
2320
|
-
return new
|
|
2320
|
+
return new Me({
|
|
2321
2321
|
...this._def,
|
|
2322
2322
|
returns: e
|
|
2323
2323
|
});
|
|
@@ -2329,9 +2329,9 @@ class je extends w {
|
|
|
2329
2329
|
return this.parse(e);
|
|
2330
2330
|
}
|
|
2331
2331
|
static create(e, r, n) {
|
|
2332
|
-
return new
|
|
2333
|
-
args: e ||
|
|
2334
|
-
returns: r ||
|
|
2332
|
+
return new Me({
|
|
2333
|
+
args: e || de.create([]).rest(Oe.create()),
|
|
2334
|
+
returns: r || Oe.create(),
|
|
2335
2335
|
typeName: y.ZodFunction,
|
|
2336
2336
|
..._(n)
|
|
2337
2337
|
});
|
|
@@ -2373,13 +2373,13 @@ et.create = (t, e) => new et({
|
|
|
2373
2373
|
..._(e)
|
|
2374
2374
|
});
|
|
2375
2375
|
function ur(t, e) {
|
|
2376
|
-
return new
|
|
2376
|
+
return new xe({
|
|
2377
2377
|
values: t,
|
|
2378
2378
|
typeName: y.ZodEnum,
|
|
2379
2379
|
..._(e)
|
|
2380
2380
|
});
|
|
2381
2381
|
}
|
|
2382
|
-
class
|
|
2382
|
+
class xe extends w {
|
|
2383
2383
|
constructor() {
|
|
2384
2384
|
super(...arguments), Ve.set(this, void 0);
|
|
2385
2385
|
}
|
|
@@ -2387,7 +2387,7 @@ class be extends w {
|
|
|
2387
2387
|
if (typeof e.data != "string") {
|
|
2388
2388
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2389
2389
|
return m(r, {
|
|
2390
|
-
expected:
|
|
2390
|
+
expected: b.joinValues(n),
|
|
2391
2391
|
received: r.parsedType,
|
|
2392
2392
|
code: l.invalid_type
|
|
2393
2393
|
}), g;
|
|
@@ -2400,7 +2400,7 @@ class be extends w {
|
|
|
2400
2400
|
options: n
|
|
2401
2401
|
}), g;
|
|
2402
2402
|
}
|
|
2403
|
-
return
|
|
2403
|
+
return U(e.data);
|
|
2404
2404
|
}
|
|
2405
2405
|
get options() {
|
|
2406
2406
|
return this._def.values;
|
|
@@ -2424,43 +2424,43 @@ class be extends w {
|
|
|
2424
2424
|
return e;
|
|
2425
2425
|
}
|
|
2426
2426
|
extract(e, r = this._def) {
|
|
2427
|
-
return
|
|
2427
|
+
return xe.create(e, {
|
|
2428
2428
|
...this._def,
|
|
2429
2429
|
...r
|
|
2430
2430
|
});
|
|
2431
2431
|
}
|
|
2432
2432
|
exclude(e, r = this._def) {
|
|
2433
|
-
return
|
|
2433
|
+
return xe.create(this.options.filter((n) => !e.includes(n)), {
|
|
2434
2434
|
...this._def,
|
|
2435
2435
|
...r
|
|
2436
2436
|
});
|
|
2437
2437
|
}
|
|
2438
2438
|
}
|
|
2439
2439
|
Ve = /* @__PURE__ */ new WeakMap();
|
|
2440
|
-
|
|
2440
|
+
xe.create = ur;
|
|
2441
2441
|
class tt extends w {
|
|
2442
2442
|
constructor() {
|
|
2443
2443
|
super(...arguments), Fe.set(this, void 0);
|
|
2444
2444
|
}
|
|
2445
2445
|
_parse(e) {
|
|
2446
|
-
const r =
|
|
2446
|
+
const r = b.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
2447
2447
|
if (n.parsedType !== p.string && n.parsedType !== p.number) {
|
|
2448
|
-
const s =
|
|
2448
|
+
const s = b.objectValues(r);
|
|
2449
2449
|
return m(n, {
|
|
2450
|
-
expected:
|
|
2450
|
+
expected: b.joinValues(s),
|
|
2451
2451
|
received: n.parsedType,
|
|
2452
2452
|
code: l.invalid_type
|
|
2453
2453
|
}), g;
|
|
2454
2454
|
}
|
|
2455
|
-
if (pt(this, Fe) || ir(this, Fe, new Set(
|
|
2456
|
-
const s =
|
|
2455
|
+
if (pt(this, Fe) || ir(this, Fe, new Set(b.getValidEnumValues(this._def.values))), !pt(this, Fe).has(e.data)) {
|
|
2456
|
+
const s = b.objectValues(r);
|
|
2457
2457
|
return m(n, {
|
|
2458
2458
|
received: n.data,
|
|
2459
2459
|
code: l.invalid_enum_value,
|
|
2460
2460
|
options: s
|
|
2461
2461
|
}), g;
|
|
2462
2462
|
}
|
|
2463
|
-
return
|
|
2463
|
+
return U(e.data);
|
|
2464
2464
|
}
|
|
2465
2465
|
get enum() {
|
|
2466
2466
|
return this._def.values;
|
|
@@ -2472,7 +2472,7 @@ tt.create = (t, e) => new tt({
|
|
|
2472
2472
|
typeName: y.ZodNativeEnum,
|
|
2473
2473
|
..._(e)
|
|
2474
2474
|
});
|
|
2475
|
-
class
|
|
2475
|
+
class $e extends w {
|
|
2476
2476
|
unwrap() {
|
|
2477
2477
|
return this._def.type;
|
|
2478
2478
|
}
|
|
@@ -2485,18 +2485,18 @@ class De 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 U(n.then((s) => this._def.type.parseAsync(s, {
|
|
2489
2489
|
path: r.path,
|
|
2490
2490
|
errorMap: r.common.contextualErrorMap
|
|
2491
2491
|
})));
|
|
2492
2492
|
}
|
|
2493
2493
|
}
|
|
2494
|
-
|
|
2494
|
+
$e.create = (t, e) => new $e({
|
|
2495
2495
|
type: t,
|
|
2496
2496
|
typeName: y.ZodPromise,
|
|
2497
2497
|
..._(e)
|
|
2498
2498
|
});
|
|
2499
|
-
class
|
|
2499
|
+
class ee extends w {
|
|
2500
2500
|
innerType() {
|
|
2501
2501
|
return this._def.schema;
|
|
2502
2502
|
}
|
|
@@ -2523,7 +2523,7 @@ class Q extends w {
|
|
|
2523
2523
|
path: n.path,
|
|
2524
2524
|
parent: n
|
|
2525
2525
|
});
|
|
2526
|
-
return u.status === "aborted" ? g : u.status === "dirty" || r.value === "dirty" ?
|
|
2526
|
+
return u.status === "aborted" ? g : u.status === "dirty" || r.value === "dirty" ? je(u.value) : u;
|
|
2527
2527
|
});
|
|
2528
2528
|
{
|
|
2529
2529
|
if (r.value === "aborted")
|
|
@@ -2533,7 +2533,7 @@ class Q extends w {
|
|
|
2533
2533
|
path: n.path,
|
|
2534
2534
|
parent: n
|
|
2535
2535
|
});
|
|
2536
|
-
return c.status === "aborted" ? g : c.status === "dirty" || r.value === "dirty" ?
|
|
2536
|
+
return c.status === "aborted" ? g : c.status === "dirty" || r.value === "dirty" ? je(c.value) : c;
|
|
2537
2537
|
}
|
|
2538
2538
|
}
|
|
2539
2539
|
if (s.type === "refinement") {
|
|
@@ -2570,43 +2570,43 @@ class Q extends w {
|
|
|
2570
2570
|
return { status: r.value, value: c };
|
|
2571
2571
|
} else
|
|
2572
2572
|
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => Be(o) ? Promise.resolve(s.transform(o.value, a)).then((c) => ({ status: r.value, value: c })) : o);
|
|
2573
|
-
|
|
2573
|
+
b.assertNever(s);
|
|
2574
2574
|
}
|
|
2575
2575
|
}
|
|
2576
|
-
|
|
2576
|
+
ee.create = (t, e, r) => new ee({
|
|
2577
2577
|
schema: t,
|
|
2578
2578
|
typeName: y.ZodEffects,
|
|
2579
2579
|
effect: e,
|
|
2580
2580
|
..._(r)
|
|
2581
2581
|
});
|
|
2582
|
-
|
|
2582
|
+
ee.createWithPreprocess = (t, e, r) => new ee({
|
|
2583
2583
|
schema: e,
|
|
2584
2584
|
effect: { type: "preprocess", transform: t },
|
|
2585
2585
|
typeName: y.ZodEffects,
|
|
2586
2586
|
..._(r)
|
|
2587
2587
|
});
|
|
2588
|
-
class
|
|
2588
|
+
class ie extends w {
|
|
2589
2589
|
_parse(e) {
|
|
2590
|
-
return this._getType(e) === p.undefined ?
|
|
2590
|
+
return this._getType(e) === p.undefined ? U(void 0) : this._def.innerType._parse(e);
|
|
2591
2591
|
}
|
|
2592
2592
|
unwrap() {
|
|
2593
2593
|
return this._def.innerType;
|
|
2594
2594
|
}
|
|
2595
2595
|
}
|
|
2596
|
-
|
|
2596
|
+
ie.create = (t, e) => new ie({
|
|
2597
2597
|
innerType: t,
|
|
2598
2598
|
typeName: y.ZodOptional,
|
|
2599
2599
|
..._(e)
|
|
2600
2600
|
});
|
|
2601
|
-
class
|
|
2601
|
+
class Ee extends w {
|
|
2602
2602
|
_parse(e) {
|
|
2603
|
-
return this._getType(e) === p.null ?
|
|
2603
|
+
return this._getType(e) === p.null ? U(null) : this._def.innerType._parse(e);
|
|
2604
2604
|
}
|
|
2605
2605
|
unwrap() {
|
|
2606
2606
|
return this._def.innerType;
|
|
2607
2607
|
}
|
|
2608
2608
|
}
|
|
2609
|
-
|
|
2609
|
+
Ee.create = (t, e) => new Ee({
|
|
2610
2610
|
innerType: t,
|
|
2611
2611
|
typeName: y.ZodNullable,
|
|
2612
2612
|
..._(e)
|
|
@@ -2715,7 +2715,7 @@ class ot extends w {
|
|
|
2715
2715
|
path: n.path,
|
|
2716
2716
|
parent: n
|
|
2717
2717
|
});
|
|
2718
|
-
return a.status === "aborted" ? g : a.status === "dirty" ? (r.dirty(),
|
|
2718
|
+
return a.status === "aborted" ? g : a.status === "dirty" ? (r.dirty(), je(a.value)) : this._def.out._parseAsync({
|
|
2719
2719
|
data: a.value,
|
|
2720
2720
|
path: n.path,
|
|
2721
2721
|
parent: n
|
|
@@ -2760,13 +2760,13 @@ st.create = (t, e) => new st({
|
|
|
2760
2760
|
..._(e)
|
|
2761
2761
|
});
|
|
2762
2762
|
function lr(t, e = {}, r) {
|
|
2763
|
-
return t ?
|
|
2763
|
+
return t ? De.create().superRefine((n, s) => {
|
|
2764
2764
|
var a, o;
|
|
2765
2765
|
if (!t(n)) {
|
|
2766
2766
|
const c = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, u = (o = (a = c.fatal) !== null && a !== void 0 ? a : r) !== null && o !== void 0 ? o : !0, d = typeof c == "string" ? { message: c } : c;
|
|
2767
2767
|
s.addIssue({ code: "custom", ...d, fatal: u });
|
|
2768
2768
|
}
|
|
2769
|
-
}) :
|
|
2769
|
+
}) : De.create();
|
|
2770
2770
|
}
|
|
2771
2771
|
const bn = {
|
|
2772
2772
|
object: R.lazycreate
|
|
@@ -2777,73 +2777,73 @@ var y;
|
|
|
2777
2777
|
})(y || (y = {}));
|
|
2778
2778
|
const xn = (t, e = {
|
|
2779
2779
|
message: `Input not instance of ${t.name}`
|
|
2780
|
-
}) => lr((r) => r instanceof t, e), fr =
|
|
2781
|
-
string: (t) =>
|
|
2782
|
-
number: (t) =>
|
|
2780
|
+
}) => lr((r) => r instanceof t, e), fr = X.create, mr = we.create, En = _t.create, kn = be.create, pr = We.create, Tn = Ie.create, Cn = ht.create, Sn = Ke.create, Rn = Ye.create, On = De.create, In = Oe.create, Pn = me.create, An = yt.create, Nn = Q.create, jn = R.create, Mn = R.strictCreate, Zn = Je.create, Dn = wt.create, $n = Ge.create, Ln = de.create, Un = Xe.create, Vn = gt.create, Fn = Pe.create, zn = Me.create, qn = Qe.create, Bn = et.create, Hn = xe.create, Wn = tt.create, Kn = $e.create, Jt = ee.create, Yn = ie.create, Jn = Ee.create, Gn = ee.createWithPreprocess, Xn = ot.create, Qn = () => fr().optional(), es = () => mr().optional(), ts = () => pr().optional(), rs = {
|
|
2781
|
+
string: (t) => X.create({ ...t, coerce: !0 }),
|
|
2782
|
+
number: (t) => we.create({ ...t, coerce: !0 }),
|
|
2783
2783
|
boolean: (t) => We.create({
|
|
2784
2784
|
...t,
|
|
2785
2785
|
coerce: !0
|
|
2786
2786
|
}),
|
|
2787
|
-
bigint: (t) =>
|
|
2788
|
-
date: (t) =>
|
|
2787
|
+
bigint: (t) => be.create({ ...t, coerce: !0 }),
|
|
2788
|
+
date: (t) => Ie.create({ ...t, coerce: !0 })
|
|
2789
2789
|
}, ns = g;
|
|
2790
2790
|
var i = /* @__PURE__ */ Object.freeze({
|
|
2791
2791
|
__proto__: null,
|
|
2792
|
-
defaultErrorMap:
|
|
2792
|
+
defaultErrorMap: Ze,
|
|
2793
2793
|
setErrorMap: rn,
|
|
2794
2794
|
getErrorMap: ft,
|
|
2795
2795
|
makeIssue: mt,
|
|
2796
2796
|
EMPTY_PATH: nn,
|
|
2797
2797
|
addIssueToContext: m,
|
|
2798
|
-
ParseStatus:
|
|
2798
|
+
ParseStatus: D,
|
|
2799
2799
|
INVALID: g,
|
|
2800
|
-
DIRTY:
|
|
2801
|
-
OK:
|
|
2800
|
+
DIRTY: je,
|
|
2801
|
+
OK: U,
|
|
2802
2802
|
isAborted: Rt,
|
|
2803
2803
|
isDirty: Ot,
|
|
2804
2804
|
isValid: Be,
|
|
2805
2805
|
isAsync: He,
|
|
2806
2806
|
get util() {
|
|
2807
|
-
return
|
|
2807
|
+
return b;
|
|
2808
2808
|
},
|
|
2809
2809
|
get objectUtil() {
|
|
2810
2810
|
return St;
|
|
2811
2811
|
},
|
|
2812
2812
|
ZodParsedType: p,
|
|
2813
|
-
getParsedType:
|
|
2813
|
+
getParsedType: ye,
|
|
2814
2814
|
ZodType: w,
|
|
2815
2815
|
datetimeRegex: dr,
|
|
2816
|
-
ZodString:
|
|
2817
|
-
ZodNumber:
|
|
2818
|
-
ZodBigInt:
|
|
2816
|
+
ZodString: X,
|
|
2817
|
+
ZodNumber: we,
|
|
2818
|
+
ZodBigInt: be,
|
|
2819
2819
|
ZodBoolean: We,
|
|
2820
|
-
ZodDate:
|
|
2820
|
+
ZodDate: Ie,
|
|
2821
2821
|
ZodSymbol: ht,
|
|
2822
2822
|
ZodUndefined: Ke,
|
|
2823
2823
|
ZodNull: Ye,
|
|
2824
|
-
ZodAny:
|
|
2825
|
-
ZodUnknown:
|
|
2826
|
-
ZodNever:
|
|
2824
|
+
ZodAny: De,
|
|
2825
|
+
ZodUnknown: Oe,
|
|
2826
|
+
ZodNever: me,
|
|
2827
2827
|
ZodVoid: yt,
|
|
2828
|
-
ZodArray:
|
|
2828
|
+
ZodArray: Q,
|
|
2829
2829
|
ZodObject: R,
|
|
2830
2830
|
ZodUnion: Je,
|
|
2831
2831
|
ZodDiscriminatedUnion: wt,
|
|
2832
2832
|
ZodIntersection: Ge,
|
|
2833
|
-
ZodTuple:
|
|
2833
|
+
ZodTuple: de,
|
|
2834
2834
|
ZodRecord: Xe,
|
|
2835
2835
|
ZodMap: gt,
|
|
2836
|
-
ZodSet:
|
|
2837
|
-
ZodFunction:
|
|
2836
|
+
ZodSet: Pe,
|
|
2837
|
+
ZodFunction: Me,
|
|
2838
2838
|
ZodLazy: Qe,
|
|
2839
2839
|
ZodLiteral: et,
|
|
2840
|
-
ZodEnum:
|
|
2840
|
+
ZodEnum: xe,
|
|
2841
2841
|
ZodNativeEnum: tt,
|
|
2842
|
-
ZodPromise:
|
|
2843
|
-
ZodEffects:
|
|
2844
|
-
ZodTransformer:
|
|
2845
|
-
ZodOptional:
|
|
2846
|
-
ZodNullable:
|
|
2842
|
+
ZodPromise: $e,
|
|
2843
|
+
ZodEffects: ee,
|
|
2844
|
+
ZodTransformer: ee,
|
|
2845
|
+
ZodOptional: ie,
|
|
2846
|
+
ZodNullable: Ee,
|
|
2847
2847
|
ZodDefault: rt,
|
|
2848
2848
|
ZodCatch: nt,
|
|
2849
2849
|
ZodNaN: _t,
|
|
@@ -3057,8 +3057,8 @@ const ks = i.object({
|
|
|
3057
3057
|
return u.data;
|
|
3058
3058
|
{
|
|
3059
3059
|
const d = u.error.format(), f = Ts(d);
|
|
3060
|
-
for (const [v,
|
|
3061
|
-
n(v,
|
|
3060
|
+
for (const [v, x] of Object.entries(f))
|
|
3061
|
+
n(v, x, v);
|
|
3062
3062
|
return null;
|
|
3063
3063
|
}
|
|
3064
3064
|
}, Ss = (t) => {
|
|
@@ -3160,7 +3160,7 @@ const ks = i.object({
|
|
|
3160
3160
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3161
3161
|
[r]
|
|
3162
3162
|
), s = {
|
|
3163
|
-
get:
|
|
3163
|
+
get: ge((a) => e[a], [e]),
|
|
3164
3164
|
...n
|
|
3165
3165
|
};
|
|
3166
3166
|
return [e, s];
|
|
@@ -3226,20 +3226,20 @@ ${t.map((r) => `- ${r.path.join("/")}: ${r.message}`).join(`
|
|
|
3226
3226
|
return t + "";
|
|
3227
3227
|
};
|
|
3228
3228
|
function Ws(t, e = 0) {
|
|
3229
|
-
const r = qe(!1), n = qe(), s = qe(t), a =
|
|
3229
|
+
const r = qe(!1), n = qe(), s = qe(t), a = ge(() => r.current, []), o = ge(() => {
|
|
3230
3230
|
r.current = !1, n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
3231
3231
|
r.current = !0, s.current();
|
|
3232
3232
|
}, e);
|
|
3233
|
-
}, [e]), c =
|
|
3233
|
+
}, [e]), c = ge(() => {
|
|
3234
3234
|
r.current = null, n.current && clearTimeout(n.current);
|
|
3235
3235
|
}, []);
|
|
3236
|
-
return
|
|
3236
|
+
return _e(() => {
|
|
3237
3237
|
s.current = t;
|
|
3238
|
-
}, [t]),
|
|
3238
|
+
}, [t]), _e(() => (o(), c), [e]), [a, c, o];
|
|
3239
3239
|
}
|
|
3240
3240
|
function Ks(t, e = 0, r = []) {
|
|
3241
3241
|
const [n, s, a] = Ws(t, e);
|
|
3242
|
-
return
|
|
3242
|
+
return _e(a, r), [n, s];
|
|
3243
3243
|
}
|
|
3244
3244
|
const N = (t) => i.nullable(t.optional());
|
|
3245
3245
|
i.string().trim().min(1, { message: "Cannot be blank" });
|
|
@@ -3372,13 +3372,13 @@ const $t = async (t, e, r) => {
|
|
|
3372
3372
|
}
|
|
3373
3373
|
return n;
|
|
3374
3374
|
}, da = (t, e) => e.safeParse(t).success, ua = (t) => Ys.safeParse(t).success, la = async (t, e) => await $t(t, { type: "get_checkout_preview", payload: e }, kr), Lt = async (t) => await $t(t, { type: "get_prefill", payload: {} }, Tr), fa = async (t, e) => await $t(t, { type: "confirm_payment_flow", payload: e }, ks), ma = (t) => t.reduce((e, r) => e + r, 0), pa = (t, e, r, n) => {
|
|
3375
|
-
const [s, a] = S(""), [o, c] = S(""), [u, d] = S(null), [f, v] = S(!1), [
|
|
3375
|
+
const [s, a] = S(""), [o, c] = S(""), [u, d] = S(null), [f, v] = S(!1), [x, E] = S(null);
|
|
3376
3376
|
return vt(async () => {
|
|
3377
3377
|
if (!n || !t)
|
|
3378
3378
|
return;
|
|
3379
|
-
const
|
|
3380
|
-
|
|
3381
|
-
v(!0), E(null), a(
|
|
3379
|
+
const T = await ha(n, at.PROMOTION_CODE);
|
|
3380
|
+
T == null || T.addEventListener("input", () => {
|
|
3381
|
+
v(!0), E(null), a(T.value);
|
|
3382
3382
|
});
|
|
3383
3383
|
}, [!!n, t]), Ks(
|
|
3384
3384
|
() => {
|
|
@@ -3387,23 +3387,23 @@ const $t = async (t, e, r) => {
|
|
|
3387
3387
|
1e3,
|
|
3388
3388
|
[s, t]
|
|
3389
3389
|
), vt(
|
|
3390
|
-
async (
|
|
3390
|
+
async (T) => {
|
|
3391
3391
|
try {
|
|
3392
3392
|
if (!e || !r || !t)
|
|
3393
3393
|
return;
|
|
3394
|
-
const
|
|
3395
|
-
|
|
3394
|
+
const C = (await Lt(e)).mode === "setup", $ = await Cr(e, r, C, o);
|
|
3395
|
+
T() && (E(null), d($));
|
|
3396
3396
|
} catch (I) {
|
|
3397
|
-
|
|
3397
|
+
T() && E(Dt(I));
|
|
3398
3398
|
} finally {
|
|
3399
|
-
|
|
3399
|
+
T() && v(!1);
|
|
3400
3400
|
}
|
|
3401
3401
|
},
|
|
3402
3402
|
[!e, !r, o, t]
|
|
3403
3403
|
), {
|
|
3404
3404
|
amount: u,
|
|
3405
3405
|
isLoading: f,
|
|
3406
|
-
error:
|
|
3406
|
+
error: x
|
|
3407
3407
|
};
|
|
3408
3408
|
}, ha = async (t, e, r) => {
|
|
3409
3409
|
const n = Date.now();
|
|
@@ -3454,33 +3454,41 @@ const $t = async (t, e, r) => {
|
|
|
3454
3454
|
const [u, d] = Ms({
|
|
3455
3455
|
apple_pay: tr,
|
|
3456
3456
|
google_pay: tr
|
|
3457
|
-
}), f = e === void 0 || r === void 0 || !n || !t, v = c.amount;
|
|
3458
|
-
return
|
|
3459
|
-
if (!Sr() || !v)
|
|
3457
|
+
}), f = e === void 0 || r === void 0 || !n || !t, v = c.amount, [x, E] = S(null);
|
|
3458
|
+
return _e(() => {
|
|
3459
|
+
if (!Sr() || !v || x === null)
|
|
3460
3460
|
return;
|
|
3461
|
-
const
|
|
3462
|
-
Or(
|
|
3463
|
-
}, [v]), vt(async () => {
|
|
3461
|
+
const T = Rr();
|
|
3462
|
+
Or(T, v, x);
|
|
3463
|
+
}, [v, x]), vt(async () => {
|
|
3464
3464
|
if (f)
|
|
3465
3465
|
return;
|
|
3466
|
-
|
|
3467
|
-
|
|
3466
|
+
window.ojs_version = "0.0.17";
|
|
3467
|
+
const T = r.find(
|
|
3468
|
+
(Z) => Z.processor_name === "stripe" && er.options.map((te) => String(te)).includes(Z.provider)
|
|
3468
3469
|
);
|
|
3469
|
-
if (!
|
|
3470
|
+
if (!T)
|
|
3470
3471
|
throw new Error("Stripe is not available as a checkout method");
|
|
3471
|
-
const
|
|
3472
|
-
|
|
3473
|
-
const
|
|
3474
|
-
|
|
3475
|
-
|
|
3472
|
+
const I = As(T.metadata), $ = (await Lt(t)).mode === "setup";
|
|
3473
|
+
E($);
|
|
3474
|
+
const V = await Cr(t, e, $, void 0), O = await Is(
|
|
3475
|
+
I,
|
|
3476
|
+
V.amountAtom,
|
|
3477
|
+
V.currency,
|
|
3478
|
+
$
|
|
3479
|
+
);
|
|
3480
|
+
xa(O);
|
|
3481
|
+
const W = await O.canMakePayment();
|
|
3482
|
+
for (const Z of er.options) {
|
|
3483
|
+
Z.replace("_", "");
|
|
3476
3484
|
try {
|
|
3477
|
-
d.set(
|
|
3485
|
+
d.set(Z, {
|
|
3478
3486
|
isLoading: !1,
|
|
3479
|
-
isAvailable: (
|
|
3480
|
-
startFlow: (
|
|
3487
|
+
isAvailable: (W == null ? void 0 : W[ga[Z]]) ?? !1,
|
|
3488
|
+
startFlow: (te) => ba(n, T, s, a, o, te)
|
|
3481
3489
|
});
|
|
3482
3490
|
} catch {
|
|
3483
|
-
d.set(
|
|
3491
|
+
d.set(Z, _a);
|
|
3484
3492
|
}
|
|
3485
3493
|
}
|
|
3486
3494
|
}, [f]), u;
|
|
@@ -3498,7 +3506,11 @@ const $t = async (t, e, r) => {
|
|
|
3498
3506
|
if (!wa(t, n, e))
|
|
3499
3507
|
return;
|
|
3500
3508
|
const o = Rr();
|
|
3501
|
-
a != null && a.
|
|
3509
|
+
if (a != null && a.overridePaymentRequest) {
|
|
3510
|
+
const u = a == null ? void 0 : a.overridePaymentRequest;
|
|
3511
|
+
Or(o, u.amount, u.pending);
|
|
3512
|
+
}
|
|
3513
|
+
o.show();
|
|
3502
3514
|
const c = await Ps(o);
|
|
3503
3515
|
r(c, e);
|
|
3504
3516
|
} catch (o) {
|
|
@@ -3512,17 +3524,17 @@ const $t = async (t, e, r) => {
|
|
|
3512
3524
|
if (!Sr())
|
|
3513
3525
|
throw new Error("Global PR not set");
|
|
3514
3526
|
return window.ojs_pr;
|
|
3515
|
-
}, Or = (t, e) => {
|
|
3516
|
-
t.update({ total: { amount: e.amountAtom, label: "Total" }, currency: e.currency });
|
|
3527
|
+
}, Or = (t, e, r) => {
|
|
3528
|
+
t.update({ total: { amount: e.amountAtom, label: "Total", pending: r }, currency: e.currency });
|
|
3517
3529
|
};
|
|
3518
|
-
var
|
|
3530
|
+
var oe;
|
|
3519
3531
|
(function(t) {
|
|
3520
3532
|
t.Call = "call", t.Reply = "reply", t.Syn = "syn", t.SynAck = "synAck", t.Ack = "ack";
|
|
3521
|
-
})(
|
|
3522
|
-
var
|
|
3533
|
+
})(oe || (oe = {}));
|
|
3534
|
+
var Re;
|
|
3523
3535
|
(function(t) {
|
|
3524
3536
|
t.Fulfilled = "fulfilled", t.Rejected = "rejected";
|
|
3525
|
-
})(
|
|
3537
|
+
})(Re || (Re = {}));
|
|
3526
3538
|
var it;
|
|
3527
3539
|
(function(t) {
|
|
3528
3540
|
t.ConnectionDestroyed = "ConnectionDestroyed", t.ConnectionTimeout = "ConnectionTimeout", t.NoIframeSrc = "NoIframeSrc";
|
|
@@ -3531,10 +3543,10 @@ var Nt;
|
|
|
3531
3543
|
(function(t) {
|
|
3532
3544
|
t.DataCloneError = "DataCloneError";
|
|
3533
3545
|
})(Nt || (Nt = {}));
|
|
3534
|
-
var
|
|
3546
|
+
var ke;
|
|
3535
3547
|
(function(t) {
|
|
3536
3548
|
t.Message = "message";
|
|
3537
|
-
})(
|
|
3549
|
+
})(ke || (ke = {}));
|
|
3538
3550
|
const Ea = (t, e) => {
|
|
3539
3551
|
const r = [];
|
|
3540
3552
|
let n = !1;
|
|
@@ -3571,46 +3583,46 @@ const Ea = (t, e) => {
|
|
|
3571
3583
|
const { localName: n, local: s, remote: a, originForSending: o, originForReceiving: c } = t;
|
|
3572
3584
|
let u = !1;
|
|
3573
3585
|
const d = (f) => {
|
|
3574
|
-
if (f.source !== a || f.data.penpal !==
|
|
3586
|
+
if (f.source !== a || f.data.penpal !== oe.Call)
|
|
3575
3587
|
return;
|
|
3576
3588
|
if (c !== "*" && f.origin !== c) {
|
|
3577
3589
|
r(`${n} received message from origin ${f.origin} which did not match expected origin ${c}`);
|
|
3578
3590
|
return;
|
|
3579
3591
|
}
|
|
3580
|
-
const v = f.data, { methodName:
|
|
3581
|
-
r(`${n}: Received ${
|
|
3582
|
-
const I = (
|
|
3583
|
-
if (r(`${n}: Sending ${
|
|
3584
|
-
r(`${n}: Unable to send ${
|
|
3592
|
+
const v = f.data, { methodName: x, args: E, id: T } = v;
|
|
3593
|
+
r(`${n}: Received ${x}() call`);
|
|
3594
|
+
const I = (C) => ($) => {
|
|
3595
|
+
if (r(`${n}: Sending ${x}() reply`), u) {
|
|
3596
|
+
r(`${n}: Unable to send ${x}() reply due to destroyed connection`);
|
|
3585
3597
|
return;
|
|
3586
3598
|
}
|
|
3587
|
-
const
|
|
3588
|
-
penpal:
|
|
3589
|
-
id:
|
|
3590
|
-
resolution:
|
|
3591
|
-
returnValue:
|
|
3599
|
+
const V = {
|
|
3600
|
+
penpal: oe.Reply,
|
|
3601
|
+
id: T,
|
|
3602
|
+
resolution: C,
|
|
3603
|
+
returnValue: $
|
|
3592
3604
|
};
|
|
3593
|
-
|
|
3605
|
+
C === Re.Rejected && $ instanceof Error && (V.returnValue = rr($), V.returnValueIsError = !0);
|
|
3594
3606
|
try {
|
|
3595
|
-
a.postMessage(
|
|
3596
|
-
} catch (
|
|
3597
|
-
if (
|
|
3598
|
-
const
|
|
3599
|
-
penpal:
|
|
3600
|
-
id:
|
|
3601
|
-
resolution:
|
|
3602
|
-
returnValue: rr(
|
|
3607
|
+
a.postMessage(V, o);
|
|
3608
|
+
} catch (O) {
|
|
3609
|
+
if (O.name === Nt.DataCloneError) {
|
|
3610
|
+
const W = {
|
|
3611
|
+
penpal: oe.Reply,
|
|
3612
|
+
id: T,
|
|
3613
|
+
resolution: Re.Rejected,
|
|
3614
|
+
returnValue: rr(O),
|
|
3603
3615
|
returnValueIsError: !0
|
|
3604
3616
|
};
|
|
3605
|
-
a.postMessage(
|
|
3617
|
+
a.postMessage(W, o);
|
|
3606
3618
|
}
|
|
3607
|
-
throw
|
|
3619
|
+
throw O;
|
|
3608
3620
|
}
|
|
3609
3621
|
};
|
|
3610
|
-
new Promise((
|
|
3622
|
+
new Promise((C) => C(e[x].apply(e, E))).then(I(Re.Fulfilled), I(Re.Rejected));
|
|
3611
3623
|
};
|
|
3612
|
-
return s.addEventListener(
|
|
3613
|
-
u = !0, s.removeEventListener(
|
|
3624
|
+
return s.addEventListener(ke.Message, d), () => {
|
|
3625
|
+
u = !0, s.removeEventListener(ke.Message, d);
|
|
3614
3626
|
};
|
|
3615
3627
|
};
|
|
3616
3628
|
let Pa = 0;
|
|
@@ -3635,7 +3647,7 @@ const Aa = () => ++Pa, Ir = ".", Pr = (t) => t ? t.split(Ir) : [], Na = (t) => t
|
|
|
3635
3647
|
const { localName: a, local: o, remote: c, originForSending: u, originForReceiving: d } = e;
|
|
3636
3648
|
let f = !1;
|
|
3637
3649
|
s(`${a}: Connecting call sender`);
|
|
3638
|
-
const v = (E) => (...
|
|
3650
|
+
const v = (E) => (...T) => {
|
|
3639
3651
|
s(`${a}: Sending ${E}() call`);
|
|
3640
3652
|
let I;
|
|
3641
3653
|
try {
|
|
@@ -3644,33 +3656,33 @@ const Aa = () => ++Pa, Ir = ".", Pr = (t) => t ? t.split(Ir) : [], Na = (t) => t
|
|
|
3644
3656
|
I = !0;
|
|
3645
3657
|
}
|
|
3646
3658
|
if (I && n(), f) {
|
|
3647
|
-
const
|
|
3648
|
-
throw
|
|
3659
|
+
const C = new Error(`Unable to send ${E}() call due to destroyed connection`);
|
|
3660
|
+
throw C.code = it.ConnectionDestroyed, C;
|
|
3649
3661
|
}
|
|
3650
|
-
return new Promise((
|
|
3651
|
-
const
|
|
3652
|
-
if (
|
|
3662
|
+
return new Promise((C, $) => {
|
|
3663
|
+
const V = Aa(), O = (Z) => {
|
|
3664
|
+
if (Z.source !== c || Z.data.penpal !== oe.Reply || Z.data.id !== V)
|
|
3653
3665
|
return;
|
|
3654
|
-
if (d !== "*" &&
|
|
3655
|
-
s(`${a} received message from origin ${
|
|
3666
|
+
if (d !== "*" && Z.origin !== d) {
|
|
3667
|
+
s(`${a} received message from origin ${Z.origin} which did not match expected origin ${d}`);
|
|
3656
3668
|
return;
|
|
3657
3669
|
}
|
|
3658
|
-
const
|
|
3659
|
-
s(`${a}: Received ${E}() reply`), o.removeEventListener(
|
|
3660
|
-
let
|
|
3661
|
-
|
|
3670
|
+
const te = Z.data;
|
|
3671
|
+
s(`${a}: Received ${E}() reply`), o.removeEventListener(ke.Message, O);
|
|
3672
|
+
let Te = te.returnValue;
|
|
3673
|
+
te.returnValueIsError && (Te = Oa(Te)), (te.resolution === Re.Fulfilled ? C : $)(Te);
|
|
3662
3674
|
};
|
|
3663
|
-
o.addEventListener(
|
|
3664
|
-
const
|
|
3665
|
-
penpal:
|
|
3666
|
-
id:
|
|
3675
|
+
o.addEventListener(ke.Message, O);
|
|
3676
|
+
const W = {
|
|
3677
|
+
penpal: oe.Call,
|
|
3678
|
+
id: V,
|
|
3667
3679
|
methodName: E,
|
|
3668
|
-
args:
|
|
3680
|
+
args: T
|
|
3669
3681
|
};
|
|
3670
|
-
c.postMessage(
|
|
3682
|
+
c.postMessage(W, u);
|
|
3671
3683
|
});
|
|
3672
|
-
},
|
|
3673
|
-
return Object.assign(t, Za(
|
|
3684
|
+
}, x = r.reduce((E, T) => (E[T] = v(T), E), {});
|
|
3685
|
+
return Object.assign(t, Za(x)), () => {
|
|
3674
3686
|
f = !0;
|
|
3675
3687
|
};
|
|
3676
3688
|
}, $a = (t, e, r, n, s) => {
|
|
@@ -3693,8 +3705,8 @@ const Aa = () => ++Pa, Ir = ".", Pr = (t) => t ? t.split(Ir) : [], Na = (t) => t
|
|
|
3693
3705
|
c && c(), c = Ia(v, t, s), o(c), u && u.forEach((E) => {
|
|
3694
3706
|
delete d[E];
|
|
3695
3707
|
}), u = f.data.methodNames;
|
|
3696
|
-
const
|
|
3697
|
-
return o(
|
|
3708
|
+
const x = Da(d, v, u, a, s);
|
|
3709
|
+
return o(x), d;
|
|
3698
3710
|
};
|
|
3699
3711
|
}, La = (t, e, r, n) => (s) => {
|
|
3700
3712
|
if (!s.source)
|
|
@@ -3705,7 +3717,7 @@ const Aa = () => ++Pa, Ir = ".", Pr = (t) => t ? t.split(Ir) : [], Na = (t) => t
|
|
|
3705
3717
|
}
|
|
3706
3718
|
t("Parent: Handshake - Received SYN, responding with SYN-ACK");
|
|
3707
3719
|
const a = {
|
|
3708
|
-
penpal:
|
|
3720
|
+
penpal: oe.SynAck,
|
|
3709
3721
|
methodNames: Object.keys(e)
|
|
3710
3722
|
};
|
|
3711
3723
|
s.source.postMessage(a, n);
|
|
@@ -3733,24 +3745,24 @@ const Aa = () => ++Pa, Ir = ".", Pr = (t) => t ? t.split(Ir) : [], Na = (t) => t
|
|
|
3733
3745
|
let { iframe: e, methods: r = {}, childOrigin: n, timeout: s, debug: a = !1 } = t;
|
|
3734
3746
|
const o = ka(a), c = Ea("Parent", o), { onDestroy: u, destroy: d } = c;
|
|
3735
3747
|
n || (za(e), n = Ra(e.src));
|
|
3736
|
-
const f = n === "null" ? "*" : n, v = Ar(r),
|
|
3748
|
+
const f = n === "null" ? "*" : n, v = Ar(r), x = La(o, v, n, f), E = $a(v, n, f, c, o);
|
|
3737
3749
|
return {
|
|
3738
|
-
promise: new Promise((I,
|
|
3739
|
-
const
|
|
3740
|
-
if (!(
|
|
3741
|
-
if (
|
|
3742
|
-
|
|
3750
|
+
promise: new Promise((I, C) => {
|
|
3751
|
+
const $ = Fa(s, d), V = (O) => {
|
|
3752
|
+
if (!(O.source !== e.contentWindow || !O.data)) {
|
|
3753
|
+
if (O.data.penpal === oe.Syn) {
|
|
3754
|
+
x(O);
|
|
3743
3755
|
return;
|
|
3744
3756
|
}
|
|
3745
|
-
if (
|
|
3746
|
-
const
|
|
3747
|
-
|
|
3757
|
+
if (O.data.penpal === oe.Ack) {
|
|
3758
|
+
const W = E(O);
|
|
3759
|
+
W && ($(), I(W));
|
|
3748
3760
|
return;
|
|
3749
3761
|
}
|
|
3750
3762
|
}
|
|
3751
3763
|
};
|
|
3752
|
-
window.addEventListener(
|
|
3753
|
-
window.removeEventListener(
|
|
3764
|
+
window.addEventListener(ke.Message, V), o("Parent: Awaiting handshake"), Va(e, c), u((O) => {
|
|
3765
|
+
window.removeEventListener(ke.Message, V), O && C(O);
|
|
3754
3766
|
});
|
|
3755
3767
|
}),
|
|
3756
3768
|
destroy() {
|
|
@@ -3808,46 +3820,46 @@ const Aa = () => ++Pa, Ir = ".", Pr = (t) => t ? t.split(Ir) : [], Na = (t) => t
|
|
|
3808
3820
|
onValidationError: d,
|
|
3809
3821
|
onCheckoutStarted: f,
|
|
3810
3822
|
onCheckoutSuccess: v,
|
|
3811
|
-
onCheckoutError:
|
|
3823
|
+
onCheckoutError: x,
|
|
3812
3824
|
onSetupPaymentMethodSuccess: E,
|
|
3813
|
-
baseUrl:
|
|
3825
|
+
baseUrl: T,
|
|
3814
3826
|
enableDynamicPreviews: I
|
|
3815
|
-
} = t,
|
|
3827
|
+
} = t, C = T ?? Rs, [$, V] = S(void 0), [O, W] = S([]), [Z, te] = S("1px"), [Te, Nr] = S(!1), [re, Le] = S(void 0), [Ut, Ce] = S(!1), [pe, jr] = S([]), [he, Mr] = S({}), [Vt, ct] = S(0), [Ft, ne] = S(!1), [se, Zr] = S(void 0), [zt, Dr] = S(void 0), [qt, $r] = S(void 0), [ue, Lr] = S(void 0), [xt, Ur] = S(void 0), le = ze(() => `opjs-form-${sr()}`, []), Y = qe(null), { cdeConn: Ae, connectToCdeIframe: Bt } = Ba(), Ht = pa(
|
|
3816
3828
|
I ?? !1,
|
|
3817
|
-
|
|
3829
|
+
Ae,
|
|
3818
3830
|
r,
|
|
3819
|
-
|
|
3820
|
-
), Et =
|
|
3831
|
+
Y.current
|
|
3832
|
+
), Et = ge(
|
|
3821
3833
|
(A) => {
|
|
3822
|
-
if (A.origin !==
|
|
3823
|
-
const
|
|
3834
|
+
if (A.origin !== C || !A.source) return;
|
|
3835
|
+
const K = A.source;
|
|
3824
3836
|
if (!Ka(A.data))
|
|
3825
3837
|
return;
|
|
3826
|
-
const
|
|
3827
|
-
if (
|
|
3838
|
+
const J = JSON.parse(A.data), F = Ss(J), Se = F.elementId;
|
|
3839
|
+
if (F.formId !== le || !Se || F.nonce in O)
|
|
3828
3840
|
return;
|
|
3829
|
-
|
|
3830
|
-
const P =
|
|
3831
|
-
if (
|
|
3832
|
-
const
|
|
3833
|
-
|
|
3834
|
-
} else if (
|
|
3835
|
-
s(
|
|
3836
|
-
else if (
|
|
3837
|
-
a(
|
|
3838
|
-
else if (
|
|
3839
|
-
o(
|
|
3840
|
-
else if (
|
|
3841
|
-
const
|
|
3842
|
-
if (
|
|
3841
|
+
W((L) => [...L, F.nonce]);
|
|
3842
|
+
const P = F.payload, z = P.type;
|
|
3843
|
+
if (z === k.enum.LAYOUT) {
|
|
3844
|
+
const L = P.height ? `${P.height}px` : "100%";
|
|
3845
|
+
te(L);
|
|
3846
|
+
} else if (z === k.enum.FOCUS && s)
|
|
3847
|
+
s(F.elementId);
|
|
3848
|
+
else if (z === k.enum.BLUR && a)
|
|
3849
|
+
a(F.elementId);
|
|
3850
|
+
else if (z === k.enum.CHANGE && o)
|
|
3851
|
+
o(F.elementId);
|
|
3852
|
+
else if (z === k.enum.LOADED) {
|
|
3853
|
+
const L = pe.find((j) => j.contentWindow === K);
|
|
3854
|
+
if (Ce(!1), !L)
|
|
3843
3855
|
return;
|
|
3844
|
-
Mr((j) => ({ ...j, [
|
|
3845
|
-
} else if (
|
|
3846
|
-
|
|
3847
|
-
else if (
|
|
3848
|
-
if (!
|
|
3856
|
+
Mr((j) => ({ ...j, [Se]: K })), $r(P.totalAmountAtoms), Dr(P.currency), Lr(P.checkoutPaymentMethods), se || Zr(P.sessionId);
|
|
3857
|
+
} else if (z === k.enum.TOKENIZE_STARTED)
|
|
3858
|
+
Ce(!0), f && f();
|
|
3859
|
+
else if (z === k.enum.PAYMENT_FLOW_STARTED) {
|
|
3860
|
+
if (!re)
|
|
3849
3861
|
throw new Error("extraData not populated");
|
|
3850
|
-
if (!
|
|
3862
|
+
if (!Ae)
|
|
3851
3863
|
throw new Error("Not connected to CDE");
|
|
3852
3864
|
(async () => {
|
|
3853
3865
|
const j = P.nextActionMetadata.type;
|
|
@@ -3859,15 +3871,15 @@ const Aa = () => ++Pa, Ir = ".", Pr = (t) => t ? t.split(Ir) : [], Na = (t) => t
|
|
|
3859
3871
|
await Ns(P, xt);
|
|
3860
3872
|
} else
|
|
3861
3873
|
throw new Error(`Unknown next action type: ${j}`);
|
|
3862
|
-
const
|
|
3863
|
-
if (
|
|
3864
|
-
const { payment_methods:
|
|
3865
|
-
secure_token:
|
|
3866
|
-
existing_cc_pm_id:
|
|
3874
|
+
const G = await Lt(Ae);
|
|
3875
|
+
if (G.mode === "setup") {
|
|
3876
|
+
const { payment_methods: ae } = await fa(Ae, {
|
|
3877
|
+
secure_token: G.token,
|
|
3878
|
+
existing_cc_pm_id: re.existingCCPMId
|
|
3867
3879
|
});
|
|
3868
|
-
if (
|
|
3869
|
-
throw new Error(`Expected exactly one payment method, got ${
|
|
3870
|
-
return
|
|
3880
|
+
if (ae.length !== 1)
|
|
3881
|
+
throw new Error(`Expected exactly one payment method, got ${ae.length}`);
|
|
3882
|
+
return Ce(!1), ct(0), ne(!1), E && E(ae[0].id), {
|
|
3871
3883
|
proceedToCheckout: !1
|
|
3872
3884
|
};
|
|
3873
3885
|
} else
|
|
@@ -3875,66 +3887,66 @@ const Aa = () => ++Pa, Ir = ".", Pr = (t) => t ? t.split(Ir) : [], Na = (t) => t
|
|
|
3875
3887
|
proceedToCheckout: !0
|
|
3876
3888
|
};
|
|
3877
3889
|
})().then(({ proceedToCheckout: j }) => {
|
|
3878
|
-
var
|
|
3890
|
+
var ae;
|
|
3879
3891
|
if (!j)
|
|
3880
3892
|
return;
|
|
3881
|
-
let
|
|
3882
|
-
if (
|
|
3893
|
+
let G;
|
|
3894
|
+
if (re.checkoutPaymentMethod.provider === "credit_card" && (G = (ae = P.startPFMetadata) == null ? void 0 : ae.cc_pm_id, !G))
|
|
3883
3895
|
throw new Error("CC PM ID not found");
|
|
3884
3896
|
Ue(
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
{ ...
|
|
3889
|
-
|
|
3890
|
-
),
|
|
3897
|
+
K,
|
|
3898
|
+
le,
|
|
3899
|
+
Se,
|
|
3900
|
+
{ ...re, type: "CHECKOUT", doNotUseLegacyCCFlow: !0, existingCCPMId: G },
|
|
3901
|
+
C
|
|
3902
|
+
), ne(!0), Le(void 0), f && f();
|
|
3891
3903
|
}).catch((j) => {
|
|
3892
|
-
const
|
|
3893
|
-
|
|
3904
|
+
const G = Dt(j);
|
|
3905
|
+
Ce(!1), ne(!1), x && x(G);
|
|
3894
3906
|
});
|
|
3895
|
-
} else if (
|
|
3896
|
-
const
|
|
3897
|
-
!Ft && (j || P.isReadyForCheckout) ? (Ue(
|
|
3898
|
-
} else if (
|
|
3899
|
-
|
|
3900
|
-
else if (
|
|
3901
|
-
|
|
3902
|
-
else if (
|
|
3907
|
+
} else if (z === k.enum.TOKENIZE_SUCCESS && re) {
|
|
3908
|
+
const L = Vt + 1, j = L === Object.keys(he).length;
|
|
3909
|
+
!Ft && (j || P.isReadyForCheckout) ? (Ue(K, le, Se, re, C), ne(!0), Le(void 0)) : ct(L);
|
|
3910
|
+
} else if (z === k.enum.CHECKOUT_SUCCESS)
|
|
3911
|
+
Ce(!1), ct(0), ne(!1), v && v(P.invoiceUrls, P.subscriptionIds, P.customerId);
|
|
3912
|
+
else if (z === k.enum.SETUP_PAYMENT_METHOD_SUCCESS)
|
|
3913
|
+
Ce(!1), ct(0), ne(!1), E && E(P.paymentMethodId);
|
|
3914
|
+
else if (z === k.enum.LOAD_ERROR)
|
|
3903
3915
|
u && u(P.message);
|
|
3904
|
-
else if (
|
|
3905
|
-
const
|
|
3906
|
-
(
|
|
3907
|
-
} else if (
|
|
3916
|
+
else if (z === k.enum.VALIDATION_ERROR) {
|
|
3917
|
+
const L = re == null ? void 0 : re.checkoutPaymentMethod.provider;
|
|
3918
|
+
(L === "credit_card" || L === void 0) && d && d(P.elementType, P.errors, Se);
|
|
3919
|
+
} else if (z === k.enum.TOKENIZE_ERROR || z === k.enum.CHECKOUT_ERROR)
|
|
3908
3920
|
if (P.message === "3DS_REQUIRED") {
|
|
3909
|
-
const
|
|
3910
|
-
if (!
|
|
3911
|
-
for (const [j,
|
|
3912
|
-
if (!
|
|
3913
|
-
const
|
|
3921
|
+
const L = ue == null ? void 0 : ue.find((j) => j.provider === "credit_card");
|
|
3922
|
+
if (!se || !Y.current || !d || !L) return;
|
|
3923
|
+
for (const [j, G] of Object.entries(he)) {
|
|
3924
|
+
if (!G) continue;
|
|
3925
|
+
const ae = lt(
|
|
3914
3926
|
k.enum.START_PAYMENT_FLOW,
|
|
3915
|
-
|
|
3916
|
-
|
|
3927
|
+
se,
|
|
3928
|
+
Y.current,
|
|
3917
3929
|
d,
|
|
3918
3930
|
// Only stripe supports frontend 3DS right now,
|
|
3919
3931
|
// so we pass processor_name: 'stripe' to tell delegator to only use stripe
|
|
3920
|
-
{
|
|
3932
|
+
{ ...L, processor_name: "stripe" },
|
|
3921
3933
|
!1
|
|
3922
3934
|
);
|
|
3923
|
-
if (
|
|
3924
|
-
|
|
3935
|
+
if (ae) {
|
|
3936
|
+
ne(!0), Le(ae), Ue(G, le, j, ae, C);
|
|
3925
3937
|
break;
|
|
3926
3938
|
}
|
|
3927
3939
|
}
|
|
3928
3940
|
} else
|
|
3929
|
-
|
|
3941
|
+
Ce(!1), ne(!1), x && x(P.message);
|
|
3930
3942
|
},
|
|
3931
3943
|
[
|
|
3932
|
-
|
|
3944
|
+
le,
|
|
3945
|
+
se,
|
|
3946
|
+
O,
|
|
3933
3947
|
re,
|
|
3934
|
-
C,
|
|
3935
|
-
ee,
|
|
3936
|
-
me,
|
|
3937
3948
|
pe,
|
|
3949
|
+
he,
|
|
3938
3950
|
Vt,
|
|
3939
3951
|
Ft,
|
|
3940
3952
|
a,
|
|
@@ -3944,82 +3956,82 @@ const Aa = () => ++Pa, Ir = ".", Pr = (t) => t ? t.split(Ir) : [], Na = (t) => t
|
|
|
3944
3956
|
f,
|
|
3945
3957
|
v,
|
|
3946
3958
|
E,
|
|
3947
|
-
|
|
3959
|
+
x,
|
|
3948
3960
|
d,
|
|
3949
|
-
|
|
3961
|
+
C,
|
|
3950
3962
|
xt,
|
|
3951
|
-
|
|
3952
|
-
|
|
3963
|
+
ue,
|
|
3964
|
+
Ae
|
|
3953
3965
|
]
|
|
3954
|
-
), Vr =
|
|
3955
|
-
if (!
|
|
3956
|
-
const A =
|
|
3966
|
+
), Vr = ge(() => {
|
|
3967
|
+
if (!Y.current || !d || !se || !ue) return;
|
|
3968
|
+
const A = ue.find((J) => J.provider === "credit_card");
|
|
3957
3969
|
if (!A)
|
|
3958
3970
|
throw new Error("Card not available as a payment method in checkout");
|
|
3959
|
-
const
|
|
3971
|
+
const K = lt(
|
|
3960
3972
|
k.enum.TOKENIZE,
|
|
3961
|
-
|
|
3962
|
-
|
|
3973
|
+
se,
|
|
3974
|
+
Y.current,
|
|
3963
3975
|
d,
|
|
3964
3976
|
A,
|
|
3965
3977
|
!1
|
|
3966
3978
|
);
|
|
3967
|
-
if (
|
|
3968
|
-
for (const [
|
|
3969
|
-
|
|
3970
|
-
|
|
3979
|
+
if (K) {
|
|
3980
|
+
for (const [J, F] of Object.entries(he))
|
|
3981
|
+
F && Ue(F, le, J, K, C);
|
|
3982
|
+
K.type = k.enum.CHECKOUT, Le(K);
|
|
3971
3983
|
}
|
|
3972
|
-
}, [
|
|
3984
|
+
}, [Y, he, le, d, se, C, ue]), kt = ge(
|
|
3973
3985
|
(A) => {
|
|
3974
3986
|
Ut && A.preventDefault();
|
|
3975
3987
|
},
|
|
3976
3988
|
[Ut]
|
|
3977
3989
|
);
|
|
3978
|
-
|
|
3979
|
-
if (
|
|
3980
|
-
|
|
3981
|
-
}, [
|
|
3990
|
+
_e(() => {
|
|
3991
|
+
if (Te || !Y.current) return;
|
|
3992
|
+
pe.length > 0 && pe.length === Object.keys(he).length && (Nr(!0), c && c(qt, zt));
|
|
3993
|
+
}, [pe, he, Te, c, qt, zt]), _e(() => (V(window.location.origin), window.addEventListener("message", Et), window.addEventListener("beforeunload", kt), () => {
|
|
3982
3994
|
window.removeEventListener("beforeunload", kt), window.removeEventListener("message", Et);
|
|
3983
|
-
}), [
|
|
3984
|
-
const Fr =
|
|
3995
|
+
}), [se, Et, kt]);
|
|
3996
|
+
const Fr = ge(
|
|
3985
3997
|
(A) => {
|
|
3986
|
-
|
|
3998
|
+
pe.find((J) => J.contentWindow === A.contentWindow) || (pe.length === 0 && Bt(A), jr((J) => [...J, A]));
|
|
3987
3999
|
},
|
|
3988
|
-
[
|
|
3989
|
-
), zr = async (A,
|
|
3990
|
-
if (!(!
|
|
3991
|
-
for (const [
|
|
3992
|
-
if (!
|
|
3993
|
-
const
|
|
4000
|
+
[pe, Bt]
|
|
4001
|
+
), zr = async (A, K) => {
|
|
4002
|
+
if (!(!Y.current || !d || !se || !ue))
|
|
4003
|
+
for (const [J, F] of Object.entries(he)) {
|
|
4004
|
+
if (!F) continue;
|
|
4005
|
+
const Se = {
|
|
3994
4006
|
stripePmId: A.paymentMethod.id
|
|
3995
4007
|
}, dt = lt(
|
|
3996
4008
|
k.enum.START_PAYMENT_FLOW,
|
|
3997
|
-
|
|
3998
|
-
|
|
4009
|
+
se,
|
|
4010
|
+
Y.current,
|
|
3999
4011
|
d,
|
|
4000
|
-
|
|
4012
|
+
K,
|
|
4001
4013
|
!1,
|
|
4002
|
-
|
|
4014
|
+
Se
|
|
4003
4015
|
);
|
|
4004
4016
|
if (dt) {
|
|
4005
|
-
Ur(A),
|
|
4017
|
+
Ur(A), ne(!0), Le(dt), Ue(F, le, J, dt, C);
|
|
4006
4018
|
break;
|
|
4007
4019
|
}
|
|
4008
4020
|
}
|
|
4009
4021
|
}, qr = (A) => {
|
|
4010
|
-
|
|
4022
|
+
ne(!1), x && x(A);
|
|
4011
4023
|
}, Br = {
|
|
4012
|
-
formId:
|
|
4013
|
-
formHeight:
|
|
4014
|
-
referer:
|
|
4024
|
+
formId: le,
|
|
4025
|
+
formHeight: Z,
|
|
4026
|
+
referer: $,
|
|
4015
4027
|
checkoutSecureToken: r,
|
|
4016
4028
|
registerIframe: Fr,
|
|
4017
|
-
baseUrl:
|
|
4029
|
+
baseUrl: C
|
|
4018
4030
|
}, Wt = va(
|
|
4019
|
-
|
|
4031
|
+
Ae,
|
|
4020
4032
|
r,
|
|
4021
|
-
|
|
4022
|
-
|
|
4033
|
+
ue,
|
|
4034
|
+
Y.current,
|
|
4023
4035
|
zr,
|
|
4024
4036
|
d,
|
|
4025
4037
|
qr,
|
|
@@ -4028,34 +4040,34 @@ const Aa = () => ++Pa, Ir = ".", Pr = (t) => t ? t.split(Ir) : [], Na = (t) => t
|
|
|
4028
4040
|
submit: Vr,
|
|
4029
4041
|
applePay: Wt.apple_pay,
|
|
4030
4042
|
googlePay: Wt.google_pay,
|
|
4031
|
-
loaded:
|
|
4043
|
+
loaded: Te,
|
|
4032
4044
|
preview: Ht
|
|
4033
4045
|
};
|
|
4034
|
-
return /* @__PURE__ */
|
|
4046
|
+
return /* @__PURE__ */ ve(nr.Provider, { value: Br, children: /* @__PURE__ */ ve("div", { className: n, ref: Y, children: e(Hr) }) });
|
|
4035
4047
|
}, Ya = (t) => JSON.stringify(t), bt = (t) => {
|
|
4036
|
-
const { subPath: e, styles: r } = t, { formId: n, referer: s, formHeight: a, checkoutSecureToken: o, registerIframe: c, baseUrl: u } = Jr(), [d, f] = S(!1), v = qe(null),
|
|
4048
|
+
const { subPath: e, styles: r } = t, { formId: n, referer: s, formHeight: a, checkoutSecureToken: o, registerIframe: c, baseUrl: u } = Jr(), [d, f] = S(!1), v = qe(null), x = ze(() => r ? Ya(r) : "", [r]), E = ze(() => ({
|
|
4037
4049
|
border: "none",
|
|
4038
4050
|
width: "100%",
|
|
4039
4051
|
height: a
|
|
4040
|
-
}), [a]),
|
|
4052
|
+
}), [a]), T = ze(() => {
|
|
4041
4053
|
if (!o || !s) return "";
|
|
4042
4054
|
const I = new URLSearchParams();
|
|
4043
|
-
return I.append("referer", s), I.append("styles",
|
|
4044
|
-
}, [
|
|
4045
|
-
return
|
|
4055
|
+
return I.append("referer", s), I.append("styles", x), I.append("formId", n), I.append("secureToken", o), I.toString();
|
|
4056
|
+
}, [x, n, s, o]);
|
|
4057
|
+
return _e(() => f(!0), []), _e(() => {
|
|
4046
4058
|
!v.current || !d || c(v.current);
|
|
4047
|
-
}, [d]), o ? /* @__PURE__ */
|
|
4059
|
+
}, [d]), o ? /* @__PURE__ */ ve(
|
|
4048
4060
|
"iframe",
|
|
4049
4061
|
{
|
|
4050
4062
|
id: `ojs-${e}-element`,
|
|
4051
4063
|
name: `${e}-element`,
|
|
4052
4064
|
className: "ojs-iframe",
|
|
4053
|
-
src: `${u}/app/v1/${e}-element/?${
|
|
4065
|
+
src: `${u}/app/v1/${e}-element/?${T}`,
|
|
4054
4066
|
style: E,
|
|
4055
4067
|
ref: v
|
|
4056
4068
|
}
|
|
4057
|
-
) : /* @__PURE__ */
|
|
4058
|
-
}, Qa = ({ styles: t }) => /* @__PURE__ */
|
|
4069
|
+
) : /* @__PURE__ */ ve("div", {});
|
|
4070
|
+
}, Qa = ({ styles: t }) => /* @__PURE__ */ ve(bt, { styles: t, subPath: "card-cvc" }), ei = ({ styles: t }) => /* @__PURE__ */ ve(bt, { styles: t, subPath: "card" }), ti = ({ styles: t }) => /* @__PURE__ */ ve(bt, { styles: t, subPath: "card-expiry" }), ri = ({ styles: t }) => /* @__PURE__ */ ve(bt, { styles: t, subPath: "card-number" });
|
|
4059
4071
|
export {
|
|
4060
4072
|
Qa as CardCvcElement,
|
|
4061
4073
|
ei as CardElement,
|