Merge branch 'trunk' into PCP-3170-add-es-lint-and-testing-library-for-js-code

This commit is contained in:
Emili Castells Guasch 2024-07-01 17:29:03 +02:00
commit 4c05e7c2bd
34 changed files with 1094 additions and 450 deletions

View file

@ -1,6 +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(!endpoint) {
if (!endpoint) {
return;
}
@ -15,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}`);
}
}
});
}