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,c=isFinite(+t)?Math.abs(t):0,i=void 0===n?",":n,a=void 0===r?".":r,s="";return s=(c?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,c).toString():""+Math.round(o)).split("."),s[0].length>3&&(s[0]=s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,i)),(s[1]||"").lengthe.length)&&(t=e.length);for(var r=0,n=Array(t);r({...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,u.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 d()("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 h(e){return h="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},h(e)}function g(e,t,r){return(t=function(e){var t=function(e){if("object"!=h(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=h(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==h(t)?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}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 S.hasOwnProperty(e)?S[e]:t}("currency"),_=y(j);(0,s.createContext)(_);var O=y,k=window.wp.data;function x(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 C(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:N,t=arguments.length>1?arguments[1]:void 0;return"SET_SURCHARGE"===t.type?C(C({},e),{},{surcharge:t.payload}):e},actions:{setSurcharge:function(e){return{type:"SET_SURCHARGE",payload:e}}},selectors:{getSurcharge:function(e){return e.surcharge}}});(0,k.register)(F);var E=window.ReactJSXRuntime;addEventListener("DOMContentLoaded",(function(){var e=function(e){var r,c,s=e.eventRegistration,u=e.emitResponse,l=e.billing,p=e.token,f=s.onPaymentSetup,m=u.responseTypes,d=(0,k.useSelect)((function(e){return e(P).getSurcharge()}),[]),y=(0,k.useDispatch)(P).setSurcharge,h=(r=(0,a.useState)(!1),c=2,function(e){if(Array.isArray(e))return e}(r)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,c,i,a=[],s=!0,u=!1;try{if(c=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=c.call(r)).done)&&(a.push(n.value),a.length!==t);s=!0);}catch(e){u=!0,o=e}finally{try{if(!s&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(u)throw o}}return a}}(r,c)||function(e,t){if(e){if("string"==typeof e)return o(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}(r,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),g=h[0],w=h[1],b=(0,a.useRef)(null);return(0,a.useEffect)((function(){w(!1);var e={hideCardholderName:!1,hideTokenFields:!1};return WlopHtConfig.surcharge&&(e.surchargeCallback=function(e){if(e.surcharge.success){var t=e.surcharge.result.surchargeAmount.amount;if(!Number.isInteger(t))return void console.error("Invalid surcharge amount received. "+t);y(t)}else console.error(e.surcharge.error)}),b.current=new Tokenizer(WlopHtConfig.url,WlopHtConfig.wrapper.id,e),b.current.initialize().then((function(){return w(!0)})),function(){try{w(!1),b.current.destroy()}catch(e){}}}),[]),(0,a.useEffect)((function(){var e=l.cartTotal.value/Math.pow(10,l.currency.minorUnit),t=Math.round(e*WlopHtConfig.currency.centFactor);b.current.setAmount(t,l.currency.code)}),[l.cartTotal.value,l.currency.code,l.currency.minorUnit]),(0,a.useEffect)((function(){if(g)if(p){var e=WlopHtConfig.tokens[p];b.current.useToken(e)}else b.current.useToken()}),[p,g]),(0,a.useEffect)((function(){return f((function(){function e(){var t;return t=i().mark((function e(){var t,r;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,b.current.submitTokenization();case 2:if((t=e.sent).success){e.next=5;break}return e.abrupt("return",{type:m.ERROR,message:t.error.message});case 5:return r=t.hostedTokenizationId,e.abrupt("return",{type:m.SUCCESS,meta:{paymentMethodData:{wlop_hosted_tokenization_id:r,wlop_screen_height:window.screen.height.toString(),wlop_screen_width:window.screen.width.toString()}}});case 7:case"end":return e.stop()}}),e)})),e=function(){var e=this,r=arguments;return new Promise((function(o,c){var i=t.apply(e,r);function a(e){n(i,o,c,a,s,"next",e)}function s(e){n(i,o,c,a,s,"throw",e)}a(void 0)}))},e.apply(this,arguments)}return function(){return e.apply(this,arguments)}()}))}),[f,m]),(0,a.useEffect)((function(){return function(){y(0)}}),[y]),(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{id:WlopHtConfig.wrapper.id,className:"wlop-ht-wrapper"}),(0,E.jsx)(t,{surcharge:d})]})},t=function(e){var t=e.surcharge;if(t<=0)return null;var r=O(wcSettings.currency).formatAmount(t/WlopHtConfig.currency.centFactor);return(0,E.jsx)("div",{className:"wlop-surcharge-note",children:(0,l.sprintf)( /** * translators: %s the surcharge amount, like $0.23 */ /** * translators: %s the surcharge amount, like $0.23 */ (0,l.__)("Includes surcharge of %s","worldline-for-woocommerce"),r)})};wp.hooks.addFilter(WlopHtConfig.gateway.id+"_checkout_fields","wlop/ht/checkout",(function(t){return t.push(e),t})),wp.hooks.addFilter(WlopHtConfig.gateway.id+"_saved_token_fields","wlop/ht/checkout",(function(t){return t.push(e),t}))})),addEventListener("DOMContentLoaded",(function(){var e=wc.blocksCheckout.ExperimentalOrderMeta,t=wp.plugins.registerPlugin,r=function(e){var t=e.cart,r=(0,k.useSelect)((function(e){return e(P).getSurcharge()}),[]);if(null==t||!t.cartTotals||!r)return null;var n=parseFloat(t.cartTotals.total_price)+r,o=O(wcSettings.currency),c=o.formatAmount(r/WlopHtConfig.currency.centFactor),i=o.formatAmount(n/WlopHtConfig.currency.centFactor);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"wp-block-woocommerce-checkout-order-summary-fee-block wc-block-components-totals-wrapper",children:(0,E.jsxs)("div",{className:"wc-block-components-totals-item",children:[(0,E.jsx)("span",{className:"wc-block-components-totals-item__label",children:(0,l.__)("Surcharge","worldline-for-woocommerce")}),(0,E.jsx)("span",{className:"wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-item__value",children:c}),(0,E.jsx)("div",{className:"wc-block-components-totals-item__description"})]})}),(0,E.jsx)("div",{className:"wc-block-components-totals-wrapper",children:(0,E.jsxs)("div",{className:"wc-block-components-totals-item wc-block-components-totals-footer-item",children:[(0,E.jsx)("span",{className:"wc-block-components-totals-item__label",children:(0,l.__)("Total With Surcharge","worldline-for-woocommerce")}),(0,E.jsx)("div",{className:"wc-block-components-totals-item__value",children:(0,E.jsx)("span",{className:"wc-block-formatted-money-amount wc-block-components-formatted-money-amount wc-block-components-totals-footer-item-tax-value",children:i})}),(0,E.jsx)("div",{className:"wc-block-components-totals-item__description"})]})})]})};t("wlop-ht-surcharge-summary",{scope:"woocommerce-checkout",render:function(){return(0,E.jsx)(e,{children:(0,E.jsx)(r,{})})}})}))}();