@aller/blink
Advanced tools
Comparing version 8.25.3-alpha.0 to 8.25.4-alpha.0
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "8.25.3-alpha.0"; | ||
export declare const VERSION = "8.25.4-alpha.0"; | ||
/** | ||
@@ -3,0 +3,0 @@ * The minimum waiting time between each sending of active time events |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ACTIVE_TIME_INITIAL_MOBILE = exports.ACTIVE_TIME_WAIT = exports.VERSION = void 0; | ||
exports.VERSION = '8.25.3-alpha.0'; | ||
exports.VERSION = '8.25.4-alpha.0'; | ||
/** | ||
@@ -6,0 +6,0 @@ * The minimum waiting time between each sending of active time events |
{ | ||
"name": "@aller/blink", | ||
"version": "8.25.3-alpha.0", | ||
"version": "8.25.4-alpha.0", | ||
"description": "A library for tracking user behaviour.", | ||
@@ -69,3 +69,3 @@ "main": "lib/main.js", | ||
}, | ||
"gitHead": "fb98c6c6afa5646628edd6d7972d95226ee3bd8b" | ||
"gitHead": "9549fc5700b4532bac28bd99d3d6b099b114c407" | ||
} |
@@ -1,2 +0,2 @@ | ||
export const VERSION = '8.25.3-alpha.0'; | ||
export const VERSION = '8.25.4-alpha.0'; | ||
@@ -3,0 +3,0 @@ /** |
@@ -56,210 +56,210 @@ import prepareAdEvent, { | ||
(next: any) => | ||
(action: any) => { | ||
// Send all events if we get a pageInit event | ||
// Make sure we do it before the PAGE_INIT flushes the state | ||
if (action.type === PAGE_INIT) { | ||
const { payload } = action; | ||
const beforePage = getPageState(getState(), payload.pageId).state; | ||
const eventsToSend = [ | ||
...getAllAdEventsPrepared(beforePage, payload.time), | ||
...getAllActiveTimeEventsPrepared(beforePage, payload.time), | ||
]; | ||
if (eventsToSend.length > 0) { | ||
send(eventsToSend); | ||
} | ||
(action: any) => { | ||
// Send all events if we get a pageInit event | ||
// Make sure we do it before the PAGE_INIT flushes the state | ||
if (action.type === PAGE_INIT) { | ||
const { payload } = action; | ||
const beforePage = getPageState(getState(), payload.pageId).state; | ||
const eventsToSend = [ | ||
...getAllAdEventsPrepared(beforePage, payload.time), | ||
...getAllActiveTimeEventsPrepared(beforePage, payload.time), | ||
]; | ||
if (eventsToSend.length > 0) { | ||
send(eventsToSend); | ||
} | ||
} | ||
// Execute the action, which might mutate the state | ||
const returnValue = next(action); | ||
const state: any = getState(); | ||
const page = getPageState(state, action.payload.pageId); | ||
switch (action.type) { | ||
case DFP_IMPRESSION_VIEWABLE: | ||
case DFP_SLOT_RENDER_ENDED: | ||
case DFP_SLOT_ON_LOAD: | ||
send([ | ||
prepareAdEvent({ | ||
page, | ||
id: action.payload.id, | ||
}), | ||
]); | ||
break; | ||
case CLICK: | ||
sendDirect([ | ||
prepareClickEvent({ | ||
page, | ||
url: action.payload.url, | ||
abId: action.payload.abId, | ||
clickId: action.payload.clickId, | ||
externalId: action.payload.id, | ||
context: action.payload.context, | ||
}), | ||
]); | ||
break; | ||
case VIDEO_PLAY: | ||
send([ | ||
prepareVideoPlayForSending({ | ||
page, | ||
...action.payload, | ||
}), | ||
]); | ||
break; | ||
case VIDEO_LOAD: | ||
send([ | ||
prepareVideoLoadForSending({ | ||
page, | ||
...action.payload, | ||
}), | ||
]); | ||
break; | ||
case VIDEO_STOP: | ||
let _send = send; | ||
if (action && action.payload && action.payload.beforeunload) { | ||
_send = sendDirect; | ||
} | ||
// Execute the action, which might mutate the state | ||
const returnValue = next(action); | ||
const state: any = getState(); | ||
const page = getPageState(state, action.payload.pageId); | ||
switch (action.type) { | ||
case DFP_IMPRESSION_VIEWABLE: | ||
case DFP_SLOT_RENDER_ENDED: | ||
case DFP_SLOT_ON_LOAD: | ||
send([ | ||
prepareAdEvent({ | ||
page, | ||
id: action.payload.id, | ||
}), | ||
]); | ||
break; | ||
case CLICK: | ||
sendDirect([ | ||
prepareClickEvent({ | ||
page, | ||
url: action.payload.url, | ||
abId: action.payload.abId, | ||
clickId: action.payload.clickId, | ||
externalId: action.payload.id, | ||
context: action.payload.context, | ||
}), | ||
]); | ||
break; | ||
case VIDEO_PLAY: | ||
send([ | ||
prepareVideoPlayForSending({ | ||
page, | ||
...action.payload, | ||
}), | ||
]); | ||
break; | ||
case VIDEO_LOAD: | ||
send([ | ||
prepareVideoLoadForSending({ | ||
page, | ||
...action.payload, | ||
}), | ||
]); | ||
break; | ||
case VIDEO_STOP: | ||
let _send = send; | ||
if (action && action.payload && action.payload.beforeunload) { | ||
_send = sendDirect; | ||
} | ||
_send( | ||
_send( | ||
prepareVideoWatchForSending({ | ||
page, | ||
...action.payload, | ||
}), | ||
); | ||
break; | ||
case PLAYER_HIDDEN: | ||
const videoIds = getUniqueVideoIdsForPlayer( | ||
page.state.video.events, | ||
action.payload.playerId, | ||
); | ||
// "Brodcast" player hidden event to all videos with the playerId | ||
videoIds.forEach(videoId => { | ||
send( | ||
prepareVideoWatchForSending({ | ||
page, | ||
page: page, | ||
videoId, | ||
...action.payload, | ||
}), | ||
); | ||
break; | ||
case PLAYER_HIDDEN: | ||
const videoIds = getUniqueVideoIdsForPlayer( | ||
page.state.video.events, | ||
action.payload.playerId, | ||
); | ||
// "Brodcast" player hidden event to all videos with the playerId | ||
videoIds.forEach(videoId => { | ||
send( | ||
prepareVideoWatchForSending({ | ||
page: page, | ||
videoId, | ||
...action.payload, | ||
}), | ||
); | ||
}); | ||
break; | ||
case VIDEO_AD: | ||
send([ | ||
prepareVideoAdForSending({ | ||
page, | ||
...action.payload, | ||
}), | ||
]); | ||
break; | ||
case CUSTOM: | ||
send([ | ||
prepareCustomEvent({ | ||
page, | ||
customDomain: action.payload.customDomain, | ||
customType: action.payload.customType, | ||
customContent: action.payload.customContent, | ||
customValue: action.payload.customValue, | ||
time: action.payload.time, | ||
}), | ||
]); | ||
break; | ||
case PAGE_LOAD: | ||
send([ | ||
preparePageloadEvent({ | ||
page, | ||
url: action.payload.url, | ||
}), | ||
]); | ||
break; | ||
case PERFORMANCE: | ||
send([ | ||
preparePerformanceEvent({ | ||
page, | ||
performanceTimings: action.payload.performanceTimings, | ||
}), | ||
]); | ||
break; | ||
case WEB_VITALS: | ||
send([ | ||
prepareCwvEvent({ | ||
page, | ||
webVitals: action.payload.webVitals, | ||
}), | ||
]); | ||
break; | ||
case ARTICLE_PREVIEW_SCREEN_ENTER: | ||
send([ | ||
prepareImpressionEvent({ | ||
page, | ||
id: action.payload.id, | ||
abId: action.payload.abId, | ||
context: action.payload.context, | ||
url: action.payload.url, | ||
title: action.payload.title, | ||
personalizationSystemUsed: | ||
action.payload.personalizationSystemUsed, | ||
personalizationParametersRequested: | ||
action.payload.personalizationParametersRequested, | ||
height: action.payload.height, | ||
width: action.payload.width, | ||
}), | ||
]); | ||
break; | ||
case BOX_SCREEN_ENTER: | ||
send([ | ||
prepareBoxEvent({ | ||
page, | ||
id: action.payload.id, | ||
title: action.payload.title, | ||
height: action.payload.height, | ||
width: action.payload.width, | ||
}), | ||
]); | ||
break; | ||
case AD_SCREEN_EXIT: | ||
case AD_SCREEN_EXIT_0: | ||
send([ | ||
prepareAdEvent({ | ||
page, | ||
id: action.payload.id, | ||
}), | ||
]); | ||
break; | ||
case ARTICLE_ACTIVITY_STOP: | ||
send([ | ||
prepareActiveTimeEvent({ | ||
page, | ||
id: action.payload.id, | ||
}), | ||
]); | ||
break; | ||
case SEND_ALL_EVENTS: | ||
{ | ||
const { payload } = action; | ||
const eventsToSend = [ | ||
...getAllAdEventsPrepared(page, payload.time), | ||
...getAllActiveTimeEventsPrepared(page, payload.time), | ||
...getAllVideoWatchEventsPrepared(page, payload.time), | ||
]; | ||
if (eventsToSend.length > 0) { | ||
sendDirect(eventsToSend); | ||
} | ||
}); | ||
break; | ||
case VIDEO_AD: | ||
send([ | ||
prepareVideoAdForSending({ | ||
page, | ||
...action.payload, | ||
}), | ||
]); | ||
break; | ||
case CUSTOM: | ||
send([ | ||
prepareCustomEvent({ | ||
page, | ||
customDomain: action.payload.customDomain, | ||
customType: action.payload.customType, | ||
customContent: action.payload.customContent, | ||
customValue: action.payload.customValue, | ||
time: action.payload.time, | ||
}), | ||
]); | ||
break; | ||
case PAGE_LOAD: | ||
send([ | ||
preparePageloadEvent({ | ||
page, | ||
url: action.payload.url, | ||
}), | ||
]); | ||
break; | ||
case PERFORMANCE: | ||
send([ | ||
preparePerformanceEvent({ | ||
page, | ||
performanceTimings: action.payload.performanceTimings, | ||
}), | ||
]); | ||
break; | ||
case WEB_VITALS: | ||
send([ | ||
prepareCwvEvent({ | ||
page, | ||
webVitals: action.payload.webVitals, | ||
}), | ||
]); | ||
break; | ||
case ARTICLE_PREVIEW_SCREEN_ENTER: | ||
send([ | ||
prepareImpressionEvent({ | ||
page, | ||
id: action.payload.id, | ||
abId: action.payload.abId, | ||
context: action.payload.context, | ||
url: action.payload.url, | ||
title: action.payload.title, | ||
personalizationSystemUsed: | ||
action.payload.personalizationSystemUsed, | ||
personalizationParametersRequested: | ||
action.payload.personalizationParametersRequested, | ||
height: action.payload.height, | ||
width: action.payload.width, | ||
}), | ||
]); | ||
break; | ||
case BOX_SCREEN_ENTER: | ||
send([ | ||
prepareBoxEvent({ | ||
page, | ||
id: action.payload.id, | ||
title: action.payload.title, | ||
height: action.payload.height, | ||
width: action.payload.width, | ||
}), | ||
]); | ||
break; | ||
case AD_SCREEN_EXIT: | ||
case AD_SCREEN_EXIT_0: | ||
send([ | ||
prepareAdEvent({ | ||
page, | ||
id: action.payload.id, | ||
}), | ||
]); | ||
break; | ||
case ARTICLE_ACTIVITY_STOP: | ||
send([ | ||
prepareActiveTimeEvent({ | ||
page, | ||
id: action.payload.id, | ||
}), | ||
]); | ||
break; | ||
case SEND_ALL_EVENTS: | ||
{ | ||
const { payload } = action; | ||
const eventsToSend = [ | ||
...getAllAdEventsPrepared(page, payload.time), | ||
...getAllActiveTimeEventsPrepared(page, payload.time), | ||
...getAllVideoWatchEventsPrepared(page, payload.time), | ||
]; | ||
if (eventsToSend.length > 0) { | ||
sendDirect(eventsToSend); | ||
} | ||
break; | ||
case CONSENT_V2: | ||
send([ | ||
prepareConsentEvent({ | ||
page, | ||
uuid: action.payload.uuid, | ||
tcfV2: action.payload.tcfV2, | ||
kind: action.payload.kind, | ||
consentGranted: action.payload.consentGranted, | ||
consentedToAll: action.payload.consentedToAll, | ||
applies: action.payload.applies, | ||
}), | ||
]); | ||
break; | ||
default: | ||
break; | ||
} | ||
return returnValue; | ||
}; | ||
} | ||
break; | ||
case CONSENT_V2: | ||
send([ | ||
prepareConsentEvent({ | ||
page, | ||
uuid: action.payload.uuid, | ||
tcfV2: action.payload.tcfV2, | ||
kind: action.payload.kind, | ||
consentGranted: action.payload.consentGranted, | ||
consentedToAll: action.payload.consentedToAll, | ||
applies: action.payload.applies, | ||
}), | ||
]); | ||
break; | ||
default: | ||
break; | ||
} | ||
return returnValue; | ||
}; | ||
} |
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
812110