xendit-components-web 0.0.12 → 0.0.14
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/CHANGELOG.md +19 -0
- package/README.md +90 -9
- package/package.json +20 -23
- package/sdk/dist/esm/index.js +8 -0
- package/sdk/dist/esm/index.js.map +1 -0
- package/sdk/dist/esm/test-data.js +3 -0
- package/sdk/dist/esm/test-data.js.map +1 -0
- package/sdk/dist/index.d.ts +74 -1
- package/sdk/dist/index.umd.js +2 -2
- package/sdk/dist/index.umd.js.map +1 -1
- package/sdk/dist/index.esm.js +0 -8
- package/sdk/dist/index.esm.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
|
|
3
3
|
No unreleased changes.
|
|
4
4
|
|
|
5
|
+
# 0.0.14
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- Fixed a bug in the publish workflow
|
|
10
|
+
- Fixed a bug where the channel picker dropdown was not disabled when there was only one channel
|
|
11
|
+
|
|
12
|
+
# 0.0.13
|
|
13
|
+
|
|
14
|
+
### Notable
|
|
15
|
+
|
|
16
|
+
Added support for QR channels (QRIS, QR_PH, PROMPTPAY, SGQR)
|
|
17
|
+
|
|
18
|
+
Added support for the installment selection UI in the Cards channel (only affects merchants with that feature enabled)
|
|
19
|
+
|
|
20
|
+
### Bug fixes
|
|
21
|
+
|
|
22
|
+
- Fixed bug where phone number field is not marked as touched on blur
|
|
23
|
+
|
|
5
24
|
# 0.0.12
|
|
6
25
|
|
|
7
26
|
### Bug fixes
|
package/README.md
CHANGED
|
@@ -19,10 +19,10 @@ npm install xendit-components-web --save
|
|
|
19
19
|
Or load it directly from our CDN:
|
|
20
20
|
|
|
21
21
|
```html
|
|
22
|
-
<script src="https://assets.xendit.co/components/v0.0.
|
|
22
|
+
<script src="https://assets.xendit.co/components/v0.0.14/index.umd.js"></script>
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
Our npm package includes TypeScript types. You also download the [.d.ts file](https://assets.xendit.co/components/v0.0.
|
|
25
|
+
Our npm package includes TypeScript types. You also download the [.d.ts file](https://assets.xendit.co/components/v0.0.14/index.d.ts) directly.
|
|
26
26
|
|
|
27
27
|
## Sessions
|
|
28
28
|
|
|
@@ -109,6 +109,16 @@ const groups = components.getActiveChannelGroups();
|
|
|
109
109
|
Returns a list of channel groups. This can be used to categorize channels by type, if you want to build
|
|
110
110
|
your own channel selection UI. Each channel has a `uiGroup` property which matches one group's `id` property.
|
|
111
111
|
|
|
112
|
+
<!--
|
|
113
|
+
### `getActiveDigitalWallets`
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
const digitalWallets = components.getActiveDigitalWallets();
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Returns a list of digital wallets available in this session.
|
|
120
|
+
-->
|
|
121
|
+
|
|
112
122
|
### `createChannelComponent`
|
|
113
123
|
|
|
114
124
|
```typescript
|
|
@@ -127,6 +137,20 @@ This returns a `HTMLElement`, which you need to insert into your document.
|
|
|
127
137
|
This method uses caching, it will always return the same element for the same channel, to preserve the
|
|
128
138
|
values the user enters into any form fields. If you don't want that, use `destroyComponent`.
|
|
129
139
|
|
|
140
|
+
<!--
|
|
141
|
+
### `createDigitalWalletComponent`
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
const htmlElement = components.createDigitalWalletComponent("GOOGLE_PAY");
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Creates a digital wallet CTA button for the specified digital wallet.
|
|
148
|
+
|
|
149
|
+
After a user clicks the button and completes the digital wallet flow, a submission will automatically begin. This is equivalent to setting the channel used (using `setCurrentChannel()`), and then calling `submit()`. The same events will be fired as a normal submission.
|
|
150
|
+
|
|
151
|
+
This returns a `HTMLElement`, which you need to insert into your document.
|
|
152
|
+
-->
|
|
153
|
+
|
|
130
154
|
### `createActionContainerComponent`
|
|
131
155
|
|
|
132
156
|
```typescript
|
|
@@ -254,6 +278,12 @@ Notifies you when the session is in a terminal state.
|
|
|
254
278
|
|
|
255
279
|
`session-complete` means the session was successful, `session-expired-or-canceled` means the session was cancelled or expired.
|
|
256
280
|
|
|
281
|
+
### `session-pending` and `session-not-pending`
|
|
282
|
+
|
|
283
|
+
Notifies you when the session is in the pending state. The pending state means a payment request or token will take some time to complete due to a manual approval flow. This affects FPX business payments. No other payment attempts can be made while in the pending state.
|
|
284
|
+
|
|
285
|
+
You might want to show a pending state UI when in the pending state.
|
|
286
|
+
|
|
257
287
|
### `submission-ready` and `submission-not-ready`
|
|
258
288
|
|
|
259
289
|
Notifies you when the user is ready to submit the payment, meaning a channel is selected and all required information is collected.
|
|
@@ -267,25 +297,29 @@ You might want to disable your submit button when not in the ready state.
|
|
|
267
297
|
|
|
268
298
|
Notifies you when a submission is in progress.
|
|
269
299
|
|
|
270
|
-
You might want to show a pending state UI when in the submission state.
|
|
300
|
+
You might want to show a pending state UI when in the submission state, and allowing the action UI to show on top.
|
|
271
301
|
|
|
272
302
|
### `action-begin` and `action-end`
|
|
273
303
|
|
|
274
304
|
Notifies you when an action is in progress.
|
|
275
305
|
|
|
276
|
-
|
|
306
|
+
Optionally, you can create an action container in the action-begin event. A default action container modal will be created if you don't.
|
|
277
307
|
|
|
278
308
|
## Appearance
|
|
279
309
|
|
|
280
|
-
### CSS
|
|
310
|
+
### CSS
|
|
311
|
+
|
|
312
|
+
The Xendit Components SDK is designed to be customized with CSS. You can override any styles with your own CSS. The SDK's base is inserted above other stylesheets at the time of loading to allow it to be easily overridden.
|
|
281
313
|
|
|
282
|
-
|
|
314
|
+
Refer to [styles.css](https://github.com/xendit/xendit-components-web/blob/main/sdk/src/styles.css) for all the overidable selectors.
|
|
283
315
|
|
|
284
|
-
CSS
|
|
316
|
+
### CSS Variables
|
|
317
|
+
|
|
318
|
+
Some CSS variables are provided to allow for easy customization. These are defined on `:root` and can be overridden by your own CSS.
|
|
285
319
|
|
|
286
320
|
The following variables are available:
|
|
287
321
|
| Variable | Description |
|
|
288
|
-
| :- |
|
|
322
|
+
| :- | :- |
|
|
289
323
|
| --xendit-font-family | Font applied to all xendit components |
|
|
290
324
|
| --xendit-color-primary | Accent color |
|
|
291
325
|
| --xendit-color-text | Base text color |
|
|
@@ -300,8 +334,15 @@ The following variables are available:
|
|
|
300
334
|
| --xendit-animation-ease | Ease function of animations |
|
|
301
335
|
| --xendit-radius-1 | Border radius applied to some components |
|
|
302
336
|
| --xendit-z-index-focus | Z-index applied to focused fields |
|
|
337
|
+
| --xendit-qr-foreground-color | The color used for QR codes (the black pixels). |
|
|
338
|
+
| --xendit-qr-background-color | The color used as the background of QR codes (the white pixels). |
|
|
339
|
+
|
|
340
|
+
Additionally, the following variables are set at component scope, where applicable:
|
|
341
|
+
| Variable | Description |
|
|
342
|
+
| :- | :- |
|
|
343
|
+
| --xendit-channel-brand-color | A brand color. Varies depending on the channel or action component where it's used. Will always be a dark color appropriate for use as a background behind white text. |
|
|
303
344
|
|
|
304
|
-
###
|
|
345
|
+
### CSS In Iframe Fields
|
|
305
346
|
|
|
306
347
|
Some form fields (credit card inputs) are implemented inside iframes to protect the user's information.
|
|
307
348
|
|
|
@@ -319,6 +360,20 @@ const sdk = new XenditComponents({
|
|
|
319
360
|
// apply styles to input placeholders in iframe fields
|
|
320
361
|
color: "#ccc",
|
|
321
362
|
},
|
|
363
|
+
},
|
|
364
|
+
});
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Fonts In Iframe Fields
|
|
368
|
+
|
|
369
|
+
Iframes can't inherit fonts you define on your page, so we allow you to load the font separately inside the iframe, by passing the font source to the constructor.
|
|
370
|
+
|
|
371
|
+
```typescript
|
|
372
|
+
const sdk = new XenditComponents({
|
|
373
|
+
iframeFieldAppearance: {
|
|
374
|
+
inputStyles: {
|
|
375
|
+
// fontFamily: "serif", // this is ignored if a fontFace is provided
|
|
376
|
+
}
|
|
322
377
|
fontFace: {
|
|
323
378
|
// insert a @font-face rule inside iframe fields
|
|
324
379
|
source: "url(https://example.com/my-font-file) format(woff2)",
|
|
@@ -327,3 +382,29 @@ const sdk = new XenditComponents({
|
|
|
327
382
|
},
|
|
328
383
|
});
|
|
329
384
|
```
|
|
385
|
+
|
|
386
|
+
<!--
|
|
387
|
+
## Digital Wallet Support
|
|
388
|
+
|
|
389
|
+
Any available Digital Wallet integration is automatically added at the top of the channel picker component. You may also create a Digital Wallet button manually by calling `createDigitalWalletComponent("GOOGLE_PAY")`.
|
|
390
|
+
|
|
391
|
+
When the user pays using the digital wallet, the submission flow will automatically begin, the same as if you had called `submit()`.
|
|
392
|
+
|
|
393
|
+
Google Pay is currently the only supported digital wallet.
|
|
394
|
+
|
|
395
|
+
### Google Pay™
|
|
396
|
+
|
|
397
|
+
Google Pay is available to Sessions that meet the following requirements:
|
|
398
|
+
|
|
399
|
+
- Your Session country is a country where Google Pay is supported.
|
|
400
|
+
- You have at least one Google Pay compatible payment method available in your session. (e.g. cards)
|
|
401
|
+
- You've provided your Google MerchantID to Xendit on the Xendit Dashboard. (If you don't have a Google MerchantID, complete registration with the [Google Pay & Wallet Console](https://pay.google.com/business/console/?utm_source=devsite&utm_medium=devsite&utm_campaign=devsite) to provision one)
|
|
402
|
+
- The Google Pay SDK is loaded using `<script async src="https://pay.google.com/gp/p/js/pay.js"></script>`. (You need to include the SDK yourself, we don't bundle it. There's no need to wait for it to finish loading, if it's still loading when you create the component, it'll have `display:none` until it finishes loading)
|
|
403
|
+
- The user is using a compatible browser. (The component will have `display:none` if the user is using an incompatible browser)
|
|
404
|
+
|
|
405
|
+
We configure Google Pay for you, providing your MerchantID, merchant name, and the allowed payment methods, including allowed card networks and authentication methods.
|
|
406
|
+
|
|
407
|
+
You can customize the appearance of the button using the options parameter of `createDigitalWalletComponent`, it accepts the same options as the [Google Pay API](https://developers.google.com/pay/api/web/reference/request-objects#ButtonOptions).
|
|
408
|
+
|
|
409
|
+
To use Google Pay, you must adhere to the Google Pay and Wallet API's [Acceptable Use Policy](https://payments.developers.google.com/terms/aup) and accept the terms defined in the [Google Pay API Terms of Service](https://payments.developers.google.com/terms/sellertos). Additionally, please ensure you follow the [Google Pay brand guidelines](https://developers.google.com/pay/api/web/guides/brand-guidelines).
|
|
410
|
+
-->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xendit-components-web",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.14",
|
|
4
4
|
"description": "Xendit frontend payment components SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Xendit",
|
|
@@ -19,11 +19,7 @@
|
|
|
19
19
|
"components"
|
|
20
20
|
],
|
|
21
21
|
"files": [
|
|
22
|
-
"./sdk/dist/
|
|
23
|
-
"./sdk/dist/index.umd.js.map",
|
|
24
|
-
"./sdk/dist/index.esm.js",
|
|
25
|
-
"./sdk/dist/index.esm.js.map",
|
|
26
|
-
"./sdk/dist/index.d.ts",
|
|
22
|
+
"./sdk/dist/",
|
|
27
23
|
"./README.md",
|
|
28
24
|
"./CHANGELOG.md"
|
|
29
25
|
],
|
|
@@ -31,7 +27,7 @@
|
|
|
31
27
|
"exports": {
|
|
32
28
|
"import": {
|
|
33
29
|
"types": "./sdk/dist/index.d.ts",
|
|
34
|
-
"default": "./sdk/dist/index.
|
|
30
|
+
"default": "./sdk/dist/esm/index.js"
|
|
35
31
|
},
|
|
36
32
|
"require": {
|
|
37
33
|
"types": "./sdk/dist/index.d.ts",
|
|
@@ -52,18 +48,18 @@
|
|
|
52
48
|
"prepare": "husky"
|
|
53
49
|
},
|
|
54
50
|
"dependencies": {
|
|
55
|
-
"card-validator": "^10.0.
|
|
51
|
+
"card-validator": "^10.0.4",
|
|
56
52
|
"classnames": "^2.5.1",
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"preact": "^10.28.2",
|
|
53
|
+
"libphonenumber-js": "^1.12.38",
|
|
54
|
+
"preact": "^10.28.4",
|
|
60
55
|
"qrcode": "^1.5.4",
|
|
61
56
|
"tslib": "^2.8.1"
|
|
62
57
|
},
|
|
63
58
|
"devDependencies": {
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
59
|
+
"@codecov/rollup-plugin": "^1.9.1",
|
|
60
|
+
"@eslint/js": "^9.39.3",
|
|
61
|
+
"@microsoft/api-extractor": "^7.57.6",
|
|
62
|
+
"@preact/preset-vite": "^2.10.3",
|
|
67
63
|
"@rollup/plugin-alias": "^6.0.0",
|
|
68
64
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
69
65
|
"@rollup/plugin-json": "^6.1.0",
|
|
@@ -74,22 +70,23 @@
|
|
|
74
70
|
"@testing-library/dom": "^10.4.1",
|
|
75
71
|
"@testing-library/jest-dom": "^6.9.1",
|
|
76
72
|
"@testing-library/user-event": "^14.6.1",
|
|
73
|
+
"@types/googlepay": "^0.7.10",
|
|
77
74
|
"@types/mime-types": "^3.0.1",
|
|
78
|
-
"@types/node": "^24.
|
|
75
|
+
"@types/node": "^24.11.0",
|
|
79
76
|
"@types/qrcode": "^1.5.6",
|
|
80
|
-
"@vitest/coverage-v8": "4.0.
|
|
81
|
-
"eslint": "^9.39.
|
|
77
|
+
"@vitest/coverage-v8": "4.0.18",
|
|
78
|
+
"eslint": "^9.39.3",
|
|
82
79
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
83
80
|
"husky": "^9.1.7",
|
|
84
|
-
"jsdom": "^
|
|
85
|
-
"lint-staged": "^16.
|
|
81
|
+
"jsdom": "^28.1.0",
|
|
82
|
+
"lint-staged": "^16.3.1",
|
|
86
83
|
"mime-types": "^3.0.2",
|
|
87
84
|
"prettier": "^3.8.1",
|
|
88
|
-
"rollup": "^4.
|
|
89
|
-
"rollup-plugin-import-css": "^4.
|
|
85
|
+
"rollup": "^4.59.0",
|
|
86
|
+
"rollup-plugin-import-css": "^4.2.0",
|
|
90
87
|
"typescript": "^5.9.3",
|
|
91
|
-
"typescript-eslint": "^8.
|
|
92
|
-
"vitest": "
|
|
88
|
+
"typescript-eslint": "^8.56.1",
|
|
89
|
+
"vitest": "4.0.18"
|
|
93
90
|
},
|
|
94
91
|
"packageManager": "pnpm@10.28.1"
|
|
95
92
|
}
|