airwallex-payment-elements 1.142.1 → 1.147.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 +48 -1
- package/types/dropInElement.d.ts +6 -0
- package/types/element.d.ts +19 -3
- package/types/events.d.ts +58 -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.147.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.147.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.147.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.147.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.147.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.147.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
|
@@ -65,7 +65,8 @@ export type Locale =
|
|
|
65
65
|
| 'ru'
|
|
66
66
|
| 'sv'
|
|
67
67
|
| 'zh'
|
|
68
|
-
| 'zh-HK'
|
|
68
|
+
| 'zh-HK'
|
|
69
|
+
| 'tr';
|
|
69
70
|
|
|
70
71
|
/**
|
|
71
72
|
* Global option to customize font styles of Elements. You can specify font options using `family`, `src` and `weight` attributes.
|
|
@@ -272,6 +273,11 @@ export interface HostPaymentPage {
|
|
|
272
273
|
* The payment consent details.
|
|
273
274
|
*/
|
|
274
275
|
payment_consent?: PaymentConsentOptions;
|
|
276
|
+
/**
|
|
277
|
+
* The options for saved payment method.
|
|
278
|
+
* @defaultValue `{ displayMode: 'auto', saveMode: 'auto' }`
|
|
279
|
+
*/
|
|
280
|
+
savedPaymentMethod?: SavedPaymentMethodOptions;
|
|
275
281
|
/**
|
|
276
282
|
* 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
283
|
* This field is required when `mode` is `'recurring'`.
|
|
@@ -654,6 +660,47 @@ export interface TermsOfUse {
|
|
|
654
660
|
end_date?: string;
|
|
655
661
|
}
|
|
656
662
|
|
|
663
|
+
type SaveMode =
|
|
664
|
+
| 'auto' // Default. Current behavior:
|
|
665
|
+
// - When next_triggered_by is undefined and customer_id is provided:
|
|
666
|
+
// * Show the checkbox.
|
|
667
|
+
// * If the customer ticks it, store the method for future CIT.
|
|
668
|
+
// * If the customer does not tick it, process as a guest checkout.
|
|
669
|
+
// - When next_triggered_by = 'merchant':
|
|
670
|
+
// * Do not show the checkbox.
|
|
671
|
+
// * Store the method for future MIT.
|
|
672
|
+
// - When next_triggered_by = 'customer':
|
|
673
|
+
// * Do not show the checkbox.
|
|
674
|
+
// * Store the method for future CIT.
|
|
675
|
+
| 'enable' // Always store when possible (no checkbox).
|
|
676
|
+
| 'disable' // Never store (always guest checkout).
|
|
677
|
+
| 'collect_consent'; // Show a checkbox and only store if the customer opts in.
|
|
678
|
+
|
|
679
|
+
export interface SavedPaymentMethodOptions {
|
|
680
|
+
/**
|
|
681
|
+
* Controls if UI *displays* existing saved payment methods.
|
|
682
|
+
*
|
|
683
|
+
* - 'auto' (default): If we have customer_id + valid payment consents,
|
|
684
|
+
* fetch and show saved methods (current behavior).
|
|
685
|
+
* - 'never': Never show saved methods in the UI, even if they exist.
|
|
686
|
+
*
|
|
687
|
+
* Note: This only affects display. Whether we *store* a method is
|
|
688
|
+
* controlled by saveMode.
|
|
689
|
+
* @defaultValue `'auto'`
|
|
690
|
+
*/
|
|
691
|
+
displayMode?: 'auto' | 'never';
|
|
692
|
+
/**
|
|
693
|
+
* Whether and how to store the payment method used in this transaction.
|
|
694
|
+
* 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.
|
|
695
|
+
* enable – Always store the payment method when possible; no checkbox is shown.
|
|
696
|
+
* disable – Never store the payment method; always treat the transaction as guest checkout.
|
|
697
|
+
* collect_consent – Always show a checkbox and only store the payment method if the customer explicitly opts in.
|
|
698
|
+
* @hidden
|
|
699
|
+
* @defaultValue `'auto'`
|
|
700
|
+
*/
|
|
701
|
+
saveMode?: SaveMode;
|
|
702
|
+
}
|
|
703
|
+
|
|
657
704
|
export interface PaymentConsentOptions {
|
|
658
705
|
/**
|
|
659
706
|
* The party to initiate subsequent payment
|
package/types/dropInElement.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
AuthorizationType,
|
|
7
7
|
Layout,
|
|
8
8
|
PaymentConsentOptions,
|
|
9
|
+
SavedPaymentMethodOptions,
|
|
9
10
|
SubmitType,
|
|
10
11
|
} from './airwallex';
|
|
11
12
|
import { ApplePayHppOrDropInRequestOptions, GooglePayRequestOptions, ContactField, LPMFlows } from './element';
|
|
@@ -70,6 +71,11 @@ export interface DropInElementOptions {
|
|
|
70
71
|
* The payment consent details.
|
|
71
72
|
*/
|
|
72
73
|
payment_consent?: PaymentConsentOptions;
|
|
74
|
+
/**
|
|
75
|
+
* The options for saved payment method.
|
|
76
|
+
* @defaultValue `{ displayMode: 'auto', saveMode: 'auto' }`
|
|
77
|
+
*/
|
|
78
|
+
savedPaymentMethod?: SavedPaymentMethodOptions;
|
|
73
79
|
/**
|
|
74
80
|
* The payment methods your website would like to integrate with
|
|
75
81
|
* @deprecated use {@link methods} instead
|
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,
|
|
@@ -152,7 +154,8 @@ export type PaymentMethodWithRedirect =
|
|
|
152
154
|
| 'venmo'
|
|
153
155
|
| 'payme'
|
|
154
156
|
| 'tabby'
|
|
155
|
-
| 'octopus'
|
|
157
|
+
| 'octopus'
|
|
158
|
+
| 'spaylater';
|
|
156
159
|
|
|
157
160
|
export type DirectDebitPaymentMethod =
|
|
158
161
|
| 'ach_direct_debit'
|
|
@@ -246,6 +249,8 @@ export type EventCode =
|
|
|
246
249
|
| 'onPressArrowKey'
|
|
247
250
|
| 'onSwitchMethod';
|
|
248
251
|
|
|
252
|
+
export type TriggerEventCode = 'intentRefetch';
|
|
253
|
+
|
|
249
254
|
/**
|
|
250
255
|
* Return error when user input validation or the request fails.
|
|
251
256
|
*/
|
|
@@ -1041,7 +1046,7 @@ export interface GooglePayButtonOptions extends GooglePayRequestOptions {
|
|
|
1041
1046
|
mode?: Mode;
|
|
1042
1047
|
/**
|
|
1043
1048
|
* 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'}`.
|
|
1049
|
+
* If the `mode` is set to `'recurring'` and `intent_id` omitted, amount should be `{value: '0', currency: 'Replace with payment currency'}`.
|
|
1045
1050
|
*/
|
|
1046
1051
|
amount: Amount;
|
|
1047
1052
|
|
|
@@ -1247,7 +1252,7 @@ export interface ApplePayButtonOptions extends ApplePayRequestOptions {
|
|
|
1247
1252
|
/**
|
|
1248
1253
|
* Indicate the amount and currency of the Payment Intent.
|
|
1249
1254
|
*
|
|
1250
|
-
* If the `mode` is set to `'recurring'` and `intent_id` omitted, amount should be `{value: 0, currency: 'Replace with payment currency'}`.
|
|
1255
|
+
* If the `mode` is set to `'recurring'` and `intent_id` omitted, amount should be `{value: '0', currency: 'Replace with payment currency'}`.
|
|
1251
1256
|
*/
|
|
1252
1257
|
amount: Amount;
|
|
1253
1258
|
/**
|
|
@@ -2003,6 +2008,17 @@ export interface DropInElementType extends ElementBaseType {
|
|
|
2003
2008
|
eventCode: EventCode,
|
|
2004
2009
|
handler: DropInElementEventHandler<EventCode>,
|
|
2005
2010
|
): void;
|
|
2011
|
+
|
|
2012
|
+
/**
|
|
2013
|
+
* Call this function to trigger a specific event.
|
|
2014
|
+
* @param code - The event code to trigger.
|
|
2015
|
+
* @param params - The parameters that pass to the triggered event handler.
|
|
2016
|
+
* @example
|
|
2017
|
+
* ```ts
|
|
2018
|
+
* element.trigger('intentRefetch');
|
|
2019
|
+
* ```
|
|
2020
|
+
*/
|
|
2021
|
+
trigger<T extends DropInTriggerEventCode>(code: T, params?: DropInElementTriggerEventParams<T>): void;
|
|
2006
2022
|
}
|
|
2007
2023
|
|
|
2008
2024
|
/**
|
package/types/events.d.ts
CHANGED
|
@@ -9,7 +9,10 @@ export type DropInElementEventCode =
|
|
|
9
9
|
| 'cancel'
|
|
10
10
|
| 'clickConfirmButton'
|
|
11
11
|
| 'switchMethod'
|
|
12
|
-
| 'pendingVerifyAccount'
|
|
12
|
+
| 'pendingVerifyAccount'
|
|
13
|
+
| 'surchargeFeeChange';
|
|
14
|
+
|
|
15
|
+
export type DropInTriggerEventCode = 'intentRefetch';
|
|
13
16
|
|
|
14
17
|
export type ApplePayButtonEventCode =
|
|
15
18
|
| 'ready'
|
|
@@ -127,8 +130,50 @@ export type PendingVerifyAccountEvent = {
|
|
|
127
130
|
};
|
|
128
131
|
};
|
|
129
132
|
|
|
133
|
+
export type SurchargeFeeChangeEvent = {
|
|
134
|
+
detail: {
|
|
135
|
+
/**
|
|
136
|
+
* The method of the payment
|
|
137
|
+
*/
|
|
138
|
+
method: PaymentMethodType;
|
|
139
|
+
/**
|
|
140
|
+
* The name of the method
|
|
141
|
+
*/
|
|
142
|
+
methodName: string;
|
|
143
|
+
/**
|
|
144
|
+
* The surcharge fee of the method
|
|
145
|
+
*/
|
|
146
|
+
surchargeFee: number;
|
|
147
|
+
/**
|
|
148
|
+
* The currency of the payment
|
|
149
|
+
*/
|
|
150
|
+
currency: string;
|
|
151
|
+
/**
|
|
152
|
+
* The base amount of the payment
|
|
153
|
+
*/
|
|
154
|
+
base_amount: number;
|
|
155
|
+
};
|
|
156
|
+
};
|
|
157
|
+
|
|
130
158
|
export type DropInElementEventHandler<T extends DropInElementEventCode> = (eventData: DropInElementEvent[T]) => void;
|
|
131
159
|
|
|
160
|
+
export type DropInElementTriggerEventParams<T extends DropInTriggerEventCode> = DropInElementTriggerMethodParam[T];
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The parameters that pass to the triggered event handler.
|
|
164
|
+
*/
|
|
165
|
+
type DropInElementTriggerMethodParam = {
|
|
166
|
+
/**
|
|
167
|
+
* Call this function to refetch the latest intent information.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* element.trigger('intentRefetch');
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
intentRefetch: undefined;
|
|
175
|
+
};
|
|
176
|
+
|
|
132
177
|
/**
|
|
133
178
|
* The event object you can listen to.
|
|
134
179
|
*/
|
|
@@ -208,6 +253,18 @@ type DropInElementEvent = {
|
|
|
208
253
|
* ```
|
|
209
254
|
*/
|
|
210
255
|
pendingVerifyAccount: PendingVerifyAccountEvent;
|
|
256
|
+
/**
|
|
257
|
+
* This event will be fired when the surcharge fee changes.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* element.on('surchargeFeeChange', (e) => {
|
|
262
|
+
* const { method, methodName, surchargeFee, currency, base_amount } = e.detail;
|
|
263
|
+
* console.log('Surcharge fee changed', { method, methodName, surchargeFee, currency, base_amount });
|
|
264
|
+
* });
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
surchargeFeeChange: SurchargeFeeChangeEvent;
|
|
211
268
|
};
|
|
212
269
|
|
|
213
270
|
interface ApplePayDateComponents {
|