@odus/checkout 0.29.0 → 0.29.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 +767 -682
- package/dist/elements.es.js +12 -21
- package/dist/package.json +1 -1
- package/dist/phone.js +47 -37
- package/dist/shared.js +153 -156
- package/package.json +1 -1
package/dist/elements.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { k as a, I as m, S as y, g as C, b as g, A as E, F as k, h as z, a as c, f as N, J as
|
|
1
|
+
import { k as a, I as m, S as y, g as C, b as g, A as E, F as k, h as z, a as c, f as N, J as P, E as S, j as x, P as F, l as R, w as A, m as V, n as M, i as B } from "./shared.js";
|
|
2
2
|
const l = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family, inherit);font-size:12px;font-weight:500;margin-top:4px;display:block;overflow:hidden;max-height:100px;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,margin .3s ease-in-out}.form-helper-text-hidden{max-height:0;opacity:0;margin-top:0;overflow:hidden}", h = ".input-wrapper{display:flex;flex-direction:column;width:100%;min-width:0;box-sizing:border-box;align-items:stretch}.input-wrapper *{box-sizing:border-box}.form-input{opacity:1;font-size:var(--odus-input-font-size, 16px);font-weight:var(--odus-input-font-weight, 400);letter-spacing:var(--odus-input-letter-spacing, .02em);transition:box-shadow .1s ease-in,border-radius .2s ease-in;box-shadow:0 0 0 1px var(--odus-border-color, #e0e0e0),0 2px 4px #00000012,0 1px 1.5px #0000000d;background:var(--odus-color-background, #fff);padding:var(--odus-input-padding, 8px 12px);border:none;outline:none;line-height:var(--odus-input-line-height, 1.5);z-index:0;box-sizing:border-box;min-height:0;flex:1;width:100%}.form-input[name=cardNumber]{padding-right:100px}.form-input-error{color:#dc2727}.form-input::placeholder{color:var(--odus-input-placeholder-color, #717173);opacity:var(--odus-input-placeholder-opacity, .3)}.form-input:focus{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d;position:relative;z-index:2}", u = ".input-label{font-family:var(--odus-font-family, inherit);font-size:var(--odus-label-font-size, 14px);font-weight:var(--odus-label-font-weight, 400);color:var(--odus-label-color, var(--odus-color-text, #1a1a1a));letter-spacing:var(--odus-label-letter-spacing, normal);line-height:var(--odus-label-line-height, 1.4);margin-bottom:var(--odus-label-margin-bottom, 6px)}", I = ":host{--odus-font-family: system-ui, sans-serif;--odus-font-size: 16px;--odus-color-error: #dc2727;--odus-color-text: #1a1a1a;--odus-color-background: #ffffff;--odus-border-color: #e0e0e0;--odus-border-radius: 6px;--odus-spacing-sm: 8px;--odus-spacing-md: 16px;--odus-spacing-lg: 24px;--odus-input-height: 44px;--odus-input-padding: 8px 12px;--odus-input-font-size: var(--odus-font-size);--odus-input-font-weight: 400;--odus-input-letter-spacing: .02em;--odus-input-line-height: 1.5;--odus-input-placeholder-color: #717173;--odus-input-placeholder-opacity: .3;--odus-input-focus-shadow: 0 0 0 1px rgba(50, 151, 211, .7), 0 1px 1px 0 rgba(0, 0, 0, .07), 0 0 0 4px rgba(50, 151, 211, .3);--odus-label-font-size: 14px;--odus-label-font-weight: 400;--odus-label-color: var(--odus-color-text);--odus-label-letter-spacing: normal;--odus-label-line-height: 1.4;--odus-label-margin-bottom: 6px;--odus-card-gap: 12px;--odus-button-height: 48px;--odus-button-border-radius: var(--odus-border-radius)}.form-input{opacity:1;font-weight:var(--odus-input-font-weight, 400);letter-spacing:var(--odus-input-letter-spacing, .02em);transition:box-shadow .1s ease-in,border-radius .2s ease-in;box-shadow:0 0 0 1px var(--odus-border-color, #e0e0e0),0 2px 4px #00000012,0 1px 1.5px #0000000d;background:var(--odus-color-background, #fff);padding:var(--odus-input-padding, 8px 12px);border:none;outline:none;line-height:var(--odus-input-line-height, 1.5);z-index:0;box-sizing:border-box;min-height:0;flex:1;width:100%}.form-input::placeholder{color:var(--odus-input-placeholder-color, #717173);opacity:var(--odus-input-placeholder-opacity, .3)}.form-input:focus{box-shadow:var( --odus-input-focus-shadow, 0 0 0 1px rgba(50, 151, 211, .7), 0 1px 1px 0 rgba(0, 0, 0, .07), 0 0 0 4px rgba(50, 151, 211, .3) );position:relative;z-index:2}.input-label{font-family:var(--odus-font-family, inherit)!important;font-size:var(--odus-label-font-size, 14px)!important;font-weight:var(--odus-label-font-weight, 400)!important;color:var(--odus-label-color, var(--odus-color-text, #1a1a1a))!important;letter-spacing:var(--odus-label-letter-spacing, normal)!important;line-height:var(--odus-label-line-height, 1.4)!important;margin-bottom:var(--odus-label-margin-bottom, 6px)!important}.form-helper-text{font-family:var(--odus-font-family, inherit)!important}";
|
|
3
3
|
class d {
|
|
4
4
|
shadowRoot = null;
|
|
@@ -336,30 +336,21 @@ class D extends d {
|
|
|
336
336
|
_country = "";
|
|
337
337
|
_input = null;
|
|
338
338
|
_select = null;
|
|
339
|
-
_allowedStates;
|
|
340
|
-
setStates(e) {
|
|
341
|
-
this._allowedStates = e.length > 0 ? e : void 0, this._value && this._allowedStates && !this._allowedStates.includes(this._value) && (this._value = "", this.emit("change", this._value)), this.shadowRoot && this.render();
|
|
342
|
-
}
|
|
343
339
|
setCountry(e) {
|
|
344
340
|
const t = this._country;
|
|
345
341
|
if (this._country = e, !this.shadowRoot) return;
|
|
346
342
|
const r = b.has(t), o = b.has(e);
|
|
347
343
|
if (r && o && t !== e) {
|
|
348
344
|
const { t: s } = a(), i = e, p = s(i === "US" ? "address.chooseState" : "address.chooseProvince");
|
|
349
|
-
this._select?.setOptions(
|
|
350
|
-
g(this._allowedStates, i),
|
|
351
|
-
p
|
|
352
|
-
), this._value = "";
|
|
345
|
+
this._select?.setOptions(g(i), p), this._value = "";
|
|
353
346
|
return;
|
|
354
347
|
}
|
|
355
348
|
r !== o && (this._value = "", this.render());
|
|
356
349
|
}
|
|
357
350
|
render() {
|
|
358
351
|
if (!this.shadowRoot) return;
|
|
359
|
-
this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null
|
|
360
|
-
|
|
361
|
-
if (this._allowedStates || e) {
|
|
362
|
-
const t = e ? this._country : "US";
|
|
352
|
+
if (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, b.has(this._country)) {
|
|
353
|
+
const t = this._country;
|
|
363
354
|
this._renderSelect(t);
|
|
364
355
|
} else
|
|
365
356
|
this._renderInput();
|
|
@@ -381,7 +372,7 @@ class D extends d {
|
|
|
381
372
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
382
373
|
}
|
|
383
374
|
_renderSelect(e) {
|
|
384
|
-
const { t } = a(), r = g(
|
|
375
|
+
const { t } = a(), r = g(e), o = t(e === "US" ? "address.chooseState" : "address.chooseProvince");
|
|
385
376
|
this._select = new y({
|
|
386
377
|
name: "billingAddress.state",
|
|
387
378
|
label: t("address.state"),
|
|
@@ -572,7 +563,7 @@ class Z extends d {
|
|
|
572
563
|
return this._error;
|
|
573
564
|
}
|
|
574
565
|
}
|
|
575
|
-
const K = "apple-pay-button{-webkit-appearance:-apple-pay-button;-apple-pay-button-type:plain;-apple-pay-button-style:black;appearance:-apple-pay-button;height:40px;min-height:40px;border-radius:4px;cursor:pointer;display:inline-block;width:100%;box-sizing:border-box}apple-pay-button:hover{filter:brightness(.9)}",
|
|
566
|
+
const K = "apple-pay-button{-webkit-appearance:-apple-pay-button;-apple-pay-button-type:plain;-apple-pay-button-style:black;appearance:-apple-pay-button;height:40px;min-height:40px;border-radius:4px;cursor:pointer;display:inline-block;width:100%;box-sizing:border-box}apple-pay-button:hover{filter:brightness(.9)}", Q = {
|
|
576
567
|
name: "odus-elements",
|
|
577
568
|
styles: {
|
|
578
569
|
fontSize: 14,
|
|
@@ -597,7 +588,7 @@ const K = "apple-pay-button{-webkit-appearance:-apple-pay-button;-apple-pay-butt
|
|
|
597
588
|
},
|
|
598
589
|
additionalPaymentMethods: {}
|
|
599
590
|
};
|
|
600
|
-
class
|
|
591
|
+
class U extends d {
|
|
601
592
|
_paymentContext = null;
|
|
602
593
|
_applePayData = null;
|
|
603
594
|
_authorized = !1;
|
|
@@ -620,7 +611,7 @@ class Q extends d {
|
|
|
620
611
|
onAuthorize: w
|
|
621
612
|
} = this._paymentContext;
|
|
622
613
|
i?.length && o?.countryCode && !i.map((f) => f.toUpperCase()).includes(o.countryCode.toUpperCase()) || (this._button = new E({
|
|
623
|
-
checkoutProfile:
|
|
614
|
+
checkoutProfile: Q,
|
|
624
615
|
paymentId: e,
|
|
625
616
|
checkoutKey: t,
|
|
626
617
|
environment: r,
|
|
@@ -790,7 +781,7 @@ class Y extends d {
|
|
|
790
781
|
};
|
|
791
782
|
}
|
|
792
783
|
getPayload() {
|
|
793
|
-
const e = this._environment === "live" ? H : J, t = new
|
|
784
|
+
const e = this._environment === "live" ? H : J, t = new P();
|
|
794
785
|
t.setPublicKey(e);
|
|
795
786
|
const r = this._cardNumber.replace(/\s+/g, ""), o = this._cardExpiry.replace(/\s+/g, "").split("/"), s = o[0] ?? "";
|
|
796
787
|
let i = o[1] ?? "";
|
|
@@ -948,7 +939,7 @@ class ee extends d {
|
|
|
948
939
|
if (!this.shadowRoot) return;
|
|
949
940
|
this._field?.getElement().remove(), this.options.initialValue && !this._email && (this._email = String(this.options.initialValue));
|
|
950
941
|
const { t: e } = a();
|
|
951
|
-
this._field = new
|
|
942
|
+
this._field = new S({
|
|
952
943
|
value: this._email,
|
|
953
944
|
error: !1,
|
|
954
945
|
checkoutProfile: $,
|
|
@@ -1259,7 +1250,7 @@ class ue {
|
|
|
1259
1250
|
});
|
|
1260
1251
|
const r = {};
|
|
1261
1252
|
Object.defineProperty(r, "applePay", {
|
|
1262
|
-
get: () => (this._applePay || (this._applePay = new
|
|
1253
|
+
get: () => (this._applePay || (this._applePay = new U(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
|
|
1263
1254
|
paymentId: this._paymentState.paymentId,
|
|
1264
1255
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1265
1256
|
environment: this._config.environment,
|
|
@@ -1489,7 +1480,7 @@ export {
|
|
|
1489
1480
|
D as AddressStateElement,
|
|
1490
1481
|
O as AddressStreetElement,
|
|
1491
1482
|
Z as AddressZipCodeElement,
|
|
1492
|
-
|
|
1483
|
+
U as ApplePayElement,
|
|
1493
1484
|
d as BaseElement,
|
|
1494
1485
|
Y as CardElement,
|
|
1495
1486
|
X as CardholderElement,
|
package/dist/package.json
CHANGED
package/dist/phone.js
CHANGED
|
@@ -537,7 +537,7 @@ function P(e, t) {
|
|
|
537
537
|
function Ge(e, t) {
|
|
538
538
|
var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
539
539
|
if (r) return (r = r.call(e)).next.bind(r);
|
|
540
|
-
if (Array.isArray(e) || (r =
|
|
540
|
+
if (Array.isArray(e) || (r = je(e)) || t) {
|
|
541
541
|
r && (e = r);
|
|
542
542
|
var n = 0;
|
|
543
543
|
return function() {
|
|
@@ -547,7 +547,7 @@ function Ge(e, t) {
|
|
|
547
547
|
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
548
548
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
549
549
|
}
|
|
550
|
-
function
|
|
550
|
+
function je(e, t) {
|
|
551
551
|
if (e) {
|
|
552
552
|
if (typeof e == "string") return It(e, t);
|
|
553
553
|
var r = {}.toString.call(e).slice(8, -1);
|
|
@@ -559,7 +559,7 @@ function It(e, t) {
|
|
|
559
559
|
for (var r = 0, n = Array(t); r < t; r++) n[r] = e[r];
|
|
560
560
|
return n;
|
|
561
561
|
}
|
|
562
|
-
var
|
|
562
|
+
var Be = ["MOBILE", "PREMIUM_RATE", "TOLL_FREE", "SHARED_COST", "VOIP", "PERSONAL_NUMBER", "PAGER", "UAN", "VOICEMAIL"];
|
|
563
563
|
function mt(e, t, r) {
|
|
564
564
|
if (t = t || {}, !(!e.country && !e.countryCallingCode)) {
|
|
565
565
|
r = new c(r), r.selectNumberingPlan(e.country, e.countryCallingCode);
|
|
@@ -567,7 +567,7 @@ function mt(e, t, r) {
|
|
|
567
567
|
if (P(n, r.nationalNumberPattern())) {
|
|
568
568
|
if (nt(n, "FIXED_LINE", r))
|
|
569
569
|
return r.type("MOBILE") && r.type("MOBILE").pattern() === "" || !r.type("MOBILE") || nt(n, "MOBILE", r) ? "FIXED_LINE_OR_MOBILE" : "FIXED_LINE";
|
|
570
|
-
for (var d = Ge(
|
|
570
|
+
for (var d = Ge(Be), i; !(i = d()).done; ) {
|
|
571
571
|
var a = i.value;
|
|
572
572
|
if (nt(n, a, r))
|
|
573
573
|
return a;
|
|
@@ -1303,10 +1303,10 @@ function X(e) {
|
|
|
1303
1303
|
}
|
|
1304
1304
|
return t;
|
|
1305
1305
|
}
|
|
1306
|
-
function
|
|
1306
|
+
function jr(e, t) {
|
|
1307
1307
|
var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
1308
1308
|
if (r) return (r = r.call(e)).next.bind(r);
|
|
1309
|
-
if (Array.isArray(e) || (r =
|
|
1309
|
+
if (Array.isArray(e) || (r = Br(e)) || t) {
|
|
1310
1310
|
r && (e = r);
|
|
1311
1311
|
var n = 0;
|
|
1312
1312
|
return function() {
|
|
@@ -1316,7 +1316,7 @@ function Br(e, t) {
|
|
|
1316
1316
|
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
1317
1317
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1318
1318
|
}
|
|
1319
|
-
function
|
|
1319
|
+
function Br(e, t) {
|
|
1320
1320
|
if (e) {
|
|
1321
1321
|
if (typeof e == "string") return Mt(e, t);
|
|
1322
1322
|
var r = {}.toString.call(e).slice(8, -1);
|
|
@@ -1329,7 +1329,7 @@ function Mt(e, t) {
|
|
|
1329
1329
|
return n;
|
|
1330
1330
|
}
|
|
1331
1331
|
function Lt(e) {
|
|
1332
|
-
for (var t = "", r =
|
|
1332
|
+
for (var t = "", r = jr(e.split("")), n; !(n = r()).done; ) {
|
|
1333
1333
|
var d = n.value;
|
|
1334
1334
|
t += Ur(d, t) || "";
|
|
1335
1335
|
}
|
|
@@ -1481,7 +1481,7 @@ function R(e) {
|
|
|
1481
1481
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1482
1482
|
}, R(e);
|
|
1483
1483
|
}
|
|
1484
|
-
function
|
|
1484
|
+
function jt(e, t) {
|
|
1485
1485
|
var r = Object.keys(e);
|
|
1486
1486
|
if (Object.getOwnPropertySymbols) {
|
|
1487
1487
|
var n = Object.getOwnPropertySymbols(e);
|
|
@@ -1491,12 +1491,12 @@ function Bt(e, t) {
|
|
|
1491
1491
|
}
|
|
1492
1492
|
return r;
|
|
1493
1493
|
}
|
|
1494
|
-
function
|
|
1494
|
+
function Bt(e) {
|
|
1495
1495
|
for (var t = 1; t < arguments.length; t++) {
|
|
1496
1496
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
1497
|
-
t % 2 ?
|
|
1497
|
+
t % 2 ? jt(Object(r), !0).forEach(function(n) {
|
|
1498
1498
|
ln(e, n, r[n]);
|
|
1499
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
1499
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : jt(Object(r)).forEach(function(n) {
|
|
1500
1500
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
1501
1501
|
});
|
|
1502
1502
|
}
|
|
@@ -1520,7 +1520,7 @@ function fn(e, t) {
|
|
|
1520
1520
|
return (t === "string" ? String : Number)(e);
|
|
1521
1521
|
}
|
|
1522
1522
|
function cn(e, t, r) {
|
|
1523
|
-
return dn(e,
|
|
1523
|
+
return dn(e, Bt(Bt({}, t), {}, {
|
|
1524
1524
|
v2: !0
|
|
1525
1525
|
}), r);
|
|
1526
1526
|
}
|
|
@@ -1854,16 +1854,16 @@ function kn(e, t, r) {
|
|
|
1854
1854
|
function Gn(e, t, r) {
|
|
1855
1855
|
var n = r.metadata, d = r.shouldTryNationalPrefixFormattingRule, i = r.getSeparatorAfterNationalPrefix, a = new RegExp("^(?:".concat(t.pattern(), ")$"));
|
|
1856
1856
|
if (a.test(e.nationalSignificantNumber))
|
|
1857
|
-
return
|
|
1857
|
+
return Bn(e, t, {
|
|
1858
1858
|
metadata: n,
|
|
1859
1859
|
shouldTryNationalPrefixFormattingRule: d,
|
|
1860
1860
|
getSeparatorAfterNationalPrefix: i
|
|
1861
1861
|
});
|
|
1862
1862
|
}
|
|
1863
|
-
function
|
|
1863
|
+
function jn(e, t, r) {
|
|
1864
1864
|
return q(e, t, r) === "IS_POSSIBLE";
|
|
1865
1865
|
}
|
|
1866
|
-
function
|
|
1866
|
+
function Bn(e, t, r) {
|
|
1867
1867
|
var n = r.metadata, d = r.shouldTryNationalPrefixFormattingRule, i = r.getSeparatorAfterNationalPrefix;
|
|
1868
1868
|
if (e.nationalSignificantNumber, e.international, e.nationalPrefix, e.carrierCode, d(t)) {
|
|
1869
1869
|
var a = Xt(e, t, {
|
|
@@ -2215,13 +2215,13 @@ function ht(e, t, r) {
|
|
|
2215
2215
|
throw new Error("Unsupported instruction tree: ".concat(t));
|
|
2216
2216
|
}
|
|
2217
2217
|
}
|
|
2218
|
-
function
|
|
2218
|
+
function j(e) {
|
|
2219
2219
|
"@babel/helpers - typeof";
|
|
2220
|
-
return
|
|
2220
|
+
return j = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
2221
2221
|
return typeof t;
|
|
2222
2222
|
} : function(t) {
|
|
2223
2223
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2224
|
-
},
|
|
2224
|
+
}, j(e);
|
|
2225
2225
|
}
|
|
2226
2226
|
function Qt(e, t) {
|
|
2227
2227
|
var r = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
@@ -2262,14 +2262,14 @@ function ud(e, t, r) {
|
|
|
2262
2262
|
}
|
|
2263
2263
|
function $d(e) {
|
|
2264
2264
|
var t = ld(e, "string");
|
|
2265
|
-
return
|
|
2265
|
+
return j(t) == "symbol" ? t : t + "";
|
|
2266
2266
|
}
|
|
2267
2267
|
function ld(e, t) {
|
|
2268
|
-
if (
|
|
2268
|
+
if (j(e) != "object" || !e) return e;
|
|
2269
2269
|
var r = e[Symbol.toPrimitive];
|
|
2270
2270
|
if (r !== void 0) {
|
|
2271
2271
|
var n = r.call(e, t);
|
|
2272
|
-
if (
|
|
2272
|
+
if (j(n) != "object") return n;
|
|
2273
2273
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2274
2274
|
}
|
|
2275
2275
|
return String(e);
|
|
@@ -2304,7 +2304,7 @@ var gt = "9", sd = 15, fd = K(gt, sd), cd = /[- ]/, hd = function() {
|
|
|
2304
2304
|
key: "format",
|
|
2305
2305
|
value: function(r, n) {
|
|
2306
2306
|
var d = this;
|
|
2307
|
-
if (
|
|
2307
|
+
if (jn(n.nationalSignificantNumber, n.country, this.metadata))
|
|
2308
2308
|
for (var i = Qt(this.matchingFormats), a; !(a = i()).done; ) {
|
|
2309
2309
|
var o = a.value, u = Gn(n, o, {
|
|
2310
2310
|
metadata: this.metadata,
|
|
@@ -2468,13 +2468,13 @@ var gt = "9", sd = 15, fd = K(gt, sd), cd = /[- ]/, hd = function() {
|
|
|
2468
2468
|
}
|
|
2469
2469
|
}]);
|
|
2470
2470
|
}();
|
|
2471
|
-
function
|
|
2471
|
+
function B(e) {
|
|
2472
2472
|
"@babel/helpers - typeof";
|
|
2473
|
-
return
|
|
2473
|
+
return B = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
2474
2474
|
return typeof t;
|
|
2475
2475
|
} : function(t) {
|
|
2476
2476
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
2477
|
-
},
|
|
2477
|
+
}, B(e);
|
|
2478
2478
|
}
|
|
2479
2479
|
function me(e, t) {
|
|
2480
2480
|
return Cd(e) || bd(e, t) || vd(e, t) || pd();
|
|
@@ -2530,14 +2530,14 @@ function Ed(e, t, r) {
|
|
|
2530
2530
|
}
|
|
2531
2531
|
function Sd(e) {
|
|
2532
2532
|
var t = xd(e, "string");
|
|
2533
|
-
return
|
|
2533
|
+
return B(t) == "symbol" ? t : t + "";
|
|
2534
2534
|
}
|
|
2535
2535
|
function xd(e, t) {
|
|
2536
|
-
if (
|
|
2536
|
+
if (B(e) != "object" || !e) return e;
|
|
2537
2537
|
var r = e[Symbol.toPrimitive];
|
|
2538
2538
|
if (r !== void 0) {
|
|
2539
2539
|
var n = r.call(e, t);
|
|
2540
|
-
if (
|
|
2540
|
+
if (B(n) != "object") return n;
|
|
2541
2541
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2542
2542
|
}
|
|
2543
2543
|
return String(e);
|
|
@@ -2732,7 +2732,7 @@ function U(e) {
|
|
|
2732
2732
|
}, U(e);
|
|
2733
2733
|
}
|
|
2734
2734
|
function Md(e, t) {
|
|
2735
|
-
return
|
|
2735
|
+
return jd(e) || Gd(e, t) || kd(e, t) || Ld();
|
|
2736
2736
|
}
|
|
2737
2737
|
function Ld() {
|
|
2738
2738
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
@@ -2768,10 +2768,10 @@ function Gd(e, t) {
|
|
|
2768
2768
|
return o;
|
|
2769
2769
|
}
|
|
2770
2770
|
}
|
|
2771
|
-
function
|
|
2771
|
+
function jd(e) {
|
|
2772
2772
|
if (Array.isArray(e)) return e;
|
|
2773
2773
|
}
|
|
2774
|
-
function
|
|
2774
|
+
function Bd(e, t) {
|
|
2775
2775
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
2776
2776
|
}
|
|
2777
2777
|
function Ud(e, t) {
|
|
@@ -2799,7 +2799,7 @@ function Wd(e, t) {
|
|
|
2799
2799
|
}
|
|
2800
2800
|
var pe = /* @__PURE__ */ function() {
|
|
2801
2801
|
function e(t, r) {
|
|
2802
|
-
|
|
2802
|
+
Bd(this, e), this.metadata = new c(r);
|
|
2803
2803
|
var n = this.getCountryAndCallingCode(t), d = Md(n, 2), i = d[0], a = d[1];
|
|
2804
2804
|
this.defaultCountry = i, this.defaultCallingCode = a, this.reset();
|
|
2805
2805
|
}
|
|
@@ -3268,7 +3268,9 @@ class qd extends E {
|
|
|
3268
3268
|
}), this.inputElement.addEventListener("focus", () => {
|
|
3269
3269
|
this.containerElement.addClass("focused");
|
|
3270
3270
|
}), this.inputElement.addEventListener("blur", (v) => {
|
|
3271
|
-
this.containerElement.removeClass("focused"),
|
|
3271
|
+
this.containerElement.removeClass("focused"), setTimeout(() => {
|
|
3272
|
+
this.validateInput(this.inputElement.getElement().value, !0), this.onBlur(v);
|
|
3273
|
+
}, 0);
|
|
3272
3274
|
}), i && this.inputElement.addEventListener("keydown", (v) => {
|
|
3273
3275
|
const rt = v;
|
|
3274
3276
|
rt.key === "Tab" && !rt.shiftKey && (rt.preventDefault(), i());
|
|
@@ -3290,7 +3292,12 @@ class qd extends E {
|
|
|
3290
3292
|
if (a?.countryCode && a.countryCode !== this.currentCountryCode) {
|
|
3291
3293
|
this.currentCountryCode = a.countryCode, this.updateSelectAndFlag(a.countryCode), r.placeholder = T(a.countryCode);
|
|
3292
3294
|
const o = this.countryCodeInput.getElement();
|
|
3293
|
-
o.value = a.countryCode
|
|
3295
|
+
o.value = a.countryCode;
|
|
3296
|
+
const u = new Event("input", { bubbles: !0 });
|
|
3297
|
+
Object.defineProperty(u, "target", {
|
|
3298
|
+
writable: !1,
|
|
3299
|
+
value: { name: "phoneCountryCode", value: a.countryCode }
|
|
3300
|
+
}), this.onChange(u);
|
|
3294
3301
|
}
|
|
3295
3302
|
} else {
|
|
3296
3303
|
const a = this.countrySelect.getElement().value;
|
|
@@ -3319,7 +3326,10 @@ class qd extends E {
|
|
|
3319
3326
|
const d = this.countryCodeInput.getElement();
|
|
3320
3327
|
d.value = t;
|
|
3321
3328
|
const i = new Event("input", { bubbles: !0 });
|
|
3322
|
-
if (
|
|
3329
|
+
if (Object.defineProperty(i, "target", {
|
|
3330
|
+
writable: !1,
|
|
3331
|
+
value: { name: "phoneCountryCode", value: t }
|
|
3332
|
+
}), this.onChange(i), n.startsWith("+")) {
|
|
3323
3333
|
const a = A(n);
|
|
3324
3334
|
!a || a.countryCode !== t ? this.showValidationError() : this.clearValidationError();
|
|
3325
3335
|
return;
|
|
@@ -3372,7 +3382,7 @@ class qd extends E {
|
|
|
3372
3382
|
}
|
|
3373
3383
|
setValue(t) {
|
|
3374
3384
|
if (!t)
|
|
3375
|
-
return this.inputElement.getElement().value = "", this.userSelectedCountry = !1, this;
|
|
3385
|
+
return this.inputElement.getElement().value ? this : (this.inputElement.getElement().value = "", this.userSelectedCountry = !1, this);
|
|
3376
3386
|
if (t.startsWith("+")) {
|
|
3377
3387
|
const r = A(t);
|
|
3378
3388
|
if (r) {
|