From 5a3013c4b5797fa213347bfcca2a101a05489ebe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Jasi=C5=84ski?= Date: Wed, 8 Jan 2025 15:21:20 +0100 Subject: [PATCH] add translations --- scripts/modal.js | 2 +- scripts/processout.js | 2 +- .../elements/payment-methods-manager.ts | 30 +++++++++++++++---- src/dynamic-checkout/locales/en.ts | 2 ++ src/dynamic-checkout/locales/es.ts | 2 ++ src/dynamic-checkout/locales/fr.ts | 2 ++ src/dynamic-checkout/locales/pl.ts | 2 ++ src/dynamic-checkout/locales/pt.ts | 2 ++ src/dynamic-checkout/views/payment-methods.ts | 3 +- 9 files changed, 38 insertions(+), 9 deletions(-) diff --git a/scripts/modal.js b/scripts/modal.js index b84fb4c..36bbe89 100644 --- a/scripts/modal.js +++ b/scripts/modal.js @@ -1 +1 @@ -!function(){function t(t){this.message=t}var r="undefined"!=typeof exports?exports:self,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";(t.prototype=new Error).name="InvalidCharacterError",r.btoa||(r.btoa=function(r){for(var o,n,a=String(r),i=0,c=e,d="";a.charAt(0|i)||(c="=",i%1);d+=c.charAt(63&o>>8-i%1*8)){if(255<(n=a.charCodeAt(i+=.75)))throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return d}),r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,"");if(o.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,a,i=0,c=0,d="";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)&&(d+=String.fromCharCode(255&n>>(-2*i&6))))a=e.indexOf(a);return d})}(),"function"!=typeof Object.assign&&(Object.assign=function(a,b){"use strict";if(null==a)throw new TypeError("Cannot convert undefined or null to object");for(var c=Object(a),d=1;d=format[currentBlock]){if(currentBlockChar=0,++currentBlock>=format.length)break;formatted+=" "}formatted+=number[i],currentBlockChar++}return formatted},Card.parseNumber=function(number){return String(number.replace(/ /gi,"").replace(/\-/gi,"").replace(/\-/gi,""))},Card.validateNumber=function(number,limit){return!((number=Card.parseNumber(number)).lengthlimit[1])&&Card.luhn(number)?null:new ProcessOut.Exception("card.invalid-number")},Card.validateCVC=function(cvc,scheme){if(scheme){if("american-express"===scheme){if(cvc&&!cvc.match(/^\d{4}$/g))return new ProcessOut.Exception("card.invalid-cvc")}else if(cvc&&!cvc.match(/^\d{3}$/g))return new ProcessOut.Exception("card.invalid-cvc")}else if(cvc&&!cvc.match(/^\d{3,4}$/g))return new ProcessOut.Exception("card.invalid-cvc");return null},Card.getIIN=function(number){var l=(number=Card.parseNumber(number)).length;return number.substring(0,l=6option.length?option:iin).length;if(iin.substring(0,l)==option.toString().substring(0,l)){matches.push(scheme);break}}}return matches},Card}());ProcessOut.Card=Card}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.CardFieldValue=function CardFieldValue(){this.number=null,this.expiryMonth=null,this.expiryYear=null,this.cvc=null,this.name=null,this.metadata=null};var CardFieldOptions=function(){function CardFieldOptions(type){this.expiryAutoNext=!0,this.cardNumberAutoNext=!0,this.type=type}return CardFieldOptions.prototype.apply=function(o){return o.placeholder&&(this.placeholder=o.placeholder),o.style&&(this.style=o.style),null!=o.requireCVC&&(this.requireCVC=o.requireCVC),o.expiryAutoNext!==undefined&&null!==o.expiryAutoNext&&(this.expiryAutoNext=o.expiryAutoNext),o.cardNumberAutoNext!==undefined&&null!==o.cardNumberAutoNext&&(this.cardNumberAutoNext=o.cardNumberAutoNext),this},CardFieldOptions}(),CardFieldOptions=(ProcessOut.CardFieldOptions=CardFieldOptions,function CardFieldStyle(){}),CardFieldOptions=(ProcessOut.CardFieldStyle=CardFieldOptions,function(){function CardField(instance,form,options,container,success,error){if(this.handlers={},!options||!options.type)throw new ProcessOut.Exception("processout-js.invalid-field-type","Options and a the field type must be provided to setup the field.");if(!container)throw new ProcessOut.Exception("processout-js.undefined-field","The card field for the ".concat(options.type," does not exist in the given container."));if(container instanceof HTMLInputElement)throw new ProcessOut.Exception("processout-js.invalid-field","The card field for the ".concat(options.type," must be an input field."));if(options.type!=CardField.number&&options.type!=CardField.expiry&&options.type!=CardField.expiryMonth&&options.type!=CardField.expiryYear&&options.type!=CardField.cvc)throw new ProcessOut.Exception("processout-js.invalid-field-type");this.instance=instance,this.form=form,this.options=options,this.el=container;instance=this.el.getAttribute("data-processout-placeholder");instance&&(this.options.placeholder=instance),this.spawn(success,error)}return CardField.prototype.spawn=function(success,error){var tmp=Math.random().toString(36).substring(7),endpoint=(this.uid="#".concat(tmp),this.instance.getProcessOutFieldEndpoint("?r=".concat(tmp).concat(this.uid))),errored=(this.iframe=document.createElement("iframe"),this.iframe.className="processout-field-cc-iframe",this.iframe.name=tmp,this.iframe.setAttribute("src",endpoint),this.iframe.setAttribute("style","background: none; width: 100%;"),this.iframe.setAttribute("frameborder","0"),this.iframe.setAttribute("allowtransparency","1"),this.iframe.style.display="none",!(this.iframe.height="14px")),iframeError=setTimeout(function(){errored=!0,typeof error==typeof Function&&error(new ProcessOut.Exception("processout-js.field.unavailable"))},CardField.timeout);this.iframe.onload=function(){try{navigator.userAgent.match(/firefox|fxios/i)&&this.iframe.contentWindow.location.replace(endpoint)}catch(e){}}.bind(this),window.addEventListener("message",function(event){errored||(event=ProcessOut.Message.parseEvent(event)).frameID==this.uid&&event.namespace==ProcessOut.Message.fieldNamespace&&(this.handlEvent(event),"alive"==event.action&&this.iframe.contentWindow.postMessage(JSON.stringify({namespace:ProcessOut.Message.fieldNamespace,projectID:this.instance.getProjectID(),action:"setup",formID:this.form.getUID(),data:this.options}),"*"),"ready"==event.action)&&(this.iframe.style.display="block",clearTimeout(iframeError),success(),this.iframe.contentWindow.postMessage(JSON.stringify({namespace:ProcessOut.Message.fieldNamespace,projectID:this.instance.getProjectID(),action:"resize"}),"*"),this.iframe.addEventListener("focus",function(event){this.focus()}.bind(this)))}.bind(this)),this.el.appendChild(this.iframe)},CardField.prototype.handlEvent=function(data){var d={field:this,type:this.options.type,element:this.el,data:data.data};switch(data.action){case"inputEvent":this.eventCallback&&this.eventCallback("oninput",d);break;case"mouseEnterEvent":this.eventCallback&&this.eventCallback("onmouseenter",d);break;case"mouseLeaveEvent":this.eventCallback&&this.eventCallback("onmouseleave",d);break;case"focusEvent":this.el.className=this.el.className+" processout-input-focused",this.eventCallback&&this.eventCallback("onfocus",d);break;case"blurEvent":this.el.className=this.el.className.replace(/\bprocessout-input-focused\b/g,"").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),this.eventCallback&&this.eventCallback("onblur",d);break;case"next":this.next&&this.next();break;case"event":if(data.data.name in this.handlers)for(var handlers=this.handlers[data.data.name],i=0;i=this.paymentConfig.pollingMaxTimeout},NativeApm.prototype.handleCaptureSuccess=function(data){if(data.success&&data.native_apm&&"PENDING_CAPTURE"===data.native_apm.state&&!this.checkIfCaptureTimeout())return this.capturePayment();if(data.success&&data.native_apm&&"PENDING_CAPTURE"===data.native_apm.state&&this.checkIfCaptureTimeout())return this.captureStart=null,ProcessOut.EventsUtils.dispatchPaymentErrorEvent(data);var errorView;if(!data.success)return this.captureStart=null,errorView=new ProcessOut.NativeApmErrorView(this.gatewayConfiguration.native_apm,this.theme),ProcessOut.EventsUtils.dispatchPaymentErrorEvent(data),this.loadView(errorView.getViewElement());this.captureStart=null;data=new ProcessOut.NativeApmSuccessView(this.gatewayConfiguration,this.markdownLibraryInstance,this.theme);return ProcessOut.EventsUtils.dispatchPaymentSuccessEvent({returnUrl:this.paymentConfig.returnUrl}),this.loadView(data.getViewElement())},NativeApm.prototype.handleCaptureError=function(req,e,errorCode){var errorView=new ProcessOut.NativeApmErrorView(this.gatewayConfiguration.native_apm,this.theme),errorData=req.response;!req.response&&errorCode&&(errorData={success:!1,error_type:errorCode,message:ProcessOut.Translator.translateError(errorCode)}),ProcessOut.EventsUtils.dispatchPaymentErrorEvent(errorData),this.loadView(errorView.getViewElement())},NativeApm.prototype.setTheme=function(themeConfig){return this.theme.setTheme(themeConfig)},NativeApm.prototype.prefillData=function(data){this.prefilledData=data},NativeApm.prototype.loadView=function(view){this.widgetWrapper&&this.napmContainer.removeChild(this.widgetWrapper),this.widgetWrapper=this.createWidgetWrapper(),this.widgetWrapper.appendChild(view),this.napmContainer.appendChild(this.widgetWrapper)},NativeApm.prototype.updatePaymentProviderLogo=function(logoUrl){logoUrl&&(this.gatewayConfiguration=__assign(__assign({},this.gatewayConfiguration),{native_apm:__assign(__assign({},this.gatewayConfiguration.native_apm),{gateway:__assign(__assign({},this.gatewayConfiguration.native_apm.gateway),{logo_url:logoUrl})})}))},NativeApm.prototype.createWidgetWrapper=function(){var widgetWrapper=document.createElement("div"),styleElement=this.theme.createInitialStyleTag();return widgetWrapper.setAttribute("class","native-apm-widget-wrapper"),widgetWrapper.appendChild(styleElement),ProcessOut.StylesUtils.styleElement(widgetWrapper,this.theme.wrapper),widgetWrapper},NativeApm.prototype.loadMarkdownLibrary=function(){var _this=this,markdownScript=document.createElement("script");markdownScript.src="https://js.processout.com/js/libraries/showdown.min.js",markdownScript.onload=function(){_this.markdownLibraryInstance=window.globalThis&&window.globalThis.showdown?new window.globalThis.showdown.Converter:null},document.head.appendChild(markdownScript)},NativeApm.prototype.loadQrCodesLibrary=function(){var qrCodeScript=document.createElement("script");qrCodeScript.src="https://js.processout.com/js/libraries/qrcode.min.js",document.head.appendChild(qrCodeScript)},NativeApm}();ProcessOut.NativeApm=NativeApm}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var NativeApmPaymentConfig=function(){function NativeApmPaymentConfig(config){this.setConfig(config)}return NativeApmPaymentConfig.prototype.getConfig=function(){return{gatewayConfigurationId:this.gatewayConfigurationId,invoiceId:this.invoiceId,returnUrl:this.returnUrl,pollingMaxTimeout:this.pollingMaxTimeout}},NativeApmPaymentConfig.prototype.setConfig=function(config){if(!this.isValidConfig(config))throw new ProcessOut.Exception("default","You must instantiate Native APM with a valid config in order to use it");this.gatewayConfigurationId=config.gatewayConfigurationId,this.invoiceId=config.invoiceId,this.returnUrl=config.returnUrl,this.pollingMaxTimeout=config.pollingMaxTimeout||180},NativeApmPaymentConfig.prototype.isValidConfig=function(config){return config.gatewayConfigurationId&&config.invoiceId},NativeApmPaymentConfig}();ProcessOut.NativeApmPaymentConfig=NativeApmPaymentConfig}(ProcessOut=ProcessOut||{}),{wrapper:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",width:"100%",fontSize:"1rem"},spinner:{width:"4rem",height:"4rem",border:"5px solid #f2f2f2",borderBottomColor:"#7e57c2",borderRadius:"50%",display:"inline-block",boxSizing:"border-box",animation:"rotation 1s linear infinite"},logo:{width:"10rem",height:"auto",marginBottom:"1rem"},buttons:{"default":{borderWidth:"0px",color:"#fff",backgroundColor:"#7e57c2",cursor:"pointer",padding:"0.8rem 1.5rem",display:"flex",justifyContent:"center",alignItems:"center",position:"relative",marginTop:"0.8rem",fontSize:"1rem",borderRadius:"5px"},spinner:{position:"absolute",width:"1rem",height:"1rem",border:"3px solid #f2f2f2",borderBottomColor:"#7e57c2",borderRadius:"50%",display:"inline-block",boxSizing:"border-box",animation:"rotation 1s linear infinite"}},form:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.8rem",width:"100%",inputsWrapper:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"0.8rem",alignItems:"center",width:"100%"},inputs:{wrapper:{width:"inherit"},text:{padding:"0 0.8rem",height:"3rem",border:"1px solid #d7d7d7",borderRadius:"5px",width:"100%",fontSize:"1rem"},select:{height:"3rem",width:"100%",border:"1px solid #d7d7d7",borderRadius:"5px",fontSize:"1rem"},numeric:{display:"flex",flexDirection:"row",gap:"0.8rem",character:{width:"3rem",height:"3rem",fontSize:"1.5rem",border:"1px solid #d7d7d7",borderRadius:"5px",textAlign:"center"}}},labels:{display:"block",marginBottom:"10px",requiredStar:{color:"#e74c3c",marginLeft:"0.1rem"}},errors:{display:"block",color:"#e74c3c",fontSize:"0.9rem",minHeight:"1rem",marginTop:"0.3rem",width:"100%"}},message:{fontSize:"1.1rem"},actionImage:{marginTop:"1.3rem",marginBottom:"1.3rem",width:"15rem",height:"auto",display:"flex",justifyContent:"center",alignItems:"center"}}),spinnerLoadingAnimation="\n@keyframes rotation {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n",defaultStyles=(!function(ProcessOut){var NativeApmThemeConfig=function(){function NativeApmThemeConfig(){this.wrapper=defaultTheme.wrapper,this.spinner=defaultTheme.spinner,this.logo=defaultTheme.logo,this.buttons=defaultTheme.buttons,this.form=defaultTheme.form,this.message=defaultTheme.message,this.actionImage=defaultTheme.actionImage}return NativeApmThemeConfig.prototype.getTheme=function(){return{wrapper:this.wrapper,spinner:this.spinner,logo:this.logo,buttons:this.buttons,form:this.form,message:this.message,actionImage:this.actionImage}},NativeApmThemeConfig.prototype.setTheme=function(theme){var mergeObjects=function(obj1,obj2){for(var key in obj2)obj2.hasOwnProperty(key)&&("object"==typeof obj2[key]&&null!==obj2[key]?obj1[key]=mergeObjects(obj1[key],obj2[key]):obj1[key]=obj2[key]);return obj1};mergeObjects(this.wrapper,theme.wrapper),mergeObjects(this.spinner,theme.spinner),mergeObjects(this.logo,theme.logo),mergeObjects(this.buttons,theme.buttons),mergeObjects(this.form,theme.form),mergeObjects(this.message,theme.message),mergeObjects(this.actionImage,theme.actionImage)},NativeApmThemeConfig.prototype.createInitialStyleTag=function(){var styleElement=document.createElement("style");return styleElement.innerHTML=spinnerLoadingAnimation,styleElement},NativeApmThemeConfig}();ProcessOut.NativeApmThemeConfig=NativeApmThemeConfig}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var StylesUtils=function(){function StylesUtils(){}return StylesUtils.styleElement=function(node,styles){return Object.keys(styles).forEach(function(style){node.style[style]=styles[style]})},StylesUtils}();ProcessOut.StylesUtils=StylesUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.NATIVE_APM_EVENTS={WIDGET_LOADING:"processout_native_apm_loading",WIDGET_READY:"processout_native_apm_ready",GATEWAY_CONFIGURATION_ERROR:"processout_native_apm_gateway_configuration_error",PAYMENT_INIT:"processout_native_apm_payment_init",PAYMENT_ADDITIONAL_INPUT:"processout_native_apm_payment_additional_input",PAYMENT_SUCCESS:"processout_native_apm_payment_success",PAYMENT_ERROR:"processout_native_apm_payment_error"};var EventsUtils=function(){function EventsUtils(){}return EventsUtils.dispatchGatewayConfigurationErrorEvent=function(errorData){errorData=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.GATEWAY_CONFIGURATION_ERROR,errorData);return window.dispatchEvent(errorData)},EventsUtils.dispatchPaymentInitEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_INIT);return window.dispatchEvent(event)},EventsUtils.dispatchWidgetLoadingEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.WIDGET_LOADING);return window.dispatchEvent(event)},EventsUtils.dispatchWidgetReadyEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.WIDGET_READY);return window.dispatchEvent(event)},EventsUtils.dispatchPaymentAdditionalInputEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_ADDITIONAL_INPUT);return window.dispatchEvent(event)},EventsUtils.dispatchPaymentSuccessEvent=function(data){data=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_SUCCESS,data);return window.dispatchEvent(data)},EventsUtils.dispatchPaymentErrorEvent=function(errorData){errorData=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_ERROR,errorData);return window.dispatchEvent(errorData)},EventsUtils.createEvent=function(eventName,data){var event_1;return"function"==typeof window.CustomEvent?new CustomEvent(eventName,{bubbles:!0,detail:data}):((event_1=document.createEvent("CustomEvent")).initCustomEvent(eventName,!0,!1,data),event_1)},EventsUtils}();ProcessOut.EventsUtils=EventsUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.texts={en:{invalidCode:"Code is not valid.",invalidPhoneNumber:"Phone number is not valid.",invalidTextValue:"Value is not valid.",invalidEmail:"Email is not valid.",phoneNumberPlaceholder:"Enter phone number",phoneNumberLabel:"Phone number",emailPlaceholder:"name@exmple.com",submitButtonText:"Pay",paymentSuccessMessage:"Success!\nPayment approved.",genericError:"Something went wrong, please try again.",paymentTimeout:"The payment was not confirmed in time in the banking application. Please try again."},pl:{invalidCode:"Niepoprawny kod.",invalidPhoneNumber:"Niepoprawny numer telefonu.",invalidTextValue:"Niepoprawna wartość.",invalidEmail:"Niepoprawny adres email.",phoneNumberPlaceholder:"Twój numer telefonu",phoneNumberLabel:"Numer telefonu",emailPlaceholder:"imię@przykład.pl",submitButtonText:"Zapłać",paymentSuccessMessage:"Sukces!\nPłatność przyjęta.",genericError:"Coś poszło nie tak, spróbuj ponownie.",paymentTimeout:"Płatność odrzucona. Czas na potwierdzenie transakcji został przekroczony. Spróbuj ponownie."},pt:{invalidCode:"Número inválido.",invalidPhoneNumber:"Número de telemóvel inválido.",invalidTextValue:"Texto inválido.",invalidEmail:"Endereço de e-mail inválido.",phoneNumberPlaceholder:"Insira o seu número de telemóvel",phoneNumberLabel:"Nº de telemóvel",emailPlaceholder:"nome@exemplo.pt",submitButtonText:"Pagar",paymentSuccessMessage:"Successo!\nPagamento aprovado.",genericError:"Ocorreu um erro ao processar o seu cartão, por favor tente novamente.",paymentTimeout:"O pagamento não foi confirmado a tempo no aplicativo bancário. Por favor, tente novamente."},fr:{invalidCode:"Numéro invalide.",invalidPhoneNumber:"Votre numéro de téléphone est invalide.",invalidTextValue:"Valeur invalide.",invalidEmail:"Votre adresse e-mail est invalide.",phoneNumberPlaceholder:"Entrez votre numéro de téléphone",phoneNumberLabel:"Numéro de téléphone",emailPlaceholder:"nom@exemple.fr",submitButtonText:"Payer",paymentSuccessMessage:"Succès!\nPaiement confirmé.",genericError:"Une erreur s’est produite, veuillez réessayer.",paymentTimeout:"Le paiement n'a pas été confirmé à temps dans l'application bancaire. Veuillez réessayer."}};var TextUtils=function(){function TextUtils(){}return TextUtils.getText=function(key){var locale=ProcessOut.Translator.getLocale(),locale=ProcessOut.texts.hasOwnProperty(locale)?locale:"en";return ProcessOut.texts[locale][key]||""},TextUtils}();ProcessOut.TextUtils=TextUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var ErrorsUtils=function(){function ErrorsUtils(){}return ErrorsUtils.isFieldsValidationError=function(errorData){var error_type=errorData.error_type,errorData=errorData.invalid_fields;return("request.validation.error"===error_type||"gateway.invalid-customer-input"===error_type)&&0',initializeApplePay(invoiceData,buttonContainer,getViewContainer)},document.head.appendChild(applePayScript)},ApplePayClient.prototype.initializeApplePay=function(invoiceData,buttonContainer,getViewContainer){var tokenizeApplePay=this.tokenizeApplePay.bind(this),applePayPaymentMethodData=this.getApplePayPaymentMethodData(invoiceData);this.processOutInstance.applePay.checkAvailability(function(err){err?console.log(err):(buttonContainer.classList.add("visible"),document.querySelector("apple-pay-button").addEventListener("click",function(){tokenizeApplePay(invoiceData,getViewContainer)}))},{merchantApplePayCertificateId:applePayPaymentMethodData.merchant_id})},ApplePayClient.prototype.getSupportedNetworks=function(invoiceData){var supportedNetworks=[];return this.getApplePayPaymentMethodData(invoiceData).supported_networks.forEach(function(network){ProcessOut.networksMap[network]&&supportedNetworks.push(ProcessOut.networksMap[network])}),supportedNetworks},ApplePayClient.prototype.createApplePaySession=function(invoiceData){var supportedNetworks=this.getSupportedNetworks(invoiceData),applePayPaymentMethodData=this.getApplePayPaymentMethodData(invoiceData),invoiceData=this.processOutInstance.applePay.newSession({total:{label:invoiceData.name,amount:invoiceData.amount},currencyCode:invoiceData.currency,countryCode:applePayPaymentMethodData.country_code,supportedNetworks:supportedNetworks,merchantCapabilities:applePayPaymentMethodData.merchant_capabilities,merchantApplePayCertificateId:applePayPaymentMethodData.merchant_id,applePaySessionVersion:14},ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePayNewSessionEvent,ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePaySessionError);return invoiceData.onpaymentauthorizedPostprocess=ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePayAuthorizedPostProcessEvent,invoiceData},ApplePayClient.prototype.tokenizeApplePay=function(invoiceData,getViewContainer){var session=this.createApplePaySession(invoiceData),makeApplePayPayment=this.makeApplePayPayment.bind(this);this.processOutInstance.tokenize(session,{},function(card){session.completePayment(0),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentSuccessEvent(card);card=card.id;makeApplePayPayment(card,invoiceData,getViewContainer)},function(err){session.completePayment(1),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentErrorEvent(err),getViewContainer().innerHTML='\n
\n Something went wrong. Please try again.\n
\n '})},ApplePayClient.prototype.makeApplePayPayment=function(cardToken,invoiceData,getViewContainer){this.processOutInstance.makeCardPayment(invoiceData.id,cardToken,{authorize_only:!0},function(invoiceId){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentSuccessView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({invoiceId:invoiceId,returnUrl:this.paymentConfig.invoiceDetails.return_url})},function(error){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)})},ApplePayClient.prototype.getApplePayPaymentMethodData=function(invoiceData){var applePayPaymentMethodData;return invoiceData.payment_methods.forEach(function(method){"applepay"===method.type&&(applePayPaymentMethodData=method.applepay)}),applePayPaymentMethodData},ApplePayClient}();ProcessOut.ApplePayClient=ApplePayClient}(ProcessOut=ProcessOut||{}),function(ProcessOut){var GooglePayClient=function(){function GooglePayClient(processOutInstance){this.processOutInstance=processOutInstance}return GooglePayClient.prototype.loadButton=function(buttonContainer,invoiceData,getViewContainer){var _this=this,googleClientScript=document.createElement("script");googleClientScript.src=ProcessOut.googlePaySdkUrl,googleClientScript.onload=function(){_this.googleClient=window.globalThis&&window.globalThis.google?new window.globalThis.google.payments.api.PaymentsClient({environment:ProcessOut.DEBUG?"TEST":"PRODUCTION"}):null,_this.initizalizeGooglePay(buttonContainer,getViewContainer,invoiceData)},document.head.appendChild(googleClientScript)},GooglePayClient.prototype.initizalizeGooglePay=function(buttonContainer,getViewContainer,invoiceData){var _this=this;this.prepareIsReadyToPayRequest(invoiceData),this.preparePaymentRequest(invoiceData),this.googleClient.isReadyToPay(this.isReadyToPayRequest).then(function(response){response.result&&(response=_this.googleClient.createButton({buttonColor:"default",buttonType:"plain",buttonRadius:4,buttonSizeMode:"fill",onClick:function(){return _this.makePayment(invoiceData,getViewContainer)}}),buttonContainer.appendChild(response))})["catch"](ProcessOut.DynamicCheckoutEventsUtils.dispatchGooglePayLoadError)},GooglePayClient.prototype.makePayment=function(invoiceData,getViewContainer){var _this=this;this.googleClient.loadPaymentData(this.paymentRequest).then(function(paymentData){var paymentData=new ProcessOut.PaymentToken(ProcessOut.TokenType.GooglePay,JSON.parse(paymentData.paymentMethodData.tokenizationData.token)),processOutInstance=_this.processOutInstance;processOutInstance.tokenize(paymentData,{},function(token){ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentSuccessEvent(token),processOutInstance.makeCardPayment(invoiceData.id,token,{authorize_only:!0},function(invoiceId){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentSuccessView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({invoiceId:invoiceId,returnUrl:this.paymentConfig.invoiceDetails.return_url})},function(error){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)})},function(err){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentErrorEvent({message:"Tokenize payment error: ".concat(JSON.stringify(err,undefined,2))})})})["catch"](ProcessOut.DynamicCheckoutEventsUtils.dispatchGooglePayLoadError)},GooglePayClient.prototype.prepareIsReadyToPayRequest=function(invoiceData){invoiceData=this.getGooglePayMethodData(invoiceData);invoiceData&&(this.isReadyToPayRequest={apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:invoiceData.googlepay.allowed_auth_methods,allowedCardNetworks:invoiceData.googlepay.allowed_card_networks},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:invoiceData.googlepay.gateway,gatewayMerchantId:invoiceData.googlepay.gateway_merchant_id}}}]})},GooglePayClient.prototype.preparePaymentRequest=function(invoiceData){var googlePayMethod=this.getGooglePayMethodData(invoiceData);googlePayMethod&&(this.paymentRequest={apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:googlePayMethod.googlepay.allowed_auth_methods,allowedCardNetworks:googlePayMethod.googlepay.allowed_card_networks},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:googlePayMethod.googlepay.gateway,gatewayMerchantId:googlePayMethod.googlepay.gateway_merchant_id}}}],transactionInfo:{totalPriceStatus:"FINAL",totalPrice:invoiceData.amount,currencyCode:invoiceData.currency},merchantInfo:{merchantName:invoiceData.name}})},GooglePayClient.prototype.getGooglePayMethodData=function(invoiceData){var googlePayMethod;return invoiceData.payment_methods.forEach(function(paymentMethod){"googlepay"===paymentMethod.type&&(googlePayMethod=paymentMethod)}),googlePayMethod},GooglePayClient}();ProcessOut.GooglePayClient=GooglePayClient}(ProcessOut=ProcessOut||{}),function(){for(var buttons=document.querySelectorAll(".processout-modal-button"),i=0;i>8-i%1*8)){if(255<(n=a.charCodeAt(i+=.75)))throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return d}),r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,"");if(o.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,a,i=0,c=0,d="";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)&&(d+=String.fromCharCode(255&n>>(-2*i&6))))a=e.indexOf(a);return d})}(),"function"!=typeof Object.assign&&(Object.assign=function(a,b){"use strict";if(null==a)throw new TypeError("Cannot convert undefined or null to object");for(var c=Object(a),d=1;d=format[currentBlock]){if(currentBlockChar=0,++currentBlock>=format.length)break;formatted+=" "}formatted+=number[i],currentBlockChar++}return formatted},Card.parseNumber=function(number){return String(number.replace(/ /gi,"").replace(/\-/gi,"").replace(/\-/gi,""))},Card.validateNumber=function(number,limit){return!((number=Card.parseNumber(number)).lengthlimit[1])&&Card.luhn(number)?null:new ProcessOut.Exception("card.invalid-number")},Card.validateCVC=function(cvc,scheme){if(scheme){if("american-express"===scheme){if(cvc&&!cvc.match(/^\d{4}$/g))return new ProcessOut.Exception("card.invalid-cvc")}else if(cvc&&!cvc.match(/^\d{3}$/g))return new ProcessOut.Exception("card.invalid-cvc")}else if(cvc&&!cvc.match(/^\d{3,4}$/g))return new ProcessOut.Exception("card.invalid-cvc");return null},Card.getIIN=function(number){var l=(number=Card.parseNumber(number)).length;return number.substring(0,l=6option.length?option:iin).length;if(iin.substring(0,l)==option.toString().substring(0,l)){matches.push(scheme);break}}}return matches},Card}());ProcessOut.Card=Card}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.CardFieldValue=function CardFieldValue(){this.number=null,this.expiryMonth=null,this.expiryYear=null,this.cvc=null,this.name=null,this.metadata=null};var CardFieldOptions=function(){function CardFieldOptions(type){this.expiryAutoNext=!0,this.cardNumberAutoNext=!0,this.type=type}return CardFieldOptions.prototype.apply=function(o){return o.placeholder&&(this.placeholder=o.placeholder),o.style&&(this.style=o.style),null!=o.requireCVC&&(this.requireCVC=o.requireCVC),o.expiryAutoNext!==undefined&&null!==o.expiryAutoNext&&(this.expiryAutoNext=o.expiryAutoNext),o.cardNumberAutoNext!==undefined&&null!==o.cardNumberAutoNext&&(this.cardNumberAutoNext=o.cardNumberAutoNext),this},CardFieldOptions}(),CardFieldOptions=(ProcessOut.CardFieldOptions=CardFieldOptions,function CardFieldStyle(){}),CardFieldOptions=(ProcessOut.CardFieldStyle=CardFieldOptions,function(){function CardField(instance,form,options,container,success,error){if(this.handlers={},!options||!options.type)throw new ProcessOut.Exception("processout-js.invalid-field-type","Options and a the field type must be provided to setup the field.");if(!container)throw new ProcessOut.Exception("processout-js.undefined-field","The card field for the ".concat(options.type," does not exist in the given container."));if(container instanceof HTMLInputElement)throw new ProcessOut.Exception("processout-js.invalid-field","The card field for the ".concat(options.type," must be an input field."));if(options.type!=CardField.number&&options.type!=CardField.expiry&&options.type!=CardField.expiryMonth&&options.type!=CardField.expiryYear&&options.type!=CardField.cvc)throw new ProcessOut.Exception("processout-js.invalid-field-type");this.instance=instance,this.form=form,this.options=options,this.el=container;instance=this.el.getAttribute("data-processout-placeholder");instance&&(this.options.placeholder=instance),this.spawn(success,error)}return CardField.prototype.spawn=function(success,error){var tmp=Math.random().toString(36).substring(7),endpoint=(this.uid="#".concat(tmp),this.instance.getProcessOutFieldEndpoint("?r=".concat(tmp).concat(this.uid))),errored=(this.iframe=document.createElement("iframe"),this.iframe.className="processout-field-cc-iframe",this.iframe.name=tmp,this.iframe.setAttribute("src",endpoint),this.iframe.setAttribute("style","background: none; width: 100%;"),this.iframe.setAttribute("frameborder","0"),this.iframe.setAttribute("allowtransparency","1"),this.iframe.style.display="none",!(this.iframe.height="14px")),iframeError=setTimeout(function(){errored=!0,typeof error==typeof Function&&error(new ProcessOut.Exception("processout-js.field.unavailable"))},CardField.timeout);this.iframe.onload=function(){try{navigator.userAgent.match(/firefox|fxios/i)&&this.iframe.contentWindow.location.replace(endpoint)}catch(e){}}.bind(this),window.addEventListener("message",function(event){errored||(event=ProcessOut.Message.parseEvent(event)).frameID==this.uid&&event.namespace==ProcessOut.Message.fieldNamespace&&(this.handlEvent(event),"alive"==event.action&&this.iframe.contentWindow.postMessage(JSON.stringify({namespace:ProcessOut.Message.fieldNamespace,projectID:this.instance.getProjectID(),action:"setup",formID:this.form.getUID(),data:this.options}),"*"),"ready"==event.action)&&(this.iframe.style.display="block",clearTimeout(iframeError),success(),this.iframe.contentWindow.postMessage(JSON.stringify({namespace:ProcessOut.Message.fieldNamespace,projectID:this.instance.getProjectID(),action:"resize"}),"*"),this.iframe.addEventListener("focus",function(event){this.focus()}.bind(this)))}.bind(this)),this.el.appendChild(this.iframe)},CardField.prototype.handlEvent=function(data){var d={field:this,type:this.options.type,element:this.el,data:data.data};switch(data.action){case"inputEvent":this.eventCallback&&this.eventCallback("oninput",d);break;case"mouseEnterEvent":this.eventCallback&&this.eventCallback("onmouseenter",d);break;case"mouseLeaveEvent":this.eventCallback&&this.eventCallback("onmouseleave",d);break;case"focusEvent":this.el.className=this.el.className+" processout-input-focused",this.eventCallback&&this.eventCallback("onfocus",d);break;case"blurEvent":this.el.className=this.el.className.replace(/\bprocessout-input-focused\b/g,"").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),this.eventCallback&&this.eventCallback("onblur",d);break;case"next":this.next&&this.next();break;case"event":if(data.data.name in this.handlers)for(var handlers=this.handlers[data.data.name],i=0;i=this.paymentConfig.pollingMaxTimeout},NativeApm.prototype.handleCaptureSuccess=function(data){if(data.success&&data.native_apm&&"PENDING_CAPTURE"===data.native_apm.state&&!this.checkIfCaptureTimeout())return this.capturePayment();if(data.success&&data.native_apm&&"PENDING_CAPTURE"===data.native_apm.state&&this.checkIfCaptureTimeout())return this.captureStart=null,ProcessOut.EventsUtils.dispatchPaymentErrorEvent(data);var errorView;if(!data.success)return this.captureStart=null,errorView=new ProcessOut.NativeApmErrorView(this.gatewayConfiguration.native_apm,this.theme),ProcessOut.EventsUtils.dispatchPaymentErrorEvent(data),this.loadView(errorView.getViewElement());this.captureStart=null;data=new ProcessOut.NativeApmSuccessView(this.gatewayConfiguration,this.markdownLibraryInstance,this.theme);return ProcessOut.EventsUtils.dispatchPaymentSuccessEvent({returnUrl:this.paymentConfig.returnUrl}),this.loadView(data.getViewElement())},NativeApm.prototype.handleCaptureError=function(req,e,errorCode){var errorView=new ProcessOut.NativeApmErrorView(this.gatewayConfiguration.native_apm,this.theme),errorData=req.response;!req.response&&errorCode&&(errorData={success:!1,error_type:errorCode,message:ProcessOut.Translator.translateError(errorCode)}),ProcessOut.EventsUtils.dispatchPaymentErrorEvent(errorData),this.loadView(errorView.getViewElement())},NativeApm.prototype.setTheme=function(themeConfig){return this.theme.setTheme(themeConfig)},NativeApm.prototype.prefillData=function(data){this.prefilledData=data},NativeApm.prototype.loadView=function(view){this.widgetWrapper&&this.napmContainer.removeChild(this.widgetWrapper),this.widgetWrapper=this.createWidgetWrapper(),this.widgetWrapper.appendChild(view),this.napmContainer.appendChild(this.widgetWrapper)},NativeApm.prototype.updatePaymentProviderLogo=function(logoUrl){logoUrl&&(this.gatewayConfiguration=__assign(__assign({},this.gatewayConfiguration),{native_apm:__assign(__assign({},this.gatewayConfiguration.native_apm),{gateway:__assign(__assign({},this.gatewayConfiguration.native_apm.gateway),{logo_url:logoUrl})})}))},NativeApm.prototype.createWidgetWrapper=function(){var widgetWrapper=document.createElement("div"),styleElement=this.theme.createInitialStyleTag();return widgetWrapper.setAttribute("class","native-apm-widget-wrapper"),widgetWrapper.appendChild(styleElement),ProcessOut.StylesUtils.styleElement(widgetWrapper,this.theme.wrapper),widgetWrapper},NativeApm.prototype.loadMarkdownLibrary=function(){var _this=this,markdownScript=document.createElement("script");markdownScript.src="https://js.processout.com/js/libraries/showdown.min.js",markdownScript.onload=function(){_this.markdownLibraryInstance=window.globalThis&&window.globalThis.showdown?new window.globalThis.showdown.Converter:null},document.head.appendChild(markdownScript)},NativeApm.prototype.loadQrCodesLibrary=function(){var qrCodeScript=document.createElement("script");qrCodeScript.src="https://js.processout.com/js/libraries/qrcode.min.js",document.head.appendChild(qrCodeScript)},NativeApm}();ProcessOut.NativeApm=NativeApm}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var NativeApmPaymentConfig=function(){function NativeApmPaymentConfig(config){this.setConfig(config)}return NativeApmPaymentConfig.prototype.getConfig=function(){return{gatewayConfigurationId:this.gatewayConfigurationId,invoiceId:this.invoiceId,returnUrl:this.returnUrl,pollingMaxTimeout:this.pollingMaxTimeout}},NativeApmPaymentConfig.prototype.setConfig=function(config){if(!this.isValidConfig(config))throw new ProcessOut.Exception("default","You must instantiate Native APM with a valid config in order to use it");this.gatewayConfigurationId=config.gatewayConfigurationId,this.invoiceId=config.invoiceId,this.returnUrl=config.returnUrl,this.pollingMaxTimeout=config.pollingMaxTimeout||180},NativeApmPaymentConfig.prototype.isValidConfig=function(config){return config.gatewayConfigurationId&&config.invoiceId},NativeApmPaymentConfig}();ProcessOut.NativeApmPaymentConfig=NativeApmPaymentConfig}(ProcessOut=ProcessOut||{}),{wrapper:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",width:"100%",fontSize:"1rem"},spinner:{width:"4rem",height:"4rem",border:"5px solid #f2f2f2",borderBottomColor:"#7e57c2",borderRadius:"50%",display:"inline-block",boxSizing:"border-box",animation:"rotation 1s linear infinite"},logo:{width:"10rem",height:"auto",marginBottom:"1rem"},buttons:{"default":{borderWidth:"0px",color:"#fff",backgroundColor:"#7e57c2",cursor:"pointer",padding:"0.8rem 1.5rem",display:"flex",justifyContent:"center",alignItems:"center",position:"relative",marginTop:"0.8rem",fontSize:"1rem",borderRadius:"5px"},spinner:{position:"absolute",width:"1rem",height:"1rem",border:"3px solid #f2f2f2",borderBottomColor:"#7e57c2",borderRadius:"50%",display:"inline-block",boxSizing:"border-box",animation:"rotation 1s linear infinite"}},form:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.8rem",width:"100%",inputsWrapper:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"0.8rem",alignItems:"center",width:"100%"},inputs:{wrapper:{width:"inherit"},text:{padding:"0 0.8rem",height:"3rem",border:"1px solid #d7d7d7",borderRadius:"5px",width:"100%",fontSize:"1rem"},select:{height:"3rem",width:"100%",border:"1px solid #d7d7d7",borderRadius:"5px",fontSize:"1rem"},numeric:{display:"flex",flexDirection:"row",gap:"0.8rem",character:{width:"3rem",height:"3rem",fontSize:"1.5rem",border:"1px solid #d7d7d7",borderRadius:"5px",textAlign:"center"}}},labels:{display:"block",marginBottom:"10px",requiredStar:{color:"#e74c3c",marginLeft:"0.1rem"}},errors:{display:"block",color:"#e74c3c",fontSize:"0.9rem",minHeight:"1rem",marginTop:"0.3rem",width:"100%"}},message:{fontSize:"1.1rem"},actionImage:{marginTop:"1.3rem",marginBottom:"1.3rem",width:"15rem",height:"auto",display:"flex",justifyContent:"center",alignItems:"center"}}),spinnerLoadingAnimation="\n@keyframes rotation {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n",defaultStyles=(!function(ProcessOut){var NativeApmThemeConfig=function(){function NativeApmThemeConfig(){this.wrapper=defaultTheme.wrapper,this.spinner=defaultTheme.spinner,this.logo=defaultTheme.logo,this.buttons=defaultTheme.buttons,this.form=defaultTheme.form,this.message=defaultTheme.message,this.actionImage=defaultTheme.actionImage}return NativeApmThemeConfig.prototype.getTheme=function(){return{wrapper:this.wrapper,spinner:this.spinner,logo:this.logo,buttons:this.buttons,form:this.form,message:this.message,actionImage:this.actionImage}},NativeApmThemeConfig.prototype.setTheme=function(theme){var mergeObjects=function(obj1,obj2){for(var key in obj2)obj2.hasOwnProperty(key)&&("object"==typeof obj2[key]&&null!==obj2[key]?obj1[key]=mergeObjects(obj1[key],obj2[key]):obj1[key]=obj2[key]);return obj1};mergeObjects(this.wrapper,theme.wrapper),mergeObjects(this.spinner,theme.spinner),mergeObjects(this.logo,theme.logo),mergeObjects(this.buttons,theme.buttons),mergeObjects(this.form,theme.form),mergeObjects(this.message,theme.message),mergeObjects(this.actionImage,theme.actionImage)},NativeApmThemeConfig.prototype.createInitialStyleTag=function(){var styleElement=document.createElement("style");return styleElement.innerHTML=spinnerLoadingAnimation,styleElement},NativeApmThemeConfig}();ProcessOut.NativeApmThemeConfig=NativeApmThemeConfig}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var StylesUtils=function(){function StylesUtils(){}return StylesUtils.styleElement=function(node,styles){return Object.keys(styles).forEach(function(style){node.style[style]=styles[style]})},StylesUtils}();ProcessOut.StylesUtils=StylesUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.NATIVE_APM_EVENTS={WIDGET_LOADING:"processout_native_apm_loading",WIDGET_READY:"processout_native_apm_ready",GATEWAY_CONFIGURATION_ERROR:"processout_native_apm_gateway_configuration_error",PAYMENT_INIT:"processout_native_apm_payment_init",PAYMENT_ADDITIONAL_INPUT:"processout_native_apm_payment_additional_input",PAYMENT_SUCCESS:"processout_native_apm_payment_success",PAYMENT_ERROR:"processout_native_apm_payment_error"};var EventsUtils=function(){function EventsUtils(){}return EventsUtils.dispatchGatewayConfigurationErrorEvent=function(errorData){errorData=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.GATEWAY_CONFIGURATION_ERROR,errorData);return window.dispatchEvent(errorData)},EventsUtils.dispatchPaymentInitEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_INIT);return window.dispatchEvent(event)},EventsUtils.dispatchWidgetLoadingEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.WIDGET_LOADING);return window.dispatchEvent(event)},EventsUtils.dispatchWidgetReadyEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.WIDGET_READY);return window.dispatchEvent(event)},EventsUtils.dispatchPaymentAdditionalInputEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_ADDITIONAL_INPUT);return window.dispatchEvent(event)},EventsUtils.dispatchPaymentSuccessEvent=function(data){data=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_SUCCESS,data);return window.dispatchEvent(data)},EventsUtils.dispatchPaymentErrorEvent=function(errorData){errorData=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_ERROR,errorData);return window.dispatchEvent(errorData)},EventsUtils.createEvent=function(eventName,data){var event_1;return"function"==typeof window.CustomEvent?new CustomEvent(eventName,{bubbles:!0,detail:data}):((event_1=document.createEvent("CustomEvent")).initCustomEvent(eventName,!0,!1,data),event_1)},EventsUtils}();ProcessOut.EventsUtils=EventsUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.texts={en:{invalidCode:"Code is not valid.",invalidPhoneNumber:"Phone number is not valid.",invalidTextValue:"Value is not valid.",invalidEmail:"Email is not valid.",phoneNumberPlaceholder:"Enter phone number",phoneNumberLabel:"Phone number",emailPlaceholder:"name@exmple.com",submitButtonText:"Pay",paymentSuccessMessage:"Success!\nPayment approved.",genericError:"Something went wrong, please try again.",paymentTimeout:"The payment was not confirmed in time in the banking application. Please try again."},pl:{invalidCode:"Niepoprawny kod.",invalidPhoneNumber:"Niepoprawny numer telefonu.",invalidTextValue:"Niepoprawna wartość.",invalidEmail:"Niepoprawny adres email.",phoneNumberPlaceholder:"Twój numer telefonu",phoneNumberLabel:"Numer telefonu",emailPlaceholder:"imię@przykład.pl",submitButtonText:"Zapłać",paymentSuccessMessage:"Sukces!\nPłatność przyjęta.",genericError:"Coś poszło nie tak, spróbuj ponownie.",paymentTimeout:"Płatność odrzucona. Czas na potwierdzenie transakcji został przekroczony. Spróbuj ponownie."},pt:{invalidCode:"Número inválido.",invalidPhoneNumber:"Número de telemóvel inválido.",invalidTextValue:"Texto inválido.",invalidEmail:"Endereço de e-mail inválido.",phoneNumberPlaceholder:"Insira o seu número de telemóvel",phoneNumberLabel:"Nº de telemóvel",emailPlaceholder:"nome@exemplo.pt",submitButtonText:"Pagar",paymentSuccessMessage:"Successo!\nPagamento aprovado.",genericError:"Ocorreu um erro ao processar o seu cartão, por favor tente novamente.",paymentTimeout:"O pagamento não foi confirmado a tempo no aplicativo bancário. Por favor, tente novamente."},fr:{invalidCode:"Numéro invalide.",invalidPhoneNumber:"Votre numéro de téléphone est invalide.",invalidTextValue:"Valeur invalide.",invalidEmail:"Votre adresse e-mail est invalide.",phoneNumberPlaceholder:"Entrez votre numéro de téléphone",phoneNumberLabel:"Numéro de téléphone",emailPlaceholder:"nom@exemple.fr",submitButtonText:"Payer",paymentSuccessMessage:"Succès!\nPaiement confirmé.",genericError:"Une erreur s’est produite, veuillez réessayer.",paymentTimeout:"Le paiement n'a pas été confirmé à temps dans l'application bancaire. Veuillez réessayer."}};var TextUtils=function(){function TextUtils(){}return TextUtils.getText=function(key){var locale=ProcessOut.Translator.getLocale(),locale=ProcessOut.texts.hasOwnProperty(locale)?locale:"en";return ProcessOut.texts[locale][key]||""},TextUtils}();ProcessOut.TextUtils=TextUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var ErrorsUtils=function(){function ErrorsUtils(){}return ErrorsUtils.isFieldsValidationError=function(errorData){var error_type=errorData.error_type,errorData=errorData.invalid_fields;return("request.validation.error"===error_type||"gateway.invalid-customer-input"===error_type)&&0',initializeApplePay(invoiceData,buttonContainer,getViewContainer)},document.head.appendChild(applePayScript)},ApplePayClient.prototype.initializeApplePay=function(invoiceData,buttonContainer,getViewContainer){var tokenizeApplePay=this.tokenizeApplePay.bind(this),applePayPaymentMethodData=this.getApplePayPaymentMethodData(invoiceData);this.processOutInstance.applePay.checkAvailability(function(err){err?console.log(err):(buttonContainer.classList.add("visible"),document.querySelector("apple-pay-button").addEventListener("click",function(){tokenizeApplePay(invoiceData,getViewContainer)}))},{merchantApplePayCertificateId:applePayPaymentMethodData.merchant_id})},ApplePayClient.prototype.getSupportedNetworks=function(invoiceData){var supportedNetworks=[];return this.getApplePayPaymentMethodData(invoiceData).supported_networks.forEach(function(network){ProcessOut.networksMap[network]&&supportedNetworks.push(ProcessOut.networksMap[network])}),supportedNetworks},ApplePayClient.prototype.createApplePaySession=function(invoiceData){var supportedNetworks=this.getSupportedNetworks(invoiceData),applePayPaymentMethodData=this.getApplePayPaymentMethodData(invoiceData),invoiceData=this.processOutInstance.applePay.newSession({total:{label:invoiceData.name,amount:invoiceData.amount},currencyCode:invoiceData.currency,countryCode:applePayPaymentMethodData.country_code,supportedNetworks:supportedNetworks,merchantCapabilities:applePayPaymentMethodData.merchant_capabilities,merchantApplePayCertificateId:applePayPaymentMethodData.merchant_id,applePaySessionVersion:14},ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePayNewSessionEvent,ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePaySessionError);return invoiceData.onpaymentauthorizedPostprocess=ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePayAuthorizedPostProcessEvent,invoiceData},ApplePayClient.prototype.tokenizeApplePay=function(invoiceData,getViewContainer){var session=this.createApplePaySession(invoiceData),makeApplePayPayment=this.makeApplePayPayment.bind(this);this.processOutInstance.tokenize(session,{},function(card){session.completePayment(0),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentSuccessEvent(card);card=card.id;makeApplePayPayment(card,invoiceData,getViewContainer)},function(err){session.completePayment(1),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentErrorEvent(err),getViewContainer().innerHTML='\n
\n Something went wrong. Please try again.\n
\n '})},ApplePayClient.prototype.makeApplePayPayment=function(cardToken,invoiceData,getViewContainer){this.processOutInstance.makeCardPayment(invoiceData.id,cardToken,{authorize_only:!0},function(invoiceId){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentSuccessView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({invoiceId:invoiceId,returnUrl:this.paymentConfig.invoiceDetails.return_url})},function(error){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)})},ApplePayClient.prototype.getApplePayPaymentMethodData=function(invoiceData){var applePayPaymentMethodData;return invoiceData.payment_methods.forEach(function(method){"applepay"===method.type&&(applePayPaymentMethodData=method.applepay)}),applePayPaymentMethodData},ApplePayClient}();ProcessOut.ApplePayClient=ApplePayClient}(ProcessOut=ProcessOut||{}),function(ProcessOut){var GooglePayClient=function(){function GooglePayClient(processOutInstance){this.processOutInstance=processOutInstance}return GooglePayClient.prototype.loadButton=function(buttonContainer,invoiceData,getViewContainer){var _this=this,googleClientScript=document.createElement("script");googleClientScript.src=ProcessOut.googlePaySdkUrl,googleClientScript.onload=function(){_this.googleClient=window.globalThis&&window.globalThis.google?new window.globalThis.google.payments.api.PaymentsClient({environment:ProcessOut.DEBUG?"TEST":"PRODUCTION"}):null,_this.initizalizeGooglePay(buttonContainer,getViewContainer,invoiceData)},document.head.appendChild(googleClientScript)},GooglePayClient.prototype.initizalizeGooglePay=function(buttonContainer,getViewContainer,invoiceData){var _this=this;this.prepareIsReadyToPayRequest(invoiceData),this.preparePaymentRequest(invoiceData),this.googleClient.isReadyToPay(this.isReadyToPayRequest).then(function(response){response.result&&(response=_this.googleClient.createButton({buttonColor:"default",buttonType:"plain",buttonRadius:4,buttonSizeMode:"fill",onClick:function(){return _this.makePayment(invoiceData,getViewContainer)}}),buttonContainer.appendChild(response))})["catch"](ProcessOut.DynamicCheckoutEventsUtils.dispatchGooglePayLoadError)},GooglePayClient.prototype.makePayment=function(invoiceData,getViewContainer){var _this=this;this.googleClient.loadPaymentData(this.paymentRequest).then(function(paymentData){var paymentData=new ProcessOut.PaymentToken(ProcessOut.TokenType.GooglePay,JSON.parse(paymentData.paymentMethodData.tokenizationData.token)),processOutInstance=_this.processOutInstance;processOutInstance.tokenize(paymentData,{},function(token){ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentSuccessEvent(token),processOutInstance.makeCardPayment(invoiceData.id,token,{authorize_only:!0},function(invoiceId){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentSuccessView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({invoiceId:invoiceId,returnUrl:this.paymentConfig.invoiceDetails.return_url})},function(error){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)})},function(err){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentErrorEvent({message:"Tokenize payment error: ".concat(JSON.stringify(err,undefined,2))})})})["catch"](ProcessOut.DynamicCheckoutEventsUtils.dispatchGooglePayLoadError)},GooglePayClient.prototype.prepareIsReadyToPayRequest=function(invoiceData){invoiceData=this.getGooglePayMethodData(invoiceData);invoiceData&&(this.isReadyToPayRequest={apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:invoiceData.googlepay.allowed_auth_methods,allowedCardNetworks:invoiceData.googlepay.allowed_card_networks},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:invoiceData.googlepay.gateway,gatewayMerchantId:invoiceData.googlepay.gateway_merchant_id}}}]})},GooglePayClient.prototype.preparePaymentRequest=function(invoiceData){var googlePayMethod=this.getGooglePayMethodData(invoiceData);googlePayMethod&&(this.paymentRequest={apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:googlePayMethod.googlepay.allowed_auth_methods,allowedCardNetworks:googlePayMethod.googlepay.allowed_card_networks},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:googlePayMethod.googlepay.gateway,gatewayMerchantId:googlePayMethod.googlepay.gateway_merchant_id}}}],transactionInfo:{totalPriceStatus:"FINAL",totalPrice:invoiceData.amount,currencyCode:invoiceData.currency},merchantInfo:{merchantName:invoiceData.name}})},GooglePayClient.prototype.getGooglePayMethodData=function(invoiceData){var googlePayMethod;return invoiceData.payment_methods.forEach(function(paymentMethod){"googlepay"===paymentMethod.type&&(googlePayMethod=paymentMethod)}),googlePayMethod},GooglePayClient}();ProcessOut.GooglePayClient=GooglePayClient}(ProcessOut=ProcessOut||{}),function(){for(var buttons=document.querySelectorAll(".processout-modal-button"),i=0;i>8-i%1*8)){if(255<(n=a.charCodeAt(i+=.75)))throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return d}),r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,"");if(o.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,a,i=0,c=0,d="";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)&&(d+=String.fromCharCode(255&n>>(-2*i&6))))a=e.indexOf(a);return d})}(),"function"!=typeof Object.assign&&(Object.assign=function(a,b){"use strict";if(null==a)throw new TypeError("Cannot convert undefined or null to object");for(var c=Object(a),d=1;d=format[currentBlock]){if(currentBlockChar=0,++currentBlock>=format.length)break;formatted+=" "}formatted+=number[i],currentBlockChar++}return formatted},Card.parseNumber=function(number){return String(number.replace(/ /gi,"").replace(/\-/gi,"").replace(/\-/gi,""))},Card.validateNumber=function(number,limit){return!((number=Card.parseNumber(number)).lengthlimit[1])&&Card.luhn(number)?null:new ProcessOut.Exception("card.invalid-number")},Card.validateCVC=function(cvc,scheme){if(scheme){if("american-express"===scheme){if(cvc&&!cvc.match(/^\d{4}$/g))return new ProcessOut.Exception("card.invalid-cvc")}else if(cvc&&!cvc.match(/^\d{3}$/g))return new ProcessOut.Exception("card.invalid-cvc")}else if(cvc&&!cvc.match(/^\d{3,4}$/g))return new ProcessOut.Exception("card.invalid-cvc");return null},Card.getIIN=function(number){var l=(number=Card.parseNumber(number)).length;return number.substring(0,l=6option.length?option:iin).length;if(iin.substring(0,l)==option.toString().substring(0,l)){matches.push(scheme);break}}}return matches},Card}());ProcessOut.Card=Card}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.CardFieldValue=function CardFieldValue(){this.number=null,this.expiryMonth=null,this.expiryYear=null,this.cvc=null,this.name=null,this.metadata=null};var CardFieldOptions=function(){function CardFieldOptions(type){this.expiryAutoNext=!0,this.cardNumberAutoNext=!0,this.type=type}return CardFieldOptions.prototype.apply=function(o){return o.placeholder&&(this.placeholder=o.placeholder),o.style&&(this.style=o.style),null!=o.requireCVC&&(this.requireCVC=o.requireCVC),o.expiryAutoNext!==undefined&&null!==o.expiryAutoNext&&(this.expiryAutoNext=o.expiryAutoNext),o.cardNumberAutoNext!==undefined&&null!==o.cardNumberAutoNext&&(this.cardNumberAutoNext=o.cardNumberAutoNext),this},CardFieldOptions}(),CardFieldOptions=(ProcessOut.CardFieldOptions=CardFieldOptions,function CardFieldStyle(){}),CardFieldOptions=(ProcessOut.CardFieldStyle=CardFieldOptions,function(){function CardField(instance,form,options,container,success,error){if(this.handlers={},!options||!options.type)throw new ProcessOut.Exception("processout-js.invalid-field-type","Options and a the field type must be provided to setup the field.");if(!container)throw new ProcessOut.Exception("processout-js.undefined-field","The card field for the ".concat(options.type," does not exist in the given container."));if(container instanceof HTMLInputElement)throw new ProcessOut.Exception("processout-js.invalid-field","The card field for the ".concat(options.type," must be an input field."));if(options.type!=CardField.number&&options.type!=CardField.expiry&&options.type!=CardField.expiryMonth&&options.type!=CardField.expiryYear&&options.type!=CardField.cvc)throw new ProcessOut.Exception("processout-js.invalid-field-type");this.instance=instance,this.form=form,this.options=options,this.el=container;instance=this.el.getAttribute("data-processout-placeholder");instance&&(this.options.placeholder=instance),this.spawn(success,error)}return CardField.prototype.spawn=function(success,error){var tmp=Math.random().toString(36).substring(7),endpoint=(this.uid="#".concat(tmp),this.instance.getProcessOutFieldEndpoint("?r=".concat(tmp).concat(this.uid))),errored=(this.iframe=document.createElement("iframe"),this.iframe.className="processout-field-cc-iframe",this.iframe.name=tmp,this.iframe.setAttribute("src",endpoint),this.iframe.setAttribute("style","background: none; width: 100%;"),this.iframe.setAttribute("frameborder","0"),this.iframe.setAttribute("allowtransparency","1"),this.iframe.style.display="none",!(this.iframe.height="14px")),iframeError=setTimeout(function(){errored=!0,typeof error==typeof Function&&error(new ProcessOut.Exception("processout-js.field.unavailable"))},CardField.timeout);this.iframe.onload=function(){try{navigator.userAgent.match(/firefox|fxios/i)&&this.iframe.contentWindow.location.replace(endpoint)}catch(e){}}.bind(this),window.addEventListener("message",function(event){errored||(event=ProcessOut.Message.parseEvent(event)).frameID==this.uid&&event.namespace==ProcessOut.Message.fieldNamespace&&(this.handlEvent(event),"alive"==event.action&&this.iframe.contentWindow.postMessage(JSON.stringify({namespace:ProcessOut.Message.fieldNamespace,projectID:this.instance.getProjectID(),action:"setup",formID:this.form.getUID(),data:this.options}),"*"),"ready"==event.action)&&(this.iframe.style.display="block",clearTimeout(iframeError),success(),this.iframe.contentWindow.postMessage(JSON.stringify({namespace:ProcessOut.Message.fieldNamespace,projectID:this.instance.getProjectID(),action:"resize"}),"*"),this.iframe.addEventListener("focus",function(event){this.focus()}.bind(this)))}.bind(this)),this.el.appendChild(this.iframe)},CardField.prototype.handlEvent=function(data){var d={field:this,type:this.options.type,element:this.el,data:data.data};switch(data.action){case"inputEvent":this.eventCallback&&this.eventCallback("oninput",d);break;case"mouseEnterEvent":this.eventCallback&&this.eventCallback("onmouseenter",d);break;case"mouseLeaveEvent":this.eventCallback&&this.eventCallback("onmouseleave",d);break;case"focusEvent":this.el.className=this.el.className+" processout-input-focused",this.eventCallback&&this.eventCallback("onfocus",d);break;case"blurEvent":this.el.className=this.el.className.replace(/\bprocessout-input-focused\b/g,"").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),this.eventCallback&&this.eventCallback("onblur",d);break;case"next":this.next&&this.next();break;case"event":if(data.data.name in this.handlers)for(var handlers=this.handlers[data.data.name],i=0;i=this.paymentConfig.pollingMaxTimeout},NativeApm.prototype.handleCaptureSuccess=function(data){if(data.success&&data.native_apm&&"PENDING_CAPTURE"===data.native_apm.state&&!this.checkIfCaptureTimeout())return this.capturePayment();if(data.success&&data.native_apm&&"PENDING_CAPTURE"===data.native_apm.state&&this.checkIfCaptureTimeout())return this.captureStart=null,ProcessOut.EventsUtils.dispatchPaymentErrorEvent(data);var errorView;if(!data.success)return this.captureStart=null,errorView=new ProcessOut.NativeApmErrorView(this.gatewayConfiguration.native_apm,this.theme),ProcessOut.EventsUtils.dispatchPaymentErrorEvent(data),this.loadView(errorView.getViewElement());this.captureStart=null;data=new ProcessOut.NativeApmSuccessView(this.gatewayConfiguration,this.markdownLibraryInstance,this.theme);return ProcessOut.EventsUtils.dispatchPaymentSuccessEvent({returnUrl:this.paymentConfig.returnUrl}),this.loadView(data.getViewElement())},NativeApm.prototype.handleCaptureError=function(req,e,errorCode){var errorView=new ProcessOut.NativeApmErrorView(this.gatewayConfiguration.native_apm,this.theme),errorData=req.response;!req.response&&errorCode&&(errorData={success:!1,error_type:errorCode,message:ProcessOut.Translator.translateError(errorCode)}),ProcessOut.EventsUtils.dispatchPaymentErrorEvent(errorData),this.loadView(errorView.getViewElement())},NativeApm.prototype.setTheme=function(themeConfig){return this.theme.setTheme(themeConfig)},NativeApm.prototype.prefillData=function(data){this.prefilledData=data},NativeApm.prototype.loadView=function(view){this.widgetWrapper&&this.napmContainer.removeChild(this.widgetWrapper),this.widgetWrapper=this.createWidgetWrapper(),this.widgetWrapper.appendChild(view),this.napmContainer.appendChild(this.widgetWrapper)},NativeApm.prototype.updatePaymentProviderLogo=function(logoUrl){logoUrl&&(this.gatewayConfiguration=__assign(__assign({},this.gatewayConfiguration),{native_apm:__assign(__assign({},this.gatewayConfiguration.native_apm),{gateway:__assign(__assign({},this.gatewayConfiguration.native_apm.gateway),{logo_url:logoUrl})})}))},NativeApm.prototype.createWidgetWrapper=function(){var widgetWrapper=document.createElement("div"),styleElement=this.theme.createInitialStyleTag();return widgetWrapper.setAttribute("class","native-apm-widget-wrapper"),widgetWrapper.appendChild(styleElement),ProcessOut.StylesUtils.styleElement(widgetWrapper,this.theme.wrapper),widgetWrapper},NativeApm.prototype.loadMarkdownLibrary=function(){var _this=this,markdownScript=document.createElement("script");markdownScript.src="https://js.processout.com/js/libraries/showdown.min.js",markdownScript.onload=function(){_this.markdownLibraryInstance=window.globalThis&&window.globalThis.showdown?new window.globalThis.showdown.Converter:null},document.head.appendChild(markdownScript)},NativeApm.prototype.loadQrCodesLibrary=function(){var qrCodeScript=document.createElement("script");qrCodeScript.src="https://js.processout.com/js/libraries/qrcode.min.js",document.head.appendChild(qrCodeScript)},NativeApm}();ProcessOut.NativeApm=NativeApm}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var NativeApmPaymentConfig=function(){function NativeApmPaymentConfig(config){this.setConfig(config)}return NativeApmPaymentConfig.prototype.getConfig=function(){return{gatewayConfigurationId:this.gatewayConfigurationId,invoiceId:this.invoiceId,returnUrl:this.returnUrl,pollingMaxTimeout:this.pollingMaxTimeout}},NativeApmPaymentConfig.prototype.setConfig=function(config){if(!this.isValidConfig(config))throw new ProcessOut.Exception("default","You must instantiate Native APM with a valid config in order to use it");this.gatewayConfigurationId=config.gatewayConfigurationId,this.invoiceId=config.invoiceId,this.returnUrl=config.returnUrl,this.pollingMaxTimeout=config.pollingMaxTimeout||180},NativeApmPaymentConfig.prototype.isValidConfig=function(config){return config.gatewayConfigurationId&&config.invoiceId},NativeApmPaymentConfig}();ProcessOut.NativeApmPaymentConfig=NativeApmPaymentConfig}(ProcessOut=ProcessOut||{}),{wrapper:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",width:"100%",fontSize:"1rem"},spinner:{width:"4rem",height:"4rem",border:"5px solid #f2f2f2",borderBottomColor:"#7e57c2",borderRadius:"50%",display:"inline-block",boxSizing:"border-box",animation:"rotation 1s linear infinite"},logo:{width:"10rem",height:"auto",marginBottom:"1rem"},buttons:{"default":{borderWidth:"0px",color:"#fff",backgroundColor:"#7e57c2",cursor:"pointer",padding:"0.8rem 1.5rem",display:"flex",justifyContent:"center",alignItems:"center",position:"relative",marginTop:"0.8rem",fontSize:"1rem",borderRadius:"5px"},spinner:{position:"absolute",width:"1rem",height:"1rem",border:"3px solid #f2f2f2",borderBottomColor:"#7e57c2",borderRadius:"50%",display:"inline-block",boxSizing:"border-box",animation:"rotation 1s linear infinite"}},form:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.8rem",width:"100%",inputsWrapper:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"0.8rem",alignItems:"center",width:"100%"},inputs:{wrapper:{width:"inherit"},text:{padding:"0 0.8rem",height:"3rem",border:"1px solid #d7d7d7",borderRadius:"5px",width:"100%",fontSize:"1rem"},select:{height:"3rem",width:"100%",border:"1px solid #d7d7d7",borderRadius:"5px",fontSize:"1rem"},numeric:{display:"flex",flexDirection:"row",gap:"0.8rem",character:{width:"3rem",height:"3rem",fontSize:"1.5rem",border:"1px solid #d7d7d7",borderRadius:"5px",textAlign:"center"}}},labels:{display:"block",marginBottom:"10px",requiredStar:{color:"#e74c3c",marginLeft:"0.1rem"}},errors:{display:"block",color:"#e74c3c",fontSize:"0.9rem",minHeight:"1rem",marginTop:"0.3rem",width:"100%"}},message:{fontSize:"1.1rem"},actionImage:{marginTop:"1.3rem",marginBottom:"1.3rem",width:"15rem",height:"auto",display:"flex",justifyContent:"center",alignItems:"center"}}),spinnerLoadingAnimation="\n@keyframes rotation {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n",defaultStyles=(!function(ProcessOut){var NativeApmThemeConfig=function(){function NativeApmThemeConfig(){this.wrapper=defaultTheme.wrapper,this.spinner=defaultTheme.spinner,this.logo=defaultTheme.logo,this.buttons=defaultTheme.buttons,this.form=defaultTheme.form,this.message=defaultTheme.message,this.actionImage=defaultTheme.actionImage}return NativeApmThemeConfig.prototype.getTheme=function(){return{wrapper:this.wrapper,spinner:this.spinner,logo:this.logo,buttons:this.buttons,form:this.form,message:this.message,actionImage:this.actionImage}},NativeApmThemeConfig.prototype.setTheme=function(theme){var mergeObjects=function(obj1,obj2){for(var key in obj2)obj2.hasOwnProperty(key)&&("object"==typeof obj2[key]&&null!==obj2[key]?obj1[key]=mergeObjects(obj1[key],obj2[key]):obj1[key]=obj2[key]);return obj1};mergeObjects(this.wrapper,theme.wrapper),mergeObjects(this.spinner,theme.spinner),mergeObjects(this.logo,theme.logo),mergeObjects(this.buttons,theme.buttons),mergeObjects(this.form,theme.form),mergeObjects(this.message,theme.message),mergeObjects(this.actionImage,theme.actionImage)},NativeApmThemeConfig.prototype.createInitialStyleTag=function(){var styleElement=document.createElement("style");return styleElement.innerHTML=spinnerLoadingAnimation,styleElement},NativeApmThemeConfig}();ProcessOut.NativeApmThemeConfig=NativeApmThemeConfig}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var StylesUtils=function(){function StylesUtils(){}return StylesUtils.styleElement=function(node,styles){return Object.keys(styles).forEach(function(style){node.style[style]=styles[style]})},StylesUtils}();ProcessOut.StylesUtils=StylesUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.NATIVE_APM_EVENTS={WIDGET_LOADING:"processout_native_apm_loading",WIDGET_READY:"processout_native_apm_ready",GATEWAY_CONFIGURATION_ERROR:"processout_native_apm_gateway_configuration_error",PAYMENT_INIT:"processout_native_apm_payment_init",PAYMENT_ADDITIONAL_INPUT:"processout_native_apm_payment_additional_input",PAYMENT_SUCCESS:"processout_native_apm_payment_success",PAYMENT_ERROR:"processout_native_apm_payment_error"};var EventsUtils=function(){function EventsUtils(){}return EventsUtils.dispatchGatewayConfigurationErrorEvent=function(errorData){errorData=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.GATEWAY_CONFIGURATION_ERROR,errorData);return window.dispatchEvent(errorData)},EventsUtils.dispatchPaymentInitEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_INIT);return window.dispatchEvent(event)},EventsUtils.dispatchWidgetLoadingEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.WIDGET_LOADING);return window.dispatchEvent(event)},EventsUtils.dispatchWidgetReadyEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.WIDGET_READY);return window.dispatchEvent(event)},EventsUtils.dispatchPaymentAdditionalInputEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_ADDITIONAL_INPUT);return window.dispatchEvent(event)},EventsUtils.dispatchPaymentSuccessEvent=function(data){data=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_SUCCESS,data);return window.dispatchEvent(data)},EventsUtils.dispatchPaymentErrorEvent=function(errorData){errorData=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_ERROR,errorData);return window.dispatchEvent(errorData)},EventsUtils.createEvent=function(eventName,data){var event_1;return"function"==typeof window.CustomEvent?new CustomEvent(eventName,{bubbles:!0,detail:data}):((event_1=document.createEvent("CustomEvent")).initCustomEvent(eventName,!0,!1,data),event_1)},EventsUtils}();ProcessOut.EventsUtils=EventsUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.texts={en:{invalidCode:"Code is not valid.",invalidPhoneNumber:"Phone number is not valid.",invalidTextValue:"Value is not valid.",invalidEmail:"Email is not valid.",phoneNumberPlaceholder:"Enter phone number",phoneNumberLabel:"Phone number",emailPlaceholder:"name@exmple.com",submitButtonText:"Pay",paymentSuccessMessage:"Success!\nPayment approved.",genericError:"Something went wrong, please try again.",paymentTimeout:"The payment was not confirmed in time in the banking application. Please try again."},pl:{invalidCode:"Niepoprawny kod.",invalidPhoneNumber:"Niepoprawny numer telefonu.",invalidTextValue:"Niepoprawna wartość.",invalidEmail:"Niepoprawny adres email.",phoneNumberPlaceholder:"Twój numer telefonu",phoneNumberLabel:"Numer telefonu",emailPlaceholder:"imię@przykład.pl",submitButtonText:"Zapłać",paymentSuccessMessage:"Sukces!\nPłatność przyjęta.",genericError:"Coś poszło nie tak, spróbuj ponownie.",paymentTimeout:"Płatność odrzucona. Czas na potwierdzenie transakcji został przekroczony. Spróbuj ponownie."},pt:{invalidCode:"Número inválido.",invalidPhoneNumber:"Número de telemóvel inválido.",invalidTextValue:"Texto inválido.",invalidEmail:"Endereço de e-mail inválido.",phoneNumberPlaceholder:"Insira o seu número de telemóvel",phoneNumberLabel:"Nº de telemóvel",emailPlaceholder:"nome@exemplo.pt",submitButtonText:"Pagar",paymentSuccessMessage:"Successo!\nPagamento aprovado.",genericError:"Ocorreu um erro ao processar o seu cartão, por favor tente novamente.",paymentTimeout:"O pagamento não foi confirmado a tempo no aplicativo bancário. Por favor, tente novamente."},fr:{invalidCode:"Numéro invalide.",invalidPhoneNumber:"Votre numéro de téléphone est invalide.",invalidTextValue:"Valeur invalide.",invalidEmail:"Votre adresse e-mail est invalide.",phoneNumberPlaceholder:"Entrez votre numéro de téléphone",phoneNumberLabel:"Numéro de téléphone",emailPlaceholder:"nom@exemple.fr",submitButtonText:"Payer",paymentSuccessMessage:"Succès!\nPaiement confirmé.",genericError:"Une erreur s’est produite, veuillez réessayer.",paymentTimeout:"Le paiement n'a pas été confirmé à temps dans l'application bancaire. Veuillez réessayer."}};var TextUtils=function(){function TextUtils(){}return TextUtils.getText=function(key){var locale=ProcessOut.Translator.getLocale(),locale=ProcessOut.texts.hasOwnProperty(locale)?locale:"en";return ProcessOut.texts[locale][key]||""},TextUtils}();ProcessOut.TextUtils=TextUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var ErrorsUtils=function(){function ErrorsUtils(){}return ErrorsUtils.isFieldsValidationError=function(errorData){var error_type=errorData.error_type,errorData=errorData.invalid_fields;return("request.validation.error"===error_type||"gateway.invalid-customer-input"===error_type)&&0',initializeApplePay(invoiceData,buttonContainer,getViewContainer)},document.head.appendChild(applePayScript)},ApplePayClient.prototype.initializeApplePay=function(invoiceData,buttonContainer,getViewContainer){var tokenizeApplePay=this.tokenizeApplePay.bind(this),applePayPaymentMethodData=this.getApplePayPaymentMethodData(invoiceData);this.processOutInstance.applePay.checkAvailability(function(err){err?console.log(err):(buttonContainer.classList.add("visible"),document.querySelector("apple-pay-button").addEventListener("click",function(){tokenizeApplePay(invoiceData,getViewContainer)}))},{merchantApplePayCertificateId:applePayPaymentMethodData.merchant_id})},ApplePayClient.prototype.getSupportedNetworks=function(invoiceData){var supportedNetworks=[];return this.getApplePayPaymentMethodData(invoiceData).supported_networks.forEach(function(network){ProcessOut.networksMap[network]&&supportedNetworks.push(ProcessOut.networksMap[network])}),supportedNetworks},ApplePayClient.prototype.createApplePaySession=function(invoiceData){var supportedNetworks=this.getSupportedNetworks(invoiceData),applePayPaymentMethodData=this.getApplePayPaymentMethodData(invoiceData),invoiceData=this.processOutInstance.applePay.newSession({total:{label:invoiceData.name,amount:invoiceData.amount},currencyCode:invoiceData.currency,countryCode:applePayPaymentMethodData.country_code,supportedNetworks:supportedNetworks,merchantCapabilities:applePayPaymentMethodData.merchant_capabilities,merchantApplePayCertificateId:applePayPaymentMethodData.merchant_id,applePaySessionVersion:14},ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePayNewSessionEvent,ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePaySessionError);return invoiceData.onpaymentauthorizedPostprocess=ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePayAuthorizedPostProcessEvent,invoiceData},ApplePayClient.prototype.tokenizeApplePay=function(invoiceData,getViewContainer){var session=this.createApplePaySession(invoiceData),makeApplePayPayment=this.makeApplePayPayment.bind(this);this.processOutInstance.tokenize(session,{},function(card){session.completePayment(0),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentSuccessEvent(card);card=card.id;makeApplePayPayment(card,invoiceData,getViewContainer)},function(err){session.completePayment(1),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentErrorEvent(err),getViewContainer().innerHTML='\n
\n Something went wrong. Please try again.\n
\n '})},ApplePayClient.prototype.makeApplePayPayment=function(cardToken,invoiceData,getViewContainer){this.processOutInstance.makeCardPayment(invoiceData.id,cardToken,{authorize_only:!0},function(invoiceId){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentSuccessView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({invoiceId:invoiceId,returnUrl:this.paymentConfig.invoiceDetails.return_url})},function(error){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)})},ApplePayClient.prototype.getApplePayPaymentMethodData=function(invoiceData){var applePayPaymentMethodData;return invoiceData.payment_methods.forEach(function(method){"applepay"===method.type&&(applePayPaymentMethodData=method.applepay)}),applePayPaymentMethodData},ApplePayClient}();ProcessOut.ApplePayClient=ApplePayClient}(ProcessOut=ProcessOut||{}),function(ProcessOut){var GooglePayClient=function(){function GooglePayClient(processOutInstance){this.processOutInstance=processOutInstance}return GooglePayClient.prototype.loadButton=function(buttonContainer,invoiceData,getViewContainer){var _this=this,googleClientScript=document.createElement("script");googleClientScript.src=ProcessOut.googlePaySdkUrl,googleClientScript.onload=function(){_this.googleClient=window.globalThis&&window.globalThis.google?new window.globalThis.google.payments.api.PaymentsClient({environment:ProcessOut.DEBUG?"TEST":"PRODUCTION"}):null,_this.initizalizeGooglePay(buttonContainer,getViewContainer,invoiceData)},document.head.appendChild(googleClientScript)},GooglePayClient.prototype.initizalizeGooglePay=function(buttonContainer,getViewContainer,invoiceData){var _this=this;this.prepareIsReadyToPayRequest(invoiceData),this.preparePaymentRequest(invoiceData),this.googleClient.isReadyToPay(this.isReadyToPayRequest).then(function(response){response.result&&(response=_this.googleClient.createButton({buttonColor:"default",buttonType:"plain",buttonRadius:4,buttonSizeMode:"fill",onClick:function(){return _this.makePayment(invoiceData,getViewContainer)}}),buttonContainer.appendChild(response))})["catch"](ProcessOut.DynamicCheckoutEventsUtils.dispatchGooglePayLoadError)},GooglePayClient.prototype.makePayment=function(invoiceData,getViewContainer){var _this=this;this.googleClient.loadPaymentData(this.paymentRequest).then(function(paymentData){var paymentData=new ProcessOut.PaymentToken(ProcessOut.TokenType.GooglePay,JSON.parse(paymentData.paymentMethodData.tokenizationData.token)),processOutInstance=_this.processOutInstance;processOutInstance.tokenize(paymentData,{},function(token){ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentSuccessEvent(token),processOutInstance.makeCardPayment(invoiceData.id,token,{authorize_only:!0},function(invoiceId){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentSuccessView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({invoiceId:invoiceId,returnUrl:this.paymentConfig.invoiceDetails.return_url})},function(error){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)})},function(err){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentErrorEvent({message:"Tokenize payment error: ".concat(JSON.stringify(err,undefined,2))})})})["catch"](ProcessOut.DynamicCheckoutEventsUtils.dispatchGooglePayLoadError)},GooglePayClient.prototype.prepareIsReadyToPayRequest=function(invoiceData){invoiceData=this.getGooglePayMethodData(invoiceData);invoiceData&&(this.isReadyToPayRequest={apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:invoiceData.googlepay.allowed_auth_methods,allowedCardNetworks:invoiceData.googlepay.allowed_card_networks},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:invoiceData.googlepay.gateway,gatewayMerchantId:invoiceData.googlepay.gateway_merchant_id}}}]})},GooglePayClient.prototype.preparePaymentRequest=function(invoiceData){var googlePayMethod=this.getGooglePayMethodData(invoiceData);googlePayMethod&&(this.paymentRequest={apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:googlePayMethod.googlepay.allowed_auth_methods,allowedCardNetworks:googlePayMethod.googlepay.allowed_card_networks},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:googlePayMethod.googlepay.gateway,gatewayMerchantId:googlePayMethod.googlepay.gateway_merchant_id}}}],transactionInfo:{totalPriceStatus:"FINAL",totalPrice:invoiceData.amount,currencyCode:invoiceData.currency},merchantInfo:{merchantName:invoiceData.name}})},GooglePayClient.prototype.getGooglePayMethodData=function(invoiceData){var googlePayMethod;return invoiceData.payment_methods.forEach(function(paymentMethod){"googlepay"===paymentMethod.type&&(googlePayMethod=paymentMethod)}),googlePayMethod},GooglePayClient}();ProcessOut.GooglePayClient=GooglePayClient}(ProcessOut=ProcessOut||{}),function(ProcessOut){var ActionFlow,MockedIFrameWindow=function(){function MockedIFrameWindow(el,iframe){var event;this.element=el,this.iframe=iframe,window.addEventListener("resize",function(event){var width=Math.max(document.body.clientWidth,document.documentElement.clientWidth),width=(this.element.style.width=width+"px",Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight));this.element.style.height=width+"px"}.bind(this)),"function"==typeof Event?event=new Event("resize"):(event=document.createEvent("Event")).initEvent("resize",!0,!0),window.dispatchEvent(event)}return MockedIFrameWindow.prototype.open=function(url){this.iframe.setAttribute("src",url),document.body.style.overflow="hidden",document.body.appendChild(this.element)},MockedIFrameWindow.prototype.close=function(){document.body.style.overflow="",this.closed=!0,this.element.remove()},MockedIFrameWindow}(),ActionHandlerOptions=(!function(ActionFlow){ActionFlow[ActionFlow.NewTab=0]="NewTab",ActionFlow[ActionFlow.NewWindow=1]="NewWindow",ActionFlow[ActionFlow.IFrame=2]="IFrame",ActionFlow[ActionFlow.FingerprintIframe=3]="FingerprintIframe",ActionFlow[ActionFlow.CurrentWindow=4]="CurrentWindow"}(ActionFlow=ProcessOut.ActionFlow||(ProcessOut.ActionFlow={})),function(){function ActionHandlerOptions(actionType,gatewayLogo,override){switch(this.iframeWidth=440,this.iframeHeight=480,this.gatewayLogo=gatewayLogo,actionType){case ActionHandlerOptions.ThreeDSChallengeFlow:this.flow=ActionFlow.IFrame;break;case ActionHandlerOptions.ThreeDSChallengeFlowNoIframe:this.flow=ActionFlow.CurrentWindow;break;case ActionHandlerOptions.ThreeDSFingerprintFlow:this.flow=ActionFlow.FingerprintIframe;break;case"paypal":case"paypalexpresscheckout":case"paypal-rest":this.flow=ActionFlow.NewWindow,this.newWindowHeight=645,this.newWindowWidth=450;break;case"test-credit-card":case"test-alternative-payment":this.flow=ActionFlow.NewWindow,this.newWindowHeight=645,this.newWindowWidth=450;break;default:this.flow=ActionFlow.NewTab}this.flow==ActionFlow.NewWindow&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(this.flow=ActionFlow.NewTab),override&&(this.flow=ActionFlow.IFrame,this.iframeWidth=override.width,this.iframeHeight=override.height)}return ActionHandlerOptions.ThreeDSChallengeFlow="three-d-s-challenge-flow",ActionHandlerOptions.ThreeDSChallengeFlowNoIframe="three-d-s-challenge-flow-no-iframe",ActionHandlerOptions.ThreeDSFingerprintFlow="three-d-s-fingerprint-flow",ActionHandlerOptions}()),ActionHandler=(ProcessOut.ActionHandlerOptions=ActionHandlerOptions,function(){function ActionHandler(instance,options){var iframe,button;this.canceled=!1,this.newWindowName="processout.checkout-window",this.instance=instance,this.options=options,this.options||(this.options=new ActionHandlerOptions),this.options.flow==ActionFlow.IFrame&&((instance=document.createElement("div")).id="processoutjs-action-modal",instance.style.position="fixed",instance.style.top="0",instance.style.left="0",instance.style.height="100%",instance.style.width="100%",instance.setAttribute("style","position: fixed; top: 0; left: 0; background: rgba(0, 0, 0, 0.5); z-index: 9999999; overflow: auto;"),(iframe=document.createElement("iframe")).setAttribute("style","margin: 1em auto; width: ".concat(this.options.iframeWidth,"px; height: ").concat(this.options.iframeHeight,'px; max-width: 100%; max-height: 100%; display: block; box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07); background-color: #ECEFF1; background-image: url("').concat(this.instance.endpoint("js","/images/loader.gif"),'"); background-repeat: no-repeat; background-position: center;")')),iframe.setAttribute("frameborder","0"),iframe.onload=function(){iframe.style.backgroundImage=null},(options=document.createElement("div")).setAttribute("style","width: 100%; text-align: center; margin-bottom: 1em;"),(button=document.createElement("div")).setAttribute("style","cursor: pointer; color: white;"),button.innerHTML=ProcessOut.Translator.translateMessage("label.cancel","Cancel"),options.appendChild(button),instance.appendChild(iframe),instance.appendChild(options),this.iframeWrapper=new MockedIFrameWindow(instance,iframe),button.onclick=function(){this.iframeWrapper.close()}.bind(this))}return ActionHandler.prototype.handle=function(url,success,error){var _a,timeout,topLayer,newWindow,timer,t=this,refocus=function(){topLayer&&topLayer.remove(),window.focus()};switch(this.options.flow){case ActionFlow.NewWindow:_a=this.createNewWindow(url),topLayer=_a.topLayer,newWindow=_a.newWindow;break;case ActionFlow.IFrame:(newWindow=this.iframeWrapper).open(url);break;case ActionFlow.FingerprintIframe:(newWindow=this.createFingerprintIFrame()).open(url),timeout=setTimeout(function(){clearInterval(timer),timer=null,newWindow.close(),error(new ProcessOut.Exception("three-d-s-2.fingerprint-timed-out"))},1e4);break;case ActionFlow.CurrentWindow:(newWindow=window).location.replace(url);break;default:_a=this.createNewTabOrWindow(url),topLayer=_a.topLayer,newWindow=_a.newWindow}return newWindow?(timer=setInterval(function(){if(timer)if(t.isCanceled())clearInterval(timer),timer=null,newWindow.close(),error(new ProcessOut.Exception("customer.canceled")),refocus();else{var cancelf=function(){clearInterval(timer),timer=null,error(new ProcessOut.Exception("customer.canceled")),refocus()};try{newWindow&&!newWindow.closed||cancelf()}catch(err){try{newWindow.close()}catch(err){}cancelf()}}},500),this.listenEvents(newWindow,timer,refocus,function(data){timeout&&clearTimeout(timeout),success(data)},function(err){timeout&&clearTimeout(timeout),error(err)}),this):(error(new ProcessOut.Exception("customer.popup-blocked")),refocus(),null)},ActionHandler.prototype.createNewTabOrWindow=function(url){url=window.open(url,this.newWindowName);return this.setupWindowObject(url)},ActionHandler.prototype.createNewWindow=function(url){var h=this.options.newWindowHeight,w=this.options.newWindowWidth,y=window.top.outerHeight/2+window.top.screenY-h/2,x=window.top.outerWidth/2+window.top.screenX-w/2,url=window.open(url,this.newWindowName,"menubar=false,toolbar=false,width=".concat(w,",height=").concat(h,",top=").concat(y,",left=").concat(x));return this.setupWindowObject(url)},ActionHandler.prototype.setupWindowObject=function(newWindow){var ret,topLayerMessageImage;return newWindow?(ret={topLayer:null,newWindow:newWindow},newWindow=function(e){try{ret.newWindow.close()}catch(err){}},window.addEventListener("beforeunload",newWindow,!1),window.addEventListener("pagehide",newWindow,!1),ret.topLayer=document.createElement("div"),ret.topLayer.id="processoutjs-action-modal",ret.topLayer.setAttribute("style","position: fixed; top: 0; left: 0; background: rgba(0, 0, 0, 0.7); z-index: 9999999; overflow: auto; height: 100%; width: 100%;"),(newWindow=document.createElement("div")).setAttribute("style","text-align: center; color: white; max-width: 350px; margin: 0 auto; margin-top: 10%; cursor: pointer;"),this.options.gatewayLogo&&((topLayerMessageImage=document.createElement("img")).setAttribute("style","max-height: 70px; max-width: 230px; filter: saturate(0) grayscale(1) brightness(0.6) contrast(100000) invert(1); margin-bottom: 2em;"),topLayerMessageImage.setAttribute("src",this.options.gatewayLogo),newWindow.appendChild(topLayerMessageImage)),(topLayerMessageImage=document.createElement("div")).innerHTML=ProcessOut.Translator.translateMessage("label.apm-description"),newWindow.appendChild(topLayerMessageImage),ret.topLayer.appendChild(newWindow),newWindow.addEventListener("click",function(){ret.newWindow.focus()}.bind(this),!1),(topLayerMessageImage=document.createElement("div")).setAttribute("style","text-align: center; color: white; max-width: 350px; margin: 0 auto; margin-top: 3em; cursor: pointer; opacity: 0.9;"),topLayerMessageImage.innerHTML=ProcessOut.Translator.translateMessage("label.cancel"),ret.topLayer.appendChild(topLayerMessageImage),topLayerMessageImage.addEventListener("click",function(){this.cancel()}.bind(this),!1),document.body.appendChild(ret.topLayer),ret):{}},ActionHandler.prototype.createFingerprintIFrame=function(){var iframeWrapper=document.createElement("div"),iframe=(iframeWrapper.id="processoutjs-fingerprint-wrapper",iframeWrapper.style.height="0",iframeWrapper.style.width="0",document.createElement("iframe"));return iframe.style.display="none",iframe.setAttribute("frameborder","0"),iframeWrapper.appendChild(iframe),new MockedIFrameWindow(iframeWrapper,iframe)},ActionHandler.prototype.listenEvents=function(newWindow,timer,refocus,success,error){var cur=++ActionHandler.listenerCount,alreadyDone=!1,handler=function(event){var data=ProcessOut.Message.parseEvent(event);if(data.namespace==ProcessOut.Message.checkoutNamespace)if(ActionHandler.listenerCount!=cur)timer&&(clearInterval(timer),timer=null);else if(!alreadyDone)switch(alreadyDone=!0,data.action){case"success":timer&&(clearInterval(timer),timer=null),newWindow.close(),success(data.data),refocus();break;case"canceled":timer&&(clearInterval(timer),timer=null),newWindow.close(),error(new ProcessOut.Exception("customer.canceled")),refocus();break;case"none":timer&&(clearInterval(timer),timer=null),newWindow.close(),error(new ProcessOut.Exception("processout-js.no-customer-action")),refocus();break;case"error":timer&&(clearInterval(timer),timer=null),newWindow.close(),error(new ProcessOut.Exception(data.errorCode,data.errorMessage)),refocus();break;default:timer&&(clearInterval(timer),timer=null),newWindow.close(),error(new ProcessOut.Exception("default")),refocus()}};window.addEventListener("message",handler),new ProcessOut.MessageHub(this.instance,null,function(k,v){v=ProcessOut.Message.parseEvent({data:v});v.namespace=k,handler({data:JSON.stringify(v)})})},ActionHandler.prototype.cancel=function(){this.canceled=!0},ActionHandler.prototype.isCanceled=function(){return this.canceled},ActionHandler.listenerCount=0,ActionHandler}());ProcessOut.ActionHandler=ActionHandler}(ProcessOut=ProcessOut||{}); +!function(){function t(t){this.message=t}var r="undefined"!=typeof exports?exports:self,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";(t.prototype=new Error).name="InvalidCharacterError",r.btoa||(r.btoa=function(r){for(var o,n,a=String(r),i=0,c=e,d="";a.charAt(0|i)||(c="=",i%1);d+=c.charAt(63&o>>8-i%1*8)){if(255<(n=a.charCodeAt(i+=.75)))throw new t("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");o=o<<8|n}return d}),r.atob||(r.atob=function(r){var o=String(r).replace(/=+$/,"");if(o.length%4==1)throw new t("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,a,i=0,c=0,d="";a=o.charAt(c++);~a&&(n=i%4?64*n+a:a,i++%4)&&(d+=String.fromCharCode(255&n>>(-2*i&6))))a=e.indexOf(a);return d})}(),"function"!=typeof Object.assign&&(Object.assign=function(a,b){"use strict";if(null==a)throw new TypeError("Cannot convert undefined or null to object");for(var c=Object(a),d=1;d=format[currentBlock]){if(currentBlockChar=0,++currentBlock>=format.length)break;formatted+=" "}formatted+=number[i],currentBlockChar++}return formatted},Card.parseNumber=function(number){return String(number.replace(/ /gi,"").replace(/\-/gi,"").replace(/\-/gi,""))},Card.validateNumber=function(number,limit){return!((number=Card.parseNumber(number)).lengthlimit[1])&&Card.luhn(number)?null:new ProcessOut.Exception("card.invalid-number")},Card.validateCVC=function(cvc,scheme){if(scheme){if("american-express"===scheme){if(cvc&&!cvc.match(/^\d{4}$/g))return new ProcessOut.Exception("card.invalid-cvc")}else if(cvc&&!cvc.match(/^\d{3}$/g))return new ProcessOut.Exception("card.invalid-cvc")}else if(cvc&&!cvc.match(/^\d{3,4}$/g))return new ProcessOut.Exception("card.invalid-cvc");return null},Card.getIIN=function(number){var l=(number=Card.parseNumber(number)).length;return number.substring(0,l=6option.length?option:iin).length;if(iin.substring(0,l)==option.toString().substring(0,l)){matches.push(scheme);break}}}return matches},Card}());ProcessOut.Card=Card}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.CardFieldValue=function CardFieldValue(){this.number=null,this.expiryMonth=null,this.expiryYear=null,this.cvc=null,this.name=null,this.metadata=null};var CardFieldOptions=function(){function CardFieldOptions(type){this.expiryAutoNext=!0,this.cardNumberAutoNext=!0,this.type=type}return CardFieldOptions.prototype.apply=function(o){return o.placeholder&&(this.placeholder=o.placeholder),o.style&&(this.style=o.style),null!=o.requireCVC&&(this.requireCVC=o.requireCVC),o.expiryAutoNext!==undefined&&null!==o.expiryAutoNext&&(this.expiryAutoNext=o.expiryAutoNext),o.cardNumberAutoNext!==undefined&&null!==o.cardNumberAutoNext&&(this.cardNumberAutoNext=o.cardNumberAutoNext),this},CardFieldOptions}(),CardFieldOptions=(ProcessOut.CardFieldOptions=CardFieldOptions,function CardFieldStyle(){}),CardFieldOptions=(ProcessOut.CardFieldStyle=CardFieldOptions,function(){function CardField(instance,form,options,container,success,error){if(this.handlers={},!options||!options.type)throw new ProcessOut.Exception("processout-js.invalid-field-type","Options and a the field type must be provided to setup the field.");if(!container)throw new ProcessOut.Exception("processout-js.undefined-field","The card field for the ".concat(options.type," does not exist in the given container."));if(container instanceof HTMLInputElement)throw new ProcessOut.Exception("processout-js.invalid-field","The card field for the ".concat(options.type," must be an input field."));if(options.type!=CardField.number&&options.type!=CardField.expiry&&options.type!=CardField.expiryMonth&&options.type!=CardField.expiryYear&&options.type!=CardField.cvc)throw new ProcessOut.Exception("processout-js.invalid-field-type");this.instance=instance,this.form=form,this.options=options,this.el=container;instance=this.el.getAttribute("data-processout-placeholder");instance&&(this.options.placeholder=instance),this.spawn(success,error)}return CardField.prototype.spawn=function(success,error){var tmp=Math.random().toString(36).substring(7),endpoint=(this.uid="#".concat(tmp),this.instance.getProcessOutFieldEndpoint("?r=".concat(tmp).concat(this.uid))),errored=(this.iframe=document.createElement("iframe"),this.iframe.className="processout-field-cc-iframe",this.iframe.name=tmp,this.iframe.setAttribute("src",endpoint),this.iframe.setAttribute("style","background: none; width: 100%;"),this.iframe.setAttribute("frameborder","0"),this.iframe.setAttribute("allowtransparency","1"),this.iframe.style.display="none",!(this.iframe.height="14px")),iframeError=setTimeout(function(){errored=!0,typeof error==typeof Function&&error(new ProcessOut.Exception("processout-js.field.unavailable"))},CardField.timeout);this.iframe.onload=function(){try{navigator.userAgent.match(/firefox|fxios/i)&&this.iframe.contentWindow.location.replace(endpoint)}catch(e){}}.bind(this),window.addEventListener("message",function(event){errored||(event=ProcessOut.Message.parseEvent(event)).frameID==this.uid&&event.namespace==ProcessOut.Message.fieldNamespace&&(this.handlEvent(event),"alive"==event.action&&this.iframe.contentWindow.postMessage(JSON.stringify({namespace:ProcessOut.Message.fieldNamespace,projectID:this.instance.getProjectID(),action:"setup",formID:this.form.getUID(),data:this.options}),"*"),"ready"==event.action)&&(this.iframe.style.display="block",clearTimeout(iframeError),success(),this.iframe.contentWindow.postMessage(JSON.stringify({namespace:ProcessOut.Message.fieldNamespace,projectID:this.instance.getProjectID(),action:"resize"}),"*"),this.iframe.addEventListener("focus",function(event){this.focus()}.bind(this)))}.bind(this)),this.el.appendChild(this.iframe)},CardField.prototype.handlEvent=function(data){var d={field:this,type:this.options.type,element:this.el,data:data.data};switch(data.action){case"inputEvent":this.eventCallback&&this.eventCallback("oninput",d);break;case"mouseEnterEvent":this.eventCallback&&this.eventCallback("onmouseenter",d);break;case"mouseLeaveEvent":this.eventCallback&&this.eventCallback("onmouseleave",d);break;case"focusEvent":this.el.className=this.el.className+" processout-input-focused",this.eventCallback&&this.eventCallback("onfocus",d);break;case"blurEvent":this.el.className=this.el.className.replace(/\bprocessout-input-focused\b/g,"").replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),this.eventCallback&&this.eventCallback("onblur",d);break;case"next":this.next&&this.next();break;case"event":if(data.data.name in this.handlers)for(var handlers=this.handlers[data.data.name],i=0;i=this.paymentConfig.pollingMaxTimeout},NativeApm.prototype.handleCaptureSuccess=function(data){if(data.success&&data.native_apm&&"PENDING_CAPTURE"===data.native_apm.state&&!this.checkIfCaptureTimeout())return this.capturePayment();if(data.success&&data.native_apm&&"PENDING_CAPTURE"===data.native_apm.state&&this.checkIfCaptureTimeout())return this.captureStart=null,ProcessOut.EventsUtils.dispatchPaymentErrorEvent(data);var errorView;if(!data.success)return this.captureStart=null,errorView=new ProcessOut.NativeApmErrorView(this.gatewayConfiguration.native_apm,this.theme),ProcessOut.EventsUtils.dispatchPaymentErrorEvent(data),this.loadView(errorView.getViewElement());this.captureStart=null;data=new ProcessOut.NativeApmSuccessView(this.gatewayConfiguration,this.markdownLibraryInstance,this.theme);return ProcessOut.EventsUtils.dispatchPaymentSuccessEvent({returnUrl:this.paymentConfig.returnUrl}),this.loadView(data.getViewElement())},NativeApm.prototype.handleCaptureError=function(req,e,errorCode){var errorView=new ProcessOut.NativeApmErrorView(this.gatewayConfiguration.native_apm,this.theme),errorData=req.response;!req.response&&errorCode&&(errorData={success:!1,error_type:errorCode,message:ProcessOut.Translator.translateError(errorCode)}),ProcessOut.EventsUtils.dispatchPaymentErrorEvent(errorData),this.loadView(errorView.getViewElement())},NativeApm.prototype.setTheme=function(themeConfig){return this.theme.setTheme(themeConfig)},NativeApm.prototype.prefillData=function(data){this.prefilledData=data},NativeApm.prototype.loadView=function(view){this.widgetWrapper&&this.napmContainer.removeChild(this.widgetWrapper),this.widgetWrapper=this.createWidgetWrapper(),this.widgetWrapper.appendChild(view),this.napmContainer.appendChild(this.widgetWrapper)},NativeApm.prototype.updatePaymentProviderLogo=function(logoUrl){logoUrl&&(this.gatewayConfiguration=__assign(__assign({},this.gatewayConfiguration),{native_apm:__assign(__assign({},this.gatewayConfiguration.native_apm),{gateway:__assign(__assign({},this.gatewayConfiguration.native_apm.gateway),{logo_url:logoUrl})})}))},NativeApm.prototype.createWidgetWrapper=function(){var widgetWrapper=document.createElement("div"),styleElement=this.theme.createInitialStyleTag();return widgetWrapper.setAttribute("class","native-apm-widget-wrapper"),widgetWrapper.appendChild(styleElement),ProcessOut.StylesUtils.styleElement(widgetWrapper,this.theme.wrapper),widgetWrapper},NativeApm.prototype.loadMarkdownLibrary=function(){var _this=this,markdownScript=document.createElement("script");markdownScript.src="https://js.processout.com/js/libraries/showdown.min.js",markdownScript.onload=function(){_this.markdownLibraryInstance=window.globalThis&&window.globalThis.showdown?new window.globalThis.showdown.Converter:null},document.head.appendChild(markdownScript)},NativeApm.prototype.loadQrCodesLibrary=function(){var qrCodeScript=document.createElement("script");qrCodeScript.src="https://js.processout.com/js/libraries/qrcode.min.js",document.head.appendChild(qrCodeScript)},NativeApm}();ProcessOut.NativeApm=NativeApm}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var NativeApmPaymentConfig=function(){function NativeApmPaymentConfig(config){this.setConfig(config)}return NativeApmPaymentConfig.prototype.getConfig=function(){return{gatewayConfigurationId:this.gatewayConfigurationId,invoiceId:this.invoiceId,returnUrl:this.returnUrl,pollingMaxTimeout:this.pollingMaxTimeout}},NativeApmPaymentConfig.prototype.setConfig=function(config){if(!this.isValidConfig(config))throw new ProcessOut.Exception("default","You must instantiate Native APM with a valid config in order to use it");this.gatewayConfigurationId=config.gatewayConfigurationId,this.invoiceId=config.invoiceId,this.returnUrl=config.returnUrl,this.pollingMaxTimeout=config.pollingMaxTimeout||180},NativeApmPaymentConfig.prototype.isValidConfig=function(config){return config.gatewayConfigurationId&&config.invoiceId},NativeApmPaymentConfig}();ProcessOut.NativeApmPaymentConfig=NativeApmPaymentConfig}(ProcessOut=ProcessOut||{}),{wrapper:{display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",width:"100%",fontSize:"1rem"},spinner:{width:"4rem",height:"4rem",border:"5px solid #f2f2f2",borderBottomColor:"#7e57c2",borderRadius:"50%",display:"inline-block",boxSizing:"border-box",animation:"rotation 1s linear infinite"},logo:{width:"10rem",height:"auto",marginBottom:"1rem"},buttons:{"default":{borderWidth:"0px",color:"#fff",backgroundColor:"#7e57c2",cursor:"pointer",padding:"0.8rem 1.5rem",display:"flex",justifyContent:"center",alignItems:"center",position:"relative",marginTop:"0.8rem",fontSize:"1rem",borderRadius:"5px"},spinner:{position:"absolute",width:"1rem",height:"1rem",border:"3px solid #f2f2f2",borderBottomColor:"#7e57c2",borderRadius:"50%",display:"inline-block",boxSizing:"border-box",animation:"rotation 1s linear infinite"}},form:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",gap:"0.8rem",width:"100%",inputsWrapper:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"0.8rem",alignItems:"center",width:"100%"},inputs:{wrapper:{width:"inherit"},text:{padding:"0 0.8rem",height:"3rem",border:"1px solid #d7d7d7",borderRadius:"5px",width:"100%",fontSize:"1rem"},select:{height:"3rem",width:"100%",border:"1px solid #d7d7d7",borderRadius:"5px",fontSize:"1rem"},numeric:{display:"flex",flexDirection:"row",gap:"0.8rem",character:{width:"3rem",height:"3rem",fontSize:"1.5rem",border:"1px solid #d7d7d7",borderRadius:"5px",textAlign:"center"}}},labels:{display:"block",marginBottom:"10px",requiredStar:{color:"#e74c3c",marginLeft:"0.1rem"}},errors:{display:"block",color:"#e74c3c",fontSize:"0.9rem",minHeight:"1rem",marginTop:"0.3rem",width:"100%"}},message:{fontSize:"1.1rem"},actionImage:{marginTop:"1.3rem",marginBottom:"1.3rem",width:"15rem",height:"auto",display:"flex",justifyContent:"center",alignItems:"center"}}),spinnerLoadingAnimation="\n@keyframes rotation {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n",defaultStyles=(!function(ProcessOut){var NativeApmThemeConfig=function(){function NativeApmThemeConfig(){this.wrapper=defaultTheme.wrapper,this.spinner=defaultTheme.spinner,this.logo=defaultTheme.logo,this.buttons=defaultTheme.buttons,this.form=defaultTheme.form,this.message=defaultTheme.message,this.actionImage=defaultTheme.actionImage}return NativeApmThemeConfig.prototype.getTheme=function(){return{wrapper:this.wrapper,spinner:this.spinner,logo:this.logo,buttons:this.buttons,form:this.form,message:this.message,actionImage:this.actionImage}},NativeApmThemeConfig.prototype.setTheme=function(theme){var mergeObjects=function(obj1,obj2){for(var key in obj2)obj2.hasOwnProperty(key)&&("object"==typeof obj2[key]&&null!==obj2[key]?obj1[key]=mergeObjects(obj1[key],obj2[key]):obj1[key]=obj2[key]);return obj1};mergeObjects(this.wrapper,theme.wrapper),mergeObjects(this.spinner,theme.spinner),mergeObjects(this.logo,theme.logo),mergeObjects(this.buttons,theme.buttons),mergeObjects(this.form,theme.form),mergeObjects(this.message,theme.message),mergeObjects(this.actionImage,theme.actionImage)},NativeApmThemeConfig.prototype.createInitialStyleTag=function(){var styleElement=document.createElement("style");return styleElement.innerHTML=spinnerLoadingAnimation,styleElement},NativeApmThemeConfig}();ProcessOut.NativeApmThemeConfig=NativeApmThemeConfig}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var StylesUtils=function(){function StylesUtils(){}return StylesUtils.styleElement=function(node,styles){return Object.keys(styles).forEach(function(style){node.style[style]=styles[style]})},StylesUtils}();ProcessOut.StylesUtils=StylesUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.NATIVE_APM_EVENTS={WIDGET_LOADING:"processout_native_apm_loading",WIDGET_READY:"processout_native_apm_ready",GATEWAY_CONFIGURATION_ERROR:"processout_native_apm_gateway_configuration_error",PAYMENT_INIT:"processout_native_apm_payment_init",PAYMENT_ADDITIONAL_INPUT:"processout_native_apm_payment_additional_input",PAYMENT_SUCCESS:"processout_native_apm_payment_success",PAYMENT_ERROR:"processout_native_apm_payment_error"};var EventsUtils=function(){function EventsUtils(){}return EventsUtils.dispatchGatewayConfigurationErrorEvent=function(errorData){errorData=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.GATEWAY_CONFIGURATION_ERROR,errorData);return window.dispatchEvent(errorData)},EventsUtils.dispatchPaymentInitEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_INIT);return window.dispatchEvent(event)},EventsUtils.dispatchWidgetLoadingEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.WIDGET_LOADING);return window.dispatchEvent(event)},EventsUtils.dispatchWidgetReadyEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.WIDGET_READY);return window.dispatchEvent(event)},EventsUtils.dispatchPaymentAdditionalInputEvent=function(){var event=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_ADDITIONAL_INPUT);return window.dispatchEvent(event)},EventsUtils.dispatchPaymentSuccessEvent=function(data){data=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_SUCCESS,data);return window.dispatchEvent(data)},EventsUtils.dispatchPaymentErrorEvent=function(errorData){errorData=EventsUtils.createEvent(ProcessOut.NATIVE_APM_EVENTS.PAYMENT_ERROR,errorData);return window.dispatchEvent(errorData)},EventsUtils.createEvent=function(eventName,data){var event_1;return"function"==typeof window.CustomEvent?new CustomEvent(eventName,{bubbles:!0,detail:data}):((event_1=document.createEvent("CustomEvent")).initCustomEvent(eventName,!0,!1,data),event_1)},EventsUtils}();ProcessOut.EventsUtils=EventsUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){ProcessOut.texts={en:{invalidCode:"Code is not valid.",invalidPhoneNumber:"Phone number is not valid.",invalidTextValue:"Value is not valid.",invalidEmail:"Email is not valid.",phoneNumberPlaceholder:"Enter phone number",phoneNumberLabel:"Phone number",emailPlaceholder:"name@exmple.com",submitButtonText:"Pay",paymentSuccessMessage:"Success!\nPayment approved.",genericError:"Something went wrong, please try again.",paymentTimeout:"The payment was not confirmed in time in the banking application. Please try again."},pl:{invalidCode:"Niepoprawny kod.",invalidPhoneNumber:"Niepoprawny numer telefonu.",invalidTextValue:"Niepoprawna wartość.",invalidEmail:"Niepoprawny adres email.",phoneNumberPlaceholder:"Twój numer telefonu",phoneNumberLabel:"Numer telefonu",emailPlaceholder:"imię@przykład.pl",submitButtonText:"Zapłać",paymentSuccessMessage:"Sukces!\nPłatność przyjęta.",genericError:"Coś poszło nie tak, spróbuj ponownie.",paymentTimeout:"Płatność odrzucona. Czas na potwierdzenie transakcji został przekroczony. Spróbuj ponownie."},pt:{invalidCode:"Número inválido.",invalidPhoneNumber:"Número de telemóvel inválido.",invalidTextValue:"Texto inválido.",invalidEmail:"Endereço de e-mail inválido.",phoneNumberPlaceholder:"Insira o seu número de telemóvel",phoneNumberLabel:"Nº de telemóvel",emailPlaceholder:"nome@exemplo.pt",submitButtonText:"Pagar",paymentSuccessMessage:"Successo!\nPagamento aprovado.",genericError:"Ocorreu um erro ao processar o seu cartão, por favor tente novamente.",paymentTimeout:"O pagamento não foi confirmado a tempo no aplicativo bancário. Por favor, tente novamente."},fr:{invalidCode:"Numéro invalide.",invalidPhoneNumber:"Votre numéro de téléphone est invalide.",invalidTextValue:"Valeur invalide.",invalidEmail:"Votre adresse e-mail est invalide.",phoneNumberPlaceholder:"Entrez votre numéro de téléphone",phoneNumberLabel:"Numéro de téléphone",emailPlaceholder:"nom@exemple.fr",submitButtonText:"Payer",paymentSuccessMessage:"Succès!\nPaiement confirmé.",genericError:"Une erreur s’est produite, veuillez réessayer.",paymentTimeout:"Le paiement n'a pas été confirmé à temps dans l'application bancaire. Veuillez réessayer."}};var TextUtils=function(){function TextUtils(){}return TextUtils.getText=function(key){var locale=ProcessOut.Translator.getLocale(),locale=ProcessOut.texts.hasOwnProperty(locale)?locale:"en";return ProcessOut.texts[locale][key]||""},TextUtils}();ProcessOut.TextUtils=TextUtils}(ProcessOut=ProcessOut||{}),!function(ProcessOut){var ErrorsUtils=function(){function ErrorsUtils(){}return ErrorsUtils.isFieldsValidationError=function(errorData){var error_type=errorData.error_type,errorData=errorData.invalid_fields;return("request.validation.error"===error_type||"gateway.invalid-customer-input"===error_type)&&0',initializeApplePay(invoiceData,buttonContainer,getViewContainer)},document.head.appendChild(applePayScript)},ApplePayClient.prototype.initializeApplePay=function(invoiceData,buttonContainer,getViewContainer){var tokenizeApplePay=this.tokenizeApplePay.bind(this),applePayPaymentMethodData=this.getApplePayPaymentMethodData(invoiceData);this.processOutInstance.applePay.checkAvailability(function(err){err?console.log(err):(buttonContainer.classList.add("visible"),document.querySelector("apple-pay-button").addEventListener("click",function(){tokenizeApplePay(invoiceData,getViewContainer)}))},{merchantApplePayCertificateId:applePayPaymentMethodData.merchant_id})},ApplePayClient.prototype.getSupportedNetworks=function(invoiceData){var supportedNetworks=[];return this.getApplePayPaymentMethodData(invoiceData).supported_networks.forEach(function(network){ProcessOut.networksMap[network]&&supportedNetworks.push(ProcessOut.networksMap[network])}),supportedNetworks},ApplePayClient.prototype.createApplePaySession=function(invoiceData){var supportedNetworks=this.getSupportedNetworks(invoiceData),applePayPaymentMethodData=this.getApplePayPaymentMethodData(invoiceData),invoiceData=this.processOutInstance.applePay.newSession({total:{label:invoiceData.name,amount:invoiceData.amount},currencyCode:invoiceData.currency,countryCode:applePayPaymentMethodData.country_code,supportedNetworks:supportedNetworks,merchantCapabilities:applePayPaymentMethodData.merchant_capabilities,merchantApplePayCertificateId:applePayPaymentMethodData.merchant_id,applePaySessionVersion:14},ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePayNewSessionEvent,ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePaySessionError);return invoiceData.onpaymentauthorizedPostprocess=ProcessOut.DynamicCheckoutEventsUtils.dispatchApplePayAuthorizedPostProcessEvent,invoiceData},ApplePayClient.prototype.tokenizeApplePay=function(invoiceData,getViewContainer){var session=this.createApplePaySession(invoiceData),makeApplePayPayment=this.makeApplePayPayment.bind(this);this.processOutInstance.tokenize(session,{},function(card){session.completePayment(0),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentSuccessEvent(card);card=card.id;makeApplePayPayment(card,invoiceData,getViewContainer)},function(err){session.completePayment(1),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentErrorEvent(err),getViewContainer().innerHTML='\n
\n Something went wrong. Please try again.\n
\n '})},ApplePayClient.prototype.makeApplePayPayment=function(cardToken,invoiceData,getViewContainer){this.processOutInstance.makeCardPayment(invoiceData.id,cardToken,{authorize_only:!0},function(invoiceId){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentSuccessView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({invoiceId:invoiceId,returnUrl:this.paymentConfig.invoiceDetails.return_url})},function(error){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)})},ApplePayClient.prototype.getApplePayPaymentMethodData=function(invoiceData){var applePayPaymentMethodData;return invoiceData.payment_methods.forEach(function(method){"applepay"===method.type&&(applePayPaymentMethodData=method.applepay)}),applePayPaymentMethodData},ApplePayClient}();ProcessOut.ApplePayClient=ApplePayClient}(ProcessOut=ProcessOut||{}),function(ProcessOut){var GooglePayClient=function(){function GooglePayClient(processOutInstance){this.processOutInstance=processOutInstance}return GooglePayClient.prototype.loadButton=function(buttonContainer,invoiceData,getViewContainer){var _this=this,googleClientScript=document.createElement("script");googleClientScript.src=ProcessOut.googlePaySdkUrl,googleClientScript.onload=function(){_this.googleClient=window.globalThis&&window.globalThis.google?new window.globalThis.google.payments.api.PaymentsClient({environment:ProcessOut.DEBUG?"TEST":"PRODUCTION"}):null,_this.initizalizeGooglePay(buttonContainer,getViewContainer,invoiceData)},document.head.appendChild(googleClientScript)},GooglePayClient.prototype.initizalizeGooglePay=function(buttonContainer,getViewContainer,invoiceData){var _this=this;this.prepareIsReadyToPayRequest(invoiceData),this.preparePaymentRequest(invoiceData),this.googleClient.isReadyToPay(this.isReadyToPayRequest).then(function(response){response.result&&(response=_this.googleClient.createButton({buttonColor:"default",buttonType:"plain",buttonRadius:4,buttonSizeMode:"fill",onClick:function(){return _this.makePayment(invoiceData,getViewContainer)}}),buttonContainer.appendChild(response))})["catch"](ProcessOut.DynamicCheckoutEventsUtils.dispatchGooglePayLoadError)},GooglePayClient.prototype.makePayment=function(invoiceData,getViewContainer){var _this=this;this.googleClient.loadPaymentData(this.paymentRequest).then(function(paymentData){var paymentData=new ProcessOut.PaymentToken(ProcessOut.TokenType.GooglePay,JSON.parse(paymentData.paymentMethodData.tokenizationData.token)),processOutInstance=_this.processOutInstance;processOutInstance.tokenize(paymentData,{},function(token){ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentSuccessEvent(token),processOutInstance.makeCardPayment(invoiceData.id,token,{authorize_only:!0},function(invoiceId){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentSuccessView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({invoiceId:invoiceId,returnUrl:this.paymentConfig.invoiceDetails.return_url})},function(error){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)})},function(err){this.resetContainerHtml().appendChild(new ProcessOut.DynamicCheckoutPaymentErrorView(this.paymentConfig).element),ProcessOut.DynamicCheckoutEventsUtils.dispatchTokenizePaymentErrorEvent({message:"Tokenize payment error: ".concat(JSON.stringify(err,undefined,2))})})})["catch"](ProcessOut.DynamicCheckoutEventsUtils.dispatchGooglePayLoadError)},GooglePayClient.prototype.prepareIsReadyToPayRequest=function(invoiceData){invoiceData=this.getGooglePayMethodData(invoiceData);invoiceData&&(this.isReadyToPayRequest={apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:invoiceData.googlepay.allowed_auth_methods,allowedCardNetworks:invoiceData.googlepay.allowed_card_networks},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:invoiceData.googlepay.gateway,gatewayMerchantId:invoiceData.googlepay.gateway_merchant_id}}}]})},GooglePayClient.prototype.preparePaymentRequest=function(invoiceData){var googlePayMethod=this.getGooglePayMethodData(invoiceData);googlePayMethod&&(this.paymentRequest={apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[{type:"CARD",parameters:{allowedAuthMethods:googlePayMethod.googlepay.allowed_auth_methods,allowedCardNetworks:googlePayMethod.googlepay.allowed_card_networks},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:{gateway:googlePayMethod.googlepay.gateway,gatewayMerchantId:googlePayMethod.googlepay.gateway_merchant_id}}}],transactionInfo:{totalPriceStatus:"FINAL",totalPrice:invoiceData.amount,currencyCode:invoiceData.currency},merchantInfo:{merchantName:invoiceData.name}})},GooglePayClient.prototype.getGooglePayMethodData=function(invoiceData){var googlePayMethod;return invoiceData.payment_methods.forEach(function(paymentMethod){"googlepay"===paymentMethod.type&&(googlePayMethod=paymentMethod)}),googlePayMethod},GooglePayClient}();ProcessOut.GooglePayClient=GooglePayClient}(ProcessOut=ProcessOut||{}),function(ProcessOut){var ActionFlow,MockedIFrameWindow=function(){function MockedIFrameWindow(el,iframe){var event;this.element=el,this.iframe=iframe,window.addEventListener("resize",function(event){var width=Math.max(document.body.clientWidth,document.documentElement.clientWidth),width=(this.element.style.width=width+"px",Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight));this.element.style.height=width+"px"}.bind(this)),"function"==typeof Event?event=new Event("resize"):(event=document.createEvent("Event")).initEvent("resize",!0,!0),window.dispatchEvent(event)}return MockedIFrameWindow.prototype.open=function(url){this.iframe.setAttribute("src",url),document.body.style.overflow="hidden",document.body.appendChild(this.element)},MockedIFrameWindow.prototype.close=function(){document.body.style.overflow="",this.closed=!0,this.element.remove()},MockedIFrameWindow}(),ActionHandlerOptions=(!function(ActionFlow){ActionFlow[ActionFlow.NewTab=0]="NewTab",ActionFlow[ActionFlow.NewWindow=1]="NewWindow",ActionFlow[ActionFlow.IFrame=2]="IFrame",ActionFlow[ActionFlow.FingerprintIframe=3]="FingerprintIframe",ActionFlow[ActionFlow.CurrentWindow=4]="CurrentWindow"}(ActionFlow=ProcessOut.ActionFlow||(ProcessOut.ActionFlow={})),function(){function ActionHandlerOptions(actionType,gatewayLogo,override){switch(this.iframeWidth=440,this.iframeHeight=480,this.gatewayLogo=gatewayLogo,actionType){case ActionHandlerOptions.ThreeDSChallengeFlow:this.flow=ActionFlow.IFrame;break;case ActionHandlerOptions.ThreeDSChallengeFlowNoIframe:this.flow=ActionFlow.CurrentWindow;break;case ActionHandlerOptions.ThreeDSFingerprintFlow:this.flow=ActionFlow.FingerprintIframe;break;case"paypal":case"paypalexpresscheckout":case"paypal-rest":this.flow=ActionFlow.NewWindow,this.newWindowHeight=645,this.newWindowWidth=450;break;case"test-credit-card":case"test-alternative-payment":this.flow=ActionFlow.NewWindow,this.newWindowHeight=645,this.newWindowWidth=450;break;default:this.flow=ActionFlow.NewTab}this.flow==ActionFlow.NewWindow&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&(this.flow=ActionFlow.NewTab),override&&(this.flow=ActionFlow.IFrame,this.iframeWidth=override.width,this.iframeHeight=override.height)}return ActionHandlerOptions.ThreeDSChallengeFlow="three-d-s-challenge-flow",ActionHandlerOptions.ThreeDSChallengeFlowNoIframe="three-d-s-challenge-flow-no-iframe",ActionHandlerOptions.ThreeDSFingerprintFlow="three-d-s-fingerprint-flow",ActionHandlerOptions}()),ActionHandler=(ProcessOut.ActionHandlerOptions=ActionHandlerOptions,function(){function ActionHandler(instance,options){var iframe,button;this.canceled=!1,this.newWindowName="processout.checkout-window",this.instance=instance,this.options=options,this.options||(this.options=new ActionHandlerOptions),this.options.flow==ActionFlow.IFrame&&((instance=document.createElement("div")).id="processoutjs-action-modal",instance.style.position="fixed",instance.style.top="0",instance.style.left="0",instance.style.height="100%",instance.style.width="100%",instance.setAttribute("style","position: fixed; top: 0; left: 0; background: rgba(0, 0, 0, 0.5); z-index: 9999999; overflow: auto;"),(iframe=document.createElement("iframe")).setAttribute("style","margin: 1em auto; width: ".concat(this.options.iframeWidth,"px; height: ").concat(this.options.iframeHeight,'px; max-width: 100%; max-height: 100%; display: block; box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07); background-color: #ECEFF1; background-image: url("').concat(this.instance.endpoint("js","/images/loader.gif"),'"); background-repeat: no-repeat; background-position: center;")')),iframe.setAttribute("frameborder","0"),iframe.onload=function(){iframe.style.backgroundImage=null},(options=document.createElement("div")).setAttribute("style","width: 100%; text-align: center; margin-bottom: 1em;"),(button=document.createElement("div")).setAttribute("style","cursor: pointer; color: white;"),button.innerHTML=ProcessOut.Translator.translateMessage("label.cancel","Cancel"),options.appendChild(button),instance.appendChild(iframe),instance.appendChild(options),this.iframeWrapper=new MockedIFrameWindow(instance,iframe),button.onclick=function(){this.iframeWrapper.close()}.bind(this))}return ActionHandler.prototype.handle=function(url,success,error){var _a,timeout,topLayer,newWindow,timer,t=this,refocus=function(){topLayer&&topLayer.remove(),window.focus()};switch(this.options.flow){case ActionFlow.NewWindow:_a=this.createNewWindow(url),topLayer=_a.topLayer,newWindow=_a.newWindow;break;case ActionFlow.IFrame:(newWindow=this.iframeWrapper).open(url);break;case ActionFlow.FingerprintIframe:(newWindow=this.createFingerprintIFrame()).open(url),timeout=setTimeout(function(){clearInterval(timer),timer=null,newWindow.close(),error(new ProcessOut.Exception("three-d-s-2.fingerprint-timed-out"))},1e4);break;case ActionFlow.CurrentWindow:(newWindow=window).location.replace(url);break;default:_a=this.createNewTabOrWindow(url),topLayer=_a.topLayer,newWindow=_a.newWindow}return newWindow?(timer=setInterval(function(){if(timer)if(t.isCanceled())clearInterval(timer),timer=null,newWindow.close(),error(new ProcessOut.Exception("customer.canceled")),refocus();else{var cancelf=function(){clearInterval(timer),timer=null,error(new ProcessOut.Exception("customer.canceled")),refocus()};try{newWindow&&!newWindow.closed||cancelf()}catch(err){try{newWindow.close()}catch(err){}cancelf()}}},500),this.listenEvents(newWindow,timer,refocus,function(data){timeout&&clearTimeout(timeout),success(data)},function(err){timeout&&clearTimeout(timeout),error(err)}),this):(error(new ProcessOut.Exception("customer.popup-blocked")),refocus(),null)},ActionHandler.prototype.createNewTabOrWindow=function(url){url=window.open(url,this.newWindowName);return this.setupWindowObject(url)},ActionHandler.prototype.createNewWindow=function(url){var h=this.options.newWindowHeight,w=this.options.newWindowWidth,y=window.top.outerHeight/2+window.top.screenY-h/2,x=window.top.outerWidth/2+window.top.screenX-w/2,url=window.open(url,this.newWindowName,"menubar=false,toolbar=false,width=".concat(w,",height=").concat(h,",top=").concat(y,",left=").concat(x));return this.setupWindowObject(url)},ActionHandler.prototype.setupWindowObject=function(newWindow){var ret,topLayerMessageImage;return newWindow?(ret={topLayer:null,newWindow:newWindow},newWindow=function(e){try{ret.newWindow.close()}catch(err){}},window.addEventListener("beforeunload",newWindow,!1),window.addEventListener("pagehide",newWindow,!1),ret.topLayer=document.createElement("div"),ret.topLayer.id="processoutjs-action-modal",ret.topLayer.setAttribute("style","position: fixed; top: 0; left: 0; background: rgba(0, 0, 0, 0.7); z-index: 9999999; overflow: auto; height: 100%; width: 100%;"),(newWindow=document.createElement("div")).setAttribute("style","text-align: center; color: white; max-width: 350px; margin: 0 auto; margin-top: 10%; cursor: pointer;"),this.options.gatewayLogo&&((topLayerMessageImage=document.createElement("img")).setAttribute("style","max-height: 70px; max-width: 230px; filter: saturate(0) grayscale(1) brightness(0.6) contrast(100000) invert(1); margin-bottom: 2em;"),topLayerMessageImage.setAttribute("src",this.options.gatewayLogo),newWindow.appendChild(topLayerMessageImage)),(topLayerMessageImage=document.createElement("div")).innerHTML=ProcessOut.Translator.translateMessage("label.apm-description"),newWindow.appendChild(topLayerMessageImage),ret.topLayer.appendChild(newWindow),newWindow.addEventListener("click",function(){ret.newWindow.focus()}.bind(this),!1),(topLayerMessageImage=document.createElement("div")).setAttribute("style","text-align: center; color: white; max-width: 350px; margin: 0 auto; margin-top: 3em; cursor: pointer; opacity: 0.9;"),topLayerMessageImage.innerHTML=ProcessOut.Translator.translateMessage("label.cancel"),ret.topLayer.appendChild(topLayerMessageImage),topLayerMessageImage.addEventListener("click",function(){this.cancel()}.bind(this),!1),document.body.appendChild(ret.topLayer),ret):{}},ActionHandler.prototype.createFingerprintIFrame=function(){var iframeWrapper=document.createElement("div"),iframe=(iframeWrapper.id="processoutjs-fingerprint-wrapper",iframeWrapper.style.height="0",iframeWrapper.style.width="0",document.createElement("iframe"));return iframe.style.display="none",iframe.setAttribute("frameborder","0"),iframeWrapper.appendChild(iframe),new MockedIFrameWindow(iframeWrapper,iframe)},ActionHandler.prototype.listenEvents=function(newWindow,timer,refocus,success,error){var cur=++ActionHandler.listenerCount,alreadyDone=!1,handler=function(event){var data=ProcessOut.Message.parseEvent(event);if(data.namespace==ProcessOut.Message.checkoutNamespace)if(ActionHandler.listenerCount!=cur)timer&&(clearInterval(timer),timer=null);else if(!alreadyDone)switch(alreadyDone=!0,data.action){case"success":timer&&(clearInterval(timer),timer=null),newWindow.close(),success(data.data),refocus();break;case"canceled":timer&&(clearInterval(timer),timer=null),newWindow.close(),error(new ProcessOut.Exception("customer.canceled")),refocus();break;case"none":timer&&(clearInterval(timer),timer=null),newWindow.close(),error(new ProcessOut.Exception("processout-js.no-customer-action")),refocus();break;case"error":timer&&(clearInterval(timer),timer=null),newWindow.close(),error(new ProcessOut.Exception(data.errorCode,data.errorMessage)),refocus();break;default:timer&&(clearInterval(timer),timer=null),newWindow.close(),error(new ProcessOut.Exception("default")),refocus()}};window.addEventListener("message",handler),new ProcessOut.MessageHub(this.instance,null,function(k,v){v=ProcessOut.Message.parseEvent({data:v});v.namespace=k,handler({data:JSON.stringify(v)})})},ActionHandler.prototype.cancel=function(){this.canceled=!0},ActionHandler.prototype.isCanceled=function(){return this.canceled},ActionHandler.listenerCount=0,ActionHandler}());ProcessOut.ActionHandler=ActionHandler}(ProcessOut=ProcessOut||{}); diff --git a/src/dynamic-checkout/elements/payment-methods-manager.ts b/src/dynamic-checkout/elements/payment-methods-manager.ts index d9d7e0a..21f5e3c 100644 --- a/src/dynamic-checkout/elements/payment-methods-manager.ts +++ b/src/dynamic-checkout/elements/payment-methods-manager.ts @@ -5,10 +5,15 @@ module ProcessOut { public element: HTMLElement; private expressPaymentMethods: PaymentMethodButton[]; public modal: any; + private paymentConfig: DynamicCheckoutPaymentConfigType; - constructor(expressPaymentMethods: PaymentMethodButton[]) { + constructor( + expressPaymentMethods: PaymentMethodButton[], + paymentConfig: DynamicCheckoutPaymentConfigType + ) { this.expressPaymentMethods = expressPaymentMethods; this.element = this.createElement(); + this.paymentConfig = paymentConfig; } private createElement() { @@ -44,15 +49,25 @@ module ProcessOut { footer: true, stickyFooter: false, closeMethods: ["overlay", "button", "escape"], - closeLabel: "Close", + closeLabel: Translations.getText( + "payments-manager-close-button", + this.paymentConfig.locale + ), }) : null; this.modal.setContent(this.createModalContent()); - this.modal.addFooterBtn("Close", "close-modal-btn", () => { - this.modal.close(); - }); + this.modal.addFooterBtn( + Translations.getText( + "payments-manager-close-button", + this.paymentConfig.locale + ), + "close-modal-btn", + () => { + this.modal.close(); + } + ); this.modal.open(); } @@ -67,7 +82,10 @@ module ProcessOut { { tagName: "div", classNames: ["dco-modal-content-header"], - textContent: "Manage saved payment methods", + textContent: Translations.getText( + "payments-manager-header", + this.paymentConfig.locale + ), }, { tagName: "div", diff --git a/src/dynamic-checkout/locales/en.ts b/src/dynamic-checkout/locales/en.ts index 7606547..94d6f44 100644 --- a/src/dynamic-checkout/locales/en.ts +++ b/src/dynamic-checkout/locales/en.ts @@ -25,5 +25,7 @@ module ProcessOut { "city-label": "City", "postcode-label": "Postal code", "state-label": "State", + "payments-manager-header": "Manage saved payment methods", + "payments-manager-close-button": "Close", }; } diff --git a/src/dynamic-checkout/locales/es.ts b/src/dynamic-checkout/locales/es.ts index 587228a..282c688 100644 --- a/src/dynamic-checkout/locales/es.ts +++ b/src/dynamic-checkout/locales/es.ts @@ -26,5 +26,7 @@ module ProcessOut { "city-label": "Ciudad", "postcode-label": "Código postal", "state-label": "Estado", + "payments-manager-header": "Administrar métodos de pago guardados", + "payments-manager-close-button": "Cerrar", }; } diff --git a/src/dynamic-checkout/locales/fr.ts b/src/dynamic-checkout/locales/fr.ts index e2d6f3e..c51fd5c 100644 --- a/src/dynamic-checkout/locales/fr.ts +++ b/src/dynamic-checkout/locales/fr.ts @@ -27,5 +27,7 @@ module ProcessOut { "city-label": "Ville", "postcode-label": "Code postal", "state-label": "État", + "payments-manager-header": "Gérer les méthodes de paiement enregistrées", + "payments-manager-close-button": "Fermer", }; } diff --git a/src/dynamic-checkout/locales/pl.ts b/src/dynamic-checkout/locales/pl.ts index 9889d5a..1054c43 100644 --- a/src/dynamic-checkout/locales/pl.ts +++ b/src/dynamic-checkout/locales/pl.ts @@ -28,5 +28,7 @@ module ProcessOut { "city-label": "Miasto", "postcode-label": "Kod pocztowy", "state-label": "Stan", + "payments-manager-header": "Zarządzaj zapisanymi metodami płatności", + "payments-manager-close-button": "Zamknij", }; } diff --git a/src/dynamic-checkout/locales/pt.ts b/src/dynamic-checkout/locales/pt.ts index fa7e424..943fe60 100644 --- a/src/dynamic-checkout/locales/pt.ts +++ b/src/dynamic-checkout/locales/pt.ts @@ -27,5 +27,7 @@ module ProcessOut { "city-label": "Cidade", "postcode-label": "Código postal", "state-label": "Estado", + "payments-manager-header": "Gerenciar métodos de pagamento salvos", + "payments-manager-close-button": "Fechar", }; } diff --git a/src/dynamic-checkout/views/payment-methods.ts b/src/dynamic-checkout/views/payment-methods.ts index f60f2e2..e988651 100644 --- a/src/dynamic-checkout/views/payment-methods.ts +++ b/src/dynamic-checkout/views/payment-methods.ts @@ -174,7 +174,8 @@ module ProcessOut { } this.paymentMethodsManager = new PaymentMethodsManager( - expressPaymentMethods + expressPaymentMethods, + this.paymentConfig ); expressCheckoutHeader.appendChild(this.paymentMethodsManager.element);