@odus/checkout 0.30.0-beta.0 → 0.30.0-beta.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,5 +1,5 @@
1
1
  import { l as pe, c as de, a as ge, f as U, d as fe, C as P, I as ce, g as ye, S as H, b as Z, H as be, V as J, e as k, A as ve, P as Se, E as Ee, h as Ce, i as Fe, j as Me, k as Ne, m as we, n as Pe, F as ke, o as Ae, p as De } from "./shared.js";
2
- import { q as Tt, r as Lt, s as Vt, t as _t, u as Bt, v as Ot, w as Rt, x as Ut } from "./shared.js";
2
+ import { q as Tt, r as Vt, s as _t, t as Bt, u as Ot, v as Rt, w as Ut, x as Ht } from "./shared.js";
3
3
  const C = {
4
4
  // Checkout lifecycle events
5
5
  CHECKOUT_INITIALIZED: "checkout.initialized",
@@ -20,7 +20,7 @@ const C = {
20
20
  PAYMENT_AUTHORIZATION_TIME: "payment.authorization_time",
21
21
  CHECKOUT_LOAD_TIME: "checkout.load_time",
22
22
  FORM_RENDER_TIME: "form.render_time"
23
- }, Ie = /^\s*at (?:(.+?) ?\()?((?:file|https?|chrome-extension|webpack-internal):\/\/.+?):(\d+):(\d+)\)?\s*$/, xe = /^([^@]+)@((?:file|https?|chrome-extension|webpack-internal):\/\/[^\s:]+):(\d+):(\d+)$/, Te = /^(?:([^@]+)@)?((?:file|https?):\/\/[^\s:]+):(\d+):(\d+)$/, q = (i) => {
23
+ }, Ie = /^\s*at (?:(.+?) ?\()?((?:file|https?|chrome-extension|webpack-internal):\/\/.+?):(\d+):(\d+)\)?\s*$/, xe = /^([^@]+)@((?:file|https?|chrome-extension|webpack-internal):\/\/[^\s:]+):(\d+):(\d+)$/, Le = /^(?:([^@]+)@)?((?:file|https?):\/\/[^\s:]+):(\d+):(\d+)$/, q = (i) => {
24
24
  if (!i)
25
25
  return [];
26
26
  const e = [], t = i.split(`
@@ -39,7 +39,7 @@ const C = {
39
39
  });
40
40
  continue;
41
41
  }
42
- n = xe.exec(a) ?? Te.exec(a), n && e.push({
42
+ n = xe.exec(a) ?? Le.exec(a), n && e.push({
43
43
  function: n[1] || "(anonymous)",
44
44
  filename: n[2],
45
45
  lineno: parseInt(n[3], 10),
@@ -47,7 +47,7 @@ const C = {
47
47
  });
48
48
  }
49
49
  return e;
50
- }, Le = "@odus/telemetry", Ve = "0.0.1";
50
+ }, Te = "@odus/telemetry", Ve = "0.0.1";
51
51
  let B, O, Y;
52
52
  const _e = () => {
53
53
  if (typeof navigator > "u")
@@ -77,7 +77,7 @@ const _e = () => {
77
77
  }, ze = (i) => {
78
78
  Y = i;
79
79
  }, $e = () => O?.id, je = (i) => ({
80
- sdk: { name: Le, version: Ve },
80
+ sdk: { name: Te, version: Ve },
81
81
  app: i.app,
82
82
  user: B,
83
83
  session: O,
@@ -85,7 +85,7 @@ const _e = () => {
85
85
  browser: _e(),
86
86
  view: Y
87
87
  }), Ke = 30, qe = 250, We = 6e4;
88
- let A = [], w = null, G = 0, T = null, L = null;
88
+ let A = [], w = null, G = 0, L = null, T = null;
89
89
  const Ye = (i) => {
90
90
  if (w)
91
91
  return;
@@ -118,8 +118,8 @@ const Ye = (i) => {
118
118
  "Content-Type": "application/json"
119
119
  };
120
120
  if (a && (n["x-faro-session-id"] = a), t && typeof navigator < "u" && navigator.sendBeacon) {
121
- const l = new Blob([s], { type: "application/json" });
122
- navigator.sendBeacon(e, l);
121
+ const o = new Blob([s], { type: "application/json" });
122
+ navigator.sendBeacon(e, o);
123
123
  return;
124
124
  }
125
125
  const r = s.length < We;
@@ -128,9 +128,9 @@ const Ye = (i) => {
128
128
  headers: n,
129
129
  body: s,
130
130
  keepalive: r
131
- }).then((l) => {
132
- if (l.status === 429) {
133
- const d = l.headers.get("Retry-After"), c = d ? parseInt(d, 10) * 1e3 : 3e4;
131
+ }).then((o) => {
132
+ if (o.status === 429) {
133
+ const d = o.headers.get("Retry-After"), c = d ? parseInt(d, 10) * 1e3 : 3e4;
134
134
  G = Date.now() + c;
135
135
  }
136
136
  }).catch(() => {
@@ -166,11 +166,11 @@ const Ye = (i) => {
166
166
  }, Je = (i) => {
167
167
  if (A = [], G = 0, w && (clearTimeout(w), w = null), typeof document > "u")
168
168
  return;
169
- T && document.removeEventListener("visibilitychange", T), L && window.removeEventListener("pagehide", L);
169
+ L && document.removeEventListener("visibilitychange", L), T && window.removeEventListener("pagehide", T);
170
170
  const e = () => R(i, !0);
171
- T = () => {
171
+ L = () => {
172
172
  document.visibilityState === "hidden" && e();
173
- }, L = e, document.addEventListener("visibilitychange", T), window.addEventListener("pagehide", L);
173
+ }, T = e, document.addEventListener("visibilitychange", L), window.addEventListener("pagehide", T);
174
174
  }, Q = () => (/* @__PURE__ */ new Date()).toISOString();
175
175
  let ee = null, te = null;
176
176
  const Xe = (i) => {
@@ -389,7 +389,7 @@ const at = (i) => {
389
389
  ...s
390
390
  }
391
391
  });
392
- }, Dt = (i, e = "info", t) => {
392
+ }, It = (i, e = "info", t) => {
393
393
  if (!E) return;
394
394
  const s = {
395
395
  info: _.INFO,
@@ -445,6 +445,40 @@ class I {
445
445
  placeholder: s.cardNumber,
446
446
  autoComplete: "cc-number",
447
447
  validations: ["required", "validCardNumber"],
448
+ addCardBrands: [
449
+ {
450
+ type: "visa",
451
+ pattern: /^4/,
452
+ format: /(\d{1,4})/g,
453
+ length: [16],
454
+ cvcLength: [3],
455
+ luhn: !0
456
+ },
457
+ {
458
+ type: "mastercard",
459
+ pattern: /^(5[1-5]|2[2-7])/,
460
+ format: /(\d{1,4})/g,
461
+ length: [16],
462
+ cvcLength: [3],
463
+ luhn: !0
464
+ },
465
+ {
466
+ type: "american-express",
467
+ pattern: /^3[47]/,
468
+ format: /(\d{1,4})(\d{1,6})?(\d{1,5})?/,
469
+ length: [15],
470
+ cvcLength: [4],
471
+ luhn: !0
472
+ },
473
+ {
474
+ type: "discover",
475
+ pattern: /^(6011|65|64[4-9]|622)/,
476
+ format: /(\d{1,4})/g,
477
+ length: [16, 19],
478
+ cvcLength: [3],
479
+ luhn: !0
480
+ }
481
+ ],
448
482
  css: t
449
483
  });
450
484
  n.on("update", (r) => {
@@ -500,16 +534,16 @@ class I {
500
534
  a(r.errors);
501
535
  return;
502
536
  }
503
- const l = r?.data;
504
- if (!l?.id) {
537
+ const o = r?.data;
538
+ if (!o?.id) {
505
539
  a(new Error("Card creation failed: no card ID returned"));
506
540
  return;
507
541
  }
508
542
  if (n === 303) {
509
- this.patchCard(e, l.id).then(s).catch(a);
543
+ this.patchCard(e, o.id).then(s).catch(a);
510
544
  return;
511
545
  }
512
- s(I.extractCardResult(l));
546
+ s(I.extractCardResult(o));
513
547
  },
514
548
  (n) => {
515
549
  a(n);
@@ -542,17 +576,17 @@ class I {
542
576
  })
543
577
  },
544
578
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
545
- (r, l) => {
546
- if (r >= 400 || l?.errors) {
547
- n(l?.errors ?? new Error("Card update failed"));
579
+ (r, o) => {
580
+ if (r >= 400 || o?.errors) {
581
+ n(o?.errors ?? new Error("Card update failed"));
548
582
  return;
549
583
  }
550
- const d = l?.data;
584
+ const d = o?.data;
551
585
  if (!d?.id) {
552
586
  n(new Error("Card update failed: no card ID returned"));
553
587
  return;
554
588
  }
555
- const c = I.extractCardResult(d), p = l.included?.find(
589
+ const c = I.extractCardResult(d), p = o.included?.find(
556
590
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
557
591
  (b) => b.type === "card_updates"
558
592
  );
@@ -791,30 +825,30 @@ const lt = () => {
791
825
  cardCvv: !1
792
826
  },
793
827
  isValid: !1
794
- }), t = (o, g, m, u) => {
795
- if (o === "cardCvv")
828
+ }), t = (l, g, m, u) => {
829
+ if (l === "cardCvv")
796
830
  return i.cardCvv(g, m);
797
- if (o === "phoneNumber" && u)
831
+ if (l === "phoneNumber" && u)
798
832
  return i.phoneNumber(g, u);
799
- const f = i[o];
833
+ const f = i[l];
800
834
  return f?.(g);
801
- }, s = (o) => {
835
+ }, s = (l) => {
802
836
  const g = {};
803
- return Object.keys(o).forEach((u) => {
804
- const f = o[u];
837
+ return Object.keys(l).forEach((u) => {
838
+ const f = l[u];
805
839
  if (f === void 0) return;
806
840
  let h;
807
- u === "cardCvv" ? h = t(u, f, o.cardNumber) : u === "phoneNumber" ? h = t(
841
+ u === "cardCvv" ? h = t(u, f, l.cardNumber) : u === "phoneNumber" ? h = t(
808
842
  u,
809
843
  f,
810
844
  void 0,
811
- o.phoneCountryCode
845
+ l.phoneCountryCode
812
846
  ) : h = t(u, f), h && (g[u] = h);
813
847
  }), [
814
848
  "billingAddress",
815
849
  "shippingAddress"
816
850
  ].forEach((u) => {
817
- const f = o[u];
851
+ const f = l[u];
818
852
  if (f && typeof f == "object") {
819
853
  const h = {};
820
854
  Object.keys(f).forEach(
@@ -830,17 +864,17 @@ const lt = () => {
830
864
  ), Object.keys(h).length > 0 && (g[u] = h);
831
865
  }
832
866
  }), g;
833
- }, a = (o) => {
834
- const g = s(o);
867
+ }, a = (l) => {
868
+ const g = s(l);
835
869
  return Object.keys(g).length === 0;
836
- }, n = "billingAddress.", r = "shippingAddress.", l = (o) => o.startsWith(n) ? {
870
+ }, n = "billingAddress.", r = "shippingAddress.", o = (l) => l.startsWith(n) ? {
837
871
  parent: "billingAddress",
838
- field: o.slice(n.length)
839
- } : o.startsWith(r) ? {
872
+ field: l.slice(n.length)
873
+ } : l.startsWith(r) ? {
840
874
  parent: "shippingAddress",
841
- field: o.slice(r.length)
842
- } : null, d = (o, g, m, u) => {
843
- const f = { ...o };
875
+ field: l.slice(r.length)
876
+ } : null, d = (l, g, m, u) => {
877
+ const f = { ...l };
844
878
  if (u)
845
879
  f[g] = {
846
880
  ...f[g],
@@ -853,16 +887,16 @@ const lt = () => {
853
887
  delete h[m], Object.keys(h).length === 0 ? delete f[g] : f[g] = h;
854
888
  }
855
889
  return f;
856
- }, c = (o, g) => {
890
+ }, c = (l, g) => {
857
891
  const m = e.getState();
858
892
  let u = g;
859
- const f = l(o);
860
- if (!f && o in U)
861
- if (o === "cardCvv") {
893
+ const f = o(l);
894
+ if (!f && l in U)
895
+ if (l === "cardCvv") {
862
896
  const S = fe(m.formData.cardNumber) === "amex" ? 4 : 3;
863
897
  u = U.cardCvv(g, S);
864
898
  } else
865
- u = U[o](g);
899
+ u = U[l](g);
866
900
  let h;
867
901
  if (f) {
868
902
  const { parent: v, field: S } = f;
@@ -876,10 +910,10 @@ const lt = () => {
876
910
  } else
877
911
  h = {
878
912
  ...m.formData,
879
- [o]: u
913
+ [l]: u
880
914
  };
881
915
  let y = { ...m.errors };
882
- if (o === "phoneCountryCode" && h.phoneNumber) {
916
+ if (l === "phoneCountryCode" && h.phoneNumber) {
883
917
  const v = t(
884
918
  "phoneNumber",
885
919
  h.phoneNumber,
@@ -888,7 +922,7 @@ const lt = () => {
888
922
  );
889
923
  v ? y.phoneNumber = v : delete y.phoneNumber;
890
924
  }
891
- if (m.touched[o])
925
+ if (m.touched[l])
892
926
  if (f) {
893
927
  const { parent: v, field: S } = f, M = i[S], x = M ? M(
894
928
  u
@@ -896,20 +930,20 @@ const lt = () => {
896
930
  y = d(y, v, S, x);
897
931
  } else {
898
932
  let v;
899
- o === "cardCvv" ? v = t(o, u, h.cardNumber) : o === "phoneNumber" ? v = t(
900
- o,
933
+ l === "cardCvv" ? v = t(l, u, h.cardNumber) : l === "phoneNumber" ? v = t(
934
+ l,
901
935
  u,
902
936
  void 0,
903
937
  h.phoneCountryCode
904
- ) : v = t(o, u), v ? y[o] = v : delete y[o];
938
+ ) : v = t(l, u), v ? y[l] = v : delete y[l];
905
939
  }
906
940
  e.setState({
907
941
  formData: h,
908
942
  errors: y,
909
943
  isValid: a(h)
910
944
  });
911
- }, p = (o, g) => {
912
- const m = e.getState(), u = l(o);
945
+ }, p = (l, g) => {
946
+ const m = e.getState(), u = o(l);
913
947
  if (u) {
914
948
  const { parent: v, field: S } = u, M = {
915
949
  ...m.formData,
@@ -922,7 +956,7 @@ const lt = () => {
922
956
  formData: M,
923
957
  touched: {
924
958
  ...m.touched,
925
- [o]: !0
959
+ [l]: !0
926
960
  },
927
961
  errors: me,
928
962
  isValid: a(M)
@@ -931,24 +965,24 @@ const lt = () => {
931
965
  }
932
966
  const f = {
933
967
  ...m.touched,
934
- [o]: !0
968
+ [l]: !0
935
969
  };
936
970
  let h;
937
- o === "cardCvv" ? h = t(o, g, m.formData.cardNumber) : o === "phoneNumber" ? h = t(
938
- o,
971
+ l === "cardCvv" ? h = t(l, g, m.formData.cardNumber) : l === "phoneNumber" ? h = t(
972
+ l,
939
973
  g,
940
974
  void 0,
941
975
  m.formData.phoneCountryCode
942
- ) : h = t(o, g);
976
+ ) : h = t(l, g);
943
977
  const y = { ...m.errors };
944
- h ? y[o] = h : delete y[o], e.setState({
978
+ h ? y[l] = h : delete y[l], e.setState({
945
979
  touched: f,
946
980
  errors: y
947
981
  });
948
- }, b = (o) => {
982
+ }, b = (l) => {
949
983
  const m = {
950
984
  ...e.getState().formData,
951
- ...o
985
+ ...l
952
986
  };
953
987
  e.setState({
954
988
  formData: m,
@@ -978,11 +1012,16 @@ async function ut(i) {
978
1012
  return null;
979
1013
  }
980
1014
  }
981
- function W(i) {
1015
+ function mt(i) {
982
1016
  if (!i) return !1;
983
1017
  const { billingFields: e, shippingFields: t } = i, s = e && Object.values(e).some((n) => n?.enabled), a = t && Object.values(t).some((n) => n?.enabled);
984
1018
  return !!(s || a);
985
1019
  }
1020
+ function W(i) {
1021
+ if (!i) return !1;
1022
+ const { billingFields: e, shippingFields: t } = i, s = e?.firstName?.enabled && e?.lastName?.enabled, a = t?.firstName?.enabled && t?.lastName?.enabled;
1023
+ return !!(s || a);
1024
+ }
986
1025
  class re extends P {
987
1026
  inputs = /* @__PURE__ */ new Map();
988
1027
  type;
@@ -995,15 +1034,15 @@ class re extends P {
995
1034
  grouped;
996
1035
  constructor(e) {
997
1036
  super("div", ["address-section"]), this.type = e.type, this.onChange = e.onChange, this.onBlur = e.onBlur, this.translationFunc = e.translationFunc, this.locale = e.locale, this.grouped = e.grouped ?? !0;
998
- const { title: t, checkoutProfile: s, fieldsConfig: a, values: n, errors: r, touched: l } = e;
1037
+ const { title: t, checkoutProfile: s, fieldsConfig: a, values: n, errors: r, touched: o } = e;
999
1038
  if (this.grouped) {
1000
1039
  const d = document.createElement("h3");
1001
1040
  d.className = "address-section-title", d.textContent = t, d.style.color = s.styles.textColor, d.style.fontFamily = `"${s.styles.fontFamily}", sans-serif`, d.style.fontSize = `${s.styles.fontSize}px`, d.style.fontWeight = "normal", this.getElement().appendChild(d);
1002
1041
  }
1003
- this.fieldsContainer = document.createElement("div"), this.fieldsContainer.className = "address-fields", this.grouped || this.fieldsContainer.classList.add("address-fields--ungrouped"), this.getElement().appendChild(this.fieldsContainer), this.createFields(s, a, n, r, l);
1042
+ this.fieldsContainer = document.createElement("div"), this.fieldsContainer.className = "address-fields", this.grouped || this.fieldsContainer.classList.add("address-fields--ungrouped"), this.getElement().appendChild(this.fieldsContainer), this.createFields(s, a, n, r, o);
1004
1043
  }
1005
1044
  borderRadius(e, t, s, a, n) {
1006
- const r = (l) => l ? `${e}px` : "0px";
1045
+ const r = (o) => o ? `${e}px` : "0px";
1007
1046
  return `${r(t)} ${r(s)} ${r(a)} ${r(n)}`;
1008
1047
  }
1009
1048
  createFields(e, t, s, a, n) {
@@ -1017,7 +1056,7 @@ class re extends P {
1017
1056
  );
1018
1057
  return;
1019
1058
  }
1020
- const r = e.styles.borderRadius, l = {
1059
+ const r = e.styles.borderRadius, o = {
1021
1060
  color: e.styles.textColor,
1022
1061
  fontSize: e.styles.fontSize,
1023
1062
  fontFamily: e.styles.fontFamily
@@ -1028,9 +1067,9 @@ class re extends P {
1028
1067
  const p = [];
1029
1068
  t.city?.enabled && p.push("city"), t.zipCode?.enabled && p.push("zipCode"), p.length > 0 && d.push({ kind: "cityZip", fields: p }), t.state?.enabled && d.push({ kind: "state" });
1030
1069
  const b = d.length;
1031
- d.forEach((o, g) => {
1070
+ d.forEach((l, g) => {
1032
1071
  const m = g === 0, u = g === b - 1, f = (h, y) => ({
1033
- ...l,
1072
+ ...o,
1034
1073
  borderRadius: this.borderRadius(
1035
1074
  r,
1036
1075
  m && h,
@@ -1039,7 +1078,7 @@ class re extends P {
1039
1078
  u && h
1040
1079
  )
1041
1080
  });
1042
- if (o.kind === "street") {
1081
+ if (l.kind === "street") {
1043
1082
  const h = this.createRow(["full"]), y = this.createInput(
1044
1083
  "street",
1045
1084
  t.street?.label ?? this.translationFunc("address.addressLine1"),
@@ -1052,10 +1091,10 @@ class re extends P {
1052
1091
  this.inputs.set("street", y), h.appendChild(y.getElement()), this.fieldsContainer.appendChild(h);
1053
1092
  return;
1054
1093
  }
1055
- if (o.kind === "name") {
1056
- const h = this.createRow(o.fields.map(() => "half")), y = o.fields.length === 1;
1057
- if (o.fields.includes("firstName")) {
1058
- const v = y || o.fields[o.fields.length - 1] === "firstName", S = this.createInput(
1094
+ if (l.kind === "name") {
1095
+ const h = this.createRow(l.fields.map(() => "half")), y = l.fields.length === 1;
1096
+ if (l.fields.includes("firstName")) {
1097
+ const v = y || l.fields[l.fields.length - 1] === "firstName", S = this.createInput(
1059
1098
  "firstName",
1060
1099
  t.firstName?.label ?? this.translationFunc("address.firstName"),
1061
1100
  s.firstName,
@@ -1066,8 +1105,8 @@ class re extends P {
1066
1105
  );
1067
1106
  this.inputs.set("firstName", S), h.appendChild(S.getElement());
1068
1107
  }
1069
- if (o.fields.includes("lastName")) {
1070
- const v = y || o.fields[0] === "lastName", S = this.createInput(
1108
+ if (l.fields.includes("lastName")) {
1109
+ const v = y || l.fields[0] === "lastName", S = this.createInput(
1071
1110
  "lastName",
1072
1111
  t.lastName?.label ?? this.translationFunc("address.lastName"),
1073
1112
  s.lastName,
@@ -1081,7 +1120,7 @@ class re extends P {
1081
1120
  this.fieldsContainer.appendChild(h);
1082
1121
  return;
1083
1122
  }
1084
- if (o.kind === "country") {
1123
+ if (l.kind === "country") {
1085
1124
  const h = this.createRow(["full"]), y = this.createCountrySelect(
1086
1125
  s.country,
1087
1126
  a.country,
@@ -1093,10 +1132,10 @@ class re extends P {
1093
1132
  this.inputs.set("country", y), h.appendChild(y.getElement()), this.fieldsContainer.appendChild(h);
1094
1133
  return;
1095
1134
  }
1096
- if (o.kind === "cityZip") {
1097
- const h = this.createRow(o.fields.map(() => "half")), y = o.fields.length === 1;
1098
- if (o.fields.includes("city")) {
1099
- const v = y || o.fields[o.fields.length - 1] === "city", S = this.createInput(
1135
+ if (l.kind === "cityZip") {
1136
+ const h = this.createRow(l.fields.map(() => "half")), y = l.fields.length === 1;
1137
+ if (l.fields.includes("city")) {
1138
+ const v = y || l.fields[l.fields.length - 1] === "city", S = this.createInput(
1100
1139
  "city",
1101
1140
  t.city?.label ?? this.translationFunc("address.townCity"),
1102
1141
  s.city,
@@ -1107,8 +1146,8 @@ class re extends P {
1107
1146
  );
1108
1147
  this.inputs.set("city", S), h.appendChild(S.getElement());
1109
1148
  }
1110
- if (o.fields.includes("zipCode")) {
1111
- const v = y || o.fields[0] === "zipCode", S = this.createInput(
1149
+ if (l.fields.includes("zipCode")) {
1150
+ const v = y || l.fields[0] === "zipCode", S = this.createInput(
1112
1151
  "zipCode",
1113
1152
  t.zipCode?.label ?? this.translationFunc("address.postalCode"),
1114
1153
  s.zipCode,
@@ -1122,7 +1161,7 @@ class re extends P {
1122
1161
  this.fieldsContainer.appendChild(h);
1123
1162
  return;
1124
1163
  }
1125
- if (o.kind === "state") {
1164
+ if (l.kind === "state") {
1126
1165
  const h = this.createRow(["full"]);
1127
1166
  if (this.stateOptions = t.state?.options, t.state?.options && t.state.options.length > 0) {
1128
1167
  const v = this.createStateSelect(
@@ -1155,7 +1194,7 @@ class re extends P {
1155
1194
  const t = document.createElement("div");
1156
1195
  return t.className = `address-row address-row-${e.length === 1 ? "single" : "double"}`, t;
1157
1196
  }
1158
- createInput(e, t, s, a, n, r, l) {
1197
+ createInput(e, t, s, a, n, r, o) {
1159
1198
  const d = `${this.type}Address.${e}`, c = new ce({
1160
1199
  name: d,
1161
1200
  error: !1,
@@ -1169,7 +1208,7 @@ class re extends P {
1169
1208
  })()
1170
1209
  },
1171
1210
  value: s,
1172
- autocomplete: l,
1211
+ autocomplete: o,
1173
1212
  onChange: (p) => {
1174
1213
  c.setError(!1);
1175
1214
  const b = new Event("input", { bubbles: !0 });
@@ -1194,8 +1233,8 @@ class re extends P {
1194
1233
  }), c;
1195
1234
  }
1196
1235
  createCountrySelect(e, t, s, a, n, r) {
1197
- const l = `${this.type}Address.country`, d = ye(n, this.locale), c = new H({
1198
- name: l,
1236
+ const o = `${this.type}Address.country`, d = ye(n, this.locale), c = new H({
1237
+ name: o,
1199
1238
  error: !1,
1200
1239
  errorMsg: void 0,
1201
1240
  styles: a,
@@ -1210,14 +1249,14 @@ class re extends P {
1210
1249
  c.setError(!1);
1211
1250
  const b = p.target.value;
1212
1251
  this.updateStateOptionsForCountry(b);
1213
- const o = new Event("change", { bubbles: !0 });
1214
- Object.defineProperty(o, "target", {
1252
+ const l = new Event("change", { bubbles: !0 });
1253
+ Object.defineProperty(l, "target", {
1215
1254
  writable: !1,
1216
1255
  value: {
1217
- name: l,
1256
+ name: o,
1218
1257
  value: b
1219
1258
  }
1220
- }), this.onChange(o);
1259
+ }), this.onChange(l);
1221
1260
  }
1222
1261
  });
1223
1262
  return c.addEventListener("blur", (p) => {
@@ -1225,7 +1264,7 @@ class re extends P {
1225
1264
  Object.defineProperty(b, "target", {
1226
1265
  writable: !1,
1227
1266
  value: {
1228
- name: l,
1267
+ name: o,
1229
1268
  value: p.target.value
1230
1269
  }
1231
1270
  }), this.onBlur(b);
@@ -1237,19 +1276,19 @@ class re extends P {
1237
1276
  const s = e === "CA" ? "CA" : "US", a = Z(this.stateOptions, s), n = s === "CA" ? this.translationFunc("address.chooseProvince") : this.translationFunc("address.chooseState");
1238
1277
  t.setOptions(a, n);
1239
1278
  }
1240
- createStateSelect(e, t, s, a, n, r, l) {
1241
- const d = `${this.type}Address.state`, c = r === "CA" ? "CA" : "US", p = Z(n, c), b = c === "CA" ? this.translationFunc("address.chooseProvince") : this.translationFunc("address.chooseState"), o = new H({
1279
+ createStateSelect(e, t, s, a, n, r, o) {
1280
+ const d = `${this.type}Address.state`, c = r === "CA" ? "CA" : "US", p = Z(n, c), b = c === "CA" ? this.translationFunc("address.chooseProvince") : this.translationFunc("address.chooseState"), l = new H({
1242
1281
  name: d,
1243
1282
  error: !1,
1244
1283
  errorMsg: void 0,
1245
1284
  styles: a,
1246
1285
  placeholder: b,
1247
- ...!this.grouped && { label: l ?? b },
1286
+ ...!this.grouped && { label: o ?? b },
1248
1287
  value: e,
1249
1288
  options: p,
1250
1289
  autocomplete: "address-level1",
1251
1290
  onChange: (g) => {
1252
- o.setError(!1);
1291
+ l.setError(!1);
1253
1292
  const m = new Event("change", { bubbles: !0 });
1254
1293
  Object.defineProperty(m, "target", {
1255
1294
  writable: !1,
@@ -1260,7 +1299,7 @@ class re extends P {
1260
1299
  }), this.onChange(m);
1261
1300
  }
1262
1301
  });
1263
- return o.addEventListener("blur", (g) => {
1302
+ return l.addEventListener("blur", (g) => {
1264
1303
  const m = new Event("blur", { bubbles: !0 });
1265
1304
  Object.defineProperty(m, "target", {
1266
1305
  writable: !1,
@@ -1269,23 +1308,23 @@ class re extends P {
1269
1308
  value: g.target.value
1270
1309
  }
1271
1310
  }), this.onBlur(m);
1272
- }), o;
1311
+ }), l;
1273
1312
  }
1274
1313
  createUngroupedFields(e, t, s, a, n) {
1275
- const r = e.styles.borderRadius, l = {
1314
+ const r = e.styles.borderRadius, o = {
1276
1315
  color: e.styles.textColor,
1277
1316
  fontSize: e.styles.fontSize,
1278
1317
  fontFamily: e.styles.fontFamily,
1279
1318
  borderRadius: `${r}px`
1280
1319
  }, d = (c, p, b) => {
1281
1320
  if (!t[c]?.enabled) return;
1282
- const o = t[c]?.label ?? this.translationFunc(p), g = this.createRow(["full"]), m = this.createInput(
1321
+ const l = t[c]?.label ?? this.translationFunc(p), g = this.createRow(["full"]), m = this.createInput(
1283
1322
  c,
1284
- o,
1323
+ l,
1285
1324
  s[c],
1286
1325
  a[c],
1287
1326
  n[c],
1288
- l,
1327
+ o,
1289
1328
  b
1290
1329
  );
1291
1330
  this.inputs.set(c, m), g.appendChild(m.getElement()), this.fieldsContainer.appendChild(g);
@@ -1295,7 +1334,7 @@ class re extends P {
1295
1334
  s.country,
1296
1335
  a.country,
1297
1336
  n.country,
1298
- l,
1337
+ o,
1299
1338
  t.country?.options,
1300
1339
  c
1301
1340
  );
@@ -1305,27 +1344,27 @@ class re extends P {
1305
1344
  this.stateOptions = t.state?.options;
1306
1345
  const c = this.createRow(["full"]), p = t.state?.options && t.state.options.length > 0, b = t.state?.label ?? this.translationFunc("address.chooseState");
1307
1346
  if (p) {
1308
- const o = this.createStateSelect(
1347
+ const l = this.createStateSelect(
1309
1348
  s.state,
1310
1349
  a.state,
1311
1350
  n.state,
1312
- l,
1351
+ o,
1313
1352
  t.state?.options,
1314
1353
  s.country,
1315
1354
  b
1316
1355
  );
1317
- this.inputs.set("state", o), c.appendChild(o.getElement());
1356
+ this.inputs.set("state", l), c.appendChild(l.getElement());
1318
1357
  } else {
1319
- const o = this.createInput(
1358
+ const l = this.createInput(
1320
1359
  "state",
1321
1360
  b,
1322
1361
  s.state,
1323
1362
  a.state,
1324
1363
  n.state,
1325
- l,
1364
+ o,
1326
1365
  "address-level1"
1327
1366
  );
1328
- this.inputs.set("state", o), c.appendChild(o.getElement());
1367
+ this.inputs.set("state", l), c.appendChild(l.getElement());
1329
1368
  }
1330
1369
  this.fieldsContainer.appendChild(c);
1331
1370
  }
@@ -1363,8 +1402,8 @@ class re extends P {
1363
1402
  updateField(e, t, s, a) {
1364
1403
  const n = this.inputs.get(e);
1365
1404
  if (n) {
1366
- const l = n.getElement().querySelector("input") || n.getElement().querySelector("select"), d = n.getValue();
1367
- !(document.activeElement === l) && !(t === "" && d !== "") && this.setValue(e, t);
1405
+ const o = n.getElement().querySelector("input") || n.getElement().querySelector("select"), d = n.getValue();
1406
+ !(document.activeElement === o) && !(t === "" && d !== "") && this.setValue(e, t);
1368
1407
  }
1369
1408
  const r = !!(a && s);
1370
1409
  this.setError(e, r, s);
@@ -1384,7 +1423,7 @@ class re extends P {
1384
1423
  e && e.focus();
1385
1424
  }
1386
1425
  }
1387
- class mt {
1426
+ class pt {
1388
1427
  input = null;
1389
1428
  isVgsMode;
1390
1429
  vgsWrapper = null;
@@ -1398,17 +1437,17 @@ class mt {
1398
1437
  onBlur: a,
1399
1438
  errorMsg: n,
1400
1439
  checkoutProfile: r,
1401
- translationFunc: l,
1440
+ translationFunc: o,
1402
1441
  autocomplete: d = "cc-name",
1403
1442
  isVgsMode: c = !1
1404
1443
  } = e;
1405
- this.isVgsMode = c, this.wrapperElement = document.createElement("div"), c ? this.buildVgsLayout(r, l) : this.buildNativeLayout(
1444
+ this.isVgsMode = c, this.wrapperElement = document.createElement("div"), c ? this.buildVgsLayout(r, o) : this.buildNativeLayout(
1406
1445
  t,
1407
1446
  s,
1408
1447
  a,
1409
1448
  n,
1410
1449
  r,
1411
- l,
1450
+ o,
1412
1451
  d
1413
1452
  );
1414
1453
  }
@@ -1420,7 +1459,7 @@ class mt {
1420
1459
  const r = document.createElement("div");
1421
1460
  r.className = "vgs-field-skeleton", this.vgsWrapper.appendChild(r), this.vgsContainer = document.createElement("div"), this.vgsContainer.id = `vgs-cc-name-${Date.now()}`, this.vgsContainer.style.position = "relative", this.vgsContainer.style.zIndex = "1", this.vgsContainer.style.width = "100%", this.vgsContainer.style.height = "100%", this.vgsWrapper.appendChild(this.vgsContainer), this.wrapperElement.appendChild(this.vgsWrapper), this.vgsHelperText = new be({ visible: !1 }), this.wrapperElement.appendChild(this.vgsHelperText.getElement());
1422
1461
  }
1423
- buildNativeLayout(e, t, s, a, n, r, l) {
1462
+ buildNativeLayout(e, t, s, a, n, r, o) {
1424
1463
  this.input = new ce({
1425
1464
  name: "name",
1426
1465
  label: r("cardholderNameLabel"),
@@ -1434,7 +1473,7 @@ class mt {
1434
1473
  },
1435
1474
  placeholder: r("cardholderNamePlaceholder"),
1436
1475
  value: e,
1437
- autocomplete: l,
1476
+ autocomplete: o,
1438
1477
  onChange: (d) => {
1439
1478
  const p = d.target.value, b = p.replace(/[^a-zA-Z\s\-'.]/g, "");
1440
1479
  p !== b && this.input?.setValue(b), this.input?.setError(!1), this.trim(), t(d);
@@ -1509,7 +1548,7 @@ class he extends P {
1509
1548
  return e.appendChild(t), e.appendChild(s), e.appendChild(a), e;
1510
1549
  }
1511
1550
  }
1512
- class pt extends P {
1551
+ class gt extends P {
1513
1552
  constructor(e) {
1514
1553
  const { translationFunc: t, checkoutProfile: s } = e;
1515
1554
  super("div", ["payment-separator"]);
@@ -1517,11 +1556,11 @@ class pt extends P {
1517
1556
  n.className = "payment-separator__line";
1518
1557
  const r = document.createElement("p");
1519
1558
  r.textContent = t("pay-with-card"), r.className = "payment-separator__text", r.style.fontFamily = `${s.styles.fontFamily}, sans-serif`;
1520
- const l = document.createElement("span");
1521
- l.className = "payment-separator__line", a.appendChild(n), a.appendChild(r), a.appendChild(l);
1559
+ const o = document.createElement("span");
1560
+ o.className = "payment-separator__line", a.appendChild(n), a.appendChild(r), a.appendChild(o);
1522
1561
  }
1523
1562
  }
1524
- class gt extends P {
1563
+ class ft extends P {
1525
1564
  paymentMethods;
1526
1565
  paymentSeparator;
1527
1566
  skeleton;
@@ -1532,12 +1571,12 @@ class gt extends P {
1532
1571
  onPaypalSubmit: a,
1533
1572
  onApplePaySubmit: n,
1534
1573
  supportedPaymentMethods: r,
1535
- translationFunc: l,
1574
+ translationFunc: o,
1536
1575
  paymentId: d,
1537
1576
  checkoutKey: c,
1538
1577
  checkoutDetails: p,
1539
1578
  environment: b,
1540
- countryCode: o
1579
+ countryCode: l
1541
1580
  } = e;
1542
1581
  if (super("div", ["payment-methods"]), this.paymentMethods = /* @__PURE__ */ new Map(), !t?.additionalPaymentMethods) {
1543
1582
  this.getElement().style.display = "none";
@@ -1550,7 +1589,7 @@ class gt extends P {
1550
1589
  const g = Object.entries(
1551
1590
  t.additionalPaymentMethods
1552
1591
  ).filter(([m, u]) => {
1553
- const f = u.enabled, h = r ? r[m] === !0 : !0, y = !u.countries || o && u.countries.includes(o);
1592
+ const f = u.enabled, h = r ? r[m] === !0 : !0, y = !u.countries || l && u.countries.includes(l);
1554
1593
  return f && h && y;
1555
1594
  }).sort((m, u) => m[1].order - u[1].order);
1556
1595
  if (g.length === 0) {
@@ -1600,8 +1639,8 @@ class gt extends P {
1600
1639
  );
1601
1640
  break;
1602
1641
  }
1603
- this.paymentMethods.size > 0 && (this.paymentSeparator = new pt({
1604
- translationFunc: l,
1642
+ this.paymentMethods.size > 0 && (this.paymentSeparator = new gt({
1643
+ translationFunc: o,
1605
1644
  checkoutProfile: t
1606
1645
  }), this.getElement().appendChild(this.paymentSeparator.getElement()));
1607
1646
  }
@@ -1618,8 +1657,8 @@ class gt extends P {
1618
1657
  return this.paymentMethods.size > 0 && this.getElement().style.display !== "none";
1619
1658
  }
1620
1659
  }
1621
- const ft = 17;
1622
- class yt extends P {
1660
+ const yt = 17;
1661
+ class bt extends P {
1623
1662
  styles;
1624
1663
  isHovered = !1;
1625
1664
  constructor(e) {
@@ -1629,7 +1668,7 @@ class yt extends P {
1629
1668
  }
1630
1669
  applyStyles() {
1631
1670
  const e = this.getElement();
1632
- 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 === ft ? "100vmax" : `${this.styles.borderRadius}px`, e.style.fontSize = `${this.styles.fontSize}px`, e.style.fontFamily = `${this.styles.fontFamily}, sans-serif`;
1671
+ 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 === yt ? "100vmax" : `${this.styles.borderRadius}px`, e.style.fontSize = `${this.styles.fontSize}px`, e.style.fontFamily = `${this.styles.fontFamily}, sans-serif`;
1633
1672
  }
1634
1673
  handleMouseEnter() {
1635
1674
  this.isHovered = !0, this.applyStyles();
@@ -1641,11 +1680,11 @@ class yt extends P {
1641
1680
  return this.getElement().disabled = e, e ? (this.addClass("disabled"), this.removeClass("valid")) : (this.removeClass("disabled"), this.addClass("valid")), this.applyStyles(), this;
1642
1681
  }
1643
1682
  }
1644
- class bt {
1683
+ class vt {
1645
1684
  button;
1646
1685
  constructor(e) {
1647
1686
  const { disabled: t, checkoutProfile: s, translationFunc: a } = e;
1648
- this.button = new yt({
1687
+ this.button = new bt({
1649
1688
  text: a(
1650
1689
  `buttonTexts.${s?.layout.actionButton.translationKey}`
1651
1690
  ),
@@ -1672,7 +1711,7 @@ class bt {
1672
1711
  return this.button.appendTo(e), this;
1673
1712
  }
1674
1713
  }
1675
- class vt {
1714
+ class St {
1676
1715
  formElement;
1677
1716
  focusManager;
1678
1717
  translationFunc;
@@ -1718,7 +1757,7 @@ class vt {
1718
1757
  (a) => a.enabled
1719
1758
  ))
1720
1759
  return;
1721
- this.paymentMethods = new gt({
1760
+ this.paymentMethods = new ft({
1722
1761
  checkoutProfile: e,
1723
1762
  formData: t,
1724
1763
  supportedPaymentMethods: this.supportedPaymentMethods,
@@ -1826,8 +1865,8 @@ class vt {
1826
1865
  "focus",
1827
1866
  this.cardNumberFocusHandler
1828
1867
  ));
1829
- const l = this.cardSection.getElement().querySelector('input[name="cardCvv"]');
1830
- l && (this.cardCvvFocusHandler = () => this.onFieldFocus("cardCvv"), l.addEventListener("focus", this.cardCvvFocusHandler));
1868
+ const o = this.cardSection.getElement().querySelector('input[name="cardCvv"]');
1869
+ o && (this.cardCvvFocusHandler = () => this.onFieldFocus("cardCvv"), o.addEventListener("focus", this.cardCvvFocusHandler));
1831
1870
  }
1832
1871
  this.focusManager.registerField("cardNumber", {
1833
1872
  focus: () => this.cardSection?.focusField("cardNumber")
@@ -1846,7 +1885,7 @@ class vt {
1846
1885
  this.cardholderSectionSkeleton = this.buildCardholderSkeleton(e), this.formElement.appendChild(this.cardholderSectionSkeleton);
1847
1886
  return;
1848
1887
  }
1849
- if (this.cardholderSection = new mt({
1888
+ if (this.cardholderSection = new pt({
1850
1889
  value: t.name,
1851
1890
  onChange: this.onChange,
1852
1891
  onBlur: this.onBlur,
@@ -1870,7 +1909,7 @@ class vt {
1870
1909
  if (!n || !Object.values(n).some(
1871
1910
  (d) => d?.enabled
1872
1911
  )) return;
1873
- const l = {
1912
+ const o = {
1874
1913
  street: "",
1875
1914
  firstName: "",
1876
1915
  lastName: "",
@@ -1884,7 +1923,7 @@ class vt {
1884
1923
  title: this.translationFunc("address.billingTitle"),
1885
1924
  checkoutProfile: e,
1886
1925
  fieldsConfig: n,
1887
- values: t.billingAddress ?? l,
1926
+ values: t.billingAddress ?? o,
1888
1927
  errors: s.billingAddress ?? {},
1889
1928
  touched: a.billingAddress ?? {},
1890
1929
  onChange: this.onChange,
@@ -1903,7 +1942,7 @@ class vt {
1903
1942
  if (!n || !Object.values(n).some(
1904
1943
  (d) => d?.enabled
1905
1944
  )) return;
1906
- const l = {
1945
+ const o = {
1907
1946
  street: "",
1908
1947
  firstName: "",
1909
1948
  lastName: "",
@@ -1917,7 +1956,7 @@ class vt {
1917
1956
  title: this.translationFunc("address.shippingTitle"),
1918
1957
  checkoutProfile: e,
1919
1958
  fieldsConfig: n,
1920
- values: t.shippingAddress ?? l,
1959
+ values: t.shippingAddress ?? o,
1921
1960
  errors: s.shippingAddress ?? {},
1922
1961
  touched: a.shippingAddress ?? {},
1923
1962
  onChange: this.onChange,
@@ -1932,7 +1971,7 @@ class vt {
1932
1971
  }
1933
1972
  createSubmitButton(e, t) {
1934
1973
  try {
1935
- this.submitButton = new bt({
1974
+ this.submitButton = new vt({
1936
1975
  disabled: t,
1937
1976
  checkoutProfile: e,
1938
1977
  translationFunc: this.translationFunc
@@ -1947,13 +1986,13 @@ class vt {
1947
1986
  updatePhoneNumberField(e, t, s) {
1948
1987
  this.phoneNumberField && (this.phoneNumberField.setValue(e), this.phoneNumberField.setError(t, s));
1949
1988
  }
1950
- updateCardSection(e, t, s, a, n, r, l, d, c) {
1989
+ updateCardSection(e, t, s, a, n, r, o, d, c) {
1951
1990
  this.cardSection && (this.cardSection.updateCardNumber(
1952
1991
  e,
1953
1992
  t,
1954
1993
  s
1955
1994
  ), this.cardSection.updateCardCvv(a, n, r), this.cardSection.updateCardExpiry(
1956
- l,
1995
+ o,
1957
1996
  d,
1958
1997
  c
1959
1998
  ));
@@ -1995,8 +2034,8 @@ class vt {
1995
2034
  n.className = "input-label", n.textContent = this.translationFunc("cardInformation"), n.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, a.appendChild(n), s.appendChild(a);
1996
2035
  const r = document.createElement("div");
1997
2036
  r.className = "vgs-card-group", r.style.borderRadius = `${t}px`, r.style.background = "#fff", r.style.display = "flex", r.style.flexDirection = "column", r.style.gap = "8px";
1998
- const l = document.createElement("div");
1999
- l.className = "card-number-row", l.style.position = "relative", l.style.height = "38.5px", l.style.overflow = "hidden", l.style.borderRadius = `${t}px`, l.appendChild(this.createSkeletonDiv()), r.appendChild(l);
2037
+ const o = document.createElement("div");
2038
+ o.className = "card-number-row", o.style.position = "relative", o.style.height = "38.5px", o.style.overflow = "hidden", o.style.borderRadius = `${t}px`, o.appendChild(this.createSkeletonDiv()), r.appendChild(o);
2000
2039
  const d = document.createElement("div");
2001
2040
  d.style.display = "flex", d.style.gap = "8px";
2002
2041
  const c = document.createElement("div");
@@ -2079,7 +2118,7 @@ class vt {
2079
2118
  this.billingAddressSection && (this.billingAddressSection.getElement().remove(), this.billingAddressSection = void 0), this.shippingAddressSection && (this.shippingAddressSection.getElement().remove(), this.shippingAddressSection = void 0), this.submitButton && (this.submitButton.getElement().remove(), this.submitButton = void 0), this.paymentMethods && (this.paymentMethods.getElement().remove(), this.paymentMethods = void 0);
2080
2119
  }
2081
2120
  }
2082
- class St {
2121
+ class Et {
2083
2122
  formManager;
2084
2123
  focusManager;
2085
2124
  onFormSubmit;
@@ -2091,16 +2130,16 @@ class St {
2091
2130
  handleChange = (e) => {
2092
2131
  const t = e.target, { name: s, value: a } = t, n = s;
2093
2132
  this.formManager.handleChange(n, a), this.localTouchedFields.has(n) || (this.localTouchedFields.add(n), this.formManager.handleBlur(n, a));
2094
- const { formData: r, errors: l, touched: d } = this.formManager.getFormState();
2095
- this.focusManager.handleStateUpdate(r, l, d);
2133
+ const { formData: r, errors: o, touched: d } = this.formManager.getFormState();
2134
+ this.focusManager.handleStateUpdate(r, o, d);
2096
2135
  };
2097
2136
  handleBlur = (e) => {
2098
2137
  const t = e.target, { name: s, value: a } = t, n = s;
2099
2138
  this.localTouchedFields.add(n), this.formManager.handleBlur(n, a), setTimeout(() => {
2100
2139
  this.onUIUpdate();
2101
2140
  }, 0);
2102
- const { formData: r, errors: l, touched: d } = this.formManager.getFormState();
2103
- d[n] || this.focusManager.handleStateUpdate(r, l, d);
2141
+ const { formData: r, errors: o, touched: d } = this.formManager.getFormState();
2142
+ d[n] || this.focusManager.handleStateUpdate(r, o, d);
2104
2143
  };
2105
2144
  handleSubmit = async (e) => {
2106
2145
  e.preventDefault(), await this.onFormSubmit(e);
@@ -2120,7 +2159,7 @@ class St {
2120
2159
  this.localTouchedFields.clear();
2121
2160
  }
2122
2161
  }
2123
- class Et {
2162
+ class Ct {
2124
2163
  formManager;
2125
2164
  checkoutProfile;
2126
2165
  formElement;
@@ -2162,13 +2201,13 @@ class Et {
2162
2201
  isFormDisabled() {
2163
2202
  const e = this.formManager.getFormState(), t = this.checkoutProfile.getState(), s = Object.keys(e.errors).filter(
2164
2203
  (y) => y !== "billingAddress" && y !== "shippingAddress"
2165
- ).length > 0, a = e.errors.billingAddress, n = a && typeof a == "object" ? Object.keys(a).length > 0 : !1, r = e.errors.shippingAddress, l = r && typeof r == "object" ? Object.keys(r).length > 0 : !1, d = s || n || l, p = W(
2204
+ ).length > 0, a = e.errors.billingAddress, n = a && typeof a == "object" ? Object.keys(a).length > 0 : !1, r = e.errors.shippingAddress, o = r && typeof r == "object" ? Object.keys(r).length > 0 : !1, d = s || n || o, p = W(
2166
2205
  t.checkoutProfile?.layout
2167
- ) ? !!(e.formData.billingAddress?.firstName || e.formData.billingAddress?.lastName || e.formData.shippingAddress?.firstName || e.formData.shippingAddress?.lastName) : !!e.formData.name, o = t.checkoutProfile?.layout.phoneNumber?.enabled ?? !1 ? !!e.formData.phoneNumber : !0, { billingFields: g, shippingFields: m } = t.checkoutProfile?.layout ?? {}, u = (y, v) => !y || Object.entries(y).every(
2206
+ ) ? !!(e.formData.billingAddress?.firstName || e.formData.billingAddress?.lastName || e.formData.shippingAddress?.firstName || e.formData.shippingAddress?.lastName) : !!e.formData.name, l = t.checkoutProfile?.layout.phoneNumber?.enabled ?? !1 ? !!e.formData.phoneNumber : !0, { billingFields: g, shippingFields: m } = t.checkoutProfile?.layout ?? {}, u = (y, v) => !y || Object.entries(y).every(
2168
2207
  ([S, M]) => !M?.enabled || !!v?.[S]?.trim()
2169
2208
  ), f = !this.isVgsMode || Object.values(this.vgsFieldsState).every(
2170
2209
  (y) => y?.isValid === !0
2171
- ), h = this.isVgsMode ? !!e.formData.email && o && f && u(g, e.formData.billingAddress) && u(m, e.formData.shippingAddress) : !!e.formData.email && o && p && !!e.formData.cardNumber && !!e.formData.cardCvv && !!e.formData.cardExpiry && u(g, e.formData.billingAddress) && u(m, e.formData.shippingAddress);
2210
+ ), h = this.isVgsMode ? !!e.formData.email && l && f && u(g, e.formData.billingAddress) && u(m, e.formData.shippingAddress) : !!e.formData.email && l && p && !!e.formData.cardNumber && !!e.formData.cardCvv && !!e.formData.cardExpiry && u(g, e.formData.billingAddress) && u(m, e.formData.shippingAddress);
2172
2211
  return d || !h || this.isSubmitting;
2173
2212
  }
2174
2213
  setSubmitting(e) {
@@ -2199,7 +2238,7 @@ class Et {
2199
2238
  this.fontCleanup && (this.fontCleanup(), this.fontCleanup = void 0);
2200
2239
  }
2201
2240
  }
2202
- class Ct extends P {
2241
+ class Ft extends P {
2203
2242
  titleElement;
2204
2243
  constructor(e = {}) {
2205
2244
  super("div", ["blur-bg"]);
@@ -2227,7 +2266,7 @@ const oe = {
2227
2266
  }
2228
2267
  }), t;
2229
2268
  };
2230
- class Ft {
2269
+ class Mt {
2231
2270
  formElement;
2232
2271
  componentManager;
2233
2272
  onLoadingStateChange;
@@ -2278,7 +2317,7 @@ class Ft {
2278
2317
  e ? (this.hideSkeleton(), this.formSkeleton = new he(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
2279
2318
  }
2280
2319
  showSpinner(e) {
2281
- this.hideSpinner(), this.spinner = new Ct({ text: e }), this.formElement.appendChild(this.spinner.getElement());
2320
+ this.hideSpinner(), this.spinner = new Ft({ text: e }), this.formElement.appendChild(this.spinner.getElement());
2282
2321
  }
2283
2322
  hideSpinner() {
2284
2323
  this.spinner && (this.spinner.getElement().remove(), this.spinner = void 0);
@@ -2309,7 +2348,7 @@ const D = (i) => ({
2309
2348
  country: "",
2310
2349
  ...i
2311
2350
  });
2312
- class Mt extends P {
2351
+ class Nt extends P {
2313
2352
  options;
2314
2353
  formManager = lt();
2315
2354
  checkoutProfile;
@@ -2327,7 +2366,7 @@ class Mt extends P {
2327
2366
  constructor(e) {
2328
2367
  super("form", ["form-container"]), this.options = e, this.vgsJwt = e.vgsJwt, this.vgsJwt && (this.vgsService = new I()), this.checkoutProfile = ot({
2329
2368
  appearance: e.appearance
2330
- }), e.locale && this.translation.setLocale(e.locale), this.componentManager = new vt({
2369
+ }), e.locale && this.translation.setLocale(e.locale), this.componentManager = new St({
2331
2370
  formElement: this.element,
2332
2371
  focusManager: this.focusManager,
2333
2372
  translationFunc: this.translation.t,
@@ -2344,11 +2383,11 @@ class Mt extends P {
2344
2383
  environment: e.environment,
2345
2384
  vgsService: this.vgsService,
2346
2385
  onVgsStateChange: (t) => this.handleVgsStateChange(t)
2347
- }), this.uiManager = new Ft({
2386
+ }), this.uiManager = new Mt({
2348
2387
  formElement: this.element,
2349
2388
  componentManager: this.componentManager,
2350
2389
  onLoadingStateChange: e.onLoadingStateChange
2351
- }), this.stateCoordinator = new Et({
2390
+ }), this.stateCoordinator = new Ct({
2352
2391
  formManager: this.formManager,
2353
2392
  checkoutProfile: this.checkoutProfile,
2354
2393
  componentManager: this.componentManager,
@@ -2358,7 +2397,7 @@ class Mt extends P {
2358
2397
  onError: (t) => this.uiManager.setErrorMessage(t),
2359
2398
  onLoadingChange: (t) => this.uiManager.setLoadingState(t),
2360
2399
  getInitialFormData: () => this._getFormStateData().formData
2361
- }), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new St({
2400
+ }), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new Et({
2362
2401
  formManager: this.formManager,
2363
2402
  focusManager: this.focusManager,
2364
2403
  onFormSubmit: async () => this.handleSubmit(),
@@ -2431,12 +2470,15 @@ class Mt extends P {
2431
2470
  this.uiManager.setErrorMessage("Failed to load checkout configuration");
2432
2471
  return;
2433
2472
  }
2434
- this.componentManager.hasComponents() && this.componentManager.cleanup(), e.checkoutProfile.layout.phoneNumber?.enabled && this.formManager.getFormState().formData.phoneNumber === void 0 && this.formManager.setFormData({ phoneNumber: "" }), e.checkoutProfile.layout.billingFields && this.formManager.getFormState().formData.billingAddress === void 0 && this.formManager.setFormData({
2473
+ this.componentManager.hasComponents() && this.componentManager.cleanup(), e.checkoutProfile.layout.phoneNumber?.enabled && this.formManager.getFormState().formData.phoneNumber === void 0 && this.formManager.setFormData({
2474
+ phoneNumber: "",
2475
+ phoneCountryCode: e.checkoutProfile.layout.phoneNumber.defaultCountry?.toUpperCase() || "US"
2476
+ }), e.checkoutProfile.layout.billingFields && this.formManager.getFormState().formData.billingAddress === void 0 && this.formManager.setFormData({
2435
2477
  billingAddress: D()
2436
2478
  }), e.checkoutProfile.layout.shippingFields && this.formManager.getFormState().formData.shippingAddress === void 0 && this.formManager.setFormData({
2437
2479
  shippingAddress: D()
2438
2480
  });
2439
- const { formData: t, errors: s, touched: a } = this._getFormStateData(), n = W(
2481
+ const { formData: t, errors: s, touched: a } = this._getFormStateData(), n = mt(
2440
2482
  e.checkoutProfile.layout
2441
2483
  );
2442
2484
  try {
@@ -2444,8 +2486,8 @@ class Mt extends P {
2444
2486
  e.checkoutProfile,
2445
2487
  t
2446
2488
  );
2447
- } catch (r) {
2448
- console.error("Failed to create payment methods:", r);
2489
+ } catch (o) {
2490
+ console.error("Failed to create payment methods:", o);
2449
2491
  }
2450
2492
  try {
2451
2493
  this.componentManager.createEmailField(
@@ -2454,8 +2496,8 @@ class Mt extends P {
2454
2496
  s,
2455
2497
  a
2456
2498
  );
2457
- } catch (r) {
2458
- console.error("Failed to create email field:", r);
2499
+ } catch (o) {
2500
+ console.error("Failed to create email field:", o);
2459
2501
  }
2460
2502
  if (n) {
2461
2503
  try {
@@ -2465,8 +2507,8 @@ class Mt extends P {
2465
2507
  s,
2466
2508
  a
2467
2509
  );
2468
- } catch (r) {
2469
- console.error("Failed to create billing address section:", r);
2510
+ } catch (o) {
2511
+ console.error("Failed to create billing address section:", o);
2470
2512
  }
2471
2513
  try {
2472
2514
  this.componentManager.createShippingAddressSection(
@@ -2475,8 +2517,8 @@ class Mt extends P {
2475
2517
  s,
2476
2518
  a
2477
2519
  );
2478
- } catch (r) {
2479
- console.error("Failed to create shipping address section:", r);
2520
+ } catch (o) {
2521
+ console.error("Failed to create shipping address section:", o);
2480
2522
  }
2481
2523
  }
2482
2524
  if (e.checkoutProfile.layout.phoneNumber?.enabled)
@@ -2487,8 +2529,8 @@ class Mt extends P {
2487
2529
  s,
2488
2530
  a
2489
2531
  );
2490
- } catch (r) {
2491
- console.error("Failed to create phone number field:", r);
2532
+ } catch (o) {
2533
+ console.error("Failed to create phone number field:", o);
2492
2534
  }
2493
2535
  try {
2494
2536
  this.componentManager.createCardSection(
@@ -2497,10 +2539,12 @@ class Mt extends P {
2497
2539
  s,
2498
2540
  a
2499
2541
  );
2500
- } catch (r) {
2501
- console.error("Failed to create card section:", r);
2542
+ } catch (o) {
2543
+ console.error("Failed to create card section:", o);
2502
2544
  }
2503
- if (!n)
2545
+ if (!W(
2546
+ e.checkoutProfile.layout
2547
+ ))
2504
2548
  try {
2505
2549
  this.componentManager.createCardholderSection(
2506
2550
  e.checkoutProfile,
@@ -2508,19 +2552,19 @@ class Mt extends P {
2508
2552
  s,
2509
2553
  a
2510
2554
  );
2511
- } catch (r) {
2512
- console.error("Failed to create cardholder section:", r);
2555
+ } catch (o) {
2556
+ console.error("Failed to create cardholder section:", o);
2513
2557
  }
2514
- this.vgsService && this.componentManager.mountVgsFields(e.checkoutProfile).catch((r) => {
2515
- console.error("Failed to mount VGS fields:", r);
2558
+ this.vgsService && this.componentManager.mountVgsFields(e.checkoutProfile).catch((o) => {
2559
+ console.error("Failed to mount VGS fields:", o);
2516
2560
  });
2517
2561
  try {
2518
2562
  this.componentManager.createSubmitButton(
2519
2563
  e.checkoutProfile,
2520
2564
  this.stateCoordinator.isFormDisabled()
2521
2565
  );
2522
- } catch (r) {
2523
- console.error("Failed to create submit button:", r);
2566
+ } catch (o) {
2567
+ console.error("Failed to create submit button:", o);
2524
2568
  }
2525
2569
  }
2526
2570
  updateFormUI() {
@@ -2541,8 +2585,8 @@ class Mt extends P {
2541
2585
  )) return;
2542
2586
  const { formData: s } = this._getFormStateData(), a = s.billingAddress ?? s.shippingAddress;
2543
2587
  if (!a) return;
2544
- const n = a.firstName?.trim() ?? "", r = a.lastName?.trim() ?? "", l = [n, r].filter(Boolean).join(" ");
2545
- l && this.formManager.setFormData({ name: l });
2588
+ const n = a.firstName?.trim() ?? "", r = a.lastName?.trim() ?? "", o = [n, r].filter(Boolean).join(" ");
2589
+ o && this.formManager.setFormData({ name: o });
2546
2590
  }
2547
2591
  /**
2548
2592
  * Infers address data based on field configuration.
@@ -2552,7 +2596,7 @@ class Mt extends P {
2552
2596
  inferAddresses() {
2553
2597
  const e = this.checkoutProfile.getState();
2554
2598
  if (!e.checkoutProfile) return;
2555
- const { billingFields: t, shippingFields: s } = e.checkoutProfile.layout, a = t && Object.values(t).some((l) => l?.enabled), n = s && Object.values(s).some((l) => l?.enabled), { formData: r } = this._getFormStateData();
2599
+ const { billingFields: t, shippingFields: s } = e.checkoutProfile.layout, a = t && Object.values(t).some((o) => o?.enabled), n = s && Object.values(s).some((o) => o?.enabled), { formData: r } = this._getFormStateData();
2556
2600
  !a && n && r.shippingAddress ? this.formManager.setFormData({
2557
2601
  billingAddress: { ...r.shippingAddress }
2558
2602
  }) : !n && a && r.billingAddress && this.formManager.setFormData({
@@ -2644,13 +2688,13 @@ class Mt extends P {
2644
2688
  ), this.componentManager.cleanup(), this.uiManager.cleanup(), this.getElement().remove();
2645
2689
  }
2646
2690
  associatePayment(e, t, s, a, n) {
2647
- this.options.paymentId = e, this.options.checkoutKey = t, this.options.supportedPaymentMethods = s, this.options.checkoutDetails = a, this.componentManager.setCheckoutDetailsLoaded(!0), n && !this.vgsService && (this.vgsJwt = n, this.vgsService = new I(), this.componentManager.setVgsService(this.vgsService), this.stateCoordinator.setVgsMode(!0), this.vgsService.init(this.options.environment).then((l) => {
2691
+ this.options.paymentId = e, this.options.checkoutKey = t, this.options.supportedPaymentMethods = s, this.options.checkoutDetails = a, this.componentManager.setCheckoutDetailsLoaded(!0), n && !this.vgsService && (this.vgsJwt = n, this.vgsService = new I(), this.componentManager.setVgsService(this.vgsService), this.stateCoordinator.setVgsMode(!0), this.vgsService.init(this.options.environment).then((o) => {
2648
2692
  this.vgsService?.createForm(
2649
- l,
2693
+ o,
2650
2694
  (d) => this.handleVgsStateChange(d)
2651
2695
  ), this.renderFormComponents();
2652
- }).catch((l) => {
2653
- console.error("Failed to load VGS Collect:", l), this.vgsService = void 0, this.vgsJwt = void 0, this.renderFormComponents();
2696
+ }).catch((o) => {
2697
+ console.error("Failed to load VGS Collect:", o), this.vgsService = void 0, this.vgsJwt = void 0, this.renderFormComponents();
2654
2698
  })), this.componentManager.removePaymentMethods(), this.componentManager.updateSupportedPaymentMethods(
2655
2699
  s
2656
2700
  ), this.componentManager.updatePaymentDetails(
@@ -2660,16 +2704,16 @@ class Mt extends P {
2660
2704
  ), !n && this.checkoutProfile.getState().checkoutProfile && this.renderFormComponents();
2661
2705
  const r = this.checkoutProfile.getState();
2662
2706
  if (r.checkoutProfile) {
2663
- const { formData: l } = this._getFormStateData();
2707
+ const { formData: o } = this._getFormStateData();
2664
2708
  this.componentManager.createPaymentMethods(
2665
2709
  r.checkoutProfile,
2666
- l,
2710
+ o,
2667
2711
  !0
2668
2712
  );
2669
2713
  }
2670
2714
  }
2671
2715
  }
2672
- class Nt {
2716
+ class wt {
2673
2717
  container = null;
2674
2718
  options;
2675
2719
  onSubmit;
@@ -2693,7 +2737,7 @@ class Nt {
2693
2737
  }
2694
2738
  }
2695
2739
  renderForm(e) {
2696
- this.container && (this.form && (this.form.destroy(), this.form = null), this.form = new Mt({
2740
+ this.container && (this.form && (this.form.destroy(), this.form = null), this.form = new Nt({
2697
2741
  apiKey: this.options.apiKey,
2698
2742
  onSubmit: this.onSubmit,
2699
2743
  locale: this.options.locale,
@@ -2730,7 +2774,7 @@ class Nt {
2730
2774
  );
2731
2775
  }
2732
2776
  }
2733
- class wt {
2777
+ class Pt {
2734
2778
  state;
2735
2779
  listeners = /* @__PURE__ */ new Set();
2736
2780
  constructor(e) {
@@ -2752,8 +2796,8 @@ class wt {
2752
2796
  this.listeners.forEach((t) => t(e));
2753
2797
  }
2754
2798
  }
2755
- const Pt = "en";
2756
- class kt {
2799
+ const kt = "en";
2800
+ class At {
2757
2801
  config;
2758
2802
  paymentState;
2759
2803
  apiService;
@@ -2769,10 +2813,10 @@ class kt {
2769
2813
  }), this.apiService = new Ae(
2770
2814
  this.config.apiKey,
2771
2815
  this.config.environment
2772
- ), this.stateManager = new wt({
2816
+ ), this.stateManager = new Pt({
2773
2817
  mounted: !1,
2774
2818
  form: null
2775
- }), this.formManager = new Nt(
2819
+ }), this.formManager = new wt(
2776
2820
  {
2777
2821
  locale: this.config.locale,
2778
2822
  apiKey: this.config.apiKey,
@@ -2794,7 +2838,7 @@ class kt {
2794
2838
  apiKey: e.apiKey,
2795
2839
  returnUrl: e.returnUrl,
2796
2840
  environment: e.environment,
2797
- locale: e.locale || Pt,
2841
+ locale: e.locale || kt,
2798
2842
  disableErrorMessages: e.disableErrorMessages ?? !1,
2799
2843
  manualActionHandling: e.manualActionHandling ?? !1,
2800
2844
  appearance: e.appearance,
@@ -2980,19 +3024,19 @@ class kt {
2980
3024
  }
2981
3025
  }
2982
3026
  }
2983
- typeof globalThis < "u" && (globalThis.OdusCheckout = kt);
3027
+ typeof globalThis < "u" && (globalThis.OdusCheckout = At);
2984
3028
  export {
2985
- kt as OdusCheckout,
3029
+ At as OdusCheckout,
2986
3030
  Tt as deLocale,
2987
- Lt as enLocale,
2988
- Vt as esLocale,
2989
- _t as frLocale,
2990
- Bt as itLocale,
2991
- Ot as plLocale,
2992
- Rt as ptLocale,
3031
+ Vt as enLocale,
3032
+ _t as esLocale,
3033
+ Bt as frLocale,
3034
+ Ot as itLocale,
3035
+ Rt as plLocale,
3036
+ Ut as ptLocale,
2993
3037
  rt as pushError,
2994
3038
  F as pushEvent,
2995
- Dt as pushLog,
3039
+ It as pushLog,
2996
3040
  ne as pushMeasurement,
2997
- Ut as trLocale
3041
+ Ht as trLocale
2998
3042
  };