@odus/checkout 1.7.2 → 1.7.7
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 +89 -88
- package/dist/components/ComponentFactory.d.ts.map +1 -1
- package/dist/components/checkout/form/EmailField.d.ts +4 -0
- package/dist/components/checkout/form/EmailField.d.ts.map +1 -1
- package/dist/components/checkout/form/FormComponentManager.d.ts +2 -2
- package/dist/components/checkout/form/FormComponentManager.d.ts.map +1 -1
- package/dist/components/checkout/form/FormUIManager.d.ts +1 -0
- package/dist/components/checkout/form/FormUIManager.d.ts.map +1 -1
- package/dist/components/common/HelperText.d.ts +1 -0
- package/dist/components/common/HelperText.d.ts.map +1 -1
- package/dist/components/common/Input.d.ts +9 -0
- package/dist/components/common/Input.d.ts.map +1 -1
- package/dist/elements/EmailElement.d.ts +3 -0
- package/dist/elements/EmailElement.d.ts.map +1 -1
- package/dist/elements.es.js +9 -5
- package/dist/index.css +1 -1
- package/dist/services/telemetry/Telemetry.service.d.ts +18 -1
- package/dist/services/telemetry/Telemetry.service.d.ts.map +1 -1
- package/dist/shared.js +33 -12
- package/dist/utils/validation/createValidationSchema.d.ts +5 -0
- package/dist/utils/validation/createValidationSchema.d.ts.map +1 -1
- package/dist/utils/validation/emailValidator.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/package.json +0 -134
package/dist/checkout.es.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { A as e, C as t, D as n, E as r, G as i, H as a, I as o, J as s, K as c, L as l, M as u, N as d, O as f,
|
|
1
|
+
import { A as e, C as t, D as n, E as r, G as i, H as a, I as o, J as s, K as c, L as l, M as u, N as d, O as f, P as p, R as m, S as h, T as g, U as _, V as v, W as y, a as b, b as x, c as ee, f as S, h as C, j as te, k as ne, l as w, m as T, n as E, o as D, p as O, q as k, r as re, s as A, t as j, u as M, v as N, x as P, y as F, z as I } from "./shared.js";
|
|
2
2
|
//#region libs/checkout/src/utils/helpers/hasAddressConfiguration.util.ts
|
|
3
|
-
function
|
|
3
|
+
function L(e) {
|
|
4
4
|
if (!e) return !1;
|
|
5
5
|
let { billingFields: t, shippingFields: n } = e, r = t && Object.values(t).some((e) => e?.enabled), i = n && Object.values(n).some((e) => e?.enabled);
|
|
6
6
|
return !!(r || i);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function R(e) {
|
|
9
9
|
if (!e) return !1;
|
|
10
10
|
let { billingFields: t, shippingFields: n } = e, r = t?.firstName?.enabled && t?.lastName?.enabled, i = n?.firstName?.enabled && n?.lastName?.enabled;
|
|
11
11
|
return !!(r || i);
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region libs/checkout/src/components/checkout/form/AddressSection.ts
|
|
15
|
-
var
|
|
15
|
+
var z = /* @__PURE__ */ new Set(["US", "CA"]), B = class extends N {
|
|
16
16
|
inputs = /* @__PURE__ */ new Map();
|
|
17
17
|
type;
|
|
18
18
|
onChange;
|
|
@@ -103,7 +103,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
103
103
|
}
|
|
104
104
|
if (e.kind === "state") {
|
|
105
105
|
let e = this.createRow(["full"]);
|
|
106
|
-
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"),
|
|
106
|
+
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"), z.has(n.country)) {
|
|
107
107
|
let a = this.createStateSelect(n.state, r.state, i.state, this.stateStyles, n.country, t.state?.label);
|
|
108
108
|
this.inputs.set("state", a), e.appendChild(a.getElement());
|
|
109
109
|
} else {
|
|
@@ -119,7 +119,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
119
119
|
return t.className = `address-row address-row-${e.length === 1 ? "single" : "double"}`, t;
|
|
120
120
|
}
|
|
121
121
|
createInput(e, t, n, r, i, a, o, s) {
|
|
122
|
-
let c = `${this.type}Address.${e}`, l = new
|
|
122
|
+
let c = `${this.type}Address.${e}`, l = new M({
|
|
123
123
|
name: c,
|
|
124
124
|
error: !1,
|
|
125
125
|
errorMsg: void 0,
|
|
@@ -140,7 +140,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
140
140
|
let e = this.translationFunc("validation.maxLengthExceeded");
|
|
141
141
|
l.setError(!0, e.replace("{{max}}", String(s)));
|
|
142
142
|
} else l.setError(!1);
|
|
143
|
-
this.onChange(
|
|
143
|
+
this.onChange(P({
|
|
144
144
|
type: "input",
|
|
145
145
|
target: {
|
|
146
146
|
name: c,
|
|
@@ -150,7 +150,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
return l.addEventListener("blur", (e) => {
|
|
153
|
-
this.onBlur(
|
|
153
|
+
this.onBlur(P({
|
|
154
154
|
type: "blur",
|
|
155
155
|
target: {
|
|
156
156
|
name: c,
|
|
@@ -160,7 +160,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
160
160
|
}), l;
|
|
161
161
|
}
|
|
162
162
|
createCountrySelect(e, t, n, r, i, a) {
|
|
163
|
-
let o = `${this.type}Address.country`, s =
|
|
163
|
+
let o = `${this.type}Address.country`, s = C(i, this.locale), c = new w({
|
|
164
164
|
name: o,
|
|
165
165
|
error: !1,
|
|
166
166
|
errorMsg: void 0,
|
|
@@ -173,7 +173,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
173
173
|
onChange: (e) => {
|
|
174
174
|
c.setError(!1);
|
|
175
175
|
let t = e.target.value;
|
|
176
|
-
this.onChange(
|
|
176
|
+
this.onChange(P({
|
|
177
177
|
type: "change",
|
|
178
178
|
target: {
|
|
179
179
|
name: o,
|
|
@@ -183,7 +183,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
183
183
|
}
|
|
184
184
|
});
|
|
185
185
|
return c.addEventListener("blur", (e) => {
|
|
186
|
-
this.onBlur(
|
|
186
|
+
this.onBlur(P({
|
|
187
187
|
type: "blur",
|
|
188
188
|
target: {
|
|
189
189
|
name: o,
|
|
@@ -201,7 +201,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
203
|
if (!r && n && (this.stateRow.style.display = ""), r) return;
|
|
204
|
-
let i = this.inputs.get("state") instanceof w, a =
|
|
204
|
+
let i = this.inputs.get("state") instanceof w, a = z.has(e);
|
|
205
205
|
if (i && a) {
|
|
206
206
|
let t = this.inputs.get("state");
|
|
207
207
|
if (t instanceof w) {
|
|
@@ -220,7 +220,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
220
220
|
rebuildStateField(e) {
|
|
221
221
|
if (!this.stateRow || !this.stateStyles) return;
|
|
222
222
|
let t = this.inputs.get("state");
|
|
223
|
-
if (t && (t.getElement().remove(), this.inputs.delete("state")),
|
|
223
|
+
if (t && (t.getElement().remove(), this.inputs.delete("state")), z.has(e)) {
|
|
224
224
|
let t = this.createStateSelect("", void 0, void 0, this.stateStyles, e, this.stateFieldConfig?.label);
|
|
225
225
|
this.inputs.set("state", t), this.stateRow.appendChild(t.getElement());
|
|
226
226
|
} else {
|
|
@@ -232,7 +232,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
232
232
|
let e = this.inputs.get("state");
|
|
233
233
|
e && e.setValue("");
|
|
234
234
|
let t = `${this.type}Address.state`;
|
|
235
|
-
this.onChange(
|
|
235
|
+
this.onChange(P({
|
|
236
236
|
type: "input",
|
|
237
237
|
target: {
|
|
238
238
|
name: t,
|
|
@@ -253,7 +253,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
253
253
|
options: c,
|
|
254
254
|
autocomplete: "address-level1",
|
|
255
255
|
onChange: (e) => {
|
|
256
|
-
u.setError(!1), this.onChange(
|
|
256
|
+
u.setError(!1), this.onChange(P({
|
|
257
257
|
type: "change",
|
|
258
258
|
target: {
|
|
259
259
|
name: o,
|
|
@@ -263,7 +263,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
263
263
|
}
|
|
264
264
|
});
|
|
265
265
|
return u.addEventListener("blur", (e) => {
|
|
266
|
-
this.onBlur(
|
|
266
|
+
this.onBlur(P({
|
|
267
267
|
type: "blur",
|
|
268
268
|
target: {
|
|
269
269
|
name: o,
|
|
@@ -291,7 +291,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
291
291
|
this.stateFieldConfig = t.state;
|
|
292
292
|
let e = this.createRow(["full"]);
|
|
293
293
|
this.stateRow = e, this.stateStyles = o, this.currentCountry = n.country, t.state?.hiddenForCountries?.includes(n.country) && (e.style.display = "none");
|
|
294
|
-
let a =
|
|
294
|
+
let a = z.has(n.country), s = t.state?.label ?? this.translationFunc("address.state");
|
|
295
295
|
if (a) {
|
|
296
296
|
let t = this.createStateSelect(n.state, r.state, i.state, o, n.country, s);
|
|
297
297
|
this.inputs.set("state", t), e.appendChild(t.getElement());
|
|
@@ -349,7 +349,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
349
349
|
let e = this.inputs.values().next().value;
|
|
350
350
|
e && e.focus();
|
|
351
351
|
}
|
|
352
|
-
},
|
|
352
|
+
}, V = class {
|
|
353
353
|
input = null;
|
|
354
354
|
isVgsMode;
|
|
355
355
|
vgsWrapper = null;
|
|
@@ -371,10 +371,10 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
371
371
|
let i = document.createElement("label");
|
|
372
372
|
i.className = "input-label", i.textContent = t("cardholderNameLabel"), i.style.fontFamily = `"${e.styles.fontFamily}", sans-serif`, i.style.fontSize = `${e.styles.fontSize}px`, r.appendChild(i), this.wrapperElement.appendChild(r), this.vgsWrapper = document.createElement("div"), this.vgsWrapper.className = "vgs-wrap", this.vgsWrapper.style.position = "relative", this.vgsWrapper.style.borderRadius = `${n}px`, this.vgsWrapper.style.height = "38.5px", this.vgsWrapper.style.width = "100%", this.vgsWrapper.style.overflow = "hidden";
|
|
373
373
|
let a = document.createElement("div");
|
|
374
|
-
a.className = "vgs-field-skeleton", this.vgsWrapper.appendChild(a), 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
|
|
374
|
+
a.className = "vgs-field-skeleton", this.vgsWrapper.appendChild(a), 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 S({ visible: !1 }), this.wrapperElement.appendChild(this.vgsHelperText.getElement());
|
|
375
375
|
}
|
|
376
376
|
buildNativeLayout(e, t, n, r, i, a, o) {
|
|
377
|
-
this.input = new
|
|
377
|
+
this.input = new M({
|
|
378
378
|
name: "name",
|
|
379
379
|
label: a("cardholderNameLabel"),
|
|
380
380
|
error: !1,
|
|
@@ -445,7 +445,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
445
445
|
focus() {
|
|
446
446
|
this.isVgsMode || this.input?.focus();
|
|
447
447
|
}
|
|
448
|
-
},
|
|
448
|
+
}, H = class extends N {
|
|
449
449
|
constructor() {
|
|
450
450
|
super("div", ["skeleton-container"]), this.createSkeletonElements();
|
|
451
451
|
}
|
|
@@ -453,14 +453,14 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
453
453
|
this.appendChild(this.createPaymentMethodSkeleton()), this.appendChild(this.createPaymentSeparatorSkeleton());
|
|
454
454
|
}
|
|
455
455
|
createPaymentMethodSkeleton() {
|
|
456
|
-
let e =
|
|
456
|
+
let e = O.createDiv(["skeleton-field"]), t = O.createDiv(["skeleton", "skeleton-payment-method"]);
|
|
457
457
|
return e.appendChild(t), e;
|
|
458
458
|
}
|
|
459
459
|
createPaymentSeparatorSkeleton() {
|
|
460
|
-
let e =
|
|
460
|
+
let e = O.createDiv(["payment-separator_container"]), t = O.createDiv(["payment-separator__line"]), n = O.createDiv(["skeleton", "skeleton-separator-text"]), r = O.createDiv(["payment-separator__line"]);
|
|
461
461
|
return e.appendChild(t), e.appendChild(n), e.appendChild(r), e;
|
|
462
462
|
}
|
|
463
|
-
},
|
|
463
|
+
}, U = class extends N {
|
|
464
464
|
constructor(e) {
|
|
465
465
|
let { translationFunc: t, checkoutProfile: n } = e;
|
|
466
466
|
super("div", ["payment-separator"]);
|
|
@@ -471,7 +471,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
471
471
|
let o = document.createElement("span");
|
|
472
472
|
o.className = "payment-separator__line", r.appendChild(i), r.appendChild(a), r.appendChild(o);
|
|
473
473
|
}
|
|
474
|
-
},
|
|
474
|
+
}, W = class extends N {
|
|
475
475
|
paymentMethods;
|
|
476
476
|
paymentSeparator;
|
|
477
477
|
skeleton;
|
|
@@ -486,7 +486,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
488
488
|
let f = Object.entries(t.additionalPaymentMethods).filter(([e, t]) => {
|
|
489
|
-
let n = t.enabled, r = a
|
|
489
|
+
let n = t.enabled, r = !a || a[e] === !0, i = !t.countries || d && t.countries.includes(d);
|
|
490
490
|
return n && r && i;
|
|
491
491
|
}).sort((e, t) => e[1].order - t[1].order);
|
|
492
492
|
if (f.length === 0) {
|
|
@@ -506,7 +506,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
506
506
|
break;
|
|
507
507
|
case "applePay":
|
|
508
508
|
if (i && s && c) {
|
|
509
|
-
let e = t.appearance?.additionalPaymentMethods?.applePay, r = new
|
|
509
|
+
let e = t.appearance?.additionalPaymentMethods?.applePay, r = new re({
|
|
510
510
|
checkoutProfile: t,
|
|
511
511
|
formData: n,
|
|
512
512
|
onSubmit: i,
|
|
@@ -525,13 +525,13 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
525
525
|
console.warn(`[PaymentMethods] Unsupported payment method: ${e}`);
|
|
526
526
|
break;
|
|
527
527
|
}
|
|
528
|
-
this.paymentMethods.size > 0 && (this.paymentSeparator = new
|
|
528
|
+
this.paymentMethods.size > 0 && (this.paymentSeparator = new U({
|
|
529
529
|
translationFunc: o,
|
|
530
530
|
checkoutProfile: t
|
|
531
531
|
}), this.getElement().appendChild(this.paymentSeparator.getElement()));
|
|
532
532
|
}
|
|
533
533
|
renderSkeleton() {
|
|
534
|
-
this.skeleton = new
|
|
534
|
+
this.skeleton = new H(), this.getElement().appendChild(this.skeleton.getElement());
|
|
535
535
|
}
|
|
536
536
|
updateFormData(e) {
|
|
537
537
|
let t = this.paymentMethods.get("paypal");
|
|
@@ -542,7 +542,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
542
542
|
hasVisiblePaymentMethods() {
|
|
543
543
|
return this.paymentMethods.size > 0 && this.getElement().style.display !== "none";
|
|
544
544
|
}
|
|
545
|
-
},
|
|
545
|
+
}, G = 17, K = class extends N {
|
|
546
546
|
styles;
|
|
547
547
|
isHovered = !1;
|
|
548
548
|
constructor(e) {
|
|
@@ -550,7 +550,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
550
550
|
}
|
|
551
551
|
applyStyles() {
|
|
552
552
|
let e = this.getElement();
|
|
553
|
-
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 ===
|
|
553
|
+
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 === G ? "100vmax" : `${this.styles.borderRadius}px`, e.style.fontSize = `${this.styles.fontSize}px`, e.style.fontFamily = `${this.styles.fontFamily}, sans-serif`;
|
|
554
554
|
}
|
|
555
555
|
handleMouseEnter() {
|
|
556
556
|
this.isHovered = !0, this.applyStyles();
|
|
@@ -561,11 +561,11 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
561
561
|
setDisabled(e) {
|
|
562
562
|
return this.getElement().disabled = e, e ? (this.addClass("disabled"), this.removeClass("valid")) : (this.removeClass("disabled"), this.addClass("valid")), this.applyStyles(), this;
|
|
563
563
|
}
|
|
564
|
-
},
|
|
564
|
+
}, q = class {
|
|
565
565
|
button;
|
|
566
566
|
constructor(e) {
|
|
567
567
|
let { disabled: t, checkoutProfile: n, translationFunc: r } = e;
|
|
568
|
-
this.button = new
|
|
568
|
+
this.button = new K({
|
|
569
569
|
text: r(`buttonTexts.${n?.layout.actionButton.translationKey}`),
|
|
570
570
|
styles: {
|
|
571
571
|
backgroundColor: n.styles.buttonColor,
|
|
@@ -589,7 +589,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
589
589
|
appendTo(e) {
|
|
590
590
|
return this.button.appendTo(e), this;
|
|
591
591
|
}
|
|
592
|
-
},
|
|
592
|
+
}, J = class {
|
|
593
593
|
formElement;
|
|
594
594
|
focusManager;
|
|
595
595
|
translationFunc;
|
|
@@ -630,7 +630,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
630
630
|
createPaymentMethods(e, t, n = !1) {
|
|
631
631
|
try {
|
|
632
632
|
if (!e?.additionalPaymentMethods || Object.keys(e.additionalPaymentMethods).length === 0 || !Object.values(e.additionalPaymentMethods).some((e) => e.enabled)) return;
|
|
633
|
-
this.paymentMethods = new
|
|
633
|
+
this.paymentMethods = new W({
|
|
634
634
|
checkoutProfile: e,
|
|
635
635
|
formData: t,
|
|
636
636
|
supportedPaymentMethods: this.supportedPaymentMethods,
|
|
@@ -650,7 +650,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
650
650
|
createEmailField(e, t, n, r) {
|
|
651
651
|
try {
|
|
652
652
|
let i = e.layout.billingFields && Object.values(e.layout.billingFields).some((e) => e?.enabled) || e.layout.shippingFields && Object.values(e.layout.shippingFields).some((e) => e?.enabled);
|
|
653
|
-
this.emailField = new
|
|
653
|
+
this.emailField = new b({
|
|
654
654
|
value: t.email,
|
|
655
655
|
onChange: this.onChange,
|
|
656
656
|
onBlur: this.onBlur,
|
|
@@ -666,7 +666,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
666
666
|
}
|
|
667
667
|
createPhoneNumberField(e, t, n, r) {
|
|
668
668
|
let i = document.createElement("div");
|
|
669
|
-
this.phonePlaceholder = i, this.formElement.appendChild(i),
|
|
669
|
+
this.phonePlaceholder = i, this.formElement.appendChild(i), I().then(({ PhoneNumberField: a }) => {
|
|
670
670
|
i.isConnected && (this.phoneNumberField = new a({
|
|
671
671
|
value: t.phoneNumber ?? "",
|
|
672
672
|
onChange: this.onChange,
|
|
@@ -693,7 +693,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
693
693
|
this.cardSectionSkeleton = this.buildCardSkeleton(e), this.formElement.appendChild(this.cardSectionSkeleton);
|
|
694
694
|
return;
|
|
695
695
|
}
|
|
696
|
-
if (this.cardSection = new
|
|
696
|
+
if (this.cardSection = new D({
|
|
697
697
|
checkoutProfile: e,
|
|
698
698
|
cardNumber: t.cardNumber,
|
|
699
699
|
cardNumberError: n.cardNumber,
|
|
@@ -707,7 +707,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
707
707
|
onChange: this.onChange,
|
|
708
708
|
onBlur: this.onBlur,
|
|
709
709
|
onCardBrandChange: () => {
|
|
710
|
-
t.cardCvv && this.onBlur(
|
|
710
|
+
t.cardCvv && this.onBlur(P({
|
|
711
711
|
type: "blur",
|
|
712
712
|
target: {
|
|
713
713
|
name: "cardCvv",
|
|
@@ -740,7 +740,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
740
740
|
this.cardholderSectionSkeleton = this.buildCardholderSkeleton(e), this.formElement.appendChild(this.cardholderSectionSkeleton);
|
|
741
741
|
return;
|
|
742
742
|
}
|
|
743
|
-
if (this.cardholderSection = new
|
|
743
|
+
if (this.cardholderSection = new V({
|
|
744
744
|
value: t.name,
|
|
745
745
|
onChange: this.onChange,
|
|
746
746
|
onBlur: this.onBlur,
|
|
@@ -771,7 +771,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
771
771
|
zipCode: "",
|
|
772
772
|
country: ""
|
|
773
773
|
};
|
|
774
|
-
this.billingAddressSection = new
|
|
774
|
+
this.billingAddressSection = new B({
|
|
775
775
|
type: "billing",
|
|
776
776
|
title: this.translationFunc("address.billingTitle"),
|
|
777
777
|
checkoutProfile: e,
|
|
@@ -802,7 +802,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
802
802
|
zipCode: "",
|
|
803
803
|
country: ""
|
|
804
804
|
};
|
|
805
|
-
this.shippingAddressSection = new
|
|
805
|
+
this.shippingAddressSection = new B({
|
|
806
806
|
type: "shipping",
|
|
807
807
|
title: this.translationFunc("address.shippingTitle"),
|
|
808
808
|
checkoutProfile: e,
|
|
@@ -822,7 +822,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
822
822
|
}
|
|
823
823
|
createSubmitButton(e, t) {
|
|
824
824
|
try {
|
|
825
|
-
this.submitButton = new
|
|
825
|
+
this.submitButton = new q({
|
|
826
826
|
disabled: t,
|
|
827
827
|
checkoutProfile: e,
|
|
828
828
|
translationFunc: this.translationFunc
|
|
@@ -831,8 +831,8 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
831
831
|
throw console.error("Error creating submit button:", e), e;
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
|
-
updateEmailField(e, t, n) {
|
|
835
|
-
this.emailField && (this.emailField.setValue(e), this.emailField.setError(t, n));
|
|
834
|
+
updateEmailField(e, t, n, r) {
|
|
835
|
+
this.emailField && (this.emailField.setValue(e), this.emailField.setError(t, n), this.emailField.setSuggestion(r ?? null));
|
|
836
836
|
}
|
|
837
837
|
updatePhoneNumberField(e, t, n) {
|
|
838
838
|
this.phoneNumberField && (this.phoneNumberField.setValue(e), this.phoneNumberField.setError(t, n));
|
|
@@ -901,7 +901,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
901
901
|
async mountVgsFields(e) {
|
|
902
902
|
if (!this.vgsService || !this.cardSection) return;
|
|
903
903
|
await this.vgsService.whenReady();
|
|
904
|
-
let t = this.cardSection.getVgsContainerIds(), n = this.cardholderSection?.getVgsContainerId(), r = await
|
|
904
|
+
let t = this.cardSection.getVgsContainerIds(), n = this.cardholderSection?.getVgsContainerId(), r = await x(e.styles.fontFamily), i = this.cardSection.buildVgsFieldCss(e, r);
|
|
905
905
|
if (this.cardholderSection && i.cardholderName) {
|
|
906
906
|
let e = i.cardholderName;
|
|
907
907
|
typeof e.height == "string" && this.cardholderSection.setFieldHeight(e.height);
|
|
@@ -950,7 +950,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
950
950
|
}
|
|
951
951
|
this.billingAddressSection &&= (this.billingAddressSection.getElement().remove(), void 0), this.shippingAddressSection &&= (this.shippingAddressSection.getElement().remove(), void 0), this.submitButton &&= (this.submitButton.getElement().remove(), void 0), this.paymentMethods &&= (this.paymentMethods.getElement().remove(), void 0);
|
|
952
952
|
}
|
|
953
|
-
},
|
|
953
|
+
}, Y = class {
|
|
954
954
|
formManager;
|
|
955
955
|
focusManager;
|
|
956
956
|
onFormSubmit;
|
|
@@ -990,7 +990,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
990
990
|
clearTouchedFields() {
|
|
991
991
|
this.localTouchedFields.clear();
|
|
992
992
|
}
|
|
993
|
-
},
|
|
993
|
+
}, ie = class {
|
|
994
994
|
formManager;
|
|
995
995
|
checkoutProfile;
|
|
996
996
|
formElement;
|
|
@@ -1011,7 +1011,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
1011
1011
|
handleProfileStateChange = (e) => {
|
|
1012
1012
|
if (!e.isLoading) if (e.checkoutProfile) try {
|
|
1013
1013
|
if (e.checkoutProfile.styles?.fontFamily) try {
|
|
1014
|
-
let { cleanup: t } =
|
|
1014
|
+
let { cleanup: t } = h({ fontFamily: e.checkoutProfile.styles.fontFamily });
|
|
1015
1015
|
this.fontCleanup = t, this.formElement.style.fontFamily = e.checkoutProfile.styles.fontFamily;
|
|
1016
1016
|
} catch (e) {
|
|
1017
1017
|
console.error("Error loading Google Font:", e);
|
|
@@ -1025,7 +1025,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
1025
1025
|
else e.error && (console.error("NO profile found", e.error), this.onError(e.error), this.onLoadingChange(!1));
|
|
1026
1026
|
};
|
|
1027
1027
|
isFormDisabled() {
|
|
1028
|
-
let e = this.formManager.getFormState(), t = this.checkoutProfile.getState(), n = Object.keys(e.errors).filter((e) => e !== "billingAddress" && e !== "shippingAddress").length > 0, r = e.errors.billingAddress, i = r && typeof r == "object" ? Object.keys(r).length > 0 : !1, a = e.errors.shippingAddress, o = a && typeof a == "object" ? Object.keys(a).length > 0 : !1, s = n || i || o, c =
|
|
1028
|
+
let e = this.formManager.getFormState(), t = this.checkoutProfile.getState(), n = Object.keys(e.errors).filter((e) => e !== "billingAddress" && e !== "shippingAddress").length > 0, r = e.errors.billingAddress, i = r && typeof r == "object" ? Object.keys(r).length > 0 : !1, a = e.errors.shippingAddress, o = a && typeof a == "object" ? Object.keys(a).length > 0 : !1, s = n || i || o, c = R(t.checkoutProfile?.layout) ? !!(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: u, shippingFields: d } = t.checkoutProfile?.layout ?? {}, f = /* @__PURE__ */ new Set(["US", "CA"]), p = (e, t) => {
|
|
1029
1029
|
if (!e) return !0;
|
|
1030
1030
|
let n = t?.country ?? "";
|
|
1031
1031
|
return Object.entries(e).every(([e, r]) => !r?.enabled || e === "state" && (!f.has(n) || r.hiddenForCountries?.includes(n)) ? !0 : !!t?.[e]?.trim());
|
|
@@ -1058,12 +1058,12 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
1058
1058
|
cleanup() {
|
|
1059
1059
|
this.fontCleanup &&= (this.fontCleanup(), void 0);
|
|
1060
1060
|
}
|
|
1061
|
-
},
|
|
1061
|
+
}, ae = class extends N {
|
|
1062
1062
|
titleElement;
|
|
1063
1063
|
constructor(e = {}) {
|
|
1064
1064
|
super("div", ["blur-bg"]);
|
|
1065
|
-
let t =
|
|
1066
|
-
this.titleElement = new
|
|
1065
|
+
let t = O.createDiv(["loader"]);
|
|
1066
|
+
this.titleElement = new N("h3", ["title"]), this.titleElement.setText(e.text || ""), this.appendChild(t), this.appendChild(this.titleElement);
|
|
1067
1067
|
}
|
|
1068
1068
|
setText(e) {
|
|
1069
1069
|
return this.titleElement.setText(e), this;
|
|
@@ -1084,10 +1084,11 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
1084
1084
|
n[i] = e[t];
|
|
1085
1085
|
}
|
|
1086
1086
|
}), n;
|
|
1087
|
-
},
|
|
1087
|
+
}, oe = class {
|
|
1088
1088
|
formElement;
|
|
1089
1089
|
componentManager;
|
|
1090
1090
|
onLoadingStateChange;
|
|
1091
|
+
validationSchema = p();
|
|
1091
1092
|
spinner;
|
|
1092
1093
|
formSkeleton;
|
|
1093
1094
|
alert;
|
|
@@ -1095,17 +1096,17 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
1095
1096
|
this.formElement = e.formElement, this.componentManager = e.componentManager, this.onLoadingStateChange = e.onLoadingStateChange;
|
|
1096
1097
|
}
|
|
1097
1098
|
updateFormUI(e, t) {
|
|
1098
|
-
this.componentManager.updatePaymentMethods(e.formData), this.componentManager.updateEmailField(e.formData.email, !!(e.errors.email && e.touched.email), e.errors.email), this.componentManager.updatePhoneNumberField(e.formData.phoneNumber ?? "", !!(e.errors.phoneNumber && e.touched.phoneNumber), e.errors.phoneNumber), this.componentManager.updateCardSection(e.formData.cardNumber, e.errors.cardNumber, !!e.touched.cardNumber, e.formData.cardCvv, e.errors.cardCvv, !!e.touched.cardCvv, e.formData.cardExpiry, e.errors.cardExpiry, !!e.touched.cardExpiry), this.componentManager.updateCardholderSection(e.formData.name, !!(e.errors.name && e.touched.name), e.errors.name), this.componentManager.updateBillingAddressSection(e.formData.billingAddress ?? X, e.errors.billingAddress ?? {}, Z(e.touched, "billingAddress")), this.componentManager.updateShippingAddressSection(e.formData.shippingAddress ?? X, e.errors.shippingAddress ?? {}, Z(e.touched, "shippingAddress")), this.componentManager.updateSubmitButton(t);
|
|
1099
|
+
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.updateCardSection(e.formData.cardNumber, e.errors.cardNumber, !!e.touched.cardNumber, e.formData.cardCvv, e.errors.cardCvv, !!e.touched.cardCvv, e.formData.cardExpiry, e.errors.cardExpiry, !!e.touched.cardExpiry), this.componentManager.updateCardholderSection(e.formData.name, !!(e.errors.name && e.touched.name), e.errors.name), this.componentManager.updateBillingAddressSection(e.formData.billingAddress ?? X, e.errors.billingAddress ?? {}, Z(e.touched, "billingAddress")), this.componentManager.updateShippingAddressSection(e.formData.shippingAddress ?? X, e.errors.shippingAddress ?? {}, Z(e.touched, "shippingAddress")), this.componentManager.updateSubmitButton(t);
|
|
1099
1100
|
}
|
|
1100
1101
|
setLoadingState(e) {
|
|
1101
1102
|
if (this.onLoadingStateChange) {
|
|
1102
1103
|
this.onLoadingStateChange(e);
|
|
1103
1104
|
return;
|
|
1104
1105
|
}
|
|
1105
|
-
e ? (this.hideSkeleton(), this.formSkeleton = new
|
|
1106
|
+
e ? (this.hideSkeleton(), this.formSkeleton = new H(), this.formElement.appendChild(this.formSkeleton.getElement())) : this.hideSkeleton();
|
|
1106
1107
|
}
|
|
1107
1108
|
showSpinner(e) {
|
|
1108
|
-
this.hideSpinner(), this.spinner = new
|
|
1109
|
+
this.hideSpinner(), this.spinner = new ae({ text: e }), this.formElement.appendChild(this.spinner.getElement());
|
|
1109
1110
|
}
|
|
1110
1111
|
hideSpinner() {
|
|
1111
1112
|
this.spinner &&= (this.spinner.getElement().remove(), void 0);
|
|
@@ -1114,7 +1115,7 @@ var R = /* @__PURE__ */ new Set(["US", "CA"]), z = class extends M {
|
|
|
1114
1115
|
this.formSkeleton &&= (this.formSkeleton.getElement().remove(), void 0);
|
|
1115
1116
|
}
|
|
1116
1117
|
setErrorMessage(e) {
|
|
1117
|
-
this.alert &&= (this.alert.getElement().remove(), void 0), this.alert = new
|
|
1118
|
+
this.alert &&= (this.alert.getElement().remove(), void 0), this.alert = new j({ message: e }), this.formElement.insertBefore(this.alert.getElement(), this.formElement.firstChild);
|
|
1118
1119
|
}
|
|
1119
1120
|
clearErrorMessage() {
|
|
1120
1121
|
this.alert &&= (this.alert.getElement().remove(), void 0);
|
|
@@ -1133,12 +1134,12 @@ var Q = (e) => ({
|
|
|
1133
1134
|
zipCode: "",
|
|
1134
1135
|
country: "",
|
|
1135
1136
|
...e
|
|
1136
|
-
}),
|
|
1137
|
+
}), se = class extends N {
|
|
1137
1138
|
options;
|
|
1138
1139
|
formManager = d();
|
|
1139
1140
|
checkoutProfile;
|
|
1140
1141
|
translation = t();
|
|
1141
|
-
focusManager = new
|
|
1142
|
+
focusManager = new F();
|
|
1142
1143
|
componentManager;
|
|
1143
1144
|
eventHandler;
|
|
1144
1145
|
stateCoordinator;
|
|
@@ -1147,7 +1148,7 @@ var Q = (e) => ({
|
|
|
1147
1148
|
vgsJwt;
|
|
1148
1149
|
vgsCardResult;
|
|
1149
1150
|
constructor(e) {
|
|
1150
|
-
super("form", ["form-container"]), this.options = e, this.vgsJwt = e.vgsJwt, this.vgsJwt && (this.vgsService = new l()), this.checkoutProfile = o({ appearance: e.appearance }), e.locale && this.translation.setLocale(e.locale), this.componentManager = new
|
|
1151
|
+
super("form", ["form-container"]), this.options = e, this.vgsJwt = e.vgsJwt, this.vgsJwt && (this.vgsService = new l()), this.checkoutProfile = o({ appearance: e.appearance }), e.locale && this.translation.setLocale(e.locale), this.componentManager = new J({
|
|
1151
1152
|
formElement: this.element,
|
|
1152
1153
|
focusManager: this.focusManager,
|
|
1153
1154
|
translationFunc: this.translation.t,
|
|
@@ -1164,11 +1165,11 @@ var Q = (e) => ({
|
|
|
1164
1165
|
environment: e.environment,
|
|
1165
1166
|
vgsService: this.vgsService,
|
|
1166
1167
|
onVgsStateChange: (e) => this.handleVgsStateChange(e)
|
|
1167
|
-
}), this.uiManager = new
|
|
1168
|
+
}), this.uiManager = new oe({
|
|
1168
1169
|
formElement: this.element,
|
|
1169
1170
|
componentManager: this.componentManager,
|
|
1170
1171
|
onLoadingStateChange: e.onLoadingStateChange
|
|
1171
|
-
}), this.stateCoordinator = new
|
|
1172
|
+
}), this.stateCoordinator = new ie({
|
|
1172
1173
|
formManager: this.formManager,
|
|
1173
1174
|
checkoutProfile: this.checkoutProfile,
|
|
1174
1175
|
componentManager: this.componentManager,
|
|
@@ -1178,7 +1179,7 @@ var Q = (e) => ({
|
|
|
1178
1179
|
onError: (e) => this.uiManager.setErrorMessage(e),
|
|
1179
1180
|
onLoadingChange: (e) => this.uiManager.setLoadingState(e),
|
|
1180
1181
|
getInitialFormData: () => this._getFormStateData().formData
|
|
1181
|
-
}), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new
|
|
1182
|
+
}), this.vgsService && this.stateCoordinator.setVgsMode(!0), this.eventHandler = new Y({
|
|
1182
1183
|
formManager: this.formManager,
|
|
1183
1184
|
focusManager: this.focusManager,
|
|
1184
1185
|
onFormSubmit: async () => this.handleSubmit(),
|
|
@@ -1228,7 +1229,7 @@ var Q = (e) => ({
|
|
|
1228
1229
|
phoneNumber: "",
|
|
1229
1230
|
phoneCountryCode: e.checkoutProfile.layout.phoneNumber.defaultCountry?.toUpperCase() || "US"
|
|
1230
1231
|
}), e.checkoutProfile.layout.billingFields && this.formManager.getFormState().formData.billingAddress === void 0 && this.formManager.setFormData({ billingAddress: Q() }), e.checkoutProfile.layout.shippingFields && this.formManager.getFormState().formData.shippingAddress === void 0 && this.formManager.setFormData({ shippingAddress: Q() });
|
|
1231
|
-
let { formData: t, errors: n, touched: r } = this._getFormStateData(), i =
|
|
1232
|
+
let { formData: t, errors: n, touched: r } = this._getFormStateData(), i = L(e.checkoutProfile.layout);
|
|
1232
1233
|
try {
|
|
1233
1234
|
this.componentManager.createPaymentMethods(e.checkoutProfile, t);
|
|
1234
1235
|
} catch (e) {
|
|
@@ -1261,7 +1262,7 @@ var Q = (e) => ({
|
|
|
1261
1262
|
} catch (e) {
|
|
1262
1263
|
console.error("Failed to create card section:", e);
|
|
1263
1264
|
}
|
|
1264
|
-
if (!
|
|
1265
|
+
if (!R(e.checkoutProfile.layout)) try {
|
|
1265
1266
|
this.componentManager.createCardholderSection(e.checkoutProfile, t, n, r);
|
|
1266
1267
|
} catch (e) {
|
|
1267
1268
|
console.error("Failed to create cardholder section:", e);
|
|
@@ -1281,7 +1282,7 @@ var Q = (e) => ({
|
|
|
1281
1282
|
}
|
|
1282
1283
|
inferCardholderName() {
|
|
1283
1284
|
let e = this.checkoutProfile.getState();
|
|
1284
|
-
if (!e.checkoutProfile || !
|
|
1285
|
+
if (!e.checkoutProfile || !R(e.checkoutProfile.layout)) return;
|
|
1285
1286
|
let { formData: t } = this._getFormStateData(), n = t.billingAddress ?? t.shippingAddress;
|
|
1286
1287
|
if (!n) return;
|
|
1287
1288
|
let r = [n.firstName?.trim() ?? "", n.lastName?.trim() ?? ""].filter(Boolean).join(" ");
|
|
@@ -1367,7 +1368,7 @@ var Q = (e) => ({
|
|
|
1367
1368
|
this.componentManager.createPaymentMethods(a.checkoutProfile, e, !0);
|
|
1368
1369
|
}
|
|
1369
1370
|
}
|
|
1370
|
-
},
|
|
1371
|
+
}, ce = class {
|
|
1371
1372
|
container = null;
|
|
1372
1373
|
options;
|
|
1373
1374
|
onSubmit;
|
|
@@ -1391,7 +1392,7 @@ var Q = (e) => ({
|
|
|
1391
1392
|
}
|
|
1392
1393
|
}
|
|
1393
1394
|
renderForm(e) {
|
|
1394
|
-
this.container && (this.form &&= (this.form.destroy(), null), this.form = new
|
|
1395
|
+
this.container && (this.form &&= (this.form.destroy(), null), this.form = new se({
|
|
1395
1396
|
apiKey: this.options.apiKey,
|
|
1396
1397
|
onSubmit: this.onSubmit,
|
|
1397
1398
|
locale: this.options.locale,
|
|
@@ -1420,7 +1421,7 @@ var Q = (e) => ({
|
|
|
1420
1421
|
async associatePayment(e, t, n, r, i) {
|
|
1421
1422
|
this.options.paymentId = e, this.options.checkoutKey = t, this.options.checkoutDetails = r, this.options.vgsJwt = i, this.form && this.form.associatePayment(e, t, n, r, i);
|
|
1422
1423
|
}
|
|
1423
|
-
},
|
|
1424
|
+
}, le = class {
|
|
1424
1425
|
state;
|
|
1425
1426
|
listeners = /* @__PURE__ */ new Set();
|
|
1426
1427
|
constructor(e) {
|
|
@@ -1444,7 +1445,7 @@ var Q = (e) => ({
|
|
|
1444
1445
|
let e = this.getState();
|
|
1445
1446
|
this.listeners.forEach((t) => t(e));
|
|
1446
1447
|
}
|
|
1447
|
-
},
|
|
1448
|
+
}, ue = "en", $ = class {
|
|
1448
1449
|
config;
|
|
1449
1450
|
_callbacks;
|
|
1450
1451
|
paymentState;
|
|
@@ -1453,13 +1454,13 @@ var Q = (e) => ({
|
|
|
1453
1454
|
stateManager;
|
|
1454
1455
|
sessionId;
|
|
1455
1456
|
constructor(e) {
|
|
1456
|
-
this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(),
|
|
1457
|
+
this.config = this.validateConfig(e), this._callbacks = { ...this.config.callbacks }, this.paymentState = {}, this.sessionId = crypto.randomUUID(), v({
|
|
1457
1458
|
environment: this.config.environment,
|
|
1458
1459
|
sessionId: this.sessionId
|
|
1459
|
-
}),
|
|
1460
|
+
}), _(c.CHECKOUT_INITIALIZED, { environment: this.config.environment }), this.apiService = new m(this.config.apiKey, this.config.environment), this.stateManager = new le({
|
|
1460
1461
|
mounted: !1,
|
|
1461
1462
|
form: null
|
|
1462
|
-
}), this.formManager = new
|
|
1463
|
+
}), this.formManager = new ce({
|
|
1463
1464
|
locale: this.config.locale,
|
|
1464
1465
|
apiKey: this.config.apiKey,
|
|
1465
1466
|
disableErrorMessages: this.config.disableErrorMessages,
|
|
@@ -1476,7 +1477,7 @@ var Q = (e) => ({
|
|
|
1476
1477
|
apiKey: e.apiKey,
|
|
1477
1478
|
returnUrl: e.returnUrl,
|
|
1478
1479
|
environment: e.environment,
|
|
1479
|
-
locale: e.locale ||
|
|
1480
|
+
locale: e.locale || ue,
|
|
1480
1481
|
disableErrorMessages: e.disableErrorMessages ?? !1,
|
|
1481
1482
|
manualActionHandling: e.manualActionHandling ?? !1,
|
|
1482
1483
|
appearance: e.appearance,
|
|
@@ -1496,7 +1497,7 @@ var Q = (e) => ({
|
|
|
1496
1497
|
return t.appendChild(n), this.stateManager.updateState({
|
|
1497
1498
|
form: n,
|
|
1498
1499
|
mounted: !0
|
|
1499
|
-
}), this.formManager.mount(n),
|
|
1500
|
+
}), this.formManager.mount(n), _(c.CHECKOUT_MOUNTED, { container_id: e }), this;
|
|
1500
1501
|
}
|
|
1501
1502
|
unmount() {
|
|
1502
1503
|
let { mounted: e } = this.stateManager.getState();
|
|
@@ -1506,13 +1507,13 @@ var Q = (e) => ({
|
|
|
1506
1507
|
e && e.remove(), this.stateManager.updateState({
|
|
1507
1508
|
form: null,
|
|
1508
1509
|
mounted: !1
|
|
1509
|
-
}),
|
|
1510
|
+
}), _(c.CHECKOUT_UNMOUNTED);
|
|
1510
1511
|
});
|
|
1511
1512
|
}
|
|
1512
1513
|
async handleSubmit({ formData: e, applePayData: t }) {
|
|
1513
1514
|
if (!this.paymentState.paymentId || !this.paymentState.checkoutKey) throw Error("Payment must be associated before submitting. Call associatePayment() first.");
|
|
1514
1515
|
let n = this.getPaymentMethod(e, t);
|
|
1515
|
-
|
|
1516
|
+
_(c.PAYMENT_SUBMIT_STARTED, {
|
|
1516
1517
|
payment_id: this.paymentState.paymentId,
|
|
1517
1518
|
payment_method: n
|
|
1518
1519
|
});
|
|
@@ -1525,21 +1526,21 @@ var Q = (e) => ({
|
|
|
1525
1526
|
returnUrl: this.config.returnUrl,
|
|
1526
1527
|
applePayData: t
|
|
1527
1528
|
}), o = performance.now() - r;
|
|
1528
|
-
i(
|
|
1529
|
+
i(k.PAYMENT_AUTHORIZATION_TIME, o, "ms", {
|
|
1529
1530
|
payment_id: this.paymentState.paymentId,
|
|
1530
1531
|
payment_method: n,
|
|
1531
1532
|
status: "success"
|
|
1532
|
-
}),
|
|
1533
|
+
}), _(c.PAYMENT_SUBMIT_SUCCESS, {
|
|
1533
1534
|
payment_id: this.paymentState.paymentId,
|
|
1534
1535
|
payment_method: n
|
|
1535
1536
|
}), this.handlePaymentResponse(a);
|
|
1536
1537
|
} catch (e) {
|
|
1537
1538
|
let t = performance.now() - r;
|
|
1538
|
-
i(
|
|
1539
|
+
i(k.PAYMENT_AUTHORIZATION_TIME, t, "ms", {
|
|
1539
1540
|
payment_id: this.paymentState.paymentId,
|
|
1540
1541
|
payment_method: n,
|
|
1541
1542
|
status: "failed"
|
|
1542
|
-
}),
|
|
1543
|
+
}), _(c.PAYMENT_SUBMIT_FAILED, {
|
|
1543
1544
|
payment_id: this.paymentState.paymentId,
|
|
1544
1545
|
payment_method: n,
|
|
1545
1546
|
error_message: e.details?.message ?? "Unknown error"
|
|
@@ -1547,15 +1548,15 @@ var Q = (e) => ({
|
|
|
1547
1548
|
}
|
|
1548
1549
|
}
|
|
1549
1550
|
handlePaymentResponse(e) {
|
|
1550
|
-
if (e.latestTransaction.status === "authorized" && (
|
|
1551
|
+
if (e.latestTransaction.status === "authorized" && (_(c.PAYMENT_AUTHORIZED, {
|
|
1551
1552
|
payment_id: this.paymentState.paymentId ?? "",
|
|
1552
1553
|
status: e.latestTransaction.status
|
|
1553
|
-
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status)), e.latestTransaction.status === "failed" && (
|
|
1554
|
+
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status)), e.latestTransaction.status === "failed" && (_(c.PAYMENT_FAILED, {
|
|
1554
1555
|
payment_id: this.paymentState.paymentId ?? "",
|
|
1555
1556
|
status: e.latestTransaction.status
|
|
1556
1557
|
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status)), e.status === "requires_action") {
|
|
1557
1558
|
let { redirectUrl: t } = e.action;
|
|
1558
|
-
|
|
1559
|
+
_(c.PAYMENT_ACTION_REQUIRED, {
|
|
1559
1560
|
payment_id: this.paymentState.paymentId ?? "",
|
|
1560
1561
|
status: e.status
|
|
1561
1562
|
}), this.config.manualActionHandling ? this._callbacks.onActionRequired?.(t) : globalThis.location.href = t;
|
|
@@ -1604,13 +1605,13 @@ var Q = (e) => ({
|
|
|
1604
1605
|
countryCode: n.countryCode
|
|
1605
1606
|
};
|
|
1606
1607
|
let r = n.supportedPaymentMethods.reduce((e, t) => (e[t] = !0, e), {});
|
|
1607
|
-
await this.formManager.associatePayment(e, t, r, this.paymentState.checkoutDetails, n.vgsJwt),
|
|
1608
|
+
await this.formManager.associatePayment(e, t, r, this.paymentState.checkoutDetails, n.vgsJwt), _(c.PAYMENT_ASSOCIATED, {
|
|
1608
1609
|
payment_id: e,
|
|
1609
1610
|
currency: n.currency,
|
|
1610
1611
|
country_code: n.countryCode
|
|
1611
1612
|
});
|
|
1612
1613
|
} catch (t) {
|
|
1613
|
-
throw
|
|
1614
|
+
throw _(c.PAYMENT_ASSOCIATION_FAILED, {
|
|
1614
1615
|
payment_id: e,
|
|
1615
1616
|
error_message: t instanceof Error ? t.message : "Unknown error"
|
|
1616
1617
|
}), a(t instanceof Error ? t : /* @__PURE__ */ Error("Failed to associate payment"), { payment_id: e }), t;
|
|
@@ -1624,4 +1625,4 @@ var Q = (e) => ({
|
|
|
1624
1625
|
//#region libs/checkout/src/index.ts
|
|
1625
1626
|
typeof globalThis < "u" && (globalThis.OdusCheckout = $);
|
|
1626
1627
|
//#endregion
|
|
1627
|
-
export { $ as OdusCheckout, u as deLocale,
|
|
1628
|
+
export { $ as OdusCheckout, u as deLocale, te as enLocale, e as esLocale, ne as frLocale, f as itLocale, n as plLocale, r as ptLocale, a as pushError, _ as pushEvent, y as pushLog, i as pushMeasurement, g as trLocale };
|