@odus/checkout 0.30.0 → 1.1.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.
@@ -1,643 +1,10 @@
1
- import { l as fe, c as me, a as ye, f as j, d as be, C as A, I as pe, b as P, g as ve, S as _, e as ee, H as Se, V as te, h as D, A as Ce, P as Ee, E as Fe, i as Me, j as Ne, k as we, m as Pe, n as ke, o as Ae, F as xe, p as De, q as Ie } from "./shared.js";
2
- import { r as _t, s as Rt, t as Bt, u as Ut, v as Ot, w as Ht, x as zt, y as $t } from "./shared.js";
3
- const F = {
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
- }, Te = /^\s*at (?:(.+?) ?\()?((?:file|https?|chrome-extension|webpack-internal):\/\/.+?):(\d+):(\d+)\)?\s*$/, Le = /^([^@]+)@((?:file|https?|chrome-extension|webpack-internal):\/\/[^\s:]+):(\d+):(\d+)$/, Ve = /^(?:([^@]+)@)?((?: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 = Te.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 = Le.exec(a) ?? Ve.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
- }, _e = "@odus/telemetry", Re = "0.0.1";
51
- let z, $, X;
52
- const Be = () => {
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
- }, Ue = () => typeof window > "u" ? {} : { url: window.location.href }, Oe = (n) => {
70
- z = void 0, X = void 0, $ = n.sessionTracking?.session ? { id: n.sessionTracking.session.id } : void 0;
71
- }, He = (n) => {
72
- z = n;
73
- }, ze = () => {
74
- z = void 0;
75
- }, $e = (n) => {
76
- $ = n;
77
- }, Ke = (n) => {
78
- X = n;
79
- }, je = () => $?.id, qe = (n) => ({
80
- sdk: { name: _e, version: Re },
81
- app: n.app,
82
- user: z,
83
- session: $,
84
- page: Ue(),
85
- browser: Be(),
86
- view: X
87
- }), We = 30, Ye = 250, Ge = 6e4;
88
- let I = [], k = null, Q = 0, R = null, B = null;
89
- const Ze = (n) => {
90
- if (k)
91
- return;
92
- const e = n.batching?.sendTimeout ?? Ye;
93
- k = setTimeout(() => {
94
- K(n);
95
- }, e);
96
- }, Je = (n, e) => {
97
- const t = {
98
- meta: qe(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
- }, Xe = (n, e, t = !1) => {
117
- const s = JSON.stringify(n), a = je(), 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 < Ge;
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
- Q = Date.now() + c;
135
- }
136
- }).catch(() => {
137
- });
138
- }, K = (n, e = !1) => {
139
- if (k && (clearTimeout(k), k = null), I.length === 0)
140
- return;
141
- if (Date.now() < Q) {
142
- I = [];
143
- return;
144
- }
145
- const t = I;
146
- I = [];
147
- try {
148
- let s = Je(t, n);
149
- if (n.beforeSend) {
150
- const a = n.beforeSend(s);
151
- if (!a)
152
- return;
153
- s = a;
154
- }
155
- Xe(s, n.url, e);
156
- } catch {
157
- }
158
- }, w = (n, e) => {
159
- I.push(n);
160
- const t = e.batching?.itemLimit ?? We;
161
- if (I.length >= t) {
162
- K(e);
163
- return;
164
- }
165
- Ze(e);
166
- }, Qe = (n) => {
167
- if (I = [], Q = 0, k && (clearTimeout(k), k = null), typeof document > "u")
168
- return;
169
- R && document.removeEventListener("visibilitychange", R), B && window.removeEventListener("pagehide", B);
170
- const e = () => K(n, !0);
171
- R = () => {
172
- document.visibilityState === "hidden" && e();
173
- }, B = e, document.addEventListener("visibilitychange", R), window.addEventListener("pagehide", B);
174
- }, ne = () => (/* @__PURE__ */ new Date()).toISOString();
175
- let ie = null, ae = null;
176
- const et = (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", q = () => {
202
- const n = new Uint8Array(16);
203
- return crypto.getRandomValues(n), Array.from(n, (e) => e.toString(16).padStart(2, "0")).join("");
204
- }, tt = (n) => {
205
- if (n)
206
- return n;
207
- if (typeof sessionStorage > "u")
208
- return q();
209
- try {
210
- const e = sessionStorage.getItem(re);
211
- if (e)
212
- return e;
213
- const t = q();
214
- return sessionStorage.setItem(re, t), t;
215
- } catch {
216
- return q();
217
- }
218
- }, st = (n) => {
219
- if (!n.sessionTracking?.enabled)
220
- return;
221
- const e = tt(n.sessionTracking.session?.id);
222
- $e({ id: e });
223
- }, W = () => (/* @__PURE__ */ new Date()).toISOString(), Y = (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
- }, nt = (n) => {
231
- if (typeof window > "u")
232
- return;
233
- Y("largest-contentful-paint", (t) => {
234
- w({
235
- type: "measurement",
236
- payload: {
237
- type: "web-vitals",
238
- values: { lcp: t.startTime },
239
- timestamp: W()
240
- }
241
- }, n);
242
- });
243
- let e = 0;
244
- Y("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: W()
252
- }
253
- }, n));
254
- }), Y("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: W()
262
- }
263
- }, n);
264
- });
265
- }, H = {
266
- INFO: "info",
267
- WARN: "warn",
268
- ERROR: "error"
269
- }, U = () => (/* @__PURE__ */ new Date()).toISOString(), it = (n) => {
270
- Oe(n), Qe(n);
271
- const e = n.instrumentations ?? {
272
- errors: !0,
273
- webVitals: !0,
274
- session: !0
275
- };
276
- return e.session !== !1 && st(n), e.errors !== !1 && et(n), e.webVitals !== !1 && nt(n), {
277
- pushError(t, s) {
278
- w({
279
- type: "exception",
280
- payload: {
281
- type: t.name,
282
- value: t.message,
283
- timestamp: U(),
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: U(),
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: U(),
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 ?? H.INFO,
316
- timestamp: U(),
317
- context: s?.context
318
- }
319
- }, n);
320
- },
321
- setUser(t) {
322
- He(t);
323
- },
324
- resetUser() {
325
- ze();
326
- },
327
- setView(t) {
328
- Ke(t);
329
- },
330
- flush() {
331
- K(n);
332
- }
333
- };
334
- }, at = (n) => n === "test" ? "https://sandbox-analytics.odus.com/collect" : "https://analytics.odus.com/collect", rt = () => {
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 C = null;
341
- const ot = (n) => {
342
- if (C)
343
- return C;
344
- if (rt())
345
- return null;
346
- const e = at(n.environment);
347
- return C = it({
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
- }), C;
379
- }, lt = (n, e) => {
380
- C && C.pushError(n, { context: e });
381
- }, M = (n, e) => {
382
- C && C.pushEvent(n, e);
383
- }, oe = (n, e, t, s) => {
384
- C && C.pushMeasurement({
385
- type: n,
386
- values: { [n]: e },
387
- context: {
388
- ...t && { unit: t },
389
- ...s
390
- }
391
- });
392
- }, Tt = (n, e = "info", t) => {
393
- if (!C) return;
394
- const s = {
395
- info: H.INFO,
396
- warn: H.WARN,
397
- error: H.ERROR
398
- };
399
- C.pushLog([n], {
400
- level: s[e],
401
- context: t
402
- });
403
- }, le = {
404
- test: "tntwpdhfwng",
405
- live: "TBD"
406
- }, de = {
407
- test: "sandbox",
408
- live: "live"
409
- };
410
- class L {
411
- vgsForm = null;
412
- fields = [];
413
- readyResolve;
414
- readyPromise;
415
- environment;
416
- constructor() {
417
- this.readyPromise = new Promise((e) => {
418
- this.readyResolve = e;
419
- });
420
- }
421
- async init(e) {
422
- return this.environment = e, await fe({
423
- vaultId: le[e],
424
- environment: de[e],
425
- version: "3.3.0"
426
- });
427
- }
428
- createForm(e, t) {
429
- if (!this.environment)
430
- throw new Error("VGS not initialized — call init() first");
431
- return this.vgsForm = e.create(
432
- le[this.environment],
433
- de[this.environment],
434
- t
435
- ), this.readyResolve?.(), this.vgsForm;
436
- }
437
- whenReady() {
438
- return this.readyPromise;
439
- }
440
- mountCardFields(e, t, s, a) {
441
- if (!this.vgsForm)
442
- throw new Error("VGS form not initialized");
443
- if (e.cardNumber) {
444
- const i = this.vgsForm.cardNumberField(e.cardNumber, {
445
- placeholder: s.cardNumber,
446
- autoComplete: "cc-number",
447
- validations: ["required", "validCardNumber"],
448
- addCardBrands: [
449
- {
450
- type: "visa",
451
- pattern: /^4/,
452
- format: /(\d{1,4})/g,
453
- length: [16],
454
- cvcLength: [3],
455
- luhn: !0
456
- },
457
- {
458
- type: "mastercard",
459
- pattern: /^(5[1-5]|2[2-7])/,
460
- format: /(\d{1,4})/g,
461
- length: [16],
462
- cvcLength: [3],
463
- luhn: !0
464
- },
465
- {
466
- type: "american-express",
467
- pattern: /^3[47]/,
468
- format: /(\d{1,4})(\d{1,6})?(\d{1,5})?/,
469
- length: [15],
470
- cvcLength: [4],
471
- luhn: !0
472
- },
473
- {
474
- type: "discover",
475
- pattern: /^(6011|65|64[4-9]|622)/,
476
- format: /(\d{1,4})/g,
477
- length: [16, 19],
478
- cvcLength: [3],
479
- luhn: !0
480
- }
481
- ],
482
- css: t.cardNumber
483
- });
484
- i.on("update", (r) => {
485
- a && a(L.mapCardType(r.cardType));
486
- }), this.fields.push(i);
487
- }
488
- if (e.cardExpiry) {
489
- const i = this.vgsForm.cardExpirationDateField(
490
- e.cardExpiry,
491
- {
492
- placeholder: s.cardExpiry,
493
- autoComplete: "cc-exp",
494
- validations: ["required", "validCardExpirationDate"],
495
- serializers: [
496
- {
497
- name: "separate",
498
- options: { monthName: "month", yearName: "year" }
499
- }
500
- ],
501
- css: t.cardExpiry
502
- }
503
- );
504
- this.fields.push(i);
505
- }
506
- if (e.cardCvv) {
507
- const i = this.vgsForm.cardCVCField(e.cardCvv, {
508
- placeholder: s.cardCvv,
509
- autoComplete: "cc-csc",
510
- validations: ["required", "validCardSecurityCode"],
511
- css: t.cardCvv
512
- });
513
- this.fields.push(i);
514
- }
515
- if (e.cardholderName) {
516
- const i = this.vgsForm.cardholderNameField(
517
- e.cardholderName,
518
- {
519
- placeholder: s.cardholderName,
520
- autoComplete: "cc-name",
521
- validations: ["required"],
522
- css: t.cardholderName
523
- }
524
- );
525
- this.fields.push(i);
526
- }
527
- }
528
- waitForFieldsReady() {
529
- return Promise.all(this.fields.map((e) => e.promise));
530
- }
531
- createCard(e) {
532
- if (!this.vgsForm)
533
- return Promise.reject(new Error("VGS form not initialized"));
534
- const t = this.vgsForm;
535
- return new Promise((s, a) => {
536
- t.createCard(
537
- { auth: e },
538
- (i, r) => {
539
- if (r?.errors) {
540
- a(r.errors);
541
- return;
542
- }
543
- const o = r?.data;
544
- if (!o?.id) {
545
- a(new Error("Card creation failed: no card ID returned"));
546
- return;
547
- }
548
- if (i === 303) {
549
- this.patchCard(e, o.id).then(s).catch(a);
550
- return;
551
- }
552
- s(L.extractCardResult(o));
553
- },
554
- (i) => {
555
- a(i);
556
- }
557
- );
558
- });
559
- }
560
- patchCard(e, t) {
561
- if (!this.vgsForm || !this.environment)
562
- return Promise.reject(new Error("VGS not initialized"));
563
- const s = this.vgsForm;
564
- return new Promise((a, i) => {
565
- s.submit(
566
- `/cards/${t}`,
567
- {
568
- method: "PATCH",
569
- headers: {
570
- Authorization: `Bearer ${e}`,
571
- "Content-Type": "application/vnd.api+json"
572
- },
573
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
574
- data: (r) => ({
575
- data: {
576
- attributes: {
577
- cvc: r.cvc,
578
- exp_month: r["exp-date"].month,
579
- exp_year: r["exp-date"].year
580
- }
581
- }
582
- })
583
- },
584
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
585
- (r, o) => {
586
- if (r >= 400 || o?.errors) {
587
- i(o?.errors ?? new Error("Card update failed"));
588
- return;
589
- }
590
- const d = o?.data;
591
- if (!d?.id) {
592
- i(new Error("Card update failed: no card ID returned"));
593
- return;
594
- }
595
- const c = L.extractCardResult(d), m = o.included?.find(
596
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
597
- (S) => S.type === "card_updates"
598
- );
599
- m?.attributes?.updated_values?.length && (c.updatedValues = m.attributes.updated_values), a(c);
600
- },
601
- (r) => {
602
- i(r);
603
- }
604
- );
605
- });
606
- }
607
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
608
- static extractCardResult(e) {
609
- const t = e.attributes;
610
- return {
611
- cardId: e.id,
612
- expMonth: String(t?.exp_month ?? ""),
613
- cvc: String(t?.cvc ?? ""),
614
- expYear: String(t?.exp_year ?? ""),
615
- name: String(t?.cardholder?.name ?? "")
616
- };
617
- }
618
- destroy() {
619
- this.vgsForm = null, this.fields = [];
620
- }
621
- static mapCardType(e) {
622
- return e ? {
623
- visa: "visa",
624
- mastercard: "mastercard",
625
- "american-express": "amex",
626
- amex: "amex",
627
- "diners-club": "unknown",
628
- discover: "discover",
629
- jcb: "unknown",
630
- unionpay: "unknown",
631
- maestro: "unknown",
632
- elo: "unknown"
633
- }[e] ?? "unknown" : "unknown";
634
- }
635
- }
636
- function G(n) {
1
+ import { c as q, a as W, f as L, d as Y, C as P, I as K, b as N, g as G, S as x, e as T, H as J, V as _, h as A, A as Z, P as X, E as Q, l as ee, i as te, j as se, k as ie, m as ae, n as ne, o as re, F as oe, p as R, q as le, r as F, s as E, t as de, u as U, v as H, w as he, x as ce } from "./shared.js";
2
+ import { z as Ie, B as Be, D as Te, G as _e, J as Re, K as Ue, L as He, y as Oe, M as ze } from "./shared.js";
3
+ function I(o) {
637
4
  return {
638
5
  name: "Custom Appearance",
639
- additionalPaymentMethods: n.additionalPaymentMethods || {},
640
- styles: n.styles || {
6
+ additionalPaymentMethods: o.additionalPaymentMethods || {},
7
+ styles: o.styles || {
641
8
  fontSize: 14,
642
9
  textColor: "#000000",
643
10
  buttonColor: "#0070f3",
@@ -647,104 +14,104 @@ function G(n) {
647
14
  buttonFontSize: 16
648
15
  },
649
16
  layout: {
650
- grouped: n.layout?.grouped,
651
- actionButton: n.layout?.actionButton || {
17
+ grouped: o.layout?.grouped,
18
+ actionButton: o.layout?.actionButton || {
652
19
  translationKey: null
653
20
  },
654
- phoneNumber: n.layout?.phoneNumber ? {
655
- enabled: n.layout.phoneNumber.enabled,
656
- label: n.layout.phoneNumber.label,
657
- defaultCountry: n.layout.phoneNumber.defaultCountry,
658
- allowedCountries: n.layout.phoneNumber.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
659
26
  } : void 0,
660
27
  billingFields: {
661
28
  street: {
662
- enabled: n.layout?.billingFields?.street?.enabled ?? !1,
663
- label: n.layout?.billingFields?.street?.label,
664
- maxLength: n.layout?.billingFields?.street?.maxLength
29
+ enabled: o.layout?.billingFields?.street?.enabled ?? !1,
30
+ label: o.layout?.billingFields?.street?.label,
31
+ maxLength: o.layout?.billingFields?.street?.maxLength
665
32
  },
666
33
  city: {
667
- enabled: n.layout?.billingFields?.city?.enabled ?? !1,
668
- label: n.layout?.billingFields?.city?.label
34
+ enabled: o.layout?.billingFields?.city?.enabled ?? !1,
35
+ label: o.layout?.billingFields?.city?.label
669
36
  },
670
37
  state: {
671
- enabled: n.layout?.billingFields?.state?.enabled ?? !1,
672
- label: n.layout?.billingFields?.state?.label,
673
- hiddenForCountries: n.layout?.billingFields?.state?.hiddenForCountries
38
+ enabled: o.layout?.billingFields?.state?.enabled ?? !1,
39
+ label: o.layout?.billingFields?.state?.label,
40
+ hiddenForCountries: o.layout?.billingFields?.state?.hiddenForCountries
674
41
  },
675
42
  zipCode: {
676
- enabled: n.layout?.billingFields?.zipCode?.enabled ?? !1,
677
- label: n.layout?.billingFields?.zipCode?.label
43
+ enabled: o.layout?.billingFields?.zipCode?.enabled ?? !1,
44
+ label: o.layout?.billingFields?.zipCode?.label
678
45
  },
679
46
  firstName: {
680
- enabled: n.layout?.billingFields?.firstName?.enabled ?? !1,
681
- label: n.layout?.billingFields?.firstName?.label
47
+ enabled: o.layout?.billingFields?.firstName?.enabled ?? !1,
48
+ label: o.layout?.billingFields?.firstName?.label
682
49
  },
683
50
  lastName: {
684
- enabled: n.layout?.billingFields?.lastName?.enabled ?? !1,
685
- label: n.layout?.billingFields?.lastName?.label
51
+ enabled: o.layout?.billingFields?.lastName?.enabled ?? !1,
52
+ label: o.layout?.billingFields?.lastName?.label
686
53
  },
687
54
  country: {
688
- enabled: n.layout?.billingFields?.country?.enabled ?? !1,
689
- label: n.layout?.billingFields?.country?.label,
690
- options: n.layout?.billingFields?.country?.options
55
+ enabled: o.layout?.billingFields?.country?.enabled ?? !1,
56
+ label: o.layout?.billingFields?.country?.label,
57
+ options: o.layout?.billingFields?.country?.options
691
58
  }
692
59
  },
693
- shippingFields: n.layout?.shippingFields ? {
60
+ shippingFields: o.layout?.shippingFields ? {
694
61
  street: {
695
- enabled: n.layout.shippingFields.street?.enabled ?? !1,
696
- label: n.layout.shippingFields.street?.label,
697
- maxLength: n.layout.shippingFields.street?.maxLength
62
+ enabled: o.layout.shippingFields.street?.enabled ?? !1,
63
+ label: o.layout.shippingFields.street?.label,
64
+ maxLength: o.layout.shippingFields.street?.maxLength
698
65
  },
699
66
  firstName: {
700
- enabled: n.layout.shippingFields.firstName?.enabled ?? !1,
701
- label: n.layout.shippingFields.firstName?.label
67
+ enabled: o.layout.shippingFields.firstName?.enabled ?? !1,
68
+ label: o.layout.shippingFields.firstName?.label
702
69
  },
703
70
  lastName: {
704
- enabled: n.layout.shippingFields.lastName?.enabled ?? !1,
705
- label: n.layout.shippingFields.lastName?.label
71
+ enabled: o.layout.shippingFields.lastName?.enabled ?? !1,
72
+ label: o.layout.shippingFields.lastName?.label
706
73
  },
707
74
  city: {
708
- enabled: n.layout.shippingFields.city?.enabled ?? !1,
709
- label: n.layout.shippingFields.city?.label
75
+ enabled: o.layout.shippingFields.city?.enabled ?? !1,
76
+ label: o.layout.shippingFields.city?.label
710
77
  },
711
78
  state: {
712
- enabled: n.layout.shippingFields.state?.enabled ?? !1,
713
- label: n.layout.shippingFields.state?.label,
714
- hiddenForCountries: n.layout.shippingFields.state?.hiddenForCountries
79
+ enabled: o.layout.shippingFields.state?.enabled ?? !1,
80
+ label: o.layout.shippingFields.state?.label,
81
+ hiddenForCountries: o.layout.shippingFields.state?.hiddenForCountries
715
82
  },
716
83
  zipCode: {
717
- enabled: n.layout.shippingFields.zipCode?.enabled ?? !1,
718
- label: n.layout.shippingFields.zipCode?.label
84
+ enabled: o.layout.shippingFields.zipCode?.enabled ?? !1,
85
+ label: o.layout.shippingFields.zipCode?.label
719
86
  },
720
87
  country: {
721
- enabled: n.layout.shippingFields.country?.enabled ?? !1,
722
- label: n.layout.shippingFields.country?.label,
723
- options: n.layout.shippingFields.country?.options
88
+ enabled: o.layout.shippingFields.country?.enabled ?? !1,
89
+ label: o.layout.shippingFields.country?.label,
90
+ options: o.layout.shippingFields.country?.options
724
91
  }
725
92
  } : void 0
726
93
  },
727
94
  appearance: {
728
- additionalPaymentMethods: n.additionalPaymentMethods ? {
729
- applePay: n.additionalPaymentMethods.applePay ? {
730
- displayName: n.additionalPaymentMethods.applePay.displayName,
731
- requiredBillingContactFields: n.additionalPaymentMethods.applePay.requiredBillingContactFields,
732
- requiredShippingContactFields: n.additionalPaymentMethods.applePay.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
733
100
  } : void 0
734
101
  } : void 0
735
102
  }
736
103
  };
737
104
  }
738
- function dt({
739
- appearance: n
105
+ function ue({
106
+ appearance: o
740
107
  }) {
741
- const e = me({
108
+ const e = q({
742
109
  checkoutProfile: void 0,
743
110
  isLoading: !0,
744
111
  error: null
745
112
  });
746
- if (n) {
747
- const s = G(n);
113
+ if (o) {
114
+ const s = I(o);
748
115
  return Promise.resolve().then(() => {
749
116
  e.setState({
750
117
  checkoutProfile: s,
@@ -755,7 +122,7 @@ function dt({
755
122
  getState: e.getState.bind(e),
756
123
  subscribe: e.subscribe.bind(e),
757
124
  updateProfile: (a) => {
758
- const i = G(a);
125
+ const i = I(a);
759
126
  e.setState({
760
127
  checkoutProfile: i,
761
128
  isLoading: !1,
@@ -804,7 +171,7 @@ function dt({
804
171
  getState: e.getState.bind(e),
805
172
  subscribe: e.subscribe.bind(e),
806
173
  updateProfile: (s) => {
807
- const a = G(s);
174
+ const a = I(s);
808
175
  e.setState({
809
176
  checkoutProfile: a,
810
177
  isLoading: !1,
@@ -815,8 +182,8 @@ function dt({
815
182
  }
816
183
  };
817
184
  }
818
- const ct = () => {
819
- const n = ye(), e = me({
185
+ const me = () => {
186
+ const o = W(), e = q({
820
187
  formData: {
821
188
  name: "",
822
189
  email: "",
@@ -833,88 +200,88 @@ const ct = () => {
833
200
  cardCvv: !1
834
201
  },
835
202
  isValid: !1
836
- }), t = (l, p, y, u) => {
203
+ }), t = (l, m, y, u) => {
837
204
  if (l === "cardCvv")
838
- return n.cardCvv(p, y);
205
+ return o.cardCvv(m, y);
839
206
  if (l === "phoneNumber" && u)
840
- return n.phoneNumber(p, u);
841
- const g = n[l];
842
- return g?.(p);
207
+ return o.phoneNumber(m, u);
208
+ const p = o[l];
209
+ return p?.(m);
843
210
  }, s = (l) => {
844
- const p = {};
211
+ const m = {};
845
212
  return Object.keys(l).forEach((u) => {
846
- const g = l[u];
847
- if (g === void 0) return;
213
+ const p = l[u];
214
+ if (p === void 0) return;
848
215
  let h;
849
- u === "cardCvv" ? h = t(u, g, l.cardNumber) : u === "phoneNumber" ? h = t(
216
+ u === "cardCvv" ? h = t(u, p, l.cardNumber) : u === "phoneNumber" ? h = t(
850
217
  u,
851
- g,
218
+ p,
852
219
  void 0,
853
220
  l.phoneCountryCode
854
- ) : h = t(u, g), h && (p[u] = h);
221
+ ) : h = t(u, p), h && (m[u] = h);
855
222
  }), [
856
223
  "billingAddress",
857
224
  "shippingAddress"
858
225
  ].forEach((u) => {
859
- const g = l[u];
860
- if (g && typeof g == "object") {
226
+ const p = l[u];
227
+ if (p && typeof p == "object") {
861
228
  const h = {};
862
- Object.keys(g).forEach(
229
+ Object.keys(p).forEach(
863
230
  (b) => {
864
- const f = g[b];
231
+ const f = p[b];
865
232
  if (f === void 0) return;
866
- const v = n[b];
867
- if (v) {
868
- const E = b === "state" ? n.state(f, g.country) : v(
233
+ const S = o[b];
234
+ if (S) {
235
+ const C = b === "state" ? o.state(f, p.country) : S(
869
236
  f
870
237
  );
871
- E && (h[b] = E);
238
+ C && (h[b] = C);
872
239
  }
873
240
  }
874
- ), Object.keys(h).length > 0 && (p[u] = h);
241
+ ), Object.keys(h).length > 0 && (m[u] = h);
875
242
  }
876
- }), p;
243
+ }), m;
877
244
  }, a = (l) => {
878
- const p = s(l);
879
- return Object.keys(p).length === 0;
880
- }, i = "billingAddress.", r = "shippingAddress.", o = (l) => l.startsWith(i) ? {
245
+ const m = s(l);
246
+ return Object.keys(m).length === 0;
247
+ }, i = "billingAddress.", n = "shippingAddress.", r = (l) => l.startsWith(i) ? {
881
248
  parent: "billingAddress",
882
249
  field: l.slice(i.length)
883
- } : l.startsWith(r) ? {
250
+ } : l.startsWith(n) ? {
884
251
  parent: "shippingAddress",
885
- field: l.slice(r.length)
886
- } : null, d = (l, p, y, u) => {
887
- const g = { ...l };
252
+ field: l.slice(n.length)
253
+ } : null, d = (l, m, y, u) => {
254
+ const p = { ...l };
888
255
  if (u)
889
- g[p] = {
890
- ...g[p],
256
+ p[m] = {
257
+ ...p[m],
891
258
  [y]: u
892
259
  };
893
260
  else {
894
261
  const h = {
895
- ...g[p]
262
+ ...p[m]
896
263
  };
897
- delete h[y], Object.keys(h).length === 0 ? delete g[p] : g[p] = h;
264
+ delete h[y], Object.keys(h).length === 0 ? delete p[m] : p[m] = h;
898
265
  }
899
- return g;
900
- }, c = (l, p) => {
266
+ return p;
267
+ }, c = (l, m) => {
901
268
  const y = e.getState();
902
- let u = p;
903
- const g = o(l);
904
- if (!g && l in j)
269
+ let u = m;
270
+ const p = r(l);
271
+ if (!p && l in L)
905
272
  if (l === "cardCvv") {
906
- const v = be(y.formData.cardNumber) === "amex" ? 4 : 3;
907
- u = j.cardCvv(p, v);
273
+ const S = Y(y.formData.cardNumber) === "amex" ? 4 : 3;
274
+ u = L.cardCvv(m, S);
908
275
  } else
909
- u = j[l](p);
276
+ u = L[l](m);
910
277
  let h;
911
- if (g) {
912
- const { parent: f, field: v } = g;
278
+ if (p) {
279
+ const { parent: f, field: S } = p;
913
280
  h = {
914
281
  ...y.formData,
915
282
  [f]: {
916
283
  ...y.formData[f] ?? {},
917
- [v]: u
284
+ [S]: u
918
285
  }
919
286
  };
920
287
  } else
@@ -933,18 +300,18 @@ const ct = () => {
933
300
  f ? b.phoneNumber = f : delete b.phoneNumber;
934
301
  }
935
302
  if (y.touched[l])
936
- if (g) {
937
- const { parent: f, field: v } = g, E = h[f];
938
- let N;
939
- if (v === "state")
940
- N = n.state(u, E?.country);
303
+ if (p) {
304
+ const { parent: f, field: S } = p, C = h[f];
305
+ let M;
306
+ if (S === "state")
307
+ M = o.state(u, C?.country);
941
308
  else {
942
- const x = n[v];
943
- N = x ? x(
309
+ const k = o[S];
310
+ M = k ? k(
944
311
  u
945
312
  ) : void 0;
946
313
  }
947
- b = d(b, f, v, N);
314
+ b = d(b, f, S, M);
948
315
  } else {
949
316
  let f;
950
317
  l === "cardCvv" ? f = t(l, u, h.cardNumber) : l === "phoneNumber" ? f = t(
@@ -959,53 +326,53 @@ const ct = () => {
959
326
  errors: b,
960
327
  isValid: a(h)
961
328
  });
962
- }, m = (l, p) => {
963
- const y = e.getState(), u = o(l);
329
+ }, g = (l, m) => {
330
+ const y = e.getState(), u = r(l);
964
331
  if (u) {
965
- const { parent: f, field: v } = u, E = {
332
+ const { parent: f, field: S } = u, C = {
966
333
  ...y.formData,
967
334
  [f]: {
968
335
  ...y.formData[f] ?? {},
969
- [v]: p
336
+ [S]: m
970
337
  }
971
338
  };
972
- let N;
973
- if (v === "state") {
974
- const V = E[f];
975
- N = n.state(p, V?.country);
339
+ let M;
340
+ if (S === "state") {
341
+ const D = C[f];
342
+ M = o.state(m, D?.country);
976
343
  } else {
977
- const V = n[v];
978
- N = V ? V(p) : void 0;
344
+ const D = o[S];
345
+ M = D ? D(m) : void 0;
979
346
  }
980
- const x = d(y.errors, f, v, N);
347
+ const k = d(y.errors, f, S, M);
981
348
  e.setState({
982
- formData: E,
349
+ formData: C,
983
350
  touched: {
984
351
  ...y.touched,
985
352
  [l]: !0
986
353
  },
987
- errors: x,
988
- isValid: a(E)
354
+ errors: k,
355
+ isValid: a(C)
989
356
  });
990
357
  return;
991
358
  }
992
- const g = {
359
+ const p = {
993
360
  ...y.touched,
994
361
  [l]: !0
995
362
  };
996
363
  let h;
997
- l === "cardCvv" ? h = t(l, p, y.formData.cardNumber) : l === "phoneNumber" ? h = t(
364
+ l === "cardCvv" ? h = t(l, m, y.formData.cardNumber) : l === "phoneNumber" ? h = t(
998
365
  l,
999
- p,
366
+ m,
1000
367
  void 0,
1001
368
  y.formData.phoneCountryCode
1002
- ) : h = t(l, p);
369
+ ) : h = t(l, m);
1003
370
  const b = { ...y.errors };
1004
371
  h ? b[l] = h : delete b[l], e.setState({
1005
- touched: g,
372
+ touched: p,
1006
373
  errors: b
1007
374
  });
1008
- }, S = (l) => {
375
+ }, v = (l) => {
1009
376
  const y = {
1010
377
  ...e.getState().formData,
1011
378
  ...l
@@ -1019,37 +386,23 @@ const ct = () => {
1019
386
  getFormState: e.getState.bind(e),
1020
387
  subscribe: e.subscribe.bind(e),
1021
388
  handleChange: c,
1022
- handleBlur: m,
1023
- setFormData: S,
389
+ handleBlur: g,
390
+ setFormData: v,
1024
391
  reset: e.resetState.bind(e)
1025
392
  };
1026
- }, ht = "https://fonts.googleapis.com/css2", ut = /src:\s*url\(([^)]+\.woff2[^)]*)\)/, mt = /\/\*\s*latin\s*\*\/\s*@font-face\s*\{[^}]*src:\s*url\(([^)]+\.woff2[^)]*)\)[^}]*\}/;
1027
- async function pt(n) {
1028
- if (!n) return null;
1029
- const e = n.trim().replace(/\s+/g, "+"), t = `${ht}?family=${e}:wght@400;700&display=swap`;
1030
- try {
1031
- const s = await fetch(t);
1032
- if (!s.ok) return null;
1033
- const a = await s.text(), i = mt.exec(a);
1034
- if (i?.[1]) return i[1];
1035
- const r = ut.exec(a);
1036
- return r?.[1] ? r[1] : null;
1037
- } catch {
1038
- return null;
1039
- }
1040
- }
1041
- function gt(n) {
1042
- if (!n) return !1;
1043
- const { billingFields: e, shippingFields: t } = n, s = e && Object.values(e).some((i) => i?.enabled), a = t && Object.values(t).some((i) => i?.enabled);
393
+ };
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);
1044
397
  return !!(s || a);
1045
398
  }
1046
- function J(n) {
1047
- if (!n) return !1;
1048
- const { billingFields: e, shippingFields: t } = n, s = e?.firstName?.enabled && e?.lastName?.enabled, a = t?.firstName?.enabled && t?.lastName?.enabled;
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;
1049
402
  return !!(s || a);
1050
403
  }
1051
- const O = /* @__PURE__ */ new Set(["US", "CA"]);
1052
- class ce extends A {
404
+ const V = /* @__PURE__ */ new Set(["US", "CA"]);
405
+ class O extends P {
1053
406
  inputs = /* @__PURE__ */ new Map();
1054
407
  type;
1055
408
  onChange;
@@ -1064,16 +417,16 @@ class ce extends A {
1064
417
  stateStyles;
1065
418
  constructor(e) {
1066
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;
1067
- const { title: t, checkoutProfile: s, fieldsConfig: a, values: i, errors: r, touched: o } = e;
420
+ const { title: t, checkoutProfile: s, fieldsConfig: a, values: i, errors: n, touched: r } = e;
1068
421
  if (this.grouped) {
1069
422
  const d = document.createElement("h3");
1070
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);
1071
424
  }
1072
- 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, r, o);
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);
1073
426
  }
1074
427
  borderRadius(e, t, s, a, i) {
1075
- const r = (o) => o ? `${e}px` : "0px";
1076
- return `${r(t)} ${r(s)} ${r(a)} ${r(i)}`;
428
+ const n = (r) => r ? `${e}px` : "0px";
429
+ return `${n(t)} ${n(s)} ${n(a)} ${n(i)}`;
1077
430
  }
1078
431
  createFields(e, t, s, a, i) {
1079
432
  if (!this.grouped) {
@@ -1086,7 +439,7 @@ class ce extends A {
1086
439
  );
1087
440
  return;
1088
441
  }
1089
- const r = e.styles.borderRadius, o = {
442
+ const n = e.styles.borderRadius, r = {
1090
443
  color: e.styles.textColor,
1091
444
  fontSize: e.styles.fontSize,
1092
445
  fontFamily: e.styles.fontFamily
@@ -1094,14 +447,14 @@ class ce extends A {
1094
447
  t.street?.enabled && d.push({ kind: "street" });
1095
448
  const c = [];
1096
449
  t.firstName?.enabled && c.push("firstName"), t.lastName?.enabled && c.push("lastName"), c.length > 0 && d.push({ kind: "name", fields: c }), t.country?.enabled && d.push({ kind: "country" });
1097
- const m = [];
1098
- t.city?.enabled && m.push("city"), t.zipCode?.enabled && m.push("zipCode"), m.length > 0 && d.push({ kind: "cityZip", fields: m }), t.state?.enabled && d.push({ kind: "state" });
1099
- const S = d.length;
1100
- d.forEach((l, p) => {
1101
- const y = p === 0, u = p === S - 1, g = (h, b) => ({
1102
- ...o,
450
+ const g = [];
451
+ t.city?.enabled && g.push("city"), t.zipCode?.enabled && g.push("zipCode"), g.length > 0 && d.push({ kind: "cityZip", fields: g }), t.state?.enabled && d.push({ kind: "state" });
452
+ const v = d.length;
453
+ d.forEach((l, m) => {
454
+ const y = m === 0, u = m === v - 1, p = (h, b) => ({
455
+ ...r,
1103
456
  borderRadius: this.borderRadius(
1104
- r,
457
+ n,
1105
458
  y && h,
1106
459
  y && b,
1107
460
  u && b,
@@ -1115,7 +468,7 @@ class ce extends A {
1115
468
  s.street,
1116
469
  a.street,
1117
470
  i.street,
1118
- g(!0, !0),
471
+ p(!0, !0),
1119
472
  "street-address",
1120
473
  t.street?.maxLength
1121
474
  );
@@ -1125,28 +478,28 @@ class ce extends A {
1125
478
  if (l.kind === "name") {
1126
479
  const h = this.createRow(l.fields.map(() => "half")), b = l.fields.length === 1;
1127
480
  if (l.fields.includes("firstName")) {
1128
- const f = b || l.fields[l.fields.length - 1] === "firstName", v = this.createInput(
481
+ const f = b || l.fields[l.fields.length - 1] === "firstName", S = this.createInput(
1129
482
  "firstName",
1130
483
  t.firstName?.label ?? this.translationFunc("address.firstName"),
1131
484
  s.firstName,
1132
485
  a.firstName,
1133
486
  i.firstName,
1134
- g(!0, f),
487
+ p(!0, f),
1135
488
  "given-name"
1136
489
  );
1137
- this.inputs.set("firstName", v), h.appendChild(v.getElement());
490
+ this.inputs.set("firstName", S), h.appendChild(S.getElement());
1138
491
  }
1139
492
  if (l.fields.includes("lastName")) {
1140
- const f = b || l.fields[0] === "lastName", v = this.createInput(
493
+ const f = b || l.fields[0] === "lastName", S = this.createInput(
1141
494
  "lastName",
1142
495
  t.lastName?.label ?? this.translationFunc("address.lastName"),
1143
496
  s.lastName,
1144
497
  a.lastName,
1145
498
  i.lastName,
1146
- g(f, !0),
499
+ p(f, !0),
1147
500
  "family-name"
1148
501
  );
1149
- this.inputs.set("lastName", v), h.appendChild(v.getElement());
502
+ this.inputs.set("lastName", S), h.appendChild(S.getElement());
1150
503
  }
1151
504
  this.fieldsContainer.appendChild(h);
1152
505
  return;
@@ -1156,7 +509,7 @@ class ce extends A {
1156
509
  s.country,
1157
510
  a.country,
1158
511
  i.country,
1159
- g(!0, !0),
512
+ p(!0, !0),
1160
513
  t.country?.options,
1161
514
  t.country?.label
1162
515
  );
@@ -1166,38 +519,38 @@ class ce extends A {
1166
519
  if (l.kind === "cityZip") {
1167
520
  const h = this.createRow(l.fields.map(() => "half")), b = l.fields.length === 1;
1168
521
  if (l.fields.includes("city")) {
1169
- const f = b || l.fields[l.fields.length - 1] === "city", v = this.createInput(
522
+ const f = b || l.fields[l.fields.length - 1] === "city", S = this.createInput(
1170
523
  "city",
1171
524
  t.city?.label ?? this.translationFunc("address.townCity"),
1172
525
  s.city,
1173
526
  a.city,
1174
527
  i.city,
1175
- g(!0, f),
528
+ p(!0, f),
1176
529
  "address-level2"
1177
530
  );
1178
- this.inputs.set("city", v), h.appendChild(v.getElement());
531
+ this.inputs.set("city", S), h.appendChild(S.getElement());
1179
532
  }
1180
533
  if (l.fields.includes("zipCode")) {
1181
- const f = b || l.fields[0] === "zipCode", v = this.createInput(
534
+ const f = b || l.fields[0] === "zipCode", S = this.createInput(
1182
535
  "zipCode",
1183
536
  t.zipCode?.label ?? this.translationFunc("address.postalCode"),
1184
537
  s.zipCode,
1185
538
  a.zipCode,
1186
539
  i.zipCode,
1187
- g(f, !0),
540
+ p(f, !0),
1188
541
  "postal-code"
1189
542
  );
1190
- this.inputs.set("zipCode", v), h.appendChild(v.getElement());
543
+ this.inputs.set("zipCode", S), h.appendChild(S.getElement());
1191
544
  }
1192
545
  this.fieldsContainer.appendChild(h);
1193
546
  return;
1194
547
  }
1195
548
  if (l.kind === "state") {
1196
549
  const h = this.createRow(["full"]);
1197
- if (this.stateFieldConfig = t.state, this.stateRow = h, this.stateStyles = g(!0, !0), this.currentCountry = s.country, t.state?.hiddenForCountries?.includes(
550
+ if (this.stateFieldConfig = t.state, this.stateRow = h, this.stateStyles = p(!0, !0), this.currentCountry = s.country, t.state?.hiddenForCountries?.includes(
1198
551
  s.country
1199
- ) && (h.style.display = "none"), O.has(s.country)) {
1200
- const v = this.createStateSelect(
552
+ ) && (h.style.display = "none"), V.has(s.country)) {
553
+ const S = this.createStateSelect(
1201
554
  s.state,
1202
555
  a.state,
1203
556
  i.state,
@@ -1205,9 +558,9 @@ class ce extends A {
1205
558
  s.country,
1206
559
  t.state?.label
1207
560
  );
1208
- this.inputs.set("state", v), h.appendChild(v.getElement());
561
+ this.inputs.set("state", S), h.appendChild(S.getElement());
1209
562
  } else {
1210
- const v = this.createInput(
563
+ const S = this.createInput(
1211
564
  "state",
1212
565
  t.state?.label ?? this.translationFunc("address.state"),
1213
566
  s.state,
@@ -1216,7 +569,7 @@ class ce extends A {
1216
569
  this.stateStyles,
1217
570
  "address-level1"
1218
571
  );
1219
- this.inputs.set("state", v), h.appendChild(v.getElement());
572
+ this.inputs.set("state", S), h.appendChild(S.getElement());
1220
573
  }
1221
574
  this.fieldsContainer.appendChild(h);
1222
575
  }
@@ -1226,31 +579,31 @@ class ce extends A {
1226
579
  const t = document.createElement("div");
1227
580
  return t.className = `address-row address-row-${e.length === 1 ? "single" : "double"}`, t;
1228
581
  }
1229
- createInput(e, t, s, a, i, r, o, d) {
1230
- const c = `${this.type}Address.${e}`, m = new pe({
582
+ createInput(e, t, s, a, i, n, r, d) {
583
+ const c = `${this.type}Address.${e}`, g = new K({
1231
584
  name: c,
1232
585
  error: !1,
1233
586
  errorMsg: void 0,
1234
- styles: r,
587
+ styles: n,
1235
588
  maxLength: d,
1236
589
  ...this.grouped ? { placeholder: t } : {
1237
590
  label: t,
1238
591
  placeholder: (() => {
1239
- const S = `address.placeholder.${e}`, l = this.translationFunc(S);
1240
- return l !== S ? l : t;
592
+ const v = `address.placeholder.${e}`, l = this.translationFunc(v);
593
+ return l !== v ? l : t;
1241
594
  })()
1242
595
  },
1243
596
  value: s,
1244
- autocomplete: o,
1245
- onChange: (S) => {
1246
- const l = S.target.value;
597
+ autocomplete: r,
598
+ onChange: (v) => {
599
+ const l = v.target.value;
1247
600
  if (d && l.length >= d) {
1248
- const p = this.translationFunc("validation.maxLengthExceeded");
1249
- m.setError(!0, p.replace("{{max}}", String(d)));
601
+ const m = this.translationFunc("validation.maxLengthExceeded");
602
+ g.setError(!0, m.replace("{{max}}", String(d)));
1250
603
  } else
1251
- m.setError(!1);
604
+ g.setError(!1);
1252
605
  this.onChange(
1253
- P({
606
+ N({
1254
607
  type: "input",
1255
608
  target: {
1256
609
  name: c,
@@ -1260,49 +613,49 @@ class ce extends A {
1260
613
  );
1261
614
  }
1262
615
  });
1263
- return m.addEventListener("blur", (S) => {
616
+ return g.addEventListener("blur", (v) => {
1264
617
  this.onBlur(
1265
- P({
618
+ N({
1266
619
  type: "blur",
1267
620
  target: {
1268
621
  name: c,
1269
- value: S.target.value
622
+ value: v.target.value
1270
623
  }
1271
624
  })
1272
625
  );
1273
- }), m;
626
+ }), g;
1274
627
  }
1275
- createCountrySelect(e, t, s, a, i, r) {
1276
- const o = `${this.type}Address.country`, d = ve(i, this.locale), c = new _({
1277
- name: o,
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,
1278
631
  error: !1,
1279
632
  errorMsg: void 0,
1280
633
  styles: a,
1281
634
  placeholder: this.translationFunc("address.chooseCountry"),
1282
635
  ...!this.grouped && {
1283
- label: r ?? this.translationFunc("address.chooseCountry")
636
+ label: n ?? this.translationFunc("address.chooseCountry")
1284
637
  },
1285
638
  value: e,
1286
639
  options: d,
1287
640
  autocomplete: "country",
1288
- onChange: (m) => {
641
+ onChange: (g) => {
1289
642
  c.setError(!1);
1290
- const S = m.target.value;
643
+ const v = g.target.value;
1291
644
  this.onChange(
1292
- P({
645
+ N({
1293
646
  type: "change",
1294
- target: { name: o, value: S }
647
+ target: { name: r, value: v }
1295
648
  })
1296
- ), this.handleCountryChange(S);
649
+ ), this.handleCountryChange(v);
1297
650
  }
1298
651
  });
1299
- return c.addEventListener("blur", (m) => {
652
+ return c.addEventListener("blur", (g) => {
1300
653
  this.onBlur(
1301
- P({
654
+ N({
1302
655
  type: "blur",
1303
656
  target: {
1304
- name: o,
1305
- value: m.target.value
657
+ name: r,
658
+ value: g.target.value
1306
659
  }
1307
660
  })
1308
661
  );
@@ -1317,26 +670,26 @@ class ce extends A {
1317
670
  return;
1318
671
  }
1319
672
  if (!a && s && (this.stateRow.style.display = ""), a) return;
1320
- const i = this.inputs.get("state") instanceof _, r = O.has(e);
1321
- if (i && r) {
1322
- const o = this.inputs.get("state");
1323
- if (o instanceof _) {
1324
- const d = e === "CA" ? "CA" : "US", c = ee(d), m = d === "CA" ? this.translationFunc("address.chooseProvince") : this.translationFunc("address.chooseState");
1325
- o.setOptions(c, m);
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);
1326
679
  }
1327
680
  this.clearStateValue();
1328
681
  return;
1329
682
  }
1330
- if (i !== r) {
683
+ if (i !== n) {
1331
684
  this.rebuildStateField(e), this.clearStateValue();
1332
685
  return;
1333
686
  }
1334
- !i && !r && t !== e && this.clearStateValue();
687
+ !i && !n && t !== e && this.clearStateValue();
1335
688
  }
1336
689
  rebuildStateField(e) {
1337
690
  if (!this.stateRow || !this.stateStyles) return;
1338
691
  const t = this.inputs.get("state");
1339
- if (t && (t.getElement().remove(), this.inputs.delete("state")), O.has(e)) {
692
+ if (t && (t.getElement().remove(), this.inputs.delete("state")), V.has(e)) {
1340
693
  const a = this.createStateSelect(
1341
694
  "",
1342
695
  void 0,
@@ -1364,64 +717,64 @@ class ce extends A {
1364
717
  e && e.setValue("");
1365
718
  const t = `${this.type}Address.state`;
1366
719
  this.onChange(
1367
- P({
720
+ N({
1368
721
  type: "input",
1369
722
  target: { name: t, value: "" },
1370
723
  detail: { programmatic: !0 }
1371
724
  })
1372
725
  );
1373
726
  }
1374
- createStateSelect(e, t, s, a, i, r) {
1375
- const o = `${this.type}Address.state`, d = i === "CA" ? "CA" : "US", c = ee(d), m = d === "CA" ? this.translationFunc("address.chooseProvince") : this.translationFunc("address.chooseState"), S = new _({
1376
- name: o,
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,
1377
730
  error: !1,
1378
731
  errorMsg: void 0,
1379
732
  styles: a,
1380
- placeholder: m,
1381
- ...!this.grouped && { label: r ?? m },
733
+ placeholder: g,
734
+ ...!this.grouped && { label: n ?? g },
1382
735
  value: e,
1383
736
  options: c,
1384
737
  autocomplete: "address-level1",
1385
738
  onChange: (l) => {
1386
- S.setError(!1), this.onChange(
1387
- P({
739
+ v.setError(!1), this.onChange(
740
+ N({
1388
741
  type: "change",
1389
742
  target: {
1390
- name: o,
743
+ name: r,
1391
744
  value: l.target.value
1392
745
  }
1393
746
  })
1394
747
  );
1395
748
  }
1396
749
  });
1397
- return S.addEventListener("blur", (l) => {
750
+ return v.addEventListener("blur", (l) => {
1398
751
  this.onBlur(
1399
- P({
752
+ N({
1400
753
  type: "blur",
1401
754
  target: {
1402
- name: o,
755
+ name: r,
1403
756
  value: l.target.value
1404
757
  }
1405
758
  })
1406
759
  );
1407
- }), S;
760
+ }), v;
1408
761
  }
1409
762
  createUngroupedFields(e, t, s, a, i) {
1410
- const r = e.styles.borderRadius, o = {
763
+ const n = e.styles.borderRadius, r = {
1411
764
  color: e.styles.textColor,
1412
765
  fontSize: e.styles.fontSize,
1413
766
  fontFamily: e.styles.fontFamily,
1414
- borderRadius: `${r}px`
1415
- }, d = (c, m, S, l) => {
767
+ borderRadius: `${n}px`
768
+ }, d = (c, g, v, l) => {
1416
769
  if (!t[c]?.enabled) return;
1417
- const p = t[c]?.label ?? this.translationFunc(m), y = this.createRow(["full"]), u = this.createInput(
770
+ const m = t[c]?.label ?? this.translationFunc(g), y = this.createRow(["full"]), u = this.createInput(
1418
771
  c,
1419
- p,
772
+ m,
1420
773
  s[c],
1421
774
  a[c],
1422
775
  i[c],
1423
- o,
1424
- S,
776
+ r,
777
+ v,
1425
778
  l
1426
779
  );
1427
780
  this.inputs.set(c, u), y.appendChild(u.getElement()), this.fieldsContainer.appendChild(y);
@@ -1432,44 +785,44 @@ class ce extends A {
1432
785
  "street-address",
1433
786
  t.street?.maxLength
1434
787
  ), d("city", "address.townCity", "address-level2"), t.country?.enabled) {
1435
- const c = t.country?.label ?? this.translationFunc("address.chooseCountry"), m = this.createRow(["full"]), S = this.createCountrySelect(
788
+ const c = t.country?.label ?? this.translationFunc("address.chooseCountry"), g = this.createRow(["full"]), v = this.createCountrySelect(
1436
789
  s.country,
1437
790
  a.country,
1438
791
  i.country,
1439
- o,
792
+ r,
1440
793
  t.country?.options,
1441
794
  c
1442
795
  );
1443
- this.inputs.set("country", S), m.appendChild(S.getElement()), this.fieldsContainer.appendChild(m);
796
+ this.inputs.set("country", v), g.appendChild(v.getElement()), this.fieldsContainer.appendChild(g);
1444
797
  }
1445
798
  if (t.state?.enabled) {
1446
799
  this.stateFieldConfig = t.state;
1447
800
  const c = this.createRow(["full"]);
1448
- this.stateRow = c, this.stateStyles = o, this.currentCountry = s.country, t.state?.hiddenForCountries?.includes(
801
+ this.stateRow = c, this.stateStyles = r, this.currentCountry = s.country, t.state?.hiddenForCountries?.includes(
1449
802
  s.country
1450
803
  ) && (c.style.display = "none");
1451
- const S = O.has(s.country), l = t.state?.label ?? this.translationFunc("address.state");
1452
- if (S) {
1453
- const p = this.createStateSelect(
804
+ const v = V.has(s.country), l = t.state?.label ?? this.translationFunc("address.state");
805
+ if (v) {
806
+ const m = this.createStateSelect(
1454
807
  s.state,
1455
808
  a.state,
1456
809
  i.state,
1457
- o,
810
+ r,
1458
811
  s.country,
1459
812
  l
1460
813
  );
1461
- this.inputs.set("state", p), c.appendChild(p.getElement());
814
+ this.inputs.set("state", m), c.appendChild(m.getElement());
1462
815
  } else {
1463
- const p = this.createInput(
816
+ const m = this.createInput(
1464
817
  "state",
1465
818
  l,
1466
819
  s.state,
1467
820
  a.state,
1468
821
  i.state,
1469
- o,
822
+ r,
1470
823
  "address-level1"
1471
824
  );
1472
- this.inputs.set("state", p), c.appendChild(p.getElement());
825
+ this.inputs.set("state", m), c.appendChild(m.getElement());
1473
826
  }
1474
827
  this.fieldsContainer.appendChild(c);
1475
828
  }
@@ -1507,10 +860,10 @@ class ce extends A {
1507
860
  updateField(e, t, s, a) {
1508
861
  const i = this.inputs.get(e);
1509
862
  if (!i) return;
1510
- const r = i.getElement().querySelector("input") || i.getElement().querySelector("select"), o = i.getValue();
1511
- !(document.activeElement === r) && !(t === "" && o !== "") && this.setValue(e, t);
1512
- const m = !!(a && s);
1513
- this.setError(e, m, s);
863
+ const n = i.getElement().querySelector("input") || i.getElement().querySelector("select"), r = i.getValue();
864
+ !(document.activeElement === n) && !(t === "" && r !== "") && this.setValue(e, t);
865
+ const g = !!(a && s);
866
+ this.setError(e, g, s);
1514
867
  }
1515
868
  updateAllFields(e, t, s) {
1516
869
  Object.keys(e).forEach((a) => {
@@ -1527,7 +880,7 @@ class ce extends A {
1527
880
  e && e.focus();
1528
881
  }
1529
882
  }
1530
- class ft {
883
+ class ge {
1531
884
  input = null;
1532
885
  isVgsMode;
1533
886
  vgsWrapper = null;
@@ -1541,18 +894,18 @@ class ft {
1541
894
  onChange: s,
1542
895
  onBlur: a,
1543
896
  errorMsg: i,
1544
- checkoutProfile: r,
1545
- translationFunc: o,
897
+ checkoutProfile: n,
898
+ translationFunc: r,
1546
899
  autocomplete: d = "cc-name",
1547
900
  isVgsMode: c = !1
1548
901
  } = e;
1549
- this.isVgsMode = c, this.wrapperElement = document.createElement("div"), c ? this.buildVgsLayout(r, o) : this.buildNativeLayout(
902
+ this.isVgsMode = c, this.wrapperElement = document.createElement("div"), c ? this.buildVgsLayout(n, r) : this.buildNativeLayout(
1550
903
  t,
1551
904
  s,
1552
905
  a,
1553
906
  i,
907
+ n,
1554
908
  r,
1555
- o,
1556
909
  d
1557
910
  );
1558
911
  }
@@ -1561,13 +914,13 @@ class ft {
1561
914
  a.style.marginBottom = "4px";
1562
915
  const i = document.createElement("label");
1563
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";
1564
- const r = document.createElement("div");
1565
- r.className = "vgs-field-skeleton", this.vgsWrapper.appendChild(r), 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 Se({ visible: !1 }), this.wrapperElement.appendChild(this.vgsHelperText.getElement());
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());
1566
919
  }
1567
- buildNativeLayout(e, t, s, a, i, r, o) {
1568
- this.input = new pe({
920
+ buildNativeLayout(e, t, s, a, i, n, r) {
921
+ this.input = new K({
1569
922
  name: "name",
1570
- label: r("cardholderNameLabel"),
923
+ label: n("cardholderNameLabel"),
1571
924
  error: !1,
1572
925
  errorMsg: a,
1573
926
  styles: {
@@ -1576,12 +929,12 @@ class ft {
1576
929
  fontSize: i.styles.fontSize,
1577
930
  fontFamily: i.styles.fontFamily
1578
931
  },
1579
- placeholder: r("cardholderNamePlaceholder"),
932
+ placeholder: n("cardholderNamePlaceholder"),
1580
933
  value: e,
1581
- autocomplete: o,
934
+ autocomplete: r,
1582
935
  onChange: (d) => {
1583
- const m = d.target.value, S = m.replace(/[^a-zA-Z\s\-'.]/g, "");
1584
- m !== S && this.input?.setValue(S), this.input?.setError(!1), this.trim(), t(d);
936
+ const g = d.target.value, v = g.replace(/[^a-zA-Z\s\-'.]/g, "");
937
+ g !== v && this.input?.setValue(v), this.input?.setError(!1), this.trim(), t(d);
1585
938
  }
1586
939
  }), this.input.addEventListener("blur", (d) => {
1587
940
  s(d);
@@ -1592,9 +945,9 @@ class ft {
1592
945
  }
1593
946
  handleVgsStateChange(e, t) {
1594
947
  if (!this.isVgsMode || !this.vgsWrapper) return;
1595
- const s = e[te.CARDHOLDER]?.isFocused;
948
+ const s = e[_.CARDHOLDER]?.isFocused;
1596
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;
1597
- const a = t[te.CARDHOLDER];
950
+ const a = t[_.CARDHOLDER];
1598
951
  a ? (this.vgsHelperText.setText(a), this.vgsHelperText.toggleVisibility(!0)) : this.vgsHelperText.toggleVisibility(!1);
1599
952
  }
1600
953
  hideFakePlaceholder() {
@@ -1629,7 +982,7 @@ class ft {
1629
982
  this.isVgsMode || this.input?.focus();
1630
983
  }
1631
984
  }
1632
- class ge extends A {
985
+ class j extends P {
1633
986
  constructor() {
1634
987
  super("div", ["skeleton-container"]), this.createSkeletonElements();
1635
988
  }
@@ -1637,35 +990,35 @@ class ge extends A {
1637
990
  this.appendChild(this.createPaymentMethodSkeleton()), this.appendChild(this.createPaymentSeparatorSkeleton());
1638
991
  }
1639
992
  createPaymentMethodSkeleton() {
1640
- const e = D.createDiv(["skeleton-field"]), t = D.createDiv([
993
+ const e = A.createDiv(["skeleton-field"]), t = A.createDiv([
1641
994
  "skeleton",
1642
995
  "skeleton-payment-method"
1643
996
  ]);
1644
997
  return e.appendChild(t), e;
1645
998
  }
1646
999
  createPaymentSeparatorSkeleton() {
1647
- const e = D.createDiv([
1000
+ const e = A.createDiv([
1648
1001
  "payment-separator_container"
1649
- ]), t = D.createDiv(["payment-separator__line"]), s = D.createDiv([
1002
+ ]), t = A.createDiv(["payment-separator__line"]), s = A.createDiv([
1650
1003
  "skeleton",
1651
1004
  "skeleton-separator-text"
1652
- ]), a = D.createDiv(["payment-separator__line"]);
1005
+ ]), a = A.createDiv(["payment-separator__line"]);
1653
1006
  return e.appendChild(t), e.appendChild(s), e.appendChild(a), e;
1654
1007
  }
1655
1008
  }
1656
- class yt extends A {
1009
+ class fe extends P {
1657
1010
  constructor(e) {
1658
1011
  const { translationFunc: t, checkoutProfile: s } = e;
1659
1012
  super("div", ["payment-separator"]);
1660
1013
  const a = this.getElement(), i = document.createElement("span");
1661
1014
  i.className = "payment-separator__line";
1662
- const r = document.createElement("p");
1663
- r.textContent = t("pay-with-card"), r.className = "payment-separator__text", r.style.fontFamily = `${s.styles.fontFamily}, sans-serif`;
1664
- const o = document.createElement("span");
1665
- o.className = "payment-separator__line", a.appendChild(i), a.appendChild(r), a.appendChild(o);
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);
1666
1019
  }
1667
1020
  }
1668
- class bt extends A {
1021
+ class ye extends P {
1669
1022
  paymentMethods;
1670
1023
  paymentSeparator;
1671
1024
  skeleton;
@@ -1675,37 +1028,37 @@ class bt extends A {
1675
1028
  formData: s,
1676
1029
  onPaypalSubmit: a,
1677
1030
  onApplePaySubmit: i,
1678
- supportedPaymentMethods: r,
1679
- translationFunc: o,
1031
+ supportedPaymentMethods: n,
1032
+ translationFunc: r,
1680
1033
  paymentId: d,
1681
1034
  checkoutKey: c,
1682
- checkoutDetails: m,
1683
- environment: S,
1035
+ checkoutDetails: g,
1036
+ environment: v,
1684
1037
  countryCode: l
1685
1038
  } = e;
1686
1039
  if (super("div", ["payment-methods"]), this.paymentMethods = /* @__PURE__ */ new Map(), !t?.additionalPaymentMethods) {
1687
1040
  this.getElement().style.display = "none";
1688
1041
  return;
1689
1042
  }
1690
- if (r === void 0) {
1043
+ if (n === void 0) {
1691
1044
  this.renderSkeleton();
1692
1045
  return;
1693
1046
  }
1694
- const p = Object.entries(
1047
+ const m = Object.entries(
1695
1048
  t.additionalPaymentMethods
1696
1049
  ).filter(([y, u]) => {
1697
- const g = u.enabled, h = r ? r[y] === !0 : !0, b = !u.countries || l && u.countries.includes(l);
1698
- return g && h && b;
1050
+ const p = u.enabled, h = n ? n[y] === !0 : !0, b = !u.countries || l && u.countries.includes(l);
1051
+ return p && h && b;
1699
1052
  }).sort((y, u) => y[1].order - u[1].order);
1700
- if (p.length === 0) {
1053
+ if (m.length === 0) {
1701
1054
  this.getElement().style.display = "none";
1702
1055
  return;
1703
1056
  }
1704
- for (const [y] of p)
1057
+ for (const [y] of m)
1705
1058
  switch (y) {
1706
1059
  case "paypal": {
1707
1060
  if (a) {
1708
- const u = new Ee({
1061
+ const u = new X({
1709
1062
  checkoutProfile: t,
1710
1063
  formData: s,
1711
1064
  onSubmit: a
@@ -1716,19 +1069,19 @@ class bt extends A {
1716
1069
  }
1717
1070
  case "applePay": {
1718
1071
  if (i && d && c) {
1719
- const u = t.appearance?.additionalPaymentMethods?.applePay, g = new Ce({
1072
+ const u = t.appearance?.additionalPaymentMethods?.applePay, p = new Z({
1720
1073
  checkoutProfile: t,
1721
1074
  formData: s,
1722
1075
  onSubmit: i,
1723
1076
  paymentId: d,
1724
1077
  checkoutKey: c,
1725
- checkoutDetails: m,
1726
- environment: S,
1078
+ checkoutDetails: g,
1079
+ environment: v,
1727
1080
  displayName: u?.displayName,
1728
1081
  requiredBillingContactFields: u?.requiredBillingContactFields,
1729
1082
  requiredShippingContactFields: u?.requiredShippingContactFields
1730
1083
  });
1731
- this.paymentMethods.set("applePay", g), g.appendTo(this.getElement());
1084
+ this.paymentMethods.set("applePay", p), p.appendTo(this.getElement());
1732
1085
  }
1733
1086
  break;
1734
1087
  }
@@ -1744,13 +1097,13 @@ class bt extends A {
1744
1097
  );
1745
1098
  break;
1746
1099
  }
1747
- this.paymentMethods.size > 0 && (this.paymentSeparator = new yt({
1748
- translationFunc: o,
1100
+ this.paymentMethods.size > 0 && (this.paymentSeparator = new fe({
1101
+ translationFunc: r,
1749
1102
  checkoutProfile: t
1750
1103
  }), this.getElement().appendChild(this.paymentSeparator.getElement()));
1751
1104
  }
1752
1105
  renderSkeleton() {
1753
- this.skeleton = new ge(), this.getElement().appendChild(this.skeleton.getElement());
1106
+ this.skeleton = new j(), this.getElement().appendChild(this.skeleton.getElement());
1754
1107
  }
1755
1108
  updateFormData(e) {
1756
1109
  const t = this.paymentMethods.get("paypal");
@@ -1762,8 +1115,8 @@ class bt extends A {
1762
1115
  return this.paymentMethods.size > 0 && this.getElement().style.display !== "none";
1763
1116
  }
1764
1117
  }
1765
- const vt = 17;
1766
- class St extends A {
1118
+ const be = 17;
1119
+ class Se extends P {
1767
1120
  styles;
1768
1121
  isHovered = !1;
1769
1122
  constructor(e) {
@@ -1773,7 +1126,7 @@ class St extends A {
1773
1126
  }
1774
1127
  applyStyles() {
1775
1128
  const e = this.getElement();
1776
- 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 === vt ? "100vmax" : `${this.styles.borderRadius}px`, e.style.fontSize = `${this.styles.fontSize}px`, e.style.fontFamily = `${this.styles.fontFamily}, sans-serif`;
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`;
1777
1130
  }
1778
1131
  handleMouseEnter() {
1779
1132
  this.isHovered = !0, this.applyStyles();
@@ -1785,11 +1138,11 @@ class St extends A {
1785
1138
  return this.getElement().disabled = e, e ? (this.addClass("disabled"), this.removeClass("valid")) : (this.removeClass("disabled"), this.addClass("valid")), this.applyStyles(), this;
1786
1139
  }
1787
1140
  }
1788
- class Ct {
1141
+ class ve {
1789
1142
  button;
1790
1143
  constructor(e) {
1791
1144
  const { disabled: t, checkoutProfile: s, translationFunc: a } = e;
1792
- this.button = new St({
1145
+ this.button = new Se({
1793
1146
  text: a(
1794
1147
  `buttonTexts.${s?.layout.actionButton.translationKey}`
1795
1148
  ),
@@ -1816,7 +1169,7 @@ class Ct {
1816
1169
  return this.button.appendTo(e), this;
1817
1170
  }
1818
1171
  }
1819
- class Et {
1172
+ class Ce {
1820
1173
  formElement;
1821
1174
  focusManager;
1822
1175
  translationFunc;
@@ -1862,7 +1215,7 @@ class Et {
1862
1215
  (a) => a.enabled
1863
1216
  ))
1864
1217
  return;
1865
- this.paymentMethods = new bt({
1218
+ this.paymentMethods = new ye({
1866
1219
  checkoutProfile: e,
1867
1220
  formData: t,
1868
1221
  supportedPaymentMethods: this.supportedPaymentMethods,
@@ -1885,11 +1238,11 @@ class Et {
1885
1238
  createEmailField(e, t, s, a) {
1886
1239
  try {
1887
1240
  const i = e.layout.billingFields && Object.values(e.layout.billingFields).some(
1888
- (r) => r?.enabled
1241
+ (n) => n?.enabled
1889
1242
  ) || e.layout.shippingFields && Object.values(e.layout.shippingFields).some(
1890
- (r) => r?.enabled
1243
+ (n) => n?.enabled
1891
1244
  );
1892
- this.emailField = new Fe({
1245
+ this.emailField = new Q({
1893
1246
  value: t.email,
1894
1247
  onChange: this.onChange,
1895
1248
  onBlur: this.onBlur,
@@ -1907,8 +1260,8 @@ class Et {
1907
1260
  }
1908
1261
  createPhoneNumberField(e, t, s, a) {
1909
1262
  const i = document.createElement("div");
1910
- this.phonePlaceholder = i, this.formElement.appendChild(i), Me().then(({ PhoneNumberField: r }) => {
1911
- i.isConnected && (this.phoneNumberField = new r({
1263
+ this.phonePlaceholder = i, this.formElement.appendChild(i), ee().then(({ PhoneNumberField: n }) => {
1264
+ i.isConnected && (this.phoneNumberField = new n({
1912
1265
  value: t.phoneNumber ?? "",
1913
1266
  onChange: this.onChange,
1914
1267
  onBlur: this.onBlur,
@@ -1921,8 +1274,8 @@ class Et {
1921
1274
  allowedCountries: e.layout.phoneNumber?.allowedCountries,
1922
1275
  locale: this.locale
1923
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);
1924
- }).catch((r) => {
1925
- console.error("Error creating phone number field:", r), i.remove(), this.phonePlaceholder = void 0;
1277
+ }).catch((n) => {
1278
+ console.error("Error creating phone number field:", n), i.remove(), this.phonePlaceholder = void 0;
1926
1279
  });
1927
1280
  }
1928
1281
  setCheckoutDetailsLoaded(e) {
@@ -1934,7 +1287,7 @@ class Et {
1934
1287
  this.cardSectionSkeleton = this.buildCardSkeleton(e), this.formElement.appendChild(this.cardSectionSkeleton);
1935
1288
  return;
1936
1289
  }
1937
- if (this.cardSection = new Ne({
1290
+ if (this.cardSection = new te({
1938
1291
  checkoutProfile: e,
1939
1292
  cardNumber: t.cardNumber,
1940
1293
  cardNumberError: s.cardNumber,
@@ -1949,7 +1302,7 @@ class Et {
1949
1302
  onBlur: this.onBlur,
1950
1303
  onCardBrandChange: () => {
1951
1304
  t.cardCvv && this.onBlur(
1952
- P({
1305
+ N({
1953
1306
  type: "blur",
1954
1307
  target: { name: "cardCvv", value: t.cardCvv }
1955
1308
  })
@@ -1958,19 +1311,23 @@ class Et {
1958
1311
  translationFunc: this.translationFunc,
1959
1312
  vgsService: this.vgsService,
1960
1313
  onVgsStateChange: this.onVgsStateChange
1961
- }), !this.vgsService) {
1314
+ }), this.vgsService)
1315
+ this.cardSection.setOnVgsAutoFocus((i) => {
1316
+ this.onFieldFocus(i);
1317
+ });
1318
+ else {
1962
1319
  const i = this.cardSection.getElement().querySelector('input[name="cardExpiry"]');
1963
1320
  i && (this.cardExpiryFocusHandler = () => this.onFieldFocus("cardExpiry"), i.addEventListener(
1964
1321
  "focus",
1965
1322
  this.cardExpiryFocusHandler
1966
1323
  ));
1967
- const r = this.cardSection.getElement().querySelector('input[name="cardNumber"]');
1968
- r && (this.cardNumberFocusHandler = () => this.onFieldFocus("cardNumber"), r.addEventListener(
1324
+ const n = this.cardSection.getElement().querySelector('input[name="cardNumber"]');
1325
+ n && (this.cardNumberFocusHandler = () => this.onFieldFocus("cardNumber"), n.addEventListener(
1969
1326
  "focus",
1970
1327
  this.cardNumberFocusHandler
1971
1328
  ));
1972
- const o = this.cardSection.getElement().querySelector('input[name="cardCvv"]');
1973
- o && (this.cardCvvFocusHandler = () => this.onFieldFocus("cardCvv"), o.addEventListener("focus", this.cardCvvFocusHandler));
1329
+ const r = this.cardSection.getElement().querySelector('input[name="cardCvv"]');
1330
+ r && (this.cardCvvFocusHandler = () => this.onFieldFocus("cardCvv"), r.addEventListener("focus", this.cardCvvFocusHandler));
1974
1331
  }
1975
1332
  this.focusManager.registerField("cardNumber", {
1976
1333
  focus: () => this.cardSection?.focusField("cardNumber")
@@ -1989,7 +1346,7 @@ class Et {
1989
1346
  this.cardholderSectionSkeleton = this.buildCardholderSkeleton(e), this.formElement.appendChild(this.cardholderSectionSkeleton);
1990
1347
  return;
1991
1348
  }
1992
- if (this.cardholderSection = new ft({
1349
+ if (this.cardholderSection = new ge({
1993
1350
  value: t.name,
1994
1351
  onChange: this.onChange,
1995
1352
  onBlur: this.onBlur,
@@ -2013,7 +1370,7 @@ class Et {
2013
1370
  if (!i || !Object.values(i).some(
2014
1371
  (d) => d?.enabled
2015
1372
  )) return;
2016
- const o = {
1373
+ const r = {
2017
1374
  street: "",
2018
1375
  firstName: "",
2019
1376
  lastName: "",
@@ -2022,12 +1379,12 @@ class Et {
2022
1379
  zipCode: "",
2023
1380
  country: ""
2024
1381
  };
2025
- this.billingAddressSection = new ce({
1382
+ this.billingAddressSection = new O({
2026
1383
  type: "billing",
2027
1384
  title: this.translationFunc("address.billingTitle"),
2028
1385
  checkoutProfile: e,
2029
1386
  fieldsConfig: i,
2030
- values: t.billingAddress ?? o,
1387
+ values: t.billingAddress ?? r,
2031
1388
  errors: s.billingAddress ?? {},
2032
1389
  touched: a.billingAddress ?? {},
2033
1390
  onChange: this.onChange,
@@ -2046,7 +1403,7 @@ class Et {
2046
1403
  if (!i || !Object.values(i).some(
2047
1404
  (d) => d?.enabled
2048
1405
  )) return;
2049
- const o = {
1406
+ const r = {
2050
1407
  street: "",
2051
1408
  firstName: "",
2052
1409
  lastName: "",
@@ -2055,12 +1412,12 @@ class Et {
2055
1412
  zipCode: "",
2056
1413
  country: ""
2057
1414
  };
2058
- this.shippingAddressSection = new ce({
1415
+ this.shippingAddressSection = new O({
2059
1416
  type: "shipping",
2060
1417
  title: this.translationFunc("address.shippingTitle"),
2061
1418
  checkoutProfile: e,
2062
1419
  fieldsConfig: i,
2063
- values: t.shippingAddress ?? o,
1420
+ values: t.shippingAddress ?? r,
2064
1421
  errors: s.shippingAddress ?? {},
2065
1422
  touched: a.shippingAddress ?? {},
2066
1423
  onChange: this.onChange,
@@ -2075,7 +1432,7 @@ class Et {
2075
1432
  }
2076
1433
  createSubmitButton(e, t) {
2077
1434
  try {
2078
- this.submitButton = new Ct({
1435
+ this.submitButton = new ve({
2079
1436
  disabled: t,
2080
1437
  checkoutProfile: e,
2081
1438
  translationFunc: this.translationFunc
@@ -2090,13 +1447,13 @@ class Et {
2090
1447
  updatePhoneNumberField(e, t, s) {
2091
1448
  this.phoneNumberField && (this.phoneNumberField.setValue(e), this.phoneNumberField.setError(t, s));
2092
1449
  }
2093
- updateCardSection(e, t, s, a, i, r, o, d, c) {
1450
+ updateCardSection(e, t, s, a, i, n, r, d, c) {
2094
1451
  this.cardSection && (this.cardSection.updateCardNumber(
2095
1452
  e,
2096
1453
  t,
2097
1454
  s
2098
- ), this.cardSection.updateCardCvv(a, i, r), this.cardSection.updateCardExpiry(
2099
- o,
1455
+ ), this.cardSection.updateCardCvv(a, i, n), this.cardSection.updateCardExpiry(
1456
+ r,
2100
1457
  d,
2101
1458
  c
2102
1459
  ));
@@ -2136,16 +1493,16 @@ class Et {
2136
1493
  a.style.marginBottom = "4px";
2137
1494
  const i = document.createElement("label");
2138
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";
2139
1498
  const r = document.createElement("div");
2140
- r.className = "vgs-card-group", r.style.borderRadius = `${t}px`, r.style.background = "#fff", r.style.display = "flex", r.style.flexDirection = "column", r.style.gap = "8px";
2141
- const o = document.createElement("div");
2142
- 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);
2143
1500
  const d = document.createElement("div");
2144
1501
  d.style.display = "flex", d.style.gap = "8px";
2145
1502
  const c = document.createElement("div");
2146
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);
2147
- const m = document.createElement("div");
2148
- return m.style.position = "relative", m.style.flex = "1", m.style.height = "38.5px", m.style.overflow = "hidden", m.style.borderRadius = `${t}px`, m.appendChild(this.createSkeletonDiv()), d.appendChild(m), r.appendChild(d), s.appendChild(r), s;
1504
+ const g = document.createElement("div");
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;
2149
1506
  }
2150
1507
  createSkeletonDiv() {
2151
1508
  const e = document.createElement("div");
@@ -2156,13 +1513,13 @@ class Et {
2156
1513
  a.style.marginBottom = "4px";
2157
1514
  const i = document.createElement("label");
2158
1515
  i.className = "input-label", i.textContent = this.translationFunc("cardholderNameLabel"), i.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, a.appendChild(i), s.appendChild(a);
2159
- const r = document.createElement("div");
2160
- return r.style.position = "relative", r.style.borderRadius = `${t}px`, r.style.height = "38.5px", r.style.width = "100%", r.style.overflow = "hidden", r.style.background = "#fff", r.appendChild(this.createSkeletonDiv()), s.appendChild(r), s;
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;
2161
1518
  }
2162
1519
  async mountVgsFields(e) {
2163
1520
  if (!this.vgsService || !this.cardSection) return;
2164
1521
  await this.vgsService.whenReady();
2165
- const t = this.cardSection.getVgsContainerIds(), s = this.cardholderSection?.getVgsContainerId(), a = await pt(
1522
+ const t = this.cardSection.getVgsContainerIds(), s = this.cardholderSection?.getVgsContainerId(), a = await se(
2166
1523
  e.styles.fontFamily
2167
1524
  ), i = this.cardSection.buildVgsFieldCss(
2168
1525
  e,
@@ -2182,7 +1539,7 @@ class Et {
2182
1539
  cardCvv: "CVV",
2183
1540
  cardholderName: this.translationFunc("cardholderNamePlaceholder")
2184
1541
  },
2185
- (r) => this.cardSection?.updateVgsCardBrand(r)
1542
+ (n) => this.cardSection?.updateVgsCardBrand(n)
2186
1543
  ), this.vgsService.waitForFieldsReady().then(() => {
2187
1544
  requestAnimationFrame(() => {
2188
1545
  this.cardSection?.hideFakePlaceholders(), this.cardholderSection?.hideFakePlaceholder();
@@ -2222,7 +1579,7 @@ class Et {
2222
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);
2223
1580
  }
2224
1581
  }
2225
- class Ft {
1582
+ class Fe {
2226
1583
  formManager;
2227
1584
  focusManager;
2228
1585
  onFormSubmit;
@@ -2234,16 +1591,16 @@ class Ft {
2234
1591
  handleChange = (e) => {
2235
1592
  const t = e.target, { name: s, value: a } = t, i = s;
2236
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));
2237
- const { formData: o, errors: d, touched: c } = this.formManager.getFormState();
2238
- this.focusManager.handleStateUpdate(o, d, c);
1594
+ const { formData: r, errors: d, touched: c } = this.formManager.getFormState();
1595
+ this.focusManager.handleStateUpdate(r, d, c);
2239
1596
  };
2240
1597
  handleBlur = (e) => {
2241
1598
  const t = e.target, { name: s, value: a } = t, i = s;
2242
1599
  this.localTouchedFields.add(i), this.formManager.handleBlur(i, a), setTimeout(() => {
2243
1600
  this.onUIUpdate();
2244
1601
  }, 0);
2245
- const { formData: r, errors: o, touched: d } = this.formManager.getFormState();
2246
- d[i] || this.focusManager.handleStateUpdate(r, o, d);
1602
+ const { formData: n, errors: r, touched: d } = this.formManager.getFormState();
1603
+ d[i] || this.focusManager.handleStateUpdate(n, r, d);
2247
1604
  };
2248
1605
  handleSubmit = async (e) => {
2249
1606
  e.preventDefault(), await this.onFormSubmit(e);
@@ -2263,7 +1620,7 @@ class Ft {
2263
1620
  this.localTouchedFields.clear();
2264
1621
  }
2265
1622
  }
2266
- class Mt {
1623
+ class Ee {
2267
1624
  formManager;
2268
1625
  checkoutProfile;
2269
1626
  formElement;
@@ -2287,7 +1644,7 @@ class Mt {
2287
1644
  try {
2288
1645
  if (e.checkoutProfile.styles?.fontFamily)
2289
1646
  try {
2290
- const { cleanup: t } = we({
1647
+ const { cleanup: t } = ie({
2291
1648
  fontFamily: e.checkoutProfile.styles.fontFamily
2292
1649
  });
2293
1650
  this.fontCleanup = t, this.formElement.style.fontFamily = e.checkoutProfile.styles.fontFamily;
@@ -2305,15 +1662,15 @@ class Mt {
2305
1662
  isFormDisabled() {
2306
1663
  const e = this.formManager.getFormState(), t = this.checkoutProfile.getState(), s = Object.keys(e.errors).filter(
2307
1664
  (f) => f !== "billingAddress" && f !== "shippingAddress"
2308
- ).length > 0, a = e.errors.billingAddress, i = a && typeof a == "object" ? Object.keys(a).length > 0 : !1, r = e.errors.shippingAddress, o = r && typeof r == "object" ? Object.keys(r).length > 0 : !1, d = s || i || o, m = J(
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(
2309
1666
  t.checkoutProfile?.layout
2310
- ) ? !!(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: p, shippingFields: y } = t.checkoutProfile?.layout ?? {}, u = /* @__PURE__ */ new Set(["US", "CA"]), g = (f, v) => {
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) => {
2311
1668
  if (!f) return !0;
2312
- const E = v?.country ?? "";
2313
- return Object.entries(f).every(([N, x]) => !x?.enabled || N === "state" && (!u.has(E) || x.hiddenForCountries?.includes(E)) ? !0 : !!v?.[N]?.trim());
1669
+ const C = S?.country ?? "";
1670
+ return Object.entries(f).every(([M, k]) => !k?.enabled || M === "state" && (!u.has(C) || k.hiddenForCountries?.includes(C)) ? !0 : !!S?.[M]?.trim());
2314
1671
  }, h = !this.isVgsMode || Object.values(this.vgsFieldsState).every(
2315
1672
  (f) => f?.isValid === !0
2316
- ), b = this.isVgsMode ? !!e.formData.email && l && h && g(p, e.formData.billingAddress) && g(y, e.formData.shippingAddress) : !!e.formData.email && l && m && !!e.formData.cardNumber && !!e.formData.cardCvv && !!e.formData.cardExpiry && g(p, e.formData.billingAddress) && g(y, e.formData.shippingAddress);
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);
2317
1674
  return d || !b || this.isSubmitting;
2318
1675
  }
2319
1676
  setSubmitting(e) {
@@ -2332,8 +1689,8 @@ class Mt {
2332
1689
  continue;
2333
1690
  const i = a.errors?.[0];
2334
1691
  if (!i) continue;
2335
- const r = Pe(s, i.code);
2336
- r && (t[s] = e(r));
1692
+ const n = ae(s, i.code);
1693
+ n && (t[s] = e(n));
2337
1694
  }
2338
1695
  return t;
2339
1696
  }
@@ -2344,18 +1701,18 @@ class Mt {
2344
1701
  this.fontCleanup && (this.fontCleanup(), this.fontCleanup = void 0);
2345
1702
  }
2346
1703
  }
2347
- class Nt extends A {
1704
+ class Me extends P {
2348
1705
  titleElement;
2349
1706
  constructor(e = {}) {
2350
1707
  super("div", ["blur-bg"]);
2351
- const t = D.createDiv(["loader"]);
2352
- this.titleElement = new A("h3", ["title"]), this.titleElement.setText(e.text || ""), this.appendChild(t), this.appendChild(this.titleElement);
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);
2353
1710
  }
2354
1711
  setText(e) {
2355
1712
  return this.titleElement.setText(e), this;
2356
1713
  }
2357
1714
  }
2358
- const he = {
1715
+ const z = {
2359
1716
  street: "",
2360
1717
  firstName: "",
2361
1718
  lastName: "",
@@ -2363,16 +1720,16 @@ const he = {
2363
1720
  city: "",
2364
1721
  zipCode: "",
2365
1722
  country: ""
2366
- }, ue = (n, e) => {
1723
+ }, $ = (o, e) => {
2367
1724
  const t = {}, s = `${e}.`;
2368
- return Object.keys(n).forEach((a) => {
1725
+ return Object.keys(o).forEach((a) => {
2369
1726
  if (a.startsWith(s)) {
2370
1727
  const i = a.slice(s.length);
2371
- t[i] = n[a];
1728
+ t[i] = o[a];
2372
1729
  }
2373
1730
  }), t;
2374
1731
  };
2375
- class wt {
1732
+ class Ne {
2376
1733
  formElement;
2377
1734
  componentManager;
2378
1735
  onLoadingStateChange;
@@ -2406,13 +1763,13 @@ class wt {
2406
1763
  !!(e.errors.name && e.touched.name),
2407
1764
  e.errors.name
2408
1765
  ), this.componentManager.updateBillingAddressSection(
2409
- e.formData.billingAddress ?? he,
1766
+ e.formData.billingAddress ?? z,
2410
1767
  e.errors.billingAddress ?? {},
2411
- ue(e.touched, "billingAddress")
1768
+ $(e.touched, "billingAddress")
2412
1769
  ), this.componentManager.updateShippingAddressSection(
2413
- e.formData.shippingAddress ?? he,
1770
+ e.formData.shippingAddress ?? z,
2414
1771
  e.errors.shippingAddress ?? {},
2415
- ue(e.touched, "shippingAddress")
1772
+ $(e.touched, "shippingAddress")
2416
1773
  ), this.componentManager.updateSubmitButton(t);
2417
1774
  }
2418
1775
  setLoadingState(e) {
@@ -2420,10 +1777,10 @@ class wt {
2420
1777
  this.onLoadingStateChange(e);
2421
1778
  return;
2422
1779
  }
2423
- e ? (this.hideSkeleton(), this.formSkeleton = new ge(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
1780
+ e ? (this.hideSkeleton(), this.formSkeleton = new j(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
2424
1781
  }
2425
1782
  showSpinner(e) {
2426
- this.hideSpinner(), this.spinner = new Nt({ text: e }), this.formElement.appendChild(this.spinner.getElement());
1783
+ this.hideSpinner(), this.spinner = new Me({ text: e }), this.formElement.appendChild(this.spinner.getElement());
2427
1784
  }
2428
1785
  hideSpinner() {
2429
1786
  this.spinner && (this.spinner.getElement().remove(), this.spinner = void 0);
@@ -2432,7 +1789,7 @@ class wt {
2432
1789
  this.formSkeleton && (this.formSkeleton.getElement().remove(), this.formSkeleton = void 0);
2433
1790
  }
2434
1791
  setErrorMessage(e) {
2435
- this.alert && (this.alert.getElement().remove(), this.alert = void 0), this.alert = new ke({ message: e }), this.formElement.insertBefore(
1792
+ this.alert && (this.alert.getElement().remove(), this.alert = void 0), this.alert = new ne({ message: e }), this.formElement.insertBefore(
2436
1793
  this.alert.getElement(),
2437
1794
  this.formElement.firstChild
2438
1795
  );
@@ -2444,7 +1801,7 @@ class wt {
2444
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);
2445
1802
  }
2446
1803
  }
2447
- const T = (n) => ({
1804
+ const w = (o) => ({
2448
1805
  street: "",
2449
1806
  firstName: "",
2450
1807
  lastName: "",
@@ -2452,14 +1809,14 @@ const T = (n) => ({
2452
1809
  city: "",
2453
1810
  zipCode: "",
2454
1811
  country: "",
2455
- ...n
1812
+ ...o
2456
1813
  });
2457
- class Pt extends A {
1814
+ class Pe extends P {
2458
1815
  options;
2459
- formManager = ct();
1816
+ formManager = me();
2460
1817
  checkoutProfile;
2461
- translation = Ae();
2462
- focusManager = new xe();
1818
+ translation = re();
1819
+ focusManager = new oe();
2463
1820
  // Managers
2464
1821
  componentManager;
2465
1822
  eventHandler;
@@ -2470,9 +1827,9 @@ class Pt extends A {
2470
1827
  vgsJwt;
2471
1828
  vgsCardResult;
2472
1829
  constructor(e) {
2473
- super("form", ["form-container"]), this.options = e, this.vgsJwt = e.vgsJwt, this.vgsJwt && (this.vgsService = new L()), this.checkoutProfile = dt({
1830
+ super("form", ["form-container"]), this.options = e, this.vgsJwt = e.vgsJwt, this.vgsJwt && (this.vgsService = new R()), this.checkoutProfile = ue({
2474
1831
  appearance: e.appearance
2475
- }), e.locale && this.translation.setLocale(e.locale), this.componentManager = new Et({
1832
+ }), e.locale && this.translation.setLocale(e.locale), this.componentManager = new Ce({
2476
1833
  formElement: this.element,
2477
1834
  focusManager: this.focusManager,
2478
1835
  translationFunc: this.translation.t,
@@ -2489,11 +1846,11 @@ class Pt extends A {
2489
1846
  environment: e.environment,
2490
1847
  vgsService: this.vgsService,
2491
1848
  onVgsStateChange: (t) => this.handleVgsStateChange(t)
2492
- }), this.uiManager = new wt({
1849
+ }), this.uiManager = new Ne({
2493
1850
  formElement: this.element,
2494
1851
  componentManager: this.componentManager,
2495
1852
  onLoadingStateChange: e.onLoadingStateChange
2496
- }), this.stateCoordinator = new Mt({
1853
+ }), this.stateCoordinator = new Ee({
2497
1854
  formManager: this.formManager,
2498
1855
  checkoutProfile: this.checkoutProfile,
2499
1856
  componentManager: this.componentManager,
@@ -2503,7 +1860,7 @@ class Pt extends A {
2503
1860
  onError: (t) => this.uiManager.setErrorMessage(t),
2504
1861
  onLoadingChange: (t) => this.uiManager.setLoadingState(t),
2505
1862
  getInitialFormData: () => this._getFormStateData().formData
2506
- }), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new Ft({
1863
+ }), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new Fe({
2507
1864
  formManager: this.formManager,
2508
1865
  focusManager: this.focusManager,
2509
1866
  onFormSubmit: async () => this.handleSubmit(),
@@ -2528,12 +1885,12 @@ class Pt extends A {
2528
1885
  },
2529
1886
  ...e.initialValues.name && { name: e.initialValues.name },
2530
1887
  ...e.initialValues.billingAddress && {
2531
- billingAddress: T(
1888
+ billingAddress: w(
2532
1889
  e.initialValues.billingAddress
2533
1890
  )
2534
1891
  },
2535
1892
  ...e.initialValues.shippingAddress && {
2536
- shippingAddress: T(
1893
+ shippingAddress: w(
2537
1894
  e.initialValues.shippingAddress
2538
1895
  )
2539
1896
  }
@@ -2550,10 +1907,10 @@ class Pt extends A {
2550
1907
  cardNumber: "",
2551
1908
  cardCvv: "",
2552
1909
  ...t?.billingAddress && {
2553
- billingAddress: T(t.billingAddress)
1910
+ billingAddress: w(t.billingAddress)
2554
1911
  },
2555
1912
  ...t?.shippingAddress && {
2556
- shippingAddress: T(t.shippingAddress)
1913
+ shippingAddress: w(t.shippingAddress)
2557
1914
  }
2558
1915
  },
2559
1916
  errors: e.errors || {},
@@ -2580,11 +1937,11 @@ class Pt extends A {
2580
1937
  phoneNumber: "",
2581
1938
  phoneCountryCode: e.checkoutProfile.layout.phoneNumber.defaultCountry?.toUpperCase() || "US"
2582
1939
  }), e.checkoutProfile.layout.billingFields && this.formManager.getFormState().formData.billingAddress === void 0 && this.formManager.setFormData({
2583
- billingAddress: T()
1940
+ billingAddress: w()
2584
1941
  }), e.checkoutProfile.layout.shippingFields && this.formManager.getFormState().formData.shippingAddress === void 0 && this.formManager.setFormData({
2585
- shippingAddress: T()
1942
+ shippingAddress: w()
2586
1943
  });
2587
- const { formData: t, errors: s, touched: a } = this._getFormStateData(), i = gt(
1944
+ const { formData: t, errors: s, touched: a } = this._getFormStateData(), i = pe(
2588
1945
  e.checkoutProfile.layout
2589
1946
  );
2590
1947
  try {
@@ -2592,8 +1949,8 @@ class Pt extends A {
2592
1949
  e.checkoutProfile,
2593
1950
  t
2594
1951
  );
2595
- } catch (o) {
2596
- console.error("Failed to create payment methods:", o);
1952
+ } catch (r) {
1953
+ console.error("Failed to create payment methods:", r);
2597
1954
  }
2598
1955
  try {
2599
1956
  this.componentManager.createEmailField(
@@ -2602,8 +1959,8 @@ class Pt extends A {
2602
1959
  s,
2603
1960
  a
2604
1961
  );
2605
- } catch (o) {
2606
- console.error("Failed to create email field:", o);
1962
+ } catch (r) {
1963
+ console.error("Failed to create email field:", r);
2607
1964
  }
2608
1965
  if (i) {
2609
1966
  try {
@@ -2613,8 +1970,8 @@ class Pt extends A {
2613
1970
  s,
2614
1971
  a
2615
1972
  );
2616
- } catch (o) {
2617
- console.error("Failed to create billing address section:", o);
1973
+ } catch (r) {
1974
+ console.error("Failed to create billing address section:", r);
2618
1975
  }
2619
1976
  try {
2620
1977
  this.componentManager.createShippingAddressSection(
@@ -2623,8 +1980,8 @@ class Pt extends A {
2623
1980
  s,
2624
1981
  a
2625
1982
  );
2626
- } catch (o) {
2627
- console.error("Failed to create shipping address section:", o);
1983
+ } catch (r) {
1984
+ console.error("Failed to create shipping address section:", r);
2628
1985
  }
2629
1986
  }
2630
1987
  if (e.checkoutProfile.layout.phoneNumber?.enabled)
@@ -2635,8 +1992,8 @@ class Pt extends A {
2635
1992
  s,
2636
1993
  a
2637
1994
  );
2638
- } catch (o) {
2639
- console.error("Failed to create phone number field:", o);
1995
+ } catch (r) {
1996
+ console.error("Failed to create phone number field:", r);
2640
1997
  }
2641
1998
  try {
2642
1999
  this.componentManager.createCardSection(
@@ -2645,10 +2002,10 @@ class Pt extends A {
2645
2002
  s,
2646
2003
  a
2647
2004
  );
2648
- } catch (o) {
2649
- console.error("Failed to create card section:", o);
2005
+ } catch (r) {
2006
+ console.error("Failed to create card section:", r);
2650
2007
  }
2651
- if (!J(
2008
+ if (!B(
2652
2009
  e.checkoutProfile.layout
2653
2010
  ))
2654
2011
  try {
@@ -2658,19 +2015,19 @@ class Pt extends A {
2658
2015
  s,
2659
2016
  a
2660
2017
  );
2661
- } catch (o) {
2662
- console.error("Failed to create cardholder section:", o);
2018
+ } catch (r) {
2019
+ console.error("Failed to create cardholder section:", r);
2663
2020
  }
2664
- this.vgsService && this.componentManager.mountVgsFields(e.checkoutProfile).catch((o) => {
2665
- console.error("Failed to mount VGS fields:", o);
2021
+ this.vgsService && this.componentManager.mountVgsFields(e.checkoutProfile).catch((r) => {
2022
+ console.error("Failed to mount VGS fields:", r);
2666
2023
  });
2667
2024
  try {
2668
2025
  this.componentManager.createSubmitButton(
2669
2026
  e.checkoutProfile,
2670
2027
  this.stateCoordinator.isFormDisabled()
2671
2028
  );
2672
- } catch (o) {
2673
- console.error("Failed to create submit button:", o);
2029
+ } catch (r) {
2030
+ console.error("Failed to create submit button:", r);
2674
2031
  }
2675
2032
  }
2676
2033
  updateFormUI() {
@@ -2686,13 +2043,13 @@ class Pt extends A {
2686
2043
  */
2687
2044
  inferCardholderName() {
2688
2045
  const e = this.checkoutProfile.getState();
2689
- if (!e.checkoutProfile || !J(
2046
+ if (!e.checkoutProfile || !B(
2690
2047
  e.checkoutProfile.layout
2691
2048
  )) return;
2692
2049
  const { formData: s } = this._getFormStateData(), a = s.billingAddress ?? s.shippingAddress;
2693
2050
  if (!a) return;
2694
- const i = a.firstName?.trim() ?? "", r = a.lastName?.trim() ?? "", o = [i, r].filter(Boolean).join(" ");
2695
- o && this.formManager.setFormData({ name: o });
2051
+ const i = a.firstName?.trim() ?? "", n = a.lastName?.trim() ?? "", r = [i, n].filter(Boolean).join(" ");
2052
+ r && this.formManager.setFormData({ name: r });
2696
2053
  }
2697
2054
  /**
2698
2055
  * Infers address data based on field configuration.
@@ -2702,11 +2059,11 @@ class Pt extends A {
2702
2059
  inferAddresses() {
2703
2060
  const e = this.checkoutProfile.getState();
2704
2061
  if (!e.checkoutProfile) return;
2705
- const { billingFields: t, shippingFields: s } = e.checkoutProfile.layout, a = t && Object.values(t).some((o) => o?.enabled), i = s && Object.values(s).some((o) => o?.enabled), { formData: r } = this._getFormStateData();
2706
- !a && i && r.shippingAddress ? this.formManager.setFormData({
2707
- billingAddress: { ...r.shippingAddress }
2708
- }) : !i && a && r.billingAddress && this.formManager.setFormData({
2709
- shippingAddress: { ...r.billingAddress }
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 }
2710
2067
  });
2711
2068
  }
2712
2069
  handleVgsStateChange(e) {
@@ -2794,13 +2151,13 @@ class Pt extends A {
2794
2151
  ), this.componentManager.cleanup(), this.uiManager.cleanup(), this.getElement().remove();
2795
2152
  }
2796
2153
  associatePayment(e, t, s, a, i) {
2797
- 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 L(), this.componentManager.setVgsService(this.vgsService), this.stateCoordinator.setVgsMode(!0), this.vgsService.init(this.options.environment).then((o) => {
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 R(), this.componentManager.setVgsService(this.vgsService), this.stateCoordinator.setVgsMode(!0), this.vgsService.init(this.options.environment).then((r) => {
2798
2155
  this.vgsService?.createForm(
2799
- o,
2156
+ r,
2800
2157
  (d) => this.handleVgsStateChange(d)
2801
2158
  ), this.renderFormComponents();
2802
- }).catch((o) => {
2803
- console.error("Failed to load VGS Collect:", o), this.vgsService = void 0, this.vgsJwt = void 0, this.renderFormComponents();
2159
+ }).catch((r) => {
2160
+ console.error("Failed to load VGS Collect:", r), this.vgsService = void 0, this.vgsJwt = void 0, this.renderFormComponents();
2804
2161
  })), this.componentManager.removePaymentMethods(), this.componentManager.updateSupportedPaymentMethods(
2805
2162
  s
2806
2163
  ), this.componentManager.updatePaymentDetails(
@@ -2808,18 +2165,18 @@ class Pt extends A {
2808
2165
  t,
2809
2166
  a
2810
2167
  ), !i && this.checkoutProfile.getState().checkoutProfile && this.renderFormComponents();
2811
- const r = this.checkoutProfile.getState();
2812
- if (r.checkoutProfile) {
2813
- const { formData: o } = this._getFormStateData();
2168
+ const n = this.checkoutProfile.getState();
2169
+ if (n.checkoutProfile) {
2170
+ const { formData: r } = this._getFormStateData();
2814
2171
  this.componentManager.createPaymentMethods(
2815
- r.checkoutProfile,
2816
- o,
2172
+ n.checkoutProfile,
2173
+ r,
2817
2174
  !0
2818
2175
  );
2819
2176
  }
2820
2177
  }
2821
2178
  }
2822
- class kt {
2179
+ class ke {
2823
2180
  container = null;
2824
2181
  options;
2825
2182
  onSubmit;
@@ -2843,7 +2200,7 @@ class kt {
2843
2200
  }
2844
2201
  }
2845
2202
  renderForm(e) {
2846
- this.container && (this.form && (this.form.destroy(), this.form = null), this.form = new Pt({
2203
+ this.container && (this.form && (this.form.destroy(), this.form = null), this.form = new Pe({
2847
2204
  apiKey: this.options.apiKey,
2848
2205
  onSubmit: this.onSubmit,
2849
2206
  locale: this.options.locale,
@@ -2880,7 +2237,7 @@ class kt {
2880
2237
  );
2881
2238
  }
2882
2239
  }
2883
- class At {
2240
+ class Ae {
2884
2241
  state;
2885
2242
  listeners = /* @__PURE__ */ new Set();
2886
2243
  constructor(e) {
@@ -2902,8 +2259,8 @@ class At {
2902
2259
  this.listeners.forEach((t) => t(e));
2903
2260
  }
2904
2261
  }
2905
- const xt = "en";
2906
- class Dt {
2262
+ const we = "en";
2263
+ class De {
2907
2264
  config;
2908
2265
  _callbacks;
2909
2266
  paymentState;
@@ -2912,18 +2269,18 @@ class Dt {
2912
2269
  stateManager;
2913
2270
  sessionId;
2914
2271
  constructor(e) {
2915
- this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(), ot({
2272
+ this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(), le({
2916
2273
  environment: this.config.environment,
2917
2274
  sessionId: this.sessionId
2918
- }), M(F.CHECKOUT_INITIALIZED, {
2275
+ }), F(E.CHECKOUT_INITIALIZED, {
2919
2276
  environment: this.config.environment
2920
- }), this.apiService = new De(
2277
+ }), this.apiService = new de(
2921
2278
  this.config.apiKey,
2922
2279
  this.config.environment
2923
- ), this.stateManager = new At({
2280
+ ), this.stateManager = new Ae({
2924
2281
  mounted: !1,
2925
2282
  form: null
2926
- }), this.formManager = new kt(
2283
+ }), this.formManager = new ke(
2927
2284
  {
2928
2285
  locale: this.config.locale,
2929
2286
  apiKey: this.config.apiKey,
@@ -2945,7 +2302,7 @@ class Dt {
2945
2302
  apiKey: e.apiKey,
2946
2303
  returnUrl: e.returnUrl,
2947
2304
  environment: e.environment,
2948
- locale: e.locale || xt,
2305
+ locale: e.locale || we,
2949
2306
  disableErrorMessages: e.disableErrorMessages ?? !1,
2950
2307
  manualActionHandling: e.manualActionHandling ?? !1,
2951
2308
  appearance: e.appearance,
@@ -2966,7 +2323,7 @@ class Dt {
2966
2323
  return t.appendChild(s), this.stateManager.updateState({
2967
2324
  form: s,
2968
2325
  mounted: !0
2969
- }), this.formManager.mount(s), M(F.CHECKOUT_MOUNTED, {
2326
+ }), this.formManager.mount(s), F(E.CHECKOUT_MOUNTED, {
2970
2327
  container_id: e
2971
2328
  }), this;
2972
2329
  }
@@ -2978,7 +2335,7 @@ class Dt {
2978
2335
  t && t.remove(), this.stateManager.updateState({
2979
2336
  form: null,
2980
2337
  mounted: !1
2981
- }), M(F.CHECKOUT_UNMOUNTED);
2338
+ }), F(E.CHECKOUT_UNMOUNTED);
2982
2339
  });
2983
2340
  }
2984
2341
  async handleSubmit({
@@ -2990,7 +2347,7 @@ class Dt {
2990
2347
  "Payment must be associated before submitting. Call associatePayment() first."
2991
2348
  );
2992
2349
  const s = this.getPaymentMethod(e, t);
2993
- M(F.PAYMENT_SUBMIT_STARTED, {
2350
+ F(E.PAYMENT_SUBMIT_STARTED, {
2994
2351
  payment_id: this.paymentState.paymentId,
2995
2352
  payment_method: s
2996
2353
  });
@@ -3002,32 +2359,32 @@ class Dt {
3002
2359
  paymentId: this.paymentState.paymentId,
3003
2360
  returnUrl: this.config.returnUrl,
3004
2361
  applePayData: t
3005
- }), r = performance.now() - a;
3006
- oe(
3007
- se.PAYMENT_AUTHORIZATION_TIME,
3008
- r,
2362
+ }), n = performance.now() - a;
2363
+ U(
2364
+ H.PAYMENT_AUTHORIZATION_TIME,
2365
+ n,
3009
2366
  "ms",
3010
2367
  {
3011
2368
  payment_id: this.paymentState.paymentId,
3012
2369
  payment_method: s,
3013
2370
  status: "success"
3014
2371
  }
3015
- ), M(F.PAYMENT_SUBMIT_SUCCESS, {
2372
+ ), F(E.PAYMENT_SUBMIT_SUCCESS, {
3016
2373
  payment_id: this.paymentState.paymentId,
3017
2374
  payment_method: s
3018
2375
  }), this.handlePaymentResponse(i);
3019
2376
  } catch (i) {
3020
- const r = performance.now() - a;
3021
- oe(
3022
- se.PAYMENT_AUTHORIZATION_TIME,
3023
- r,
2377
+ const n = performance.now() - a;
2378
+ U(
2379
+ H.PAYMENT_AUTHORIZATION_TIME,
2380
+ n,
3024
2381
  "ms",
3025
2382
  {
3026
2383
  payment_id: this.paymentState.paymentId,
3027
2384
  payment_method: s,
3028
2385
  status: "failed"
3029
2386
  }
3030
- ), M(F.PAYMENT_SUBMIT_FAILED, {
2387
+ ), F(E.PAYMENT_SUBMIT_FAILED, {
3031
2388
  payment_id: this.paymentState.paymentId,
3032
2389
  payment_method: s,
3033
2390
  error_message: i.details?.message ?? "Unknown error"
@@ -3035,15 +2392,15 @@ class Dt {
3035
2392
  }
3036
2393
  }
3037
2394
  handlePaymentResponse(e) {
3038
- if (e.latestTransaction.status === "authorized" && (M(F.PAYMENT_AUTHORIZED, {
2395
+ if (e.latestTransaction.status === "authorized" && (F(E.PAYMENT_AUTHORIZED, {
3039
2396
  payment_id: this.paymentState.paymentId ?? "",
3040
2397
  status: e.latestTransaction.status
3041
- }), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status)), e.latestTransaction.status === "failed" && (M(F.PAYMENT_FAILED, {
2398
+ }), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status)), e.latestTransaction.status === "failed" && (F(E.PAYMENT_FAILED, {
3042
2399
  payment_id: this.paymentState.paymentId ?? "",
3043
2400
  status: e.latestTransaction.status
3044
2401
  }), this._callbacks.onPaymentFailed?.(e.latestTransaction.status)), e.status === "requires_action") {
3045
2402
  const { redirectUrl: t } = e.action;
3046
- M(F.PAYMENT_ACTION_REQUIRED, {
2403
+ F(E.PAYMENT_ACTION_REQUIRED, {
3047
2404
  payment_id: this.paymentState.paymentId ?? "",
3048
2405
  status: e.status
3049
2406
  }), this.config.manualActionHandling ? this._callbacks.onActionRequired?.(t) : globalThis.location.href = t;
@@ -3083,7 +2440,7 @@ class Dt {
3083
2440
  throw new Error("paymentId and checkoutKey are required");
3084
2441
  this.paymentState.paymentId = e, this.paymentState.checkoutKey = t;
3085
2442
  try {
3086
- const s = await Ie({
2443
+ const s = await he({
3087
2444
  id: e,
3088
2445
  checkoutKey: t,
3089
2446
  environment: this.config.environment
@@ -3104,7 +2461,7 @@ class Dt {
3104
2461
  countryCode: s.countryCode
3105
2462
  };
3106
2463
  const a = s.supportedPaymentMethods.reduce(
3107
- (i, r) => (i[r] = !0, i),
2464
+ (i, n) => (i[n] = !0, i),
3108
2465
  {}
3109
2466
  );
3110
2467
  await this.formManager.associatePayment(
@@ -3113,16 +2470,16 @@ class Dt {
3113
2470
  a,
3114
2471
  this.paymentState.checkoutDetails,
3115
2472
  s.vgsJwt
3116
- ), M(F.PAYMENT_ASSOCIATED, {
2473
+ ), F(E.PAYMENT_ASSOCIATED, {
3117
2474
  payment_id: e,
3118
2475
  currency: s.currency,
3119
2476
  country_code: s.countryCode
3120
2477
  });
3121
2478
  } catch (s) {
3122
- throw M(F.PAYMENT_ASSOCIATION_FAILED, {
2479
+ throw F(E.PAYMENT_ASSOCIATION_FAILED, {
3123
2480
  payment_id: e,
3124
2481
  error_message: s instanceof Error ? s.message : "Unknown error"
3125
- }), lt(
2482
+ }), ce(
3126
2483
  s instanceof Error ? s : new Error("Failed to associate payment"),
3127
2484
  { payment_id: e }
3128
2485
  ), s;
@@ -3132,19 +2489,19 @@ class Dt {
3132
2489
  Object.assign(this._callbacks, e);
3133
2490
  }
3134
2491
  }
3135
- typeof globalThis < "u" && (globalThis.OdusCheckout = Dt);
2492
+ typeof globalThis < "u" && (globalThis.OdusCheckout = De);
3136
2493
  export {
3137
- Dt as OdusCheckout,
3138
- _t as deLocale,
3139
- Rt as enLocale,
3140
- Bt as esLocale,
3141
- Ut as frLocale,
3142
- Ot as itLocale,
3143
- Ht as plLocale,
3144
- zt as ptLocale,
3145
- lt as pushError,
3146
- M as pushEvent,
3147
- Tt as pushLog,
3148
- oe as pushMeasurement,
3149
- $t as trLocale
2494
+ De as OdusCheckout,
2495
+ Ie as deLocale,
2496
+ Be as enLocale,
2497
+ Te as esLocale,
2498
+ _e as frLocale,
2499
+ Re 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
3150
2507
  };