@ludens-reklame/profiler-client
Advanced tools
Comparing version 0.4.6 to 0.5.0
@@ -39,3 +39,5 @@ interface Opts { | ||
private network; | ||
private wrapDom; | ||
private removePersonalizations; | ||
} | ||
export default Profiler; |
@@ -40,2 +40,3 @@ "use strict"; | ||
var profilerURL = 'https://api.profiler.marketing'; | ||
var PERSONALIZATION_CLASS_NAME = '__prfPrs'; | ||
var Profiler = /** @class */ (function () { | ||
@@ -73,2 +74,3 @@ function Profiler(opts) { | ||
_a.sent(); | ||
this.handlePersonalizations(); | ||
return [3 /*break*/, 3]; | ||
@@ -95,2 +97,3 @@ case 2: | ||
_a.sent(); | ||
this.handlePersonalizations(); | ||
return [3 /*break*/, 3]; | ||
@@ -156,2 +159,3 @@ case 2: | ||
_a.sent(); | ||
this.handlePersonalizations(); | ||
_a.label = 2; | ||
@@ -179,2 +183,3 @@ case 2: return [3 /*break*/, 4]; | ||
personalizations = _a.sent(); | ||
this.removePersonalizations(); | ||
for (i = 0; i < personalizations.length; i++) { | ||
@@ -187,3 +192,3 @@ ps = personalizations[i]; | ||
if (ps.htmlPlacement === 'replace') { | ||
elem.innerHTML = ps.html; | ||
elem.innerHTML = this.wrapDom(ps.html); | ||
} | ||
@@ -193,3 +198,3 @@ else { | ||
//@ts-ignore How to fix this? | ||
ps.htmlPlacement || 'beforeend', ps.html); | ||
ps.htmlPlacement || 'beforeend', this.wrapDom(ps.html)); | ||
} | ||
@@ -260,2 +265,12 @@ } | ||
}; | ||
Profiler.prototype.wrapDom = function (html) { | ||
return ('<span class="' + PERSONALIZATION_CLASS_NAME + '">' + html + '</span>'); | ||
}; | ||
Profiler.prototype.removePersonalizations = function () { | ||
var elements = document.getElementsByClassName(PERSONALIZATION_CLASS_NAME); | ||
for (var i = 0; i < elements.length; i++) { | ||
var element = elements[i]; | ||
element.remove(); | ||
} | ||
}; | ||
return Profiler; | ||
@@ -262,0 +277,0 @@ }()); |
{ | ||
"name": "@ludens-reklame/profiler-client", | ||
"version": "0.4.6", | ||
"version": "0.5.0", | ||
"description": "Profiler for all", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
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
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
19838
318