secure.medilisk.com
Open in
urlscan Pro
151.101.194.132
Public Scan
URL:
https://secure.medilisk.com/apps/161744/8
Submission: On July 30 via api from US — Scanned from US
Submission: On July 30 via api from US — Scanned from US
Form analysis
0 forms found in the DOMText Content
// Copyright (c) Funnelish, Ginigo Ltd. 2024, All rights reserved. // Modified on: 16/06/2024 - 01:23 "use strict";function _typeof(o){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o})(o)}function _regeneratorRuntime(){_regeneratorRuntime=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{define({},"")}catch(t){define=function(t,e,r){return t[e]=r}}function wrap(t,e,r,n){e=e&&e.prototype instanceof Generator?e:Generator,e=Object.create(e.prototype),n=new Context(n||[]);return o(e,"_invoke",{value:makeInvokeMethod(t,r,n)}),e}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var i={},d=(define(i,a,function(){return this}),Object.getPrototypeOf),d=d&&d(d(values([]))),g=(d&&d!==r&&n.call(d,a)&&(i=d),GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(i));function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t)})})}function AsyncIterator(t,e){function invoke(r,o,i,a){var u,r=tryCatch(t[r],t,o);if("throw"!==r.type)return(o=(u=r.arg).value)&&"object"==_typeof(o)&&n.call(o,"__await")?e.resolve(o.__await).then(function(t){invoke("next",t,i,a)},function(t){invoke("throw",t,i,a)}):e.resolve(o).then(function(t){u.value=t,i(u)},function(t){return invoke("throw",t,i,a)});a(r.arg)}var r;o(this,"_invoke",{value:function(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r)})}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}})}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){c=function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;n=tryCatch(o,e.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,y;o=n.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}(c,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=f;c=tryCatch(e,r,n);if("normal"===c.type){if(o=n.done?s:l,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=s,n.method="throw",n.arg=c.arg)}}}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0)}function values(e){if(e||""===e){var o,r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return o=-1,(r=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next}).next=r}throw new TypeError(_typeof(e)+" is not iterable")}return o(g,"constructor",{value:GeneratorFunction.prototype=GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){t="function"==typeof t&&t.constructor;return!!t&&(t===GeneratorFunction||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t},e.awrap=function(t){return{__await:t}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next()})},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this}),define(g,"toString",function(){return"[object Generator]"}),e.keys=function(t){var n,e=Object(t),r=[];for(n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next}return next.done=!0,next}},e.values=values,Context.prototype={constructor:Context,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var o=this.tryEntries.length-1;0<=o;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;0<=r;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}var a=(i=i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc?null:i)?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y}},catch:function(t){for(var e=this.tryEntries.length-1;0<=e;--e){var n,o,r=this.tryEntries[e];if(r.tryLoc===t)return"throw"===(n=r.completion).type&&(o=n.arg,resetTryEntry(r)),o}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}function ownKeys(e,r){var o,t=Object.keys(e);return Object.getOwnPropertySymbols&&(o=Object.getOwnPropertySymbols(e),r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)),t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value}catch(n){return void e(n)}i.done?t(u):Promise.resolve(u).then(r,o)}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n)}_next(void 0)})}}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o)}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function _toPropertyKey(t){t=_toPrimitive(t,"string");return"symbol"==_typeof(t)?t:t+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0===e)return("string"===r?String:Number)(t);e=e.call(t,r||"default");if("object"!=_typeof(e))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}var instance,fPayKlarna=function(){return _createClass(function fPayKlarna(fPayInstance,method){_classCallCheck(this,fPayKlarna),this.fpay=fPayInstance,this.config=null,this.method=method,this.userGatewayId=method.user_gateway_id,(method.instance=this).fpay.klarnaInstance=this},[{key:"isLoaded",value:function(){return"undefined"!=typeof Klarna}},{key:"loadJs",value:function(callback){this.isLoaded()?callback():(funnelish.loadScript("https://x.klarnacdn.net/kp/lib/v1/api.js",callback),this.addHooks())}},{key:"loadSettings",value:(_loadSettings=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(){var products,data,_this=this,_args=arguments;return _regeneratorRuntime().wrap(function(_context){for(;;)switch(_context.prev=_context.next){case 0:return products=(products=0<_args.length&&void 0!==_args[0]?_args[0]:null)||this.getProductsArray(),_context.next=4,funnelish.post("/gateways/".concat(funnelish.funnelId,"/").concat(this.method.gateway_id,"/settings"),_objectSpread(_objectSpread({},funnelish.getAuthHeader()),{},{user_gateway_id:this.userGatewayId,app_id:this.fpay.id,country:funnelish.countries.country,currency:funnelish.currency(),products:products,current_client_token:this.config&&this.config.session?this.config.session.client_token:"",discount_id:funnelish.discount?funnelish.discount.discount_id:null,is_oto:funnelish.isOTO()}));case 4:if("failed"===(data=_context.sent).status)return console.error("Something went wrong",data),_context.abrupt("return");_context.next=8;break;case 8:this.config=data,this.loadJs(function(){return _this.setup()});case 10:case"end":return _context.stop()}},_callee,this)})),function(){return _loadSettings.apply(this,arguments)})},{key:"categories",value:function(){return this.config.session.payment_method_categories||[]}},{key:"setup",value:function(){var pfOptions,div,oldIdentifier,_this2=this;(funnelish.isOTO()||funnelish.isOrderForm())&&(this.config&&this.config.session?this.config.error?(console.error(this.config.error),this.fpay.showError(this.config.error)):(pfOptions=[],oldIdentifier="klarna",oldIdentifier=funnelish.isOTO()?((pfOptions=document.querySelector(".klarna-hidden-pf-options"))||((div=document.createElement("div")).className="klarna-hidden-pf-options hidden",document.body.appendChild(div),pfOptions=document.querySelector(".klarna-hidden-pf-options")),funnelish.getCookie("fpay_klarna_category")||"klarna"):(div=(pfOptions=document.querySelector(".payment-form .pf-options")).querySelector(".pf-header.klarna [name='checkout[payment_gateway]']:checked"))?div.dataset.identifier:null,Klarna.Payments.init({client_token:this.config.session.client_token}),this.categories().length?(pfOptions.querySelectorAll(".pf-option.klarna").forEach(function(r){return r.remove()}),this.categories().forEach(function(m){var html='<label class="pf-header klarna '.concat(m.identifier,'">\n\t\t\t\t\t\t\t<input type="radio" data-identifier="').concat(m.identifier,'" \n\t\t\t\t\t\t\t\tgroup-id="').concat(_this2.method.group_id,'" user-gateway-id="').concat(_this2.method.user_gateway_id,'" \n\t\t\t\t\t\t\t\tgateway-id="').concat(_this2.method.gateway_id,'" name="checkout[payment_gateway]">\n\t\t\t\t\t\t\t<span>').concat(m.name||"Buy now, Pay later",'</span>\n\t\t\t\t\t\t\t<img class="pf-klarna-logo" src="').concat(m.asset_urls.descriptive,'" />\n\t\t\t\t\t\t</label>\n\n\t\t\t\t\t\t<div class="pf-content klarna ').concat(m.identifier,'" data-identifier="').concat(m.identifier,'"></div>'),div=document.createElement("div"),el=(div.innerHTML=html,div.className="pf-option klarna",pfOptions.appendChild(div),pfOptions.querySelector(".pf-header.klarna.".concat(m.identifier," [name='checkout[payment_gateway]']")));el&&el.addEventListener("change",function(){_this2.fpay.checkGateway()}),Klarna.Payments.load({container:".pf-option.klarna .pf-content.".concat(m.identifier),payment_method_category:m.identifier},function(res){oldIdentifier&&m.identifier===oldIdentifier&&el&&(el.checked=!0,el.dispatchEvent(new Event("change",{bubbles:!0})))})})):this.fpay.showError("Try a different payment method")):this.fpay.showError("Try a different payment method"))}},{key:"addHooks",value:function(){var _this3=this;funnelish.on("discount_applied",function(){_this3.loadSettings()}),document.querySelectorAll('input[name="product-id"], .product-list .pl-item .pl-variant-option input').forEach(function(x){x.addEventListener("change",function(){_this3.loadSettings()})})}},{key:"getProductsArray",value:function(){var plist=[],products=funnelish.getSelectedProducts()||[];return(products=!products.length&&funnelish.products&&0<funnelish.products.length?[{product:funnelish.products[0],qty:1}]:products).forEach(function(p){p.product&&plist.push({product_id:p.product.id,qty:p.qty,variant_option1:p.variant_option1,variant_option2:p.variant_option2,variant_option3:p.variant_option3})}),plist}},{key:"getVariantPrice",value:function(product){var variant=1<arguments.length&&void 0!==arguments[1]&&arguments[1],price=product&&product.price||0;return price=variant&&(product=product.options?product.options.find(function(o){return o.title===variant}):null)&&product.price?product.price:price}},{key:"authorizeOto",value:function(customer,productIds){productIds.forEach(function(pid){pid.product=funnelish.findProduct(pid.product_id)});["first_name","last_name","full_name","email","phone","address","zip","state","city","country","shipping_address","shipping_zip","shipping_state","shipping_city","shipping_country"].forEach(function(field){customer[field]=localStorage.getItem("fnsh.core.customer.".concat(field))}),customer.optin_email=customer.email,this.authorize(customer,productIds)}},{key:"authorize",value:function(customer,products){var _this4=this,total=0,lines=[],cat=document.querySelector(".pf-option.klarna [name='checkout[payment_gateway]']:checked"),category=cat?cat.dataset.identifier:null;console.log("authorize","products",products,"customer",customer),products.forEach(function(p){var vt;p.product&&(vt=[p.variant_option1,p.variant_option2,p.variant_option3].filter(Boolean).join(" / "),vt=100*_this4.getVariantPrice(p.product,vt),total+=vt*p.qty,vt={type:"physical",reference:p.product.id+"",name:p.product.name,quantity:p.qty,unit_price:vt,tax_rate:0,total_amount:vt*p.qty,total_discount_amount:0,total_tax_amount:0,product_url:window.location.href},p.product.imageUrl&&(vt.image_url=p.product.imageUrl),lines.push(vt))}),console.log("products",products,"lines",lines,"category",category),Klarna.Payments.authorize({payment_method_category:category||"klarna"},{purchase_country:funnelish.countries.country,purchase_currency:funnelish.currency(),billing_address:{given_name:customer.first_name,family_name:customer.last_name,email:customer.optin_email,street_address:customer.address||customer.shipping_address,postal_code:customer.zip||customer.shipping_zip,city:customer.city||customer.shipping_city,region:customer.state||customer.shipping_state,phone:customer.phone,country:customer.country||customer.shipping_country},shipping_address:{given_name:customer.first_name,family_name:customer.last_name,email:customer.optin_email,street_address:customer.shipping_address||customer.address,postal_code:customer.shipping_zip||customer.zip,city:customer.shipping_city||customer.city,region:customer.shipping_state||customer.state,phone:customer.phone,country:customer.shipping_country||customer.country},order_amount:total,order_lines:lines,customer:{}},function(res){var token;console.debug(res),res.error&&res.error.invalid_fields?_this4.fpay.showError("Invalid fields: "+res.error.invalid_fields.join(", ")+"."):res.approved?res.approved&&((token=res.authorization_token)?funnelish.isOTO()?_this4.payOto(customer,products,token,{category:category}):_this4.fpay.pay(products,null,token,{category:category}):_this4.fpay.showError("Invalid token, try a different payment method.")):(console.error("failed:",res),_this4.fpay.showError("Try a different payment method."))})}},{key:"payOto",value:(_payOto=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(customer,products,token){var extra,cid,gatewayGroupId,userGatewayId,data,_args2=arguments;return _regeneratorRuntime().wrap(function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return extra=3<_args2.length&&void 0!==_args2[3]?_args2[3]:null,cid=this.fpay.getCID(),gatewayGroupId=this.fpay.getNumCookie("fpay_method_group_id"),userGatewayId=this.fpay.getNumCookie("fpay_user_gateway_id"),this.fpay.getNumCookie("fpay_gateway_id"),userGatewayId={user_gateway_id:userGatewayId,gateway_group_id:gatewayGroupId,cid:cid,extra:extra,token:token},funnelish.startLoading(),_context2.prev=7,_context2.next=10,funnelish.post("/pay",_objectSpread(_objectSpread(_objectSpread({},funnelish.getAuthHeader()),userGatewayId),{},{customer:customer,products:products,is_oto:!0,discount_id:funnelish.discount?funnelish.discount.discount_id:null}));case 10:if((data=_context2.sent).success){_context2.next=15;break}throw data.error;case 15:data.result.goto?window.location=data.result.goto:this.fpay.showError(data);case 16:_context2.next=23;break;case 18:_context2.prev=18,_context2.t0=_context2.catch(7),funnelish.stopLoading(),this.fpay.showError(this.fpay.parseError(_context2.t0)),console.error(_context2.t0);case 23:return _context2.prev=23,funnelish.stopLoading(),_context2.finish(23);case 26:case"end":return _context2.stop()}},_callee2,this,[[7,18,23,26]])})),function(_x,_x2,_x3){return _payOto.apply(this,arguments)})}]);var _payOto,_loadSettings}(),fPayMollie=function(){return _createClass(function fPayMollie(fPayInstance,method){_classCallCheck(this,fPayMollie),this.mollie=null,this.fpay=fPayInstance,this.config=null,this.method=method,this.userGatewayId=method.user_gateway_id,(method.instance=this).fpay.mollieInstance=this},[{key:"isLoaded",value:function(){return"undefined"!=typeof Mollie}},{key:"loadJs",value:function(callback){this.isLoaded()?callback():funnelish.loadScript("https://js.mollie.com/v1/mollie.js",callback)}},{key:"loadSettings",value:(_loadSettings2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(){var data,_this5=this;return _regeneratorRuntime().wrap(function(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:return _context3.next=3,funnelish.post("/gateways/".concat(funnelish.funnelId,"/").concat(this.method.gateway_id,"/settings"),_objectSpread(_objectSpread({},funnelish.getAuthHeader()),{},{user_gateway_id:this.userGatewayId,app_id:this.fpay.id,country:funnelish.countries.country,currency:funnelish.currency(),products:[],current_client_token:this.config&&this.config.session?this.config.session.client_token:"",discount_id:funnelish.discount?funnelish.discount.discount_id:null,is_oto:funnelish.isOTO()}));case 3:if("failed"===(data=_context3.sent).status)return console.error("Something went wrong",data),_context3.abrupt("return");_context3.next=7;break;case 7:this.config=data,this.loadJs(function(){return _this5.setup()});case 9:case"end":return _context3.stop()}},_callee3,this)})),function(){return _loadSettings2.apply(this,arguments)})},{key:"getLocale",value:function(){var l=navigator.language;return["en_US","nl_NL","nl_BE","fr_FR","fr_BE","de_DE","de_AT","de_CH","es_ES","ca_ES","pt_PT","it_IT","nb_NO","sv_SE","fi_FI","da_DK","is_IS","hu_HU","pl_PL","lv_LV","lt_L"].includes(l)?l:"en_US"}},{key:"setup",value:function(){var options;(funnelish.isOTO()||funnelish.isOrderForm())&&(this.config&&this.config.mollie_profile_id?this.config.error?(console.error(this.config.error),this.fpay.showError(this.config.error)):this.method.gateway_id!==this.fpay.MOLLIE||(this.mollie=Mollie(this.config.mollie_profile_id,{locale:this.getLocale(),testmode:funnelish.isTestMode()}),funnelish.isOTO())||(options={styles:{base:{color:"dark"===this.fpay.theme?"#c7c7c7":"#000000",fontSize:"16px","::placeholder":{color:"dark"===this.fpay.theme?"#CFD7DF":"#c6ced6"}},valid:{color:"dark"===this.fpay.theme?"#0ad20a":"#090"}}},this.mollie.createComponent("cardHolder",options).mount("#card_cardholder_container"),this.mollie.createComponent("cardNumber",options).mount("#card_number_container"),this.mollie.createComponent("expiryDate",options).mount("#mm_yy_container"),this.mollie.createComponent("verificationCode",options).mount("#cvc_container")):this.fpay.showError("Try a different payment method"))}},{key:"getToken",value:(_getToken=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(){var token,_yield$this$mollie$cr;return _regeneratorRuntime().wrap(function(_context4){for(;;)switch(_context4.prev=_context4.next){case 0:return _context4.prev=0,_context4.next=3,this.mollie.createToken();case 3:if(_yield$this$mollie$cr=_context4.sent,token=_yield$this$mollie$cr.token,_yield$this$mollie$cr=_yield$this$mollie$cr.error)return this.fpay.showError(_yield$this$mollie$cr),_context4.abrupt("return");_context4.next=9;break;case 9:return _context4.abrupt("return",token);case 12:return _context4.prev=12,_context4.t0=_context4.catch(0),this.fpay.showError(_context4.t0),_context4.abrupt("return",null);case 16:case"end":return _context4.stop()}},_callee4,this,[[0,12]])})),function(){return _getToken.apply(this,arguments)})},{key:"payOto",value:(_payOto2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(customer,products,token){var extra,cid,gatewayGroupId,userGatewayId,data,_args5=arguments;return _regeneratorRuntime().wrap(function(_context5){for(;;)switch(_context5.prev=_context5.next){case 0:return extra=3<_args5.length&&void 0!==_args5[3]?_args5[3]:null,cid=this.fpay.getCID(),gatewayGroupId=this.fpay.getNumCookie("fpay_method_group_id"),userGatewayId=this.fpay.getNumCookie("fpay_user_gateway_id"),this.fpay.getNumCookie("fpay_gateway_id"),userGatewayId={user_gateway_id:userGatewayId,gateway_group_id:gatewayGroupId,cid:cid,extra:extra,token:token},funnelish.startLoading(),_context5.prev=7,_context5.next=10,funnelish.post("/pay",_objectSpread(_objectSpread(_objectSpread({},funnelish.getAuthHeader()),userGatewayId),{},{customer:customer,products:products,is_oto:!0,discount_id:funnelish.discount?funnelish.discount.discount_id:null}));case 10:if((data=_context5.sent).success){_context5.next=15;break}throw data.error;case 15:data.result.goto?window.location=data.result.goto:this.fpay.showError(data);case 16:_context5.next=23;break;case 18:_context5.prev=18,_context5.t0=_context5.catch(7),funnelish.stopLoading(),this.fpay.showError(this.fpay.parseError(_context5.t0)),console.error(_context5.t0);case 23:return _context5.prev=23,funnelish.stopLoading(),_context5.finish(23);case 26:case"end":return _context5.stop()}},_callee5,this,[[7,18,23,26]])})),function(_x4,_x5,_x6){return _payOto2.apply(this,arguments)})}]);var _payOto2,_getToken,_loadSettings2}(),fPayAirwallex=function(){return _createClass(function fPayAirwallex(fPayInstance,method){_classCallCheck(this,fPayAirwallex),this.airwallex=null,this.fpay=fPayInstance,this.config=null,this.method=method,this.userGatewayId=method.user_gateway_id,((method.instance=this).fpay.airwallexInstance=this).cardNumber=null},[{key:"isLoaded",value:function(){return"undefined"!=typeof Airwallex}},{key:"loadJs",value:function(callback){this.isLoaded()?callback():funnelish.loadScript("https://checkout.airwallex.com/assets/elements.bundle.min.js",callback)}},{key:"loadSettings",value:(_loadSettings3=_asyncToGenerator(_regeneratorRuntime().mark(function _callee6(){var data,_this6=this;return _regeneratorRuntime().wrap(function(_context6){for(;;)switch(_context6.prev=_context6.next){case 0:return _context6.next=3,funnelish.post("/gateways/".concat(funnelish.funnelId,"/").concat(this.method.gateway_id,"/settings"),_objectSpread(_objectSpread({},funnelish.getAuthHeader()),{},{user_gateway_id:this.userGatewayId,app_id:this.fpay.id,country:funnelish.countries.country,currency:funnelish.currency(),products:[],current_client_token:this.config&&this.config.session?this.config.session.client_token:"",discount_id:funnelish.discount?funnelish.discount.discount_id:null,is_oto:funnelish.isOTO()}));case 3:if("failed"===(data=_context6.sent).status)return console.error("Something went wrong",data),_context6.abrupt("return");_context6.next=7;break;case 7:this.config=data,this.loadJs(function(){return _this6.setup()});case 9:case"end":return _context6.stop()}},_callee6,this)})),function(){return _loadSettings3.apply(this,arguments)})},{key:"setup",value:function(){if(funnelish.isOTO()||funnelish.isOrderForm())if(this.config&&this.config.is_connected){if(this.config.error)console.error(this.config.error),this.fpay.showError(this.config.error);else if(this.method.gateway_id===this.fpay.AIRWALLEX&&(this.airwallex=Airwallex.init({env:this.config.env||"demo",origin:window.location.origin}),!funnelish.isOTO())){var info={};try{info=JSON.parse(this.method.info)}catch(e){console.warn(e)}this.cardNumber=Airwallex.createElement("cardNumber",{placeholder:info.cc||null,style:{base:{fontFamily:"monospace",color:"dark"===this.fpay.theme?"#c7c7c7":"#000000"}}}),this.cardElement=this.cardNumber.mount("card_number_container");var expiryDate=Airwallex.createElement("expiry",{placeholder:info.expiry||null,style:{base:{fontFamily:"monospace",color:"dark"===this.fpay.theme?"#c7c7c7":"#000000"}}}),expiryDate=(this.expiryElement=expiryDate.mount("mm_yy_container"),Airwallex.createElement("cvc",{placeholder:info.cvc||null,style:{base:{fontFamily:"monospace",color:"dark"===this.fpay.theme?"#c7c7c7":"#000000"}}})),info=(this.cvcElement=expiryDate.mount("cvc_container"),function(event){var _event$detail=event.detail,complete=_event$detail.complete,_event$detail=_event$detail.error,event=event.target;event&&(_event$detail&&"required"===_event$detail.code||event.classList.remove("error"),complete?event.classList.add("complete"):event.classList.remove("complete"))}),expiryDate=function(event){var complete=event.detail.complete,error=event.detail.error,event=event.target;event&&event.classList.remove("active"),error&&"required"!==error.code?event.classList.add("error"):event.classList.remove("error"),complete&&event.classList.add("complete")},onFocus=function(event){event=event.target;event&&event.classList.add("active")};this.cardElement.addEventListener("onChange",info),this.cardElement.addEventListener("onFocus",onFocus),this.cardElement.addEventListener("onBlur",expiryDate),this.expiryElement.addEventListener("onChange",info),this.expiryElement.addEventListener("onFocus",onFocus),this.expiryElement.addEventListener("onBlur",expiryDate),this.cvcElement.addEventListener("onChange",info),this.cvcElement.addEventListener("onFocus",onFocus),this.cvcElement.addEventListener("onBlur",expiryDate)}}else this.fpay.showError("Try a different payment method")}},{key:"generateAddress",value:function(customer){var address={};return(customer.country||customer.shipping_country)&&(address.country_code=customer.country||customer.shipping_country),(customer.zip||customer.shipping_zip)&&(address.postcode=customer.zip||customer.shipping_zip),(customer.address||customer.shipping_address)&&(address.street=customer.address||customer.shipping_address),customer.state&&(address.state=customer.state),(customer.city||customer.shipping_city)&&(address.city=customer.city),"UK"===address.country_code&&(address.country_code="GB"),address}},{key:"generateBilling",value:function(customer){var address=this.generateAddress(customer),address={email:customer.optin_email,first_name:customer.first_name,last_name:customer.last_name,address:address};return customer.phone&&(address.phone_number=customer.phone),address}},{key:"pay",value:(_pay=_asyncToGenerator(_regeneratorRuntime().mark(function _callee7(data){var r,resp,intent;return _regeneratorRuntime().wrap(function(_context7){for(;;)switch(_context7.prev=_context7.next){case 0:if(data.result){_context7.next=3;break}return console.error("something is wrong! ",data),_context7.abrupt("return");case 3:return r=data.result,this.email,_context7.next=7,Airwallex.createPaymentConsent({intent_id:r.reference,customer_id:r.customer_id,client_secret:r.client_secret,currency:funnelish.currency(),element:this.cardNumber,next_triggered_by:"merchant"});case 7:return resp=_context7.sent,_context7.next=10,Airwallex.getPaymentIntent(r.reference,r.client_secret);case 10:intent=_context7.sent,console.log("intent",intent,"consent",resp),funnelish.stopLoading(),intent&&"SUCCEEDED"===intent.status?window.location=intent.return_url+"?payment_consent_id=".concat(intent.payment_consent_id,"&payment_intent_id=").concat(intent.id):this.fpay.showError(resp.error||"something went wrong! try again later.");case 14:case"end":return _context7.stop()}},_callee7,this)})),function(_x7){return _pay.apply(this,arguments)})},{key:"payOto",value:(_payOto3=_asyncToGenerator(_regeneratorRuntime().mark(function _callee8(data){var r,consentId;return _regeneratorRuntime().wrap(function(_context8){for(;;)switch(_context8.prev=_context8.next){case 0:if(data.result){_context8.next=3;break}return console.error("something is wrong! ",data),_context8.abrupt("return");case 3:(r=data.result).goto&&(consentId=funnelish.getCookie("fpay_airwallex_consent_id"),window.location=r.goto+"?payment_consent_id=".concat(consentId,"&payment_intent_id=").concat(r.reference));case 5:case"end":return _context8.stop()}},_callee8)})),function(_x8){return _payOto3.apply(this,arguments)})}]);var _payOto3,_pay,_loadSettings3}(),appFPay=function(){return _createClass(function appFPay(){_classCallCheck(this,appFPay),this.STRIPEID=1,this.IDEALID=8,this.NMI=9,this.KLARNASTRIPE=10,this.BANCONTACTSTRIPE=11,this.SOFORTSTRIPE=12,this.SEPASTRIPE=13,this.CHECKOUT_COM=14,this.P24STRIPE=15,this.RAZORPAYID=16,this.EPS=17,this.KLARNA=19,this.MOLLIE=20,this.MOLLIE_IDEAL=21,this.MOLLIE_BANCONTACT=22,this.AIRWALLEX=23,this.id=8,this.name="Funnelish Pay",this.defaultMethod=null,this.paymentMethods=null,this.config=[],this.funnel_config=[],this.stripe=null,this.stripeCard=null,this.pageUrl=window.funnelish.pageUrl,this.gateways=!1,this.beta=funnelish.isBeta(),this.stripeConfig=null,this.idealConfig=null,this.method_codes=null,this.nmiConfig=null,this.idealBank=null,this.p24Bank=null,this.epsBank=null,this.sepa=null},[{key:"init",value:(_init=_asyncToGenerator(_regeneratorRuntime().mark(function _callee9(app){return _regeneratorRuntime().wrap(function(_context9){for(;;)switch(_context9.prev=_context9.next){case 0:return(window.funnelish.funnelishPay=this).setupCodes(),_context9.next=4,this.loader_setup(app);case 4:this.handleLoadError();case 5:case"end":return _context9.stop()}},_callee9,this)})),function(_x9){return _init.apply(this,arguments)})},{key:"handleLoadError",value:function(){var err=new URLSearchParams(window.location.search).get("fpay-error");err&&err.trim()&&this.showError(err)}},{key:"setupCodes",value:function(){function btn(m){var headline,el=document.querySelector('a[href="#submit-step"]');return el?(headline=(el=(headline=el.querySelector(".btn-headline"))?headline:el)?el.innerText:"Complete Order",'<b id="span_btn_text">"'.concat(headline,'"</b>')):'<b id="span_btn_text">"Complete Order"</b>'}var _this7=this;this.method_codes=[{id:1,name:"Credit Card",html:function(m){return'<div class="pf-option">'.concat(function(m){var amex="",mastercard="",visa="";return(!(1<arguments.length&&void 0!==arguments[1])||arguments[1])&&(visa='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 512 512" \n\t\t\t\t\t\t\t\txml:space="preserve">\n\t\t\t\t\t\t\t<path style="fill:#FFFFFF;" d="M512,402.281c0,16.716-13.55,30.267-30.265,30.267H30.265C13.55,432.549,0,418.997,0,402.281V109.717 c0-16.716,13.55-30.266,30.265-30.266h451.47c16.716,0,30.265,13.551,30.265,30.266V402.281L512,402.281z"></path>\n\t\t\t\t\t\t\t<path style="fill:#F79F1A;" d="M113.64,258.035l-12.022-57.671c-2.055-7.953-8.035-10.319-15.507-10.632H30.993l-0.491,2.635 C73.431,202.774,101.836,227.88,113.64,258.035z"></path>\n\t\t\t\t\t\t\t<g>\n\t\t\t\t\t\t\t\t<polygon style="fill:#059BBF;" points="241.354,190.892 205.741,190.892 183.499,321.419 219.053,321.419 "></polygon>\n\t\t\t\t\t\t\t\t<path style="fill:#059BBF;" d="M135.345,321.288l56.01-130.307h-37.691l-34.843,89.028l-3.719-13.442 c-6.83-16.171-26.35-39.446-49.266-54.098l31.85,108.863L135.345,321.288z"></path>\n\t\t\t\t\t\t\t\t<path style="fill:#059BBF;" d="M342.931,278.75c0.132-14.819-9.383-26.122-29.887-35.458c-12.461-6.03-20.056-10.051-19.965-16.17 c0-5.406,6.432-11.213,20.368-11.213c11.661-0.179,20.057,2.367,26.624,5.003l3.218,1.475l4.826-28.277 c-7.059-2.637-18.094-5.451-31.895-5.451c-35.157,0-59.904,17.691-60.128,43.064c-0.224,18.763,17.692,29.216,31.181,35.469 c13.847,6.374,18.493,10.453,18.404,16.171c-0.089,8.743-11.035,12.73-21.264,12.73c-14.25,0-21.8-1.965-33.509-6.843l-4.55-2.09 l-4.998,29.249c8.303,3.629,23.668,6.801,39.618,6.933C318.361,323.342,342.663,305.876,342.931,278.75z"></path>\n\t\t\t\t\t\t\t\t<path style="fill:#059BBF;" d="M385.233,301.855c4.065,0,40.382,0.045,45.566,0.045c1.072,4.545,4.333,19.565,4.333,19.565h33.011 L439.33,191.027h-27.472c-8.533,0-14.874,2.323-18.628,10.809l-52.845,119.629h37.392 C377.774,321.465,383.848,305.386,385.233,301.855z M409.622,238.645c-0.176,0.357,2.95-7.549,4.737-12.463l2.411,11.256 c0,0,6.792,31.182,8.22,37.704h-29.528C398.411,267.638,409.622,238.645,409.622,238.645z"></path>\n\t\t\t\t\t\t\t\t<path style="fill:#059BBF;" d="M481.735,79.451H30.265C13.55,79.451,0,93.001,0,109.717v31.412h512v-31.412 C512,93.001,498.451,79.451,481.735,79.451z"></path>\n\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t\t<path style="fill:#F79F1A;" d="M481.735,432.549H30.265C13.55,432.549,0,418.998,0,402.283v-31.412h512v31.412 C512,418.998,498.451,432.549,481.735,432.549z"></path>\n\t\t\t\t\t\t\t<path style="opacity:0.15;fill:#202121;enable-background:new ;" d="M21.517,402.281V109.717 c0-16.716,13.551-30.266,30.267-30.266h-21.52C13.55,79.451,0,93.001,0,109.717v292.565c0,16.716,13.55,30.267,30.265,30.267h21.52 C35.069,432.549,21.517,418.997,21.517,402.281z"></path>\n\t\t\t\t\t\t</svg>',mastercard='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 512 512" \n \t\t\t\t\t\t\t\t\txml:space="preserve">\n\t\t\t\t\t\t\t\t<path style="fill:#5286F9;" d="M488.727,66.494H256H23.273C10.42,66.494,0,76.914,0,89.767v332.466 c0,12.853,10.42,23.273,23.273,23.273H256h232.727c12.853,0,23.273-10.42,23.273-23.273V89.767 C512,76.914,501.58,66.494,488.727,66.494z"></path>\n\t\t\t\t\t\t\t\t<path style="fill:#FFB655;" d="M273.776,189.773c5.115,5.86,9.57,12.31,13.236,19.242c7.427,14.041,11.655,30.026,11.655,46.986 s-4.228,32.943-11.655,46.986c-3.666,6.932-8.121,13.38-13.236,19.24c-5.264,6.031-11.23,11.427-17.776,16.069 c16.454,11.664,36.523,18.553,58.182,18.553c55.608,0,100.849-45.241,100.849-100.848S369.79,155.152,314.182,155.152 c-21.659,0-41.728,6.886-58.182,18.553C262.544,178.347,268.51,183.744,273.776,189.773z"></path>\n\t\t\t\t\t\t\t\t<path style="fill:#D8143A;" d="M287.012,209.016c-3.666-6.934-8.121-13.382-13.236-19.242c-5.267-6.031-11.231-11.425-17.776-16.066 c-16.452-11.667-36.523-18.553-58.182-18.553c-55.608,0-100.848,45.241-100.848,100.848s45.241,100.848,100.848,100.848 c21.659,0,41.73-6.887,58.182-18.553c6.546-4.641,12.51-10.038,17.776-16.067c5.115-5.86,9.57-12.31,13.236-19.24 c7.427-14.043,11.655-30.028,11.655-46.986C298.667,239.041,294.439,223.057,287.012,209.016z"></path>\n\t\t\t\t\t\t\t\t<path style="fill:#3D6DEB;" d="M197.818,356.851c-55.608,0-100.848-45.241-100.848-100.848s45.241-100.848,100.848-100.848 c21.659,0,41.728,6.886,58.182,18.553V66.494H23.273C10.42,66.494,0,76.914,0,89.767v332.466c0,12.853,10.42,23.273,23.273,23.273 H256v-107.21C239.546,349.962,219.477,356.851,197.818,356.851z"></path>\n\t\t\t\t\t\t\t</svg>',amex='<svg xmlns="http://www.w3.org/2000/svg" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 291.764 291.764" xml:space="preserve">\n\t\t\t\t\t\t\t<g>\n\t\t\t\t\t\t\t\t<path style="fill:#26A6D1;" d="M18.235,41.025h255.294c10.066,0,18.235,8.169,18.235,18.244v173.235 c0,10.066-8.169,18.235-18.235,18.235H18.235C8.16,250.74,0,242.57,0,232.505V59.269C0,49.194,8.169,41.025,18.235,41.025z"></path>\n\t\t\t\t\t\t\t\t<path style="fill:#FFFFFF;" d="M47.047,113.966l-28.812,63.76h34.492l4.276-10.166h9.774l4.276,10.166h37.966v-7.759l3.383,7.759 h19.639l3.383-7.923v7.923h78.959l9.601-9.902l8.99,9.902l40.555,0.082l-28.903-31.784l28.903-32.058h-39.926l-9.346,9.719 l-8.707-9.719h-85.897l-7.376,16.457l-7.549-16.457h-34.42v7.495l-3.829-7.495C76.479,113.966,47.047,113.966,47.047,113.966z M53.721,123.02h16.813l19.111,43.236V123.02h18.418l14.761,31l13.604-31h18.326v45.752h-11.151l-0.091-35.851l-16.257,35.851 h-9.975l-16.348-35.851v35.851h-22.94l-4.349-10.257H50.147l-4.34,10.248H33.516C33.516,168.763,53.721,123.02,53.721,123.02z M164.956,123.02h45.342L224.166,138l14.315-14.98h13.868l-21.071,22.995l21.071,22.73h-14.497l-13.868-15.154l-14.388,15.154 h-44.64L164.956,123.02L164.956,123.02z M61.9,130.761l-7.741,18.272h15.473L61.9,130.761z M176.153,132.493v8.352h24.736v9.309 h-24.736v9.118h27.745l12.892-13.43l-12.345-13.357h-28.292L176.153,132.493z"></path>\n\t\t\t\t\t\t\t</g>\n\t\t\t\t\t\t</svg>'),'<label class="pf-header">\n\t\t\t\t\t\t<input type="radio" group-id="'.concat(m.group_id,'" \n\t\t\t\t\t\t\t\t\tuser-gateway-id="').concat(m.user_gateway_id,'" gateway-id="').concat(m.gateway_id,'"\n\t\t\t\t\t\t\t\t\t name="checkout[payment_gateway]">\n\t\t\t\t\t\t<span>').concat(m.title||"Credit Card",'</span>\n\t\t\t\t\t\t<ul class="card-icons">\n\t\t\t\t\t\t\t').concat(visa,"\n\t\t\t\t\t\t\t").concat(mastercard,"\n\t\t\t\t\t\t\t").concat(amex,"\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</label>")}(m)+function(m){var j={};try{j=JSON.parse(m.info)}catch(ex){}var cardHolder="";return m.gateway_id===_this7.MOLLIE&&(cardHolder='<div class="fields-container">\n\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t<span id="lbl_card_holder">'.concat(j.cardHolder||"Name on card",'</span>\n\t\t\t\t\t\t\t\t\x3c!-- Card Number Container --\x3e\n\t\t\t\t\t\t\t\t<div id="card_cardholder_container" class="field__input field__input--iframe-container">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t</div>')),'<div class="pf-content layout-column gateway_'.concat(m.gateway_id,'">\n\t\t\t\t\t\t').concat(cardHolder,'\n\t\t\t\t\t\t<div class="fields-container">\n\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t<span id="lbl_card_number">').concat(j.cc||"Card number",'</span>\n\t\t\t\t\t\t\t\t\x3c!-- Card Number Container --\x3e\n\t\t\t\t\t\t\t\t<div id="card_number_container" class="field__input field__input--iframe-container">\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div class="flex layout-row">\n\t\t\t\t\t\t\t<div class="fields-container ccMonthWrap">\n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t<span id="lbl_mm_yy">').concat(j.expiry||"MM / YY",'</span>\n\t\t\t\t\t\t\t\t\t\t\x3c!-- MM / YY Container --\x3e\n\t\t\t\t\t\t\t\t\t<div id="mm_yy_container" class="field__input field__input--iframe-container">\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<div class="fields-container ccCVCWrap">\n\t\t\t\t\t\t\t\t<label>\n\t\t\t\t\t\t\t\t\t<span id="lbl_cvc">').concat(j.cvc||"CVC",'</span>\n\t\t\t\t\t\t\t\t\t\t\x3c!-- CVC Container --\x3e\n\t\t\t\t\t\t\t\t\t<div id="cvc_container" class="field__input field__input--iframe-container">\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>')}(m),"</div>")}},{id:2,name:"Paypal",html:function(m){return'<div class="pf-option">'.concat(function(m){return'\x3c!-- Paypal --\x3e\n\t\t\t\t\t<label class="pf-header">\n\t\t\t\t\t\t<input type="radio" group-id="'.concat(m.group_id,'" \n\t\t\t\t\t\t\t\t\tuser-gateway-id="').concat(m.user_gateway_id,'" gateway-id="').concat(m.gateway_id,'"\n\t\t\t\t\t\t\t\t\t name="checkout[payment_gateway]">\n\t\t\t\t\t\t<img alt="PayPal" class="offsite-payment-gateway-logo" src="/img/billing/paypal.svg">\n\t\t\t\t\t</label>')}(m)+function(m){var t="After clicking ".concat(btn(),"\n\t\t\t\t\t\t\t, you will be redirected to PayPal to complete your purchase securely.");return m&&m.info&&(t=m.info.replace("{SUBMIT_BUTTON}",btn())),'<div class="pf-content">\n\t\t\t\t\t\t<img class="icon-offsite" src="/img/offsite-img.png" />\n\t\t\t\t\t\t<p id="paypal_message_p">\n\t\t\t\t\t\t'.concat(t,"\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>")}(m),"</div>")}},{id:3,name:"COD",html:function(m){return'<div class="pf-option">'.concat(function(m){return'\n<label class="pf-header">\n\t<input type="radio" group-id="'.concat(m.group_id,'" \n\t\t\tuser-gateway-id="').concat(m.user_gateway_id,'" gateway-id="').concat(m.gateway_id,'"\n\t\t\tname="checkout[payment_gateway]">\n\t<span >').concat(m.title||"Cash On Delivery","</span>\n</label>")}(m)+function(m){var t="Click ".concat(btn()," to complete your purchase.</br>You'll only pay for the order once it's delivered to your address.");return m&&m.info&&(t=m.info.replace("{SUBMIT_BUTTON}",btn())),'\n<div class="pf-content">\n\t<i style="height: 68px;display: block;">\n\t\t<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" width="" height="68" style="height: 68px;">\n\t\t\t<g id="Tracking" style="fill: #b4b4b4;">\n\t\t\t\t<path d="M61.707,34.293,49.293,21.879A2.978,2.978,0,0,0,47.171,21H30v2h5V38h2V23H47.171a1,1,0,0,1,.708.293L49.586,25H45a2,2,0,0,0-2,2v9a2,2,0,0,0,2,2H60v8a1,1,0,0,1-1,1H56.92a6.991,6.991,0,0,0-13.84,0H28.92a6.991,6.991,0,0,0-13.84,0H13a1,1,0,0,1-1-1V37H10v9a3,3,0,0,0,3,3h2.08a6.978,6.978,0,0,0,2.031,4H2v2H50a7.006,7.006,0,0,0,6.92-6H59a3,3,0,0,0,3-3V35A1,1,0,0,0,61.707,34.293ZM17,48a5,5,0,1,1,5,5A5.006,5.006,0,0,1,17,48Zm9.889,5a6.978,6.978,0,0,0,2.031-4H43.08a6.978,6.978,0,0,0,2.031,4ZM50,53a5,5,0,1,1,5-5A5.006,5.006,0,0,1,50,53ZM45,36V27h6.586L60,35.414V36Z">\n\t\t\t\t</path>\n\t\t\t\t<rect x="21" y="47" width="2" height="2"></rect>\n\t\t\t\t<rect x="49" y="47" width="2" height="2"></rect>\n\t\t\t\t<rect x="2" y="44" width="5" height="2"></rect>\n\t\t\t\t<rect x="4" y="40" width="3" height="2"></rect>\n\t\t\t\t<rect x="5" y="36" width="2" height="2"></rect>\n\t\t\t\t<path d="M15,35A13,13,0,1,0,2,22,13.015,13.015,0,0,0,15,35Zm0-24A11,11,0,1,1,4,22,11.013,11.013,0,0,1,15,11Z"></path>\n\t\t\t\t<path d="M15,31a1,1,0,0,0,.707-.293C16.351,30.063,22,24.29,22,20A7,7,0,0,0,8,20c0,4.29,5.649,10.063,6.293,10.707A1,1,0,0,0,15,31Zm0-16a5.006,5.006,0,0,1,5,5c0,2.566-3.147,6.531-5,8.551-1.853-2.02-5-5.985-5-8.551A5.006,5.006,0,0,1,15,15Z"></path>\n\t\t\t\t<path d="M18,20a3,3,0,1,0-3,3A3,3,0,0,0,18,20Zm-4,0a1,1,0,1,1,1,1A1,1,0,0,1,14,20Z"></path>\n\t\t\t\t<rect x="40" y="40" width="4" height="2"></rect>\n\t\t\t</g>\n\t\t</svg> \n\t</i>\n\t<p class="cod-message">'.concat(t,"</p>\n</div>")}(m),"</div>")}},{id:5,name:"iDeal",html:function(m){return'\x3c!-- iDeal --\x3e\n\t\t\t\t\t<div class="pf-option">\n\t\t\t\t\t\t<label class="pf-header ideal">\n\t\t\t\t\t\t\t<input type="radio" group-id="'.concat(m.group_id,'" user-gateway-id="').concat(m.user_gateway_id,'" \n\t\t\t\t\t\t\t\tgateway-id="').concat(m.gateway_id,'" name="checkout[payment_gateway]">\n\t\t\t\t\t\t\t<img class="gateway-logo ideal" src="https://img.funnelish.com/default/ideal-logo.svg" />\n\t\t\t\t\t\t</label>\n\n\t\t\t\t\t\t').concat(function(m){var t;return m.gateway_id===_this7.MOLLIE_IDEAL?(t="After clicking ".concat(btn(),"\n\t\t\t\t\t\t\t, you will be redirected to PayPal to complete your purchase securely."),m&&m.info&&(t=m.info.replace("{SUBMIT_BUTTON}",btn())),'<div class="pf-content">\n\t\t\t\t\t\t<img class="icon-offsite" src="/img/offsite-img.png" />\n\t\t\t\t\t\t<p id="paypal_message_p">\n\t\t\t\t\t\t'.concat(t,"\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>")):(t=m.info||"Select your bank below",m&&m.info&&(t=m.info.replace("{SUBMIT_BUTTON}",btn())),'<div class="pf-content">\n\t\t\t\t\t\t\t\t<span class="select-bank">'.concat(t,'</span>\n\t\t\t\t\t\t\t\t<div class="fpay-ideal-container field__input--iframe-container ideal"></div>\n\t\t\t\t\t\t</div>'))}(m),"\n\t\t\t\t\t</div>")}},{id:6,name:"Buy now, Pay later",html:function(m){var c,hidden;return 19===m.gateway_id?"":(hidden=!1,m.always_show||(c=(funnelish.countries.country||"").toLowerCase(),hidden=!["gb","us","at","se","es","no","nl","it","de","fr","fi","dk","be"].includes(c)),'\x3c!-- Buy now, Pay later --\x3e\n\t\t\t\t\t<div class="pf-option klarna '.concat(hidden?"hidden":"",'">\n\t\t\t\t\t\t<label class="pf-header klarna">\n\t\t\t\t\t\t\t<input type="radio" group-id="').concat(m.group_id,'" user-gateway-id="').concat(m.user_gateway_id,'" \n\t\t\t\t\t\t\t\tgateway-id="').concat(m.gateway_id,'" name="checkout[payment_gateway]">\n\t\t\t\t\t\t\t<span>').concat(m.title||"Buy now, Pay later",'</span>\n\t\t\t\t\t\t\t<img class="pf-klarna-logo" src="https://img.funnelish.com/default/klarna-logo.svg" />\n\t\t\t\t\t\t</label>\n\n\t\t\t\t\t\t').concat(function(m){var t="After clicking ".concat(btn(),"\n\t\t\t\t\t\t\t, you will be redirected to Buy now, Pay later with Klarna to complete your purchase securely.");return m&&m.info&&(t=m.info.replace("{SUBMIT_BUTTON}",btn())),'<div class="pf-content klarna">\n\t\t\t\t\t\t<img class="icon-offsite" src="/img/offsite-img.png" />\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t'.concat(t,"\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>")}(m),"\n\t\t\t\t\t</div>"))}},{id:7,name:"Bancontact",html:function(m){var info=m.info||"After clicking {SUBMIT_BUTTON}, you will be redirected to Bancontact to complete your purchase securely.",hidden=(m&&m.info&&(info=m.info.replace("{SUBMIT_BUTTON}",btn())),!1);return m.always_show||(hidden="be"!==(funnelish.countries.country||"").toLowerCase()),'\x3c!-- Bancontact --\x3e\n\t\t\t\t\t<div class="pf-option '.concat(hidden?"hidden":"",'">\n\t\t\t\t\t\t<label class="pf-header bancontact">\n\t\t\t\t\t\t\t<input type="radio" group-id="').concat(m.group_id,'" user-gateway-id="').concat(m.user_gateway_id,'" \n\t\t\t\t\t\t\t\tgateway-id="').concat(m.gateway_id,'" name="checkout[payment_gateway]">\n\t\t\t\t\t\t\t<span>').concat(m.title||"",'</span>\n\t\t\t\t\t\t\t<img class="pf-bancontact-logo"\n\t\t\t\t\t\t\tsrc="https://img.funnelish.com/default/Bancontact-logo.svg" />\n\t\t\t\t\t\t</label>\n\n\t\t\t\t\t\t<div class="pf-content">\n\t\t\t\t\t\t\t<img class="icon-offsite" src="/img/offsite-img.png" />\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t').concat(info,"\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>")}},{id:8,name:"Sofort",html:function(m){var c,info=m.info||"After clicking {SUBMIT_BUTTON}, you will be redirected to your banking app to complete your purchase securely.",hidden=(m&&m.info&&(info=m.info.replace("{SUBMIT_BUTTON}",btn())),!1);return m.always_show||(c=(funnelish.countries.country||"").toLowerCase(),hidden=!["at","be","de","it","nl","es"].includes(c)),'\x3c!-- Sofort --\x3e\n\t\t\t\t\t<div class="pf-option '.concat(hidden?"hidden":"",'">\n\t\t\t\t\t\t<label class="pf-header sofort">\n\t\t\t\t\t\t\t<input type="radio" group-id="').concat(m.group_id,'" user-gateway-id="').concat(m.user_gateway_id,'" \n\t\t\t\t\t\t\t\tgateway-id="').concat(m.gateway_id,'" name="checkout[payment_gateway]">\n\t\t\t\t\t\t\t<span>').concat(m.title||"",'</span>\n\t\t\t\t\t\t\t<img class="pf-sofort-logo"\n\t\t\t\t\t\t\tsrc="https://img.funnelish.com/default/SOFORT-Logo-').concat("white"===funnelish.funnelishPay.theme?"Dark":"Light",'.svg" />\n\t\t\t\t\t\t</label>\n\n\t\t\t\t\t\t<div class="pf-content">\n\t\t\t\t\t\t\t<img class="icon-offsite" src="/img/offsite-img.png" />\n\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t').concat(info,"\n\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>")}},{id:9,name:"SEPA",html:function(m){var info={IBAN:"IBAN"};try{info=JSON.parse(m.info)}catch(ex){}var c,hidden=!1;return m.always_show||(c=(funnelish.countries.country||"").toLowerCase(),hidden=!["ad","at","be","bg","hr","cy","cz","dk","ee","fi","fr","de","gr","hu","is","ie","it","lv","li","lt","lu","mt","mc","nl","no","pl","pt","ro","sm","sk","si","es","se","ch","gb"].includes(c)),'\x3c!-- SEPA --\x3e\n\t\t\t\t\t<div class="pf-option sepa '.concat(hidden?"hidden":"",'">\n\t\t\t\t\t\t<label class="pf-header sepa">\n\t\t\t\t\t\t\t<input type="radio" group-id="').concat(m.group_id,'" user-gateway-id="').concat(m.user_gateway_id,'" \n\t\t\t\t\t\t\t\tgateway-id="').concat(m.gateway_id,'" name="checkout[payment_gateway]">\n\t\t\t\t\t\t\t<span>').concat(m.title||"SEPA Direct Debit",'</span>\n\t\t\t\t\t\t</label>\n\n\t\t\t\t\t\t<div class="pf-content">\n\t\t\t\t\t\t\t\t<span class="pf-iban">').concat(info.IBAN||"IBAN",'</span>\n\t\t\t\t\t\t\t\t<div class="pf-sepa-container sepa"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>')}},{id:10,name:"Przelewy24",html:function(m){var d="Select your P24 bank below",j={select_a_bank:d};try{m.info&&(j=JSON.parse(m.info))}catch(ex){console.warn("bad P24 method info",ex)}j.select_a_bank&&(d=j.select_a_bank.replace("{SUBMIT_BUTTON}",btn())),j=!1;return m.always_show||(j="pl"!==(funnelish.countries.country||"").toLowerCase()),'\x3c!-- P24 --\x3e\n\t\t\t\t\t<div class="pf-option '.concat(j?"hidden":"",'">\n\t\t\t\t\t\t<label class="pf-header p24">\n\t\t\t\t\t\t\t<input type="radio" group-id="').concat(m.group_id,'" user-gateway-id="').concat(m.user_gateway_id,'" \n\t\t\t\t\t\t\t\tgateway-id="').concat(m.gateway_id,'" name="checkout[payment_gateway]">\n\t\t\t\t\t\t\t<img class="gateway-logo p24" src="https://img.funnelish.com/default/przelewy24_logo_2022.svg" />\n\t\t\t\t\t\t</label>\n\n\t\t\t\t\t\t<div class="pf-content p24">\n\t\t\t\t\t\t\t<span class="select-bank">').concat(d,'</span>\n\t\t\t\t\t\t\t<div class="fpay-p24-container p24"></div>\n\t\t\t\t\t\t\t<span class="info-message _tos" >\n\t\t\t\t\t\t\t\tOświadczam, że zapoznałem się z <a href="https://www.przelewy24.pl/regulamin" target="_blank">regulaminem</a> i \n\t\t\t\t\t\t\t\t<a href="https://www.przelewy24.pl/obowiazekinformacyjny" target="_blank">obowiązkiem informacyjnym</a> \n\t\t\t\t\t\t\t\tserwisu Przelewy24.\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>')}},{id:11,name:"RazorPay",html:function(m){var hidden=!1;return m.always_show||(hidden="in"!==(funnelish.countries.country||"").toLowerCase()),'\x3c!-- RazorPay --\x3e\n\t\t\t\t\t\t<div class="pf-option '.concat(hidden?"hidden":"",'">\n\t\t\t\t\t\t\t<label class="pf-header razorpay">\n\t\t\t\t\t\t\t\t<input type="radio" group-id="').concat(m.group_id,'" user-gateway-id="').concat(m.user_gateway_id,'" \n\t\t\t\t\t\t\t\t\tgateway-id="').concat(m.gateway_id,'" name="checkout[payment_gateway]">\n\t\t\t\t\t\t\t\t<img class="gateway-logo razorpay" \n\t\t\t\t\t\t\t\tsrc="https://img.funnelish.com/default/razorpay-logo-').concat("dark"===_this7.theme?"white":"black",'.png" />\n\t\t\t\t\t\t\t</label>\n\t\n\t\t\t\t\t\t\t').concat(function(m){var t="After clicking ".concat(btn(),", you will be redirected to RazorPay to complete your purchase securely.");return m&&m.info&&(t=m.info.replace("{SUBMIT_BUTTON}",btn())),'<div class="pf-content">\n\t\t\t\t\t\t<img class="icon-offsite" src="/img/offsite-img.png" />\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t'.concat(t,"\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</div>")}(m),"\n\t\t\t\t\t\t</div>")}},{id:12,name:"EPS",html:function(m){var d="Select your EPS bank below",info=(info=m.info||{select_a_bank:d}).select_a_bank?info.select_a_bank.replace("{SUBMIT_BUTTON}",btn()):d,d=!1;return m.always_show||(d="at"!==(funnelish.countries.country||"").toLowerCase()),'\x3c!-- EPS --\x3e\n\t\t\t\t\t<div class="pf-option '.concat(d?"hidden":"",'">\n\t\t\t\t\t\t<label class="pf-header eps">\n\t\t\t\t\t\t\t<input type="radio" group-id="').concat(m.group_id,'" user-gateway-id="').concat(m.user_gateway_id,'" \n\t\t\t\t\t\t\t\tgateway-id="').concat(m.gateway_id,'" name="checkout[payment_gateway]">\n\t\t\t\t\t\t\t<img class="gateway-logo eps" src="https://img.funnelish.com/default/eps-logo.png" />\n\t\t\t\t\t\t</label>\n\n\t\t\t\t\t\t<div class="pf-content eps">\n\t\t\t\t\t\t\t<span class="select-bank">').concat(info,'</span>\n\t\t\t\t\t\t\t<div class="fpay-eps-container eps"></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>')}}]}},{key:"loader_setup",value:(_loader_setup=_asyncToGenerator(_regeneratorRuntime().mark(function _callee10(app){var funnel_config;return _regeneratorRuntime().wrap(function(_context10){for(;;)switch(_context10.prev=_context10.next){case 0:if((funnel_config=JSON.parse(app.funnel_config))&&(this.paymentMethods=funnel_config.payment_methods,this.defaultMethod=funnel_config.default_method,this.theme=funnel_config.theme||"white",this.funnel_config=funnel_config),funnelish.isOrderForm())return _context10.next=5,this.setup_methods();_context10.next=7;break;case 5:_context10.next=8;break;case 7:this.setup_oto_step();case 8:funnelish.isTYP()&&this.load_typ_orders();case 9:case"end":return _context10.stop()}},_callee10,this)})),function(_x10){return _loader_setup.apply(this,arguments)})},{key:"payBoxHtml",value:function(form){var span,theme=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"white";return funnelish.isTestMode()&&((span=document.createElement("span")).innerHTML='<span class="test-mode">Test Mode</span>',form.appendChild(span)),form.classList.add(theme),form}},{key:"getMethodCode",value:function(method){for(var i in this.method_codes){i=this.method_codes[i];if(i.id==method.group_id)return i}return null}},{key:"appendGateway",value:(_appendGateway=_asyncToGenerator(_regeneratorRuntime().mark(function _callee11(form,methodCode,method){var el;return _regeneratorRuntime().wrap(function(_context11){for(;;)switch(_context11.prev=_context11.next){case 0:el=document.createElement("div"),form.appendChild(el),el.outerHTML=methodCode.html(method),_context11.t0=method.gateway_id,_context11.next=_context11.t0===this.NMI?6:_context11.t0===this.CHECKOUT_COM?9:_context11.t0===this.RAZORPAYID?12:_context11.t0===this.KLARNA?15:_context11.t0===this.MOLLIE?18:_context11.t0===this.MOLLIE_IDEAL?22:_context11.t0===this.MOLLIE_BANCONTACT?26:_context11.t0===this.AIRWALLEX?30:34;break;case 6:return _context11.next=8,this.loadNMISettings(method.user_gateway_id,method);case 8:return _context11.abrupt("break",34);case 9:return _context11.next=11,this.loadCheckoutComSettings(method.user_gateway_id,method);case 11:return _context11.abrupt("break",34);case 12:return _context11.next=14,this.loadRazorPaySettings(method.user_gateway_id,method);case 14:return _context11.abrupt("break",34);case 15:return _context11.next=17,new fPayKlarna(this,method).loadSettings();case 17:return _context11.abrupt("break",34);case 18:return this.mollie=new fPayMollie(this,method),_context11.next=21,this.mollie.loadSettings();case 21:return _context11.abrupt("break",34);case 22:return this.mollieIdeal=new fPayMollie(this,method),_context11.next=25,this.mollieIdeal.loadSettings();case 25:return _context11.abrupt("break",34);case 26:return this.mollieBancontact=new fPayMollie(this,method),_context11.next=29,this.mollieBancontact.loadSettings();case 29:return _context11.abrupt("break",34);case 30:return this.airwallex=new fPayAirwallex(this,method),_context11.next=33,this.airwallex.loadSettings();case 33:return _context11.abrupt("break",34);case 34:case"end":return _context11.stop()}},_callee11,this)})),function(_x11,_x12,_x13){return _appendGateway.apply(this,arguments)})},{key:"isStripeLoaded",value:function(){return"undefined"!=typeof Stripe}},{key:"loadStripeJs",value:function(callback){this.isStripeLoaded()||window.funnelish.loadScript("https://js.stripe.com/v3/",callback)}},{key:"isNMILoaded",value:function(){return"undefined"!=typeof CollectJS}},{key:"loadNMIJs",value:function(callback,m){if(!this.isNMILoaded()){var j={};try{m&&m.info&&(j=JSON.parse(m.info))}catch(ex){}m=this.nmiConfig.publicKey;window.funnelish.loadScript("https://secure.networkmerchants.com/token/Collect.js",callback,{tokenizationKey:m,fieldCcnumberSelector:"#card_number_container",fieldCcnumberTitle:j.cc||"Card Number",fieldCcnumberPlaceholder:"0000 0000 0000 0000",fieldCcexpSelector:"#mm_yy_container",fieldCcexpTitle:j.expiry||"MM / YY",fieldCcexpPlaceholder:"00 / 00",fieldCvvSelector:"#cvc_container",fieldCvvTitle:j.cvc||"CVC",fieldCvvPlaceholder:"***"})}}},{key:"loadNMISettings",value:(_loadNMISettings=_asyncToGenerator(_regeneratorRuntime().mark(function _callee12(userGatewayId,method){var data,_this8=this;return _regeneratorRuntime().wrap(function(_context12){for(;;)switch(_context12.prev=_context12.next){case 0:if(this.nmiConfig){_context12.next=9;break}return _context12.next=3,window.funnelish.post("/gateways/".concat(funnelish.funnelId,"/").concat(this.NMI,"/settings"),_objectSpread(_objectSpread({},window.funnelish.getAuthHeader()),{},{user_gateway_id:userGatewayId,app_id:this.id}));case 3:if("failed"===(data=_context12.sent).status)return console.error("Something went wrong",data),_context12.abrupt("return");_context12.next=7;break;case 7:this.nmiConfig=data,this.loadNMIJs(function(){return _this8.setupNMI(method)});case 9:case"end":return _context12.stop()}},_callee12,this)})),function(_x14,_x15){return _loadNMISettings.apply(this,arguments)})},{key:"isCheckoutComLoaded",value:function(){return"undefined"!=typeof Frames}},{key:"loadCheckoutComJs",value:function(callback){this.isCheckoutComLoaded()||window.funnelish.loadScript("https://cdn.checkout.com/js/framesv2.min.js",callback)}},{key:"loadCheckoutComSettings",value:(_loadCheckoutComSettings=_asyncToGenerator(_regeneratorRuntime().mark(function _callee13(userGatewayId,method){var data,_this9=this;return _regeneratorRuntime().wrap(function(_context13){for(;;)switch(_context13.prev=_context13.next){case 0:if(this.checkoutComConfig){_context13.next=9;break}return _context13.next=3,window.funnelish.post("/gateways/".concat(funnelish.funnelId,"/").concat(method.gateway_id,"/settings"),_objectSpread(_objectSpread({},window.funnelish.getAuthHeader()),{},{user_gateway_id:userGatewayId,app_id:this.id}));case 3:if("failed"===(data=_context13.sent).status)return console.error("Something went wrong",data),_context13.abrupt("return");_context13.next=7;break;case 7:this.checkoutComConfig=data,this.loadCheckoutComJs(function(){return _this9.setupCheckoutCom(userGatewayId,method)});case 9:case"end":return _context13.stop()}},_callee13,this)})),function(_x16,_x17){return _loadCheckoutComSettings.apply(this,arguments)})},{key:"setupCheckoutCom",value:function(userGatewayId,method){if(this.checkoutComConfig.error)console.error(this.checkoutComConfig.error);else{var publicKey=this.checkoutComConfig.public_key,method=this.getMethodCode(method),j={};try{j=JSON.parse(method.info)}catch(ex){}document.getElementById("card_number_container").classList.add("card-number-frame"),document.getElementById("mm_yy_container").classList.add("expiry-date-frame"),document.getElementById("cvc_container").classList.add("cvv-frame"),Frames.init({publicKey:publicKey,localization:{cardNumberPlaceholder:j.card||"Card number",expiryMonthPlaceholder:j.mm||"MM",expiryYearPlaceholder:j.yy||"YY",cvvPlaceholder:j.cvv||"CVV"},style:{base:{fontWeight:500,fontSize:"16px",height:"40px",padding:"2px 10px",fontSmoothing:"antialiased",color:"dark"===this.theme?"#c7c7c7":"#000000"},autofill:{color:"#e39f48"},focus:{color:"dark"===this.theme?"#c7c7c7":"#000000"},invalid:{color:"#d72829"},placeholder:{base:{color:"dark"===this.theme?"#CFD7DF":"#c6ced6"},focus:{}}}})}}},{key:"isRazorPayLoaded",value:function(){return"undefined"!=typeof Razorpay}},{key:"loadRazorPayJs",value:function(callback){this.isRazorPayLoaded()||window.funnelish.loadScript("https://checkout.razorpay.com/v1/checkout.js",callback)}},{key:"loadRazorPaySettings",value:(_loadRazorPaySettings=_asyncToGenerator(_regeneratorRuntime().mark(function _callee14(userGatewayId,method){var data,_this10=this;return _regeneratorRuntime().wrap(function(_context14){for(;;)switch(_context14.prev=_context14.next){case 0:if(this.razorPayConfig){_context14.next=9;break}return _context14.next=3,window.funnelish.post("/gateways/".concat(funnelish.funnelId,"/").concat(method.gateway_id,"/settings"),_objectSpread(_objectSpread({},window.funnelish.getAuthHeader()),{},{user_gateway_id:userGatewayId,app_id:this.id}));case 3:if("failed"===(data=_context14.sent).status)return console.error("Something went wrong",data),_context14.abrupt("return");_context14.next=7;break;case 7:this.razorPayConfig=data,this.loadRazorPayJs(function(){return _this10.setupRazorPay(userGatewayId,method)});case 9:case"end":return _context14.stop()}},_callee14,this)})),function(_x18,_x19){return _loadRazorPaySettings.apply(this,arguments)})},{key:"setupRazorPay",value:function(userGatewayId,method){this.razorPayConfig.error&&console.error(this.razorPayConfig.error)}},{key:"setupNMI",value:function(m){var _this11=this;if(this.nmiConfig.error)console.error(this.nmiConfig.error);else if(window.funnelish.isOrderForm()){var j={};try{m&&m.info&&(j=JSON.parse(m.info))}catch(ex){}CollectJS.configure({callback:function(response){var products;console.log("NMI callback",response),response.token?(products=funnelish.getSelectedProducts(),_this11.pay(products,null,response.token)):console.error("NMI invalid token",response.token)},variant:"inline",googleFont:"Abel",invalidCss:{"border-color":"#B40E3E",color:"#B40E3E"},validCss:{"border-color":"#26a026",color:"none"},customCss:{color:"dark"===this.theme?"#CFD7DF":"#353535","background-color":"dark"===this.theme?"#525252":"#fff","font-weight":"500",height:"46px","line-height":"46px",padding:"12px","border-style":"solid","border-width":"1px","border-color":"dark"===this.theme?"transparent":"#CFD7DF","border-radius":"5px","font-size":"16px","margin-top":"3px"},focusCss:{"border-color":"dark"===this.theme?"#CFD7DF":"#c6ced6"},fields:{cvv:{placeholder:j.cvc||"CVC"},ccnumber:{placeholder:j.cc||"Credit Card"},ccexp:{placeholder:j.expiry||"MM / YY"}}})}}},{key:"setupStripe",value:function(){var apiKey,accountID,elementClasses,bank,container,_container2;this.stripeConfig.error?console.error(this.stripeConfig.error):(accountID=this.stripeConfig.account_id,apiKey=this.stripeConfig.stripe_api_key,this.stripeAccountId=accountID,this.stripe=Stripe(apiKey,{stripeAccount:accountID}),apiKey=this.stripe.elements(),accountID={base:{fontWeight:500,fontSize:"16px",fontSmoothing:"antialiased",color:"dark"===this.theme?"#c7c7c7":"#000000",":focus":{color:"dark"===this.theme?"#c7c7c7":"#000000"},"::placeholder":{color:"dark"===this.theme?"#CFD7DF":"#c6ced6"},":-webkit-autofill":{color:"#e39f48"}},invalid:{color:"#d72829","::placeholder":{color:"#FFCCA5"}}},elementClasses={focus:"focused",empty:"empty",invalid:"invalid",complete:"complete"},this.getMethodById(this.P24STRIPE)&&(funnelish.isOrderForm()||funnelish.isOTO())&&(bank=funnelish.getCookie("fpay_p24_bank")||"",funnelish.isOTO()&&((container=document.createElement("div")).className="fpay-p24-container hidden",document.body.appendChild(container)),accountID.base.padding="8px 15px",accountID.base.cursor="pointer !important",accountID.base.backgroundColor="dark"===this.theme?"#2b252b":"white",container={style:accountID},bank&&(container.value=bank),this.p24Bank=apiKey.create("p24Bank",container),this.p24Bank.mount(".fpay-p24-container")),this.getMethodById(this.EPS)&&(bank=funnelish.getCookie("fpay_eps_bank")||"",funnelish.isOTO()&&((container=document.createElement("div")).className="fpay-eps-container hidden",document.body.appendChild(container)),accountID.base.padding="8px 15px",accountID.base.cursor="pointer !important",accountID.base.backgroundColor="dark"===this.theme?"#2b252b":"white",container={style:accountID},bank&&(container.value=bank),this.epsBank=apiKey.create("epsBank",container),this.epsBank.mount(".fpay-eps-container")),this.getMethodById(this.IDEALID)&&(bank=funnelish.getCookie("fpay_ideal_bank")||"",(container=JSON.parse(JSON.stringify(accountID))).base.padding="8px 15px",container.base.cursor="pointer !important",container.base.backgroundColor="dark"===this.theme?"#2b252b":"white",container={style:container},funnelish.isOTO()&&((_container2=document.createElement("div")).className="fpay-ideal-container hidden",document.body.appendChild(_container2),bank)&&(container.value=bank),funnelish.isOTO()||funnelish.isOrderForm())&&(this.idealBank=apiKey.create("idealBank",container),this.idealBank.mount(".fpay-ideal-container")),window.funnelish.isOrderForm()&&(this.getMethodById(this.STRIPEID)&&(this.cardNumber=apiKey.create("cardNumber",{style:accountID,classes:elementClasses}),this.cardNumber.mount("#card_number_container"),apiKey.create("cardExpiry",{style:accountID,classes:elementClasses}).mount("#mm_yy_container"),apiKey.create("cardCvc",{style:accountID,classes:elementClasses}).mount("#cvc_container")),this.getMethodById(this.SEPASTRIPE))&&(accountID.base.padding="8px 15px",accountID.base.cursor="pointer !important",accountID.base.backgroundColor="transparent",accountID.base.iconColor="dark"===this.theme?"white":"#2c2c2c",this.sepa=apiKey.create("iban",{style:accountID,supportedCountries:["SEPA"],placeholderCountry:funnelish.countries.country||"GB"}),this.sepa.mount(".pf-sepa-container")))}},{key:"getMethodById",value:function(id){for(var i in this.paymentMethods){i=this.paymentMethods[i];if(i.gateway_id===id)return i}return null}},{key:"loadStripeSettings",value:(_loadStripeSettings=_asyncToGenerator(_regeneratorRuntime().mark(function _callee15(userGatewayId,gatewayId){var data,_this12=this;return _regeneratorRuntime().wrap(function(_context15){for(;;)switch(_context15.prev=_context15.next){case 0:if(this.stripeConfig){_context15.next=9;break}return _context15.next=3,window.funnelish.post("/gateways/".concat(funnelish.funnelId,"/").concat(gatewayId,"/settings"),_objectSpread(_objectSpread({},window.funnelish.getAuthHeader()),{},{user_gateway_id:userGatewayId,app_id:this.id}));case 3:if("failed"===(data=_context15.sent).status)return console.error("Something went wrong",data),_context15.abrupt("return");_context15.next=7;break;case 7:this.stripeConfig=data,this.loadStripeJs(function(){return _this12.setupStripe()});case 9:case"end":return _context15.stop()}},_callee15,this)})),function(_x20,_x21){return _loadStripeSettings.apply(this,arguments)})},{key:"setup_methods",value:(_setup_methods=_asyncToGenerator(_regeneratorRuntime().mark(function _callee16(){var forms,i,form,boxes,needsStripe,userGatewayId,_i,mc,_el,option,_this13=this;return _regeneratorRuntime().wrap(function(_context16){for(;;)switch(_context16.prev=_context16.next){case 0:this.paymentMethods||alert("No Payment methods set in Funnelish."),funnelish.on("of_purchase",this.handleOfPurchase,this),forms=document.querySelectorAll(".payment-form"),i=0;case 4:if(!(i<forms.length)){_context16.next=33;break}form=forms[i],this.payBoxHtml(form,this.theme),(boxes=document.createElement("div")).className="pf-options",form.appendChild(boxes),needsStripe=!1,userGatewayId=0,_context16.t0=_regeneratorRuntime().keys(this.paymentMethods);case 13:if((_context16.t1=_context16.t0()).done){_context16.next=22;break}return _i=_context16.t1.value,_i=this.paymentMethods[_i],mc=this.getMethodCode(_i),_context16.next=19,this.appendGateway(boxes,mc,_i);case 19:needsStripe&&userGatewayId||![this.STRIPEID,this.IDEALID,this.KLARNASTRIPE,this.BANCONTACTSTRIPE,this.SOFORTSTRIPE,this.SEPASTRIPE,this.P24STRIPE,this.EPS].includes(_i.gateway_id)||(needsStripe=!0,userGatewayId=_i.user_gateway_id),_context16.next=13;break;case 22:if(needsStripe)return _context16.next=25,this.loadStripeSettings(userGatewayId,this.STRIPEID);_context16.next=25;break;case 25:(mc=document.createElement("div")).innerHTML="<b>Error: </b> <span>Something went wrong, check your details and try again!</span>",mc.className="card-error",form.appendChild(mc),form.classList.remove("loading");case 30:i++,_context16.next=4;break;case 33:if(document.querySelectorAll("[name='checkout[payment_gateway]'], [name='product-id']").forEach(function(el){el.addEventListener("change",function(){return _this13.checkGateway()})}),!this.defaultMethod){_context16.next=47;break}if(_el=document.querySelector("input[name='checkout[payment_gateway]'][group-id='".concat(this.defaultMethod,"']"))){_context16.next=40;break}return this.selectDefaultOption(),_context16.abrupt("return");case 40:if(!(option=_el.closest(".pf-option"))||option.classList.contains("hidden"))return this.selectDefaultOption(),_context16.abrupt("return");_context16.next=44;break;case 44:_el.click(),_context16.next=48;break;case 47:this.selectDefaultOption();case 48:case"end":return _context16.stop()}},_callee16,this)})),function(){return _setup_methods.apply(this,arguments)})},{key:"selectDefaultOption",value:function(){var o=document.querySelector("input[name='checkout[payment_gateway]']:first-child");o&&o.click()}},{key:"handleOfPurchase",value:(_handleOfPurchase=_asyncToGenerator(_regeneratorRuntime().mark(function _callee17(products){return _regeneratorRuntime().wrap(function(_context17){for(;;)switch(_context17.prev=_context17.next){case 0:return _context17.next=2,this.pay(products);case 2:case"end":return _context17.stop()}},_callee17,this)})),function(_x22){return _handleOfPurchase.apply(this,arguments)})},{key:"showError",value:function(error){console.error(error),error=(error="object"===_typeof(error)&&error.message?error.message:error)||"Something went wrong, check your details and try again!";var forms=document.querySelectorAll(".payment-form");forms.forEach(function(form){form.classList.add("invalid"),form.querySelector(".card-error span").innerText=error}),0<forms.length?forms[0].scrollIntoView():alert(error),funnelish.stopLoading()}},{key:"hideError",value:function(){document.querySelectorAll(".payment-form").forEach(function(form){form.classList.remove("invalid")})}},{key:"getSelectedGatewayInfo",value:function(){var gatewayGroupId,userGatewayId,el=document.querySelector("input[name='checkout[payment_gateway]']:checked");return el?(gatewayGroupId=el.getAttribute("group-id"),userGatewayId=el.getAttribute("user-gateway-id"),el=el.getAttribute("gateway-id"),{gatewayGroupId:parseInt(gatewayGroupId),userGatewayId:parseInt(userGatewayId),gatewayId:parseInt(el)}):(console.error("Error: no payment method selected."),{})}},{key:"getCheckoutComCardHolder",value:function(customer){var data={},address={};return(customer.country||customer.shipping_country)&&(address.country=customer.country||customer.shipping_country),(customer.zip||customer.shipping_zip)&&(address.zip=customer.zip||customer.shipping_zip),(customer.address||customer.shipping_address)&&(address.addressLine1=customer.address||customer.shipping_address),(customer.state||customer.shipping_state)&&(address.state=customer.state||customer.shipping_state),(customer.city||customer.shipping_city)&&(address.city=customer.city||customer.shipping_city),"UK"===address.country&&(address.country="GB"),data.billingAddress=address,data.name=customer.full_name||"",data.phone=customer.phone||"",data}},{key:"pay",value:(_pay2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee18(products){var paymentRef,newToken,extra,customer,gatewayGroupId,_this$getSelectedGate,fPayData,plist,token,_token,userGatewayId,_data2,_this14=this,_args18=arguments;return _regeneratorRuntime().wrap(function(_context18){for(;;)switch(_context18.prev=_context18.next){case 0:if(paymentRef=1<_args18.length&&void 0!==_args18[1]?_args18[1]:null,newToken=2<_args18.length&&void 0!==_args18[2]?_args18[2]:null,extra=3<_args18.length&&void 0!==_args18[3]?_args18[3]:null,customer=funnelish.validateFields(),_this$getSelectedGate=this.getSelectedGatewayInfo(),gatewayGroupId=_this$getSelectedGate.gatewayGroupId,userGatewayId=_this$getSelectedGate.userGatewayId,_this$getSelectedGate=_this$getSelectedGate.gatewayId,fPayData={gateway_group_id:gatewayGroupId,user_gateway_id:userGatewayId,gateway_id:_this$getSelectedGate},funnelish.setCookie("fpay_gateway_id",_this$getSelectedGate,2),funnelish.setCookie("fpay_user_gateway_id",userGatewayId,2),funnelish.setCookie("fpay_method_group_id",gatewayGroupId,2),this.hideError(),funnelish.startLoading(),funnelish.validateOptin(customer)){_context18.next=14;break}return funnelish.stopLoading(),_context18.abrupt("return");case 14:plist=[],products.forEach(function(p){var err;if(!p.product)throw funnelish.stopLoading(),_this14.showError(err="Selected product not found, maybe order bump product not created!"),console.error(err),err;plist.push({product_id:p.product.id,qty:p.qty,variant_option1:p.variant_option1,variant_option2:p.variant_option2,variant_option3:p.variant_option3})}),extra&&(fPayData.extra=extra),paymentRef?(fPayData.payment_reference=paymentRef,_context18.next=75):_context18.next=21;break;case 21:if(_this$getSelectedGate===this.MOLLIE)return _context18.next=24,this.mollie.getToken();_context18.next=31;break;case 24:if(token=_context18.sent){_context18.next=28;break}return funnelish.stopLoading(),_context18.abrupt("return");case 28:fPayData.token=token,_context18.next=75;break;case 31:if(_this$getSelectedGate===this.STRIPEID)return _context18.next=34,this.GetStripeToken(customer);_context18.next=41;break;case 34:if(_token=_context18.sent){_context18.next=38;break}return funnelish.stopLoading(),_context18.abrupt("return");case 38:fPayData.token=_token,_context18.next=75;break;case 41:if(_this$getSelectedGate!==this.NMI){_context18.next=50;break}if(newToken){_context18.next=47;break}return _context18.next=45,CollectJS.startPaymentRequest();case 45:return funnelish.stopLoading(),_context18.abrupt("return");case 47:fPayData.token=newToken,_context18.next=75;break;case 50:if(_this$getSelectedGate!==this.CHECKOUT_COM){_context18.next=68;break}if(newToken){_context18.next=66;break}return _context18.prev=52,Frames.cardholder=this.getCheckoutComCardHolder(customer),_context18.next=56,Frames.submitCard();case 56:userGatewayId=_context18.sent,fPayData.token=userGatewayId.token,_context18.next=66;break;case 60:return _context18.prev=60,_context18.t0=_context18.catch(52),funnelish.stopLoading(),this.showError(_context18.t0),console.error(_context18.t0),_context18.abrupt("return");case 66:_context18.next=75;break;case 68:if(_this$getSelectedGate!==this.KLARNA){_context18.next=75;break}if(newToken){_context18.next=74;break}return this.klarnaInstance.authorize(customer,products),_context18.abrupt("return");case 74:fPayData.token=newToken;case 75:return _context18.prev=75,_context18.next=78,funnelish.post("/pay",_objectSpread(_objectSpread(_objectSpread({},funnelish.getAuthHeader()),fPayData),{},{customer:customer,products:plist,is_oto:funnelish.isOTO(),discount_id:funnelish.discount?funnelish.discount.discount_id:null}));case 78:if((_data2=_context18.sent).customer_id&&this.setCID(_data2.customer_id),_data2.success){_context18.next=84;break}throw _data2.error;case 84:if(_this$getSelectedGate===this.AIRWALLEX)return _context18.next=87,this.airwallex.pay(_data2,customer);_context18.next=89;break;case 87:_context18.next=111;break;case 89:_this$getSelectedGate!==this.MOLLIE?_context18.next=93:(_data2.result.goto&&(window.location=_data2.result.goto),_context18.next=111);break;case 93:_this$getSelectedGate!==this.KLARNA?_context18.next=97:(_data2.result.goto&&(window.location=_data2.result.goto),_context18.next=111);break;case 97:[this.KLARNASTRIPE,this.IDEALID,this.P24STRIPE,this.BANCONTACTSTRIPE,this.SOFORTSTRIPE,this.SEPASTRIPE,this.EPS].includes(_this$getSelectedGate)?(this.authPayment(_data2,customer),_context18.next=111):_context18.next=101;break;case 101:_this$getSelectedGate!=this.STRIPEID?_context18.next=105:(_data2.result.needs_approval?this.authPayment(_data2,customer):window.location=_data2.result.goto,_context18.next=111);break;case 105:if(_this$getSelectedGate===this.RAZORPAYID)return _context18.next=108,this.authRazorPay(_data2,customer);_context18.next=110;break;case 108:_context18.next=111;break;case 110:_data2.result.goto?window.location=_data2.result.goto:_data2.result.needs_approval?this.authPayment(_data2,customer):this.showError();case 111:_context18.next=118;break;case 113:_context18.prev=113,_context18.t1=_context18.catch(75),funnelish.stopLoading(),this.showError(this.parseError(_context18.t1)),console.error(_context18.t1);case 118:return _context18.prev=118,_context18.finish(118);case 120:case"end":return _context18.stop()}},_callee18,this,[[52,60],[75,113,118,120]])})),function(_x23){return _pay2.apply(this,arguments)})},{key:"authRazorPay",value:(_authRazorPay=_asyncToGenerator(_regeneratorRuntime().mark(function _callee19(data,customer){var order,meta,desc,keyId,_this15=this;return _regeneratorRuntime().wrap(function(_context19){for(;;)switch(_context19.prev=_context19.next){case 0:if(_context19.prev=0,order=data.result.gateway_data.order,meta=data.result.gateway_data.meta,desc=data.result.gateway_data.description,"created"!==order.status)return this.showError("order has invalid status",data.gateway_data.status),_context19.abrupt("return");_context19.next=7;break;case 7:keyId=this.razorPayConfig.key_id,["full_name","optin_email","phone"].forEach(function(x){customer[x]||(customer[x]=localStorage.getItem("fnsh.core.customer.".concat("optin_email"===x?"email":x)))}),keyId={key:keyId,amount:order.amount,currency:order.currency,name:desc,description:desc,callback_url:data.result.goto,order_id:order.id,redirect:!0,handler:function(response){funnelish.stopLoading()},prefill:{name:customer.full_name,email:customer.optin_email,contact:customer.phone},notes:meta||{},theme:{color:"#3399cc"}},(keyId=new Razorpay(keyId)).on("payment.failed",function(response){_this15.showError(response.error.description),funnelish.stopLoading()}),funnelish.stopLoading(),keyId.open(),_context19.next=19;break;case 16:_context19.prev=16,_context19.t0=_context19.catch(0),this.showError(_context19.t0);case 19:case"end":return _context19.stop()}},_callee19,this,[[0,16]])})),function(_x24,_x25){return _authRazorPay.apply(this,arguments)})},{key:"checkGateway",value:function(){var content=document.querySelector("input[name='checkout[payment_gateway]']:checked").closest(".pf-option");document.querySelectorAll(".payment-form .pf-option").forEach(function(x){return x.classList.remove("active")}),content.classList.add("active")}},{key:"GetStripeToken",value:(_GetStripeToken=_asyncToGenerator(_regeneratorRuntime().mark(function _callee20(customer){var address,result;return _regeneratorRuntime().wrap(function(_context20){for(;;)switch(_context20.prev=_context20.next){case 0:return address=this.generateStripeAddress(customer),address={email:customer.optin_email,address:address},customer.full_name&&(address.name=customer.full_name),customer.phone&&(address.phone=customer.phone),_context20.next=6,this.stripe.createPaymentMethod({type:"card",card:this.cardNumber,billing_details:address});case 6:if((result=_context20.sent).error)return this.showError(result.error.message),_context20.abrupt("return",null);_context20.next=12;break;case 12:return _context20.abrupt("return",result.paymentMethod.id);case 13:case"end":return _context20.stop()}},_callee20,this)})),function(_x26){return _GetStripeToken.apply(this,arguments)})},{key:"generateStripeAddress",value:function(customer){var address={};return(customer.country||customer.shipping_country)&&(address.country=customer.country||customer.shipping_country),(customer.zip||customer.shipping_zip)&&(address.postal_code=customer.zip||customer.shipping_zip),(customer.address||customer.shipping_address)&&(address.line1=customer.address||customer.shipping_address),customer.state&&(address.state=customer.state),customer.city&&(address.city=customer.city),"UK"===address.country&&(address.country="GB"),address}},{key:"setCID",value:function(cid){funnelish.setCookie("fnsh.core.cid",cid,20)}},{key:"getCID",value:function(){return funnelish.getCookie("fnsh.core.cid")}},{key:"getStripeBillingDetails",value:function(customer){var address=this.generateStripeAddress(customer),address={email:customer.optin_email,name:customer.full_name,address:address};return customer.phone&&(address.phone=customer.phone),address}},{key:"getAnyCountry",value:function(customer){var c="";return c="UK"===(c=(c=customer.country||customer.shipping_country?customer.country||customer.shipping_country:c)||localStorage.getItem("fnsh.core.customer.country")||localStorage.getItem("fnsh.core.customer.shipping_country"))?"GB":c}},{key:"getKlarnaBillingDetails",value:function(customer){var address={},address=(address.country=this.getAnyCountry(customer),customer.optin_email||(customer.optin_email=localStorage.getItem("fnsh.core.customer.email")),customer.phone||(customer.phone=localStorage.getItem("fnsh.core.customer.phone")),{email:customer.optin_email,address:address});return customer.phone&&(address.phone=customer.phone),address}},{key:"authPayment",value:(_authPayment=_asyncToGenerator(_regeneratorRuntime().mark(function _callee21(data,customer,otoIndex){var ref,gateway_id,result,payment_method,r,_yield$this$stripe$co,_error,_payment_method2,_payment_method4,_payment_method5,_payment_method6,gotoUrl;return _regeneratorRuntime().wrap(function(_context21){for(;;)switch(_context21.prev=_context21.next){case 0:if(ref=data.result.reference,gateway_id=data.result.gateway_id,[this.STRIPEID,this.IDEALID,this.P24STRIPE,this.KLARNASTRIPE,this.BANCONTACTSTRIPE,this.SOFORTSTRIPE,this.SEPASTRIPE,this.EPS].includes(gateway_id)){_context21.next=6;break}return this.showError("Unknown payment option!",gateway_id),_context21.abrupt("return");case 6:if(result={},gateway_id===this.STRIPEID)return _context21.next=10,this.stripe.confirmCardPayment(ref,{});_context21.next=14;break;case 10:(result=_context21.sent).error||(window.location=data.result.goto),_context21.next=115;break;case 14:if(gateway_id!==this.IDEALID)_context21.next=36;else{if(customer.optin_email||(customer.optin_email=funnelish.getCookie("fnsh.core.customer.email")||localStorage.getItem("fnsh.core.customer.email")||""),customer.full_name||(customer.full_name=funnelish.getCookie("fnsh.core.customer.full_name")||localStorage.getItem("fnsh.core.customer.full_name")||""),(payment_method={billing_details:this.getStripeBillingDetails(customer)}).ideal=this.idealBank,(r=data.result).client_secret&&r.client_secret.startsWith("seti_"))return _context21.next=23,this.stripe.confirmIdealSetup(r.client_secret,{payment_method:payment_method,return_url:data.goto});_context21.next=28}break;case 23:_yield$this$stripe$co=_context21.sent,(_yield$this$stripe$co=_yield$this$stripe$co.error)&&this.showError(_yield$this$stripe$co.message),_context21.next=33;break;case 28:return _context21.next=30,this.stripe.confirmIdealPayment(r.client_secret,{payment_method:payment_method,return_url:data.goto});case 30:_yield$this$stripe$co=_context21.sent,(_error=_yield$this$stripe$co.error)&&this.showError(_error.message);case 33:return _context21.abrupt("return");case 36:if(gateway_id===this.EPS)return customer.full_name||(customer.full_name=localStorage.getItem("fnsh.core.customer.full_name")||""),(_error={billing_details:{name:customer.full_name||""}}).eps=this.epsBank,_context21.next=42,this.stripe.confirmEpsPayment(data.result.reference,{payment_method:_error,return_url:data.result.goto});_context21.next=47;break;case 42:return(result=_context21.sent).error&&this.showError(result.error.message),_context21.abrupt("return");case 47:if(gateway_id===this.P24STRIPE)return customer.optin_email||(customer.optin_email=localStorage.getItem("fnsh.core.customer.email")||""),customer.full_name||(customer.full_name=localStorage.getItem("fnsh.core.customer.full_name")||""),(_payment_method2={billing_details:this.getStripeBillingDetails(customer)}).p24=this.p24Bank,_context21.next=54,this.stripe.confirmP24Payment(data.result.reference,{payment_method:_payment_method2,payment_method_options:{p24:{tos_shown_and_accepted:!0}},return_url:data.result.goto});_context21.next=59;break;case 54:return(result=_context21.sent).error&&this.showError(result.error.message),_context21.abrupt("return");case 59:if(gateway_id===this.KLARNASTRIPE)return _payment_method2={billing_details:this.getKlarnaBillingDetails(customer)},_context21.next=63,this.stripe.confirmKlarnaPayment(data.result.client_secret,{payment_method:_payment_method2,return_url:data.goto});_context21.next=68;break;case 63:return(result=_context21.sent).error&&this.showError(result.error.message),_context21.abrupt("return");case 68:if(gateway_id!==this.BANCONTACTSTRIPE)_context21.next=83;else{if(_payment_method4={billing_details:{name:customer.full_name||"",email:customer.optin_email||""}},data.result.client_secret.startsWith("seti_"))return _context21.next=73,this.stripe.confirmBancontactSetup(data.result.client_secret,{payment_method:_payment_method4,return_url:data.goto});_context21.next=76}break;case 73:result=_context21.sent,_context21.next=79;break;case 76:return _context21.next=78,this.stripe.confirmBancontactPayment(data.result.client_secret,{payment_method:_payment_method4,return_url:data.goto});case 78:result=_context21.sent;case 79:return result.error&&this.showError(result.error.message),_context21.abrupt("return");case 83:if(gateway_id!==this.SOFORTSTRIPE)_context21.next=98;else{if(_payment_method5={sofort:{country:this.getAnyCountry(customer)},billing_details:{name:customer.full_name||"",email:customer.optin_email||""}},data.result.client_secret.startsWith("seti_"))return _context21.next=88,this.stripe.confirmSofortSetup(data.result.client_secret,{payment_method:_payment_method5,return_url:data.goto});_context21.next=91}break;case 88:result=_context21.sent,_context21.next=94;break;case 91:return _context21.next=93,this.stripe.confirmSofortPayment(data.result.client_secret,{payment_method:_payment_method5,return_url:data.goto});case 93:result=_context21.sent;case 94:return result.error&&this.showError(result.error.message),_context21.abrupt("return");case 98:if(gateway_id!==this.SEPASTRIPE)_context21.next=115;else{if(_payment_method6={billing_details:this.getStripeBillingDetails(customer)},funnelish.isOrderForm()&&(_payment_method6.sepa_debit=this.sepa),gotoUrl="",data.result.client_secret.startsWith("seti_"))return _context21.next=105,this.stripe.confirmSepaDebitSetup(data.result.client_secret,{payment_method:_payment_method6});_context21.next=109}break;case 105:(result=_context21.sent).error?this.showError(result.error.message):gotoUrl=data.goto+"?setup_intent=".concat(result.setupIntent.id),_context21.next=113;break;case 109:return _context21.next=111,this.stripe.confirmSepaDebitPayment(data.result.client_secret,{payment_method:_payment_method6});case 111:(result=_context21.sent).error?this.showError(result.error.message):gotoUrl=data.goto+"?payment_intent=".concat(result.paymentIntent.id);case 113:return!result.error&&gotoUrl&&(window.location=gotoUrl),_context21.abrupt("return");case 115:result.error?this.showError(result.error.message):funnelish.isOTO();case 116:case"end":return _context21.stop()}},_callee21,this)})),function(_x27,_x28,_x29){return _authPayment.apply(this,arguments)})},{key:"pay_oto",value:(_pay_oto=_asyncToGenerator(_regeneratorRuntime().mark(function _callee22(otoId,paymentRef){var products,customer,cid,gatewayGroupId,gatewayId,userGatewayId,consentId,data;return _regeneratorRuntime().wrap(function(_context22){for(;;)switch(_context22.prev=_context22.next){case 0:if(products=[],0===otoId?funnelish.getSelectedProducts().forEach(function(p){products.push({product_id:p.product.id,qty:p.qty,variant_option1:p.variant_option1,variant_option2:p.variant_option2,variant_option3:p.variant_option3})}):products=[{product_id:otoId,qty:1}],customer=funnelish.validateFields(),cid=this.getCID(),gatewayGroupId=this.getNumCookie("fpay_method_group_id"),userGatewayId=this.getNumCookie("fpay_user_gateway_id"),gatewayId=this.getNumCookie("fpay_gateway_id"),userGatewayId={user_gateway_id:userGatewayId,gateway_group_id:gatewayGroupId,cid:cid},customer){_context22.next=10;break}return _context22.abrupt("return");case 10:if(paymentRef&&(userGatewayId.payment_reference=paymentRef),gatewayId===this.KLARNA)return this.klarnaInstance.authorizeOto(customer,products),_context22.abrupt("return");_context22.next=16;break;case 16:if(gatewayId!==this.AIRWALLEX){_context22.next=22;break}if(consentId=funnelish.getCookie("fpay_airwallex_consent_id")){_context22.next=21;break}return this.fpay.showError("Couldn't process payment due to invalid consent id."),_context22.abrupt("return");case 21:userGatewayId.extra={payment_consent_id:consentId};case 22:return funnelish.startLoading(),_context22.prev=23,_context22.next=26,funnelish.post("/pay",_objectSpread(_objectSpread(_objectSpread({},funnelish.getAuthHeader()),userGatewayId),{},{customer:customer,products:products,is_oto:!0,discount_id:funnelish.discount?funnelish.discount.discount_id:null}));case 26:if((data=_context22.sent).success){_context22.next=31;break}throw data.error;case 31:if(gatewayId===this.AIRWALLEX)return _context22.next=34,this.airwallex.payOto(data);_context22.next=36;break;case 34:_context22.next=42;break;case 36:if(gatewayId===this.RAZORPAYID)return _context22.next=39,this.authRazorPay(data,customer);_context22.next=41;break;case 39:_context22.next=42;break;case 41:gatewayId===this.KLARNASTRIPE||[this.P24STRIPE,this.EPS,this.IDEALID].includes(gatewayId)?this.authPayment(data,customer):[this.BANCONTACTSTRIPE,this.SOFORTSTRIPE,this.SEPASTRIPE].includes(gatewayId)?window.location=data.result.goto:gatewayId==this.STRIPEID?data.result.needs_approval?this.authPayment(data,customer):window.location=data.result.goto:data.result.goto?window.location=data.result.goto:data.result.needs_approval?this.authPayment(data,customer):this.showError();case 42:_context22.next=49;break;case 44:_context22.prev=44,_context22.t0=_context22.catch(23),funnelish.stopLoading(),this.showError(this.parseError(_context22.t0)),console.error(_context22.t0);case 49:return _context22.prev=49,_context22.finish(49);case 51:case"end":return _context22.stop()}},_callee22,this,[[23,44,49,51]])})),function(_x30,_x31){return _pay_oto.apply(this,arguments)})},{key:"getNumCookie",value:function(cookie){cookie=funnelish.getCookie(cookie);return cookie?parseInt(cookie):0}},{key:"parseError",value:function(errorString){try{var error=JSON.parse(errorString);return error.message?error.message:null}catch(ex){return errorString}}},{key:"setup_oto_step",value:function(){var i,_this16=this,gatewayId=this.getNumCookie("fpay_gateway_id"),method=null;for(i in this.paymentMethods){var m=this.paymentMethods[i];if(m.gateway_id===gatewayId){method=m;break}}method?([this.STRIPEID,this.P24STRIPE,this.EPS,this.IDEALID,this.KLARNASTRIPE,this.BANCONTACTSTRIPE,this.SOFORTSTRIPE].includes(gatewayId)?this.loadStripeSettings(method.user_gateway_id,gatewayId):method.gateway_id===this.RAZORPAYID?this.loadRazorPaySettings(method.user_gateway_id,method):method.gateway_id===this.KLARNA?new fPayKlarna(this,method).loadSettings():method.gateway_id===this.AIRWALLEX&&(this.airwallex=new fPayAirwallex(this,method),this.airwallex.loadSettings()),funnelish.on("oto_yes",function(otoId){_this16.pay_oto(otoId)},this)):(funnelish.isOTO()||funnelish.isOrderForm())&&console.error("Error: no valid payment method selected at order form.")}},{key:"load_typ_orders",value:function(){}}]);var _pay_oto,_authPayment,_GetStripeToken,_authRazorPay,_pay2,_handleOfPurchase,_setup_methods,_loadStripeSettings,_loadRazorPaySettings,_loadCheckoutComSettings,_loadNMISettings,_appendGateway,_loader_setup,_init}();console.log("Funnelish pay loaded",funnelish),funnelish&&(instance=new appFPay,console.log("FPay registering"),funnelish.registerApp(instance.id,instance));