Fix GooglePay preview buttons

This commit is contained in:
Pedro Silva 2023-10-16 17:56:58 +01:00
parent 8847cbbd21
commit 9ab11b40e4
No known key found for this signature in database
GPG key ID: E2EE20C0669D24B3
3 changed files with 24 additions and 4 deletions

View file

@ -36,6 +36,17 @@ import widgetBuilder from "../../../ppcp-button/resources/js/modules/Renderer/Wi
}
});
// Maybe we can find a more elegant reload method when transitioning from styling modes.
jQuery([
'#ppcp-smart_button_enable_styling_per_location'
].join(',')).on('change', () => {
setTimeout(() => {
for (const [selector, ppcpConfig] of Object.entries(activeButtons)) {
createButton(ppcpConfig);
}
}, 100);
});
const applyConfigOptions = function (buttonConfig) {
buttonConfig.button = buttonConfig.button || {};
buttonConfig.button.style = buttonConfig.button.style || {};

View file

@ -109,10 +109,13 @@ class AvailabilityNotice {
static function ( $notices ): array {
$message = sprintf(
// translators: %1$s and %2$s are the opening and closing of HTML <a> tag.
__(
'<p>Notice: We could not determine your PayPal seller status to list your available features. Disconnect and reconnect your PayPal account through our onboarding process to resolve this.</p><p>Don\'t worry if you cannot use the onboarding process; most functionalities available to your account should work.</p>',
'<p>Notice: We could not determine your PayPal seller status to list your available features. Disconnect and reconnect your PayPal account through our %1$sonboarding process%2$s to resolve this.</p><p>Don\'t worry if you cannot use the %1$sonboarding process%2$s; most functionalities available to your account should work.</p>',
'woocommerce-paypal-payments'
)
),
'<a href="https://woocommerce.com/document/woocommerce-paypal-payments/#connect-paypal-account" target="_blank">',
'</a>'
);
// Name the key so it can be overridden in other modules.

View file

@ -19,7 +19,10 @@ document.addEventListener(
if (! toggleElement.checked) {
group.forEach( (elementToHide) => {
document.querySelector(elementToHide).style.display = 'none';
const element = document.querySelector(elementToHide);
if (element) {
element.style.display = 'none';
}
})
}
toggleElement.addEventListener(
@ -27,7 +30,10 @@ document.addEventListener(
(event) => {
if (! event.target.checked) {
group.forEach( (elementToHide) => {
document.querySelector(elementToHide).style.display = 'none';
const element = document.querySelector(elementToHide);
if (element) {
element.style.display = 'none';
}
});
return;