@odus/checkout 1.14.7 → 1.14.8
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 +50 -78
- package/dist/elements.es.js +9 -45
- package/dist/phone.js +63 -70
- package/dist/shared.js +28 -63
- package/package.json +1 -1
package/dist/checkout.es.js
CHANGED
|
@@ -154,9 +154,7 @@ var q = class extends b {
|
|
|
154
154
|
if (e.kind === "street") {
|
|
155
155
|
let e = this.createRow(["full"]), a = this.createInput("street", t.street?.label ?? this.translationFunc("address.addressLine1"), n.street, r.street, i.street, d(!0, !0), "street-address", t.street?.maxLength);
|
|
156
156
|
this.inputs.set("street", a), e.appendChild(a.getElement()), this.fieldsContainer.appendChild(e);
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
if (e.kind === "name") {
|
|
157
|
+
} else if (e.kind === "name") {
|
|
160
158
|
let a = this.createRow(e.fields.map(() => "half")), o = e.fields.length === 1;
|
|
161
159
|
if (e.fields.includes("firstName")) {
|
|
162
160
|
let s = o || e.fields[e.fields.length - 1] === "firstName", c = this.createInput("firstName", t.firstName?.label ?? this.translationFunc("address.firstName"), n.firstName, r.firstName, i.firstName, d(!0, s), "given-name");
|
|
@@ -167,14 +165,10 @@ var q = class extends b {
|
|
|
167
165
|
this.inputs.set("lastName", c), a.appendChild(c.getElement());
|
|
168
166
|
}
|
|
169
167
|
this.fieldsContainer.appendChild(a);
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
if (e.kind === "country") {
|
|
168
|
+
} else if (e.kind === "country") {
|
|
173
169
|
let e = this.createRow(["full"]), a = this.createCountrySelect(n.country, r.country, i.country, d(!0, !0), t.country?.options, t.country?.label);
|
|
174
170
|
this.inputs.set("country", a), e.appendChild(a.getElement()), this.fieldsContainer.appendChild(e);
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
if (e.kind === "cityZip") {
|
|
171
|
+
} else if (e.kind === "cityZip") {
|
|
178
172
|
let a = this.createRow(e.fields.map(() => "half")), o = e.fields.length === 1;
|
|
179
173
|
if (e.fields.includes("city")) {
|
|
180
174
|
let s = o || e.fields[e.fields.length - 1] === "city", c = this.createInput("city", t.city?.label ?? this.translationFunc("address.townCity"), n.city, r.city, i.city, d(!0, s), "address-level2");
|
|
@@ -185,9 +179,7 @@ var q = class extends b {
|
|
|
185
179
|
this.inputs.set("zipCode", c), a.appendChild(c.getElement());
|
|
186
180
|
}
|
|
187
181
|
this.fieldsContainer.appendChild(a);
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
if (e.kind === "state") {
|
|
182
|
+
} else if (e.kind === "state") {
|
|
191
183
|
let e = this.createRow(["full"]);
|
|
192
184
|
if (this.stateFieldConfig = t.state, this.stateRow = e, this.stateStyles = d(!0, !0), this.currentCountry = n.country, t.state?.hiddenForCountries?.includes(n.country) && (e.style.display = "none"), g(n.country)) {
|
|
193
185
|
let a = this.createStateSelect(n.state, r.state, i.state, this.stateStyles, n.country, t.state?.label);
|
|
@@ -297,13 +289,7 @@ var q = class extends b {
|
|
|
297
289
|
t.setOptions(r, i);
|
|
298
290
|
}
|
|
299
291
|
this.clearStateValue();
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
if (i !== a) {
|
|
303
|
-
this.rebuildStateField(e), this.clearStateValue();
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
!i && !a && t !== e && this.clearStateValue();
|
|
292
|
+
} else i === a ? !i && !a && t !== e && this.clearStateValue() : (this.rebuildStateField(e), this.clearStateValue());
|
|
307
293
|
}
|
|
308
294
|
rebuildStateField(e) {
|
|
309
295
|
if (!this.stateRow || !this.stateStyles) return;
|
|
@@ -587,46 +573,45 @@ var q = class extends b {
|
|
|
587
573
|
let n = t.enabled, r = !s || s[e] === !0, i = ae(t.countries, p);
|
|
588
574
|
return n && r && i;
|
|
589
575
|
}).sort((e, t) => e[1].order - t[1].order);
|
|
590
|
-
if (m.length === 0)
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
|
|
576
|
+
if (m.length === 0) this.getElement().style.display = "none";
|
|
577
|
+
else {
|
|
578
|
+
for (let [e] of m) switch (e) {
|
|
579
|
+
case "paypal":
|
|
580
|
+
if (r) {
|
|
581
|
+
let e = new de({
|
|
582
|
+
checkoutProfile: t,
|
|
583
|
+
formData: n,
|
|
584
|
+
onSubmit: r
|
|
585
|
+
});
|
|
586
|
+
this.paymentMethods.set("paypal", e), e.appendTo(this.getElement());
|
|
587
|
+
}
|
|
588
|
+
break;
|
|
589
|
+
case "applePay":
|
|
590
|
+
if (i && l && u) {
|
|
591
|
+
let e = t.appearance?.additionalPaymentMethods?.applePay, r = new L({
|
|
592
|
+
checkoutProfile: t,
|
|
593
|
+
formData: n,
|
|
594
|
+
onSubmit: i,
|
|
595
|
+
onStartFailed: a,
|
|
596
|
+
onPaymentDataFailed: o,
|
|
597
|
+
paymentId: l,
|
|
598
|
+
checkoutKey: u,
|
|
599
|
+
checkoutDetails: d,
|
|
600
|
+
environment: f,
|
|
601
|
+
displayName: e?.displayName,
|
|
602
|
+
requiredBillingContactFields: e?.requiredBillingContactFields,
|
|
603
|
+
requiredShippingContactFields: e?.requiredShippingContactFields
|
|
604
|
+
});
|
|
605
|
+
this.paymentMethods.set("applePay", r), r.appendTo(this.getElement());
|
|
606
|
+
}
|
|
607
|
+
break;
|
|
608
|
+
default: console.warn(`[PaymentMethods] Unsupported payment method: ${e}`);
|
|
609
|
+
}
|
|
610
|
+
this.paymentMethods.size > 0 && (this.paymentSeparator = new Ce({
|
|
611
|
+
translationFunc: c,
|
|
612
|
+
checkoutProfile: t
|
|
613
|
+
}), this.getElement().appendChild(this.paymentSeparator.getElement()));
|
|
625
614
|
}
|
|
626
|
-
this.paymentMethods.size > 0 && (this.paymentSeparator = new Ce({
|
|
627
|
-
translationFunc: c,
|
|
628
|
-
checkoutProfile: t
|
|
629
|
-
}), this.getElement().appendChild(this.paymentSeparator.getElement()));
|
|
630
615
|
}
|
|
631
616
|
renderSkeleton() {
|
|
632
617
|
this.skeleton = new J(), this.getElement().appendChild(this.skeleton.getElement());
|
|
@@ -1173,11 +1158,7 @@ var q = class extends b {
|
|
|
1173
1158
|
this.componentManager.updatePaymentMethods(e.formData), this.componentManager.updateEmailField(e.formData.email, !!(e.errors.email && e.touched.email), e.errors.email, e.touched.email ? this.validationSchema.emailSuggestion(e.formData.email) : void 0), this.componentManager.updatePhoneNumberField(e.formData.phoneNumber ?? "", !!(e.errors.phoneNumber && e.touched.phoneNumber), e.errors.phoneNumber), this.componentManager.updateCardholderSection(e.formData.name, !!(e.errors.name && e.touched.name), e.errors.name), this.componentManager.updateBillingAddressSection(e.formData.billingAddress ?? Y, e.errors.billingAddress ?? {}, X(e.touched, "billingAddress")), this.componentManager.updateShippingAddressSection(e.formData.shippingAddress ?? Y, e.errors.shippingAddress ?? {}, X(e.touched, "shippingAddress")), this.componentManager.updateSubmitButton(t);
|
|
1174
1159
|
}
|
|
1175
1160
|
setLoadingState(e) {
|
|
1176
|
-
|
|
1177
|
-
this.onLoadingStateChange(e);
|
|
1178
|
-
return;
|
|
1179
|
-
}
|
|
1180
|
-
e ? (this.hideSkeleton(), this.formSkeleton = new J(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
|
|
1161
|
+
this.onLoadingStateChange ? this.onLoadingStateChange(e) : e ? (this.hideSkeleton(), this.formSkeleton = new J(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
|
|
1181
1162
|
}
|
|
1182
1163
|
showSpinner(e) {
|
|
1183
1164
|
this.hideSpinner(), this.spinner = new je({ text: e }), this.formElement.appendChild(this.spinner.getElement());
|
|
@@ -1294,11 +1275,8 @@ var Q = (e) => ({
|
|
|
1294
1275
|
};
|
|
1295
1276
|
}
|
|
1296
1277
|
initializeForm() {
|
|
1297
|
-
if (this.uiManager.setLoadingState(!0), this.options.errorMsg && this.uiManager.setErrorMessage(this.options.errorMsg), !this.vgsService && this.options.paymentId && this.options.checkoutDetails)
|
|
1298
|
-
|
|
1299
|
-
return;
|
|
1300
|
-
}
|
|
1301
|
-
if (this.vgsService) {
|
|
1278
|
+
if (this.uiManager.setLoadingState(!0), this.options.errorMsg && this.uiManager.setErrorMessage(this.options.errorMsg), !this.vgsService && this.options.paymentId && this.options.checkoutDetails) this.failCardCaptureClosed(C.NO_TOKENIZATION_SESSION);
|
|
1279
|
+
else if (this.vgsService) {
|
|
1302
1280
|
let e = this.vgsService;
|
|
1303
1281
|
e.init(this.options.environment).then((t) => {
|
|
1304
1282
|
this.vgsService === e && e.createForm(t, (e) => this.handleVgsStateChange(e));
|
|
@@ -1520,16 +1498,10 @@ var Q = (e) => ({
|
|
|
1520
1498
|
this.unmount(), this.container = e, this.renderForm();
|
|
1521
1499
|
}
|
|
1522
1500
|
update(e) {
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
locale: e.locale
|
|
1528
|
-
});
|
|
1529
|
-
return;
|
|
1530
|
-
}
|
|
1531
|
-
e.errorMsg && !this.options.disableErrorMessages ? this.form.setErrorMessage(e.errorMsg) : this.renderForm(e.errorMsg);
|
|
1532
|
-
}
|
|
1501
|
+
this.container && this.form && (e.appearance || e.locale ? this.form.updateAppearance({
|
|
1502
|
+
appearance: e.appearance,
|
|
1503
|
+
locale: e.locale
|
|
1504
|
+
}) : e.errorMsg && !this.options.disableErrorMessages ? this.form.setErrorMessage(e.errorMsg) : this.renderForm(e.errorMsg));
|
|
1533
1505
|
}
|
|
1534
1506
|
renderForm(e) {
|
|
1535
1507
|
this.container && (this.form &&= (this.form.destroy(), null), this.form = new Pe({
|
package/dist/elements.es.js
CHANGED
|
@@ -257,9 +257,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
257
257
|
if (n && r && t !== e) {
|
|
258
258
|
let { t } = O(), n = k(e), r = t(c(n));
|
|
259
259
|
this._select?.setOptions(a(n), this.options.placeholder ?? r), this._select?.setValue(""), this._value = "", this.emit("change", this._value);
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
n !== r && (this._value = "", this.render(), this.emit("change", this._value));
|
|
260
|
+
} else n !== r && (this._value = "", this.render(), this.emit("change", this._value));
|
|
263
261
|
}
|
|
264
262
|
render() {
|
|
265
263
|
this.shadowRoot && (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, u(this._country) ? this._renderSelect(k(this._country)) : this._renderInput());
|
|
@@ -444,15 +442,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
444
442
|
return;
|
|
445
443
|
}
|
|
446
444
|
let { paymentId: e, checkoutKey: t, environment: n, checkoutDetails: r, displayName: i, countries: a, requiredBillingContactFields: o, requiredShippingContactFields: s, onAuthorize: c, onStartFailed: l, onPaymentDataFailed: u } = this._paymentContext;
|
|
447
|
-
|
|
448
|
-
this._setAvailability(!1);
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
if (!ue()) {
|
|
452
|
-
this._setAvailability(!1);
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
this._button = new he({
|
|
445
|
+
oe(a, r?.countryCode) && ue() ? (this._button = new he({
|
|
456
446
|
checkoutProfile: Se,
|
|
457
447
|
paymentId: e,
|
|
458
448
|
checkoutKey: t,
|
|
@@ -469,7 +459,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
469
459
|
let t = await c(e);
|
|
470
460
|
return t || (this._authorized = !1, this.emit("change", e)), t;
|
|
471
461
|
}
|
|
472
|
-
}), this.shadowRoot.appendChild(this._button.getElement()), this._setAvailability(!0);
|
|
462
|
+
}), this.shadowRoot.appendChild(this._button.getElement()), this._setAvailability(!0)) : this._setAvailability(!1);
|
|
473
463
|
}
|
|
474
464
|
_setAvailability(e) {
|
|
475
465
|
this._isAvailable = e, this.host && (e ? this.host.style.removeProperty("display") : this.host.style.display = "none");
|
|
@@ -756,17 +746,7 @@ var we = class {
|
|
|
756
746
|
if (this._captureState === "vgs") {
|
|
757
747
|
if (!this.host || !this._vgsAdapter) return;
|
|
758
748
|
this._vgsAdapter.renderSection(this.host, () => this.emit("change", this.getValue()));
|
|
759
|
-
|
|
760
|
-
}
|
|
761
|
-
if (this._captureState === "unsupported") {
|
|
762
|
-
this.clearBody();
|
|
763
|
-
return;
|
|
764
|
-
}
|
|
765
|
-
if (this._captureState === "pending") {
|
|
766
|
-
this.renderPendingPlaceholder();
|
|
767
|
-
return;
|
|
768
|
-
}
|
|
769
|
-
this.renderUnavailableNotice();
|
|
749
|
+
} else this._captureState === "unsupported" ? this.clearBody() : this._captureState === "pending" ? this.renderPendingPlaceholder() : this.renderUnavailableNotice();
|
|
770
750
|
}
|
|
771
751
|
clearBody() {
|
|
772
752
|
this.shadowRoot?.querySelectorAll(".card-unavailable, .card-pending").forEach((e) => e.remove());
|
|
@@ -949,11 +929,7 @@ var we = class {
|
|
|
949
929
|
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new T({ message: this._message }), this.shadowRoot.appendChild(this._alert.getElement())));
|
|
950
930
|
}
|
|
951
931
|
setError(e) {
|
|
952
|
-
|
|
953
|
-
this.emit("error", e);
|
|
954
|
-
return;
|
|
955
|
-
}
|
|
956
|
-
this._alert ? this._alert.setMessage(e) : (this._alert = new T({ message: e }), this.shadowRoot.appendChild(this._alert.getElement())), this.emit("error", e);
|
|
932
|
+
this._message = e, this.shadowRoot && (this._alert ? this._alert.setMessage(e) : (this._alert = new T({ message: e }), this.shadowRoot.appendChild(this._alert.getElement()))), this.emit("error", e);
|
|
957
933
|
}
|
|
958
934
|
clearError() {
|
|
959
935
|
this._message = null, this._alert?.getElement().remove(), this._alert = null;
|
|
@@ -1159,11 +1135,7 @@ var we = class {
|
|
|
1159
1135
|
enumerable: !0
|
|
1160
1136
|
}), Object.defineProperty(n, "phone", {
|
|
1161
1137
|
get: () => (this._phone || (this._phone = new $(), this._trackElement(this._phone), this._phone.setLoadOutcomeListener((e) => {
|
|
1162
|
-
|
|
1163
|
-
this._settleLoad();
|
|
1164
|
-
return;
|
|
1165
|
-
}
|
|
1166
|
-
this._readiness.fail({
|
|
1138
|
+
e.status === "ready" ? this._settleLoad() : this._readiness.fail({
|
|
1167
1139
|
reason: e.reason,
|
|
1168
1140
|
attributes: e.attributes
|
|
1169
1141
|
});
|
|
@@ -1229,11 +1201,7 @@ var we = class {
|
|
|
1229
1201
|
get: () => (this._card || (this._card = new J(), this._card.setEnvironment(this._config.environment), this._card.on("ready", () => {
|
|
1230
1202
|
this._cardFieldsReady = !1;
|
|
1231
1203
|
}), this._trackElement(this._card), this._card.setLoadOutcomeListener((e) => {
|
|
1232
|
-
|
|
1233
|
-
this._cardFieldsReady = !0, this._settleLoad();
|
|
1234
|
-
return;
|
|
1235
|
-
}
|
|
1236
|
-
this._readiness.settle(e);
|
|
1204
|
+
this._readiness.markMounted(), e.status === "ready" ? (this._cardFieldsReady = !0, this._settleLoad()) : this._readiness.settle(e);
|
|
1237
1205
|
}), this._paymentState.vgsJwt ? this._card.setVgsJwt(this._paymentState.vgsJwt) : this._paymentState.cardCapture === "unavailable" ? this._card.markCaptureUnavailable() : this._paymentState.cardCapture === "unsupported" && this._card.resetCardCapture()), this._card),
|
|
1238
1206
|
enumerable: !0
|
|
1239
1207
|
}), Object.defineProperty(o, "cardholderName", {
|
|
@@ -1372,15 +1340,11 @@ var we = class {
|
|
|
1372
1340
|
return;
|
|
1373
1341
|
}
|
|
1374
1342
|
let t = await this._getPayload();
|
|
1375
|
-
|
|
1376
|
-
this._reportSubmitFailure(t.error, "card");
|
|
1377
|
-
return;
|
|
1378
|
-
}
|
|
1379
|
-
await this._executeAuthorization({
|
|
1343
|
+
t.ok ? await this._executeAuthorization({
|
|
1380
1344
|
formData: t.formData,
|
|
1381
1345
|
applePayData: void 0,
|
|
1382
1346
|
customCustomerData: e?.customerData
|
|
1383
|
-
});
|
|
1347
|
+
}) : this._reportSubmitFailure(t.error, "card");
|
|
1384
1348
|
}
|
|
1385
1349
|
applyTheme(e) {
|
|
1386
1350
|
let t = e["--odus-font-family"];
|
package/dist/phone.js
CHANGED
|
@@ -8868,11 +8868,11 @@ function dn(e, t, n) {
|
|
|
8868
8868
|
if (e) {
|
|
8869
8869
|
if (e.length > sn) {
|
|
8870
8870
|
if (n) throw new N("TOO_LONG");
|
|
8871
|
-
|
|
8871
|
+
} else {
|
|
8872
|
+
if (t === !1) return e;
|
|
8873
|
+
var r = e.search(cn);
|
|
8874
|
+
if (!(r < 0)) return e.slice(r).replace(ln, "");
|
|
8872
8875
|
}
|
|
8873
|
-
if (t === !1) return e;
|
|
8874
|
-
var r = e.search(cn);
|
|
8875
|
-
if (!(r < 0)) return e.slice(r).replace(ln, "");
|
|
8876
8876
|
}
|
|
8877
8877
|
}
|
|
8878
8878
|
function fn(e, t, n) {
|
|
@@ -9436,52 +9436,52 @@ var lr = /*#__PURE__*/ function() {
|
|
|
9436
9436
|
value: function(e) {
|
|
9437
9437
|
if (!e) throw Error("Pattern is required");
|
|
9438
9438
|
var t = e.match(fr);
|
|
9439
|
-
if (
|
|
9439
|
+
if (t) {
|
|
9440
|
+
var n = t[1], r = e.slice(0, t.index), i = e.slice(t.index + n.length);
|
|
9441
|
+
switch (n) {
|
|
9442
|
+
case "(?:":
|
|
9443
|
+
r && this.parsePattern(r), this.startContext({
|
|
9444
|
+
or: !0,
|
|
9445
|
+
instructions: [],
|
|
9446
|
+
branches: []
|
|
9447
|
+
});
|
|
9448
|
+
break;
|
|
9449
|
+
case ")":
|
|
9450
|
+
if (!this.getContext().or) throw Error("\")\" operator must be preceded by \"(?:\" operator");
|
|
9451
|
+
if (r && this.parsePattern(r), this.getContext().instructions.length === 0) throw Error("No instructions found after \"|\" operator in an \"or\" group");
|
|
9452
|
+
var a = this.getContext().branches;
|
|
9453
|
+
a.push(pr(this.getContext().instructions)), this.endContext(), this.getContext().instructions.push({
|
|
9454
|
+
op: "|",
|
|
9455
|
+
args: a
|
|
9456
|
+
});
|
|
9457
|
+
break;
|
|
9458
|
+
case "|":
|
|
9459
|
+
if (!this.getContext().or) throw Error("\"|\" operator can only be used inside \"or\" groups");
|
|
9460
|
+
if (r && this.parsePattern(r), !this.getContext().branches) {
|
|
9461
|
+
/* istanbul ignore else */
|
|
9462
|
+
if (this.context.length === 1) this.getContext().branches = [];
|
|
9463
|
+
else throw Error("\"branches\" not found in an \"or\" group context");
|
|
9464
|
+
}
|
|
9465
|
+
this.getContext().branches.push(pr(this.getContext().instructions)), this.getContext().instructions = [];
|
|
9466
|
+
break;
|
|
9467
|
+
case "[":
|
|
9468
|
+
r && this.parsePattern(r), this.startContext({ oneOfSet: !0 });
|
|
9469
|
+
break;
|
|
9470
|
+
case "]":
|
|
9471
|
+
if (!this.getContext().oneOfSet) throw Error("\"]\" operator must be preceded by \"[\" operator");
|
|
9472
|
+
this.endContext(), this.getContext().instructions.push({
|
|
9473
|
+
op: "[]",
|
|
9474
|
+
args: ur(r)
|
|
9475
|
+
});
|
|
9476
|
+
break;
|
|
9477
|
+
/* istanbul ignore next */
|
|
9478
|
+
default: throw Error(`Unknown operator: ${n}`);
|
|
9479
|
+
}
|
|
9480
|
+
i && this.parsePattern(i);
|
|
9481
|
+
} else {
|
|
9440
9482
|
if (dr.test(e)) throw Error(`Illegal characters found in a pattern: ${e}`);
|
|
9441
9483
|
this.getContext().instructions = this.getContext().instructions.concat(e.split(""));
|
|
9442
|
-
return;
|
|
9443
|
-
}
|
|
9444
|
-
var n = t[1], r = e.slice(0, t.index), i = e.slice(t.index + n.length);
|
|
9445
|
-
switch (n) {
|
|
9446
|
-
case "(?:":
|
|
9447
|
-
r && this.parsePattern(r), this.startContext({
|
|
9448
|
-
or: !0,
|
|
9449
|
-
instructions: [],
|
|
9450
|
-
branches: []
|
|
9451
|
-
});
|
|
9452
|
-
break;
|
|
9453
|
-
case ")":
|
|
9454
|
-
if (!this.getContext().or) throw Error("\")\" operator must be preceded by \"(?:\" operator");
|
|
9455
|
-
if (r && this.parsePattern(r), this.getContext().instructions.length === 0) throw Error("No instructions found after \"|\" operator in an \"or\" group");
|
|
9456
|
-
var a = this.getContext().branches;
|
|
9457
|
-
a.push(pr(this.getContext().instructions)), this.endContext(), this.getContext().instructions.push({
|
|
9458
|
-
op: "|",
|
|
9459
|
-
args: a
|
|
9460
|
-
});
|
|
9461
|
-
break;
|
|
9462
|
-
case "|":
|
|
9463
|
-
if (!this.getContext().or) throw Error("\"|\" operator can only be used inside \"or\" groups");
|
|
9464
|
-
if (r && this.parsePattern(r), !this.getContext().branches) {
|
|
9465
|
-
/* istanbul ignore else */
|
|
9466
|
-
if (this.context.length === 1) this.getContext().branches = [];
|
|
9467
|
-
else throw Error("\"branches\" not found in an \"or\" group context");
|
|
9468
|
-
}
|
|
9469
|
-
this.getContext().branches.push(pr(this.getContext().instructions)), this.getContext().instructions = [];
|
|
9470
|
-
break;
|
|
9471
|
-
case "[":
|
|
9472
|
-
r && this.parsePattern(r), this.startContext({ oneOfSet: !0 });
|
|
9473
|
-
break;
|
|
9474
|
-
case "]":
|
|
9475
|
-
if (!this.getContext().oneOfSet) throw Error("\"]\" operator must be preceded by \"[\" operator");
|
|
9476
|
-
this.endContext(), this.getContext().instructions.push({
|
|
9477
|
-
op: "[]",
|
|
9478
|
-
args: ur(r)
|
|
9479
|
-
});
|
|
9480
|
-
break;
|
|
9481
|
-
/* istanbul ignore next */
|
|
9482
|
-
default: throw Error(`Unknown operator: ${n}`);
|
|
9483
9484
|
}
|
|
9484
|
-
i && this.parsePattern(i);
|
|
9485
9485
|
}
|
|
9486
9486
|
}
|
|
9487
9487
|
]);
|
|
@@ -9874,11 +9874,8 @@ var Mr = "9", Nr = V(Mr, 15), Pr = /[- ]/, G = !0, Fr = G && function() {
|
|
|
9874
9874
|
key: "formatNextNationalNumberDigits",
|
|
9875
9875
|
value: function(e) {
|
|
9876
9876
|
var t = Qn(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, e);
|
|
9877
|
-
if (!t)
|
|
9878
|
-
|
|
9879
|
-
return;
|
|
9880
|
-
}
|
|
9881
|
-
return this.populatedNationalNumberTemplate = t[0], this.populatedNationalNumberTemplatePosition = t[1], Xn(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1);
|
|
9877
|
+
if (!t) this.resetFormat();
|
|
9878
|
+
else return this.populatedNationalNumberTemplate = t[0], this.populatedNationalNumberTemplatePosition = t[1], Xn(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1);
|
|
9882
9879
|
}
|
|
9883
9880
|
},
|
|
9884
9881
|
{
|
|
@@ -10934,26 +10931,22 @@ var X = (e) => {
|
|
|
10934
10931
|
this._userSelectedCountry = !0, this._currentCountryCode = e, this._countrySelector.setCountry(e), this._syncCountryCodeInput(e), this._inputElement.getElement().placeholder = this._customPlaceholder ?? $(e);
|
|
10935
10932
|
}
|
|
10936
10933
|
_validateInput(e, t = !1) {
|
|
10937
|
-
if (!e)
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
} else n = e.replace(/\D/g, "").length;
|
|
10951
|
-
if (n <= t) {
|
|
10952
|
-
this._clearValidationError();
|
|
10953
|
-
return;
|
|
10934
|
+
if (!e) this._clearValidationError();
|
|
10935
|
+
else if (Ei(e, this._currentCountryCode)) this._clearValidationError();
|
|
10936
|
+
else {
|
|
10937
|
+
if (!t) {
|
|
10938
|
+
let t = Di(this._currentCountryCode), n;
|
|
10939
|
+
if (e.startsWith("+")) {
|
|
10940
|
+
let t = Q(e);
|
|
10941
|
+
n = t ? t.nationalNumber.replace(/\D/g, "").length : 0;
|
|
10942
|
+
} else n = e.replace(/\D/g, "").length;
|
|
10943
|
+
if (n <= t) {
|
|
10944
|
+
this._clearValidationError();
|
|
10945
|
+
return;
|
|
10946
|
+
}
|
|
10954
10947
|
}
|
|
10948
|
+
this._showValidationError();
|
|
10955
10949
|
}
|
|
10956
|
-
this._showValidationError();
|
|
10957
10950
|
}
|
|
10958
10951
|
_showValidationError() {
|
|
10959
10952
|
this._containerElement.addClass("error");
|
package/dist/shared.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
|
-
var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), t = {
|
|
2
|
+
var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), t = {
|
|
3
3
|
checkoutDetails: (e) => `/v2/payments/${e}/checkout-details`,
|
|
4
4
|
authorize: (e) => `/v2/payments/${e}/authorize`,
|
|
5
5
|
applePaySessions: (e) => `/v2/payments/${e}/apple-pay-sessions`
|
|
@@ -124,11 +124,11 @@ var e = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t
|
|
|
124
124
|
}, k = {
|
|
125
125
|
test: "sandbox",
|
|
126
126
|
live: "live"
|
|
127
|
-
}, A = 2e4, j = /* @__PURE__ */ e(((e, t) => {
|
|
128
|
-
var
|
|
127
|
+
}, A = 2e4, j = /* @__PURE__ */ e(((e, t, n) => {
|
|
128
|
+
var r = function(e) {
|
|
129
129
|
return e && e.Math === Math && e;
|
|
130
130
|
};
|
|
131
|
-
t.exports =
|
|
131
|
+
t.exports = r(typeof globalThis == "object" && globalThis) || r(typeof window == "object" && window) || r(typeof self == "object" && self) || r(typeof global == "object" && global) || r(typeof n == "object" && n) || (function() {
|
|
132
132
|
return this;
|
|
133
133
|
})() || Function("return this")();
|
|
134
134
|
})), M = /* @__PURE__ */ e(((e, t) => {
|
|
@@ -1702,15 +1702,7 @@ var ir = function(e) {
|
|
|
1702
1702
|
crossorigin: l,
|
|
1703
1703
|
logLevel: u
|
|
1704
1704
|
}), new Promise(function(e, t) {
|
|
1705
|
-
|
|
1706
|
-
t(Ln.IS_UNDEFINED("window"));
|
|
1707
|
-
return;
|
|
1708
|
-
}
|
|
1709
|
-
if (window.VGSCollect) {
|
|
1710
|
-
tr(r, a, u), e(window.VGSCollect);
|
|
1711
|
-
return;
|
|
1712
|
-
}
|
|
1713
|
-
er().then(function() {
|
|
1705
|
+
typeof window > "u" ? t(Ln.IS_UNDEFINED("window")) : window.VGSCollect ? (tr(r, a, u), e(window.VGSCollect)) : er().then(function() {
|
|
1714
1706
|
tr(r, a, u), e(window.VGSCollect);
|
|
1715
1707
|
}).catch(function(e) {
|
|
1716
1708
|
t(e);
|
|
@@ -1723,21 +1715,17 @@ var ir = function(e) {
|
|
|
1723
1715
|
let n = e.trim();
|
|
1724
1716
|
if (!n) continue;
|
|
1725
1717
|
let r = ar.exec(n);
|
|
1726
|
-
|
|
1727
|
-
t.push({
|
|
1728
|
-
function: r[1] || "(anonymous)",
|
|
1729
|
-
filename: r[2],
|
|
1730
|
-
lineno: parseInt(r[3], 10),
|
|
1731
|
-
colno: parseInt(r[4], 10)
|
|
1732
|
-
});
|
|
1733
|
-
continue;
|
|
1734
|
-
}
|
|
1735
|
-
r = or.exec(n) ?? sr.exec(n), r && t.push({
|
|
1718
|
+
r ? t.push({
|
|
1736
1719
|
function: r[1] || "(anonymous)",
|
|
1737
1720
|
filename: r[2],
|
|
1738
1721
|
lineno: parseInt(r[3], 10),
|
|
1739
1722
|
colno: parseInt(r[4], 10)
|
|
1740
|
-
})
|
|
1723
|
+
}) : (r = or.exec(n) ?? sr.exec(n), r && t.push({
|
|
1724
|
+
function: r[1] || "(anonymous)",
|
|
1725
|
+
filename: r[2],
|
|
1726
|
+
lineno: parseInt(r[3], 10),
|
|
1727
|
+
colno: parseInt(r[4], 10)
|
|
1728
|
+
}));
|
|
1741
1729
|
}
|
|
1742
1730
|
return t;
|
|
1743
1731
|
}, lr = "@odus/telemetry", ur = "0.0.1", dr, fr, pr, mr = () => {
|
|
@@ -1783,11 +1771,7 @@ var ir = function(e) {
|
|
|
1783
1771
|
Hr(e);
|
|
1784
1772
|
}, t);
|
|
1785
1773
|
}, Pr = (e) => {
|
|
1786
|
-
|
|
1787
|
-
J = { ...e };
|
|
1788
|
-
return;
|
|
1789
|
-
}
|
|
1790
|
-
J.items += e.items, J.rateLimitedMs += e.rateLimitedMs, J.since = Math.min(J.since, e.since);
|
|
1774
|
+
J ? (J.items += e.items, J.rateLimitedMs += e.rateLimitedMs, J.since = Math.min(J.since, e.since)) : J = { ...e };
|
|
1791
1775
|
}, Fr = (e, t = 0) => {
|
|
1792
1776
|
(e !== 0 || t !== 0) && Pr({
|
|
1793
1777
|
items: e,
|
|
@@ -1871,11 +1855,7 @@ var ir = function(e) {
|
|
|
1871
1855
|
}, Y = (e, t) => {
|
|
1872
1856
|
Or.push(e);
|
|
1873
1857
|
let n = t.batching?.itemLimit ?? Cr;
|
|
1874
|
-
|
|
1875
|
-
Hr(t);
|
|
1876
|
-
return;
|
|
1877
|
-
}
|
|
1878
|
-
Nr(t);
|
|
1858
|
+
Or.length >= n ? Hr(t) : Nr(t);
|
|
1879
1859
|
}, Ur = (e) => {
|
|
1880
1860
|
if (Or = [], Ar = 0, J = null, kr &&= (clearTimeout(kr), null), typeof document > "u") return;
|
|
1881
1861
|
jr && document.removeEventListener("visibilitychange", jr), Mr && window.removeEventListener("pagehide", Mr);
|
|
@@ -2052,7 +2032,7 @@ var ir = function(e) {
|
|
|
2052
2032
|
url: t,
|
|
2053
2033
|
app: {
|
|
2054
2034
|
name: "odus-checkout",
|
|
2055
|
-
version: "1.14.
|
|
2035
|
+
version: "1.14.8",
|
|
2056
2036
|
environment: e.environment === "test" ? "sandbox" : "production"
|
|
2057
2037
|
},
|
|
2058
2038
|
isolate: !0,
|
|
@@ -2387,20 +2367,15 @@ var ir = function(e) {
|
|
|
2387
2367
|
return;
|
|
2388
2368
|
}
|
|
2389
2369
|
let u = a?.data;
|
|
2390
|
-
if (
|
|
2370
|
+
if (u?.id) i === 303 ? this.patchCard(t, u.id).then((e) => {
|
|
2371
|
+
o(l), n(e);
|
|
2372
|
+
}).catch((e) => {
|
|
2373
|
+
r(c(e, s.CARD_UPDATE_FAILED, e instanceof Error ? e.message : "Patch failed", l));
|
|
2374
|
+
}) : (o(l), n(e.extractCardResult(u)));
|
|
2375
|
+
else {
|
|
2391
2376
|
let e = "Card creation failed: no card ID returned";
|
|
2392
2377
|
r(c(/* @__PURE__ */ Error(e), s.NO_CARD_ID, e, l, i));
|
|
2393
|
-
return;
|
|
2394
|
-
}
|
|
2395
|
-
if (i === 303) {
|
|
2396
|
-
this.patchCard(t, u.id).then((e) => {
|
|
2397
|
-
o(l), n(e);
|
|
2398
|
-
}).catch((e) => {
|
|
2399
|
-
r(c(e, s.CARD_UPDATE_FAILED, e instanceof Error ? e.message : "Patch failed", l));
|
|
2400
|
-
});
|
|
2401
|
-
return;
|
|
2402
2378
|
}
|
|
2403
|
-
o(l), n(e.extractCardResult(u));
|
|
2404
2379
|
}, (t) => {
|
|
2405
2380
|
r(c(t, e.isFieldValidationErrors(t) ? s.INVALID_INPUT : s.REQUEST_FAILED, t instanceof Error ? t.message : JSON.stringify(t), e.extractObservabilityMeta(t)));
|
|
2406
2381
|
});
|
|
@@ -2543,11 +2518,7 @@ var ir = function(e) {
|
|
|
2543
2518
|
this._outcome || (this._paymentId = e, this._beginStage(), this._startWait());
|
|
2544
2519
|
}
|
|
2545
2520
|
settle(e) {
|
|
2546
|
-
|
|
2547
|
-
this.ready();
|
|
2548
|
-
return;
|
|
2549
|
-
}
|
|
2550
|
-
this.fail({
|
|
2521
|
+
e.status === "ready" ? this.ready() : this.fail({
|
|
2551
2522
|
reason: e.reason,
|
|
2552
2523
|
attributes: e.attributes
|
|
2553
2524
|
});
|
|
@@ -2556,19 +2527,13 @@ var ir = function(e) {
|
|
|
2556
2527
|
this._outcome || this._mountedAt !== void 0 && this._associatedAt !== void 0 && this._finish(f.READY, m.NONE);
|
|
2557
2528
|
}
|
|
2558
2529
|
fail(e) {
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
...e.attributes,
|
|
2565
|
-
card_reason: e.reason
|
|
2566
|
-
}
|
|
2567
|
-
});
|
|
2568
|
-
return;
|
|
2530
|
+
this._outcome || (Ji.includes(e.reason) && Ni() ? this.exclude({
|
|
2531
|
+
reason: u.VGS_BLOCKED_BY_CSP,
|
|
2532
|
+
attributes: {
|
|
2533
|
+
...e.attributes,
|
|
2534
|
+
card_reason: e.reason
|
|
2569
2535
|
}
|
|
2570
|
-
|
|
2571
|
-
}
|
|
2536
|
+
}) : (this._beginStage(), this._finish(f.FAILED, m.OURS, e)));
|
|
2572
2537
|
}
|
|
2573
2538
|
exclude(e) {
|
|
2574
2539
|
this._outcome || (this._notOurs.delete(e.reason), this._notOurs.set(e.reason, e));
|