UNPKG

@aller/blink

Version:

A library for tracking user behaviour.

100 lines 3.41 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __spreadArrays = (this && this.__spreadArrays) || function () { for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j]; return r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.inscreenReducer0 = exports.inscreenReducer = exports.inscreen0 = void 0; var actions_1 = require("../actions"); function inscreen(state, action) { if (state === void 0) { state = []; } switch (action.type) { case actions_1.AD_SCREEN_ENTER: case actions_1.ARTICLE_PREVIEW_SCREEN_ENTER: case actions_1.BOX_SCREEN_ENTER: return __spreadArrays(state, [ { type: 'start', time: action.payload.time || new Date(), }, ]); case actions_1.AD_SCREEN_EXIT: return __spreadArrays(state, [ { type: 'stop', time: action.payload.time || new Date(), }, ]); default: return state; } } function inscreen0(state, action) { if (state === void 0) { state = []; } switch (action.type) { case actions_1.AD_SCREEN_ENTER_0: return __spreadArrays(state, [ { type: 'start', time: action.payload.time || new Date(), }, ]); case actions_1.AD_SCREEN_EXIT_0: return __spreadArrays(state, [ { type: 'stop', time: action.payload.time || new Date(), }, ]); default: return state; } } exports.inscreen0 = inscreen0; function inscreenReducer(state, action) { var _a; if (state === void 0) { state = {}; } switch (action.type) { case actions_1.PAGE_INIT: return {}; case actions_1.AD_SCREEN_ENTER: case actions_1.AD_SCREEN_EXIT: case actions_1.ARTICLE_PREVIEW_SCREEN_ENTER: case actions_1.BOX_SCREEN_ENTER: { return __assign(__assign({}, state), (_a = {}, _a[action.payload.id] = inscreen(state[action.payload.id], action), _a)); } default: return state; } } exports.inscreenReducer = inscreenReducer; function inscreenReducer0(state, action) { var _a; if (state === void 0) { state = {}; } switch (action.type) { case actions_1.PAGE_INIT: return {}; case actions_1.AD_SCREEN_ENTER_0: case actions_1.AD_SCREEN_EXIT_0: { return __assign(__assign({}, state), (_a = {}, _a[action.payload.id] = inscreen0(state[action.payload.id], action), _a)); } default: return state; } } exports.inscreenReducer0 = inscreenReducer0; //# sourceMappingURL=inscreen.js.map