as-event-tracker
Version:
Logs events in the browser based on client interactions.
96 lines • 3.02 kB
JavaScript
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserState = void 0;
var utils_1 = require("../helpers/utils");
var ClientChannelMeta_1 = __importDefault(require("./ClientChannelMeta"));
var UserState = (function () {
function UserState(init) {
this.sessionId = "";
this.visitorId = "";
Object.assign(this, init);
}
return UserState;
}());
exports.UserState = UserState;
var State = (function () {
function State(init) {
this.client_key = "";
this.client_reference = null;
this.request_id = "";
this.enableAutoClick = false;
this.sendPageLoad = false;
this.manualPageLoadTrackingStringsToMatch = null;
this.isAuthenticated = false;
this.user = new UserState();
this.captureUrl = '';
this.dataSource = '';
this.clientChannelMeta = new ClientChannelMeta_1.default({});
this.consoleLogEvents = false;
Object.assign(this, init);
}
State.prototype.setClientRef = function (client_ref) {
if (client_ref) {
this.isAuthenticated = true;
this.client_reference = client_ref;
}
else {
this.isAuthenticated = false;
this.client_reference = null;
}
};
;
State.prototype.setVisitorId = function () {
this.user.visitorId = (0, utils_1.randomIdFromDate)(true);
};
;
State.prototype.setSessionId = function () {
this.user.sessionId = (0, utils_1.randomIdFromDate)();
};
;
State.prototype.setClientKey = function (clientKey) {
this.client_key = clientKey;
};
;
State.prototype.setRequestId = function (reqId) {
this.request_id = reqId;
};
;
State.prototype.setAutoClick = function (autoClick) {
this.enableAutoClick = autoClick;
};
;
State.prototype.setAutoPageLoad = function (autoPageLoad) {
this.sendPageLoad = autoPageLoad;
};
;
State.prototype.setUserState = function (userState) {
this.user = userState;
};
;
State.prototype.setConsoleLogEvents = function (consoleLogEvents) {
this.consoleLogEvents = consoleLogEvents;
};
;
State.prototype.setCaptureUrl = function (captureUrl) {
this.captureUrl = captureUrl;
};
;
State.prototype.setClientChannelMeta = function (clientChannelMeta) {
this.clientChannelMeta = clientChannelMeta;
};
;
State.prototype.setDataSource = function (dataSource) {
this.dataSource = dataSource;
};
;
State.prototype.setLogger = function (logger) {
this.logger = logger;
};
;
return State;
}());
exports.default = State;
//# sourceMappingURL=State.js.map