@getopenpay/openpay-js-react 0.0.18-alpha.1cc8d4c → 0.0.19-alpha.2de60c2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +328 -327
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -46,7 +46,7 @@ var Bt = {};
|
|
|
46
46
|
var $r;
|
|
47
47
|
function Fn() {
|
|
48
48
|
return $r || ($r = 1, process.env.NODE_ENV !== "production" && function() {
|
|
49
|
-
var t = Hr, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"),
|
|
49
|
+
var t = Hr, e = Symbol.for("react.element"), r = Symbol.for("react.portal"), n = Symbol.for("react.fragment"), s = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), i = Symbol.for("react.provider"), u = Symbol.for("react.context"), d = Symbol.for("react.forward_ref"), l = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), E = Symbol.for("react.memo"), T = Symbol.for("react.lazy"), O = Symbol.for("react.offscreen"), A = Symbol.iterator, $ = "@@iterator";
|
|
50
50
|
function M(o) {
|
|
51
51
|
if (o === null || typeof o != "object")
|
|
52
52
|
return null;
|
|
@@ -74,7 +74,7 @@ function Fn() {
|
|
|
74
74
|
var re = !1, K = !1, be = !1, ce = !1, ir = !1, ue;
|
|
75
75
|
ue = Symbol.for("react.module.reference");
|
|
76
76
|
function We(o) {
|
|
77
|
-
return !!(typeof o == "string" || typeof o == "function" || o === n || o === a || ir || o === s || o === l || o === p || ce || o === O || re || K || be || typeof o == "object" && o !== null && (o.$$typeof === T || o.$$typeof === E || o.$$typeof ===
|
|
77
|
+
return !!(typeof o == "string" || typeof o == "function" || o === n || o === a || ir || o === s || o === l || o === p || ce || o === O || re || K || be || typeof o == "object" && o !== null && (o.$$typeof === T || o.$$typeof === E || o.$$typeof === i || o.$$typeof === u || o.$$typeof === d || // This needs to include all possible module reference object
|
|
78
78
|
// types supported by any Flight configuration anywhere since
|
|
79
79
|
// we don't know which Flight build this will end up being used
|
|
80
80
|
// with.
|
|
@@ -116,7 +116,7 @@ function Fn() {
|
|
|
116
116
|
case u:
|
|
117
117
|
var f = o;
|
|
118
118
|
return Te(f) + ".Consumer";
|
|
119
|
-
case
|
|
119
|
+
case i:
|
|
120
120
|
var y = o;
|
|
121
121
|
return Te(y._context) + ".Provider";
|
|
122
122
|
case d:
|
|
@@ -674,28 +674,28 @@ var S;
|
|
|
674
674
|
}
|
|
675
675
|
t.assertNever = r, t.arrayToEnum = (s) => {
|
|
676
676
|
const a = {};
|
|
677
|
-
for (const
|
|
678
|
-
a[
|
|
677
|
+
for (const i of s)
|
|
678
|
+
a[i] = i;
|
|
679
679
|
return a;
|
|
680
680
|
}, t.getValidEnumValues = (s) => {
|
|
681
|
-
const a = t.objectKeys(s).filter((u) => typeof s[s[u]] != "number"),
|
|
681
|
+
const a = t.objectKeys(s).filter((u) => typeof s[s[u]] != "number"), i = {};
|
|
682
682
|
for (const u of a)
|
|
683
|
-
|
|
684
|
-
return t.objectValues(
|
|
683
|
+
i[u] = s[u];
|
|
684
|
+
return t.objectValues(i);
|
|
685
685
|
}, t.objectValues = (s) => t.objectKeys(s).map(function(a) {
|
|
686
686
|
return s[a];
|
|
687
687
|
}), t.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
|
|
688
688
|
const a = [];
|
|
689
|
-
for (const
|
|
690
|
-
Object.prototype.hasOwnProperty.call(s,
|
|
689
|
+
for (const i in s)
|
|
690
|
+
Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
|
|
691
691
|
return a;
|
|
692
692
|
}, t.find = (s, a) => {
|
|
693
|
-
for (const
|
|
694
|
-
if (a(
|
|
695
|
-
return
|
|
693
|
+
for (const i of s)
|
|
694
|
+
if (a(i))
|
|
695
|
+
return i;
|
|
696
696
|
}, t.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && isFinite(s) && Math.floor(s) === s;
|
|
697
697
|
function n(s, a = " | ") {
|
|
698
|
-
return s.map((
|
|
698
|
+
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
699
699
|
}
|
|
700
700
|
t.joinValues = n, t.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
701
701
|
})(S || (S = {}));
|
|
@@ -784,20 +784,20 @@ class ge extends Error {
|
|
|
784
784
|
const r = e || function(a) {
|
|
785
785
|
return a.message;
|
|
786
786
|
}, n = { _errors: [] }, s = (a) => {
|
|
787
|
-
for (const
|
|
788
|
-
if (
|
|
789
|
-
|
|
790
|
-
else if (
|
|
791
|
-
s(
|
|
792
|
-
else if (
|
|
793
|
-
s(
|
|
794
|
-
else if (
|
|
795
|
-
n._errors.push(r(
|
|
787
|
+
for (const i of a.issues)
|
|
788
|
+
if (i.code === "invalid_union")
|
|
789
|
+
i.unionErrors.map(s);
|
|
790
|
+
else if (i.code === "invalid_return_type")
|
|
791
|
+
s(i.returnTypeError);
|
|
792
|
+
else if (i.code === "invalid_arguments")
|
|
793
|
+
s(i.argumentsError);
|
|
794
|
+
else if (i.path.length === 0)
|
|
795
|
+
n._errors.push(r(i));
|
|
796
796
|
else {
|
|
797
797
|
let u = n, d = 0;
|
|
798
|
-
for (; d <
|
|
799
|
-
const l =
|
|
800
|
-
d ===
|
|
798
|
+
for (; d < i.path.length; ) {
|
|
799
|
+
const l = i.path[d];
|
|
800
|
+
d === i.path.length - 1 ? (u[l] = u[l] || { _errors: [] }, u[l]._errors.push(r(i))) : u[l] = u[l] || { _errors: [] }, u = u[l], d++;
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
803
|
};
|
|
@@ -891,7 +891,7 @@ function Jt() {
|
|
|
891
891
|
return Gr;
|
|
892
892
|
}
|
|
893
893
|
const Gt = (t) => {
|
|
894
|
-
const { data: e, path: r, errorMaps: n, issueData: s } = t, a = [...r, ...s.path || []],
|
|
894
|
+
const { data: e, path: r, errorMaps: n, issueData: s } = t, a = [...r, ...s.path || []], i = {
|
|
895
895
|
...s,
|
|
896
896
|
path: a
|
|
897
897
|
};
|
|
@@ -904,7 +904,7 @@ const Gt = (t) => {
|
|
|
904
904
|
let u = "";
|
|
905
905
|
const d = n.filter((l) => !!l).slice().reverse();
|
|
906
906
|
for (const l of d)
|
|
907
|
-
u = l(
|
|
907
|
+
u = l(i, { data: e, defaultError: u }).message;
|
|
908
908
|
return {
|
|
909
909
|
...s,
|
|
910
910
|
path: a,
|
|
@@ -948,10 +948,10 @@ class te {
|
|
|
948
948
|
static async mergeObjectAsync(e, r) {
|
|
949
949
|
const n = [];
|
|
950
950
|
for (const s of r) {
|
|
951
|
-
const a = await s.key,
|
|
951
|
+
const a = await s.key, i = await s.value;
|
|
952
952
|
n.push({
|
|
953
953
|
key: a,
|
|
954
|
-
value:
|
|
954
|
+
value: i
|
|
955
955
|
});
|
|
956
956
|
}
|
|
957
957
|
return te.mergeObjectSync(e, n);
|
|
@@ -959,10 +959,10 @@ class te {
|
|
|
959
959
|
static mergeObjectSync(e, r) {
|
|
960
960
|
const n = {};
|
|
961
961
|
for (const s of r) {
|
|
962
|
-
const { key: a, value:
|
|
963
|
-
if (a.status === "aborted" ||
|
|
962
|
+
const { key: a, value: i } = s;
|
|
963
|
+
if (a.status === "aborted" || i.status === "aborted")
|
|
964
964
|
return b;
|
|
965
|
-
a.status === "dirty" && e.dirty(),
|
|
965
|
+
a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value < "u" || s.alwaysSet) && (n[a.value] = i.value);
|
|
966
966
|
}
|
|
967
967
|
return { status: e.value, value: n };
|
|
968
968
|
}
|
|
@@ -1012,10 +1012,10 @@ function x(t) {
|
|
|
1012
1012
|
const { errorMap: e, invalid_type_error: r, required_error: n, description: s } = t;
|
|
1013
1013
|
if (e && (r || n))
|
|
1014
1014
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1015
|
-
return e ? { errorMap: e, description: s } : { errorMap: (
|
|
1015
|
+
return e ? { errorMap: e, description: s } : { errorMap: (i, u) => {
|
|
1016
1016
|
var d, l;
|
|
1017
1017
|
const { message: p } = t;
|
|
1018
|
-
return
|
|
1018
|
+
return i.code === "invalid_enum_value" ? { message: p ?? u.defaultError } : typeof u.data > "u" ? { message: (d = p ?? n) !== null && d !== void 0 ? d : u.defaultError } : i.code !== "invalid_type" ? { message: u.defaultError } : { message: (l = p ?? r) !== null && l !== void 0 ? l : u.defaultError };
|
|
1019
1019
|
}, description: s };
|
|
1020
1020
|
}
|
|
1021
1021
|
class k {
|
|
@@ -1107,11 +1107,11 @@ class k {
|
|
|
1107
1107
|
refine(e, r) {
|
|
1108
1108
|
const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
|
|
1109
1109
|
return this._refinement((s, a) => {
|
|
1110
|
-
const
|
|
1110
|
+
const i = e(s), u = () => a.addIssue({
|
|
1111
1111
|
code: m.custom,
|
|
1112
1112
|
...n(s)
|
|
1113
1113
|
});
|
|
1114
|
-
return typeof Promise < "u" &&
|
|
1114
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((d) => d ? !0 : (u(), !1)) : i ? !0 : (u(), !1);
|
|
1115
1115
|
});
|
|
1116
1116
|
}
|
|
1117
1117
|
refinement(e, r) {
|
|
@@ -1251,8 +1251,8 @@ class Ee extends k {
|
|
|
1251
1251
|
message: a.message
|
|
1252
1252
|
}), n.dirty());
|
|
1253
1253
|
else if (a.kind === "length") {
|
|
1254
|
-
const
|
|
1255
|
-
(
|
|
1254
|
+
const i = e.data.length > a.value, u = e.data.length < a.value;
|
|
1255
|
+
(i || u) && (s = this._getOrReturnCtx(e, s), i ? h(s, {
|
|
1256
1256
|
code: m.too_big,
|
|
1257
1257
|
maximum: a.value,
|
|
1258
1258
|
type: "string",
|
|
@@ -1578,8 +1578,8 @@ Ee.create = (t) => {
|
|
|
1578
1578
|
});
|
|
1579
1579
|
};
|
|
1580
1580
|
function us(t, e) {
|
|
1581
|
-
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = parseInt(t.toFixed(s).replace(".", "")),
|
|
1582
|
-
return a %
|
|
1581
|
+
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = parseInt(t.toFixed(s).replace(".", "")), i = parseInt(e.toFixed(s).replace(".", ""));
|
|
1582
|
+
return a % i / Math.pow(10, s);
|
|
1583
1583
|
}
|
|
1584
1584
|
class Le extends k {
|
|
1585
1585
|
constructor() {
|
|
@@ -2093,11 +2093,11 @@ class xe extends k {
|
|
|
2093
2093
|
received: r.parsedType
|
|
2094
2094
|
}), b;
|
|
2095
2095
|
if (s.exactLength !== null) {
|
|
2096
|
-
const
|
|
2097
|
-
(
|
|
2098
|
-
code:
|
|
2096
|
+
const i = r.data.length > s.exactLength.value, u = r.data.length < s.exactLength.value;
|
|
2097
|
+
(i || u) && (h(r, {
|
|
2098
|
+
code: i ? m.too_big : m.too_small,
|
|
2099
2099
|
minimum: u ? s.exactLength.value : void 0,
|
|
2100
|
-
maximum:
|
|
2100
|
+
maximum: i ? s.exactLength.value : void 0,
|
|
2101
2101
|
type: "array",
|
|
2102
2102
|
inclusive: !0,
|
|
2103
2103
|
exact: !0,
|
|
@@ -2119,8 +2119,8 @@ class xe extends k {
|
|
|
2119
2119
|
exact: !1,
|
|
2120
2120
|
message: s.maxLength.message
|
|
2121
2121
|
}), n.dirty()), r.common.async)
|
|
2122
|
-
return Promise.all([...r.data].map((
|
|
2123
|
-
const a = [...r.data].map((
|
|
2122
|
+
return Promise.all([...r.data].map((i, u) => s.type._parseAsync(new Se(r, i, r.path, u)))).then((i) => te.mergeArray(n, i));
|
|
2123
|
+
const a = [...r.data].map((i, u) => s.type._parseSync(new Se(r, i, r.path, u)));
|
|
2124
2124
|
return te.mergeArray(n, a);
|
|
2125
2125
|
}
|
|
2126
2126
|
get element() {
|
|
@@ -2191,12 +2191,12 @@ class V extends k {
|
|
|
2191
2191
|
received: l.parsedType
|
|
2192
2192
|
}), b;
|
|
2193
2193
|
}
|
|
2194
|
-
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys:
|
|
2194
|
+
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), u = [];
|
|
2195
2195
|
if (!(this._def.catchall instanceof Ne && this._def.unknownKeys === "strip"))
|
|
2196
2196
|
for (const l in s.data)
|
|
2197
|
-
|
|
2197
|
+
i.includes(l) || u.push(l);
|
|
2198
2198
|
const d = [];
|
|
2199
|
-
for (const l of
|
|
2199
|
+
for (const l of i) {
|
|
2200
2200
|
const p = a[l], E = s.data[l];
|
|
2201
2201
|
d.push({
|
|
2202
2202
|
key: { status: "valid", value: l },
|
|
@@ -2254,8 +2254,8 @@ class V extends k {
|
|
|
2254
2254
|
unknownKeys: "strict",
|
|
2255
2255
|
...e !== void 0 ? {
|
|
2256
2256
|
errorMap: (r, n) => {
|
|
2257
|
-
var s, a,
|
|
2258
|
-
const d = (
|
|
2257
|
+
var s, a, i, u;
|
|
2258
|
+
const d = (i = (a = (s = this._def).errorMap) === null || a === void 0 ? void 0 : a.call(s, r, n).message) !== null && i !== void 0 ? i : n.defaultError;
|
|
2259
2259
|
return r.code === "unrecognized_keys" ? {
|
|
2260
2260
|
message: (u = v.errToObj(e).message) !== null && u !== void 0 ? u : d
|
|
2261
2261
|
} : {
|
|
@@ -2469,15 +2469,15 @@ class Rt extends k {
|
|
|
2469
2469
|
for (const u of a)
|
|
2470
2470
|
if (u.result.status === "dirty")
|
|
2471
2471
|
return r.common.issues.push(...u.ctx.common.issues), u.result;
|
|
2472
|
-
const
|
|
2472
|
+
const i = a.map((u) => new ge(u.ctx.common.issues));
|
|
2473
2473
|
return h(r, {
|
|
2474
2474
|
code: m.invalid_union,
|
|
2475
|
-
unionErrors:
|
|
2475
|
+
unionErrors: i
|
|
2476
2476
|
}), b;
|
|
2477
2477
|
}
|
|
2478
2478
|
if (r.common.async)
|
|
2479
2479
|
return Promise.all(n.map(async (a) => {
|
|
2480
|
-
const
|
|
2480
|
+
const i = {
|
|
2481
2481
|
...r,
|
|
2482
2482
|
common: {
|
|
2483
2483
|
...r.common,
|
|
@@ -2489,14 +2489,14 @@ class Rt extends k {
|
|
|
2489
2489
|
result: await a._parseAsync({
|
|
2490
2490
|
data: r.data,
|
|
2491
2491
|
path: r.path,
|
|
2492
|
-
parent:
|
|
2492
|
+
parent: i
|
|
2493
2493
|
}),
|
|
2494
|
-
ctx:
|
|
2494
|
+
ctx: i
|
|
2495
2495
|
};
|
|
2496
2496
|
})).then(s);
|
|
2497
2497
|
{
|
|
2498
2498
|
let a;
|
|
2499
|
-
const
|
|
2499
|
+
const i = [];
|
|
2500
2500
|
for (const d of n) {
|
|
2501
2501
|
const l = {
|
|
2502
2502
|
...r,
|
|
@@ -2512,11 +2512,11 @@ class Rt extends k {
|
|
|
2512
2512
|
});
|
|
2513
2513
|
if (p.status === "valid")
|
|
2514
2514
|
return p;
|
|
2515
|
-
p.status === "dirty" && !a && (a = { result: p, ctx: l }), l.common.issues.length &&
|
|
2515
|
+
p.status === "dirty" && !a && (a = { result: p, ctx: l }), l.common.issues.length && i.push(l.common.issues);
|
|
2516
2516
|
}
|
|
2517
2517
|
if (a)
|
|
2518
2518
|
return r.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2519
|
-
const u =
|
|
2519
|
+
const u = i.map((d) => new ge(d));
|
|
2520
2520
|
return h(r, {
|
|
2521
2521
|
code: m.invalid_union,
|
|
2522
2522
|
unionErrors: u
|
|
@@ -2577,10 +2577,10 @@ class ar extends k {
|
|
|
2577
2577
|
static create(e, r, n) {
|
|
2578
2578
|
const s = /* @__PURE__ */ new Map();
|
|
2579
2579
|
for (const a of r) {
|
|
2580
|
-
const
|
|
2581
|
-
if (!
|
|
2580
|
+
const i = je(a.shape[e]);
|
|
2581
|
+
if (!i.length)
|
|
2582
2582
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2583
|
-
for (const u of
|
|
2583
|
+
for (const u of i) {
|
|
2584
2584
|
if (s.has(u))
|
|
2585
2585
|
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);
|
|
2586
2586
|
s.set(u, a);
|
|
@@ -2600,20 +2600,20 @@ function Er(t, e) {
|
|
|
2600
2600
|
if (t === e)
|
|
2601
2601
|
return { valid: !0, data: t };
|
|
2602
2602
|
if (r === g.object && n === g.object) {
|
|
2603
|
-
const s = S.objectKeys(e), a = S.objectKeys(t).filter((u) => s.indexOf(u) !== -1),
|
|
2603
|
+
const s = S.objectKeys(e), a = S.objectKeys(t).filter((u) => s.indexOf(u) !== -1), i = { ...t, ...e };
|
|
2604
2604
|
for (const u of a) {
|
|
2605
2605
|
const d = Er(t[u], e[u]);
|
|
2606
2606
|
if (!d.valid)
|
|
2607
2607
|
return { valid: !1 };
|
|
2608
|
-
|
|
2608
|
+
i[u] = d.data;
|
|
2609
2609
|
}
|
|
2610
|
-
return { valid: !0, data:
|
|
2610
|
+
return { valid: !0, data: i };
|
|
2611
2611
|
} else if (r === g.array && n === g.array) {
|
|
2612
2612
|
if (t.length !== e.length)
|
|
2613
2613
|
return { valid: !1 };
|
|
2614
2614
|
const s = [];
|
|
2615
2615
|
for (let a = 0; a < t.length; a++) {
|
|
2616
|
-
const
|
|
2616
|
+
const i = t[a], u = e[a], d = Er(i, u);
|
|
2617
2617
|
if (!d.valid)
|
|
2618
2618
|
return { valid: !1 };
|
|
2619
2619
|
s.push(d.data);
|
|
@@ -2623,11 +2623,11 @@ function Er(t, e) {
|
|
|
2623
2623
|
}
|
|
2624
2624
|
class St extends k {
|
|
2625
2625
|
_parse(e) {
|
|
2626
|
-
const { status: r, ctx: n } = this._processInputParams(e), s = (a,
|
|
2627
|
-
if (br(a) || br(
|
|
2626
|
+
const { status: r, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
2627
|
+
if (br(a) || br(i))
|
|
2628
2628
|
return b;
|
|
2629
|
-
const u = Er(a.value,
|
|
2630
|
-
return u.valid ? ((wr(a) || wr(
|
|
2629
|
+
const u = Er(a.value, i.value);
|
|
2630
|
+
return u.valid ? ((wr(a) || wr(i)) && r.dirty(), { status: r.value, value: u.data }) : (h(n, {
|
|
2631
2631
|
code: m.invalid_intersection_types
|
|
2632
2632
|
}), b);
|
|
2633
2633
|
};
|
|
@@ -2642,7 +2642,7 @@ class St extends k {
|
|
|
2642
2642
|
path: n.path,
|
|
2643
2643
|
parent: n
|
|
2644
2644
|
})
|
|
2645
|
-
]).then(([a,
|
|
2645
|
+
]).then(([a, i]) => s(a, i)) : s(this._def.left._parseSync({
|
|
2646
2646
|
data: n.data,
|
|
2647
2647
|
path: n.path,
|
|
2648
2648
|
parent: n
|
|
@@ -2683,11 +2683,11 @@ class Oe extends k {
|
|
|
2683
2683
|
exact: !1,
|
|
2684
2684
|
type: "array"
|
|
2685
2685
|
}), r.dirty());
|
|
2686
|
-
const a = [...n.data].map((
|
|
2686
|
+
const a = [...n.data].map((i, u) => {
|
|
2687
2687
|
const d = this._def.items[u] || this._def.rest;
|
|
2688
|
-
return d ? d._parse(new Se(n,
|
|
2689
|
-
}).filter((
|
|
2690
|
-
return n.common.async ? Promise.all(a).then((
|
|
2688
|
+
return d ? d._parse(new Se(n, i, n.path, u)) : null;
|
|
2689
|
+
}).filter((i) => !!i);
|
|
2690
|
+
return n.common.async ? Promise.all(a).then((i) => te.mergeArray(r, i)) : te.mergeArray(r, a);
|
|
2691
2691
|
}
|
|
2692
2692
|
get items() {
|
|
2693
2693
|
return this._def.items;
|
|
@@ -2724,11 +2724,11 @@ class Ot extends k {
|
|
|
2724
2724
|
expected: g.object,
|
|
2725
2725
|
received: n.parsedType
|
|
2726
2726
|
}), b;
|
|
2727
|
-
const s = [], a = this._def.keyType,
|
|
2727
|
+
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
2728
2728
|
for (const u in n.data)
|
|
2729
2729
|
s.push({
|
|
2730
2730
|
key: a._parse(new Se(n, u, n.path, u)),
|
|
2731
|
-
value:
|
|
2731
|
+
value: i._parse(new Se(n, n.data[u], n.path, u)),
|
|
2732
2732
|
alwaysSet: u in n.data
|
|
2733
2733
|
});
|
|
2734
2734
|
return n.common.async ? te.mergeObjectAsync(r, s) : te.mergeObjectSync(r, s);
|
|
@@ -2765,14 +2765,14 @@ class tr extends k {
|
|
|
2765
2765
|
expected: g.map,
|
|
2766
2766
|
received: n.parsedType
|
|
2767
2767
|
}), b;
|
|
2768
|
-
const s = this._def.keyType, a = this._def.valueType,
|
|
2768
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([u, d], l) => ({
|
|
2769
2769
|
key: s._parse(new Se(n, u, n.path, [l, "key"])),
|
|
2770
2770
|
value: a._parse(new Se(n, d, n.path, [l, "value"]))
|
|
2771
2771
|
}));
|
|
2772
2772
|
if (n.common.async) {
|
|
2773
2773
|
const u = /* @__PURE__ */ new Map();
|
|
2774
2774
|
return Promise.resolve().then(async () => {
|
|
2775
|
-
for (const d of
|
|
2775
|
+
for (const d of i) {
|
|
2776
2776
|
const l = await d.key, p = await d.value;
|
|
2777
2777
|
if (l.status === "aborted" || p.status === "aborted")
|
|
2778
2778
|
return b;
|
|
@@ -2782,7 +2782,7 @@ class tr extends k {
|
|
|
2782
2782
|
});
|
|
2783
2783
|
} else {
|
|
2784
2784
|
const u = /* @__PURE__ */ new Map();
|
|
2785
|
-
for (const d of
|
|
2785
|
+
for (const d of i) {
|
|
2786
2786
|
const l = d.key, p = d.value;
|
|
2787
2787
|
if (l.status === "aborted" || p.status === "aborted")
|
|
2788
2788
|
return b;
|
|
@@ -2824,7 +2824,7 @@ class Qe extends k {
|
|
|
2824
2824
|
message: s.maxSize.message
|
|
2825
2825
|
}), r.dirty());
|
|
2826
2826
|
const a = this._def.valueType;
|
|
2827
|
-
function
|
|
2827
|
+
function i(d) {
|
|
2828
2828
|
const l = /* @__PURE__ */ new Set();
|
|
2829
2829
|
for (const p of d) {
|
|
2830
2830
|
if (p.status === "aborted")
|
|
@@ -2834,7 +2834,7 @@ class Qe extends k {
|
|
|
2834
2834
|
return { status: r.value, value: l };
|
|
2835
2835
|
}
|
|
2836
2836
|
const u = [...n.data.values()].map((d, l) => a._parse(new Se(n, d, n.path, l)));
|
|
2837
|
-
return n.common.async ? Promise.all(u).then((d) =>
|
|
2837
|
+
return n.common.async ? Promise.all(u).then((d) => i(d)) : i(u);
|
|
2838
2838
|
}
|
|
2839
2839
|
min(e, r) {
|
|
2840
2840
|
return new Qe({
|
|
@@ -2906,13 +2906,13 @@ class ct extends k {
|
|
|
2906
2906
|
}
|
|
2907
2907
|
});
|
|
2908
2908
|
}
|
|
2909
|
-
const a = { errorMap: r.common.contextualErrorMap },
|
|
2909
|
+
const a = { errorMap: r.common.contextualErrorMap }, i = r.data;
|
|
2910
2910
|
if (this._def.returns instanceof dt) {
|
|
2911
2911
|
const u = this;
|
|
2912
2912
|
return se(async function(...d) {
|
|
2913
2913
|
const l = new ge([]), p = await u._def.args.parseAsync(d, a).catch((O) => {
|
|
2914
2914
|
throw l.addIssue(n(d, O)), l;
|
|
2915
|
-
}), E = await Reflect.apply(
|
|
2915
|
+
}), E = await Reflect.apply(i, this, p);
|
|
2916
2916
|
return await u._def.returns._def.type.parseAsync(E, a).catch((O) => {
|
|
2917
2917
|
throw l.addIssue(s(E, O)), l;
|
|
2918
2918
|
});
|
|
@@ -2923,7 +2923,7 @@ class ct extends k {
|
|
|
2923
2923
|
const l = u._def.args.safeParse(d, a);
|
|
2924
2924
|
if (!l.success)
|
|
2925
2925
|
throw new ge([n(d, l.error)]);
|
|
2926
|
-
const p = Reflect.apply(
|
|
2926
|
+
const p = Reflect.apply(i, this, l.data), E = u._def.returns.safeParse(p, a);
|
|
2927
2927
|
if (!E.success)
|
|
2928
2928
|
throw new ge([s(p, E.error)]);
|
|
2929
2929
|
return E.data;
|
|
@@ -3131,17 +3131,17 @@ class ke extends k {
|
|
|
3131
3131
|
}
|
|
3132
3132
|
_parse(e) {
|
|
3133
3133
|
const { status: r, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
3134
|
-
addIssue: (
|
|
3135
|
-
h(n,
|
|
3134
|
+
addIssue: (i) => {
|
|
3135
|
+
h(n, i), i.fatal ? r.abort() : r.dirty();
|
|
3136
3136
|
},
|
|
3137
3137
|
get path() {
|
|
3138
3138
|
return n.path;
|
|
3139
3139
|
}
|
|
3140
3140
|
};
|
|
3141
3141
|
if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
|
|
3142
|
-
const
|
|
3142
|
+
const i = s.transform(n.data, a);
|
|
3143
3143
|
if (n.common.async)
|
|
3144
|
-
return Promise.resolve(
|
|
3144
|
+
return Promise.resolve(i).then(async (u) => {
|
|
3145
3145
|
if (r.value === "aborted")
|
|
3146
3146
|
return b;
|
|
3147
3147
|
const d = await this._def.schema._parseAsync({
|
|
@@ -3155,7 +3155,7 @@ class ke extends k {
|
|
|
3155
3155
|
if (r.value === "aborted")
|
|
3156
3156
|
return b;
|
|
3157
3157
|
const u = this._def.schema._parseSync({
|
|
3158
|
-
data:
|
|
3158
|
+
data: i,
|
|
3159
3159
|
path: n.path,
|
|
3160
3160
|
parent: n
|
|
3161
3161
|
});
|
|
@@ -3163,7 +3163,7 @@ class ke extends k {
|
|
|
3163
3163
|
}
|
|
3164
3164
|
}
|
|
3165
3165
|
if (s.type === "refinement") {
|
|
3166
|
-
const
|
|
3166
|
+
const i = (u) => {
|
|
3167
3167
|
const d = s.refinement(u, a);
|
|
3168
3168
|
if (n.common.async)
|
|
3169
3169
|
return Promise.resolve(d);
|
|
@@ -3177,25 +3177,25 @@ class ke extends k {
|
|
|
3177
3177
|
path: n.path,
|
|
3178
3178
|
parent: n
|
|
3179
3179
|
});
|
|
3180
|
-
return u.status === "aborted" ? b : (u.status === "dirty" && r.dirty(),
|
|
3180
|
+
return u.status === "aborted" ? b : (u.status === "dirty" && r.dirty(), i(u.value), { status: r.value, value: u.value });
|
|
3181
3181
|
} else
|
|
3182
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((u) => u.status === "aborted" ? b : (u.status === "dirty" && r.dirty(),
|
|
3182
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((u) => u.status === "aborted" ? b : (u.status === "dirty" && r.dirty(), i(u.value).then(() => ({ status: r.value, value: u.value }))));
|
|
3183
3183
|
}
|
|
3184
3184
|
if (s.type === "transform")
|
|
3185
3185
|
if (n.common.async === !1) {
|
|
3186
|
-
const
|
|
3186
|
+
const i = this._def.schema._parseSync({
|
|
3187
3187
|
data: n.data,
|
|
3188
3188
|
path: n.path,
|
|
3189
3189
|
parent: n
|
|
3190
3190
|
});
|
|
3191
|
-
if (!Et(
|
|
3192
|
-
return
|
|
3193
|
-
const u = s.transform(
|
|
3191
|
+
if (!Et(i))
|
|
3192
|
+
return i;
|
|
3193
|
+
const u = s.transform(i.value, a);
|
|
3194
3194
|
if (u instanceof Promise)
|
|
3195
3195
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3196
3196
|
return { status: r.value, value: u };
|
|
3197
3197
|
} else
|
|
3198
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((
|
|
3198
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => Et(i) ? Promise.resolve(s.transform(i.value, a)).then((u) => ({ status: r.value, value: u })) : i);
|
|
3199
3199
|
S.assertNever(s);
|
|
3200
3200
|
}
|
|
3201
3201
|
}
|
|
@@ -3387,9 +3387,9 @@ Dt.create = (t, e) => new Dt({
|
|
|
3387
3387
|
});
|
|
3388
3388
|
function nn(t, e = {}, r) {
|
|
3389
3389
|
return t ? lt.create().superRefine((n, s) => {
|
|
3390
|
-
var a,
|
|
3390
|
+
var a, i;
|
|
3391
3391
|
if (!t(n)) {
|
|
3392
|
-
const u = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, d = (
|
|
3392
|
+
const u = typeof e == "function" ? e(n) : typeof e == "string" ? { message: e } : e, d = (i = (a = u.fatal) !== null && a !== void 0 ? a : r) !== null && i !== void 0 ? i : !0, l = typeof u == "string" ? { message: u } : u;
|
|
3393
3393
|
s.addIssue({ code: "custom", ...l, fatal: d });
|
|
3394
3394
|
}
|
|
3395
3395
|
}) : lt.create();
|
|
@@ -3413,7 +3413,7 @@ const fs = (t, e = {
|
|
|
3413
3413
|
bigint: (t) => Ue.create({ ...t, coerce: !0 }),
|
|
3414
3414
|
date: (t) => Xe.create({ ...t, coerce: !0 })
|
|
3415
3415
|
}, Bs = b;
|
|
3416
|
-
var
|
|
3416
|
+
var c = /* @__PURE__ */ Object.freeze({
|
|
3417
3417
|
__proto__: null,
|
|
3418
3418
|
defaultErrorMap: ut,
|
|
3419
3419
|
setErrorMap: Bn,
|
|
@@ -3529,23 +3529,23 @@ var i = /* @__PURE__ */ Object.freeze({
|
|
|
3529
3529
|
quotelessJson: Yn,
|
|
3530
3530
|
ZodError: ge
|
|
3531
3531
|
});
|
|
3532
|
-
const ye =
|
|
3532
|
+
const ye = c.string().trim().min(1, { message: "Cannot be blank" }), he = c.string().trim().optional(), xr = (t) => c.nullable(t.optional());
|
|
3533
3533
|
var Mt = /* @__PURE__ */ ((t) => (t.FIRST_NAME = "firstName", t.LAST_NAME = "lastName", t.EMAIL = "email", t.ZIP_CODE = "zipCode", t.CITY = "city", t.STATE = "state", t.COUNTRY = "country", t.ADDRESS = "address", t.PHONE = "phone", t.PROMOTION_CODE = "promotionCode", t))(Mt || {});
|
|
3534
|
-
const cn =
|
|
3534
|
+
const cn = c.nativeEnum(Mt);
|
|
3535
3535
|
var un = /* @__PURE__ */ ((t) => (t.CARD_NUMBER = "cardNumber", t.CARD_EXPIRY = "cardExpiry", t.CARD_CVC = "cardCvc", t))(un || {});
|
|
3536
|
-
const ln =
|
|
3537
|
-
provider:
|
|
3538
|
-
processor_name: xr(
|
|
3539
|
-
metadata: xr(
|
|
3540
|
-
}), Ks =
|
|
3541
|
-
id:
|
|
3536
|
+
const ln = c.nativeEnum(un), Hs = c.union([cn, ln]), dn = c.object({
|
|
3537
|
+
provider: c.string(),
|
|
3538
|
+
processor_name: xr(c.string()),
|
|
3539
|
+
metadata: xr(c.record(c.string(), c.any()))
|
|
3540
|
+
}), Ks = c.object({
|
|
3541
|
+
id: c.string()
|
|
3542
3542
|
});
|
|
3543
|
-
|
|
3543
|
+
c.object({
|
|
3544
3544
|
cardNumber: he,
|
|
3545
3545
|
expiry: he,
|
|
3546
3546
|
cvc: he
|
|
3547
3547
|
});
|
|
3548
|
-
|
|
3548
|
+
c.object({
|
|
3549
3549
|
backgroundColor: he,
|
|
3550
3550
|
color: he,
|
|
3551
3551
|
fontFamily: he,
|
|
@@ -3554,7 +3554,7 @@ i.object({
|
|
|
3554
3554
|
margin: he,
|
|
3555
3555
|
padding: he
|
|
3556
3556
|
});
|
|
3557
|
-
const N =
|
|
3557
|
+
const N = c.enum([
|
|
3558
3558
|
// Element -> Form
|
|
3559
3559
|
"LAYOUT",
|
|
3560
3560
|
"LOADED",
|
|
@@ -3575,56 +3575,56 @@ const N = i.enum([
|
|
|
3575
3575
|
"TOKENIZE",
|
|
3576
3576
|
"CHECKOUT",
|
|
3577
3577
|
"START_PAYMENT_FLOW"
|
|
3578
|
-
]), Js = N.extract(["TOKENIZE_STARTED", "CHECKOUT_STARTED"]), Gs =
|
|
3578
|
+
]), Js = N.extract(["TOKENIZE_STARTED", "CHECKOUT_STARTED"]), Gs = c.object({ type: Js }), Xs = N.extract(["BLUR", "FOCUS", "CHANGE"]), Qs = c.object({
|
|
3579
3579
|
type: Xs,
|
|
3580
3580
|
elementType: ln
|
|
3581
|
-
}), ea = N.extract(["LOAD_ERROR", "TOKENIZE_ERROR", "CHECKOUT_ERROR"]), ta =
|
|
3581
|
+
}), ea = N.extract(["LOAD_ERROR", "TOKENIZE_ERROR", "CHECKOUT_ERROR"]), ta = c.object({
|
|
3582
3582
|
type: ea,
|
|
3583
3583
|
message: ye
|
|
3584
|
-
}), ra = N.extract(["VALIDATION_ERROR"]), na =
|
|
3584
|
+
}), ra = N.extract(["VALIDATION_ERROR"]), na = c.object({
|
|
3585
3585
|
type: ra,
|
|
3586
3586
|
elementType: Hs,
|
|
3587
|
-
errors:
|
|
3588
|
-
}), sa =
|
|
3589
|
-
type:
|
|
3587
|
+
errors: c.array(c.string())
|
|
3588
|
+
}), sa = c.object({
|
|
3589
|
+
type: c.literal(N.enum.LAYOUT),
|
|
3590
3590
|
height: ye
|
|
3591
|
-
}), aa =
|
|
3592
|
-
type:
|
|
3591
|
+
}), aa = c.object({
|
|
3592
|
+
type: c.literal(N.enum.LOADED),
|
|
3593
3593
|
sessionId: ye,
|
|
3594
|
-
totalAmountAtoms:
|
|
3594
|
+
totalAmountAtoms: c.number(),
|
|
3595
3595
|
currency: he,
|
|
3596
|
-
checkoutPaymentMethods:
|
|
3597
|
-
}), oa =
|
|
3598
|
-
type:
|
|
3599
|
-
nextActionMetadata:
|
|
3600
|
-
paymentFlowMetadata:
|
|
3601
|
-
startPFMetadata:
|
|
3602
|
-
}), ia =
|
|
3603
|
-
type:
|
|
3604
|
-
paymentMethodId:
|
|
3605
|
-
}), ca =
|
|
3596
|
+
checkoutPaymentMethods: c.array(dn)
|
|
3597
|
+
}), oa = c.object({
|
|
3598
|
+
type: c.literal(N.enum.PAYMENT_FLOW_STARTED),
|
|
3599
|
+
nextActionMetadata: c.record(c.string(), c.any()),
|
|
3600
|
+
paymentFlowMetadata: c.any().optional(),
|
|
3601
|
+
startPFMetadata: c.optional(c.record(c.string(), c.any()))
|
|
3602
|
+
}), ia = c.object({
|
|
3603
|
+
type: c.literal(N.enum.SETUP_PAYMENT_METHOD_SUCCESS),
|
|
3604
|
+
paymentMethodId: c.string()
|
|
3605
|
+
}), ca = c.object({
|
|
3606
3606
|
firstName: ye,
|
|
3607
3607
|
lastName: ye,
|
|
3608
3608
|
email: ye,
|
|
3609
3609
|
zipCode: ye,
|
|
3610
3610
|
country: ye,
|
|
3611
3611
|
promotionCode: he
|
|
3612
|
-
}), ua = N.extract(["TOKENIZE", "CHECKOUT", "START_PAYMENT_FLOW"]), fn =
|
|
3612
|
+
}), ua = N.extract(["TOKENIZE", "CHECKOUT", "START_PAYMENT_FLOW"]), fn = c.object({
|
|
3613
3613
|
type: ua,
|
|
3614
3614
|
sessionId: ye,
|
|
3615
3615
|
checkoutPaymentMethod: dn,
|
|
3616
|
-
paymentFlowMetadata:
|
|
3617
|
-
doNotUseLegacyCCFlow:
|
|
3616
|
+
paymentFlowMetadata: c.any().optional(),
|
|
3617
|
+
doNotUseLegacyCCFlow: c.boolean().optional(),
|
|
3618
3618
|
existingCCPMId: he
|
|
3619
|
-
}).extend(ca.shape), la =
|
|
3620
|
-
type:
|
|
3621
|
-
isReadyForCheckout:
|
|
3622
|
-
}), da =
|
|
3623
|
-
type:
|
|
3624
|
-
invoiceUrls:
|
|
3625
|
-
subscriptionIds:
|
|
3626
|
-
customerId:
|
|
3627
|
-
}), fa =
|
|
3619
|
+
}).extend(ca.shape), la = c.object({
|
|
3620
|
+
type: c.literal(N.enum.TOKENIZE_SUCCESS),
|
|
3621
|
+
isReadyForCheckout: c.boolean()
|
|
3622
|
+
}), da = c.object({
|
|
3623
|
+
type: c.literal(N.enum.CHECKOUT_SUCCESS),
|
|
3624
|
+
invoiceUrls: c.array(c.string()),
|
|
3625
|
+
subscriptionIds: c.array(c.string()),
|
|
3626
|
+
customerId: c.string()
|
|
3627
|
+
}), fa = c.discriminatedUnion("type", [
|
|
3628
3628
|
Gs,
|
|
3629
3629
|
Qs,
|
|
3630
3630
|
ta,
|
|
@@ -3636,26 +3636,26 @@ const N = i.enum([
|
|
|
3636
3636
|
da,
|
|
3637
3637
|
oa,
|
|
3638
3638
|
ia
|
|
3639
|
-
]), ma =
|
|
3639
|
+
]), ma = c.object({
|
|
3640
3640
|
payload: fa,
|
|
3641
3641
|
nonce: ye,
|
|
3642
3642
|
formId: ye,
|
|
3643
3643
|
elementId: ye
|
|
3644
3644
|
});
|
|
3645
|
-
|
|
3646
|
-
amountAtom:
|
|
3645
|
+
c.object({
|
|
3646
|
+
amountAtom: c.number(),
|
|
3647
3647
|
currency: ye
|
|
3648
3648
|
});
|
|
3649
|
-
|
|
3650
|
-
secure_token:
|
|
3651
|
-
promotion_code:
|
|
3649
|
+
c.object({
|
|
3650
|
+
secure_token: c.string(),
|
|
3651
|
+
promotion_code: c.string().optional()
|
|
3652
3652
|
});
|
|
3653
|
-
|
|
3654
|
-
secure_token:
|
|
3655
|
-
existing_cc_pm_id: xr(
|
|
3653
|
+
c.object({
|
|
3654
|
+
secure_token: c.string(),
|
|
3655
|
+
existing_cc_pm_id: xr(c.string())
|
|
3656
3656
|
});
|
|
3657
|
-
const pa =
|
|
3658
|
-
payment_methods:
|
|
3657
|
+
const pa = c.object({
|
|
3658
|
+
payment_methods: c.array(Ks)
|
|
3659
3659
|
}), ha = (t) => {
|
|
3660
3660
|
const e = {};
|
|
3661
3661
|
return Object.entries(t).forEach(([r, n]) => {
|
|
@@ -3667,14 +3667,14 @@ const pa = i.object({
|
|
|
3667
3667
|
}
|
|
3668
3668
|
}), e;
|
|
3669
3669
|
}, ya = (t, e) => Array.from(t.querySelectorAll("input[data-opid]") ?? []).reduce((s, a) => {
|
|
3670
|
-
const
|
|
3671
|
-
return
|
|
3672
|
-
}, e), Kt = (t, e, r, n, s, a,
|
|
3670
|
+
const i = a.getAttribute("data-opid");
|
|
3671
|
+
return i ? { ...s, [i]: a.value } : s;
|
|
3672
|
+
}, e), Kt = (t, e, r, n, s, a, i) => {
|
|
3673
3673
|
const u = ya(r, {
|
|
3674
3674
|
type: t,
|
|
3675
3675
|
sessionId: e,
|
|
3676
3676
|
checkoutPaymentMethod: s,
|
|
3677
|
-
paymentFlowMetadata:
|
|
3677
|
+
paymentFlowMetadata: i,
|
|
3678
3678
|
doNotUseLegacyCCFlow: a
|
|
3679
3679
|
});
|
|
3680
3680
|
console.log(`[form] Constructing ${t} payload:`, u), (s.provider === "apple_pay" || s.provider === "google_pay") && (u[Mt.ZIP_CODE] || (console.log("[form] Overriding empty zip code (only for google and apple pay)"), u[Mt.ZIP_CODE] = "00000"));
|
|
@@ -3756,30 +3756,30 @@ const pa = i.object({
|
|
|
3756
3756
|
throw e.complete("fail"), new Error(`Payment failed: ${s.error.message ?? "unknown"}`);
|
|
3757
3757
|
e.complete("success");
|
|
3758
3758
|
}, ka = async (t) => {
|
|
3759
|
-
var a,
|
|
3759
|
+
var a, i, u, d;
|
|
3760
3760
|
const e = t.nextActionMetadata, n = await (await Rr(e.stripe_pk)).confirmCardSetup(e.client_secret, {
|
|
3761
3761
|
payment_method: e.stripe_pm_id
|
|
3762
3762
|
}), s = (a = n.setupIntent) == null ? void 0 : a.status;
|
|
3763
3763
|
if (s === "succeeded")
|
|
3764
3764
|
console.log("[3DS] CONFIRMING PM:", e.stripe_pm_id), console.log("[3DS] Setup intent created:", n.setupIntent);
|
|
3765
3765
|
else throw s === "canceled" ? new Error("Payment cancelled, please click Submit again to pay") : new Error(
|
|
3766
|
-
`${((
|
|
3766
|
+
`${((i = n.error) == null ? void 0 : i.message) ?? ((d = (u = n.setupIntent) == null ? void 0 : u.last_setup_error) == null ? void 0 : d.message) ?? "Payment failed, please click submit again to pay."}`
|
|
3767
3767
|
);
|
|
3768
3768
|
}, Ta = (t = {}) => {
|
|
3769
3769
|
const [e, r] = F(t), n = bt(
|
|
3770
3770
|
() => ({
|
|
3771
|
-
set: (a,
|
|
3771
|
+
set: (a, i) => {
|
|
3772
3772
|
r((u) => ({
|
|
3773
3773
|
...u,
|
|
3774
|
-
[a]:
|
|
3774
|
+
[a]: i
|
|
3775
3775
|
}));
|
|
3776
3776
|
},
|
|
3777
3777
|
setAll: (a) => {
|
|
3778
3778
|
r(a);
|
|
3779
3779
|
},
|
|
3780
3780
|
remove: (a) => {
|
|
3781
|
-
r((
|
|
3782
|
-
const { [a]: u, ...d } =
|
|
3781
|
+
r((i) => {
|
|
3782
|
+
const { [a]: u, ...d } = i;
|
|
3783
3783
|
return d;
|
|
3784
3784
|
});
|
|
3785
3785
|
},
|
|
@@ -3797,10 +3797,10 @@ var Sr = { exports: {} }, Ca = Hr;
|
|
|
3797
3797
|
function pn(t, e, r) {
|
|
3798
3798
|
var n = typeof e == "function";
|
|
3799
3799
|
Ca.useEffect(function() {
|
|
3800
|
-
var s, a = !0,
|
|
3800
|
+
var s, a = !0, i = t(function() {
|
|
3801
3801
|
return a;
|
|
3802
3802
|
});
|
|
3803
|
-
return Promise.resolve(
|
|
3803
|
+
return Promise.resolve(i).then(function(u) {
|
|
3804
3804
|
s = u;
|
|
3805
3805
|
}), function() {
|
|
3806
3806
|
a = !1, n && e(s);
|
|
@@ -3810,16 +3810,16 @@ function pn(t, e, r) {
|
|
|
3810
3810
|
Sr.exports = pn;
|
|
3811
3811
|
Sr.exports.useAsyncEffect = pn;
|
|
3812
3812
|
var Ra = Sr.exports;
|
|
3813
|
-
const nr = /* @__PURE__ */ Ln(Ra), Sa =
|
|
3814
|
-
type:
|
|
3815
|
-
loc:
|
|
3816
|
-
msg:
|
|
3817
|
-
url:
|
|
3818
|
-
}), Oa =
|
|
3819
|
-
code:
|
|
3820
|
-
message:
|
|
3821
|
-
path:
|
|
3822
|
-
}), Ia =
|
|
3813
|
+
const nr = /* @__PURE__ */ Ln(Ra), Sa = c.object({
|
|
3814
|
+
type: c.string(),
|
|
3815
|
+
loc: c.array(c.string()),
|
|
3816
|
+
msg: c.string(),
|
|
3817
|
+
url: c.string()
|
|
3818
|
+
}), Oa = c.array(Sa), Pa = c.object({
|
|
3819
|
+
code: c.string(),
|
|
3820
|
+
message: c.string(),
|
|
3821
|
+
path: c.array(c.string())
|
|
3822
|
+
}), Ia = c.array(Pa), ja = {
|
|
3823
3823
|
"failed to fetch": "Connection error: please double check if you are connected to the internet, then try again"
|
|
3824
3824
|
}, kr = (t) => {
|
|
3825
3825
|
const e = t.toLowerCase().trim();
|
|
@@ -3852,7 +3852,7 @@ ${t.message}`), t.message);
|
|
|
3852
3852
|
return t + "";
|
|
3853
3853
|
};
|
|
3854
3854
|
function Ma(t, e = 0) {
|
|
3855
|
-
const r = wt(!1), n = wt(), s = wt(t), a = Ze(() => r.current, []),
|
|
3855
|
+
const r = wt(!1), n = wt(), s = wt(t), a = Ze(() => r.current, []), i = Ze(() => {
|
|
3856
3856
|
r.current = !1, n.current && clearTimeout(n.current), n.current = setTimeout(() => {
|
|
3857
3857
|
r.current = !0, s.current();
|
|
3858
3858
|
}, e);
|
|
@@ -3861,132 +3861,132 @@ function Ma(t, e = 0) {
|
|
|
3861
3861
|
}, []);
|
|
3862
3862
|
return Ae(() => {
|
|
3863
3863
|
s.current = t;
|
|
3864
|
-
}, [t]), Ae(() => (
|
|
3864
|
+
}, [t]), Ae(() => (i(), u), [e]), [a, u, i];
|
|
3865
3865
|
}
|
|
3866
3866
|
function Za(t, e = 0, r = []) {
|
|
3867
3867
|
const [n, s, a] = Ma(t, e);
|
|
3868
3868
|
return Ae(a, r), [n, s];
|
|
3869
3869
|
}
|
|
3870
|
-
const H = (t) =>
|
|
3871
|
-
|
|
3872
|
-
const $a =
|
|
3873
|
-
cde_response_type:
|
|
3874
|
-
message:
|
|
3875
|
-
}), La =
|
|
3876
|
-
name:
|
|
3877
|
-
amount_atom_off: H(
|
|
3878
|
-
percent_off: H(
|
|
3879
|
-
currency: H(
|
|
3880
|
-
duration:
|
|
3881
|
-
duration_in_months: H(
|
|
3882
|
-
}), Ua =
|
|
3883
|
-
amount_subtotal_atom:
|
|
3884
|
-
amount_total_atom:
|
|
3885
|
-
currency:
|
|
3886
|
-
description: H(
|
|
3887
|
-
price_id:
|
|
3888
|
-
billing_interval: H(
|
|
3889
|
-
billing_interval_count: H(
|
|
3890
|
-
quantity:
|
|
3891
|
-
}), Fa =
|
|
3892
|
-
name:
|
|
3870
|
+
const H = (t) => c.nullable(t.optional());
|
|
3871
|
+
c.string().trim().min(1, { message: "Cannot be blank" });
|
|
3872
|
+
const $a = c.object({
|
|
3873
|
+
cde_response_type: c.literal("error"),
|
|
3874
|
+
message: c.string()
|
|
3875
|
+
}), La = c.enum(["usd", "brl"]), hn = c.object({
|
|
3876
|
+
name: c.string(),
|
|
3877
|
+
amount_atom_off: H(c.number()),
|
|
3878
|
+
percent_off: H(c.number()),
|
|
3879
|
+
currency: H(c.string()),
|
|
3880
|
+
duration: c.string(),
|
|
3881
|
+
duration_in_months: H(c.number())
|
|
3882
|
+
}), Ua = c.object({
|
|
3883
|
+
amount_subtotal_atom: c.number().int(),
|
|
3884
|
+
amount_total_atom: c.number().int(),
|
|
3885
|
+
currency: c.string(),
|
|
3886
|
+
description: H(c.string()),
|
|
3887
|
+
price_id: c.string(),
|
|
3888
|
+
billing_interval: H(c.string()),
|
|
3889
|
+
billing_interval_count: H(c.number().int()),
|
|
3890
|
+
quantity: c.number().int()
|
|
3891
|
+
}), Fa = c.record(c.string(), c.any()), Va = c.object({
|
|
3892
|
+
name: c.string(),
|
|
3893
3893
|
settings: H(Fa)
|
|
3894
|
-
}), za =
|
|
3895
|
-
provider:
|
|
3896
|
-
processor_name: H(
|
|
3897
|
-
metadata: H(
|
|
3898
|
-
}), Wa =
|
|
3899
|
-
quantity:
|
|
3900
|
-
}), qa =
|
|
3901
|
-
id: H(
|
|
3902
|
-
billing_interval: H(
|
|
3903
|
-
billing_interval_count: H(
|
|
3904
|
-
subscription_items:
|
|
3905
|
-
trial_start: H(
|
|
3906
|
-
trial_end: H(
|
|
3907
|
-
}), yn =
|
|
3908
|
-
amount_atom:
|
|
3909
|
-
}), Ya =
|
|
3910
|
-
amount_atom:
|
|
3911
|
-
amount_atom_considering_discount_applied:
|
|
3912
|
-
currency:
|
|
3913
|
-
discount_amount_atoms:
|
|
3914
|
-
subscription_item_id:
|
|
3915
|
-
}), Ba =
|
|
3894
|
+
}), za = c.object({
|
|
3895
|
+
provider: c.string(),
|
|
3896
|
+
processor_name: H(c.string()),
|
|
3897
|
+
metadata: H(c.record(c.string(), c.any()))
|
|
3898
|
+
}), Wa = c.object({
|
|
3899
|
+
quantity: c.number()
|
|
3900
|
+
}), qa = c.object({
|
|
3901
|
+
id: H(c.string()),
|
|
3902
|
+
billing_interval: H(c.string()),
|
|
3903
|
+
billing_interval_count: H(c.number().int()),
|
|
3904
|
+
subscription_items: c.array(Wa),
|
|
3905
|
+
trial_start: H(c.string()),
|
|
3906
|
+
trial_end: H(c.string())
|
|
3907
|
+
}), yn = c.object({
|
|
3908
|
+
amount_atom: c.number()
|
|
3909
|
+
}), Ya = c.object({
|
|
3910
|
+
amount_atom: c.number(),
|
|
3911
|
+
amount_atom_considering_discount_applied: c.number(),
|
|
3912
|
+
currency: c.string(),
|
|
3913
|
+
discount_amount_atoms: c.array(yn),
|
|
3914
|
+
subscription_item_id: c.string()
|
|
3915
|
+
}), Ba = c.object({
|
|
3916
3916
|
coupon: hn
|
|
3917
|
-
}), Ha =
|
|
3918
|
-
currency:
|
|
3919
|
-
discounts:
|
|
3920
|
-
hosted_invoice_url: H(
|
|
3921
|
-
lines:
|
|
3922
|
-
remaining_amount_atom:
|
|
3923
|
-
tax_amount_atom:
|
|
3924
|
-
total_amount_atom:
|
|
3925
|
-
total_discount_amount_atoms:
|
|
3926
|
-
}), zr =
|
|
3927
|
-
created:
|
|
3928
|
-
invoices:
|
|
3929
|
-
}), gn =
|
|
3917
|
+
}), Ha = c.object({
|
|
3918
|
+
currency: c.string(),
|
|
3919
|
+
discounts: c.array(Ba),
|
|
3920
|
+
hosted_invoice_url: H(c.string()),
|
|
3921
|
+
lines: c.array(Ya),
|
|
3922
|
+
remaining_amount_atom: c.number(),
|
|
3923
|
+
tax_amount_atom: c.number(),
|
|
3924
|
+
total_amount_atom: c.number(),
|
|
3925
|
+
total_discount_amount_atoms: c.array(yn)
|
|
3926
|
+
}), zr = c.object({
|
|
3927
|
+
created: c.array(qa),
|
|
3928
|
+
invoices: c.array(Ha)
|
|
3929
|
+
}), gn = c.object({
|
|
3930
3930
|
preview: zr,
|
|
3931
3931
|
preview_post_trial: H(zr),
|
|
3932
|
-
coupons:
|
|
3933
|
-
}), Wr =
|
|
3934
|
-
status:
|
|
3935
|
-
token:
|
|
3936
|
-
email: H(
|
|
3937
|
-
line_items:
|
|
3938
|
-
amount_subtotal_atom:
|
|
3939
|
-
amount_total_atom:
|
|
3932
|
+
coupons: c.array(hn)
|
|
3933
|
+
}), Wr = c.object({
|
|
3934
|
+
status: c.literal("open"),
|
|
3935
|
+
token: c.string(),
|
|
3936
|
+
email: H(c.string()),
|
|
3937
|
+
line_items: c.array(Ua),
|
|
3938
|
+
amount_subtotal_atom: c.number().int(),
|
|
3939
|
+
amount_total_atom: c.number().int(),
|
|
3940
3940
|
brand: Va,
|
|
3941
3941
|
subs_preview: H(gn),
|
|
3942
3942
|
// Null in setup mode
|
|
3943
|
-
methods_available:
|
|
3944
|
-
}), vn =
|
|
3945
|
-
|
|
3946
|
-
mode:
|
|
3947
|
-
currency:
|
|
3943
|
+
methods_available: c.array(za)
|
|
3944
|
+
}), vn = c.discriminatedUnion("mode", [
|
|
3945
|
+
c.object({
|
|
3946
|
+
mode: c.literal("setup"),
|
|
3947
|
+
currency: c.nullable(c.undefined())
|
|
3948
3948
|
}).extend(Wr.shape),
|
|
3949
|
-
|
|
3950
|
-
mode:
|
|
3949
|
+
c.object({
|
|
3950
|
+
mode: c.enum(["payment", "subscription"]),
|
|
3951
3951
|
currency: La
|
|
3952
3952
|
}).extend(Wr.shape)
|
|
3953
|
-
]), Ka =
|
|
3954
|
-
status:
|
|
3955
|
-
}), Ja =
|
|
3956
|
-
status:
|
|
3953
|
+
]), Ka = c.object({
|
|
3954
|
+
status: c.literal("complete")
|
|
3955
|
+
}), Ja = c.object({
|
|
3956
|
+
status: c.literal("expired")
|
|
3957
3957
|
});
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
logo:
|
|
3961
|
-
icon:
|
|
3962
|
-
primary_color:
|
|
3963
|
-
secondary_color:
|
|
3958
|
+
c.union([vn, Ka, Ja]);
|
|
3959
|
+
c.object({
|
|
3960
|
+
logo: c.string(),
|
|
3961
|
+
icon: c.string(),
|
|
3962
|
+
primary_color: c.string(),
|
|
3963
|
+
secondary_color: c.string()
|
|
3964
3964
|
});
|
|
3965
|
-
|
|
3966
|
-
invoice_urls:
|
|
3967
|
-
subscription_ids:
|
|
3968
|
-
customer_id:
|
|
3965
|
+
c.object({
|
|
3966
|
+
invoice_urls: c.array(c.string()),
|
|
3967
|
+
subscription_ids: c.array(c.string()),
|
|
3968
|
+
customer_id: c.string()
|
|
3969
3969
|
});
|
|
3970
|
-
|
|
3971
|
-
payment_method_id:
|
|
3970
|
+
c.object({
|
|
3971
|
+
payment_method_id: c.string()
|
|
3972
3972
|
});
|
|
3973
|
-
|
|
3974
|
-
id:
|
|
3975
|
-
return_url:
|
|
3973
|
+
c.object({
|
|
3974
|
+
id: c.string(),
|
|
3975
|
+
return_url: c.string()
|
|
3976
3976
|
});
|
|
3977
|
-
const Ga =
|
|
3978
|
-
type:
|
|
3979
|
-
loc:
|
|
3980
|
-
msg:
|
|
3981
|
-
url:
|
|
3977
|
+
const Ga = c.object({
|
|
3978
|
+
type: c.string(),
|
|
3979
|
+
loc: c.array(c.string()),
|
|
3980
|
+
msg: c.string(),
|
|
3981
|
+
url: c.string()
|
|
3982
3982
|
});
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
required_user_actions:
|
|
3983
|
+
c.array(Ga);
|
|
3984
|
+
c.object({
|
|
3985
|
+
required_user_actions: c.array(c.record(c.string(), c.any()))
|
|
3986
3986
|
});
|
|
3987
|
-
|
|
3988
|
-
required_user_actions:
|
|
3989
|
-
cc_pm_id:
|
|
3987
|
+
c.object({
|
|
3988
|
+
required_user_actions: c.array(c.record(c.string(), c.any())),
|
|
3989
|
+
cc_pm_id: c.string()
|
|
3990
3990
|
});
|
|
3991
3991
|
const Or = async (t, e, r) => {
|
|
3992
3992
|
console.log("[cde-client] Querying CDE with path and connection:", e.type, t);
|
|
@@ -3999,7 +3999,7 @@ const Or = async (t, e, r) => {
|
|
|
3999
3999
|
}
|
|
4000
4000
|
return n;
|
|
4001
4001
|
}, Xa = (t, e) => e.safeParse(t).success, Qa = (t) => $a.safeParse(t).success, eo = async (t, e) => await Or(t, { type: "get_checkout_preview", payload: e }, gn), Pr = async (t) => await Or(t, { type: "get_prefill", payload: {} }, vn), to = async (t, e) => await Or(t, { type: "confirm_payment_flow", payload: e }, pa), ro = (t) => t.reduce((e, r) => e + r, 0), no = (t, e, r, n) => {
|
|
4002
|
-
const [s, a] = F(""), [
|
|
4002
|
+
const [s, a] = F(""), [i, u] = F(""), [d, l] = F(null), [p, E] = F(!1), [T, O] = F(null);
|
|
4003
4003
|
return nr(async () => {
|
|
4004
4004
|
if (!n || !t)
|
|
4005
4005
|
return;
|
|
@@ -4018,15 +4018,15 @@ const Or = async (t, e, r) => {
|
|
|
4018
4018
|
try {
|
|
4019
4019
|
if (!e || !r || !t)
|
|
4020
4020
|
return;
|
|
4021
|
-
const M = (await Pr(e)).mode === "setup", L = await _n(e, r, M,
|
|
4022
|
-
console.log("[useDynamicPreview] Querying. Promo code:",
|
|
4021
|
+
const M = (await Pr(e)).mode === "setup", L = await _n(e, r, M, i);
|
|
4022
|
+
console.log("[useDynamicPreview] Querying. Promo code:", i), A() ? (console.log("[useDynamicPreview] Setting preview:", i, L), O(null), l(L)) : console.log("[useDynamicPreview] Discarding:", L);
|
|
4023
4023
|
} catch ($) {
|
|
4024
4024
|
A() && (console.error("[useDynamicPreview] Error doing preview", sr($)), O(sr($)));
|
|
4025
4025
|
} finally {
|
|
4026
4026
|
A() && E(!1);
|
|
4027
4027
|
}
|
|
4028
4028
|
},
|
|
4029
|
-
[!e, !r,
|
|
4029
|
+
[!e, !r, i, t]
|
|
4030
4030
|
), {
|
|
4031
4031
|
amount: d,
|
|
4032
4032
|
isLoading: p,
|
|
@@ -4051,10 +4051,10 @@ const Or = async (t, e, r) => {
|
|
|
4051
4051
|
}), s = new Set(n.preview.invoices.map((u) => u.currency));
|
|
4052
4052
|
if (s.size !== 1)
|
|
4053
4053
|
throw new Error(`Expected exactly one currency, got ${s.size}`);
|
|
4054
|
-
const a = s.values().next().value,
|
|
4054
|
+
const a = s.values().next().value, i = ro(n.preview.invoices.map((u) => u.remaining_amount_atom));
|
|
4055
4055
|
return {
|
|
4056
4056
|
currency: a,
|
|
4057
|
-
amountAtom:
|
|
4057
|
+
amountAtom: i
|
|
4058
4058
|
};
|
|
4059
4059
|
}, _n = async (t, e, r, n) => {
|
|
4060
4060
|
if (r)
|
|
@@ -4064,7 +4064,7 @@ const Or = async (t, e, r) => {
|
|
|
4064
4064
|
const s = await ao(t, e, n);
|
|
4065
4065
|
return { amountAtom: s.amountAtom, currency: s.currency };
|
|
4066
4066
|
}
|
|
4067
|
-
}, qr =
|
|
4067
|
+
}, qr = c.enum(["apple_pay", "google_pay"]), oo = {
|
|
4068
4068
|
apple_pay: "applePay",
|
|
4069
4069
|
google_pay: "googlePay"
|
|
4070
4070
|
}, Yr = {
|
|
@@ -4083,7 +4083,7 @@ const Or = async (t, e, r) => {
|
|
|
4083
4083
|
startFlow: async () => {
|
|
4084
4084
|
console.error("startFlow triggered when payment request is not available.");
|
|
4085
4085
|
}
|
|
4086
|
-
}, co = (t, e, r, n, s, a,
|
|
4086
|
+
}, co = (t, e, r, n, s, a, i, u) => {
|
|
4087
4087
|
const [d, l] = Ta({
|
|
4088
4088
|
apple_pay: Yr,
|
|
4089
4089
|
google_pay: Yr
|
|
@@ -4119,7 +4119,7 @@ const Or = async (t, e, r) => {
|
|
|
4119
4119
|
l.set(K, {
|
|
4120
4120
|
isLoading: !1,
|
|
4121
4121
|
isAvailable: (re == null ? void 0 : re[oo[K]]) ?? !1,
|
|
4122
|
-
startFlow: (ce) => lo(n, A, s, a,
|
|
4122
|
+
startFlow: (ce) => lo(n, A, s, a, i, ce)
|
|
4123
4123
|
});
|
|
4124
4124
|
} catch (ce) {
|
|
4125
4125
|
console.error(ce), l.set(K, io);
|
|
@@ -4137,19 +4137,20 @@ const Or = async (t, e, r) => {
|
|
|
4137
4137
|
!1
|
|
4138
4138
|
), lo = async (t, e, r, n, s, a) => {
|
|
4139
4139
|
try {
|
|
4140
|
-
|
|
4140
|
+
const i = window.console.log;
|
|
4141
|
+
if (i("[startFlow] triggered"), !uo(t, n, e))
|
|
4141
4142
|
return;
|
|
4142
|
-
|
|
4143
|
-
const
|
|
4144
|
-
if (
|
|
4145
|
-
const
|
|
4146
|
-
En(
|
|
4143
|
+
i("[startFlow] post-validate");
|
|
4144
|
+
const u = wn();
|
|
4145
|
+
if (i("[startFlow] pr:", u, "override:", a == null ? void 0 : a.overridePaymentRequest), a != null && a.overridePaymentRequest) {
|
|
4146
|
+
const l = a == null ? void 0 : a.overridePaymentRequest;
|
|
4147
|
+
En(u, l.amount, l.pending);
|
|
4147
4148
|
}
|
|
4148
|
-
|
|
4149
|
-
const
|
|
4150
|
-
|
|
4151
|
-
} catch (
|
|
4152
|
-
console.error("[startFlow] Error:",
|
|
4149
|
+
i("[startFlow] showing PR..."), u.show(), i("[startFlow] PR shown. Waiting...");
|
|
4150
|
+
const d = await wa(u);
|
|
4151
|
+
i("[startFlow] PR fulfilled. Completing flow..."), r(d, e);
|
|
4152
|
+
} catch (i) {
|
|
4153
|
+
window.console.error("[startFlow] Error:", i), s(sr(i));
|
|
4153
4154
|
}
|
|
4154
4155
|
}, fo = (t) => {
|
|
4155
4156
|
if ("ojs_pr" in window)
|
|
@@ -4206,8 +4207,8 @@ const mo = (t, e) => {
|
|
|
4206
4207
|
const e = document.location, r = yo.exec(t);
|
|
4207
4208
|
let n, s, a;
|
|
4208
4209
|
r ? (n = r[1] ? r[1] : e.protocol, s = r[2], a = r[4]) : (n = e.protocol, s = e.hostname, a = e.port);
|
|
4209
|
-
const
|
|
4210
|
-
return `${n}//${s}${
|
|
4210
|
+
const i = a && a !== ho[n] ? `:${a}` : "";
|
|
4211
|
+
return `${n}//${s}${i}`;
|
|
4211
4212
|
}, Br = ({ name: t, message: e, stack: r }) => ({
|
|
4212
4213
|
name: t,
|
|
4213
4214
|
message: e,
|
|
@@ -4216,7 +4217,7 @@ const mo = (t, e) => {
|
|
|
4216
4217
|
const e = new Error();
|
|
4217
4218
|
return Object.keys(t).forEach((r) => e[r] = t[r]), e;
|
|
4218
4219
|
}, bo = (t, e, r) => {
|
|
4219
|
-
const { localName: n, local: s, remote: a, originForSending:
|
|
4220
|
+
const { localName: n, local: s, remote: a, originForSending: i, originForReceiving: u } = t;
|
|
4220
4221
|
let d = !1;
|
|
4221
4222
|
const l = (p) => {
|
|
4222
4223
|
if (p.source !== a || p.data.penpal !== Re.Call)
|
|
@@ -4240,7 +4241,7 @@ const mo = (t, e) => {
|
|
|
4240
4241
|
};
|
|
4241
4242
|
M === Je.Rejected && L instanceof Error && (I.returnValue = Br(L), I.returnValueIsError = !0);
|
|
4242
4243
|
try {
|
|
4243
|
-
a.postMessage(I,
|
|
4244
|
+
a.postMessage(I, i);
|
|
4244
4245
|
} catch (U) {
|
|
4245
4246
|
if (U.name === Tr.DataCloneError) {
|
|
4246
4247
|
const re = {
|
|
@@ -4250,7 +4251,7 @@ const mo = (t, e) => {
|
|
|
4250
4251
|
returnValue: Br(U),
|
|
4251
4252
|
returnValueIsError: !0
|
|
4252
4253
|
};
|
|
4253
|
-
a.postMessage(re,
|
|
4254
|
+
a.postMessage(re, i);
|
|
4254
4255
|
}
|
|
4255
4256
|
throw U;
|
|
4256
4257
|
}
|
|
@@ -4267,7 +4268,7 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4267
4268
|
return r.push(t), xo(r);
|
|
4268
4269
|
}, To = (t, e, r) => {
|
|
4269
4270
|
const n = kn(e);
|
|
4270
|
-
return n.reduce((s, a,
|
|
4271
|
+
return n.reduce((s, a, i) => (typeof s[a] > "u" && (s[a] = {}), i === n.length - 1 && (s[a] = r), s[a]), t), t;
|
|
4271
4272
|
}, Tn = (t, e) => {
|
|
4272
4273
|
const r = {};
|
|
4273
4274
|
return Object.keys(t).forEach((n) => {
|
|
@@ -4280,7 +4281,7 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4280
4281
|
To(e, r, t[r]);
|
|
4281
4282
|
return e;
|
|
4282
4283
|
}, Ro = (t, e, r, n, s) => {
|
|
4283
|
-
const { localName: a, local:
|
|
4284
|
+
const { localName: a, local: i, remote: u, originForSending: d, originForReceiving: l } = e;
|
|
4284
4285
|
let p = !1;
|
|
4285
4286
|
s(`${a}: Connecting call sender`);
|
|
4286
4287
|
const E = (O) => (...A) => {
|
|
@@ -4304,11 +4305,11 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4304
4305
|
return;
|
|
4305
4306
|
}
|
|
4306
4307
|
const be = K.data;
|
|
4307
|
-
s(`${a}: Received ${O}() reply`),
|
|
4308
|
+
s(`${a}: Received ${O}() reply`), i.removeEventListener(ze.Message, U);
|
|
4308
4309
|
let ce = be.returnValue;
|
|
4309
4310
|
be.returnValueIsError && (ce = _o(ce)), (be.resolution === Je.Fulfilled ? M : L)(ce);
|
|
4310
4311
|
};
|
|
4311
|
-
|
|
4312
|
+
i.addEventListener(ze.Message, U);
|
|
4312
4313
|
const re = {
|
|
4313
4314
|
penpal: Re.Call,
|
|
4314
4315
|
id: I,
|
|
@@ -4322,7 +4323,7 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4322
4323
|
p = !0;
|
|
4323
4324
|
};
|
|
4324
4325
|
}, So = (t, e, r, n, s) => {
|
|
4325
|
-
const { destroy: a, onDestroy:
|
|
4326
|
+
const { destroy: a, onDestroy: i } = n;
|
|
4326
4327
|
let u, d;
|
|
4327
4328
|
const l = {};
|
|
4328
4329
|
return (p) => {
|
|
@@ -4338,11 +4339,11 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4338
4339
|
originForSending: r,
|
|
4339
4340
|
originForReceiving: e
|
|
4340
4341
|
};
|
|
4341
|
-
u && u(), u = bo(E, t, s),
|
|
4342
|
+
u && u(), u = bo(E, t, s), i(u), d && d.forEach((O) => {
|
|
4342
4343
|
delete l[O];
|
|
4343
4344
|
}), d = p.data.methodNames;
|
|
4344
4345
|
const T = Ro(l, E, d, a, s);
|
|
4345
|
-
return
|
|
4346
|
+
return i(T), l;
|
|
4346
4347
|
};
|
|
4347
4348
|
}, Oo = (t, e, r, n) => (s) => {
|
|
4348
4349
|
if (!s.source)
|
|
@@ -4379,9 +4380,9 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4379
4380
|
}
|
|
4380
4381
|
}, No = (t) => {
|
|
4381
4382
|
let { iframe: e, methods: r = {}, childOrigin: n, timeout: s, debug: a = !1 } = t;
|
|
4382
|
-
const
|
|
4383
|
+
const i = po(a), u = mo("Parent", i), { onDestroy: d, destroy: l } = u;
|
|
4383
4384
|
n || (Ao(e), n = vo(e.src));
|
|
4384
|
-
const p = n === "null" ? "*" : n, E = Tn(r), T = Oo(
|
|
4385
|
+
const p = n === "null" ? "*" : n, E = Tn(r), T = Oo(i, E, n, p), O = So(E, n, p, u, i);
|
|
4385
4386
|
return {
|
|
4386
4387
|
promise: new Promise(($, M) => {
|
|
4387
4388
|
const L = jo(s, l), I = (U) => {
|
|
@@ -4397,7 +4398,7 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4397
4398
|
}
|
|
4398
4399
|
}
|
|
4399
4400
|
};
|
|
4400
|
-
window.addEventListener(ze.Message, I),
|
|
4401
|
+
window.addEventListener(ze.Message, I), i("Parent: Awaiting handshake"), Io(e, u), d((U) => {
|
|
4401
4402
|
window.removeEventListener(ze.Message, I), U && M(U);
|
|
4402
4403
|
});
|
|
4403
4404
|
}),
|
|
@@ -4452,7 +4453,7 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4452
4453
|
className: n,
|
|
4453
4454
|
onFocus: s,
|
|
4454
4455
|
onBlur: a,
|
|
4455
|
-
onChange:
|
|
4456
|
+
onChange: i,
|
|
4456
4457
|
onLoad: u,
|
|
4457
4458
|
onLoadError: d,
|
|
4458
4459
|
onValidationError: l,
|
|
@@ -4464,7 +4465,7 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4464
4465
|
enableDynamicPreviews: $
|
|
4465
4466
|
} = t, M = A ?? va, [L, I] = F(void 0), [U, re] = F([]), [K, be] = F("1px"), [ce, ir] = F(!1), [ue, We] = F(void 0), [Lt, Te] = F(!1), [B, Pe] = F([]), [ae, Ut] = F({}), [ft, qe] = F(0), [mt, le] = F(!1), [de, Ft] = F(void 0), [pt, cr] = F(void 0), [Vt, ht] = F(void 0), [fe, et] = F(void 0), [Ye, tt] = F(void 0), we = bt(() => `opjs-form-${Jr()}`, []), oe = wt(null);
|
|
4466
4467
|
Ae(() => {
|
|
4467
|
-
const D = { version: "0.0.
|
|
4468
|
+
const D = { version: "0.0.19", release_version: "0.0.19-alpha.2de60c2" };
|
|
4468
4469
|
window.ojs_version = D, console.log("OJS version:", D);
|
|
4469
4470
|
}, []);
|
|
4470
4471
|
const { cdeConn: De, connectToCdeIframe: zt } = Do(), Be = no(
|
|
@@ -4496,8 +4497,8 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4496
4497
|
s(q.elementId);
|
|
4497
4498
|
else if (X === N.enum.BLUR && a)
|
|
4498
4499
|
a(q.elementId);
|
|
4499
|
-
else if (X === N.enum.CHANGE &&
|
|
4500
|
-
|
|
4500
|
+
else if (X === N.enum.CHANGE && i)
|
|
4501
|
+
i(q.elementId);
|
|
4501
4502
|
else if (X === N.enum.LOADED) {
|
|
4502
4503
|
const J = B.find((z) => z.contentWindow === ee);
|
|
4503
4504
|
if (Te(!1), !J) {
|
|
@@ -4605,7 +4606,7 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4605
4606
|
ft,
|
|
4606
4607
|
mt,
|
|
4607
4608
|
a,
|
|
4608
|
-
|
|
4609
|
+
i,
|
|
4609
4610
|
s,
|
|
4610
4611
|
d,
|
|
4611
4612
|
p,
|
|
@@ -4709,18 +4710,18 @@ const Eo = () => ++wo, xn = ".", kn = (t) => t ? t.split(xn) : [], xo = (t) => t
|
|
|
4709
4710
|
columnNumber: 5
|
|
4710
4711
|
}, void 0);
|
|
4711
4712
|
}, Lo = (t) => JSON.stringify(t), or = (t) => {
|
|
4712
|
-
const { subPath: e, styles: r } = t, { formId: n, referer: s, formHeight: a, checkoutSecureToken:
|
|
4713
|
+
const { subPath: e, styles: r } = t, { formId: n, referer: s, formHeight: a, checkoutSecureToken: i, registerIframe: u, baseUrl: d } = $n(), [l, p] = F(!1), E = wt(null), T = bt(() => r ? Lo(r) : "", [r]), O = bt(() => ({
|
|
4713
4714
|
border: "none",
|
|
4714
4715
|
width: "100%",
|
|
4715
4716
|
height: a
|
|
4716
4717
|
}), [a]), A = bt(() => {
|
|
4717
|
-
if (!
|
|
4718
|
+
if (!i || !s) return "";
|
|
4718
4719
|
const $ = new URLSearchParams();
|
|
4719
|
-
return $.append("referer", s), $.append("styles", T), $.append("formId", n), $.append("secureToken",
|
|
4720
|
-
}, [T, n, s,
|
|
4720
|
+
return $.append("referer", s), $.append("styles", T), $.append("formId", n), $.append("secureToken", i), $.toString();
|
|
4721
|
+
}, [T, n, s, i]);
|
|
4721
4722
|
return Ae(() => p(!0), []), Ae(() => {
|
|
4722
4723
|
!E.current || !l || u(E.current);
|
|
4723
|
-
}, [l]),
|
|
4724
|
+
}, [l]), i ? /* @__PURE__ */ $e.jsxDEV(
|
|
4724
4725
|
"iframe",
|
|
4725
4726
|
{
|
|
4726
4727
|
id: `ojs-${e}-element`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getopenpay/openpay-js-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19-alpha.2de60c2",
|
|
4
4
|
"description": "Accept payments through OpenPay, right on your site",
|
|
5
5
|
"author": "OpenPay <info@getopenpay.com> (https://getopenpay.com)",
|
|
6
6
|
"type": "module",
|