@odus/checkout 1.17.0-beta.1 → 1.17.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 { $ 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 ee, Q as h, R as g, S as _, T as te, U as ne, X as re, Y as ie, Z as v, _ as ae, _t as y, at as oe, b, c as se, ct as x, d as ce, dt as S, f as C, ft as w, g as T, gt as E, h as D, ht as O, i as k, it as A, j as le, k as ue, l as de, lt as j, mt as M, n as fe, nt as pe, o as me, ot as N, p as P, pt as F, q as I, r as L, rt as R, s as z, st as he, t as ge, tt as _e, u as B, ut as V, vt as ve, w as ye, x as H, y as U, yt as be, z as W } from "./shared.js";
2
- import { t as G } 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 ee, Q as te, R as h, S as ne, T as re, U as ie, X as ae, Y as g, Z as oe, _ as se, _t as _, at as v, b as y, bt as ce, c as le, ct as b, d as ue, dt as x, et as S, f as C, ft as w, g as T, gt as E, h as D, ht as O, i as de, it as fe, j as pe, k as me, l as he, lt as ge, mt as k, n as _e, o as ve, ot as A, p as j, pt as M, q as N, r as P, rt as F, s as ye, st as be, t as xe, tt as Se, u as I, ut as L, vt as R, w as Ce, x as z, xt as we, y as B, yt as V, z as H } from "./shared.js";
2
+ import { t as U } from "./shared2.js";
3
3
  //#region libs/checkout/src/utils/focus/FocusManager.ts
