airwallex-payment-elements 1.142.1 → 1.158.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/lib/bin/airwallex.cjs.js +2 -2
- package/lib/bin/airwallex.es.js +2 -2
- package/lib/bin/airwallex.iife.js +2 -2
- package/package.json +1 -1
- package/types/airwallex.d.ts +59 -0
- package/types/dropInElement.d.ts +31 -1
- package/types/element.d.ts +49 -4
- package/types/events.d.ts +145 -1
- package/types/qrcodeElement.d.ts +2 -1
package/lib/bin/airwallex.cjs.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [1.
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,t="/assets/elements.bundle.min.js?version=1.
|
|
1
|
+
/* Airwallex Checkout Component Version [1.158.0] */
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,t="/assets/elements.bundle.min.js?version=1.158.0",o=e=>{const r=document.createElement("script");r.src=`${e}${t}`,r.crossOrigin="anonymous";const o=document.head||document.body;if(!o)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return o.appendChild(r),r},n=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let n=0;const l=async()=>{const n=document.querySelector(`script[src="${t}"], script[src="${t}/"]`)||o(r((null==e?void 0:e.env)||"prod"));return new Promise(((r,t)=>{n.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):t(new Error("Failed to load Airwallex on load event"))})),n.addEventListener("error",(()=>{t(new Error("Failed to load Airwallex scripts")),n.remove&&n.remove()}))}))};for(;n<3;)try{return await l()}catch(e){n++,await new Promise((e=>window.setTimeout(e,500)))}return null},l=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},a=e=>{if(window.Airwallex)return window.Airwallex.redirectToCheckout(e);console.error("Please loadAirwallex() before redirectToCheckout();")},i=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),w=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),d=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),s=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},c=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";throw console.error(e),new Error(e)}},x=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},m=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},A=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},y=e=>window.Airwallex.getDeviceFingerprint(e);var u={getGatewayUrl:r,loadAirwallex:n,loadAirwallexJs:o,init:l,redirectToCheckout:a,createElement:i,destroyElement:w,getDeviceFingerprint:y,getElement:d,getPaymentIntent:m,createPaymentMethod:x,createPaymentConsent:A,confirmPaymentIntent:s,confirmPaymentIntentWithSavedCard:c};exports.confirmPaymentIntent=s,exports.confirmPaymentIntentWithSavedCard=c,exports.createElement=i,exports.createPaymentConsent=A,exports.createPaymentMethod=x,exports.default=u,exports.destroyElement=w,exports.getDeviceFingerprint=y,exports.getElement=d,exports.getGatewayUrl=r,exports.getPaymentIntent=m,exports.init=l,exports.loadAirwallex=n,exports.loadAirwallexJs=o,exports.redirectToCheckout=a;
|
|
3
3
|
//# sourceMappingURL=airwallex.cjs.js.map
|
package/lib/bin/airwallex.es.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [1.
|
|
2
|
-
const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,o="/assets/elements.bundle.min.js?version=1.
|
|
1
|
+
/* Airwallex Checkout Component Version [1.158.0] */
|
|
2
|
+
const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,o="/assets/elements.bundle.min.js?version=1.158.0",n=e=>{const r=document.createElement("script");r.src=`${e}${o}`,r.crossOrigin="anonymous";const n=document.head||document.body;if(!n)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return n.appendChild(r),r},l=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let l=0;const t=async()=>{const l=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||n(r((null==e?void 0:e.env)||"prod"));return new Promise(((r,o)=>{l.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))})),l.addEventListener("error",(()=>{o(new Error("Failed to load Airwallex scripts")),l.remove&&l.remove()}))}))};for(;l<3;)try{return await t()}catch(e){l++,await new Promise((e=>window.setTimeout(e,500)))}return null},t=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},a=e=>{if(window.Airwallex)return window.Airwallex.redirectToCheckout(e);console.error("Please loadAirwallex() before redirectToCheckout();")},i=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),w=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),d=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),c=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},s=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";throw console.error(e),new Error(e)}},m=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},x=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},A=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},u=e=>window.Airwallex.getDeviceFingerprint(e);var y={getGatewayUrl:r,loadAirwallex:l,loadAirwallexJs:n,init:t,redirectToCheckout:a,createElement:i,destroyElement:w,getDeviceFingerprint:u,getElement:d,getPaymentIntent:x,createPaymentMethod:m,createPaymentConsent:A,confirmPaymentIntent:c,confirmPaymentIntentWithSavedCard:s};export default y;export{c as confirmPaymentIntent,s as confirmPaymentIntentWithSavedCard,i as createElement,A as createPaymentConsent,m as createPaymentMethod,w as destroyElement,u as getDeviceFingerprint,d as getElement,r as getGatewayUrl,x as getPaymentIntent,t as init,l as loadAirwallex,n as loadAirwallexJs,a as redirectToCheckout};
|
|
3
3
|
//# sourceMappingURL=airwallex.es.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [1.
|
|
2
|
-
var Airwallex=function(e){"use strict";const r={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},n=e=>`https://${r[e]||r.prod}`,t="/assets/elements.bundle.min.js?version=1.
|
|
1
|
+
/* Airwallex Checkout Component Version [1.158.0] */
|
|
2
|
+
var Airwallex=function(e){"use strict";const r={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",dev:"checkout-dev.airwallex.com",local:"localhost:3000"},n=e=>`https://${r[e]||r.prod}`,t="/assets/elements.bundle.min.js?version=1.158.0",o=e=>{const r=document.createElement("script");r.src=`${e}${t}`,r.crossOrigin="anonymous";const n=document.head||document.body;if(!n)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return n.appendChild(r),r},l=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let r=0;const l=async()=>{const r=document.querySelector(`script[src="${t}"], script[src="${t}/"]`)||o(n((null==e?void 0:e.env)||"prod"));return new Promise(((n,t)=>{r.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),n(window.Airwallex)):t(new Error("Failed to load Airwallex on load event"))})),r.addEventListener("error",(()=>{t(new Error("Failed to load Airwallex scripts")),r.remove&&r.remove()}))}))};for(;r<3;)try{return await l()}catch(e){r++,await new Promise((e=>window.setTimeout(e,500)))}return null},a=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},i=e=>{if(window.Airwallex)return window.Airwallex.redirectToCheckout(e);console.error("Please loadAirwallex() before redirectToCheckout();")},w=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),d=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),c=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),s=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},m=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";throw console.error(e),new Error(e)}},x=async(e,r)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,r);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},A=async(e,r)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,r);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},u=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},y=e=>window.Airwallex.getDeviceFingerprint(e);var f={getGatewayUrl:n,loadAirwallex:l,loadAirwallexJs:o,init:a,redirectToCheckout:i,createElement:w,destroyElement:d,getDeviceFingerprint:y,getElement:c,getPaymentIntent:A,createPaymentMethod:x,createPaymentConsent:u,confirmPaymentIntent:s,confirmPaymentIntentWithSavedCard:m};return e.confirmPaymentIntent=s,e.confirmPaymentIntentWithSavedCard=m,e.createElement=w,e.createPaymentConsent=u,e.createPaymentMethod=x,e.default=f,e.destroyElement=d,e.getDeviceFingerprint=y,e.getElement=c,e.getGatewayUrl=n,e.getPaymentIntent=A,e.init=a,e.loadAirwallex=l,e.loadAirwallexJs=o,e.redirectToCheckout=i,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
3
3
|
//# sourceMappingURL=airwallex.iife.js.map
|
package/package.json
CHANGED
package/types/airwallex.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ export type Locale =
|
|
|
53
53
|
| 'es'
|
|
54
54
|
| 'fi'
|
|
55
55
|
| 'fr'
|
|
56
|
+
| 'he'
|
|
56
57
|
| 'id'
|
|
57
58
|
| 'it'
|
|
58
59
|
| 'ja'
|
|
@@ -63,10 +64,16 @@ export type Locale =
|
|
|
63
64
|
| 'pt'
|
|
64
65
|
| 'ro'
|
|
65
66
|
| 'ru'
|
|
67
|
+
| 'si'
|
|
66
68
|
| 'sv'
|
|
69
|
+
| 'tr'
|
|
70
|
+
| 'vi'
|
|
71
|
+
| 'ur'
|
|
67
72
|
| 'zh'
|
|
68
73
|
| 'zh-HK';
|
|
69
74
|
|
|
75
|
+
export type ExpressPaymentMethodType = 'googlepay' | 'applepay' | 'paypal' | 'venmo' | 'lumi' | 'birdpay';
|
|
76
|
+
|
|
70
77
|
/**
|
|
71
78
|
* Global option to customize font styles of Elements. You can specify font options using `family`, `src` and `weight` attributes.
|
|
72
79
|
*/
|
|
@@ -272,6 +279,11 @@ export interface HostPaymentPage {
|
|
|
272
279
|
* The payment consent details.
|
|
273
280
|
*/
|
|
274
281
|
payment_consent?: PaymentConsentOptions;
|
|
282
|
+
/**
|
|
283
|
+
* The options for saved payment method.
|
|
284
|
+
* @defaultValue `{ displayMode: 'auto', saveMode: 'auto' }`
|
|
285
|
+
*/
|
|
286
|
+
savedPaymentMethod?: SavedPaymentMethodOptions;
|
|
275
287
|
/**
|
|
276
288
|
* The ID of the Customer used in registered user checkout. Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro)
|
|
277
289
|
* This field is required when `mode` is `'recurring'`.
|
|
@@ -417,6 +429,12 @@ export interface HostPaymentPage {
|
|
|
417
429
|
* @defaultValue `'pay'`
|
|
418
430
|
*/
|
|
419
431
|
submitType?: SubmitType;
|
|
432
|
+
/**
|
|
433
|
+
* The express payment methods to be displayed on the payment page.
|
|
434
|
+
* @defaultValue `['googlepay', 'applepay', 'paypal', 'venmo', 'lumi', 'birdpay']`
|
|
435
|
+
* @hidden
|
|
436
|
+
*/
|
|
437
|
+
expressPaymentMethods?: ExpressPaymentMethodType[];
|
|
420
438
|
}
|
|
421
439
|
|
|
422
440
|
/**
|
|
@@ -654,6 +672,47 @@ export interface TermsOfUse {
|
|
|
654
672
|
end_date?: string;
|
|
655
673
|
}
|
|
656
674
|
|
|
675
|
+
type SaveMode =
|
|
676
|
+
| 'auto' // Default. Current behavior:
|
|
677
|
+
// - When next_triggered_by is undefined and customer_id is provided:
|
|
678
|
+
// * Show the checkbox.
|
|
679
|
+
// * If the customer ticks it, store the method for future CIT.
|
|
680
|
+
// * If the customer does not tick it, process as a guest checkout.
|
|
681
|
+
// - When next_triggered_by = 'merchant':
|
|
682
|
+
// * Do not show the checkbox.
|
|
683
|
+
// * Store the method for future MIT.
|
|
684
|
+
// - When next_triggered_by = 'customer':
|
|
685
|
+
// * Do not show the checkbox.
|
|
686
|
+
// * Store the method for future CIT.
|
|
687
|
+
| 'enable' // Always store when possible (no checkbox).
|
|
688
|
+
| 'disable' // Never store (always guest checkout).
|
|
689
|
+
| 'collect_consent'; // Show a checkbox and only store if the customer opts in.
|
|
690
|
+
|
|
691
|
+
export interface SavedPaymentMethodOptions {
|
|
692
|
+
/**
|
|
693
|
+
* Controls if UI *displays* existing saved payment methods.
|
|
694
|
+
*
|
|
695
|
+
* - 'auto' (default): If we have customer_id + valid payment consents,
|
|
696
|
+
* fetch and show saved methods (current behavior).
|
|
697
|
+
* - 'never': Never show saved methods in the UI, even if they exist.
|
|
698
|
+
*
|
|
699
|
+
* Note: This only affects display. Whether we *store* a method is
|
|
700
|
+
* controlled by saveMode.
|
|
701
|
+
* @defaultValue `'auto'`
|
|
702
|
+
*/
|
|
703
|
+
displayMode?: 'auto' | 'never';
|
|
704
|
+
/**
|
|
705
|
+
* Whether and how to store the payment method used in this transaction.
|
|
706
|
+
* auto – when next_triggered_by is undefined and a customer_id is present, a checkbox is shown so the customer can choose between guest checkout and storing the method for future CIT; when next_triggered_by is merchant or customer, no checkbox is shown and the method is automatically stored for future MIT or CIT respectively.
|
|
707
|
+
* enable – Always store the payment method when possible; no checkbox is shown.
|
|
708
|
+
* disable – Never store the payment method; always treat the transaction as guest checkout.
|
|
709
|
+
* collect_consent – Always show a checkbox and only store the payment method if the customer explicitly opts in.
|
|
710
|
+
* @hidden
|
|
711
|
+
* @defaultValue `'auto'`
|
|
712
|
+
*/
|
|
713
|
+
saveMode?: SaveMode;
|
|
714
|
+
}
|
|
715
|
+
|
|
657
716
|
export interface PaymentConsentOptions {
|
|
658
717
|
/**
|
|
659
718
|
* The party to initiate subsequent payment
|
package/types/dropInElement.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
AuthorizationType,
|
|
7
7
|
Layout,
|
|
8
8
|
PaymentConsentOptions,
|
|
9
|
+
SavedPaymentMethodOptions,
|
|
9
10
|
SubmitType,
|
|
11
|
+
ExpressPaymentMethodType,
|
|
10
12
|
} from './airwallex';
|
|
11
13
|
import { ApplePayHppOrDropInRequestOptions, GooglePayRequestOptions, ContactField, LPMFlows } from './element';
|
|
12
14
|
interface WeChatPayFlow {
|
|
@@ -70,6 +72,11 @@ export interface DropInElementOptions {
|
|
|
70
72
|
* The payment consent details.
|
|
71
73
|
*/
|
|
72
74
|
payment_consent?: PaymentConsentOptions;
|
|
75
|
+
/**
|
|
76
|
+
* The options for saved payment method.
|
|
77
|
+
* @defaultValue `{ displayMode: 'auto', saveMode: 'auto' }`
|
|
78
|
+
*/
|
|
79
|
+
savedPaymentMethod?: SavedPaymentMethodOptions;
|
|
73
80
|
/**
|
|
74
81
|
* The payment methods your website would like to integrate with
|
|
75
82
|
* @deprecated use {@link methods} instead
|
|
@@ -79,6 +86,15 @@ export interface DropInElementOptions {
|
|
|
79
86
|
* The payment methods your website would like to integrate with.
|
|
80
87
|
*/
|
|
81
88
|
methods?: Array<PaymentMethodType>;
|
|
89
|
+
/**
|
|
90
|
+
* Whether to display the built-in confirm button. Default is `true`.
|
|
91
|
+
* When set to `false`:
|
|
92
|
+
* - The confirm button will be hidden
|
|
93
|
+
* - Only card payment method will be displayed, other payment methods will be hidden
|
|
94
|
+
* - You must implement your own button and call `dropInElement.confirm()` to submit the payment
|
|
95
|
+
* @defaultValue `true`
|
|
96
|
+
*/
|
|
97
|
+
showConfirmButton?: boolean;
|
|
82
98
|
/**
|
|
83
99
|
* Whether the amount should be captured automatically upon successful payment authorization.
|
|
84
100
|
* Set it to `false` if you want to place a hold on the payment method and capture the funds sometime later.
|
|
@@ -139,7 +155,8 @@ export interface DropInElementOptions {
|
|
|
139
155
|
*/
|
|
140
156
|
customer_id?: string;
|
|
141
157
|
/**
|
|
142
|
-
*
|
|
158
|
+
* Options for recurring flow.
|
|
159
|
+
* @deprecated use {@link payment_consent} instead
|
|
143
160
|
*/
|
|
144
161
|
recurringOptions?: RecurringOptions;
|
|
145
162
|
/**
|
|
@@ -199,4 +216,17 @@ export interface DropInElementOptions {
|
|
|
199
216
|
* If the quote_id is not provided, Drop-in Element will use ACC logic to automatically convert the amount and currency.
|
|
200
217
|
*/
|
|
201
218
|
quote_id?: string | null;
|
|
219
|
+
/**
|
|
220
|
+
* Whether to force disable automatic currency conversion.
|
|
221
|
+
* - `true`: Overrides merchant settings to disable conversion.
|
|
222
|
+
* - `false`: Respects the merchant's automatic conversion configuration.
|
|
223
|
+
* @defaultValue `false`
|
|
224
|
+
*/
|
|
225
|
+
disableAutoCurrencyConversion?: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* The express payment methods to be displayed on the payment page.
|
|
228
|
+
* @defaultValue `['googlepay', 'applepay', 'paypal', 'venmo', 'lumi', 'birdpay']`
|
|
229
|
+
* @hidden
|
|
230
|
+
*/
|
|
231
|
+
expressPaymentMethods?: ExpressPaymentMethodType[];
|
|
202
232
|
}
|
package/types/element.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ import {
|
|
|
22
22
|
CardElementEventHandler,
|
|
23
23
|
DropInElementEventCode,
|
|
24
24
|
DropInElementEventHandler,
|
|
25
|
+
DropInElementTriggerEventParams,
|
|
26
|
+
DropInTriggerEventCode,
|
|
25
27
|
GooglePayButtonEventCode,
|
|
26
28
|
GooglePayButtonEventHandler,
|
|
27
29
|
SplitElementEventCode,
|
|
@@ -128,6 +130,7 @@ export type PaymentMethodWithRedirect =
|
|
|
128
130
|
| 'linkaja'
|
|
129
131
|
| 'jenius_pay'
|
|
130
132
|
| 'klarna'
|
|
133
|
+
| 'wero'
|
|
131
134
|
| 'korean_local_card'
|
|
132
135
|
| 'naver_pay'
|
|
133
136
|
| 'payco'
|
|
@@ -152,7 +155,8 @@ export type PaymentMethodWithRedirect =
|
|
|
152
155
|
| 'venmo'
|
|
153
156
|
| 'payme'
|
|
154
157
|
| 'tabby'
|
|
155
|
-
| 'octopus'
|
|
158
|
+
| 'octopus'
|
|
159
|
+
| 'spaylater';
|
|
156
160
|
|
|
157
161
|
export type DirectDebitPaymentMethod =
|
|
158
162
|
| 'ach_direct_debit'
|
|
@@ -230,6 +234,8 @@ export type ERROR_CODE =
|
|
|
230
234
|
* `onPendingVerifyAccount`: Triggered when the shopper checks out with Direct Debit payment methods and the bank account needs to be verified.
|
|
231
235
|
*
|
|
232
236
|
* `onSwitchMethod`: Triggered when the shopper switches payment methods in Hosted Payment Page or dropIn Element.
|
|
237
|
+
*
|
|
238
|
+
* `onSurchargeFeeChange`: Triggered when the surcharge fee changes.
|
|
233
239
|
*/
|
|
234
240
|
export type EventCode =
|
|
235
241
|
| 'onReady'
|
|
@@ -244,7 +250,10 @@ export type EventCode =
|
|
|
244
250
|
| 'onClick'
|
|
245
251
|
| 'onPendingVerifyAccount'
|
|
246
252
|
| 'onPressArrowKey'
|
|
247
|
-
| 'onSwitchMethod'
|
|
253
|
+
| 'onSwitchMethod'
|
|
254
|
+
| 'onSurchargeFeeChange';
|
|
255
|
+
|
|
256
|
+
export type TriggerEventCode = 'intentRefetch';
|
|
248
257
|
|
|
249
258
|
/**
|
|
250
259
|
* Return error when user input validation or the request fails.
|
|
@@ -1041,7 +1050,7 @@ export interface GooglePayButtonOptions extends GooglePayRequestOptions {
|
|
|
1041
1050
|
mode?: Mode;
|
|
1042
1051
|
/**
|
|
1043
1052
|
* Indicate the amount and currency of the Payment Intent.
|
|
1044
|
-
* If the `mode` is set to `'recurring'` and `intent_id` omitted, amount should be `{value: 0, currency: 'Replace with payment currency'}`.
|
|
1053
|
+
* If the `mode` is set to `'recurring'` and `intent_id` omitted, amount should be `{value: '0', currency: 'Replace with payment currency'}`.
|
|
1045
1054
|
*/
|
|
1046
1055
|
amount: Amount;
|
|
1047
1056
|
|
|
@@ -1247,7 +1256,7 @@ export interface ApplePayButtonOptions extends ApplePayRequestOptions {
|
|
|
1247
1256
|
/**
|
|
1248
1257
|
* Indicate the amount and currency of the Payment Intent.
|
|
1249
1258
|
*
|
|
1250
|
-
* If the `mode` is set to `'recurring'` and `intent_id` omitted, amount should be `{value: 0, currency: 'Replace with payment currency'}`.
|
|
1259
|
+
* If the `mode` is set to `'recurring'` and `intent_id` omitted, amount should be `{value: '0', currency: 'Replace with payment currency'}`.
|
|
1251
1260
|
*/
|
|
1252
1261
|
amount: Amount;
|
|
1253
1262
|
/**
|
|
@@ -1970,6 +1979,16 @@ export interface ApplePayButtonElementType extends ElementBaseType {
|
|
|
1970
1979
|
completeValidation(merchantSession: unknown): void;
|
|
1971
1980
|
}
|
|
1972
1981
|
|
|
1982
|
+
/**
|
|
1983
|
+
* Data for confirming payment intent in DropIn element.
|
|
1984
|
+
*/
|
|
1985
|
+
export interface DropInConfirmData {
|
|
1986
|
+
/**
|
|
1987
|
+
* The `client_secret` of the Payment Intent when Payment Intent is provided. Otherwise, this should be the `client_secret` of the Customer object.
|
|
1988
|
+
*/
|
|
1989
|
+
client_secret?: string;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1973
1992
|
/**
|
|
1974
1993
|
* Element functions can be used in your integration flow with Airwallex element.
|
|
1975
1994
|
*/
|
|
@@ -2003,6 +2022,32 @@ export interface DropInElementType extends ElementBaseType {
|
|
|
2003
2022
|
eventCode: EventCode,
|
|
2004
2023
|
handler: DropInElementEventHandler<EventCode>,
|
|
2005
2024
|
): void;
|
|
2025
|
+
|
|
2026
|
+
/**
|
|
2027
|
+
* Call this function to trigger a specific event.
|
|
2028
|
+
* @param code - The event code to trigger.
|
|
2029
|
+
* @param params - The parameters that pass to the triggered event handler.
|
|
2030
|
+
* @example
|
|
2031
|
+
* ```ts
|
|
2032
|
+
* element.trigger('intentRefetch');
|
|
2033
|
+
* ```
|
|
2034
|
+
*/
|
|
2035
|
+
trigger<T extends DropInTriggerEventCode>(code: T, params?: DropInElementTriggerEventParams<T>): void;
|
|
2036
|
+
|
|
2037
|
+
/**
|
|
2038
|
+
* Using this function to confirm payment intent when showConfirmButton is set to false, only applicable for card payment method.
|
|
2039
|
+
*
|
|
2040
|
+
* @param data - Payment confirmation data
|
|
2041
|
+
* @example
|
|
2042
|
+
* ```ts
|
|
2043
|
+
* element.confirm({
|
|
2044
|
+
* client_secret: 'replace-with-your-client-secret',
|
|
2045
|
+
* });
|
|
2046
|
+
* // or
|
|
2047
|
+
* element.confirm({});
|
|
2048
|
+
* ```
|
|
2049
|
+
*/
|
|
2050
|
+
confirm(data?: DropInConfirmData): Promise<Intent>;
|
|
2006
2051
|
}
|
|
2007
2052
|
|
|
2008
2053
|
/**
|
package/types/events.d.ts
CHANGED
|
@@ -9,7 +9,11 @@ export type DropInElementEventCode =
|
|
|
9
9
|
| 'cancel'
|
|
10
10
|
| 'clickConfirmButton'
|
|
11
11
|
| 'switchMethod'
|
|
12
|
-
| 'pendingVerifyAccount'
|
|
12
|
+
| 'pendingVerifyAccount'
|
|
13
|
+
| 'surchargeFeeChange'
|
|
14
|
+
| 'change';
|
|
15
|
+
|
|
16
|
+
export type DropInTriggerEventCode = 'intentRefetch';
|
|
13
17
|
|
|
14
18
|
export type ApplePayButtonEventCode =
|
|
15
19
|
| 'ready'
|
|
@@ -100,10 +104,12 @@ export type SuccessEvent = {
|
|
|
100
104
|
export type SwitchMethodEvent = {
|
|
101
105
|
detail: {
|
|
102
106
|
/**
|
|
107
|
+
@deprecated replaced by methodType
|
|
103
108
|
* The method of the payment
|
|
104
109
|
*/
|
|
105
110
|
method: PaymentMethodType;
|
|
106
111
|
/**
|
|
112
|
+
@deprecated replaced by methodLabel
|
|
107
113
|
* The name of the method
|
|
108
114
|
*/
|
|
109
115
|
methodName: string;
|
|
@@ -111,6 +117,14 @@ export type SwitchMethodEvent = {
|
|
|
111
117
|
* The surcharge fee of the method
|
|
112
118
|
*/
|
|
113
119
|
surchargeFee: number;
|
|
120
|
+
/**
|
|
121
|
+
* The enum value of the payment method
|
|
122
|
+
*/
|
|
123
|
+
methodType: PaymentMethodType;
|
|
124
|
+
/**
|
|
125
|
+
* The localized translation of the method name
|
|
126
|
+
*/
|
|
127
|
+
methodLabel: string;
|
|
114
128
|
};
|
|
115
129
|
};
|
|
116
130
|
|
|
@@ -127,8 +141,110 @@ export type PendingVerifyAccountEvent = {
|
|
|
127
141
|
};
|
|
128
142
|
};
|
|
129
143
|
|
|
144
|
+
export type SurchargeFeeChangeEvent = {
|
|
145
|
+
detail: {
|
|
146
|
+
/**
|
|
147
|
+
* The enum value of the payment method
|
|
148
|
+
*/
|
|
149
|
+
methodType: PaymentMethodType;
|
|
150
|
+
/**
|
|
151
|
+
* The localized translation of the method name
|
|
152
|
+
*/
|
|
153
|
+
methodLabel: string;
|
|
154
|
+
/**
|
|
155
|
+
* The surcharge fee of the method
|
|
156
|
+
*/
|
|
157
|
+
surchargeFee: number;
|
|
158
|
+
/**
|
|
159
|
+
* The currency of the payment
|
|
160
|
+
*/
|
|
161
|
+
currency: string;
|
|
162
|
+
/**
|
|
163
|
+
* The base amount of the payment
|
|
164
|
+
*/
|
|
165
|
+
base_amount: number;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export type DropInChangeEvent = {
|
|
170
|
+
detail: {
|
|
171
|
+
/**
|
|
172
|
+
* Whether the form is complete
|
|
173
|
+
*/
|
|
174
|
+
complete: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Whether the form is empty
|
|
177
|
+
*/
|
|
178
|
+
empty: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* The selected payment method
|
|
181
|
+
*/
|
|
182
|
+
selectedPaymentMethod: 'card' | null;
|
|
183
|
+
/**
|
|
184
|
+
* The form value
|
|
185
|
+
*/
|
|
186
|
+
value: {
|
|
187
|
+
/**
|
|
188
|
+
* The type of payment method
|
|
189
|
+
*/
|
|
190
|
+
type: 'card';
|
|
191
|
+
/**
|
|
192
|
+
* The card details (if type is 'card')
|
|
193
|
+
*/
|
|
194
|
+
card?: {
|
|
195
|
+
/**
|
|
196
|
+
* The card brand
|
|
197
|
+
*/
|
|
198
|
+
brand: string;
|
|
199
|
+
/**
|
|
200
|
+
* Whether the card input is complete
|
|
201
|
+
*/
|
|
202
|
+
complete: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* Whether the card input is empty
|
|
205
|
+
*/
|
|
206
|
+
empty: boolean;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* The error information (if any)
|
|
211
|
+
*/
|
|
212
|
+
error?: {
|
|
213
|
+
/**
|
|
214
|
+
* The error code
|
|
215
|
+
*/
|
|
216
|
+
code: string;
|
|
217
|
+
/**
|
|
218
|
+
* The error message
|
|
219
|
+
*/
|
|
220
|
+
message: string;
|
|
221
|
+
/**
|
|
222
|
+
* The field that has the error
|
|
223
|
+
*/
|
|
224
|
+
field?: string;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
|
|
130
229
|
export type DropInElementEventHandler<T extends DropInElementEventCode> = (eventData: DropInElementEvent[T]) => void;
|
|
131
230
|
|
|
231
|
+
export type DropInElementTriggerEventParams<T extends DropInTriggerEventCode> = DropInElementTriggerMethodParam[T];
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* The parameters that pass to the triggered event handler.
|
|
235
|
+
*/
|
|
236
|
+
type DropInElementTriggerMethodParam = {
|
|
237
|
+
/**
|
|
238
|
+
* Call this function to refetch the latest intent information.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* element.trigger('intentRefetch');
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
intentRefetch: undefined;
|
|
246
|
+
};
|
|
247
|
+
|
|
132
248
|
/**
|
|
133
249
|
* The event object you can listen to.
|
|
134
250
|
*/
|
|
@@ -208,6 +324,34 @@ type DropInElementEvent = {
|
|
|
208
324
|
* ```
|
|
209
325
|
*/
|
|
210
326
|
pendingVerifyAccount: PendingVerifyAccountEvent;
|
|
327
|
+
/**
|
|
328
|
+
* This event will be fired when the surcharge fee changes.
|
|
329
|
+
*
|
|
330
|
+
* **Note:** This event is specifically for surcharge fee updates. It may fire when switching payment methods if the new method has different fees. For general form state changes (completeness, input values, errors), use the `change` event instead.
|
|
331
|
+
*
|
|
332
|
+
* @example
|
|
333
|
+
* ```ts
|
|
334
|
+
* element.on('surchargeFeeChange', (e) => {
|
|
335
|
+
* const { methodType, methodLabel, surchargeFee, currency, base_amount } = e.detail;
|
|
336
|
+
* console.log('Surcharge fee changed', { methodType, methodLabel, surchargeFee, currency, base_amount });
|
|
337
|
+
* });
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
surchargeFeeChange: SurchargeFeeChangeEvent;
|
|
341
|
+
/**
|
|
342
|
+
* This event will be fired when the form data changes. Only triggered when showConfirmButton is set to false.
|
|
343
|
+
*
|
|
344
|
+
* **Note:** This event focuses on form state changes (completeness, input values, errors). For surcharge fee updates, use the `surchargeFeeChange` event instead.
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```ts
|
|
348
|
+
* element.on('change', (e) => {
|
|
349
|
+
* const { complete, empty, selectedPaymentMethod, value, error } = e.detail;
|
|
350
|
+
* console.log('Form changed', { complete, empty, selectedPaymentMethod, value, error });
|
|
351
|
+
* });
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
change: DropInChangeEvent;
|
|
211
355
|
};
|
|
212
356
|
|
|
213
357
|
interface ApplePayDateComponents {
|
package/types/qrcodeElement.d.ts
CHANGED