airwallex-payment-elements 1.25.0 → 1.45.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/.gitlab-ci.yml CHANGED
@@ -9,6 +9,7 @@ variables:
9
9
  GITLAB_ONLY_REPO: "true"
10
10
  DOC_PATH_PREFIX: "payment-elements"
11
11
  GCS_UPLOAD_TAG: "acquiring"
12
+ ADDITIONAL_TAG: "nonpci"
12
13
  cache:
13
14
  key:
14
15
  files:
@@ -1,3 +1,3 @@
1
- /* Airwallex Checkout Component Version [1.25.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.25.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;
1
+ /* Airwallex Checkout Component Version [1.45.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.45.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
@@ -1,3 +1,3 @@
1
- /* Airwallex Checkout Component Version [1.25.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.25.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};
1
+ /* Airwallex Checkout Component Version [1.45.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.45.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.25.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.25.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}({});
1
+ /* Airwallex Checkout Component Version [1.45.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.45.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "airwallex-payment-elements",
3
- "version": "1.25.0",
3
+ "version": "1.45.0",
4
4
  "module": "lib/bin/airwallex.es.js",
5
5
  "main": "lib/bin/airwallex.cjs.js",
6
6
  "bin": "lib/bin/airwallex.cjs.js",
@@ -55,6 +55,7 @@
55
55
  "@typescript-eslint/parser": "^4.15.1",
56
56
  "confusing-browser-globals": "^1.0.10",
57
57
  "core-js": "^3.9.0",
58
+ "dts-bundle-generator": "^9.5.1",
58
59
  "eslint": "^7.20.0",
59
60
  "eslint-config-google": "^0.14.0",
60
61
  "eslint-config-prettier": "^7.2.0",
@@ -102,7 +103,6 @@
102
103
  "dependencies": {
103
104
  "@types/applepayjs": "^3.0.3",
104
105
  "@types/googlepay": "^0.6.4",
105
- "csstype": "^3.0.6",
106
- "dts-bundle-generator": "^8.1.2"
106
+ "csstype": "^3.0.6"
107
107
  }
108
108
  }
@@ -9,6 +9,17 @@ import {
9
9
  WechatElementOptions,
10
10
  ApplePayButtonOptions,
11
11
  GooglePayButtonOptions,
12
+ ApplePayButtonElementType,
13
+ GooglePayButtonElementType,
14
+ CardElementType,
15
+ DropInElementType,
16
+ CardNumberElementType,
17
+ ExpiryDateElementType,
18
+ CvcElementType,
19
+ WechatElementType,
20
+ FullFeaturedCardElementType,
21
+ RedirectElementType,
22
+ QrcodeElementType,
12
23
  } from './element';
13
24
  import { QrcodeElementOptions } from './qrcodeElement';
14
25
  import { Intent, PaymentMethodBasicInfo } from './cardNumber';
@@ -127,6 +138,10 @@ export interface RecurringOptions extends HppRecurringOptions {
127
138
  * Set it to true if you want to skip 3DS regardless of the risk score and SCA. Only applicable when it's card recurring flow.
128
139
  */
129
140
  skip_3ds?: boolean;
141
+ /**
142
+ * Descriptor that may be displayed to the customer during the verification.
143
+ */
144
+ descriptor?: string;
130
145
  }
131
146
 
132
147
  /**
@@ -218,10 +233,6 @@ export interface HostPaymentPage {
218
233
  * The failed return url when shopper can not fulfill the payment intent
219
234
  */
220
235
  failUrl?: string;
221
- /**
222
- * The cancel return url when shopper canceled the payment intent
223
- */
224
- cancelUrl?: string;
225
236
  /**
226
237
  * The logo url of your website you want to show in the HPP head
227
238
  */
