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AC,QAAQ;wBACrB,IAAI,EAAE,EAAE,CAAC,IAAI;wBACb,IAAI,EAAE,EAAE,CAAC,IAAI;wBACb,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE;qBACnC,CAAC;oBACF,GAAG,CAAC,SAAS,CAAC,IAAI,GAAG,OAAO,CAAC;oBAC7B,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;iBACvB;gBAED,sCAAsC;gBACtC,qDAAqD;gBACrD,aAAa;gBAGb,sBAAsB;gBACtB,4EAA4E;gBAC5E,OAAO,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;aAC7C;YAAC,OAAO,GAAG,EAAE;gBACb,OAAO,CAAC,GAAG,CAAC,6BAA6B,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;gBACvD,MAAM,GAAG,CAAC;aACV;QACF,CAAC;QAEM,WAAW,CAAC,EAAU;YAC5B,IAAI,GAAG,GAAG,IAAI,CAAC;YAEf,IAAI,CAAC,EAAE;gBAAE,OAAO,IAAI,CAAC;YAErB,IAAI,QAAQ,GAAG,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YAEjC,IAAI,QAAQ,IAAI,SAAS,IAAI,QAAQ,IAAI,IAAI;gBAC5C,OAAO,IAAI,CAAC;YACb,OAAO,QAAQ,CAAC;QACjB,CAAC;KACD;IAED,qBAAqB;IACV,SAAG,GAAG,IAAI,MAAM,EAAE,CAAC;AAC/B,CAAC,EAnbS,KAAK,KAAL,KAAK,QAmbd","file":"web.js","sourcesContent":["/****************************************************************************\r\nCopyright (c) 2018 One10, LLC\r\n\r\nUnauthorized use or copying of this file, via any medium, is strictly prohibited.\r\nProprietary and confidential.\r\nAll Rights Reserved.\r\n****************************************************************************/\r\n\r\n// Note: This file must be in a separate folder than the rest of the application and the folder must have a special tsconfig.json.\r\n// The following \"triple slash\" directives are required.\r\n\r\n/// \r\n/// \r\n/// \r\n/// \r\n\r\nnamespace CpWeb {\r\n\r\n\tinterface InitializeOptions {\r\n\t\tLauncherPath?: string;\r\n\t\tLauncherName?: string;\r\n\t\tAppGlobalReference?: string;\r\n\t\tStartPath?: string;\r\n\t\tStartName?: string;\r\n\t\tStartModel?: any;\r\n\t\tStartGlobalReference?: string;\r\n\t\tConfig?: Config;\r\n\t}\r\n\r\n\tinterface LoadOptions {\r\n\t\tPath: string;\r\n\t\tName: string;\r\n\t\tModel?: any;\r\n\t\tGlobalReference?: string;\r\n\t}\r\n\r\n\t/**\r\n\t * Web component information.\r\n\t * NOTE: This is a separate copy from the one in 'cp/appShared'. It cannot be imported into a non-module TS file.\r\n\t * If the classes are moved to a definition file, then they could be imported.\r\n\t */\r\n\tclass ComponentInfo {\r\n\t\t/** Component wrapper module from the loader. */\r\n\t\tComponent: KeyValueCollection>;\r\n\t\t/** Component name. */\r\n\t\tName: string;\r\n\t\t/** Optional model associated with the component. */\r\n\t\tModel?: any;\r\n\t\t/** Optional global (window-level) variable name for the component.. */\r\n\t\tGlobalReference?: string;\r\n\t\t/** Component file path. */\r\n\t\tPath: string;\r\n\r\n\t\tconstructor(component: any, name: string, path: string, model?: any, globalReference?: string) {\r\n\t\t\tlet mod = this;\r\n\t\t\tmod.Component = component;\r\n\t\t\tmod.Name = name;\r\n\t\t\tmod.Path = path;\r\n\t\t\tmod.Model = model;\r\n\t\t\tmod.GlobalReference = globalReference;\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Application launch options.\r\n\t * NOTE: This is a separate copy from the one in 'cp/appShared'. It cannot be imported into a non-module TS file.\r\n\t * If the classes are moved to a definition file, then they could be imported.\r\n\t */\r\n\tclass LaunchOptions {\r\n\t\tComponents: ComponentInfo[];\r\n\t\tManagerGlobalReference?: string;\r\n\t\tStartupComponent?: ComponentInfo;\r\n\t\tConfig?: Config;\r\n\r\n\t\tconstructor(components: ComponentInfo[], config?: Config, managerGlobalReference?: string, startupComponent?: ComponentInfo) {\r\n\t\t\tlet mod = this;\r\n\t\t\tmod.Components = components;\r\n\t\t\tmod.Config = config;\r\n\t\t\tmod.ManagerGlobalReference = managerGlobalReference;\r\n\t\t\tmod.StartupComponent = startupComponent;\r\n\t\t}\r\n\t}\r\n\r\n\tclass ResourceInfo {\r\n\t\tKey: string;\r\n\t\tContent: string;\r\n\t}\r\n\tclass ResourceList {\r\n\t\t[index: string]: ResourceInfo;\r\n\t}\r\n\tclass CmsContentItem {\r\n\t\tKey: string;\r\n\t\tContent: any;\r\n\t}\r\n\tclass CmsContentItemList {\r\n\t\t[index: string]: CmsContentItem;\r\n\t}\r\n\tinterface TemplateInfo {\r\n\t\tName: string;\r\n\t\tTemplate?: Template;\r\n\t\tType: string; // [TODO] Use enum\r\n\t\tExtraInfo?: any;\r\n\t}\r\n\r\n\tclass WebApp {\r\n\t\tprivate Components: ComponentInfo[] = [];\r\n\t\tprivate ComponentCount: number = 0;\r\n\t\tprivate ComponentsLoaded: number = 0;\r\n\t\tprivate PageReady: boolean = false;\r\n\t\tprivate HasStartup: boolean = false;\r\n\t\tprivate Config: Config;\r\n\t\tprivate Resources: ResourceList = {};\r\n\t\tprivate CmsContentItems: CmsContentItemList = {};\r\n\t\tprivate Templates: IKeyValueCollection = {};\r\n\r\n\t\tpublic BindList: TemplateBindModel[] = [];\r\n\r\n\t\tconstructor() {\r\n\t\t\t//debugger;\r\n\t\t\tlet mod = this;\r\n\r\n\t\t\t// Register docment ready handler\r\n\t\t\t// Need to do this inline (anonymous) to retain \"mod\" scope\r\n\t\t\t$(document).ready(() => {\r\n\t\t\t\t// Update the flag\r\n\t\t\t\tmod.PageReady = true;\r\n\r\n\t\t\t\t// Add timer (like 30 sec?) to let the user know not all modules loaded\r\n\t\t\t\t// Be sure to cancel it in CheckStatus\r\n\t\t\t\t// @@@\r\n\r\n\t\t\t\t// Check the load status\r\n\t\t\t\tmod.CheckStatus();\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tpublic Initialize(opt: InitializeOptions) {\r\n\t\t\t//debugger;\r\n\t\t\tlet mod = this;\r\n\r\n\t\t\tif (!opt) opt = {};\r\n\r\n\t\t\t// Get option values and defaults\r\n\t\t\tlet lp = mod.GetString(opt.LauncherPath, \"cp/appShared\");\r\n\t\t\tlet ln = mod.GetString(opt.LauncherName, \"ApplicationLauncher\");\r\n\t\t\tlet ar = mod.GetString(opt.AppGlobalReference, \"ApplicationManager\");\r\n\t\t\tlet sp = mod.GetString(opt.StartPath, null);\r\n\t\t\tlet sn = mod.GetString(opt.StartName, null);\r\n\t\t\tlet sr = mod.GetString(opt.StartGlobalReference, null);\r\n\t\t\tmod.Config = opt.Config || window[\"CPConfig\"];\r\n\t\t\twindow[\"GTMKey\"] = mod.Config.Core.Tracking.TrackingGTMId;\r\n\n\t\t\t// Load the launcher\r\n\t\t\tmod.LoadComponent({ Path: lp, Name: ln, GlobalReference: ar });\r\n\r\n\t\t\t// Load the startup module\r\n\t\t\tif (sp && sn) {\r\n\t\t\t\tmod.HasStartup = true;\r\n\t\t\t\tmod.LoadComponent({ Path: sp, Name: sn, Model: opt.StartModel, GlobalReference: sr });\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t/**\r\n\t\t * Initialize page and user tracking.\r\n\t\t * @param {any} container - Container for the tracker.\r\n\t\t * @param {Document} doc - Document DOM.\r\n\t\t * @param {string} tagName - Tag type name for containing the tracker.\r\n\t\t * @param {string} scriptPath - Path to the tracking library.\r\n\t\t * @param {string} varName - Variable name within the container where the tracker will be stored.\r\n\t\t * @param {HTMLElement} elem - Optional element containing the tracker.\r\n\t\t * @param {Element} tagRef - Optional tag DOM reference where the tracker will be added.\r\n\t\t */\r\n\t\t\t\r\n\t\tpublic AddResources(items: ResourceInfo[]): void {\r\n\t\t\tlet mod = this;\r\n\r\n\t\t\tfor (let i = 0; i < items.length; i++) {\r\n\t\t\t\tlet item = items[i];\r\n\t\t\t\tmod.Resources[item.Key] = item;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic AddCmsContentItems(item: CmsContentItem): void {\r\n\t\t\tlet mod = this;\r\n\t\t\tmod.CmsContentItems[item.Key] = item;\r\n\t\t}\r\n\t\tpublic LoadComponent(opt: LoadOptions) {\r\n\t\t\tlet mod = this;\r\n\t\t\t// Validation\r\n\t\t\tif (!opt) throw new Error(\"Missing or invalid load options.\");\r\n\t\t\tif (!opt.Path || opt.Path.length == 0) throw new Error(\"Missing or invalid module path.\");\r\n\t\t\tif (!opt.Name) throw new Error(\"Missing or invalid module name.\");\r\n\r\n\t\t\tlet path = opt.Path;\r\n\r\n\t\t\t// Add an extension if there isn't one\r\n\t\t\tif (path.substring(path.length - 3, path.length) != \".js\")\r\n\t\t\t\tpath += \".js\";\r\n\r\n\t\t\t// Add it to the queue\r\n\t\t\t// Components (first param) will be null until they are loaded\r\n\t\t\tlet ci = new ComponentInfo(null, opt.Name, path, opt.Model, opt.GlobalReference);\r\n\t\t\tmod.Components.push(ci);\r\n\t\t\tmod.ComponentCount++;\r\n\r\n\t\t\t// Start the import\r\n\t\t\tmod.DoImport(ci);\r\n\t\t}\r\n\r\n\t\tprivate GetString(src: string, defaultValue: string = \"\"): string {\r\n\t\t\tif (src && src.length && src.length > 0)\r\n\t\t\t\treturn src;\r\n\t\t\treturn defaultValue;\r\n\t\t}\r\n\r\n\t\tprivate DoImport(componentInfo: ComponentInfo) {\r\n\t\t\t//debugger;\r\n\t\t\tlet mod = this;\r\n\r\n\t\t\t// Load the component module and handle the promise/async\r\n\t\t\t// [TODO] Is there a way to tell TS \"SystemJS\" is a global var?\r\n\t\t\t//console.log(window[\"SystemJS\"].bundleConfig);\r\n\t\t\tif (window[\"SystemJS\"] && window[\"SystemJS\"].bundleConfig && window[\"SystemJS\"].bundleConfig.enabled) {\r\n\t\t\t\tvar bundleConfig = window[\"SystemJS\"].bundleConfig;\r\n\t\t\t\tvar bundlePath = componentInfo.Path.replace('.js', bundleConfig.fileNameSuffix);\r\n\t\t\t\t//console.log(componentInfo.Path);\r\n\t\t\t\twindow[\"SystemJS\"].import(bundlePath)\r\n\t\t\t\t\t.then(function (bp) {\r\n\t\t\t\t\t\tmod.Import(componentInfo);\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t\tmod.Import(componentInfo);\r\n\t\t}\r\n\r\n\t\tprivate Import(componentInfo: ComponentInfo) {\r\n\t\t\tlet mod = this;\r\n\t\t\tif (window[\"SystemJS\"]) {\r\n\t\t\t\twindow[\"SystemJS\"].import(componentInfo.Path)\r\n\t\t\t\t\t.then(function (comp) {\r\n\t\t\t\t\t\t// Save the reference\r\n\t\t\t\t\t\tcomponentInfo.Component = comp;\r\n\t\t\t\t\t\t//console.log(componentInfo.Path);\r\n\t\t\t\t\t\t// Increment the counter\r\n\t\t\t\t\t\tmod.ComponentsLoaded++;\r\n\t\t\t\t\t\t// Check the load status\r\n\t\t\t\t\t\tmod.CheckStatus();\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tprivate CheckStatus(): void {\r\n\t\t\t//debugger;\r\n\t\t\tlet mod = this;\r\n\r\n\t\t\t// If the page isn't ready, stop\r\n\t\t\tif (!mod.PageReady) return;\r\n\r\n\t\t\t// If all components haven't finished loading, stop\r\n\t\t\tif (mod.ComponentsLoaded < mod.ComponentCount) return;\r\n\r\n\t\t\t// Launch the app\r\n\t\t\t// The first component is the launcher itself\r\n\t\t\t// The second component is the startup component (optional)\r\n\t\t\t// Remove the launcher and startup from the array\r\n\t\t\t// Do this async (timeout of zero) so we don't hold up Initialize, DoImport, or page ready\r\n\t\t\t//debugger;\r\n\t\t\tsetTimeout(() => {\r\n\t\t\t\t//debugger;\r\n\t\t\t\tlet hs = mod.HasStartup;\r\n\t\t\t\tlet components = mod.Components;\r\n\t\t\t\tvar c = components[0];\r\n\r\n\t\t\t\t// Save the resource collection\r\n\t\t\t\twindow[\"CPResourceData\"] = mod.Resources;\n\t\t\t\twindow[\"CPCmsContentItems\"] = mod.CmsContentItems;\r\n\r\n\t\t\t\t// Make sure launcher is present.\r\n\t\t\t\t// Pages could theoretically have no launcher or modules (likely legacy pages)\r\n\t\t\t\tif (c) {\r\n\t\t\t\t\tvar s = hs ? components[1] : null;\r\n\t\t\t\t\tcomponents.splice(0, hs ? 2 : 1);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tlet ctorTemp = c.Component[c.Name];\r\n\t\t\t\t\t\tvar a = new ctorTemp(new LaunchOptions(components, mod.Config, c.GlobalReference, s));\n\t\t\t\t\t} catch (error) {\r\n\t\t\t\t\t\tconsole.log(error);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\tpublic RegisterTemplate(id: string, type?: string, extraInfo?: any): void {\r\n\t\t\t//debugger;\r\n\t\t\tlet mod = this;\r\n\r\n\t\t\tlet template = mod.Templates[id];\r\n\t\t\tif (!template) {\r\n\t\t\t\tif (!type)\r\n\t\t\t\t\ttype = \"static\";\r\n\t\t\t\tmod.Templates[id] = { Name: id, Template: null, Type: type, ExtraInfo: extraInfo };\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic RegisterTemplateCallback(templateId: string, controlId: string, data?: TemplateRuntimeModel, extraInfo?: any): void {\r\n\t\t\t// [TODO] Consider passing in object instead of params\r\n\t\t\t//debugger;\r\n\t\t\tlet mod = this;\r\n\r\n\t\t\tlet tbi: TemplateBindModel = {\r\n\t\t\t\tTemplate: data.Template,\r\n\t\t\t\tMeta: data.Meta,\r\n\t\t\t\tData: data.Data,\r\n\t\t\t\tExtraInfo: extraInfo || {}\r\n\t\t\t};\r\n\t\t\ttbi.ExtraInfo.Type = \"callback\";\r\n\t\t\tmod.BindList.push(tbi);\r\n\t\t}\n\n\t\tpublic RegisterTemplateBinding(templateId: string, controlId: string, data?: TemplateRuntimeModel, extraInfo?: any): void {\n\t\t\t//debugger;\n\t\t\tlet mod = this;\n\n\t\t\t// [TODO] Combine this with RegisterTemplateCallback, or at least create a common ancestory function.\n\n\t\t\tlet tbi: TemplateBindModel = {\r\n\t\t\t\tTemplate: data.Template,\r\n\t\t\t\tMeta: data.Meta,\r\n\t\t\t\tData: data.Data,\r\n\t\t\t\tExtraInfo: extraInfo || {}\r\n\t\t\t};\r\n\t\t\ttbi.ExtraInfo.Type = \"bound\";\r\n\t\t\tmod.BindList.push(tbi);\r\n\t\t}\r\n\r\n\t\tpublic RenderTemplate(info: TemplateRunInfo): string {\r\n\r\n\t\t\tlet mod = this;\r\n\r\n\t\t\tlet id = info.Name;\r\n\t\t\ttry {\n\t\t\t\tlet template = mod.Templates[id];\r\n\r\n\t\t\t\tlet data = info.Data;\r\n\r\n\t\t\t\t// debugger;\r\n\t\t\t\tif (data == undefined || data == null || typeof(data as any) === 'string')\r\n\t\t\t\t\tdata = {};\r\n\t\t\t\t// [TODO] Might need to move \"_template\" if Data is an observable model. But Meta coule be missing and Template is anonymous (transient)\r\n\t\t\t\tif (data._template == undefined || data._template == null)\r\n\t\t\t\t\tdata._template = {\r\n\t\t\t\t\t\tType: \"function\" // [TODO] Use enum or constant\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t// See if the template was found\r\n\t\t\t\tif (template == undefined || template == null || !template.Template) {\r\n\t\t\t\t\t// See if it was found but not defined\r\n\t\t\t\t\tif (template == undefined || template == null) {\r\n\t\t\t\t\t\t// Define a new template container\r\n\t\t\t\t\t\tmod.Templates[id] = template = { Name: id, Template: null, Type: \"static\" };\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Get the template contents\r\n\t\t\t\t\tlet sel = $(\"#\" + id);\r\n\t\t\t\t\tif (!sel || sel == undefined || sel.length == 0) {\r\n\t\t\t\t\t\tthrow new Error(\"Unable to locate template '\" + id + \"'.\");\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t// Get the template contents\r\n\t\t\t\t\tlet tc = sel.html();\r\n\r\n\t\t\t\t\t// Compile the template\r\n\t\t\t\t\ttemplate.Template = kendo.template(tc);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//if (data.id == \"earningsCheck\" && (id == 'gizmo' || id == 'gizmo__table')) debugger; // [TEST]\r\n\r\n\t\t\t\tlet parent = info.Parent || '';\r\n\t\t\t\tlet childKey = info.ChildKey;\r\n\t\t\t\tlet parentMeta = info.ParentMeta || '';\r\n\t\t\t\tlet metaKey = info.MetaKey;\r\n\t\t\t\tif (childKey === undefined || childKey === null) childKey = '';\r\n\t\t\t\tif (typeof childKey !== \"string\") childKey = (childKey[\"toString\"] as Function)();\r\n\t\t\t\tif (metaKey === undefined || metaKey === null) metaKey = '';\r\n\t\t\t\tif (typeof metaKey !== \"string\") metaKey = (metaKey[\"toString\"] as Function)();\r\n\r\n\t\t\t\t// Start with the parent path, or ID if no parent\r\n\t\t\t\tlet controlPath = parent ? parent : id;\r\n\t\t\t\t// Add a child key, if specified\r\n\t\t\t\tif (childKey.length > 0)\r\n\t\t\t\t\tcontrolPath += '_' + childKey;\r\n\t\t\t\tlet metaPath = (parentMeta ? parentMeta + '.' : '') + metaKey;\r\n\r\n\t\t\t\t// Runtime template info\r\n\t\t\t\tlet ti: TemplateRuntimeInfo = {\r\n\t\t\t\t\tname: id,\r\n\t\t\t\t\tparentControlPath: parent,\r\n\t\t\t\t\tkey: childKey,\r\n\t\t\t\t\tcontrolPath: controlPath,\r\n\t\t\t\t\tmetaPath: metaPath,\r\n\t\t\t\t\tcontext: info.Context\r\n\t\t\t\t};\r\n\r\n\t\t\t\tlet tm: TemplateRuntimeModel = {\r\n\t\t\t\t\tTemplate: ti,\r\n\t\t\t\t\tMeta: info.Meta || {},\r\n\t\t\t\t\tData: info.Data || {},\r\n\t\t\t\t\tResources: info.Context.Resources\r\n\t\t\t\t};\r\n\r\n\t\t\t\t// [TODO] Handle async model updates? What if two model updates are in progress and added to the queue, but only one of them is ready when the queue is processed?\r\n\t\t\t\tif (template.Type == \"bound\") { // [TODO] Use enum or constant\r\n\t\t\t\t\tlet tbi: TemplateBindModel = {\r\n\t\t\t\t\t\tTemplate: tm.Template,\r\n\t\t\t\t\t\tMeta: tm.Meta,\r\n\t\t\t\t\t\tData: tm.Data,\r\n\t\t\t\t\t\tExtraInfo: template.ExtraInfo || {}\r\n\t\t\t\t\t};\r\n\t\t\t\t\ttbi.ExtraInfo.Type = \"bound\";\r\n\t\t\t\t\tmod.BindList.push(tbi);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t//if (id.indexOf(\"content-body\") >= 0)\r\n\t\t\t\t//\tif (info.ParentMeta.indexOf(\"earningsCheck\") >= 0)\r\n\t\t\t\t//\t\tdebugger;\r\n\r\n\r\n\t\t\t\t// Invoke the template\r\n\t\t\t\t// Data/model param is an array (per Kendo) but should be a single structure\r\n\t\t\t\treturn kendo.render(template.Template, [tm]);\r\n\t\t\t} catch (err) {\r\n\t\t\t\tconsole.log(\"Error processing template '\" + id + \"'.\");\r\n\t\t\t\tthrow err;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tpublic GetTemplate(id: string): TemplateInfo {\r\n\t\t\tlet mod = this;\r\n\r\n\t\t\tif (!id) return null;\r\n\r\n\t\t\tlet template = mod.Templates[id];\r\n\r\n\t\t\tif (template == undefined || template == null)\r\n\t\t\t\treturn null;\r\n\t\t\treturn template;\r\n\t\t}\r\n\t}\r\n\r\n\t// Expose an instance\r\n\texport var App = new WebApp();\r\n}\r\n"]}