var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; /// <reference path="./AbstractEvent.ts" /> /// <reference path="./IProductEvent.ts" /> /// <reference path="../context/ProductReference.ts" /> /// <reference path="../context/IProductReferenceConfigOptions.ts" /> /// <reference path="../../serialization/ISerializable.ts" /> var econda; (function (econda) { var recengine; (function (recengine) { var event; (function (event) { var AbstractEvent = econda.recengine.event.AbstractEvent; var ProductReference = econda.recengine.context.ProductReference; /** * Event when visitor views a product on a product detail page. * @class econda.recengine.event.ProductViewEvent */ var ProductViewEvent = (function (_super) { __extends(ProductViewEvent, _super); function ProductViewEvent(cfg) { _super.call(this); /** * Reference to product viewed * @cfg {econda.recengine.context.ProductReference} * @accessor */ this._product = null; if (cfg instanceof ProductViewEvent) { return cfg; } this.initConfig(cfg); } ProductViewEvent.prototype.getProduct = function () { return this._product; }; ProductViewEvent.prototype.setProduct = function (productReference) { this._product = new ProductReference(productReference); }; ProductViewEvent.prototype.getObjectData = function () { return { className: 'econda.recengine.event.ProductViewEvent', data: { timestamp: this.getTimestamp(), product: this._product } }; }; ProductViewEvent.prototype.setObjectData = function (data) { if (typeof data === 'object' && data !== null) { this.setTimestamp(data.timestamp); this._product = data.product || null; } }; ProductViewEvent.TYPE = 'product:view'; return ProductViewEvent; }(AbstractEvent)); event.ProductViewEvent = ProductViewEvent; })(event = recengine.event || (recengine.event = {})); })(recengine = econda.recengine || (econda.recengine = {})); })(econda || (econda = {}));