xendit-components-web 0.0.11 → 0.0.13

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 CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  No unreleased changes.
4
4
 
5
+ # 0.0.13
6
+
7
+ ### Notable
8
+
9
+ Added support for QR channels (QRIS, QR_PH, PROMPTPAY, SGQR)
10
+
11
+ Added support for the installment selection UI in the Cards channel (only affects merchants with that feature enabled)
12
+
13
+ ### Bug fixes
14
+
15
+ - Fixed bug where phone number field is not marked as touched on blur
16
+
17
+ # 0.0.12
18
+
19
+ ### Bug fixes
20
+
21
+ - Fixed a bug where the credit card expiry field would not insert a slash if the user pasted the expiry date without a slash.
22
+ - Fixed poor UX when typing a slash in the credit card expiry field.
23
+ - Allow card expiry up to 2099
24
+
5
25
  # 0.0.11
6
26
 
7
27
  ### Notable
@@ -12,20 +32,20 @@ Added new public method `pollImmediately` to immediently check for updates.
12
32
 
13
33
  Changed the layout of the default action container.
14
34
 
15
- ## Bug fixes
35
+ ### Bug fixes
16
36
 
17
37
  - Fixed UX bugs in the dropdown widget.
18
38
  - Prevent auto-updating the phone number country code if the user already typed a phone number.
19
39
 
20
40
  # 0.0.10
21
41
 
22
- ## Bug fixes
42
+ ### Bug fixes
23
43
 
24
44
  Fixed npm publish.
25
45
 
26
46
  # 0.0.9
27
47
 
28
- ## Bug fixes
48
+ ### Bug fixes
29
49
 
30
50
  Missing `.d.ts` file is restored.
