@odus/checkout 0.3.0 → 0.5.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 +81 -77
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/checkout.es.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
const L = (n) => n === "test" ? "https://sandbox-api.odus.com" : n === "live" ? "https://api.odus.com" : "http://localhost:3000"
|
|
2
|
-
const [e, ...t] = n?.split(" ") || [], [a] = t.reverse();
|
|
3
|
-
return { firstName: e, lastName: a };
|
|
4
|
-
};
|
|
1
|
+
const L = (n) => n === "test" ? "https://sandbox-api.odus.com" : n === "live" ? "https://api.odus.com" : "http://localhost:3000";
|
|
5
2
|
class $ {
|
|
6
3
|
apiKey;
|
|
7
4
|
baseUrl;
|
|
@@ -60,7 +57,7 @@ class $ {
|
|
|
60
57
|
}) {
|
|
61
58
|
let r = {};
|
|
62
59
|
if (i && a) {
|
|
63
|
-
const o = a.cardExpiry.replace(/\s+/g, "").split("/"), l = o[0], c = o[1]
|
|
60
|
+
const o = a.cardExpiry.replace(/\s+/g, "").split("/"), l = o[0], c = o[1];
|
|
64
61
|
r = {
|
|
65
62
|
paymentMethodData: {
|
|
66
63
|
type: "card",
|
|
@@ -73,8 +70,7 @@ class $ {
|
|
|
73
70
|
},
|
|
74
71
|
customerData: {
|
|
75
72
|
email: a.email,
|
|
76
|
-
|
|
77
|
-
lastName: m
|
|
73
|
+
name: a.name
|
|
78
74
|
},
|
|
79
75
|
context: {
|
|
80
76
|
returnUrl: s,
|
|
@@ -238,7 +234,7 @@ function H({
|
|
|
238
234
|
reload: i
|
|
239
235
|
};
|
|
240
236
|
}
|
|
241
|
-
const
|
|
237
|
+
const I = {
|
|
242
238
|
cardNumber: (n) => (n.replace(/\s/g, "").match(/.{1,4}/g) || []).join(" "),
|
|
243
239
|
cardExpiry: (n) => {
|
|
244
240
|
const t = n.replace(/\D/g, "").slice(0, 4);
|
|
@@ -433,10 +429,10 @@ const T = {
|
|
|
433
429
|
const a = t.replace(/\s/g, ""), [i, s] = a.split("/").map((m) => m.trim());
|
|
434
430
|
if (!i || !s || i.length !== 2 || s.length !== 2)
|
|
435
431
|
return n("validation.cardExpiryFormat");
|
|
436
|
-
const r = /* @__PURE__ */ new Date(), o = r.getFullYear() % 100, l = r.getMonth() + 1, c = parseInt(i, 10),
|
|
432
|
+
const r = /* @__PURE__ */ new Date(), o = r.getFullYear() % 100, l = r.getMonth() + 1, c = parseInt(i, 10), d = parseInt(s, 10);
|
|
437
433
|
if (c < 1 || c > 12)
|
|
438
434
|
return n("validation.cardExpiryFormat");
|
|
439
|
-
if (
|
|
435
|
+
if (d < o || d === o && c < l)
|
|
440
436
|
return n("validation.cardExpiryInvalid");
|
|
441
437
|
}
|
|
442
438
|
};
|
|
@@ -455,26 +451,26 @@ const T = {
|
|
|
455
451
|
},
|
|
456
452
|
isValid: !1
|
|
457
453
|
}), t = (l, c) => {
|
|
458
|
-
const
|
|
459
|
-
return
|
|
454
|
+
const d = n[l];
|
|
455
|
+
return d?.(c);
|
|
460
456
|
}, a = (l) => {
|
|
461
457
|
const c = {};
|
|
462
|
-
return Object.keys(l).forEach((
|
|
463
|
-
const m = t(
|
|
464
|
-
m && (c[
|
|
458
|
+
return Object.keys(l).forEach((d) => {
|
|
459
|
+
const m = t(d, l[d]);
|
|
460
|
+
m && (c[d] = m);
|
|
465
461
|
}), c;
|
|
466
462
|
}, i = (l) => {
|
|
467
463
|
const c = a(l);
|
|
468
464
|
return Object.keys(c).length === 0;
|
|
469
465
|
}, s = (l, c) => {
|
|
470
|
-
const
|
|
466
|
+
const d = e.getState();
|
|
471
467
|
let m = c;
|
|
472
|
-
l in
|
|
468
|
+
l in I && (m = I[l](c));
|
|
473
469
|
const u = {
|
|
474
|
-
...
|
|
470
|
+
...d.formData,
|
|
475
471
|
[l]: m
|
|
476
|
-
}, p = { ...
|
|
477
|
-
if (
|
|
472
|
+
}, p = { ...d.errors };
|
|
473
|
+
if (d.touched[l]) {
|
|
478
474
|
const f = t(l, m);
|
|
479
475
|
f ? p[l] = f : delete p[l];
|
|
480
476
|
}
|
|
@@ -484,22 +480,22 @@ const T = {
|
|
|
484
480
|
isValid: i(u)
|
|
485
481
|
});
|
|
486
482
|
}, r = (l, c) => {
|
|
487
|
-
const
|
|
488
|
-
...
|
|
483
|
+
const d = e.getState(), m = {
|
|
484
|
+
...d.touched,
|
|
489
485
|
[l]: !0
|
|
490
|
-
}, u = t(l, c), p = { ...
|
|
486
|
+
}, u = t(l, c), p = { ...d.errors };
|
|
491
487
|
u ? p[l] = u : delete p[l], e.setState({
|
|
492
488
|
touched: m,
|
|
493
489
|
errors: p
|
|
494
490
|
});
|
|
495
491
|
}, o = (l) => {
|
|
496
|
-
const
|
|
492
|
+
const d = {
|
|
497
493
|
...e.getState().formData,
|
|
498
494
|
...l
|
|
499
495
|
};
|
|
500
496
|
e.setState({
|
|
501
|
-
formData:
|
|
502
|
-
isValid: i(
|
|
497
|
+
formData: d,
|
|
498
|
+
isValid: i(d)
|
|
503
499
|
});
|
|
504
500
|
};
|
|
505
501
|
return {
|
|
@@ -630,7 +626,7 @@ function Z({
|
|
|
630
626
|
n && o();
|
|
631
627
|
const c = () => {
|
|
632
628
|
r && (r.remove(), r = null);
|
|
633
|
-
},
|
|
629
|
+
}, d = async (m) => {
|
|
634
630
|
r && (r.on("tokenize", async function(u) {
|
|
635
631
|
await m(u);
|
|
636
632
|
}), r.tokenize());
|
|
@@ -638,7 +634,7 @@ function Z({
|
|
|
638
634
|
return {
|
|
639
635
|
getState: s.getState.bind(s),
|
|
640
636
|
subscribe: s.subscribe.bind(s),
|
|
641
|
-
tokenize:
|
|
637
|
+
tokenize: d,
|
|
642
638
|
cleanup: c
|
|
643
639
|
};
|
|
644
640
|
}
|
|
@@ -669,15 +665,15 @@ const J = "E-Mail", W = "Name des/der Karteninhaber/in", X = "Kartendaten", Q =
|
|
|
669
665
|
loading: Ee,
|
|
670
666
|
buttonTexts: be,
|
|
671
667
|
validation: Ce
|
|
672
|
-
}, xe = "E-mail", Fe = "Nom du titulaire de la carte", we = "Informations de la carte", Le = "Nom complet figurant sur la carte", Me = "MM / AA", ke = "Veuillez ne pas fermer cette fenêtre",
|
|
668
|
+
}, xe = "E-mail", Fe = "Nom du titulaire de la carte", we = "Informations de la carte", Le = "Nom complet figurant sur la carte", Me = "MM / AA", ke = "Veuillez ne pas fermer cette fenêtre", Ie = { pay: "PAYER", submit: "ENVOYER", getPlan: "OBTENIR MON PLAN", donate: "FAIRE UN DON", book: "RÉSERVER MAINTENANT", order: "COMMANDER MAINTENANT" }, Te = { emailSuggestion: "Vouliez-vous dire {{email}}?", emailInvalid: "Votre adresse e-mail n’est pas valide", cardExpiryInvalid: "La date d'expiration de votre carte est dans le passé", cardExpiryFormat: "La date d’expiration de votre carte est incomplète", cardSecurityFormat: "Le code de sécurité de votre carte est incomplet", nameRequired: "Veuillez saisir le nom tel qu’il figure sur votre carte", cardNumberInvalid: "Votre numéro de carte est invalide" }, Ne = {
|
|
673
669
|
email: xe,
|
|
674
670
|
cardholderNameLabel: Fe,
|
|
675
671
|
cardInformation: we,
|
|
676
672
|
cardholderNamePlaceholder: Le,
|
|
677
673
|
cardExpiry: Me,
|
|
678
674
|
loading: ke,
|
|
679
|
-
buttonTexts:
|
|
680
|
-
validation:
|
|
675
|
+
buttonTexts: Ie,
|
|
676
|
+
validation: Te
|
|
681
677
|
}, ze = "Email", Pe = "Nome del titolare della carta", Ae = "Informazioni sulla carta", De = "Nome completo sulla carta", $e = "MM / AA", Ve = "Non chiudere la finestra", Re = { pay: "PAGA", submit: "INVIA", getPlan: "OTTIENI IL MIO PIANO", donate: "DONARE", book: "PRENOTA ORA", order: "ORDINA ORA" }, Be = { emailSuggestion: "Intendevi {{email}}?", emailInvalid: "La tua email non è corretta", cardExpiryInvalid: "La data di scadenza della tua carta è nel passato", cardExpiryFormat: "La data di scadenza della tua carta è incompleta", cardSecurityFormat: "Il codice di sicurezza della tua carta è incompleto", nameRequired: "Inserisci il nome come appare sulla tua carta", cardNumberInvalid: "Il numero della tua carta non è valido" }, Oe = {
|
|
682
678
|
email: ze,
|
|
683
679
|
cardholderNameLabel: Pe,
|
|
@@ -714,7 +710,7 @@ const J = "E-Mail", W = "Name des/der Karteninhaber/in", X = "Kartendaten", Q =
|
|
|
714
710
|
loading: dt,
|
|
715
711
|
buttonTexts: ht,
|
|
716
712
|
validation: mt
|
|
717
|
-
},
|
|
713
|
+
}, T = {
|
|
718
714
|
en: ue,
|
|
719
715
|
de: se,
|
|
720
716
|
es: Se,
|
|
@@ -743,7 +739,7 @@ class pt {
|
|
|
743
739
|
}
|
|
744
740
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
745
741
|
getNestedTranslation(e) {
|
|
746
|
-
const t = this.locale in
|
|
742
|
+
const t = this.locale in T ? T[this.locale] : {}, a = this.findNestedValue(t, e);
|
|
747
743
|
return a === void 0 ? e : a;
|
|
748
744
|
}
|
|
749
745
|
findNestedValue(e, t) {
|
|
@@ -912,7 +908,7 @@ function bt(n) {
|
|
|
912
908
|
inputStyles: r
|
|
913
909
|
};
|
|
914
910
|
}
|
|
915
|
-
class
|
|
911
|
+
class h {
|
|
916
912
|
element;
|
|
917
913
|
children = [];
|
|
918
914
|
eventListeners = [];
|
|
@@ -974,7 +970,7 @@ class d {
|
|
|
974
970
|
* Append this component to a parent element
|
|
975
971
|
*/
|
|
976
972
|
appendTo(e) {
|
|
977
|
-
return e instanceof
|
|
973
|
+
return e instanceof h ? e.appendChild(this) : e.appendChild(this.element), this;
|
|
978
974
|
}
|
|
979
975
|
/**
|
|
980
976
|
* Add an event listener to the element
|
|
@@ -1014,19 +1010,19 @@ class y {
|
|
|
1014
1010
|
* Create a div element
|
|
1015
1011
|
*/
|
|
1016
1012
|
static createDiv(e = [], t = {}) {
|
|
1017
|
-
return new
|
|
1013
|
+
return new h("div", e, t);
|
|
1018
1014
|
}
|
|
1019
1015
|
/**
|
|
1020
1016
|
* Create a span element
|
|
1021
1017
|
*/
|
|
1022
1018
|
static createSpan(e = [], t = {}) {
|
|
1023
|
-
return new
|
|
1019
|
+
return new h("span", e, t);
|
|
1024
1020
|
}
|
|
1025
1021
|
/**
|
|
1026
1022
|
* Create a button element
|
|
1027
1023
|
*/
|
|
1028
1024
|
static createButton(e, t = [], a = {}) {
|
|
1029
|
-
const i = new
|
|
1025
|
+
const i = new h("button", t, a);
|
|
1030
1026
|
return i.setText(e), i;
|
|
1031
1027
|
}
|
|
1032
1028
|
/**
|
|
@@ -1034,7 +1030,7 @@ class y {
|
|
|
1034
1030
|
*/
|
|
1035
1031
|
static createInput(e, t = [], a = {}) {
|
|
1036
1032
|
const i = { type: e, ...a };
|
|
1037
|
-
return new
|
|
1033
|
+
return new h("input", t, i);
|
|
1038
1034
|
}
|
|
1039
1035
|
/**
|
|
1040
1036
|
* Create a text input
|
|
@@ -1045,26 +1041,26 @@ class y {
|
|
|
1045
1041
|
placeholder: e,
|
|
1046
1042
|
...a
|
|
1047
1043
|
};
|
|
1048
|
-
return new
|
|
1044
|
+
return new h("input", t, i);
|
|
1049
1045
|
}
|
|
1050
1046
|
/**
|
|
1051
1047
|
* Create a form element
|
|
1052
1048
|
*/
|
|
1053
1049
|
static createForm(e = [], t = {}) {
|
|
1054
|
-
return new
|
|
1050
|
+
return new h("form", e, t);
|
|
1055
1051
|
}
|
|
1056
1052
|
/**
|
|
1057
1053
|
* Create a label element
|
|
1058
1054
|
*/
|
|
1059
1055
|
static createLabel(e, t = "", a = [], i = {}) {
|
|
1060
|
-
const s = t ? { for: t, ...i } : i, r = new
|
|
1056
|
+
const s = t ? { for: t, ...i } : i, r = new h("label", a, s);
|
|
1061
1057
|
return r.setText(e), r;
|
|
1062
1058
|
}
|
|
1063
1059
|
/**
|
|
1064
1060
|
* Create a select element
|
|
1065
1061
|
*/
|
|
1066
1062
|
static createSelect(e, t = [], a = {}) {
|
|
1067
|
-
const i = new
|
|
1063
|
+
const i = new h("select", t, a);
|
|
1068
1064
|
return e.forEach((s) => {
|
|
1069
1065
|
const r = document.createElement("option");
|
|
1070
1066
|
r.value = s.value, r.textContent = s.text, s.selected && (r.selected = !0), i.getElement().appendChild(r);
|
|
@@ -1075,10 +1071,10 @@ class y {
|
|
|
1075
1071
|
*/
|
|
1076
1072
|
static createImage(e, t = "", a = [], i = {}) {
|
|
1077
1073
|
const s = { src: e, alt: t, ...i };
|
|
1078
|
-
return new
|
|
1074
|
+
return new h("img", a, s);
|
|
1079
1075
|
}
|
|
1080
1076
|
}
|
|
1081
|
-
class Ct extends
|
|
1077
|
+
class Ct extends h {
|
|
1082
1078
|
messageComponent;
|
|
1083
1079
|
constructor(e) {
|
|
1084
1080
|
super("div", []);
|
|
@@ -1091,10 +1087,10 @@ class Ct extends d {
|
|
|
1091
1087
|
i.getElement().innerHTML = this.createAlertCircleSVG();
|
|
1092
1088
|
const s = y.createDiv([
|
|
1093
1089
|
"error-alert-text-container"
|
|
1094
|
-
]), r = new
|
|
1090
|
+
]), r = new h("h4", [
|
|
1095
1091
|
"error-alert-title"
|
|
1096
1092
|
]);
|
|
1097
|
-
r.setText("Checkout Error"), this.messageComponent = new
|
|
1093
|
+
r.setText("Checkout Error"), this.messageComponent = new h("p", [
|
|
1098
1094
|
"error-alert-message"
|
|
1099
1095
|
]), this.messageComponent.setText(e.message || "Bad request"), s.appendChild(r), s.appendChild(this.messageComponent), a.appendChild(i), a.appendChild(s), t.appendChild(a), this.appendChild(t);
|
|
1100
1096
|
}
|
|
@@ -1121,18 +1117,18 @@ class Ct extends d {
|
|
|
1121
1117
|
return this.messageComponent.setText(e), this;
|
|
1122
1118
|
}
|
|
1123
1119
|
}
|
|
1124
|
-
class z extends
|
|
1120
|
+
class z extends h {
|
|
1125
1121
|
titleElement;
|
|
1126
1122
|
constructor(e = {}) {
|
|
1127
1123
|
super("div", ["blur-bg"]);
|
|
1128
1124
|
const t = y.createDiv(["loader"]);
|
|
1129
|
-
this.titleElement = new
|
|
1125
|
+
this.titleElement = new h("h3", ["title"]), this.titleElement.setText(e.text || ""), this.appendChild(t), this.appendChild(this.titleElement);
|
|
1130
1126
|
}
|
|
1131
1127
|
setText(e) {
|
|
1132
1128
|
return this.titleElement.setText(e), this;
|
|
1133
1129
|
}
|
|
1134
1130
|
}
|
|
1135
|
-
class v extends
|
|
1131
|
+
class v extends h {
|
|
1136
1132
|
constructor(e) {
|
|
1137
1133
|
super("div", []);
|
|
1138
1134
|
const t = document.createElement("span");
|
|
@@ -1143,7 +1139,7 @@ class v extends d {
|
|
|
1143
1139
|
return t && (t.textContent = e), this;
|
|
1144
1140
|
}
|
|
1145
1141
|
}
|
|
1146
|
-
class St extends
|
|
1142
|
+
class St extends h {
|
|
1147
1143
|
constructor(e) {
|
|
1148
1144
|
super("label", ["input-label"], {
|
|
1149
1145
|
for: e.id
|
|
@@ -1152,7 +1148,7 @@ class St extends d {
|
|
|
1152
1148
|
t.style.fontFamily = "inherit", t.style.color = e.styles.color, t.style.fontSize = `${e.styles.fontSize}px`;
|
|
1153
1149
|
}
|
|
1154
1150
|
}
|
|
1155
|
-
class k extends
|
|
1151
|
+
class k extends h {
|
|
1156
1152
|
inputElement;
|
|
1157
1153
|
helperText = null;
|
|
1158
1154
|
constructor(e) {
|
|
@@ -1172,7 +1168,7 @@ class k extends d {
|
|
|
1172
1168
|
name: e.name,
|
|
1173
1169
|
class: `form-input ${e.error ? "form-input-error" : ""}`
|
|
1174
1170
|
};
|
|
1175
|
-
if (e.placeholder && (t.placeholder = e.placeholder), e.value && (t.value = e.value), e.required && (t.required = String(e.required)), e.disabled && (t.disabled = String(e.disabled)), this.inputElement = y.createInput(
|
|
1171
|
+
if (e.placeholder && (t.placeholder = e.placeholder), e.value && (t.value = e.value), e.required && (t.required = String(e.required)), e.disabled && (t.disabled = String(e.disabled)), e.autocomplete && (t.autocomplete = e.autocomplete), this.inputElement = y.createInput(
|
|
1176
1172
|
e.type || "text",
|
|
1177
1173
|
[],
|
|
1178
1174
|
t
|
|
@@ -1206,7 +1202,8 @@ class xt {
|
|
|
1206
1202
|
error: s,
|
|
1207
1203
|
errorMsg: r,
|
|
1208
1204
|
checkoutProfile: o,
|
|
1209
|
-
translationFunc: l
|
|
1205
|
+
translationFunc: l,
|
|
1206
|
+
autocomplete: c = "cc-name"
|
|
1210
1207
|
} = e;
|
|
1211
1208
|
this.input = new k({
|
|
1212
1209
|
name: "name",
|
|
@@ -1221,11 +1218,12 @@ class xt {
|
|
|
1221
1218
|
},
|
|
1222
1219
|
placeholder: l("cardholderNamePlaceholder"),
|
|
1223
1220
|
value: t,
|
|
1224
|
-
|
|
1225
|
-
|
|
1221
|
+
autocomplete: c,
|
|
1222
|
+
onChange: (d) => {
|
|
1223
|
+
this.trim(), a(d);
|
|
1226
1224
|
}
|
|
1227
|
-
}), this.input.addEventListener("blur", (
|
|
1228
|
-
i(
|
|
1225
|
+
}), this.input.addEventListener("blur", (d) => {
|
|
1226
|
+
i(d);
|
|
1229
1227
|
});
|
|
1230
1228
|
}
|
|
1231
1229
|
getValue() {
|
|
@@ -1248,7 +1246,7 @@ class xt {
|
|
|
1248
1246
|
return this.input.appendTo(e), this;
|
|
1249
1247
|
}
|
|
1250
1248
|
}
|
|
1251
|
-
class Ft extends
|
|
1249
|
+
class Ft extends h {
|
|
1252
1250
|
constructor(e) {
|
|
1253
1251
|
super("div", []);
|
|
1254
1252
|
const t = document.createElement("div");
|
|
@@ -1283,7 +1281,7 @@ const wt = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='iso-8859-1'?%
|
|
|
1283
1281
|
imgSrc: Lt
|
|
1284
1282
|
}
|
|
1285
1283
|
];
|
|
1286
|
-
class
|
|
1284
|
+
class It extends h {
|
|
1287
1285
|
cardType;
|
|
1288
1286
|
constructor(e) {
|
|
1289
1287
|
super("div", []), this.cardType = e.cardType;
|
|
@@ -1342,7 +1340,7 @@ class Tt extends d {
|
|
|
1342
1340
|
return this;
|
|
1343
1341
|
}
|
|
1344
1342
|
}
|
|
1345
|
-
class
|
|
1343
|
+
class Tt extends h {
|
|
1346
1344
|
cardNumber;
|
|
1347
1345
|
cardExpiry;
|
|
1348
1346
|
cardCvv;
|
|
@@ -1358,13 +1356,14 @@ class It extends d {
|
|
|
1358
1356
|
isCvvValid: o,
|
|
1359
1357
|
cardType: l,
|
|
1360
1358
|
cardExpiry: c,
|
|
1361
|
-
cardExpiryError:
|
|
1359
|
+
cardExpiryError: d,
|
|
1362
1360
|
cardExpiryTouched: m,
|
|
1363
1361
|
onChange: u,
|
|
1364
1362
|
onBlur: p,
|
|
1365
|
-
translationFunc: f
|
|
1363
|
+
translationFunc: f,
|
|
1364
|
+
cardExpiryAutocomplete: A = "cc-exp"
|
|
1366
1365
|
} = e, b = document.createElement("div");
|
|
1367
|
-
b.className = "card-grid", this.cardNumber = new
|
|
1366
|
+
b.className = "card-grid", this.cardNumber = new It({
|
|
1368
1367
|
styles: {
|
|
1369
1368
|
color: t.styles.textColor,
|
|
1370
1369
|
fontSize: t.styles.fontSize,
|
|
@@ -1379,9 +1378,10 @@ class It extends d {
|
|
|
1379
1378
|
C.className = "card-details", this.cardExpiry = new k({
|
|
1380
1379
|
name: "cardExpiry",
|
|
1381
1380
|
placeholder: f("cardExpiry"),
|
|
1382
|
-
error: !!(
|
|
1383
|
-
errorMsg:
|
|
1381
|
+
error: !!(d && m),
|
|
1382
|
+
errorMsg: d,
|
|
1384
1383
|
value: c,
|
|
1384
|
+
autocomplete: A,
|
|
1385
1385
|
onChange: (g) => {
|
|
1386
1386
|
this.trimCardExpiry(), u(g);
|
|
1387
1387
|
},
|
|
@@ -1401,8 +1401,8 @@ class It extends d {
|
|
|
1401
1401
|
"Tab"
|
|
1402
1402
|
].includes(w.key) && !/^\d$/.test(w.key) && w.preventDefault();
|
|
1403
1403
|
});
|
|
1404
|
-
const
|
|
1405
|
-
|
|
1404
|
+
const D = this.cardExpiry.getElement();
|
|
1405
|
+
D.style.height = "100%";
|
|
1406
1406
|
const F = document.createElement("div");
|
|
1407
1407
|
if (F.className = "input-wrapper", this.cardCvv = new Ft({
|
|
1408
1408
|
styles: {
|
|
@@ -1478,7 +1478,8 @@ class Nt {
|
|
|
1478
1478
|
error: s,
|
|
1479
1479
|
errorMsg: r,
|
|
1480
1480
|
checkoutProfile: o,
|
|
1481
|
-
translationFunc: l
|
|
1481
|
+
translationFunc: l,
|
|
1482
|
+
autocomplete: c = "email"
|
|
1482
1483
|
} = e;
|
|
1483
1484
|
this.input = new k({
|
|
1484
1485
|
name: "email",
|
|
@@ -1494,9 +1495,10 @@ class Nt {
|
|
|
1494
1495
|
placeholder: l("email"),
|
|
1495
1496
|
type: "email",
|
|
1496
1497
|
value: t,
|
|
1498
|
+
autocomplete: c,
|
|
1497
1499
|
// Wrap the original onChange to apply trim before calling it
|
|
1498
|
-
onChange: (
|
|
1499
|
-
this.trim(), a(
|
|
1500
|
+
onChange: (d) => {
|
|
1501
|
+
this.trim(), a(d);
|
|
1500
1502
|
}
|
|
1501
1503
|
}), this.input.addEventListener("blur", i);
|
|
1502
1504
|
}
|
|
@@ -1521,7 +1523,7 @@ class Nt {
|
|
|
1521
1523
|
}
|
|
1522
1524
|
}
|
|
1523
1525
|
const zt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='101px'%20height='32'%20viewBox='0%200%20101%2032'%20preserveAspectRatio='xMinYMin%20meet'%3e%3cpath%20fill='%23003087'%20d='M%2012.237%202.8%20L%204.437%202.8%20C%203.937%202.8%203.437%203.2%203.337%203.7%20L%200.237%2023.7%20C%200.137%2024.1%200.437%2024.4%200.837%2024.4%20L%204.537%2024.4%20C%205.037%2024.4%205.537%2024%205.637%2023.5%20L%206.437%2018.1%20C%206.537%2017.6%206.937%2017.2%207.537%2017.2%20L%2010.037%2017.2%20C%2015.137%2017.2%2018.137%2014.7%2018.937%209.8%20C%2019.237%207.7%2018.937%206%2017.937%204.8%20C%2016.837%203.5%2014.837%202.8%2012.237%202.8%20Z%20M%2013.137%2010.1%20C%2012.737%2012.9%2010.537%2012.9%208.537%2012.9%20L%207.337%2012.9%20L%208.137%207.7%20C%208.137%207.4%208.437%207.2%208.737%207.2%20L%209.237%207.2%20C%2010.637%207.2%2011.937%207.2%2012.637%208%20C%2013.137%208.4%2013.337%209.1%2013.137%2010.1%20Z'/%3e%3cpath%20fill='%23003087'%20d='M%2035.437%2010%20L%2031.737%2010%20C%2031.437%2010%2031.137%2010.2%2031.137%2010.5%20L%2030.937%2011.5%20L%2030.637%2011.1%20C%2029.837%209.9%2028.037%209.5%2026.237%209.5%20C%2022.137%209.5%2018.637%2012.6%2017.937%2017%20C%2017.537%2019.2%2018.037%2021.3%2019.337%2022.7%20C%2020.437%2024%2022.137%2024.6%2024.037%2024.6%20C%2027.337%2024.6%2029.237%2022.5%2029.237%2022.5%20L%2029.037%2023.5%20C%2028.937%2023.9%2029.237%2024.3%2029.637%2024.3%20L%2033.037%2024.3%20C%2033.537%2024.3%2034.037%2023.9%2034.137%2023.4%20L%2036.137%2010.6%20C%2036.237%2010.4%2035.837%2010%2035.437%2010%20Z%20M%2030.337%2017.2%20C%2029.937%2019.3%2028.337%2020.8%2026.137%2020.8%20C%2025.037%2020.8%2024.237%2020.5%2023.637%2019.8%20C%2023.037%2019.1%2022.837%2018.2%2023.037%2017.2%20C%2023.337%2015.1%2025.137%2013.6%2027.237%2013.6%20C%2028.337%2013.6%2029.137%2014%2029.737%2014.6%20C%2030.237%2015.3%2030.437%2016.2%2030.337%2017.2%20Z'/%3e%3cpath%20fill='%23003087'%20d='M%2055.337%2010%20L%2051.637%2010%20C%2051.237%2010%2050.937%2010.2%2050.737%2010.5%20L%2045.537%2018.1%20L%2043.337%2010.8%20C%2043.237%2010.3%2042.737%2010%2042.337%2010%20L%2038.637%2010%20C%2038.237%2010%2037.837%2010.4%2038.037%2010.9%20L%2042.137%2023%20L%2038.237%2028.4%20C%2037.937%2028.8%2038.237%2029.4%2038.737%2029.4%20L%2042.437%2029.4%20C%2042.837%2029.4%2043.137%2029.2%2043.337%2028.9%20L%2055.837%2010.9%20C%2056.137%2010.6%2055.837%2010%2055.337%2010%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2067.737%202.8%20L%2059.937%202.8%20C%2059.437%202.8%2058.937%203.2%2058.837%203.7%20L%2055.737%2023.6%20C%2055.637%2024%2055.937%2024.3%2056.337%2024.3%20L%2060.337%2024.3%20C%2060.737%2024.3%2061.037%2024%2061.037%2023.7%20L%2061.937%2018%20C%2062.037%2017.5%2062.437%2017.1%2063.037%2017.1%20L%2065.537%2017.1%20C%2070.637%2017.1%2073.637%2014.6%2074.437%209.7%20C%2074.737%207.6%2074.437%205.9%2073.437%204.7%20C%2072.237%203.5%2070.337%202.8%2067.737%202.8%20Z%20M%2068.637%2010.1%20C%2068.237%2012.9%2066.037%2012.9%2064.037%2012.9%20L%2062.837%2012.9%20L%2063.637%207.7%20C%2063.637%207.4%2063.937%207.2%2064.237%207.2%20L%2064.737%207.2%20C%2066.137%207.2%2067.437%207.2%2068.137%208%20C%2068.637%208.4%2068.737%209.1%2068.637%2010.1%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2090.937%2010%20L%2087.237%2010%20C%2086.937%2010%2086.637%2010.2%2086.637%2010.5%20L%2086.437%2011.5%20L%2086.137%2011.1%20C%2085.337%209.9%2083.537%209.5%2081.737%209.5%20C%2077.637%209.5%2074.137%2012.6%2073.437%2017%20C%2073.037%2019.2%2073.537%2021.3%2074.837%2022.7%20C%2075.937%2024%2077.637%2024.6%2079.537%2024.6%20C%2082.837%2024.6%2084.737%2022.5%2084.737%2022.5%20L%2084.537%2023.5%20C%2084.437%2023.9%2084.737%2024.3%2085.137%2024.3%20L%2088.537%2024.3%20C%2089.037%2024.3%2089.537%2023.9%2089.637%2023.4%20L%2091.637%2010.6%20C%2091.637%2010.4%2091.337%2010%2090.937%2010%20Z%20M%2085.737%2017.2%20C%2085.337%2019.3%2083.737%2020.8%2081.537%2020.8%20C%2080.437%2020.8%2079.637%2020.5%2079.037%2019.8%20C%2078.437%2019.1%2078.237%2018.2%2078.437%2017.2%20C%2078.737%2015.1%2080.537%2013.6%2082.637%2013.6%20C%2083.737%2013.6%2084.537%2014%2085.137%2014.6%20C%2085.737%2015.3%2085.937%2016.2%2085.737%2017.2%20Z'/%3e%3cpath%20fill='%23009cde'%20d='M%2095.337%203.3%20L%2092.137%2023.6%20C%2092.037%2024%2092.337%2024.3%2092.737%2024.3%20L%2095.937%2024.3%20C%2096.437%2024.3%2096.937%2023.9%2097.037%2023.4%20L%20100.237%203.5%20C%20100.337%203.1%20100.037%202.8%2099.637%202.8%20L%2096.037%202.8%20C%2095.637%202.8%2095.437%203%2095.337%203.3%20Z'/%3e%3c/svg%3e";
|
|
1524
|
-
class Pt extends
|
|
1526
|
+
class Pt extends h {
|
|
1525
1527
|
formData;
|
|
1526
1528
|
onSubmit;
|
|
1527
1529
|
isSubmitting = !1;
|
|
@@ -1553,7 +1555,7 @@ class Pt extends d {
|
|
|
1553
1555
|
return this.isSubmitting = e, this.getElement().style.opacity = e ? "0.7" : "1", this;
|
|
1554
1556
|
}
|
|
1555
1557
|
}
|
|
1556
|
-
class At extends
|
|
1558
|
+
class At extends h {
|
|
1557
1559
|
paymentMethods;
|
|
1558
1560
|
constructor(e) {
|
|
1559
1561
|
const { checkoutProfile: t, formData: a, onPaypalSubmit: i } = e;
|
|
@@ -1593,7 +1595,7 @@ class At extends d {
|
|
|
1593
1595
|
}
|
|
1594
1596
|
}
|
|
1595
1597
|
const Dt = 17;
|
|
1596
|
-
class $t extends
|
|
1598
|
+
class $t extends h {
|
|
1597
1599
|
styles;
|
|
1598
1600
|
isHovered = !1;
|
|
1599
1601
|
constructor(e) {
|
|
@@ -1648,7 +1650,7 @@ class Vt {
|
|
|
1648
1650
|
}
|
|
1649
1651
|
}
|
|
1650
1652
|
const Rt = "https://test-htp.tokenex.com/Iframe/Iframe-v3.min.js", Bt = "https://htp.tokenex.com/iframe/iframe-v3.min.js";
|
|
1651
|
-
class Ot extends
|
|
1653
|
+
class Ot extends h {
|
|
1652
1654
|
options;
|
|
1653
1655
|
isSubmitting = !1;
|
|
1654
1656
|
scriptCleanup;
|
|
@@ -1731,7 +1733,9 @@ class Ot extends d {
|
|
|
1731
1733
|
} catch {
|
|
1732
1734
|
this.setErrorMessage("Failed to initialize payment form");
|
|
1733
1735
|
}
|
|
1734
|
-
else e.checkoutProfile
|
|
1736
|
+
else e.checkoutProfile || this.setErrorMessage(
|
|
1737
|
+
"Cannot initialize iframe: No checkout profile available"
|
|
1738
|
+
);
|
|
1735
1739
|
};
|
|
1736
1740
|
handleIframeStateChange = (e) => {
|
|
1737
1741
|
this.cardSection && (this.cardSection.updateCardNumberValidation(
|
|
@@ -1748,7 +1752,7 @@ class Ot extends d {
|
|
|
1748
1752
|
if (this.iframeHook && !this.cardSection)
|
|
1749
1753
|
try {
|
|
1750
1754
|
const { formData: t, errors: a, touched: i } = this._getFormStateData(), s = this.iframeHook.getState();
|
|
1751
|
-
this.cardSection = new
|
|
1755
|
+
this.cardSection = new Tt({
|
|
1752
1756
|
checkoutProfile: e,
|
|
1753
1757
|
isLoading: s.loadingIframe,
|
|
1754
1758
|
isFocused: s.isFocused,
|
package/dist/package.json
CHANGED