swdc-tracker
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -57,2 +57,10 @@ "use strict"; | ||
swdcTracker.spTracker = tracker([e], namespace, appId, false); | ||
if (process.env.ENABLE_SWDC_TRACKER === "true") { | ||
swdcTracker.testMode = false; | ||
console.log('swdc-tracker initialized and ready to send events'); | ||
} | ||
else { | ||
swdcTracker.testMode = true; | ||
console.log('swdc-tracker test mode on. set env ENABLE_SWDC_TRACKER to "true" to send events'); | ||
} | ||
return [3 /*break*/, 3]; | ||
@@ -94,4 +102,8 @@ case 2: | ||
]; | ||
swdcTracker.spTracker.trackUnstructEvent(properties, contexts); | ||
swdcTracker.spTracker.trackUnstructEvent(properties, contexts); | ||
if (swdcTracker.testMode) { | ||
testEvent(properties, contexts); | ||
} | ||
else { | ||
swdcTracker.spTracker.trackUnstructEvent(properties, contexts); | ||
} | ||
return [2 /*return*/]; | ||
@@ -131,4 +143,16 @@ } | ||
]; | ||
swdcTracker.spTracker.trackUnstructEvent(properties, contexts); | ||
if (swdcTracker.testMode) { | ||
testEvent(properties, contexts); | ||
} | ||
else { | ||
swdcTracker.spTracker.trackUnstructEvent(properties, contexts); | ||
} | ||
}; | ||
function testEvent(properties, contexts) { | ||
var event = { | ||
properties: properties, | ||
contexts: contexts | ||
}; | ||
console.log("swdc-tracker test mode on. trackUnstructEvent was called with the following payload: ", event); | ||
} | ||
exports.default = swdcTracker; |
{ | ||
"name": "swdc-tracker", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "swdc event tracker", | ||
@@ -5,0 +5,0 @@ "main": "dist", |
@@ -23,3 +23,12 @@ import { get } from "./utils/http"; | ||
const e = emitter(tracker_api_host) | ||
swdcTracker.spTracker = tracker([e], namespace, appId, false) | ||
if(process.env.ENABLE_SWDC_TRACKER === "true") { | ||
swdcTracker.testMode = false | ||
console.log('swdc-tracker initialized and ready to send events') | ||
} else { | ||
swdcTracker.testMode = true | ||
console.log('swdc-tracker test mode on. set env ENABLE_SWDC_TRACKER to "true" to send events') | ||
} | ||
} catch(e) { | ||
@@ -80,5 +89,7 @@ console.log("swdcTracker failed to initialize", e) | ||
swdcTracker.spTracker.trackUnstructEvent(properties, contexts) | ||
swdcTracker.spTracker.trackUnstructEvent(properties, contexts); | ||
if(swdcTracker.testMode){ | ||
testEvent(properties, contexts) | ||
} else { | ||
swdcTracker.spTracker.trackUnstructEvent(properties, contexts) | ||
} | ||
} | ||
@@ -169,5 +180,17 @@ | ||
swdcTracker.spTracker.trackUnstructEvent(properties, contexts) | ||
if(swdcTracker.testMode){ | ||
testEvent(properties, contexts) | ||
} else { | ||
swdcTracker.spTracker.trackUnstructEvent(properties, contexts) | ||
} | ||
} | ||
function testEvent(properties: any, contexts: any): void { | ||
const event = { | ||
properties: properties, | ||
contexts: contexts | ||
} | ||
console.log("swdc-tracker test mode on. trackUnstructEvent was called with the following payload: ", event) | ||
} | ||
export default swdcTracker; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49176
794
2