@paynext/sdk 0.0.134 → 0.0.135
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/index.d.ts +2 -1
- package/dist/index.es.js +19 -13
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +6 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -515,9 +515,10 @@ declare enum PaymentStatus {
|
|
|
515
515
|
|
|
516
516
|
export declare class PayNextCheckout {
|
|
517
517
|
private core;
|
|
518
|
+
private parentId;
|
|
518
519
|
constructor();
|
|
519
520
|
mount(componentId: string, config: PayNextConfig): Promise<void>;
|
|
520
|
-
unmount(
|
|
521
|
+
unmount(): Promise<void>;
|
|
521
522
|
}
|
|
522
523
|
|
|
523
524
|
export declare interface PayNextConfig {
|
package/dist/index.es.js
CHANGED
|
@@ -54,6 +54,7 @@ import ub from "react";
|
|
|
54
54
|
class G3 {
|
|
55
55
|
constructor() {
|
|
56
56
|
b(this, "core");
|
|
57
|
+
b(this, "parentId");
|
|
57
58
|
}
|
|
58
59
|
mount(e, n) {
|
|
59
60
|
return A(this, null, function* () {
|
|
@@ -63,7 +64,7 @@ class G3 {
|
|
|
63
64
|
console.error(`Element with id "${e}" not found`);
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
|
-
if (!this.core) {
|
|
67
|
+
if (this.parentId = e, !this.core) {
|
|
67
68
|
const y = (yield import("./index-C6qOiJ-j.js")).Core;
|
|
68
69
|
this.core = new y();
|
|
69
70
|
}
|
|
@@ -77,11 +78,13 @@ class G3 {
|
|
|
77
78
|
r.innerHTML = "", r.appendChild(i), (g = (h = (p = this.core) == null ? void 0 : p.state) == null ? void 0 : h.checkout) == null || g.setState(n);
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
|
-
unmount(
|
|
81
|
+
unmount() {
|
|
81
82
|
return A(this, null, function* () {
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
var n;
|
|
84
|
+
if (!this.parentId)
|
|
85
|
+
return;
|
|
86
|
+
const e = document.getElementById(this.parentId);
|
|
87
|
+
!e || !this.core || (e.innerHTML = "", (n = this.core) == null || n.clearState());
|
|
85
88
|
});
|
|
86
89
|
}
|
|
87
90
|
}
|
|
@@ -4232,13 +4235,13 @@ class wE {
|
|
|
4232
4235
|
return !1;
|
|
4233
4236
|
const s = e ? k(m({}, e), {
|
|
4234
4237
|
onError: (o) => {
|
|
4235
|
-
var c, l;
|
|
4238
|
+
var c, l, d;
|
|
4236
4239
|
if (!this.isInitialized) {
|
|
4237
4240
|
console.error("Apple Pay error:", o);
|
|
4238
4241
|
return;
|
|
4239
4242
|
}
|
|
4240
4243
|
const a = this.config.state.translate.messages();
|
|
4241
|
-
o
|
|
4244
|
+
(c = o == null ? void 0 : o.toLowerCase()) != null && c.includes("cancelled") ? (l = e.onCancel) == null || l.call(e) : (Ks(o, a), (d = e.onError) == null || d.call(e, { e: o, paymentMethod: H.APPLE_PAY }));
|
|
4242
4245
|
},
|
|
4243
4246
|
onSuccess: (o) => {
|
|
4244
4247
|
var a;
|
|
@@ -4441,7 +4444,10 @@ class LE {
|
|
|
4441
4444
|
"cancelled by user",
|
|
4442
4445
|
"user cancelled",
|
|
4443
4446
|
"popup close"
|
|
4444
|
-
].some((s) =>
|
|
4447
|
+
].some((s) => {
|
|
4448
|
+
var o;
|
|
4449
|
+
return (o = n == null ? void 0 : n.toLowerCase()) == null ? void 0 : o.includes(s);
|
|
4450
|
+
});
|
|
4445
4451
|
}
|
|
4446
4452
|
// render
|
|
4447
4453
|
render() {
|
|
@@ -4575,8 +4581,8 @@ class HE {
|
|
|
4575
4581
|
}
|
|
4576
4582
|
// handle venmo errors
|
|
4577
4583
|
handleVenmoError(e, n) {
|
|
4578
|
-
var r, i, s;
|
|
4579
|
-
this.isInitialized && ((r = e == null ? void 0 : e.message)
|
|
4584
|
+
var r, i, s, o;
|
|
4585
|
+
this.isInitialized && ((i = (r = e == null ? void 0 : e.message) == null ? void 0 : r.toLowerCase()) != null && i.includes("close") ? (s = n == null ? void 0 : n.onCancel) == null || s.call(n) : (o = n == null ? void 0 : n.onError) == null || o.call(n, { e, paymentMethod: H.VENMO }));
|
|
4580
4586
|
}
|
|
4581
4587
|
// add event listener
|
|
4582
4588
|
addEventListener(e, n) {
|
|
@@ -4925,7 +4931,7 @@ class d1 {
|
|
|
4925
4931
|
var i, s, o, a, c, l, d, u, f;
|
|
4926
4932
|
const r = e.messages();
|
|
4927
4933
|
if (this.element = document.createElement("div"), this.element.classList.add(Pe.wrapper), this.inputContainer.classList.add(Pe.inputContainer), (i = n == null ? void 0 : n.container) != null && i.className && Te(this.inputContainer, n.container.className), (s = n == null ? void 0 : n.container) != null && s.styles && Object.assign(this.inputContainer.style, n.container.styles), this.input.setAttribute("id", this.id), this.input.setAttribute("autocomplete", "cc-name"), this.input.setAttribute("placeholder", r.card.name.placeholder), this.input.classList.add(Pe.input), (o = n == null ? void 0 : n.field) != null && o.className && Te(this.input, n.field.className), (a = n == null ? void 0 : n.field) != null && a.styles && Object.assign(this.input.style, n.field.styles), (c = n == null ? void 0 : n.placeholder) != null && c.styles && Object.keys(n.placeholder.styles).length) {
|
|
4928
|
-
const p = (g) => g.replace(/[A-Z]/g, (_) => "-" + _.toLowerCase()), h = Object.entries(n.placeholder.styles).map(([g, _]) => `${p(g)}:${_};`).join("");
|
|
4934
|
+
const p = (g) => g.replace(/[A-Z]/g, (_) => "-" + (_ == null ? void 0 : _.toLowerCase())), h = Object.entries(n.placeholder.styles).map(([g, _]) => `${p(g)}:${_};`).join("");
|
|
4929
4935
|
this.placeholderStyle.textContent = `#${this.id}::placeholder{${h}}`, this.element.appendChild(this.placeholderStyle);
|
|
4930
4936
|
}
|
|
4931
4937
|
this.endContent.classList.add(Pe.hidden), this.endContent.appendChild(this.warning.render()), this.inputContainer.append(this.input, this.endContent), this.label.setAttribute("for", this.id), this.label.classList.add(Pe.label), (l = n == null ? void 0 : n.label) != null && l.className && Te(this.label, n.label.className), (d = n == null ? void 0 : n.label) != null && d.styles && Object.assign(this.label.style, n.label.styles), this.labelText.textContent = r.card.name.label, this.labelError.textContent = r.card.required, this.labelError.classList.add(Pe.labelError, Pe.hidden), (u = n == null ? void 0 : n.error) != null && u.className && Te(this.labelError, n.error.className), (f = n == null ? void 0 : n.error) != null && f.styles && Object.assign(this.labelError.style, n.error.styles), this.label.append(this.labelText, this.labelError), this.element.append(this.label, this.inputContainer), this.input.addEventListener("input", () => this.handleChange(this.input.value)), this.input.addEventListener("paste", () => this.handleChange(this.input.value)), this.input.addEventListener("blur", () => this.validate(this.input.value)), e.subscribe(({ messages: p }) => {
|
|
@@ -5131,7 +5137,7 @@ class k1 {
|
|
|
5131
5137
|
this.translate = e;
|
|
5132
5138
|
const r = e.messages();
|
|
5133
5139
|
if (this.element = document.createElement("div"), this.element.classList.add(Ce.wrapper), this.inputContainer.classList.add(Ce.inputContainer), (i = n == null ? void 0 : n.container) != null && i.className && Te(this.inputContainer, n.container.className), (s = n == null ? void 0 : n.container) != null && s.styles && Object.assign(this.inputContainer.style, n.container.styles), this.input.setAttribute("id", this.id), this.input.setAttribute("autocomplete", "cc-number"), this.input.setAttribute("placeholder", "1234 1234 1234 1234"), this.input.setAttribute("inputmode", "numeric"), this.input.setAttribute("pattern", "[0-9]*"), this.input.setAttribute("enterkeyhint", "done"), this.input.classList.add(Ce.input), (o = n == null ? void 0 : n.field) != null && o.className && Te(this.input, n.field.className), (a = n == null ? void 0 : n.field) != null && a.styles && Object.assign(this.input.style, n.field.styles), (c = n == null ? void 0 : n.placeholder) != null && c.styles && Object.keys(n.placeholder.styles).length) {
|
|
5134
|
-
const p = (_) => _.replace(/[A-Z]/g, (y) => "-" + y.toLowerCase()), h = Object.entries(n.placeholder.styles).map(([_, y]) => `${p(_)}:${y} !important;`).join(""), g = `#${this.id}`;
|
|
5140
|
+
const p = (_) => _.replace(/[A-Z]/g, (y) => "-" + (y == null ? void 0 : y.toLowerCase())), h = Object.entries(n.placeholder.styles).map(([_, y]) => `${p(_)}:${y} !important;`).join(""), g = `#${this.id}`;
|
|
5135
5141
|
this.placeholderStyle.textContent = `${g}::placeholder{${h}}
|
|
5136
5142
|
${g}::-webkit-input-placeholder{${h}}
|
|
5137
5143
|
${g}::-moz-placeholder{${h}}
|
|
@@ -5303,7 +5309,7 @@ class B1 {
|
|
|
5303
5309
|
this.element = document.createElement("div"), this.element.classList.add(K.securityContent), this.expiryInputContainer.classList.add(K.inputContainer), (o = n == null ? void 0 : n.container) != null && o.className && Te(this.expiryInputContainer, n.container.className), (a = n == null ? void 0 : n.container) != null && a.styles && Object.assign(this.expiryInputContainer.style, n.container.styles), this.expiryInput.setAttribute("id", this.expiryId), this.expiryInput.setAttribute("autocomplete", "cc-exp"), this.expiryInput.setAttribute("placeholder", r.card.expiry.placeholder), this.expiryInput.setAttribute("inputmode", "numeric"), this.expiryInput.setAttribute("pattern", "[0-9]*"), this.expiryInput.setAttribute("enterkeyhint", "next"), this.expiryInput.classList.add(K.input), (c = n == null ? void 0 : n.field) != null && c.className && Te(this.expiryInput, n.field.className), (l = n == null ? void 0 : n.field) != null && l.styles && Object.assign(this.expiryInput.style, n.field.styles), this.expiryEndContent.classList.add(K.endContent), this.expiryEndContent.appendChild(this.expiryWarning.render()), this.expiryInputContainer.append(this.expiryInput, this.expiryEndContent), this.expiryLabel.setAttribute("for", this.expiryId), this.expiryLabel.classList.add(K.label), (d = n == null ? void 0 : n.label) != null && d.className && Te(this.expiryLabel, n.label.className), (u = n == null ? void 0 : n.label) != null && u.styles && Object.assign(this.expiryLabel.style, n.label.styles), this.expiryLabelText.contentEditable = "false", this.expiryLabelText.textContent = r.card.expiry.label, this.expiryLabelError.textContent = r.card.required, this.expiryLabelError.classList.add(K.labelError, K.hidden), this.expiryLabel.append(this.expiryLabelText, this.expiryLabelError), this.expiryError.classList.add(K.error, K.hidden), (f = n == null ? void 0 : n.error) != null && f.className && Te(this.expiryError, n.error.className), (p = n == null ? void 0 : n.error) != null && p.styles && Object.assign(this.expiryError.style, n.error.styles);
|
|
5304
5310
|
const i = document.createElement("div");
|
|
5305
5311
|
if (i.appendChild(this.expiryError), this.cvcInputContainer.classList.add(K.inputContainer), (h = n == null ? void 0 : n.container) != null && h.className && Te(this.cvcInputContainer, n.container.className), (g = n == null ? void 0 : n.container) != null && g.styles && Object.assign(this.cvcInputContainer.style, n.container.styles), this.cvcInput.setAttribute("id", this.cvcId), this.cvcInput.setAttribute("autocomplete", "cc-csc"), this.cvcInput.setAttribute("placeholder", r.card.cvc.placeholder), this.cvcInput.setAttribute("inputmode", "numeric"), this.cvcInput.setAttribute("pattern", "[0-9]*"), this.cvcInput.setAttribute("enterkeyhint", "done"), this.cvcInput.classList.add(K.input), (_ = n == null ? void 0 : n.field) != null && _.className && Te(this.cvcInput, n.field.className), (y = n == null ? void 0 : n.field) != null && y.styles && Object.assign(this.cvcInput.style, n.field.styles), (v = n == null ? void 0 : n.placeholder) != null && v.styles && Object.keys(n.placeholder.styles).length) {
|
|
5306
|
-
const T = (I) => I.replace(/[A-Z]/g, (L) => "-" + L.toLowerCase()), w = Object.entries(n.placeholder.styles).map(([I, L]) => `${T(I)}:${L};`).join("");
|
|
5312
|
+
const T = (I) => I.replace(/[A-Z]/g, (L) => "-" + (L == null ? void 0 : L.toLowerCase())), w = Object.entries(n.placeholder.styles).map(([I, L]) => `${T(I)}:${L};`).join("");
|
|
5307
5313
|
this.placeholderStyle.textContent = `#${this.expiryId}::placeholder{${w}}#${this.cvcId}::placeholder{${w}}`, this.element.appendChild(this.placeholderStyle);
|
|
5308
5314
|
}
|
|
5309
5315
|
this.cvcEndContent.classList.add(K.endContent), this.cvcEndContent.appendChild(this.cardCvc.render()), this.cvcInputContainer.append(this.cvcInput, this.cvcEndContent), this.cvcLabel.setAttribute("for", this.cvcId), this.cvcLabel.classList.add(K.label), (C = n == null ? void 0 : n.label) != null && C.className && Te(this.cvcLabel, n.label.className), (x = n == null ? void 0 : n.label) != null && x.styles && Object.assign(this.cvcLabel.style, n.label.styles), this.cvcLabelText.textContent = r.card.cvc.label, this.cvcLabelError.textContent = r.card.required, this.cvcLabelError.classList.add(K.labelError, K.hidden), (R = n == null ? void 0 : n.error) != null && R.className && Te(this.cvcLabel, n.error.className), (M = n == null ? void 0 : n.error) != null && M.styles && Object.assign(this.cvcLabelError.style, n.error.styles), this.cvcLabel.append(this.cvcLabelText, this.cvcLabelError), this.cvcError.classList.add(K.error, K.hidden);
|