@splitsoftware/splitio-commons 2.4.2-rc.0 → 2.4.2-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -9,7 +9,7 @@ var constants_2 = require("../utils/constants");
|
|
|
9
9
|
* Impressions tracker stores impressions in cache and pass them to the listener and integrations manager if provided.
|
|
10
10
|
*/
|
|
11
11
|
function impressionsTrackerFactory(settings, impressionsCache, noneStrategy, strategy, whenInit, integrationsManager, telemetryCache) {
|
|
12
|
-
var log = settings.log,
|
|
12
|
+
var log = settings.log, _a = settings.runtime, ip = _a.ip, hostname = _a.hostname, version = settings.version;
|
|
13
13
|
return {
|
|
14
14
|
track: function (impressions, attributes) {
|
|
15
15
|
if (settings.userConsent === constants_2.CONSENT_DECLINED)
|
|
@@ -42,7 +42,7 @@ function impressionsTrackerFactory(settings, impressionsCache, noneStrategy, str
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
// @TODO next block might be handled by the integration manager. In that case, the metadata object doesn't need to be passed in the constructor
|
|
45
|
-
if (impressionListener || integrationsManager) {
|
|
45
|
+
if (settings.impressionListener || integrationsManager) {
|
|
46
46
|
var _loop_1 = function (i) {
|
|
47
47
|
var impressionData = {
|
|
48
48
|
// copy of impression, to avoid unexpected behavior if modified by integrations or impressionListener
|
|
@@ -59,8 +59,8 @@ function impressionsTrackerFactory(settings, impressionsCache, noneStrategy, str
|
|
|
59
59
|
if (integrationsManager)
|
|
60
60
|
integrationsManager.handleImpression(impressionData);
|
|
61
61
|
try { // @ts-ignore. An exception on the listeners should not break the SDK.
|
|
62
|
-
if (impressionListener)
|
|
63
|
-
impressionListener.logImpression(impressionData);
|
|
62
|
+
if (settings.impressionListener)
|
|
63
|
+
settings.impressionListener.logImpression(impressionData);
|
|
64
64
|
}
|
|
65
65
|
catch (err) {
|
|
66
66
|
log.error(constants_1.ERROR_IMPRESSIONS_LISTENER, [err]);
|
|
@@ -6,7 +6,7 @@ import { CONSENT_DECLINED, DEDUPED, QUEUED } from '../utils/constants';
|
|
|
6
6
|
* Impressions tracker stores impressions in cache and pass them to the listener and integrations manager if provided.
|
|
7
7
|
*/
|
|
8
8
|
export function impressionsTrackerFactory(settings, impressionsCache, noneStrategy, strategy, whenInit, integrationsManager, telemetryCache) {
|
|
9
|
-
var log = settings.log,
|
|
9
|
+
var log = settings.log, _a = settings.runtime, ip = _a.ip, hostname = _a.hostname, version = settings.version;
|
|
10
10
|
return {
|
|
11
11
|
track: function (impressions, attributes) {
|
|
12
12
|
if (settings.userConsent === CONSENT_DECLINED)
|
|
@@ -39,7 +39,7 @@ export function impressionsTrackerFactory(settings, impressionsCache, noneStrate
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
// @TODO next block might be handled by the integration manager. In that case, the metadata object doesn't need to be passed in the constructor
|
|
42
|
-
if (impressionListener || integrationsManager) {
|
|
42
|
+
if (settings.impressionListener || integrationsManager) {
|
|
43
43
|
var _loop_1 = function (i) {
|
|
44
44
|
var impressionData = {
|
|
45
45
|
// copy of impression, to avoid unexpected behavior if modified by integrations or impressionListener
|
|
@@ -56,8 +56,8 @@ export function impressionsTrackerFactory(settings, impressionsCache, noneStrate
|
|
|
56
56
|
if (integrationsManager)
|
|
57
57
|
integrationsManager.handleImpression(impressionData);
|
|
58
58
|
try { // @ts-ignore. An exception on the listeners should not break the SDK.
|
|
59
|
-
if (impressionListener)
|
|
60
|
-
impressionListener.logImpression(impressionData);
|
|
59
|
+
if (settings.impressionListener)
|
|
60
|
+
settings.impressionListener.logImpression(impressionData);
|
|
61
61
|
}
|
|
62
62
|
catch (err) {
|
|
63
63
|
log.error(ERROR_IMPRESSIONS_LISTENER, [err]);
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@ export function impressionsTrackerFactory(
|
|
|
20
20
|
telemetryCache?: ITelemetryCacheSync | ITelemetryCacheAsync,
|
|
21
21
|
): IImpressionsTracker {
|
|
22
22
|
|
|
23
|
-
const { log,
|
|
23
|
+
const { log, runtime: { ip, hostname }, version } = settings;
|
|
24
24
|
|
|
25
25
|
return {
|
|
26
26
|
track(impressions: ImpressionDecorated[], attributes?: SplitIO.Attributes) {
|
|
@@ -56,7 +56,7 @@ export function impressionsTrackerFactory(
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// @TODO next block might be handled by the integration manager. In that case, the metadata object doesn't need to be passed in the constructor
|
|
59
|
-
if (impressionListener || integrationsManager) {
|
|
59
|
+
if (settings.impressionListener || integrationsManager) {
|
|
60
60
|
for (let i = 0; i < impressionsLength; i++) {
|
|
61
61
|
const impressionData: SplitIO.ImpressionData = {
|
|
62
62
|
// copy of impression, to avoid unexpected behavior if modified by integrations or impressionListener
|
|
@@ -74,7 +74,7 @@ export function impressionsTrackerFactory(
|
|
|
74
74
|
if (integrationsManager) integrationsManager.handleImpression(impressionData);
|
|
75
75
|
|
|
76
76
|
try { // @ts-ignore. An exception on the listeners should not break the SDK.
|
|
77
|
-
if (impressionListener) impressionListener.logImpression(impressionData);
|
|
77
|
+
if (settings.impressionListener) settings.impressionListener.logImpression(impressionData);
|
|
78
78
|
} catch (err) {
|
|
79
79
|
log.error(ERROR_IMPRESSIONS_LISTENER, [err]);
|
|
80
80
|
}
|