'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Business Analytics (C) Copyright IBM Corp. 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../../../features/dashboard/userProfile/UserProfileAPI'], function (APIFactory, UserProfileAPI) { /** * @class * @implements UserProfileAPI * @hideconstructor * @classdesc default implementation of the UserProfileAPI */ var CAUserProfile = function () { function CAUserProfile() { _classCallCheck(this, CAUserProfile); this._api = APIFactory.createAPI(this, [UserProfileAPI]); } CAUserProfile.prototype.getAPI = function getAPI() { return this._api; }; /** * Glass initialize method for services * @param {Object} glassContext */ CAUserProfile.prototype.initialize = function initialize(glassContext) { var _this = this; this._userProfile = glassContext.getCoreSvc('.UserProfile'); this._config = glassContext.getCoreSvc('.Config'); return this._config.getConfigValue('ClientValidDomainList').then(function (list) { _this._validDomainList = list; }); }; /** * * @param {string} capabilityName * @returns {boolean} true/false based on CM capabilities */ CAUserProfile.prototype.hasCapability = function hasCapability(capabilityName) { return this._userProfile.capabilities.indexOf(capabilityName) != -1; }; CAUserProfile.prototype.getValidDomainList = function getValidDomainList() { return this._validDomainList; }; /** * @returns {string} user content locale. Defaults to 'en' */ CAUserProfile.prototype.getContentLocale = function getContentLocale() { var userPreferences = this._userProfile && this._userProfile.preferences; return userPreferences && userPreferences.contentLocale || 'en'; }; CAUserProfile.prototype.getAvailableContentLocales = function getAvailableContentLocales() { return this._config.getContentLocales(); }; CAUserProfile.prototype.getUserAccount = function getUserAccount() { var userAccount = this._userProfile.userAccount; return { defaultName: userAccount && userAccount.defaultName, userName: userAccount && userAccount.userName, id: userAccount && userAccount.id, email: userAccount && userAccount.email }; }; return CAUserProfile; }(); return CAUserProfile; }); //# sourceMappingURL=CAUserProfile.js.map