Socket
Socket
Sign inDemoInstall

airwallex-payment-elements

Package Overview
Dependencies
Maintainers
3
Versions
161
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

airwallex-payment-elements - npm Package Compare versions

Comparing version 0.2.40 to 0.2.45

4

lib/bin/airwallex.cjs.js

@@ -1,4 +0,4 @@

/* Airwallex Checkout Component Version [0.2.40] */
"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"},t={prod:"https://pci-api.airwallex.com",demo:"https://pci-api-demo.airwallex.com",staging:"https://pci-api-staging.airwallex.com",qa:"https://pci-api-qa.airwallex.com",preview:"https://pci-api-preview.airwallex.com",dev:"http://localhost:8080"};class n{constructor(e,t){var n,i;this.domElement=null,this.gatewayUrl=e,this.options=t,this.iframe=window.document.createElement("iframe"),this.iframe.setAttribute("frameborder","0"),this.iframe.setAttribute("allowtransparency","true"),this.iframe.setAttribute("importance","high"),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("allowpaymentrequest","true"),null===(n=this.iframe)||void 0===n||n.setAttribute("style","\n height: 0;\n width: 100%;\n display: block;\n "),i=e=>{var t,n,i;if(e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)){const t=new CustomEvent(null===(n=e.data)||void 0===n?void 0:n.code,{detail:{type:null===(i=e.data)||void 0===i?void 0:i.type},bubbles:!0,composed:!0});window.document.dispatchEvent(t)}},window.addEventListener("message",(e=>{window.ReactNativeWebView&&window.ReactNativeWebView.postMessage(JSON.stringify(e.data)),i(e)}))}addResizeListener(e){window.addEventListener("message",(t=>{var n,i,o,l;if(t.origin===this.gatewayUrl&&t.isTrusted&&"onResize"===(null===(n=t.data)||void 0===n?void 0:n.code)&&e===(null===(i=t.data)||void 0===i?void 0:i.type)){const e=null===(o=this.iframe)||void 0===o?void 0:o.style;e&&(e.height=`${null===(l=t.data)||void 0===l?void 0:l.height}px`)}}))}mount(e){if("string"!=typeof e)return(null==e?void 0:e.hasChildNodes())&&(e.innerHTML=""),this.iframe&&e.appendChild(this.iframe),this.domElement=e,e;{const t=window.document.getElementById(e);return(null==t?void 0:t.hasChildNodes())&&(t.innerHTML=""),this.iframe&&(null==t||t.appendChild(this.iframe)),t&&(this.domElement=t),t}}blur(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"blur"},this.gatewayUrl)}clear(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"clear"},this.gatewayUrl)}destroy(){var e;this.clear(),null===(e=this.iframe)||void 0===e||e.remove(),this.iframe=null}focus(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"focus"},this.gatewayUrl)}unmount(){var e;this.clear(),this.iframe&&(null===(e=this.domElement)||void 0===e||e.removeChild(this.iframe))}update(e){var t,n;this.options={...this.options,...e},null===(n=null===(t=this.iframe)||void 0===t?void 0:t.contentWindow)||void 0===n||n.postMessage({code:"update",options:e},this.gatewayUrl)}async confirm(){throw new Error("Confirm is not supported in ElementBase")}success(e){throw new Error(`Call success with ${e.id} is not supported in ElementBase`)}fail(e){throw new Error(`Call fail with ${e.code}: ${e.message} is not supported in ElementBase`)}}const i=["cardNumber","expiry","cvc","paymentRequestButton","card","wechat","qrcode","redirect","dropIn","fullFeaturedCard","threeDsFrictionless","threeDsChallenge"],o={},l={cardNumber:null,expiry:null,cvc:null,threeDsFrictionless:null,threeDsChallenge:null,paymentRequestButton:null,card:null,wechat:null,qrcode:null,redirect:null,dropIn:null,fullFeaturedCard:null},r=e=>{var t;return i.includes(e)?(null===(t=l[e])||void 0===t||t.destroy(),l[e]=null,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1)},a=e=>i.includes(e)?l[e]:(console.warn(`getElement with type: ${e} not support!`),null),s=(e,t)=>i.includes(e)?(l[e]=t,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1);class d extends n{constructor(e,t,n){var i,l,r,a;super(e,n),this.confirmResponse=t,null===(i=this.iframe)||void 0===i||i.setAttribute("src",`${e}/#/elements/3ds-frictionless?options=${encodeURIComponent(JSON.stringify(this.options))}&lang=${null===(l=o)||void 0===l?void 0:l.locale}`),null===(r=this.iframe)||void 0===r||r.setAttribute("name","Airwallex 3DS frictionless iframe"),null===(a=this.iframe)||void 0===a||a.setAttribute("title","Airwallex 3DS frictionless iframe"),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsFrictionless"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}class c extends n{constructor(e,t,n){var i,o,l,r,a,s,d,c,u;super(e,n),this.confirmResponse=t;const w=(null==n?void 0:n.customizeChallengeWindowSize)&&b[null==n?void 0:n.customizeChallengeWindowSize]?b[null==n?void 0:n.customizeChallengeWindowSize]:b["05"],h=(null===(i=null==n?void 0:n.style)||void 0===i?void 0:i.popupWidth)?`${null===(o=null==n?void 0:n.style)||void 0===o?void 0:o.popupWidth}px`:w[0],p=(null===(l=null==n?void 0:n.style)||void 0===l?void 0:l.popupHeight)?`${null===(r=null==n?void 0:n.style)||void 0===r?void 0:r.popupHeight}px`:w[1];null===(a=this.iframe)||void 0===a||a.setAttribute("src",`${e}/#/elements/3ds-challenge?options=${encodeURIComponent(JSON.stringify(this.options))}`),null===(s=this.iframe)||void 0===s||s.setAttribute("name","Airwallex 3DS challenge iframe"),null===(d=this.iframe)||void 0===d||d.setAttribute("title","Airwallex 3DS challenge iframe"),null===(c=this.iframe)||void 0===c||c.setAttribute("scrolling","yes"),null===(u=this.iframe)||void 0===u||u.setAttribute("style",`\n background: #fff;\n width: ${h};\n height: ${p};\n position: ${(null==n?void 0:n.useDefaultStyle)?"absolute":"relative"};\n top: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n left: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n transform: ${(null==n?void 0:n.useDefaultStyle)?"translate(-50%, -50%)":"none"};\n border-radius: ${(null==n?void 0:n.useDefaultStyle)?"4px":"0"};\n `),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsChallenge"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}let u,w,h,p,m,v;const g={resolver:null,reject:null,awaiting:!1},f=e=>{var t;null===(t=document.querySelector(`#${e}`))||void 0===t||t.remove(),r("threeDsFrictionless"===e?"threeDsFrictionless":"threeDsChallenge")},y=()=>{g.awaiting=!1,g.resolver=null,g.reject=null},x=e=>{var t,n,i;const o="data"in e?e.data:e.detail,l=["hpp","api"].includes(h),r=l?null:a(h),d=(null==r?void 0:r.gatewayUrl)||window.location.origin;("data"in e&&e.origin===d&&e.isTrusted||l)&&"threeDsFrictionless"===(null==o?void 0:o.type)&&(f("threeDsChallenge"),"onSuccess"===(null==o?void 0:o.code)&&(console.log("frictionlessHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=g.resolver)||void 0===t||t.call(g,o),y(),f("threeDsFrictionless")),["onError","onChallengeError"].includes(null==o?void 0:o.code)&&(console.log(`frictionlessHandler ${null==o?void 0:o.code}`,(new Date).toLocaleTimeString()),null===(n=g.reject)||void 0===n||n.call(g,o),y(),f("threeDsFrictionless")),"onChallenge"===(null==o?void 0:o.code)&&(console.log("frictionlessHandler onChallenge threeDsFrictionlessType",(new Date).toLocaleTimeString()),f("threeDsFrictionless"),w?u=w:(u=document.createElement("div"),u.setAttribute("id","threeDsChallenge"),u.setAttribute("style","\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 0;\n z-index: 1500;\n overflow: hidden;\n background: rgba(0, 0, 0, 0.75);\n "),document.body.appendChild(u)),s("threeDsChallenge",new c(m,o,{origin:window.location.origin,style:{popupWidth:undefined,popupHeight:undefined},useDefaultStyle:null===w,customizeChallengeWindowSize:p,intent:v})),window.addEventListener("message",A),null===(i=a("threeDsChallenge"))||void 0===i||i.mount(u)))},A=e=>{var t,n;const i="data"in e?e.data:e.detail,o=["hpp","api"].includes(h),l=o?null:a(h),r=(null==l?void 0:l.gatewayUrl)||window.location.origin;("data"in e&&e.origin===r&&e.isTrusted||o)&&"threeDsChallenge"===(null==i?void 0:i.type)&&("onReady"===(null==i?void 0:i.code)&&(console.log("challengeHandler onReady",(new Date).toLocaleTimeString()),setTimeout((()=>{u.style.height="100%"}),2e3)),"onChallengeSuccess"===(null==i?void 0:i.code)&&(u.style.height="0"),"onSuccess"===(null==i?void 0:i.code)&&(console.log("challengeHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=g.resolver)||void 0===t||t.call(g,i),y(),f("threeDsChallenge")),["onError","onChallengeError"].includes(null==i?void 0:i.code)&&(console.log(`challengeHandler ${null==i?void 0:i.code}`,(new Date).toLocaleTimeString()),null===(n=g.reject)||void 0===n||n.call(g,i),y(),f("threeDsChallenge")))},b={"01":["250px","400px"],"02":["390px","400px"],"03":["500px","600px"],"04":["600px","400px"],"05":["100%","100%"]};let E="";const C=({intent_id:e="",env:t="prod"})=>{if(!E.includes(e)){const n="prod"===t?"9ozphlqx":"45ssiuz3",i=document.createElement("script");E=`${e}${Date.now()}`,i.src=`https://h.online-metrix.net/fp/tags.js?org_id=${n}&session_id=${E}`,document.body.appendChild(i)}return E},D=t=>`https://${e[t]||"checkout.airwallex.com"}`,S=`/assets/bundle.${[0,2,40].join(".")}.min.js`,$=e=>{const t=document.createElement("script");t.src=`${e}${S}`;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(t),t};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,t)=>window.Airwallex?window.Airwallex.createElement(e,t):(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,t)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,t);{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=n=>{const{env:i,checkoutOrigin:o}=n;return`${t[i||"prod"]}/api/v1/checkout/elements/3ds?origin=https://${e[i||"prod"]}&checkoutOrigin=${o||window.location.origin}`},exports.getBrowserInfo=e=>{const{navigator:t,screen:n}=window||{},{language:i}=t||{},{colorDepth:o,height:l,width:r}=n||{},{intent_id:a,env:s}=e||{};let d;return e&&(d=C({intent_id:a,env:s})),{device_id:d,screen_height:l,screen_width:r,screen_color_depth:o,language:i,timezone:(new Date).getTimezoneOffset(),browser:{java_enabled:window.navigator.javaEnabled(),javascript_enabled:!0,user_agent:t.userAgent}}},exports.getDeviceFingerprint=C,exports.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),exports.getGatewayUrl=D,exports.getPaymentIntent=async(e,t)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,t);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},exports.handle3ds=t=>{const{cardBin:n,next_action:i,authFormContainer:o,intent:l,challengeWindowSize:r,env:c}=t;return(({intent:e,gatewayUrl:t,cardBin:n,next_action:i,authFormContainer:o,componentType:l,challengeWindowSize:r})=>{var c;g.awaiting&&console.warn("Should wait previous 3ds flow finished before execute new one!"),console.log("threeDsHandler onChallenge type",(new Date).toLocaleTimeString()),w=document.getElementById(o||""),h=l,p=r,m=t,v=e,f("threeDsFrictionless"),s("threeDsFrictionless",new d(m,{code:"",type:"threeDsFrictionless",cardBin:n,next_action:i},{intent:v,origin:window.location.origin}));const u=document.createElement("div");return u.setAttribute("id","threeDsFrictionless"),document.body.appendChild(u),window.addEventListener("message",x),null===(c=a("threeDsFrictionless"))||void 0===c||c.mount(u),new Promise(((e,t)=>{g.resolver=e,g.reject=t,g.awaiting=!0}))})({gatewayUrl:`https://${e[c]}`,cardBin:n,intent:l,next_action:i,authFormContainer:o,componentType:"api",challengeWindowSize:r})},exports.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},exports.loadAirwallex=e=>Promise.resolve().then((()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const t=document.querySelector(`script[src="${S}"], script[src="${S}/"]`)||$(D((null==e?void 0:e.env)||"prod"));return new Promise(((n,i)=>{t.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),n(window.Airwallex)):i(new Error("Failed to load Airwallex on load event"))})),t.addEventListener("error",(()=>{i(new Error("Failed to load Airwallex scripts"))}))}))})),exports.loadAirwallexJs=$,exports.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")};
/* Airwallex Checkout Component Version [0.2.45] */
"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"},t={prod:"https://pci-api.airwallex.com",demo:"https://pci-api-demo.airwallex.com",staging:"https://pci-api-staging.airwallex.com",qa:"https://pci-api-qa.airwallex.com",preview:"https://pci-api-preview.airwallex.com",dev:"http://localhost:8080"};class n{constructor(e,t){var n,i;this.domElement=null,this.gatewayUrl=e,this.options=t,this.iframe=window.document.createElement("iframe"),this.iframe.setAttribute("frameborder","0"),this.iframe.setAttribute("allowtransparency","true"),this.iframe.setAttribute("importance","high"),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("allowpaymentrequest","true"),null===(n=this.iframe)||void 0===n||n.setAttribute("style","\n height: 0;\n width: 100%;\n display: block;\n "),i=e=>{var t,n,i;if(e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)){const t=new CustomEvent(null===(n=e.data)||void 0===n?void 0:n.code,{detail:{type:null===(i=e.data)||void 0===i?void 0:i.type},bubbles:!0,composed:!0});window.document.dispatchEvent(t)}},window.addEventListener("message",(e=>{window.ReactNativeWebView&&window.ReactNativeWebView.postMessage(JSON.stringify(e.data)),i(e)}))}addResizeListener(e){window.addEventListener("message",(t=>{var n,i,o,l;if(t.origin===this.gatewayUrl&&t.isTrusted&&"onResize"===(null===(n=t.data)||void 0===n?void 0:n.code)&&e===(null===(i=t.data)||void 0===i?void 0:i.type)){const e=null===(o=this.iframe)||void 0===o?void 0:o.style;e&&(e.height=`${null===(l=t.data)||void 0===l?void 0:l.height}px`)}}))}mount(e){if("string"!=typeof e)return(null==e?void 0:e.hasChildNodes())&&(e.innerHTML=""),this.iframe&&e.appendChild(this.iframe),this.domElement=e,e;{const t=window.document.getElementById(e);return(null==t?void 0:t.hasChildNodes())&&(t.innerHTML=""),this.iframe&&(null==t||t.appendChild(this.iframe)),t&&(this.domElement=t),t}}blur(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"blur"},this.gatewayUrl)}clear(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"clear"},this.gatewayUrl)}destroy(){var e;this.clear(),null===(e=this.iframe)||void 0===e||e.remove(),this.iframe=null}focus(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"focus"},this.gatewayUrl)}unmount(){var e;this.clear(),this.iframe&&(null===(e=this.domElement)||void 0===e||e.removeChild(this.iframe))}update(e){var t,n;this.options={...this.options,...e},null===(n=null===(t=this.iframe)||void 0===t?void 0:t.contentWindow)||void 0===n||n.postMessage({code:"update",options:e},this.gatewayUrl)}async confirm(){throw new Error("Confirm is not supported in ElementBase")}success(e){throw new Error(`Call success with ${e.id} is not supported in ElementBase`)}fail(e){throw new Error(`Call fail with ${e.code}: ${e.message} is not supported in ElementBase`)}}const i=["cardNumber","expiry","cvc","paymentRequestButton","card","wechat","qrcode","redirect","dropIn","fullFeaturedCard","threeDsFrictionless","threeDsChallenge"],o={},l={cardNumber:null,expiry:null,cvc:null,threeDsFrictionless:null,threeDsChallenge:null,paymentRequestButton:null,card:null,wechat:null,qrcode:null,redirect:null,dropIn:null,fullFeaturedCard:null},r=e=>{var t;return i.includes(e)?(null===(t=l[e])||void 0===t||t.destroy(),l[e]=null,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1)},a=e=>i.includes(e)?l[e]:(console.warn(`getElement with type: ${e} not support!`),null),s=(e,t)=>i.includes(e)?(l[e]=t,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1);class d extends n{constructor(e,t,n){var i,l,r,a;super(e,n),this.confirmResponse=t,null===(i=this.iframe)||void 0===i||i.setAttribute("src",`${e}/#/elements/3ds-frictionless?options=${encodeURIComponent(JSON.stringify(this.options))}&lang=${null===(l=o)||void 0===l?void 0:l.locale}`),null===(r=this.iframe)||void 0===r||r.setAttribute("name","Airwallex 3DS frictionless iframe"),null===(a=this.iframe)||void 0===a||a.setAttribute("title","Airwallex 3DS frictionless iframe"),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsFrictionless"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}class c extends n{constructor(e,t,n){var i,o,l,r,a,s,d,c,u;super(e,n),this.confirmResponse=t;const w=(null==n?void 0:n.customizeChallengeWindowSize)&&E[null==n?void 0:n.customizeChallengeWindowSize]?E[null==n?void 0:n.customizeChallengeWindowSize]:E["05"],h=(null===(i=null==n?void 0:n.style)||void 0===i?void 0:i.popupWidth)?`${null===(o=null==n?void 0:n.style)||void 0===o?void 0:o.popupWidth}px`:w[0],p=(null===(l=null==n?void 0:n.style)||void 0===l?void 0:l.popupHeight)?`${null===(r=null==n?void 0:n.style)||void 0===r?void 0:r.popupHeight}px`:w[1];null===(a=this.iframe)||void 0===a||a.setAttribute("src",`${e}/#/elements/3ds-challenge?options=${encodeURIComponent(JSON.stringify(this.options))}`),null===(s=this.iframe)||void 0===s||s.setAttribute("name","Airwallex 3DS challenge iframe"),null===(d=this.iframe)||void 0===d||d.setAttribute("title","Airwallex 3DS challenge iframe"),null===(c=this.iframe)||void 0===c||c.setAttribute("scrolling","yes"),null===(u=this.iframe)||void 0===u||u.setAttribute("style",`\n background: #fff;\n width: ${h};\n height: ${p};\n position: ${(null==n?void 0:n.useDefaultStyle)?"absolute":"relative"};\n top: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n left: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n transform: ${(null==n?void 0:n.useDefaultStyle)?"translate(-50%, -50%)":"none"};\n border-radius: ${(null==n?void 0:n.useDefaultStyle)?"4px":"0"};\n `),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsChallenge"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}let u,w,h,p,m,v;const g={resolver:null,reject:null,awaiting:!1},f=e=>{var t;null===(t=document.querySelector(`#${e}`))||void 0===t||t.remove(),r("threeDsFrictionless"===e?"threeDsFrictionless":"threeDsChallenge")},y=()=>{g.awaiting=!1,g.resolver=null,g.reject=null},x=e=>{var t;f("threeDsFrictionless"),w?u=w:(u=document.createElement("div"),u.setAttribute("id","threeDsChallenge"),u.setAttribute("style","\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 0;\n z-index: 1500;\n overflow: hidden;\n background: rgba(0, 0, 0, 0.75);\n "),document.body.appendChild(u)),s("threeDsChallenge",new c(m,e,{origin:window.location.origin,style:{popupWidth:undefined,popupHeight:undefined},useDefaultStyle:null===w,customizeChallengeWindowSize:p,intent:v})),window.addEventListener("message",b),null===(t=a("threeDsChallenge"))||void 0===t||t.mount(u)},A=e=>{var t,n;const i="data"in e?e.data:e.detail,o=["hpp","api"].includes(h),l=o?null:a(h),r=(null==l?void 0:l.gatewayUrl)||window.location.origin;("data"in e&&e.origin===r&&e.isTrusted||o)&&"threeDsFrictionless"===(null==i?void 0:i.type)&&(f("threeDsChallenge"),"onSuccess"===(null==i?void 0:i.code)&&(console.log("frictionlessHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=g.resolver)||void 0===t||t.call(g,i),y(),f("threeDsFrictionless")),["onError","onChallengeError"].includes(null==i?void 0:i.code)&&(console.log(`frictionlessHandler ${null==i?void 0:i.code}`,(new Date).toLocaleTimeString()),null===(n=g.reject)||void 0===n||n.call(g,i),y(),f("threeDsFrictionless")),"onChallenge"===(null==i?void 0:i.code)&&(console.log("frictionlessHandler onChallenge threeDsFrictionlessType",(new Date).toLocaleTimeString()),x(i)))},b=e=>{var t,n;const i="data"in e?e.data:e.detail,o=["hpp","api"].includes(h),l=o?null:a(h),r=(null==l?void 0:l.gatewayUrl)||window.location.origin;("data"in e&&e.origin===r&&e.isTrusted||o)&&"threeDsChallenge"===(null==i?void 0:i.type)&&("onReady"===(null==i?void 0:i.code)&&(console.log("challengeHandler onReady",(new Date).toLocaleTimeString()),setTimeout((()=>{u.style.height="100%"}),2e3)),"onChallengeSuccess"===(null==i?void 0:i.code)&&(u.style.height="0"),"onSuccess"===(null==i?void 0:i.code)&&(console.log("challengeHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=g.resolver)||void 0===t||t.call(g,i),y(),f("threeDsChallenge")),["onError","onChallengeError"].includes(null==i?void 0:i.code)&&(console.log(`challengeHandler ${null==i?void 0:i.code}`,(new Date).toLocaleTimeString()),null===(n=g.reject)||void 0===n||n.call(g,i),y(),f("threeDsChallenge")))},E={"01":["250px","400px"],"02":["390px","400px"],"03":["500px","600px"],"04":["600px","400px"],"05":["100%","100%"]};let C="";const D=({intent_id:e="",env:t="prod"})=>{if(!C.includes(e)){const n="prod"===t?"9ozphlqx":"45ssiuz3",i=document.createElement("script");C=`${e}${Date.now()}`,i.src=`https://h.online-metrix.net/fp/tags.js?org_id=${n}&session_id=${C}`,document.body.appendChild(i)}return C},S=t=>`https://${e[t]||"checkout.airwallex.com"}`,$=`/assets/bundle.${[0,2,45].join(".")}.min.js`,P=e=>{const t=document.createElement("script");t.src=`${e}${$}`;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(t),t};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,t)=>window.Airwallex?window.Airwallex.createElement(e,t):(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,t)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,t);{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=n=>{const{env:i,checkoutOrigin:o}=n;return`${t[i||"prod"]}/api/v1/checkout/elements/3ds?origin=https://${e[i||"prod"]}&checkoutOrigin=${o||window.location.origin}`},exports.getBrowserInfo=e=>{const{navigator:t,screen:n}=window||{},{language:i}=t||{},{colorDepth:o,height:l,width:r}=n||{},{intent_id:a,env:s}=e||{};let d;return e&&(d=D({intent_id:a,env:s})),{device_id:d,screen_height:l,screen_width:r,screen_color_depth:o,language:i,timezone:(new Date).getTimezoneOffset(),browser:{java_enabled:window.navigator.javaEnabled(),javascript_enabled:!0,user_agent:t.userAgent}}},exports.getDeviceFingerprint=D,exports.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),exports.getGatewayUrl=S,exports.getPaymentIntent=async(e,t)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,t);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},exports.handle3ds=t=>{const{cardBin:n,next_action:i,authFormContainer:o,intent:l,challengeWindowSize:r,env:c}=t;return(({intent:e,gatewayUrl:t,cardBin:n,next_action:i,authFormContainer:o,componentType:l,challengeWindowSize:r})=>{var c;if(g.awaiting&&console.warn("Should wait previous 3ds flow finished before execute new one!"),console.log("threeDsHandler onChallenge type",(new Date).toLocaleTimeString()),w=document.getElementById(o||""),h=l,p=r,m=t,v=e,f("threeDsFrictionless"),f("threeDsChallenge"),"WAITING_USER_INFO_INPUT"===(null==i?void 0:i.stage))x({type:"threeDsFrictionless",next_action:i});else{s("threeDsFrictionless",new d(m,{code:"",type:"threeDsFrictionless",cardBin:n,next_action:i},{intent:v,origin:window.location.origin}));const e=document.createElement("div");e.setAttribute("id","threeDsFrictionless"),document.body.appendChild(e),window.addEventListener("message",A),null===(c=a("threeDsFrictionless"))||void 0===c||c.mount(e)}return new Promise(((e,t)=>{g.resolver=e,g.reject=t,g.awaiting=!0}))})({gatewayUrl:`https://${e[c]}`,cardBin:n,intent:l,next_action:i,authFormContainer:o,componentType:"api",challengeWindowSize:r})},exports.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},exports.loadAirwallex=e=>Promise.resolve().then((()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const t=document.querySelector(`script[src="${$}"], script[src="${$}/"]`)||P(S((null==e?void 0:e.env)||"prod"));return new Promise(((n,i)=>{t.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),n(window.Airwallex)):i(new Error("Failed to load Airwallex on load event"))})),t.addEventListener("error",(()=>{i(new Error("Failed to load Airwallex scripts"))}))}))})),exports.loadAirwallexJs=P,exports.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")};
/* Airwallex @Charlie.Lang */
//# sourceMappingURL=airwallex.cjs.js.map

