@monei-js/components 1.7.10 → 2.1.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/README.md +100 -9
- package/dist/chunk.js +13 -0
- package/dist/index.cjs +1643 -0
- package/dist/index.d.cts +528 -0
- package/dist/index.d.ts +526 -14
- package/dist/index.js +1616 -7
- package/dist/monei.umd.production.min.js +64 -0
- package/dist/monei.umd.production.min.js.map +1 -0
- package/package.json +42 -65
- package/src/bridge/types.ts +106 -0
- package/dist/api.d.ts +0 -13
- package/dist/bizum/container.d.ts +0 -4
- package/dist/bizum/index.d.ts +0 -5
- package/dist/bizum/modal.d.ts +0 -3
- package/dist/bizum/types.d.ts +0 -30
- package/dist/cardInput/index.d.ts +0 -8
- package/dist/cardInput/types.d.ts +0 -51
- package/dist/click2pay/container.d.ts +0 -4
- package/dist/click2pay/index.d.ts +0 -5
- package/dist/click2pay/modal.d.ts +0 -3
- package/dist/click2pay/types.d.ts +0 -23
- package/dist/cofidis/container.d.ts +0 -4
- package/dist/cofidis/index.d.ts +0 -6
- package/dist/cofidis/modal.d.ts +0 -3
- package/dist/cofidis/types.d.ts +0 -45
- package/dist/cofidis/widget.d.ts +0 -3
- package/dist/cofidisLoan/container.d.ts +0 -4
- package/dist/cofidisLoan/index.d.ts +0 -7
- package/dist/cofidisLoan/modal.d.ts +0 -4
- package/dist/cofidisLoan/types.d.ts +0 -45
- package/dist/cofidisLoan/widget.d.ts +0 -4
- package/dist/components.cjs.development.js +0 -18997
- package/dist/components.cjs.development.js.map +0 -1
- package/dist/components.cjs.production.min.js +0 -2
- package/dist/components.cjs.production.min.js.map +0 -1
- package/dist/components.esm.js +0 -18979
- package/dist/components.esm.js.map +0 -1
- package/dist/config.d.ts +0 -28
- package/dist/container.d.ts +0 -1
- package/dist/enums.d.ts +0 -4
- package/dist/googlePay/index.d.ts +0 -4
- package/dist/googlePay/types.d.ts +0 -21
- package/dist/paymentModal/container.d.ts +0 -4
- package/dist/paymentModal/index.d.ts +0 -6
- package/dist/paymentModal/types.d.ts +0 -28
- package/dist/paymentRequest/index.d.ts +0 -4
- package/dist/paymentRequest/types.d.ts +0 -22
- package/dist/paypal/index.d.ts +0 -4
- package/dist/paypal/types.d.ts +0 -27
- package/dist/types.d.ts +0 -194
- package/dist/utils.d.ts +0 -11
- package/types/belter.d.ts +0 -1
- package/types/component.d.ts +0 -196
- package/types/css.d.ts +0 -9
- package/types/global.d.ts +0 -3
- package/types/post-robot.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,16 +1,107 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @monei-js/components
|
|
2
2
|
|
|
3
|
-
MONEI UI Components
|
|
3
|
+
MONEI UI Components — drop-in payment UI for the web. Renders secure iframes for card input, PayPal, Bizum, Apple Pay, and a full payment modal. Works with any framework or vanilla JS.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Framework Packages
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
Translating placeholders into your customer’s preferred language
|
|
9
|
-
Using responsive design to fit the width of your customer’s screen or mobile device
|
|
10
|
-
Customizing the styling to match the look and feel of your checkout flow
|
|
7
|
+
For framework-specific components with idiomatic APIs and full type support:
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
| Package | Framework | Install |
|
|
10
|
+
| ------------------------------ | ----------- | ------------------------------------ |
|
|
11
|
+
| `@monei-js/react-components` | React 17+ | `npm i @monei-js/react-components` |
|
|
12
|
+
| `@monei-js/vue-components` | Vue 3.3+ | `npm i @monei-js/vue-components` |
|
|
13
|
+
| `@monei-js/angular-components` | Angular 14+ | `npm i @monei-js/angular-components` |
|
|
14
|
+
| `@monei-js/svelte-components` | Svelte 5+ | `npm i @monei-js/svelte-components` |
|
|
15
|
+
|
|
16
|
+
All framework packages require `@monei-js/components` as a peer dependency for API functions (`confirmPayment`, `api`, etc.).
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install @monei-js/components
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or load via CDN:
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<script src="https://js.monei.com/v3/monei.js"></script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Components
|
|
31
|
+
|
|
32
|
+
| Component | Description |
|
|
33
|
+
| ---------------- | -------------------------------------------- |
|
|
34
|
+
| `CardInput` | Secure card number/expiry/CVC input (iframe) |
|
|
35
|
+
| `PaymentModal` | Full-screen payment flow modal |
|
|
36
|
+
| `Bizum` | Bizum button + phone verification modal |
|
|
37
|
+
| `PayPal` | PayPal checkout button |
|
|
38
|
+
| `PaymentRequest` | Apple Pay / browser Payment Request button |
|
|
39
|
+
|
|
40
|
+
## Quick Start (Vanilla JS)
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
import {CardInput, confirmPayment} from '@monei-js/components';
|
|
44
|
+
|
|
45
|
+
const cardInput = CardInput({
|
|
46
|
+
paymentId: 'pay_...',
|
|
47
|
+
onChange({isTouched, error, cardType}) {
|
|
48
|
+
// handle validation state
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
cardInput.render('#card-input');
|
|
52
|
+
|
|
53
|
+
// Tokenize and confirm
|
|
54
|
+
const {token} = await cardInput.submit();
|
|
55
|
+
const result = await confirmPayment({paymentId: 'pay_...', paymentToken: token});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## API
|
|
59
|
+
|
|
60
|
+
Exported via `api` namespace:
|
|
61
|
+
|
|
62
|
+
- `confirmPayment({paymentId, ...})` — confirm a payment with token
|
|
63
|
+
- `getPaymentMethods({accountId | paymentId})` — list available payment methods
|
|
64
|
+
- `getPayment(paymentId)` — fetch payment status
|
|
65
|
+
- `createPayment({accountId, amount, currency, ...})` — create a client-side payment (POS)
|
|
66
|
+
- `sendPaymentReceipt({paymentId, customerEmail, ...})` — send receipt email
|
|
67
|
+
|
|
68
|
+
## Migrating from `createToken`
|
|
69
|
+
|
|
70
|
+
Before:
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
import {CardInput, createToken} from '@monei-js/components';
|
|
74
|
+
|
|
75
|
+
const cardInput = CardInput({paymentId: 'pay_...'});
|
|
76
|
+
cardInput.render('#card-input');
|
|
77
|
+
const {token} = await createToken(cardInput);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
After (instance `submit()`):
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
import {CardInput} from '@monei-js/components';
|
|
84
|
+
|
|
85
|
+
const cardInput = CardInput({paymentId: 'pay_...'});
|
|
86
|
+
cardInput.render('#card-input');
|
|
87
|
+
const {token} = await cardInput.submit({cardholderName: 'John'});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
`createToken()` still works but logs a deprecation warning.
|
|
91
|
+
|
|
92
|
+
## Deprecated APIs
|
|
93
|
+
|
|
94
|
+
- **`.driver()`** — Use the framework-specific packages above instead. `.driver('react')` → `@monei-js/react-components`, `.driver('vue3')` → `@monei-js/vue-components`, `.driver('angular')` → `@monei-js/angular-components`.
|
|
95
|
+
- **`createToken(instance)`** — Use `instance.submit()` instead (see above).
|
|
96
|
+
|
|
97
|
+
## Server-Side
|
|
98
|
+
|
|
99
|
+
For creating payments on your server, use [@monei-js/node-sdk](https://github.com/MONEI/monei-node-sdk).
|
|
13
100
|
|
|
14
101
|
## Documentation
|
|
15
102
|
|
|
16
|
-
|
|
103
|
+
Full docs: [docs.monei.com/docs/monei-js-overview](https://docs.monei.com/docs/monei-js-overview)
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT
|
package/dist/chunk.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __exportAll = (all, no_symbols) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
|
+
return target;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __exportAll as t };
|