@ludens-reklame/profiler-client
Advanced tools
Comparing version 0.4.5 to 0.4.6
@@ -31,3 +31,3 @@ interface Opts { | ||
private hasPersonalized; | ||
private hasRegisteredService; | ||
private hasRegisteredSource; | ||
constructor(opts: Opts); | ||
@@ -37,3 +37,3 @@ push(opts: PushOpts): Promise<void>; | ||
getPersonalizations(): Promise<Personalization[]>; | ||
registerService(): Promise<void>; | ||
registerSource(): Promise<void>; | ||
private handlePersonalizations; | ||
@@ -40,0 +40,0 @@ private network; |
@@ -43,3 +43,3 @@ "use strict"; | ||
this.hasPersonalized = false; | ||
this.hasRegisteredService = false; | ||
this.hasRegisteredSource = false; | ||
this.organization = opts.organization; | ||
@@ -53,3 +53,3 @@ this.personalize = opts.personalize || false; | ||
} | ||
this.registerService(); | ||
this.registerSource(); | ||
} | ||
@@ -134,31 +134,31 @@ Profiler.prototype.push = function (opts) { | ||
}; | ||
Profiler.prototype.registerService = function () { | ||
Profiler.prototype.registerSource = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var firstParty, thirdParty; | ||
var firstParty, thirdParty, error_4; | ||
return __generator(this, function (_a) { | ||
try { | ||
if (document && | ||
'referrer' in document && | ||
window && | ||
'location' in window && | ||
this.contactRef) { | ||
switch (_a.label) { | ||
case 0: | ||
_a.trys.push([0, 3, , 4]); | ||
if (!(document && | ||
'referrer' in document && | ||
window && | ||
'location' in window && | ||
this.contactRef)) return [3 /*break*/, 2]; | ||
firstParty = window.location.href; | ||
thirdParty = document.referrer; | ||
this.hasRegisteredService = true; | ||
if (firstParty.length > 0) { | ||
this.network('contacts/' + this.contactRef + '/referrers', { | ||
url: firstParty | ||
}, true); | ||
} | ||
if (thirdParty.length > 0) { | ||
this.network('contacts/' + this.contactRef + '/referrers', { | ||
url: thirdParty | ||
}, true); | ||
} | ||
} | ||
this.hasRegisteredSource = true; | ||
return [4 /*yield*/, this.network('contacts/' + this.contactRef + '/sources', { | ||
firstParty: firstParty, | ||
thirdParty: thirdParty | ||
}, true)]; | ||
case 1: | ||
_a.sent(); | ||
_a.label = 2; | ||
case 2: return [3 /*break*/, 4]; | ||
case 3: | ||
error_4 = _a.sent(); | ||
console.error(error_4); | ||
return [3 /*break*/, 4]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
catch (error) { | ||
console.error(error); | ||
} | ||
return [2 /*return*/]; | ||
}); | ||
@@ -169,3 +169,3 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var personalizations, i, ps, elems, j, elem, scriptTag, error_4; | ||
var personalizations, i, ps, elems, j, elem, scriptTag, error_5; | ||
return __generator(this, function (_a) { | ||
@@ -205,4 +205,4 @@ switch (_a.label) { | ||
case 3: | ||
error_4 = _a.sent(); | ||
console.error(error_4); | ||
error_5 = _a.sent(); | ||
console.error(error_5); | ||
return [3 /*break*/, 4]; | ||
@@ -216,3 +216,3 @@ case 4: return [2 /*return*/]; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var url, response, json, error_5; | ||
var url, response, json, error_6; | ||
return __generator(this, function (_a) { | ||
@@ -245,4 +245,4 @@ switch (_a.label) { | ||
} | ||
if (!this.hasRegisteredService && this.contactRef) { | ||
this.registerService(); | ||
if (!this.hasRegisteredSource && this.contactRef) { | ||
this.registerSource(); | ||
} | ||
@@ -252,4 +252,4 @@ } | ||
case 3: | ||
error_5 = _a.sent(); | ||
console.error(error_5); | ||
error_6 = _a.sent(); | ||
console.error(error_6); | ||
return [3 /*break*/, 4]; | ||
@@ -256,0 +256,0 @@ case 4: return [2 /*return*/]; |
{ | ||
"name": "@ludens-reklame/profiler-client", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"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
18474