@odus/checkout 1.17.1 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/checkout.es.js +241 -231
  2. package/dist/components/checkout/form/AddressSection.d.ts.map +1 -1
  3. package/dist/components/checkout/form/CardSection.d.ts.map +1 -1
  4. package/dist/components/checkout/form/CardUnavailableNotice.d.ts.map +1 -1
  5. package/dist/components/checkout/form/CardholderSection.d.ts.map +1 -1
  6. package/dist/components/checkout/form/Form.d.ts.map +1 -1
  7. package/dist/components/checkout/form/FormComponentManager.d.ts.map +1 -1
  8. package/dist/components/checkout/form/PhoneCountrySelector.d.ts.map +1 -1
  9. package/dist/components/checkout/form/PhoneNumberField.d.ts.map +1 -1
  10. package/dist/components/common/CountryDialCodeDropdown.d.ts.map +1 -1
  11. package/dist/components/common/Input.d.ts.map +1 -1
  12. package/dist/components/common/Select.d.ts.map +1 -1
  13. package/dist/core/constants/fontSize.constants.d.ts +7 -0
  14. package/dist/core/constants/fontSize.constants.d.ts.map +1 -0
  15. package/dist/core/vgs/VGSCollectService.d.ts +0 -7
  16. package/dist/core/vgs/VGSCollectService.d.ts.map +1 -1
  17. package/dist/elements/ApplePayElement.d.ts.map +1 -1
  18. package/dist/elements/EmailElement.d.ts.map +1 -1
  19. package/dist/elements/PayPalElement.d.ts.map +1 -1
  20. package/dist/elements/PhoneElement.d.ts.map +1 -1
  21. package/dist/elements/card/VgsCardAdapter.d.ts.map +1 -1
  22. package/dist/elements/cardElement.constants.d.ts.map +1 -1
  23. package/dist/elements/theme/index.d.ts.map +1 -1
  24. package/dist/elements.es.js +267 -267
  25. package/dist/factories/createCheckoutProfile.d.ts.map +1 -1
  26. package/dist/loader/loadOdus.d.ts +9 -1
  27. package/dist/loader/loadOdus.d.ts.map +1 -1
  28. package/dist/loader.d.ts +1 -1
  29. package/dist/loader.d.ts.map +1 -1
  30. package/dist/loader.es.js +20 -17
  31. package/dist/phone.js +477 -474
  32. package/dist/shared.js +360 -391
  33. package/dist/types/common/FormData.type.d.ts +0 -2
  34. package/dist/types/common/FormData.type.d.ts.map +1 -1
  35. package/dist/types/telemetry/TelemetryEvents.type.d.ts +2 -2
  36. package/dist/types/telemetry/TelemetryEvents.type.d.ts.map +1 -1
  37. package/dist/utils/dom/fontFamily.util.d.ts +23 -0
  38. package/dist/utils/dom/fontFamily.util.d.ts.map +1 -0
  39. package/dist/utils/dom/googleFontUrl.d.ts +5 -5
  40. package/dist/utils/dom/googleFontUrl.d.ts.map +1 -1
  41. package/dist/utils/dom/index.d.ts +1 -0
  42. package/dist/utils/dom/index.d.ts.map +1 -1
  43. package/dist/utils/phone/countryDialCodes.d.ts +6 -0
  44. package/dist/utils/phone/countryDialCodes.d.ts.map +1 -1
  45. package/package.json +1 -1
@@ -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 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";
1
+ import { $ as e, A as t, B as n, C as r, E as i, F as a, I as o, J as s, K as c, L as l, M as u, N as d, O as f, P as p, Q as m, R as h, S as ee, St as te, T as ne, U as re, V as g, W as ie, X as _, Y as ae, Z as oe, _ as se, _t as v, at as ce, b as y, bt as b, c as le, ct as ue, d as de, dt as x, et as fe, f as S, ft as C, g as w, gt as T, h as E, ht as D, i as pe, it as me, j as he, k as ge, l as _e, lt as O, mt as k, n as ve, nt as ye, o as be, ot as A, p as j, pt as M, q as N, r as xe, s as Se, st as P, t as Ce, tt as F, u as I, ut as we, vt as L, w as R, x as z, xt as Te, y as B, yt as V, z as H } from "./shared.js";
2
2
  import { t as U } from "./shared2.js";
3
3
  //#region libs/checkout/src/utils/focus/FocusManager.ts