@@ -1,4 +0,4 @@

/* Airwallex Checkout Component Version [0.2.40] */
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"},t={prod:"https://pci-api.airwallex.com",demo:"https://pci-api-demo.airwallex.com",staging:"https://pci-api-staging.airwallex.com",qa:"https://pci-api-qa.airwallex.com",preview:"https://pci-api-preview.airwallex.com",dev:"http://localhost:8080"};class n{constructor(e,t){var n,i;this.domElement=null,this.gatewayUrl=e,this.options=t,this.iframe=window.document.createElement("iframe"),this.iframe.setAttribute("frameborder","0"),this.iframe.setAttribute("allowtransparency","true"),this.iframe.setAttribute("importance","high"),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("allowpaymentrequest","true"),null===(n=this.iframe)||void 0===n||n.setAttribute("style","\n height: 0;\n width: 100%;\n display: block;\n "),i=e=>{var t,n,i;if(e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)){const t=new CustomEvent(null===(n=e.data)||void 0===n?void 0:n.code,{detail:{type:null===(i=e.data)||void 0===i?void 0:i.type},bubbles:!0,composed:!0});window.document.dispatchEvent(t)}},window.addEventListener("message",(e=>{window.ReactNativeWebView&&window.ReactNativeWebView.postMessage(JSON.stringify(e.data)),i(e)}))}addResizeListener(e){window.addEventListener("message",(t=>{var n,i,o,l;if(t.origin===this.gatewayUrl&&t.isTrusted&&"onResize"===(null===(n=t.data)||void 0===n?void 0:n.code)&&e===(null===(i=t.data)||void 0===i?void 0:i.type)){const e=null===(o=this.iframe)||void 0===o?void 0:o.style;e&&(e.height=`${null===(l=t.data)||void 0===l?void 0:l.height}px`)}}))}mount(e){if("string"!=typeof e)return(null==e?void 0:e.hasChildNodes())&&(e.innerHTML=""),this.iframe&&e.appendChild(this.iframe),this.domElement=e,e;{const t=window.document.getElementById(e);return(null==t?void 0:t.hasChildNodes())&&(t.innerHTML=""),this.iframe&&(null==t||t.appendChild(this.iframe)),t&&(this.domElement=t),t}}blur(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"blur"},this.gatewayUrl)}clear(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"clear"},this.gatewayUrl)}destroy(){var e;this.clear(),null===(e=this.iframe)||void 0===e||e.remove(),this.iframe=null}focus(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"focus"},this.gatewayUrl)}unmount(){var e;this.clear(),this.iframe&&(null===(e=this.domElement)||void 0===e||e.removeChild(this.iframe))}update(e){var t,n;this.options={...this.options,...e},null===(n=null===(t=this.iframe)||void 0===t?void 0:t.contentWindow)||void 0===n||n.postMessage({code:"update",options:e},this.gatewayUrl)}async confirm(){throw new Error("Confirm is not supported in ElementBase")}success(e){throw new Error(`Call success with ${e.id} is not supported in ElementBase`)}fail(e){throw new Error(`Call fail with ${e.code}: ${e.message} is not supported in ElementBase`)}}const i=["cardNumber","expiry","cvc","paymentRequestButton","card","wechat","qrcode","redirect","dropIn","fullFeaturedCard","threeDsFrictionless","threeDsChallenge"],o={},l={cardNumber:null,expiry:null,cvc:null,threeDsFrictionless:null,threeDsChallenge:null,paymentRequestButton:null,card:null,wechat:null,qrcode:null,redirect:null,dropIn:null,fullFeaturedCard:null},r=e=>{var t;return i.includes(e)?(null===(t=l[e])||void 0===t||t.destroy(),l[e]=null,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1)},a=e=>i.includes(e)?l[e]:(console.warn(`getElement with type: ${e} not support!`),null),s=(e,t)=>i.includes(e)?(l[e]=t,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1);class d extends n{constructor(e,t,n){var i,l,r,a;super(e,n),this.confirmResponse=t,null===(i=this.iframe)||void 0===i||i.setAttribute("src",`${e}/#/elements/3ds-frictionless?options=${encodeURIComponent(JSON.stringify(this.options))}&lang=${null===(l=o)||void 0===l?void 0:l.locale}`),null===(r=this.iframe)||void 0===r||r.setAttribute("name","Airwallex 3DS frictionless iframe"),null===(a=this.iframe)||void 0===a||a.setAttribute("title","Airwallex 3DS frictionless iframe"),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsFrictionless"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}class c extends n{constructor(e,t,n){var i,o,l,r,a,s,d,c,u;super(e,n),this.confirmResponse=t;const w=(null==n?void 0:n.customizeChallengeWindowSize)&&b[null==n?void 0:n.customizeChallengeWindowSize]?b[null==n?void 0:n.customizeChallengeWindowSize]:b["05"],h=(null===(i=null==n?void 0:n.style)||void 0===i?void 0:i.popupWidth)?`${null===(o=null==n?void 0:n.style)||void 0===o?void 0:o.popupWidth}px`:w[0],m=(null===(l=null==n?void 0:n.style)||void 0===l?void 0:l.popupHeight)?`${null===(r=null==n?void 0:n.style)||void 0===r?void 0:r.popupHeight}px`:w[1];null===(a=this.iframe)||void 0===a||a.setAttribute("src",`${e}/#/elements/3ds-challenge?options=${encodeURIComponent(JSON.stringify(this.options))}`),null===(s=this.iframe)||void 0===s||s.setAttribute("name","Airwallex 3DS challenge iframe"),null===(d=this.iframe)||void 0===d||d.setAttribute("title","Airwallex 3DS challenge iframe"),null===(c=this.iframe)||void 0===c||c.setAttribute("scrolling","yes"),null===(u=this.iframe)||void 0===u||u.setAttribute("style",`\n background: #fff;\n width: ${h};\n height: ${m};\n position: ${(null==n?void 0:n.useDefaultStyle)?"absolute":"relative"};\n top: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n left: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n transform: ${(null==n?void 0:n.useDefaultStyle)?"translate(-50%, -50%)":"none"};\n border-radius: ${(null==n?void 0:n.useDefaultStyle)?"4px":"0"};\n `),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsChallenge"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}let u,w,h,m,p,v;const g={resolver:null,reject:null,awaiting:!1},f=e=>{var t;null===(t=document.querySelector(`#${e}`))||void 0===t||t.remove(),r("threeDsFrictionless"===e?"threeDsFrictionless":"threeDsChallenge")},y=()=>{g.awaiting=!1,g.resolver=null,g.reject=null},x=e=>{var t,n,i;const o="data"in e?e.data:e.detail,l=["hpp","api"].includes(h),r=l?null:a(h),d=(null==r?void 0:r.gatewayUrl)||window.location.origin;("data"in e&&e.origin===d&&e.isTrusted||l)&&"threeDsFrictionless"===(null==o?void 0:o.type)&&(f("threeDsChallenge"),"onSuccess"===(null==o?void 0:o.code)&&(console.log("frictionlessHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=g.resolver)||void 0===t||t.call(g,o),y(),f("threeDsFrictionless")),["onError","onChallengeError"].includes(null==o?void 0:o.code)&&(console.log(`frictionlessHandler ${null==o?void 0:o.code}`,(new Date).toLocaleTimeString()),null===(n=g.reject)||void 0===n||n.call(g,o),y(),f("threeDsFrictionless")),"onChallenge"===(null==o?void 0:o.code)&&(console.log("frictionlessHandler onChallenge threeDsFrictionlessType",(new Date).toLocaleTimeString()),f("threeDsFrictionless"),w?u=w:(u=document.createElement("div"),u.setAttribute("id","threeDsChallenge"),u.setAttribute("style","\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 0;\n z-index: 1500;\n overflow: hidden;\n background: rgba(0, 0, 0, 0.75);\n "),document.body.appendChild(u)),s("threeDsChallenge",new c(p,o,{origin:window.location.origin,style:{popupWidth:undefined,popupHeight:undefined},useDefaultStyle:null===w,customizeChallengeWindowSize:m,intent:v})),window.addEventListener("message",A),null===(i=a("threeDsChallenge"))||void 0===i||i.mount(u)))},A=e=>{var t,n;const i="data"in e?e.data:e.detail,o=["hpp","api"].includes(h),l=o?null:a(h),r=(null==l?void 0:l.gatewayUrl)||window.location.origin;("data"in e&&e.origin===r&&e.isTrusted||o)&&"threeDsChallenge"===(null==i?void 0:i.type)&&("onReady"===(null==i?void 0:i.code)&&(console.log("challengeHandler onReady",(new Date).toLocaleTimeString()),setTimeout((()=>{u.style.height="100%"}),2e3)),"onChallengeSuccess"===(null==i?void 0:i.code)&&(u.style.height="0"),"onSuccess"===(null==i?void 0:i.code)&&(console.log("challengeHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=g.resolver)||void 0===t||t.call(g,i),y(),f("threeDsChallenge")),["onError","onChallengeError"].includes(null==i?void 0:i.code)&&(console.log(`challengeHandler ${null==i?void 0:i.code}`,(new Date).toLocaleTimeString()),null===(n=g.reject)||void 0===n||n.call(g,i),y(),f("threeDsChallenge")))},b={"01":["250px","400px"],"02":["390px","400px"],"03":["500px","600px"],"04":["600px","400px"],"05":["100%","100%"]},E=e=>{const{navigator:t,screen:n}=window||{},{language:i}=t||{},{colorDepth:o,height:l,width:r}=n||{},{intent_id:a,env:s}=e||{};let d;return e&&(d=D({intent_id:a,env:s})),{device_id:d,screen_height:l,screen_width:r,screen_color_depth:o,language:i,timezone:(new Date).getTimezoneOffset(),browser:{java_enabled:window.navigator.javaEnabled(),javascript_enabled:!0,user_agent:t.userAgent}}};let C="";const D=({intent_id:e="",env:t="prod"})=>{if(!C.includes(e)){const n="prod"===t?"9ozphlqx":"45ssiuz3",i=document.createElement("script");C=`${e}${Date.now()}`,i.src=`https://h.online-metrix.net/fp/tags.js?org_id=${n}&session_id=${C}`,document.body.appendChild(i)}return C},$=n=>{const{env:i,checkoutOrigin:o}=n;return`${t[i||"prod"]}/api/v1/checkout/elements/3ds?origin=https://${e[i||"prod"]}&checkoutOrigin=${o||window.location.origin}`},S=t=>{const{cardBin:n,next_action:i,authFormContainer:o,intent:l,challengeWindowSize:r,env:c}=t;return(({intent:e,gatewayUrl:t,cardBin:n,next_action:i,authFormContainer:o,componentType:l,challengeWindowSize:r})=>{var c;g.awaiting&&console.warn("Should wait previous 3ds flow finished before execute new one!"),console.log("threeDsHandler onChallenge type",(new Date).toLocaleTimeString()),w=document.getElementById(o||""),h=l,m=r,p=t,v=e,f("threeDsFrictionless"),s("threeDsFrictionless",new d(p,{code:"",type:"threeDsFrictionless",cardBin:n,next_action:i},{intent:v,origin:window.location.origin}));const u=document.createElement("div");return u.setAttribute("id","threeDsFrictionless"),document.body.appendChild(u),window.addEventListener("message",x),null===(c=a("threeDsFrictionless"))||void 0===c||c.mount(u),new Promise(((e,t)=>{g.resolver=e,g.reject=t,g.awaiting=!0}))})({gatewayUrl:`https://${e[c]}`,cardBin:n,intent:l,next_action:i,authFormContainer:o,componentType:"api",challengeWindowSize:r})},P=t=>`https://${e[t]||"checkout.airwallex.com"}`,F=`/assets/bundle.${[0,2,40].join(".")}.min.js`,T=e=>{const t=document.createElement("script");t.src=`${e}${F}`;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(t),t},W=e=>Promise.resolve().then((()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const t=document.querySelector(`script[src="${F}"], script[src="${F}/"]`)||T(P((null==e?void 0:e.env)||"prod"));return new Promise(((n,i)=>{t.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),n(window.Airwallex)):i(new Error("Failed to load Airwallex on load event"))})),t.addEventListener("error",(()=>{i(new Error("Failed to load Airwallex scripts"))}))}))})),R=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},U=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},z=(e,t)=>window.Airwallex?window.Airwallex.createElement(e,t):(console.error("Please loadAirwallex() before createElement();"),null),L=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),_=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),k=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},q=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,t)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,t);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},H=async(e,t)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,t);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},I=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}};export{k as confirmPaymentIntent,q as confirmPaymentIntentWithSavedCard,z as createElement,I as createPaymentConsent,M as createPaymentMethod,L as destroyElement,$ as get3dsReturnUrl,E as getBrowserInfo,D as getDeviceFingerprint,_ as getElement,P as getGatewayUrl,H as getPaymentIntent,S as handle3ds,R as init,W as loadAirwallex,T as loadAirwallexJs,U as redirectToCheckout};
/* Airwallex Checkout Component Version [0.2.45] */
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"},t={prod:"https://pci-api.airwallex.com",demo:"https://pci-api-demo.airwallex.com",staging:"https://pci-api-staging.airwallex.com",qa:"https://pci-api-qa.airwallex.com",preview:"https://pci-api-preview.airwallex.com",dev:"http://localhost:8080"};class n{constructor(e,t){var n,i;this.domElement=null,this.gatewayUrl=e,this.options=t,this.iframe=window.document.createElement("iframe"),this.iframe.setAttribute("frameborder","0"),this.iframe.setAttribute("allowtransparency","true"),this.iframe.setAttribute("importance","high"),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("allowpaymentrequest","true"),null===(n=this.iframe)||void 0===n||n.setAttribute("style","\n height: 0;\n width: 100%;\n display: block;\n "),i=e=>{var t,n,i;if(e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)){const t=new CustomEvent(null===(n=e.data)||void 0===n?void 0:n.code,{detail:{type:null===(i=e.data)||void 0===i?void 0:i.type},bubbles:!0,composed:!0});window.document.dispatchEvent(t)}},window.addEventListener("message",(e=>{window.ReactNativeWebView&&window.ReactNativeWebView.postMessage(JSON.stringify(e.data)),i(e)}))}addResizeListener(e){window.addEventListener("message",(t=>{var n,i,o,l;if(t.origin===this.gatewayUrl&&t.isTrusted&&"onResize"===(null===(n=t.data)||void 0===n?void 0:n.code)&&e===(null===(i=t.data)||void 0===i?void 0:i.type)){const e=null===(o=this.iframe)||void 0===o?void 0:o.style;e&&(e.height=`${null===(l=t.data)||void 0===l?void 0:l.height}px`)}}))}mount(e){if("string"!=typeof e)return(null==e?void 0:e.hasChildNodes())&&(e.innerHTML=""),this.iframe&&e.appendChild(this.iframe),this.domElement=e,e;{const t=window.document.getElementById(e);return(null==t?void 0:t.hasChildNodes())&&(t.innerHTML=""),this.iframe&&(null==t||t.appendChild(this.iframe)),t&&(this.domElement=t),t}}blur(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"blur"},this.gatewayUrl)}clear(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"clear"},this.gatewayUrl)}destroy(){var e;this.clear(),null===(e=this.iframe)||void 0===e||e.remove(),this.iframe=null}focus(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"focus"},this.gatewayUrl)}unmount(){var e;this.clear(),this.iframe&&(null===(e=this.domElement)||void 0===e||e.removeChild(this.iframe))}update(e){var t,n;this.options={...this.options,...e},null===(n=null===(t=this.iframe)||void 0===t?void 0:t.contentWindow)||void 0===n||n.postMessage({code:"update",options:e},this.gatewayUrl)}async confirm(){throw new Error("Confirm is not supported in ElementBase")}success(e){throw new Error(`Call success with ${e.id} is not supported in ElementBase`)}fail(e){throw new Error(`Call fail with ${e.code}: ${e.message} is not supported in ElementBase`)}}const i=["cardNumber","expiry","cvc","paymentRequestButton","card","wechat","qrcode","redirect","dropIn","fullFeaturedCard","threeDsFrictionless","threeDsChallenge"],o={},l={cardNumber:null,expiry:null,cvc:null,threeDsFrictionless:null,threeDsChallenge:null,paymentRequestButton:null,card:null,wechat:null,qrcode:null,redirect:null,dropIn:null,fullFeaturedCard:null},r=e=>{var t;return i.includes(e)?(null===(t=l[e])||void 0===t||t.destroy(),l[e]=null,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1)},a=e=>i.includes(e)?l[e]:(console.warn(`getElement with type: ${e} not support!`),null),s=(e,t)=>i.includes(e)?(l[e]=t,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1);class d extends n{constructor(e,t,n){var i,l,r,a;super(e,n),this.confirmResponse=t,null===(i=this.iframe)||void 0===i||i.setAttribute("src",`${e}/#/elements/3ds-frictionless?options=${encodeURIComponent(JSON.stringify(this.options))}&lang=${null===(l=o)||void 0===l?void 0:l.locale}`),null===(r=this.iframe)||void 0===r||r.setAttribute("name","Airwallex 3DS frictionless iframe"),null===(a=this.iframe)||void 0===a||a.setAttribute("title","Airwallex 3DS frictionless iframe"),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsFrictionless"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}class c extends n{constructor(e,t,n){var i,o,l,r,a,s,d,c,u;super(e,n),this.confirmResponse=t;const w=(null==n?void 0:n.customizeChallengeWindowSize)&&E[null==n?void 0:n.customizeChallengeWindowSize]?E[null==n?void 0:n.customizeChallengeWindowSize]:E["05"],h=(null===(i=null==n?void 0:n.style)||void 0===i?void 0:i.popupWidth)?`${null===(o=null==n?void 0:n.style)||void 0===o?void 0:o.popupWidth}px`:w[0],m=(null===(l=null==n?void 0:n.style)||void 0===l?void 0:l.popupHeight)?`${null===(r=null==n?void 0:n.style)||void 0===r?void 0:r.popupHeight}px`:w[1];null===(a=this.iframe)||void 0===a||a.setAttribute("src",`${e}/#/elements/3ds-challenge?options=${encodeURIComponent(JSON.stringify(this.options))}`),null===(s=this.iframe)||void 0===s||s.setAttribute("name","Airwallex 3DS challenge iframe"),null===(d=this.iframe)||void 0===d||d.setAttribute("title","Airwallex 3DS challenge iframe"),null===(c=this.iframe)||void 0===c||c.setAttribute("scrolling","yes"),null===(u=this.iframe)||void 0===u||u.setAttribute("style",`\n background: #fff;\n width: ${h};\n height: ${m};\n position: ${(null==n?void 0:n.useDefaultStyle)?"absolute":"relative"};\n top: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n left: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n transform: ${(null==n?void 0:n.useDefaultStyle)?"translate(-50%, -50%)":"none"};\n border-radius: ${(null==n?void 0:n.useDefaultStyle)?"4px":"0"};\n `),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsChallenge"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}let u,w,h,m,v,p;const g={resolver:null,reject:null,awaiting:!1},f=e=>{var t;null===(t=document.querySelector(`#${e}`))||void 0===t||t.remove(),r("threeDsFrictionless"===e?"threeDsFrictionless":"threeDsChallenge")},y=()=>{g.awaiting=!1,g.resolver=null,g.reject=null},x=e=>{var t;f("threeDsFrictionless"),w?u=w:(u=document.createElement("div"),u.setAttribute("id","threeDsChallenge"),u.setAttribute("style","\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 0;\n z-index: 1500;\n overflow: hidden;\n background: rgba(0, 0, 0, 0.75);\n "),document.body.appendChild(u)),s("threeDsChallenge",new c(v,e,{origin:window.location.origin,style:{popupWidth:undefined,popupHeight:undefined},useDefaultStyle:null===w,customizeChallengeWindowSize:m,intent:p})),window.addEventListener("message",b),null===(t=a("threeDsChallenge"))||void 0===t||t.mount(u)},A=e=>{var t,n;const i="data"in e?e.data:e.detail,o=["hpp","api"].includes(h),l=o?null:a(h),r=(null==l?void 0:l.gatewayUrl)||window.location.origin;("data"in e&&e.origin===r&&e.isTrusted||o)&&"threeDsFrictionless"===(null==i?void 0:i.type)&&(f("threeDsChallenge"),"onSuccess"===(null==i?void 0:i.code)&&(console.log("frictionlessHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=g.resolver)||void 0===t||t.call(g,i),y(),f("threeDsFrictionless")),["onError","onChallengeError"].includes(null==i?void 0:i.code)&&(console.log(`frictionlessHandler ${null==i?void 0:i.code}`,(new Date).toLocaleTimeString()),null===(n=g.reject)||void 0===n||n.call(g,i),y(),f("threeDsFrictionless")),"onChallenge"===(null==i?void 0:i.code)&&(console.log("frictionlessHandler onChallenge threeDsFrictionlessType",(new Date).toLocaleTimeString()),x(i)))},b=e=>{var t,n;const i="data"in e?e.data:e.detail,o=["hpp","api"].includes(h),l=o?null:a(h),r=(null==l?void 0:l.gatewayUrl)||window.location.origin;("data"in e&&e.origin===r&&e.isTrusted||o)&&"threeDsChallenge"===(null==i?void 0:i.type)&&("onReady"===(null==i?void 0:i.code)&&(console.log("challengeHandler onReady",(new Date).toLocaleTimeString()),setTimeout((()=>{u.style.height="100%"}),2e3)),"onChallengeSuccess"===(null==i?void 0:i.code)&&(u.style.height="0"),"onSuccess"===(null==i?void 0:i.code)&&(console.log("challengeHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=g.resolver)||void 0===t||t.call(g,i),y(),f("threeDsChallenge")),["onError","onChallengeError"].includes(null==i?void 0:i.code)&&(console.log(`challengeHandler ${null==i?void 0:i.code}`,(new Date).toLocaleTimeString()),null===(n=g.reject)||void 0===n||n.call(g,i),y(),f("threeDsChallenge")))},E={"01":["250px","400px"],"02":["390px","400px"],"03":["500px","600px"],"04":["600px","400px"],"05":["100%","100%"]},D=e=>{const{navigator:t,screen:n}=window||{},{language:i}=t||{},{colorDepth:o,height:l,width:r}=n||{},{intent_id:a,env:s}=e||{};let d;return e&&(d=S({intent_id:a,env:s})),{device_id:d,screen_height:l,screen_width:r,screen_color_depth:o,language:i,timezone:(new Date).getTimezoneOffset(),browser:{java_enabled:window.navigator.javaEnabled(),javascript_enabled:!0,user_agent:t.userAgent}}};let C="";const S=({intent_id:e="",env:t="prod"})=>{if(!C.includes(e)){const n="prod"===t?"9ozphlqx":"45ssiuz3",i=document.createElement("script");C=`${e}${Date.now()}`,i.src=`https://h.online-metrix.net/fp/tags.js?org_id=${n}&session_id=${C}`,document.body.appendChild(i)}return C},$=n=>{const{env:i,checkoutOrigin:o}=n;return`${t[i||"prod"]}/api/v1/checkout/elements/3ds?origin=https://${e[i||"prod"]}&checkoutOrigin=${o||window.location.origin}`},F=t=>{const{cardBin:n,next_action:i,authFormContainer:o,intent:l,challengeWindowSize:r,env:c}=t;return(({intent:e,gatewayUrl:t,cardBin:n,next_action:i,authFormContainer:o,componentType:l,challengeWindowSize:r})=>{var c;if(g.awaiting&&console.warn("Should wait previous 3ds flow finished before execute new one!"),console.log("threeDsHandler onChallenge type",(new Date).toLocaleTimeString()),w=document.getElementById(o||""),h=l,m=r,v=t,p=e,f("threeDsFrictionless"),f("threeDsChallenge"),"WAITING_USER_INFO_INPUT"===(null==i?void 0:i.stage))x({type:"threeDsFrictionless",next_action:i});else{s("threeDsFrictionless",new d(v,{code:"",type:"threeDsFrictionless",cardBin:n,next_action:i},{intent:p,origin:window.location.origin}));const e=document.createElement("div");e.setAttribute("id","threeDsFrictionless"),document.body.appendChild(e),window.addEventListener("message",A),null===(c=a("threeDsFrictionless"))||void 0===c||c.mount(e)}return new Promise(((e,t)=>{g.resolver=e,g.reject=t,g.awaiting=!0}))})({gatewayUrl:`https://${e[c]}`,cardBin:n,intent:l,next_action:i,authFormContainer:o,componentType:"api",challengeWindowSize:r})},P=t=>`https://${e[t]||"checkout.airwallex.com"}`,T=`/assets/bundle.${[0,2,45].join(".")}.min.js`,W=e=>{const t=document.createElement("script");t.src=`${e}${T}`;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(t),t},U=e=>Promise.resolve().then((()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const t=document.querySelector(`script[src="${T}"], script[src="${T}/"]`)||W(P((null==e?void 0:e.env)||"prod"));return new Promise(((n,i)=>{t.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),n(window.Airwallex)):i(new Error("Failed to load Airwallex on load event"))})),t.addEventListener("error",(()=>{i(new Error("Failed to load Airwallex scripts"))}))}))})),_=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},R=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},z=(e,t)=>window.Airwallex?window.Airwallex.createElement(e,t):(console.error("Please loadAirwallex() before createElement();"),null),L=e=>window.Airwallex?window.Airwallex.destroyElement(e):(console.error("Please loadAirwallex() before destroyElement();"),!1),I=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),k=async e=>{if(window.Airwallex)return window.Airwallex.confirmPaymentIntent(e);{const e="Please loadAirwallex() before confirmPaymentIntent();";throw console.error(e),new Error(e)}},q=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,t)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,t);{const e="Please loadAirwallex() before createPaymentMethod();";throw console.error(e),new Error(e)}},H=async(e,t)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,t);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},N=async e=>{if(window.Airwallex)return window.Airwallex.createPaymentConsent(e);{const e="Please loadAirwallex() before createPaymentConsent();";throw console.error(e),new Error(e)}};export{k as confirmPaymentIntent,q as confirmPaymentIntentWithSavedCard,z as createElement,N as createPaymentConsent,M as createPaymentMethod,L as destroyElement,$ as get3dsReturnUrl,D as getBrowserInfo,S as getDeviceFingerprint,I as getElement,P as getGatewayUrl,H as getPaymentIntent,F as handle3ds,_ as init,U as loadAirwallex,W as loadAirwallexJs,R as redirectToCheckout};
/* Airwallex @Charlie.Lang */
//# sourceMappingURL=airwallex.es.js.map