4
- var xe = class {
4
+ var Te = class {
5
5
  focusSequence = [
6
6
  "cardNumber",
7
7
  "cardExpiry",
@@ -81,19 +81,19 @@ var xe = class {
81
81
  };
82
82
  //#endregion
83
83
  //#region libs/checkout/src/utils/helpers/hasAddressConfiguration.util.ts
84
- function Se(e) {
84
+ function Ee(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 K(e) {
89
+ function W(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 q = class extends H {
96
+ var G = class extends z {
97
97
  inputs = /* @__PURE__ */ new Map();
98
98
  type;
99
99
  onChange;
@@ -181,7 +181,7 @@ var q = class extends H {
181
181
  this.fieldsContainer.appendChild(a);
182
182
  } else if (e.kind === "state") {
183
183
  let e = this.createRow(["full"]);
184
- 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(n.country)) {
184
+ 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"), H(n.country)) {
185
185
  let a = this.createStateSelect(n.state, r.state, i.state, this.stateStyles, n.country, t.state?.label);
186
186
  this.inputs.set("state", a), e.appendChild(a.getElement());
187
187
  } else {
@@ -197,7 +197,7 @@ var q = class extends H {
197
197
  return t.className = `address-row address-row-${e.length === 1 ? "single" : "double"}`, t;
198
198
  }
199
199
  createInput(e, t, n, r, i, a, o, s) {
200
- let c = `${this.type}Address.${e}`, l = new P({
200
+ let c = `${this.type}Address.${e}`, l = new j({
201
201
  name: c,
202
202
  error: !1,
203
203
  errorMsg: void 0,
@@ -219,7 +219,7 @@ var q = class extends H {
219
219
  let t = this.translationFunc("validation.maxLengthExceeded");
220
220
  this.applyFieldError(e, !0, t.replace("{{max}}", String(s)));
221
221
  } else this.applyFieldError(e, !1);
222
- this.onChange(G({
222
+ this.onChange(U({
223
223
  type: "input",
224
224
  target: {
225
225
  name: c,
@@ -229,7 +229,7 @@ var q = class extends H {
229
229
  }
230
230
  });
231
231
  return l.addEventListener("blur", (e) => {
232
- this.onBlur(G({
232
+ this.onBlur(U({
233
233
  type: "blur",
234
234
  target: {
235
235
  name: c,
@@ -239,7 +239,7 @@ var q = class extends H {
239
239
  }), l;
240
240
  }
241
241
  createCountrySelect(e, t, n, r, i, a) {
242
- let o = `${this.type}Address.country`, s = ae(i, this.locale), c = new C({
242
+ let o = `${this.type}Address.country`, s = se(i, this.locale), c = new C({
243
243
  name: o,
244
244
  error: !1,
245
245
  errorMsg: void 0,
@@ -253,7 +253,7 @@ var q = class extends H {
253
253
  onChange: (e) => {
254
254
  this.applyFieldError("country", !1);
255
255
  let t = e.target.value;
256
- this.onChange(G({
256
+ this.onChange(U({
257
257
  type: "change",
258
258
  target: {
259
259
  name: o,
@@ -263,7 +263,7 @@ var q = class extends H {
263
263
  }
264
264
  });
265
265
  return c.addEventListener("blur", (e) => {
266
- this.onBlur(G({
266
+ this.onBlur(U({
267
267
  type: "blur",
268
268
  target: {
269
269
  name: o,
@@ -281,11 +281,11 @@ var q = class extends H {
281
281
  return;
282
282
  }
283
283
  if (!i && r && (this.stateRow.style.display = ""), i) return;
284
- let a = this.inputs.get("state") instanceof C, o = W(e);
284
+ let a = this.inputs.get("state") instanceof C, o = H(e);
285
285
  if (a && o) {
286
286
  let t = this.inputs.get("state");
287
287
  if (t instanceof C) {
288
- let r = n(e), i = d(r), a = this.translationFunc(g(r));
288
+ let r = n(e), i = d(r), a = this.translationFunc(h(r));
289
289
  t.setOptions(i, a);
290
290
  }
291
291
  this.clearStateValue();
@@ -295,7 +295,7 @@ var q = class extends H {
295
295
  if (!this.stateRow || !this.stateStyles) return;
296
296
  this.applyFieldError("state", !1);
297
297
  let t = this.inputs.get("state");
298
- if (t && (t.getElement().remove(), this.inputs.delete("state")), W(e)) {
298
+ if (t && (t.getElement().remove(), this.inputs.delete("state")), H(e)) {
299
299
  let t = this.createStateSelect("", void 0, void 0, this.stateStyles, e, this.stateFieldConfig?.label);
300
300
  this.inputs.set("state", t), this.stateRow.appendChild(t.getElement());
301
301
  } else {
@@ -307,7 +307,7 @@ var q = class extends H {
307
307
  let e = this.inputs.get("state");
308
308
  e && e.setValue("");
309
309
  let t = `${this.type}Address.state`;
310
- this.onChange(G({
310
+ this.onChange(U({
311
311
  type: "input",
312
312
  target: {
313
313
  name: t,
@@ -317,7 +317,7 @@ var q = class extends H {
317
317
  }));
318
318
  }
319
319
  createStateSelect(e, t, r, i, a, o) {
320
- let s = `${this.type}Address.state`, c = n(a), l = d(c), u = this.translationFunc(g(c)), f = new C({
320
+ let s = `${this.type}Address.state`, c = n(a), l = d(c), u = this.translationFunc(h(c)), f = new C({
321
321
  name: s,
322
322
  error: !1,
323
323
  errorMsg: void 0,
@@ -329,7 +329,7 @@ var q = class extends H {
329
329
  options: l,
330
330
  autocomplete: "address-level1",
331
331
  onChange: (e) => {
332
- this.applyFieldError("state", !1), this.onChange(G({
332
+ this.applyFieldError("state", !1), this.onChange(U({
333
333
  type: "change",
334
334
  target: {
335
335
  name: s,
@@ -339,7 +339,7 @@ var q = class extends H {
339
339
  }
340
340
  });
341
341
  return f.addEventListener("blur", (e) => {
342
- this.onBlur(G({
342
+ this.onBlur(U({
343
343
  type: "blur",
344
344
  target: {
345
345
  name: s,
@@ -367,7 +367,7 @@ var q = class extends H {
367
367
  this.stateFieldConfig = t.state;
368
368
  let e = this.createRow(["full"]);
369
369
  this.stateRow = e, this.stateStyles = o, this.currentCountry = n.country, t.state?.hiddenForCountries?.includes(n.country) && (e.style.display = "none");
370
- let a = W(n.country), s = t.state?.label ?? this.translationFunc("address.state");
370
+ let a = H(n.country), s = t.state?.label ?? this.translationFunc("address.state");
371
371
  if (a) {
372
372
  let t = this.createStateSelect(n.state, r.state, i.state, o, n.country, s);
373
373
  this.inputs.set("state", t), e.appendChild(t.getElement());
@@ -433,7 +433,7 @@ var q = class extends H {
433
433
  let e = this.inputs.values().next().value;
434
434
  e && e.focus();
435
435
  }
436
- }, Ce = class {
436
+ }, De = class {
437
437
  input = null;
438
438
  isVgsMode;
439
439
  vgsWrapper = null;
@@ -441,7 +441,7 @@ var q = class extends H {
441
441
  vgsHelperText = null;
442
442
  wrapperElement;
443
443
  _vgsFieldsReady = !1;
444
- _fieldHeight = b(U, 14);
444
+ _fieldHeight = y(B, 14);
445
445
  _borderRadius = 0;
446
446
  constructor(e) {
447
447
  let { value: t, onChange: n, onBlur: r, errorMsg: i, checkoutProfile: a, translationFunc: o, autocomplete: s = "cc-name", isVgsMode: c = !1 } = e;
@@ -449,7 +449,7 @@ var q = class extends H {
449
449
  }
450
450
  buildVgsLayout(e, t) {
451
451
  let n = e.styles.borderRadius;
452
- this._borderRadius = n, this._fieldHeight = b(U, e.styles.fontSize);
452
+ this._borderRadius = n, this._fieldHeight = y(B, e.styles.fontSize);
453
453
  let r = document.createElement("div");
454
454
  r.style.marginBottom = "4px";
455
455
  let i = document.createElement("label");
@@ -458,7 +458,7 @@ var q = class extends H {
458
458
  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 T({ visible: !1 }), this.wrapperElement.appendChild(this.vgsHelperText.getElement());
459
459
  }
460
460
  buildNativeLayout(e, t, n, r, i, a, o) {
461
- this.input = new P({
461
+ this.input = new j({
462
462
  name: "name",
463
463
  label: a("cardholderNameLabel"),
464
464
  error: !1,
@@ -485,9 +485,9 @@ var q = class extends H {
485
485
  }
486
486
  handleVgsStateChange(e, t) {
487
487
  if (!this.isVgsMode || !this.vgsWrapper) return;
488
- let n = e[B.CARDHOLDER]?.isFocused;
488
+ let n = e[I.CARDHOLDER]?.isFocused;
489
489
  if (this._vgsFieldsReady && (this.vgsWrapper.style.boxShadow = n ? "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;
490
- let r = t[B.CARDHOLDER];
490
+ let r = t[I.CARDHOLDER];
491
491
  r ? (this.vgsHelperText.setText(r), this.vgsHelperText.toggleVisibility(!0)) : this.vgsHelperText.toggleVisibility(!1);
492
492
  }
493
493
  setFieldHeight(e) {
@@ -529,7 +529,7 @@ var q = class extends H {
529
529
  focus() {
530
530
  this.isVgsMode || this.input?.focus();
531
531
  }
532
- }, J = class extends H {
532
+ }, K = class extends z {
533
533
  constructor() {
534
534
  super("div", ["skeleton-container"]), this.createSkeletonElements();
535
535
  }
@@ -544,7 +544,7 @@ var q = class extends H {
544
544
  let e = D.createDiv(["payment-separator_container"]), t = D.createDiv(["payment-separator__line"]), n = D.createDiv(["skeleton", "skeleton-separator-text"]), r = D.createDiv(["payment-separator__line"]);
545
545
  return e.appendChild(t), e.appendChild(n), e.appendChild(r), e;
546
546
  }
547
- }, we = class extends H {
547
+ }, Oe = class extends z {
548
548
  constructor(e) {
549
549
  let { translationFunc: t, checkoutProfile: n } = e;
550
550
  super("div", ["payment-separator"]);
@@ -555,7 +555,7 @@ var q = class extends H {
555
555
  let o = document.createElement("span");
556
556
  o.className = "payment-separator__line", r.appendChild(i), r.appendChild(a), r.appendChild(o);
557
557
  }
558
- }, Te = class extends H {
558
+ }, ke = class extends z {
559
559
  paymentMethods;
560
560
  paymentSeparator;
561
561
  skeleton;
@@ -570,7 +570,7 @@ var q = class extends H {
570
570
  return;
571
571
  }
572
572
  let m = Object.entries(t.additionalPaymentMethods).filter(([e, t]) => {
573
- let n = t.enabled, r = !s || s[e] === !0, i = me(t.countries, p);
573
+ let n = t.enabled, r = !s || s[e] === !0, i = ve(t.countries, p);
574
574
  return n && r && i;
575
575
  }).sort((e, t) => e[1].order - t[1].order);
576
576
  if (m.length === 0) this.getElement().style.display = "none";
@@ -578,7 +578,7 @@ var q = class extends H {
578
578
  for (let [e] of m) switch (e) {
579
579
  case "paypal":
580
580
  if (r) {
581
- let e = new L({
581
+ let e = new P({
582
582
  checkoutProfile: t,
583
583
  formData: n,
584
584
  onSubmit: r
@@ -588,7 +588,7 @@ var q = class extends H {
588
588
  break;
589
589
  case "applePay":
590
590
  if (i && l && u) {
591
- let e = t.appearance?.additionalPaymentMethods?.applePay, r = new k({
591
+ let e = t.appearance?.additionalPaymentMethods?.applePay, r = new de({
592
592
  checkoutProfile: t,
593
593
  formData: n,
594
594
  onSubmit: i,
@@ -607,14 +607,14 @@ var q = class extends H {
607
607
  break;
608
608
  default: console.warn(`[PaymentMethods] Unsupported payment method: ${e}`);
609
609
  }
610
- this.paymentMethods.size > 0 && (this.paymentSeparator = new we({
610
+ this.paymentMethods.size > 0 && (this.paymentSeparator = new Oe({
611
611
  translationFunc: c,
612
612
  checkoutProfile: t
613
613
  }), this.getElement().appendChild(this.paymentSeparator.getElement()));
614
614
  }
615
615
  }
616
616
  renderSkeleton() {
617
- this.skeleton = new J(), this.getElement().appendChild(this.skeleton.getElement());
617
+ this.skeleton = new K(), this.getElement().appendChild(this.skeleton.getElement());
618
618
  }
619
619
  updateFormData(e) {
620
620
  let t = this.paymentMethods.get("paypal");
@@ -625,7 +625,7 @@ var q = class extends H {
625
625
  hasVisiblePaymentMethods() {
626
626
  return this.paymentMethods.size > 0 && this.getElement().style.display !== "none";
627
627
  }
628
- }, Ee = 17, De = class extends H {
628
+ }, Ae = 17, je = class extends z {
629
629
  styles;
630
630
  isHovered = !1;
631
631
  constructor(e) {
@@ -633,7 +633,7 @@ var q = class extends H {
633
633
  }
634
634
  applyStyles() {
635
635
  let e = this.getElement();
636
- 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 === Ee ? "100vmax" : `${this.styles.borderRadius}px`, e.style.fontSize = `${this.styles.fontSize}px`, e.style.fontFamily = `${this.styles.fontFamily}, sans-serif`;
636
+ 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 === Ae ? "100vmax" : `${this.styles.borderRadius}px`, e.style.fontSize = `${this.styles.fontSize}px`, e.style.fontFamily = `${this.styles.fontFamily}, sans-serif`;
637
637
  }
638
638
  handleMouseEnter() {
639
639
  this.isHovered = !0, this.applyStyles();
@@ -644,12 +644,12 @@ var q = class extends H {
644
644
  setDisabled(e) {
645
645
  return this.getElement().disabled = e, e ? (this.addClass("disabled"), this.removeClass("valid")) : (this.removeClass("disabled"), this.addClass("valid")), this.applyStyles(), this;
646
646
  }
647
- }, Oe = class {
647
+ }, q = "pay", Me = class {
648
648
  button;
649
649
  constructor(e) {
650
650
  let { disabled: t, checkoutProfile: n, translationFunc: r } = e;
651
- this.button = new De({
652
- text: r(`buttonTexts.${n?.layout.actionButton.translationKey}`),
651
+ this.button = new je({
652
+ text: Ne(n, r),
653
653
  styles: {
654
654
  backgroundColor: n.styles.buttonColor,
655
655
  color: n.styles.buttonTextColor,
@@ -672,7 +672,14 @@ var q = class extends H {
672
672
  appendTo(e) {
673
673
  return this.button.appendTo(e), this;
674
674
  }
675
- }, ke = class {
675
+ };
676
+ function Ne(e, t) {
677
+ let n = `buttonTexts.${e?.layout?.actionButton?.translationKey || q}`, r = t(n);
678
+ return r === n ? t(`buttonTexts.${q}`) : r;
679
+ }
680
+ //#endregion
681
+ //#region libs/checkout/src/components/checkout/form/FormComponentManager.ts
682
+ var Pe = class {
676
683
  formElement;
677
684
  focusManager;
678
685
  translationFunc;
@@ -712,7 +719,7 @@ var q = class extends H {
712
719
  createPaymentMethods(e, t, n = !1) {
713
720
  try {
714
721
  if (!e?.additionalPaymentMethods || Object.keys(e.additionalPaymentMethods).length === 0 || !Object.values(e.additionalPaymentMethods).some((e) => e.enabled)) return;
715
- this.removePaymentMethods(), this.paymentMethods = new Te({
722
+ this.removePaymentMethods(), this.paymentMethods = new ke({
716
723
  checkoutProfile: e,
717
724
  formData: t,
718
725
  supportedPaymentMethods: this.supportedPaymentMethods,
@@ -734,7 +741,7 @@ var q = class extends H {
734
741
  createEmailField(e, t, n, r) {
735
742
  try {
736
743
  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);
737
- this.emailField = new z({
744
+ this.emailField = new ye({
738
745
  value: t.email,
739
746
  onChange: this.onChange,
740
747
  onBlur: this.onBlur,
@@ -750,7 +757,7 @@ var q = class extends H {
750
757
  }
751
758
  createPhoneNumberField(e, t, n, r) {
752
759
  let i = document.createElement("div");
753
- return this.phonePlaceholder = i, this.formElement.appendChild(i), ne().then(({ PhoneNumberField: a }) => this.phonePlaceholder === i && (this.phoneNumberField = new a({
760
+ return this.phonePlaceholder = i, this.formElement.appendChild(i), ie().then(({ PhoneNumberField: a }) => this.phonePlaceholder === i && (this.phoneNumberField = new a({
754
761
  value: t.phoneNumber ?? "",
755
762
  onChange: this.onChange,
756
763
  onBlur: this.onBlur,
@@ -778,13 +785,13 @@ var q = class extends H {
778
785
  }
779
786
  if (!this.isCardSupported()) return;
780
787
  if (!this.vgsService) {
781
- this.cardUnavailableNotice = new se({
788
+ this.cardUnavailableNotice = new le({
782
789
  checkoutProfile: e,
783
790
  translationFunc: this.translationFunc
784
791
  }), this.formElement.appendChild(this.cardUnavailableNotice.getElement());
785
792
  return;
786
793
  }
787
- this.cardSection = new de({
794
+ this.cardSection = new he({
788
795
  checkoutProfile: e,
789
796
  translationFunc: this.translationFunc,
790
797
  vgsService: this.vgsService
@@ -801,7 +808,7 @@ var q = class extends H {
801
808
  this.cardholderSectionSkeleton = this.buildCardholderSkeleton(e), this.formElement.appendChild(this.cardholderSectionSkeleton);
802
809
  return;
803
810
  }
804
- if (this.cardholderSection = new Ce({
811
+ if (this.cardholderSection = new De({
805
812
  value: t.name,
806
813
  onChange: this.onChange,
807
814
  onBlur: this.onBlur,
@@ -832,7 +839,7 @@ var q = class extends H {
832
839
  zipCode: "",
833
840
  country: ""
834
841
  };
835
- this.billingAddressSection = new q({
842
+ this.billingAddressSection = new G({
836
843
  type: "billing",
837
844
  title: this.translationFunc("address.billingTitle"),
838
845
  checkoutProfile: e,
@@ -863,7 +870,7 @@ var q = class extends H {
863
870
  zipCode: "",
864
871
  country: ""
865
872
  };
866
- this.shippingAddressSection = new q({
873
+ this.shippingAddressSection = new G({
867
874
  type: "shipping",
868
875
  title: this.translationFunc("address.shippingTitle"),
869
876
  checkoutProfile: e,
@@ -883,7 +890,7 @@ var q = class extends H {
883
890
  }
884
891
  createSubmitButton(e, t) {
885
892
  try {
886
- this.submitButton = new Oe({
893
+ this.submitButton = new Me({
887
894
  disabled: t,
888
895
  checkoutProfile: e,
889
896
  translationFunc: this.translationFunc
@@ -932,7 +939,7 @@ var q = class extends H {
932
939
  return !this.supportedPaymentMethods || !!this.supportedPaymentMethods.card;
933
940
  }
934
941
  buildCardSkeleton(e) {
935
- let t = e.styles.borderRadius, n = b(U, e.styles.fontSize), r = document.createElement("div"), i = document.createElement("div");
942
+ let t = e.styles.borderRadius, n = y(B, e.styles.fontSize), r = document.createElement("div"), i = document.createElement("div");
936
943
  i.style.marginBottom = "4px";
937
944
  let a = document.createElement("label");
938
945
  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);
@@ -961,11 +968,11 @@ var q = class extends H {
961
968
  let i = document.createElement("label");
962
969
  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);
963
970
  let a = document.createElement("div");
964
- return a.style.position = "relative", a.style.borderRadius = `${t}px`, a.style.height = b(U, 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;
971
+ return a.style.position = "relative", a.style.borderRadius = `${t}px`, a.style.height = y(B, 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;
965
972
  }
966
973
  async mountVgsFields(e) {
967
974
  if (!this.vgsService || !this.cardSection) return !1;
968
- let t = _(e.styles.fontFamily);
975
+ let t = ne(e.styles.fontFamily);
969
976
  await this.vgsService.whenReady();
970
977
  let n = this.cardSection.getVgsContainerIds(), r = this.cardholderSection?.getVgsContainerId(), i = await t, a = this.cardSection.buildVgsFieldCss(e, i);
971
978
  if (this.cardholderSection && a.cardholderName) {
@@ -1006,7 +1013,7 @@ var q = class extends H {
1006
1013
  }
1007
1014
  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);
1008
1015
  }
1009
- }, Ae = class {
1016
+ }, Fe = class {
1010
1017
  formManager;
1011
1018
  focusManager;
1012
1019
  onFormSubmit;
@@ -1046,7 +1053,7 @@ var q = class extends H {
1046
1053
  clearTouchedFields() {
1047
1054
  this.localTouchedFields.clear();
1048
1055
  }
1049
- }, je = class {
1056
+ }, Ie = class {
1050
1057
  formManager;
1051
1058
  checkoutProfile;
1052
1059
  formElement;
@@ -1084,7 +1091,7 @@ var q = class extends H {
1084
1091
  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) => {
1085
1092
  if (!e) return !0;
1086
1093
  let n = t?.country ?? "";
1087
- return Object.entries(e).every(([e, r]) => !r?.enabled || e === "state" && (!W(n) || r.hiddenForCountries?.includes(n)) ? !0 : !!t?.[e]?.trim());
1094
+ return Object.entries(e).every(([e, r]) => !r?.enabled || e === "state" && (!H(n) || r.hiddenForCountries?.includes(n)) ? !0 : !!t?.[e]?.trim());
1088
1095
  }, 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);
1089
1096
  return s || !m || this.isSubmitting;
1090
1097
  }
@@ -1106,7 +1113,7 @@ var q = class extends H {
1106
1113
  if (!r?.isTouched || r.isFocused || r.isValid) continue;
1107
1114
  let i = r.errors?.[0];
1108
1115
  if (!i) continue;
1109
- let a = ce(n, i.code);
1116
+ let a = ue(n, i.code);
1110
1117
  a && (t[n] = e(a));
1111
1118
  }
1112
1119
  return t;
@@ -1117,17 +1124,17 @@ var q = class extends H {
1117
1124
  cleanup() {
1118
1125
  this.fontCleanup &&= (this.fontCleanup(), void 0);
1119
1126
  }
1120
- }, Me = class extends H {
1127
+ }, Le = class extends z {
1121
1128
  titleElement;
1122
1129
  constructor(e = {}) {
1123
1130
  super("div", ["blur-bg"]);
1124
1131
  let t = D.createDiv(["loader"]);
1125
- this.titleElement = new H("h3", ["title"]), this.titleElement.setText(e.text || ""), this.appendChild(t), this.appendChild(this.titleElement);
1132
+ this.titleElement = new z("h3", ["title"]), this.titleElement.setText(e.text || ""), this.appendChild(t), this.appendChild(this.titleElement);
1126
1133
  }
1127
1134
  setText(e) {
1128
1135
  return this.titleElement.setText(e), this;
1129
1136
  }
1130
- }, Y = {
1137
+ }, J = {
1131
1138
  street: "",
1132
1139
  firstName: "",
1133
1140
  lastName: "",
@@ -1135,7 +1142,7 @@ var q = class extends H {
1135
1142
  city: "",
1136
1143
  zipCode: "",
1137
1144
  country: ""
1138
- }, X = (e, t) => {
1145
+ }, Y = (e, t) => {
1139
1146
  let n = {}, r = `${t}.`;
1140
1147
  return Object.keys(e).forEach((t) => {
1141
1148
  if (t.startsWith(r)) {
@@ -1143,7 +1150,7 @@ var q = class extends H {
1143
1150
  n[i] = e[t];
1144
1151
  }
1145
1152
  }), n;
1146
- }, Ne = class {
1153
+ }, X = class {
1147
1154
  formElement;
1148
1155
  componentManager;
1149
1156
  onLoadingStateChange;
@@ -1155,13 +1162,13 @@ var q = class extends H {
1155
1162
  this.formElement = e.formElement, this.componentManager = e.componentManager, this.onLoadingStateChange = e.onLoadingStateChange;
1156
1163
  }
1157
1164
  updateFormUI(e, t) {
1158
- 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);
1165
+ 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 ?? J, e.errors.billingAddress ?? {}, Y(e.touched, "billingAddress")), this.componentManager.updateShippingAddressSection(e.formData.shippingAddress ?? J, e.errors.shippingAddress ?? {}, Y(e.touched, "shippingAddress")), this.componentManager.updateSubmitButton(t);
1159
1166
  }
1160
1167
  setLoadingState(e) {
1161
- this.onLoadingStateChange ? this.onLoadingStateChange(e) : e ? (this.hideSkeleton(), this.formSkeleton = new J(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
1168
+ this.onLoadingStateChange ? this.onLoadingStateChange(e) : e ? (this.hideSkeleton(), this.formSkeleton = new K(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
1162
1169
  }
1163
1170
  showSpinner(e) {
1164
- this.hideSpinner(), this.spinner = new Me({ text: e }), this.formElement.appendChild(this.spinner.getElement());
1171
+ this.hideSpinner(), this.spinner = new Le({ text: e }), this.formElement.appendChild(this.spinner.getElement());
1165
1172
  }
1166
1173
  hideSpinner() {
1167
1174
  this.spinner &&= (this.spinner.getElement().remove(), void 0);
@@ -1170,7 +1177,7 @@ var q = class extends H {
1170
1177
  this.formSkeleton &&= (this.formSkeleton.getElement().remove(), void 0);
1171
1178
  }
1172
1179
  setErrorMessage(e) {
1173
- this.alert &&= (this.alert.getElement().remove(), void 0), this.alert = new fe({ message: e }), this.formElement.insertBefore(this.alert.getElement(), this.formElement.firstChild);
1180
+ this.alert &&= (this.alert.getElement().remove(), void 0), this.alert = new _e({ message: e }), this.formElement.insertBefore(this.alert.getElement(), this.formElement.firstChild);
1174
1181
  }
1175
1182
  clearErrorMessage() {
1176
1183
  this.alert &&= (this.alert.getElement().remove(), void 0);
@@ -1178,7 +1185,7 @@ var q = class extends H {
1178
1185
  cleanup() {
1179
1186
  this.spinner &&= (this.spinner.getElement().remove(), void 0), this.formSkeleton &&= (this.formSkeleton.getElement().remove(), void 0), this.alert &&= (this.alert.getElement().remove(), void 0);
1180
1187
  }
1181
- }, Z = "phone_number", Pe = "form";
1188
+ }, Z = "phone_number", Re = "form";
1182
1189
  globalThis.navigator.userAgent;
1183
1190
  var Q = (e) => ({
1184
1191
  street: "",
@@ -1189,18 +1196,18 @@ var Q = (e) => ({
1189
1196
  zipCode: "",
1190
1197
  country: "",
1191
1198
  ...e
1192
- }), Fe = class extends H {
1199
+ }), ze = class extends z {
1193
1200
  options;
1194
1201
  formManager = a();
1195
1202
  checkoutProfile;
1196
- translation = te();
1197
- focusManager = new xe();
1203
+ translation = re();
1204
+ focusManager = new Te();
1198
1205
  componentManager;
1199
1206
  eventHandler;
1200
1207
  stateCoordinator;
1201
1208
  uiManager;
1202
1209
  vgsService;
1203
- vgsJwt;
1210
+ vgsSession;
1204
1211
  vgsCardResult;
1205
1212
  isCardCaptureUnavailable = !1;
1206
1213
  vgsMountGeneration = 0;
@@ -1208,7 +1215,7 @@ var Q = (e) => ({
1208
1215
  constructor(e) {
1209
1216
  super("form", ["form-container"]), this.options = e;
1210
1217
  let t = !e.supportedPaymentMethods || !!e.supportedPaymentMethods.card;
1211
- e.vgsJwt && t && (this.vgsJwt = e.vgsJwt, this.vgsService = new I()), this.checkoutProfile = s({ appearance: e.appearance }), e.locale && this.translation.setLocale(e.locale), this.componentManager = new ke({
1218
+ e.vgsJwt && t && (this.vgsSession = this.createVgsSession(e.vgsJwt), this.vgsService = new g()), this.checkoutProfile = s({ appearance: e.appearance }), e.locale && this.translation.setLocale(e.locale), this.componentManager = new Pe({
1212
1219
  formElement: this.element,
1213
1220
  focusManager: this.focusManager,
1214
1221
  translationFunc: this.translation.t,
@@ -1218,7 +1225,7 @@ var Q = (e) => ({
1218
1225
  onBlur: (e) => this.eventHandler.handleBlur(e),
1219
1226
  onPaypalSubmit: async () => this.handlePaypalSubmit(),
1220
1227
  onApplePaySubmit: async (e) => this.handleApplePaySubmit(e),
1221
- onApplePayStartFailed: (e) => this.options.onSubmitOutcome?.(ie(e)),
1228
+ onApplePayStartFailed: (e) => this.options.onSubmitOutcome?.(oe(e)),
1222
1229
  onApplePayPaymentDataFailed: (e) => this.options.onSubmitOutcome?.(e),
1223
1230
  supportedPaymentMethods: e.supportedPaymentMethods,
1224
1231
  paymentId: e.paymentId,
@@ -1226,22 +1233,22 @@ var Q = (e) => ({
1226
1233
  checkoutDetails: e.checkoutDetails,
1227
1234
  environment: e.environment,
1228
1235
  vgsService: this.vgsService
1229
- }), this.uiManager = new Ne({
1236
+ }), this.uiManager = new X({
1230
1237
  formElement: this.element,
1231
1238
  componentManager: this.componentManager,
1232
1239
  onLoadingStateChange: e.onLoadingStateChange
1233
- }), this.stateCoordinator = new je({
1240
+ }), this.stateCoordinator = new Ie({
1234
1241
  formManager: this.formManager,
1235
1242
  checkoutProfile: this.checkoutProfile,
1236
1243
  componentManager: this.componentManager,
1237
1244
  formElement: this.element,
1238
1245
  onUIUpdate: () => this.updateFormUI(),
1239
1246
  onProfileLoaded: () => this.renderFormComponents(),
1240
- onRenderFailed: (e) => this.reportRenderFailure(Pe, e),
1247
+ onRenderFailed: (e) => this.reportRenderFailure(Re, e),
1241
1248
  onError: (e) => this.uiManager.setErrorMessage(e),
1242
1249
  onLoadingChange: (e) => this.uiManager.setLoadingState(e),
1243
1250
  getInitialFormData: () => this._getFormStateData().formData
1244
- }), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new Ae({
1251
+ }), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new Fe({
1245
1252
  formManager: this.formManager,
1246
1253
  focusManager: this.focusManager,
1247
1254
  onFormSubmit: async () => this.handleSubmit(),
@@ -1275,13 +1282,13 @@ var Q = (e) => ({
1275
1282
  };
1276
1283
  }
1277
1284
  initializeForm() {
1278
- if (this.uiManager.setLoadingState(!0), this.options.errorMsg && this.uiManager.setErrorMessage(this.options.errorMsg), !this.vgsService && this.options.paymentId && this.options.checkoutDetails) this.failCardCaptureClosed(w.NO_TOKENIZATION_SESSION);
1285
+ if (this.uiManager.setLoadingState(!0), this.options.errorMsg && this.uiManager.setErrorMessage(this.options.errorMsg), !this.vgsService && this.options.paymentId && this.options.checkoutDetails) this.failCardCaptureClosed(k.NO_TOKENIZATION_SESSION);
1279
1286
  else if (this.vgsService) {
1280
1287
  let e = this.vgsService;
1281
1288
  e.init(this.options.environment).then((t) => {
1282
1289
  this.vgsService === e && e.createForm(t, (e) => this.handleVgsStateChange(e));
1283
1290
  }).catch((t) => {
1284
- this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(w.INIT_FAILED));
1291
+ this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(k.INIT_FAILED));
1285
1292
  });
1286
1293
  }
1287
1294
  }
@@ -1295,11 +1302,19 @@ var Q = (e) => ({
1295
1302
  this.isCardCaptureUnavailable = !0, this.dropVgsService(), this.stateCoordinator.setVgsMode(!1), this.stateCoordinator.setCardCaptureUnavailable(!0), this.reportLoadOutcome({
1296
1303
  status: "failed",
1297
1304
  reason: e
1298
- }), t || A(F.CARD_CAPTURE_UNAVAILABLE, { reason: e }), this.checkoutProfile.getState().checkoutProfile && this.renderFormComponents(), this.updateFormUI();
1305
+ }), t || A(O.CARD_CAPTURE_UNAVAILABLE, { reason: e }), this.checkoutProfile.getState().checkoutProfile && this.renderFormComponents(), this.updateFormUI();
1306
+ }
1307
+ createVgsSession(e) {
1308
+ let { paymentId: t, checkoutKey: n, environment: r } = this.options;
1309
+ return new N(e, t && n ? l({
1310
+ id: t,
1311
+ checkoutKey: n,
1312
+ environment: r
1313
+ }) : void 0);
1299
1314
  }
1300
1315
  dropVgsService() {
1301
1316
  let e = this.vgsService;
1302
- this.vgsService = void 0, this.vgsJwt = void 0, this.componentManager.setVgsService(void 0), e?.destroy();
1317
+ this.vgsService = void 0, this.vgsSession = void 0, this.componentManager.setVgsService(void 0), e?.destroy();
1303
1318
  }
1304
1319
  recoverCardCapture() {
1305
1320
  this.isCardCaptureUnavailable && (this.isCardCaptureUnavailable = !1, this.stateCoordinator.setCardCaptureUnavailable(!1), this.updateFormUI());
@@ -1314,7 +1329,7 @@ var Q = (e) => ({
1314
1329
  phoneNumber: "",
1315
1330
  phoneCountryCode: e.checkoutProfile.layout.phoneNumber.defaultCountry?.toUpperCase() || "US"
1316
1331
  }), 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() });
1317
- let { formData: t, errors: n, touched: r } = this._getFormStateData(), i = Se(e.checkoutProfile.layout);
1332
+ let { formData: t, errors: n, touched: r } = this._getFormStateData(), i = Ee(e.checkoutProfile.layout);
1318
1333
  try {
1319
1334
  this.componentManager.createPaymentMethods(e.checkoutProfile, t);
1320
1335
  } catch (e) {
@@ -1348,7 +1363,7 @@ var Q = (e) => ({
1348
1363
  } catch (e) {
1349
1364
  console.error("Failed to create card section:", e), this.reportRenderFailure("card_section");
1350
1365
  }
1351
- if (!K(e.checkoutProfile.layout) && this.componentManager.isCardSupported()) try {
1366
+ if (!W(e.checkoutProfile.layout) && this.componentManager.isCardSupported()) try {
1352
1367
  this.componentManager.createCardholderSection(e.checkoutProfile, t, n, r);
1353
1368
  } catch (e) {
1354
1369
  console.error("Failed to create cardholder section:", e), this.reportRenderFailure("cardholder");
@@ -1358,7 +1373,7 @@ var Q = (e) => ({
1358
1373
  this.componentManager.mountVgsFields(e.checkoutProfile).then(async (e) => {
1359
1374
  e && this.vgsMountGeneration === n && this.vgsService === t && (!a || await a) && this.vgsMountGeneration === n && this.vgsService === t && this.reportLoadOutcome({ status: "ready" });
1360
1375
  }).catch((e) => {
1361
- this.vgsMountGeneration === n && this.vgsService === t && (console.error("Failed to mount VGS fields:", e), this.failCardCaptureClosed(w.FIELDS_NOT_READY));
1376
+ this.vgsMountGeneration === n && this.vgsService === t && (console.error("Failed to mount VGS fields:", e), this.failCardCaptureClosed(k.FIELDS_NOT_READY));
1362
1377
  });
1363
1378
  }
1364
1379
  try {
@@ -1373,10 +1388,10 @@ var Q = (e) => ({
1373
1388
  reportRenderFailure(e, t) {
1374
1389
  this.reportLoadOutcome({
1375
1390
  status: "failed",
1376
- reason: M.FORM_RENDER_FAILED,
1391
+ reason: E.FORM_RENDER_FAILED,
1377
1392
  attributes: {
1378
1393
  form_part: e,
1379
- ...t !== void 0 && { error_class: _e(t) }
1394
+ ...t !== void 0 && { error_class: F(t) }
1380
1395
  }
1381
1396
  });
1382
1397
  }
@@ -1389,7 +1404,7 @@ var Q = (e) => ({
1389
1404
  }
1390
1405
  inferCardholderName() {
1391
1406
  let e = this.checkoutProfile.getState();
1392
- if (!e.checkoutProfile || !K(e.checkoutProfile.layout)) return;
1407
+ if (!e.checkoutProfile || !W(e.checkoutProfile.layout)) return;
1393
1408
  let { formData: t } = this._getFormStateData(), n = t.billingAddress ?? t.shippingAddress;
1394
1409
  if (!n) return;
1395
1410
  let r = [n.firstName?.trim() ?? "", n.lastName?.trim() ?? ""].filter(Boolean).join(" ");
@@ -1408,19 +1423,19 @@ var Q = (e) => ({
1408
1423
  }
1409
1424
  async handleSubmit() {
1410
1425
  if (!this.stateCoordinator.isFormDisabled()) try {
1411
- if (this.stateCoordinator.setSubmitting(!0), this.updateFormUI(), this.options.onLoadingStateChange?.(!0), this.uiManager.showSpinner(this.translation.t("loading")), this.inferCardholderName(), this.inferAddresses(), !this.vgsService || !this.vgsJwt) {
1412
- this.options.onSubmitOutcome?.(h(e(/* @__PURE__ */ Error("Card capture unavailable"), be.CAPTURE_UNAVAILABLE), "card")), this.handleSubmitError(this.translation.t("cardUnavailable"));
1426
+ if (this.stateCoordinator.setSubmitting(!0), this.updateFormUI(), this.options.onLoadingStateChange?.(!0), this.uiManager.showSpinner(this.translation.t("loading")), this.inferCardholderName(), this.inferAddresses(), !this.vgsService || !this.vgsSession) {
1427
+ this.options.onSubmitOutcome?.(S(Se(/* @__PURE__ */ Error("Card capture unavailable"), we.CAPTURE_UNAVAILABLE), "card")), this.handleSubmitError(this.translation.t("cardUnavailable"));
1413
1428
  return;
1414
1429
  }
1415
1430
  try {
1416
- this.vgsCardResult = await this.vgsService.createCard(this.vgsJwt);
1431
+ this.vgsCardResult = await this.vgsService.createCard(this.vgsSession);
1417
1432
  } catch (e) {
1418
- console.error("VGS card creation failed:", e), this.options.onSubmitOutcome?.(h(e, "card")), this.handleSubmitError("Card processing failed. Please check your card details and try again.");
1433
+ console.error("VGS card creation failed:", e), this.options.onSubmitOutcome?.(S(e, "card")), this.handleSubmitError("Card processing failed. Please check your card details and try again.");
1419
1434
  return;
1420
1435
  }
1421
- let t = this.formManager.getFormState().formData;
1436
+ let e = this.formManager.getFormState().formData;
1422
1437
  await this.options.onSubmit({ formData: this.vgsCardResult ? {
1423
- ...t,
1438
+ ...e,
1424
1439
  vgsCardData: {
1425
1440
  cardId: this.vgsCardResult.cardId,
1426
1441
  expMonth: this.vgsCardResult.expMonth,
@@ -1428,7 +1443,7 @@ var Q = (e) => ({
1428
1443
  name: this.vgsCardResult.name,
1429
1444
  ...this.vgsCardResult.updatedValues && { updatedValues: this.vgsCardResult.updatedValues }
1430
1445
  }
1431
- } : t }), this.uiManager.hideSpinner(), this.options.onLoadingStateChange?.(!1), this.stateCoordinator.setSubmitting(!1), this.updateFormUI();
1446
+ } : e }), this.uiManager.hideSpinner(), this.options.onLoadingStateChange?.(!1), this.stateCoordinator.setSubmitting(!1), this.updateFormUI();
1432
1447
  } catch {
1433
1448
  this.handleSubmitError("Payment processing failed. Please try again.");
1434
1449
  }
@@ -1471,22 +1486,22 @@ var Q = (e) => ({
1471
1486
  associatePayment(e, t, n, r, i) {
1472
1487
  this.options.paymentId = e, this.options.checkoutKey = t, this.options.supportedPaymentMethods = n, this.options.checkoutDetails = r, this.componentManager.setCheckoutDetailsLoaded(!0), this.componentManager.updateSupportedPaymentMethods(n);
1473
1488
  let a = this.componentManager.isCardSupported();
1474
- if (i && a && (this.vgsJwt = i), i && a && !this.vgsService) {
1475
- let e = new I();
1489
+ if (i && a && (this.vgsSession = this.createVgsSession(i)), i && a && !this.vgsService) {
1490
+ let e = new g();
1476
1491
  this.vgsService = e, this.componentManager.setVgsService(e), this.stateCoordinator.setVgsMode(!0), e.init(this.options.environment).then((t) => {
1477
1492
  this.vgsService === e && (e.createForm(t, (e) => this.handleVgsStateChange(e)), this.recoverCardCapture(), this.renderFormComponents());
1478
1493
  }).catch((t) => {
1479
- this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(w.INIT_FAILED));
1494
+ this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(k.INIT_FAILED));
1480
1495
  });
1481
1496
  }
1482
- this.componentManager.removePaymentMethods(), this.componentManager.updatePaymentDetails(e, t, r), (!i || !a) && this.failCardCaptureClosed(w.NO_TOKENIZATION_SESSION);
1497
+ this.componentManager.removePaymentMethods(), this.componentManager.updatePaymentDetails(e, t, r), (!i || !a) && this.failCardCaptureClosed(k.NO_TOKENIZATION_SESSION);
1483
1498
  let o = this.checkoutProfile.getState();
1484
1499
  if (o.checkoutProfile) {
1485
1500
  let { formData: e } = this._getFormStateData();
1486
1501
  this.componentManager.createPaymentMethods(o.checkoutProfile, e, !0);
1487
1502
  }
1488
1503
  }
1489
- }, Ie = class {
1504
+ }, Be = class {
1490
1505
  container = null;
1491
1506
  options;
1492
1507
  onSubmit;
@@ -1504,7 +1519,7 @@ var Q = (e) => ({
1504
1519
  }) : e.errorMsg && !this.options.disableErrorMessages ? this.form.setErrorMessage(e.errorMsg) : this.renderForm(e.errorMsg));
1505
1520
  }
1506
1521
  renderForm(e) {
1507
- this.container && (this.form &&= (this.form.destroy(), null), this.form = new Fe({
1522
+ this.container && (this.form &&= (this.form.destroy(), null), this.form = new ze({
1508
1523
  apiKey: this.options.apiKey,
1509
1524
  onSubmit: this.onSubmit,
1510
1525
  locale: this.options.locale,
@@ -1536,7 +1551,7 @@ var Q = (e) => ({
1536
1551
  async associatePayment(e, t, n, r, i) {
1537
1552
  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);
1538
1553
  }
1539
- }, Le = class {
1554
+ }, Ve = class {
1540
1555
  state;
1541
1556
  listeners = /* @__PURE__ */ new Set();
1542
1557
  constructor(e) {
@@ -1560,7 +1575,7 @@ var Q = (e) => ({
1560
1575
  let e = this.getState();
1561
1576
  this.listeners.forEach((t) => t(e));
1562
1577
  }
1563
- }, Re = "en", $ = class {
1578
+ }, He = "en", $ = class {
1564
1579
  config;
1565
1580
  _callbacks;
1566
1581
  paymentState;
@@ -1571,14 +1586,14 @@ var Q = (e) => ({
1571
1586
  readiness = new o();
1572
1587
  associationSequence = 0;
1573
1588
  constructor(e) {
1574
- this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(), u(), pe({
1589
+ this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(), u(), fe({
1575
1590
  environment: this.config.environment,
1576
1591
  sessionId: this.sessionId,
1577
1592
  integration: "dropin"
1578
- }), A(F.CHECKOUT_INITIALIZED, { environment: this.config.environment }), this.apiService = new ye(this.config.apiKey, this.config.environment), this.stateManager = new Le({
1593
+ }), A(O.CHECKOUT_INITIALIZED, { environment: this.config.environment }), this.apiService = new Ce(this.config.apiKey, this.config.environment), this.stateManager = new Ve({
1579
1594
  mounted: !1,
1580
1595
  form: null
1581
- }), this.formManager = new Ie({
1596
+ }), this.formManager = new Be({
1582
1597
  locale: this.config.locale,
1583
1598
  apiKey: this.config.apiKey,
1584
1599
  disableErrorMessages: this.config.disableErrorMessages,
@@ -1599,7 +1614,7 @@ var Q = (e) => ({
1599
1614
  apiKey: e.apiKey,
1600
1615
  returnUrl: e.returnUrl,
1601
1616
  environment: e.environment,
1602
- locale: e.locale || Re,
1617
+ locale: e.locale || He,
1603
1618
  disableErrorMessages: e.disableErrorMessages ?? !1,
1604
1619
  manualActionHandling: e.manualActionHandling ?? !1,
1605
1620
  appearance: e.appearance,
@@ -1620,15 +1635,15 @@ var Q = (e) => ({
1620
1635
  return n = !0, t = document.createElement("div"), r.appendChild(t), this.stateManager.updateState({
1621
1636
  form: t,
1622
1637
  mounted: !0
1623
- }), this.formManager.mount(t), this.readiness.markMounted(), A(F.CHECKOUT_MOUNTED, { container_id: e }), this;
1638
+ }), this.formManager.mount(t), this.readiness.markMounted(), A(O.CHECKOUT_MOUNTED, { container_id: e }), this;
1624
1639
  } catch (r) {
1625
1640
  throw t?.remove(), this.stateManager.updateState({
1626
1641
  form: null,
1627
1642
  mounted: !1
1628
- }), A(F.CHECKOUT_MOUNT_FAILED, {
1643
+ }), A(O.CHECKOUT_MOUNT_FAILED, {
1629
1644
  container_id: e,
1630
1645
  error_message: r instanceof Error ? r.message : "Unknown error"
1631
- }), R(r instanceof Error ? r : /* @__PURE__ */ Error("Failed to mount checkout"), { container_id: e }), n ? this.readiness.fail({ reason: M.MOUNT_FAILED }) : this.readiness.exclude({ reason: M.CONTAINER_NOT_FOUND }), r;
1646
+ }), v(r instanceof Error ? r : /* @__PURE__ */ Error("Failed to mount checkout"), { container_id: e }), n ? this.readiness.fail({ reason: E.MOUNT_FAILED }) : this.readiness.exclude({ reason: E.CONTAINER_NOT_FOUND }), r;
1632
1647
  }
1633
1648
  }
1634
1649
  unmount() {
@@ -1639,66 +1654,66 @@ var Q = (e) => ({
1639
1654
  e && e.remove(), this.stateManager.updateState({
1640
1655
  form: null,
1641
1656
  mounted: !1
1642
- }), A(F.CHECKOUT_UNMOUNTED);
1657
+ }), A(O.CHECKOUT_UNMOUNTED);
1643
1658
  });
1644
1659
  }
1645
- async handleSubmit({ formData: e, applePayData: t }) {
1660
+ async handleSubmit({ formData: t, applePayData: n }) {
1646
1661
  if (!this.paymentState.paymentId || !this.paymentState.checkoutKey) throw Error("Payment must be associated before submitting. Call associatePayment() first.");
1647
- let n = this.getPaymentMethod(e, t);
1648
- A(F.PAYMENT_SUBMIT_STARTED, {
1662
+ let r = this.getPaymentMethod(t, n);
1663
+ A(O.PAYMENT_SUBMIT_STARTED, {
1649
1664
  payment_id: this.paymentState.paymentId,
1650
- payment_method: n
1665
+ payment_method: r
1651
1666
  });
1652
- let r = performance.now();
1667
+ let i = performance.now();
1653
1668
  try {
1654
- let i = await this.apiService.authorizePayment({
1669
+ let e = await this.apiService.authorizePayment({
1655
1670
  checkoutKey: this.paymentState.checkoutKey,
1656
- formData: e || null,
1671
+ formData: t || null,
1657
1672
  paymentId: this.paymentState.paymentId,
1658
1673
  returnUrl: this.config.returnUrl,
1659
- applePayData: t
1674
+ applePayData: n
1660
1675
  });
1661
1676
  this.readiness.reportSubmit({
1662
- outcome: ve.SUCCEEDED,
1663
- paymentMethod: n
1677
+ outcome: ce.SUCCEEDED,
1678
+ paymentMethod: r
1664
1679
  });
1665
- let a = performance.now() - r;
1666
- return N(O.PAYMENT_AUTHORIZATION_TIME, a, "ms", {
1680
+ let a = performance.now() - i;
1681
+ return b(_.PAYMENT_AUTHORIZATION_TIME, a, "ms", {
1667
1682
  payment_id: this.paymentState.paymentId,
1668
- payment_method: n,
1683
+ payment_method: r,
1669
1684
  status: "success"
1670
- }), A(F.PAYMENT_SUBMIT_SUCCESS, {
1685
+ }), A(O.PAYMENT_SUBMIT_SUCCESS, {
1671
1686
  payment_id: this.paymentState.paymentId,
1672
- payment_method: n
1673
- }), this.handlePaymentResponse(i);
1674
- } catch (e) {
1675
- let t = performance.now() - r;
1676
- return N(O.PAYMENT_AUTHORIZATION_TIME, t, "ms", {
1687
+ payment_method: r
1688
+ }), this.handlePaymentResponse(e);
1689
+ } catch (t) {
1690
+ let n = performance.now() - i;
1691
+ return b(_.PAYMENT_AUTHORIZATION_TIME, n, "ms", {
1677
1692
  payment_id: this.paymentState.paymentId,
1678
- payment_method: n,
1693
+ payment_method: r,
1679
1694
  status: "failed"
1680
- }), A(F.PAYMENT_SUBMIT_FAILED, {
1695
+ }), A(O.PAYMENT_SUBMIT_FAILED, {
1681
1696
  payment_id: this.paymentState.paymentId,
1682
- payment_method: n,
1683
- error_message: e.details?.message ?? "Unknown error",
1684
- ...x(e)
1685
- }), this.readiness.reportSubmit(v(e, n)), this.handleAuthorizationError(e), !1;
1697
+ payment_method: r,
1698
+ error_message: t.details?.message ?? "Unknown error",
1699
+ ...L(t)
1700
+ }), this.readiness.reportSubmit(e(t, r)), this.handleAuthorizationError(t), !1;
1686
1701
  }
1687
1702
  }
1688
1703
  handlePaymentResponse(e) {
1689
- let t = !1, n = ge(e);
1690
- if (n === "authorized" && (A(F.PAYMENT_AUTHORIZED, {
1704
+ let t = !1, n = xe(e);
1705
+ if (n === "authorized" && (A(O.PAYMENT_AUTHORIZED, {
1691
1706
  payment_id: this.paymentState.paymentId ?? "",
1692
1707
  status: n
1693
- }), V(() => this._callbacks.onPaymentSucceeded?.(n)), t = !0), n === "failed" && (A(F.PAYMENT_FAILED, {
1708
+ }), w(() => this._callbacks.onPaymentSucceeded?.(n)), t = !0), n === "failed" && (A(O.PAYMENT_FAILED, {
1694
1709
  payment_id: this.paymentState.paymentId ?? "",
1695
1710
  status: n
1696
- }), V(() => this._callbacks.onPaymentFailed?.(n))), e.status === "requires_action") {
1711
+ }), w(() => this._callbacks.onPaymentFailed?.(n))), e.status === "requires_action") {
1697
1712
  let { redirectUrl: n } = e.action;
1698
- A(F.PAYMENT_ACTION_REQUIRED, {
1713
+ A(O.PAYMENT_ACTION_REQUIRED, {
1699
1714
  payment_id: this.paymentState.paymentId ?? "",
1700
1715
  status: e.status
1701
- }), this.config.manualActionHandling ? V(() => this._callbacks.onActionRequired?.(n)) : globalThis.location.href = n, t = !0;
1716
+ }), this.config.manualActionHandling ? w(() => this._callbacks.onActionRequired?.(n)) : globalThis.location.href = n, t = !0;
1702
1717
  }
1703
1718
  return t;
1704
1719
  }
@@ -1731,36 +1746,36 @@ var Q = (e) => ({
1731
1746
  async associatePayment(e, t) {
1732
1747
  if (!e || !t) throw Error("paymentId and checkoutKey are required");
1733
1748
  let n = ++this.associationSequence;
1734
- this.readiness.start(e), this.paymentState.paymentId = e, this.paymentState.checkoutKey = t, l(this.config.environment);
1735
- let r = y.CHECKOUT_DETAILS;
1749
+ this.readiness.start(e), this.paymentState.paymentId = e, this.paymentState.checkoutKey = t, ae(this.config.environment);
1750
+ let r = V.CHECKOUT_DETAILS;
1736
1751
  try {
1737
- let i = await he({
1752
+ let i = await ge({
1738
1753
  id: e,
1739
1754
  checkoutKey: t,
1740
1755
  environment: this.config.environment
1741
1756
  });
1742
- if (!i || !i.supportedPaymentMethods || !Array.isArray(i.supportedPaymentMethods)) throw S(/* @__PURE__ */ Error("Invalid response: supportedPaymentMethods must be an array"), E.INVALID_RESPONSE, j(i));
1743
- if (!i.supportedPaymentMethods.every((e) => typeof e == "string")) throw S(/* @__PURE__ */ Error("Invalid response: all supportedPaymentMethods must be strings"), E.INVALID_RESPONSE, j(i));
1757
+ if (!i || !i.supportedPaymentMethods || !Array.isArray(i.supportedPaymentMethods)) throw M(/* @__PURE__ */ Error("Invalid response: supportedPaymentMethods must be an array"), R.INVALID_RESPONSE, x(i));
1758
+ if (!i.supportedPaymentMethods.every((e) => typeof e == "string")) throw M(/* @__PURE__ */ Error("Invalid response: all supportedPaymentMethods must be strings"), R.INVALID_RESPONSE, x(i));
1744
1759
  if (n !== this.associationSequence) return;
1745
- r = y.FORM_SETUP, this.readiness.markAssociated(), this.paymentState.checkoutDetails = {
1760
+ r = V.FORM_SETUP, this.readiness.markAssociated(), this.paymentState.checkoutDetails = {
1746
1761
  amount: i.amount,
1747
1762
  currency: i.currency,
1748
1763
  countryCode: i.countryCode
1749
1764
  };
1750
1765
  let a = i.supportedPaymentMethods.reduce((e, t) => (e[t] = !0, e), {});
1751
- await this.formManager.associatePayment(e, t, a, this.paymentState.checkoutDetails, i.vgsJwt), A(F.PAYMENT_ASSOCIATED, {
1766
+ await this.formManager.associatePayment(e, t, a, this.paymentState.checkoutDetails, i.vgsJwt), A(O.PAYMENT_ASSOCIATED, {
1752
1767
  payment_id: e,
1753
1768
  currency: i.currency,
1754
1769
  country_code: i.countryCode
1755
1770
  });
1756
1771
  } catch (t) {
1757
- if (A(F.PAYMENT_ASSOCIATION_FAILED, {
1772
+ if (A(O.PAYMENT_ASSOCIATION_FAILED, {
1758
1773
  payment_id: e,
1759
1774
  error_message: t instanceof Error ? t.message : "Unknown error",
1760
1775
  stage: r,
1761
- ...x(t)
1762
- }), R(t instanceof Error ? t : /* @__PURE__ */ Error("Failed to associate payment"), { payment_id: e }), n === this.associationSequence) {
1763
- let { ours: e, ...n } = re(t, r);
1776
+ ...L(t)
1777
+ }), v(t instanceof Error ? t : /* @__PURE__ */ Error("Failed to associate payment"), { payment_id: e }), n === this.associationSequence) {
1778
+ let { ours: e, ...n } = te(t, r);
1764
1779
  e ? this.readiness.fail(n) : this.readiness.exclude(n);
1765
1780
  }
1766
1781
  throw t;
@@ -1774,4 +1789,4 @@ var Q = (e) => ({
1774
1789
  //#region libs/checkout/src/index.ts
1775
1790
  typeof globalThis < "u" && (globalThis.OdusCheckout = $);
1776
1791
  //#endregion
1777
- export { $ as OdusCheckout, ee as deLocale, p as enLocale, f as esLocale, le as frLocale, t as itLocale, ue as plLocale, m as ptLocale, R as pushError, A as pushEvent, oe as pushLog, N as pushMeasurement, i as trLocale };
1792
+ export { $ as OdusCheckout, ee as deLocale, p as enLocale, f as esLocale, pe as frLocale, t as itLocale, me as plLocale, m as ptLocale, v as pushError, A as pushEvent, be as pushLog, b as pushMeasurement, i as trLocale };