4
- var Te = class {
4
+ var Ee = class {
5
5
  focusSequence = [
6
6
  "cardNumber",
7
7
  "cardExpiry",
@@ -81,7 +81,7 @@ var Te = class {
81
81
  };
82
82
  //#endregion
83
83
  //#region libs/checkout/src/utils/helpers/hasAddressConfiguration.util.ts
84
- function Ee(e) {
84
+ function De(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);
@@ -113,9 +113,9 @@ var G = class extends z {
113
113
  let { title: t, checkoutProfile: n, fieldsConfig: r, values: i, errors: a, touched: o } = e;
114
114
  if (this.grouped) {
115
115
  let e = document.createElement("h3");
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);
116
+ e.className = "address-section-title", e.textContent = t, e.style.color = n.styles.textColor, e.style.fontFamily = R(n.styles.fontFamily), 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 T({
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 w({
119
119
  text: "",
120
120
  visible: !1
121
121
  }), this.fieldsContainer.appendChild(this.groupMessage.getElement()));
@@ -124,69 +124,69 @@ var G = class extends z {
124
124
  let a = (t) => t ? `${e}px` : "0px";
125
125
  return `${a(t)} ${a(n)} ${a(r)} ${a(i)}`;
126
126
  }
127
- createFields(e, t, n, r, i) {
127
+ createFields(e, t, r, i, a) {
128
128
  if (!this.grouped) {
129
- this.createUngroupedFields(e, t, n, r, i);
129
+ this.createUngroupedFields(e, t, r, i, a);
130
130
  return;
131
131
  }
132
- let a = e.styles.borderRadius, o = {
132
+ let o = e.styles.borderRadius, s = {
133
133
  color: e.styles.textColor,
134
134
  fontSize: e.styles.fontSize,
135
135
  fontFamily: e.styles.fontFamily
136
- }, s = [];
137
- t.street?.enabled && s.push({ kind: "street" });
138
- let c = [];
139
- t.firstName?.enabled && c.push("firstName"), t.lastName?.enabled && c.push("lastName"), c.length > 0 && s.push({
140
- kind: "name",
141
- fields: c
142
- }), t.country?.enabled && s.push({ kind: "country" });
136
+ }, c = [];
137
+ t.street?.enabled && c.push({ kind: "street" });
143
138
  let l = [];
144
- t.city?.enabled && l.push("city"), t.zipCode?.enabled && l.push("zipCode"), l.length > 0 && s.push({
145
- kind: "cityZip",
139
+ t.firstName?.enabled && l.push("firstName"), t.lastName?.enabled && l.push("lastName"), l.length > 0 && c.push({
140
+ kind: "name",
146
141
  fields: l
147
- }), t.state?.enabled && s.push({ kind: "state" });
148
- let u = s.length;
149
- s.forEach((e, s) => {
150
- let c = s === 0, l = s === u - 1, d = (e, t) => ({
151
- ...o,
152
- borderRadius: this.borderRadius(a, c && e, c && t, l && t, l && e)
142
+ }), t.country?.enabled && c.push({ kind: "country" });
143
+ let u = [];
144
+ t.city?.enabled && u.push("city"), t.zipCode?.enabled && u.push("zipCode"), u.length > 0 && c.push({
145
+ kind: "cityZip",
146
+ fields: u
147
+ }), t.state?.enabled && c.push({ kind: "state" });
148
+ let d = c.length;
149
+ c.forEach((e, c) => {
150
+ let l = c === 0, u = c === d - 1, f = (e, t) => ({
151
+ ...s,
152
+ borderRadius: this.borderRadius(o, l && e, l && t, u && t, u && e)
153
153
  });
154
154
  if (e.kind === "street") {
155
- let e = this.createRow(["full"]), a = this.createInput("street", t.street?.label ?? this.translationFunc("address.addressLine1"), n.street, r.street, i.street, d(!0, !0), "street-address", t.street?.maxLength);
156
- this.inputs.set("street", a), e.appendChild(a.getElement()), this.fieldsContainer.appendChild(e);
155
+ let e = this.createRow(["full"]), n = this.createInput("street", t.street?.label ?? this.translationFunc("address.addressLine1"), r.street, i.street, a.street, f(!0, !0), "street-address", t.street?.maxLength);
156
+ this.inputs.set("street", n), e.appendChild(n.getElement()), this.fieldsContainer.appendChild(e);
157
157
  } else if (e.kind === "name") {
158
- let a = this.createRow(e.fields.map(() => "half")), o = e.fields.length === 1;
158
+ let n = this.createRow(e.fields.map(() => "half")), o = e.fields.length === 1;
159
159
  if (e.fields.includes("firstName")) {
160
- let s = o || e.fields[e.fields.length - 1] === "firstName", c = this.createInput("firstName", t.firstName?.label ?? this.translationFunc("address.firstName"), n.firstName, r.firstName, i.firstName, d(!0, s), "given-name");
161
- this.inputs.set("firstName", c), a.appendChild(c.getElement());
160
+ let s = o || e.fields[e.fields.length - 1] === "firstName", c = this.createInput("firstName", t.firstName?.label ?? this.translationFunc("address.firstName"), r.firstName, i.firstName, a.firstName, f(!0, s), "given-name");
161
+ this.inputs.set("firstName", c), n.appendChild(c.getElement());
162
162
  }
163
163
  if (e.fields.includes("lastName")) {
164
- let s = o || e.fields[0] === "lastName", c = this.createInput("lastName", t.lastName?.label ?? this.translationFunc("address.lastName"), n.lastName, r.lastName, i.lastName, d(s, !0), "family-name");
165
- this.inputs.set("lastName", c), a.appendChild(c.getElement());
164
+ let s = o || e.fields[0] === "lastName", c = this.createInput("lastName", t.lastName?.label ?? this.translationFunc("address.lastName"), r.lastName, i.lastName, a.lastName, f(s, !0), "family-name");
165
+ this.inputs.set("lastName", c), n.appendChild(c.getElement());
166
166
  }
167
- this.fieldsContainer.appendChild(a);
167
+ this.fieldsContainer.appendChild(n);
168
168
  } else if (e.kind === "country") {
169
- let e = this.createRow(["full"]), a = this.createCountrySelect(n.country, r.country, i.country, d(!0, !0), t.country?.options, t.country?.label);
170
- this.inputs.set("country", a), e.appendChild(a.getElement()), this.fieldsContainer.appendChild(e);
169
+ let e = this.createRow(["full"]), n = this.createCountrySelect(r.country, i.country, a.country, f(!0, !0), t.country?.options, t.country?.label);
170
+ this.inputs.set("country", n), e.appendChild(n.getElement()), this.fieldsContainer.appendChild(e);
171
171
  } else if (e.kind === "cityZip") {
172
- let a = this.createRow(e.fields.map(() => "half")), o = e.fields.length === 1;
172
+ let n = this.createRow(e.fields.map(() => "half")), o = e.fields.length === 1;
173
173
  if (e.fields.includes("city")) {
174
- let s = o || e.fields[e.fields.length - 1] === "city", c = this.createInput("city", t.city?.label ?? this.translationFunc("address.townCity"), n.city, r.city, i.city, d(!0, s), "address-level2");
175
- this.inputs.set("city", c), a.appendChild(c.getElement());
174
+ let s = o || e.fields[e.fields.length - 1] === "city", c = this.createInput("city", t.city?.label ?? this.translationFunc("address.townCity"), r.city, i.city, a.city, f(!0, s), "address-level2");
175
+ this.inputs.set("city", c), n.appendChild(c.getElement());
176
176
  }
177
177
  if (e.fields.includes("zipCode")) {
178
- let s = o || e.fields[0] === "zipCode", c = this.createInput("zipCode", t.zipCode?.label ?? this.translationFunc("address.postalCode"), n.zipCode, r.zipCode, i.zipCode, d(s, !0), "postal-code");
179
- this.inputs.set("zipCode", c), a.appendChild(c.getElement());
178
+ let s = o || e.fields[0] === "zipCode", c = this.createInput("zipCode", t.zipCode?.label ?? this.translationFunc("address.postalCode"), r.zipCode, i.zipCode, a.zipCode, f(s, !0), "postal-code");
179
+ this.inputs.set("zipCode", c), n.appendChild(c.getElement());
180
180
  }
181
- this.fieldsContainer.appendChild(a);
181
+ this.fieldsContainer.appendChild(n);
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"), H(n.country)) {
185
- let a = this.createStateSelect(n.state, r.state, i.state, this.stateStyles, n.country, t.state?.label);
186
- this.inputs.set("state", a), e.appendChild(a.getElement());
184
+ if (this.stateFieldConfig = t.state, this.stateRow = e, this.stateStyles = f(!0, !0), this.currentCountry = r.country, t.state?.hiddenForCountries?.includes(r.country) && (e.style.display = "none"), n(r.country)) {
185
+ let n = this.createStateSelect(r.state, i.state, a.state, this.stateStyles, r.country, t.state?.label);
186
+ this.inputs.set("state", n), e.appendChild(n.getElement());
187
187
  } else {
188
- let a = this.createInput("state", t.state?.label ?? this.translationFunc("address.state"), n.state, r.state, i.state, this.stateStyles, "address-level1");
189
- this.inputs.set("state", a), e.appendChild(a.getElement());
188
+ let n = this.createInput("state", t.state?.label ?? this.translationFunc("address.state"), r.state, i.state, a.state, this.stateStyles, "address-level1");
189
+ this.inputs.set("state", n), e.appendChild(n.getElement());
190
190
  }
191
191
  this.fieldsContainer.appendChild(e);
192
192
  }
@@ -239,7 +239,7 @@ var G = class extends z {
239
239
  }), l;
240
240
  }
241
241
  createCountrySelect(e, t, n, r, i, a) {
242
- let o = `${this.type}Address.country`, s = se(i, this.locale), c = new C({
242
+ let o = `${this.type}Address.country`, s = se(i, this.locale), c = new S({
243
243
  name: o,
244
244
  error: !1,
245
245
  errorMsg: void 0,
@@ -281,12 +281,12 @@ var G = class extends z {
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 = H(e);
284
+ let a = this.inputs.get("state") instanceof S, o = n(e);
285
285
  if (a && o) {
286
286
  let t = this.inputs.get("state");
287
- if (t instanceof C) {
288
- let r = n(e), i = d(r), a = this.translationFunc(h(r));
289
- t.setOptions(i, a);
287
+ if (t instanceof S) {
288
+ let n = g(e), r = h(n), i = this.translationFunc(H(n));
289
+ t.setOptions(r, i);
290
290
  }
291
291
  this.clearStateValue();
292
292
  } else a === o ? !a && !o && t !== e && this.clearStateValue() : (this.rebuildStateField(e), this.clearStateValue());
@@ -295,7 +295,7 @@ var G = class extends z {
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")), H(e)) {
298
+ if (t && (t.getElement().remove(), this.inputs.delete("state")), n(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 {
@@ -316,68 +316,68 @@ var G = class extends z {
316
316
  detail: { programmatic: !0 }
317
317
  }));
318
318
  }
319
- createStateSelect(e, t, r, i, a, o) {
320
- let s = `${this.type}Address.state`, c = n(a), l = d(c), u = this.translationFunc(h(c)), f = new C({
321
- name: s,
319
+ createStateSelect(e, t, n, r, i, a) {
320
+ let o = `${this.type}Address.state`, s = g(i), c = h(s), l = this.translationFunc(H(s)), u = new S({
321
+ name: o,
322
322
  error: !1,
323
323
  errorMsg: void 0,
324
- styles: i,
325
- placeholder: u,
324
+ styles: r,
325
+ placeholder: l,
326
326
  renderMessage: !this.grouped,
327
- ...!this.grouped && { label: o ?? u },
327
+ ...!this.grouped && { label: a ?? l },
328
328
  value: e,
329
- options: l,
329
+ options: c,
330
330
  autocomplete: "address-level1",
331
331
  onChange: (e) => {
332
332
  this.applyFieldError("state", !1), this.onChange(U({
333
333
  type: "change",
334
334
  target: {
335
- name: s,
335
+ name: o,
336
336
  value: e.target.value
337
337
  }
338
338
  }));
339
339
  }
340
340
  });
341
- return f.addEventListener("blur", (e) => {
341
+ return u.addEventListener("blur", (e) => {
342
342
  this.onBlur(U({
343
343
  type: "blur",
344
344
  target: {
345
- name: s,
345
+ name: o,
346
346
  value: e.target.value
347
347
  }
348
348
  }));
349
- }), f;
349
+ }), u;
350
350
  }
351
- createUngroupedFields(e, t, n, r, i) {
352
- let a = e.styles.borderRadius, o = {
351
+ createUngroupedFields(e, t, r, i, a) {
352
+ let o = e.styles.borderRadius, s = {
353
353
  color: e.styles.textColor,
354
354
  fontSize: e.styles.fontSize,
355
355
  fontFamily: e.styles.fontFamily,
356
- borderRadius: `${a}px`
357
- }, s = (e, a, s, c) => {
356
+ borderRadius: `${o}px`
357
+ }, c = (e, n, o, c) => {
358
358
  if (!t[e]?.enabled) return;
359
- let l = t[e]?.label ?? this.translationFunc(a), u = this.createRow(["full"]), d = this.createInput(e, l, n[e], r[e], i[e], o, s, c);
359
+ let l = t[e]?.label ?? this.translationFunc(n), u = this.createRow(["full"]), d = this.createInput(e, l, r[e], i[e], a[e], s, o, c);
360
360
  this.inputs.set(e, d), u.appendChild(d.getElement()), this.fieldsContainer.appendChild(u);
361
361
  };
362
- if (s("firstName", "address.firstName", "given-name"), s("lastName", "address.lastName", "family-name"), s("street", "address.addressLine1", "street-address", t.street?.maxLength), s("city", "address.townCity", "address-level2"), t.country?.enabled) {
363
- let e = t.country?.label ?? this.translationFunc("address.chooseCountry"), a = this.createRow(["full"]), s = this.createCountrySelect(n.country, r.country, i.country, o, t.country?.options, e);
364
- this.inputs.set("country", s), a.appendChild(s.getElement()), this.fieldsContainer.appendChild(a);
362
+ if (c("firstName", "address.firstName", "given-name"), c("lastName", "address.lastName", "family-name"), c("street", "address.addressLine1", "street-address", t.street?.maxLength), c("city", "address.townCity", "address-level2"), t.country?.enabled) {
363
+ let e = t.country?.label ?? this.translationFunc("address.chooseCountry"), n = this.createRow(["full"]), o = this.createCountrySelect(r.country, i.country, a.country, s, t.country?.options, e);
364
+ this.inputs.set("country", o), n.appendChild(o.getElement()), this.fieldsContainer.appendChild(n);
365
365
  }
366
366
  if (t.state?.enabled) {
367
367
  this.stateFieldConfig = t.state;
368
368
  let e = this.createRow(["full"]);
369
- this.stateRow = e, this.stateStyles = o, this.currentCountry = n.country, t.state?.hiddenForCountries?.includes(n.country) && (e.style.display = "none");
370
- let a = H(n.country), s = t.state?.label ?? this.translationFunc("address.state");
371
- if (a) {
372
- let t = this.createStateSelect(n.state, r.state, i.state, o, n.country, s);
369
+ this.stateRow = e, this.stateStyles = s, this.currentCountry = r.country, t.state?.hiddenForCountries?.includes(r.country) && (e.style.display = "none");
370
+ let o = n(r.country), c = t.state?.label ?? this.translationFunc("address.state");
371
+ if (o) {
372
+ let t = this.createStateSelect(r.state, i.state, a.state, s, r.country, c);
373
373
  this.inputs.set("state", t), e.appendChild(t.getElement());
374
374
  } else {
375
- let t = this.createInput("state", s, n.state, r.state, i.state, o, "address-level1");
375
+ let t = this.createInput("state", c, r.state, i.state, a.state, s, "address-level1");
376
376
  this.inputs.set("state", t), e.appendChild(t.getElement());
377
377
  }
378
378
  this.fieldsContainer.appendChild(e);
379
379
  }
380
- s("zipCode", "address.postalCode", "postal-code");
380
+ c("zipCode", "address.postalCode", "postal-code");
381
381
  }
382
382
  getValue(e) {
383
383
  return this.inputs.get(e)?.getValue() ?? "";
@@ -433,7 +433,7 @@ var G = class extends z {
433
433
  let e = this.inputs.values().next().value;
434
434
  e && e.focus();
435
435
  }
436
- }, De = class {
436
+ }, Oe = class {
437
437
  input = null;
438
438
  isVgsMode;
439
439
  vgsWrapper = null;
@@ -453,9 +453,9 @@ var G = class extends z {
453
453
  let r = document.createElement("div");
454
454
  r.style.marginBottom = "4px";
455
455
  let i = document.createElement("label");
456
- 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";
456
+ i.className = "input-label", i.textContent = t("cardholderNameLabel"), i.style.fontFamily = R(e.styles.fontFamily), 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";
457
457
  let a = document.createElement("div");
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());
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 w({ visible: !1 }), this.wrapperElement.appendChild(this.vgsHelperText.getElement());
459
459
  }
460
460
  buildNativeLayout(e, t, n, r, i, a, o) {
461
461
  this.input = new j({
@@ -537,14 +537,14 @@ var G = class extends z {
537
537
  this.appendChild(this.createPaymentMethodSkeleton()), this.appendChild(this.createPaymentSeparatorSkeleton());
538
538
  }
539
539
  createPaymentMethodSkeleton() {
540
- let e = D.createDiv(["skeleton-field"]), t = D.createDiv(["skeleton", "skeleton-payment-method"]);
540
+ let e = E.createDiv(["skeleton-field"]), t = E.createDiv(["skeleton", "skeleton-payment-method"]);
541
541
  return e.appendChild(t), e;
542
542
  }
543
543
  createPaymentSeparatorSkeleton() {
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"]);
544
+ let e = E.createDiv(["payment-separator_container"]), t = E.createDiv(["payment-separator__line"]), n = E.createDiv(["skeleton", "skeleton-separator-text"]), r = E.createDiv(["payment-separator__line"]);
545
545
  return e.appendChild(t), e.appendChild(n), e.appendChild(r), e;
546
546
  }
547
- }, Oe = class extends z {
547
+ }, ke = 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 G = class extends z {
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
- }, ke = class extends z {
558
+ }, Ae = class extends z {
559
559
  paymentMethods;
560
560
  paymentSeparator;
561
561
  skeleton;
@@ -570,7 +570,7 @@ var G = class extends z {
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 = ve(t.countries, p);
573
+ let n = t.enabled, r = !s || s[e] === !0, i = be(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 G = class extends z {
578
578
  for (let [e] of m) switch (e) {
579
579
  case "paypal":
580
580
  if (r) {
581
- let e = new P({
581
+ let e = new xe({
582
582
  checkoutProfile: t,
583
583
  formData: n,
584
584
  onSubmit: r
@@ -588,7 +588,7 @@ var G = class extends z {
588
588
  break;
589
589
  case "applePay":
590
590
  if (i && l && u) {
591
- let e = t.appearance?.additionalPaymentMethods?.applePay, r = new de({
591
+ let e = t.appearance?.additionalPaymentMethods?.applePay, r = new pe({
592
592
  checkoutProfile: t,
593
593
  formData: n,
594
594
  onSubmit: i,
@@ -607,7 +607,7 @@ var G = class extends z {
607
607
  break;
608
608
  default: console.warn(`[PaymentMethods] Unsupported payment method: ${e}`);
609
609
  }
610
- this.paymentMethods.size > 0 && (this.paymentSeparator = new Oe({
610
+ this.paymentMethods.size > 0 && (this.paymentSeparator = new ke({
611
611
  translationFunc: c,
612
612
  checkoutProfile: t
613
613
  }), this.getElement().appendChild(this.paymentSeparator.getElement()));
@@ -625,7 +625,7 @@ var G = class extends z {
625
625
  hasVisiblePaymentMethods() {
626
626
  return this.paymentMethods.size > 0 && this.getElement().style.display !== "none";
627
627
  }
628
- }, Ae = 17, je = class extends z {
628
+ }, je = 17, Me = class extends z {
629
629
  styles;
630
630
  isHovered = !1;
631
631
  constructor(e) {
@@ -633,7 +633,7 @@ var G = class extends z {
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 === Ae ? "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 === je ? "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 G = class extends z {
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
- }, q = "pay", Me = class {
647
+ }, q = "pay", Ne = class {
648
648
  button;
649
649
  constructor(e) {
650
650
  let { disabled: t, checkoutProfile: n, translationFunc: r } = e;
651
- this.button = new je({
652
- text: Ne(n, r),
651
+ this.button = new Me({
652
+ text: Pe(n, r),
653
653
  styles: {
654
654
  backgroundColor: n.styles.buttonColor,
655
655
  color: n.styles.buttonTextColor,
@@ -673,13 +673,13 @@ var G = class extends z {
673
673
  return this.button.appendTo(e), this;
674
674
  }
675
675
  };
676
- function Ne(e, t) {
676
+ function Pe(e, t) {
677
677
  let n = `buttonTexts.${e?.layout?.actionButton?.translationKey || q}`, r = t(n);
678
678
  return r === n ? t(`buttonTexts.${q}`) : r;
679
679
  }
680
680
  //#endregion
681
681
  //#region libs/checkout/src/components/checkout/form/FormComponentManager.ts
682
- var Pe = class {
682
+ var Fe = class {
683
683
  formElement;
684
684
  focusManager;
685
685
  translationFunc;
@@ -719,7 +719,7 @@ var Pe = class {
719
719
  createPaymentMethods(e, t, n = !1) {
720
720
  try {
721
721
  if (!e?.additionalPaymentMethods || Object.keys(e.additionalPaymentMethods).length === 0 || !Object.values(e.additionalPaymentMethods).some((e) => e.enabled)) return;
722
- this.removePaymentMethods(), this.paymentMethods = new ke({
722
+ this.removePaymentMethods(), this.paymentMethods = new Ae({
723
723
  checkoutProfile: e,
724
724
  formData: t,
725
725
  supportedPaymentMethods: this.supportedPaymentMethods,
@@ -741,7 +741,7 @@ var Pe = class {
741
741
  createEmailField(e, t, n, r) {
742
742
  try {
743
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);
744
- this.emailField = new ye({
744
+ this.emailField = new Se({
745
745
  value: t.email,
746
746
  onChange: this.onChange,
747
747
  onBlur: this.onBlur,
@@ -757,19 +757,30 @@ var Pe = class {
757
757
  }
758
758
  createPhoneNumberField(e, t, n, r) {
759
759
  let i = document.createElement("div");
760
- return this.phonePlaceholder = i, this.formElement.appendChild(i), ie().then(({ PhoneNumberField: a }) => this.phonePlaceholder === i && (this.phoneNumberField = new a({
761
- value: t.phoneNumber ?? "",
762
- onChange: this.onChange,
763
- onBlur: this.onBlur,
764
- onTab: () => this.focusManager.focusField("cardNumber"),
765
- error: !!(n.phoneNumber && r.phoneNumber),
766
- errorMsg: n.phoneNumber,
767
- checkoutProfile: e,
768
- translationFunc: this.translationFunc,
769
- defaultCountry: e.layout.phoneNumber?.defaultCountry || "US",
770
- allowedCountries: e.layout.phoneNumber?.allowedCountries,
771
- locale: this.locale
772
- }), 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, !0)).catch((e) => {
760
+ return this.phonePlaceholder = i, this.formElement.appendChild(i), ie().then(({ PhoneNumberField: a }) => {
761
+ if (this.phonePlaceholder !== i) return !1;
762
+ this.phoneNumberField = new a({
763
+ value: t.phoneNumber ?? "",
764
+ onChange: this.onChange,
765
+ onBlur: this.onBlur,
766
+ onTab: () => this.focusManager.focusField("cardNumber"),
767
+ error: !!(n.phoneNumber && r.phoneNumber),
768
+ errorMsg: n.phoneNumber,
769
+ checkoutProfile: e,
770
+ translationFunc: this.translationFunc,
771
+ defaultCountry: t.phoneCountryCode || e.layout.phoneNumber?.defaultCountry || "US",
772
+ allowedCountries: e.layout.phoneNumber?.allowedCountries,
773
+ locale: this.locale
774
+ }), 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;
775
+ let o = this.phoneNumberField.getCountry();
776
+ return t.phoneCountryCode !== o && this.onChange(U({
777
+ type: "input",
778
+ target: {
779
+ name: "phoneCountryCode",
780
+ value: o
781
+ }
782
+ })), !0;
783
+ }).catch((e) => {
773
784
  if (console.error("Error creating phone number field:", e), this.phonePlaceholder !== i) return !1;
774
785
  throw i.remove(), this.phonePlaceholder = void 0, e;
775
786
  });
@@ -791,7 +802,7 @@ var Pe = class {
791
802
  }), this.formElement.appendChild(this.cardUnavailableNotice.getElement());
792
803
  return;
793
804
  }
794
- this.cardSection = new he({
805
+ this.cardSection = new _e({
795
806
  checkoutProfile: e,
796
807
  translationFunc: this.translationFunc,
797
808
  vgsService: this.vgsService
@@ -808,7 +819,7 @@ var Pe = class {
808
819
  this.cardholderSectionSkeleton = this.buildCardholderSkeleton(e), this.formElement.appendChild(this.cardholderSectionSkeleton);
809
820
  return;
810
821
  }
811
- if (this.cardholderSection = new De({
822
+ if (this.cardholderSection = new Oe({
812
823
  value: t.name,
813
824
  onChange: this.onChange,
814
825
  onBlur: this.onBlur,
@@ -890,7 +901,7 @@ var Pe = class {
890
901
  }
891
902
  createSubmitButton(e, t) {
892
903
  try {
893
- this.submitButton = new Me({
904
+ this.submitButton = new Ne({
894
905
  disabled: t,
895
906
  checkoutProfile: e,
896
907
  translationFunc: this.translationFunc
@@ -942,7 +953,7 @@ var Pe = class {
942
953
  let t = e.styles.borderRadius, n = y(B, e.styles.fontSize), r = document.createElement("div"), i = document.createElement("div");
943
954
  i.style.marginBottom = "4px";
944
955
  let a = document.createElement("label");
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);
956
+ a.className = "input-label", a.textContent = this.translationFunc("cardInformation"), a.style.fontFamily = R(e.styles.fontFamily), a.style.fontSize = `${e.styles.fontSize}px`, i.appendChild(a), r.appendChild(i);
946
957
  let o = document.createElement("div");
947
958
  o.className = "vgs-card-group", o.style.borderRadius = `${t}px`, o.style.background = "#fff", o.style.display = "flex", o.style.flexDirection = "column", o.style.position = "relative";
948
959
  let s = document.createElement("div");
@@ -966,13 +977,13 @@ var Pe = class {
966
977
  let t = e.styles.borderRadius, n = document.createElement("div"), r = document.createElement("div");
967
978
  r.style.marginBottom = "4px";
968
979
  let i = document.createElement("label");
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);
980
+ i.className = "input-label", i.textContent = this.translationFunc("cardholderNameLabel"), i.style.fontFamily = R(e.styles.fontFamily), i.style.fontSize = `${e.styles.fontSize}px`, r.appendChild(i), n.appendChild(r);
970
981
  let a = document.createElement("div");
971
982
  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;
972
983
  }
973
984
  async mountVgsFields(e) {
974
985
  if (!this.vgsService || !this.cardSection) return !1;
975
- let t = ne(e.styles.fontFamily);
986
+ let t = ee(e.styles.fontFamily);
976
987
  await this.vgsService.whenReady();
977
988
  let n = this.cardSection.getVgsContainerIds(), r = this.cardholderSection?.getVgsContainerId(), i = await t, a = this.cardSection.buildVgsFieldCss(e, i);
978
989
  if (this.cardholderSection && a.cardholderName) {
@@ -1013,7 +1024,7 @@ var Pe = class {
1013
1024
  }
1014
1025
  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);
1015
1026
  }
1016
- }, Fe = class {
1027
+ }, Ie = class {
1017
1028
  formManager;
1018
1029
  focusManager;
1019
1030
  onFormSubmit;
@@ -1053,7 +1064,7 @@ var Pe = class {
1053
1064
  clearTouchedFields() {
1054
1065
  this.localTouchedFields.clear();
1055
1066
  }
1056
- }, Ie = class {
1067
+ }, Le = class {
1057
1068
  formManager;
1058
1069
  checkoutProfile;
1059
1070
  formElement;
@@ -1088,12 +1099,12 @@ var Pe = class {
1088
1099
  };
1089
1100
  isFormDisabled() {
1090
1101
  if (this.isCardCaptureUnavailable) return !0;
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) => {
1102
+ let e = this.formManager.getFormState(), t = this.checkoutProfile.getState(), r = Object.keys(e.errors).filter((e) => e !== "billingAddress" && e !== "shippingAddress").length > 0, i = e.errors.billingAddress, a = i && typeof i == "object" ? Object.keys(i).length > 0 : !1, o = e.errors.shippingAddress, s = o && typeof o == "object" ? Object.keys(o).length > 0 : !1, c = r || a || s, l = t.checkoutProfile?.layout.phoneNumber?.enabled ?? !1 ? !!e.formData.phoneNumber : !0, { billingFields: u, shippingFields: d } = t.checkoutProfile?.layout ?? {}, f = (e, t) => {
1092
1103
  if (!e) return !0;
1093
- let n = t?.country ?? "";
1094
- return Object.entries(e).every(([e, r]) => !r?.enabled || e === "state" && (!H(n) || r.hiddenForCountries?.includes(n)) ? !0 : !!t?.[e]?.trim());
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);
1096
- return s || !m || this.isSubmitting;
1104
+ let r = t?.country ?? "";
1105
+ return Object.entries(e).every(([e, i]) => !i?.enabled || e === "state" && (!n(r) || i.hiddenForCountries?.includes(r)) ? !0 : !!t?.[e]?.trim());
1106
+ }, p = Object.values(this.vgsFieldsState), m = p.length > 0 && p.every((e) => e?.isValid === !0), h = this.isVgsMode && !!e.formData.email && l && m && f(u, e.formData.billingAddress) && f(d, e.formData.shippingAddress);
1107
+ return c || !h || this.isSubmitting;
1097
1108
  }
1098
1109
  setSubmitting(e) {
1099
1110
  this.isSubmitting = e;
@@ -1113,7 +1124,7 @@ var Pe = class {
1113
1124
  if (!r?.isTouched || r.isFocused || r.isValid) continue;
1114
1125
  let i = r.errors?.[0];
1115
1126
  if (!i) continue;
1116
- let a = ue(n, i.code);
1127
+ let a = de(n, i.code);
1117
1128
  a && (t[n] = e(a));
1118
1129
  }
1119
1130
  return t;
@@ -1124,11 +1135,11 @@ var Pe = class {
1124
1135
  cleanup() {
1125
1136
  this.fontCleanup &&= (this.fontCleanup(), void 0);
1126
1137
  }
1127
- }, Le = class extends z {
1138
+ }, Re = class extends z {
1128
1139
  titleElement;
1129
1140
  constructor(e = {}) {
1130
1141
  super("div", ["blur-bg"]);
1131
- let t = D.createDiv(["loader"]);
1142
+ let t = E.createDiv(["loader"]);
1132
1143
  this.titleElement = new z("h3", ["title"]), this.titleElement.setText(e.text || ""), this.appendChild(t), this.appendChild(this.titleElement);
1133
1144
  }
1134
1145
  setText(e) {
@@ -1150,11 +1161,11 @@ var Pe = class {
1150
1161
  n[i] = e[t];
1151
1162
  }
1152
1163
  }), n;
1153
- }, X = class {
1164
+ }, ze = class {
1154
1165
  formElement;
1155
1166
  componentManager;
1156
1167
  onLoadingStateChange;
1157
- validationSchema = c();
1168
+ validationSchema = l();
1158
1169
  spinner;
1159
1170
  formSkeleton;
1160
1171
  alert;
@@ -1168,7 +1179,7 @@ var Pe = class {
1168
1179
  this.onLoadingStateChange ? this.onLoadingStateChange(e) : e ? (this.hideSkeleton(), this.formSkeleton = new K(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
1169
1180
  }
1170
1181
  showSpinner(e) {
1171
- this.hideSpinner(), this.spinner = new Le({ text: e }), this.formElement.appendChild(this.spinner.getElement());
1182
+ this.hideSpinner(), this.spinner = new Re({ text: e }), this.formElement.appendChild(this.spinner.getElement());
1172
1183
  }
1173
1184
  hideSpinner() {
1174
1185
  this.spinner &&= (this.spinner.getElement().remove(), void 0);
@@ -1177,7 +1188,7 @@ var Pe = class {
1177
1188
  this.formSkeleton &&= (this.formSkeleton.getElement().remove(), void 0);
1178
1189
  }
1179
1190
  setErrorMessage(e) {
1180
- this.alert &&= (this.alert.getElement().remove(), void 0), this.alert = new _e({ message: e }), this.formElement.insertBefore(this.alert.getElement(), this.formElement.firstChild);
1191
+ this.alert &&= (this.alert.getElement().remove(), void 0), this.alert = new ve({ message: e }), this.formElement.insertBefore(this.alert.getElement(), this.formElement.firstChild);
1181
1192
  }
1182
1193
  clearErrorMessage() {
1183
1194
  this.alert &&= (this.alert.getElement().remove(), void 0);
@@ -1185,7 +1196,7 @@ var Pe = class {
1185
1196
  cleanup() {
1186
1197
  this.spinner &&= (this.spinner.getElement().remove(), void 0), this.formSkeleton &&= (this.formSkeleton.getElement().remove(), void 0), this.alert &&= (this.alert.getElement().remove(), void 0);
1187
1198
  }
1188
- }, Z = "phone_number", Re = "form";
1199
+ }, X = "phone_number", Z = "form";
1189
1200
  globalThis.navigator.userAgent;
1190
1201
  var Q = (e) => ({
1191
1202
  street: "",
@@ -1196,12 +1207,12 @@ var Q = (e) => ({
1196
1207
  zipCode: "",
1197
1208
  country: "",
1198
1209
  ...e
1199
- }), ze = class extends z {
1210
+ }), Be = class extends z {
1200
1211
  options;
1201
- formManager = a();
1212
+ formManager = o();
1202
1213
  checkoutProfile;
1203
- translation = re();
1204
- focusManager = new Te();
1214
+ translation = i();
1215
+ focusManager = new Ee();
1205
1216
  componentManager;
1206
1217
  eventHandler;
1207
1218
  stateCoordinator;
@@ -1215,7 +1226,7 @@ var Q = (e) => ({
1215
1226
  constructor(e) {
1216
1227
  super("form", ["form-container"]), this.options = e;
1217
1228
  let t = !e.supportedPaymentMethods || !!e.supportedPaymentMethods.card;
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({
1229
+ e.vgsJwt && t && (this.vgsSession = this.createVgsSession(e.vgsJwt), this.vgsService = new _()), this.checkoutProfile = re({ appearance: e.appearance }), e.locale && this.translation.setLocale(e.locale), this.componentManager = new Fe({
1219
1230
  formElement: this.element,
1220
1231
  focusManager: this.focusManager,
1221
1232
  translationFunc: this.translation.t,
@@ -1225,7 +1236,7 @@ var Q = (e) => ({
1225
1236
  onBlur: (e) => this.eventHandler.handleBlur(e),
1226
1237
  onPaypalSubmit: async () => this.handlePaypalSubmit(),
1227
1238
  onApplePaySubmit: async (e) => this.handleApplePaySubmit(e),
1228
- onApplePayStartFailed: (e) => this.options.onSubmitOutcome?.(oe(e)),
1239
+ onApplePayStartFailed: (e) => this.options.onSubmitOutcome?.(m(e)),
1229
1240
  onApplePayPaymentDataFailed: (e) => this.options.onSubmitOutcome?.(e),
1230
1241
  supportedPaymentMethods: e.supportedPaymentMethods,
1231
1242
  paymentId: e.paymentId,
@@ -1233,22 +1244,22 @@ var Q = (e) => ({
1233
1244
  checkoutDetails: e.checkoutDetails,
1234
1245
  environment: e.environment,
1235
1246
  vgsService: this.vgsService
1236
- }), this.uiManager = new X({
1247
+ }), this.uiManager = new ze({
1237
1248
  formElement: this.element,
1238
1249
  componentManager: this.componentManager,
1239
1250
  onLoadingStateChange: e.onLoadingStateChange
1240
- }), this.stateCoordinator = new Ie({
1251
+ }), this.stateCoordinator = new Le({
1241
1252
  formManager: this.formManager,
1242
1253
  checkoutProfile: this.checkoutProfile,
1243
1254
  componentManager: this.componentManager,
1244
1255
  formElement: this.element,
1245
1256
  onUIUpdate: () => this.updateFormUI(),
1246
1257
  onProfileLoaded: () => this.renderFormComponents(),
1247
- onRenderFailed: (e) => this.reportRenderFailure(Re, e),
1258
+ onRenderFailed: (e) => this.reportRenderFailure(Z, e),
1248
1259
  onError: (e) => this.uiManager.setErrorMessage(e),
1249
1260
  onLoadingChange: (e) => this.uiManager.setLoadingState(e),
1250
1261
  getInitialFormData: () => this._getFormStateData().formData
1251
- }), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new Fe({
1262
+ }), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new Ie({
1252
1263
  formManager: this.formManager,
1253
1264
  focusManager: this.focusManager,
1254
1265
  onFormSubmit: async () => this.handleSubmit(),
@@ -1282,13 +1293,13 @@ var Q = (e) => ({
1282
1293
  };
1283
1294
  }
1284
1295
  initializeForm() {
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);
1296
+ if (this.uiManager.setLoadingState(!0), this.options.errorMsg && this.uiManager.setErrorMessage(this.options.errorMsg), !this.vgsService && this.options.paymentId && this.options.checkoutDetails) this.failCardCaptureClosed(D.NO_TOKENIZATION_SESSION);
1286
1297
  else if (this.vgsService) {
1287
1298
  let e = this.vgsService;
1288
1299
  e.init(this.options.environment).then((t) => {
1289
1300
  this.vgsService === e && e.createForm(t, (e) => this.handleVgsStateChange(e));
1290
1301
  }).catch((t) => {
1291
- this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(k.INIT_FAILED));
1302
+ this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(D.INIT_FAILED));
1292
1303
  });
1293
1304
  }
1294
1305
  }
@@ -1302,11 +1313,11 @@ var Q = (e) => ({
1302
1313
  this.isCardCaptureUnavailable = !0, this.dropVgsService(), this.stateCoordinator.setVgsMode(!1), this.stateCoordinator.setCardCaptureUnavailable(!0), this.reportLoadOutcome({
1303
1314
  status: "failed",
1304
1315
  reason: e
1305
- }), t || A(O.CARD_CAPTURE_UNAVAILABLE, { reason: e }), this.checkoutProfile.getState().checkoutProfile && this.renderFormComponents(), this.updateFormUI();
1316
+ }), t || P(T.CARD_CAPTURE_UNAVAILABLE, { reason: e }), this.checkoutProfile.getState().checkoutProfile && this.renderFormComponents(), this.updateFormUI();
1306
1317
  }
1307
1318
  createVgsSession(e) {
1308
1319
  let { paymentId: t, checkoutKey: n, environment: r } = this.options;
1309
- return new N(e, t && n ? l({
1320
+ return new s(e, t && n ? ae({
1310
1321
  id: t,
1311
1322
  checkoutKey: n,
1312
1323
  environment: r
@@ -1329,7 +1340,7 @@ var Q = (e) => ({
1329
1340
  phoneNumber: "",
1330
1341
  phoneCountryCode: e.checkoutProfile.layout.phoneNumber.defaultCountry?.toUpperCase() || "US"
1331
1342
  }), 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() });
1332
- let { formData: t, errors: n, touched: r } = this._getFormStateData(), i = Ee(e.checkoutProfile.layout);
1343
+ let { formData: t, errors: n, touched: r } = this._getFormStateData(), i = De(e.checkoutProfile.layout);
1333
1344
  try {
1334
1345
  this.componentManager.createPaymentMethods(e.checkoutProfile, t);
1335
1346
  } catch (e) {
@@ -1354,9 +1365,9 @@ var Q = (e) => ({
1354
1365
  }
1355
1366
  let a;
1356
1367
  if (e.checkoutProfile.layout.phoneNumber?.enabled) try {
1357
- a = this.componentManager.createPhoneNumberField(e.checkoutProfile, t, n, r).catch((e) => (this.reportRenderFailure(Z, e), !1));
1368
+ a = this.componentManager.createPhoneNumberField(e.checkoutProfile, t, n, r).catch((e) => (this.reportRenderFailure(X, e), !1));
1358
1369
  } catch (e) {
1359
- console.error("Failed to create phone number field:", e), this.reportRenderFailure(Z, e), a = Promise.resolve(!1);
1370
+ console.error("Failed to create phone number field:", e), this.reportRenderFailure(X, e), a = Promise.resolve(!1);
1360
1371
  }
1361
1372
  try {
1362
1373
  this.componentManager.createCardSection(e.checkoutProfile);
@@ -1373,7 +1384,7 @@ var Q = (e) => ({
1373
1384
  this.componentManager.mountVgsFields(e.checkoutProfile).then(async (e) => {
1374
1385
  e && this.vgsMountGeneration === n && this.vgsService === t && (!a || await a) && this.vgsMountGeneration === n && this.vgsService === t && this.reportLoadOutcome({ status: "ready" });
1375
1386
  }).catch((e) => {
1376
- this.vgsMountGeneration === n && this.vgsService === t && (console.error("Failed to mount VGS fields:", e), this.failCardCaptureClosed(k.FIELDS_NOT_READY));
1387
+ this.vgsMountGeneration === n && this.vgsService === t && (console.error("Failed to mount VGS fields:", e), this.failCardCaptureClosed(D.FIELDS_NOT_READY));
1377
1388
  });
1378
1389
  }
1379
1390
  try {
@@ -1388,10 +1399,10 @@ var Q = (e) => ({
1388
1399
  reportRenderFailure(e, t) {
1389
1400
  this.reportLoadOutcome({
1390
1401
  status: "failed",
1391
- reason: E.FORM_RENDER_FAILED,
1402
+ reason: v.FORM_RENDER_FAILED,
1392
1403
  attributes: {
1393
1404
  form_part: e,
1394
- ...t !== void 0 && { error_class: F(t) }
1405
+ ...t !== void 0 && { error_class: me(t) }
1395
1406
  }
1396
1407
  });
1397
1408
  }
@@ -1424,13 +1435,13 @@ var Q = (e) => ({
1424
1435
  async handleSubmit() {
1425
1436
  if (!this.stateCoordinator.isFormDisabled()) try {
1426
1437
  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"));
1438
+ this.options.onSubmitOutcome?.(F(ye(/* @__PURE__ */ Error("Card capture unavailable"), te.CAPTURE_UNAVAILABLE), "card")), this.handleSubmitError(this.translation.t("cardUnavailable"));
1428
1439
  return;
1429
1440
  }
1430
1441
  try {
1431
1442
  this.vgsCardResult = await this.vgsService.createCard(this.vgsSession);
1432
1443
  } catch (e) {
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.");
1444
+ console.error("VGS card creation failed:", e), this.options.onSubmitOutcome?.(F(e, "card")), this.handleSubmitError("Card processing failed. Please check your card details and try again.");
1434
1445
  return;
1435
1446
  }
1436
1447
  let e = this.formManager.getFormState().formData;
@@ -1440,8 +1451,7 @@ var Q = (e) => ({
1440
1451
  cardId: this.vgsCardResult.cardId,
1441
1452
  expMonth: this.vgsCardResult.expMonth,
1442
1453
  expYear: this.vgsCardResult.expYear,
1443
- name: this.vgsCardResult.name,
1444
- ...this.vgsCardResult.updatedValues && { updatedValues: this.vgsCardResult.updatedValues }
1454
+ name: this.vgsCardResult.name
1445
1455
  }
1446
1456
  } : e }), this.uiManager.hideSpinner(), this.options.onLoadingStateChange?.(!1), this.stateCoordinator.setSubmitting(!1), this.updateFormUI();
1447
1457
  } catch {
@@ -1487,21 +1497,21 @@ var Q = (e) => ({
1487
1497
  this.options.paymentId = e, this.options.checkoutKey = t, this.options.supportedPaymentMethods = n, this.options.checkoutDetails = r, this.componentManager.setCheckoutDetailsLoaded(!0), this.componentManager.updateSupportedPaymentMethods(n);
1488
1498
  let a = this.componentManager.isCardSupported();
1489
1499
  if (i && a && (this.vgsSession = this.createVgsSession(i)), i && a && !this.vgsService) {
1490
- let e = new g();
1500
+ let e = new _();
1491
1501
  this.vgsService = e, this.componentManager.setVgsService(e), this.stateCoordinator.setVgsMode(!0), e.init(this.options.environment).then((t) => {
1492
1502
  this.vgsService === e && (e.createForm(t, (e) => this.handleVgsStateChange(e)), this.recoverCardCapture(), this.renderFormComponents());
1493
1503
  }).catch((t) => {
1494
- this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(k.INIT_FAILED));
1504
+ this.vgsService === e && (console.error("Failed to load VGS Collect:", t), this.failCardCaptureClosed(D.INIT_FAILED));
1495
1505
  });
1496
1506
  }
1497
- this.componentManager.removePaymentMethods(), this.componentManager.updatePaymentDetails(e, t, r), (!i || !a) && this.failCardCaptureClosed(k.NO_TOKENIZATION_SESSION);
1507
+ this.componentManager.removePaymentMethods(), this.componentManager.updatePaymentDetails(e, t, r), (!i || !a) && this.failCardCaptureClosed(D.NO_TOKENIZATION_SESSION);
1498
1508
  let o = this.checkoutProfile.getState();
1499
1509
  if (o.checkoutProfile) {
1500
1510
  let { formData: e } = this._getFormStateData();
1501
1511
  this.componentManager.createPaymentMethods(o.checkoutProfile, e, !0);
1502
1512
  }
1503
1513
  }
1504
- }, Be = class {
1514
+ }, Ve = class {
1505
1515
  container = null;
1506
1516
  options;
1507
1517
  onSubmit;
@@ -1519,7 +1529,7 @@ var Q = (e) => ({
1519
1529
  }) : e.errorMsg && !this.options.disableErrorMessages ? this.form.setErrorMessage(e.errorMsg) : this.renderForm(e.errorMsg));
1520
1530
  }
1521
1531
  renderForm(e) {
1522
- this.container && (this.form &&= (this.form.destroy(), null), this.form = new ze({
1532
+ this.container && (this.form &&= (this.form.destroy(), null), this.form = new Be({
1523
1533
  apiKey: this.options.apiKey,
1524
1534
  onSubmit: this.onSubmit,
1525
1535
  locale: this.options.locale,
@@ -1551,7 +1561,7 @@ var Q = (e) => ({
1551
1561
  async associatePayment(e, t, n, r, i) {
1552
1562
  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);
1553
1563
  }
1554
- }, Ve = class {
1564
+ }, He = class {
1555
1565
  state;
1556
1566
  listeners = /* @__PURE__ */ new Set();
1557
1567
  constructor(e) {
@@ -1575,7 +1585,7 @@ var Q = (e) => ({
1575
1585
  let e = this.getState();
1576
1586
  this.listeners.forEach((t) => t(e));
1577
1587
  }
1578
- }, He = "en", $ = class {
1588
+ }, Ue = "en", $ = class {
1579
1589
  config;
1580
1590
  _callbacks;
1581
1591
  paymentState;
@@ -1583,17 +1593,17 @@ var Q = (e) => ({
1583
1593
  formManager;
1584
1594
  stateManager;
1585
1595
  sessionId;
1586
- readiness = new o();
1596
+ readiness = new c();
1587
1597
  associationSequence = 0;
1588
1598
  constructor(e) {
1589
- this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(), u(), fe({
1599
+ this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(), N(), ce({
1590
1600
  environment: this.config.environment,
1591
1601
  sessionId: this.sessionId,
1592
1602
  integration: "dropin"
1593
- }), A(O.CHECKOUT_INITIALIZED, { environment: this.config.environment }), this.apiService = new Ce(this.config.apiKey, this.config.environment), this.stateManager = new Ve({
1603
+ }), P(T.CHECKOUT_INITIALIZED, { environment: this.config.environment }), this.apiService = new ne(this.config.apiKey, this.config.environment), this.stateManager = new He({
1594
1604
  mounted: !1,
1595
1605
  form: null
1596
- }), this.formManager = new Be({
1606
+ }), this.formManager = new Ve({
1597
1607
  locale: this.config.locale,
1598
1608
  apiKey: this.config.apiKey,
1599
1609
  disableErrorMessages: this.config.disableErrorMessages,
@@ -1614,7 +1624,7 @@ var Q = (e) => ({
1614
1624
  apiKey: e.apiKey,
1615
1625
  returnUrl: e.returnUrl,
1616
1626
  environment: e.environment,
1617
- locale: e.locale || He,
1627
+ locale: e.locale || Ue,
1618
1628
  disableErrorMessages: e.disableErrorMessages ?? !1,
1619
1629
  manualActionHandling: e.manualActionHandling ?? !1,
1620
1630
  appearance: e.appearance,
@@ -1635,15 +1645,15 @@ var Q = (e) => ({
1635
1645
  return n = !0, t = document.createElement("div"), r.appendChild(t), this.stateManager.updateState({
1636
1646
  form: t,
1637
1647
  mounted: !0
1638
- }), this.formManager.mount(t), this.readiness.markMounted(), A(O.CHECKOUT_MOUNTED, { container_id: e }), this;
1648
+ }), this.formManager.mount(t), this.readiness.markMounted(), P(T.CHECKOUT_MOUNTED, { container_id: e }), this;
1639
1649
  } catch (r) {
1640
1650
  throw t?.remove(), this.stateManager.updateState({
1641
1651
  form: null,
1642
1652
  mounted: !1
1643
- }), A(O.CHECKOUT_MOUNT_FAILED, {
1653
+ }), P(T.CHECKOUT_MOUNT_FAILED, {
1644
1654
  container_id: e,
1645
1655
  error_message: r instanceof Error ? r.message : "Unknown error"
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;
1656
+ }), A(r instanceof Error ? r : /* @__PURE__ */ Error("Failed to mount checkout"), { container_id: e }), n ? this.readiness.fail({ reason: v.MOUNT_FAILED }) : this.readiness.exclude({ reason: v.CONTAINER_NOT_FOUND }), r;
1647
1657
  }
1648
1658
  }
1649
1659
  unmount() {
@@ -1654,66 +1664,66 @@ var Q = (e) => ({
1654
1664
  e && e.remove(), this.stateManager.updateState({
1655
1665
  form: null,
1656
1666
  mounted: !1
1657
- }), A(O.CHECKOUT_UNMOUNTED);
1667
+ }), P(T.CHECKOUT_UNMOUNTED);
1658
1668
  });
1659
1669
  }
1660
- async handleSubmit({ formData: t, applePayData: n }) {
1670
+ async handleSubmit({ formData: e, applePayData: t }) {
1661
1671
  if (!this.paymentState.paymentId || !this.paymentState.checkoutKey) throw Error("Payment must be associated before submitting. Call associatePayment() first.");
1662
- let r = this.getPaymentMethod(t, n);
1663
- A(O.PAYMENT_SUBMIT_STARTED, {
1672
+ let n = this.getPaymentMethod(e, t);
1673
+ P(T.PAYMENT_SUBMIT_STARTED, {
1664
1674
  payment_id: this.paymentState.paymentId,
1665
- payment_method: r
1675
+ payment_method: n
1666
1676
  });
1667
- let i = performance.now();
1677
+ let r = performance.now();
1668
1678
  try {
1669
- let e = await this.apiService.authorizePayment({
1679
+ let i = await this.apiService.authorizePayment({
1670
1680
  checkoutKey: this.paymentState.checkoutKey,
1671
- formData: t || null,
1681
+ formData: e || null,
1672
1682
  paymentId: this.paymentState.paymentId,
1673
1683
  returnUrl: this.config.returnUrl,
1674
- applePayData: n
1684
+ applePayData: t
1675
1685
  });
1676
1686
  this.readiness.reportSubmit({
1677
- outcome: ce.SUCCEEDED,
1678
- paymentMethod: r
1687
+ outcome: Te.SUCCEEDED,
1688
+ paymentMethod: n
1679
1689
  });
1680
- let a = performance.now() - i;
1681
- return b(_.PAYMENT_AUTHORIZATION_TIME, a, "ms", {
1690
+ let a = performance.now() - r;
1691
+ return O(L.PAYMENT_AUTHORIZATION_TIME, a, "ms", {
1682
1692
  payment_id: this.paymentState.paymentId,
1683
- payment_method: r,
1693
+ payment_method: n,
1684
1694
  status: "success"
1685
- }), A(O.PAYMENT_SUBMIT_SUCCESS, {
1695
+ }), P(T.PAYMENT_SUBMIT_SUCCESS, {
1686
1696
  payment_id: this.paymentState.paymentId,
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", {
1697
+ payment_method: n
1698
+ }), this.handlePaymentResponse(i);
1699
+ } catch (e) {
1700
+ let t = performance.now() - r;
1701
+ return O(L.PAYMENT_AUTHORIZATION_TIME, t, "ms", {
1692
1702
  payment_id: this.paymentState.paymentId,
1693
- payment_method: r,
1703
+ payment_method: n,
1694
1704
  status: "failed"
1695
- }), A(O.PAYMENT_SUBMIT_FAILED, {
1705
+ }), P(T.PAYMENT_SUBMIT_FAILED, {
1696
1706
  payment_id: this.paymentState.paymentId,
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;
1707
+ payment_method: n,
1708
+ error_message: e.details?.message ?? "Unknown error",
1709
+ ...x(e)
1710
+ }), this.readiness.reportSubmit(fe(e, n)), this.handleAuthorizationError(e), !1;
1701
1711
  }
1702
1712
  }
1703
1713
  handlePaymentResponse(e) {
1704
- let t = !1, n = xe(e);
1705
- if (n === "authorized" && (A(O.PAYMENT_AUTHORIZED, {
1714
+ let t = !1, n = Ce(e);
1715
+ if (n === "authorized" && (P(T.PAYMENT_AUTHORIZED, {
1706
1716
  payment_id: this.paymentState.paymentId ?? "",
1707
1717
  status: n
1708
- }), w(() => this._callbacks.onPaymentSucceeded?.(n)), t = !0), n === "failed" && (A(O.PAYMENT_FAILED, {
1718
+ }), M(() => this._callbacks.onPaymentSucceeded?.(n)), t = !0), n === "failed" && (P(T.PAYMENT_FAILED, {
1709
1719
  payment_id: this.paymentState.paymentId ?? "",
1710
1720
  status: n
1711
- }), w(() => this._callbacks.onPaymentFailed?.(n))), e.status === "requires_action") {
1721
+ }), M(() => this._callbacks.onPaymentFailed?.(n))), e.status === "requires_action") {
1712
1722
  let { redirectUrl: n } = e.action;
1713
- A(O.PAYMENT_ACTION_REQUIRED, {
1723
+ P(T.PAYMENT_ACTION_REQUIRED, {
1714
1724
  payment_id: this.paymentState.paymentId ?? "",
1715
1725
  status: e.status
1716
- }), this.config.manualActionHandling ? w(() => this._callbacks.onActionRequired?.(n)) : globalThis.location.href = n, t = !0;
1726
+ }), this.config.manualActionHandling ? M(() => this._callbacks.onActionRequired?.(n)) : globalThis.location.href = n, t = !0;
1717
1727
  }
1718
1728
  return t;
1719
1729
  }
@@ -1743,42 +1753,42 @@ var Q = (e) => ({
1743
1753
  locale: e.locale
1744
1754
  });
1745
1755
  }
1746
- async associatePayment(e, t) {
1747
- if (!e || !t) throw Error("paymentId and checkoutKey are required");
1748
- let n = ++this.associationSequence;
1749
- this.readiness.start(e), this.paymentState.paymentId = e, this.paymentState.checkoutKey = t, ae(this.config.environment);
1750
- let r = V.CHECKOUT_DETAILS;
1756
+ async associatePayment(t, n) {
1757
+ if (!t || !n) throw Error("paymentId and checkoutKey are required");
1758
+ let r = ++this.associationSequence;
1759
+ this.readiness.start(t), this.paymentState.paymentId = t, this.paymentState.checkoutKey = n, oe(this.config.environment);
1760
+ let i = b.CHECKOUT_DETAILS;
1751
1761
  try {
1752
- let i = await ge({
1753
- id: e,
1754
- checkoutKey: t,
1762
+ let e = await we({
1763
+ id: t,
1764
+ checkoutKey: n,
1755
1765
  environment: this.config.environment
1756
1766
  });
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));
1759
- if (n !== this.associationSequence) return;
1760
- r = V.FORM_SETUP, this.readiness.markAssociated(), this.paymentState.checkoutDetails = {
1761
- amount: i.amount,
1762
- currency: i.currency,
1763
- countryCode: i.countryCode
1767
+ if (!e || !e.supportedPaymentMethods || !Array.isArray(e.supportedPaymentMethods)) throw k(/* @__PURE__ */ Error("Invalid response: supportedPaymentMethods must be an array"), V.INVALID_RESPONSE, C(e));
1768
+ if (!e.supportedPaymentMethods.every((e) => typeof e == "string")) throw k(/* @__PURE__ */ Error("Invalid response: all supportedPaymentMethods must be strings"), V.INVALID_RESPONSE, C(e));
1769
+ if (r !== this.associationSequence) return;
1770
+ i = b.FORM_SETUP, this.readiness.markAssociated(), this.paymentState.checkoutDetails = {
1771
+ amount: e.amount,
1772
+ currency: e.currency,
1773
+ countryCode: e.countryCode
1764
1774
  };
1765
- let a = i.supportedPaymentMethods.reduce((e, t) => (e[t] = !0, e), {});
1766
- await this.formManager.associatePayment(e, t, a, this.paymentState.checkoutDetails, i.vgsJwt), A(O.PAYMENT_ASSOCIATED, {
1767
- payment_id: e,
1768
- currency: i.currency,
1769
- country_code: i.countryCode
1775
+ let a = e.supportedPaymentMethods.reduce((e, t) => (e[t] = !0, e), {});
1776
+ await this.formManager.associatePayment(t, n, a, this.paymentState.checkoutDetails, e.vgsJwt), P(T.PAYMENT_ASSOCIATED, {
1777
+ payment_id: t,
1778
+ currency: e.currency,
1779
+ country_code: e.countryCode
1770
1780
  });
1771
- } catch (t) {
1772
- if (A(O.PAYMENT_ASSOCIATION_FAILED, {
1773
- payment_id: e,
1774
- error_message: t instanceof Error ? t.message : "Unknown error",
1775
- stage: 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);
1779
- e ? this.readiness.fail(n) : this.readiness.exclude(n);
1781
+ } catch (n) {
1782
+ if (P(T.PAYMENT_ASSOCIATION_FAILED, {
1783
+ payment_id: t,
1784
+ error_message: n instanceof Error ? n.message : "Unknown error",
1785
+ stage: i,
1786
+ ...x(n)
1787
+ }), A(n instanceof Error ? n : /* @__PURE__ */ Error("Failed to associate payment"), { payment_id: t }), r === this.associationSequence) {
1788
+ let { ours: t, ...r } = e(n, i);
1789
+ t ? this.readiness.fail(r) : this.readiness.exclude(r);
1780
1790
  }
1781
- throw t;
1791
+ throw n;
1782
1792
  }
1783
1793
  }
1784
1794
  setCallbacks(e) {
@@ -1789,4 +1799,4 @@ var Q = (e) => ({
1789
1799
  //#region libs/checkout/src/index.ts
1790
1800
  typeof globalThis < "u" && (globalThis.OdusCheckout = $);
1791
1801
  //#endregion
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 };
1802
+ export { $ as OdusCheckout, a as deLocale, p as enLocale, d as esLocale, u as frLocale, he as itLocale, t as plLocale, ge as ptLocale, A as pushError, P as pushEvent, ue as pushLog, O as pushMeasurement, f as trLocale };