@finsemble/finsemble-ui 7.3.2 → 7.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finsemble/finsemble-ui",
3
- "version": "7.3.2",
3
+ "version": "7.3.5",
4
4
  "description": "Ready-made React components to give you a head-start building your SmartDesktop.",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -29,7 +29,7 @@
29
29
  "build-storybook": "build-storybook"
30
30
  },
31
31
  "dependencies": {
32
- "@finsemble/finsemble-api": "7.3.2",
32
+ "@finsemble/finsemble-api": "7.3.5",
33
33
  "@q42/floating-focus-a11y": "^1.3.3",
34
34
  "@reduxjs/toolkit": "^1.5.0",
35
35
  "@svgr/webpack": "^5.5.0",
@@ -247,6 +247,12 @@ function refreshAppDefinitions(componentList) {
247
247
  }
248
248
  });
249
249
  });
250
+ // removes component from the configComponents list if it has been removed from the config
251
+ Object.values(data.configComponents).forEach((component) => {
252
+ if (!componentTypeList.includes(component.name) && !apps.includes(component.appID)) {
253
+ delete data.configComponents[component.appID];
254
+ }
255
+ });
250
256
  componentTypeList.forEach((componentType) => {
251
257
  var _a, _b, _c, _d, _e, _f;
252
258
  const component = componentList === null || componentList === void 0 ? void 0 : componentList[componentType];
@@ -1 +1 @@
1
- {"version":3,"file":"StoreActions.js","sourceRoot":"","sources":["../../../../../src/components/toolbar/advancedAppLauncher/stores/StoreActions.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,MAAM,KAAK,GAAG,OAAO,CAAC,OAA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I,CAAC,gBAAgB,CAAQ,CAAC,CAAC;IAE1F,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACpB,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC,CAAC,CAAC;IACH,0BAA0B;IAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,MAAM,CAAC,GAAW;IAC1B,uBAAuB;IACvB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,uBAAuB;IACvB,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC7B,uBAAuB;IACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,uBAAuB;IACvB,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport { findIndex } from \"lodash\";\nimport { getStore } from \"./LauncherStore\";\nimport AppDirectory from \"../modules/AppDirectory\";\nimport FDC3 from \"../modules/FDC3\";\nimport { iconFromConfig } from \"../../../icon/Icon\";\nimport { FoldersType, FolderAppType } from \"../../../../types/advancedAppLauncherTypes\";\nimport { StandardError } from \"@finsemble/finsemble-api/types/types\";\nimport sortFunctions from \"../utils/sort-functions\";\nconst async = require(\"async\");\nlet FDC3Client: FDC3;\nlet appd: any;\nlet appDEndpoint: any;\n\ntype ComponentDescriptor = Record<string, any>;\ntype ComponentList = Record<string, ComponentDescriptor>;\n\ntype AppsType = {\n\tappID: string;\n\ttags: string[];\n\tname: string;\n\turl: string;\n\ttype: string;\n\tcanDelete: boolean;\n\tdisplayName?: string;\n};\ntype ConfigType = {\n\tappID: string;\n\ticon: any;\n\tname: string;\n\tdisplayName: string;\n\tsource: string;\n\ttags: string[];\n};\ntype DataType = {\n\tfolders: FoldersType[\"folders\"];\n\tfoldersList: FoldersType[\"list\"];\n\tapps: {\n\t\t[field: string]: AppsType;\n\t};\n\ttags: string[];\n\tactiveFolder: string;\n\tfilterText: string;\n\tsortBy: keyof typeof sortFunctions;\n\tisFormVisible: boolean;\n\tconfigComponents: {\n\t\t[field: string]: ConfigType;\n\t};\n};\n\nexport default {\n\tinitialize,\n\taddApp,\n\taddNewFolder,\n\taddAppToFolder,\n\tremoveAppFromFolder,\n\trenameFolder,\n\tdeleteFolder,\n\tdeleteApp,\n\tdeleteTag,\n\treorderFolders,\n\tgetFolders,\n\tgetFoldersList,\n\tgetActiveFolderName,\n\tgetActiveFolder,\n\tgetSingleFolder,\n\tgetAllAppsTags,\n\tgetAllApps,\n\tgetAllAppsFromFolder,\n\tgetFormStatus,\n\tgetSearchText,\n\tgetSortBy,\n\taddTag,\n\tgetTags,\n\tgetApp,\n\tgetDragDisabled,\n\tgetConstants,\n\tfindAppByField,\n\tgetApps,\n\trefreshAppDefinitions,\n};\n\nlet data = <DataType>{};\nconst ADVANCED_APP_LAUNCHER = \"Advanced App Launcher\";\nconst NEW_FOLDER_NAME = \"New folder\";\n// returns names of default folders.\nfunction getConstants() {\n\tconst DASHBOARDS = \"Dashboards\";\n\tconst FAVORITES = \"Favorites\";\n\treturn { ADVANCED_APP_LAUNCHER, DASHBOARDS, FAVORITES };\n}\n\n// Add to here if you want to disable dragging on a folder.\nfunction getDragDisabled() {\n\tconst { DASHBOARDS, FAVORITES } = getConstants();\n\treturn [ADVANCED_APP_LAUNCHER, DASHBOARDS, FAVORITES];\n}\n\nfunction initialize(callback = Function.prototype) {\n\tFSBL.Clients.ConfigClient.getValue({ field: \"finsemble.appDirectoryEndpoint\" }, (_, appDirectoryEndpoint) => {\n\t\t// cache value globally to be used in the event that we need to fetch data for a given component.\n\t\tappDEndpoint = appDirectoryEndpoint;\n\t\tconst store = getStore();\n\t\tdata.folders = store?.values.appFolders.folders;\n\t\tdata.foldersList = store?.values.appFolders.list;\n\t\tvalidateFolderDataStructure();\n\t\tdata.apps = store?.values.appDefinitions;\n\t\tdata.tags = store?.values.activeLauncherTags;\n\t\tdata.activeFolder = store?.values.activeFolder;\n\t\tdata.filterText = store?.values.filterText;\n\t\tdata.sortBy = store?.values.sortBy;\n\t\tdata.isFormVisible = store?.values.isFormVisible;\n\t\tdata.configComponents = {};\n\n\t\t// Add listeners to keep our copy up to date\n\t\tstore?.addListener({ field: \"appFolders.folders\" }, (foldersErr, dt) => {\n\t\t\tdata.folders = dt.value;\n\t\t});\n\t\tstore?.addListener({ field: \"appFolders.list\" }, (folderListErr, dt) => (data.foldersList = dt.value));\n\t\tstore?.addListener({ field: \"appDefinitions\" }, (appDefinitionsErr, dt) => (data.apps = dt.value));\n\t\tstore?.addListener({ field: \"activeFolder\" }, (activeFolderErr, dt) => {\n\t\t\tdata.activeFolder = dt.value;\n\t\t});\n\t\tstore?.addListener({ field: \"isFormVisible\" }, (visibilityErr, dt) => (data.isFormVisible = dt.value));\n\t\tstore?.addListener({ field: \"sortBy\" }, (sortErr, dt) => (data.sortBy = dt.value));\n\t\tstore?.addListener({ field: \"activeLauncherTags\" }, (launcherTagsErr, dt) => (data.tags = dt.value));\n\t\tstore?.addListener({ field: \"filterText\" }, (filterTextErr, dt) => (data.filterText = dt.value));\n\n\t\tFSBL.Clients.RouterClient.subscribe(\"Launcher.update\", (err, response) => {\n\t\t\tFSBL.Clients.Logger.debug(\"list updated\", err, response);\n\t\t\tif (err) {\n\t\t\t\treturn console.error(err);\n\t\t\t}\n\t\t\trefreshAppDefinitions(response.data.componentList);\n\t\t});\n\n\t\t// @deprecate in favor of SystemManagerClient.waitForStartup()\n\t\tFSBL.Clients.RouterClient.subscribe(\"Finsemble.Service.State.launcherService\", (unsubscribeErr) => {\n\t\t\tif (unsubscribeErr) {\n\t\t\t\tFSBL.Clients.Logger.error(\n\t\t\t\t\t\"App Launcher encountered an error unsubscribing from the launcher service\",\n\t\t\t\t\tunsubscribeErr\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tloadInstalledComponentsFromStore(() => {\n\t\t\t\t// We load our stored components(config driven) here\n\t\t\t\tloadInstalledConfigComponents(() => {\n\t\t\t\t\tupdateAppsInFolders(callback);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n}\n\n// This gets a specific app in FDC3 and returns the results\nfunction getApp(appID: string, cb = Function.prototype) {\n\tappd\n\t\t.get(appID)\n\t\t.then((app: any) => cb(null, app))\n\t\t.catch((err: StandardError) => cb(err));\n}\n/**\n * Ensures all 'apps' properties on folders conform\n * to the new structure (Array vs object)\n */\nfunction validateFolderDataStructure() {\n\tObject.keys(data.folders).forEach((folderName) => {\n\t\tconst folder = data.folders[folderName];\n\t\tif (!Array.isArray(folder.apps)) {\n\t\t\tconst warning =\n\t\t\t\t\"Application Launcher Persistent Store has data stored in deprecated format. Please check distributedStore configs\";\n\t\t\t// If the structure is wrong, notify the user in hopes that the foundation will be fixed\n\t\t\tFSBL.Clients.Logger.warn(warning);\n\t\t\tFSBL.UserNotification.alert(\"system\", \"ONCE-SINCE-STARTUP\", \"Distributed Store Type Mismatch\", warning);\n\t\t\tlet newApps: FolderAppType[] = [];\n\t\t\tObject.values(folder.apps).forEach((app: any) => {\n\t\t\t\tnewApps.push(app);\n\t\t\t});\n\t\t\tfolder.apps = newApps;\n\t\t}\n\t});\n\t_setFolders();\n}\n\n// Update apps in folders with updated config information\nfunction updateAppsInFolders(cb = Function.prototype) {\n\t// Loop through folders and update apps with new info\n\tconst { ADVANCED_APP_LAUNCHER: advancedAppLauncherFolderName } = getConstants();\n\tObject.keys(data.folders).forEach((folderName) => {\n\t\tif (folderName === advancedAppLauncherFolderName) return;\n\t\telse {\n\t\t\tconst folder = data.folders[folderName];\n\t\t\tObject.values(data.configComponents).forEach((configComp) => {\n\t\t\t\tlet index = -1;\n\t\t\t\tfolder.apps.forEach((folderApp, i) => {\n\t\t\t\t\tif (folderApp.appID.toString().trim() === configComp.appID.toString().trim()) {\n\t\t\t\t\t\tindex = i;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (index > -1) {\n\t\t\t\t\tdata.folders[folderName].apps.splice(index, 1, configComp);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\t_setFolders(cb);\n}\n\n/**\n * Given a component config, will return tags, or an empty array.\n *\n * @param {*} componentConfig\n * @returns\n */\nfunction extractTagsFromFinsembleComponentConfig(componentConfig: ComponentDescriptor) {\n\tif (!componentConfig.foreign) return [];\n\tif (!componentConfig.foreign.components) return [];\n\tif (!componentConfig.foreign.components[\"App Launcher\"]) return [];\n\n\tconst { tags } = componentConfig.foreign.components[\"App Launcher\"];\n\n\tif (tags) {\n\t\tif (typeof tags === \"string\") {\n\t\t\treturn [tags];\n\t\t}\n\t\treturn tags;\n\t}\n\n\treturn [];\n}\n/**\n * Instantiates classes needed to interact with the appD server.\n * Only done when needed. If there are no components with source 'FDC3', this code will not execute.\n */\nfunction lazyLoadAppD() {\n\tif (!FDC3Client) FDC3Client = new FDC3({ url: appDEndpoint });\n\tif (!appd) appd = new AppDirectory(FDC3Client) as FDC3;\n}\n\n/**\n * Here we load apps from FDC3\n * @param {*} cb\n */\nfunction loadInstalledComponentsFromStore(cb = Function.prototype) {\n\tasync.map(\n\t\tObject.values(data.apps),\n\t\t(component: any, componentDone: any) => {\n\t\t\t// Load FDC3 components here\n\t\t\tif (component.source && component.source === \"FDC3\") {\n\t\t\t\tlazyLoadAppD();\n\t\t\t\t// get the app info so we can load it into the launcher\n\t\t\t\treturn getApp(component.appID, (err: StandardError) => {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\t// don't want to kill this;\n\t\t\t\t\t\tdeleteApp(component.appID);\n\t\t\t\t\t\tconsole.error(\"there was an error loading from FDC3\", component, err);\n\t\t\t\t\t}\n\t\t\t\t\treturn componentDone();\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Assumption - component is always a user defined component\n\t\t\t// when testing I was never able to get any other component types in this method\n\t\t\tFSBL.Clients.LauncherClient.addUserDefinedComponent(component, (compAddErr) => {\n\t\t\t\tif (compAddErr) {\n\t\t\t\t\tconsole.warn(\"Failed to add new app:\", compAddErr);\n\t\t\t\t}\n\t\t\t\tcomponentDone(compAddErr);\n\t\t\t});\n\t\t},\n\t\t(err: StandardError) => {\n\t\t\tcb(err);\n\t\t}\n\t);\n}\n\n// We load our apps that were loaded from the config.\nfunction loadInstalledConfigComponents(cb = Function.prototype) {\n\t// Get the list of components from the launcher service\n\tFSBL.Clients.LauncherClient.getComponentList((err, componentList) => {\n\t\t/*\n\t\t * Update the folders under the \"App\" menu and delete any apps in the folder\n\t\t * that are no longer in the config and are not user defined components.\n\t\t */\n\t\trefreshAppDefinitions(componentList || {});\n\t\tcb();\n\t});\n}\n\nfunction getApps() {\n\treturn data.apps;\n}\n\nfunction refreshAppDefinitions(componentList: ComponentList) {\n\tconst componentTypeList = Object.keys(componentList);\n\n\tconst { folders } = data;\n\t// Get the user defined apps\n\tconst apps = Object.keys(data.apps);\n\tObject.keys(folders).forEach((folderName) => {\n\t\tfolders[folderName].apps.forEach((configDefinedApp, i) => {\n\t\t\tconst { name, appID } = configDefinedApp;\n\t\t\t// If the component is not in the config component list and is not a user defined component\n\t\t\tif (!componentTypeList.includes(name) && !apps.includes(appID)) {\n\t\t\t\t// Delete app from the folder\n\t\t\t\tfolders[folderName].apps.splice(i, 1);\n\t\t\t}\n\t\t});\n\t});\n\n\tcomponentTypeList.forEach((componentType) => {\n\t\tconst component = componentList?.[componentType];\n\t\tif (component && component.component) {\n\t\t\tconst launchableByUser = component?.foreign?.components?.[\"App Launcher\"]?.launchableByUser;\n\n\t\t\tconst displayName = component.component.displayName ?? componentType;\n\t\t\tconst iconObject = iconFromConfig(component?.foreign?.components?.Toolbar, displayName, component?.appDConfig);\n\t\t\t// Make sure the app is launchable by user\n\t\t\tif (launchableByUser && !component.component.isUserDefined) {\n\t\t\t\tdata.configComponents[componentType] = {\n\t\t\t\t\tappID: componentType,\n\t\t\t\t\ticon: iconObject,\n\t\t\t\t\tname: componentType,\n\t\t\t\t\tdisplayName,\n\t\t\t\t\tsource: \"config\",\n\t\t\t\t\ttags: extractTagsFromFinsembleComponentConfig(component),\n\t\t\t\t};\n\t\t\t} else if (!launchableByUser && data.configComponents[componentType]) {\n\t\t\t\tdelete data.configComponents[componentType];\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction _setValue(field: string, value: any, cb: any) {\n\tgetStore()?.setValue(\n\t\t{\n\t\t\tfield: field,\n\t\t\tvalue: value,\n\t\t},\n\t\t(error) => {\n\t\t\tif (error) {\n\t\t\t\tFSBL.Clients.Logger.error(`Advanced App Launcher: Failed to save: ${field}:${value}`);\n\t\t\t} else {\n\t\t\t\tcb && cb();\n\t\t\t}\n\t\t}\n\t);\n}\n\nfunction _setFolders(cb = Function.prototype) {\n\t_setValue(\"appFolders.folders\", data.folders, (err: StandardError) => {\n\t\tif (err) {\n\t\t\tFSBL.Clients.Logger.error(`Advanced App Launcher: Failed to set folders: ${err}`);\n\t\t\treturn;\n\t\t}\n\n\t\tcb();\n\t});\n}\n\nfunction _findAppIndexInFolders(appID: string, folderName: string) {\n\treturn findIndex(data.folders[folderName].apps, (app) => app.appID === appID);\n}\n\nfunction getFolders() {\n\treturn data.folders;\n}\n\nfunction getFoldersList() {\n\treturn data.foldersList;\n}\n\nfunction getAllApps() {\n\treturn Object.assign({}, data.apps, data.configComponents);\n}\n\nfunction getFormStatus() {\n\treturn data.isFormVisible;\n}\n\nfunction getSingleFolder(folderName: string) {\n\treturn data.folders[folderName];\n}\n\nfunction reorderFolders(destIndex: number, srcIndex: number) {\n\t// There are two types of folders: Those that can be arranged, and those that cannot. We don't want to reorder the folders relative to the unorderable folders. Split them out, and then combine them after doing the filtering/swapping.\n\tconst dragDisabled = getDragDisabled();\n\tconst unorderableFolders = data.foldersList.filter((folderName) => dragDisabled.includes(folderName));\n\tconst orderableFolders = data.foldersList.filter((folderName) => !dragDisabled.includes(folderName));\n\tconst movedFolder = orderableFolders[destIndex];\n\tconst remainingItems = orderableFolders.filter((item, index) => index !== destIndex);\n\tdata.foldersList = [\n\t\t...unorderableFolders,\n\t\t...remainingItems.slice(0, srcIndex),\n\t\tmovedFolder,\n\t\t...remainingItems.slice(srcIndex),\n\t];\n\t_setValue(\"appFolders.list\", data.foldersList, () => {});\n\treturn data.foldersList;\n}\n\nfunction addApp(app = <AppsType>{}, cb: any) {\n\tconst appID = `${new Date().getTime()}`;\n\tconst folder = data.activeFolder;\n\tconst newAppData = {\n\t\tappID,\n\t\ttags: app.tags,\n\t\tname: app.name,\n\t\turl: app.url,\n\t\ttype: \"component\",\n\t\tcanDelete: true,\n\t};\n\n\t/**\n\t * Note, the advanced app launcher can currently only keep track of apps that\n\t * are added by itself. Apps added by the basic launcher, or any other means,\n\t * will not be detected. A reconciliation process would need to be added that\n\t * listens on the distributed store similar to how the basic app launcher works.\n\t *\n\t * FSBL.Clients.RouterClient.subscribe(\"Launcher.update\", (err, response) => {\n\t\t\tFSBL.Clients.Logger.debug(\"list updated\", err, response);\n\t\t\tif (err) {\n\t\t\t\treturn console.error(err);\n\t\t\t}\n\t\t\tself.filterComponents(response.data.componentList);\n\t\t});\n\t */\n\tFSBL.Clients.LauncherClient.addUserDefinedComponent(newAppData, (compAddErr) => {\n\t\tif (compAddErr) {\n\t\t\tcb({ code: \"failed_to_add_app\", message: compAddErr });\n\t\t\tconsole.warn(\"Failed to add new app:\", compAddErr);\n\t\t\treturn;\n\t\t}\n\t\tdata.apps[appID] = newAppData;\n\n\t\t// Add to ADVANCED_APP_LAUNCHER folder\n\t\tdata.folders[ADVANCED_APP_LAUNCHER].apps.push(newAppData);\n\n\t\t// Check if we need to add to another folder as well\n\t\tif (folder !== ADVANCED_APP_LAUNCHER) {\n\t\t\tdata.folders[folder].apps.push(newAppData);\n\t\t}\n\t\t// Save appDefinitions and then folders\n\t\t_setValue(\"appDefinitions\", data.apps, () => {\n\t\t\t_setFolders();\n\t\t\tcb && cb();\n\t\t});\n\t});\n}\n\nfunction deleteApp(appID: string) {\n\t// Delete app from any folder that has it\n\tfor (const key in data.folders) {\n\t\tconst appIndex = _findAppIndexInFolders(appID, key);\n\t\tdata.folders[key].apps.splice(appIndex, 1);\n\t}\n\n\t// Delete app from the apps list\n\tFSBL.Clients.LauncherClient.removeUserDefinedComponent(data.apps[appID], () => {\n\t\tdelete data.apps[appID];\n\t\t// Save appDefinitions and then folders\n\t\t_setValue(\"appDefinitions\", data.apps, () => {\n\t\t\t_setFolders();\n\t\t});\n\t});\n}\n\nfunction addNewFolder(name?: string) {\n\t// Each new folder is given a number, lets store them here\n\t// to get the highest one and then increment\n\t// result of this will be [0, 1, 2] etc\n\tconst newFoldersNums = [\n\t\t0,\n\t\t// Find folders that have a name of \"New folder\" or \"New folder #\"\n\t\t...data.foldersList\n\t\t\t.filter((folder) => folder.startsWith(NEW_FOLDER_NAME))\n\t\t\t.map((folder) => {\n\t\t\t\tconst numbers: any[] = folder.match(/\\d+/g) || [];\n\t\t\t\treturn Math.max(...numbers);\n\t\t\t}),\n\t];\n\tconst highestFolderNumber = Math.max(...newFoldersNums);\n\tconst folderName: string = name ?? `${NEW_FOLDER_NAME} ${highestFolderNumber + 1}`;\n\tconst newFolder = {\n\t\tdisableUserRemove: true,\n\t\ticon: \"ff-adp-hamburger\",\n\t\tcanEdit: true,\n\t\tcanDelete: true,\n\t\tapps: [],\n\t};\n\tdata.folders[folderName] = newFolder;\n\t_setFolders(() => {\n\t\t// Update folders order if adding was successful\n\t\tdata.foldersList.push(folderName);\n\t\t_setValue(\"appFolders.list\", data.foldersList, () => {});\n\t});\n}\n\nfunction deleteFolder(folderName: string) {\n\t// Check if user is trying to delete the active folder\n\tif (folderName === data.activeFolder) {\n\t\tdata.activeFolder = ADVANCED_APP_LAUNCHER;\n\t\t_setValue(\"activeFolder\", data.activeFolder, () => {});\n\t}\n\n\tdelete data.folders[folderName] &&\n\t\t_setFolders(() => {\n\t\t\t// Update the order of folders\n\t\t\tconst index = data.foldersList.indexOf(folderName);\n\t\t\tdata.foldersList.splice(index, 1);\n\t\t\t_setValue(\"appFolders.list\", data.foldersList, () => {});\n\t\t});\n}\n\nfunction renameFolder(oldName: string, newName: string) {\n\tlet indexOfOld = data.foldersList.findIndex((folderName) => folderName === oldName);\n\n\tif (indexOfOld > -1) {\n\t\tlet oldFolder = data.folders[oldName];\n\t\tdata.folders[newName] = oldFolder;\n\t\tdata.foldersList.splice(indexOfOld, 1, newName);\n\n\t\t_setFolders(() => {\n\t\t\t_setValue(\"appFolders.list\", data.foldersList, () => {});\n\n\t\t\tif (data.activeFolder === oldName) {\n\t\t\t\t_setValue(\"activeFolder\", newName, () => {});\n\t\t\t}\n\n\t\t\tdelete data.folders[oldName];\n\t\t});\n\t}\n}\n\nfunction addAppToFolder(folderName: string, app: FolderAppType) {\n\tconst appIndex = _findAppIndexInFolders(app.appID, folderName);\n\n\tif (appIndex < 0) {\n\t\tdata.folders[folderName].apps.push({\n\t\t\tname: app.name,\n\t\t\tdisplayName: app.displayName,\n\t\t\tappID: app.appID,\n\t\t});\n\t\t_setFolders();\n\t}\n}\n\nfunction removeAppFromFolder(folderName: string, app: FolderAppType) {\n\tconst appIndex = _findAppIndexInFolders(app.appID, folderName);\n\tdata.folders[folderName].apps.splice(appIndex, 1);\n\t_setFolders();\n}\n\nfunction getAllAppsFromFolder(folderName: string) {\n\treturn data.folders[folderName].apps;\n}\n\n/**\n * Given a field, search through FDC3 apps and apps pulled in via config and return that app.\n * */\nfunction findAppByField(field: keyof AppsType | keyof ConfigType, value: any) {\n\treturn (\n\t\tObject.values(data.apps).find((app) => (app ? (app as any)[field] === value : false)) ||\n\t\tObject.values(data.configComponents).find((app) => (app ? (app as any)[field] === value : false))\n\t);\n}\n\nfunction getActiveFolder() {\n\tconst folder = data.folders[data.activeFolder];\n\n\tif (!folder) {\n\t\tFSBL.Clients.Logger.error(`activeFolder:\"${data.activeFolder}\" not found! Defaulting to empty folder`);\n\t\treturn {\n\t\t\tname: data.activeFolder,\n\t\t\tapps: [],\n\t\t};\n\t}\n\n\tObject.values(folder.apps).forEach((app) => {\n\t\tconst appData = findAppByField(\"appID\", app.appID);\n\t\tif (!appData) {\n\t\t\tapp.tags = [];\n\t\t} else {\n\t\t\tapp.tags = appData.tags;\n\t\t}\n\t});\n\t// Need a name for the AppDefinition/AppActionsMenu rendering\n\tfolder.name = data.activeFolder;\n\treturn folder;\n}\n\nfunction getActiveFolderName() {\n\treturn data.activeFolder;\n}\n\nfunction getSearchText() {\n\treturn data.filterText;\n}\n\nfunction getSortBy() {\n\treturn data.sortBy;\n}\n\nfunction getTags() {\n\treturn data.tags;\n}\n\nfunction getAllAppsTags() {\n\tlet tags: any[] = [];\n\t// Pull tags from applications installed via FDC3 and the component config.\n\tconst apps = Object.values(data.apps).concat(Object.values(data.configComponents) as any);\n\n\tapps.forEach((app) => {\n\t\ttags = tags.concat(app.tags);\n\t});\n\t// return unique ones only\n\treturn tags.filter((tag, index) => tags.indexOf(tag) === index);\n}\n\nfunction addTag(tag: string) {\n\t// Push new tag to list\n\tdata.tags.indexOf(tag) < 0 && data.tags.push(tag);\n\t// Update tags in store\n\t_setValue(\"activeLauncherTags\", data.tags, () => {});\n}\n\nfunction deleteTag(tag: string) {\n\t// Push new tag to list\n\tdata.tags.splice(data.tags.indexOf(tag), 1);\n\t// Update tags in store\n\t_setValue(\"activeLauncherTags\", data.tags, () => {});\n}\n"]}
1
+ {"version":3,"file":"StoreActions.js","sourceRoot":"","sources":["../../../../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vB,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACtD,CAAC;AAED,SAAS,SAAS,CAAC,GAAW;IAC7B,uBAAuB;IACvB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5C,uBAAuB;IACvB,SAAS,CAAC,oBAAoB,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\nimport { findIndex } from \"lodash\";\nimport { getStore } from \"./LauncherStore\";\nimport AppDirectory from \"../modules/AppDirectory\";\nimport FDC3 from \"../modules/FDC3\";\nimport { iconFromConfig } from \"../../../icon/Icon\";\nimport { FoldersType, FolderAppType } from \"../../../../types/advancedAppLauncherTypes\";\nimport { StandardError } from \"@finsemble/finsemble-api/types/types\";\nimport sortFunctions from \"../utils/sort-functions\";\nconst async = require(\"async\");\nlet FDC3Client: FDC3;\nlet appd: any;\nlet appDEndpoint: any;\n\ntype ComponentDescriptor = Record<string, any>;\ntype ComponentList = Record<string, ComponentDescriptor>;\n\ntype AppsType = {\n\tappID: string;\n\ttags: string[];\n\tname: string;\n\turl: string;\n\ttype: string;\n\tcanDelete: boolean;\n\tdisplayName?: string;\n};\ntype ConfigType = {\n\tappID: string;\n\ticon: any;\n\tname: string;\n\tdisplayName: string;\n\tsource: string;\n\ttags: string[];\n};\ntype DataType = {\n\tfolders: FoldersType[\"folders\"];\n\tfoldersList: FoldersType[\"list\"];\n\tapps: {\n\t\t[field: string]: AppsType;\n\t};\n\ttags: string[];\n\tactiveFolder: string;\n\tfilterText: string;\n\tsortBy: keyof typeof sortFunctions;\n\tisFormVisible: boolean;\n\tconfigComponents: {\n\t\t[field: string]: ConfigType;\n\t};\n};\n\nexport default {\n\tinitialize,\n\taddApp,\n\taddNewFolder,\n\taddAppToFolder,\n\tremoveAppFromFolder,\n\trenameFolder,\n\tdeleteFolder,\n\tdeleteApp,\n\tdeleteTag,\n\treorderFolders,\n\tgetFolders,\n\tgetFoldersList,\n\tgetActiveFolderName,\n\tgetActiveFolder,\n\tgetSingleFolder,\n\tgetAllAppsTags,\n\tgetAllApps,\n\tgetAllAppsFromFolder,\n\tgetFormStatus,\n\tgetSearchText,\n\tgetSortBy,\n\taddTag,\n\tgetTags,\n\tgetApp,\n\tgetDragDisabled,\n\tgetConstants,\n\tfindAppByField,\n\tgetApps,\n\trefreshAppDefinitions,\n};\n\nlet data = <DataType>{};\nconst ADVANCED_APP_LAUNCHER = \"Advanced App Launcher\";\nconst NEW_FOLDER_NAME = \"New folder\";\n// returns names of default folders.\nfunction getConstants() {\n\tconst DASHBOARDS = \"Dashboards\";\n\tconst FAVORITES = \"Favorites\";\n\treturn { ADVANCED_APP_LAUNCHER, DASHBOARDS, FAVORITES };\n}\n\n// Add to here if you want to disable dragging on a folder.\nfunction getDragDisabled() {\n\tconst { DASHBOARDS, FAVORITES } = getConstants();\n\treturn [ADVANCED_APP_LAUNCHER, DASHBOARDS, FAVORITES];\n}\n\nfunction initialize(callback = Function.prototype) {\n\tFSBL.Clients.ConfigClient.getValue({ field: \"finsemble.appDirectoryEndpoint\" }, (_, appDirectoryEndpoint) => {\n\t\t// cache value globally to be used in the event that we need to fetch data for a given component.\n\t\tappDEndpoint = appDirectoryEndpoint;\n\t\tconst store = getStore();\n\t\tdata.folders = store?.values.appFolders.folders;\n\t\tdata.foldersList = store?.values.appFolders.list;\n\t\tvalidateFolderDataStructure();\n\t\tdata.apps = store?.values.appDefinitions;\n\t\tdata.tags = store?.values.activeLauncherTags;\n\t\tdata.activeFolder = store?.values.activeFolder;\n\t\tdata.filterText = store?.values.filterText;\n\t\tdata.sortBy = store?.values.sortBy;\n\t\tdata.isFormVisible = store?.values.isFormVisible;\n\t\tdata.configComponents = {};\n\n\t\t// Add listeners to keep our copy up to date\n\t\tstore?.addListener({ field: \"appFolders.folders\" }, (foldersErr, dt) => {\n\t\t\tdata.folders = dt.value;\n\t\t});\n\t\tstore?.addListener({ field: \"appFolders.list\" }, (folderListErr, dt) => (data.foldersList = dt.value));\n\t\tstore?.addListener({ field: \"appDefinitions\" }, (appDefinitionsErr, dt) => (data.apps = dt.value));\n\t\tstore?.addListener({ field: \"activeFolder\" }, (activeFolderErr, dt) => {\n\t\t\tdata.activeFolder = dt.value;\n\t\t});\n\t\tstore?.addListener({ field: \"isFormVisible\" }, (visibilityErr, dt) => (data.isFormVisible = dt.value));\n\t\tstore?.addListener({ field: \"sortBy\" }, (sortErr, dt) => (data.sortBy = dt.value));\n\t\tstore?.addListener({ field: \"activeLauncherTags\" }, (launcherTagsErr, dt) => (data.tags = dt.value));\n\t\tstore?.addListener({ field: \"filterText\" }, (filterTextErr, dt) => (data.filterText = dt.value));\n\n\t\tFSBL.Clients.RouterClient.subscribe(\"Launcher.update\", (err, response) => {\n\t\t\tFSBL.Clients.Logger.debug(\"list updated\", err, response);\n\t\t\tif (err) {\n\t\t\t\treturn console.error(err);\n\t\t\t}\n\t\t\trefreshAppDefinitions(response.data.componentList);\n\t\t});\n\n\t\t// @deprecate in favor of SystemManagerClient.waitForStartup()\n\t\tFSBL.Clients.RouterClient.subscribe(\"Finsemble.Service.State.launcherService\", (unsubscribeErr) => {\n\t\t\tif (unsubscribeErr) {\n\t\t\t\tFSBL.Clients.Logger.error(\n\t\t\t\t\t\"App Launcher encountered an error unsubscribing from the launcher service\",\n\t\t\t\t\tunsubscribeErr\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tloadInstalledComponentsFromStore(() => {\n\t\t\t\t// We load our stored components(config driven) here\n\t\t\t\tloadInstalledConfigComponents(() => {\n\t\t\t\t\tupdateAppsInFolders(callback);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n}\n\n// This gets a specific app in FDC3 and returns the results\nfunction getApp(appID: string, cb = Function.prototype) {\n\tappd\n\t\t.get(appID)\n\t\t.then((app: any) => cb(null, app))\n\t\t.catch((err: StandardError) => cb(err));\n}\n/**\n * Ensures all 'apps' properties on folders conform\n * to the new structure (Array vs object)\n */\nfunction validateFolderDataStructure() {\n\tObject.keys(data.folders).forEach((folderName) => {\n\t\tconst folder = data.folders[folderName];\n\t\tif (!Array.isArray(folder.apps)) {\n\t\t\tconst warning =\n\t\t\t\t\"Application Launcher Persistent Store has data stored in deprecated format. Please check distributedStore configs\";\n\t\t\t// If the structure is wrong, notify the user in hopes that the foundation will be fixed\n\t\t\tFSBL.Clients.Logger.warn(warning);\n\t\t\tFSBL.UserNotification.alert(\"system\", \"ONCE-SINCE-STARTUP\", \"Distributed Store Type Mismatch\", warning);\n\t\t\tlet newApps: FolderAppType[] = [];\n\t\t\tObject.values(folder.apps).forEach((app: any) => {\n\t\t\t\tnewApps.push(app);\n\t\t\t});\n\t\t\tfolder.apps = newApps;\n\t\t}\n\t});\n\t_setFolders();\n}\n\n// Update apps in folders with updated config information\nfunction updateAppsInFolders(cb = Function.prototype) {\n\t// Loop through folders and update apps with new info\n\tconst { ADVANCED_APP_LAUNCHER: advancedAppLauncherFolderName } = getConstants();\n\tObject.keys(data.folders).forEach((folderName) => {\n\t\tif (folderName === advancedAppLauncherFolderName) return;\n\t\telse {\n\t\t\tconst folder = data.folders[folderName];\n\t\t\tObject.values(data.configComponents).forEach((configComp) => {\n\t\t\t\tlet index = -1;\n\t\t\t\tfolder.apps.forEach((folderApp, i) => {\n\t\t\t\t\tif (folderApp.appID.toString().trim() === configComp.appID.toString().trim()) {\n\t\t\t\t\t\tindex = i;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (index > -1) {\n\t\t\t\t\tdata.folders[folderName].apps.splice(index, 1, configComp);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n\t_setFolders(cb);\n}\n\n/**\n * Given a component config, will return tags, or an empty array.\n *\n * @param {*} componentConfig\n * @returns\n */\nfunction extractTagsFromFinsembleComponentConfig(componentConfig: ComponentDescriptor) {\n\tif (!componentConfig.foreign) return [];\n\tif (!componentConfig.foreign.components) return [];\n\tif (!componentConfig.foreign.components[\"App Launcher\"]) return [];\n\n\tconst { tags } = componentConfig.foreign.components[\"App Launcher\"];\n\n\tif (tags) {\n\t\tif (typeof tags === \"string\") {\n\t\t\treturn [tags];\n\t\t}\n\t\treturn tags;\n\t}\n\n\treturn [];\n}\n/**\n * Instantiates classes needed to interact with the appD server.\n * Only done when needed. If there are no components with source 'FDC3', this code will not execute.\n */\nfunction lazyLoadAppD() {\n\tif (!FDC3Client) FDC3Client = new FDC3({ url: appDEndpoint });\n\tif (!appd) appd = new AppDirectory(FDC3Client) as FDC3;\n}\n\n/**\n * Here we load apps from FDC3\n * @param {*} cb\n */\nfunction loadInstalledComponentsFromStore(cb = Function.prototype) {\n\tasync.map(\n\t\tObject.values(data.apps),\n\t\t(component: any, componentDone: any) => {\n\t\t\t// Load FDC3 components here\n\t\t\tif (component.source && component.source === \"FDC3\") {\n\t\t\t\tlazyLoadAppD();\n\t\t\t\t// get the app info so we can load it into the launcher\n\t\t\t\treturn getApp(component.appID, (err: StandardError) => {\n\t\t\t\t\tif (err) {\n\t\t\t\t\t\t// don't want to kill this;\n\t\t\t\t\t\tdeleteApp(component.appID);\n\t\t\t\t\t\tconsole.error(\"there was an error loading from FDC3\", component, err);\n\t\t\t\t\t}\n\t\t\t\t\treturn componentDone();\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Assumption - component is always a user defined component\n\t\t\t// when testing I was never able to get any other component types in this method\n\t\t\tFSBL.Clients.LauncherClient.addUserDefinedComponent(component, (compAddErr) => {\n\t\t\t\tif (compAddErr) {\n\t\t\t\t\tconsole.warn(\"Failed to add new app:\", compAddErr);\n\t\t\t\t}\n\t\t\t\tcomponentDone(compAddErr);\n\t\t\t});\n\t\t},\n\t\t(err: StandardError) => {\n\t\t\tcb(err);\n\t\t}\n\t);\n}\n\n// We load our apps that were loaded from the config.\nfunction loadInstalledConfigComponents(cb = Function.prototype) {\n\t// Get the list of components from the launcher service\n\tFSBL.Clients.LauncherClient.getComponentList((err, componentList) => {\n\t\t/*\n\t\t * Update the folders under the \"App\" menu and delete any apps in the folder\n\t\t * that are no longer in the config and are not user defined components.\n\t\t */\n\t\trefreshAppDefinitions(componentList || {});\n\t\tcb();\n\t});\n}\n\nfunction getApps() {\n\treturn data.apps;\n}\n\nfunction refreshAppDefinitions(componentList: ComponentList) {\n\tconst componentTypeList = Object.keys(componentList);\n\n\tconst { folders } = data;\n\t// Get the user defined apps\n\tconst apps = Object.keys(data.apps);\n\tObject.keys(folders).forEach((folderName) => {\n\t\tfolders[folderName].apps.forEach((configDefinedApp, i) => {\n\t\t\tconst { name, appID } = configDefinedApp;\n\t\t\t// If the component is not in the config component list and is not a user defined component\n\t\t\tif (!componentTypeList.includes(name) && !apps.includes(appID)) {\n\t\t\t\t// Delete app from the folder\n\t\t\t\tfolders[folderName].apps.splice(i, 1);\n\t\t\t}\n\t\t});\n\t});\n\n\t// removes component from the configComponents list if it has been removed from the config\n\tObject.values(data.configComponents).forEach((component) => {\n\t\tif (!componentTypeList.includes(component.name) && !apps.includes(component.appID)) {\n\t\t\tdelete data.configComponents[component.appID];\n\t\t}\n\t});\n\n\tcomponentTypeList.forEach((componentType) => {\n\t\tconst component = componentList?.[componentType];\n\t\tif (component && component.component) {\n\t\t\tconst launchableByUser = component?.foreign?.components?.[\"App Launcher\"]?.launchableByUser;\n\n\t\t\tconst displayName = component.component.displayName ?? componentType;\n\t\t\tconst iconObject = iconFromConfig(component?.foreign?.components?.Toolbar, displayName, component?.appDConfig);\n\t\t\t// Make sure the app is launchable by user\n\t\t\tif (launchableByUser && !component.component.isUserDefined) {\n\t\t\t\tdata.configComponents[componentType] = {\n\t\t\t\t\tappID: componentType,\n\t\t\t\t\ticon: iconObject,\n\t\t\t\t\tname: componentType,\n\t\t\t\t\tdisplayName,\n\t\t\t\t\tsource: \"config\",\n\t\t\t\t\ttags: extractTagsFromFinsembleComponentConfig(component),\n\t\t\t\t};\n\t\t\t} else if (!launchableByUser && data.configComponents[componentType]) {\n\t\t\t\tdelete data.configComponents[componentType];\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction _setValue(field: string, value: any, cb: any) {\n\tgetStore()?.setValue(\n\t\t{\n\t\t\tfield: field,\n\t\t\tvalue: value,\n\t\t},\n\t\t(error) => {\n\t\t\tif (error) {\n\t\t\t\tFSBL.Clients.Logger.error(`Advanced App Launcher: Failed to save: ${field}:${value}`);\n\t\t\t} else {\n\t\t\t\tcb && cb();\n\t\t\t}\n\t\t}\n\t);\n}\n\nfunction _setFolders(cb = Function.prototype) {\n\t_setValue(\"appFolders.folders\", data.folders, (err: StandardError) => {\n\t\tif (err) {\n\t\t\tFSBL.Clients.Logger.error(`Advanced App Launcher: Failed to set folders: ${err}`);\n\t\t\treturn;\n\t\t}\n\n\t\tcb();\n\t});\n}\n\nfunction _findAppIndexInFolders(appID: string, folderName: string) {\n\treturn findIndex(data.folders[folderName].apps, (app) => app.appID === appID);\n}\n\nfunction getFolders() {\n\treturn data.folders;\n}\n\nfunction getFoldersList() {\n\treturn data.foldersList;\n}\n\nfunction getAllApps() {\n\treturn Object.assign({}, data.apps, data.configComponents);\n}\n\nfunction getFormStatus() {\n\treturn data.isFormVisible;\n}\n\nfunction getSingleFolder(folderName: string) {\n\treturn data.folders[folderName];\n}\n\nfunction reorderFolders(destIndex: number, srcIndex: number) {\n\t// There are two types of folders: Those that can be arranged, and those that cannot. We don't want to reorder the folders relative to the unorderable folders. Split them out, and then combine them after doing the filtering/swapping.\n\tconst dragDisabled = getDragDisabled();\n\tconst unorderableFolders = data.foldersList.filter((folderName) => dragDisabled.includes(folderName));\n\tconst orderableFolders = data.foldersList.filter((folderName) => !dragDisabled.includes(folderName));\n\tconst movedFolder = orderableFolders[destIndex];\n\tconst remainingItems = orderableFolders.filter((item, index) => index !== destIndex);\n\tdata.foldersList = [\n\t\t...unorderableFolders,\n\t\t...remainingItems.slice(0, srcIndex),\n\t\tmovedFolder,\n\t\t...remainingItems.slice(srcIndex),\n\t];\n\t_setValue(\"appFolders.list\", data.foldersList, () => {});\n\treturn data.foldersList;\n}\n\nfunction addApp(app = <AppsType>{}, cb: any) {\n\tconst appID = `${new Date().getTime()}`;\n\tconst folder = data.activeFolder;\n\tconst newAppData = {\n\t\tappID,\n\t\ttags: app.tags,\n\t\tname: app.name,\n\t\turl: app.url,\n\t\ttype: \"component\",\n\t\tcanDelete: true,\n\t};\n\n\t/**\n\t * Note, the advanced app launcher can currently only keep track of apps that\n\t * are added by itself. Apps added by the basic launcher, or any other means,\n\t * will not be detected. A reconciliation process would need to be added that\n\t * listens on the distributed store similar to how the basic app launcher works.\n\t *\n\t * FSBL.Clients.RouterClient.subscribe(\"Launcher.update\", (err, response) => {\n\t\t\tFSBL.Clients.Logger.debug(\"list updated\", err, response);\n\t\t\tif (err) {\n\t\t\t\treturn console.error(err);\n\t\t\t}\n\t\t\tself.filterComponents(response.data.componentList);\n\t\t});\n\t */\n\tFSBL.Clients.LauncherClient.addUserDefinedComponent(newAppData, (compAddErr) => {\n\t\tif (compAddErr) {\n\t\t\tcb({ code: \"failed_to_add_app\", message: compAddErr });\n\t\t\tconsole.warn(\"Failed to add new app:\", compAddErr);\n\t\t\treturn;\n\t\t}\n\t\tdata.apps[appID] = newAppData;\n\n\t\t// Add to ADVANCED_APP_LAUNCHER folder\n\t\tdata.folders[ADVANCED_APP_LAUNCHER].apps.push(newAppData);\n\n\t\t// Check if we need to add to another folder as well\n\t\tif (folder !== ADVANCED_APP_LAUNCHER) {\n\t\t\tdata.folders[folder].apps.push(newAppData);\n\t\t}\n\t\t// Save appDefinitions and then folders\n\t\t_setValue(\"appDefinitions\", data.apps, () => {\n\t\t\t_setFolders();\n\t\t\tcb && cb();\n\t\t});\n\t});\n}\n\nfunction deleteApp(appID: string) {\n\t// Delete app from any folder that has it\n\tfor (const key in data.folders) {\n\t\tconst appIndex = _findAppIndexInFolders(appID, key);\n\t\tdata.folders[key].apps.splice(appIndex, 1);\n\t}\n\n\t// Delete app from the apps list\n\tFSBL.Clients.LauncherClient.removeUserDefinedComponent(data.apps[appID], () => {\n\t\tdelete data.apps[appID];\n\t\t// Save appDefinitions and then folders\n\t\t_setValue(\"appDefinitions\", data.apps, () => {\n\t\t\t_setFolders();\n\t\t});\n\t});\n}\n\nfunction addNewFolder(name?: string) {\n\t// Each new folder is given a number, lets store them here\n\t// to get the highest one and then increment\n\t// result of this will be [0, 1, 2] etc\n\tconst newFoldersNums = [\n\t\t0,\n\t\t// Find folders that have a name of \"New folder\" or \"New folder #\"\n\t\t...data.foldersList\n\t\t\t.filter((folder) => folder.startsWith(NEW_FOLDER_NAME))\n\t\t\t.map((folder) => {\n\t\t\t\tconst numbers: any[] = folder.match(/\\d+/g) || [];\n\t\t\t\treturn Math.max(...numbers);\n\t\t\t}),\n\t];\n\tconst highestFolderNumber = Math.max(...newFoldersNums);\n\tconst folderName: string = name ?? `${NEW_FOLDER_NAME} ${highestFolderNumber + 1}`;\n\tconst newFolder = {\n\t\tdisableUserRemove: true,\n\t\ticon: \"ff-adp-hamburger\",\n\t\tcanEdit: true,\n\t\tcanDelete: true,\n\t\tapps: [],\n\t};\n\tdata.folders[folderName] = newFolder;\n\t_setFolders(() => {\n\t\t// Update folders order if adding was successful\n\t\tdata.foldersList.push(folderName);\n\t\t_setValue(\"appFolders.list\", data.foldersList, () => {});\n\t});\n}\n\nfunction deleteFolder(folderName: string) {\n\t// Check if user is trying to delete the active folder\n\tif (folderName === data.activeFolder) {\n\t\tdata.activeFolder = ADVANCED_APP_LAUNCHER;\n\t\t_setValue(\"activeFolder\", data.activeFolder, () => {});\n\t}\n\n\tdelete data.folders[folderName] &&\n\t\t_setFolders(() => {\n\t\t\t// Update the order of folders\n\t\t\tconst index = data.foldersList.indexOf(folderName);\n\t\t\tdata.foldersList.splice(index, 1);\n\t\t\t_setValue(\"appFolders.list\", data.foldersList, () => {});\n\t\t});\n}\n\nfunction renameFolder(oldName: string, newName: string) {\n\tlet indexOfOld = data.foldersList.findIndex((folderName) => folderName === oldName);\n\n\tif (indexOfOld > -1) {\n\t\tlet oldFolder = data.folders[oldName];\n\t\tdata.folders[newName] = oldFolder;\n\t\tdata.foldersList.splice(indexOfOld, 1, newName);\n\n\t\t_setFolders(() => {\n\t\t\t_setValue(\"appFolders.list\", data.foldersList, () => {});\n\n\t\t\tif (data.activeFolder === oldName) {\n\t\t\t\t_setValue(\"activeFolder\", newName, () => {});\n\t\t\t}\n\n\t\t\tdelete data.folders[oldName];\n\t\t});\n\t}\n}\n\nfunction addAppToFolder(folderName: string, app: FolderAppType) {\n\tconst appIndex = _findAppIndexInFolders(app.appID, folderName);\n\n\tif (appIndex < 0) {\n\t\tdata.folders[folderName].apps.push({\n\t\t\tname: app.name,\n\t\t\tdisplayName: app.displayName,\n\t\t\tappID: app.appID,\n\t\t});\n\t\t_setFolders();\n\t}\n}\n\nfunction removeAppFromFolder(folderName: string, app: FolderAppType) {\n\tconst appIndex = _findAppIndexInFolders(app.appID, folderName);\n\tdata.folders[folderName].apps.splice(appIndex, 1);\n\t_setFolders();\n}\n\nfunction getAllAppsFromFolder(folderName: string) {\n\treturn data.folders[folderName].apps;\n}\n\n/**\n * Given a field, search through FDC3 apps and apps pulled in via config and return that app.\n * */\nfunction findAppByField(field: keyof AppsType | keyof ConfigType, value: any) {\n\treturn (\n\t\tObject.values(data.apps).find((app) => (app ? (app as any)[field] === value : false)) ||\n\t\tObject.values(data.configComponents).find((app) => (app ? (app as any)[field] === value : false))\n\t);\n}\n\nfunction getActiveFolder() {\n\tconst folder = data.folders[data.activeFolder];\n\n\tif (!folder) {\n\t\tFSBL.Clients.Logger.error(`activeFolder:\"${data.activeFolder}\" not found! Defaulting to empty folder`);\n\t\treturn {\n\t\t\tname: data.activeFolder,\n\t\t\tapps: [],\n\t\t};\n\t}\n\n\tObject.values(folder.apps).forEach((app) => {\n\t\tconst appData = findAppByField(\"appID\", app.appID);\n\t\tif (!appData) {\n\t\t\tapp.tags = [];\n\t\t} else {\n\t\t\tapp.tags = appData.tags;\n\t\t}\n\t});\n\t// Need a name for the AppDefinition/AppActionsMenu rendering\n\tfolder.name = data.activeFolder;\n\treturn folder;\n}\n\nfunction getActiveFolderName() {\n\treturn data.activeFolder;\n}\n\nfunction getSearchText() {\n\treturn data.filterText;\n}\n\nfunction getSortBy() {\n\treturn data.sortBy;\n}\n\nfunction getTags() {\n\treturn data.tags;\n}\n\nfunction getAllAppsTags() {\n\tlet tags: any[] = [];\n\t// Pull tags from applications installed via FDC3 and the component config.\n\tconst apps = Object.values(data.apps).concat(Object.values(data.configComponents) as any);\n\n\tapps.forEach((app) => {\n\t\ttags = tags.concat(app.tags);\n\t});\n\t// return unique ones only\n\treturn tags.filter((tag, index) => tags.indexOf(tag) === index);\n}\n\nfunction addTag(tag: string) {\n\t// Push new tag to list\n\tdata.tags.indexOf(tag) < 0 && data.tags.push(tag);\n\t// Update tags in store\n\t_setValue(\"activeLauncherTags\", data.tags, () => {});\n}\n\nfunction deleteTag(tag: string) {\n\t// Push new tag to list\n\tdata.tags.splice(data.tags.indexOf(tag), 1);\n\t// Update tags in store\n\t_setValue(\"activeLauncherTags\", data.tags, () => {});\n}\n"]}
@@ -67,6 +67,7 @@ function EditTab(props) {
67
67
  }
68
68
  };
69
69
  const clickHandler = () => {
70
+ var _a;
70
71
  const allowWindowTitleRenaming = Store.getValue("allowWindowTitleRenaming");
71
72
  if (clickTimeout) {
72
73
  // double click
@@ -81,8 +82,12 @@ function EditTab(props) {
81
82
  setClickTimeout(undefined);
82
83
  }, 500);
83
84
  setClickTimeout(timeout);
84
- if (props.setActiveTab)
85
+ // Only call props.setActiveTab IFF this current tab is NOT the current tab
86
+ // This prevents white flashes/renders while clicking on an actibe tab
87
+ if (((_a = props.windowIdentifier) === null || _a === void 0 ? void 0 : _a.windowName) !== FSBL.Clients.WindowClient.getCurrentWindow().name &&
88
+ !!props.setActiveTab) {
85
89
  props.setActiveTab();
90
+ }
86
91
  }
87
92
  };
