xendit-components-web 0.0.7 → 0.0.9

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 ADDED
@@ -0,0 +1,60 @@
1
+ # Unreleased
2
+
3
+ No unreleased changes.
4
+
5
+ # 0.0.9
6
+
7
+ Missing `.d.ts` file is restored.
8
+
9
+ # 0.0.8
10
+
11
+ ### Notable
12
+
13
+ - Channels other than `"CARDS"` are disabled for the initial release.
14
+ - `sessionClientKey` is renamed to `componentsSdkKey`
15
+
16
+ ### New features
17
+
18
+ Support searching channels by channel code to `getActiveChannels`:
19
+
20
+ ```typescript
21
+ const cardsComponent = components.getActiveChannels({ filter: "CARDS" })[0];
22
+ ```
23
+
24
+ The layout of the default action container component and the mock iframe action have been improved.
25
+
26
+ ### Bug fixes
27
+
28
+ - Prevent channel picker from sometimes collapsing the cards group while typing a card number
29
+ - Fix missing types in the `.d.ts` file
30
+ - In mock mode, mock channels now use an appropriate action type based on their channel type
31
+ - The module can now be imported in Node.js. It asserts it's running on a browser in the `XenditComponents` constructor instead.
32
+
33
+ # 0.0.7
34
+
35
+ Initial release.
36
+
37
+ This release contains credit card payment and tokenization flows.
38
+
39
+ ```typescript
40
+ const components: XenditComponents = new XenditComponents({
41
+ componentsSdkKey: componentsSdkKeyFromYourServer,
42
+ });
43
+
44
+ const cardsChannel = components.getActiveChannels({ filter: "CARDS" })[0];
45
+ const channelPicker: HTMLElement =
46
+ components.createChannelComponent(cardsChannel);
47
+
48
+ myCheckoutPage.replaceChildren(channelPicker);
49
+
50
+ mySubmitButton.addEventListener("click", () => {
51
+ components.submit();
52
+ });
53
+
54
+ components.addEventListener("session-complete", () => {
55
+ alert("Payment Success");
56
+ });
57
+ components.addEventListener("session-expired-or-canceled", () => {
58
+ alert("Payment cancelled or expired");
59
+ });
60
+ ```
package/README.md CHANGED
@@ -15,10 +15,10 @@ npm install xendit-components-web --save
15
15
  Or load it directly from our CDN:
16
16
 
17
17
  ```html
18
- <script src="https://assets.xendit.co/components/VERSION_NUMBER_HERE/index.umd.js"></script>
18
+ <script src="https://assets.xendit.co/components/0.0.9/index.umd.js"></script>
19
19
  ```
20
20
 
21
- Our npm package includes TypeScript types. If you're using the CDN, download type declarations from `https://assets.xendit.co/components/VERSION_NUMBER_HERE/index.d.ts`
21
+ Our npm package includes TypeScript types. If you're using the CDN, download type declarations from `https://assets.xendit.co/components/0.0.9/index.d.ts`
22
22
 
23
23
  ## Sessions
24
24
 
@@ -37,13 +37,13 @@ Two types of sessions are available:
37
37
  First, initialize the SDK either with either:
38
38
 
39
39
  - `XenditComponentsTest` for frontend development or unit tests
40
- - `XenditComponents`, for production, which requires a `sessionClientKey`, which comes from the Session object, which you need to create on your server. Make an endpoint that creates a session for the user's current transaction, return the `components_sdk_key` to the client, and pass it into the constructor.
40
+ - `XenditComponents`, for production, which requires a `componentsSdkKey`. That key comes from the session object you create on your server. Make an endpoint that creates a session for the user's current transaction, return the `components_sdk_key` to the client, and pass it into the constructor.
41
41
 
42
42
  ```typescript
43
43
  // For frontend development, use XenditComponentsTest
44
44
  const components: XenditComponents = new XenditComponentsTest({});
45
45
  // For production or e2e testing, use XenditComponents, passing in the components_sdk_key from the Session object
46
- // const components: XenditComponents = new XenditComponents({ sessionClientKey });
46
+ const components: XenditComponents = new XenditComponents({ componentsSdkKey });
47
47
 
48
48
  // Create a channel picker component
49
49
  const channelPicker: HTMLElement = components.createChannelPickerComponent();
@@ -71,7 +71,7 @@ components.addEventListener("session-expired-or-canceled", () => {
71
71
 
72
72
  The constructor.
73
73
 
74
- For production and e2e testing, you need to pass the `sessionClientKey`, which you can get when you create a Session on your server.
74
+ For production and e2e testing, you need to pass the `componentsSdkKey`, which you can get when you create a Session on your server.
75
75
 
76
76
  For development and unit testing, use `XenditComponentsTest`, which uses mock data and doesn't connect to Xendit servers.
77
77
 
@@ -110,9 +110,7 @@ your own channel selection UI. Each channel has a `uiGroup` property which match
110
110
  ### `createChannelComponent`
111
111
 
112
112
  ```typescript
113
- const channel = components
114
- .getActiveChannels()
115
- .find((channel) => channel.channelCode === "CARDS");
113
+ const channel = components.getActiveChannels({ filter: "CARDS" })[0];
116
114
  if (channel) {
117
115
  const htmlElement = components.createChannelPickerComponent(channel);
118
116
  myContainer.replaceChildren(htmlElement);
@@ -220,9 +218,7 @@ The current channel:
220
218
  ### `setCurrentChannel`
221
219
 
222
220
  ```typescript
223
- const channel = components
224
- .getActiveChannels()
225
- .find((channel) => channel.channelCode === "CARDS");
221
+ const channel = components.getActiveChannels({ filter: "CARDS" })[0];
226
222
  if (channel) {
227
223
  components.setCurrentChannel(channel);
228
224
  }
@@ -283,10 +279,8 @@ The following variables are available:
283
279
  | --xendit-color-text-placeholder | Placeholder color |
284
280
  | --xendit-color-disabled | Background color of disabled elements |
285
281
  | --xendit-color-danger | Border color of elements with validation errors and text color of validation errors |
286
- | --xendit-color-border | TODO: remove this |
287
- | --xendit-color-border-subtle | TODO: rename this |
288
- | --xendit-color-border-default | TODO: rename this |
289
- | --xendit-color-background | Background color of elements |
282
+ | --xendit-color-border | Border color used on accordions, input fields, and logos |
283
+ | --xendit-color-background | Background color of input fields |
290
284
  | --xendit-focus-shadow | Box-shadow applied to elements with focus |
291
285
  | --xendit-animation-duration | Duration of animations (affects the channel picker accordion) |
292
286
  | --xendit-animation-ease | Ease function of animations |
@@ -297,13 +291,25 @@ The following variables are available:
297
291
 
298
292
  Some form fields (credit card inputs) are implemented inside iframes to protect the user's information.
299
293
 
300
- Regular CSS doesn't apply inside iframes. The SDK instead provides overrides in the constructor which
301
- it applies to the iframe fields.
294
+ You can't override the CSS inside the iframe fields. Instead, you can pass some limited styles to the constructor
295
+ which we'll pass along to the iframes.
302
296
 
303
297
  ```typescript
304
298
  const sdk = new XenditComponents({
305
- appearance: {
306
- // TODO
299
+ iframeFieldAppearance: {
300
+ inputStyles: {
301
+ // apply styles to inputs within iframe fields
302
+ color: "#000",
303
+ },
304
+ placeholderStyles: {
305
+ // apply styles to input placeholders in iframe fields
306
+ color: "#ccc",
307
+ },
308
+ fontFace: {
309
+ // insert a @font-face rule inside iframe fields
310
+ source: "url(https://example.com/my-font-file) format(woff2)",
311
+ descriptors: { display: "swap" },
312
+ },
307
313
  },
308
314
  });
309
315
  ```
package/README.md.bak ADDED
@@ -0,0 +1,315 @@
1
+ # xendit-components-web
2
+
3
+ Xendit Components allows you to accept payments directly on your website using the Xendit Sessions API.
4
+
5
+ This SDK's role is to take a Session (created on your server using the Xendit Sessions API) and render a payment UI, and allow you to customize the UI to match your site's look & feel.
6
+
7
+ ## Installation
8
+
9
+ Install using npm:
10
+
11
+ ```sh
12
+ npm install xendit-components-web --save
13
+ ```
14
+
15
+ Or load it directly from our CDN:
16
+
17
+ ```html
18
+ <script src="https://assets.xendit.co/components/0.0.9/index.umd.js"></script>
19
+ ```
20
+
21
+ Our npm package includes TypeScript types. If you're using the CDN, download type declarations from `https://assets.xendit.co/components/0.0.9/index.d.ts`
22
+
23
+ ## Sessions
24
+
25
+ The Xendit Session API is an abstraction over the Xendit Payments API, representing one transaction (or tokenization). Using one session, a user can make any number
26
+ of attempts to pay, one of which can be successful. A successful payment completes the session.
27
+
28
+ Sessions also abstract away any differences between channels, allowing you to write once, and accept payments from any channel Xendit supports.
29
+
30
+ Two types of sessions are available:
31
+
32
+ - `PAY` sessions collect a payment and optionally save a payment token for later use
33
+ - `SAVE` sessions save a payment token
34
+
35
+ ## Quick Start
36
+
37
+ First, initialize the SDK either with either:
38
+
39
+ - `XenditComponentsTest` for frontend development or unit tests
40
+ - `XenditComponents`, for production, which requires a `componentsSdkKey`. That key comes from the session object you create on your server. Make an endpoint that creates a session for the user's current transaction, return the `components_sdk_key` to the client, and pass it into the constructor.
41
+
42
+ ```typescript
43
+ // For frontend development, use XenditComponentsTest
44
+ const components: XenditComponents = new XenditComponentsTest({});
45
+ // For production or e2e testing, use XenditComponents, passing in the components_sdk_key from the Session object
46
+ const components: XenditComponents = new XenditComponents({ componentsSdkKey });
47
+
48
+ // Create a channel picker component
49
+ const channelPicker: HTMLElement = components.createChannelPickerComponent();
50
+
51
+ // Insert the channel picker into your document
52
+ myCheckoutPage.replaceChildren(channelPicker);
53
+
54
+ // Call submit() when the user clicks your submit button
55
+ mySubmitButton.addEventListener("click", () => {
56
+ components.submit();
57
+ });
58
+
59
+ // Listen to the status of the session
60
+ components.addEventListener("session-complete", () => {
61
+ alert("Payment Success");
62
+ });
63
+ components.addEventListener("session-expired-or-canceled", () => {
64
+ alert("Payment cancelled or expired");
65
+ });
66
+ ```
67
+
68
+ ## Components API
69
+
70
+ ### `XenditComponents` and `XenditComponentsTest`
71
+
72
+ The constructor.
73
+
74
+ For production and e2e testing, you need to pass the `componentsSdkKey`, which you can get when you create a Session on your server.
75
+
76
+ For development and unit testing, use `XenditComponentsTest`, which uses mock data and doesn't connect to Xendit servers.
77
+
78
+ ### `createChannelPickerComponent`
79
+
80
+ ```typescript
81
+ const htmlElement = components.createChannelPickerComponent();
82
+ myContainer.replaceChildren(htmlElement);
83
+ ```
84
+
85
+ Creates a UI for the user to select a payment channel and fill any required information.
86
+
87
+ This returns a `HTMLElement`, which you need to insert into your document.
88
+
89
+ This method uses caching, it will always return the same channel picker element.
90
+ Changing the current channel will update the channel picker UI, even if it's unmounted.
91
+ If you don't want this, use `destroyComponent.`
92
+
93
+ ### `getActiveChannels`
94
+
95
+ ```typescript
96
+ const channels = components.getActiveChannels();
97
+ ```
98
+
99
+ Returns the list of channels available in this session.
100
+
101
+ ### `getActiveChannelGroups`
102
+
103
+ ```typescript
104
+ const groups = components.getActiveChannelGroups();
105
+ ```
106
+
107
+ Returns a list of channel groups. This can be used to categorize channels by type, if you want to build
108
+ your own channel selection UI. Each channel has a `uiGroup` property which matches one group's `id` property.
109
+
110
+ ### `createChannelComponent`
111
+
112
+ ```typescript
113
+ const channel = components.getActiveChannels({ filter: "CARDS" })[0];
114
+ if (channel) {
115
+ const htmlElement = components.createChannelPickerComponent(channel);
116
+ myContainer.replaceChildren(htmlElement);
117
+ }
118
+ ```
119
+
120
+ Selects a payment channel and creates a UI for the user to fill any required information. You
121
+ need to pass in the channel you want to use, as returned from getActiveChannels.
122
+
123
+ This returns a `HTMLElement`, which you need to insert into your document.
124
+
125
+ This method uses caching, it will always return the same element for the same channel, to preserve the
126
+ values the user enters into any form fields. If you don't want that, use `destroyComponent`.
127
+
128
+ ### `createActionContainerComponent`
129
+
130
+ ```typescript
131
+ components.addEventListener("action-begin", () => {
132
+ const htmlElement = components.createActionContainerComponent();
133
+ myActionContainer.replaceChildren(htmlElement);
134
+ });
135
+ ```
136
+
137
+ Creates a container into which any additional actions (e.g. 3DS, QR Codes) will be rendered.
138
+
139
+ This is optional, if you don't create one, the SDK will create a modal with an action container for you.
140
+ You cannot create an action container during an action (i.e. after the `action-begin` event).
141
+
142
+ This returns a `HTMLElement`, which you need to insert into your document.
143
+
144
+ This method does not use caching.
145
+
146
+ ### `submit`
147
+
148
+ ```typescript
149
+ function onSubmitButtonClick() {
150
+ components.submit();
151
+ }
152
+ ```
153
+
154
+ Begins submission for the active payment channel.
155
+
156
+ Call this from the click event of your submit button.
157
+
158
+ Submission is only available when the session is active, a channel is made current by creating a channel component, any required information is collected, and
159
+ another submission is not in progress. Use the `submission-ready` and `submission-not-ready` events to know when submission is available.
160
+
161
+ This calls the [create payment request](https://docs.xendit.co/apidocs/create-payment-request)
162
+ or [create payment token](https://docs.xendit.co/apidocs/create-payment-token) endpoint depending on the session type. You
163
+ may listen to the corresponding webhooks on your server.
164
+
165
+ ### `simulatePayment`
166
+
167
+ ```typescript
168
+ components.simulatePayment();
169
+ ```
170
+
171
+ Calls the [simulate payment](https://docs.xendit.co/apidocs/simulate-payment-test-mode) endpoint.
172
+
173
+ This is only available in test mode sessions. It also requires the payment channel to be a QR, OTC, or VA channel, and it requires an action
174
+ to be in-progress.
175
+
176
+ ### `abortSubmission`
177
+
178
+ ```typescript
179
+ components.abortSubmission();
180
+ ```
181
+
182
+ Cancels the current submission, if any.
183
+
184
+ ### `destroyComponent`
185
+
186
+ ```typescript
187
+ components.destroyComponent(htmlElement);
188
+ ```
189
+
190
+ Destroys a component, deleting any cached data and removing the element from the document. Manual cleanup is not normally required,
191
+ but is made available if you want it.
192
+
193
+ ### `showValidationErrors`
194
+
195
+ ```typescript
196
+ components.showValidationErrors();
197
+ ```
198
+
199
+ Reveals hidden validation errors in the current channel's form, if any.
200
+
201
+ Validation errors are normally hidden until the user changes and unfocusses the input.
202
+
203
+ ### `getCurrentChannel`
204
+
205
+ ```typescript
206
+ const channel: XenditChannel = components.getCurrentChannel();
207
+ ```
208
+
209
+ Returns the current channel.
210
+
211
+ The current channel is the one you or the channel picker component selected by calling `createChannelComponent` or `setCurrentChannel`.
212
+
213
+ The current channel:
214
+
215
+ - Will be used for submission when you call `submit()`
216
+ - Is interactive (other channel components are disabled)
217
+
218
+ ### `setCurrentChannel`
219
+
220
+ ```typescript
221
+ const channel = components.getActiveChannels({ filter: "CARDS" })[0];
222
+ if (channel) {
223
+ components.setCurrentChannel(channel);
224
+ }
225
+ ```
226
+
227
+ Makes the provided channel the current channel.
228
+
229
+ ## Events
230
+
231
+ ### `init`
232
+
233
+ Notifies you when the session information is loaded. Most SDK functions require the session to be loaded and can only be called after this event.
234
+
235
+ `createChannelPickerComponent` is available before the init event.
236
+
237
+ ### `session-complete` and `session-expired-or-canceled`
238
+
239
+ Notifies you when the session is in a terminal state.
240
+
241
+ `session-complete` means the session was successful, `session-expired-or-canceled` means the session was cancelled or expired.
242
+
243
+ ### `submission-ready` and `submission-not-ready`
244
+
245
+ Notifies you when the user is ready to submit the payment, meaning a channel is selected and all required information is collected.
246
+
247
+ `submit` will only work in the ready state, or it will throw. Calling it when there are form validation errors will also reveal those errors
248
+ to the user.
249
+
250
+ You might want to disable your submit button when not in the ready state.
251
+
252
+ ### `submission-begin` and `submission-end`
253
+
254
+ Notifies you when a submission is in progress.
255
+
256
+ You might want to show a pending state UI when in the submission state.
257
+
258
+ ### `action-begin` and `action-end`
259
+
260
+ Notifies you when an action is in progress.
261
+
262
+ You might want to create an action container in the action-begin event.
263
+
264
+ ## Appearance
265
+
266
+ ### CSS Variables
267
+
268
+ 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.
269
+
270
+ CSS variables can be overridden to change styles across all components.
271
+
272
+ The following variables are available:
273
+ | Variable | Description |
274
+ | :- | -: |
275
+ | --xendit-font-family | Font applied to all xendit components |
276
+ | --xendit-color-primary | Accent color |
277
+ | --xendit-color-text | Base text color |
278
+ | --xendit-color-text-secondary | Lighter text color |
279
+ | --xendit-color-text-placeholder | Placeholder color |
280
+ | --xendit-color-disabled | Background color of disabled elements |
281
+ | --xendit-color-danger | Border color of elements with validation errors and text color of validation errors |
282
+ | --xendit-color-border | Border color used on accordions, input fields, and logos |
283
+ | --xendit-color-background | Background color of input fields |
284
+ | --xendit-focus-shadow | Box-shadow applied to elements with focus |
285
+ | --xendit-animation-duration | Duration of animations (affects the channel picker accordion) |
286
+ | --xendit-animation-ease | Ease function of animations |
287
+ | --xendit-radius-1 | Border radius applied to some components |
288
+ | --xendit-z-index-focus | Z-index applied to focused fields |
289
+
290
+ ### Appearance of Iframe fields
291
+
292
+ Some form fields (credit card inputs) are implemented inside iframes to protect the user's information.
293
+
294
+ You can't override the CSS inside the iframe fields. Instead, you can pass some limited styles to the constructor
295
+ which we'll pass along to the iframes.
296
+
297
+ ```typescript
298
+ const sdk = new XenditComponents({
299
+ iframeFieldAppearance: {
300
+ inputStyles: {
301
+ // apply styles to inputs within iframe fields
302
+ color: "#000",
303
+ },
304
+ placeholderStyles: {
305
+ // apply styles to input placeholders in iframe fields
306
+ color: "#ccc",
307
+ },
308
+ fontFace: {
309
+ // insert a @font-face rule inside iframe fields
310
+ source: "url(https://example.com/my-font-file) format(woff2)",
311
+ descriptors: { display: "swap" },
312
+ },
313
+ },
314
+ });
315
+ ```
package/package.json CHANGED
@@ -1,16 +1,27 @@
1
1
  {
2
2
  "name": "xendit-components-web",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Xendit frontend payment components SDK",
5
5
  "type": "module",
6
6
  "author": "Xendit",
7
- "license": "UNLICENSED",
7
+ "license": "MIT",
8
+ "keywords": [
9
+ "xendit",
10
+ "payment",
11
+ "payments",
12
+ "payment processing",
13
+ "credit cards",
14
+ "checkout",
15
+ "components"
16
+ ],
8
17
  "files": [
9
18
  "./sdk/dist/index.umd.js",
10
19
  "./sdk/dist/index.umd.js.map",
11
20
  "./sdk/dist/index.esm.js",
12
21
  "./sdk/dist/index.esm.js.map",
13
- "./sdk/dist/index.d.ts"
22
+ "./sdk/dist/index.d.ts",
23
+ "./README.md",
24
+ "./CHANGELOG.md"
14
25
  ],
15
26
  "types": "./sdk/dist/index.d.ts",
16
27
  "exports": {
@@ -23,19 +34,6 @@
23
34
  "default": "./sdk/dist/index.umd.js"
24
35
  }
25
36
  },
26
- "scripts": {
27
- "dev": "./build.ts dev",
28
- "build": "./build.ts prod",
29
- "test": "vitest run",
30
- "test:watch": "vitest",
31
- "test:run": "vitest run",
32
- "test:debug": "vitest run --printConsoleTrace=true --silent=false",
33
- "lint": "eslint . --ext .ts,.tsx",
34
- "lint:fix": "eslint . --fix --ext .ts,.tsx",
35
- "prettier": "prettier . --check",
36
- "prettier:fix": "prettier . --check --write",
37
- "prepare": "husky"
38
- },
39
37
  "dependencies": {
40
38
  "card-validator": "^10.0.3",
41
39
  "classnames": "^2.5.1",
@@ -76,5 +74,16 @@
76
74
  "typescript-eslint": "^8.48.0",
77
75
  "vitest": "^4.0.14"
78
76
  },
79
- "packageManager": "pnpm@10.15.1"
80
- }
77
+ "scripts": {
78
+ "dev": "./build.ts dev",
79
+ "build": "./build.ts prod",
80
+ "test": "vitest run",
81
+ "test:watch": "vitest",
82
+ "test:run": "vitest run",
83
+ "test:debug": "vitest run --printConsoleTrace=true --silent=false",
84
+ "lint": "eslint . --ext .ts,.tsx",
85
+ "lint:fix": "eslint . --fix --ext .ts,.tsx",
86
+ "prettier": "prettier . --check",
87
+ "prettier:fix": "prettier . --check --write"
88
+ }
89
+ }
@@ -1,5 +1,3 @@
1
- import { IframeAppearanceOptions } from '../../shared/types';
2
-
3
1
  /**
4
2
  * @public
5
3
  * Channel properties for a payment method or payment token.
@@ -11,7 +9,45 @@ export declare interface ChannelProperties {
11
9
  /**
12
10
  * @public
13
11
  */
14
- declare type ChannelPropertyPrimative = string | number | boolean | undefined;
12
+ export declare type ChannelPropertyPrimative = string | number | boolean | undefined;
13
+
14
+ /**
15
+ * @public
16
+ */
17
+ export declare type IframeAppearanceOptions = {
18
+ /**
19
+ * Limited styles applied to iframe inputs.
20
+ */
21
+ inputStyles?: {
22
+ fontFamily?: string;
23
+ fontSize?: string;
24
+ fontWeight?: string;
25
+ lineHeight?: string;
26
+ letterSpacing?: string;
27
+ color?: string;
28
+ backgroundColor?: string;
29
+ };
30
+ /**
31
+ * Limited styles applied to iframe input placeholders.
32
+ */
33
+ placeholderStyles?: {
34
+ color?: string;
35
+ };
36
+ /**
37
+ * Custom font face to load within iframe fields.
38
+ * If you use this, you don't need to specify fontFamily or fontWeight.
39
+ */
40
+ fontFace?: {
41
+ /**
42
+ * CSS font-face source descriptor (e.g. `url(...) format(...)`)
43
+ */
44
+ source: string;
45
+ /**
46
+ * Font face options. Font family and weight are set automatically.
47
+ */
48
+ descriptors?: Pick<FontFaceDescriptors, "display" | "style" | "stretch">;
49
+ };
50
+ };
15
51
 
16
52
  /**
17
53
  * @public
@@ -50,7 +86,7 @@ export declare class XenditComponents extends EventTarget {
50
86
  * ```
51
87
  * // initialize
52
88
  * const components = new XenditComponents({
53
- * sessionClientKey: "your-session-client-key",
89
+ * componentsSdkKey: "your-session-client-key",
54
90
  * });
55
91
  * ```
56
92
  */
@@ -118,7 +154,7 @@ export declare class XenditComponents extends EventTarget {
118
154
  *
119
155
  * @example
120
156
  * ```
121
- * const cardsChannel = components.getActiveChannels().find(ch => ch.channelCode === "CARDS");
157
+ * const cardsChannel = components.getActiveChannels({ filter: "CARDS" })[0];
122
158
  * const paymentComponent = components.createChannelComponent(cardsChannel);
123
159
  * document.querySelector(".payment-container").appendChild(paymentComponent);
124
160
  * ```
@@ -331,7 +367,7 @@ export declare class XenditComponents extends EventTarget {
331
367
  * Test version of XenditComponents that uses mock data instead of API calls.
332
368
  * Use this class for testing and development purposes.
333
369
  *
334
- * The sessionClientKey option is ignored.
370
+ * The componentsSdkKey option is ignored.
335
371
  *
336
372
  * @example
337
373
  * ```
@@ -341,10 +377,10 @@ export declare class XenditComponents extends EventTarget {
341
377
  export declare class XenditComponentsTest extends XenditComponents {
342
378
  /**
343
379
  * @public
344
- * Test SDK ignores sessionClientKey and uses a mock key.
380
+ * Test SDK ignores componentsSdkKey and uses a mock key.
345
381
  */
346
- constructor(options: Omit<XenditSdkOptions, "sessionClientKey"> & {
347
- sessionClientKey?: string;
382
+ constructor(options: Omit<XenditSdkOptions, "componentsSdkKey"> & {
383
+ componentsSdkKey?: string;
348
384
  });
349
385
  }
350
386
 
@@ -403,9 +439,16 @@ export declare type XenditEventMap = {
403
439
  * Event fired when the SDK fails in an unrecoverable way.
404
440
  */
405
441
  export declare class XenditFatalErrorEvent extends Event {
442
+ /**
443
+ * A detailed error message for developers. Don't show this to users.
444
+ */
406
445
  message: string;
407
446
  static type: "fatal-error";
408
- constructor(message: string);
447
+ constructor(
448
+ /**
449
+ * A detailed error message for developers. Don't show this to users.
450
+ */
451
+ message: string);
409
452
  }
410
453
 
411
454
  /**
@@ -566,7 +609,7 @@ export declare interface XenditSdkOptions {
566
609
  * Your server should retrieve this from the Xendit API and pass it directly to the
567
610
  * client without saving or logging it anywhere.
568
611
  */
569
- sessionClientKey: string;
612
+ componentsSdkKey: string;
570
613
  iframeFieldAppearance?: IframeAppearanceOptions;
571
614
  }
572
615