@@ -260,6 +271,10 @@ export interface HostPaymentPage {
260
271
  * Currency of your payment intent or consent. Three-letter ISO currency code
261
272
  */
262
273
  currency: string;
274
+ /**
275
+ * The connected account associated with the payment when you are using Payments for Platforms. You should specify the specific connected account if you want to use its information to process the payment. This includes the statement descriptor displayed on the shopper's credit card or bank statement. The shopper will also see the available payment methods activated by the connected account.
276
+ */
277
+ platformConnectedAccount?: string;
263
278
  /**
264
279
  * The 2-letter ISO country code from which the consumer will be paying
265
280
  * If you want to integrate with `bank_transfer`, `online_banking`, `skrill` or `seven_eleven` payment method, it would be required
@@ -424,6 +439,7 @@ export interface PaymentMethod {
424
439
  code?: string;
425
440
  };
426
441
  }
442
+
427
443
  /**
428
444
  * Element integration `step #1.1` (optional)
429
445
  *
@@ -495,6 +511,20 @@ export interface ElementOptionsTypeMap {
495
511
  fullFeaturedCard: FullFeaturedCardElementOptions;
496
512
  }
497
513
 
514
+ export interface ElementTypeMap {
515
+ cardNumber?: CardNumberElementType;
516
+ expiry?: ExpiryDateElementType;
517
+ cvc?: CvcElementType;
518
+ applePayButton?: ApplePayButtonElementType;
519
+ googlePayButton?: GooglePayButtonElementType;
520
+ card?: CardElementType;
521
+ dropIn?: DropInElementType;
522
+ wechat?: WechatElementType;
523
+ qrcode?: QrcodeElementType;
524
+ redirect?: RedirectElementType;
525
+ fullFeaturedCard?: FullFeaturedCardElementType;
526
+ }
527
+
498
528
  /**
499
529
  * Interface of the request when call confirmPaymentIntent with contact.
500
530
  * The application scenario: when you already have a payment consent created by call createPaymentConsent and your customer would like to trigger a payment intent confirm with the pre signed consent (linked with customer_id)
@@ -504,7 +534,7 @@ export interface PaymentMethodWithConsent {
504
534
  * The id of the intent which would be confirmed
505
535
  * @deprecated Please use `intent_id`
506
536
  */
507
- id: string;
537
+ id?: string;
508
538
  /**
509
539
  * The id of the intent which would be confirmed
510
540
  */
@@ -571,7 +601,7 @@ export interface Consent {
571
601
  export declare function createElement<T extends keyof ElementOptionsTypeMap>(
572
602
  type: T,
573
603
  options?: ElementOptionsTypeMap[T],
574
- ): Element | null;
604
+ ): ElementTypeMap[T] | null;
575
605
  /**
576
606
  * Destroy element on the demand
577
607
  */
@@ -580,7 +610,7 @@ export declare const destroyElement: (type: ElementType) => boolean;
580
610
  /**
581
611
  * Query created element by type, there are only exist one type of element in one page
582
612
  */
583
- export declare const getElement: (type: ElementType) => Element | null;
613
+ export declare function getElement<T extends keyof ElementOptionsTypeMap>(type: T): ElementTypeMap[T] | null;
584
614
 
585
615
  /**
586
616
  * Element integration `step #4`
@@ -637,6 +667,10 @@ export interface PaymentConsentRequest {
637
667
  * The element you would like to use to create consent
638
668
  */
639
669
  element: Element;
670
+ /**
671
+ * payment_method_id is required when you want to create a payment consent with a saved payment method
672
+ */
673
+ payment_method_id?: string;
640
674
  /**
641
675
  * The customer_id of the consent
642
676
  */
@@ -645,10 +679,6 @@ export interface PaymentConsentRequest {
645
679
  * The cardholder name for this payment method
646
680
  */
647
681
  cardname?: string;
648
- /**
649
- * If customer already has a payment method, merchant could provide it instead of create a new one
650
- */
651
- payment_method_id?: string;
652
682
  /**
653
683
  * The subsequent transactions are triggered by `merchant` or `customer`
654
684
  */
@@ -15,6 +15,10 @@ export interface DropInElementOptions extends ElementOptions {
15
15
  * Currency of your payment intent or consent. Three-letter ISO currency code
16
16
  */
17
17
  currency: string;
18
+ /**
19
+ * The connected account associated with the payment when you are using Payments for Platforms. You should specify the specific connected account if you want to use its information to process the payment. This includes the statement descriptor displayed on the shopper's credit card or bank statement. The shopper will also see the available payment methods activated by the connected account.
20
+ */
21
+ platformConnectedAccount?: string;
18
22
  /**
19
23
  * Checkout mode, can be one of payment, recurring
20
24
  * @default payment
@@ -58,6 +62,7 @@ export interface DropInElementOptions extends ElementOptions {
58
62
  googlePayRequestOptions?: GooglePayRequestOptions;
59
63
  /**
60
64
  * Indicate to improve 3DS experience, indicate if the payment form will collect billing info from shopper
65
+ * @deprecated please use `requiredBillingContactFields` instead
61
66
  */
62
67
  withBilling?: boolean;
63
68
  /**
@@ -103,6 +108,7 @@ export interface DropInElementOptions extends ElementOptions {
103
108
  shopper_email?: string;
104
109
  /**
105
110
  * Billing info from merchant
111
+ * This option would override the user input billing fields, so don't set withBilling and requiredBillingContactFields when you use this option
106
112
  */
107
113
  billing?: Billing;
108
114
 
@@ -1,10 +1,13 @@
1
1
  import { Intent, PaymentMethodBasicInfo } from './cardNumber';
2
2
  import { Properties } from 'csstype';
3
3
  import { PaymentMethodWithQrcode, QrcodeElementOptions } from './qrcodeElement';
4
- import { AuthorizationType, RecurringOptions } from './airwallex';
4
+ import { AuthorizationType, Consent, RecurringOptions } from './airwallex';
5
5
  import { DropInElementOptions } from './dropInElement';
6
6
  import { RedirectElementOptions } from './redirectElement';
7
- import { Mode, InitOptions } from './airwallex';
7
+ import { Mode, InitOptions, PaymentMethod, PaymentConsentRequest, PaymentConsentResponse } from './airwallex';
8
+
9
+ export type PaymentMethodRequest = Omit<PaymentMethod, 'element'>;
10
+ export type CreatePaymentConsentRequest = Omit<PaymentConsentRequest, 'element'>;
8
11
 
9
12
  /**
10
13
  * All the flows that supported by Local Payment Methods
@@ -107,7 +110,20 @@ export type PaymentMethodWithRedirect =
107
110
  | 'korean_local_card'
108
111
  | 'naver_pay'
109
112
  | 'payco'
110
- | 'samsung_pay';
113
+ | 'samsung_pay'
114
+ | 'au_pay'
115
+ | 'bkash'
116
+ | 'd_barai'
117
+ | 'line_pay'
118
+ | 'merpay'
119
+ | 'payeasy_atm'
120
+ | 'paypay'
121
+ | 'rakuten_pay'
122
+ | 'safetypay'
123
+ | 'toss_pay'
124
+ | 'upi'
125
+ | 'zip'
126
+ | 'spei';
111
127
 
112
128
  export type DirectDebitPaymentMethod =
113
129
  | 'ach_direct_debit'
@@ -339,18 +355,36 @@ export interface PopUpStyle {
339
355
  popupHeight?: number;
340
356
  }
341
357
 
358
+ export type SelectorAllowed =
359
+ | '.Button'
360
+ | '.GooglePayButton'
361
+ | '.ApplePayButton'
362
+ | '.Input'
363
+ | '.Button:hover'
364
+ | '.GooglePayButton:hover'
365
+ | '.ApplePayButton:hover'
366
+ | '.Input:hover';
367
+ export interface Appearance {
368
+ rules?: Record<SelectorAllowed, Properties>;
369
+ }
370
+
342
371
  /**
343
372
  * Config base options for element integration, support using for ElementType
344
373
  */
345
374
  export interface ElementOptions {
346
375
  /**
347
- * Element css style camelcase option, default style by Chrome browser default
376
+ * * Element container css style camelcase option, default style by Chrome browser default
348
377
  */
349
378
  style?: PopUpStyle & Properties;
350
379
  /**
351
380
  * Your checkout website origin url, aka merchant checkout page's 'window.location.origin' field
352
381
  */
353
382
  origin?: string;
383
+ /**
384
+ * Customize the payment element to match the design of your site
385
+ * The layout of each Element stays consistent, but you can modify colors, fonts, borders, padding, and more.
386
+ */
387
+ appearance?: Appearance;
354
388
  }
355
389
 
356
390
  /**
@@ -518,6 +552,11 @@ export interface CvcElementOptions extends ElementOptions {
518
552
  * Container for authentication form, it's an element id
519
553
  */
520
554
  authFormContainer?: string;
555
+ /**
556
+ * Indicate if cvc elemment works alone or not.
557
+ * If you want to use cvc elements for saved consents payment, you could set it true to improve checkout experience
558
+ */
559
+ isStandalone?: boolean;
521
560
  }
522
561
 
523
562
  /**
@@ -626,25 +665,21 @@ export interface ApplePayRequestOriginalOptions {
626
665
 
627
666
  /**
628
667
  * The shipping information that you require from the user in order to fulfill the order.
629
- * @deprecated Airwallex won't save shipping info in apple pay
630
668
  */
631
669
  requiredShippingContactFields?: ApplePayJS.ApplePayContactField[];
632
670
 
633
671
  /**
634
672
  * Shipping contact information for the user.
635
- * @deprecated Airwallex won't save shipping info in apple pay
636
673
  */
637
674
  shippingContact?: ApplePayJS.ApplePayPaymentContact;
638
675
 
639
676
  /**
640
677
  * A set of shipping method objects that describe the available shipping methods.
641
- * @deprecated Airwallex won't save shipping info in apple pay
642
678
  */
643
679
  shippingMethods?: ApplePayJS.ApplePayShippingMethod[];
644
680
 
645
681
  /**
646
682
  * How the items are to be shipped.
647
- * @deprecated Airwallex won't save shipping info in apple pay
648
683
  */
649
684
  shippingType?: ApplePayJS.ApplePayShippingType;
650
685
 
@@ -685,6 +720,7 @@ export interface GooglePayRequestOptions {
685
720
  /**
686
721
  * Detailed information about the merchant.
687
722
  */
723
+
688
724
  merchantInfo?: {
689
725
  /**
690
726
  * Merchant name encoded as UTF-8.
@@ -835,21 +871,78 @@ export interface GooglePayRequestOptions {
835
871
  * Optional billing address parameters for the returned billing address.
836
872
  */
837
873
  billingAddressParameters?: google.payments.api.BillingAddressParameters;
874
+ /**
875
+ * Whether a shipping address is required from the buyer.
876
+ *
877
+ * The returned shipping address can be retrieved from
878
+ * [[Address|`Address`]].
879
+ *
880
+ * If omitted, defaults to `false`.
881
+ *
882
+ * @default false
883
+ */
884
+ shippingAddressRequired?: false | true | undefined;
885
+
886
+ /**
887
+ * Optional shipping address parameters.
888
+ *
889
+ * If omitted, the default values specified in
890
+ * [[ShippingAddressParameters|`ShippingAddressParameters`]] will be
891
+ * assumed.
892
+ */
893
+ shippingAddressParameters?: google.payments.api.ShippingAddressParameters;
894
+ /**
895
+ * Offers available for redemption that can be used with the current
896
+ * order.
897
+ */
898
+ offerInfo?: google.payments.api.OfferInfo;
899
+
900
+ /**
901
+ * Whether a shipping option is required from the buyer.
902
+ *
903
+ * If omitted, defaults to `false`.
904
+ * Note: This field is currently only for web only.
905
+ *
906
+ * @default false
907
+ */
908
+ shippingOptionRequired?: boolean;
909
+
910
+ /**
911
+ * Parameters for shipping option that can be used in this request.
912
+ *
913
+ * This should only be set if
914
+ * [[PaymentDataRequest.shippingOptionRequired|`PaymentDataRequest.shippingOptionRequired`]]
915
+ * is set to true.
916
+ *
917
+ * Note: This field is currently only for web only.
918
+ */
919
+ shippingOptionParameters?: google.payments.api.ShippingOptionParameters;
920
+
921
+ /**
922
+ * List of callbacks that the developer intents to handle.
923
+ * Upon selection by the user, these intents can be used to update the
924
+ * request with new data based on that selection (e.g. if a shipping
925
+ * option is selected, the developer could update the `transactionInfo`
926
+ * with new `totalPrice` and `diplayItems`).
927
+ *
928
+ * Note: This functionality is only available for web.
929
+ */
930
+ callbackIntents?: google.payments.api.CallbackIntent[];
838
931
  }
839
932
 
840
933
  export interface GooglePayButtonOptions extends GooglePayRequestOptions, ElementOptions {
841
934
  /**
842
935
  * The payment intent id you would like to checkout
843
- * It's required for payment mode and optional for recurring mode
844
936
  * Refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Payment_Intents/Intro)
845
937
  *
846
938
  */
847
939
  intent_id?: string;
848
940
  /**
849
941
  * If the intent_id provided, this should be the client_secret of the intent
850
- * If no intent_id provided, this should be the client_secret of the customer
942
+ * If no intent_id provided and customer_id provided, this should be the client_secret of the customer
943
+ * If no intent_id provided and no customer_id provided, this field can be empty
851
944
  */
852
- client_secret: string;
945
+ client_secret?: string;
853
946
  /**
854
947
  * Checkout for know customer, refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro)
855
948
  * It's required for recurring mode
@@ -884,8 +977,19 @@ export interface GooglePayButtonOptions extends GooglePayRequestOptions, Element
884
977
  * Container for authentication form, it's an element id
885
978
  */
886
979
  authFormContainer?: string;
980
+ /**
981
+ * Error for the last PaymentData, will be displayed to the user.
982
+ * Example: you can update error when user selected the wrong shipping option
983
+ * Note: This field is currently only for web only.
984
+ */
985
+ error?: google.payments.api.PaymentDataError;
887
986
  }
888
987
 
988
+ type GooglePayNextActionOptions = Pick<
989
+ GooglePayButtonOptions,
990
+ 'client_secret' | 'intent_id' | 'customer_id' | 'autoCapture' | 'authorizationType' | 'authFormContainer'
991
+ >;
992
+
889
993
  export interface ApplePayRequestOptions extends ApplePayRequestOriginalOptions {
890
994
  /**
891
995
  * Indicate the type of button you want displayed on your payments form. Like 'donate'
@@ -932,9 +1036,10 @@ export interface ApplePayButtonOptions extends ElementOptions, ApplePayRequestOp
932
1036
  intent_id?: string;
933
1037
  /**
934
1038
  * If the intent_id provided, this should be the client_secret of the intent
935
- * If no intent_id provided, this should be the client_secret of the customer
1039
+ * If no intent_id provided and customer_id provided, this should be the client_secret of the customer
1040
+ * If no intent_id provided and no customer_id provided, this value can be passed in update function later
936
1041
  */
937
- client_secret: string;
1042
+ client_secret?: string;
938
1043
  /**
939
1044
  * Checkout for know customer, refer to [Airwallex Client API](https://www.airwallex.com/docs/api#/Payment_Acceptance/Customers/Intro)
940
1045
  * It's required for recurring mode
@@ -992,6 +1097,8 @@ export interface Element {
992
1097
  * Refer to the options when call createElement
993
1098
  */
994
1099
  options?:
1100
+ | GooglePayButtonOptions
1101
+ | ApplePayButtonOptions
995
1102
  | CardElementOptions
996
1103
  | CardNumberElementOptions
997
1104
  | ExpiryDateElementOptions
@@ -1051,3 +1158,443 @@ export interface Element {
1051
1158
  initOptions?: InitOptions,
1052
1159
  ): void;
1053
1160
  }
1161
+
1162
+ interface ElementBaseType {
1163
+ /**
1164
+ * @hidden
1165
+ * The iframe element after mount to the DOM
1166
+ */
1167
+ iframe: HTMLIFrameElement | null;
1168
+ /**
1169
+ * @hidden
1170
+ * Refer to the DOM element you call mount function
1171
+ */
1172
+ domElement: null | HTMLElement;
1173
+ /**
1174
+ * Element integration `step #3`
1175
+ * Mount payment element to your HTML DOM element for checkout
1176
+ */
1177
+ /**
1178
+ * Mount element to your HTML DOM
1179
+ * @example
1180
+ * ```ts
1181
+ // type
1182
+ element.mount: (domElement: string | HTMLElement) => void
1183
+
1184
+ // There are two ways to mount element:
1185
+ // 1. call with container dom id
1186
+ element.mount('container-dom-id');
1187
+
1188
+ // 2.find the created DOM in existing HTML and call with container DOM element
1189
+ const containerElement = document.getElementById("container-dom-id");
1190
+ element.mount(containerElement);
1191
+ ```
1192
+ */
1193
+ mount(domElement: string | HTMLElement): null | HTMLElement;
1194
+
1195
+ /**
1196
+ * Using this function to unmount the element, opposite to mount function
1197
+ * The element instance is still kept
1198
+ * @example
1199
+ * ```ts
1200
+ element.unmount();
1201
+ ```
1202
+ */
1203
+ unmount(): void;
1204
+
1205
+ /**
1206
+ * Using this function to destory the element instance
1207
+ * @example
1208
+ ```ts
1209
+ element.destroy();
1210
+ ```
1211
+ *
1212
+ * ***IMPORTANT***
1213
+ *
1214
+ * Once element destroy by call function destroyElement, the element reference should not be used anymore
1215
+ */
1216
+ destroy(): void;
1217
+ }
1218
+
1219
+ type CardElementEvent = 'ready' | 'click' | 'focus' | 'blur';
1220
+ /**
1221
+ * Functions and external fields can be used in your integration flow with airwallex element
1222
+ */
1223
+ export interface CardElementType extends ElementBaseType {
1224
+ /**
1225
+ * Using this function to blur the input html element
1226
+ */
1227
+ blur(): void;
1228
+ /**
1229
+ * Using this function to clear the input html element
1230
+ */
1231
+ clear(): void;
1232
+ /**
1233
+ * Using this function to focus the input html element
1234
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/blur
1235
+ */
1236
+ focus(): void;
1237
+ /**
1238
+ * Using this function to create payment consent
1239
+ * @param data Payment consent request
1240
+ */
1241
+ createPaymentConsent(data: CreatePaymentConsentRequest): Promise<PaymentConsentResponse>;
1242
+ /**
1243
+ * Using this function to confirm payment intent
1244
+ * @param data Payment method
1245
+ */
1246
+ confirm(data: PaymentMethodRequest): Promise<Intent>;
1247
+ /**
1248
+ * Using this function to update the element option after create the element
1249
+ */
1250
+ update(options?: Partial<CardElementOptions>, initOptions?: Partial<InitOptions>): void;
1251
+ /**
1252
+ * Listen to element event
1253
+ *
1254
+ * @example
1255
+ ```ts
1256
+ element.on('success', () => {
1257
+ // Handle success event
1258
+ });
1259
+ ```
1260
+ */
1261
+ on(event: CardElementEvent, handler: EventListener): void;
1262
+ }
1263
+
1264
+ export type CardNumberElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pressArrowKey' | 'submit';
1265
+
1266
+ /**
1267
+ * Functions and external fields can be used in your integration flow with airwallex element
1268
+ */
1269
+ export interface CardNumberElementType extends ElementBaseType {
1270
+ /**
1271
+ * Using this function to blur the input html element
1272
+ */
1273
+ blur(): void;
1274
+ /**
1275
+ * Using this function to clear the input html element
1276
+ */
1277
+ clear(): void;
1278
+ /**
1279
+ * Using this function to focus the input html element
1280
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/blur
1281
+ */
1282
+ focus(): void;
1283
+ /**
1284
+ * Using this function to create payment consent
1285
+ * @param data Payment consent request
1286
+ */
1287
+ createPaymentConsent(data: CreatePaymentConsentRequest): Promise<PaymentConsentResponse>;
1288
+ /**
1289
+ * Using this function to confirm payment intent
1290
+ * @param data Payment method
1291
+ */
1292
+ confirm(data: PaymentMethodRequest): Promise<Intent>;
1293
+ /**
1294
+ * Using this function to update the element option after create the element
1295
+ */
1296
+ update(options?: Partial<CardNumberElementOptions>, initOptions?: Partial<InitOptions>): void;
1297
+ /**
1298
+ * Listen to element event
1299
+ *
1300
+ * @example
1301
+ ```ts
1302
+ element.on('change', () => {
1303
+ // Handle change event
1304
+ });
1305
+ ```
1306
+ */
1307
+ on(event: CardNumberElementEvent, handler: EventListener): void;
1308
+ }
1309
+
1310
+ export type ExpiryElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pressArrowKey';
1311
+
1312
+ /**
1313
+ * Functions and external fields can be used in your integration flow with airwallex element
1314
+ */
1315
+ export interface ExpiryDateElementType extends ElementBaseType {
1316
+ /**
1317
+ * Using this function to blur the input html element
1318
+ */
1319
+ blur(): void;
1320
+ /**
1321
+ * Using this function to clear the input html element
1322
+ */
1323
+ clear(): void;
1324
+ /**
1325
+ * Using this function to focus the input html element
1326
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/blur
1327
+ */
1328
+ focus(): void;
1329
+ /**
1330
+ * Using this function to update the element option after create the element
1331
+ */
1332
+ update(options?: Partial<ExpiryDateElementOptions>, initOptions?: Partial<InitOptions>): void;
1333
+ /**
1334
+ * Listen to element event
1335
+ *
1336
+ * @example
1337
+ ```ts
1338
+ element.on('change', () => {
1339
+ // Handle change event
1340
+ });
1341
+ ```
1342
+ */
1343
+ on(event: ExpiryElementEvent, handler: EventListener): void;
1344
+ }
1345
+
1346
+ export type CvcElementEvent = 'ready' | 'change' | 'focus' | 'blur' | 'pressArrowKey' | 'submit';
1347
+
1348
+ /**
1349
+ * Functions and external fields can be used in your integration flow with airwallex element
1350
+ */
1351
+ export interface CvcElementType extends ElementBaseType {
1352
+ /**
1353
+ * Using this function to blur the input html element
1354
+ */
1355
+ blur(): void;
1356
+ /**
1357
+ * Using this function to clear the input html element
1358
+ */
1359
+ clear(): void;
1360
+ /**
1361
+ * Using this function to focus the input html element
1362
+ * https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/blur
1363
+ */
1364
+ focus(): void;
1365
+ /**
1366
+ * Using this function to confirm payment intent
1367
+ * @param data Payment method
1368
+ */
1369
+ confirm(data: PaymentMethodRequest): Promise<Intent>;
1370
+ /**
1371
+ * Using this function to create payment consent
1372
+ * @param data Payment consent request
1373
+ */
1374
+ createPaymentConsent(data: CreatePaymentConsentRequest): Promise<PaymentConsentResponse>;
1375
+ /**
1376
+ * Using this function to update the element option after create the element
1377
+ */
1378
+
1379
+ update(options?: Partial<CvcElementOptions>, initOptions?: Partial<InitOptions>): void;
1380
+ /**
1381
+ * Listen to element event
1382
+ *
1383
+ * @example
1384
+ ```ts
1385
+ element.on('change', () => {
1386
+ // Handle change event
1387
+ });
1388
+ ```
1389
+ */
1390
+ on(event: CvcElementEvent, handler: EventListener): void;
1391
+ }
1392
+
1393
+ export type ApplePayButtonEvent =
1394
+ | 'ready'
1395
+ | 'click'
1396
+ | 'shippingMethodChange'
1397
+ | 'shippingAddressChange'
1398
+ | 'validateMerchant'
1399
+ | 'authorized'
1400
+ | 'cancel'
1401
+ | 'success'
1402
+ | 'error';
1403
+
1404
+ /**
1405
+ * Functions and external fields can be used in your integration flow with airwallex element
1406
+ */
1407
+ export interface ApplePayButtonElementType extends ElementBaseType {
1408
+ /**
1409
+ * Using this function to update the element option after create the element
1410
+ */
1411
+ update(options?: Partial<ApplePayButtonOptions>, initOptions?: Partial<InitOptions>): void;
1412
+
1413
+ /**
1414
+ * Listen to element event
1415
+ *
1416
+ * @example
1417
+ ```ts
1418
+ element.on('success', () => {
1419
+ // Handle success event
1420
+ });
1421
+ ```
1422
+ */
1423
+ on(event: ApplePayButtonEvent, handler: EventListener): void;
1424
+ /**
1425
+ * Using this function to confirm payment intent
1426
+ * @param data client_secret returned in create intent response
1427
+ */
1428
+ confirmIntent(data: { client_secret: string }): Promise<Intent>;
1429
+ /**
1430
+ * Using this function to create payment consent
1431
+ * @param data client_secret returned in create intent response or returned in create customer response
1432
+ */
1433
+ createPaymentConsent(data: { client_secret: string }): Promise<Consent | undefined>;
1434
+ /**
1435
+ *
1436
+ * @param data apple pay session data
1437
+ */
1438
+ completeValidation(data: unknown): void;
1439
+ }
1440
+
1441
+ export type DropInElementEvent =
1442
+ | 'ready'
1443
+ | 'click'
1444
+ | 'cancel'
1445
+ | 'success'
1446
+ | 'error'
1447
+ | 'switchMethod'
1448
+ | 'pendingVerifyAccount';
1449
+
1450
+ /**
1451
+ * Functions and external fields can be used in your integration flow with airwallex element
1452
+ */
1453
+ export interface DropInElementType extends ElementBaseType {
1454
+ /**
1455
+ * Using this function to update the element option after create the element
1456
+ */
1457
+ update(options?: Partial<DropInElementOptions>, initOptions?: Partial<InitOptions>): void;
1458
+ /**
1459
+ * Listen to element event
1460
+ *
1461
+ * @example
1462
+ ```ts
1463
+ element.on('success', () => {
1464
+ // Handle success event
1465
+ });
1466
+ ```
1467
+ */
1468
+ on(event: DropInElementEvent, handler: EventListener): void;
1469
+ }
1470
+
1471
+ export type GooglePayButtonEvent =
1472
+ | 'ready'
1473
+ | 'click'
1474
+ | 'cancel'
1475
+ | 'success'
1476
+ | 'error'
1477
+ | 'authorized'
1478
+ | 'shippingAddressChange'
1479
+ | 'shippingMethodChange';
1480
+ /**
1481
+ * Functions and external fields can be used in your integration flow with airwallex element
1482
+ */
1483
+ export interface GooglePayButtonElementType extends ElementBaseType {
1484
+ /**
1485
+ * Using this function to update the element option after create the element
1486
+ */
1487
+ update(options?: Partial<GooglePayButtonOptions>, initOptions?: Partial<InitOptions>): void;
1488
+
1489
+ /**
1490
+ * Listen to element event
1491
+ *
1492
+ * @example
1493
+ ```ts
1494
+ element.on('success', () => {
1495
+ // Handle success event
1496
+ });
1497
+ ```
1498
+ */
1499
+ on(event: GooglePayButtonEvent, handler: EventListener): void;
1500
+
1501
+ /**
1502
+ * Using this function to confirm payment intent
1503
+ * @param data client_secret returned in create intent response
1504
+ */
1505
+ confirmIntent(data: { client_secret: string }): Promise<Intent>;
1506
+ /**
1507
+ * Using this function to create payment consent
1508
+ * @param data client_secret returned in create intent response or returned in create customer response
1509
+ */
1510
+ createPaymentConsent(data: { client_secret: string }): Promise<Consent | undefined>;
1511
+ }
1512
+
1513
+ export type WechatElementEvent = 'ready' | 'success' | 'error';
1514
+ /**
1515
+ * @deprecated
1516
+ */
1517
+ export interface WechatElementType extends ElementBaseType {
1518
+ /**
1519
+ * Using this function to update the element option after create the element
1520
+ */
1521
+ update(options?: Partial<WechatElementOptions>, initOptions?: Partial<InitOptions>): void;
1522
+ /**
1523
+ * Listen to element event
1524
+ *
1525
+ * @example
1526
+ ```ts
1527
+ element.on('ready', () => {
1528
+ // Handle ready event
1529
+ });
1530
+ ```
1531
+ */
1532
+ on(event: WechatElementEvent, handler: EventListener): void;
1533
+ }
1534
+
1535
+ export type QrcodeElementEvent = 'ready' | 'success' | 'error';
1536
+ /**
1537
+ * @deprecated
1538
+ */
1539
+ export interface QrcodeElementType extends ElementBaseType {
1540
+ /**
1541
+ * Using this function to update the element option after create the element
1542
+ */
1543
+ update(options?: Partial<QrcodeElementOptions>, initOptions?: Partial<InitOptions>): void;
1544
+ /**
1545
+ * Listen to element event
1546
+ *
1547
+ * @example
1548
+ ```ts
1549
+ element.on('change', () => {
1550
+ // Handle change event
1551
+ });
1552
+ ```
1553
+ */
1554
+ on(event: QrcodeElementEvent, handler: EventListener): void;
1555
+ }
1556
+
1557
+ type FullFeaturedCardElementEvent = 'ready' | 'success' | 'error';
1558
+
1559
+ /**
1560
+ * @deprecated
1561
+ */
1562
+ export interface FullFeaturedCardElementType extends ElementBaseType {
1563
+ /**
1564
+ * Using this function to update the element option after create the element
1565
+ */
1566
+ update(options?: Partial<FullFeaturedCardElementOptions>, initOptions?: Partial<InitOptions>): void;
1567
+ /**
1568
+ * Listen to element event
1569
+ *
1570
+ * @example
1571
+ ```ts
1572
+ element.on('change', () => {
1573
+ // Handle change event
1574
+ });
1575
+ ```
1576
+ */
1577
+ on(event: FullFeaturedCardElementEvent, handler: EventListener): void;
1578
+ }
1579
+
1580
+ export type RedirectElementEvent = 'ready' | 'success' | 'error';
1581
+ /**
1582
+ * @deprecated
1583
+ */
1584
+ export interface RedirectElementType extends ElementBaseType {
1585
+ /**
1586
+ * Using this function to update the element option after create the element
1587
+ */
1588
+ update(options?: Partial<RedirectElementOptions>, initOptions?: Partial<InitOptions>): void;
1589
+ /**
1590
+ * Listen to element event
1591
+ *
1592
+ * @example
1593
+ ```ts
1594
+ element.on('change', () => {
1595
+ // Handle change event
1596
+ });
1597
+ ```
1598
+ */
1599
+ on(event: RedirectElementEvent, handler: EventListener): void;
1600
+ }
package/types/index.d.ts CHANGED
@@ -28,7 +28,9 @@ import Airwallex, {
28
28
  Mode,
29
29
  RecurringOptions,
30
30
  Consent,
31
+ ElementTypeMap,
31
32
  Locale,
33
+ Billing,
32
34
  } from './airwallex';
33
35
 
34
36
  export {
@@ -55,6 +57,8 @@ export {
55
57
  RecurringOptions,
56
58
  Consent,
57
59
  Locale,
60
+ Billing,
61
+ ElementTypeMap,
58
62
  };
59
63
 
60
64
  /**