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="AjaxProxy.ts" /> var econda; (function (econda) { var recengine; (function (recengine) { var proxy; (function (proxy) { var AjaxProxy = econda.recengine.proxy.AjaxProxy; /** * AdProxy class. Used to request recommendations for offsite banners. We use 3rd party cookies and so we have to use a special uri * with the same host we use in tracking. * * @class econda.recengine.proxy.AdProxy * @extends econda.recengine.proxy.AjaxProxy */ var AdProxy = (function (_super) { __extends(AdProxy, _super); function AdProxy() { _super.apply(this, arguments); } /** * Returns the client id parsed from cross sell account id. * @private * @returns {String} econda client id */ AdProxy.prototype._getClientId = function () { var r = this.getRequest(); var accountId = r.getAccountId(); if (accountId == null || accountId.length < 10) { econda.debug.error("Invalid account id in cross sell request: " + accountId); return null; } else { return accountId.substr(0, 8); } }; /** * Returns full request uri including account specific parts. * @private * @returns {String} uri */ AdProxy.prototype._getRequestUri = function () { var r = this.getRequest(); var accountId = r.getAccountId(); var protocol = AjaxProxy.detectProtocol(); var clientId = this._getClientId(); var uri = protocol + '://cross.econda-monitor.de/l/' + clientId + '/' + accountId + '.do'; return uri; }; /** * Detects if cookies are required for current request. Overwrites AjaxProxy check, cookies are always required * for ad requests. * @returns {Boolean} * @private */ AdProxy.prototype._isCookieRequired = function () { return true; }; /** * @inheritdoc */ AdProxy.prototype.send = function () { if (this.getUri() == null) { var uri = this._getRequestUri(); this.setUri(uri); } _super.prototype.send.call(this); }; return AdProxy; }(AjaxProxy)); proxy.AdProxy = AdProxy; })(proxy = recengine.proxy || (recengine.proxy = {})); })(recengine = econda.recengine || (econda.recengine = {})); })(econda || (econda = {}));