@@ -1,4 +0,4 @@

/* Airwallex Checkout Component Version [0.2.40] */
var Airwallex=function(e){"use strict";const t={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={prod:"https://pci-api.airwallex.com",demo:"https://pci-api-demo.airwallex.com",staging:"https://pci-api-staging.airwallex.com",qa:"https://pci-api-qa.airwallex.com",preview:"https://pci-api-preview.airwallex.com",dev:"http://localhost:8080"};class i{constructor(e,t){var n,i;this.domElement=null,this.gatewayUrl=e,this.options=t,this.iframe=window.document.createElement("iframe"),this.iframe.setAttribute("frameborder","0"),this.iframe.setAttribute("allowtransparency","true"),this.iframe.setAttribute("importance","high"),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("allowpaymentrequest","true"),null===(n=this.iframe)||void 0===n||n.setAttribute("style","\n height: 0;\n width: 100%;\n display: block;\n "),i=e=>{var t,n,i;if(e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)){const t=new CustomEvent(null===(n=e.data)||void 0===n?void 0:n.code,{detail:{type:null===(i=e.data)||void 0===i?void 0:i.type},bubbles:!0,composed:!0});window.document.dispatchEvent(t)}},window.addEventListener("message",(e=>{window.ReactNativeWebView&&window.ReactNativeWebView.postMessage(JSON.stringify(e.data)),i(e)}))}addResizeListener(e){window.addEventListener("message",(t=>{var n,i,o,l;if(t.origin===this.gatewayUrl&&t.isTrusted&&"onResize"===(null===(n=t.data)||void 0===n?void 0:n.code)&&e===(null===(i=t.data)||void 0===i?void 0:i.type)){const e=null===(o=this.iframe)||void 0===o?void 0:o.style;e&&(e.height=`${null===(l=t.data)||void 0===l?void 0:l.height}px`)}}))}mount(e){if("string"!=typeof e)return(null==e?void 0:e.hasChildNodes())&&(e.innerHTML=""),this.iframe&&e.appendChild(this.iframe),this.domElement=e,e;{const t=window.document.getElementById(e);return(null==t?void 0:t.hasChildNodes())&&(t.innerHTML=""),this.iframe&&(null==t||t.appendChild(this.iframe)),t&&(this.domElement=t),t}}blur(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"blur"},this.gatewayUrl)}clear(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"clear"},this.gatewayUrl)}destroy(){var e;this.clear(),null===(e=this.iframe)||void 0===e||e.remove(),this.iframe=null}focus(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"focus"},this.gatewayUrl)}unmount(){var e;this.clear(),this.iframe&&(null===(e=this.domElement)||void 0===e||e.removeChild(this.iframe))}update(e){var t,n;this.options={...this.options,...e},null===(n=null===(t=this.iframe)||void 0===t?void 0:t.contentWindow)||void 0===n||n.postMessage({code:"update",options:e},this.gatewayUrl)}async confirm(){throw new Error("Confirm is not supported in ElementBase")}success(e){throw new Error(`Call success with ${e.id} is not supported in ElementBase`)}fail(e){throw new Error(`Call fail with ${e.code}: ${e.message} is not supported in ElementBase`)}}const o=["cardNumber","expiry","cvc","paymentRequestButton","card","wechat","qrcode","redirect","dropIn","fullFeaturedCard","threeDsFrictionless","threeDsChallenge"],l={},r={cardNumber:null,expiry:null,cvc:null,threeDsFrictionless:null,threeDsChallenge:null,paymentRequestButton:null,card:null,wechat:null,qrcode:null,redirect:null,dropIn:null,fullFeaturedCard:null},a=e=>{var t;return o.includes(e)?(null===(t=r[e])||void 0===t||t.destroy(),r[e]=null,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1)},s=e=>o.includes(e)?r[e]:(console.warn(`getElement with type: ${e} not support!`),null),d=(e,t)=>o.includes(e)?(r[e]=t,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1);class c extends i{constructor(e,t,n){var i,o,r,a;super(e,n),this.confirmResponse=t,null===(i=this.iframe)||void 0===i||i.setAttribute("src",`${e}/#/elements/3ds-frictionless?options=${encodeURIComponent(JSON.stringify(this.options))}&lang=${null===(o=l)||void 0===o?void 0:o.locale}`),null===(r=this.iframe)||void 0===r||r.setAttribute("name","Airwallex 3DS frictionless iframe"),null===(a=this.iframe)||void 0===a||a.setAttribute("title","Airwallex 3DS frictionless iframe"),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsFrictionless"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}class u extends i{constructor(e,t,n){var i,o,l,r,a,s,d,c,u;super(e,n),this.confirmResponse=t;const w=(null==n?void 0:n.customizeChallengeWindowSize)&&S[null==n?void 0:n.customizeChallengeWindowSize]?S[null==n?void 0:n.customizeChallengeWindowSize]:S["05"],h=(null===(i=null==n?void 0:n.style)||void 0===i?void 0:i.popupWidth)?`${null===(o=null==n?void 0:n.style)||void 0===o?void 0:o.popupWidth}px`:w[0],m=(null===(l=null==n?void 0:n.style)||void 0===l?void 0:l.popupHeight)?`${null===(r=null==n?void 0:n.style)||void 0===r?void 0:r.popupHeight}px`:w[1];null===(a=this.iframe)||void 0===a||a.setAttribute("src",`${e}/#/elements/3ds-challenge?options=${encodeURIComponent(JSON.stringify(this.options))}`),null===(s=this.iframe)||void 0===s||s.setAttribute("name","Airwallex 3DS challenge iframe"),null===(d=this.iframe)||void 0===d||d.setAttribute("title","Airwallex 3DS challenge iframe"),null===(c=this.iframe)||void 0===c||c.setAttribute("scrolling","yes"),null===(u=this.iframe)||void 0===u||u.setAttribute("style",`\n background: #fff;\n width: ${h};\n height: ${m};\n position: ${(null==n?void 0:n.useDefaultStyle)?"absolute":"relative"};\n top: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n left: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n transform: ${(null==n?void 0:n.useDefaultStyle)?"translate(-50%, -50%)":"none"};\n border-radius: ${(null==n?void 0:n.useDefaultStyle)?"4px":"0"};\n `),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsChallenge"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}const w="threeDsFrictionless",h="threeDsChallenge";let m,v,p,g,f,y;const x={resolver:null,reject:null,awaiting:!1},A=e=>{var t;null===(t=document.querySelector(`#${e}`))||void 0===t||t.remove(),a(e===w?w:h)},b=()=>{x.awaiting=!1,x.resolver=null,x.reject=null},E=e=>{var t,n,i;const o="data"in e?e.data:e.detail,l=["hpp","api"].includes(p),r=l?null:s(p),a=(null==r?void 0:r.gatewayUrl)||window.location.origin;("data"in e&&e.origin===a&&e.isTrusted||l)&&(null==o?void 0:o.type)===w&&(A(h),"onSuccess"===(null==o?void 0:o.code)&&(console.log("frictionlessHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=x.resolver)||void 0===t||t.call(x,o),b(),A(w)),["onError","onChallengeError"].includes(null==o?void 0:o.code)&&(console.log(`frictionlessHandler ${null==o?void 0:o.code}`,(new Date).toLocaleTimeString()),null===(n=x.reject)||void 0===n||n.call(x,o),b(),A(w)),"onChallenge"===(null==o?void 0:o.code)&&(console.log("frictionlessHandler onChallenge threeDsFrictionlessType",(new Date).toLocaleTimeString()),A(w),v?m=v:(m=document.createElement("div"),m.setAttribute("id",h),m.setAttribute("style","\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 0;\n z-index: 1500;\n overflow: hidden;\n background: rgba(0, 0, 0, 0.75);\n "),document.body.appendChild(m)),d(h,new u(f,o,{origin:window.location.origin,style:{popupWidth:undefined,popupHeight:undefined},useDefaultStyle:null===v,customizeChallengeWindowSize:g,intent:y})),window.addEventListener("message",C),null===(i=s(h))||void 0===i||i.mount(m)))},C=e=>{var t,n;const i="data"in e?e.data:e.detail,o=["hpp","api"].includes(p),l=o?null:s(p),r=(null==l?void 0:l.gatewayUrl)||window.location.origin;("data"in e&&e.origin===r&&e.isTrusted||o)&&(null==i?void 0:i.type)===h&&("onReady"===(null==i?void 0:i.code)&&(console.log("challengeHandler onReady",(new Date).toLocaleTimeString()),setTimeout((()=>{m.style.height="100%"}),2e3)),"onChallengeSuccess"===(null==i?void 0:i.code)&&(m.style.height="0"),"onSuccess"===(null==i?void 0:i.code)&&(console.log("challengeHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=x.resolver)||void 0===t||t.call(x,i),b(),A(h)),["onError","onChallengeError"].includes(null==i?void 0:i.code)&&(console.log(`challengeHandler ${null==i?void 0:i.code}`,(new Date).toLocaleTimeString()),null===(n=x.reject)||void 0===n||n.call(x,i),b(),A(h)))},S={"01":["250px","400px"],"02":["390px","400px"],"03":["500px","600px"],"04":["600px","400px"],"05":["100%","100%"]};let $="";const D=({intent_id:e="",env:t="prod"})=>{if(!$.includes(e)){const n="prod"===t?"9ozphlqx":"45ssiuz3",i=document.createElement("script");$=`${e}${Date.now()}`,i.src=`https://h.online-metrix.net/fp/tags.js?org_id=${n}&session_id=${$}`,document.body.appendChild(i)}return $},P=e=>`https://${t[e]||"checkout.airwallex.com"}`,T=`/assets/bundle.${[0,2,40].join(".")}.min.js`,W=e=>{const t=document.createElement("script");t.src=`${e}${T}`;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(t),t};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,t)=>window.Airwallex?window.Airwallex.createElement(e,t):(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,t)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,t);{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=>{const{env:i,checkoutOrigin:o}=e;return`${n[i||"prod"]}/api/v1/checkout/elements/3ds?origin=https://${t[i||"prod"]}&checkoutOrigin=${o||window.location.origin}`},e.getBrowserInfo=e=>{const{navigator:t,screen:n}=window||{},{language:i}=t||{},{colorDepth:o,height:l,width:r}=n||{},{intent_id:a,env:s}=e||{};let d;return e&&(d=D({intent_id:a,env:s})),{device_id:d,screen_height:l,screen_width:r,screen_color_depth:o,language:i,timezone:(new Date).getTimezoneOffset(),browser:{java_enabled:window.navigator.javaEnabled(),javascript_enabled:!0,user_agent:t.userAgent}}},e.getDeviceFingerprint=D,e.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),e.getGatewayUrl=P,e.getPaymentIntent=async(e,t)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,t);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},e.handle3ds=e=>{const{cardBin:n,next_action:i,authFormContainer:o,intent:l,challengeWindowSize:r,env:a}=e;return(({intent:e,gatewayUrl:t,cardBin:n,next_action:i,authFormContainer:o,componentType:l,challengeWindowSize:r})=>{var a;x.awaiting&&console.warn("Should wait previous 3ds flow finished before execute new one!"),console.log("threeDsHandler onChallenge type",(new Date).toLocaleTimeString()),v=document.getElementById(o||""),p=l,g=r,f=t,y=e,A(w),d(w,new c(f,{code:"",type:w,cardBin:n,next_action:i},{intent:y,origin:window.location.origin}));const u=document.createElement("div");return u.setAttribute("id",w),document.body.appendChild(u),window.addEventListener("message",E),null===(a=s(w))||void 0===a||a.mount(u),new Promise(((e,t)=>{x.resolver=e,x.reject=t,x.awaiting=!0}))})({gatewayUrl:`https://${t[a]}`,cardBin:n,intent:l,next_action:i,authFormContainer:o,componentType:"api",challengeWindowSize:r})},e.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},e.loadAirwallex=e=>Promise.resolve().then((()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const t=document.querySelector(`script[src="${T}"], script[src="${T}/"]`)||W(P((null==e?void 0:e.env)||"prod"));return new Promise(((n,i)=>{t.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),n(window.Airwallex)):i(new Error("Failed to load Airwallex on load event"))})),t.addEventListener("error",(()=>{i(new Error("Failed to load Airwallex scripts"))}))}))})),e.loadAirwallexJs=W,e.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
/* Airwallex Checkout Component Version [0.2.45] */
var Airwallex=function(e){"use strict";const t={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={prod:"https://pci-api.airwallex.com",demo:"https://pci-api-demo.airwallex.com",staging:"https://pci-api-staging.airwallex.com",qa:"https://pci-api-qa.airwallex.com",preview:"https://pci-api-preview.airwallex.com",dev:"http://localhost:8080"};class i{constructor(e,t){var n,i;this.domElement=null,this.gatewayUrl=e,this.options=t,this.iframe=window.document.createElement("iframe"),this.iframe.setAttribute("frameborder","0"),this.iframe.setAttribute("allowtransparency","true"),this.iframe.setAttribute("importance","high"),this.iframe.setAttribute("scrolling","no"),this.iframe.setAttribute("allowpaymentrequest","true"),null===(n=this.iframe)||void 0===n||n.setAttribute("style","\n height: 0;\n width: 100%;\n display: block;\n "),i=e=>{var t,n,i;if(e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)){const t=new CustomEvent(null===(n=e.data)||void 0===n?void 0:n.code,{detail:{type:null===(i=e.data)||void 0===i?void 0:i.type},bubbles:!0,composed:!0});window.document.dispatchEvent(t)}},window.addEventListener("message",(e=>{window.ReactNativeWebView&&window.ReactNativeWebView.postMessage(JSON.stringify(e.data)),i(e)}))}addResizeListener(e){window.addEventListener("message",(t=>{var n,i,o,l;if(t.origin===this.gatewayUrl&&t.isTrusted&&"onResize"===(null===(n=t.data)||void 0===n?void 0:n.code)&&e===(null===(i=t.data)||void 0===i?void 0:i.type)){const e=null===(o=this.iframe)||void 0===o?void 0:o.style;e&&(e.height=`${null===(l=t.data)||void 0===l?void 0:l.height}px`)}}))}mount(e){if("string"!=typeof e)return(null==e?void 0:e.hasChildNodes())&&(e.innerHTML=""),this.iframe&&e.appendChild(this.iframe),this.domElement=e,e;{const t=window.document.getElementById(e);return(null==t?void 0:t.hasChildNodes())&&(t.innerHTML=""),this.iframe&&(null==t||t.appendChild(this.iframe)),t&&(this.domElement=t),t}}blur(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"blur"},this.gatewayUrl)}clear(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"clear"},this.gatewayUrl)}destroy(){var e;this.clear(),null===(e=this.iframe)||void 0===e||e.remove(),this.iframe=null}focus(){var e,t;null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"focus"},this.gatewayUrl)}unmount(){var e;this.clear(),this.iframe&&(null===(e=this.domElement)||void 0===e||e.removeChild(this.iframe))}update(e){var t,n;this.options={...this.options,...e},null===(n=null===(t=this.iframe)||void 0===t?void 0:t.contentWindow)||void 0===n||n.postMessage({code:"update",options:e},this.gatewayUrl)}async confirm(){throw new Error("Confirm is not supported in ElementBase")}success(e){throw new Error(`Call success with ${e.id} is not supported in ElementBase`)}fail(e){throw new Error(`Call fail with ${e.code}: ${e.message} is not supported in ElementBase`)}}const o=["cardNumber","expiry","cvc","paymentRequestButton","card","wechat","qrcode","redirect","dropIn","fullFeaturedCard","threeDsFrictionless","threeDsChallenge"],l={},r={cardNumber:null,expiry:null,cvc:null,threeDsFrictionless:null,threeDsChallenge:null,paymentRequestButton:null,card:null,wechat:null,qrcode:null,redirect:null,dropIn:null,fullFeaturedCard:null},a=e=>{var t;return o.includes(e)?(null===(t=r[e])||void 0===t||t.destroy(),r[e]=null,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1)},s=e=>o.includes(e)?r[e]:(console.warn(`getElement with type: ${e} not support!`),null),d=(e,t)=>o.includes(e)?(r[e]=t,!0):(console.warn(`destroyElement with type: ${e} not support!`),!1);class c extends i{constructor(e,t,n){var i,o,r,a;super(e,n),this.confirmResponse=t,null===(i=this.iframe)||void 0===i||i.setAttribute("src",`${e}/#/elements/3ds-frictionless?options=${encodeURIComponent(JSON.stringify(this.options))}&lang=${null===(o=l)||void 0===o?void 0:o.locale}`),null===(r=this.iframe)||void 0===r||r.setAttribute("name","Airwallex 3DS frictionless iframe"),null===(a=this.iframe)||void 0===a||a.setAttribute("title","Airwallex 3DS frictionless iframe"),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsFrictionless"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}class u extends i{constructor(e,t,n){var i,o,l,r,a,s,d,c,u;super(e,n),this.confirmResponse=t;const w=(null==n?void 0:n.customizeChallengeWindowSize)&&$[null==n?void 0:n.customizeChallengeWindowSize]?$[null==n?void 0:n.customizeChallengeWindowSize]:$["05"],h=(null===(i=null==n?void 0:n.style)||void 0===i?void 0:i.popupWidth)?`${null===(o=null==n?void 0:n.style)||void 0===o?void 0:o.popupWidth}px`:w[0],m=(null===(l=null==n?void 0:n.style)||void 0===l?void 0:l.popupHeight)?`${null===(r=null==n?void 0:n.style)||void 0===r?void 0:r.popupHeight}px`:w[1];null===(a=this.iframe)||void 0===a||a.setAttribute("src",`${e}/#/elements/3ds-challenge?options=${encodeURIComponent(JSON.stringify(this.options))}`),null===(s=this.iframe)||void 0===s||s.setAttribute("name","Airwallex 3DS challenge iframe"),null===(d=this.iframe)||void 0===d||d.setAttribute("title","Airwallex 3DS challenge iframe"),null===(c=this.iframe)||void 0===c||c.setAttribute("scrolling","yes"),null===(u=this.iframe)||void 0===u||u.setAttribute("style",`\n background: #fff;\n width: ${h};\n height: ${m};\n position: ${(null==n?void 0:n.useDefaultStyle)?"absolute":"relative"};\n top: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n left: ${(null==n?void 0:n.useDefaultStyle)?"50%":"0"};\n transform: ${(null==n?void 0:n.useDefaultStyle)?"translate(-50%, -50%)":"none"};\n border-radius: ${(null==n?void 0:n.useDefaultStyle)?"4px":"0"};\n `),window.addEventListener("message",(e=>{var t,n,i,o;e.origin===this.gatewayUrl&&e.isTrusted&&"onReady"===(null===(t=e.data)||void 0===t?void 0:t.code)&&"threeDsChallenge"===(null===(n=e.data)||void 0===n?void 0:n.type)&&(null===(o=null===(i=this.iframe)||void 0===i?void 0:i.contentWindow)||void 0===o||o.postMessage({code:"update",data:this.confirmResponse},this.gatewayUrl))}))}async confirm(){var e,t;return null===(t=null===(e=this.iframe)||void 0===e?void 0:e.contentWindow)||void 0===t||t.postMessage({code:"confirm",data:this.confirmResponse},this.gatewayUrl),null}}const w="threeDsFrictionless",h="threeDsChallenge";let m,v,p,g,f,y;const x={resolver:null,reject:null,awaiting:!1},A=e=>{var t;null===(t=document.querySelector(`#${e}`))||void 0===t||t.remove(),a(e===w?w:h)},b=()=>{x.awaiting=!1,x.resolver=null,x.reject=null},E=e=>{var t;A(w),v?m=v:(m=document.createElement("div"),m.setAttribute("id",h),m.setAttribute("style","\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 0;\n z-index: 1500;\n overflow: hidden;\n background: rgba(0, 0, 0, 0.75);\n "),document.body.appendChild(m)),d(h,new u(f,e,{origin:window.location.origin,style:{popupWidth:undefined,popupHeight:undefined},useDefaultStyle:null===v,customizeChallengeWindowSize:g,intent:y})),window.addEventListener("message",S),null===(t=s(h))||void 0===t||t.mount(m)},C=e=>{var t,n;const i="data"in e?e.data:e.detail,o=["hpp","api"].includes(p),l=o?null:s(p),r=(null==l?void 0:l.gatewayUrl)||window.location.origin;("data"in e&&e.origin===r&&e.isTrusted||o)&&(null==i?void 0:i.type)===w&&(A(h),"onSuccess"===(null==i?void 0:i.code)&&(console.log("frictionlessHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=x.resolver)||void 0===t||t.call(x,i),b(),A(w)),["onError","onChallengeError"].includes(null==i?void 0:i.code)&&(console.log(`frictionlessHandler ${null==i?void 0:i.code}`,(new Date).toLocaleTimeString()),null===(n=x.reject)||void 0===n||n.call(x,i),b(),A(w)),"onChallenge"===(null==i?void 0:i.code)&&(console.log("frictionlessHandler onChallenge threeDsFrictionlessType",(new Date).toLocaleTimeString()),E(i)))},S=e=>{var t,n;const i="data"in e?e.data:e.detail,o=["hpp","api"].includes(p),l=o?null:s(p),r=(null==l?void 0:l.gatewayUrl)||window.location.origin;("data"in e&&e.origin===r&&e.isTrusted||o)&&(null==i?void 0:i.type)===h&&("onReady"===(null==i?void 0:i.code)&&(console.log("challengeHandler onReady",(new Date).toLocaleTimeString()),setTimeout((()=>{m.style.height="100%"}),2e3)),"onChallengeSuccess"===(null==i?void 0:i.code)&&(m.style.height="0"),"onSuccess"===(null==i?void 0:i.code)&&(console.log("challengeHandler onSuccess",(new Date).toLocaleTimeString()),null===(t=x.resolver)||void 0===t||t.call(x,i),b(),A(h)),["onError","onChallengeError"].includes(null==i?void 0:i.code)&&(console.log(`challengeHandler ${null==i?void 0:i.code}`,(new Date).toLocaleTimeString()),null===(n=x.reject)||void 0===n||n.call(x,i),b(),A(h)))},$={"01":["250px","400px"],"02":["390px","400px"],"03":["500px","600px"],"04":["600px","400px"],"05":["100%","100%"]};let D="";const P=({intent_id:e="",env:t="prod"})=>{if(!D.includes(e)){const n="prod"===t?"9ozphlqx":"45ssiuz3",i=document.createElement("script");D=`${e}${Date.now()}`,i.src=`https://h.online-metrix.net/fp/tags.js?org_id=${n}&session_id=${D}`,document.body.appendChild(i)}return D},T=e=>`https://${t[e]||"checkout.airwallex.com"}`,W=`/assets/bundle.${[0,2,45].join(".")}.min.js`,U=e=>{const t=document.createElement("script");t.src=`${e}${W}`;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(t),t};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,t)=>window.Airwallex?window.Airwallex.createElement(e,t):(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,t)=>{if(window.Airwallex)return window.Airwallex.createPaymentMethod(e,t);{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=>{const{env:i,checkoutOrigin:o}=e;return`${n[i||"prod"]}/api/v1/checkout/elements/3ds?origin=https://${t[i||"prod"]}&checkoutOrigin=${o||window.location.origin}`},e.getBrowserInfo=e=>{const{navigator:t,screen:n}=window||{},{language:i}=t||{},{colorDepth:o,height:l,width:r}=n||{},{intent_id:a,env:s}=e||{};let d;return e&&(d=P({intent_id:a,env:s})),{device_id:d,screen_height:l,screen_width:r,screen_color_depth:o,language:i,timezone:(new Date).getTimezoneOffset(),browser:{java_enabled:window.navigator.javaEnabled(),javascript_enabled:!0,user_agent:t.userAgent}}},e.getDeviceFingerprint=P,e.getElement=e=>window.Airwallex?window.Airwallex.getElement(e):(console.error("Please loadAirwallex() before getElement();"),null),e.getGatewayUrl=T,e.getPaymentIntent=async(e,t)=>{if(window.Airwallex)return window.Airwallex.getPaymentIntent(e,t);{const e="Please loadAirwallex() before getPaymentIntent();";throw console.error(e),new Error(e)}},e.handle3ds=e=>{const{cardBin:n,next_action:i,authFormContainer:o,intent:l,challengeWindowSize:r,env:a}=e;return(({intent:e,gatewayUrl:t,cardBin:n,next_action:i,authFormContainer:o,componentType:l,challengeWindowSize:r})=>{var a;if(x.awaiting&&console.warn("Should wait previous 3ds flow finished before execute new one!"),console.log("threeDsHandler onChallenge type",(new Date).toLocaleTimeString()),v=document.getElementById(o||""),p=l,g=r,f=t,y=e,A(w),A(h),"WAITING_USER_INFO_INPUT"===(null==i?void 0:i.stage))E({type:"threeDsFrictionless",next_action:i});else{d(w,new c(f,{code:"",type:w,cardBin:n,next_action:i},{intent:y,origin:window.location.origin}));const e=document.createElement("div");e.setAttribute("id",w),document.body.appendChild(e),window.addEventListener("message",C),null===(a=s(w))||void 0===a||a.mount(e)}return new Promise(((e,t)=>{x.resolver=e,x.reject=t,x.awaiting=!0}))})({gatewayUrl:`https://${t[a]}`,cardBin:n,intent:l,next_action:i,authFormContainer:o,componentType:"api",challengeWindowSize:r})},e.init=e=>{window.Airwallex?window.Airwallex.init(e):console.error("Please loadAirwallex() before init();")},e.loadAirwallex=e=>Promise.resolve().then((()=>{if("undefined"==typeof window)return null;if(window.Airwallex)return window.Airwallex;const t=document.querySelector(`script[src="${W}"], script[src="${W}/"]`)||U(T((null==e?void 0:e.env)||"prod"));return new Promise(((n,i)=>{t.addEventListener("load",(()=>{window.Airwallex?(window.Airwallex.init(e),n(window.Airwallex)):i(new Error("Failed to load Airwallex on load event"))})),t.addEventListener("error",(()=>{i(new Error("Failed to load Airwallex scripts"))}))}))})),e.loadAirwallexJs=U,e.redirectToCheckout=e=>{window.Airwallex?window.Airwallex.redirectToCheckout(e):console.error("Please loadAirwallex() before redirectToCheckout();")},Object.defineProperty(e,"__esModule",{value:!0}),e}({});
/* Airwallex @Charlie.Lang */
//# sourceMappingURL=airwallex.iife.js.map
{
"name": "airwallex-payment-elements",
"version": "0.2.40",
"version": "0.2.45",
"module": "lib/bin/airwallex.es.js",

@@ -5,0 +5,0 @@ "main": "lib/bin/airwallex.cjs.js",

@@ -69,3 +69,12 @@ import { Intent, PaymentMethodBasicInfo } from './cardNumber';

| 'paysera'
| 'satispay';
| 'satispay'
| 'family_mart'
| 'hi_life'
| 'sam_kiosk'
| 'axs_kiosk'
| 'bigc'
| 'esun'
| 'permata_atm'
| 'boost'
| 'shopee_pay';

@@ -72,0 +81,0 @@ /**

@@ -82,2 +82,5 @@ import { AirwallexEnv } from './airwallex';

};
type: string;
url: string;
stage?: string;
}

@@ -84,0 +87,0 @@

@@ -19,3 +19,4 @@ import { ElementOptions, PaymentMethodWithRedirect } from './element';

/**
* For poli, grab_pay, konbini, eps, giropay, ideal, multibankco, bancontact, blik, mybank, paybybankapp, maxima, narvesen, paypost, perlas_terminals
* For poli, grab_pay, konbini, eps, giropay, ideal, multibankco, bancontact, blik
* mybank, paybybankapp, maxima, narvesen, paypost, perlas_terminals
*/

@@ -27,3 +28,4 @@ interface RedirectElementPaymentOptionsForPoli extends RedirectElementPaymentBasicOptions {

/**
* For fpx, enets, pay_easy, tesco_lotus, dragonpay
* For fpx, enets, pay_easy, tesco_lotus, dragonpay, family_mart, hi_life
* sam_kiosk, axs_kiosk, bigc, esun, permata_atm, boost, shopee_pay
*/

@@ -37,3 +39,3 @@ interface RedirectElementPaymentOptionsForFpx extends RedirectElementPaymentBasicOptions {

/**
* For bank_transfer, paysafecash
* For paysafecash
*/

@@ -47,3 +49,3 @@ interface RedirectElementPaymentOptionsForBankTransfer extends RedirectElementPaymentBasicOptions {

/**
* For online_banking, seven_eleven
* For bank_transfer, online_banking, seven_eleven
*/

@@ -50,0 +52,0 @@ interface RedirectElementPaymentOptionsForOnlineBanking extends RedirectElementPaymentBasicOptions {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc