xendit-components-web 0.0.7 → 0.0.8

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.
@@ -1,777 +0,0 @@
1
- import { IframeAppearanceOptions } from '../../shared/types';
2
-
3
- /**
4
- * @public
5
- * Channel properties for a payment method or payment token.
6
- */
7
- export declare interface ChannelProperties {
8
- [key: string]: ChannelPropertyPrimative | ChannelPropertyPrimative[] | ChannelProperties;
9
- }
10
-
11
- /**
12
- * @public
13
- */
14
- declare type ChannelPropertyPrimative = string | number | boolean | undefined;
15
-
16
- /**
17
- * @public
18
- * Event sometimes fired after submission, if an action is required.
19
- */
20
- export declare class XenditActionBeginEvent extends Event {
21
- static type: "action-begin";
22
- constructor();
23
- }
24
-
25
- /**
26
- * @public
27
- * Event fired when an action ends, success or fail.
28
- */
29
- export declare class XenditActionEndEvent extends Event {
30
- static type: "action-end";
31
- constructor();
32
- }
33
-
34
- /**
35
- * @public
36
- */
37
- export declare class XenditComponents extends EventTarget {
38
- /**
39
- * @public
40
- * Initialize the SDK for a given session.
41
- *
42
- * You can get the components sdk key from the components_sdk_key field of the
43
- * `POST /sessions` or `GET /session` endpoints.
44
- *
45
- * This creates an object that can be used to create UI components, that allow
46
- * users to make payment or save tokens, using a variety of channels, depending on
47
- * the session configuration.
48
- *
49
- * @example
50
- * ```
51
- * // initialize
52
- * const components = new XenditComponents({
53
- * sessionClientKey: "your-session-client-key",
54
- * });
55
- * ```
56
- */
57
- constructor(options: XenditSdkOptions);
58
- /**
59
- * @public
60
- * Retrieve the xendit session object.
61
- */
62
- getSession(): XenditSession;
63
- /**
64
- * @public
65
- * Retrieve the customer ascociated with the session.
66
- */
67
- getCustomer(): XenditCustomer | null;
68
- /**
69
- * @public
70
- * Retrieve the list of payment channels available for this session.
71
- *
72
- * The channels are organized in a way that is appropriate to show to users.
73
- * You can use this to render your channel picker UI.
74
- *
75
- * You can pass `{filter: "CHANNEL_CODE"}` to filter channels by string or regexp.
76
- */
77
- getActiveChannelGroups(options?: XenditGetChannelsOptions): XenditPaymentChannelGroup[];
78
- /**
79
- * @public
80
- * Retrieve an unorganized list of payment channels available for this session.
81
- *
82
- * Use this when you need to search for specific channels. When rendering your UI,
83
- * consider using `getActiveChannelGroups` if you support many channels.
84
- *
85
- * You can pass `{filter: "CHANNEL_CODE"}` to filter channels by string or regexp.
86
- */
87
- getActiveChannels(options?: XenditGetChannelsOptions): XenditPaymentChannel[];
88
- /**
89
- * @public
90
- * Creates a drop-in UI component for selecting a channel and making payments.
91
- *
92
- * This returns a div immediately. The component will be populated after
93
- * initialization is complete. You should insert this div into the DOM.
94
- *
95
- * Calling this again will destroy it and return a new element. Manually
96
- * destroying the component is not necessary, removing it from the DOM is sufficient.
97
- *
98
- * @example
99
- * ```
100
- * const channelPickerDiv = components.createChannelPickerComponent();
101
- * document.querySelector(".payment-container").appendChild(channelPickerDiv);
102
- * ```
103
- */
104
- createChannelPickerComponent(): HTMLElement;
105
- /**
106
- * @public
107
- * Creates a UI component for making payments with a specific channel. It will
108
- * contain form fields, and/or instructions for the user.
109
- *
110
- * This also makes the provided channel "current", the `submit` method
111
- * will use that channel.
112
- *
113
- * This returns a div. You should insert this div into the DOM. Creating a new
114
- * component multiple times for the same channel will return the same component instance.
115
- *
116
- * Destroying the component manually is not necessary, removing it from the DOM is sufficient,
117
- * but if you want to clear the form state, you can do so with the `destroyComponent` method.
118
- *
119
- * @example
120
- * ```
121
- * const cardsChannel = components.getActiveChannels().find(ch => ch.channelCode === "CARDS");
122
- * const paymentComponent = components.createChannelComponent(cardsChannel);
123
- * document.querySelector(".payment-container").appendChild(paymentComponent);
124
- * ```
125
- */
126
- createChannelComponent(channel: XenditPaymentChannel, active?: boolean): HTMLElement;
127
- /**
128
- * @public
129
- * Returns the current payment channel.
130
- */
131
- getCurrentChannel(): XenditPaymentChannel | null;
132
- /**
133
- * @public
134
- * Makes the given channel the current channel for submission.
135
- *
136
- * The current channel:
137
- * - Is interactive if it has a form (other channel components are non-interactive)
138
- * - Is used when `submit()` is called.
139
- *
140
- * Set to null to clear the current channel.
141
- */
142
- setCurrentChannel(channel: XenditPaymentChannel | null): void;
143
- /**
144
- * @public
145
- *
146
- * Reveals any hidden validation errors in the current channel's form. Does nothing if
147
- * there are no validation errors to show.
148
- *
149
- * Normally, validation errors on required fields are not shown if the user did not touch them.
150
- */
151
- showValidationErrors(): void;
152
- /**
153
- * @public
154
- * Creates a container element for rendering action UIs.
155
- *
156
- * For example, 3DS or QR codes.
157
- *
158
- * Create an action container before or during the action-begin event, and
159
- * the action UI will be rendered inside it.
160
- * Creating an action container during an action will throw an error.
161
- *
162
- * If no action container is created (or if the created container is removed from the DOM or is too small),
163
- * the SDK will create an action container (in a modal dialog) for you.
164
- */
165
- createActionContainerComponent(): HTMLElement;
166
- /**
167
- * @public
168
- * Destroys a component of any type created by the SDK. Removes it from the DOM if necessary.
169
- * Throws if the element is not a xendit component or if it was already destroyed.
170
- */
171
- destroyComponent(component: HTMLElement): void;
172
- /**
173
- * @public
174
- * Submit, makes a payment or saves a payment method for the current payment channel.
175
- *
176
- * Call this when your submit button is clicked. Listen to the events to know the status:
177
- * - `submission-begin` and `submission-end` to know when submission is in progress (you should disable your UI during this time). Submission-end also provides a reason.
178
- * - `action-begin` and `action-end` to know when user action is in progress
179
- * - `will-redirect` when the user will be redirected to another page
180
- * - `payment-[request|token]-[created|discarded]` informs you of the ID of the resource we create on the backend, and if/when it is discarded
181
- * - `session-complete` when the payment request or token is successfully created (you should redirect the user to your confirmation page)
182
- * - `session-expired-or-canceled` can happen at any time, but it's likely to happen on submission if the session expired or was cancelled during checkout
183
- * - `submission-not-ready` fires before `submission-begin` to indicate that you cannot submit while a submission is in progress
184
- *
185
- * When a submission fails, you can try again by calling `submit()` again.
186
- * (The `session-expired-or-canceled` and `fatal-error` events are fatal, submission failure is normal and recoverable)
187
- *
188
- * This corresponds to the endpoints:
189
- * - `POST /v3/payment_requests` for PAY sessions
190
- * - `POST /v3/payment_tokens` for SAVE sessions
191
- */
192
- submit(): void;
193
- /**
194
- * @public
195
- * Cancels a submission.
196
- *
197
- * If a submission is in-flight, the request is cancelled. If an action is in progress,
198
- * the action is aborted. Any active PaymentRequest or PaymentToken is abandoned.
199
- *
200
- * Does nothing if there is no active submission.
201
- */
202
- abortSubmission(): void;
203
- /**
204
- * @public
205
- * Completes a payment in test mode.
206
- *
207
- * The session must be in test mode, and the session type must be PAY, and
208
- * the sdk must have an in-progress action, and the channel must be a QR, VA, or OTC channel.
209
- *
210
- * @example
211
- * ```
212
- * components.addEventListener("action-begin", () => {
213
- * components.simulatePayment();
214
- * });
215
- * ```
216
- */
217
- simulatePayment(): void;
218
- /**
219
- * @public
220
- * The `init` event lets you know when the session data has been loaded.
221
- *
222
- * The `createChannelPickerComponent` method can be called before this event, but
223
- * most other functionaility needs to wait for this event.
224
- *
225
- * @example
226
- * ```
227
- * components.addEventListener("init", () => {
228
- * components.getSession();
229
- * });
230
- * ```
231
- */
232
- addEventListener(name: "init", listener: XenditEventListener<XenditInitEvent>, options?: boolean | AddEventListenerOptions): void;
233
- /**
234
- * @public
235
- * The `submission-ready` and `submission-not-ready` events let you know when submission should be available.
236
- * If ready, you can call `submit()` to begin the payment or token creation process.
237
- *
238
- * "submission-ready" means a channel has been selected, and all required fields are populated,
239
- * and all fields are valid.
240
- *
241
- * Use this to enable/disable your submit button.
242
- *
243
- * @example
244
- * ```
245
- * components.addEventListener("submission-ready", () => {
246
- * submitButton.disabled = false;
247
- * });
248
- * components.addEventListener("submission-not-ready", () => {
249
- * submitButton.disabled = true;
250
- * });
251
- * ```
252
- */
253
- addEventListener(name: "submission-ready", listener: XenditEventListener<XenditReadyEvent>, options?: boolean | AddEventListenerOptions): void;
254
- addEventListener(name: "submission-not-ready", listener: XenditEventListener<XenditReadyEvent>, options?: boolean | AddEventListenerOptions): void;
255
- /**
256
- * @public
257
- * The `submission-begin` and `submission-end` events let you know when a submission is in progress.
258
- *
259
- * Use this to disable your UI while submission is in progress.
260
- *
261
- * In the case of successful submission, `submission-end` will be followed by `session-complete`.
262
- * In the case of failed submission, the SDK will return to the ready state and you can try submitting again.
263
- */
264
- addEventListener(name: "submission-begin", listener: XenditEventListener<XenditSubmissionBeginEvent>, options?: boolean | AddEventListenerOptions): void;
265
- addEventListener(name: "submission-end", listener: XenditEventListener<XenditSubmissionEndEvent>, options?: boolean | AddEventListenerOptions): void;
266
- /**
267
- * @public
268
- * The events `payment-request-created`, `payment-token-created`, `payment-request-discarded`, and `payment-token-discarded`
269
- * let you know when a payment request or payment token has been created (as part of a submission) or
270
- * discarded (by cancelling or failing a submission).
271
- */
272
- addEventListener(name: "payment-request-created", listener: XenditEventListener<XenditPaymentRequestCreatedEvent>, options?: boolean | AddEventListenerOptions): void;
273
- addEventListener(name: "payment-token-created", listener: XenditEventListener<XenditPaymentTokenCreatedEvent>, options?: boolean | AddEventListenerOptions): void;
274
- addEventListener(name: "payment-request-discarded", listener: XenditEventListener<XenditPaymentRequestDiscardedEvent>, options?: boolean | AddEventListenerOptions): void;
275
- addEventListener(name: "payment-token-discarded", listener: XenditEventListener<XenditPaymentTokenDiscardedEvent>, options?: boolean | AddEventListenerOptions): void;
276
- /**
277
- * @public
278
- * The `action-begin` and `action-end` events let you know when a user action is in progress.
279
- *
280
- * After submission, an action may be required (e.g. 3DS, redirect, QR code, etc.).
281
- * The SDK will control the UI for actions, you don't need to do anything.
282
- *
283
- * Avoid changing any application state while an action is in progress as it may be
284
- * confusing for the user or interrupt their payment attempt.
285
- *
286
- * `action-end` is fired after the action is done, successfully or not. Note that users can
287
- * voluntarily dismiss actions.
288
- */
289
- addEventListener(name: "action-begin", listener: XenditEventListener<XenditActionBeginEvent>, options?: boolean | AddEventListenerOptions): void;
290
- addEventListener(name: "action-end", listener: XenditEventListener<XenditActionEndEvent>, options?: boolean | AddEventListenerOptions): void;
291
- /**
292
- * @public
293
- * Event handler called just before the user is redirected to a third party site to
294
- * complete the payment.
295
- *
296
- * Since redirects are actions, this will always be preceded by an `action-begin` event.
297
- */
298
- addEventListener(name: "will-redirect", listener: XenditEventListener<XenditWillRedirectEvent>, options?: boolean | AddEventListenerOptions): void;
299
- /**
300
- * @public
301
- * Event handler called on success.
302
- * The payment has been made and/or the token has been created.
303
- */
304
- addEventListener(name: "session-complete", listener: XenditEventListener<XenditSessionCompleteEvent>, options?: boolean | AddEventListenerOptions): void;
305
- /**
306
- * @public
307
- * Event handler called when the session has expired or been cancelled.
308
- */
309
- addEventListener(name: "session-expired-or-canceled", listener: XenditEventListener<XenditSessionExpiredOrCanceledEvent>, options?: boolean | AddEventListenerOptions): void;
310
- /**
311
- * @public
312
- * Event handler called when something unrecoverable has happened. You should create a new
313
- * session and a new SDK instance.
314
- */
315
- addEventListener(name: "fatal-error", listener: XenditEventListener<XenditFatalErrorEvent>, options?: boolean | AddEventListenerOptions): void;
316
- /**
317
- * @public
318
- * Fallback overload.
319
- */
320
- addEventListener<K extends keyof XenditEventMap>(type: K, listener: (this: XenditComponents, ev: XenditEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
321
- /**
322
- * @public
323
- * Fallback overload.
324
- */
325
- removeEventListener<K extends keyof XenditEventMap>(type: K, listener: (this: XenditComponents, ev: XenditEventMap[K]) => void, options?: boolean | AddEventListenerOptions): void;
326
- static amountFormat(amount: number, currency: string): string;
327
- }
328
-
329
- /**
330
- * @public
331
- * Test version of XenditComponents that uses mock data instead of API calls.
332
- * Use this class for testing and development purposes.
333
- *
334
- * The sessionClientKey option is ignored.
335
- *
336
- * @example
337
- * ```
338
- * const testSdk = new XenditComponentsTest({});
339
- * ```
340
- */
341
- export declare class XenditComponentsTest extends XenditComponents {
342
- /**
343
- * @public
344
- * Test SDK ignores sessionClientKey and uses a mock key.
345
- */
346
- constructor(options: Omit<XenditSdkOptions, "sessionClientKey"> & {
347
- sessionClientKey?: string;
348
- });
349
- }
350
-
351
- /**
352
- * @public
353
- */
354
- export declare interface XenditCustomer {
355
- id: string;
356
- type: "INDIVIDUAL";
357
- /**
358
- * E-mail address of customer.
359
- */
360
- email?: string;
361
- /**
362
- * Mobile number of customer in E.164 format +(country code)(subscriber number)
363
- */
364
- mobileNumber?: string;
365
- individualDetail: {
366
- /**
367
- * Primary or first name(s) of customer.
368
- */
369
- givenNames: string;
370
- /**
371
- * Last or family name of customer.
372
- */
373
- surname?: string;
374
- };
375
- }
376
-
377
- /**
378
- * @public
379
- */
380
- export declare type XenditEventListener<T extends Event | XenditEventMap[keyof XenditEventMap]> = ((event: T) => void) | null;
381
-
382
- /**
383
- * @public
384
- */
385
- export declare type XenditEventMap = {
386
- init: XenditInitEvent;
387
- "submission-ready": XenditReadyEvent;
388
- "submission-not-ready": XenditReadyEvent;
389
- "action-begin": XenditActionBeginEvent;
390
- "action-end": XenditActionEndEvent;
391
- "will-redirect": XenditWillRedirectEvent;
392
- "session-complete": XenditSessionCompleteEvent;
393
- "session-expired-or-canceled": XenditSessionExpiredOrCanceledEvent;
394
- "payment-request-created": XenditPaymentRequestCreatedEvent;
395
- "payment-request-discarded": XenditPaymentRequestDiscardedEvent;
396
- "payment-token-created": XenditPaymentTokenCreatedEvent;
397
- "payment-token-discarded": XenditPaymentTokenDiscardedEvent;
398
- "fatal-error": XenditFatalErrorEvent;
399
- };
400
-
401
- /**
402
- * @public
403
- * Event fired when the SDK fails in an unrecoverable way.
404
- */
405
- export declare class XenditFatalErrorEvent extends Event {
406
- message: string;
407
- static type: "fatal-error";
408
- constructor(message: string);
409
- }
410
-
411
- /**
412
- * @public
413
- * Options for retrieving payment channels.
414
- */
415
- export declare interface XenditGetChannelsOptions {
416
- /**
417
- * Filter channels by their channel codes.
418
- * (If using a RegExp, do not use the `g` flag.)
419
- */
420
- filter: string | string[] | RegExp;
421
- /**
422
- * If true, channels that do not satisfy the session's min/max amount will be filtered out.
423
- * Default true.
424
- */
425
- filterMinMax?: boolean;
426
- }
427
-
428
- /**
429
- * @public
430
- * Event fired when the Session is loaded.
431
- */
432
- export declare class XenditInitEvent extends Event {
433
- static type: "init";
434
- constructor();
435
- }
436
-
437
- /**
438
- * @public
439
- * Event fired when the SDK is not ready to submit.
440
- */
441
- export declare class XenditNotReadyEvent extends Event {
442
- static type: "submission-not-ready";
443
- constructor();
444
- }
445
-
446
- /**
447
- * @public
448
- */
449
- export declare interface XenditPaymentChannel {
450
- /**
451
- * The channel_code used to refer to this payment channel.
452
- *
453
- * This is either a string or an array of strings.
454
- *
455
- * In some cases (e.g. GOPAY), channels that are semantically the same have different channel codes depending
456
- * on whether they're being used for pay or pay and save. In that case this will be an array of two channel codes.
457
- */
458
- channelCode: string | string[];
459
- /**
460
- * The display name of the payment channel.
461
- */
462
- brandName: string;
463
- /**
464
- * The theme color associated with the payment channel, in hex format.
465
- *
466
- * This will always be suitable for use as a background color with white text.
467
- */
468
- brandColor: string;
469
- /**
470
- * The logo URL of the payment channel.
471
- */
472
- brandLogoUrl: string;
473
- /**
474
- * UI group to which this channel belongs.
475
- *
476
- * This is a suggestion for how to organize channels in your UI.
477
- */
478
- uiGroup: XenditPaymentChannelGroup;
479
- /**
480
- * The minimum amount for which this channel can be used.
481
- */
482
- minAmount?: number;
483
- /**
484
- * The maximum amount for which this channel can be used.
485
- */
486
- maxAmount?: number;
487
- /**
488
- * If this is a cards channel, the supported card brands.
489
- */
490
- cardBrands?: {
491
- name: string;
492
- logoUrl: string;
493
- }[];
494
- }
495
-
496
- /**
497
- * @public
498
- */
499
- export declare interface XenditPaymentChannelGroup {
500
- /**
501
- * An arbitrary identifier.
502
- */
503
- groupId: string;
504
- /**
505
- * The display name of the group.
506
- */
507
- label: string;
508
- /**
509
- * The sort priority of the group.
510
- */
511
- channels: readonly XenditPaymentChannel[];
512
- }
513
-
514
- /**
515
- * @public
516
- */
517
- export declare class XenditPaymentRequestCreatedEvent extends Event {
518
- paymentRequestId: string;
519
- static type: "payment-request-created";
520
- constructor(paymentRequestId: string);
521
- }
522
-
523
- /**
524
- * @public
525
- */
526
- export declare class XenditPaymentRequestDiscardedEvent extends Event {
527
- paymentRequestId: string;
528
- static type: "payment-request-discarded";
529
- constructor(paymentRequestId: string);
530
- }
531
-
532
- /**
533
- * @public
534
- */
535
- export declare class XenditPaymentTokenCreatedEvent extends Event {
536
- paymentTokenId: string;
537
- static type: "payment-token-created";
538
- constructor(paymentTokenId: string);
539
- }
540
-
541
- /**
542
- * @public
543
- */
544
- export declare class XenditPaymentTokenDiscardedEvent extends Event {
545
- paymentTokenId: string;
546
- static type: "payment-token-discarded";
547
- constructor(paymentTokenId: string);
548
- }
549
-
550
- /**
551
- * @public
552
- * Event fired when the SDK is ready to submit.
553
- */
554
- export declare class XenditReadyEvent extends Event {
555
- channelCode: string;
556
- static type: "submission-ready";
557
- constructor(channelCode: string);
558
- }
559
-
560
- /**
561
- * @public
562
- */
563
- export declare interface XenditSdkOptions {
564
- /**
565
- * The client key from your session.
566
- * Your server should retrieve this from the Xendit API and pass it directly to the
567
- * client without saving or logging it anywhere.
568
- */
569
- sessionClientKey: string;
570
- iframeFieldAppearance?: IframeAppearanceOptions;
571
- }
572
-
573
- /**
574
- * @public
575
- */
576
- export declare interface XenditSession {
577
- /**
578
- * Session ID with prefix `ps-`.
579
- */
580
- id: string;
581
- /**
582
- * Description of the transaction provided by merchant on session creation.
583
- * The SDK does not use this, but you may show it to your users.
584
- */
585
- description?: string;
586
- /**
587
- * The type of session.
588
- *
589
- * PAY sessions create a payment request, calling /v3/payment_requests
590
- * SAVE sessions create a saved payment token, calling /v3/payment_tokens
591
- */
592
- sessionType: "PAY" | "SAVE";
593
- /**
594
- * The kind of session, only COMPONENT sessions can be used with the components SDK.
595
- */
596
- mode: "COMPONENTS";
597
- /**
598
- * Merchant provided identifier for the session.
599
- */
600
- referenceId: string;
601
- /**
602
- * ISO 3166-1 alpha-2 two-letter country code for the country of transaction.
603
- */
604
- country: string;
605
- /**
606
- * ISO 4217 three-letter currency code for the payment.
607
- */
608
- currency: string;
609
- /**
610
- * For mode=PAY, the amount to be collected.
611
- * For mode=SAVE, this will always be 0.
612
- */
613
- amount: number;
614
- /**
615
- * A map of channels to channel properties provided by merchant on session creation.
616
- *
617
- * Keys are channel codes in lowercase.
618
- */
619
- channelProperties?: Record<string, ChannelProperties>;
620
- /**
621
- * When the session will expire. After this, it cannot be used, you'll need to create a new session.
622
- */
623
- expiresAt: Date;
624
- /**
625
- * Locale code for the session.
626
- */
627
- locale: string;
628
- /**
629
- * Status of the session.
630
- */
631
- status: "ACTIVE" | "CANCELED" | "EXPIRED" | "COMPLETED";
632
- /**
633
- * Indicates whether the customer is allowed to save their payment method during this session.
634
- *
635
- * DISABLED means users do not have the option to save a payment method.
636
- * OPTIONAL means users are given a checkbox to choose whether to save their payment method.
637
- * FORCED means users must save their payment method and only channels that support saving will be shown.
638
- * undefined means the merchant has not specified this preference or this is not a PAY session.
639
- *
640
- * If the user wishes to save a payment method, `/v3/payment_requests` will be called with type="PAY_AND_SAVE".
641
- */
642
- allowSavePaymentMethod?: "DISABLED" | "OPTIONAL" | "FORCED";
643
- /**
644
- * Indicates whether the payment will be captured automatically or manually.
645
- */
646
- captureMethod?: "AUTOMATIC" | "MANUAL";
647
- /**
648
- * Line items. The components SDK does not use this, but you may show it to your users.
649
- */
650
- items?: {
651
- /**
652
- * The type of item
653
- */
654
- type: "DIGITAL_PRODUCT" | "PHYSICAL_PRODUCT" | "DIGITAL_SERVICE" | "PHYSICAL_SERVICE" | "FEE";
655
- /**
656
- * Your reference ID for the item.
657
- */
658
- referenceId?: string;
659
- /**
660
- * Name of the item.
661
- */
662
- name: string;
663
- /**
664
- * Price per item. Can be negative for discounts. Total line item amount is net_unit_amount * quantity.
665
- */
666
- netUnitAmount: number;
667
- /**
668
- * Number of items in this line item.
669
- */
670
- quantity: number;
671
- url?: string;
672
- imageUrl?: string;
673
- category?: string;
674
- subcategory?: string;
675
- description?: string;
676
- metadata?: Record<string, string>;
677
- }[];
678
- }
679
-
680
- /**
681
- * @public
682
- * Event fired when the session is complete, meaning the payment has been processed
683
- * or the token has been created.
684
- */
685
- export declare class XenditSessionCompleteEvent extends Event {
686
- static type: "session-complete";
687
- constructor();
688
- }
689
-
690
- /**
691
- * @public
692
- * Event fired when the session has failed, meaning expired or cancelled.
693
- */
694
- export declare class XenditSessionExpiredOrCanceledEvent extends Event {
695
- static type: "session-expired-or-canceled";
696
- constructor();
697
- }
698
-
699
- /**
700
- * @public
701
- * Event fired after submission begins.
702
- */
703
- export declare class XenditSubmissionBeginEvent extends Event {
704
- static type: "submission-begin";
705
- constructor();
706
- }
707
-
708
- /**
709
- * @public
710
- * Event fired when a submission is complete or fails. Submission encompasses creation of a
711
- * payment request or payment token, and any actions the user needs to complete.
712
- *
713
- * Includes details about why the submission ended, and error messages if applicable.
714
- */
715
- export declare class XenditSubmissionEndEvent extends Event {
716
- /**
717
- * The reason why the submission ended.
718
- */
719
- reason: string;
720
- /**
721
- * An error message to show to the user. A title and 1-2 lines of localized text.
722
- */
723
- userErrorMessage?: string[] | undefined;
724
- /**
725
- * A detailed error message for developers.
726
- */
727
- developerErrorMessage?: {
728
- /**
729
- * The type of error.
730
- * - NETWORK_ERROR: A network error occurred while creating the payment request or payment token.
731
- * - ERROR: Failed to created a payment request or payment token.
732
- * - FAILURE: A payment request or payment token transitioned to a failure state.
733
- */
734
- type: "NETWORK_ERROR" | "ERROR" | "FAILURE";
735
- /**
736
- * The code associated with the error.
737
- */
738
- code: string;
739
- } | undefined;
740
- static type: "submission-end";
741
- constructor(
742
- /**
743
- * The reason why the submission ended.
744
- */
745
- reason: string,
746
- /**
747
- * An error message to show to the user. A title and 1-2 lines of localized text.
748
- */
749
- userErrorMessage?: string[] | undefined,
750
- /**
751
- * A detailed error message for developers.
752
- */
753
- developerErrorMessage?: {
754
- /**
755
- * The type of error.
756
- * - NETWORK_ERROR: A network error occurred while creating the payment request or payment token.
757
- * - ERROR: Failed to created a payment request or payment token.
758
- * - FAILURE: A payment request or payment token transitioned to a failure state.
759
- */
760
- type: "NETWORK_ERROR" | "ERROR" | "FAILURE";
761
- /**
762
- * The code associated with the error.
763
- */
764
- code: string;
765
- } | undefined);
766
- }
767
-
768
- /**
769
- * @public
770
- * Event fired when the a redirect action is about to happen.
771
- */
772
- export declare class XenditWillRedirectEvent extends Event {
773
- static type: "will-redirect";
774
- constructor();
775
- }
776
-
777
- export { }