airwallex-payment-elements 0.2.75 → 0.2.79
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
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [0.2.
|
|
1
|
+
/* Airwallex Checkout Component Version [0.2.79] */
|
|
2
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",qa:"checkoutui.qa.awx.im",preview:"checkoutui.preview.awx.im",dev:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,o="/assets/elements.bundle.min.js",t=e=>{const r=document.createElement("script");r.src=`${e}${o}`;const t=document.head||document.body;if(!t)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return t.appendChild(r),r};exports.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},exports.confirmPaymentIntentWithSavedCard=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";throw console.error(e),new Error(e)}},exports.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),exports.createPaymentConsent=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},exports.createPaymentMethod=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)}},exports.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),exports.get3dsReturnUrl=e=>window.Airwallex.get3dsReturnUrl(e),exports.getBrowserInfo=e=>window.Airwallex.getBrowserInfo(e),exports.getDeviceFingerprint=e=>window.Airwallex.getDeviceFingerprint(e),exports.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),exports.getGatewayUrl=r,exports.getPaymentIntent=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)}},exports.handle3ds=e=>window.Airwallex.handle3ds(e),exports.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},exports.loadAirwallex=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="${o}"], script[src="${o}/"]`)||t(r((null==e?void 0:e.env)||"prod"));return new Promise(((r,o)=>{n.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))})),n.addEventListener("error",(()=>{o(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},exports.loadAirwallexJs=t,exports.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")};
|
|
3
3
|
//# sourceMappingURL=airwallex.cjs.js.map
|
package/lib/bin/airwallex.es.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [0.2.
|
|
1
|
+
/* Airwallex Checkout Component Version [0.2.79] */
|
|
2
2
|
const e={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",qa:"checkoutui.qa.awx.im",preview:"checkoutui.preview.awx.im",dev:"localhost:3000"},r=r=>`https://${e[r]||e.prod}`,o="/assets/elements.bundle.min.js",l=e=>{const r=document.createElement("script");r.src=`${e}${o}`;const l=document.head||document.body;if(!l)throw new Error("Airwallex payment scripts requires a <head> or <body> html element in order to be loaded.");return l.appendChild(r),r},n=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let n=0;const w=async()=>{const n=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||l(r((null==e?void 0:e.env)||"prod"));return new Promise(((r,o)=>{n.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),r(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))})),n.addEventListener("error",(()=>{o(new Error("Failed to load Airwallex scripts")),n.remove&&n.remove()}))}))};for(;n<3;)try{return await w()}catch(e){n++,await new Promise((e=>window.setTimeout(e,500)))}return null},w=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},i=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},t=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),a=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)}},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)}},u=e=>window.Airwallex.getBrowserInfo(e),f=e=>window.Airwallex.getDeviceFingerprint(e),h=e=>window.Airwallex.get3dsReturnUrl(e),y=e=>window.Airwallex.handle3ds(e);export{c as confirmPaymentIntent,s as confirmPaymentIntentWithSavedCard,t as createElement,A as createPaymentConsent,x as createPaymentMethod,a as destroyElement,h as get3dsReturnUrl,u as getBrowserInfo,f as getDeviceFingerprint,d as getElement,r as getGatewayUrl,m as getPaymentIntent,y as handle3ds,w as init,n as loadAirwallex,l as loadAirwallexJs,i as redirectToCheckout};
|
|
3
3
|
//# sourceMappingURL=airwallex.es.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* Airwallex Checkout Component Version [0.2.
|
|
1
|
+
/* Airwallex Checkout Component Version [0.2.79] */
|
|
2
2
|
var Airwallex=function(e){"use strict";const r={prod:"checkout.airwallex.com",demo:"checkout-demo.airwallex.com",staging:"checkout-staging.airwallex.com",qa:"checkoutui.qa.awx.im",preview:"checkoutui.preview.awx.im",dev:"localhost:3000"},n=e=>`https://${r[e]||r.prod}`,o="/assets/elements.bundle.min.js",l=e=>{const r=document.createElement("script");r.src=`${e}${o}`;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};return e.confirmPaymentIntent=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},e.confirmPaymentIntentWithSavedCard=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntentWithSavedCard(e);{const e="Please loadAirwallex() before confirmPaymentIntentWithSavedCard();";throw console.error(e),new Error(e)}},e.createElement=(e,r)=>window.Airwallex?window.Airwallex.createElement(e,r):(console.error("Please loadAirwallex() before createElement();"),null),e.createPaymentConsent=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}},e.createPaymentMethod=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)}},e.destroyElement=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),e.get3dsReturnUrl=e=>window.Airwallex.get3dsReturnUrl(e),e.getBrowserInfo=e=>window.Airwallex.getBrowserInfo(e),e.getDeviceFingerprint=e=>window.Airwallex.getDeviceFingerprint(e),e.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),e.getGatewayUrl=n,e.getPaymentIntent=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)}},e.handle3ds=e=>window.Airwallex.handle3ds(e),e.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},e.loadAirwallex=async e=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;let r=0;const t=async()=>{const r=document.querySelector(`script[src="${o}"], script[src="${o}/"]`)||l(n((null==e?void 0:e.env)||"prod"));return new Promise(((n,o)=>{r.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),n(window.Airwallex)):o(new Error("Failed to load Airwallex on load event"))})),r.addEventListener("error",(()=>{o(new Error("Failed to load Airwallex scripts")),r.remove&&r.remove()}))}))};for(;r<3;)try{return await t()}catch(e){r++,await new Promise((e=>window.setTimeout(e,500)))}return null},e.loadAirwallexJs=l,e.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
3
3
|
//# sourceMappingURL=airwallex.iife.js.map
|
package/package.json
CHANGED
package/types/airwallex.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ export interface HppRecurringOptions {
|
|
|
103
103
|
*/
|
|
104
104
|
currency?: string;
|
|
105
105
|
/**
|
|
106
|
-
* It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
|
|
106
|
+
* It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
|
|
107
107
|
*/
|
|
108
108
|
connected_account_id?: string;
|
|
109
109
|
};
|
|
@@ -553,8 +553,10 @@ export interface PaymentConsentRequest {
|
|
|
553
553
|
/**
|
|
554
554
|
* If the intent provided, this should be the client_secret of the intent
|
|
555
555
|
* If no intent provided, this should be the client_secret of the customer
|
|
556
|
+
* For `cardNumber` or `card` element, it should be required.
|
|
557
|
+
* For `directDebit` element, you needn't provide it.
|
|
556
558
|
*/
|
|
557
|
-
client_secret
|
|
559
|
+
client_secret?: string;
|
|
558
560
|
/**
|
|
559
561
|
* The element you would like to use to create consent
|
|
560
562
|
*/
|
|
@@ -563,6 +565,10 @@ export interface PaymentConsentRequest {
|
|
|
563
565
|
* The customer_id of the consent
|
|
564
566
|
*/
|
|
565
567
|
customer_id: string;
|
|
568
|
+
/**
|
|
569
|
+
* The cardholder name for this payment method
|
|
570
|
+
*/
|
|
571
|
+
cardname?: string;
|
|
566
572
|
/**
|
|
567
573
|
* If customer already has a payment method, merchant could provide it instead of create a new one
|
|
568
574
|
*/
|
|
@@ -584,7 +590,7 @@ export interface PaymentConsentRequest {
|
|
|
584
590
|
*/
|
|
585
591
|
billing?: Billing;
|
|
586
592
|
/**
|
|
587
|
-
* It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
|
|
593
|
+
* It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
|
|
588
594
|
*/
|
|
589
595
|
connected_account_id?: string;
|
|
590
596
|
}
|
|
@@ -609,11 +615,11 @@ export interface PaymentConsentResponse {
|
|
|
609
615
|
/**
|
|
610
616
|
* The currency of the payment consent
|
|
611
617
|
*/
|
|
612
|
-
currency
|
|
618
|
+
currency?: string;
|
|
613
619
|
/**
|
|
614
620
|
* The payment method of the payment consent
|
|
615
621
|
*/
|
|
616
|
-
payment_method
|
|
622
|
+
payment_method?: {
|
|
617
623
|
/**
|
|
618
624
|
* The id of the payment method
|
|
619
625
|
*/
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { Mode } from './airwallex';
|
|
2
1
|
import { ElementOptions, DirectDebitPaymentMethod } from './element';
|
|
3
2
|
|
|
4
3
|
export interface DirectDebitElementOptions extends ElementOptions {
|
|
5
|
-
/**
|
|
6
|
-
* The payment intent id you would like to checkout
|
|
7
|
-
*/
|
|
8
|
-
intent_id: string;
|
|
9
4
|
/**
|
|
10
5
|
* If the intent provided, this should be the client_secret of the intent
|
|
11
6
|
* If no intent provided, this should be the client_secret of the customer
|
|
@@ -17,8 +12,11 @@ export interface DirectDebitElementOptions extends ElementOptions {
|
|
|
17
12
|
*/
|
|
18
13
|
method: DirectDebitPaymentMethod;
|
|
19
14
|
/**
|
|
20
|
-
*
|
|
21
|
-
|
|
15
|
+
* Customer name
|
|
16
|
+
*/
|
|
17
|
+
shopper_name?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Customer email
|
|
22
20
|
*/
|
|
23
|
-
|
|
21
|
+
shopper_email?: string;
|
|
24
22
|
}
|
package/types/element.d.ts
CHANGED
|
@@ -814,11 +814,17 @@ export interface ApplePayRequestOptions extends ApplePayRequestOriginalOptions {
|
|
|
814
814
|
totalPriceType?: 'final' | 'pending';
|
|
815
815
|
/**
|
|
816
816
|
* Card networks supported by the merchant.
|
|
817
|
+
* if not configured, supportedNetworks will automatically configure based on merchant account settings
|
|
817
818
|
* For more details, please refer to https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/1916122-supportednetworks
|
|
818
819
|
*/
|
|
819
820
|
supportedNetworks?: string[];
|
|
820
821
|
/**
|
|
821
|
-
* Payment capabilities supported by the merchant.
|
|
822
|
+
* Payment capabilities supported by the merchant.
|
|
823
|
+
* If not configured, supportedNetworks will automatically configure according to the merchant account settings
|
|
824
|
+
* supports3DS - Required. This value must be supplied.
|
|
825
|
+
* supportsCredit - Optional. If present, only transactions that are categorized as credit cards are allowed.
|
|
826
|
+
* supportsDebit - Optional. If present, only transactions that are categorized as debit cards are allowed.
|
|
827
|
+
* supportsEMV - Include this value only if you support China Union Pay transactions. (if supportedNetworks don't contains chinaUnionPay, please don't include it).
|
|
822
828
|
*/
|
|
823
829
|
merchantCapabilities?: ApplePayJS.ApplePayMerchantCapability[];
|
|
824
830
|
}
|