CINXE.COM

<!DOCTYPE html> <html id="ng-app" ng-controller="GlobalController" eg-tb-global="" eg-custom-global="" role="application" lang="{{language}}"> <head> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title ng-bind="pageTitle"></title> <meta name="description" content="{{metaDescription}}" /> <meta name="keywords" content="{{metaKeywords}}" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> <meta id="egSSData" /> <link ng-attr-rel="{{::faviconRel}}" ng-attr-type="{{::faviconType}}" ng-href="{{::faviconUrl}}" /> <style> #jsMsg { height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; } @keyframes blink { 0% { opacity: .2; } 20% { opacity: 1; } 100% { opacity: .2; } } .loading_container span { font-size: 100px; font-family:'Arial Rounded MT Bold'; animation-name: blink; animation-duration: 1.4s; animation-iteration-count: infinite; animation-fill-mode: both; } .loading_container span:nth-child(2) { animation-delay: .2s; } .loading_container span:nth-child(3) { animation-delay: .4s; } </style> </head> <body class="eg-ss-body" linkclick="" block-ui="ApplicationBlockUI"> <div id="jsMsg"> Javascript is not enabled. Please enable Javascript to access this website. </div> <script>document.getElementById("jsMsg").outerHTML = "<div id='jsMsg'><p class='loading_container'><span>.</span><span>.</span><span>.</span></p></div>";</script> <script type="text/javascript"> /* * The eGainTemplateBaseUrlPath will be used to determine the base URL path of the template which is being launched. * By default it will be NULL if the templates are deployed at the default location in the eGain environment. * * But if the templates are deployed outside of the eGain environment * and the templates are being accessed through the long format URLs * For e.g., http://server.com/root/portal/silver/help/customer/locale/en-US/portal/201600000001000 * then provide the URL path of the template as follows: * For e.g., /root/portal/silver/ */ var eGainTemplateBaseUrlPath = null; /* * Do NOT modify any of the value/code below this comment. */ var egGlobal = (function () { var _egGlobal = {}; var DEFAULT_OPTIONS = { "loadTextAngular": true }; var _CUSTOM_NAME_REGEX = /^custom/i; var _ABSOLUTE_URL_REGEX = /^(?:[a-z]+:)?\/\//i; var _CONTEXT_ROOT_URL_REGEX = /^\/[^\/]+/; var _CACHE_PARAM_NAME = "cache"; var _loadInstant = null; var _baseVersion = null; var _isDebugOn = false; var _baseName = null; var _uniqueIdentifier = null; var _currentProductVersion = null; var _coreJson = null; var _customTemplateJson = null; var _coreTemplateJson = null; var _mergedTemplateJson = null; var _mode = null; var _tbMode = false; var _tbOverride = null; var _isBrandingEnabled = false; var _isCustomisationEnabled = false; var _urlParams = null; var _options = null; var _initialise = function () { _loadInstant = Date.now(); _uniqueIdentifier = _getUID(); _currentProductVersion = _loadInstant; _isBrandingEnabled = true; _isCustomisationEnabled = true; _options = _egGlobal.merge({}, DEFAULT_OPTIONS, arguments[0]); }; var _getUID = function () { var randomNumber = function () { return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); }; return (randomNumber() + randomNumber() + "-" + randomNumber() + "-" + randomNumber() + "-" + randomNumber() + "-" + randomNumber() + randomNumber() + randomNumber()); }; /** * The function was copied and modified from angularjs. * @param {type} dst target object * @param {type} objs source objects * @param {Boolean} deep true if deep merging is required else false * @returns {unresolved} target object */ var _baseExtend = function (dst, objs, deep) { if (_egGlobal.isObject(dst)) { for (var i = 0, objsLen = objs.length; i < objsLen; ++i) { var obj = objs[i]; if (!_egGlobal.isObject(obj)) { continue; } var keys = Object.keys(obj); for (var j = 0, keysLen = keys.length; j < keysLen; j++) { var key = keys[j]; var src = obj[key]; if (deep && _egGlobal.isObject(src)) { if (!_egGlobal.isObject(dst[key])) { dst[key] = {}; } _baseExtend(dst[key], [src], true); } else { dst[key] = src; } } } } return dst; }; _egGlobal.isCustomName = function (name) { return _CUSTOM_NAME_REGEX.test(name); }; _egGlobal.isAbsoluteUrl = function (url) { return _ABSOLUTE_URL_REGEX.test(url); }; _egGlobal.isContextRootUrl = function (url) { return _CONTEXT_ROOT_URL_REGEX.test(url); }; _egGlobal.isRelativeUrl = function (url) { return (!_egGlobal.isAbsoluteUrl(url) && !_egGlobal.isContextRootUrl(url)); }; _egGlobal.isObject = function (obj) { return obj && "[object Object]" === Object.prototype.toString.call(obj); }; _egGlobal.isEmptyObject = function (obj) { if (_egGlobal.isObject(obj)) { for (var prop in obj) { if (obj.hasOwnProperty(prop)) { return false; } } } return true; }; /** * Function to execute the iterator function for each of the object's own enumerable properties in order of their insertion * @param {type} obj * @param {type} iteratorFunction * @returns {undefined} */ _egGlobal.objectForEachInOrder = function (obj, iteratorFunction) { if (_egGlobal.isObject(obj) && "function" === typeof iteratorFunction) { var keysInOrder = null; try { keysInOrder = Object.keys(obj); } catch (e) { keysInOrder = null; } if (keysInOrder) { keysInOrder.forEach(function (key) { if (key) { iteratorFunction(obj[key], key); } }); } } }; _egGlobal.merge = function (dst) { return _baseExtend(dst, Array.prototype.slice.call(arguments, 1), true); }; _egGlobal.extend = function (dst) { return _baseExtend(dst, Array.prototype.slice.call(arguments, 1), false); }; _egGlobal.loadInstant = function () { return _loadInstant; }; _egGlobal.toLowerCase = function (input) { return (("string" === typeof input) ? input.toLowerCase() : ""); }; _egGlobal.loadTextAngular = function () { return _options.loadTextAngular; }; _egGlobal.uniqueIdentifier = function () { return _uniqueIdentifier; }; _egGlobal.isBrandingEnabled = function () { return _isBrandingEnabled; }; _egGlobal.isCustomisationEnabled = function () { return _isCustomisationEnabled; }; _egGlobal.urlParams = function (forceRecheck) { if (!_egGlobal.isObject(_urlParams) || true === forceRecheck) { _urlParams = {}; var search = location.search.substring(1); search.replace(/([^=&]+)=([^&]*)/g, function (m, key, value) { _urlParams[decodeURIComponent(key)] = decodeURIComponent(value); }); } return _urlParams; }; _egGlobal.getUrlParameter = function (name) { var ret = null; if (name && "string" === typeof name) { name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); var results = regex.exec(location.search); if (results && 2 <= results.length) { ret = decodeURIComponent(results[1].replace(/\+/g, " ")); } } return ret; }; _egGlobal.checkTbMode = function () { return _egGlobal.tbMode("true" === _egGlobal.getUrlParameter("eg_tb_mode")); }; _egGlobal.tbMode = function (tbMode) { if ("boolean" === typeof tbMode) { _tbMode = tbMode; } return _tbMode; }; _egGlobal.checkTbOverride = function () { var tbOverride = _egGlobal.getUrlParameter("eg_tb_override"); if (tbOverride) { try { tbOverride = JSON.parse(tbOverride); } catch (e) { } } return _egGlobal.tbOverride(tbOverride); }; _egGlobal.tbOverride = function (tbOverride) { if (_egGlobal.isObject(tbOverride)) { _tbOverride = tbOverride; } return _tbOverride; }; _egGlobal.getTbOverrideAttribute = function (entityType, entityName, entityAttributeName) { var tbOverride = _egGlobal.tbOverride(); var ret = (tbOverride && tbOverride[entityType] && tbOverride[entityType][entityName]) ? tbOverride[entityType][entityName][entityAttributeName] : null; return ret; }; _egGlobal.getTbOverrideResourcePath = function (entityType, entityName, resourceType) { var entityAttributeName = _egGlobal.toLowerCase(resourceType) + "Path"; var ret = _egGlobal.getTbOverrideAttribute(entityType, entityName, entityAttributeName); return ret; }; _egGlobal.checkMode = function () { var mode = (true === _egGlobal.isDebugOn()) ? _egGlobal.getUrlParameter("debug_mode") : null; return _egGlobal.mode(mode); }; _egGlobal.checkBaseVersion = function () { var baseVersion = (true === _egGlobal.isDebugOn()) ? _egGlobal.getUrlParameter("debug_base_version") : null; return _egGlobal.baseVersion(baseVersion); }; _egGlobal.checkBaseName = function () { var baseName = (true === _egGlobal.isDebugOn()) ? _egGlobal.getUrlParameter("debug_base_name") : null; return _egGlobal.baseName(baseName); }; _egGlobal.mode = function (mode) { _mode = _egGlobal.toLowerCase(mode); switch (_mode) { case "default": { _isBrandingEnabled = false; _isCustomisationEnabled = false; break; } case "brand": { _isBrandingEnabled = true; _isCustomisationEnabled = false; break; } case "custom": { _isBrandingEnabled = false; _isCustomisationEnabled = true; break; } case "all": default: { _mode = "all"; _isBrandingEnabled = true; _isCustomisationEnabled = true; break; } } return _mode; }; _egGlobal.isDebugOn = function (isDebugOn) { if ("boolean" === typeof isDebugOn) { _isDebugOn = isDebugOn; } return _isDebugOn; }; _egGlobal.baseVersion = function (version) { if (version && "string" === typeof version) { _baseVersion = version; } return _baseVersion; }; _egGlobal.baseName = function (name) { if (name && "string" === typeof name) { _baseName = name; } return _baseName; }; _egGlobal.currentProductVersion = function (version) { if (version && "string" === typeof version) { _currentProductVersion = version; } return _currentProductVersion; }; _egGlobal.addCacheParam = function (url, isCacheRequired) { var retUrl = url; if (url && "string" === typeof url) { var sep = (-1 >= url.indexOf("?")) ? "?" : "&"; var suffix = ""; var cacheValue = (false !== isCacheRequired) ? _egGlobal.currentProductVersion() + ((suffix = _egGlobal.entityAttribute("config", "preferences", "cacheSuffix")) ? "__" + suffix : "") : _egGlobal.loadInstant(); retUrl = url + sep + _CACHE_PARAM_NAME + "=" + cacheValue; } return retUrl; }; _egGlobal.coreJson = function (json) { if (_egGlobal.isObject(json)) { _coreJson = json; if (json.core) { _egGlobal.currentProductVersion(json.core.currentProductVersion); } } return _coreJson; }; _egGlobal.createPathInObject = function (obj, deepPath, createLastPathItem, lastPathItemCreateValue) { var ret = { "created": false, "reference": null }; if (_egGlobal.isObject(obj) && "string" === typeof deepPath) { var paths = deepPath.split("."); var ref = obj; for (var i = 0, len = paths.length; i < len; i++) { var path = paths[i]; /* * get the reference of the path if exists or create a new object * If createLastPathItem === true then for all path items including the last one * Else only for the non-last path items */ if (len > (i + 1)) { //non-last path item ref[path] = _egGlobal.isObject(ref[path]) ? ref[path] : {}; ref = ref[path]; } else if (len === (i + 1) && true === createLastPathItem) { //last path item ref[path] = ("undefined" !== typeof ref[path]) ? ref[path] : lastPathItemCreateValue; ref = ref[path]; } } ret.created = true; ret.reference = ref; } return ret; }; _egGlobal.getDeepRef = function (obj, deepPath) { var ret = null; if (_egGlobal.isObject(obj) && "string" === typeof deepPath) { var paths = deepPath.split("."); var ref = obj; for (var i = 0, len = paths.length; i < len; i++) { ref = ref[paths[i]]; if (_egGlobal.isObject(ref) || ("undefined" !== typeof ref && len === (i + 1))) { //continue going further deep if it is a valid object //or if it is the last path but NOT undefined then return the ref ret = ref; } else { ret = null; break; } } } return ret; }; _egGlobal.mergeRequiredAttributes = function (mergedObject, requiredObject) { if (_egGlobal.isObject(mergedObject) && _egGlobal.isObject(requiredObject)) { var path = "configs.allConfigs.app.eGainPortalApiPath"; var mergedReady = _egGlobal.createPathInObject(mergedObject, path); var requiredRef = _egGlobal.getDeepRef(requiredObject, path); if (mergedReady && true === mergedReady.created && null !== mergedReady.reference && requiredRef) { mergedReady.reference.eGainPortalApiPath = requiredRef; } } }; _egGlobal.mergeDefaultBrandCustom = function (mergedObject, defaultObject, brandObject, customObject) { mergedObject = _egGlobal.isObject(mergedObject) ? mergedObject : {}; _egGlobal.merge(mergedObject, defaultObject); if (_isBrandingEnabled) { _egGlobal.merge(mergedObject, brandObject); } if (_isCustomisationEnabled) { _egGlobal.merge(mergedObject, customObject); } return mergedObject; }; _egGlobal.checkAndMergeTemplateJson = function () { if (_egGlobal.isObject(_customTemplateJson) && _egGlobal.isObject(_coreTemplateJson)) { var mergedTemplateJson = { "template": {} }; _egGlobal.mergeDefaultBrandCustom( mergedTemplateJson.template, _coreTemplateJson.template, _customTemplateJson.brand, _customTemplateJson.custom ); if (!_isBrandingEnabled) { _egGlobal.mergeRequiredAttributes(mergedTemplateJson.template, _customTemplateJson.brand); } if (!_isCustomisationEnabled) { _egGlobal.mergeRequiredAttributes(mergedTemplateJson.template, _customTemplateJson.custom); } _egGlobal.mergedTemplateJson(mergedTemplateJson); } }; _egGlobal.customTemplateJson = function (json) { if (_egGlobal.isObject(json)) { _customTemplateJson = json; if (json.template && json.template.base) { _egGlobal.baseVersion(json.template.base.version); _egGlobal.baseName(json.template.base.name); _egGlobal.isDebugOn(json.template.debug); } _egGlobal.checkAndMergeTemplateJson(); } return _customTemplateJson; }; _egGlobal.coreTemplateJson = function (json) { if (_egGlobal.isObject(json)) { _coreTemplateJson = json; _egGlobal.checkAndMergeTemplateJson(); } return _coreTemplateJson; }; _egGlobal.mergedTemplateJson = function (json) { if (_egGlobal.isObject(json)) { _mergedTemplateJson = json; } return _mergedTemplateJson; }; _egGlobal.allEntity = function (entityType, createIfNotExist, fromCore) { var ret = null; var path = null; var templateJson = null; createIfNotExist = !!createIfNotExist; fromCore = !!fromCore; if (fromCore) { if (createIfNotExist) { _coreTemplateJson = _coreTemplateJson || {}; } templateJson = _coreTemplateJson; } else { if (createIfNotExist) { _mergedTemplateJson = _mergedTemplateJson || {}; } templateJson = _mergedTemplateJson; } if (templateJson) { var lcEntityType = _egGlobal.toLowerCase(entityType); switch (lcEntityType) { case "page": { path = "template.pages.allPages"; break; } case "component": { path = "template.components.allComponents"; break; } case "layout": { path = "template.layouts.allLayouts"; break; } case "route": { path = "template.routes.allRoutes"; break; } case "config": { path = "template.configs.allConfigs"; break; } case "css": { path = "template.css.allCss"; break; } case "l10n": { path = "template.l10ns.allL10ns"; break; } case "lib": { path = "template.libs.allLibs"; break; } case "media": { path = "template.media.allMedia"; break; } case "less": { path = "template.less.allLess"; break; } case "tb": { path = "template.tb.allTbs"; break; } } if (path) { if (createIfNotExist) { _egGlobal.createPathInObject(templateJson, path, true, {}); } ret = _egGlobal.getDeepRef(templateJson, path); } } return ret; }; _egGlobal.singleEntity = function (entityType, entityName, createIfNotExist, fromCore) { var ret = null; var all = null; if ("string" === typeof entityName && (all = _egGlobal.allEntity(entityType, createIfNotExist, fromCore))) { ret = all[entityName]; if (true === createIfNotExist && "undefined" === typeof ret) { ret = all[entityName] = {}; } } return ret; }; _egGlobal.entityAttribute = function (entityType, entityName, entityAttributeName, entityAttributeValue, fromCore) { var ret = null; var obj = null; var validValue = ("undefined" !== typeof entityAttributeValue); if ("string" === typeof entityAttributeName && (obj = _egGlobal.singleEntity(entityType, entityName, validValue, fromCore))) { if (validValue) { obj[entityAttributeName] = entityAttributeValue; } ret = obj[entityAttributeName]; } return ret; }; _egGlobal.resourcePath = function (entityType, entityName, resourceType, resourceValue, fromCore) { var entityAttributeName = _egGlobal.toLowerCase(resourceType) + "Path"; var ret = _egGlobal.entityAttribute( entityType, entityName, entityAttributeName, resourceValue, fromCore); return ret; }; _egGlobal.clean = function () { _loadInstant = null; _baseVersion = null; _isDebugOn = false; _baseName = null; _uniqueIdentifier = null; _currentProductVersion = null; _coreJson = null; _customTemplateJson = null; _coreTemplateJson = null; _mergedTemplateJson = null; _mode = null; _isBrandingEnabled = false; _isCustomisationEnabled = false; _urlParams = null; _options = null; _initialise(); }; _egGlobal.clean(); return _egGlobal; })(); (function (templateJsonFileName, templateBaseUrlPath, templateDefaultValues) { /* * Global object used for holding scripts and css URLs. Path provided should be relative to template path */ var scriptObject = { css: [], scripts: [] }; /* * Following logic is added to support the change of the templateBaseUrlPath through Themebuilder * for Preview in Portal or if the user has provided a specific value, portal defaults to launch the template * in "preview in portal" and change of the CSS file name with themebuilder version number included in the file name */ var updateThemeBuilderVersion = function (themebuilderVersion) { if (themebuilderVersion && scriptObject && scriptObject.css && 0 < scriptObject.css.length) { scriptObject.css.forEach(function (item, index, arr) { item = "" + item; if (0 === item.indexOf("css/application-")) { var dotIndex = item.lastIndexOf("."); var newItem = (0 <= dotIndex) ? item.slice(0, dotIndex) + themebuilderVersion + item.slice(dotIndex) : item; arr[index] = newItem; } }); } }; var makeRequest = function (url, callback, errorCallback) { var xhttp = new XMLHttpRequest(); if (typeof callback === "function") { xhttp.onreadystatechange = function () { if (this.readyState === 4 && this.status === 200) { callback(this.responseText); } else if (this.readyState === 4) { errorCallback(this.responseText); } }; } xhttp.open("GET", url, true); xhttp.send(); }; /** * Function to include scripts and css * @returns {undefined} */ var includeScriptsAndCss = function () { if (scriptObject && scriptObject.css) { egGlobal.objectForEachInOrder(egGlobal.allEntity("css"), function (value, key) { var overriddenPath = egGlobal.getTbOverrideResourcePath("css", key, "css"); var path = (overriddenPath) ? overriddenPath : egGlobal.resourcePath("css", key, "css"); if (path) { scriptObject.css.push(path); } }); } if (scriptObject && scriptObject.scripts) { var customScripts = []; var appBootstrap = null; egGlobal.objectForEachInOrder(egGlobal.allEntity("lib"), function (value, key) { var overriddenPath = egGlobal.getTbOverrideResourcePath("lib", key, "js"); var path = (overriddenPath) ? overriddenPath : egGlobal.resourcePath("lib", key, "js"); if (path) { if (egGlobal.isCustomName(key)) { customScripts.push(path); } else if ("application-bootstrap" === key) { appBootstrap = path; } else { scriptObject.scripts.push(path); } } }); egGlobal.objectForEachInOrder(egGlobal.allEntity("component"), function (value, key) { var path = egGlobal.resourcePath("component", key, "controller"); if (path) { scriptObject.scripts.push(path); } }); egGlobal.objectForEachInOrder(egGlobal.allEntity("page"), function (value, key) { var path = egGlobal.resourcePath("page", key, "controller"); if (path) { scriptObject.scripts.push(path); } }); scriptObject.scripts = scriptObject.scripts.concat(customScripts); if (appBootstrap) { scriptObject.scripts.push(appBootstrap); } } }; var getParamsForTbMode = function () { egGlobal.checkTbMode(); if (true === egGlobal.tbMode()) { var baseUrl = egGlobal.getUrlParameter("eg_tb_base_url"); if (baseUrl) { templateBaseUrlPath = baseUrl; } templateDefaultValues = templateDefaultValues || {}; var portalId = egGlobal.getUrlParameter("eg_tb_portal_id"); if (portalId) { templateDefaultValues.defaultPortalId = portalId; } var locale = egGlobal.getUrlParameter("eg_tb_default_locale"); if (locale) { templateDefaultValues.defaultLocale = locale; } var portalType = egGlobal.getUrlParameter("eg_tb_portal_type"); if (portalType) { templateDefaultValues.defaultUserType = portalType; } egGlobal.checkTbOverride(); } }; getParamsForTbMode(); var egSSData = document.getElementById("egSSData"); if (egSSData) { if (egSSData.getAttribute("data-eg-base-href") && !templateBaseUrlPath) { templateBaseUrlPath = egSSData.getAttribute("data-eg-base-href"); } templateDefaultValues = templateDefaultValues || {}; if (egSSData.getAttribute("data-eg-portal-id") && !templateDefaultValues.defaultPortalId) { templateDefaultValues.defaultPortalId = egSSData.getAttribute("data-eg-portal-id"); } if (egSSData.getAttribute("data-eg-default-locale") && !templateDefaultValues.defaultLocale) { templateDefaultValues.defaultLocale = egSSData.getAttribute("data-eg-default-locale"); } if (egSSData.getAttribute("data-eg-portal-type") && !templateDefaultValues.defaultUserType) { templateDefaultValues.defaultUserType = egSSData.getAttribute("data-eg-portal-type"); } updateThemeBuilderVersion(egSSData.getAttribute("data-eg-themebuilder-version")); } var eGSSPortalParam = {}; var pathNames = []; var pathNamesLC = []; var isShortUrl = false; var isShortUrlError = false; var isError = false; var cacheStaticFiles = true; function addScript(src) { if (src && src.split("?")[0] !== "undefined") { var scriptTag = document.createElement("script"); var url = egGlobal.isRelativeUrl(src) ? eGSSPortalParam.templatePath + src : src; scriptTag.src = egGlobal.addCacheParam(url, cacheStaticFiles); scriptTag.type = "text/javascript"; scriptTag.async = false; document.head.appendChild(scriptTag); } } function addCss(href) { if (href) { var cssTag = document.createElement("link"); var url = egGlobal.isRelativeUrl(href) ? eGSSPortalParam.templatePath + href : href; cssTag.setAttribute("href", egGlobal.addCacheParam(url, cacheStaticFiles)); cssTag.setAttribute("rel", "stylesheet"); cssTag.setAttribute("type", "text/css"); document.head.appendChild(cssTag); } } function getCookie(cname) { var name = cname + "="; var ca = document.cookie.split(";"); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) === " ") { c = c.substring(1); } if (c.indexOf(name) === 0) { return c.substring(name.length, c.length); } } return ""; } var logError = function (msg) { var msgElement = document.getElementById("jsMsg"); msgElement.innerHTML = "Sorry, you've visited an invalid URL!!!"; console.log(msg); }; var removeErrorElement = function () { var body = document.getElementsByTagName("body"); if (body && body[0]) { body = body[0]; var msgElement = document.getElementById("jsMsg"); body.removeChild(msgElement); } }; var sessionStore = function (name, value, remove) { var retValue = false; if (name) { if (typeof value !== "undefined" && null !== value) { var stringValue = JSON.stringify(value); sessionStorage.setItem(name, stringValue); retValue = true; } else if (true === remove) { sessionStorage.removeItem(name); retValue = true; } else { retValue = sessionStorage.getItem(name); retValue = (retValue) ? JSON.parse(retValue) : retValue; } } return retValue; }; var checkURLChangesAndClearSessionStorage = function () { if (!window.sessionStorage.getItem("session-sessionToken")) { var eGSSPortalParamFromStorage = sessionStore("eGSSPortalParam"); if (eGSSPortalParamFromStorage) { if (eGSSPortalParamFromStorage.portalType !== eGSSPortalParam.portalType) { //clear cookies except apiPath clearCookies(eGSSPortalParamFromStorage.baseUrl.substring(0, eGSSPortalParamFromStorage.baseUrl.length - 1), ["all"], ["apiPath"]); // Clear everything from sessionStorage sessionStorage.clear(); } else if (eGSSPortalParamFromStorage.templateName !== eGSSPortalParam.templateName || eGSSPortalParamFromStorage.portalId !== eGSSPortalParam.portalId || eGSSPortalParamFromStorage.currentLocale !== eGSSPortalParam.currentLocale) { var xEgainSession = sessionStorage.getItem("X-egain-session"); //collect cookies with agent profile var cookiesNotToClear = ["apiPath"].concat(document.cookie.split(";").filter(function (c) { return c.trim().indexOf("selectedProfile-") === 0; }).map(function (c) { return c.split("=")[0].trim(); })); //clear cookies except apiPath and agent profile if (eGSSPortalParamFromStorage.baseUrl) { clearCookies(eGSSPortalParamFromStorage.baseUrl.substring(0, eGSSPortalParamFromStorage.baseUrl.length - 1), ["all"], cookiesNotToClear); } // Clear everything from sessionStorage sessionStorage.clear(); // add X-egain-session back to session Storage sessionStorage.setItem("X-egain-session", xEgainSession); } } } }; var clearCookies = function (path, cookiesToClear, cookiesNotToClear) { if (path !== undefined) { var cookies = document.cookie.split("; "); for (var i = 0; i < cookies.length; i++) { var cookie = cookies[i]; var eqPos = cookie.indexOf("="); var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; if (cookiesToClear.length > 0 && cookiesToClear[0] === "all" && cookiesNotToClear && cookiesNotToClear.indexOf(name) > -1) { //do nothing, we dont need to clear this cookie } else if (cookiesToClear.length > 0 && cookiesToClear[0] !== "all" && cookiesToClear.indexOf(name) > -1) { document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=" + path; } else { document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=" + path; } } } }; var pathParts = location.pathname.split("/"); pathParts.forEach(function (value) { if (value) { pathNames.push(value); pathNamesLC.push(value.toLowerCase()); } }); /* Function to share sessionStorage data across multiple tabs */ var previousTabData; var shareSessionStorageData = function (event) { if (!event) { event = window.event; } if (!event.newValue) { return; } if (event.key === "getSessionStorage") { // Some tab asked for the sessionStorage -> send it localStorage.setItem("sessionStorage", JSON.stringify(sessionStorage)); localStorage.removeItem("sessionStorage"); } else if (event.key === "sessionStorage") { previousTabData = JSON.parse(event.newValue); } }; var addCssScripts = function () { cacheStaticFiles = egGlobal.entityAttribute("config", "app", "cacheStaticFiles"); if (scriptObject && scriptObject.css) { for (var i = 0, cssLen = scriptObject.css.length; i < cssLen; i++) { addCss(scriptObject.css[i]); } } if (scriptObject && scriptObject.scripts) { for (var j = 0, scrLen = scriptObject.scripts.length; j < scrLen; j++) { addScript(scriptObject.scripts[j]); } } }; var copyPreviousTabData = function() { if (previousTabData && previousTabData.eGSSPortalParam) { var data = JSON.parse(previousTabData.eGSSPortalParam); previousTabData.eGSSIsShortUrl = JSON.parse(previousTabData.eGSSIsShortUrl); if (data.templateName === eGSSPortalParam.templateName && data.portalType === eGSSPortalParam.portalType && data.currentLocale === eGSSPortalParam.currentLocale && data.portalId === eGSSPortalParam.portalId && previousTabData.eGSSIsShortUrl === isShortUrl) { for (var key in previousTabData) { var copyDataFromOtherTab = (false === isShortUrlError || (true === isShortUrlError && "eGSSPortalParam" !== key && "eGSSIsShortUrl" !== key && "eGSSIsShortUrlError" !== key)); if (true === copyDataFromOtherTab) { if ("eGSSPortalParam" === key) { var portalParams = JSON.parse(previousTabData[key]); if (!portalParams.baseUrl) { portalParams.baseUrl = eGSSPortalParam.baseUrl; previousTabData[key] = JSON.stringify(portalParams); } } sessionStorage.setItem(key, previousTabData[key]); } else { switch (key) { case "eGSSPortalParam": sessionStore("eGSSPortalParam", eGSSPortalParam); break; case "eGSSIsShortUrl": sessionStore("eGSSIsShortUrl", isShortUrl); break; } } } } else { sessionStore("eGSSIsShortUrl", isShortUrl); sessionStore("eGSSPortalParam", eGSSPortalParam); } } else { sessionStore("eGSSIsShortUrl", isShortUrl); sessionStore("eGSSPortalParam", eGSSPortalParam); } addCssScripts(); removeErrorElement(); }; var setEgSSTabOpen = function() { window.localStorage.setItem('egSSTabOpen', Date.now()); setTimeout(setEgSSTabOpen, 5000); }; var isNewTab = function() { return window.localStorage.getItem('egSSTabOpen') && (parseFloat(window.localStorage.getItem('egSSTabOpen')) > (Date.now() - 8000)); }; var checkAndLaunchTemplate = function () { if (isNewTab() && !window.sessionStorage.getItem("session-sessionToken")) { setTimeout(function () { copyPreviousTabData(); }, 1000); } else { if (window.sessionStorage.getItem("session-sessionToken")) { sessionStore("eGSSIsShortUrl", isShortUrl); sessionStore("eGSSPortalParam" + egGlobal.uniqueIdentifier(), eGSSPortalParam); } else { setEgSSTabOpen(); sessionStore("eGSSIsShortUrl", isShortUrl); sessionStore("eGSSPortalParam", eGSSPortalParam); } addCssScripts(); removeErrorElement(); } }; if (window.addEventListener) { window.addEventListener("storage", shareSessionStorageData, false); } else { window.attachEvent("onstorage", shareSessionStorageData); } localStorage.setItem("getSessionStorage", egGlobal.loadInstant()); isShortUrl = sessionStore("eGSSIsShortUrl"); isShortUrl = ("boolean" === typeof isShortUrl) ? isShortUrl : false; isShortUrlError = sessionStore("eGSSIsShortUrlError"); isShortUrlError = ("boolean" === typeof isShortUrlError) ? isShortUrlError : false; eGSSPortalParam = (true === isShortUrl) ? sessionStore("eGSSPortalParam") : eGSSPortalParam; if (true === isShortUrl && 2 <= pathNames.length && eGSSPortalParam && eGSSPortalParam.urlContextRoot && eGSSPortalParam.urlContextRoot === pathNames[0] && eGSSPortalParam.routeUniqueId && eGSSPortalParam.routeUniqueId === pathNames[1] && eGSSPortalParam.templateName && eGSSPortalParam.portalId && eGSSPortalParam.portalType && eGSSPortalParam.currentLocale && eGSSPortalParam.templatePath ) { eGSSPortalParam.baseUrl = "/" + pathNames[0] + "/" + pathNames[1] + "/"; } else { isShortUrl = false; eGSSPortalParam = {}; eGSSPortalParam.urlContextRoot = (pathNames[0]) ? pathNames[0] : ""; var urlContextRootPath = (eGSSPortalParam.urlContextRoot) ? "/" + eGSSPortalParam.urlContextRoot : ""; /*eGSSPortalParam.initial = { "url": location.pathname, "pathNames": pathNames };*/ /* * If the template is launched with long URL format at default location in eGain server. * For e.g., http://egain.com/system/templates/selfservice/silver/help/customer/locale/en-US/portal/201600000001000 */ if (10 <= pathNames.length && "templates" === pathNamesLC[1] && "selfservice" === pathNamesLC[2] && "help" === pathNamesLC[4] && "locale" === pathNamesLC[6] && "portal" === pathNamesLC[8] ) { eGSSPortalParam.contextRoot = pathNames[0]; eGSSPortalParam.templateName = pathNames[3]; eGSSPortalParam.portalType = pathNames[5]; eGSSPortalParam.currentLocale = pathNames[7]; eGSSPortalParam.portalId = pathNames[9]; eGSSPortalParam.baseUrl = urlContextRootPath + "/" + pathNames[1] + "/" + pathNames[2] + "/" + pathNames[3] + "/"; eGSSPortalParam.templatePath = eGSSPortalParam.baseUrl; } /* * If the template is launched with long URL format outside of eGain server. * Then value of templateBaseUrlPath must have been set and the URL must have atleast six params * For e.g., http://server.com/root/portal/silver/help/customer/locale/en-US/portal/201600000001000 */ else if (templateBaseUrlPath && 0 === location.pathname.indexOf(templateBaseUrlPath)) { var urlPathForRoutePathNames = []; var urlPathForRoutePathNamesLC = []; var urlPathForRoute = location.pathname.replace(templateBaseUrlPath, ""); var urlPathForRoutePathParts = urlPathForRoute.split("/"); urlPathForRoutePathParts.forEach(function (value) { if (value) { urlPathForRoutePathNames.push(value); urlPathForRoutePathNamesLC.push(value.toLowerCase()); } }); if (urlPathForRoutePathNames && 6 <= urlPathForRoutePathNames.length && "help" === urlPathForRoutePathNamesLC[0] && "locale" === urlPathForRoutePathNamesLC[2] && "portal" === urlPathForRoutePathNamesLC[4] ) { /* * The context root of the eGain application CANNOT be determined. * But assuming that the template name is the last name in the templateBaseUrlPath */ var templateNameIndex = (pathNames.length - urlPathForRoutePathNames.length) - 1; eGSSPortalParam.templateName = (0 <= templateNameIndex) ? pathNames[templateNameIndex] : null; eGSSPortalParam.portalType = urlPathForRoutePathNames[1]; eGSSPortalParam.currentLocale = urlPathForRoutePathNames[3]; eGSSPortalParam.portalId = urlPathForRoutePathNames[5]; eGSSPortalParam.baseUrl = templateBaseUrlPath; eGSSPortalParam.templatePath = eGSSPortalParam.baseUrl; } /* * NON-PROD SECTION * * The templateDefaultValues will be used to determine the default values for the required parameters. * For e.g., portal Id, locale and portal type * Ideally in production templates this block should NEVER be executed * This block is meant for launching the template during development or debugging purposes. * And it is also being used for launching the template through themebuilder in "preview in portal" */ else if (templateDefaultValues && templateDefaultValues.defaultPortalId && templateDefaultValues.defaultUserType && templateDefaultValues.defaultLocale ) { /* * The context root of the eGain application CANNOT be determined. * But assuming that the template name is the last name in the templateBaseUrlPath */ var templateNameIndex = (pathNames.length - urlPathForRoutePathNames.length) - 1; eGSSPortalParam.templateName = (0 <= templateNameIndex) ? pathNames[templateNameIndex] : null; eGSSPortalParam.portalType = templateDefaultValues.defaultUserType; eGSSPortalParam.currentLocale = templateDefaultValues.defaultLocale; eGSSPortalParam.portalId = templateDefaultValues.defaultPortalId; eGSSPortalParam.baseUrl = templateBaseUrlPath; eGSSPortalParam.templatePath = eGSSPortalParam.baseUrl; eGSSPortalParam._dev_only_mode = true; } else { isError = true; logError("You have visited an incomplete URL!!!"); } } else { isError = true; logError("You have visited an invalid URL!!!"); } } if (false === isError) { checkURLChangesAndClearSessionStorage(); var coreJsonFilePath = egGlobal.addCacheParam(eGSSPortalParam.templatePath + "../core/common/core.json", false); makeRequest(coreJsonFilePath, function (response) { try { egGlobal.coreJson(JSON.parse(response)); } catch (e) { // DO NOTHING } }, function (response) { //TODO: ideally we should not proceed ahead console.error("Could not load the core.json"); console.error(response); } ); /* * Even when the template is loaded in the TB mode, the custom template.json should be loaded as is. * Since there may be custom entries in the template.json that should be loaded as is * when the template is launched in TB-app. */ var customTemplateJsonFileName = templateJsonFileName; var templateJsonFilePath = egGlobal.addCacheParam(eGSSPortalParam.templatePath + customTemplateJsonFileName, false); makeRequest(templateJsonFilePath, function (customResponse) { var customTemplateJson = JSON.parse(customResponse); egGlobal.customTemplateJson(customTemplateJson); egGlobal.checkMode(); egGlobal.checkBaseVersion(); egGlobal.checkBaseName(); var baseVersion = egGlobal.baseVersion(); var templateName = egGlobal.baseName(); if (baseVersion && templateName) { /* * When the template is loaded in the TB mode, the template-tb.json should be loaded * instead of template.json. * Since we want to load TB specific files when the template is launched in TB-app. */ var coreTemplateJsonFileName = (true === egGlobal.tbMode()) ? "template-tb.json" : templateJsonFileName; var coreTemplateJsonFilePath = egGlobal.addCacheParam( eGSSPortalParam.templatePath + "../core/" + templateName + "/root/" + baseVersion + "/" + coreTemplateJsonFileName , false); makeRequest(coreTemplateJsonFilePath, function (response) { var coreTemplateJson = JSON.parse(response); egGlobal.coreTemplateJson(coreTemplateJson); var portalAPIPath = egGlobal.getTbOverrideAttribute("config", "app", "eGainPortalApiPath"); if(portalAPIPath) { egGlobal.entityAttribute("config", "app", "eGainPortalApiPath", portalAPIPath); } includeScriptsAndCss(); checkAndLaunchTemplate(); }, function (errorResponse) { console.error("Could not load the template json from core"); console.error(errorResponse); } ); } }, function (errorResponse) { console.error("Could not load the template json from template"); console.error(errorResponse); } ); } })("template.json", eGainTemplateBaseUrlPath); </script> <!-- CONTAINER FOR TOASTER ALERTS --> <toaster-container aria-atomic="true" aria-live="assertive" toaster-options="{'timeout': 3000, 'close-button': true}"></toaster-container> <!-- MAIN VIEW WHERE ALL CONTENT IS INJECTED --> <div id="eg-ss-view" class="eg-view" ng-view=""></div> <div id="eg-ss-tb-global-end" class="eg-tb-global-end" eg-tb-global-end="" eg-custom-global-end=""></div> </body> </html>