@odus/checkout 0.14.0-beta.2 → 0.14.0
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 +33 -27
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/checkout.es.js
CHANGED
|
@@ -276,7 +276,7 @@ var ut = (
|
|
|
276
276
|
return a > 0 && (i += ".incomplete"), i;
|
|
277
277
|
}, n;
|
|
278
278
|
}()
|
|
279
|
-
),
|
|
279
|
+
), Wt = (
|
|
280
280
|
/** @class */
|
|
281
281
|
function() {
|
|
282
282
|
function n(t, e, r, i, s) {
|
|
@@ -506,7 +506,7 @@ var ut = (
|
|
|
506
506
|
return this.tagClass === 0 && this.tagNumber === 0;
|
|
507
507
|
}, n;
|
|
508
508
|
}()
|
|
509
|
-
), V,
|
|
509
|
+
), V, Qt = 244837814094590, Tt = (Qt & 16777215) == 15715070, T = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], Xt = (1 << 26) / T[T.length - 1], p = (
|
|
510
510
|
/** @class */
|
|
511
511
|
function() {
|
|
512
512
|
function n(t, e, r) {
|
|
@@ -1904,7 +1904,7 @@ var xe = /* @__PURE__ */ function() {
|
|
|
1904
1904
|
}
|
|
1905
1905
|
return t.prototype.parseKey = function(e) {
|
|
1906
1906
|
try {
|
|
1907
|
-
var r = 0, i = 0, s = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/, a = s.test(e) ? Zt.decode(e) : mt.unarmor(e), o =
|
|
1907
|
+
var r = 0, i = 0, s = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/, a = s.test(e) ? Zt.decode(e) : mt.unarmor(e), o = Wt.decode(a);
|
|
1908
1908
|
if (o.sub.length === 3 && (o = o.sub[2].sub[0]), o.sub.length === 9) {
|
|
1909
1909
|
r = o.sub[1].getHexStringValue(), this.n = C(r, 16), i = o.sub[2].getHexStringValue(), this.e = parseInt(i, 16);
|
|
1910
1910
|
var l = o.sub[3].getHexStringValue();
|
|
@@ -2076,7 +2076,13 @@ class De {
|
|
|
2076
2076
|
browserInfo;
|
|
2077
2077
|
publicKey;
|
|
2078
2078
|
constructor(t, e, r) {
|
|
2079
|
-
this.apiKey = t, this.baseUrl = gt(e), this.publicKey = e === "test" ? Fe : Me, this.browserInfo = r || {
|
|
2079
|
+
this.apiKey = t, this.baseUrl = gt(e), this.publicKey = e === "test" ? Fe : Me, this.browserInfo = r || {
|
|
2080
|
+
colorDepth: screen.colorDepth,
|
|
2081
|
+
javaEnabled: navigator.javaEnabled(),
|
|
2082
|
+
screenHeight: screen.height,
|
|
2083
|
+
screenWidth: screen.width,
|
|
2084
|
+
timeZoneOffset: (/* @__PURE__ */ new Date()).getTimezoneOffset().toString()
|
|
2085
|
+
};
|
|
2080
2086
|
}
|
|
2081
2087
|
async fetchApi({
|
|
2082
2088
|
endpoint: t,
|
|
@@ -2359,7 +2365,7 @@ function Pe({
|
|
|
2359
2365
|
reload: s
|
|
2360
2366
|
};
|
|
2361
2367
|
}
|
|
2362
|
-
const
|
|
2368
|
+
const W = (n) => {
|
|
2363
2369
|
const t = n.replace(/\s/g, "");
|
|
2364
2370
|
return /^4\d{0,15}$/.test(t) ? "visa" : /^(5[1-5]\d{4}|677189|222[1-9]\d{2}|22[3-9]\d{3}|2[3-6]\d{4}|27[01]\d{3}|2720\d{2})\d{0,13}$/.test(
|
|
2365
2371
|
t
|
|
@@ -2576,7 +2582,7 @@ const Q = (n) => {
|
|
|
2576
2582
|
const r = e.replace(/\s/g, "");
|
|
2577
2583
|
if (!r)
|
|
2578
2584
|
return n("validation.cardNumberInvalid");
|
|
2579
|
-
const i =
|
|
2585
|
+
const i = W(r);
|
|
2580
2586
|
if (i === "unknown")
|
|
2581
2587
|
return n("validation.cardNumberInvalid");
|
|
2582
2588
|
const s = i === "amex" ? 15 : 16;
|
|
@@ -2587,7 +2593,7 @@ const Q = (n) => {
|
|
|
2587
2593
|
const i = e.replace(/\s/g, "");
|
|
2588
2594
|
if (!i || !/^\d+$/.test(i))
|
|
2589
2595
|
return n("validation.cardSecurityFormat");
|
|
2590
|
-
const a = (r ?
|
|
2596
|
+
const a = (r ? W(r) : "unknown") === "amex" ? 4 : 3;
|
|
2591
2597
|
if (i.length !== a)
|
|
2592
2598
|
return n("validation.cardSecurityFormat");
|
|
2593
2599
|
}
|
|
@@ -2633,7 +2639,7 @@ const Q = (n) => {
|
|
|
2633
2639
|
let d = c;
|
|
2634
2640
|
if (l in J)
|
|
2635
2641
|
if (l === "cardCvv") {
|
|
2636
|
-
const E =
|
|
2642
|
+
const E = W(u.formData.cardNumber) === "amex" ? 4 : 3;
|
|
2637
2643
|
d = J.cardCvv(c, E);
|
|
2638
2644
|
} else
|
|
2639
2645
|
d = J[l](c);
|
|
@@ -2687,9 +2693,9 @@ const Q = (n) => {
|
|
|
2687
2693
|
"pay-with-card": "oder mit Karte bezahlen",
|
|
2688
2694
|
buttonTexts: Ze,
|
|
2689
2695
|
validation: Ye
|
|
2690
|
-
},
|
|
2691
|
-
email:
|
|
2692
|
-
cardholderNameLabel:
|
|
2696
|
+
}, We = "Email", Qe = "Cardholder name", Xe = "Card information", tr = "Full name on card", er = "MM / YY", rr = "Do not close the window", ir = { pay: "PAY", submit: "SUBMIT", getPlan: "GET MY PLAN", donate: "DONATE", book: "BOOK NOW", order: "ORDER NOW" }, nr = { 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", "invalid-checkout": "Failed to initialize checkout" }, sr = {
|
|
2697
|
+
email: We,
|
|
2698
|
+
cardholderNameLabel: Qe,
|
|
2693
2699
|
cardInformation: Xe,
|
|
2694
2700
|
cardholderNamePlaceholder: tr,
|
|
2695
2701
|
cardExpiry: er,
|
|
@@ -2747,9 +2753,9 @@ const Q = (n) => {
|
|
|
2747
2753
|
"pay-with-card": "ou pagar com cartão",
|
|
2748
2754
|
buttonTexts: Zr,
|
|
2749
2755
|
validation: Yr
|
|
2750
|
-
},
|
|
2751
|
-
email:
|
|
2752
|
-
cardholderNameLabel:
|
|
2756
|
+
}, Wr = "E-posta", Qr = "Kart sahibinin adı", Xr = "Kart bilgileri", ti = "Kart üzerindeki tam ad", ei = "AA / YY", ri = "Lütfen pencereyi kapatmayın", ii = { pay: "ÖDE", submit: "GÖNDER", getPlan: "PLANIMI AL", donate: "BAĞIŞ YAP", book: "ŞİMDİ REZERVASYON YAP", order: "ŞİMDİ SİPARİŞ VER" }, ni = { 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", "invalid-checkout": "Checkout başlatılamadı" }, si = {
|
|
2757
|
+
email: Wr,
|
|
2758
|
+
cardholderNameLabel: Qr,
|
|
2753
2759
|
cardInformation: Xr,
|
|
2754
2760
|
cardholderNamePlaceholder: ti,
|
|
2755
2761
|
cardExpiry: ei,
|
|
@@ -3183,7 +3189,7 @@ class di extends S {
|
|
|
3183
3189
|
e.style.fontFamily = "inherit", e.style.color = t.styles.color, e.style.fontSize = `${t.styles.fontSize}px`;
|
|
3184
3190
|
}
|
|
3185
3191
|
}
|
|
3186
|
-
class
|
|
3192
|
+
class Q extends S {
|
|
3187
3193
|
inputElement;
|
|
3188
3194
|
helperText = null;
|
|
3189
3195
|
constructor(t) {
|
|
@@ -3248,7 +3254,7 @@ class fi {
|
|
|
3248
3254
|
translationFunc: o,
|
|
3249
3255
|
autocomplete: l = "cc-name"
|
|
3250
3256
|
} = t;
|
|
3251
|
-
this.input = new
|
|
3257
|
+
this.input = new Q({
|
|
3252
3258
|
name: "name",
|
|
3253
3259
|
label: o("cardholderNameLabel"),
|
|
3254
3260
|
// Always hide error initially - we'll show it only on blur if needed
|
|
@@ -3301,7 +3307,7 @@ class mi {
|
|
|
3301
3307
|
constructor(t) {
|
|
3302
3308
|
this.options = t, this.currentMaxLength = this.getMaxLengthForCardBrand(
|
|
3303
3309
|
t.cardBrand || "unknown"
|
|
3304
|
-
), this.input = new
|
|
3310
|
+
), this.input = new Q({
|
|
3305
3311
|
name: "cardCvv",
|
|
3306
3312
|
placeholder: "CVV",
|
|
3307
3313
|
type: "tel",
|
|
@@ -3384,7 +3390,7 @@ class Ei {
|
|
|
3384
3390
|
wrapper;
|
|
3385
3391
|
inputContainer = null;
|
|
3386
3392
|
constructor(t) {
|
|
3387
|
-
this.options = t, this.wrapper = document.createElement("div"), this.wrapper.style.position = "relative", this.input = new
|
|
3393
|
+
this.options = t, this.wrapper = document.createElement("div"), this.wrapper.style.position = "relative", this.input = new Q({
|
|
3388
3394
|
name: "cardNumber",
|
|
3389
3395
|
label: t.translationFunc?.("cardInformation") ?? "Card number",
|
|
3390
3396
|
placeholder: "1234 5678 9012 3456",
|
|
@@ -3426,7 +3432,7 @@ class Ei {
|
|
|
3426
3432
|
}
|
|
3427
3433
|
handleChange = (t) => {
|
|
3428
3434
|
let i = t.target.value.replace(/\D/g, "");
|
|
3429
|
-
const s =
|
|
3435
|
+
const s = W(i), a = s === "amex" ? 15 : 16;
|
|
3430
3436
|
i = i.slice(0, a);
|
|
3431
3437
|
const o = J.cardNumber(i);
|
|
3432
3438
|
this.input.setValue(o), this.currentCardBrand = s, this.updateCardIcons(this.currentCardBrand), this.options.onChange && this.options.onChange(o, this.currentCardBrand);
|
|
@@ -3444,7 +3450,7 @@ class Ei {
|
|
|
3444
3450
|
return this.input.getValue();
|
|
3445
3451
|
}
|
|
3446
3452
|
setValue(t) {
|
|
3447
|
-
this.input.setValue(t), this.currentCardBrand =
|
|
3453
|
+
this.input.setValue(t), this.currentCardBrand = W(t), this.updateCardIcons(this.currentCardBrand);
|
|
3448
3454
|
}
|
|
3449
3455
|
setError(t) {
|
|
3450
3456
|
this.input.getElement().querySelector(".form-input")?.classList.toggle("form-input-error", t);
|
|
@@ -3508,7 +3514,7 @@ class bi extends S {
|
|
|
3508
3514
|
}
|
|
3509
3515
|
}), r && this.cardNumberElement.setValue(r), y.appendChild(this.cardNumberElement.getElement());
|
|
3510
3516
|
const E = document.createElement("div");
|
|
3511
|
-
E.className = "card-details", this.cardExpiry = new
|
|
3517
|
+
E.className = "card-details", this.cardExpiry = new Q({
|
|
3512
3518
|
name: "cardExpiry",
|
|
3513
3519
|
type: "tel",
|
|
3514
3520
|
placeholder: m("cardExpiry"),
|
|
@@ -3608,7 +3614,7 @@ class Si {
|
|
|
3608
3614
|
translationFunc: l,
|
|
3609
3615
|
autocomplete: c = "email"
|
|
3610
3616
|
} = t;
|
|
3611
|
-
this.input = new
|
|
3617
|
+
this.input = new Q({
|
|
3612
3618
|
name: "email",
|
|
3613
3619
|
label: l("email"),
|
|
3614
3620
|
// Always hide error initially - we'll show it only on blur if needed
|
|
@@ -4390,18 +4396,18 @@ class Ri extends S {
|
|
|
4390
4396
|
async handleSubmit() {
|
|
4391
4397
|
if (!this.stateCoordinator.isFormDisabled())
|
|
4392
4398
|
try {
|
|
4393
|
-
this.stateCoordinator.setSubmitting(!0), this.updateFormUI(), this.uiManager.showSpinner(this.translation.t("loading")), await this.options.onSubmit({
|
|
4399
|
+
this.stateCoordinator.setSubmitting(!0), this.updateFormUI(), this.options.onLoadingStateChange?.(!0), this.uiManager.showSpinner(this.translation.t("loading")), await this.options.onSubmit({
|
|
4394
4400
|
formData: this.formManager.getFormState().formData
|
|
4395
|
-
}), this.uiManager.hideSpinner(), this.stateCoordinator.setSubmitting(!1), this.updateFormUI();
|
|
4401
|
+
}), this.uiManager.hideSpinner(), this.options.onLoadingStateChange?.(!1), this.stateCoordinator.setSubmitting(!1), this.updateFormUI();
|
|
4396
4402
|
} catch {
|
|
4397
4403
|
this.handleSubmitError("Payment processing failed. Please try again.");
|
|
4398
4404
|
}
|
|
4399
4405
|
}
|
|
4400
4406
|
handleSubmitError(t) {
|
|
4401
|
-
this.uiManager.hideSpinner(), this.stateCoordinator.setSubmitting(!1), this.uiManager.setErrorMessage(t), this.updateFormUI();
|
|
4407
|
+
this.uiManager.hideSpinner(), this.options.onLoadingStateChange?.(!1), this.stateCoordinator.setSubmitting(!1), this.uiManager.setErrorMessage(t), this.updateFormUI();
|
|
4402
4408
|
}
|
|
4403
4409
|
async handlePaypalSubmit() {
|
|
4404
|
-
this.stateCoordinator.setSubmitting(!0), this.updateFormUI(), this.uiManager.showSpinner(this.translation.t("loading"));
|
|
4410
|
+
this.stateCoordinator.setSubmitting(!0), this.updateFormUI(), this.options.onLoadingStateChange?.(!0), this.uiManager.showSpinner(this.translation.t("loading"));
|
|
4405
4411
|
try {
|
|
4406
4412
|
await this.options.onSubmit({
|
|
4407
4413
|
formData: null
|
|
@@ -4409,7 +4415,7 @@ class Ri extends S {
|
|
|
4409
4415
|
} catch {
|
|
4410
4416
|
this.uiManager.setErrorMessage(
|
|
4411
4417
|
"PayPal processing failed. Please try again."
|
|
4412
|
-
), this.uiManager.hideSpinner(), this.stateCoordinator.setSubmitting(!1), this.updateFormUI();
|
|
4418
|
+
), this.uiManager.hideSpinner(), this.options.onLoadingStateChange?.(!1), this.stateCoordinator.setSubmitting(!1), this.updateFormUI();
|
|
4413
4419
|
}
|
|
4414
4420
|
}
|
|
4415
4421
|
setErrorMessage(t) {
|
package/dist/package.json
CHANGED