@odus/checkout 1.10.2 → 1.11.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.
package/dist/phone.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as e, h as t, m as n, p as r, v as i, y as a } from "./shared.js";
1
+ import { V as e, _ as t, b as n, h as r, m as i, p as a } from "./shared.js";
2
2
  import { t as o } from "./shared2.js";
3
3
  //#region libs/checkout/src/utils/dom/restoreCursorAfterFormat.util.ts
4
4
  var s = (e, t, n) => {
@@ -10465,29 +10465,29 @@ function xi() {
10465
10465
  var X = (e) => {
10466
10466
  let t = e.toUpperCase().split("").map((e) => 127397 + e.charCodeAt(0));
10467
10467
  return String.fromCodePoint(...t);
10468
- }, Si = (e, t) => {
10469
- let n = Object.values(a);
10470
- return (e?.length ? n.filter((t) => e.includes(t.toUpperCase())) : n).map((e) => {
10468
+ }, Si = (n, r) => {
10469
+ let i = Object.values(e);
10470
+ return (n?.length ? i.filter((e) => n.includes(e.toUpperCase())) : i).map((e) => {
10471
10471
  try {
10472
10472
  let n = bi(e);
10473
10473
  return {
10474
10474
  code: e.toUpperCase(),
10475
- name: i(e, t),
10475
+ name: t(e, r),
10476
10476
  dialCode: `+${n}`,
10477
10477
  flag: X(e)
10478
10478
  };
10479
10479
  } catch {
10480
10480
  return null;
10481
10481
  }
10482
- }).filter((e) => e !== null).sort((e, n) => e.name.localeCompare(n.name, t));
10482
+ }).filter((e) => e !== null).sort((e, t) => e.name.localeCompare(t.name, r));
10483
10483
  }, Ci = (e) => {
10484
10484
  try {
10485
- let t = e.toUpperCase(), n = bi(t);
10485
+ let n = e.toUpperCase(), r = bi(n);
10486
10486
  return {
10487
- code: t,
10488
- name: i(t),
10489
- dialCode: `+${n}`,
10490
- flag: X(t)
10487
+ code: n,
10488
+ name: t(n),
10489
+ dialCode: `+${r}`,
10490
+ flag: X(n)
10491
10491
  };
10492
10492
  } catch {
10493
10493
  return null;
@@ -10784,19 +10784,19 @@ var X = (e) => {
10784
10784
  } catch {
10785
10785
  return Infinity;
10786
10786
  }
10787
- }, Oi = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"none\" aria-hidden=\"true\"><path d=\"M2 3.5L5 6.5L8 3.5\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>", ki = class extends e {
10787
+ }, Oi = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"none\" aria-hidden=\"true\"><path d=\"M2 3.5L5 6.5L8 3.5\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/></svg>", ki = class extends n {
10788
10788
  _flagDisplay;
10789
10789
  _selectElement;
10790
10790
  _locale;
10791
- constructor(t) {
10791
+ constructor(e) {
10792
10792
  super("div", ["country-select-wrapper"]);
10793
- let { countries: n, selectedCode: r, locale: i, styles: a, ariaLabel: o, onChange: s } = t;
10794
- this._locale = i, this._flagDisplay = new e("span", ["country-flag"]), this._flagDisplay.setText(X(r)), this._selectElement = new e("select", ["country-select"]), this._selectElement.setAttribute("aria-label", o);
10793
+ let { countries: t, selectedCode: r, locale: i, styles: a, ariaLabel: o, onChange: s } = e;
10794
+ this._locale = i, this._flagDisplay = new n("span", ["country-flag"]), this._flagDisplay.setText(X(r)), this._selectElement = new n("select", ["country-select"]), this._selectElement.setAttribute("aria-label", o);
10795
10795
  let c = this._selectElement.getElement();
10796
- c.style.fontFamily = `"${a.fontFamily}", sans-serif`, c.style.color = a.textColor, c.style.fontSize = `${a.fontSize}px`, this._buildOptions(n, r), this._selectElement.addEventListener("change", (e) => {
10796
+ c.style.fontFamily = `"${a.fontFamily}", sans-serif`, c.style.color = a.textColor, c.style.fontSize = `${a.fontSize}px`, this._buildOptions(t, r), this._selectElement.addEventListener("change", (e) => {
10797
10797
  s(e.target.value);
10798
10798
  });
10799
- let l = new e("span", ["country-chevron"]);
10799
+ let l = new n("span", ["country-chevron"]);
10800
10800
  l.getElement().innerHTML = Oi, this.appendChild(this._flagDisplay), this.appendChild(l), this.appendChild(this._selectElement);
10801
10801
  }
10802
10802
  setCountry(e) {
@@ -10820,7 +10820,7 @@ var X = (e) => {
10820
10820
  }), n.appendChild(i);
10821
10821
  });
10822
10822
  }
10823
- }, Ai = class extends e {
10823
+ }, Ai = class extends n {
10824
10824
  _countrySelector;
10825
10825
  _inputElement;
10826
10826
  _countryCodeInput;
@@ -10832,23 +10832,23 @@ var X = (e) => {
10832
10832
  _onBlur;
10833
10833
  _translationFunc;
10834
10834
  _customPlaceholder;
10835
- constructor(r) {
10835
+ constructor(e) {
10836
10836
  super("div", ["input-wrapper", "phone-number-field-wrapper"]);
10837
- let { value: i, onChange: a, onBlur: o, onTab: s, checkoutProfile: c, translationFunc: l, defaultCountry: u, allowedCountries: d, locale: f, label: p, placeholder: m } = r;
10838
- this._onChange = a, this._onBlur = o, this._translationFunc = l, this._customPlaceholder = m, this._currentCountryCode = u?.toUpperCase() || "US", this._buildLabel(c, l, p), this._containerElement = this._buildContainer(c), this._countrySelector = this._buildCountrySelector(d, f, c, l), this._containerElement.appendChild(this._countrySelector), this._countryCodeInput = n.createInput("hidden", [], {
10837
+ let { value: t, onChange: a, onBlur: o, onTab: s, checkoutProfile: c, translationFunc: l, defaultCountry: u, allowedCountries: d, locale: f, label: p, placeholder: m } = e;
10838
+ this._onChange = a, this._onBlur = o, this._translationFunc = l, this._customPlaceholder = m, this._currentCountryCode = u?.toUpperCase() || "US", this._buildLabel(c, l, p), this._containerElement = this._buildContainer(c), this._countrySelector = this._buildCountrySelector(d, f, c, l), this._containerElement.appendChild(this._countrySelector), this._countryCodeInput = i.createInput("hidden", [], {
10839
10839
  name: "phoneCountryCode",
10840
10840
  value: this._currentCountryCode
10841
10841
  }), this.appendChild(this._countryCodeInput);
10842
- let h = this._currentCountryCode, { inputElement: g, initialValue: _ } = this._buildInput(c, i, s);
10843
- this._inputElement = g, _ !== i && (this._inputElement.getElement().value = _), this._currentCountryCode !== h && this._syncCountryCodeInput(this._currentCountryCode);
10844
- let v = new e("div", ["phone-input-wrapper"]);
10845
- v.appendChild(this._inputElement), this._containerElement.appendChild(v), this.appendChild(this._containerElement), this._helperText = new t({
10846
- text: r.errorMsg || "",
10847
- visible: r.error
10848
- }), this.appendChild(this._helperText), r.error && this._containerElement.addClass("error");
10842
+ let h = this._currentCountryCode, { inputElement: g, initialValue: _ } = this._buildInput(c, t, s);
10843
+ this._inputElement = g, _ !== t && (this._inputElement.getElement().value = _), this._currentCountryCode !== h && this._syncCountryCodeInput(this._currentCountryCode);
10844
+ let v = new n("div", ["phone-input-wrapper"]);
10845
+ v.appendChild(this._inputElement), this._containerElement.appendChild(v), this.appendChild(this._containerElement), this._helperText = new r({
10846
+ text: e.errorMsg || "",
10847
+ visible: e.error
10848
+ }), this.appendChild(this._helperText), e.error && this._containerElement.addClass("error");
10849
10849
  }
10850
10850
  _buildLabel(e, t, n) {
10851
- let i = new r({
10851
+ let r = new a({
10852
10852
  styles: {
10853
10853
  color: e.styles.textColor,
10854
10854
  fontSize: e.styles.fontSize
@@ -10856,11 +10856,11 @@ var X = (e) => {
10856
10856
  label: n ?? t("phoneNumber"),
10857
10857
  id: "phoneNumber"
10858
10858
  });
10859
- this.appendChild(i);
10859
+ this.appendChild(r);
10860
10860
  }
10861
- _buildContainer(t) {
10862
- let n = new e("div", ["phone-number-field-container"]), r = n.getElement();
10863
- return r.style.borderRadius = `${t.styles.borderRadius}px`, r.style.setProperty("--phone-border-radius", `${t.styles.borderRadius}px`), n;
10861
+ _buildContainer(e) {
10862
+ let t = new n("div", ["phone-number-field-container"]), r = t.getElement();
10863
+ return r.style.borderRadius = `${e.styles.borderRadius}px`, r.style.setProperty("--phone-border-radius", `${e.styles.borderRadius}px`), t;
10864
10864
  }
10865
10865
  _buildCountrySelector(e, t, n, r) {
10866
10866
  return new ki({
@@ -10878,17 +10878,17 @@ var X = (e) => {
10878
10878
  }
10879
10879
  });
10880
10880
  }
10881
- _buildInput(e, t, r) {
10882
- let i = t;
10881
+ _buildInput(e, t, n) {
10882
+ let r = t;
10883
10883
  if (t && t.startsWith("+")) {
10884
10884
  let e = Q(t);
10885
- e && (this._currentCountryCode = e.countryCode, this._countrySelector.setCountry(e.countryCode), i = Z(t, e.countryCode));
10885
+ e && (this._currentCountryCode = e.countryCode, this._countrySelector.setCountry(e.countryCode), r = Z(t, e.countryCode));
10886
10886
  }
10887
- let a = n.createInput("tel", ["form-input"], {
10887
+ let a = i.createInput("tel", ["form-input"], {
10888
10888
  id: "phoneNumber",
10889
10889
  name: "phoneNumber",
10890
10890
  placeholder: this._customPlaceholder ?? $(this._currentCountryCode),
10891
- value: i,
10891
+ value: r,
10892
10892
  autocomplete: "tel",
10893
10893
  maxlength: "30"
10894
10894
  }), o = a.getElement();
@@ -10898,12 +10898,12 @@ var X = (e) => {
10898
10898
  this._containerElement.addClass("focused");
10899
10899
  }), a.addEventListener("blur", (e) => {
10900
10900
  this._containerElement.removeClass("focused"), this._validateInput(this._inputElement.getElement().value, !0), this._onBlur(e);
10901
- }), r && a.addEventListener("keydown", (e) => {
10901
+ }), n && a.addEventListener("keydown", (e) => {
10902
10902
  let t = e;
10903
- t.key === "Tab" && !t.shiftKey && (t.preventDefault(), r());
10903
+ t.key === "Tab" && !t.shiftKey && (t.preventDefault(), n());
10904
10904
  }), {
10905
10905
  inputElement: a,
10906
- initialValue: i
10906
+ initialValue: r
10907
10907
  };
10908
10908
  }
10909
10909
  _handleInput(e) {
@@ -1 +1 @@
1
- {"version":3,"file":"Checkout.service.d.ts","sourceRoot":"","sources":["../../../src/services/checkout/Checkout.service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACf,MAAM,0CAA0C,CAAC;AAElD,OAAO,KA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