Hide PayPal Insights when WP Debug is set to false. Also allow logging when WP Debug is set to false.

This commit is contained in:
Daniel Dudzic 2024-06-12 22:30:33 +02:00
parent b4e35e2959
commit 8f99aa5f9e
No known key found for this signature in database
GPG key ID: 31B40D33E3465483
2 changed files with 11 additions and 9 deletions

View file

@ -1,7 +1,7 @@
export function log(message, level = 'info') {
const wpDebug = window.wc_ppcp_axo?.wp_debug;
const endpoint = window.wc_ppcp_axo?.ajax?.frontend_logger?.endpoint;
if(!wpDebug || !endpoint) {
if (!endpoint) {
return;
}
@ -16,12 +16,14 @@ export function log(message, level = 'info') {
}
})
}).then(() => {
switch (level) {
case 'error':
console.error(`[AXO] ${message}`);
break;
default:
console.log(`[AXO] ${message}`);
if (wpDebug) {
switch (level) {
case 'error':
console.error(`[AXO] ${message}`);
break;
default:
console.log(`[AXO] ${message}`);
}
}
});
}