31
51
 
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.11/index.umd.js"></script>
22
+ <script src="https://assets.xendit.co/components/v0.0.13/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.11/index.d.ts) directly.
25
+ Our npm package includes TypeScript types. You also download the [.d.ts file](https://assets.xendit.co/components/v0.0.13/index.d.ts) directly.
26
26
 
27
27
  ## Sessions
28
28
 
@@ -254,6 +254,12 @@ Notifies you when the session is in a terminal state.
254
254
 
255
255
  `session-complete` means the session was successful, `session-expired-or-canceled` means the session was cancelled or expired.
256
256
 
257
+ ### `session-pending` and `session-not-pending`
258
+
259
+ 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.
260
+
261
+ You might want to show a pending state UI when in the pending state.
262
+
257
263
  ### `submission-ready` and `submission-not-ready`
258
264
 
259
265
  Notifies you when the user is ready to submit the payment, meaning a channel is selected and all required information is collected.
@@ -267,21 +273,25 @@ You might want to disable your submit button when not in the ready state.
267
273
 
268
274
  Notifies you when a submission is in progress.
269
275
 
270
- You might want to show a pending state UI when in the submission state.
276
+ You might want to show a pending state UI when in the submission state, and allowing the action UI to show on top.
271
277
 
272
278
  ### `action-begin` and `action-end`
273
279
 
274
280
  Notifies you when an action is in progress.
275
281
 
276
- You might want to create an action container in the action-begin event.
282
+ 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
283
 
278
284
  ## Appearance
279
285
 
280
- ### CSS Variables
286
+ ### CSS
281
287
 
282
- The Xendit Components SDK is customizable by overriding its CSS. The SDK inserts its CSS above any other CSS at the time of loading to allow it to be easily overridden.
288
+ 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.
283
289
 
284
- CSS variables can be overridden to change styles across all components.
290
+ Refer to [styles.css](https://github.com/xendit/xendit-components-web/blob/main/sdk/src/styles.css) for all the overidable selectors.
291
+
292
+ ### CSS Variables
293
+
294
+ Some CSS variables are provided to allow for easy customization. These are defined on `:root` and can be overridden by your own CSS.
285
295
 
286
296
  The following variables are available:
287
297
  | Variable | Description |
@@ -301,7 +311,7 @@ The following variables are available:
301
311
  | --xendit-radius-1 | Border radius applied to some components |
302
312
  | --xendit-z-index-focus | Z-index applied to focused fields |
303
313
 
304
- ### Appearance of Iframe fields
314
+ ### CSS In Iframe Fields
305
315
 
306
316
  Some form fields (credit card inputs) are implemented inside iframes to protect the user's information.
307
317
 
@@ -319,6 +329,20 @@ const sdk = new XenditComponents({
319
329
  // apply styles to input placeholders in iframe fields
320
330
  color: "#ccc",
321
331
  },
332
+ },
333
+ });
334
+ ```
335
+
336
+ ### Fonts In Iframe Fields
337
+
338
+ 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.
339
+
340
+ ```typescript
341
+ const sdk = new XenditComponents({
342
+ iframeFieldAppearance: {
343
+ inputStyles: {
344
+ // fontFamily: "serif", // this is ignored if a fontFace is provided
345
+ }
322
346
  fontFace: {
323
347
  // insert a @font-face rule inside iframe fields
324
348
  source: "url(https://example.com/my-font-file) format(woff2)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xendit-components-web",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "Xendit frontend payment components SDK",
5
5
  "type": "module",
6
6
  "author": "Xendit",
@@ -52,18 +52,18 @@
52
52
  "prepare": "husky"
53
53
  },
54
54
  "dependencies": {
55
- "card-validator": "^10.0.3",
55
+ "card-validator": "^10.0.4",
56
56
  "classnames": "^2.5.1",
57
- "i18next": "^25.8.0",
58
- "libphonenumber-js": "^1.12.35",
59
- "preact": "^10.28.2",
57
+ "libphonenumber-js": "^1.12.38",
58
+ "preact": "^10.28.4",
60
59
  "qrcode": "^1.5.4",
61
60
  "tslib": "^2.8.1"
62
61
  },
63
62
  "devDependencies": {
64
- "@eslint/js": "^9.39.2",
65
- "@microsoft/api-extractor": "^7.55.2",
66
- "@preact/preset-vite": "^2.10.2",
63
+ "@codecov/rollup-plugin": "^1.9.1",
64
+ "@eslint/js": "^9.39.3",
65
+ "@microsoft/api-extractor": "^7.57.6",
66
+ "@preact/preset-vite": "^2.10.3",
67
67
  "@rollup/plugin-alias": "^6.0.0",
68
68
  "@rollup/plugin-commonjs": "^29.0.0",
69
69
  "@rollup/plugin-json": "^6.1.0",
@@ -75,21 +75,21 @@
75
75
  "@testing-library/jest-dom": "^6.9.1",
76
76
  "@testing-library/user-event": "^14.6.1",
77
77
  "@types/mime-types": "^3.0.1",
78
- "@types/node": "^24.10.1",
78
+ "@types/node": "^24.11.0",
79
79
  "@types/qrcode": "^1.5.6",
80
- "@vitest/coverage-v8": "4.0.17",
81
- "eslint": "^9.39.2",
80
+ "@vitest/coverage-v8": "4.0.18",
81
+ "eslint": "^9.39.3",
82
82
  "eslint-plugin-react-hooks": "^7.0.1",
83
83
  "husky": "^9.1.7",
84
- "jsdom": "^27.4.0",
85
- "lint-staged": "^16.2.7",
84
+ "jsdom": "^28.1.0",
85
+ "lint-staged": "^16.3.1",
86
86
  "mime-types": "^3.0.2",
87
87
  "prettier": "^3.8.1",
88
- "rollup": "^4.56.0",
89
- "rollup-plugin-import-css": "^4.1.2",
88
+ "rollup": "^4.59.0",
89
+ "rollup-plugin-import-css": "^4.2.0",
90
90
  "typescript": "^5.9.3",
91
- "typescript-eslint": "^8.53.1",
92
- "vitest": "^4.0.17"
91
+ "typescript-eslint": "^8.56.1",
92
+ "vitest": "4.0.18"
93
93
  },
94
94
  "packageManager": "pnpm@10.28.1"
95
95
  }
@@ -380,6 +380,27 @@ export declare class XenditComponents extends EventTarget {
380
380
  * Event handler called when the session has expired or been cancelled.
381
381
  */
382
382
  addEventListener(name: "session-expired-or-canceled", listener: XenditEventListener<XenditSessionExpiredOrCanceledEvent>, options?: boolean | AddEventListenerOptions): void;
383
+ /**
384
+ * @public
385
+ * Event handler called on pending state. You should show a pending UI in response to this event.
386
+ *
387
+ * The pending state means an associated payment request or token will take some time to complete.
388
+ * No other payment attempts can be made while in the pending state.
389
+ *
390
+ * This occurs for payments requiring manual confirmation, e.g. FPX business payments.
391
+ *
392
+ * The pending state usually occurs after a submission-end event.
393
+ * This event will also be fired if the SDK is initialized and the session is already pending.
394
+ */
395
+ addEventListener(name: "session-pending", listener: XenditEventListener<XenditSessionPendingEvent>, options?: boolean | AddEventListenerOptions): void;
396
+ /**
397
+ * @public
398
+ * Event handler called when exiting the pending state.
399
+ *
400
+ * After the pending state, the session may be in the active state, allowing further attempts, or
401
+ * it may be completed or expired/canceled, in which case the respective event will be fired immediently after this one.
402
+ */
403
+ addEventListener(name: "session-not-pending", listener: XenditEventListener<XenditSessionNotPendingEvent>, options?: boolean | AddEventListenerOptions): void;
383
404
  /**
384
405
  * @public
385
406
  * Event handler called when something unrecoverable has happened. You should create a new
@@ -471,11 +492,15 @@ export declare type XenditEventMap = {
471
492
  init: XenditInitEvent;
472
493
  "submission-ready": XenditReadyEvent;
473
494
  "submission-not-ready": XenditReadyEvent;
495
+ "submission-begin": XenditSubmissionBeginEvent;
496
+ "submission-end": XenditSubmissionEndEvent;
474
497
  "action-begin": XenditActionBeginEvent;
475
498
  "action-end": XenditActionEndEvent;
476
499
  "will-redirect": XenditWillRedirectEvent;
477
500
  "session-complete": XenditSessionCompleteEvent;
478
501
  "session-expired-or-canceled": XenditSessionExpiredOrCanceledEvent;
502
+ "session-pending": XenditSessionPendingEvent;
503
+ "session-not-pending": XenditSessionNotPendingEvent;
479
504
  "payment-request-created": XenditPaymentRequestCreatedEvent;
480
505
  "payment-request-discarded": XenditPaymentRequestDiscardedEvent;
481
506
  "payment-token-created": XenditPaymentTokenCreatedEvent;
@@ -720,7 +745,7 @@ export declare interface XenditSession {
720
745
  /**
721
746
  * Status of the session.
722
747
  */
723
- status: "ACTIVE" | "CANCELED" | "EXPIRED" | "COMPLETED";
748
+ status: "ACTIVE" | "PENDING" | "CANCELED" | "EXPIRED" | "COMPLETED";
724
749
  /**
725
750
  * Indicates whether the customer is allowed to save their payment method during this session.
726
751
  *
@@ -788,6 +813,24 @@ export declare class XenditSessionExpiredOrCanceledEvent extends Event {
788
813
  constructor();
789
814
  }
790
815
 
816
+ /**
817
+ * @public
818
+ * Event fired when the session is no longer pending.
819
+ */
820
+ export declare class XenditSessionNotPendingEvent extends Event {
821
+ static type: "session-not-pending";
822
+ constructor();
823
+ }
824
+
825
+ /**
826
+ * @public
827
+ * Event fired when the session is pending.
828
+ */
829
+ export declare class XenditSessionPendingEvent extends Event {
830
+ static type: "session-pending";
831
+ constructor();
832
+ }
833
+
791
834
  /**
792
835
  * @public
793
836
  * Event fired after submission begins.