@blotoutio/providers-app-lovin-sdk
Advanced tools
Comparing version
@@ -48,2 +48,34 @@ 'use strict'; | ||
const canLog = () => { | ||
try { | ||
return localStorage.getItem('edgeTagDebug') === '1'; | ||
} | ||
catch { | ||
return false; | ||
} | ||
}; | ||
const prefix = `[EdgeTag]`; | ||
const logger = { | ||
log: (...args) => { | ||
if (canLog()) { | ||
console.log(prefix, ...args); | ||
} | ||
}, | ||
error: (...args) => { | ||
if (canLog()) { | ||
console.error(prefix, ...args); | ||
} | ||
}, | ||
info: (...args) => { | ||
if (canLog()) { | ||
console.info(prefix, ...args); | ||
} | ||
}, | ||
trace: (...args) => { | ||
if (canLog()) { | ||
console.trace(prefix, ...args); | ||
} | ||
}, | ||
}; | ||
const getItems = (contents) => contents.map((item) => { | ||
@@ -157,5 +189,2 @@ return { | ||
} | ||
default: { | ||
throw new Error(`Event: ${eventName} is not supported.`); | ||
} | ||
} | ||
@@ -166,11 +195,15 @@ }; | ||
const payload = { | ||
sdkVersion: "1.4.0" , | ||
sdkVersion: "1.5.0" , | ||
}; | ||
if (window.axon && manifestVariables['enableBrowser'] === '1') { | ||
try { | ||
const { name, data: eventData } = getEventData(eventName, userId, data); | ||
window.axon('track', name, eventData); | ||
const event = getEventData(eventName, userId, data); | ||
if (!event) { | ||
logger.log(`[${packageName}] ${eventName} not supported`); | ||
return; | ||
} | ||
window.axon('track', event.name, event.data); | ||
} | ||
catch (e) { | ||
console.log(e); | ||
logger.error(e); | ||
} | ||
@@ -177,0 +210,0 @@ } |
47
index.js
@@ -49,2 +49,34 @@ var ProvidersAppLovinSdk = (function () { | ||
const canLog = () => { | ||
try { | ||
return localStorage.getItem('edgeTagDebug') === '1'; | ||
} | ||
catch { | ||
return false; | ||
} | ||
}; | ||
const prefix = `[EdgeTag]`; | ||
const logger = { | ||
log: (...args) => { | ||
if (canLog()) { | ||
console.log(prefix, ...args); | ||
} | ||
}, | ||
error: (...args) => { | ||
if (canLog()) { | ||
console.error(prefix, ...args); | ||
} | ||
}, | ||
info: (...args) => { | ||
if (canLog()) { | ||
console.info(prefix, ...args); | ||
} | ||
}, | ||
trace: (...args) => { | ||
if (canLog()) { | ||
console.trace(prefix, ...args); | ||
} | ||
}, | ||
}; | ||
const getItems = (contents) => contents.map((item) => { | ||
@@ -158,5 +190,2 @@ return { | ||
} | ||
default: { | ||
throw new Error(`Event: ${eventName} is not supported.`); | ||
} | ||
} | ||
@@ -167,11 +196,15 @@ }; | ||
const payload = { | ||
sdkVersion: "1.4.0" , | ||
sdkVersion: "1.5.0" , | ||
}; | ||
if (window.axon && manifestVariables['enableBrowser'] === '1') { | ||
try { | ||
const { name, data: eventData } = getEventData(eventName, userId, data); | ||
window.axon('track', name, eventData); | ||
const event = getEventData(eventName, userId, data); | ||
if (!event) { | ||
logger.log(`[${packageName}] ${eventName} not supported`); | ||
return; | ||
} | ||
window.axon('track', event.name, event.data); | ||
} | ||
catch (e) { | ||
console.log(e); | ||
logger.error(e); | ||
} | ||
@@ -178,0 +211,0 @@ } |
{ | ||
"name": "@blotoutio/providers-app-lovin-sdk", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "App Lovin Browser SDK for EdgeTag", | ||
@@ -5,0 +5,0 @@ "author": "Blotout", |
Sorry, the diff of this file is not supported yet
19966
11.77%667
16.81%