diff --git a/assets/css/mollie-components.css b/assets/css/mollie-components.css index 69c983b4c..4603554bf 100644 --- a/assets/css/mollie-components.css +++ b/assets/css/mollie-components.css @@ -3,6 +3,10 @@ flex-wrap: wrap; } +.mollie-components-description svg { + display: inline !important; +} + .mollie-components .mollie-component-label { font-weight: 400; } @@ -22,6 +26,7 @@ .mollie-components .mollie-component iframe { border-radius: 6px; + margin: 0; } .mollie-components div { diff --git a/assets/js/mollie-components.min.js b/assets/js/mollie-components.min.js index a3867227b..b2364ef56 100644 --- a/assets/js/mollie-components.min.js +++ b/assets/js/mollie-components.min.js @@ -1 +1 @@ -!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n){var t=".cardToken",r=".mollie-components",o="form",c=".wc_payment_methods",a="#mollie-notice";function u(){return!1}function i(e){return e?e.querySelector(c):null}function l(e,n){return n?n.querySelector(".payment_method_mollie_wc_gateway_".concat(e)):null}function s(e){return e?e.querySelector(a):null}function f(e){return e?e.querySelector(r):null}function m(e,n){var t,r,o,c=y(i(document)).parentNode||null,a=s(document),u=(r=(t=n).content,o=t.type,'\n
\n ').concat(r,"\n
\n "));a&&a.remove(),c?(c.insertAdjacentHTML("beforebegin",u),function(e){var n=s(document);n||(n=i(document));e.scroll_to_notices(e(n))}(e)):alert(n.content)}function d(e){var n,r,o;return regeneratorRuntime.async((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,regeneratorRuntime.awrap(e.createToken(t));case 2:if(n=c.sent,r=n.token,!(o=n.error)){c.next=7;break}throw new Error(o.message||"");case 7:return c.abrupt("return",r);case 8:case"end":return c.stop()}}))}function p(e,n){n&&(n.value=e,n.setAttribute("value",e))}function y(e){return e?e.closest(o):null}function b(e){e.off("checkout_place_order",u),e.off("submit",g)}function v(e){var n=l(e,document),t=n?n.querySelector("#payment_method_mollie_wc_gateway_".concat(e)):null;return t&&t.checked||!1}function g(e){var n,r,o,c,a,u,i,l,s,f,g,_,w;return regeneratorRuntime.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(n="",r=e.data,o=r.jQuery,c=r.mollie,a=r.gateway,u=r.gatewayContainer,i=r.messages,l=y(u),s=o(l),f=o(document.body),v(a)){h.next=8;break}return b(s),h.abrupt("return");case 8:return e.preventDefault(),e.stopImmediatePropagation(),h.prev=10,h.next=13,regeneratorRuntime.awrap(d(c));case 13:n=h.sent,h.next=23;break;case 16:return h.prev=16,h.t0=h.catch(10),g=h.t0,_=g.message,message=void 0===_?i.defaultErrorMessage:_,(w=g)&&m(o,{content:w,type:"error"}),s.removeClass("processing").unblock(),f.trigger("checkout_error"),h.abrupt("return");case 23:b(s),n&&p(n,u.querySelector(t)),s.submit();case 26:case"end":return h.stop()}}),null,null,[[10,16]])}function _(e,n,t,r,o){t.forEach((function(t){return function(e,n,t,r,o){var c=t.name,a=function(e,n,t,r){var o;return r.has(e)&&(o=r.get(e)),o||(o=n.createComponent(e,t)),o}(c,e,n,r);f(o).insertAdjacentHTML("beforeend",'
')),a.mount("#".concat(c));var u,i,l=(u=c,(i=o)?i.querySelector(".mollie-component--".concat(u)):null);l?(!function(e,n){var t=n.label;e.insertAdjacentHTML("beforebegin",''.concat(t,""))}(l,t),function(e,n){var t=n.name;e.insertAdjacentHTML("afterend",''))}(l,t),!r.has(c)&&r.set(c,a)):console.warn("Component ".concat(c," not found in the DOM. Probably had problem during mount."))}(e,n,t,r,o)}))}!function(e){var n=e._,t=e.Mollie,r=e.mollieComponentsSettings,o=e.jQuery;if(!n.isEmpty(r)&&n.isFunction(t)){var c="updated_checkout",a=new Map,i=o(document),s=r.merchantProfileId,m=r.options,d=r.isCheckoutPayPage,p=new t(s,m);d&&(c="payment_method_selected"),i.on(c,(function(){return function(e,n,t,r){t.options,t.merchantProfileId;var o=t.componentsSettings,c=t.componentsAttributes,a=t.enabledGateways,i=t.messages;!function(e){e.forEach((function(e){return e.unmount()}))}(r),a.forEach((function(t){var a,s=l(t,document),m=f(s),d=y(s),p=e(d);s?d?(b(p),(a=m)&&(a.innerText=""),function(e){e.insertAdjacentHTML("beforeend",'')}(m),_(n,o[t],c,r,s),p.on("checkout_place_order",u),p.on("submit",null,{jQuery:e,mollie:n,gateway:t,gatewayContainer:s,messages:i},g)):console.warn("Cannot initialize Mollie Components, no form found."):console.warn("Cannot initialize Mollie Components for gateway ".concat(t,"."))}))}(o,p,r,a)}))}}(window)}]); \ No newline at end of file +!function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=0)}([function(e,n){var t=".cardToken",r=".mollie-components",o="form",c=".wc_payment_methods",a="#mollie-notice";function u(){return!1}function i(e){return e?e.querySelector(c):null}function l(e,n){return n?n.querySelector(".payment_method_mollie_wc_gateway_".concat(e)):null}function s(e){return e?e.querySelector(a):null}function f(e){return e?e.querySelector(r):null}function m(e,n){var t,r,o,c=y(i(document)).parentNode||null,a=s(document),u=(r=(t=n).content,o=t.type,'\n
\n ').concat(r,"\n
\n "));a&&a.remove(),c?(c.insertAdjacentHTML("beforebegin",u),function(e){var n=s(document);n||(n=i(document));e.scroll_to_notices(e(n))}(e)):alert(n.content)}function d(e){var n,r,o;return regeneratorRuntime.async((function(c){for(;;)switch(c.prev=c.next){case 0:return c.next=2,regeneratorRuntime.awrap(e.createToken(t));case 2:if(n=c.sent,r=n.token,!(o=n.error)){c.next=7;break}throw new Error(o.message||"");case 7:return c.abrupt("return",r);case 8:case"end":return c.stop()}}))}function p(e,n){n&&(n.value=e,n.setAttribute("value",e))}function y(e){return e?e.closest(o):null}function b(e){e.off("checkout_place_order",u),e.off("submit",g)}function v(e){var n=l(e,document),t=n?n.querySelector("#payment_method_mollie_wc_gateway_".concat(e)):null;return t&&t.checked||!1}function g(e){var n,r,o,c,a,u,i,l,s,f,g,_,w;return regeneratorRuntime.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(n="",r=e.data,o=r.jQuery,c=r.mollie,a=r.gateway,u=r.gatewayContainer,i=r.messages,l=y(u),s=o(l),f=o(document.body),v(a)){h.next=9;break}return b(s),s.submit(),h.abrupt("return");case 9:return e.preventDefault(),e.stopImmediatePropagation(),h.prev=11,h.next=14,regeneratorRuntime.awrap(d(c));case 14:n=h.sent,h.next=24;break;case 17:return h.prev=17,h.t0=h.catch(11),g=h.t0,_=g.message,message=void 0===_?i.defaultErrorMessage:_,(w=g)&&m(o,{content:w,type:"error"}),s.removeClass("processing").unblock(),f.trigger("checkout_error"),h.abrupt("return");case 24:b(s),n&&p(n,u.querySelector(t)),s.submit();case 27:case"end":return h.stop()}}),null,null,[[11,17]])}function _(e,n,t,r,o){t.forEach((function(t){return function(e,n,t,r,o){var c=t.name,a=function(e,n,t,r){var o;return r.has(e)&&(o=r.get(e)),o||(o=n.createComponent(e,t)),o}(c,e,n,r);f(o).insertAdjacentHTML("beforeend",'
')),a.mount("#".concat(c));var u,i,l=(u=c,(i=o)?i.querySelector(".mollie-component--".concat(u)):null);l?(!function(e,n){var t=n.label;e.insertAdjacentHTML("beforebegin",''.concat(t,""))}(l,t),function(e,n){var t=n.name;e.insertAdjacentHTML("afterend",''))}(l,t),!r.has(c)&&r.set(c,a)):console.warn("Component ".concat(c," not found in the DOM. Probably had problem during mount."))}(e,n,t,r,o)}))}!function(e){var n=e._,t=e.Mollie,r=e.mollieComponentsSettings,o=e.jQuery;if(!n.isEmpty(r)&&n.isFunction(t)){var c="updated_checkout",a=new Map,i=o(document),s=r.merchantProfileId,m=r.options,d=r.isCheckoutPayPage,p=new t(s,m);d&&(c="payment_method_selected"),i.on(c,(function(){return function(e,n,t,r){t.options,t.merchantProfileId;var o=t.componentsSettings,c=t.componentsAttributes,a=t.enabledGateways,i=t.messages;!function(e){e.forEach((function(e){return e.unmount()}))}(r),a.forEach((function(t){var a,s=l(t,document),m=f(s),d=y(s),p=e(d);s?d?(b(p),(a=m)&&(a.innerText=""),function(e){e.insertAdjacentHTML("beforeend",'')}(m),_(n,o[t],c,r,s),p.on("checkout_place_order",u),p.on("submit",null,{jQuery:e,mollie:n,gateway:t,gatewayContainer:s,messages:i},g)):console.warn("Cannot initialize Mollie Components, no form found."):console.warn("Cannot initialize Mollie Components for gateway ".concat(t,"."))}))}(o,p,r,a)}))}}(window)}]); \ No newline at end of file diff --git a/changelog.txt b/changelog.txt index 5875ec4ba..ab62879e0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,11 @@ == Changelog == += 5.4.2 - 09-12-2019 = + +* Fix - Mollie crash when WooCommerce plugin is not active +* Fix - Checkout form does not submit the order at first click on Place Order button when payment method is not one which support Mollie Components +* Fix - Minor styles issues for Mollie Components + = 5.4.1 - 05-12-2019 = * Fix - Mollie Components request multiple times the merchant profile ID via API diff --git a/inc/woocommerce.php b/inc/woocommerce.php index 52671be8c..681bddeb6 100644 --- a/inc/woocommerce.php +++ b/inc/woocommerce.php @@ -16,14 +16,6 @@ function is_order_received_page () } } -if (!function_exists('wc_date_format')) -{ - function wc_date_format () - { - return apply_filters('woocommerce_date_format', get_option('date_format')); - } -} - if (!function_exists('untrailingslashit')) { /** diff --git a/mollie-payments-for-woocommerce.php b/mollie-payments-for-woocommerce.php index 7236ff1cd..33cdeb7f8 100644 --- a/mollie-payments-for-woocommerce.php +++ b/mollie-payments-for-woocommerce.php @@ -3,7 +3,7 @@ * Plugin Name: Mollie Payments for WooCommerce * Plugin URI: https://www.mollie.com * Description: Accept payments in WooCommerce with the official Mollie plugin - * Version: 5.4.1 + * Version: 5.4.2 * Author: Mollie * Author URI: https://www.mollie.com * Requires at least: 3.8 @@ -197,14 +197,14 @@ function () { add_action('admin_notices', 'mollie_wc_plugin_inactive'); return; } - } - ); - add_action( - 'init', - function () { - load_plugin_textdomain('mollie-payments-for-woocommerce'); - Mollie_WC_Plugin::init(); + add_action( + 'init', + function () { + load_plugin_textdomain('mollie-payments-for-woocommerce'); + Mollie_WC_Plugin::init(); + } + ); } ); }, diff --git a/resources/js/mollie-components.js b/resources/js/mollie-components.js index 110b2d5b2..81ca90044 100644 --- a/resources/js/mollie-components.js +++ b/resources/js/mollie-components.js @@ -159,6 +159,7 @@ async function submitForm (evt) if (!isGatewaySelected(gateway)) { // Let other gateway to submit the form turnMollieComponentsSubmissionOff($form) + $form.submit() return } diff --git a/src/Mollie/WC/Gateway/Abstract.php b/src/Mollie/WC/Gateway/Abstract.php index d6cd0dd7a..b32975189 100644 --- a/src/Mollie/WC/Gateway/Abstract.php +++ b/src/Mollie/WC/Gateway/Abstract.php @@ -2055,7 +2055,7 @@ protected function mollieComponentsFields() ?>
-

+

lockIcon(); esc_html_e('Secure payments provided by '); diff --git a/src/Mollie/WC/Plugin.php b/src/Mollie/WC/Plugin.php index 01df4b72d..ea81db0ab 100644 --- a/src/Mollie/WC/Plugin.php +++ b/src/Mollie/WC/Plugin.php @@ -8,7 +8,7 @@ class Mollie_WC_Plugin { const PLUGIN_ID = 'mollie-payments-for-woocommerce'; const PLUGIN_TITLE = 'Mollie Payments for WooCommerce'; - const PLUGIN_VERSION = '5.4.1'; + const PLUGIN_VERSION = '5.4.2'; const DB_VERSION = '1.0'; const DB_VERSION_PARAM_NAME = 'mollie-db-version';