airwallex-payment-elements 1.147.0 → 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 +14 -2
- package/types/dropInElement.d.ts +25 -1
- package/types/element.d.ts +30 -1
- package/types/events.d.ts +94 -7
- 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,15 @@ 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
|
-
| 'zh-HK'
|
|
69
|
-
|
|
73
|
+
| 'zh-HK';
|
|
74
|
+
|
|
75
|
+
export type ExpressPaymentMethodType = 'googlepay' | 'applepay' | 'paypal' | 'venmo' | 'lumi' | 'birdpay';
|
|
70
76
|
|
|
71
77
|
/**
|
|
72
78
|
* Global option to customize font styles of Elements. You can specify font options using `family`, `src` and `weight` attributes.
|
|
@@ -423,6 +429,12 @@ export interface HostPaymentPage {
|
|
|
423
429
|
* @defaultValue `'pay'`
|
|
424
430
|
*/
|
|
425
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[];
|
|
426
438
|
}
|
|
427
439
|
|
|
428
440
|
/**
|
package/types/dropInElement.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
PaymentConsentOptions,
|
|
9
9
|
SavedPaymentMethodOptions,
|
|
10
10
|
SubmitType,
|
|
11
|
+
ExpressPaymentMethodType,
|
|
11
12
|
} from './airwallex';
|
|
12
13
|
import { ApplePayHppOrDropInRequestOptions, GooglePayRequestOptions, ContactField, LPMFlows } from './element';
|
|
13
14
|
interface WeChatPayFlow {
|
|
@@ -85,6 +86,15 @@ export interface DropInElementOptions {
|
|
|
85
86
|
* The payment methods your website would like to integrate with.
|
|
86
87
|
*/
|
|
87
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;
|
|
88
98
|
/**
|
|
89
99
|
* Whether the amount should be captured automatically upon successful payment authorization.
|
|
90
100
|
* Set it to `false` if you want to place a hold on the payment method and capture the funds sometime later.
|
|
@@ -145,7 +155,8 @@ export interface DropInElementOptions {
|
|
|
145
155
|
*/
|
|
146
156
|
customer_id?: string;
|
|
147
157
|
/**
|
|
148
|
-
*
|
|
158
|
+
* Options for recurring flow.
|
|
159
|
+
* @deprecated use {@link payment_consent} instead
|
|
149
160
|
*/
|
|
150
161
|
recurringOptions?: RecurringOptions;
|
|
151
162
|
/**
|
|
@@ -205,4 +216,17 @@ export interface DropInElementOptions {
|
|
|
205
216
|
* If the quote_id is not provided, Drop-in Element will use ACC logic to automatically convert the amount and currency.
|
|
206
217
|
*/
|
|
207
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[];
|
|
208
232
|
}
|
package/types/element.d.ts
CHANGED
|
@@ -130,6 +130,7 @@ export type PaymentMethodWithRedirect =
|
|
|
130
130
|
| 'linkaja'
|
|
131
131
|
| 'jenius_pay'
|
|
132
132
|
| 'klarna'
|
|
133
|
+
| 'wero'
|
|
133
134
|
| 'korean_local_card'
|
|
134
135
|
| 'naver_pay'
|
|
135
136
|
| 'payco'
|
|
@@ -233,6 +234,8 @@ export type ERROR_CODE =
|
|
|
233
234
|
* `onPendingVerifyAccount`: Triggered when the shopper checks out with Direct Debit payment methods and the bank account needs to be verified.
|
|
234
235
|
*
|
|
235
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.
|
|
236
239
|
*/
|
|
237
240
|
export type EventCode =
|
|
238
241
|
| 'onReady'
|
|
@@ -247,7 +250,8 @@ export type EventCode =
|
|
|
247
250
|
| 'onClick'
|
|
248
251
|
| 'onPendingVerifyAccount'
|
|
249
252
|
| 'onPressArrowKey'
|
|
250
|
-
| 'onSwitchMethod'
|
|
253
|
+
| 'onSwitchMethod'
|
|
254
|
+
| 'onSurchargeFeeChange';
|
|
251
255
|
|
|
252
256
|
export type TriggerEventCode = 'intentRefetch';
|
|
253
257
|
|
|
@@ -1975,6 +1979,16 @@ export interface ApplePayButtonElementType extends ElementBaseType {
|
|
|
1975
1979
|
completeValidation(merchantSession: unknown): void;
|
|
1976
1980
|
}
|
|
1977
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
|
+
|
|
1978
1992
|
/**
|
|
1979
1993
|
* Element functions can be used in your integration flow with Airwallex element.
|
|
1980
1994
|
*/
|
|
@@ -2019,6 +2033,21 @@ export interface DropInElementType extends ElementBaseType {
|
|
|
2019
2033
|
* ```
|
|
2020
2034
|
*/
|
|
2021
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>;
|
|
2022
2051
|
}
|
|
2023
2052
|
|
|
2024
2053
|
/**
|
package/types/events.d.ts
CHANGED
|
@@ -10,7 +10,8 @@ export type DropInElementEventCode =
|
|
|
10
10
|
| 'clickConfirmButton'
|
|
11
11
|
| 'switchMethod'
|
|
12
12
|
| 'pendingVerifyAccount'
|
|
13
|
-
| 'surchargeFeeChange'
|
|
13
|
+
| 'surchargeFeeChange'
|
|
14
|
+
| 'change';
|
|
14
15
|
|
|
15
16
|
export type DropInTriggerEventCode = 'intentRefetch';
|
|
16
17
|
|
|
@@ -103,10 +104,12 @@ export type SuccessEvent = {
|
|
|
103
104
|
export type SwitchMethodEvent = {
|
|
104
105
|
detail: {
|
|
105
106
|
/**
|
|
107
|
+
@deprecated replaced by methodType
|
|
106
108
|
* The method of the payment
|
|
107
109
|
*/
|
|
108
110
|
method: PaymentMethodType;
|
|
109
111
|
/**
|
|
112
|
+
@deprecated replaced by methodLabel
|
|
110
113
|
* The name of the method
|
|
111
114
|
*/
|
|
112
115
|
methodName: string;
|
|
@@ -114,6 +117,14 @@ export type SwitchMethodEvent = {
|
|
|
114
117
|
* The surcharge fee of the method
|
|
115
118
|
*/
|
|
116
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;
|
|
117
128
|
};
|
|
118
129
|
};
|
|
119
130
|
|
|
@@ -133,13 +144,13 @@ export type PendingVerifyAccountEvent = {
|
|
|
133
144
|
export type SurchargeFeeChangeEvent = {
|
|
134
145
|
detail: {
|
|
135
146
|
/**
|
|
136
|
-
* The
|
|
147
|
+
* The enum value of the payment method
|
|
137
148
|
*/
|
|
138
|
-
|
|
149
|
+
methodType: PaymentMethodType;
|
|
139
150
|
/**
|
|
140
|
-
* The
|
|
151
|
+
* The localized translation of the method name
|
|
141
152
|
*/
|
|
142
|
-
|
|
153
|
+
methodLabel: string;
|
|
143
154
|
/**
|
|
144
155
|
* The surcharge fee of the method
|
|
145
156
|
*/
|
|
@@ -155,6 +166,66 @@ export type SurchargeFeeChangeEvent = {
|
|
|
155
166
|
};
|
|
156
167
|
};
|
|
157
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
|
+
|
|
158
229
|
export type DropInElementEventHandler<T extends DropInElementEventCode> = (eventData: DropInElementEvent[T]) => void;
|
|
159
230
|
|
|
160
231
|
export type DropInElementTriggerEventParams<T extends DropInTriggerEventCode> = DropInElementTriggerMethodParam[T];
|
|
@@ -256,15 +327,31 @@ type DropInElementEvent = {
|
|
|
256
327
|
/**
|
|
257
328
|
* This event will be fired when the surcharge fee changes.
|
|
258
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
|
+
*
|
|
259
332
|
* @example
|
|
260
333
|
* ```ts
|
|
261
334
|
* element.on('surchargeFeeChange', (e) => {
|
|
262
|
-
* const {
|
|
263
|
-
* console.log('Surcharge fee changed', {
|
|
335
|
+
* const { methodType, methodLabel, surchargeFee, currency, base_amount } = e.detail;
|
|
336
|
+
* console.log('Surcharge fee changed', { methodType, methodLabel, surchargeFee, currency, base_amount });
|
|
264
337
|
* });
|
|
265
338
|
* ```
|
|
266
339
|
*/
|
|
267
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;
|
|
268
355
|
};
|
|
269
356
|
|
|
270
357
|
interface ApplePayDateComponents {
|
package/types/qrcodeElement.d.ts
CHANGED