mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 18:16:38 +08:00
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:
parent
b4e35e2959
commit
8f99aa5f9e
2 changed files with 11 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
||||||
export function log(message, level = 'info') {
|
export function log(message, level = 'info') {
|
||||||
const wpDebug = window.wc_ppcp_axo?.wp_debug;
|
const wpDebug = window.wc_ppcp_axo?.wp_debug;
|
||||||
const endpoint = window.wc_ppcp_axo?.ajax?.frontend_logger?.endpoint;
|
const endpoint = window.wc_ppcp_axo?.ajax?.frontend_logger?.endpoint;
|
||||||
if(!wpDebug || !endpoint) {
|
if (!endpoint) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ export function log(message, level = 'info') {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
if (wpDebug) {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case 'error':
|
case 'error':
|
||||||
console.error(`[AXO] ${message}`);
|
console.error(`[AXO] ${message}`);
|
||||||
|
@ -23,5 +24,6 @@ export function log(message, level = 'info') {
|
||||||
default:
|
default:
|
||||||
console.log(`[AXO] ${message}`);
|
console.log(`[AXO] ${message}`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ class AxoManager {
|
||||||
'email' => 'render',
|
'email' => 'render',
|
||||||
),
|
),
|
||||||
'insights' => array(
|
'insights' => array(
|
||||||
'enabled' => true,
|
'enabled' => defined( 'WP_DEBUG' ) && WP_DEBUG,
|
||||||
'client_id' => ( $this->settings->has( 'client_id' ) ? $this->settings->get( 'client_id' ) : null ),
|
'client_id' => ( $this->settings->has( 'client_id' ) ? $this->settings->get( 'client_id' ) : null ),
|
||||||
'session_id' =>
|
'session_id' =>
|
||||||
substr(
|
substr(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue