Ubuntu

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ !function(){"use strict";var e={431:function(e){e.exports=function(e,t,r,n){e=(e+"").replace(/[^0-9+\-Ee.]/g,"");var o=isFinite(+e)?+e:0,i=isFinite(+t)?Math.abs(t):0,a=void 0===n?",":n,c=void 0===r?".":r,u="";return u=(i?function(e,t){if(-1===(""+e).indexOf("e"))return+(Math.round(e+"e+"+t)+"e-"+t);var r=(""+e).split("e"),n="";return+r[1]+t>0&&(n="+"),(+(Math.round(+r[0]+"e"+n+(+r[1]+t))+"e-"+t)).toFixed(t)}(o,i).toString():""+Math.round(o)).split("."),u[0].length>3&&(u[0]=u[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,a)),(u[1]||"").length2&&void 0!==arguments[2]&&arguments[2],n=function(e){return"string"==typeof e?document.querySelector(e):e}(e);if(n){var o=n.style.getPropertyValue("display");if(t)"none"===o&&n.style.removeProperty("display"),function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}(n)||n.style.setProperty("display","block");else{if("none"===o)return;n.style.setProperty("display","none",r?"important":"")}}},s=window.wp.element,l=window.wp.htmlEntities,d=window.wp.i18n,f=r(431),p=r.n(f);var m=window.wp.deprecated,y=r.n(m);const h=function(e){let t;function r(e){if(e.priceFormat)return function(e){const t=document.createElement("DIV");return t.innerHTML=e,t.textContent||t.innerText||""}(e.priceFormat.toString());switch(e.symbolPosition){case"left":return"%1$s%2$s";case"right":return"%2$s%1$s";case"left_space":return"%1$s %2$s";case"right_space":return"%2$s %1$s"}return"%1$s%2$s"}function n(e){const n={code:"USD",symbol:"$",symbolPosition:"left",thousandSeparator:",",decimalSeparator:".",precision:2,...e};let o=n.precision;null===o?(console.warn("Currency precision is null"),o=NaN):"string"==typeof o&&(o=parseInt(o,10)),t={code:n.code.toString(),symbol:n.symbol.toString(),symbolPosition:n.symbolPosition.toString(),decimalSeparator:n.decimalSeparator.toString(),priceFormat:r(n),thousandSeparator:n.thousandSeparator.toString(),precision:o}}function o(e,r=!1){const n=function({precision:e=null,decimalSeparator:t=".",thousandSeparator:r=","},n){if(void 0===n)return"";if("number"!=typeof n&&(n=parseFloat(n)),isNaN(n))return"";let o=null===e?NaN:Number(e);if(isNaN(o)){const[,e]=n.toString().split(".");o=e?e.length:0}return p()(n,o,t,r)}(t,e);if(""===n)return n;const{priceFormat:o,symbol:i,code:a}=t;return(0,d.sprintf)(o,r?a:i,n)}return n(e),{getCurrencyConfig:()=>({...t}),getDataForCountry:function(e,t={},r={}){const n=t[e];if(!n)return{};const o=r[n.currency_code];return o?{code:n.currency_code,symbol:(0,l.decodeEntities)(o),symbolPosition:n.currency_pos,thousandSeparator:n.thousand_sep,decimalSeparator:n.decimal_sep,precision:n.num_decimals}:{}},setCurrency:n,formatAmount:o,formatCurrency:function(e){return y()("Currency().formatCurrency",{version:"5.0.0",alternative:"Currency().formatAmount",plugin:"WooCommerce",hint:"`formatAmount` accepts the same arguments as formatCurrency"}),o(e)},getPriceFormat:r,formatDecimal(e){if("number"!=typeof e&&(e=parseFloat(e)),Number.isNaN(e))return 0;const{precision:r}=t;return Math.round(e*Math.pow(10,r))/Math.pow(10,r)},formatDecimalString(e){if("number"!=typeof e&&(e=parseFloat(e)),Number.isNaN(e))return"";const{precision:r}=t;return e.toFixed(r)},render(e){return"number"!=typeof e&&(e=parseFloat(e)),e<0?(0,s.createElement)("span",{className:"is-negative"},o(e)):o(e)}}};function g(e){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(e)}function v(e){var t=function(e){if("object"!=g(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=g(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==g(t)?t:t+""}function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t1&&void 0!==arguments[1]&&arguments[1];return _.hasOwnProperty(e)?_[e]:t}("currency"),C=h(k);(0,s.createContext)(C);var H=h;addEventListener("DOMContentLoaded",(function(){var e,t=!1,r=0,n=".payment_method_cawl-hosted-tokenization input.woocommerce-SavedPaymentMethods-tokenInput",i=".shop_table.woocommerce-checkout-review-order-table",s="",l=function(){if(s){var e=document.querySelector(i);e&&(e.innerHTML=s)}},f=function(e){var t=document.querySelector(i);if(t){var r=e/WlopHtConfig.currency.centFactor,n=t.querySelector("tfoot");if(n){var o=WlopHtConfig.total/WlopHtConfig.currency.centFactor+r,a=H(WlopHtConfig.currency),c=a.formatAmount(o),u=a.formatAmount(r),s=n.querySelector(".wlop-order-surcharge");if(s){var l=s.querySelector(".woocommerce-Price-amount bdi");l&&(l.textContent=u)}else{(s=document.createElement("tr")).classList.add("wlop-order-surcharge"),s.innerHTML="\n\t\t\t\t".concat((0,d.__)("Surcharge","worldline-for-woocommerce"),'\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t').concat(u,"\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t");var f=n.querySelector(".order-total");f?n.insertBefore(s,f):n.appendChild(s)}var p=n.querySelector(".order-total .woocommerce-Price-amount bdi");p&&(p.textContent=c)}}},p=function(){return document.querySelector("#"+WlopHtConfig.wrapper.id)};function m(){var t=p();if(t){e&&e.destroy(),t.innerHTML="";var n={hideCardholderName:!1,hideTokenFields:!1};WlopHtConfig.surcharge&&(n.surchargeCallback=function(e){if(e.surcharge.success){var t=e.surcharge.result.surchargeAmount.amount;Number.isInteger(t)||console.error("Invalid surcharge amount received. "+t),r=t,g(t)}else console.error(e.surcharge.error)}),e=new Tokenizer(WlopHtConfig.url,WlopHtConfig.wrapper.id,n)}}if(p()){var y=function(){var e=p();if(e){var t=c()===WlopHtConfig.gateway.id;u(e,t),t?r>0&&f(r):l()}},h=function(){e&&t&&e.setAmount(WlopHtConfig.total,WlopHtConfig.currency.code)},g=function(e){if(WlopHtConfig.surcharge){var t=document.getElementById(WlopHtConfig.surcharge.wrapper.id);if(t){if(e<=0)return t.innerHTML="",void l();var r=H(WlopHtConfig.currency).formatAmount(e/WlopHtConfig.currency.centFactor);t.innerHTML=(0,d.sprintf)( /** * translators: %s the surcharge amount, like $0.23 */ /** * translators: %s the surcharge amount, like $0.23 */ (0,d.__)("Includes surcharge of %s","worldline-for-woocommerce"),r),c()===WlopHtConfig.gateway.id?f(e):l()}}},v=function(){var r=o(a().mark((function r(){var o,i,c;return a().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(o=p()){r.next=3;break}throw new Error("Hosted tokenization iframe wrapper not found.");case 3:if(!(o.childNodes.length>0)){r.next=5;break}return r.abrupt("return");case 5:if(i=o.closest(".wc_payment_methods"),(c=null==i?void 0:i.offsetWidth)&&c>0&&c<450&&o.classList.add("wlop-ht-narrow"),t)try{e.destroy()}catch(e){}return r.next=11,e.initialize();case 11:b(),y(),t=!0,h(),document.querySelectorAll(n).forEach((function(e){e.addEventListener("click",S)})),S();case 18:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}(),w=function(){var e=o(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return["wlop_hosted_tokenization_id","wlop_screen_height","wlop_screen_width"].forEach((function(e){var t;null===(t=document.querySelector('[name="'.concat(e,'"]')))||void 0===t||t.remove()})),m(),e.next=4,v();case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b=function(){var r=document.querySelector("#place_order");if(!r)throw new Error("Place order button not found.");if(!r.dataset.wlopHtHandlerAdded){var n=!1;r.dataset.wlopHtHandlerAdded="true",r.addEventListener("click",function(){var i=o(a().mark((function o(i){var u,s;return a().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(!n){o.next=2;break}return o.abrupt("return");case 2:if(t){o.next=4;break}return o.abrupt("return");case 4:if(c()===WlopHtConfig.gateway.id){o.next=6;break}return o.abrupt("return");case 6:return i.preventDefault(),i.stopImmediatePropagation(),o.next=10,e.submitTokenization();case 10:(u=o.sent).success?(s=u.hostedTokenizationId,r.insertAdjacentHTML("afterend",'')),r.insertAdjacentHTML("afterend",'')),r.insertAdjacentHTML("afterend",'')),n=!0,r.click()):alert(u.error.message);case 12:case"end":return o.stop()}}),o)})));return function(_x){return i.apply(this,arguments)}}())}},S=function(){var t=document.querySelector(n+":checked");if(t){var o=t.value;if("new"===o)r=0,g(0),e.useToken();else{var i=WlopHtConfig.tokens[o];e.useToken(i)}}},_=function(){var e=o(a().mark((function e(){var t,r,n,o=arguments;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]&&o[0],e.next=3,jQuery.ajax({type:"post",dataType:"json",url:WlopHtConfig.ajax,data:{action:"wlop_hosted_tokenization_config",withoutUrl:t}});case 3:r=e.sent,n=r.data,t&&(n.url=WlopHtConfig.url,n.tokens=WlopHtConfig.tokens),WlopHtConfig=n;case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();m(),v(),jQuery(document.body).on("updated_checkout",o(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0,(t=document.querySelector(i))&&(s=t.innerHTML),e.next=3,_(!0);case 3:return e.next=5,v();case 5:h();case 6:case"end":return e.stop()}var t}),e)})))),jQuery(document.body).on("updated_checkout payment_method_selected",(function(){y()})),jQuery(document.body).on("checkout_error",o(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c()===WlopHtConfig.gateway.id){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,_();case 4:return e.next=6,w();case 6:case"end":return e.stop()}}),e)}))));var k=document.querySelector("form.checkout");k&&k.querySelectorAll("input").forEach((function(e){e.addEventListener("keydown",(function(e){"Enter"===e.key&&c()===WlopHtConfig.gateway.id&&e.preventDefault()}))})),setTimeout((function(){jQuery(document.body).trigger("wc-credit-card-form-init")}),0)}}))}();