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="AbstractFieldDecorator.ts" /> /// <reference path="../../util/UriUtils.ts" /> var econda; (function (econda) { var recengine; (function (recengine) { var decorator; (function (decorator) { var UriUtils = econda.util.UriUtils; /** * Adds uri parameters to deeplink (default) field for econda performance tracking. * @class econda.recengine.decorator.PeformanceTracking */ var PerformanceTracking = (function (_super) { __extends(PerformanceTracking, _super); function PerformanceTracking(cfg) { if (cfg === void 0) { cfg = null; } _super.call(this); this.fields = ['deeplink']; /** * Widget name * @cfg {String} widgetName * @accessor */ this.widgetName = null; /** * Source product id as to be displayed in reports * @cfg {String} source * @accessor */ this.source = null; /** * Name for widget position, e.g. "Home/Main Widget", "Product Details/Cross Selling" * @cfg {String} position * @accessor */ this.position = null; if (cfg instanceof PerformanceTracking) { return cfg; } this.initConfig(cfg); } PerformanceTracking.prototype.getWidgetName = function () { return this.widgetName; }; PerformanceTracking.prototype.setWidgetName = function (name) { this.widgetName = name; return this; }; PerformanceTracking.prototype.getSource = function () { return this.source; }; PerformanceTracking.prototype.setSource = function (name) { this.source = name; return this; }; PerformanceTracking.prototype.getPosition = function () { return this.position; }; PerformanceTracking.prototype.setPosition = function (name) { this.position = name; return this; }; PerformanceTracking.prototype._getTrackingParams = function (product) { var cmp = this; var w = this.getRequest(); var widgetName = this.getWidgetName() || w.getWidgetId(); return { emcs0: widgetName, emcs1: cmp.getPosition(), emcs2: cmp.getSource(), emcs3: product.id }; }; /** * Add 'trackingparameters' field to product * @protected */ PerformanceTracking.prototype.decorateProduct = function (product) { product.trackingparameters = UriUtils.concatParams(this._getTrackingParams(product)); }; /** * Decorates a single uri field. * @protected */ PerformanceTracking.prototype.decorateField = function (value, product, fieldName) { var uriWithParams = UriUtils.appendParams(value, this._getTrackingParams(product)); return uriWithParams; }; return PerformanceTracking; }(decorator.AbstractFieldDecorator)); decorator.PerformanceTracking = PerformanceTracking; // end of class })(decorator = recengine.decorator || (recengine.decorator = {})); })(recengine = econda.recengine || (econda.recengine = {})); })(econda || (econda = {})); // end of module