@odus/checkout 0.5.3 → 0.5.4
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 +61 -42
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/checkout.es.js
CHANGED
|
@@ -469,24 +469,24 @@ const z = {
|
|
|
469
469
|
const E = {
|
|
470
470
|
...d.formData,
|
|
471
471
|
[l]: u
|
|
472
|
-
},
|
|
472
|
+
}, y = { ...d.errors };
|
|
473
473
|
if (d.touched[l]) {
|
|
474
474
|
const m = t(l, u);
|
|
475
|
-
m ?
|
|
475
|
+
m ? y[l] = m : delete y[l];
|
|
476
476
|
}
|
|
477
477
|
e.setState({
|
|
478
478
|
formData: E,
|
|
479
|
-
errors:
|
|
479
|
+
errors: y,
|
|
480
480
|
isValid: i(E)
|
|
481
481
|
});
|
|
482
482
|
}, s = (l, c) => {
|
|
483
483
|
const d = e.getState(), u = {
|
|
484
484
|
...d.touched,
|
|
485
485
|
[l]: !0
|
|
486
|
-
}, E = t(l, c),
|
|
487
|
-
E ?
|
|
486
|
+
}, E = t(l, c), y = { ...d.errors };
|
|
487
|
+
E ? y[l] = E : delete y[l], e.setState({
|
|
488
488
|
touched: u,
|
|
489
|
-
errors:
|
|
489
|
+
errors: y
|
|
490
490
|
});
|
|
491
491
|
}, o = (l) => {
|
|
492
492
|
const d = {
|
|
@@ -645,8 +645,8 @@ function Q({
|
|
|
645
645
|
if (C && b)
|
|
646
646
|
try {
|
|
647
647
|
l();
|
|
648
|
-
} catch (
|
|
649
|
-
console.error("Failed to create TokenEx iframe:",
|
|
648
|
+
} catch (v) {
|
|
649
|
+
console.error("Failed to create TokenEx iframe:", v);
|
|
650
650
|
}
|
|
651
651
|
else m < g && f();
|
|
652
652
|
}, p);
|
|
@@ -677,7 +677,7 @@ function Q({
|
|
|
677
677
|
n && await o();
|
|
678
678
|
}, E = () => {
|
|
679
679
|
s && (s.remove(), s = null);
|
|
680
|
-
},
|
|
680
|
+
}, y = async (m) => {
|
|
681
681
|
s && (s.on("tokenize", async function(g) {
|
|
682
682
|
await m(g);
|
|
683
683
|
}), s.tokenize());
|
|
@@ -685,7 +685,7 @@ function Q({
|
|
|
685
685
|
return {
|
|
686
686
|
getState: r.getState.bind(r),
|
|
687
687
|
subscribe: r.subscribe.bind(r),
|
|
688
|
-
tokenize:
|
|
688
|
+
tokenize: y,
|
|
689
689
|
cleanup: E,
|
|
690
690
|
initialize: u
|
|
691
691
|
};
|
|
@@ -699,7 +699,7 @@ const ee = "E-Mail", te = "Name des/der Karteninhaber/in", ae = "Kartendaten", i
|
|
|
699
699
|
loading: se,
|
|
700
700
|
buttonTexts: ne,
|
|
701
701
|
validation: oe
|
|
702
|
-
}, ce = "Email", de = "Cardholder name", he = "Card information", me = "Full name on card", ue = "MM / YY", pe = "Do not close the window", fe = { pay: "PAY", submit: "SUBMIT", getPlan: "GET MY PLAN", donate: "DONATE", book: "BOOK NOW", order: "ORDER NOW" }, ge = { emailSuggestion: "Did you mean {{email}}?", emailInvalid: "Your email is not correct", cardExpiryInvalid: "Your card's expiration date is in the past", cardExpiryFormat: "Your card’s expiration date is incomplete", cardSecurityFormat: "Your card’s security code is incomplete", nameRequired: "Please enter the name as it appears on your card", cardNumberInvalid: "Your card number is invalid" },
|
|
702
|
+
}, ce = "Email", de = "Cardholder name", he = "Card information", me = "Full name on card", ue = "MM / YY", pe = "Do not close the window", fe = { pay: "PAY", submit: "SUBMIT", getPlan: "GET MY PLAN", donate: "DONATE", book: "BOOK NOW", order: "ORDER NOW" }, ge = { emailSuggestion: "Did you mean {{email}}?", emailInvalid: "Your email is not correct", cardExpiryInvalid: "Your card's expiration date is in the past", cardExpiryFormat: "Your card’s expiration date is incomplete", cardSecurityFormat: "Your card’s security code is incomplete", nameRequired: "Please enter the name as it appears on your card", cardNumberInvalid: "Your card number is invalid" }, ye = {
|
|
703
703
|
email: ce,
|
|
704
704
|
cardholderNameLabel: de,
|
|
705
705
|
cardInformation: he,
|
|
@@ -708,8 +708,8 @@ const ee = "E-Mail", te = "Name des/der Karteninhaber/in", ae = "Kartendaten", i
|
|
|
708
708
|
loading: pe,
|
|
709
709
|
buttonTexts: fe,
|
|
710
710
|
validation: ge
|
|
711
|
-
},
|
|
712
|
-
email:
|
|
711
|
+
}, ve = "Correo electrónico", Ee = "Nombre del titular de la tarjeta", be = "Información de la tarjeta", Ce = "Nombre completo en la tarjeta", Se = "MM / AA", xe = "Por favor, no cierre esta ventana", Fe = { pay: "PAGAR", submit: "ENVIAR", getPlan: "OBTENER MI PLAN", donate: "DONAR", book: "RESERVAR AHORA", order: "ORDENAR AHORA" }, we = { emailSuggestion: "¿Quisiste decir {{email}}?", emailInvalid: "Su correo electrónico no es válido", cardExpiryInvalid: "La fecha de vencimiento de la tarjeta ya pasó", cardExpiryFormat: "La fecha de vencimiento de su tarjeta está incompleta", cardSecurityFormat: "El código de seguridad de su tarjeta está incompleto", nameRequired: "Por favor, ingrese el nombre tal como aparece en su tarjeta", cardNumberInvalid: "Su número de tarjeta no es válido" }, Le = {
|
|
712
|
+
email: ve,
|
|
713
713
|
cardholderNameLabel: Ee,
|
|
714
714
|
cardInformation: be,
|
|
715
715
|
cardholderNamePlaceholder: Ce,
|
|
@@ -753,7 +753,7 @@ const ee = "E-Mail", te = "Name des/der Karteninhaber/in", ae = "Kartendaten", i
|
|
|
753
753
|
loading: st,
|
|
754
754
|
buttonTexts: nt,
|
|
755
755
|
validation: ot
|
|
756
|
-
}, ct = "E-posta", dt = "Kart sahibinin adı", ht = "Kart bilgileri", mt = "Kart üzerindeki tam ad", ut = "AA / YY", pt = "Lütfen pencereyi kapatmayın", ft = { pay: "ÖDE", submit: "GÖNDER", getPlan: "PLANIMI AL", donate: "BAĞIŞ YAP", book: "ŞİMDİ REZERVASYON YAP", order: "ŞİMDİ SİPARİŞ VER" }, gt = { emailSuggestion: "{{email}} demek mi istediniz?", emailInvalid: "E-posta adresiniz geçerli değil", cardExpiryInvalid: "Kartınızın son kullanma tarihi geçmiş", cardExpiryFormat: "Kartınızın son kullanma tarihi eksik", cardSecurityFormat: "Kartınızın güvenlik kodu eksik", nameRequired: "Lütfen kart üzerindeki ismi girin", cardNumberInvalid: "Kart numaranız geçersiz" },
|
|
756
|
+
}, ct = "E-posta", dt = "Kart sahibinin adı", ht = "Kart bilgileri", mt = "Kart üzerindeki tam ad", ut = "AA / YY", pt = "Lütfen pencereyi kapatmayın", ft = { pay: "ÖDE", submit: "GÖNDER", getPlan: "PLANIMI AL", donate: "BAĞIŞ YAP", book: "ŞİMDİ REZERVASYON YAP", order: "ŞİMDİ SİPARİŞ VER" }, gt = { emailSuggestion: "{{email}} demek mi istediniz?", emailInvalid: "E-posta adresiniz geçerli değil", cardExpiryInvalid: "Kartınızın son kullanma tarihi geçmiş", cardExpiryFormat: "Kartınızın son kullanma tarihi eksik", cardSecurityFormat: "Kartınızın güvenlik kodu eksik", nameRequired: "Lütfen kart üzerindeki ismi girin", cardNumberInvalid: "Kart numaranız geçersiz" }, yt = {
|
|
757
757
|
email: ct,
|
|
758
758
|
cardholderNameLabel: dt,
|
|
759
759
|
cardInformation: ht,
|
|
@@ -763,17 +763,17 @@ const ee = "E-Mail", te = "Name des/der Karteninhaber/in", ae = "Kartendaten", i
|
|
|
763
763
|
buttonTexts: ft,
|
|
764
764
|
validation: gt
|
|
765
765
|
}, N = {
|
|
766
|
-
en:
|
|
766
|
+
en: ye,
|
|
767
767
|
de: le,
|
|
768
768
|
es: Le,
|
|
769
769
|
fr: De,
|
|
770
770
|
pl: Qe,
|
|
771
771
|
pt: lt,
|
|
772
|
-
tr:
|
|
772
|
+
tr: yt,
|
|
773
773
|
it: Ue
|
|
774
774
|
// Add other locales here
|
|
775
775
|
};
|
|
776
|
-
class
|
|
776
|
+
class vt {
|
|
777
777
|
locale;
|
|
778
778
|
loadedLocales = /* @__PURE__ */ new Set();
|
|
779
779
|
constructor(e = "en") {
|
|
@@ -822,7 +822,7 @@ const A = [
|
|
|
822
822
|
"tr"
|
|
823
823
|
], Et = "en";
|
|
824
824
|
function bt(n) {
|
|
825
|
-
const e = new
|
|
825
|
+
const e = new vt(), a = (() => {
|
|
826
826
|
const o = navigator?.language?.split("-")[0]?.toLowerCase();
|
|
827
827
|
return A.includes(o) ? o : Et;
|
|
828
828
|
})();
|
|
@@ -1411,7 +1411,7 @@ class Pt extends h {
|
|
|
1411
1411
|
cardExpiryError: d,
|
|
1412
1412
|
cardExpiryTouched: u,
|
|
1413
1413
|
onChange: E,
|
|
1414
|
-
onBlur:
|
|
1414
|
+
onBlur: y,
|
|
1415
1415
|
translationFunc: m,
|
|
1416
1416
|
cardExpiryAutocomplete: g = "cc-exp"
|
|
1417
1417
|
} = e, f = document.createElement("div");
|
|
@@ -1434,8 +1434,8 @@ class Pt extends h {
|
|
|
1434
1434
|
errorMsg: d,
|
|
1435
1435
|
value: c,
|
|
1436
1436
|
autocomplete: g,
|
|
1437
|
-
onChange: (
|
|
1438
|
-
this.trimCardExpiry(), E(
|
|
1437
|
+
onChange: (v) => {
|
|
1438
|
+
this.trimCardExpiry(), E(v);
|
|
1439
1439
|
},
|
|
1440
1440
|
styles: {
|
|
1441
1441
|
color: t.styles.textColor,
|
|
@@ -1443,8 +1443,8 @@ class Pt extends h {
|
|
|
1443
1443
|
fontSize: t.styles.fontSize,
|
|
1444
1444
|
fontFamily: t.styles.fontFamily
|
|
1445
1445
|
}
|
|
1446
|
-
}), this.cardExpiry.addEventListener("blur",
|
|
1447
|
-
const M =
|
|
1446
|
+
}), this.cardExpiry.addEventListener("blur", y), this.cardExpiry.addEventListener("keydown", (v) => {
|
|
1447
|
+
const M = v;
|
|
1448
1448
|
![
|
|
1449
1449
|
"Backspace",
|
|
1450
1450
|
"Delete",
|
|
@@ -1463,16 +1463,16 @@ class Pt extends h {
|
|
|
1463
1463
|
isLoading: a,
|
|
1464
1464
|
isFocused: r
|
|
1465
1465
|
}), b.appendChild(this.cardCvv.getElement()), p.appendChild(this.cardExpiry.getElement()), p.appendChild(b), f.appendChild(p), this.getElement().appendChild(f), i && !s) {
|
|
1466
|
-
const
|
|
1466
|
+
const v = new x({
|
|
1467
1467
|
text: m("validation.cardNumberInvalid")
|
|
1468
1468
|
});
|
|
1469
|
-
this.validationMessages.set("cardNumber",
|
|
1469
|
+
this.validationMessages.set("cardNumber", v), this.appendChild(v);
|
|
1470
1470
|
}
|
|
1471
1471
|
if (r && !o) {
|
|
1472
|
-
const
|
|
1472
|
+
const v = new x({
|
|
1473
1473
|
text: m("validation.cardSecurityFormat")
|
|
1474
1474
|
});
|
|
1475
|
-
this.validationMessages.set("cardCvv",
|
|
1475
|
+
this.validationMessages.set("cardCvv", v), this.appendChild(v);
|
|
1476
1476
|
}
|
|
1477
1477
|
}
|
|
1478
1478
|
updateCardType(e) {
|
|
@@ -1775,7 +1775,11 @@ class Ut extends h {
|
|
|
1775
1775
|
const { inputStyles: t, formContainerStyle: a } = Ft(
|
|
1776
1776
|
e.checkoutProfile
|
|
1777
1777
|
);
|
|
1778
|
-
this.applyFormContainerStyles(a), this.
|
|
1778
|
+
this.applyFormContainerStyles(a), this.cardSection || (this.createCardSection(e.checkoutProfile), console.log("✅ Card element check before iframe initialization:", {
|
|
1779
|
+
cardElementExists: !!document.getElementById("card-element"),
|
|
1780
|
+
cvvElementExists: !!document.getElementById("card-cvv-element"),
|
|
1781
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1782
|
+
})), this.iframeHook = Q({
|
|
1779
1783
|
apiKey: this.options.apiKey,
|
|
1780
1784
|
checkoutProfile: e.checkoutProfile,
|
|
1781
1785
|
inputStyles: t,
|
|
@@ -1783,9 +1787,11 @@ class Ut extends h {
|
|
|
1783
1787
|
this.formManager.setFormData(i);
|
|
1784
1788
|
},
|
|
1785
1789
|
environment: this.options.environment
|
|
1786
|
-
}), this.iframeHook?.subscribe(this.handleIframeStateChange), await this.iframeHook?.initialize()
|
|
1787
|
-
|
|
1788
|
-
|
|
1790
|
+
}), this.iframeHook?.subscribe(this.handleIframeStateChange), await this.iframeHook?.initialize(), console.log("✅ TokenEx iframe initialized successfully:", {
|
|
1791
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1792
|
+
});
|
|
1793
|
+
} catch (t) {
|
|
1794
|
+
console.error("Failed to initialize payment form:", t), this.setErrorMessage("Failed to initialize payment form");
|
|
1789
1795
|
}
|
|
1790
1796
|
else e.checkoutProfile || this.setErrorMessage(
|
|
1791
1797
|
"Cannot initialize iframe: No checkout profile available"
|
|
@@ -1814,7 +1820,7 @@ class Ut extends h {
|
|
|
1814
1820
|
isCvvValid: !1,
|
|
1815
1821
|
possibleCardType: "unknown"
|
|
1816
1822
|
};
|
|
1817
|
-
this.iframeHook && (r = this.iframeHook.getState()), this.cardSection = new Pt({
|
|
1823
|
+
if (this.iframeHook && (r = this.iframeHook.getState()), this.cardSection = new Pt({
|
|
1818
1824
|
checkoutProfile: e,
|
|
1819
1825
|
isLoading: r.loadingIframe,
|
|
1820
1826
|
isFocused: r.isFocused,
|
|
@@ -1828,9 +1834,24 @@ class Ut extends h {
|
|
|
1828
1834
|
onChange: this.handleChange,
|
|
1829
1835
|
onBlur: this.handleBlur,
|
|
1830
1836
|
translationFunc: this.translation.t
|
|
1831
|
-
}), this.
|
|
1832
|
-
|
|
1833
|
-
|
|
1837
|
+
}), this.emailField && this.cardholderSection)
|
|
1838
|
+
this.element.insertBefore(
|
|
1839
|
+
this.cardSection.getElement(),
|
|
1840
|
+
this.cardholderSection.getElement()
|
|
1841
|
+
);
|
|
1842
|
+
else if (this.emailField) {
|
|
1843
|
+
const s = this.emailField.getElement().nextSibling;
|
|
1844
|
+
s ? this.element.insertBefore(
|
|
1845
|
+
this.cardSection.getElement(),
|
|
1846
|
+
s
|
|
1847
|
+
) : this.element.appendChild(this.cardSection.getElement());
|
|
1848
|
+
} else
|
|
1849
|
+
this.element.appendChild(this.cardSection.getElement()), console.warn(
|
|
1850
|
+
"Card section inserted at end of form - component order may be incorrect"
|
|
1851
|
+
);
|
|
1852
|
+
this.updateFormUI(), this.cardSection && this.emailField && this.cardholderSection && this.submitButton;
|
|
1853
|
+
} catch (t) {
|
|
1854
|
+
console.error("Error creating card section:", t), this.setErrorMessage("Card section temporarily unavailable");
|
|
1834
1855
|
}
|
|
1835
1856
|
};
|
|
1836
1857
|
initializeForm() {
|
|
@@ -1856,13 +1877,11 @@ class Ut extends h {
|
|
|
1856
1877
|
this.setErrorMessage("Failed to load checkout configuration");
|
|
1857
1878
|
return;
|
|
1858
1879
|
}
|
|
1859
|
-
this.createPaymentMethods(e.checkoutProfile), this.createEmailField(e.checkoutProfile), this.
|
|
1860
|
-
cardElementExists: !!document.getElementById("card-element"),
|
|
1861
|
-
cvvElementExists: !!document.getElementById("card-cvv-element"),
|
|
1880
|
+
this.createPaymentMethods(e.checkoutProfile), this.createEmailField(e.checkoutProfile), this.createCardholderSection(e.checkoutProfile), this.createSubmitButton(e.checkoutProfile), console.log("✅ Form components rendered successfully:", {
|
|
1862
1881
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
1863
1882
|
});
|
|
1864
|
-
} catch {
|
|
1865
|
-
this.setErrorMessage("Failed to render checkout form components");
|
|
1883
|
+
} catch (e) {
|
|
1884
|
+
console.error("Failed to render form components:", e), this.setErrorMessage("Failed to render checkout form components");
|
|
1866
1885
|
}
|
|
1867
1886
|
}
|
|
1868
1887
|
}
|
|
@@ -2170,11 +2189,11 @@ typeof globalThis < "u" && (globalThis.OdusCheckout = Yt);
|
|
|
2170
2189
|
export {
|
|
2171
2190
|
Yt as OdusCheckout,
|
|
2172
2191
|
le as deLocale,
|
|
2173
|
-
|
|
2192
|
+
ye as enLocale,
|
|
2174
2193
|
Le as esLocale,
|
|
2175
2194
|
De as frLocale,
|
|
2176
2195
|
Ue as itLocale,
|
|
2177
2196
|
Qe as plLocale,
|
|
2178
2197
|
lt as ptLocale,
|
|
2179
|
-
|
|
2198
|
+
yt as trLocale
|
|
2180
2199
|
};
|
package/dist/package.json
CHANGED