@paynext/sdk 0.0.95 → 0.0.96
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/README.md +40 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +6 -6
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -112,6 +112,7 @@ interface PayNextConfig {
|
|
|
112
112
|
variant?: 'default' | 'compact'
|
|
113
113
|
locale?: Locale
|
|
114
114
|
translate?: CheckoutTranslate
|
|
115
|
+
errorMessageText?: string
|
|
115
116
|
styles?: StylesConfig
|
|
116
117
|
onCheckoutLoaded?: (result: LoadedResult) => void
|
|
117
118
|
onCheckoutAttempt?: (result: AttemptResult) => void
|
|
@@ -125,6 +126,45 @@ interface LoadedResult {
|
|
|
125
126
|
}
|
|
126
127
|
```
|
|
127
128
|
|
|
129
|
+
### Add a Submit Button Icon
|
|
130
|
+
|
|
131
|
+
Provide inline SVG markup via `styles.SubmitButton.iconSvg` to render an icon to the left of the "Pay with card" button label. The SDK hides the icon and shows a spinner while a payment request is in flight, then restores the icon once processing finishes. A 24x24px viewBox keeps the layout balanced.
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
const checkout = new PayNextCheckout(container)
|
|
135
|
+
|
|
136
|
+
await checkout.mount({
|
|
137
|
+
...config,
|
|
138
|
+
styles: {
|
|
139
|
+
SubmitButton: {
|
|
140
|
+
iconSvg: `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
141
|
+
<path d="M6 12L10 16L18 8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
|
|
142
|
+
</svg>`
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Customize the Back Button
|
|
149
|
+
|
|
150
|
+
Pass `styles.BackButton` to adjust the container that wraps the default arrow icon. Both `className` and `styles` map directly onto that wrapper `<div>`, letting you add global CSS hooks or inline overrides without replacing the built-in markup.
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
const checkout = new PayNextCheckout(container)
|
|
154
|
+
|
|
155
|
+
await checkout.mount({
|
|
156
|
+
...config,
|
|
157
|
+
styles: {
|
|
158
|
+
BackButton: {
|
|
159
|
+
className: 'my-back-button',
|
|
160
|
+
styles: {
|
|
161
|
+
color: '#111827'
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
})
|
|
166
|
+
```
|
|
167
|
+
|
|
128
168
|
## Supported Payment Methods
|
|
129
169
|
|
|
130
170
|
- **Cards**: Visa, Mastercard, American Express, Discover, JCB, Diners Club, UnionPay, Maestro
|
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -5011,7 +5011,7 @@ class vl {
|
|
|
5011
5011
|
}
|
|
5012
5012
|
}
|
|
5013
5013
|
class gl {
|
|
5014
|
-
constructor() {
|
|
5014
|
+
constructor(t) {
|
|
5015
5015
|
C(this, "template", `
|
|
5016
5016
|
<svg
|
|
5017
5017
|
xmlns='http://www.w3.org/2000/svg'
|
|
@@ -5030,7 +5030,7 @@ class gl {
|
|
|
5030
5030
|
<span class="${ne.srOnly}">Back</span>
|
|
5031
5031
|
`);
|
|
5032
5032
|
C(this, "element", document.createElement("div"));
|
|
5033
|
-
this.element.classList.add(ne.backButton), this.element.innerHTML = this.template;
|
|
5033
|
+
this.element.classList.add(ne.backButton), t != null && t.className && this.element.classList.add(t.className), t != null && t.styles && Object.assign(this.element.style, t.styles), this.element.innerHTML = this.template;
|
|
5034
5034
|
}
|
|
5035
5035
|
render() {
|
|
5036
5036
|
return this.element;
|
|
@@ -5040,10 +5040,10 @@ const yl = "_button_125my_1", bl = {
|
|
|
5040
5040
|
button: yl
|
|
5041
5041
|
};
|
|
5042
5042
|
class El {
|
|
5043
|
-
constructor() {
|
|
5043
|
+
constructor(t) {
|
|
5044
5044
|
C(this, "element");
|
|
5045
|
-
C(this, "icon"
|
|
5046
|
-
this.element = document.createElement("div"), this.element.classList.add(bl.button), this.element.appendChild(this.icon.render());
|
|
5045
|
+
C(this, "icon");
|
|
5046
|
+
this.element = document.createElement("div"), this.element.classList.add(bl.button), this.icon = new gl(t), this.element.appendChild(this.icon.render());
|
|
5047
5047
|
}
|
|
5048
5048
|
addEventListener(t) {
|
|
5049
5049
|
return this.element.addEventListener("click", t);
|
|
@@ -5825,7 +5825,7 @@ class gd {
|
|
|
5825
5825
|
close: new oe()
|
|
5826
5826
|
});
|
|
5827
5827
|
const s = r.getState();
|
|
5828
|
-
this.element = document.createElement("form"), this.onPaymentAttempt = i, this.submit = new Il(t, s.SubmitButton), this.back = new El(), this.number = new rd(t, s.Input), this.name = new Ul(t, s.Input), this.cardSecurity = new vd(t, s.Input), this.element.classList.add(Oe.cardForm, e || "");
|
|
5828
|
+
this.element = document.createElement("form"), this.onPaymentAttempt = i, this.submit = new Il(t, s.SubmitButton), this.back = new El(s.BackButton), this.number = new rd(t, s.Input), this.name = new Ul(t, s.Input), this.cardSecurity = new vd(t, s.Input), this.element.classList.add(Oe.cardForm, e || "");
|
|
5829
5829
|
const o = this.back.render();
|
|
5830
5830
|
a && (this.isBackVisible = !1, o.classList.add(Oe.hidden), this.element.classList.add(Oe.topOffset)), this.element.append(
|
|
5831
5831
|
o,
|