@paynext/sdk 0.0.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/README.md +54 -0
- package/dist/assets/index.css +1 -0
- package/dist/index.d.ts +221 -0
- package/dist/index.es.js +9272 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.umd.js +53 -0
- package/dist/index.umd.js.map +1 -0
- package/package.json +77 -0
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## Expanding the ESLint configuration
|
|
11
|
+
|
|
12
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
export default tseslint.config({
|
|
16
|
+
extends: [
|
|
17
|
+
// Remove ...tseslint.configs.recommended and replace with this
|
|
18
|
+
...tseslint.configs.recommendedTypeChecked,
|
|
19
|
+
// Alternatively, use this for stricter rules
|
|
20
|
+
...tseslint.configs.strictTypeChecked,
|
|
21
|
+
// Optionally, add this for stylistic rules
|
|
22
|
+
...tseslint.configs.stylisticTypeChecked,
|
|
23
|
+
],
|
|
24
|
+
languageOptions: {
|
|
25
|
+
// other options...
|
|
26
|
+
parserOptions: {
|
|
27
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
28
|
+
tsconfigRootDir: import.meta.dirname,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
})
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
// eslint.config.js
|
|
38
|
+
import reactX from 'eslint-plugin-react-x'
|
|
39
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
40
|
+
|
|
41
|
+
export default tseslint.config({
|
|
42
|
+
plugins: {
|
|
43
|
+
// Add the react-x and react-dom plugins
|
|
44
|
+
'react-x': reactX,
|
|
45
|
+
'react-dom': reactDom,
|
|
46
|
+
},
|
|
47
|
+
rules: {
|
|
48
|
+
// other rules...
|
|
49
|
+
// Enable its recommended typescript rules
|
|
50
|
+
...reactX.configs['recommended-typescript'].rules,
|
|
51
|
+
...reactDom.configs.recommended.rules,
|
|
52
|
+
},
|
|
53
|
+
})
|
|
54
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._button_159xd_1{transition-property:transform,color,background,background-color,border-color,text-decoration-color,fill,stroke,opacity;transition-timing-function:ease;transition-duration:.25s;position:relative;z-index:0;box-sizing:border-box;display:inline-flex;height:2.5rem;width:100%;min-width:5rem;transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;align-items:center;justify-content:center;gap:.5rem;overflow:hidden;white-space:nowrap;border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1));padding-left:1rem;padding-right:1rem;font-size:.875rem;line-height:1.25rem;font-weight:400;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1));-webkit-font-smoothing:auto;-moz-osx-font-smoothing:auto;outline:2px solid transparent;outline-offset:2px}@media (prefers-reduced-motion: reduce){._button_159xd_1{transition-property:none}}._button_159xd_1>svg{max-width:2rem}._primary_159xd_11{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}._success_159xd_15{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}._loading_159xd_19,._button_159xd_1:hover{opacity:.7}._press_159xd_24{transform:scale(.95)}._card_1woqz_1{display:grid;gap:.75rem;padding-top:1rem}._title_1woqz_5{font-size:.875rem;line-height:1.25rem;font-weight:600}._error_1woqz_9{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}._label_1woqz_13{display:flex;width:100%;justify-content:space-between}._label_1woqz_13 span{text-wrap:nowrap;text-overflow:ellipsis;overflow:hidden}._cardDataContainer_1woqz_23{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.5rem}._iconContainer_1woqz_27{margin:0 1px}._payButton_1woqz_31{display:flex;align-items:center;justify-content:center}._spinner_1woqz_35{width:24px;height:24px}._inputContainer_1eto7_1{background-color:transparent;display:flex;height:40px;width:100%;cursor:text;align-items:center;justify-content:space-between;border-radius:.75rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1));padding-left:.75rem;padding-right:.75rem}._inputContainer_1eto7_1::-moz-placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}._inputContainer_1eto7_1::placeholder{--tw-placeholder-opacity: 1;color:rgb(156 163 175 / var(--tw-placeholder-opacity, 1))}._inputContainer_1eto7_1{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}@media (min-width: 640px){._inputContainer_1eto7_1{font-size:.875rem;line-height:1.25rem}}._inputFocus_1eto7_6,._inputContainer_1eto7_1:hover{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity, 1))}._input_1eto7_1{background-color:transparent;display:block;height:100%;width:100%;border-style:none;font-size:1rem;font-weight:400;outline:2px solid transparent;outline-offset:2px}._endContent_1eto7_16{display:flex}._errorInput_1eto7_20{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1));--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}._errorInput_1eto7_20:hover{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1));--tw-ring-opacity: 1;--tw-ring-color: rgb(220 38 38 / var(--tw-ring-opacity, 1))}._errorInput_1eto7_20:focus{--tw-border-opacity: 1;border-color:rgb(220 38 38 / var(--tw-border-opacity, 1));--tw-ring-opacity: 1;--tw-ring-color: rgb(220 38 38 / var(--tw-ring-opacity, 1))}._error_1eto7_20{margin-top:.25rem;padding-left:.25rem;font-size:.75rem;line-height:1rem;font-weight:400;--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}._label_1eto7_28{margin-bottom:2px;display:flex;align-items:center;justify-content:space-between;padding-left:1px;padding-right:.5rem;font-size:.75rem;line-height:1rem;font-weight:400}._labelError_1eto7_32{font-size:.6875rem;--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}._cvcIcon_1yx89_1{width:100%;height:100%}._iconContainer_1nckj_1{margin:0 1px}._container_4s1xq_1{display:flex;width:100%;flex-grow:1;flex-direction:row;align-items:center;justify-content:flex-start;-moz-column-gap:.25rem;column-gap:.25rem;border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(254 231 239 / var(--tw-bg-opacity, 1));padding:.75rem 1rem;--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}._container_4s1xq_1:is(._dark_4s1xq_1 *){background-color:#fee7ef80;--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}._iconContainer_4s1xq_5{width:16px;height:16px}._icon_4s1xq_5{width:100%;height:100%}._title_4s1xq_15{padding-left:.25rem;font-size:.875rem;line-height:1.25rem;font-weight:300}._svg_1kkac_1{height:100%;width:100%}@keyframes _spin_1kkac_1{to{transform:rotate(360deg)}}._svg_1kkac_1{animation:_spin_1kkac_1 1s linear infinite;fill:#9ca3af;--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}._svg_1kkac_1:is(._dark_1kkac_1 *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}._sr_1kkac_5{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}._googlePay_1a960_1{border-radius:12px;height:40px;overflow:hidden;background-color:transparent}._googlePay_1a960_1 iframe{width:calc(100% + 12px)!important;height:44px!important;border:none;display:block;transform:translateY(-2px);margin:0 -6px}._hidden_1a960_17{display:none}._applePay_2b2iv_1{border-radius:12px;height:40px;overflow:hidden;background-color:transparent}._applePay_2b2iv_1 iframe{width:calc(100% + 12px)!important;height:44px!important;border:none;display:block;transform:translateY(-2px);margin:0 -6px}._hidden_2b2iv_17{display:none}._container_a64yo_1{position:relative;height:auto;min-height:40px;width:100%;max-width:640px}._backBtn_a64yo_5{cursor:pointer}._cardBtn_a64yo_9{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}._btnContainer_a64yo_13{display:grid;gap:.5rem}._spinner_a64yo_17{height:40px;width:40px}._spinnerContainer_a64yo_21{position:absolute;z-index:50;display:flex;height:auto;width:100%;align-items:center;justify-content:center;border-radius:.375rem}._paypalBtn_2m8yd_1{overflow:hidden;border-radius:12px;height:40px}._container_ipway_1{display:flex;width:100%;flex-direction:column;align-items:center;justify-content:center}._icon_ipway_5{position:absolute;top:50%;left:50%;width:1.5rem;--tw-translate-x: -50%;--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));fill:#16a34a}._iconContainer_ipway_9{position:relative;display:grid;height:2.25rem;width:2.25rem;flex:none;place-items:center;border-radius:9999px;--tw-bg-opacity: 1;background-color:rgb(232 250 240 / var(--tw-bg-opacity, 1))}._iconContainer_ipway_9:is(._dark_ipway_1 *){--tw-bg-opacity: 1;background-color:rgb(209 244 224 / var(--tw-bg-opacity, 1))}._title_ipway_13{margin-top:.5rem;font-weight:300}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { EvervaultProviderProps } from '@evervault/react';
|
|
3
|
+
import { FC } from 'react';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
export declare interface AblePayConfig {
|
|
7
|
+
clientToken: string;
|
|
8
|
+
supportedCardTypes?: CardType[];
|
|
9
|
+
variant?: 'default' | 'compact';
|
|
10
|
+
styles?: StylesConfig;
|
|
11
|
+
onCheckoutComplete?: () => void;
|
|
12
|
+
onCheckoutFail?: (error: Error) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare const AblePayModule: FC<CehckoutFormProps>;
|
|
16
|
+
export { AblePayModule }
|
|
17
|
+
export { AblePayModule as CheckoutForm }
|
|
18
|
+
|
|
19
|
+
export declare enum CardType {
|
|
20
|
+
Visa = "visa",
|
|
21
|
+
Mastercard = "mastercard",
|
|
22
|
+
AmericanExpress = "american-express",
|
|
23
|
+
Discover = "discover",
|
|
24
|
+
JCB = "jcb",
|
|
25
|
+
DinersClub = "diners-club",
|
|
26
|
+
UnionPay = "unionpay",
|
|
27
|
+
Maestro = "maestro"
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export declare const cardTypes: readonly [{
|
|
31
|
+
readonly name: "Visa";
|
|
32
|
+
readonly type: CardType.Visa;
|
|
33
|
+
readonly pattern: RegExp;
|
|
34
|
+
readonly minLength: 16;
|
|
35
|
+
readonly maxLength: 16;
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "MasterCard";
|
|
38
|
+
readonly type: CardType.Mastercard;
|
|
39
|
+
readonly pattern: RegExp;
|
|
40
|
+
readonly minLength: 16;
|
|
41
|
+
readonly maxLength: 16;
|
|
42
|
+
}, {
|
|
43
|
+
readonly name: "American Express";
|
|
44
|
+
readonly type: CardType.AmericanExpress;
|
|
45
|
+
readonly pattern: RegExp;
|
|
46
|
+
readonly minLength: 15;
|
|
47
|
+
readonly maxLength: 15;
|
|
48
|
+
}, {
|
|
49
|
+
readonly name: "Discover";
|
|
50
|
+
readonly type: CardType.Discover;
|
|
51
|
+
readonly pattern: RegExp;
|
|
52
|
+
readonly minLength: 16;
|
|
53
|
+
readonly maxLength: 16;
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "JCB";
|
|
56
|
+
readonly type: CardType.JCB;
|
|
57
|
+
readonly pattern: RegExp;
|
|
58
|
+
readonly minLength: 15;
|
|
59
|
+
readonly maxLength: 16;
|
|
60
|
+
}, {
|
|
61
|
+
readonly name: "Diners Club";
|
|
62
|
+
readonly type: CardType.DinersClub;
|
|
63
|
+
readonly pattern: RegExp;
|
|
64
|
+
readonly minLength: 14;
|
|
65
|
+
readonly maxLength: 16;
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "Union Pay";
|
|
68
|
+
readonly type: CardType.UnionPay;
|
|
69
|
+
readonly pattern: RegExp;
|
|
70
|
+
readonly minLength: 16;
|
|
71
|
+
readonly maxLength: 19;
|
|
72
|
+
}, {
|
|
73
|
+
readonly name: "Maestro";
|
|
74
|
+
readonly type: CardType.Maestro;
|
|
75
|
+
readonly pattern: RegExp;
|
|
76
|
+
readonly minLength: 12;
|
|
77
|
+
readonly maxLength: 19;
|
|
78
|
+
}];
|
|
79
|
+
|
|
80
|
+
export declare type CehckoutFormProps = AblePayConfig & {
|
|
81
|
+
evConfig: Pick<EvervaultProviderProps, 'appId' | 'teamId'>;
|
|
82
|
+
translate?: DeepPartial<CheckoutTranslate>;
|
|
83
|
+
locale?: Locale;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
declare interface CheckoutTranslate {
|
|
87
|
+
card: {
|
|
88
|
+
title: string;
|
|
89
|
+
number: {
|
|
90
|
+
label: string;
|
|
91
|
+
error: {
|
|
92
|
+
required: string;
|
|
93
|
+
invalid: string;
|
|
94
|
+
incomplete: string;
|
|
95
|
+
unsupported: string;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
expiry: {
|
|
99
|
+
label: string;
|
|
100
|
+
placeholder: string;
|
|
101
|
+
error: {
|
|
102
|
+
required: string;
|
|
103
|
+
invalid: string;
|
|
104
|
+
incomplete: string;
|
|
105
|
+
expired: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
cvc: {
|
|
109
|
+
label: string;
|
|
110
|
+
placeholder: string;
|
|
111
|
+
error: {
|
|
112
|
+
required: string;
|
|
113
|
+
incomplete: string;
|
|
114
|
+
invalid: string;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
name: {
|
|
118
|
+
label: string;
|
|
119
|
+
placeholder: string;
|
|
120
|
+
error: {
|
|
121
|
+
required: string;
|
|
122
|
+
invalid: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
pay: {
|
|
126
|
+
button: string;
|
|
127
|
+
};
|
|
128
|
+
compact: {
|
|
129
|
+
button: string;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
status: {
|
|
133
|
+
success: string;
|
|
134
|
+
error: string;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
declare type DeepPartial<T> = T extends object ? {
|
|
139
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
140
|
+
} : T;
|
|
141
|
+
|
|
142
|
+
declare const i18n: {
|
|
143
|
+
ar: CheckoutTranslate;
|
|
144
|
+
en: CheckoutTranslate;
|
|
145
|
+
bg: CheckoutTranslate;
|
|
146
|
+
cs: CheckoutTranslate;
|
|
147
|
+
da: CheckoutTranslate;
|
|
148
|
+
de: CheckoutTranslate;
|
|
149
|
+
el: CheckoutTranslate;
|
|
150
|
+
es: CheckoutTranslate;
|
|
151
|
+
et: CheckoutTranslate;
|
|
152
|
+
fi: CheckoutTranslate;
|
|
153
|
+
fil: CheckoutTranslate;
|
|
154
|
+
fr: CheckoutTranslate;
|
|
155
|
+
hr: CheckoutTranslate;
|
|
156
|
+
hu: CheckoutTranslate;
|
|
157
|
+
id: CheckoutTranslate;
|
|
158
|
+
it: CheckoutTranslate;
|
|
159
|
+
ja: CheckoutTranslate;
|
|
160
|
+
ko: CheckoutTranslate;
|
|
161
|
+
lt: CheckoutTranslate;
|
|
162
|
+
lv: CheckoutTranslate;
|
|
163
|
+
ms: CheckoutTranslate;
|
|
164
|
+
ru: CheckoutTranslate;
|
|
165
|
+
mt: CheckoutTranslate;
|
|
166
|
+
nb: CheckoutTranslate;
|
|
167
|
+
nl: CheckoutTranslate;
|
|
168
|
+
pl: CheckoutTranslate;
|
|
169
|
+
pt: CheckoutTranslate;
|
|
170
|
+
ro: CheckoutTranslate;
|
|
171
|
+
sk: CheckoutTranslate;
|
|
172
|
+
sl: CheckoutTranslate;
|
|
173
|
+
sv: CheckoutTranslate;
|
|
174
|
+
th: CheckoutTranslate;
|
|
175
|
+
tr: CheckoutTranslate;
|
|
176
|
+
vi: CheckoutTranslate;
|
|
177
|
+
zh: CheckoutTranslate;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export declare enum InputError {
|
|
181
|
+
Invalid = "invalid",
|
|
182
|
+
Empty = "empty",
|
|
183
|
+
Incomplete = "incomplete",
|
|
184
|
+
Unsupported = "unsupported",
|
|
185
|
+
Expired = "expired"
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
declare type InputStyles = {
|
|
189
|
+
field?: {
|
|
190
|
+
styles?: CSSProperties;
|
|
191
|
+
className?: string;
|
|
192
|
+
};
|
|
193
|
+
label?: {
|
|
194
|
+
styles?: CSSProperties;
|
|
195
|
+
className?: string;
|
|
196
|
+
};
|
|
197
|
+
error?: {
|
|
198
|
+
styles?: CSSProperties;
|
|
199
|
+
className?: string;
|
|
200
|
+
};
|
|
201
|
+
container?: {
|
|
202
|
+
styles?: CSSProperties;
|
|
203
|
+
className?: string;
|
|
204
|
+
focus?: string;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
declare type Locale = keyof typeof i18n;
|
|
209
|
+
|
|
210
|
+
export declare interface StylesConfig {
|
|
211
|
+
card?: {
|
|
212
|
+
input?: InputStyles;
|
|
213
|
+
button?: {
|
|
214
|
+
styles?: CSSProperties;
|
|
215
|
+
className?: string;
|
|
216
|
+
icon?: ReactNode;
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export { }
|