@odus/checkout 1.0.0 → 1.2.0
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/checkout.es.js +344 -745
- package/dist/elements.es.js +1 -1
- package/dist/package.json +2 -5
- package/dist/phone.js +1 -1
- package/dist/shared.js +2363 -1859
- package/package.json +2 -5
package/dist/checkout.es.js
CHANGED
|
@@ -1,411 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
// Checkout lifecycle events
|
|
5
|
-
CHECKOUT_INITIALIZED: "checkout.initialized",
|
|
6
|
-
CHECKOUT_MOUNTED: "checkout.mounted",
|
|
7
|
-
CHECKOUT_UNMOUNTED: "checkout.unmounted",
|
|
8
|
-
// Payment association events
|
|
9
|
-
PAYMENT_ASSOCIATED: "payment.associated",
|
|
10
|
-
PAYMENT_ASSOCIATION_FAILED: "payment.association.failed",
|
|
11
|
-
// Form submission events
|
|
12
|
-
PAYMENT_SUBMIT_STARTED: "payment.submit.started",
|
|
13
|
-
PAYMENT_SUBMIT_SUCCESS: "payment.submit.success",
|
|
14
|
-
PAYMENT_SUBMIT_FAILED: "payment.submit.failed",
|
|
15
|
-
// Payment status events
|
|
16
|
-
PAYMENT_AUTHORIZED: "payment.authorized",
|
|
17
|
-
PAYMENT_FAILED: "payment.failed",
|
|
18
|
-
PAYMENT_ACTION_REQUIRED: "payment.action_required"
|
|
19
|
-
}, se = {
|
|
20
|
-
PAYMENT_AUTHORIZATION_TIME: "payment.authorization_time",
|
|
21
|
-
CHECKOUT_LOAD_TIME: "checkout.load_time",
|
|
22
|
-
FORM_RENDER_TIME: "form.render_time"
|
|
23
|
-
}, Ie = /^\s*at (?:(.+?) ?\()?((?:file|https?|chrome-extension|webpack-internal):\/\/.+?):(\d+):(\d+)\)?\s*$/, xe = /^([^@]+)@((?:file|https?|chrome-extension|webpack-internal):\/\/[^\s:]+):(\d+):(\d+)$/, Te = /^(?:([^@]+)@)?((?:file|https?):\/\/[^\s:]+):(\d+):(\d+)$/, Z = (n) => {
|
|
24
|
-
if (!n)
|
|
25
|
-
return [];
|
|
26
|
-
const e = [], t = n.split(`
|
|
27
|
-
`);
|
|
28
|
-
for (const s of t) {
|
|
29
|
-
const a = s.trim();
|
|
30
|
-
if (!a)
|
|
31
|
-
continue;
|
|
32
|
-
let i = Ie.exec(a);
|
|
33
|
-
if (i) {
|
|
34
|
-
e.push({
|
|
35
|
-
function: i[1] || "(anonymous)",
|
|
36
|
-
filename: i[2],
|
|
37
|
-
lineno: parseInt(i[3], 10),
|
|
38
|
-
colno: parseInt(i[4], 10)
|
|
39
|
-
});
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
i = xe.exec(a) ?? Te.exec(a), i && e.push({
|
|
43
|
-
function: i[1] || "(anonymous)",
|
|
44
|
-
filename: i[2],
|
|
45
|
-
lineno: parseInt(i[3], 10),
|
|
46
|
-
colno: parseInt(i[4], 10)
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
return e;
|
|
50
|
-
}, Le = "@odus/telemetry", Ve = "0.0.1";
|
|
51
|
-
let H, z, J;
|
|
52
|
-
const _e = () => {
|
|
53
|
-
if (typeof navigator > "u")
|
|
54
|
-
return {};
|
|
55
|
-
const n = navigator.userAgent;
|
|
56
|
-
let e, t, s;
|
|
57
|
-
n.includes("Firefox/") ? (e = "Firefox", t = n.match(/Firefox\/([\d.]+)/)?.[1]) : n.includes("Edg/") ? (e = "Edge", t = n.match(/Edg\/([\d.]+)/)?.[1]) : n.includes("Chrome/") ? (e = "Chrome", t = n.match(/Chrome\/([\d.]+)/)?.[1]) : n.includes("Safari/") && (e = "Safari", t = n.match(/Version\/([\d.]+)/)?.[1]), n.includes("Windows") ? s = "Windows" : n.includes("Mac OS") ? s = "macOS" : n.includes("Linux") ? s = "Linux" : n.includes("Android") ? s = "Android" : (n.includes("iPhone") || n.includes("iPad")) && (s = "iOS");
|
|
58
|
-
const a = /Mobi|Android|iPhone|iPad/i.test(n) || void 0;
|
|
59
|
-
return {
|
|
60
|
-
name: e,
|
|
61
|
-
version: t,
|
|
62
|
-
os: s,
|
|
63
|
-
mobile: a ?? !1,
|
|
64
|
-
language: navigator.language,
|
|
65
|
-
viewportWidth: String(window.innerWidth),
|
|
66
|
-
viewportHeight: String(window.innerHeight),
|
|
67
|
-
userAgent: n
|
|
68
|
-
};
|
|
69
|
-
}, Be = () => typeof window > "u" ? {} : { url: window.location.href }, Re = (n) => {
|
|
70
|
-
H = void 0, J = void 0, z = n.sessionTracking?.session ? { id: n.sessionTracking.session.id } : void 0;
|
|
71
|
-
}, Ue = (n) => {
|
|
72
|
-
H = n;
|
|
73
|
-
}, Oe = () => {
|
|
74
|
-
H = void 0;
|
|
75
|
-
}, He = (n) => {
|
|
76
|
-
z = n;
|
|
77
|
-
}, ze = (n) => {
|
|
78
|
-
J = n;
|
|
79
|
-
}, $e = () => z?.id, Ke = (n) => ({
|
|
80
|
-
sdk: { name: Le, version: Ve },
|
|
81
|
-
app: n.app,
|
|
82
|
-
user: H,
|
|
83
|
-
session: z,
|
|
84
|
-
page: Be(),
|
|
85
|
-
browser: _e(),
|
|
86
|
-
view: J
|
|
87
|
-
}), je = 30, qe = 250, We = 6e4;
|
|
88
|
-
let x = [], k = null, X = 0, _ = null, B = null;
|
|
89
|
-
const Ye = (n) => {
|
|
90
|
-
if (k)
|
|
91
|
-
return;
|
|
92
|
-
const e = n.batching?.sendTimeout ?? qe;
|
|
93
|
-
k = setTimeout(() => {
|
|
94
|
-
$(n);
|
|
95
|
-
}, e);
|
|
96
|
-
}, Ze = (n, e) => {
|
|
97
|
-
const t = {
|
|
98
|
-
meta: Ke(e)
|
|
99
|
-
};
|
|
100
|
-
for (const s of n)
|
|
101
|
-
switch (s.type) {
|
|
102
|
-
case "exception":
|
|
103
|
-
(t.exceptions ??= []).push(s.payload);
|
|
104
|
-
break;
|
|
105
|
-
case "log":
|
|
106
|
-
(t.logs ??= []).push(s.payload);
|
|
107
|
-
break;
|
|
108
|
-
case "event":
|
|
109
|
-
(t.events ??= []).push(s.payload);
|
|
110
|
-
break;
|
|
111
|
-
case "measurement":
|
|
112
|
-
(t.measurements ??= []).push(s.payload);
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
return t;
|
|
116
|
-
}, Ge = (n, e, t = !1) => {
|
|
117
|
-
const s = JSON.stringify(n), a = $e(), i = {
|
|
118
|
-
"Content-Type": "application/json"
|
|
119
|
-
};
|
|
120
|
-
if (a && (i["x-faro-session-id"] = a), t && typeof navigator < "u" && navigator.sendBeacon) {
|
|
121
|
-
const o = new Blob([s], { type: "application/json" });
|
|
122
|
-
navigator.sendBeacon(e, o);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const r = s.length < We;
|
|
126
|
-
fetch(e, {
|
|
127
|
-
method: "POST",
|
|
128
|
-
headers: i,
|
|
129
|
-
body: s,
|
|
130
|
-
keepalive: r
|
|
131
|
-
}).then((o) => {
|
|
132
|
-
if (o.status === 429) {
|
|
133
|
-
const d = o.headers.get("Retry-After"), c = d ? parseInt(d, 10) * 1e3 : 3e4;
|
|
134
|
-
X = Date.now() + c;
|
|
135
|
-
}
|
|
136
|
-
}).catch(() => {
|
|
137
|
-
});
|
|
138
|
-
}, $ = (n, e = !1) => {
|
|
139
|
-
if (k && (clearTimeout(k), k = null), x.length === 0)
|
|
140
|
-
return;
|
|
141
|
-
if (Date.now() < X) {
|
|
142
|
-
x = [];
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const t = x;
|
|
146
|
-
x = [];
|
|
147
|
-
try {
|
|
148
|
-
let s = Ze(t, n);
|
|
149
|
-
if (n.beforeSend) {
|
|
150
|
-
const a = n.beforeSend(s);
|
|
151
|
-
if (!a)
|
|
152
|
-
return;
|
|
153
|
-
s = a;
|
|
154
|
-
}
|
|
155
|
-
Ge(s, n.url, e);
|
|
156
|
-
} catch {
|
|
157
|
-
}
|
|
158
|
-
}, w = (n, e) => {
|
|
159
|
-
x.push(n);
|
|
160
|
-
const t = e.batching?.itemLimit ?? je;
|
|
161
|
-
if (x.length >= t) {
|
|
162
|
-
$(e);
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
Ye(e);
|
|
166
|
-
}, Je = (n) => {
|
|
167
|
-
if (x = [], X = 0, k && (clearTimeout(k), k = null), typeof document > "u")
|
|
168
|
-
return;
|
|
169
|
-
_ && document.removeEventListener("visibilitychange", _), B && window.removeEventListener("pagehide", B);
|
|
170
|
-
const e = () => $(n, !0);
|
|
171
|
-
_ = () => {
|
|
172
|
-
document.visibilityState === "hidden" && e();
|
|
173
|
-
}, B = e, document.addEventListener("visibilitychange", _), window.addEventListener("pagehide", B);
|
|
174
|
-
}, ne = () => (/* @__PURE__ */ new Date()).toISOString();
|
|
175
|
-
let ie = null, ae = null;
|
|
176
|
-
const Xe = (n) => {
|
|
177
|
-
typeof window > "u" || (ie = (e) => {
|
|
178
|
-
const t = e.error instanceof Error ? e.error : new Error(e.message);
|
|
179
|
-
w({
|
|
180
|
-
type: "exception",
|
|
181
|
-
payload: {
|
|
182
|
-
type: t.name,
|
|
183
|
-
value: t.message,
|
|
184
|
-
timestamp: ne(),
|
|
185
|
-
stacktrace: t.stack ? { frames: Z(t.stack) } : void 0
|
|
186
|
-
}
|
|
187
|
-
}, n);
|
|
188
|
-
}, ae = (e) => {
|
|
189
|
-
const t = e.reason, s = t instanceof Error ? t : new Error(String(t));
|
|
190
|
-
w({
|
|
191
|
-
type: "exception",
|
|
192
|
-
payload: {
|
|
193
|
-
type: s.name,
|
|
194
|
-
value: s.message,
|
|
195
|
-
timestamp: ne(),
|
|
196
|
-
stacktrace: s.stack ? { frames: Z(s.stack) } : void 0,
|
|
197
|
-
context: { source: "unhandledrejection" }
|
|
198
|
-
}
|
|
199
|
-
}, n);
|
|
200
|
-
}, window.addEventListener("error", ie), window.addEventListener("unhandledrejection", ae));
|
|
201
|
-
}, re = "odus_telemetry_session_id", j = () => {
|
|
202
|
-
const n = new Uint8Array(16);
|
|
203
|
-
return crypto.getRandomValues(n), Array.from(n, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
204
|
-
}, Qe = (n) => {
|
|
205
|
-
if (n)
|
|
206
|
-
return n;
|
|
207
|
-
if (typeof sessionStorage > "u")
|
|
208
|
-
return j();
|
|
209
|
-
try {
|
|
210
|
-
const e = sessionStorage.getItem(re);
|
|
211
|
-
if (e)
|
|
212
|
-
return e;
|
|
213
|
-
const t = j();
|
|
214
|
-
return sessionStorage.setItem(re, t), t;
|
|
215
|
-
} catch {
|
|
216
|
-
return j();
|
|
217
|
-
}
|
|
218
|
-
}, et = (n) => {
|
|
219
|
-
if (!n.sessionTracking?.enabled)
|
|
220
|
-
return;
|
|
221
|
-
const e = Qe(n.sessionTracking.session?.id);
|
|
222
|
-
He({ id: e });
|
|
223
|
-
}, q = () => (/* @__PURE__ */ new Date()).toISOString(), W = (n, e) => {
|
|
224
|
-
if (typeof PerformanceObserver > "u" || !PerformanceObserver.supportedEntryTypes?.includes(n))
|
|
225
|
-
return;
|
|
226
|
-
new PerformanceObserver((s) => {
|
|
227
|
-
for (const a of s.getEntries())
|
|
228
|
-
e(a);
|
|
229
|
-
}).observe({ type: n, buffered: !0 });
|
|
230
|
-
}, tt = (n) => {
|
|
231
|
-
if (typeof window > "u")
|
|
232
|
-
return;
|
|
233
|
-
W("largest-contentful-paint", (t) => {
|
|
234
|
-
w({
|
|
235
|
-
type: "measurement",
|
|
236
|
-
payload: {
|
|
237
|
-
type: "web-vitals",
|
|
238
|
-
values: { lcp: t.startTime },
|
|
239
|
-
timestamp: q()
|
|
240
|
-
}
|
|
241
|
-
}, n);
|
|
242
|
-
});
|
|
243
|
-
let e = 0;
|
|
244
|
-
W("layout-shift", (t) => {
|
|
245
|
-
const s = t;
|
|
246
|
-
s.hadRecentInput || (e += s.value, w({
|
|
247
|
-
type: "measurement",
|
|
248
|
-
payload: {
|
|
249
|
-
type: "web-vitals",
|
|
250
|
-
values: { cls: e },
|
|
251
|
-
timestamp: q()
|
|
252
|
-
}
|
|
253
|
-
}, n));
|
|
254
|
-
}), W("event", (t) => {
|
|
255
|
-
const s = t;
|
|
256
|
-
s.duration > 0 && w({
|
|
257
|
-
type: "measurement",
|
|
258
|
-
payload: {
|
|
259
|
-
type: "web-vitals",
|
|
260
|
-
values: { inp: s.duration },
|
|
261
|
-
timestamp: q()
|
|
262
|
-
}
|
|
263
|
-
}, n);
|
|
264
|
-
});
|
|
265
|
-
}, O = {
|
|
266
|
-
INFO: "info",
|
|
267
|
-
WARN: "warn",
|
|
268
|
-
ERROR: "error"
|
|
269
|
-
}, R = () => (/* @__PURE__ */ new Date()).toISOString(), st = (n) => {
|
|
270
|
-
Re(n), Je(n);
|
|
271
|
-
const e = n.instrumentations ?? {
|
|
272
|
-
errors: !0,
|
|
273
|
-
webVitals: !0,
|
|
274
|
-
session: !0
|
|
275
|
-
};
|
|
276
|
-
return e.session !== !1 && et(n), e.errors !== !1 && Xe(n), e.webVitals !== !1 && tt(n), {
|
|
277
|
-
pushError(t, s) {
|
|
278
|
-
w({
|
|
279
|
-
type: "exception",
|
|
280
|
-
payload: {
|
|
281
|
-
type: t.name,
|
|
282
|
-
value: t.message,
|
|
283
|
-
timestamp: R(),
|
|
284
|
-
stacktrace: t.stack ? { frames: Z(t.stack) } : void 0,
|
|
285
|
-
context: s?.context
|
|
286
|
-
}
|
|
287
|
-
}, n);
|
|
288
|
-
},
|
|
289
|
-
pushEvent(t, s) {
|
|
290
|
-
w({
|
|
291
|
-
type: "event",
|
|
292
|
-
payload: {
|
|
293
|
-
name: t,
|
|
294
|
-
timestamp: R(),
|
|
295
|
-
attributes: s
|
|
296
|
-
}
|
|
297
|
-
}, n);
|
|
298
|
-
},
|
|
299
|
-
pushMeasurement(t) {
|
|
300
|
-
w({
|
|
301
|
-
type: "measurement",
|
|
302
|
-
payload: {
|
|
303
|
-
type: t.type,
|
|
304
|
-
values: t.values,
|
|
305
|
-
timestamp: R(),
|
|
306
|
-
context: t.context
|
|
307
|
-
}
|
|
308
|
-
}, n);
|
|
309
|
-
},
|
|
310
|
-
pushLog(t, s) {
|
|
311
|
-
w({
|
|
312
|
-
type: "log",
|
|
313
|
-
payload: {
|
|
314
|
-
message: t.join(" "),
|
|
315
|
-
level: s?.level ?? O.INFO,
|
|
316
|
-
timestamp: R(),
|
|
317
|
-
context: s?.context
|
|
318
|
-
}
|
|
319
|
-
}, n);
|
|
320
|
-
},
|
|
321
|
-
setUser(t) {
|
|
322
|
-
Ue(t);
|
|
323
|
-
},
|
|
324
|
-
resetUser() {
|
|
325
|
-
Oe();
|
|
326
|
-
},
|
|
327
|
-
setView(t) {
|
|
328
|
-
ze(t);
|
|
329
|
-
},
|
|
330
|
-
flush() {
|
|
331
|
-
$(n);
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
}, nt = (n) => n === "test" ? "https://sandbox-analytics.odus.com/collect" : "https://analytics.odus.com/collect", it = () => {
|
|
335
|
-
if (typeof window > "u")
|
|
336
|
-
return !1;
|
|
337
|
-
const n = window.location.hostname;
|
|
338
|
-
return n === "localhost" || n === "127.0.0.1" || n === "0.0.0.0" || n === "::1" || n === "[::1]" || n.endsWith(".localhost");
|
|
339
|
-
};
|
|
340
|
-
let E = null;
|
|
341
|
-
const at = (n) => {
|
|
342
|
-
if (E)
|
|
343
|
-
return E;
|
|
344
|
-
if (it())
|
|
345
|
-
return null;
|
|
346
|
-
const e = nt(n.environment);
|
|
347
|
-
return E = st({
|
|
348
|
-
url: e,
|
|
349
|
-
app: {
|
|
350
|
-
name: "odus-checkout",
|
|
351
|
-
environment: n.environment === "test" ? "sandbox" : "production"
|
|
352
|
-
},
|
|
353
|
-
isolate: !0,
|
|
354
|
-
sessionTracking: {
|
|
355
|
-
enabled: !0,
|
|
356
|
-
session: {
|
|
357
|
-
id: n.sessionId
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
beforeSend: (t) => {
|
|
361
|
-
if (t.meta?.view?.name)
|
|
362
|
-
try {
|
|
363
|
-
const s = new URL(t.meta.view.name);
|
|
364
|
-
[
|
|
365
|
-
"token",
|
|
366
|
-
"key",
|
|
367
|
-
"apiKey",
|
|
368
|
-
"card",
|
|
369
|
-
"cvv",
|
|
370
|
-
"pan"
|
|
371
|
-
].forEach((i) => {
|
|
372
|
-
s.searchParams.has(i) && s.searchParams.set(i, "[REDACTED]");
|
|
373
|
-
}), t.meta.view.name = s.toString();
|
|
374
|
-
} catch {
|
|
375
|
-
}
|
|
376
|
-
return t;
|
|
377
|
-
}
|
|
378
|
-
}), E;
|
|
379
|
-
}, rt = (n, e) => {
|
|
380
|
-
E && E.pushError(n, { context: e });
|
|
381
|
-
}, M = (n, e) => {
|
|
382
|
-
E && E.pushEvent(n, e);
|
|
383
|
-
}, oe = (n, e, t, s) => {
|
|
384
|
-
E && E.pushMeasurement({
|
|
385
|
-
type: n,
|
|
386
|
-
values: { [n]: e },
|
|
387
|
-
context: {
|
|
388
|
-
...t && { unit: t },
|
|
389
|
-
...s
|
|
390
|
-
}
|
|
391
|
-
});
|
|
392
|
-
}, Pt = (n, e = "info", t) => {
|
|
393
|
-
if (!E) return;
|
|
394
|
-
const s = {
|
|
395
|
-
info: O.INFO,
|
|
396
|
-
warn: O.WARN,
|
|
397
|
-
error: O.ERROR
|
|
398
|
-
};
|
|
399
|
-
E.pushLog([n], {
|
|
400
|
-
level: s[e],
|
|
401
|
-
context: t
|
|
402
|
-
});
|
|
403
|
-
};
|
|
404
|
-
function Y(n) {
|
|
1
|
+
import { k as q, n as W, t as L, p as Y, e as P, I as K, l as N, w as G, S as x, x as T, H as J, i as R, f as A, a as Z, P as Q, E as X, G as ee, C as te, s as se, j as ie, z as ae, A as ne, m as re, F as oe, V as _, B as le, N as F, c as E, b as de, Q as U, d as H, v as he, M as ce } from "./shared.js";
|
|
2
|
+
import { o as Ie, q as Be, r as Te, u as Re, D as _e, K as Ue, L as He, O as Oe, R as ze } from "./shared.js";
|
|
3
|
+
function I(o) {
|
|
405
4
|
return {
|
|
406
5
|
name: "Custom Appearance",
|
|
407
|
-
additionalPaymentMethods:
|
|
408
|
-
styles:
|
|
6
|
+
additionalPaymentMethods: o.additionalPaymentMethods || {},
|
|
7
|
+
styles: o.styles || {
|
|
409
8
|
fontSize: 14,
|
|
410
9
|
textColor: "#000000",
|
|
411
10
|
buttonColor: "#0070f3",
|
|
@@ -415,104 +14,104 @@ function Y(n) {
|
|
|
415
14
|
buttonFontSize: 16
|
|
416
15
|
},
|
|
417
16
|
layout: {
|
|
418
|
-
grouped:
|
|
419
|
-
actionButton:
|
|
17
|
+
grouped: o.layout?.grouped,
|
|
18
|
+
actionButton: o.layout?.actionButton || {
|
|
420
19
|
translationKey: null
|
|
421
20
|
},
|
|
422
|
-
phoneNumber:
|
|
423
|
-
enabled:
|
|
424
|
-
label:
|
|
425
|
-
defaultCountry:
|
|
426
|
-
allowedCountries:
|
|
21
|
+
phoneNumber: o.layout?.phoneNumber ? {
|
|
22
|
+
enabled: o.layout.phoneNumber.enabled,
|
|
23
|
+
label: o.layout.phoneNumber.label,
|
|
24
|
+
defaultCountry: o.layout.phoneNumber.defaultCountry,
|
|
25
|
+
allowedCountries: o.layout.phoneNumber.allowedCountries
|
|
427
26
|
} : void 0,
|
|
428
27
|
billingFields: {
|
|
429
28
|
street: {
|
|
430
|
-
enabled:
|
|
431
|
-
label:
|
|
432
|
-
maxLength:
|
|
29
|
+
enabled: o.layout?.billingFields?.street?.enabled ?? !1,
|
|
30
|
+
label: o.layout?.billingFields?.street?.label,
|
|
31
|
+
maxLength: o.layout?.billingFields?.street?.maxLength
|
|
433
32
|
},
|
|
434
33
|
city: {
|
|
435
|
-
enabled:
|
|
436
|
-
label:
|
|
34
|
+
enabled: o.layout?.billingFields?.city?.enabled ?? !1,
|
|
35
|
+
label: o.layout?.billingFields?.city?.label
|
|
437
36
|
},
|
|
438
37
|
state: {
|
|
439
|
-
enabled:
|
|
440
|
-
label:
|
|
441
|
-
hiddenForCountries:
|
|
38
|
+
enabled: o.layout?.billingFields?.state?.enabled ?? !1,
|
|
39
|
+
label: o.layout?.billingFields?.state?.label,
|
|
40
|
+
hiddenForCountries: o.layout?.billingFields?.state?.hiddenForCountries
|
|
442
41
|
},
|
|
443
42
|
zipCode: {
|
|
444
|
-
enabled:
|
|
445
|
-
label:
|
|
43
|
+
enabled: o.layout?.billingFields?.zipCode?.enabled ?? !1,
|
|
44
|
+
label: o.layout?.billingFields?.zipCode?.label
|
|
446
45
|
},
|
|
447
46
|
firstName: {
|
|
448
|
-
enabled:
|
|
449
|
-
label:
|
|
47
|
+
enabled: o.layout?.billingFields?.firstName?.enabled ?? !1,
|
|
48
|
+
label: o.layout?.billingFields?.firstName?.label
|
|
450
49
|
},
|
|
451
50
|
lastName: {
|
|
452
|
-
enabled:
|
|
453
|
-
label:
|
|
51
|
+
enabled: o.layout?.billingFields?.lastName?.enabled ?? !1,
|
|
52
|
+
label: o.layout?.billingFields?.lastName?.label
|
|
454
53
|
},
|
|
455
54
|
country: {
|
|
456
|
-
enabled:
|
|
457
|
-
label:
|
|
458
|
-
options:
|
|
55
|
+
enabled: o.layout?.billingFields?.country?.enabled ?? !1,
|
|
56
|
+
label: o.layout?.billingFields?.country?.label,
|
|
57
|
+
options: o.layout?.billingFields?.country?.options
|
|
459
58
|
}
|
|
460
59
|
},
|
|
461
|
-
shippingFields:
|
|
60
|
+
shippingFields: o.layout?.shippingFields ? {
|
|
462
61
|
street: {
|
|
463
|
-
enabled:
|
|
464
|
-
label:
|
|
465
|
-
maxLength:
|
|
62
|
+
enabled: o.layout.shippingFields.street?.enabled ?? !1,
|
|
63
|
+
label: o.layout.shippingFields.street?.label,
|
|
64
|
+
maxLength: o.layout.shippingFields.street?.maxLength
|
|
466
65
|
},
|
|
467
66
|
firstName: {
|
|
468
|
-
enabled:
|
|
469
|
-
label:
|
|
67
|
+
enabled: o.layout.shippingFields.firstName?.enabled ?? !1,
|
|
68
|
+
label: o.layout.shippingFields.firstName?.label
|
|
470
69
|
},
|
|
471
70
|
lastName: {
|
|
472
|
-
enabled:
|
|
473
|
-
label:
|
|
71
|
+
enabled: o.layout.shippingFields.lastName?.enabled ?? !1,
|
|
72
|
+
label: o.layout.shippingFields.lastName?.label
|
|
474
73
|
},
|
|
475
74
|
city: {
|
|
476
|
-
enabled:
|
|
477
|
-
label:
|
|
75
|
+
enabled: o.layout.shippingFields.city?.enabled ?? !1,
|
|
76
|
+
label: o.layout.shippingFields.city?.label
|
|
478
77
|
},
|
|
479
78
|
state: {
|
|
480
|
-
enabled:
|
|
481
|
-
label:
|
|
482
|
-
hiddenForCountries:
|
|
79
|
+
enabled: o.layout.shippingFields.state?.enabled ?? !1,
|
|
80
|
+
label: o.layout.shippingFields.state?.label,
|
|
81
|
+
hiddenForCountries: o.layout.shippingFields.state?.hiddenForCountries
|
|
483
82
|
},
|
|
484
83
|
zipCode: {
|
|
485
|
-
enabled:
|
|
486
|
-
label:
|
|
84
|
+
enabled: o.layout.shippingFields.zipCode?.enabled ?? !1,
|
|
85
|
+
label: o.layout.shippingFields.zipCode?.label
|
|
487
86
|
},
|
|
488
87
|
country: {
|
|
489
|
-
enabled:
|
|
490
|
-
label:
|
|
491
|
-
options:
|
|
88
|
+
enabled: o.layout.shippingFields.country?.enabled ?? !1,
|
|
89
|
+
label: o.layout.shippingFields.country?.label,
|
|
90
|
+
options: o.layout.shippingFields.country?.options
|
|
492
91
|
}
|
|
493
92
|
} : void 0
|
|
494
93
|
},
|
|
495
94
|
appearance: {
|
|
496
|
-
additionalPaymentMethods:
|
|
497
|
-
applePay:
|
|
498
|
-
displayName:
|
|
499
|
-
requiredBillingContactFields:
|
|
500
|
-
requiredShippingContactFields:
|
|
95
|
+
additionalPaymentMethods: o.additionalPaymentMethods ? {
|
|
96
|
+
applePay: o.additionalPaymentMethods.applePay ? {
|
|
97
|
+
displayName: o.additionalPaymentMethods.applePay.displayName,
|
|
98
|
+
requiredBillingContactFields: o.additionalPaymentMethods.applePay.requiredBillingContactFields,
|
|
99
|
+
requiredShippingContactFields: o.additionalPaymentMethods.applePay.requiredShippingContactFields
|
|
501
100
|
} : void 0
|
|
502
101
|
} : void 0
|
|
503
102
|
}
|
|
504
103
|
};
|
|
505
104
|
}
|
|
506
|
-
function
|
|
507
|
-
appearance:
|
|
105
|
+
function ue({
|
|
106
|
+
appearance: o
|
|
508
107
|
}) {
|
|
509
|
-
const e =
|
|
108
|
+
const e = q({
|
|
510
109
|
checkoutProfile: void 0,
|
|
511
110
|
isLoading: !0,
|
|
512
111
|
error: null
|
|
513
112
|
});
|
|
514
|
-
if (
|
|
515
|
-
const s =
|
|
113
|
+
if (o) {
|
|
114
|
+
const s = I(o);
|
|
516
115
|
return Promise.resolve().then(() => {
|
|
517
116
|
e.setState({
|
|
518
117
|
checkoutProfile: s,
|
|
@@ -523,7 +122,7 @@ function ot({
|
|
|
523
122
|
getState: e.getState.bind(e),
|
|
524
123
|
subscribe: e.subscribe.bind(e),
|
|
525
124
|
updateProfile: (a) => {
|
|
526
|
-
const i =
|
|
125
|
+
const i = I(a);
|
|
527
126
|
e.setState({
|
|
528
127
|
checkoutProfile: i,
|
|
529
128
|
isLoading: !1,
|
|
@@ -572,7 +171,7 @@ function ot({
|
|
|
572
171
|
getState: e.getState.bind(e),
|
|
573
172
|
subscribe: e.subscribe.bind(e),
|
|
574
173
|
updateProfile: (s) => {
|
|
575
|
-
const a =
|
|
174
|
+
const a = I(s);
|
|
576
175
|
e.setState({
|
|
577
176
|
checkoutProfile: a,
|
|
578
177
|
isLoading: !1,
|
|
@@ -583,8 +182,8 @@ function ot({
|
|
|
583
182
|
}
|
|
584
183
|
};
|
|
585
184
|
}
|
|
586
|
-
const
|
|
587
|
-
const
|
|
185
|
+
const me = () => {
|
|
186
|
+
const o = W(), e = q({
|
|
588
187
|
formData: {
|
|
589
188
|
name: "",
|
|
590
189
|
email: "",
|
|
@@ -603,10 +202,10 @@ const lt = () => {
|
|
|
603
202
|
isValid: !1
|
|
604
203
|
}), t = (l, m, y, u) => {
|
|
605
204
|
if (l === "cardCvv")
|
|
606
|
-
return
|
|
205
|
+
return o.cardCvv(m, y);
|
|
607
206
|
if (l === "phoneNumber" && u)
|
|
608
|
-
return
|
|
609
|
-
const p =
|
|
207
|
+
return o.phoneNumber(m, u);
|
|
208
|
+
const p = o[l];
|
|
610
209
|
return p?.(m);
|
|
611
210
|
}, s = (l) => {
|
|
612
211
|
const m = {};
|
|
@@ -631,9 +230,9 @@ const lt = () => {
|
|
|
631
230
|
(b) => {
|
|
632
231
|
const f = p[b];
|
|
633
232
|
if (f === void 0) return;
|
|
634
|
-
const S =
|
|
233
|
+
const S = o[b];
|
|
635
234
|
if (S) {
|
|
636
|
-
const C = b === "state" ?
|
|
235
|
+
const C = b === "state" ? o.state(f, p.country) : S(
|
|
637
236
|
f
|
|
638
237
|
);
|
|
639
238
|
C && (h[b] = C);
|
|
@@ -645,12 +244,12 @@ const lt = () => {
|
|
|
645
244
|
}, a = (l) => {
|
|
646
245
|
const m = s(l);
|
|
647
246
|
return Object.keys(m).length === 0;
|
|
648
|
-
}, i = "billingAddress.",
|
|
247
|
+
}, i = "billingAddress.", n = "shippingAddress.", r = (l) => l.startsWith(i) ? {
|
|
649
248
|
parent: "billingAddress",
|
|
650
249
|
field: l.slice(i.length)
|
|
651
|
-
} : l.startsWith(
|
|
250
|
+
} : l.startsWith(n) ? {
|
|
652
251
|
parent: "shippingAddress",
|
|
653
|
-
field: l.slice(
|
|
252
|
+
field: l.slice(n.length)
|
|
654
253
|
} : null, d = (l, m, y, u) => {
|
|
655
254
|
const p = { ...l };
|
|
656
255
|
if (u)
|
|
@@ -668,13 +267,13 @@ const lt = () => {
|
|
|
668
267
|
}, c = (l, m) => {
|
|
669
268
|
const y = e.getState();
|
|
670
269
|
let u = m;
|
|
671
|
-
const p =
|
|
672
|
-
if (!p && l in
|
|
270
|
+
const p = r(l);
|
|
271
|
+
if (!p && l in L)
|
|
673
272
|
if (l === "cardCvv") {
|
|
674
|
-
const S =
|
|
675
|
-
u =
|
|
273
|
+
const S = Y(y.formData.cardNumber) === "amex" ? 4 : 3;
|
|
274
|
+
u = L.cardCvv(m, S);
|
|
676
275
|
} else
|
|
677
|
-
u =
|
|
276
|
+
u = L[l](m);
|
|
678
277
|
let h;
|
|
679
278
|
if (p) {
|
|
680
279
|
const { parent: f, field: S } = p;
|
|
@@ -703,16 +302,16 @@ const lt = () => {
|
|
|
703
302
|
if (y.touched[l])
|
|
704
303
|
if (p) {
|
|
705
304
|
const { parent: f, field: S } = p, C = h[f];
|
|
706
|
-
let
|
|
305
|
+
let M;
|
|
707
306
|
if (S === "state")
|
|
708
|
-
|
|
307
|
+
M = o.state(u, C?.country);
|
|
709
308
|
else {
|
|
710
|
-
const
|
|
711
|
-
|
|
309
|
+
const k = o[S];
|
|
310
|
+
M = k ? k(
|
|
712
311
|
u
|
|
713
312
|
) : void 0;
|
|
714
313
|
}
|
|
715
|
-
b = d(b, f, S,
|
|
314
|
+
b = d(b, f, S, M);
|
|
716
315
|
} else {
|
|
717
316
|
let f;
|
|
718
317
|
l === "cardCvv" ? f = t(l, u, h.cardNumber) : l === "phoneNumber" ? f = t(
|
|
@@ -728,7 +327,7 @@ const lt = () => {
|
|
|
728
327
|
isValid: a(h)
|
|
729
328
|
});
|
|
730
329
|
}, g = (l, m) => {
|
|
731
|
-
const y = e.getState(), u =
|
|
330
|
+
const y = e.getState(), u = r(l);
|
|
732
331
|
if (u) {
|
|
733
332
|
const { parent: f, field: S } = u, C = {
|
|
734
333
|
...y.formData,
|
|
@@ -737,22 +336,22 @@ const lt = () => {
|
|
|
737
336
|
[S]: m
|
|
738
337
|
}
|
|
739
338
|
};
|
|
740
|
-
let
|
|
339
|
+
let M;
|
|
741
340
|
if (S === "state") {
|
|
742
|
-
const
|
|
743
|
-
|
|
341
|
+
const D = C[f];
|
|
342
|
+
M = o.state(m, D?.country);
|
|
744
343
|
} else {
|
|
745
|
-
const
|
|
746
|
-
|
|
344
|
+
const D = o[S];
|
|
345
|
+
M = D ? D(m) : void 0;
|
|
747
346
|
}
|
|
748
|
-
const
|
|
347
|
+
const k = d(y.errors, f, S, M);
|
|
749
348
|
e.setState({
|
|
750
349
|
formData: C,
|
|
751
350
|
touched: {
|
|
752
351
|
...y.touched,
|
|
753
352
|
[l]: !0
|
|
754
353
|
},
|
|
755
|
-
errors:
|
|
354
|
+
errors: k,
|
|
756
355
|
isValid: a(C)
|
|
757
356
|
});
|
|
758
357
|
return;
|
|
@@ -792,18 +391,18 @@ const lt = () => {
|
|
|
792
391
|
reset: e.resetState.bind(e)
|
|
793
392
|
};
|
|
794
393
|
};
|
|
795
|
-
function
|
|
796
|
-
if (!
|
|
797
|
-
const { billingFields: e, shippingFields: t } =
|
|
394
|
+
function pe(o) {
|
|
395
|
+
if (!o) return !1;
|
|
396
|
+
const { billingFields: e, shippingFields: t } = o, s = e && Object.values(e).some((i) => i?.enabled), a = t && Object.values(t).some((i) => i?.enabled);
|
|
798
397
|
return !!(s || a);
|
|
799
398
|
}
|
|
800
|
-
function
|
|
801
|
-
if (!
|
|
802
|
-
const { billingFields: e, shippingFields: t } =
|
|
399
|
+
function B(o) {
|
|
400
|
+
if (!o) return !1;
|
|
401
|
+
const { billingFields: e, shippingFields: t } = o, s = e?.firstName?.enabled && e?.lastName?.enabled, a = t?.firstName?.enabled && t?.lastName?.enabled;
|
|
803
402
|
return !!(s || a);
|
|
804
403
|
}
|
|
805
|
-
const
|
|
806
|
-
class
|
|
404
|
+
const V = /* @__PURE__ */ new Set(["US", "CA"]);
|
|
405
|
+
class O extends P {
|
|
807
406
|
inputs = /* @__PURE__ */ new Map();
|
|
808
407
|
type;
|
|
809
408
|
onChange;
|
|
@@ -818,16 +417,16 @@ class le extends A {
|
|
|
818
417
|
stateStyles;
|
|
819
418
|
constructor(e) {
|
|
820
419
|
super("div", ["address-section"]), this.type = e.type, this.onChange = e.onChange, this.onBlur = e.onBlur, this.translationFunc = e.translationFunc, this.locale = e.locale, this.grouped = e.grouped ?? !0;
|
|
821
|
-
const { title: t, checkoutProfile: s, fieldsConfig: a, values: i, errors:
|
|
420
|
+
const { title: t, checkoutProfile: s, fieldsConfig: a, values: i, errors: n, touched: r } = e;
|
|
822
421
|
if (this.grouped) {
|
|
823
422
|
const d = document.createElement("h3");
|
|
824
423
|
d.className = "address-section-title", d.textContent = t, d.style.color = s.styles.textColor, d.style.fontFamily = `"${s.styles.fontFamily}", sans-serif`, d.style.fontSize = `${s.styles.fontSize}px`, d.style.fontWeight = "normal", this.getElement().appendChild(d);
|
|
825
424
|
}
|
|
826
|
-
this.fieldsContainer = document.createElement("div"), this.fieldsContainer.className = "address-fields", this.grouped || this.fieldsContainer.classList.add("address-fields--ungrouped"), this.getElement().appendChild(this.fieldsContainer), this.createFields(s, a, i,
|
|
425
|
+
this.fieldsContainer = document.createElement("div"), this.fieldsContainer.className = "address-fields", this.grouped || this.fieldsContainer.classList.add("address-fields--ungrouped"), this.getElement().appendChild(this.fieldsContainer), this.createFields(s, a, i, n, r);
|
|
827
426
|
}
|
|
828
427
|
borderRadius(e, t, s, a, i) {
|
|
829
|
-
const
|
|
830
|
-
return `${
|
|
428
|
+
const n = (r) => r ? `${e}px` : "0px";
|
|
429
|
+
return `${n(t)} ${n(s)} ${n(a)} ${n(i)}`;
|
|
831
430
|
}
|
|
832
431
|
createFields(e, t, s, a, i) {
|
|
833
432
|
if (!this.grouped) {
|
|
@@ -840,7 +439,7 @@ class le extends A {
|
|
|
840
439
|
);
|
|
841
440
|
return;
|
|
842
441
|
}
|
|
843
|
-
const
|
|
442
|
+
const n = e.styles.borderRadius, r = {
|
|
844
443
|
color: e.styles.textColor,
|
|
845
444
|
fontSize: e.styles.fontSize,
|
|
846
445
|
fontFamily: e.styles.fontFamily
|
|
@@ -853,9 +452,9 @@ class le extends A {
|
|
|
853
452
|
const v = d.length;
|
|
854
453
|
d.forEach((l, m) => {
|
|
855
454
|
const y = m === 0, u = m === v - 1, p = (h, b) => ({
|
|
856
|
-
...
|
|
455
|
+
...r,
|
|
857
456
|
borderRadius: this.borderRadius(
|
|
858
|
-
|
|
457
|
+
n,
|
|
859
458
|
y && h,
|
|
860
459
|
y && b,
|
|
861
460
|
u && b,
|
|
@@ -950,7 +549,7 @@ class le extends A {
|
|
|
950
549
|
const h = this.createRow(["full"]);
|
|
951
550
|
if (this.stateFieldConfig = t.state, this.stateRow = h, this.stateStyles = p(!0, !0), this.currentCountry = s.country, t.state?.hiddenForCountries?.includes(
|
|
952
551
|
s.country
|
|
953
|
-
) && (h.style.display = "none"),
|
|
552
|
+
) && (h.style.display = "none"), V.has(s.country)) {
|
|
954
553
|
const S = this.createStateSelect(
|
|
955
554
|
s.state,
|
|
956
555
|
a.state,
|
|
@@ -980,12 +579,12 @@ class le extends A {
|
|
|
980
579
|
const t = document.createElement("div");
|
|
981
580
|
return t.className = `address-row address-row-${e.length === 1 ? "single" : "double"}`, t;
|
|
982
581
|
}
|
|
983
|
-
createInput(e, t, s, a, i,
|
|
984
|
-
const c = `${this.type}Address.${e}`, g = new
|
|
582
|
+
createInput(e, t, s, a, i, n, r, d) {
|
|
583
|
+
const c = `${this.type}Address.${e}`, g = new K({
|
|
985
584
|
name: c,
|
|
986
585
|
error: !1,
|
|
987
586
|
errorMsg: void 0,
|
|
988
|
-
styles:
|
|
587
|
+
styles: n,
|
|
989
588
|
maxLength: d,
|
|
990
589
|
...this.grouped ? { placeholder: t } : {
|
|
991
590
|
label: t,
|
|
@@ -995,7 +594,7 @@ class le extends A {
|
|
|
995
594
|
})()
|
|
996
595
|
},
|
|
997
596
|
value: s,
|
|
998
|
-
autocomplete:
|
|
597
|
+
autocomplete: r,
|
|
999
598
|
onChange: (v) => {
|
|
1000
599
|
const l = v.target.value;
|
|
1001
600
|
if (d && l.length >= d) {
|
|
@@ -1004,7 +603,7 @@ class le extends A {
|
|
|
1004
603
|
} else
|
|
1005
604
|
g.setError(!1);
|
|
1006
605
|
this.onChange(
|
|
1007
|
-
|
|
606
|
+
N({
|
|
1008
607
|
type: "input",
|
|
1009
608
|
target: {
|
|
1010
609
|
name: c,
|
|
@@ -1016,7 +615,7 @@ class le extends A {
|
|
|
1016
615
|
});
|
|
1017
616
|
return g.addEventListener("blur", (v) => {
|
|
1018
617
|
this.onBlur(
|
|
1019
|
-
|
|
618
|
+
N({
|
|
1020
619
|
type: "blur",
|
|
1021
620
|
target: {
|
|
1022
621
|
name: c,
|
|
@@ -1026,15 +625,15 @@ class le extends A {
|
|
|
1026
625
|
);
|
|
1027
626
|
}), g;
|
|
1028
627
|
}
|
|
1029
|
-
createCountrySelect(e, t, s, a, i,
|
|
1030
|
-
const
|
|
1031
|
-
name:
|
|
628
|
+
createCountrySelect(e, t, s, a, i, n) {
|
|
629
|
+
const r = `${this.type}Address.country`, d = G(i, this.locale), c = new x({
|
|
630
|
+
name: r,
|
|
1032
631
|
error: !1,
|
|
1033
632
|
errorMsg: void 0,
|
|
1034
633
|
styles: a,
|
|
1035
634
|
placeholder: this.translationFunc("address.chooseCountry"),
|
|
1036
635
|
...!this.grouped && {
|
|
1037
|
-
label:
|
|
636
|
+
label: n ?? this.translationFunc("address.chooseCountry")
|
|
1038
637
|
},
|
|
1039
638
|
value: e,
|
|
1040
639
|
options: d,
|
|
@@ -1043,19 +642,19 @@ class le extends A {
|
|
|
1043
642
|
c.setError(!1);
|
|
1044
643
|
const v = g.target.value;
|
|
1045
644
|
this.onChange(
|
|
1046
|
-
|
|
645
|
+
N({
|
|
1047
646
|
type: "change",
|
|
1048
|
-
target: { name:
|
|
647
|
+
target: { name: r, value: v }
|
|
1049
648
|
})
|
|
1050
649
|
), this.handleCountryChange(v);
|
|
1051
650
|
}
|
|
1052
651
|
});
|
|
1053
652
|
return c.addEventListener("blur", (g) => {
|
|
1054
653
|
this.onBlur(
|
|
1055
|
-
|
|
654
|
+
N({
|
|
1056
655
|
type: "blur",
|
|
1057
656
|
target: {
|
|
1058
|
-
name:
|
|
657
|
+
name: r,
|
|
1059
658
|
value: g.target.value
|
|
1060
659
|
}
|
|
1061
660
|
})
|
|
@@ -1071,26 +670,26 @@ class le extends A {
|
|
|
1071
670
|
return;
|
|
1072
671
|
}
|
|
1073
672
|
if (!a && s && (this.stateRow.style.display = ""), a) return;
|
|
1074
|
-
const i = this.inputs.get("state") instanceof
|
|
1075
|
-
if (i &&
|
|
1076
|
-
const
|
|
1077
|
-
if (
|
|
1078
|
-
const d = e === "CA" ? "CA" : "US", c =
|
|
1079
|
-
|
|
673
|
+
const i = this.inputs.get("state") instanceof x, n = V.has(e);
|
|
674
|
+
if (i && n) {
|
|
675
|
+
const r = this.inputs.get("state");
|
|
676
|
+
if (r instanceof x) {
|
|
677
|
+
const d = e === "CA" ? "CA" : "US", c = T(d), g = d === "CA" ? this.translationFunc("address.chooseProvince") : this.translationFunc("address.chooseState");
|
|
678
|
+
r.setOptions(c, g);
|
|
1080
679
|
}
|
|
1081
680
|
this.clearStateValue();
|
|
1082
681
|
return;
|
|
1083
682
|
}
|
|
1084
|
-
if (i !==
|
|
683
|
+
if (i !== n) {
|
|
1085
684
|
this.rebuildStateField(e), this.clearStateValue();
|
|
1086
685
|
return;
|
|
1087
686
|
}
|
|
1088
|
-
!i && !
|
|
687
|
+
!i && !n && t !== e && this.clearStateValue();
|
|
1089
688
|
}
|
|
1090
689
|
rebuildStateField(e) {
|
|
1091
690
|
if (!this.stateRow || !this.stateStyles) return;
|
|
1092
691
|
const t = this.inputs.get("state");
|
|
1093
|
-
if (t && (t.getElement().remove(), this.inputs.delete("state")),
|
|
692
|
+
if (t && (t.getElement().remove(), this.inputs.delete("state")), V.has(e)) {
|
|
1094
693
|
const a = this.createStateSelect(
|
|
1095
694
|
"",
|
|
1096
695
|
void 0,
|
|
@@ -1118,30 +717,30 @@ class le extends A {
|
|
|
1118
717
|
e && e.setValue("");
|
|
1119
718
|
const t = `${this.type}Address.state`;
|
|
1120
719
|
this.onChange(
|
|
1121
|
-
|
|
720
|
+
N({
|
|
1122
721
|
type: "input",
|
|
1123
722
|
target: { name: t, value: "" },
|
|
1124
723
|
detail: { programmatic: !0 }
|
|
1125
724
|
})
|
|
1126
725
|
);
|
|
1127
726
|
}
|
|
1128
|
-
createStateSelect(e, t, s, a, i,
|
|
1129
|
-
const
|
|
1130
|
-
name:
|
|
727
|
+
createStateSelect(e, t, s, a, i, n) {
|
|
728
|
+
const r = `${this.type}Address.state`, d = i === "CA" ? "CA" : "US", c = T(d), g = d === "CA" ? this.translationFunc("address.chooseProvince") : this.translationFunc("address.chooseState"), v = new x({
|
|
729
|
+
name: r,
|
|
1131
730
|
error: !1,
|
|
1132
731
|
errorMsg: void 0,
|
|
1133
732
|
styles: a,
|
|
1134
733
|
placeholder: g,
|
|
1135
|
-
...!this.grouped && { label:
|
|
734
|
+
...!this.grouped && { label: n ?? g },
|
|
1136
735
|
value: e,
|
|
1137
736
|
options: c,
|
|
1138
737
|
autocomplete: "address-level1",
|
|
1139
738
|
onChange: (l) => {
|
|
1140
739
|
v.setError(!1), this.onChange(
|
|
1141
|
-
|
|
740
|
+
N({
|
|
1142
741
|
type: "change",
|
|
1143
742
|
target: {
|
|
1144
|
-
name:
|
|
743
|
+
name: r,
|
|
1145
744
|
value: l.target.value
|
|
1146
745
|
}
|
|
1147
746
|
})
|
|
@@ -1150,10 +749,10 @@ class le extends A {
|
|
|
1150
749
|
});
|
|
1151
750
|
return v.addEventListener("blur", (l) => {
|
|
1152
751
|
this.onBlur(
|
|
1153
|
-
|
|
752
|
+
N({
|
|
1154
753
|
type: "blur",
|
|
1155
754
|
target: {
|
|
1156
|
-
name:
|
|
755
|
+
name: r,
|
|
1157
756
|
value: l.target.value
|
|
1158
757
|
}
|
|
1159
758
|
})
|
|
@@ -1161,11 +760,11 @@ class le extends A {
|
|
|
1161
760
|
}), v;
|
|
1162
761
|
}
|
|
1163
762
|
createUngroupedFields(e, t, s, a, i) {
|
|
1164
|
-
const
|
|
763
|
+
const n = e.styles.borderRadius, r = {
|
|
1165
764
|
color: e.styles.textColor,
|
|
1166
765
|
fontSize: e.styles.fontSize,
|
|
1167
766
|
fontFamily: e.styles.fontFamily,
|
|
1168
|
-
borderRadius: `${
|
|
767
|
+
borderRadius: `${n}px`
|
|
1169
768
|
}, d = (c, g, v, l) => {
|
|
1170
769
|
if (!t[c]?.enabled) return;
|
|
1171
770
|
const m = t[c]?.label ?? this.translationFunc(g), y = this.createRow(["full"]), u = this.createInput(
|
|
@@ -1174,7 +773,7 @@ class le extends A {
|
|
|
1174
773
|
s[c],
|
|
1175
774
|
a[c],
|
|
1176
775
|
i[c],
|
|
1177
|
-
|
|
776
|
+
r,
|
|
1178
777
|
v,
|
|
1179
778
|
l
|
|
1180
779
|
);
|
|
@@ -1190,7 +789,7 @@ class le extends A {
|
|
|
1190
789
|
s.country,
|
|
1191
790
|
a.country,
|
|
1192
791
|
i.country,
|
|
1193
|
-
|
|
792
|
+
r,
|
|
1194
793
|
t.country?.options,
|
|
1195
794
|
c
|
|
1196
795
|
);
|
|
@@ -1199,16 +798,16 @@ class le extends A {
|
|
|
1199
798
|
if (t.state?.enabled) {
|
|
1200
799
|
this.stateFieldConfig = t.state;
|
|
1201
800
|
const c = this.createRow(["full"]);
|
|
1202
|
-
this.stateRow = c, this.stateStyles =
|
|
801
|
+
this.stateRow = c, this.stateStyles = r, this.currentCountry = s.country, t.state?.hiddenForCountries?.includes(
|
|
1203
802
|
s.country
|
|
1204
803
|
) && (c.style.display = "none");
|
|
1205
|
-
const v =
|
|
804
|
+
const v = V.has(s.country), l = t.state?.label ?? this.translationFunc("address.state");
|
|
1206
805
|
if (v) {
|
|
1207
806
|
const m = this.createStateSelect(
|
|
1208
807
|
s.state,
|
|
1209
808
|
a.state,
|
|
1210
809
|
i.state,
|
|
1211
|
-
|
|
810
|
+
r,
|
|
1212
811
|
s.country,
|
|
1213
812
|
l
|
|
1214
813
|
);
|
|
@@ -1220,7 +819,7 @@ class le extends A {
|
|
|
1220
819
|
s.state,
|
|
1221
820
|
a.state,
|
|
1222
821
|
i.state,
|
|
1223
|
-
|
|
822
|
+
r,
|
|
1224
823
|
"address-level1"
|
|
1225
824
|
);
|
|
1226
825
|
this.inputs.set("state", m), c.appendChild(m.getElement());
|
|
@@ -1261,8 +860,8 @@ class le extends A {
|
|
|
1261
860
|
updateField(e, t, s, a) {
|
|
1262
861
|
const i = this.inputs.get(e);
|
|
1263
862
|
if (!i) return;
|
|
1264
|
-
const
|
|
1265
|
-
!(document.activeElement ===
|
|
863
|
+
const n = i.getElement().querySelector("input") || i.getElement().querySelector("select"), r = i.getValue();
|
|
864
|
+
!(document.activeElement === n) && !(t === "" && r !== "") && this.setValue(e, t);
|
|
1266
865
|
const g = !!(a && s);
|
|
1267
866
|
this.setError(e, g, s);
|
|
1268
867
|
}
|
|
@@ -1281,7 +880,7 @@ class le extends A {
|
|
|
1281
880
|
e && e.focus();
|
|
1282
881
|
}
|
|
1283
882
|
}
|
|
1284
|
-
class
|
|
883
|
+
class ge {
|
|
1285
884
|
input = null;
|
|
1286
885
|
isVgsMode;
|
|
1287
886
|
vgsWrapper = null;
|
|
@@ -1295,18 +894,18 @@ class ct {
|
|
|
1295
894
|
onChange: s,
|
|
1296
895
|
onBlur: a,
|
|
1297
896
|
errorMsg: i,
|
|
1298
|
-
checkoutProfile:
|
|
1299
|
-
translationFunc:
|
|
897
|
+
checkoutProfile: n,
|
|
898
|
+
translationFunc: r,
|
|
1300
899
|
autocomplete: d = "cc-name",
|
|
1301
900
|
isVgsMode: c = !1
|
|
1302
901
|
} = e;
|
|
1303
|
-
this.isVgsMode = c, this.wrapperElement = document.createElement("div"), c ? this.buildVgsLayout(
|
|
902
|
+
this.isVgsMode = c, this.wrapperElement = document.createElement("div"), c ? this.buildVgsLayout(n, r) : this.buildNativeLayout(
|
|
1304
903
|
t,
|
|
1305
904
|
s,
|
|
1306
905
|
a,
|
|
1307
906
|
i,
|
|
907
|
+
n,
|
|
1308
908
|
r,
|
|
1309
|
-
o,
|
|
1310
909
|
d
|
|
1311
910
|
);
|
|
1312
911
|
}
|
|
@@ -1315,13 +914,13 @@ class ct {
|
|
|
1315
914
|
a.style.marginBottom = "4px";
|
|
1316
915
|
const i = document.createElement("label");
|
|
1317
916
|
i.className = "input-label", i.textContent = t("cardholderNameLabel"), i.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, i.style.fontSize = `${e.styles.fontSize}px`, a.appendChild(i), this.wrapperElement.appendChild(a), this.vgsWrapper = document.createElement("div"), this.vgsWrapper.className = "vgs-wrap", this.vgsWrapper.style.position = "relative", this.vgsWrapper.style.borderRadius = `${s}px`, this.vgsWrapper.style.height = "38.5px", this.vgsWrapper.style.width = "100%", this.vgsWrapper.style.overflow = "hidden";
|
|
1318
|
-
const
|
|
1319
|
-
|
|
917
|
+
const n = document.createElement("div");
|
|
918
|
+
n.className = "vgs-field-skeleton", this.vgsWrapper.appendChild(n), this.vgsContainer = document.createElement("div"), this.vgsContainer.id = `vgs-cc-name-${Date.now()}`, this.vgsContainer.style.position = "relative", this.vgsContainer.style.zIndex = "1", this.vgsContainer.style.width = "100%", this.vgsContainer.style.height = "100%", this.vgsWrapper.appendChild(this.vgsContainer), this.wrapperElement.appendChild(this.vgsWrapper), this.vgsHelperText = new J({ visible: !1 }), this.wrapperElement.appendChild(this.vgsHelperText.getElement());
|
|
1320
919
|
}
|
|
1321
|
-
buildNativeLayout(e, t, s, a, i,
|
|
1322
|
-
this.input = new
|
|
920
|
+
buildNativeLayout(e, t, s, a, i, n, r) {
|
|
921
|
+
this.input = new K({
|
|
1323
922
|
name: "name",
|
|
1324
|
-
label:
|
|
923
|
+
label: n("cardholderNameLabel"),
|
|
1325
924
|
error: !1,
|
|
1326
925
|
errorMsg: a,
|
|
1327
926
|
styles: {
|
|
@@ -1330,9 +929,9 @@ class ct {
|
|
|
1330
929
|
fontSize: i.styles.fontSize,
|
|
1331
930
|
fontFamily: i.styles.fontFamily
|
|
1332
931
|
},
|
|
1333
|
-
placeholder:
|
|
932
|
+
placeholder: n("cardholderNamePlaceholder"),
|
|
1334
933
|
value: e,
|
|
1335
|
-
autocomplete:
|
|
934
|
+
autocomplete: r,
|
|
1336
935
|
onChange: (d) => {
|
|
1337
936
|
const g = d.target.value, v = g.replace(/[^a-zA-Z\s\-'.]/g, "");
|
|
1338
937
|
g !== v && this.input?.setValue(v), this.input?.setError(!1), this.trim(), t(d);
|
|
@@ -1346,9 +945,9 @@ class ct {
|
|
|
1346
945
|
}
|
|
1347
946
|
handleVgsStateChange(e, t) {
|
|
1348
947
|
if (!this.isVgsMode || !this.vgsWrapper) return;
|
|
1349
|
-
const s = e[
|
|
948
|
+
const s = e[R.CARDHOLDER]?.isFocused;
|
|
1350
949
|
if (this._vgsFieldsReady && (this.vgsWrapper.style.boxShadow = s ? "0 0 0 1px rgba(50, 151, 211, 0.7), 0 1px 1px 0 rgba(0, 0, 0, 0.07), 0 0 0 4px rgba(50, 151, 211, 0.3)" : "0 0 0 1px #e0e0e0, 0 2px 4px 0 rgba(0,0,0,0.07), 0 1px 1.5px 0 rgba(0,0,0,0.05)"), !t || !this.vgsHelperText) return;
|
|
1351
|
-
const a = t[
|
|
950
|
+
const a = t[R.CARDHOLDER];
|
|
1352
951
|
a ? (this.vgsHelperText.setText(a), this.vgsHelperText.toggleVisibility(!0)) : this.vgsHelperText.toggleVisibility(!1);
|
|
1353
952
|
}
|
|
1354
953
|
hideFakePlaceholder() {
|
|
@@ -1383,7 +982,7 @@ class ct {
|
|
|
1383
982
|
this.isVgsMode || this.input?.focus();
|
|
1384
983
|
}
|
|
1385
984
|
}
|
|
1386
|
-
class
|
|
985
|
+
class j extends P {
|
|
1387
986
|
constructor() {
|
|
1388
987
|
super("div", ["skeleton-container"]), this.createSkeletonElements();
|
|
1389
988
|
}
|
|
@@ -1391,35 +990,35 @@ class me extends A {
|
|
|
1391
990
|
this.appendChild(this.createPaymentMethodSkeleton()), this.appendChild(this.createPaymentSeparatorSkeleton());
|
|
1392
991
|
}
|
|
1393
992
|
createPaymentMethodSkeleton() {
|
|
1394
|
-
const e =
|
|
993
|
+
const e = A.createDiv(["skeleton-field"]), t = A.createDiv([
|
|
1395
994
|
"skeleton",
|
|
1396
995
|
"skeleton-payment-method"
|
|
1397
996
|
]);
|
|
1398
997
|
return e.appendChild(t), e;
|
|
1399
998
|
}
|
|
1400
999
|
createPaymentSeparatorSkeleton() {
|
|
1401
|
-
const e =
|
|
1000
|
+
const e = A.createDiv([
|
|
1402
1001
|
"payment-separator_container"
|
|
1403
|
-
]), t =
|
|
1002
|
+
]), t = A.createDiv(["payment-separator__line"]), s = A.createDiv([
|
|
1404
1003
|
"skeleton",
|
|
1405
1004
|
"skeleton-separator-text"
|
|
1406
|
-
]), a =
|
|
1005
|
+
]), a = A.createDiv(["payment-separator__line"]);
|
|
1407
1006
|
return e.appendChild(t), e.appendChild(s), e.appendChild(a), e;
|
|
1408
1007
|
}
|
|
1409
1008
|
}
|
|
1410
|
-
class
|
|
1009
|
+
class fe extends P {
|
|
1411
1010
|
constructor(e) {
|
|
1412
1011
|
const { translationFunc: t, checkoutProfile: s } = e;
|
|
1413
1012
|
super("div", ["payment-separator"]);
|
|
1414
1013
|
const a = this.getElement(), i = document.createElement("span");
|
|
1415
1014
|
i.className = "payment-separator__line";
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1015
|
+
const n = document.createElement("p");
|
|
1016
|
+
n.textContent = t("pay-with-card"), n.className = "payment-separator__text", n.style.fontFamily = `${s.styles.fontFamily}, sans-serif`;
|
|
1017
|
+
const r = document.createElement("span");
|
|
1018
|
+
r.className = "payment-separator__line", a.appendChild(i), a.appendChild(n), a.appendChild(r);
|
|
1420
1019
|
}
|
|
1421
1020
|
}
|
|
1422
|
-
class
|
|
1021
|
+
class ye extends P {
|
|
1423
1022
|
paymentMethods;
|
|
1424
1023
|
paymentSeparator;
|
|
1425
1024
|
skeleton;
|
|
@@ -1429,8 +1028,8 @@ class ut extends A {
|
|
|
1429
1028
|
formData: s,
|
|
1430
1029
|
onPaypalSubmit: a,
|
|
1431
1030
|
onApplePaySubmit: i,
|
|
1432
|
-
supportedPaymentMethods:
|
|
1433
|
-
translationFunc:
|
|
1031
|
+
supportedPaymentMethods: n,
|
|
1032
|
+
translationFunc: r,
|
|
1434
1033
|
paymentId: d,
|
|
1435
1034
|
checkoutKey: c,
|
|
1436
1035
|
checkoutDetails: g,
|
|
@@ -1441,14 +1040,14 @@ class ut extends A {
|
|
|
1441
1040
|
this.getElement().style.display = "none";
|
|
1442
1041
|
return;
|
|
1443
1042
|
}
|
|
1444
|
-
if (
|
|
1043
|
+
if (n === void 0) {
|
|
1445
1044
|
this.renderSkeleton();
|
|
1446
1045
|
return;
|
|
1447
1046
|
}
|
|
1448
1047
|
const m = Object.entries(
|
|
1449
1048
|
t.additionalPaymentMethods
|
|
1450
1049
|
).filter(([y, u]) => {
|
|
1451
|
-
const p = u.enabled, h =
|
|
1050
|
+
const p = u.enabled, h = n ? n[y] === !0 : !0, b = !u.countries || l && u.countries.includes(l);
|
|
1452
1051
|
return p && h && b;
|
|
1453
1052
|
}).sort((y, u) => y[1].order - u[1].order);
|
|
1454
1053
|
if (m.length === 0) {
|
|
@@ -1459,7 +1058,7 @@ class ut extends A {
|
|
|
1459
1058
|
switch (y) {
|
|
1460
1059
|
case "paypal": {
|
|
1461
1060
|
if (a) {
|
|
1462
|
-
const u = new
|
|
1061
|
+
const u = new Q({
|
|
1463
1062
|
checkoutProfile: t,
|
|
1464
1063
|
formData: s,
|
|
1465
1064
|
onSubmit: a
|
|
@@ -1470,7 +1069,7 @@ class ut extends A {
|
|
|
1470
1069
|
}
|
|
1471
1070
|
case "applePay": {
|
|
1472
1071
|
if (i && d && c) {
|
|
1473
|
-
const u = t.appearance?.additionalPaymentMethods?.applePay, p = new
|
|
1072
|
+
const u = t.appearance?.additionalPaymentMethods?.applePay, p = new Z({
|
|
1474
1073
|
checkoutProfile: t,
|
|
1475
1074
|
formData: s,
|
|
1476
1075
|
onSubmit: i,
|
|
@@ -1498,13 +1097,13 @@ class ut extends A {
|
|
|
1498
1097
|
);
|
|
1499
1098
|
break;
|
|
1500
1099
|
}
|
|
1501
|
-
this.paymentMethods.size > 0 && (this.paymentSeparator = new
|
|
1502
|
-
translationFunc:
|
|
1100
|
+
this.paymentMethods.size > 0 && (this.paymentSeparator = new fe({
|
|
1101
|
+
translationFunc: r,
|
|
1503
1102
|
checkoutProfile: t
|
|
1504
1103
|
}), this.getElement().appendChild(this.paymentSeparator.getElement()));
|
|
1505
1104
|
}
|
|
1506
1105
|
renderSkeleton() {
|
|
1507
|
-
this.skeleton = new
|
|
1106
|
+
this.skeleton = new j(), this.getElement().appendChild(this.skeleton.getElement());
|
|
1508
1107
|
}
|
|
1509
1108
|
updateFormData(e) {
|
|
1510
1109
|
const t = this.paymentMethods.get("paypal");
|
|
@@ -1516,8 +1115,8 @@ class ut extends A {
|
|
|
1516
1115
|
return this.paymentMethods.size > 0 && this.getElement().style.display !== "none";
|
|
1517
1116
|
}
|
|
1518
1117
|
}
|
|
1519
|
-
const
|
|
1520
|
-
class
|
|
1118
|
+
const be = 17;
|
|
1119
|
+
class Se extends P {
|
|
1521
1120
|
styles;
|
|
1522
1121
|
isHovered = !1;
|
|
1523
1122
|
constructor(e) {
|
|
@@ -1527,7 +1126,7 @@ class pt extends A {
|
|
|
1527
1126
|
}
|
|
1528
1127
|
applyStyles() {
|
|
1529
1128
|
const e = this.getElement();
|
|
1530
|
-
e.style.backgroundColor = this.isHovered ? `color-mix(in srgb, ${this.styles.backgroundColor} 80%, transparent)` : this.styles.backgroundColor, e.disabled ? (e.style.color = "rgb(150, 150, 150)", e.style.backgroundColor = "rgb(200, 200, 200)") : e.style.color = this.styles.color, e.style.borderRadius = this.styles.borderRadius ===
|
|
1129
|
+
e.style.backgroundColor = this.isHovered ? `color-mix(in srgb, ${this.styles.backgroundColor} 80%, transparent)` : this.styles.backgroundColor, e.disabled ? (e.style.color = "rgb(150, 150, 150)", e.style.backgroundColor = "rgb(200, 200, 200)") : e.style.color = this.styles.color, e.style.borderRadius = this.styles.borderRadius === be ? "100vmax" : `${this.styles.borderRadius}px`, e.style.fontSize = `${this.styles.fontSize}px`, e.style.fontFamily = `${this.styles.fontFamily}, sans-serif`;
|
|
1531
1130
|
}
|
|
1532
1131
|
handleMouseEnter() {
|
|
1533
1132
|
this.isHovered = !0, this.applyStyles();
|
|
@@ -1539,11 +1138,11 @@ class pt extends A {
|
|
|
1539
1138
|
return this.getElement().disabled = e, e ? (this.addClass("disabled"), this.removeClass("valid")) : (this.removeClass("disabled"), this.addClass("valid")), this.applyStyles(), this;
|
|
1540
1139
|
}
|
|
1541
1140
|
}
|
|
1542
|
-
class
|
|
1141
|
+
class ve {
|
|
1543
1142
|
button;
|
|
1544
1143
|
constructor(e) {
|
|
1545
1144
|
const { disabled: t, checkoutProfile: s, translationFunc: a } = e;
|
|
1546
|
-
this.button = new
|
|
1145
|
+
this.button = new Se({
|
|
1547
1146
|
text: a(
|
|
1548
1147
|
`buttonTexts.${s?.layout.actionButton.translationKey}`
|
|
1549
1148
|
),
|
|
@@ -1570,7 +1169,7 @@ class gt {
|
|
|
1570
1169
|
return this.button.appendTo(e), this;
|
|
1571
1170
|
}
|
|
1572
1171
|
}
|
|
1573
|
-
class
|
|
1172
|
+
class Ce {
|
|
1574
1173
|
formElement;
|
|
1575
1174
|
focusManager;
|
|
1576
1175
|
translationFunc;
|
|
@@ -1616,7 +1215,7 @@ class ft {
|
|
|
1616
1215
|
(a) => a.enabled
|
|
1617
1216
|
))
|
|
1618
1217
|
return;
|
|
1619
|
-
this.paymentMethods = new
|
|
1218
|
+
this.paymentMethods = new ye({
|
|
1620
1219
|
checkoutProfile: e,
|
|
1621
1220
|
formData: t,
|
|
1622
1221
|
supportedPaymentMethods: this.supportedPaymentMethods,
|
|
@@ -1639,11 +1238,11 @@ class ft {
|
|
|
1639
1238
|
createEmailField(e, t, s, a) {
|
|
1640
1239
|
try {
|
|
1641
1240
|
const i = e.layout.billingFields && Object.values(e.layout.billingFields).some(
|
|
1642
|
-
(
|
|
1241
|
+
(n) => n?.enabled
|
|
1643
1242
|
) || e.layout.shippingFields && Object.values(e.layout.shippingFields).some(
|
|
1644
|
-
(
|
|
1243
|
+
(n) => n?.enabled
|
|
1645
1244
|
);
|
|
1646
|
-
this.emailField = new
|
|
1245
|
+
this.emailField = new X({
|
|
1647
1246
|
value: t.email,
|
|
1648
1247
|
onChange: this.onChange,
|
|
1649
1248
|
onBlur: this.onBlur,
|
|
@@ -1661,8 +1260,8 @@ class ft {
|
|
|
1661
1260
|
}
|
|
1662
1261
|
createPhoneNumberField(e, t, s, a) {
|
|
1663
1262
|
const i = document.createElement("div");
|
|
1664
|
-
this.phonePlaceholder = i, this.formElement.appendChild(i),
|
|
1665
|
-
i.isConnected && (this.phoneNumberField = new
|
|
1263
|
+
this.phonePlaceholder = i, this.formElement.appendChild(i), ee().then(({ PhoneNumberField: n }) => {
|
|
1264
|
+
i.isConnected && (this.phoneNumberField = new n({
|
|
1666
1265
|
value: t.phoneNumber ?? "",
|
|
1667
1266
|
onChange: this.onChange,
|
|
1668
1267
|
onBlur: this.onBlur,
|
|
@@ -1675,8 +1274,8 @@ class ft {
|
|
|
1675
1274
|
allowedCountries: e.layout.phoneNumber?.allowedCountries,
|
|
1676
1275
|
locale: this.locale
|
|
1677
1276
|
}), this.phoneNumberFocusHandler = () => this.onFieldFocus("phoneNumber"), this.phoneNumberField.getElement().addEventListener("focus", this.phoneNumberFocusHandler, !0), this.focusManager.registerField("phoneNumber", this.phoneNumberField), i.replaceWith(this.phoneNumberField.getElement()), this.phonePlaceholder = void 0);
|
|
1678
|
-
}).catch((
|
|
1679
|
-
console.error("Error creating phone number field:",
|
|
1277
|
+
}).catch((n) => {
|
|
1278
|
+
console.error("Error creating phone number field:", n), i.remove(), this.phonePlaceholder = void 0;
|
|
1680
1279
|
});
|
|
1681
1280
|
}
|
|
1682
1281
|
setCheckoutDetailsLoaded(e) {
|
|
@@ -1688,7 +1287,7 @@ class ft {
|
|
|
1688
1287
|
this.cardSectionSkeleton = this.buildCardSkeleton(e), this.formElement.appendChild(this.cardSectionSkeleton);
|
|
1689
1288
|
return;
|
|
1690
1289
|
}
|
|
1691
|
-
if (this.cardSection = new
|
|
1290
|
+
if (this.cardSection = new te({
|
|
1692
1291
|
checkoutProfile: e,
|
|
1693
1292
|
cardNumber: t.cardNumber,
|
|
1694
1293
|
cardNumberError: s.cardNumber,
|
|
@@ -1703,7 +1302,7 @@ class ft {
|
|
|
1703
1302
|
onBlur: this.onBlur,
|
|
1704
1303
|
onCardBrandChange: () => {
|
|
1705
1304
|
t.cardCvv && this.onBlur(
|
|
1706
|
-
|
|
1305
|
+
N({
|
|
1707
1306
|
type: "blur",
|
|
1708
1307
|
target: { name: "cardCvv", value: t.cardCvv }
|
|
1709
1308
|
})
|
|
@@ -1722,13 +1321,13 @@ class ft {
|
|
|
1722
1321
|
"focus",
|
|
1723
1322
|
this.cardExpiryFocusHandler
|
|
1724
1323
|
));
|
|
1725
|
-
const
|
|
1726
|
-
|
|
1324
|
+
const n = this.cardSection.getElement().querySelector('input[name="cardNumber"]');
|
|
1325
|
+
n && (this.cardNumberFocusHandler = () => this.onFieldFocus("cardNumber"), n.addEventListener(
|
|
1727
1326
|
"focus",
|
|
1728
1327
|
this.cardNumberFocusHandler
|
|
1729
1328
|
));
|
|
1730
|
-
const
|
|
1731
|
-
|
|
1329
|
+
const r = this.cardSection.getElement().querySelector('input[name="cardCvv"]');
|
|
1330
|
+
r && (this.cardCvvFocusHandler = () => this.onFieldFocus("cardCvv"), r.addEventListener("focus", this.cardCvvFocusHandler));
|
|
1732
1331
|
}
|
|
1733
1332
|
this.focusManager.registerField("cardNumber", {
|
|
1734
1333
|
focus: () => this.cardSection?.focusField("cardNumber")
|
|
@@ -1747,7 +1346,7 @@ class ft {
|
|
|
1747
1346
|
this.cardholderSectionSkeleton = this.buildCardholderSkeleton(e), this.formElement.appendChild(this.cardholderSectionSkeleton);
|
|
1748
1347
|
return;
|
|
1749
1348
|
}
|
|
1750
|
-
if (this.cardholderSection = new
|
|
1349
|
+
if (this.cardholderSection = new ge({
|
|
1751
1350
|
value: t.name,
|
|
1752
1351
|
onChange: this.onChange,
|
|
1753
1352
|
onBlur: this.onBlur,
|
|
@@ -1771,7 +1370,7 @@ class ft {
|
|
|
1771
1370
|
if (!i || !Object.values(i).some(
|
|
1772
1371
|
(d) => d?.enabled
|
|
1773
1372
|
)) return;
|
|
1774
|
-
const
|
|
1373
|
+
const r = {
|
|
1775
1374
|
street: "",
|
|
1776
1375
|
firstName: "",
|
|
1777
1376
|
lastName: "",
|
|
@@ -1780,12 +1379,12 @@ class ft {
|
|
|
1780
1379
|
zipCode: "",
|
|
1781
1380
|
country: ""
|
|
1782
1381
|
};
|
|
1783
|
-
this.billingAddressSection = new
|
|
1382
|
+
this.billingAddressSection = new O({
|
|
1784
1383
|
type: "billing",
|
|
1785
1384
|
title: this.translationFunc("address.billingTitle"),
|
|
1786
1385
|
checkoutProfile: e,
|
|
1787
1386
|
fieldsConfig: i,
|
|
1788
|
-
values: t.billingAddress ??
|
|
1387
|
+
values: t.billingAddress ?? r,
|
|
1789
1388
|
errors: s.billingAddress ?? {},
|
|
1790
1389
|
touched: a.billingAddress ?? {},
|
|
1791
1390
|
onChange: this.onChange,
|
|
@@ -1804,7 +1403,7 @@ class ft {
|
|
|
1804
1403
|
if (!i || !Object.values(i).some(
|
|
1805
1404
|
(d) => d?.enabled
|
|
1806
1405
|
)) return;
|
|
1807
|
-
const
|
|
1406
|
+
const r = {
|
|
1808
1407
|
street: "",
|
|
1809
1408
|
firstName: "",
|
|
1810
1409
|
lastName: "",
|
|
@@ -1813,12 +1412,12 @@ class ft {
|
|
|
1813
1412
|
zipCode: "",
|
|
1814
1413
|
country: ""
|
|
1815
1414
|
};
|
|
1816
|
-
this.shippingAddressSection = new
|
|
1415
|
+
this.shippingAddressSection = new O({
|
|
1817
1416
|
type: "shipping",
|
|
1818
1417
|
title: this.translationFunc("address.shippingTitle"),
|
|
1819
1418
|
checkoutProfile: e,
|
|
1820
1419
|
fieldsConfig: i,
|
|
1821
|
-
values: t.shippingAddress ??
|
|
1420
|
+
values: t.shippingAddress ?? r,
|
|
1822
1421
|
errors: s.shippingAddress ?? {},
|
|
1823
1422
|
touched: a.shippingAddress ?? {},
|
|
1824
1423
|
onChange: this.onChange,
|
|
@@ -1833,7 +1432,7 @@ class ft {
|
|
|
1833
1432
|
}
|
|
1834
1433
|
createSubmitButton(e, t) {
|
|
1835
1434
|
try {
|
|
1836
|
-
this.submitButton = new
|
|
1435
|
+
this.submitButton = new ve({
|
|
1837
1436
|
disabled: t,
|
|
1838
1437
|
checkoutProfile: e,
|
|
1839
1438
|
translationFunc: this.translationFunc
|
|
@@ -1848,13 +1447,13 @@ class ft {
|
|
|
1848
1447
|
updatePhoneNumberField(e, t, s) {
|
|
1849
1448
|
this.phoneNumberField && (this.phoneNumberField.setValue(e), this.phoneNumberField.setError(t, s));
|
|
1850
1449
|
}
|
|
1851
|
-
updateCardSection(e, t, s, a, i,
|
|
1450
|
+
updateCardSection(e, t, s, a, i, n, r, d, c) {
|
|
1852
1451
|
this.cardSection && (this.cardSection.updateCardNumber(
|
|
1853
1452
|
e,
|
|
1854
1453
|
t,
|
|
1855
1454
|
s
|
|
1856
|
-
), this.cardSection.updateCardCvv(a, i,
|
|
1857
|
-
|
|
1455
|
+
), this.cardSection.updateCardCvv(a, i, n), this.cardSection.updateCardExpiry(
|
|
1456
|
+
r,
|
|
1858
1457
|
d,
|
|
1859
1458
|
c
|
|
1860
1459
|
));
|
|
@@ -1894,16 +1493,16 @@ class ft {
|
|
|
1894
1493
|
a.style.marginBottom = "4px";
|
|
1895
1494
|
const i = document.createElement("label");
|
|
1896
1495
|
i.className = "input-label", i.textContent = this.translationFunc("cardInformation"), i.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, a.appendChild(i), s.appendChild(a);
|
|
1496
|
+
const n = document.createElement("div");
|
|
1497
|
+
n.className = "vgs-card-group", n.style.borderRadius = `${t}px`, n.style.background = "#fff", n.style.display = "flex", n.style.flexDirection = "column", n.style.gap = "8px";
|
|
1897
1498
|
const r = document.createElement("div");
|
|
1898
|
-
r.className = "
|
|
1899
|
-
const o = document.createElement("div");
|
|
1900
|
-
o.className = "card-number-row", o.style.position = "relative", o.style.height = "38.5px", o.style.overflow = "hidden", o.style.borderRadius = `${t}px`, o.appendChild(this.createSkeletonDiv()), r.appendChild(o);
|
|
1499
|
+
r.className = "card-number-row", r.style.position = "relative", r.style.height = "38.5px", r.style.overflow = "hidden", r.style.borderRadius = `${t}px`, r.appendChild(this.createSkeletonDiv()), n.appendChild(r);
|
|
1901
1500
|
const d = document.createElement("div");
|
|
1902
1501
|
d.style.display = "flex", d.style.gap = "8px";
|
|
1903
1502
|
const c = document.createElement("div");
|
|
1904
1503
|
c.style.position = "relative", c.style.flex = "1", c.style.height = "38.5px", c.style.overflow = "hidden", c.style.borderRadius = `${t}px`, c.appendChild(this.createSkeletonDiv()), d.appendChild(c);
|
|
1905
1504
|
const g = document.createElement("div");
|
|
1906
|
-
return g.style.position = "relative", g.style.flex = "1", g.style.height = "38.5px", g.style.overflow = "hidden", g.style.borderRadius = `${t}px`, g.appendChild(this.createSkeletonDiv()), d.appendChild(g),
|
|
1505
|
+
return g.style.position = "relative", g.style.flex = "1", g.style.height = "38.5px", g.style.overflow = "hidden", g.style.borderRadius = `${t}px`, g.appendChild(this.createSkeletonDiv()), d.appendChild(g), n.appendChild(d), s.appendChild(n), s;
|
|
1907
1506
|
}
|
|
1908
1507
|
createSkeletonDiv() {
|
|
1909
1508
|
const e = document.createElement("div");
|
|
@@ -1914,13 +1513,13 @@ class ft {
|
|
|
1914
1513
|
a.style.marginBottom = "4px";
|
|
1915
1514
|
const i = document.createElement("label");
|
|
1916
1515
|
i.className = "input-label", i.textContent = this.translationFunc("cardholderNameLabel"), i.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, a.appendChild(i), s.appendChild(a);
|
|
1917
|
-
const
|
|
1918
|
-
return
|
|
1516
|
+
const n = document.createElement("div");
|
|
1517
|
+
return n.style.position = "relative", n.style.borderRadius = `${t}px`, n.style.height = "38.5px", n.style.width = "100%", n.style.overflow = "hidden", n.style.background = "#fff", n.appendChild(this.createSkeletonDiv()), s.appendChild(n), s;
|
|
1919
1518
|
}
|
|
1920
1519
|
async mountVgsFields(e) {
|
|
1921
1520
|
if (!this.vgsService || !this.cardSection) return;
|
|
1922
1521
|
await this.vgsService.whenReady();
|
|
1923
|
-
const t = this.cardSection.getVgsContainerIds(), s = this.cardholderSection?.getVgsContainerId(), a = await
|
|
1522
|
+
const t = this.cardSection.getVgsContainerIds(), s = this.cardholderSection?.getVgsContainerId(), a = await se(
|
|
1924
1523
|
e.styles.fontFamily
|
|
1925
1524
|
), i = this.cardSection.buildVgsFieldCss(
|
|
1926
1525
|
e,
|
|
@@ -1940,7 +1539,7 @@ class ft {
|
|
|
1940
1539
|
cardCvv: "CVV",
|
|
1941
1540
|
cardholderName: this.translationFunc("cardholderNamePlaceholder")
|
|
1942
1541
|
},
|
|
1943
|
-
(
|
|
1542
|
+
(n) => this.cardSection?.updateVgsCardBrand(n)
|
|
1944
1543
|
), this.vgsService.waitForFieldsReady().then(() => {
|
|
1945
1544
|
requestAnimationFrame(() => {
|
|
1946
1545
|
this.cardSection?.hideFakePlaceholders(), this.cardholderSection?.hideFakePlaceholder();
|
|
@@ -1980,7 +1579,7 @@ class ft {
|
|
|
1980
1579
|
this.billingAddressSection && (this.billingAddressSection.getElement().remove(), this.billingAddressSection = void 0), this.shippingAddressSection && (this.shippingAddressSection.getElement().remove(), this.shippingAddressSection = void 0), this.submitButton && (this.submitButton.getElement().remove(), this.submitButton = void 0), this.paymentMethods && (this.paymentMethods.getElement().remove(), this.paymentMethods = void 0);
|
|
1981
1580
|
}
|
|
1982
1581
|
}
|
|
1983
|
-
class
|
|
1582
|
+
class Fe {
|
|
1984
1583
|
formManager;
|
|
1985
1584
|
focusManager;
|
|
1986
1585
|
onFormSubmit;
|
|
@@ -1992,16 +1591,16 @@ class yt {
|
|
|
1992
1591
|
handleChange = (e) => {
|
|
1993
1592
|
const t = e.target, { name: s, value: a } = t, i = s;
|
|
1994
1593
|
this.formManager.handleChange(i, a), e instanceof CustomEvent && e.detail?.programmatic ? this.localTouchedFields.delete(i) : this.localTouchedFields.has(i) || (this.localTouchedFields.add(i), this.formManager.handleBlur(i, a));
|
|
1995
|
-
const { formData:
|
|
1996
|
-
this.focusManager.handleStateUpdate(
|
|
1594
|
+
const { formData: r, errors: d, touched: c } = this.formManager.getFormState();
|
|
1595
|
+
this.focusManager.handleStateUpdate(r, d, c);
|
|
1997
1596
|
};
|
|
1998
1597
|
handleBlur = (e) => {
|
|
1999
1598
|
const t = e.target, { name: s, value: a } = t, i = s;
|
|
2000
1599
|
this.localTouchedFields.add(i), this.formManager.handleBlur(i, a), setTimeout(() => {
|
|
2001
1600
|
this.onUIUpdate();
|
|
2002
1601
|
}, 0);
|
|
2003
|
-
const { formData:
|
|
2004
|
-
d[i] || this.focusManager.handleStateUpdate(
|
|
1602
|
+
const { formData: n, errors: r, touched: d } = this.formManager.getFormState();
|
|
1603
|
+
d[i] || this.focusManager.handleStateUpdate(n, r, d);
|
|
2005
1604
|
};
|
|
2006
1605
|
handleSubmit = async (e) => {
|
|
2007
1606
|
e.preventDefault(), await this.onFormSubmit(e);
|
|
@@ -2021,7 +1620,7 @@ class yt {
|
|
|
2021
1620
|
this.localTouchedFields.clear();
|
|
2022
1621
|
}
|
|
2023
1622
|
}
|
|
2024
|
-
class
|
|
1623
|
+
class Ee {
|
|
2025
1624
|
formManager;
|
|
2026
1625
|
checkoutProfile;
|
|
2027
1626
|
formElement;
|
|
@@ -2045,7 +1644,7 @@ class bt {
|
|
|
2045
1644
|
try {
|
|
2046
1645
|
if (e.checkoutProfile.styles?.fontFamily)
|
|
2047
1646
|
try {
|
|
2048
|
-
const { cleanup: t } =
|
|
1647
|
+
const { cleanup: t } = ie({
|
|
2049
1648
|
fontFamily: e.checkoutProfile.styles.fontFamily
|
|
2050
1649
|
});
|
|
2051
1650
|
this.fontCleanup = t, this.formElement.style.fontFamily = e.checkoutProfile.styles.fontFamily;
|
|
@@ -2063,12 +1662,12 @@ class bt {
|
|
|
2063
1662
|
isFormDisabled() {
|
|
2064
1663
|
const e = this.formManager.getFormState(), t = this.checkoutProfile.getState(), s = Object.keys(e.errors).filter(
|
|
2065
1664
|
(f) => f !== "billingAddress" && f !== "shippingAddress"
|
|
2066
|
-
).length > 0, a = e.errors.billingAddress, i = a && typeof a == "object" ? Object.keys(a).length > 0 : !1,
|
|
1665
|
+
).length > 0, a = e.errors.billingAddress, i = a && typeof a == "object" ? Object.keys(a).length > 0 : !1, n = e.errors.shippingAddress, r = n && typeof n == "object" ? Object.keys(n).length > 0 : !1, d = s || i || r, g = B(
|
|
2067
1666
|
t.checkoutProfile?.layout
|
|
2068
1667
|
) ? !!(e.formData.billingAddress?.firstName || e.formData.billingAddress?.lastName || e.formData.shippingAddress?.firstName || e.formData.shippingAddress?.lastName) : !!e.formData.name, l = t.checkoutProfile?.layout.phoneNumber?.enabled ?? !1 ? !!e.formData.phoneNumber : !0, { billingFields: m, shippingFields: y } = t.checkoutProfile?.layout ?? {}, u = /* @__PURE__ */ new Set(["US", "CA"]), p = (f, S) => {
|
|
2069
1668
|
if (!f) return !0;
|
|
2070
1669
|
const C = S?.country ?? "";
|
|
2071
|
-
return Object.entries(f).every(([
|
|
1670
|
+
return Object.entries(f).every(([M, k]) => !k?.enabled || M === "state" && (!u.has(C) || k.hiddenForCountries?.includes(C)) ? !0 : !!S?.[M]?.trim());
|
|
2072
1671
|
}, h = !this.isVgsMode || Object.values(this.vgsFieldsState).every(
|
|
2073
1672
|
(f) => f?.isValid === !0
|
|
2074
1673
|
), b = this.isVgsMode ? !!e.formData.email && l && h && p(m, e.formData.billingAddress) && p(y, e.formData.shippingAddress) : !!e.formData.email && l && g && !!e.formData.cardNumber && !!e.formData.cardCvv && !!e.formData.cardExpiry && p(m, e.formData.billingAddress) && p(y, e.formData.shippingAddress);
|
|
@@ -2090,8 +1689,8 @@ class bt {
|
|
|
2090
1689
|
continue;
|
|
2091
1690
|
const i = a.errors?.[0];
|
|
2092
1691
|
if (!i) continue;
|
|
2093
|
-
const
|
|
2094
|
-
|
|
1692
|
+
const n = ae(s, i.code);
|
|
1693
|
+
n && (t[s] = e(n));
|
|
2095
1694
|
}
|
|
2096
1695
|
return t;
|
|
2097
1696
|
}
|
|
@@ -2102,18 +1701,18 @@ class bt {
|
|
|
2102
1701
|
this.fontCleanup && (this.fontCleanup(), this.fontCleanup = void 0);
|
|
2103
1702
|
}
|
|
2104
1703
|
}
|
|
2105
|
-
class
|
|
1704
|
+
class Me extends P {
|
|
2106
1705
|
titleElement;
|
|
2107
1706
|
constructor(e = {}) {
|
|
2108
1707
|
super("div", ["blur-bg"]);
|
|
2109
|
-
const t =
|
|
2110
|
-
this.titleElement = new
|
|
1708
|
+
const t = A.createDiv(["loader"]);
|
|
1709
|
+
this.titleElement = new P("h3", ["title"]), this.titleElement.setText(e.text || ""), this.appendChild(t), this.appendChild(this.titleElement);
|
|
2111
1710
|
}
|
|
2112
1711
|
setText(e) {
|
|
2113
1712
|
return this.titleElement.setText(e), this;
|
|
2114
1713
|
}
|
|
2115
1714
|
}
|
|
2116
|
-
const
|
|
1715
|
+
const z = {
|
|
2117
1716
|
street: "",
|
|
2118
1717
|
firstName: "",
|
|
2119
1718
|
lastName: "",
|
|
@@ -2121,16 +1720,16 @@ const de = {
|
|
|
2121
1720
|
city: "",
|
|
2122
1721
|
zipCode: "",
|
|
2123
1722
|
country: ""
|
|
2124
|
-
},
|
|
1723
|
+
}, $ = (o, e) => {
|
|
2125
1724
|
const t = {}, s = `${e}.`;
|
|
2126
|
-
return Object.keys(
|
|
1725
|
+
return Object.keys(o).forEach((a) => {
|
|
2127
1726
|
if (a.startsWith(s)) {
|
|
2128
1727
|
const i = a.slice(s.length);
|
|
2129
|
-
t[i] =
|
|
1728
|
+
t[i] = o[a];
|
|
2130
1729
|
}
|
|
2131
1730
|
}), t;
|
|
2132
1731
|
};
|
|
2133
|
-
class
|
|
1732
|
+
class Ne {
|
|
2134
1733
|
formElement;
|
|
2135
1734
|
componentManager;
|
|
2136
1735
|
onLoadingStateChange;
|
|
@@ -2164,13 +1763,13 @@ class vt {
|
|
|
2164
1763
|
!!(e.errors.name && e.touched.name),
|
|
2165
1764
|
e.errors.name
|
|
2166
1765
|
), this.componentManager.updateBillingAddressSection(
|
|
2167
|
-
e.formData.billingAddress ??
|
|
1766
|
+
e.formData.billingAddress ?? z,
|
|
2168
1767
|
e.errors.billingAddress ?? {},
|
|
2169
|
-
|
|
1768
|
+
$(e.touched, "billingAddress")
|
|
2170
1769
|
), this.componentManager.updateShippingAddressSection(
|
|
2171
|
-
e.formData.shippingAddress ??
|
|
1770
|
+
e.formData.shippingAddress ?? z,
|
|
2172
1771
|
e.errors.shippingAddress ?? {},
|
|
2173
|
-
|
|
1772
|
+
$(e.touched, "shippingAddress")
|
|
2174
1773
|
), this.componentManager.updateSubmitButton(t);
|
|
2175
1774
|
}
|
|
2176
1775
|
setLoadingState(e) {
|
|
@@ -2178,10 +1777,10 @@ class vt {
|
|
|
2178
1777
|
this.onLoadingStateChange(e);
|
|
2179
1778
|
return;
|
|
2180
1779
|
}
|
|
2181
|
-
e ? (this.hideSkeleton(), this.formSkeleton = new
|
|
1780
|
+
e ? (this.hideSkeleton(), this.formSkeleton = new j(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
|
|
2182
1781
|
}
|
|
2183
1782
|
showSpinner(e) {
|
|
2184
|
-
this.hideSpinner(), this.spinner = new
|
|
1783
|
+
this.hideSpinner(), this.spinner = new Me({ text: e }), this.formElement.appendChild(this.spinner.getElement());
|
|
2185
1784
|
}
|
|
2186
1785
|
hideSpinner() {
|
|
2187
1786
|
this.spinner && (this.spinner.getElement().remove(), this.spinner = void 0);
|
|
@@ -2190,7 +1789,7 @@ class vt {
|
|
|
2190
1789
|
this.formSkeleton && (this.formSkeleton.getElement().remove(), this.formSkeleton = void 0);
|
|
2191
1790
|
}
|
|
2192
1791
|
setErrorMessage(e) {
|
|
2193
|
-
this.alert && (this.alert.getElement().remove(), this.alert = void 0), this.alert = new
|
|
1792
|
+
this.alert && (this.alert.getElement().remove(), this.alert = void 0), this.alert = new ne({ message: e }), this.formElement.insertBefore(
|
|
2194
1793
|
this.alert.getElement(),
|
|
2195
1794
|
this.formElement.firstChild
|
|
2196
1795
|
);
|
|
@@ -2202,7 +1801,7 @@ class vt {
|
|
|
2202
1801
|
this.spinner && (this.spinner.getElement().remove(), this.spinner = void 0), this.formSkeleton && (this.formSkeleton.getElement().remove(), this.formSkeleton = void 0), this.alert && (this.alert.getElement().remove(), this.alert = void 0);
|
|
2203
1802
|
}
|
|
2204
1803
|
}
|
|
2205
|
-
const
|
|
1804
|
+
const w = (o) => ({
|
|
2206
1805
|
street: "",
|
|
2207
1806
|
firstName: "",
|
|
2208
1807
|
lastName: "",
|
|
@@ -2210,14 +1809,14 @@ const T = (n) => ({
|
|
|
2210
1809
|
city: "",
|
|
2211
1810
|
zipCode: "",
|
|
2212
1811
|
country: "",
|
|
2213
|
-
...
|
|
1812
|
+
...o
|
|
2214
1813
|
});
|
|
2215
|
-
class
|
|
1814
|
+
class Pe extends P {
|
|
2216
1815
|
options;
|
|
2217
|
-
formManager =
|
|
1816
|
+
formManager = me();
|
|
2218
1817
|
checkoutProfile;
|
|
2219
|
-
translation =
|
|
2220
|
-
focusManager = new
|
|
1818
|
+
translation = re();
|
|
1819
|
+
focusManager = new oe();
|
|
2221
1820
|
// Managers
|
|
2222
1821
|
componentManager;
|
|
2223
1822
|
eventHandler;
|
|
@@ -2228,9 +1827,9 @@ class Et extends A {
|
|
|
2228
1827
|
vgsJwt;
|
|
2229
1828
|
vgsCardResult;
|
|
2230
1829
|
constructor(e) {
|
|
2231
|
-
super("form", ["form-container"]), this.options = e, this.vgsJwt = e.vgsJwt, this.vgsJwt && (this.vgsService = new
|
|
1830
|
+
super("form", ["form-container"]), this.options = e, this.vgsJwt = e.vgsJwt, this.vgsJwt && (this.vgsService = new _()), this.checkoutProfile = ue({
|
|
2232
1831
|
appearance: e.appearance
|
|
2233
|
-
}), e.locale && this.translation.setLocale(e.locale), this.componentManager = new
|
|
1832
|
+
}), e.locale && this.translation.setLocale(e.locale), this.componentManager = new Ce({
|
|
2234
1833
|
formElement: this.element,
|
|
2235
1834
|
focusManager: this.focusManager,
|
|
2236
1835
|
translationFunc: this.translation.t,
|
|
@@ -2247,11 +1846,11 @@ class Et extends A {
|
|
|
2247
1846
|
environment: e.environment,
|
|
2248
1847
|
vgsService: this.vgsService,
|
|
2249
1848
|
onVgsStateChange: (t) => this.handleVgsStateChange(t)
|
|
2250
|
-
}), this.uiManager = new
|
|
1849
|
+
}), this.uiManager = new Ne({
|
|
2251
1850
|
formElement: this.element,
|
|
2252
1851
|
componentManager: this.componentManager,
|
|
2253
1852
|
onLoadingStateChange: e.onLoadingStateChange
|
|
2254
|
-
}), this.stateCoordinator = new
|
|
1853
|
+
}), this.stateCoordinator = new Ee({
|
|
2255
1854
|
formManager: this.formManager,
|
|
2256
1855
|
checkoutProfile: this.checkoutProfile,
|
|
2257
1856
|
componentManager: this.componentManager,
|
|
@@ -2261,7 +1860,7 @@ class Et extends A {
|
|
|
2261
1860
|
onError: (t) => this.uiManager.setErrorMessage(t),
|
|
2262
1861
|
onLoadingChange: (t) => this.uiManager.setLoadingState(t),
|
|
2263
1862
|
getInitialFormData: () => this._getFormStateData().formData
|
|
2264
|
-
}), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new
|
|
1863
|
+
}), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new Fe({
|
|
2265
1864
|
formManager: this.formManager,
|
|
2266
1865
|
focusManager: this.focusManager,
|
|
2267
1866
|
onFormSubmit: async () => this.handleSubmit(),
|
|
@@ -2286,12 +1885,12 @@ class Et extends A {
|
|
|
2286
1885
|
},
|
|
2287
1886
|
...e.initialValues.name && { name: e.initialValues.name },
|
|
2288
1887
|
...e.initialValues.billingAddress && {
|
|
2289
|
-
billingAddress:
|
|
1888
|
+
billingAddress: w(
|
|
2290
1889
|
e.initialValues.billingAddress
|
|
2291
1890
|
)
|
|
2292
1891
|
},
|
|
2293
1892
|
...e.initialValues.shippingAddress && {
|
|
2294
|
-
shippingAddress:
|
|
1893
|
+
shippingAddress: w(
|
|
2295
1894
|
e.initialValues.shippingAddress
|
|
2296
1895
|
)
|
|
2297
1896
|
}
|
|
@@ -2308,10 +1907,10 @@ class Et extends A {
|
|
|
2308
1907
|
cardNumber: "",
|
|
2309
1908
|
cardCvv: "",
|
|
2310
1909
|
...t?.billingAddress && {
|
|
2311
|
-
billingAddress:
|
|
1910
|
+
billingAddress: w(t.billingAddress)
|
|
2312
1911
|
},
|
|
2313
1912
|
...t?.shippingAddress && {
|
|
2314
|
-
shippingAddress:
|
|
1913
|
+
shippingAddress: w(t.shippingAddress)
|
|
2315
1914
|
}
|
|
2316
1915
|
},
|
|
2317
1916
|
errors: e.errors || {},
|
|
@@ -2338,11 +1937,11 @@ class Et extends A {
|
|
|
2338
1937
|
phoneNumber: "",
|
|
2339
1938
|
phoneCountryCode: e.checkoutProfile.layout.phoneNumber.defaultCountry?.toUpperCase() || "US"
|
|
2340
1939
|
}), e.checkoutProfile.layout.billingFields && this.formManager.getFormState().formData.billingAddress === void 0 && this.formManager.setFormData({
|
|
2341
|
-
billingAddress:
|
|
1940
|
+
billingAddress: w()
|
|
2342
1941
|
}), e.checkoutProfile.layout.shippingFields && this.formManager.getFormState().formData.shippingAddress === void 0 && this.formManager.setFormData({
|
|
2343
|
-
shippingAddress:
|
|
1942
|
+
shippingAddress: w()
|
|
2344
1943
|
});
|
|
2345
|
-
const { formData: t, errors: s, touched: a } = this._getFormStateData(), i =
|
|
1944
|
+
const { formData: t, errors: s, touched: a } = this._getFormStateData(), i = pe(
|
|
2346
1945
|
e.checkoutProfile.layout
|
|
2347
1946
|
);
|
|
2348
1947
|
try {
|
|
@@ -2350,8 +1949,8 @@ class Et extends A {
|
|
|
2350
1949
|
e.checkoutProfile,
|
|
2351
1950
|
t
|
|
2352
1951
|
);
|
|
2353
|
-
} catch (
|
|
2354
|
-
console.error("Failed to create payment methods:",
|
|
1952
|
+
} catch (r) {
|
|
1953
|
+
console.error("Failed to create payment methods:", r);
|
|
2355
1954
|
}
|
|
2356
1955
|
try {
|
|
2357
1956
|
this.componentManager.createEmailField(
|
|
@@ -2360,8 +1959,8 @@ class Et extends A {
|
|
|
2360
1959
|
s,
|
|
2361
1960
|
a
|
|
2362
1961
|
);
|
|
2363
|
-
} catch (
|
|
2364
|
-
console.error("Failed to create email field:",
|
|
1962
|
+
} catch (r) {
|
|
1963
|
+
console.error("Failed to create email field:", r);
|
|
2365
1964
|
}
|
|
2366
1965
|
if (i) {
|
|
2367
1966
|
try {
|
|
@@ -2371,8 +1970,8 @@ class Et extends A {
|
|
|
2371
1970
|
s,
|
|
2372
1971
|
a
|
|
2373
1972
|
);
|
|
2374
|
-
} catch (
|
|
2375
|
-
console.error("Failed to create billing address section:",
|
|
1973
|
+
} catch (r) {
|
|
1974
|
+
console.error("Failed to create billing address section:", r);
|
|
2376
1975
|
}
|
|
2377
1976
|
try {
|
|
2378
1977
|
this.componentManager.createShippingAddressSection(
|
|
@@ -2381,8 +1980,8 @@ class Et extends A {
|
|
|
2381
1980
|
s,
|
|
2382
1981
|
a
|
|
2383
1982
|
);
|
|
2384
|
-
} catch (
|
|
2385
|
-
console.error("Failed to create shipping address section:",
|
|
1983
|
+
} catch (r) {
|
|
1984
|
+
console.error("Failed to create shipping address section:", r);
|
|
2386
1985
|
}
|
|
2387
1986
|
}
|
|
2388
1987
|
if (e.checkoutProfile.layout.phoneNumber?.enabled)
|
|
@@ -2393,8 +1992,8 @@ class Et extends A {
|
|
|
2393
1992
|
s,
|
|
2394
1993
|
a
|
|
2395
1994
|
);
|
|
2396
|
-
} catch (
|
|
2397
|
-
console.error("Failed to create phone number field:",
|
|
1995
|
+
} catch (r) {
|
|
1996
|
+
console.error("Failed to create phone number field:", r);
|
|
2398
1997
|
}
|
|
2399
1998
|
try {
|
|
2400
1999
|
this.componentManager.createCardSection(
|
|
@@ -2403,10 +2002,10 @@ class Et extends A {
|
|
|
2403
2002
|
s,
|
|
2404
2003
|
a
|
|
2405
2004
|
);
|
|
2406
|
-
} catch (
|
|
2407
|
-
console.error("Failed to create card section:",
|
|
2005
|
+
} catch (r) {
|
|
2006
|
+
console.error("Failed to create card section:", r);
|
|
2408
2007
|
}
|
|
2409
|
-
if (!
|
|
2008
|
+
if (!B(
|
|
2410
2009
|
e.checkoutProfile.layout
|
|
2411
2010
|
))
|
|
2412
2011
|
try {
|
|
@@ -2416,19 +2015,19 @@ class Et extends A {
|
|
|
2416
2015
|
s,
|
|
2417
2016
|
a
|
|
2418
2017
|
);
|
|
2419
|
-
} catch (
|
|
2420
|
-
console.error("Failed to create cardholder section:",
|
|
2018
|
+
} catch (r) {
|
|
2019
|
+
console.error("Failed to create cardholder section:", r);
|
|
2421
2020
|
}
|
|
2422
|
-
this.vgsService && this.componentManager.mountVgsFields(e.checkoutProfile).catch((
|
|
2423
|
-
console.error("Failed to mount VGS fields:",
|
|
2021
|
+
this.vgsService && this.componentManager.mountVgsFields(e.checkoutProfile).catch((r) => {
|
|
2022
|
+
console.error("Failed to mount VGS fields:", r);
|
|
2424
2023
|
});
|
|
2425
2024
|
try {
|
|
2426
2025
|
this.componentManager.createSubmitButton(
|
|
2427
2026
|
e.checkoutProfile,
|
|
2428
2027
|
this.stateCoordinator.isFormDisabled()
|
|
2429
2028
|
);
|
|
2430
|
-
} catch (
|
|
2431
|
-
console.error("Failed to create submit button:",
|
|
2029
|
+
} catch (r) {
|
|
2030
|
+
console.error("Failed to create submit button:", r);
|
|
2432
2031
|
}
|
|
2433
2032
|
}
|
|
2434
2033
|
updateFormUI() {
|
|
@@ -2444,13 +2043,13 @@ class Et extends A {
|
|
|
2444
2043
|
*/
|
|
2445
2044
|
inferCardholderName() {
|
|
2446
2045
|
const e = this.checkoutProfile.getState();
|
|
2447
|
-
if (!e.checkoutProfile || !
|
|
2046
|
+
if (!e.checkoutProfile || !B(
|
|
2448
2047
|
e.checkoutProfile.layout
|
|
2449
2048
|
)) return;
|
|
2450
2049
|
const { formData: s } = this._getFormStateData(), a = s.billingAddress ?? s.shippingAddress;
|
|
2451
2050
|
if (!a) return;
|
|
2452
|
-
const i = a.firstName?.trim() ?? "",
|
|
2453
|
-
|
|
2051
|
+
const i = a.firstName?.trim() ?? "", n = a.lastName?.trim() ?? "", r = [i, n].filter(Boolean).join(" ");
|
|
2052
|
+
r && this.formManager.setFormData({ name: r });
|
|
2454
2053
|
}
|
|
2455
2054
|
/**
|
|
2456
2055
|
* Infers address data based on field configuration.
|
|
@@ -2460,11 +2059,11 @@ class Et extends A {
|
|
|
2460
2059
|
inferAddresses() {
|
|
2461
2060
|
const e = this.checkoutProfile.getState();
|
|
2462
2061
|
if (!e.checkoutProfile) return;
|
|
2463
|
-
const { billingFields: t, shippingFields: s } = e.checkoutProfile.layout, a = t && Object.values(t).some((
|
|
2464
|
-
!a && i &&
|
|
2465
|
-
billingAddress: { ...
|
|
2466
|
-
}) : !i && a &&
|
|
2467
|
-
shippingAddress: { ...
|
|
2062
|
+
const { billingFields: t, shippingFields: s } = e.checkoutProfile.layout, a = t && Object.values(t).some((r) => r?.enabled), i = s && Object.values(s).some((r) => r?.enabled), { formData: n } = this._getFormStateData();
|
|
2063
|
+
!a && i && n.shippingAddress ? this.formManager.setFormData({
|
|
2064
|
+
billingAddress: { ...n.shippingAddress }
|
|
2065
|
+
}) : !i && a && n.billingAddress && this.formManager.setFormData({
|
|
2066
|
+
shippingAddress: { ...n.billingAddress }
|
|
2468
2067
|
});
|
|
2469
2068
|
}
|
|
2470
2069
|
handleVgsStateChange(e) {
|
|
@@ -2552,13 +2151,13 @@ class Et extends A {
|
|
|
2552
2151
|
), this.componentManager.cleanup(), this.uiManager.cleanup(), this.getElement().remove();
|
|
2553
2152
|
}
|
|
2554
2153
|
associatePayment(e, t, s, a, i) {
|
|
2555
|
-
this.options.paymentId = e, this.options.checkoutKey = t, this.options.supportedPaymentMethods = s, this.options.checkoutDetails = a, this.componentManager.setCheckoutDetailsLoaded(!0), i && !this.vgsService && (this.vgsJwt = i, this.vgsService = new
|
|
2154
|
+
this.options.paymentId = e, this.options.checkoutKey = t, this.options.supportedPaymentMethods = s, this.options.checkoutDetails = a, this.componentManager.setCheckoutDetailsLoaded(!0), i && !this.vgsService && (this.vgsJwt = i, this.vgsService = new _(), this.componentManager.setVgsService(this.vgsService), this.stateCoordinator.setVgsMode(!0), this.vgsService.init(this.options.environment).then((r) => {
|
|
2556
2155
|
this.vgsService?.createForm(
|
|
2557
|
-
|
|
2156
|
+
r,
|
|
2558
2157
|
(d) => this.handleVgsStateChange(d)
|
|
2559
2158
|
), this.renderFormComponents();
|
|
2560
|
-
}).catch((
|
|
2561
|
-
console.error("Failed to load VGS Collect:",
|
|
2159
|
+
}).catch((r) => {
|
|
2160
|
+
console.error("Failed to load VGS Collect:", r), this.vgsService = void 0, this.vgsJwt = void 0, this.renderFormComponents();
|
|
2562
2161
|
})), this.componentManager.removePaymentMethods(), this.componentManager.updateSupportedPaymentMethods(
|
|
2563
2162
|
s
|
|
2564
2163
|
), this.componentManager.updatePaymentDetails(
|
|
@@ -2566,18 +2165,18 @@ class Et extends A {
|
|
|
2566
2165
|
t,
|
|
2567
2166
|
a
|
|
2568
2167
|
), !i && this.checkoutProfile.getState().checkoutProfile && this.renderFormComponents();
|
|
2569
|
-
const
|
|
2570
|
-
if (
|
|
2571
|
-
const { formData:
|
|
2168
|
+
const n = this.checkoutProfile.getState();
|
|
2169
|
+
if (n.checkoutProfile) {
|
|
2170
|
+
const { formData: r } = this._getFormStateData();
|
|
2572
2171
|
this.componentManager.createPaymentMethods(
|
|
2573
|
-
|
|
2574
|
-
|
|
2172
|
+
n.checkoutProfile,
|
|
2173
|
+
r,
|
|
2575
2174
|
!0
|
|
2576
2175
|
);
|
|
2577
2176
|
}
|
|
2578
2177
|
}
|
|
2579
2178
|
}
|
|
2580
|
-
class
|
|
2179
|
+
class ke {
|
|
2581
2180
|
container = null;
|
|
2582
2181
|
options;
|
|
2583
2182
|
onSubmit;
|
|
@@ -2601,7 +2200,7 @@ class Ct {
|
|
|
2601
2200
|
}
|
|
2602
2201
|
}
|
|
2603
2202
|
renderForm(e) {
|
|
2604
|
-
this.container && (this.form && (this.form.destroy(), this.form = null), this.form = new
|
|
2203
|
+
this.container && (this.form && (this.form.destroy(), this.form = null), this.form = new Pe({
|
|
2605
2204
|
apiKey: this.options.apiKey,
|
|
2606
2205
|
onSubmit: this.onSubmit,
|
|
2607
2206
|
locale: this.options.locale,
|
|
@@ -2638,7 +2237,7 @@ class Ct {
|
|
|
2638
2237
|
);
|
|
2639
2238
|
}
|
|
2640
2239
|
}
|
|
2641
|
-
class
|
|
2240
|
+
class Ae {
|
|
2642
2241
|
state;
|
|
2643
2242
|
listeners = /* @__PURE__ */ new Set();
|
|
2644
2243
|
constructor(e) {
|
|
@@ -2660,8 +2259,8 @@ class Ft {
|
|
|
2660
2259
|
this.listeners.forEach((t) => t(e));
|
|
2661
2260
|
}
|
|
2662
2261
|
}
|
|
2663
|
-
const
|
|
2664
|
-
class
|
|
2262
|
+
const we = "en";
|
|
2263
|
+
class De {
|
|
2665
2264
|
config;
|
|
2666
2265
|
_callbacks;
|
|
2667
2266
|
paymentState;
|
|
@@ -2670,18 +2269,18 @@ class Nt {
|
|
|
2670
2269
|
stateManager;
|
|
2671
2270
|
sessionId;
|
|
2672
2271
|
constructor(e) {
|
|
2673
|
-
this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(),
|
|
2272
|
+
this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(), le({
|
|
2674
2273
|
environment: this.config.environment,
|
|
2675
2274
|
sessionId: this.sessionId
|
|
2676
|
-
}),
|
|
2275
|
+
}), F(E.CHECKOUT_INITIALIZED, {
|
|
2677
2276
|
environment: this.config.environment
|
|
2678
|
-
}), this.apiService = new
|
|
2277
|
+
}), this.apiService = new de(
|
|
2679
2278
|
this.config.apiKey,
|
|
2680
2279
|
this.config.environment
|
|
2681
|
-
), this.stateManager = new
|
|
2280
|
+
), this.stateManager = new Ae({
|
|
2682
2281
|
mounted: !1,
|
|
2683
2282
|
form: null
|
|
2684
|
-
}), this.formManager = new
|
|
2283
|
+
}), this.formManager = new ke(
|
|
2685
2284
|
{
|
|
2686
2285
|
locale: this.config.locale,
|
|
2687
2286
|
apiKey: this.config.apiKey,
|
|
@@ -2703,7 +2302,7 @@ class Nt {
|
|
|
2703
2302
|
apiKey: e.apiKey,
|
|
2704
2303
|
returnUrl: e.returnUrl,
|
|
2705
2304
|
environment: e.environment,
|
|
2706
|
-
locale: e.locale ||
|
|
2305
|
+
locale: e.locale || we,
|
|
2707
2306
|
disableErrorMessages: e.disableErrorMessages ?? !1,
|
|
2708
2307
|
manualActionHandling: e.manualActionHandling ?? !1,
|
|
2709
2308
|
appearance: e.appearance,
|
|
@@ -2724,7 +2323,7 @@ class Nt {
|
|
|
2724
2323
|
return t.appendChild(s), this.stateManager.updateState({
|
|
2725
2324
|
form: s,
|
|
2726
2325
|
mounted: !0
|
|
2727
|
-
}), this.formManager.mount(s),
|
|
2326
|
+
}), this.formManager.mount(s), F(E.CHECKOUT_MOUNTED, {
|
|
2728
2327
|
container_id: e
|
|
2729
2328
|
}), this;
|
|
2730
2329
|
}
|
|
@@ -2736,7 +2335,7 @@ class Nt {
|
|
|
2736
2335
|
t && t.remove(), this.stateManager.updateState({
|
|
2737
2336
|
form: null,
|
|
2738
2337
|
mounted: !1
|
|
2739
|
-
}),
|
|
2338
|
+
}), F(E.CHECKOUT_UNMOUNTED);
|
|
2740
2339
|
});
|
|
2741
2340
|
}
|
|
2742
2341
|
async handleSubmit({
|
|
@@ -2748,7 +2347,7 @@ class Nt {
|
|
|
2748
2347
|
"Payment must be associated before submitting. Call associatePayment() first."
|
|
2749
2348
|
);
|
|
2750
2349
|
const s = this.getPaymentMethod(e, t);
|
|
2751
|
-
|
|
2350
|
+
F(E.PAYMENT_SUBMIT_STARTED, {
|
|
2752
2351
|
payment_id: this.paymentState.paymentId,
|
|
2753
2352
|
payment_method: s
|
|
2754
2353
|
});
|
|
@@ -2760,32 +2359,32 @@ class Nt {
|
|
|
2760
2359
|
paymentId: this.paymentState.paymentId,
|
|
2761
2360
|
returnUrl: this.config.returnUrl,
|
|
2762
2361
|
applePayData: t
|
|
2763
|
-
}),
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2362
|
+
}), n = performance.now() - a;
|
|
2363
|
+
U(
|
|
2364
|
+
H.PAYMENT_AUTHORIZATION_TIME,
|
|
2365
|
+
n,
|
|
2767
2366
|
"ms",
|
|
2768
2367
|
{
|
|
2769
2368
|
payment_id: this.paymentState.paymentId,
|
|
2770
2369
|
payment_method: s,
|
|
2771
2370
|
status: "success"
|
|
2772
2371
|
}
|
|
2773
|
-
),
|
|
2372
|
+
), F(E.PAYMENT_SUBMIT_SUCCESS, {
|
|
2774
2373
|
payment_id: this.paymentState.paymentId,
|
|
2775
2374
|
payment_method: s
|
|
2776
2375
|
}), this.handlePaymentResponse(i);
|
|
2777
2376
|
} catch (i) {
|
|
2778
|
-
const
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2377
|
+
const n = performance.now() - a;
|
|
2378
|
+
U(
|
|
2379
|
+
H.PAYMENT_AUTHORIZATION_TIME,
|
|
2380
|
+
n,
|
|
2782
2381
|
"ms",
|
|
2783
2382
|
{
|
|
2784
2383
|
payment_id: this.paymentState.paymentId,
|
|
2785
2384
|
payment_method: s,
|
|
2786
2385
|
status: "failed"
|
|
2787
2386
|
}
|
|
2788
|
-
),
|
|
2387
|
+
), F(E.PAYMENT_SUBMIT_FAILED, {
|
|
2789
2388
|
payment_id: this.paymentState.paymentId,
|
|
2790
2389
|
payment_method: s,
|
|
2791
2390
|
error_message: i.details?.message ?? "Unknown error"
|
|
@@ -2793,15 +2392,15 @@ class Nt {
|
|
|
2793
2392
|
}
|
|
2794
2393
|
}
|
|
2795
2394
|
handlePaymentResponse(e) {
|
|
2796
|
-
if (e.latestTransaction.status === "authorized" && (
|
|
2395
|
+
if (e.latestTransaction.status === "authorized" && (F(E.PAYMENT_AUTHORIZED, {
|
|
2797
2396
|
payment_id: this.paymentState.paymentId ?? "",
|
|
2798
2397
|
status: e.latestTransaction.status
|
|
2799
|
-
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status)), e.latestTransaction.status === "failed" && (
|
|
2398
|
+
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status)), e.latestTransaction.status === "failed" && (F(E.PAYMENT_FAILED, {
|
|
2800
2399
|
payment_id: this.paymentState.paymentId ?? "",
|
|
2801
2400
|
status: e.latestTransaction.status
|
|
2802
2401
|
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status)), e.status === "requires_action") {
|
|
2803
2402
|
const { redirectUrl: t } = e.action;
|
|
2804
|
-
|
|
2403
|
+
F(E.PAYMENT_ACTION_REQUIRED, {
|
|
2805
2404
|
payment_id: this.paymentState.paymentId ?? "",
|
|
2806
2405
|
status: e.status
|
|
2807
2406
|
}), this.config.manualActionHandling ? this._callbacks.onActionRequired?.(t) : globalThis.location.href = t;
|
|
@@ -2841,7 +2440,7 @@ class Nt {
|
|
|
2841
2440
|
throw new Error("paymentId and checkoutKey are required");
|
|
2842
2441
|
this.paymentState.paymentId = e, this.paymentState.checkoutKey = t;
|
|
2843
2442
|
try {
|
|
2844
|
-
const s = await
|
|
2443
|
+
const s = await he({
|
|
2845
2444
|
id: e,
|
|
2846
2445
|
checkoutKey: t,
|
|
2847
2446
|
environment: this.config.environment
|
|
@@ -2862,7 +2461,7 @@ class Nt {
|
|
|
2862
2461
|
countryCode: s.countryCode
|
|
2863
2462
|
};
|
|
2864
2463
|
const a = s.supportedPaymentMethods.reduce(
|
|
2865
|
-
(i,
|
|
2464
|
+
(i, n) => (i[n] = !0, i),
|
|
2866
2465
|
{}
|
|
2867
2466
|
);
|
|
2868
2467
|
await this.formManager.associatePayment(
|
|
@@ -2871,16 +2470,16 @@ class Nt {
|
|
|
2871
2470
|
a,
|
|
2872
2471
|
this.paymentState.checkoutDetails,
|
|
2873
2472
|
s.vgsJwt
|
|
2874
|
-
),
|
|
2473
|
+
), F(E.PAYMENT_ASSOCIATED, {
|
|
2875
2474
|
payment_id: e,
|
|
2876
2475
|
currency: s.currency,
|
|
2877
2476
|
country_code: s.countryCode
|
|
2878
2477
|
});
|
|
2879
2478
|
} catch (s) {
|
|
2880
|
-
throw
|
|
2479
|
+
throw F(E.PAYMENT_ASSOCIATION_FAILED, {
|
|
2881
2480
|
payment_id: e,
|
|
2882
2481
|
error_message: s instanceof Error ? s.message : "Unknown error"
|
|
2883
|
-
}),
|
|
2482
|
+
}), ce(
|
|
2884
2483
|
s instanceof Error ? s : new Error("Failed to associate payment"),
|
|
2885
2484
|
{ payment_id: e }
|
|
2886
2485
|
), s;
|
|
@@ -2890,19 +2489,19 @@ class Nt {
|
|
|
2890
2489
|
Object.assign(this._callbacks, e);
|
|
2891
2490
|
}
|
|
2892
2491
|
}
|
|
2893
|
-
typeof globalThis < "u" && (globalThis.OdusCheckout =
|
|
2492
|
+
typeof globalThis < "u" && (globalThis.OdusCheckout = De);
|
|
2894
2493
|
export {
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2494
|
+
De as OdusCheckout,
|
|
2495
|
+
Ie as deLocale,
|
|
2496
|
+
Be as enLocale,
|
|
2497
|
+
Te as esLocale,
|
|
2498
|
+
Re as frLocale,
|
|
2499
|
+
_e as itLocale,
|
|
2500
|
+
Ue as plLocale,
|
|
2501
|
+
He as ptLocale,
|
|
2502
|
+
ce as pushError,
|
|
2503
|
+
F as pushEvent,
|
|
2504
|
+
Oe as pushLog,
|
|
2505
|
+
U as pushMeasurement,
|
|
2506
|
+
ze as trLocale
|
|
2908
2507
|
};
|