airwallex-payment-elements 0.2.75 → 0.2.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- /* Airwallex Checkout Component Version [0.2.75] */
1
+ /* Airwallex Checkout Component Version [0.2.81] */
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
@@ -1,3 +1,3 @@
1
- /* Airwallex Checkout Component Version [0.2.75] */
1
+ /* Airwallex Checkout Component Version [0.2.81] */
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.75] */
1
+ /* Airwallex Checkout Component Version [0.2.81] */
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "airwallex-payment-elements",
3
- "version": "0.2.75",
3
+ "version": "0.2.81",
4
4
  "module": "lib/bin/airwallex.es.js",
5
5
  "main": "lib/bin/airwallex.cjs.js",
6
6
  "bin": "lib/bin/airwallex.cjs.js",
@@ -76,6 +76,29 @@ export interface HppTheme extends BoxStyle {
76
76
  fonts?: FontOptions[];
77
77
  }
78
78
 
79
+ export interface RecurringOptions extends HppRecurringOptions {
80
+ /**
81
+ * The subsequent transactions are triggered by `merchant` or `customer`
82
+ */
83
+ next_triggered_by?: 'merchant' | 'customer';
84
+ /**
85
+ * The reason why merchant trigger transaction. Only applicable when next_triggered_by is `merchant`
86
+ */
87
+ merchant_trigger_reason?: 'scheduled' | 'unscheduled';
88
+ /**
89
+ * Only applicable when next_triggered_by is customer and method is card. If true, the customer must provide cvc for the subsequent payment with this PaymentConsent
90
+ */
91
+ requires_cvc?: boolean;
92
+ /**
93
+ * Currency of the initial PaymentIntent to verify the PaymentConsent. Three-letter ISO currency code. Only applicable for card method
94
+ */
95
+ currency?: string;
96
+ /**
97
+ * It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
98
+ */
99
+ connected_account_id?: string;
100
+ }
101
+
79
102
  /**
80
103
  * Config for HPP recurring flow
81
104
  */
