airwallex-payment-elements 0.2.58 → 0.2.66

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.58] */
1
+ /* Airwallex Checkout Component Version [0.2.66] */
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.58] */
1
+ /* Airwallex Checkout Component Version [0.2.66] */
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.58] */
1
+ /* Airwallex Checkout Component Version [0.2.66] */
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.58",
3
+ "version": "0.2.66",
4
4
  "module": "lib/bin/airwallex.es.js",
5
5
  "main": "lib/bin/airwallex.cjs.js",
6
6
  "bin": "lib/bin/airwallex.cjs.js",
@@ -50,7 +50,6 @@
50
50
  "@rollup/plugin-replace": "^2.3.4",
51
51
  "@semantic-release/changelog": "^5.0.1",
52
52
  "@semantic-release/git": "^9.0.0",
53
- "@types/applepayjs": "^3.0.3",
54
53
  "@types/jest": "^26.0.20",
55
54
  "@typescript-eslint/eslint-plugin": "^4.15.1",
56
55
  "@typescript-eslint/parser": "^4.15.1",
@@ -96,6 +95,7 @@
96
95
  ]
97
96
  },
98
97
  "dependencies": {
98
+ "@types/applepayjs": "^3.0.3",
99
99
  "csstype": "^3.0.6"
100
100
  }
101
101
  }
@@ -12,7 +12,7 @@ import {
12
12
  } from './element';
13
13
  import { QrcodeElementOptions } from './qrcodeElement';
14
14
  import { Intent, PaymentMethodBasicInfo } from './cardNumber';
15
- import { BoxStyle, PaymentMethodType, ApplePayHppRequestOptions } from './element';
15
+ import { BoxStyle, PaymentMethodType, ApplePayHppOrDropInRequestOptions } from './element';
16
16
  import { getBrowserInfo, getDeviceFingerprint, get3dsReturnUrl, handle3ds } from './fraud';
17
17
  import { DropInElementOptions } from './dropInElement';
18
18
  import { RedirectElementOptions } from './redirectElement';
@@ -175,7 +175,7 @@ export interface HostPaymentPage {
175
175
  * The options of apple pay
176
176
  * If you want to integrate with apple pay, you need to provide the following options
177
177
  */
178
- applePayRequestOptions?: ApplePayHppRequestOptions;
178
+ applePayRequestOptions?: ApplePayHppOrDropInRequestOptions;
179
179
  /**
180
180
  * Currency of your payment intent or consent. Three-letter ISO currency code
181
181
  */
@@ -3,7 +3,7 @@ import { ElementOptions, DirectDebitPaymentMethod } from './element';
3
3
 
4
4
  export interface DirectDebitElementOptions extends ElementOptions {
5
5
  /**
6
- * The intent_id that would be confirmed with the new created payment consent
6
+ * The payment intent id you would like to checkout
7
7
  */
8
8
  intent_id: string;
9
9
  /**
@@ -1,5 +1,6 @@
1
1
  import { ElementOptions, PaymentMethodType, BoxStyle } from './element';
2
2
  import { Mode, HppRecurringOptions } from './airwallex';
3
+ import { ApplePayHppOrDropInRequestOptions } from './element';
3
4
 
4
5
  /**
5
6
  * Apply to dropIn element type integration, interface used when call createElement with type `dropIn`
@@ -27,6 +28,11 @@ export interface DropInElementOptions extends ElementOptions {
27
28
  * Indicate whether to capture immediate when authentication success
28
29
  */
29
30
  autoCapture?: boolean;
31
+ /**
32
+ * The options of apple pay
33
+ * If you want to integrate with apple pay, you need to provide the following options
34
+ */
35
+ applePayRequestOptions?: ApplePayHppOrDropInRequestOptions;
30
36
  /**
31
37
  * Indicate to improve 3DS experience, indicate if the payment form will collect billing info from shopper
32
38
  */
@@ -40,7 +46,7 @@ export interface DropInElementOptions extends ElementOptions {
40
46
  */
41
47
  authFormContainer?: string;
42
48
  /**
43
- * The intent_id that would be confirmed with the new created payment consent
49
+ * The payment intent id you would like to checkout, it's required when mode is `payment`
44
50
  */
45
51
  intent_id?: string;
46
52
  /**
@@ -36,6 +36,7 @@ export type PaymentMethodWithRedirect =
36
36
  | 'dana'
37
37
  | 'kakaopay'
38
38
  | 'tng'
39
+ | 'rabbit_line_pay'
39
40
  | 'poli'
40
41
  | 'fpx'
41
42
  | 'online_banking'
@@ -170,7 +171,8 @@ export type EventCode =
170
171
  | 'onBlur'
171
172
  | 'onChange'
172
173
  | 'onClick'
173
- | 'onPendingVerifyAccount';
174
+ | 'onPendingVerifyAccount'
175
+ | 'onPressArrowKey';
174
176
 
175
177
  /**
176
178
  * Return error when failed to validate user input or failed to request
@@ -224,6 +226,7 @@ export interface EventDetail {
224
226
  directDebit?: {
225
227
  url: string;
226
228
  };
229
+ arrowKey?: 'ArrowLeft' | 'ArrowRight' | 'ArrowTop' | 'ArrowDown';
227
230
  }
228
231
 
229
232
  export type ExtendEventDetail = EventDetail & {
@@ -466,7 +469,7 @@ export interface FullFeaturedCardPaymentOptions extends ElementOptions {
466
469
  mode?: 'payment';
467
470
  }
468
471
 
469
- export interface FullFeaturedCardRecurringOptions extends FullFeaturedCardPaymentOptions {
472
+ export interface FullFeaturedCardRecurringOptions extends Omit<FullFeaturedCardPaymentOptions, 'mode'> {
470
473
  /**
471
474
  * If the intent provided, this should be the client_secret of the intent
472
475
  * If no intent provided, this should be the client_secret of the customer
@@ -502,7 +505,7 @@ export interface PaymentShippingOption {
502
505
  selected: boolean;
503
506
  }
504
507
 
505
- export type ApplePayHppRequestOptions = ApplePayRequestOptions;
508
+ export type ApplePayHppOrDropInRequestOptions = ApplePayRequestOptions;
506
509
 
507
510
  export interface ApplePayRequestOriginalOptions {
508
511
  /**
@@ -567,7 +570,7 @@ export interface ApplePayRequestOptions extends ApplePayRequestOriginalOptions {
567
570
  */
568
571
  buttonColor?: 'black' | 'white' | ' white-with-line';
569
572
  /**
570
- * Description of the total price.
573
+ * Provide a business name for the label field. Use the same business name people will see when they look for the charge on their bank or credit card statement. For example, "COMPANY, INC."
571
574
  */
572
575
  totalPriceLabel?: string;
573
576
  /**
@@ -2,7 +2,7 @@ import { ElementOptions, PaymentMethodWithRedirect } from './element';
2
2
  import { Intent } from './cardNumber';
3
3
 
4
4
  /**
5
- * For alipaycn, alipayhk, gcash, dana, kakaopay, tng
5
+ * For alipaycn, alipayhk, gcash, dana, kakaopay, tng, rabbit_line_pay
6
6
  */
7
7
  interface RedirectElementPaymentBasicOptions extends ElementOptions {
8
8
  /**