@odus/checkout 1.10.2 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkout.es.js +171 -171
- package/dist/components/checkout/form/AddressSection.d.ts.map +1 -1
- package/dist/components/checkout/form/FormStateCoordinator.d.ts.map +1 -1
- package/dist/elements/AddressStateElement.d.ts.map +1 -1
- package/dist/elements/OdusElements.d.ts.map +1 -1
- package/dist/elements.es.js +248 -253
- package/dist/phone.js +44 -44
- package/dist/services/checkout/Checkout.service.d.ts.map +1 -1
- package/dist/shared.js +744 -699
- package/dist/utils/dom/index.d.ts +1 -0
- package/dist/utils/dom/index.d.ts.map +1 -1
- package/dist/utils/dom/preconnectOrigins.d.ts +12 -0
- package/dist/utils/dom/preconnectOrigins.d.ts.map +1 -0
- package/dist/utils/state/stateNames.d.ts +29 -6
- package/dist/utils/state/stateNames.d.ts.map +1 -1
- package/dist/utils/validation/createValidationSchema.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/phone.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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) => {
|
|
@@ -7881,7 +7881,7 @@ var ne = "1.2.0", re = "1.7.35", ie = " ext. ", y = /*#__PURE__*/ function() {
|
|
|
7881
7881
|
{
|
|
7882
7882
|
key: "usesNationalPrefix",
|
|
7883
7883
|
value: function() {
|
|
7884
|
-
return
|
|
7884
|
+
return !(!this.nationalPrefixFormattingRule() || se.test(this.nationalPrefixFormattingRule()));
|
|
7885
7885
|
}
|
|
7886
7886
|
},
|
|
7887
7887
|
{
|
|
@@ -8072,7 +8072,7 @@ var Te = [
|
|
|
8072
8072
|
"VOICEMAIL"
|
|
8073
8073
|
];
|
|
8074
8074
|
function S(e, t, n) {
|
|
8075
|
-
if (t ||= {},
|
|
8075
|
+
if (t ||= {}, e.country || e.countryCallingCode) {
|
|
8076
8076
|
var r = new y(n);
|
|
8077
8077
|
r.selectNumberingPlan(e.country || e.countryCallingCode);
|
|
8078
8078
|
var i = t.v2 ? e.nationalNumber : e.phone;
|
|
@@ -10374,7 +10374,7 @@ var _i = /*#__PURE__*/ function() {
|
|
|
10374
10374
|
var e = this.state, t = e.nationalSignificantNumber, n = e.carrierCode, r = e.callingCode;
|
|
10375
10375
|
if (t) {
|
|
10376
10376
|
var i = this._getCountry();
|
|
10377
|
-
if (
|
|
10377
|
+
if (i || r) {
|
|
10378
10378
|
if (i && i === this.defaultCountry) {
|
|
10379
10379
|
var a = vi(this.metadata.numberingPlan.callingCode(), t, this.metadata);
|
|
10380
10380
|
a && (i = a);
|
|
@@ -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 = (
|
|
10469
|
-
let
|
|
10470
|
-
return (
|
|
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:
|
|
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,
|
|
10482
|
+
}).filter((e) => e !== null).sort((e, t) => e.name.localeCompare(t.name, r));
|
|
10483
10483
|
}, Ci = (e) => {
|
|
10484
10484
|
try {
|
|
10485
|
-
let
|
|
10485
|
+
let n = e.toUpperCase(), r = bi(n);
|
|
10486
10486
|
return {
|
|
10487
|
-
code:
|
|
10488
|
-
name:
|
|
10489
|
-
dialCode: `+${
|
|
10490
|
-
flag: X(
|
|
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
|
|
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(
|
|
10791
|
+
constructor(e) {
|
|
10792
10792
|
super("div", ["country-select-wrapper"]);
|
|
10793
|
-
let { countries:
|
|
10794
|
-
this._locale = i, this._flagDisplay = new
|
|
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(
|
|
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
|
|
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
|
|
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(
|
|
10835
|
+
constructor(e) {
|
|
10836
10836
|
super("div", ["input-wrapper", "phone-number-field-wrapper"]);
|
|
10837
|
-
let { value:
|
|
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 =
|
|
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,
|
|
10843
|
-
this._inputElement = g, _ !==
|
|
10844
|
-
let v = new
|
|
10845
|
-
v.appendChild(this._inputElement), this._containerElement.appendChild(v), this.appendChild(this._containerElement), this._helperText = new
|
|
10846
|
-
text:
|
|
10847
|
-
visible:
|
|
10848
|
-
}), this.appendChild(this._helperText),
|
|
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
|
|
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(
|
|
10859
|
+
this.appendChild(r);
|
|
10860
10860
|
}
|
|
10861
|
-
_buildContainer(
|
|
10862
|
-
let
|
|
10863
|
-
return r.style.borderRadius = `${
|
|
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,
|
|
10882
|
-
let
|
|
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),
|
|
10885
|
+
e && (this._currentCountryCode = e.countryCode, this._countrySelector.setCountry(e.countryCode), r = Z(t, e.countryCode));
|
|
10886
10886
|
}
|
|
10887
|
-
let a =
|
|
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:
|
|
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
|
-
}),
|
|
10901
|
+
}), n && a.addEventListener("keydown", (e) => {
|
|
10902
10902
|
let t = e;
|
|
10903
|
-
t.key === "Tab" && !t.shiftKey && (t.preventDefault(),
|
|
10903
|
+
t.key === "Tab" && !t.shiftKey && (t.preventDefault(), n());
|
|
10904
10904
|
}), {
|
|
10905
10905
|
inputElement: a,
|
|
10906
|
-
initialValue:
|
|
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,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;
|
|
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,KAAK,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAiC7D,cAAM,QAAQ;IACZ,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,WAAW,CAAsB;IACzC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,cAAc;IA2ClC,OAAO,CAAC,cAAc;IA4Bf,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAmDhC,OAAO,IAAI,IAAI;IAwBtB;;;;;;OAMG;YACW,YAAY;IA0E1B;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IA0C7B,OAAO,CAAC,wBAAwB;IAWhC,OAAO,CAAC,gBAAgB;IASjB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IASnC,UAAU,IAAI,IAAI;IASlB,MAAM,CAAC,KAAK,EAAE;QAAE,UAAU,CAAC,EAAE,UAAU,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAmB3D,gBAAgB,CAC3B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,IAAI,CAAC;IAuFT,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,iBAAiB,CAAC,GAAG,IAAI;CAGjE;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|