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="../../util/BaseContext.ts"/> /// <reference path="../../data.ts" /> /// <reference path="../../debug.ts" /> /// <reference path="IContextConfigOptions.ts" /> var econda; (function (econda) { var profileaccess; (function (profileaccess) { var context; (function (context) { /** * Request context, e.g. the product we want to get recommendations for. * @class econda.recengine.context.Context * @extends econda.base.BaseClass * */ var Context = (function (_super) { __extends(Context, _super); function Context(cfg) { _super.call(this); /** * True to auto append visitor data from current visitor profile * @cfg {Boolean} appendVisitorData */ this._appendVisitorData = null; var cfg = cfg || {}; if (cfg instanceof Context) { return cfg; } else { if (typeof cfg['appendVisitorData'] != 'undefined') { this._appendVisitorData = cfg['appendVisitorData'] === true; delete cfg['appendVisitorData']; } this.initConfig(cfg); } if (this._appendVisitorData === true) { this._doAppendVisitorData(); } } Context.prototype._doAppendVisitorData = function () { try { var visitorProfile = econda.data.visitor; this.setVisitorId(visitorProfile.getVisitorId()); this.setCustomerId(visitorProfile.getCustomerId()); this.setUserId(visitorProfile.getUserId()); this.setRecipientId(visitorProfile.getRecipientId()); this.setEmail(visitorProfile.getEmail()); this.setEmailHash(visitorProfile.getEmailHash()); this.setProfileProperties(visitorProfile.getProperties()); } catch (e) { econda.debug.error('Could not append visitor profile data to cross sell request due to an internal exception: ' + e); } }; return Context; }(econda.base.BaseContext)); context.Context = Context; // end of class })(context = profileaccess.context || (profileaccess.context = {})); })(profileaccess = econda.profileaccess || (econda.profileaccess = {})); })(econda || (econda = {})); // end of module