@odus/checkout 1.10.2 → 1.11.1

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,7 +1,7 @@
1
- import { A as e, B as t, C as n, D as r, E as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, P as m, R as h, S as g, T as _, U as v, W as y, X as b, Y as x, _ as S, a as C, b as w, c as ee, d as T, f as E, g as D, h as O, j as k, k as te, l as A, m as j, n as M, o as N, q as P, r as ne, s as re, t as F, u as I, w as L, x as R, z } from "./shared.js";
2
- import { t as B } from "./shared2.js";
1
+ import { $ as e, A as t, B as n, C as r, D as i, F as a, G as o, H as s, I as c, J as l, K as u, L as d, M as f, N as p, O as m, P as h, Q as g, R as _, S as ee, T as v, U as y, X as b, Y as x, Z as S, a as te, b as C, c as w, d as T, et as E, f as D, g as O, h as k, j as ne, k as re, l as A, m as j, n as ie, o as ae, q as M, r as N, s as P, t as F, u as I, v as L, w as R, x as z, y as B, z as V } from "./shared.js";
2
+ import { t as H } from "./shared2.js";
3
3
  //#region libs/checkout/src/utils/focus/FocusManager.ts
4
- var V = class {
4
+ var U = class {
5
5
  focusSequence = [
6
6
  "cardNumber",
7
7
  "cardExpiry",
@@ -81,19 +81,19 @@ var V = class {
81
81
  };
82
82
  //#endregion
83
83
  //#region libs/checkout/src/utils/helpers/hasAddressConfiguration.util.ts
84
- function H(e) {
84
+ function W(e) {
85
85
  if (!e) return !1;
86
86
  let { billingFields: t, shippingFields: n } = e, r = t && Object.values(t).some((e) => e?.enabled), i = n && Object.values(n).some((e) => e?.enabled);
87
87
  return !!(r || i);
88
88
  }
89
- function U(e) {
89
+ function G(e) {
90
90
  if (!e) return !1;
91
91
  let { billingFields: t, shippingFields: n } = e, r = t?.firstName?.enabled && t?.lastName?.enabled, i = n?.firstName?.enabled && n?.lastName?.enabled;
92
92
  return !!(r || i);
93
93
  }
94
94
  //#endregion
95
95
  //#region libs/checkout/src/components/checkout/form/AddressSection.ts
96
- var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
96
+ var K = class extends C {
97
97
  inputs = /* @__PURE__ */ new Map();
98
98
  type;
99
99
  onChange;
@@ -115,7 +115,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
115
115
  let e = document.createElement("h3");
116
116
  e.className = "address-section-title", e.textContent = t, e.style.color = n.styles.textColor, e.style.fontFamily = `"${n.styles.fontFamily}", sans-serif`, e.style.fontSize = `${n.styles.fontSize}px`, e.style.fontWeight = "normal", this.getElement().appendChild(e);
117
117
  }
118
- 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(n, r, i, a, o), this.grouped && (this.groupMessage = new O({
118
+ 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(n, r, i, a, o), this.grouped && (this.groupMessage = new k({
119
119
  text: "",
120
120
  visible: !1
121
121
  }), this.fieldsContainer.appendChild(this.groupMessage.getElement()));
@@ -189,7 +189,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
189
189
  }
190
190
  if (e.kind === "state") {
191
191
  let e = this.createRow(["full"]);
192
- if (this.stateFieldConfig = t.state, this.stateRow = e, this.stateStyles = d(!0, !0), this.currentCountry = n.country, t.state?.hiddenForCountries?.includes(n.country) && (e.style.display = "none"), W.has(n.country)) {
192
+ if (this.stateFieldConfig = t.state, this.stateRow = e, this.stateStyles = d(!0, !0), this.currentCountry = n.country, t.state?.hiddenForCountries?.includes(n.country) && (e.style.display = "none"), V(n.country)) {
193
193
  let a = this.createStateSelect(n.state, r.state, i.state, this.stateStyles, n.country, t.state?.label);
194
194
  this.inputs.set("state", a), e.appendChild(a.getElement());
195
195
  } else {
@@ -205,7 +205,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
205
205
  return t.className = `address-row address-row-${e.length === 1 ? "single" : "double"}`, t;
206
206
  }
207
207
  createInput(e, t, n, r, i, a, o, s) {
208
- let c = `${this.type}Address.${e}`, l = new E({
208
+ let c = `${this.type}Address.${e}`, l = new D({
209
209
  name: c,
210
210
  error: !1,
211
211
  errorMsg: void 0,
@@ -227,7 +227,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
227
227
  let t = this.translationFunc("validation.maxLengthExceeded");
228
228
  this.applyFieldError(e, !0, t.replace("{{max}}", String(s)));
229
229
  } else this.applyFieldError(e, !1);
230
- this.onChange(B({
230
+ this.onChange(H({
231
231
  type: "input",
232
232
  target: {
233
233
  name: c,
@@ -237,7 +237,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
237
237
  }
238
238
  });
239
239
  return l.addEventListener("blur", (e) => {
240
- this.onBlur(B({
240
+ this.onBlur(H({
241
241
  type: "blur",
242
242
  target: {
243
243
  name: c,
@@ -247,7 +247,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
247
247
  }), l;
248
248
  }
249
249
  createCountrySelect(e, t, n, r, i, a) {
250
- let o = `${this.type}Address.country`, s = S(i, this.locale), c = new T({
250
+ let o = `${this.type}Address.country`, s = O(i, this.locale), c = new T({
251
251
  name: o,
252
252
  error: !1,
253
253
  errorMsg: void 0,
@@ -261,7 +261,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
261
261
  onChange: (e) => {
262
262
  this.applyFieldError("country", !1);
263
263
  let t = e.target.value;
264
- this.onChange(B({
264
+ this.onChange(H({
265
265
  type: "change",
266
266
  target: {
267
267
  name: o,
@@ -271,7 +271,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
271
271
  }
272
272
  });
273
273
  return c.addEventListener("blur", (e) => {
274
- this.onBlur(B({
274
+ this.onBlur(H({
275
275
  type: "blur",
276
276
  target: {
277
277
  name: o,
@@ -283,33 +283,33 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
283
283
  handleCountryChange(e) {
284
284
  let t = this.currentCountry;
285
285
  if (this.currentCountry = e, !this.stateRow || !this.stateFieldConfig?.enabled) return;
286
- let n = this.stateFieldConfig.hiddenForCountries?.includes(t), r = this.stateFieldConfig.hiddenForCountries?.includes(e);
287
- if (r && !n) {
286
+ let r = this.stateFieldConfig.hiddenForCountries?.includes(t), i = this.stateFieldConfig.hiddenForCountries?.includes(e);
287
+ if (i && !r) {
288
288
  this.stateRow.style.display = "none", this.applyFieldError("state", !1), this.clearStateValue();
289
289
  return;
290
290
  }
291
- if (!r && n && (this.stateRow.style.display = ""), r) return;
292
- let i = this.inputs.get("state") instanceof T, a = W.has(e);
293
- if (i && a) {
291
+ if (!i && r && (this.stateRow.style.display = ""), i) return;
292
+ let a = this.inputs.get("state") instanceof T, o = V(e);
293
+ if (a && o) {
294
294
  let t = this.inputs.get("state");
295
295
  if (t instanceof T) {
296
- let n = e === "CA" ? "CA" : "US", r = D(n), i = n === "CA" ? this.translationFunc("address.chooseProvince") : this.translationFunc("address.chooseState");
297
- t.setOptions(r, i);
296
+ let r = n(e), i = d(r), a = this.translationFunc(_(r));
297
+ t.setOptions(i, a);
298
298
  }
299
299
  this.clearStateValue();
300
300
  return;
301
301
  }
302
- if (i !== a) {
302
+ if (a !== o) {
303
303
  this.rebuildStateField(e), this.clearStateValue();
304
304
  return;
305
305
  }
306
- !i && !a && t !== e && this.clearStateValue();
306
+ !a && !o && t !== e && this.clearStateValue();
307
307
  }
308
308
  rebuildStateField(e) {
309
309
  if (!this.stateRow || !this.stateStyles) return;
310
310
  this.applyFieldError("state", !1);
311
311
  let t = this.inputs.get("state");
312
- if (t && (t.getElement().remove(), this.inputs.delete("state")), W.has(e)) {
312
+ if (t && (t.getElement().remove(), this.inputs.delete("state")), V(e)) {
313
313
  let t = this.createStateSelect("", void 0, void 0, this.stateStyles, e, this.stateFieldConfig?.label);
314
314
  this.inputs.set("state", t), this.stateRow.appendChild(t.getElement());
315
315
  } else {
@@ -321,7 +321,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
321
321
  let e = this.inputs.get("state");
322
322
  e && e.setValue("");
323
323
  let t = `${this.type}Address.state`;
324
- this.onChange(B({
324
+ this.onChange(H({
325
325
  type: "input",
326
326
  target: {
327
327
  name: t,
@@ -330,37 +330,37 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
330
330
  detail: { programmatic: !0 }
331
331
  }));
332
332
  }
333
- createStateSelect(e, t, n, r, i, a) {
334
- let o = `${this.type}Address.state`, s = i === "CA" ? "CA" : "US", c = D(s), l = s === "CA" ? this.translationFunc("address.chooseProvince") : this.translationFunc("address.chooseState"), u = new T({
335
- name: o,
333
+ createStateSelect(e, t, r, i, a, o) {
334
+ let s = `${this.type}Address.state`, c = n(a), l = d(c), u = this.translationFunc(_(c)), f = new T({
335
+ name: s,
336
336
  error: !1,
337
337
  errorMsg: void 0,
338
- styles: r,
339
- placeholder: l,
338
+ styles: i,
339
+ placeholder: u,
340
340
  renderMessage: !this.grouped,
341
- ...!this.grouped && { label: a ?? l },
341
+ ...!this.grouped && { label: o ?? u },
342
342
  value: e,
343
- options: c,
343
+ options: l,
344
344
  autocomplete: "address-level1",
345
345
  onChange: (e) => {
346
- this.applyFieldError("state", !1), this.onChange(B({
346
+ this.applyFieldError("state", !1), this.onChange(H({
347
347
  type: "change",
348
348
  target: {
349
- name: o,
349
+ name: s,
350
350
  value: e.target.value
351
351
  }
352
352
  }));
353
353
  }
354
354
  });
355
- return u.addEventListener("blur", (e) => {
356
- this.onBlur(B({
355
+ return f.addEventListener("blur", (e) => {
356
+ this.onBlur(H({
357
357
  type: "blur",
358
358
  target: {
359
- name: o,
359
+ name: s,
360
360
  value: e.target.value
361
361
  }
362
362
  }));
363
- }), u;
363
+ }), f;
364
364
  }
365
365
  createUngroupedFields(e, t, n, r, i) {
366
366
  let a = e.styles.borderRadius, o = {
@@ -381,7 +381,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
381
381
  this.stateFieldConfig = t.state;
382
382
  let e = this.createRow(["full"]);
383
383
  this.stateRow = e, this.stateStyles = o, this.currentCountry = n.country, t.state?.hiddenForCountries?.includes(n.country) && (e.style.display = "none");
384
- let a = W.has(n.country), s = t.state?.label ?? this.translationFunc("address.state");
384
+ let a = V(n.country), s = t.state?.label ?? this.translationFunc("address.state");
385
385
  if (a) {
386
386
  let t = this.createStateSelect(n.state, r.state, i.state, o, n.country, s);
387
387
  this.inputs.set("state", t), e.appendChild(t.getElement());
@@ -447,7 +447,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
447
447
  let e = this.inputs.values().next().value;
448
448
  e && e.focus();
449
449
  }
450
- }, K = class {
450
+ }, q = class {
451
451
  input = null;
452
452
  isVgsMode;
453
453
  vgsWrapper = null;
@@ -455,7 +455,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
455
455
  vgsHelperText = null;
456
456
  wrapperElement;
457
457
  _vgsFieldsReady = !1;
458
- _fieldHeight = R(w, 14);
458
+ _fieldHeight = B(L, 14);
459
459
  _borderRadius = 0;
460
460
  constructor(e) {
461
461
  let { value: t, onChange: n, onBlur: r, errorMsg: i, checkoutProfile: a, translationFunc: o, autocomplete: s = "cc-name", isVgsMode: c = !1 } = e;
@@ -463,16 +463,16 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
463
463
  }
464
464
  buildVgsLayout(e, t) {
465
465
  let n = e.styles.borderRadius;
466
- this._borderRadius = n, this._fieldHeight = R(w, e.styles.fontSize);
466
+ this._borderRadius = n, this._fieldHeight = B(L, e.styles.fontSize);
467
467
  let r = document.createElement("div");
468
468
  r.style.marginBottom = "4px";
469
469
  let i = document.createElement("label");
470
470
  i.className = "input-label", i.textContent = t("cardholderNameLabel"), i.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, i.style.fontSize = `${e.styles.fontSize}px`, r.appendChild(i), this.wrapperElement.appendChild(r), this.vgsWrapper = document.createElement("div"), this.vgsWrapper.className = "vgs-wrap", this.vgsWrapper.style.position = "relative", this.vgsWrapper.style.borderRadius = `${n}px`, this.vgsWrapper.style.height = this._fieldHeight, this.vgsWrapper.style.width = "100%", this.vgsWrapper.style.overflow = "hidden";
471
471
  let a = document.createElement("div");
472
- a.className = "vgs-field-skeleton", this.vgsWrapper.appendChild(a), 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 O({ visible: !1 }), this.wrapperElement.appendChild(this.vgsHelperText.getElement());
472
+ a.className = "vgs-field-skeleton", this.vgsWrapper.appendChild(a), 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 k({ visible: !1 }), this.wrapperElement.appendChild(this.vgsHelperText.getElement());
473
473
  }
474
474
  buildNativeLayout(e, t, n, r, i, a, o) {
475
- this.input = new E({
475
+ this.input = new D({
476
476
  name: "name",
477
477
  label: a("cardholderNameLabel"),
478
478
  error: !1,
@@ -543,7 +543,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
543
543
  focus() {
544
544
  this.isVgsMode || this.input?.focus();
545
545
  }
546
- }, q = class extends g {
546
+ }, J = class extends C {
547
547
  constructor() {
548
548
  super("div", ["skeleton-container"]), this.createSkeletonElements();
549
549
  }
@@ -558,7 +558,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
558
558
  let e = j.createDiv(["payment-separator_container"]), t = j.createDiv(["payment-separator__line"]), n = j.createDiv(["skeleton", "skeleton-separator-text"]), r = j.createDiv(["payment-separator__line"]);
559
559
  return e.appendChild(t), e.appendChild(n), e.appendChild(r), e;
560
560
  }
561
- }, J = class extends g {
561
+ }, oe = class extends C {
562
562
  constructor(e) {
563
563
  let { translationFunc: t, checkoutProfile: n } = e;
564
564
  super("div", ["payment-separator"]);
@@ -569,7 +569,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
569
569
  let o = document.createElement("span");
570
570
  o.className = "payment-separator__line", r.appendChild(i), r.appendChild(a), r.appendChild(o);
571
571
  }
572
- }, Y = class extends g {
572
+ }, se = class extends C {
573
573
  paymentMethods;
574
574
  paymentSeparator;
575
575
  skeleton;
@@ -584,7 +584,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
584
584
  return;
585
585
  }
586
586
  let f = Object.entries(t.additionalPaymentMethods).filter(([e, t]) => {
587
- let n = t.enabled, r = !a || a[e] === !0, i = C(t.countries, d);
587
+ let n = t.enabled, r = !a || a[e] === !0, i = te(t.countries, d);
588
588
  return n && r && i;
589
589
  }).sort((e, t) => e[1].order - t[1].order);
590
590
  if (f.length === 0) {
@@ -594,7 +594,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
594
594
  for (let [e] of f) switch (e) {
595
595
  case "paypal":
596
596
  if (r) {
597
- let e = new M({
597
+ let e = new ie({
598
598
  checkoutProfile: t,
599
599
  formData: n,
600
600
  onSubmit: r
@@ -604,7 +604,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
604
604
  break;
605
605
  case "applePay":
606
606
  if (i && s && c) {
607
- let e = t.appearance?.additionalPaymentMethods?.applePay, r = new ne({
607
+ let e = t.appearance?.additionalPaymentMethods?.applePay, r = new N({
608
608
  checkoutProfile: t,
609
609
  formData: n,
610
610
  onSubmit: i,
@@ -621,13 +621,13 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
621
621
  break;
622
622
  default: console.warn(`[PaymentMethods] Unsupported payment method: ${e}`);
623
623
  }
624
- this.paymentMethods.size > 0 && (this.paymentSeparator = new J({
624
+ this.paymentMethods.size > 0 && (this.paymentSeparator = new oe({
625
625
  translationFunc: o,
626
626
  checkoutProfile: t
627
627
  }), this.getElement().appendChild(this.paymentSeparator.getElement()));
628
628
  }
629
629
  renderSkeleton() {
630
- this.skeleton = new q(), this.getElement().appendChild(this.skeleton.getElement());
630
+ this.skeleton = new J(), this.getElement().appendChild(this.skeleton.getElement());
631
631
  }
632
632
  updateFormData(e) {
633
633
  let t = this.paymentMethods.get("paypal");
@@ -638,7 +638,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
638
638
  hasVisiblePaymentMethods() {
639
639
  return this.paymentMethods.size > 0 && this.getElement().style.display !== "none";
640
640
  }
641
- }, ie = 17, ae = class extends g {
641
+ }, ce = 17, le = class extends C {
642
642
  styles;
643
643
  isHovered = !1;
644
644
  constructor(e) {
@@ -646,7 +646,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
646
646
  }
647
647
  applyStyles() {
648
648
  let e = this.getElement();
649
- 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 === ie ? "100vmax" : `${this.styles.borderRadius}px`, e.style.fontSize = `${this.styles.fontSize}px`, e.style.fontFamily = `${this.styles.fontFamily}, sans-serif`;
649
+ 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 === ce ? "100vmax" : `${this.styles.borderRadius}px`, e.style.fontSize = `${this.styles.fontSize}px`, e.style.fontFamily = `${this.styles.fontFamily}, sans-serif`;
650
650
  }
651
651
  handleMouseEnter() {
652
652
  this.isHovered = !0, this.applyStyles();
@@ -657,11 +657,11 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
657
657
  setDisabled(e) {
658
658
  return this.getElement().disabled = e, e ? (this.addClass("disabled"), this.removeClass("valid")) : (this.removeClass("disabled"), this.addClass("valid")), this.applyStyles(), this;
659
659
  }
660
- }, oe = class {
660
+ }, ue = class {
661
661
  button;
662
662
  constructor(e) {
663
663
  let { disabled: t, checkoutProfile: n, translationFunc: r } = e;
664
- this.button = new ae({
664
+ this.button = new le({
665
665
  text: r(`buttonTexts.${n?.layout.actionButton.translationKey}`),
666
666
  styles: {
667
667
  backgroundColor: n.styles.buttonColor,
@@ -685,7 +685,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
685
685
  appendTo(e) {
686
686
  return this.button.appendTo(e), this;
687
687
  }
688
- }, se = class {
688
+ }, de = class {
689
689
  formElement;
690
690
  focusManager;
691
691
  translationFunc;
@@ -723,7 +723,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
723
723
  createPaymentMethods(e, t, n = !1) {
724
724
  try {
725
725
  if (!e?.additionalPaymentMethods || Object.keys(e.additionalPaymentMethods).length === 0 || !Object.values(e.additionalPaymentMethods).some((e) => e.enabled)) return;
726
- this.removePaymentMethods(), this.paymentMethods = new Y({
726
+ this.removePaymentMethods(), this.paymentMethods = new se({
727
727
  checkoutProfile: e,
728
728
  formData: t,
729
729
  supportedPaymentMethods: this.supportedPaymentMethods,
@@ -743,7 +743,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
743
743
  createEmailField(e, t, n, r) {
744
744
  try {
745
745
  let i = e.layout.billingFields && Object.values(e.layout.billingFields).some((e) => e?.enabled) || e.layout.shippingFields && Object.values(e.layout.shippingFields).some((e) => e?.enabled);
746
- this.emailField = new N({
746
+ this.emailField = new ae({
747
747
  value: t.email,
748
748
  onChange: this.onChange,
749
749
  onBlur: this.onBlur,
@@ -757,24 +757,24 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
757
757
  throw console.error("Error creating email field:", e), e;
758
758
  }
759
759
  }
760
- createPhoneNumberField(e, n, r, i) {
761
- let a = document.createElement("div");
762
- this.phonePlaceholder = a, this.formElement.appendChild(a), t().then(({ PhoneNumberField: t }) => {
763
- a.isConnected && (this.phoneNumberField = new t({
764
- value: n.phoneNumber ?? "",
760
+ createPhoneNumberField(e, t, n, r) {
761
+ let i = document.createElement("div");
762
+ this.phonePlaceholder = i, this.formElement.appendChild(i), y().then(({ PhoneNumberField: a }) => {
763
+ i.isConnected && (this.phoneNumberField = new a({
764
+ value: t.phoneNumber ?? "",
765
765
  onChange: this.onChange,
766
766
  onBlur: this.onBlur,
767
767
  onTab: () => this.focusManager.focusField("cardNumber"),
768
- error: !!(r.phoneNumber && i.phoneNumber),
769
- errorMsg: r.phoneNumber,
768
+ error: !!(n.phoneNumber && r.phoneNumber),
769
+ errorMsg: n.phoneNumber,
770
770
  checkoutProfile: e,
771
771
  translationFunc: this.translationFunc,
772
772
  defaultCountry: e.layout.phoneNumber?.defaultCountry || "US",
773
773
  allowedCountries: e.layout.phoneNumber?.allowedCountries,
774
774
  locale: this.locale
775
- }), this.phoneNumberFocusHandler = () => this.onFieldFocus("phoneNumber"), this.phoneNumberField.getElement().addEventListener("focus", this.phoneNumberFocusHandler, !0), this.focusManager.registerField("phoneNumber", this.phoneNumberField), a.replaceWith(this.phoneNumberField.getElement()), this.phonePlaceholder = void 0);
775
+ }), 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);
776
776
  }).catch((e) => {
777
- console.error("Error creating phone number field:", e), a.remove(), this.phonePlaceholder = void 0;
777
+ console.error("Error creating phone number field:", e), i.remove(), this.phonePlaceholder = void 0;
778
778
  });
779
779
  }
780
780
  setCheckoutDetailsLoaded(e) {
@@ -788,13 +788,13 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
788
788
  }
789
789
  if (!this.isCardSupported()) return;
790
790
  if (!this.vgsService) {
791
- this.cardUnavailableNotice = new re({
791
+ this.cardUnavailableNotice = new P({
792
792
  checkoutProfile: e,
793
793
  translationFunc: this.translationFunc
794
794
  }), this.formElement.appendChild(this.cardUnavailableNotice.getElement());
795
795
  return;
796
796
  }
797
- this.cardSection = new ee({
797
+ this.cardSection = new w({
798
798
  checkoutProfile: e,
799
799
  translationFunc: this.translationFunc,
800
800
  vgsService: this.vgsService
@@ -811,7 +811,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
811
811
  this.cardholderSectionSkeleton = this.buildCardholderSkeleton(e), this.formElement.appendChild(this.cardholderSectionSkeleton);
812
812
  return;
813
813
  }
814
- if (this.cardholderSection = new K({
814
+ if (this.cardholderSection = new q({
815
815
  value: t.name,
816
816
  onChange: this.onChange,
817
817
  onBlur: this.onBlur,
@@ -842,7 +842,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
842
842
  zipCode: "",
843
843
  country: ""
844
844
  };
845
- this.billingAddressSection = new G({
845
+ this.billingAddressSection = new K({
846
846
  type: "billing",
847
847
  title: this.translationFunc("address.billingTitle"),
848
848
  checkoutProfile: e,
@@ -873,7 +873,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
873
873
  zipCode: "",
874
874
  country: ""
875
875
  };
876
- this.shippingAddressSection = new G({
876
+ this.shippingAddressSection = new K({
877
877
  type: "shipping",
878
878
  title: this.translationFunc("address.shippingTitle"),
879
879
  checkoutProfile: e,
@@ -893,7 +893,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
893
893
  }
894
894
  createSubmitButton(e, t) {
895
895
  try {
896
- this.submitButton = new oe({
896
+ this.submitButton = new ue({
897
897
  disabled: t,
898
898
  checkoutProfile: e,
899
899
  translationFunc: this.translationFunc
@@ -942,7 +942,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
942
942
  return !this.supportedPaymentMethods || !!this.supportedPaymentMethods.card;
943
943
  }
944
944
  buildCardSkeleton(e) {
945
- let t = e.styles.borderRadius, n = R(w, e.styles.fontSize), r = document.createElement("div"), i = document.createElement("div");
945
+ let t = e.styles.borderRadius, n = B(L, e.styles.fontSize), r = document.createElement("div"), i = document.createElement("div");
946
946
  i.style.marginBottom = "4px";
947
947
  let a = document.createElement("label");
948
948
  a.className = "input-label", a.textContent = this.translationFunc("cardInformation"), a.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, a.style.fontSize = `${e.styles.fontSize}px`, i.appendChild(a), r.appendChild(i);
@@ -971,14 +971,14 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
971
971
  let i = document.createElement("label");
972
972
  i.className = "input-label", i.textContent = this.translationFunc("cardholderNameLabel"), i.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, i.style.fontSize = `${e.styles.fontSize}px`, r.appendChild(i), n.appendChild(r);
973
973
  let a = document.createElement("div");
974
- return a.style.position = "relative", a.style.borderRadius = `${t}px`, a.style.height = R(w, e.styles.fontSize), a.style.width = "100%", a.style.overflow = "hidden", a.style.background = "#fff", a.appendChild(this.createSkeletonDiv()), n.appendChild(a), n.appendChild(this.createHelperTextSpacer("form-helper-text-anchor")), n;
974
+ return a.style.position = "relative", a.style.borderRadius = `${t}px`, a.style.height = B(L, e.styles.fontSize), a.style.width = "100%", a.style.overflow = "hidden", a.style.background = "#fff", a.appendChild(this.createSkeletonDiv()), n.appendChild(a), n.appendChild(this.createHelperTextSpacer("form-helper-text-anchor")), n;
975
975
  }
976
976
  async mountVgsFields(e) {
977
977
  if (!this.vgsService || !this.cardSection) return;
978
978
  await this.vgsService.whenReady();
979
- let t = this.cardSection.getVgsContainerIds(), r = this.cardholderSection?.getVgsContainerId(), i = await n(e.styles.fontFamily), a = this.cardSection.buildVgsFieldCss(e, i);
980
- if (this.cardholderSection && a.cardholderName) {
981
- let e = a.cardholderName;
979
+ let t = this.cardSection.getVgsContainerIds(), n = this.cardholderSection?.getVgsContainerId(), r = await z(e.styles.fontFamily), i = this.cardSection.buildVgsFieldCss(e, r);
980
+ if (this.cardholderSection && i.cardholderName) {
981
+ let e = i.cardholderName;
982
982
  typeof e.height == "string" && this.cardholderSection.setFieldHeight(e.height);
983
983
  let t = e["border-radius"];
984
984
  typeof t == "string" && this.cardholderSection.setBorderRadius(parseFloat(t));
@@ -987,8 +987,8 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
987
987
  cardNumber: t.cardNumber ? `#${t.cardNumber}` : void 0,
988
988
  cardExpiry: t.cardExpiry ? `#${t.cardExpiry}` : void 0,
989
989
  cardCvv: t.cardCvv ? `#${t.cardCvv}` : void 0,
990
- cardholderName: r ? `#${r}` : void 0
991
- }, a, {
990
+ cardholderName: n ? `#${n}` : void 0
991
+ }, i, {
992
992
  cardNumber: "1234 5678 9012 3456",
993
993
  cardExpiry: this.translationFunc("cardExpiry"),
994
994
  cardCvv: "CVV",
@@ -1015,7 +1015,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
1015
1015
  }
1016
1016
  this.billingAddressSection &&= (this.billingAddressSection.getElement().remove(), void 0), this.shippingAddressSection &&= (this.shippingAddressSection.getElement().remove(), void 0), this.submitButton &&= (this.submitButton.getElement().remove(), void 0), this.paymentMethods &&= (this.paymentMethods.getElement().remove(), void 0);
1017
1017
  }
1018
- }, ce = class {
1018
+ }, fe = class {
1019
1019
  formManager;
1020
1020
  focusManager;
1021
1021
  onFormSubmit;
@@ -1055,7 +1055,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
1055
1055
  clearTouchedFields() {
1056
1056
  this.localTouchedFields.clear();
1057
1057
  }
1058
- }, le = class {
1058
+ }, pe = class {
1059
1059
  formManager;
1060
1060
  checkoutProfile;
1061
1061
  formElement;
@@ -1078,7 +1078,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
1078
1078
  if (!e.isLoading) {
1079
1079
  if (e.checkoutProfile) try {
1080
1080
  if (e.checkoutProfile.styles?.fontFamily) try {
1081
- let { cleanup: t } = L({ fontFamily: e.checkoutProfile.styles.fontFamily });
1081
+ let { cleanup: t } = ee({ fontFamily: e.checkoutProfile.styles.fontFamily });
1082
1082
  this.fontCleanup = t, this.formElement.style.fontFamily = e.checkoutProfile.styles.fontFamily;
1083
1083
  } catch (e) {
1084
1084
  console.error("Error loading Google Font:", e);
@@ -1094,12 +1094,12 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
1094
1094
  };
1095
1095
  isFormDisabled() {
1096
1096
  if (this.isCardCaptureUnavailable) return !0;
1097
- let e = this.formManager.getFormState(), t = this.checkoutProfile.getState(), n = Object.keys(e.errors).filter((e) => e !== "billingAddress" && e !== "shippingAddress").length > 0, r = e.errors.billingAddress, i = r && typeof r == "object" ? Object.keys(r).length > 0 : !1, a = e.errors.shippingAddress, o = a && typeof a == "object" ? Object.keys(a).length > 0 : !1, s = n || i || o, c = t.checkoutProfile?.layout.phoneNumber?.enabled ?? !1 ? !!e.formData.phoneNumber : !0, { billingFields: l, shippingFields: u } = t.checkoutProfile?.layout ?? {}, d = /* @__PURE__ */ new Set(["US", "CA"]), f = (e, t) => {
1097
+ let e = this.formManager.getFormState(), t = this.checkoutProfile.getState(), n = Object.keys(e.errors).filter((e) => e !== "billingAddress" && e !== "shippingAddress").length > 0, r = e.errors.billingAddress, i = r && typeof r == "object" ? Object.keys(r).length > 0 : !1, a = e.errors.shippingAddress, o = a && typeof a == "object" ? Object.keys(a).length > 0 : !1, s = n || i || o, c = t.checkoutProfile?.layout.phoneNumber?.enabled ?? !1 ? !!e.formData.phoneNumber : !0, { billingFields: l, shippingFields: u } = t.checkoutProfile?.layout ?? {}, d = (e, t) => {
1098
1098
  if (!e) return !0;
1099
1099
  let n = t?.country ?? "";
1100
- return Object.entries(e).every(([e, r]) => !r?.enabled || e === "state" && (!d.has(n) || r.hiddenForCountries?.includes(n)) ? !0 : !!t?.[e]?.trim());
1101
- }, p = Object.values(this.vgsFieldsState), m = p.length > 0 && p.every((e) => e?.isValid === !0), h = this.isVgsMode && !!e.formData.email && c && m && f(l, e.formData.billingAddress) && f(u, e.formData.shippingAddress);
1102
- return s || !h || this.isSubmitting;
1100
+ return Object.entries(e).every(([e, r]) => !r?.enabled || e === "state" && (!V(n) || r.hiddenForCountries?.includes(n)) ? !0 : !!t?.[e]?.trim());
1101
+ }, f = Object.values(this.vgsFieldsState), p = f.length > 0 && f.every((e) => e?.isValid === !0), m = this.isVgsMode && !!e.formData.email && c && p && d(l, e.formData.billingAddress) && d(u, e.formData.shippingAddress);
1102
+ return s || !m || this.isSubmitting;
1103
1103
  }
1104
1104
  setSubmitting(e) {
1105
1105
  this.isSubmitting = e;
@@ -1130,17 +1130,17 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
1130
1130
  cleanup() {
1131
1131
  this.fontCleanup &&= (this.fontCleanup(), void 0);
1132
1132
  }
1133
- }, ue = class extends g {
1133
+ }, me = class extends C {
1134
1134
  titleElement;
1135
1135
  constructor(e = {}) {
1136
1136
  super("div", ["blur-bg"]);
1137
1137
  let t = j.createDiv(["loader"]);
1138
- this.titleElement = new g("h3", ["title"]), this.titleElement.setText(e.text || ""), this.appendChild(t), this.appendChild(this.titleElement);
1138
+ this.titleElement = new C("h3", ["title"]), this.titleElement.setText(e.text || ""), this.appendChild(t), this.appendChild(this.titleElement);
1139
1139
  }
1140
1140
  setText(e) {
1141
1141
  return this.titleElement.setText(e), this;
1142
1142
  }
1143
- }, X = {
1143
+ }, Y = {
1144
1144
  street: "",
1145
1145
  firstName: "",
1146
1146
  lastName: "",
@@ -1148,7 +1148,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
1148
1148
  city: "",
1149
1149
  zipCode: "",
1150
1150
  country: ""
1151
- }, Z = (e, t) => {
1151
+ }, X = (e, t) => {
1152
1152
  let n = {}, r = `${t}.`;
1153
1153
  return Object.keys(e).forEach((t) => {
1154
1154
  if (t.startsWith(r)) {
@@ -1156,11 +1156,11 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
1156
1156
  n[i] = e[t];
1157
1157
  }
1158
1158
  }), n;
1159
- }, de = class {
1159
+ }, he = class {
1160
1160
  formElement;
1161
1161
  componentManager;
1162
1162
  onLoadingStateChange;
1163
- validationSchema = h();
1163
+ validationSchema = c();
1164
1164
  spinner;
1165
1165
  formSkeleton;
1166
1166
  alert;
@@ -1168,17 +1168,17 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
1168
1168
  this.formElement = e.formElement, this.componentManager = e.componentManager, this.onLoadingStateChange = e.onLoadingStateChange;
1169
1169
  }
1170
1170
  updateFormUI(e, t) {
1171
- this.componentManager.updatePaymentMethods(e.formData), this.componentManager.updateEmailField(e.formData.email, !!(e.errors.email && e.touched.email), e.errors.email, e.touched.email ? this.validationSchema.emailSuggestion(e.formData.email) : void 0), this.componentManager.updatePhoneNumberField(e.formData.phoneNumber ?? "", !!(e.errors.phoneNumber && e.touched.phoneNumber), e.errors.phoneNumber), this.componentManager.updateCardholderSection(e.formData.name, !!(e.errors.name && e.touched.name), e.errors.name), this.componentManager.updateBillingAddressSection(e.formData.billingAddress ?? X, e.errors.billingAddress ?? {}, Z(e.touched, "billingAddress")), this.componentManager.updateShippingAddressSection(e.formData.shippingAddress ?? X, e.errors.shippingAddress ?? {}, Z(e.touched, "shippingAddress")), this.componentManager.updateSubmitButton(t);
1171
+ this.componentManager.updatePaymentMethods(e.formData), this.componentManager.updateEmailField(e.formData.email, !!(e.errors.email && e.touched.email), e.errors.email, e.touched.email ? this.validationSchema.emailSuggestion(e.formData.email) : void 0), this.componentManager.updatePhoneNumberField(e.formData.phoneNumber ?? "", !!(e.errors.phoneNumber && e.touched.phoneNumber), e.errors.phoneNumber), this.componentManager.updateCardholderSection(e.formData.name, !!(e.errors.name && e.touched.name), e.errors.name), this.componentManager.updateBillingAddressSection(e.formData.billingAddress ?? Y, e.errors.billingAddress ?? {}, X(e.touched, "billingAddress")), this.componentManager.updateShippingAddressSection(e.formData.shippingAddress ?? Y, e.errors.shippingAddress ?? {}, X(e.touched, "shippingAddress")), this.componentManager.updateSubmitButton(t);
1172
1172
  }
1173
1173
  setLoadingState(e) {
1174
1174
  if (this.onLoadingStateChange) {
1175
1175
  this.onLoadingStateChange(e);
1176
1176
  return;
1177
1177
  }
1178
- e ? (this.hideSkeleton(), this.formSkeleton = new q(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
1178
+ e ? (this.hideSkeleton(), this.formSkeleton = new J(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
1179
1179
  }
1180
1180
  showSpinner(e) {
1181
- this.hideSpinner(), this.spinner = new ue({ text: e }), this.formElement.appendChild(this.spinner.getElement());
1181
+ this.hideSpinner(), this.spinner = new me({ text: e }), this.formElement.appendChild(this.spinner.getElement());
1182
1182
  }
1183
1183
  hideSpinner() {
1184
1184
  this.spinner &&= (this.spinner.getElement().remove(), void 0);
@@ -1197,7 +1197,7 @@ var W = /* @__PURE__ */ new Set(["US", "CA"]), G = class extends g {
1197
1197
  }
1198
1198
  };
1199
1199
  globalThis.navigator.userAgent;
1200
- var Q = (e) => ({
1200
+ var Z = (e) => ({
1201
1201
  street: "",
1202
1202
  firstName: "",
1203
1203
  lastName: "",
@@ -1206,12 +1206,12 @@ var Q = (e) => ({
1206
1206
  zipCode: "",
1207
1207
  country: "",
1208
1208
  ...e
1209
- }), fe = class extends g {
1209
+ }), ge = class extends C {
1210
1210
  options;
1211
- formManager = d();
1211
+ formManager = a();
1212
1212
  checkoutProfile;
1213
- translation = r();
1214
- focusManager = new V();
1213
+ translation = v();
1214
+ focusManager = new U();
1215
1215
  componentManager;
1216
1216
  eventHandler;
1217
1217
  stateCoordinator;
@@ -1225,7 +1225,7 @@ var Q = (e) => ({
1225
1225
  constructor(e) {
1226
1226
  super("form", ["form-container"]), this.options = e;
1227
1227
  let t = !e.supportedPaymentMethods || !!e.supportedPaymentMethods.card;
1228
- e.vgsJwt && t && (this.vgsJwt = e.vgsJwt, this.vgsService = new _()), this.checkoutProfile = z({ appearance: e.appearance }), e.locale && this.translation.setLocale(e.locale), this.componentManager = new se({
1228
+ e.vgsJwt && t && (this.vgsJwt = e.vgsJwt, this.vgsService = new r()), this.checkoutProfile = s({ appearance: e.appearance }), e.locale && this.translation.setLocale(e.locale), this.componentManager = new de({
1229
1229
  formElement: this.element,
1230
1230
  focusManager: this.focusManager,
1231
1231
  translationFunc: this.translation.t,
@@ -1241,11 +1241,11 @@ var Q = (e) => ({
1241
1241
  checkoutDetails: e.checkoutDetails,
1242
1242
  environment: e.environment,
1243
1243
  vgsService: this.vgsService
1244
- }), this.uiManager = new de({
1244
+ }), this.uiManager = new he({
1245
1245
  formElement: this.element,
1246
1246
  componentManager: this.componentManager,
1247
1247
  onLoadingStateChange: e.onLoadingStateChange
1248
- }), this.stateCoordinator = new le({
1248
+ }), this.stateCoordinator = new pe({
1249
1249
  formManager: this.formManager,
1250
1250
  checkoutProfile: this.checkoutProfile,
1251
1251
  componentManager: this.componentManager,
@@ -1255,7 +1255,7 @@ var Q = (e) => ({
1255
1255
  onError: (e) => this.uiManager.setErrorMessage(e),
1256
1256
  onLoadingChange: (e) => this.uiManager.setLoadingState(e),
1257
1257
  getInitialFormData: () => this._getFormStateData().formData
1258
- }), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new ce({
1258
+ }), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new fe({
1259
1259
  formManager: this.formManager,
1260
1260
  focusManager: this.focusManager,
1261
1261
  onFormSubmit: async () => this.handleSubmit(),
@@ -1267,8 +1267,8 @@ var Q = (e) => ({
1267
1267
  ...e.initialValues.email && { email: e.initialValues.email },
1268
1268
  ...e.initialValues.phoneNumber && { phoneNumber: e.initialValues.phoneNumber },
1269
1269
  ...e.initialValues.name && { name: e.initialValues.name },
1270
- ...e.initialValues.billingAddress && { billingAddress: Q(e.initialValues.billingAddress) },
1271
- ...e.initialValues.shippingAddress && { shippingAddress: Q(e.initialValues.shippingAddress) }
1270
+ ...e.initialValues.billingAddress && { billingAddress: Z(e.initialValues.billingAddress) },
1271
+ ...e.initialValues.shippingAddress && { shippingAddress: Z(e.initialValues.shippingAddress) }
1272
1272
  }), this.initializeForm(), this.appendTo(e.container);
1273
1273
  }
1274
1274
  _getFormStateData() {
@@ -1281,8 +1281,8 @@ var Q = (e) => ({
1281
1281
  cardExpiry: "",
1282
1282
  cardNumber: "",
1283
1283
  cardCvv: "",
1284
- ...t?.billingAddress && { billingAddress: Q(t.billingAddress) },
1285
- ...t?.shippingAddress && { shippingAddress: Q(t.shippingAddress) }
1284
+ ...t?.billingAddress && { billingAddress: Z(t.billingAddress) },
1285
+ ...t?.shippingAddress && { shippingAddress: Z(t.shippingAddress) }
1286
1286
  },
1287
1287
  errors: e.errors || {},
1288
1288
  touched: e.touched || {}
@@ -1290,7 +1290,7 @@ var Q = (e) => ({
1290
1290
  }
1291
1291
  initializeForm() {
1292
1292
  if (this.uiManager.setLoadingState(!0), this.options.errorMsg && this.uiManager.setErrorMessage(this.options.errorMsg), !this.vgsService && this.options.paymentId && this.options.checkoutDetails) {
1293
- this.failCardCaptureClosed(P.NO_TOKENIZATION_SESSION);
1293
+ this.failCardCaptureClosed(S.NO_TOKENIZATION_SESSION);
1294
1294
  return;
1295
1295
  }
1296
1296
  if (this.vgsService) {
@@ -1298,7 +1298,7 @@ var Q = (e) => ({
1298
1298
  e.init(this.options.environment).then((t) => {
1299
1299
  this.vgsService === e && e.createForm(t, (e) => this.handleVgsStateChange(e));
1300
1300
  }).catch((t) => {
1301
- this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(P.INIT_FAILED));
1301
+ this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(S.INIT_FAILED));
1302
1302
  });
1303
1303
  }
1304
1304
  }
@@ -1309,7 +1309,7 @@ var Q = (e) => ({
1309
1309
  return;
1310
1310
  }
1311
1311
  let t = this.isCardCaptureUnavailable;
1312
- this.isCardCaptureUnavailable = !0, this.dropVgsService(), this.stateCoordinator.setVgsMode(!1), this.stateCoordinator.setCardCaptureUnavailable(!0), t || y(l.CARD_CAPTURE_UNAVAILABLE, { reason: e }), this.checkoutProfile.getState().checkoutProfile && this.renderFormComponents(), this.updateFormUI();
1312
+ this.isCardCaptureUnavailable = !0, this.dropVgsService(), this.stateCoordinator.setVgsMode(!1), this.stateCoordinator.setCardCaptureUnavailable(!0), t || M(g.CARD_CAPTURE_UNAVAILABLE, { reason: e }), this.checkoutProfile.getState().checkoutProfile && this.renderFormComponents(), this.updateFormUI();
1313
1313
  }
1314
1314
  dropVgsService() {
1315
1315
  let e = this.vgsService;
@@ -1327,8 +1327,8 @@ var Q = (e) => ({
1327
1327
  this.componentManager.hasComponents() && this.componentManager.cleanup(), e.checkoutProfile.layout.phoneNumber?.enabled && this.formManager.getFormState().formData.phoneNumber === void 0 && this.formManager.setFormData({
1328
1328
  phoneNumber: "",
1329
1329
  phoneCountryCode: e.checkoutProfile.layout.phoneNumber.defaultCountry?.toUpperCase() || "US"
1330
- }), e.checkoutProfile.layout.billingFields && this.formManager.getFormState().formData.billingAddress === void 0 && this.formManager.setFormData({ billingAddress: Q() }), e.checkoutProfile.layout.shippingFields && this.formManager.getFormState().formData.shippingAddress === void 0 && this.formManager.setFormData({ shippingAddress: Q() });
1331
- let { formData: t, errors: n, touched: r } = this._getFormStateData(), i = H(e.checkoutProfile.layout);
1330
+ }), e.checkoutProfile.layout.billingFields && this.formManager.getFormState().formData.billingAddress === void 0 && this.formManager.setFormData({ billingAddress: Z() }), e.checkoutProfile.layout.shippingFields && this.formManager.getFormState().formData.shippingAddress === void 0 && this.formManager.setFormData({ shippingAddress: Z() });
1331
+ let { formData: t, errors: n, touched: r } = this._getFormStateData(), i = W(e.checkoutProfile.layout);
1332
1332
  try {
1333
1333
  this.componentManager.createPaymentMethods(e.checkoutProfile, t);
1334
1334
  } catch (e) {
@@ -1361,7 +1361,7 @@ var Q = (e) => ({
1361
1361
  } catch (e) {
1362
1362
  console.error("Failed to create card section:", e);
1363
1363
  }
1364
- if (!U(e.checkoutProfile.layout) && this.componentManager.isCardSupported()) try {
1364
+ if (!G(e.checkoutProfile.layout) && this.componentManager.isCardSupported()) try {
1365
1365
  this.componentManager.createCardholderSection(e.checkoutProfile, t, n, r);
1366
1366
  } catch (e) {
1367
1367
  console.error("Failed to create cardholder section:", e);
@@ -1369,7 +1369,7 @@ var Q = (e) => ({
1369
1369
  if (this.vgsService) {
1370
1370
  let t = this.vgsService, n = ++this.vgsMountGeneration;
1371
1371
  this.componentManager.mountVgsFields(e.checkoutProfile).catch((e) => {
1372
- this.vgsMountGeneration === n && this.vgsService === t && (console.error("Failed to mount VGS fields:", e), this.failCardCaptureClosed(P.FIELDS_NOT_READY));
1372
+ this.vgsMountGeneration === n && this.vgsService === t && (console.error("Failed to mount VGS fields:", e), this.failCardCaptureClosed(S.FIELDS_NOT_READY));
1373
1373
  });
1374
1374
  }
1375
1375
  try {
@@ -1384,7 +1384,7 @@ var Q = (e) => ({
1384
1384
  }
1385
1385
  inferCardholderName() {
1386
1386
  let e = this.checkoutProfile.getState();
1387
- if (!e.checkoutProfile || !U(e.checkoutProfile.layout)) return;
1387
+ if (!e.checkoutProfile || !G(e.checkoutProfile.layout)) return;
1388
1388
  let { formData: t } = this._getFormStateData(), n = t.billingAddress ?? t.shippingAddress;
1389
1389
  if (!n) return;
1390
1390
  let r = [n.firstName?.trim() ?? "", n.lastName?.trim() ?? ""].filter(Boolean).join(" ");
@@ -1463,25 +1463,25 @@ var Q = (e) => ({
1463
1463
  destroy() {
1464
1464
  this.isDestroyed = !0, this.vgsMountGeneration += 1, this.vgsService?.destroy(), this.vgsService = void 0, this.stateCoordinator.cleanup(), this.eventHandler.clearTouchedFields(), this.getElement().removeEventListener("submit", this.eventHandler.handleSubmit), this.getElement().removeEventListener("keydown", this.eventHandler.handleKeyDown), this.componentManager.cleanup(), this.uiManager.cleanup(), this.getElement().remove();
1465
1465
  }
1466
- associatePayment(e, t, n, r, i) {
1467
- this.options.paymentId = e, this.options.checkoutKey = t, this.options.supportedPaymentMethods = n, this.options.checkoutDetails = r, this.componentManager.setCheckoutDetailsLoaded(!0), this.componentManager.updateSupportedPaymentMethods(n);
1468
- let a = this.componentManager.isCardSupported();
1469
- if (i && a && (this.vgsJwt = i), i && a && !this.vgsService) {
1470
- let e = new _();
1466
+ associatePayment(e, t, n, i, a) {
1467
+ this.options.paymentId = e, this.options.checkoutKey = t, this.options.supportedPaymentMethods = n, this.options.checkoutDetails = i, this.componentManager.setCheckoutDetailsLoaded(!0), this.componentManager.updateSupportedPaymentMethods(n);
1468
+ let o = this.componentManager.isCardSupported();
1469
+ if (a && o && (this.vgsJwt = a), a && o && !this.vgsService) {
1470
+ let e = new r();
1471
1471
  this.vgsService = e, this.componentManager.setVgsService(e), this.stateCoordinator.setVgsMode(!0), e.init(this.options.environment).then((t) => {
1472
1472
  this.vgsService === e && (e.createForm(t, (e) => this.handleVgsStateChange(e)), this.recoverCardCapture(), this.renderFormComponents());
1473
1473
  }).catch((t) => {
1474
- this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(P.INIT_FAILED));
1474
+ this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(S.INIT_FAILED));
1475
1475
  });
1476
1476
  }
1477
- this.componentManager.removePaymentMethods(), this.componentManager.updatePaymentDetails(e, t, r), (!i || !a) && this.failCardCaptureClosed(P.NO_TOKENIZATION_SESSION);
1478
- let o = this.checkoutProfile.getState();
1479
- if (o.checkoutProfile) {
1477
+ this.componentManager.removePaymentMethods(), this.componentManager.updatePaymentDetails(e, t, i), (!a || !o) && this.failCardCaptureClosed(S.NO_TOKENIZATION_SESSION);
1478
+ let s = this.checkoutProfile.getState();
1479
+ if (s.checkoutProfile) {
1480
1480
  let { formData: e } = this._getFormStateData();
1481
- this.componentManager.createPaymentMethods(o.checkoutProfile, e, !0);
1481
+ this.componentManager.createPaymentMethods(s.checkoutProfile, e, !0);
1482
1482
  }
1483
1483
  }
1484
- }, pe = class {
1484
+ }, _e = class {
1485
1485
  container = null;
1486
1486
  options;
1487
1487
  onSubmit;
@@ -1493,7 +1493,7 @@ var Q = (e) => ({
1493
1493
  this.unmount(), this.container = e, this.renderForm();
1494
1494
  }
1495
1495
  update(e) {
1496
- if (!(!this.container || !this.form)) {
1496
+ if (this.container && this.form) {
1497
1497
  if (e.appearance || e.locale) {
1498
1498
  this.form.updateAppearance({
1499
1499
  appearance: e.appearance,
@@ -1505,7 +1505,7 @@ var Q = (e) => ({
1505
1505
  }
1506
1506
  }
1507
1507
  renderForm(e) {
1508
- this.container && (this.form &&= (this.form.destroy(), null), this.form = new fe({
1508
+ this.container && (this.form &&= (this.form.destroy(), null), this.form = new ge({
1509
1509
  apiKey: this.options.apiKey,
1510
1510
  onSubmit: this.onSubmit,
1511
1511
  locale: this.options.locale,
@@ -1535,7 +1535,7 @@ var Q = (e) => ({
1535
1535
  async associatePayment(e, t, n, r, i) {
1536
1536
  this.options.paymentId = e, this.options.checkoutKey = t, this.options.checkoutDetails = r, this.options.vgsJwt = i, this.options.supportedPaymentMethods = n, this.form && this.form.associatePayment(e, t, n, r, i);
1537
1537
  }
1538
- }, me = class {
1538
+ }, Q = class {
1539
1539
  state;
1540
1540
  listeners = /* @__PURE__ */ new Set();
1541
1541
  constructor(e) {
@@ -1559,7 +1559,7 @@ var Q = (e) => ({
1559
1559
  let e = this.getState();
1560
1560
  this.listeners.forEach((t) => t(e));
1561
1561
  }
1562
- }, he = "en", $ = class {
1562
+ }, ve = "en", $ = class {
1563
1563
  config;
1564
1564
  _callbacks;
1565
1565
  paymentState;
@@ -1568,14 +1568,14 @@ var Q = (e) => ({
1568
1568
  stateManager;
1569
1569
  sessionId;
1570
1570
  constructor(e) {
1571
- this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(), s({
1571
+ this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(), b(), o({
1572
1572
  environment: this.config.environment,
1573
1573
  sessionId: this.sessionId,
1574
1574
  integration: "dropin"
1575
- }), y(l.CHECKOUT_INITIALIZED, { environment: this.config.environment }), this.apiService = new i(this.config.apiKey, this.config.environment), this.stateManager = new me({
1575
+ }), M(g.CHECKOUT_INITIALIZED, { environment: this.config.environment }), this.apiService = new R(this.config.apiKey, this.config.environment), this.stateManager = new Q({
1576
1576
  mounted: !1,
1577
1577
  form: null
1578
- }), this.formManager = new pe({
1578
+ }), this.formManager = new _e({
1579
1579
  locale: this.config.locale,
1580
1580
  apiKey: this.config.apiKey,
1581
1581
  disableErrorMessages: this.config.disableErrorMessages,
@@ -1592,7 +1592,7 @@ var Q = (e) => ({
1592
1592
  apiKey: e.apiKey,
1593
1593
  returnUrl: e.returnUrl,
1594
1594
  environment: e.environment,
1595
- locale: e.locale || he,
1595
+ locale: e.locale || ve,
1596
1596
  disableErrorMessages: e.disableErrorMessages ?? !1,
1597
1597
  manualActionHandling: e.manualActionHandling ?? !1,
1598
1598
  appearance: e.appearance,
@@ -1613,15 +1613,15 @@ var Q = (e) => ({
1613
1613
  return t = document.createElement("div"), n.appendChild(t), this.stateManager.updateState({
1614
1614
  form: t,
1615
1615
  mounted: !0
1616
- }), this.formManager.mount(t), y(l.CHECKOUT_MOUNTED, { container_id: e }), this;
1616
+ }), this.formManager.mount(t), M(g.CHECKOUT_MOUNTED, { container_id: e }), this;
1617
1617
  } catch (n) {
1618
1618
  throw t?.remove(), this.stateManager.updateState({
1619
1619
  form: null,
1620
1620
  mounted: !1
1621
- }), y(l.CHECKOUT_MOUNT_FAILED, {
1621
+ }), M(g.CHECKOUT_MOUNT_FAILED, {
1622
1622
  container_id: e,
1623
1623
  error_message: n instanceof Error ? n.message : "Unknown error"
1624
- }), v(n instanceof Error ? n : /* @__PURE__ */ Error("Failed to mount checkout"), { container_id: e }), n;
1624
+ }), u(n instanceof Error ? n : /* @__PURE__ */ Error("Failed to mount checkout"), { container_id: e }), n;
1625
1625
  }
1626
1626
  }
1627
1627
  unmount() {
@@ -1632,57 +1632,57 @@ var Q = (e) => ({
1632
1632
  e && e.remove(), this.stateManager.updateState({
1633
1633
  form: null,
1634
1634
  mounted: !1
1635
- }), y(l.CHECKOUT_UNMOUNTED);
1635
+ }), M(g.CHECKOUT_UNMOUNTED);
1636
1636
  });
1637
1637
  }
1638
- async handleSubmit({ formData: e, applePayData: t }) {
1638
+ async handleSubmit({ formData: t, applePayData: n }) {
1639
1639
  if (!this.paymentState.paymentId || !this.paymentState.checkoutKey) throw Error("Payment must be associated before submitting. Call associatePayment() first.");
1640
- let n = this.getPaymentMethod(e, t);
1641
- y(l.PAYMENT_SUBMIT_STARTED, {
1640
+ let r = this.getPaymentMethod(t, n);
1641
+ M(g.PAYMENT_SUBMIT_STARTED, {
1642
1642
  payment_id: this.paymentState.paymentId,
1643
- payment_method: n
1643
+ payment_method: r
1644
1644
  });
1645
- let r = performance.now();
1645
+ let i = performance.now();
1646
1646
  try {
1647
- let i = await this.apiService.authorizePayment({
1647
+ let a = await this.apiService.authorizePayment({
1648
1648
  checkoutKey: this.paymentState.checkoutKey,
1649
- formData: e || null,
1649
+ formData: t || null,
1650
1650
  paymentId: this.paymentState.paymentId,
1651
1651
  returnUrl: this.config.returnUrl,
1652
- applePayData: t
1653
- }), a = performance.now() - r;
1654
- return u(x.PAYMENT_AUTHORIZATION_TIME, a, "ms", {
1652
+ applePayData: n
1653
+ }), o = performance.now() - i;
1654
+ return x(e.PAYMENT_AUTHORIZATION_TIME, o, "ms", {
1655
1655
  payment_id: this.paymentState.paymentId,
1656
- payment_method: n,
1656
+ payment_method: r,
1657
1657
  status: "success"
1658
- }), y(l.PAYMENT_SUBMIT_SUCCESS, {
1658
+ }), M(g.PAYMENT_SUBMIT_SUCCESS, {
1659
1659
  payment_id: this.paymentState.paymentId,
1660
- payment_method: n
1661
- }), this.handlePaymentResponse(i);
1662
- } catch (e) {
1663
- let t = performance.now() - r;
1664
- return u(x.PAYMENT_AUTHORIZATION_TIME, t, "ms", {
1660
+ payment_method: r
1661
+ }), this.handlePaymentResponse(a);
1662
+ } catch (t) {
1663
+ let n = performance.now() - i;
1664
+ return x(e.PAYMENT_AUTHORIZATION_TIME, n, "ms", {
1665
1665
  payment_id: this.paymentState.paymentId,
1666
- payment_method: n,
1666
+ payment_method: r,
1667
1667
  status: "failed"
1668
- }), y(l.PAYMENT_SUBMIT_FAILED, {
1668
+ }), M(g.PAYMENT_SUBMIT_FAILED, {
1669
1669
  payment_id: this.paymentState.paymentId,
1670
- payment_method: n,
1671
- error_message: e.details?.message ?? "Unknown error"
1672
- }), this.handleAuthorizationError(e), !1;
1670
+ payment_method: r,
1671
+ error_message: t.details?.message ?? "Unknown error"
1672
+ }), this.handleAuthorizationError(t), !1;
1673
1673
  }
1674
1674
  }
1675
1675
  handlePaymentResponse(e) {
1676
1676
  let t = !1;
1677
- if (e.latestTransaction.status === "authorized" && (y(l.PAYMENT_AUTHORIZED, {
1677
+ if (e.latestTransaction.status === "authorized" && (M(g.PAYMENT_AUTHORIZED, {
1678
1678
  payment_id: this.paymentState.paymentId ?? "",
1679
1679
  status: e.latestTransaction.status
1680
- }), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status), t = !0), e.latestTransaction.status === "failed" && (y(l.PAYMENT_FAILED, {
1680
+ }), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status), t = !0), e.latestTransaction.status === "failed" && (M(g.PAYMENT_FAILED, {
1681
1681
  payment_id: this.paymentState.paymentId ?? "",
1682
1682
  status: e.latestTransaction.status
1683
1683
  }), this._callbacks.onPaymentFailed?.(e.latestTransaction.status)), e.status === "requires_action") {
1684
1684
  let { redirectUrl: n } = e.action;
1685
- y(l.PAYMENT_ACTION_REQUIRED, {
1685
+ M(g.PAYMENT_ACTION_REQUIRED, {
1686
1686
  payment_id: this.paymentState.paymentId ?? "",
1687
1687
  status: e.status
1688
1688
  }), this.config.manualActionHandling ? this._callbacks.onActionRequired?.(n) : globalThis.location.href = n, t = !0;
@@ -1719,7 +1719,7 @@ var Q = (e) => ({
1719
1719
  if (!e || !t) throw Error("paymentId and checkoutKey are required");
1720
1720
  this.paymentState.paymentId = e, this.paymentState.checkoutKey = t;
1721
1721
  try {
1722
- let n = await b({
1722
+ let n = await E({
1723
1723
  id: e,
1724
1724
  checkoutKey: t,
1725
1725
  environment: this.config.environment
@@ -1732,16 +1732,16 @@ var Q = (e) => ({
1732
1732
  countryCode: n.countryCode
1733
1733
  };
1734
1734
  let r = n.supportedPaymentMethods.reduce((e, t) => (e[t] = !0, e), {});
1735
- await this.formManager.associatePayment(e, t, r, this.paymentState.checkoutDetails, n.vgsJwt), y(l.PAYMENT_ASSOCIATED, {
1735
+ await this.formManager.associatePayment(e, t, r, this.paymentState.checkoutDetails, n.vgsJwt), M(g.PAYMENT_ASSOCIATED, {
1736
1736
  payment_id: e,
1737
1737
  currency: n.currency,
1738
1738
  country_code: n.countryCode
1739
1739
  });
1740
1740
  } catch (t) {
1741
- throw y(l.PAYMENT_ASSOCIATION_FAILED, {
1741
+ throw M(g.PAYMENT_ASSOCIATION_FAILED, {
1742
1742
  payment_id: e,
1743
1743
  error_message: t instanceof Error ? t.message : "Unknown error"
1744
- }), v(t instanceof Error ? t : /* @__PURE__ */ Error("Failed to associate payment"), { payment_id: e }), t;
1744
+ }), u(t instanceof Error ? t : /* @__PURE__ */ Error("Failed to associate payment"), { payment_id: e }), t;
1745
1745
  }
1746
1746
  }
1747
1747
  setCallbacks(e) {
@@ -1752,4 +1752,4 @@ var Q = (e) => ({
1752
1752
  //#region libs/checkout/src/index.ts
1753
1753
  typeof globalThis < "u" && (globalThis.OdusCheckout = $);
1754
1754
  //#endregion
1755
- export { $ as OdusCheckout, c as deLocale, a as enLocale, m as esLocale, p as frLocale, f as itLocale, k as plLocale, e as ptLocale, v as pushError, y as pushEvent, o as pushLog, u as pushMeasurement, te as trLocale };
1755
+ export { $ as OdusCheckout, h as deLocale, p as enLocale, f as esLocale, ne as frLocale, t as itLocale, re as plLocale, m as ptLocale, u as pushError, M as pushEvent, l as pushLog, x as pushMeasurement, i as trLocale };