88
93
  const blurHandler = (e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"windowTitle.js","sourceRoot":"","sources":["../../../../src/components/windowTitleBar/components/windowTitle.tsx"],"names":[],"mappings":";;;;;;AAGA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAgDtD,mEAAmE;AACnE,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAClD,8CAA8C;AAC9C,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAEpD,mCAAmC;AACnC,IAAI,kBAAuB,CAAC;AAE5B;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,KAAK,IAAI,EAAE;IACxC,IAAI,CAAC,kBAAkB,EAAE;QACxB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,iBAAiB,CAAC;YACjF,KAAK,EAAE,sBAAsB;SAC7B,CAAC,CAAC;QACH,kBAAkB,GAAG,KAAK,CAAC;KAC3B;IAED,mBAAmB;IACnB,OAAO,kBAAkB,CAAC;AAC3B,CAAC,CAAC;AAEF;;;GAGG;AACH,SAAS,OAAO,CAAC,KAAmB;IACnC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAA6B,SAAS,CAAC,CAAC;IAC9F,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAC;IAErD,MAAM,cAAc,GAAG,KAAK,EAAE,CAA6E,EAAE,EAAE;QAC9G,qFAAqF;QAErF,gBAAgB;QAChB,MAA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ACH,KAAK;IACJ,wCAAwC;IACxC,MAAM,KAAK,GAAG,MAAM,qBAAqB,EAAE,CAAC;IAC5C,mEAAmE;IACnE,IAAI,CAAC,KAAK,EAAE;QACX,oDAAoD;QACpD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QACzF,OAAO;KACP;IACD,KAAK,CAAC,cAAc,CACnB,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,EAAE,EACjD,IAAI,CAAC,4BAA4B,EACjC,CAAC,GAAkB,EAAE,QAA6B,EAAE,EAAE;QACrD,IAAI,CAAC,CAAC,GAAG,EAAE;YACV,qGAAqG;YACrG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CACvB,yCAAyC,sBAAsB,gBAAgB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,GAAG,EACxH,GAAG,CACH,CAAC;YACF,OAAO;SACP;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CACxB,8BAA8B,sBAAsB,gBAAgB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,GAAG,CAC7G,CAAC;IACH,CAAC,CACD,CAAC;AACH,CAAC","sourcesContent":["import { WindowIdentifier, WindowDescriptor, services } from \"@finsemble/finsemble-api\";\nimport { ListenerFunction } from \"@finsemble/finsemble-api/types/clients/StoreModel\";\nimport { StandardError } from \"@finsemble/finsemble-api/types/types\";\nimport React, { Component } from \"react\";\nimport { EditTabProps } from \"../../../types/windowTitleBar\";\nimport { Icon } from \"../../icon/Icon\";\nimport { Store } from \"../stores/windowTitleBarStore\";\n\ntype IconDescriptor = services.window.types.IconDescriptor;\n\n/**\n * TAB TITLES: HOW DO THEY WORK?\n *\n * Each component, when stacked, will have several tab titles. For each component, there is a window. For each window, there are 2 tab titles per component.\n *\n * Whichever component is \"active\" will render all tabs - exactly one \"active\" tab and n-1 \"inactive\" tabs (where n is the number of components in the stack). When\n * the active component is changed (via a click, for example), then the visible window becomes the window associated with the active component.\n *\n * Tab titles may change at any time, and for a number of reasons. For example, the component may execute \"document.title='...some title'\". Or perhaps the tab title has\n * been edited by the user. In order to account for all title changes, the following flow is used:\n * *something* updates document.title\n * The WindowClient for the component will notice the title change and send a router message (via FinsembleWindow.setTitle) with a topic representitive of the windowName\n * BaseWindow listens to router changes on the same topic and updates a DistributedStore dedicated to tab names\n * The tab components all subscribe to the DistributedStore dedicated to tab names and will update the title accordingly\n *\n * This is a \"one-way\" operation; that is to say that some code will ultimately alter the DistributedStore and the tab title components will read the changes. While this generally\n * happens with a write to document.title, it can also happen when a user edits the tab title manually. In this case, the component state is altered with a field \"persistedTitle\"\n * whose value is the edited title. At render time, the tab title component will use any value in \"persistedTitle\" as the title, irregardless of any other value.\n *\n * NOTE: A tab may be edited only when it is the active component; ergo the call to \"setComponentState\" is safe.\n */\n\n/**\n * WINDOW TITLES: HOW DO THEY WORK?\n *\n * Each application window has a title which is displayed in the operating system taskbar and task switcher. This title comes from the\n * value of \"document.title\" in the window title bar component. It is important to understand that when tabs are stacked, the actual window\n * which holds the window title is the title of the window of the active component. It is therefore important to keep the window title and the\n * tab titles up to date and synchronized.\n */\n\ntype TitleProps = {\n\twindowIdentifier: WindowIdentifier;\n\tonUpdate?: Function;\n\ttitleWidth?: number;\n\tonClick?: () => void;\n};\n\ntype TitleState = {\n\ttitle: string | undefined;\n\ticon: any;\n\twindowName?: string;\n};\n\n// The store name for the distributed store which tracks tab titles\nconst WINDOW_TAB_TITLE_STORE = \"window-tab-title\";\n// The field name to watch for tab title edits\nconst FIELD_NAME_PERSISTED_TITLE = \"persistedTitle\";\n\n// The windowTabNameStore reference\nlet windowTabNameStore: any;\n\n/**\n * Gets the store which tracks the tab title for a windowName. This is a distributed store shared by all components.\n *\n * @returns a Promise which resolves the StoreModel associated with window and tab names\n */\nconst getWindowTabNameStore = async () => {\n\tif (!windowTabNameStore) {\n\t\tlet { data: store } = await FSBL.Clients.DistributedStoreClient.createGlobalStore({\n\t\t\tstore: WINDOW_TAB_TITLE_STORE,\n\t\t});\n\t\twindowTabNameStore = store;\n\t}\n\n\t// Return the store\n\treturn windowTabNameStore;\n};\n\n/**\n * The wrapper component for tab renaming\n * @param {*} props\n */\nfunction EditTab(props: EditTabProps) {\n\tconst [editingTitle, setEditingTitle] = React.useState(false);\n\tconst [clickTimeout, setClickTimeout] = React.useState<NodeJS.Timeout | undefined>(undefined);\n\tconst inputEl = React.useRef<HTMLInputElement>(null);\n\n\tconst updateTabTitle = async (e: React.KeyboardEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement>) => {\n\t\t// When the tab title has changed via a user edit, simply update the DistributedStore\n\n\t\t// Get the title\n\t\tconst title = (e.target as HTMLInputElement).value;\n\n\t\t// Get the tab name store\n\t\tlet store = await getWindowTabNameStore();\n\t\t// If the store is unavailable, then the tab name cannot be persisted\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error persisting tab title via EditTab: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Persist the tab title\n\t\tstore.setValue({ field: props.windowIdentifier.windowName, value: title });\n\n\t\t// Get the window which coresponds to the tab being edited\n\t\tconst { wrap: win } = await FSBL.FinsembleWindow.getInstance(props.windowIdentifier);\n\n\t\t// Set the component state \"persistedTitle\" (which is the edited title)\n\t\tFSBL.Clients.Logger.debug(`Setting component state \"${FIELD_NAME_PERSISTED_TITLE}\" with value \"${title}\"`);\n\t\tawait win.setComponentState({ field: FIELD_NAME_PERSISTED_TITLE, value: title });\n\n\t\t// Stop editing in all cases\n\t\tsetEditingTitle(false);\n\t};\n\n\tconst beginEditing = async () => {\n\t\tawait setEditingTitle(true);\n\t\tinputEl?.current?.focus();\n\t\tif (inputEl?.current) {\n\t\t\tinputEl.current.value = props.title ?? \"\";\n\t\t}\n\t};\n\n\tconst clickHandler = () => {\n\t\tconst allowWindowTitleRenaming = Store.getValue(\"allowWindowTitleRenaming\");\n\n\t\tif (clickTimeout) {\n\t\t\t// double click\n\t\t\tif (allowWindowTitleRenaming) {\n\t\t\t\tbeginEditing();\n\t\t\t}\n\t\t} else if (!editingTitle) {\n\t\t\t// single click\n\t\t\tlet timeout = setTimeout(() => {\n\t\t\t\tclearTimeout(clickTimeout);\n\t\t\t\tsetClickTimeout(undefined);\n\t\t\t}, 500);\n\t\t\tsetClickTimeout(timeout);\n\t\t\tif (props.setActiveTab) props.setActiveTab();\n\t\t}\n\t};\n\n\tconst blurHandler = (e: React.FocusEvent<HTMLInputElement>) => {\n\t\tupdateTabTitle(e);\n\t};\n\n\tconst keyDownHandler = (e: React.KeyboardEvent<HTMLInputElement>) => {\n\t\te.key === \"Enter\" && updateTabTitle(e);\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"fsbl-tab-editor\"\n\t\t\t// We can't use Click and Dblclick events together cause for one dblclick fires two click events which close title editor.\n\t\t\t// Workaround with setTimeout should resolve this behavior.\n\t\t\tonClick={clickHandler}\n\t\t>\n\t\t\t{editingTitle ? (\n\t\t\t\t<div className=\"fsbl-tab fsbl-active-tab\" style={{ width: props.tabWidth || \"auto\" }}>\n\t\t\t\t\t{/* workaround to disable tab dragging in the edit mode */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tdraggable={true}\n\t\t\t\t\t\tonDragStart={(e) => {\n\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tid=\"title_editor_input\"\n\t\t\t\t\t\t\tref={inputEl}\n\t\t\t\t\t\t\tonBlur={blurHandler}\n\t\t\t\t\t\t\tonKeyDown={keyDownHandler}\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tclassName=\"tab__input\"\n\t\t\t\t\t\t\tmaxLength={32}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\tprops.children\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\n/*\n * Description how stacked window tabs work.\n *\n * The simplest case - when you have only 2 tabs. In that case you will actually have 2 windows and 4 tabs.\n * Lets call them as: window 1 - w1, window 2 - w2, tab 1 from window 1 - w1_t1, tab 2 from window 1 - w1_t2, for tabs from window 2 - w2_t1 and w2_t2.\n * When you switch tabs you activate w1 or w2 with active tab w1_t1 or w2_t2 correspondingly.\n * Tabs w1_t2 and w2_t1 are inactive. They needed only for rendering. I call them as remote tabs, cause their titles must be synchronized with active tabs titles.\n * Thus when you rename active tab (w1_t1), the corresponding remote tab (w2_t1) should be updated automatically.\n */\n\nexport class Title extends Component<TitleProps, TitleState> {\n\t// The listener for tab title change events via the DistributedStoreClient, kept as a reference so\n\t// that the listener can be deregistered when the component is unmounted\n\ttabTitleChangedStoreListener: ListenerFunction = (err: StandardError, response: { field: string; value: string }) => {\n\t\tif (!!err) {\n\t\t\t// This is not critical; in the worst case this tab title will be stale\n\t\t\tFSBL.Clients.Logger.warn(\n\t\t\t\t`Listener error for store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`,\n\t\t\t\terr\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Log a message\n\t\tFSBL.Clients.Logger.debug(\n\t\t\t`Store \"${WINDOW_TAB_TITLE_STORE}\" notified of new title \"${response.value}\" for window \"${response.field}\"`\n\t\t);\n\n\t\t// Invoke updateTitle\n\t\tif (!!this._mounted) {\n\t\t\tthis.updateTitle();\n\t\t}\n\t};\n\n\t// Flag to determine if this instance is currently mounted; this is necessary because:\n\t// 1.) Title components are mounted and unmounted as an artifact of how the tab or tab list is rendered\n\t// 2.) Keeping tab titles synchronized is an asynchronous process\n\t// 3.) During the asynchronous process of tab title synchronization, a call to setState is made and\n\t// that raises a React warning since the component state cannot be changed while the component\n\t// is unmounted\n\t_mounted = false;\n\n\tconstructor(props: TitleProps) {\n\t\tsuper(props);\n\n\t\t// Declare the initial title as a blank string\n\t\tlet initialTitle = \" \";\n\n\t\t// If the currently rendering tab represents the current window, then use the document title (or window name)\n\t\tif (\n\t\t\tundefined !== finsembleWindow?.thisWindowName &&\n\t\t\tfinsembleWindow?.thisWindowName === props?.windowIdentifier?.windowName\n\t\t) {\n\t\t\tinitialTitle = document.title || props.windowIdentifier?.windowName;\n\t\t}\n\n\t\tthis.state = {\n\t\t\t// Use document.title first to prevent a title flickering when dragging a tab of another window.\n\t\t\t// The reason for flickering is the component re-rendering multiple times. The initial place\n\t\t\t// where re-rendering start is the `disallowDragOnCenterRegion()` at the WindowTitleBarShell.\n\t\t\t// At that function, we change the state of the parent component which triggers re-rendering for the children tree.\n\t\t\ttitle: initialTitle,\n\t\t\ticon: null,\n\t\t\t// The \"windowName\" is the name of the window which corresponds to the this instance of the\n\t\t\t// Title component, though the actual current window may belong to some other\n\t\t\t// component(ie this tab represents an inactive window)\n\t\t\twindowName: props.windowIdentifier?.windowName,\n\t\t};\n\n\t\t// Bind the \"updateTitle\" function (in order to use React component functions)\n\t\tthis.updateTitle = this.updateTitle.bind(this);\n\n\t\t// Initial title set\n\t\tthis.updateTitle();\n\t}\n\n\t/**\n\t * Gets a reference to the \"Window Manager\" component for the tab which is rendering. If the this tab IS the active tab, then the WindowManager will be the same as the WindowManager\n\t * attached to the WindowClient. However, all other tab components displayed in this window will need to derive the WindowManager from the config, based on the\n\t * tab's windowIdentifier.\n\t *\n\t * This is because the tab's windowIdentifier only has the name (ex: SomeApp-37ba6708-3a75-462e-b900-1812e338cbf1). The name is derived by removing the last 5 substrings\n\t * separated by \"-\". This will fail in the face of a UUID format change.\n\t *\n\t * @returns the \"Window Manager\" component, or \"undefined\" if the \"Window Manager\" is not found\n\t */\n\tasync #getWindowManagerForTab() {\n\t\t// On second thought, ALL tabs will derive the WindowManager the same way; at least if it is wrong, it is wrong consistently\n\t\t//\n\t\t// if (finsembleWindow.thisWindowName === this.props?.windowIdentifier?.windowName) {\n\t\t// \treturn FSBL.Clients.WindowClient.options?.customData?.foreign?.components?.[\"Window Manager\"] || FSBL.Clients.WindowClient.options?.customData?.appDConfig?.manifest?.foreign?.components?.[\"Window Manager\"];\n\t\t// } else {\n\n\t\t// Check that \"windowName\" exists\n\t\tif (!!this.props?.windowIdentifier?.windowName) {\n\t\t\t// Get the window name\n\t\t\tconst tabsWindowName = this.props.windowIdentifier.windowName;\n\t\t\t// Get the active descriptors\n\t\t\tconst { data: activeDescriptors } = await FSBL.Clients.LauncherClient.getActiveDescriptors();\n\t\t\t// Return the \"Window Manager\" for the window whose name matches THIS tab's name\n\t\t\treturn activeDescriptors?.[tabsWindowName]?.customData?.appDConfig?.manifest?.foreign?.components?.[\n\t\t\t\t\"Window Manager\"\n\t\t\t];\n\t\t}\n\n\t\treturn undefined;\n\t\t// }\n\t}\n\n\t/**\n\t * Calculates a tab title. Uses the following algorithm until a non-null value is found.\n\t * <ol>\n\t * <li>user edited tab title</li>\n\t * <li>the component config</li>\n\t * <li>document.title</li>\n\t * <li>appd config</li>\n\t * </ol>\n\t *\n\t * @returns the calculated tab title\n\t */\n\tasync #calculateTabTitle() {\n\t\treturn (\n\t\t\t(await this.#getUserEditedTitle()) ||\n\t\t\t(await this.#getConfigTitle()) ||\n\t\t\t(await this.#getDocumentTitle()) ||\n\t\t\tthis.#getAppDTitle()\n\t\t);\n\t}\n\n\t/**\n\t * Returns the name of the title supplied by a user; undefined if the user has not supplied a title.\n\t *\n\t * @returns The name of the title supplied by a user; undefined if the user has not supplied a title\n\t */\n\tasync #getUserEditedTitle() {\n\t\tconst { wrap: tabWindow } = await FSBL.FinsembleWindow.getInstance(this.props.windowIdentifier);\n\t\treturn new Promise((resolve) => {\n\t\t\ttabWindow.getComponentState({ field: FIELD_NAME_PERSISTED_TITLE }, (error: any, persistedTitle: any) => {\n\t\t\t\tif (!!error) {\n\t\t\t\t\t// should always return value even if it hasn't been retrieved from the state\n\t\t\t\t\tresolve(undefined);\n\t\t\t\t} else {\n\t\t\t\t\tresolve(persistedTitle);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Gets a title set in the component configuration.\n\t *\n\t * @returns any title set in the component configuration\n\t */\n\tasync #getConfigTitle() {\n\t\tconst windowManager = await this.#getWindowManagerForTab();\n\t\treturn windowManager?.FSBLHeader?.title || windowManager?.title;\n\t}\n\n\t/**\n\t * Returns document.title.\n\t *\n\t * @returns the document.title (from the \"tab name\" store)\n\t */\n\tasync #getDocumentTitle() {\n\t\tconst store = await getWindowTabNameStore();\n\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error setting the tab title: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.props?.windowIdentifier?.windowName\n\t\t\t? (await store.getGlobalValue(this.props.windowIdentifier.windowName)).data\n\t\t\t: undefined;\n\t}\n\n\t/**\n\t * Gets the AppD configuration\n\t *\n\t * @returns The AppD name\n\t */\n\t#getAppDTitle() {\n\t\treturn (\n\t\t\tFSBL.Clients.WindowClient.options?.customData?.appDConfig?.manifest?.component?.displayName ||\n\t\t\tFSBL.Clients.WindowClient.options?.customData?.appDConfig?.name\n\t\t);\n\t}\n\n\t/**\n\t * Updates the title for both the tab and the window.\n\t *\n\t * @returns a Promise which resolves nothing\n\t */\n\tasync updateTitle() {\n\t\t// There is a subtle difference bewtween windowTitle and tabTitle. Since this code executes\n\t\t// when *any* tab has a name change, this code can execute when the active window represents\n\t\t// a tab other than the currently rendering tab (ie an inactive tab).\n\n\t\t// The window represented by this tab title instance\n\t\tconst { wrap: tabWindow } = await FSBL.FinsembleWindow.getInstance(this.props.windowIdentifier);\n\n\t\t// \"tabWindowOptions\" refers to the options from the window which hosts the component represented by this tab\n\t\tconst { data: tabWindowOptions } = await tabWindow.getOptions();\n\n\t\t// Derive the title: \"config title\" then \"document.title\" then \"appd title\"\n\t\tlet title = await this.#calculateTabTitle();\n\n\t\t// Get the titleBar icon from the WindowDescriptor for the TAB window (not the CURRENT window)\n\t\tconst icon: IconDescriptor = (tabWindowOptions as WindowDescriptor)?.icons?.titleBarIcon ?? {\n\t\t\timageType: \"initials\",\n\t\t\tname: title,\n\t\t};\n\n\t\t// Log a message\n\t\tFSBL.Clients.Logger.debug(`Setting tab title ${title} for window ${this.props.windowIdentifier.windowName}`);\n\n\t\t// Finally, set the state if the component is mounted\n\t\tif (!!this._mounted) {\n\t\t\tthis.setState({\n\t\t\t\ttitle,\n\t\t\t\ticon: {\n\t\t\t\t\t...icon,\n\t\t\t\t\t// Application causes the background to default to a circle rather than a square\n\t\t\t\t\tcategory: \"Application\",\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// If this tab component instance represents the window (that is, this is the active tab), then set the title\n\t\tif (finsembleWindow.thisWindowName === this.props.windowIdentifier.windowName) {\n\t\t\tdocument.title = await this.#calculateTabTitle();\n\t\t}\n\t}\n\n\t/**\n\t * Adds the listener(s) required to set window and tab titles.\n\t */\n\tasync #addListeners() {\n\t\t// Subscribe to the DistributedStoreClient (these messages originate from BaseWindow, when the\n\t\t// DistributedStore has been updated).\n\t\t//\n\t\t// Each window will have n listeners, where n is the number of tabs held in the window.\n\n\t\t// Get the store and add a listener\n\t\tconst store = await getWindowTabNameStore();\n\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error adding a tab title listener: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Add a listener\n\t\tstore.addListener({ field: this.props.windowIdentifier.windowName }, this.tabTitleChangedStoreListener, () => {\n\t\t\tFSBL.Clients.Logger.debug(\n\t\t\t\t`Added listener to store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Removes listener(s) required to set window and tab titles.\n\t */\n\tasync #removeListeners() {\n\t\t// Unsubscribe from the window/tab store\n\t\tconst store = await getWindowTabNameStore();\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error removing a tab title listener: the store was not found\");\n\t\t\treturn;\n\t\t}\n\t\tstore.removeListener(\n\t\t\t{ field: this.props.windowIdentifier.windowName },\n\t\t\tthis.tabTitleChangedStoreListener,\n\t\t\t(err: StandardError, response: boolean | undefined) => {\n\t\t\t\tif (!!err) {\n\t\t\t\t\t// This is not critical; the listener could not be removed from the store - this may be a memory leak\n\t\t\t\t\tFSBL.Clients.Logger.warn(\n\t\t\t\t\t\t`Could not remove listener from store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`,\n\t\t\t\t\t\terr\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tFSBL.Clients.Logger.debug(\n\t\t\t\t\t`Removed listener to store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * React component lifecycle event, triggered once the component has been added to the DOM.\n\t */\n\tcomponentDidMount() {\n\t\t// Set the mounted flag to true (this component is currently mounted)\n\t\tthis._mounted = true;\n\n\t\t// Add listeners\n\t\tthis.#addListeners();\n\t}\n\n\t// Triggers a re-rendering of the drag handle in the title bar.\n\tcomponentDidUpdate() {\n\t\tif (typeof this.props.onUpdate === \"function\") {\n\t\t\tthis.props.onUpdate();\n\t\t}\n\t}\n\n\t/**\n\t * React component lifecycle event, triggered before the component is removed from the DOM.\n\t */\n\tcomponentWillUnmount() {\n\t\t// Set the mounted flag to false (this component is not currently mounted)\n\t\tthis._mounted = false;\n\n\t\t// Remove listeners\n\t\tthis.#removeListeners();\n\t}\n\n\trender() {\n\t\tconst { titleWidth } = this.props;\n\t\tconst style = titleWidth ? { width: titleWidth } : {};\n\t\treturn (\n\t\t\t<EditTab\n\t\t\t\ttabWidth={titleWidth}\n\t\t\t\tsetActiveTab={this?.props?.onClick}\n\t\t\t\ttitle={this.state.title}\n\t\t\t\t// The windowIdentifier indicates which app/component this tab instance should represent\n\t\t\t\twindowIdentifier={this.props.windowIdentifier}\n\t\t\t>\n\t\t\t\t<div className=\"fsbl-tab-title\" style={style}>\n\t\t\t\t\t{this.state.icon && <Icon {...this.state.icon} />}\n\t\t\t\t\t<div className=\"title-text\">{this.state.title}</div>\n\t\t\t\t</div>\n\t\t\t</EditTab>\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"windowTitle.js","sourceRoot":"","sources":["../../../../src/components/windowTitleBar/components/windowTitle.tsx"],"names":[],"mappings":";;;;;;AAGA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAgDtD,mEAAmE;AACnE,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAClD,8CAA8C;AAC9C,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAEpD,mCAAmC;AACnC,IAAI,kBAAuB,CAAC;AAE5B;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,KAAK,IAAI,EAAE;IACxC,IAAI,CAAC,kBAAkB,EAAE;QACxB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,iBAAiB,CAAC;YACjF,KAAK,EAAE,sBAAsB;SAC7B,CAAC,CAAC;QACH,kBAAkB,GAAG,KAAK,CAAC;KAC3B;IAED,mBAAmB;IACnB,OAAO,kBAAkB,CAAC;AAC3B,CAAC,CAAC;AAEF;;;GAGG;AACH,SAAS,OAAO,CAAC,KAAmB;IACnC,MAAM,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AAC,UAAU,GAAG,CAC7G,CAAC;IACH,CAAC,CACD,CAAC;AACH,CAAC","sourcesContent":["import { WindowIdentifier, WindowDescriptor, services } from \"@finsemble/finsemble-api\";\nimport { ListenerFunction } from \"@finsemble/finsemble-api/types/clients/StoreModel\";\nimport { StandardError } from \"@finsemble/finsemble-api/types/types\";\nimport React, { Component } from \"react\";\nimport { EditTabProps } from \"../../../types/windowTitleBar\";\nimport { Icon } from \"../../icon/Icon\";\nimport { Store } from \"../stores/windowTitleBarStore\";\n\ntype IconDescriptor = services.window.types.IconDescriptor;\n\n/**\n * TAB TITLES: HOW DO THEY WORK?\n *\n * Each component, when stacked, will have several tab titles. For each component, there is a window. For each window, there are 2 tab titles per component.\n *\n * Whichever component is \"active\" will render all tabs - exactly one \"active\" tab and n-1 \"inactive\" tabs (where n is the number of components in the stack). When\n * the active component is changed (via a click, for example), then the visible window becomes the window associated with the active component.\n *\n * Tab titles may change at any time, and for a number of reasons. For example, the component may execute \"document.title='...some title'\". Or perhaps the tab title has\n * been edited by the user. In order to account for all title changes, the following flow is used:\n * *something* updates document.title\n * The WindowClient for the component will notice the title change and send a router message (via FinsembleWindow.setTitle) with a topic representitive of the windowName\n * BaseWindow listens to router changes on the same topic and updates a DistributedStore dedicated to tab names\n * The tab components all subscribe to the DistributedStore dedicated to tab names and will update the title accordingly\n *\n * This is a \"one-way\" operation; that is to say that some code will ultimately alter the DistributedStore and the tab title components will read the changes. While this generally\n * happens with a write to document.title, it can also happen when a user edits the tab title manually. In this case, the component state is altered with a field \"persistedTitle\"\n * whose value is the edited title. At render time, the tab title component will use any value in \"persistedTitle\" as the title, irregardless of any other value.\n *\n * NOTE: A tab may be edited only when it is the active component; ergo the call to \"setComponentState\" is safe.\n */\n\n/**\n * WINDOW TITLES: HOW DO THEY WORK?\n *\n * Each application window has a title which is displayed in the operating system taskbar and task switcher. This title comes from the\n * value of \"document.title\" in the window title bar component. It is important to understand that when tabs are stacked, the actual window\n * which holds the window title is the title of the window of the active component. It is therefore important to keep the window title and the\n * tab titles up to date and synchronized.\n */\n\ntype TitleProps = {\n\twindowIdentifier: WindowIdentifier;\n\tonUpdate?: Function;\n\ttitleWidth?: number;\n\tonClick?: () => void;\n};\n\ntype TitleState = {\n\ttitle: string | undefined;\n\ticon: any;\n\twindowName?: string;\n};\n\n// The store name for the distributed store which tracks tab titles\nconst WINDOW_TAB_TITLE_STORE = \"window-tab-title\";\n// The field name to watch for tab title edits\nconst FIELD_NAME_PERSISTED_TITLE = \"persistedTitle\";\n\n// The windowTabNameStore reference\nlet windowTabNameStore: any;\n\n/**\n * Gets the store which tracks the tab title for a windowName. This is a distributed store shared by all components.\n *\n * @returns a Promise which resolves the StoreModel associated with window and tab names\n */\nconst getWindowTabNameStore = async () => {\n\tif (!windowTabNameStore) {\n\t\tlet { data: store } = await FSBL.Clients.DistributedStoreClient.createGlobalStore({\n\t\t\tstore: WINDOW_TAB_TITLE_STORE,\n\t\t});\n\t\twindowTabNameStore = store;\n\t}\n\n\t// Return the store\n\treturn windowTabNameStore;\n};\n\n/**\n * The wrapper component for tab renaming\n * @param {*} props\n */\nfunction EditTab(props: EditTabProps) {\n\tconst [editingTitle, setEditingTitle] = React.useState(false);\n\tconst [clickTimeout, setClickTimeout] = React.useState<NodeJS.Timeout | undefined>(undefined);\n\tconst inputEl = React.useRef<HTMLInputElement>(null);\n\n\tconst updateTabTitle = async (e: React.KeyboardEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement>) => {\n\t\t// When the tab title has changed via a user edit, simply update the DistributedStore\n\n\t\t// Get the title\n\t\tconst title = (e.target as HTMLInputElement).value;\n\n\t\t// Get the tab name store\n\t\tlet store = await getWindowTabNameStore();\n\t\t// If the store is unavailable, then the tab name cannot be persisted\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error persisting tab title via EditTab: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Persist the tab title\n\t\tstore.setValue({ field: props.windowIdentifier.windowName, value: title });\n\n\t\t// Get the window which coresponds to the tab being edited\n\t\tconst { wrap: win } = await FSBL.FinsembleWindow.getInstance(props.windowIdentifier);\n\n\t\t// Set the component state \"persistedTitle\" (which is the edited title)\n\t\tFSBL.Clients.Logger.debug(`Setting component state \"${FIELD_NAME_PERSISTED_TITLE}\" with value \"${title}\"`);\n\t\tawait win.setComponentState({ field: FIELD_NAME_PERSISTED_TITLE, value: title });\n\n\t\t// Stop editing in all cases\n\t\tsetEditingTitle(false);\n\t};\n\n\tconst beginEditing = async () => {\n\t\tawait setEditingTitle(true);\n\t\tinputEl?.current?.focus();\n\t\tif (inputEl?.current) {\n\t\t\tinputEl.current.value = props.title ?? \"\";\n\t\t}\n\t};\n\n\tconst clickHandler = () => {\n\t\tconst allowWindowTitleRenaming = Store.getValue(\"allowWindowTitleRenaming\");\n\n\t\tif (clickTimeout) {\n\t\t\t// double click\n\t\t\tif (allowWindowTitleRenaming) {\n\t\t\t\tbeginEditing();\n\t\t\t}\n\t\t} else if (!editingTitle) {\n\t\t\t// single click\n\t\t\tlet timeout = setTimeout(() => {\n\t\t\t\tclearTimeout(clickTimeout);\n\t\t\t\tsetClickTimeout(undefined);\n\t\t\t}, 500);\n\t\t\tsetClickTimeout(timeout);\n\t\t\t// Only call props.setActiveTab IFF this current tab is NOT the current tab\n\t\t\t// This prevents white flashes/renders while clicking on an actibe tab\n\t\t\tif (\n\t\t\t\tprops.windowIdentifier?.windowName !== FSBL.Clients.WindowClient.getCurrentWindow().name &&\n\t\t\t\t!!props.setActiveTab\n\t\t\t) {\n\t\t\t\tprops.setActiveTab();\n\t\t\t}\n\t\t}\n\t};\n\n\tconst blurHandler = (e: React.FocusEvent<HTMLInputElement>) => {\n\t\tupdateTabTitle(e);\n\t};\n\n\tconst keyDownHandler = (e: React.KeyboardEvent<HTMLInputElement>) => {\n\t\te.key === \"Enter\" && updateTabTitle(e);\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"fsbl-tab-editor\"\n\t\t\t// We can't use Click and Dblclick events together cause for one dblclick fires two click events which close title editor.\n\t\t\t// Workaround with setTimeout should resolve this behavior.\n\t\t\tonClick={clickHandler}\n\t\t>\n\t\t\t{editingTitle ? (\n\t\t\t\t<div className=\"fsbl-tab fsbl-active-tab\" style={{ width: props.tabWidth || \"auto\" }}>\n\t\t\t\t\t{/* workaround to disable tab dragging in the edit mode */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tdraggable={true}\n\t\t\t\t\t\tonDragStart={(e) => {\n\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tid=\"title_editor_input\"\n\t\t\t\t\t\t\tref={inputEl}\n\t\t\t\t\t\t\tonBlur={blurHandler}\n\t\t\t\t\t\t\tonKeyDown={keyDownHandler}\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tclassName=\"tab__input\"\n\t\t\t\t\t\t\tmaxLength={32}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\tprops.children\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\n/*\n * Description how stacked window tabs work.\n *\n * The simplest case - when you have only 2 tabs. In that case you will actually have 2 windows and 4 tabs.\n * Lets call them as: window 1 - w1, window 2 - w2, tab 1 from window 1 - w1_t1, tab 2 from window 1 - w1_t2, for tabs from window 2 - w2_t1 and w2_t2.\n * When you switch tabs you activate w1 or w2 with active tab w1_t1 or w2_t2 correspondingly.\n * Tabs w1_t2 and w2_t1 are inactive. They needed only for rendering. I call them as remote tabs, cause their titles must be synchronized with active tabs titles.\n * Thus when you rename active tab (w1_t1), the corresponding remote tab (w2_t1) should be updated automatically.\n */\n\nexport class Title extends Component<TitleProps, TitleState> {\n\t// The listener for tab title change events via the DistributedStoreClient, kept as a reference so\n\t// that the listener can be deregistered when the component is unmounted\n\ttabTitleChangedStoreListener: ListenerFunction = (err: StandardError, response: { field: string; value: string }) => {\n\t\tif (!!err) {\n\t\t\t// This is not critical; in the worst case this tab title will be stale\n\t\t\tFSBL.Clients.Logger.warn(\n\t\t\t\t`Listener error for store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`,\n\t\t\t\terr\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Log a message\n\t\tFSBL.Clients.Logger.debug(\n\t\t\t`Store \"${WINDOW_TAB_TITLE_STORE}\" notified of new title \"${response.value}\" for window \"${response.field}\"`\n\t\t);\n\n\t\t// Invoke updateTitle\n\t\tif (!!this._mounted) {\n\t\t\tthis.updateTitle();\n\t\t}\n\t};\n\n\t// Flag to determine if this instance is currently mounted; this is necessary because:\n\t// 1.) Title components are mounted and unmounted as an artifact of how the tab or tab list is rendered\n\t// 2.) Keeping tab titles synchronized is an asynchronous process\n\t// 3.) During the asynchronous process of tab title synchronization, a call to setState is made and\n\t// that raises a React warning since the component state cannot be changed while the component\n\t// is unmounted\n\t_mounted = false;\n\n\tconstructor(props: TitleProps) {\n\t\tsuper(props);\n\n\t\t// Declare the initial title as a blank string\n\t\tlet initialTitle = \" \";\n\n\t\t// If the currently rendering tab represents the current window, then use the document title (or window name)\n\t\tif (\n\t\t\tundefined !== finsembleWindow?.thisWindowName &&\n\t\t\tfinsembleWindow?.thisWindowName === props?.windowIdentifier?.windowName\n\t\t) {\n\t\t\tinitialTitle = document.title || props.windowIdentifier?.windowName;\n\t\t}\n\n\t\tthis.state = {\n\t\t\t// Use document.title first to prevent a title flickering when dragging a tab of another window.\n\t\t\t// The reason for flickering is the component re-rendering multiple times. The initial place\n\t\t\t// where re-rendering start is the `disallowDragOnCenterRegion()` at the WindowTitleBarShell.\n\t\t\t// At that function, we change the state of the parent component which triggers re-rendering for the children tree.\n\t\t\ttitle: initialTitle,\n\t\t\ticon: null,\n\t\t\t// The \"windowName\" is the name of the window which corresponds to the this instance of the\n\t\t\t// Title component, though the actual current window may belong to some other\n\t\t\t// component(ie this tab represents an inactive window)\n\t\t\twindowName: props.windowIdentifier?.windowName,\n\t\t};\n\n\t\t// Bind the \"updateTitle\" function (in order to use React component functions)\n\t\tthis.updateTitle = this.updateTitle.bind(this);\n\n\t\t// Initial title set\n\t\tthis.updateTitle();\n\t}\n\n\t/**\n\t * Gets a reference to the \"Window Manager\" component for the tab which is rendering. If the this tab IS the active tab, then the WindowManager will be the same as the WindowManager\n\t * attached to the WindowClient. However, all other tab components displayed in this window will need to derive the WindowManager from the config, based on the\n\t * tab's windowIdentifier.\n\t *\n\t * This is because the tab's windowIdentifier only has the name (ex: SomeApp-37ba6708-3a75-462e-b900-1812e338cbf1). The name is derived by removing the last 5 substrings\n\t * separated by \"-\". This will fail in the face of a UUID format change.\n\t *\n\t * @returns the \"Window Manager\" component, or \"undefined\" if the \"Window Manager\" is not found\n\t */\n\tasync #getWindowManagerForTab() {\n\t\t// On second thought, ALL tabs will derive the WindowManager the same way; at least if it is wrong, it is wrong consistently\n\t\t//\n\t\t// if (finsembleWindow.thisWindowName === this.props?.windowIdentifier?.windowName) {\n\t\t// \treturn FSBL.Clients.WindowClient.options?.customData?.foreign?.components?.[\"Window Manager\"] || FSBL.Clients.WindowClient.options?.customData?.appDConfig?.manifest?.foreign?.components?.[\"Window Manager\"];\n\t\t// } else {\n\n\t\t// Check that \"windowName\" exists\n\t\tif (!!this.props?.windowIdentifier?.windowName) {\n\t\t\t// Get the window name\n\t\t\tconst tabsWindowName = this.props.windowIdentifier.windowName;\n\t\t\t// Get the active descriptors\n\t\t\tconst { data: activeDescriptors } = await FSBL.Clients.LauncherClient.getActiveDescriptors();\n\t\t\t// Return the \"Window Manager\" for the window whose name matches THIS tab's name\n\t\t\treturn activeDescriptors?.[tabsWindowName]?.customData?.appDConfig?.manifest?.foreign?.components?.[\n\t\t\t\t\"Window Manager\"\n\t\t\t];\n\t\t}\n\n\t\treturn undefined;\n\t\t// }\n\t}\n\n\t/**\n\t * Calculates a tab title. Uses the following algorithm until a non-null value is found.\n\t * <ol>\n\t * <li>user edited tab title</li>\n\t * <li>the component config</li>\n\t * <li>document.title</li>\n\t * <li>appd config</li>\n\t * </ol>\n\t *\n\t * @returns the calculated tab title\n\t */\n\tasync #calculateTabTitle() {\n\t\treturn (\n\t\t\t(await this.#getUserEditedTitle()) ||\n\t\t\t(await this.#getConfigTitle()) ||\n\t\t\t(await this.#getDocumentTitle()) ||\n\t\t\tthis.#getAppDTitle()\n\t\t);\n\t}\n\n\t/**\n\t * Returns the name of the title supplied by a user; undefined if the user has not supplied a title.\n\t *\n\t * @returns The name of the title supplied by a user; undefined if the user has not supplied a title\n\t */\n\tasync #getUserEditedTitle() {\n\t\tconst { wrap: tabWindow } = await FSBL.FinsembleWindow.getInstance(this.props.windowIdentifier);\n\t\treturn new Promise((resolve) => {\n\t\t\ttabWindow.getComponentState({ field: FIELD_NAME_PERSISTED_TITLE }, (error: any, persistedTitle: any) => {\n\t\t\t\tif (!!error) {\n\t\t\t\t\t// should always return value even if it hasn't been retrieved from the state\n\t\t\t\t\tresolve(undefined);\n\t\t\t\t} else {\n\t\t\t\t\tresolve(persistedTitle);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Gets a title set in the component configuration.\n\t *\n\t * @returns any title set in the component configuration\n\t */\n\tasync #getConfigTitle() {\n\t\tconst windowManager = await this.#getWindowManagerForTab();\n\t\treturn windowManager?.FSBLHeader?.title || windowManager?.title;\n\t}\n\n\t/**\n\t * Returns document.title.\n\t *\n\t * @returns the document.title (from the \"tab name\" store)\n\t */\n\tasync #getDocumentTitle() {\n\t\tconst store = await getWindowTabNameStore();\n\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error setting the tab title: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.props?.windowIdentifier?.windowName\n\t\t\t? (await store.getGlobalValue(this.props.windowIdentifier.windowName)).data\n\t\t\t: undefined;\n\t}\n\n\t/**\n\t * Gets the AppD configuration\n\t *\n\t * @returns The AppD name\n\t */\n\t#getAppDTitle() {\n\t\treturn (\n\t\t\tFSBL.Clients.WindowClient.options?.customData?.appDConfig?.manifest?.component?.displayName ||\n\t\t\tFSBL.Clients.WindowClient.options?.customData?.appDConfig?.name\n\t\t);\n\t}\n\n\t/**\n\t * Updates the title for both the tab and the window.\n\t *\n\t * @returns a Promise which resolves nothing\n\t */\n\tasync updateTitle() {\n\t\t// There is a subtle difference bewtween windowTitle and tabTitle. Since this code executes\n\t\t// when *any* tab has a name change, this code can execute when the active window represents\n\t\t// a tab other than the currently rendering tab (ie an inactive tab).\n\n\t\t// The window represented by this tab title instance\n\t\tconst { wrap: tabWindow } = await FSBL.FinsembleWindow.getInstance(this.props.windowIdentifier);\n\n\t\t// \"tabWindowOptions\" refers to the options from the window which hosts the component represented by this tab\n\t\tconst { data: tabWindowOptions } = await tabWindow.getOptions();\n\n\t\t// Derive the title: \"config title\" then \"document.title\" then \"appd title\"\n\t\tlet title = await this.#calculateTabTitle();\n\n\t\t// Get the titleBar icon from the WindowDescriptor for the TAB window (not the CURRENT window)\n\t\tconst icon: IconDescriptor = (tabWindowOptions as WindowDescriptor)?.icons?.titleBarIcon ?? {\n\t\t\timageType: \"initials\",\n\t\t\tname: title,\n\t\t};\n\n\t\t// Log a message\n\t\tFSBL.Clients.Logger.debug(`Setting tab title ${title} for window ${this.props.windowIdentifier.windowName}`);\n\n\t\t// Finally, set the state if the component is mounted\n\t\tif (!!this._mounted) {\n\t\t\tthis.setState({\n\t\t\t\ttitle,\n\t\t\t\ticon: {\n\t\t\t\t\t...icon,\n\t\t\t\t\t// Application causes the background to default to a circle rather than a square\n\t\t\t\t\tcategory: \"Application\",\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// If this tab component instance represents the window (that is, this is the active tab), then set the title\n\t\tif (finsembleWindow.thisWindowName === this.props.windowIdentifier.windowName) {\n\t\t\tdocument.title = await this.#calculateTabTitle();\n\t\t}\n\t}\n\n\t/**\n\t * Adds the listener(s) required to set window and tab titles.\n\t */\n\tasync #addListeners() {\n\t\t// Subscribe to the DistributedStoreClient (these messages originate from BaseWindow, when the\n\t\t// DistributedStore has been updated).\n\t\t//\n\t\t// Each window will have n listeners, where n is the number of tabs held in the window.\n\n\t\t// Get the store and add a listener\n\t\tconst store = await getWindowTabNameStore();\n\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error adding a tab title listener: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Add a listener\n\t\tstore.addListener({ field: this.props.windowIdentifier.windowName }, this.tabTitleChangedStoreListener, () => {\n\t\t\tFSBL.Clients.Logger.debug(\n\t\t\t\t`Added listener to store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Removes listener(s) required to set window and tab titles.\n\t */\n\tasync #removeListeners() {\n\t\t// Unsubscribe from the window/tab store\n\t\tconst store = await getWindowTabNameStore();\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error removing a tab title listener: the store was not found\");\n\t\t\treturn;\n\t\t}\n\t\tstore.removeListener(\n\t\t\t{ field: this.props.windowIdentifier.windowName },\n\t\t\tthis.tabTitleChangedStoreListener,\n\t\t\t(err: StandardError, response: boolean | undefined) => {\n\t\t\t\tif (!!err) {\n\t\t\t\t\t// This is not critical; the listener could not be removed from the store - this may be a memory leak\n\t\t\t\t\tFSBL.Clients.Logger.warn(\n\t\t\t\t\t\t`Could not remove listener from store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`,\n\t\t\t\t\t\terr\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tFSBL.Clients.Logger.debug(\n\t\t\t\t\t`Removed listener to store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * React component lifecycle event, triggered once the component has been added to the DOM.\n\t */\n\tcomponentDidMount() {\n\t\t// Set the mounted flag to true (this component is currently mounted)\n\t\tthis._mounted = true;\n\n\t\t// Add listeners\n\t\tthis.#addListeners();\n\t}\n\n\t// Triggers a re-rendering of the drag handle in the title bar.\n\tcomponentDidUpdate() {\n\t\tif (typeof this.props.onUpdate === \"function\") {\n\t\t\tthis.props.onUpdate();\n\t\t}\n\t}\n\n\t/**\n\t * React component lifecycle event, triggered before the component is removed from the DOM.\n\t */\n\tcomponentWillUnmount() {\n\t\t// Set the mounted flag to false (this component is not currently mounted)\n\t\tthis._mounted = false;\n\n\t\t// Remove listeners\n\t\tthis.#removeListeners();\n\t}\n\n\trender() {\n\t\tconst { titleWidth } = this.props;\n\t\tconst style = titleWidth ? { width: titleWidth } : {};\n\t\treturn (\n\t\t\t<EditTab\n\t\t\t\ttabWidth={titleWidth}\n\t\t\t\tsetActiveTab={this?.props?.onClick}\n\t\t\t\ttitle={this.state.title}\n\t\t\t\t// The windowIdentifier indicates which app/component this tab instance should represent\n\t\t\t\twindowIdentifier={this.props.windowIdentifier}\n\t\t\t>\n\t\t\t\t<div className=\"fsbl-tab-title\" style={style}>\n\t\t\t\t\t{this.state.icon && <Icon {...this.state.icon} />}\n\t\t\t\t\t<div className=\"title-text\">{this.state.title}</div>\n\t\t\t\t</div>\n\t\t\t</EditTab>\n\t\t);\n\t}\n}\n"]}