UNPKG

clean-insights-sdk

Version:

A privacy-preserving measurement framework.

61 lines (60 loc) 2.73 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.Visit = void 0; var DataPoint_1 = require("./DataPoint"); var Visit = /** @class */ (function (_super) { __extends(Visit, _super); /** * @param {string[]|VisitData} scenePath * A hierarchical path to the scene visited or an object containing all arguments. * * @param {string=} campaignId * The campaign ID this data point is for. OPTIONAL if provided via an object as first argument. * * @param {number=} times=1 * Number of times this data point has arisen between `first` and `last`. OPTIONAL. * * @param {dayjs.Dayjs=} first=NOW * The first time this data point has arisen. OPTIONAL. * * @param {dayjs.Dayjs=} last=NOW * The last time this data point has arisen. OPTIONAL. */ function Visit(scenePath, campaignId, times, first, last) { var _this = this; if (Array.isArray(scenePath)) { if (typeof campaignId === 'string') { _this = _super.call(this, campaignId, times, first, last) || this; _this.scenePath = scenePath; } else { throw TypeError('You either need to provide all non-optional arguments in their place or in an object as the first argument.'); } } else { _this = _super.call(this, scenePath.campaignId, scenePath.times, scenePath.first, scenePath.last) || this; _this.scenePath = scenePath.scenePath; } return _this; } Visit.prototype.toString = function () { return "[".concat(this.constructor.name, ": scenePath=").concat(this.scenePath, ", campaignId=").concat(this.campaignId, ", times=").concat(this.times, ", first=").concat(this.first.format(), ", last=").concat(this.last.format(), "]"); }; return Visit; }(DataPoint_1.DataPoint)); exports.Visit = Visit;