@@ -84,6 +107,7 @@ export interface HppRecurringOptions {
84
107
  * Currently we supports card and alipay(exclude alipaycn) recurring flow
85
108
  * For alipay, merchant does not need to config anything
86
109
  * For card, merchant needs to provide related configurations
110
+ * @deperacated use `RecurringOptions` instead
87
111
  */
88
112
  card?: {
89
113
  /**
@@ -103,7 +127,7 @@ export interface HppRecurringOptions {
103
127
  */
104
128
  currency?: string;
105
129
  /**
106
- * It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
130
+ * It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
107
131
  */
108
132
  connected_account_id?: string;
109
133
  };
@@ -135,9 +159,14 @@ export interface HostPaymentPage {
135
159
  */
136
160
  customer_id?: string;
137
161
  /**
138
- * The payment method component your website would like to integrate with
162
+ * The payment methods your website would like to integrate with
163
+ * @deprecated use `methods` instead
139
164
  */
140
165
  components?: Array<PaymentMethodType>;
166
+ /**
167
+ * The payment methods your website would like to integrate with
168
+ */
169
+ methods?: Array<PaymentMethodType>;
141
170
  /**
142
171
  * Only support for card payment, indicate whether to capture immediate when authentication success
143
172
  */
@@ -174,7 +203,7 @@ export interface HostPaymentPage {
174
203
  /**
175
204
  * The options of recurring flow
176
205
  */
177
- recurringOptions?: HppRecurringOptions;
206
+ recurringOptions?: RecurringOptions;
178
207
  /**
179
208
  * The options of apple pay
180
209
  * If you want to integrate with apple pay, you need to provide the following options
@@ -553,8 +582,10 @@ export interface PaymentConsentRequest {
553
582
  /**
554
583
  * If the intent provided, this should be the client_secret of the intent
555
584
  * If no intent provided, this should be the client_secret of the customer
585
+ * For `cardNumber` or `card` element, it should be required.
586
+ * For `directDebit` element, you needn't provide it.
556
587
  */
557
- client_secret: string;
588
+ client_secret?: string;
558
589
  /**
559
590
  * The element you would like to use to create consent
560
591
  */
@@ -563,6 +594,10 @@ export interface PaymentConsentRequest {
563
594
  * The customer_id of the consent
564
595
  */
565
596
  customer_id: string;
597
+ /**
598
+ * The cardholder name for this payment method
599
+ */
600
+ cardname?: string;
566
601
  /**
567
602
  * If customer already has a payment method, merchant could provide it instead of create a new one
568
603
  */
@@ -584,7 +619,7 @@ export interface PaymentConsentRequest {
584
619
  */
585
620
  billing?: Billing;
586
621
  /**
587
- * It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
622
+ * It is to be used by the platform to indicate the connected entity in the transaction where platform is the owner of transaction.
588
623
  */
589
624
  connected_account_id?: string;
590
625
  }
@@ -609,11 +644,11 @@ export interface PaymentConsentResponse {
609
644
  /**
610
645
  * The currency of the payment consent
611
646
  */
612
- currency: string;
647
+ currency?: string;
613
648
  /**
614
649
  * The payment method of the payment consent
615
650
  */
616
- payment_method: {
651
+ payment_method?: {
617
652
  /**
618
653
  * The id of the payment method
619
654
  */
@@ -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
- * Checkout mode, can be one of payment, recurring
21
- * @default payment
15
+ * Customer name
16
+ */
17
+ shopper_name?: string;
18
+ /**
19
+ * Customer email
22
20
  */
23
- mode?: Mode;
21
+ shopper_email?: string;
24
22
  }
@@ -1,5 +1,5 @@
1
1
  import { ElementOptions, PaymentMethodType, BoxStyle } from './element';
2
- import { Mode, HppRecurringOptions, Billing } from './airwallex';
2
+ import { Mode, RecurringOptions, Billing } from './airwallex';
3
3
  import { ApplePayHppOrDropInRequestOptions, GooglePayRequestOptions } from './element';
4
4
 
5
5
  /**
@@ -21,9 +21,14 @@ export interface DropInElementOptions extends ElementOptions {
21
21
  */
22
22
  mode?: Mode;
23
23
  /**
24
- * The payment method component your website would like to integrate with
24
+ * The payment methods your website would like to integrate with
25
+ * @deprecated use `methods` instead
25
26
  */
26
27
  components?: Array<PaymentMethodType>;
28
+ /**
29
+ * The payment methods your website would like to integrate with
30
+ */
31
+ methods?: Array<PaymentMethodType>;
27
32
  /**
28
33
  * Indicate whether to capture immediate when authentication success
29
34
  */
@@ -61,7 +66,7 @@ export interface DropInElementOptions extends ElementOptions {
61
66
  /**
62
67
  * The options of recurring flow
63
68
  */
64
- recurringOptions?: HppRecurringOptions;
69
+ recurringOptions?: RecurringOptions;
65
70
  /**
66
71
  * The 2-letter ISO country code from which the consumer will be paying
67
72
  * If you want to integrate with `bank_transfer` payment method, it would be required
@@ -1,7 +1,7 @@
1
1
  import { Intent, PaymentMethodBasicInfo } from './cardNumber';
2
2
  import { Properties } from 'csstype';
3
3
  import { QrcodeElementOptions } from './qrcodeElement';
4
- import { HppRecurringOptions } from './airwallex';
4
+ import { RecurringOptions } from './airwallex';
5
5
  import { DropInElementOptions } from './dropInElement';
6
6
  import { RedirectElementOptions } from './redirectElement';
7
7
  import { NextAction } from './fraud';
@@ -354,6 +354,10 @@ export interface CardElementOptions extends ElementOptions {
354
354
  * Indicate whether to capture immediate when authentication success
355
355
  */
356
356
  autoCapture?: boolean;
357
+ /**
358
+ * One or more card networks that you support.
359
+ */
360
+ allowedCardNetworks?: CardNetwork[];
357
361
  /**
358
362
  * Style for card element
359
363
  */
@@ -382,6 +386,10 @@ export interface CardNumberElementOptions extends ElementOptions {
382
386
  * Indicate whether to capture immediate when authentication success
383
387
  */
384
388
  autoCapture?: boolean;
389
+ /**
390
+ * One or more card networks that you support.
391
+ */
392
+ allowedCardNetworks?: CardNetwork[];
385
393
  /**
386
394
  * The placeholder attribute specifies a short hint that describes the expected value of an input field
387
395
  */
@@ -490,7 +498,7 @@ export interface FullFeaturedCardRecurringOptions extends Omit<FullFeaturedCardP
490
498
  /**
491
499
  * The options of recurring flow
492
500
  */
493
- recurringOptions: HppRecurringOptions['card'];
501
+ recurringOptions: RecurringOptions;
494
502
  }
495
503
 
496
504
  export type FullFeaturedCardElementOptions = FullFeaturedCardPaymentOptions | FullFeaturedCardRecurringOptions;
@@ -589,6 +597,8 @@ export interface GooglePayHppRequestOptions extends Omit<GooglePayRequestOptions
589
597
  };
590
598
  }
591
599
 
600
+ export type CardNetwork = 'visa' | 'mastercard' | 'maestro' | 'unionpay' | 'amex';
601
+
592
602
  export type GoogleSupportedCardNetWork = 'MASTERCARD' | 'MAESTRO' | 'VISA';
593
603
  export interface GooglePayRequestOptions {
594
604
  /**
@@ -814,11 +824,17 @@ export interface ApplePayRequestOptions extends ApplePayRequestOriginalOptions {
814
824
  totalPriceType?: 'final' | 'pending';
815
825
  /**
816
826
  * Card networks supported by the merchant.
827
+ * if not configured, supportedNetworks will automatically configure based on merchant account settings
817
828
  * For more details, please refer to https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/1916122-supportednetworks
818
829
  */
819
830
  supportedNetworks?: string[];
820
831
  /**
821
- * Payment capabilities supported by the merchant. Default value is ['supports3DS', 'supportsDebit', 'supportsCredit', 'supportsEMV'].
832
+ * Payment capabilities supported by the merchant.
833
+ * If not configured, supportedNetworks will automatically configure according to the merchant account settings
834
+ * supports3DS - Required. This value must be supplied.
835
+ * supportsCredit - Optional. If present, only transactions that are categorized as credit cards are allowed.
836
+ * supportsDebit - Optional. If present, only transactions that are categorized as debit cards are allowed.
837
+ * supportsEMV - Include this value only if you support China Union Pay transactions. (if supportedNetworks don't contains chinaUnionPay, please don't include it).
822
838
  */
823
839
  merchantCapabilities?: ApplePayJS.ApplePayMerchantCapability[];
824
840
  }
package/types/index.d.ts CHANGED
@@ -27,7 +27,7 @@ import Airwallex, {
27
27
  HppTheme,
28
28
  HostPaymentPage,
29
29
  Mode,
30
- HppRecurringOptions,
30
+ RecurringOptions,
31
31
  Consent,
32
32
  } from './airwallex';
33
33
 
@@ -52,7 +52,7 @@ export {
52
52
  FontOptions,
53
53
  HppTheme,
54
54
  HostPaymentPage,
55
- HppRecurringOptions,
55
+ RecurringOptions,
56
56
  Consent,
57
57
  };
58
58