@finsemble/finsemble-ui 6.3.1 → 6.3.2

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.
Files changed (544) hide show
  1. package/README.md +28 -28
  2. package/package.json +1 -1
  3. package/react/actions/favoriteActions.js.map +1 -1
  4. package/react/actions/linkerActions.js.map +1 -1
  5. package/react/actions/menuActions.js.map +1 -1
  6. package/react/actions/rootActions.js.map +1 -1
  7. package/react/actions/searchActions.js.map +1 -1
  8. package/react/actions/smartDesktopDesignerActions.js.map +1 -1
  9. package/react/actions/toolbarActions.js.map +1 -1
  10. package/react/actions/workspaceActions.js.map +1 -1
  11. package/react/assets/css/advancedAppLauncher.css +636 -636
  12. package/react/assets/css/appCatalog.css +1069 -1069
  13. package/react/assets/css/authentication.css +78 -78
  14. package/react/assets/css/button.css +220 -220
  15. package/react/assets/css/core/formElements.css +23 -23
  16. package/react/assets/css/core/icons.css +69 -69
  17. package/react/assets/css/core/notifications.css +75 -75
  18. package/react/assets/css/core/windowFrame.css +36 -36
  19. package/react/assets/css/dashbar.css +78 -78
  20. package/react/assets/css/defaultTheme.css +356 -356
  21. package/react/assets/css/dialogs.css +158 -158
  22. package/react/assets/css/favorites.css +101 -101
  23. package/react/assets/css/finsemble.css +38 -38
  24. package/react/assets/css/focus.css +4 -4
  25. package/react/assets/css/font-finance.css +385 -385
  26. package/react/assets/css/fonts/Open_Sans/LICENSE.txt +202 -202
  27. package/react/assets/css/fonts/Open_Sans/OpenSans-Definition.css +118 -118
  28. package/react/assets/css/fonts/font-finance.svg +124 -124
  29. package/react/assets/css/fonts/icons-reference.html +1174 -1174
  30. package/react/assets/css/linkerWindow.css +124 -124
  31. package/react/assets/css/menus.css +195 -195
  32. package/react/assets/css/notificationsCenter.css +597 -597
  33. package/react/assets/css/processMonitor.css +213 -213
  34. package/react/assets/css/search.css +128 -128
  35. package/react/assets/css/shared/animations.css +99 -99
  36. package/react/assets/css/tags.css +136 -136
  37. package/react/assets/css/toolbar.css +413 -413
  38. package/react/assets/css/userPreferences.css +568 -568
  39. package/react/assets/css/windowTitleBar.css +652 -652
  40. package/react/assets/icons/check-square.svg +5 -5
  41. package/react/assets/icons/check.svg +3 -3
  42. package/react/assets/icons/chevron-left.svg +3 -3
  43. package/react/assets/icons/chevron-right.svg +3 -3
  44. package/react/assets/icons/copy.svg +10 -10
  45. package/react/assets/icons/exclamation-circle.svg +4 -4
  46. package/react/assets/icons/external-link.svg +12 -12
  47. package/react/assets/icons/flag.svg +10 -10
  48. package/react/assets/icons/folder.svg +3 -3
  49. package/react/assets/icons/font.svg +3 -3
  50. package/react/assets/icons/globe.svg +3 -3
  51. package/react/assets/icons/hdd.svg +9 -9
  52. package/react/assets/icons/key.svg +10 -10
  53. package/react/assets/icons/life-ring.svg +3 -3
  54. package/react/assets/icons/lock.svg +5 -5
  55. package/react/assets/icons/magic.svg +15 -15
  56. package/react/assets/icons/moon.svg +10 -10
  57. package/react/assets/icons/paint-roller.svg +3 -3
  58. package/react/assets/icons/pencil.svg +10 -10
  59. package/react/assets/icons/plus.svg +3 -3
  60. package/react/assets/icons/question-circle.svg +5 -5
  61. package/react/assets/icons/search.svg +3 -3
  62. package/react/assets/icons/sun.svg +9 -9
  63. package/react/assets/icons/times.svg +3 -3
  64. package/react/assets/icons/toggle-off.svg +6 -6
  65. package/react/assets/icons/toggle-on.svg +6 -6
  66. package/react/assets/icons/tools.svg +3 -3
  67. package/react/assets/icons/trash.svg +12 -12
  68. package/react/assets/icons/upload.svg +10 -10
  69. package/react/assets/icons/window.svg +3 -3
  70. package/react/componentTemplateGenerator.js +85 -85
  71. package/react/componentTemplateGenerator.js.map +1 -1
  72. package/react/components/FinsembleProvider.js.map +1 -1
  73. package/react/components/appCatalog/AppCatalog.js.map +1 -1
  74. package/react/components/appCatalog/AppCatalogComponent.js.map +1 -1
  75. package/react/components/appCatalog/components/AppCard.js.map +1 -1
  76. package/react/components/appCatalog/components/AppList.js.map +1 -1
  77. package/react/components/appCatalog/components/AppResults.js.map +1 -1
  78. package/react/components/appCatalog/components/Carousel.js.map +1 -1
  79. package/react/components/appCatalog/components/EmptyResults.js.map +1 -1
  80. package/react/components/appCatalog/components/Hero.js.map +1 -1
  81. package/react/components/appCatalog/components/Home.js.map +1 -1
  82. package/react/components/appCatalog/components/SearchBar.js.map +1 -1
  83. package/react/components/appCatalog/components/Showcase/AppDescription.js.map +1 -1
  84. package/react/components/appCatalog/components/Showcase/AppDevNotes.js.map +1 -1
  85. package/react/components/appCatalog/components/Showcase/AppShowcase.js.map +1 -1
  86. package/react/components/appCatalog/components/Showcase/Header.js.map +1 -1
  87. package/react/components/appCatalog/components/Showcase/ImageCarousel.js.map +1 -1
  88. package/react/components/appCatalog/components/Showcase/Modal.js.map +1 -1
  89. package/react/components/appCatalog/components/Showcase/ReleaseNotes.js.map +1 -1
  90. package/react/components/appCatalog/components/Showcase/SupportNotes.js.map +1 -1
  91. package/react/components/appCatalog/components/Showcase/VersionNotes.js.map +1 -1
  92. package/react/components/appCatalog/components/Showcase/defaults.js.map +1 -1
  93. package/react/components/appCatalog/components/Tag.js.map +1 -1
  94. package/react/components/appCatalog/components/Toast.js.map +1 -1
  95. package/react/components/appCatalog/components/helpers.js.map +1 -1
  96. package/react/components/appCatalog/index.js.map +1 -1
  97. package/react/components/appCatalog/modules/AppDirectory.js.map +1 -1
  98. package/react/components/appCatalog/modules/FDC3.js.map +1 -1
  99. package/react/components/appCatalog/stores/appStore.js.map +1 -1
  100. package/react/components/appCatalog/stores/storeActions.js.map +1 -1
  101. package/react/components/common/Button.js.map +1 -1
  102. package/react/components/common/ButtonIcon.js.map +1 -1
  103. package/react/components/common/ButtonRow.js.map +1 -1
  104. package/react/components/common/ButtonTile.js.map +1 -1
  105. package/react/components/common/Checkbox.js.map +1 -1
  106. package/react/components/common/ColorPicker.js.map +1 -1
  107. package/react/components/common/DropZone.js.map +1 -1
  108. package/react/components/common/DropdownButton.js.map +1 -1
  109. package/react/components/common/FileInput.js.map +1 -1
  110. package/react/components/common/FinsembleIcon.js.map +1 -1
  111. package/react/components/common/FinsembleSelect.js.map +1 -1
  112. package/react/components/common/FinsembleToggle.js.map +1 -1
  113. package/react/components/common/FontSizeSelector.js.map +1 -1
  114. package/react/components/common/Header.js.map +1 -1
  115. package/react/components/common/ImagePreview.js.map +1 -1
  116. package/react/components/common/LoadingSpinner.js.map +1 -1
  117. package/react/components/common/Tab.js.map +1 -1
  118. package/react/components/common/Tooltip.js.map +1 -1
  119. package/react/components/common/css/application-edit-page.css +117 -117
  120. package/react/components/common/css/application-list.css +47 -47
  121. package/react/components/common/css/button.css +164 -164
  122. package/react/components/common/css/color-picker.css +52 -52
  123. package/react/components/common/css/drop-zone.css +17 -17
  124. package/react/components/common/css/file-input.css +49 -49
  125. package/react/components/common/css/header.css +43 -43
  126. package/react/components/common/css/icon.css +13 -13
  127. package/react/components/common/css/image-preview.css +57 -57
  128. package/react/components/common/css/loading-spinner.css +39 -39
  129. package/react/components/common/css/selector.css +51 -51
  130. package/react/components/common/css/styles.css +128 -128
  131. package/react/components/common/css/tab.css +56 -56
  132. package/react/components/common/css/toggle.css +32 -32
  133. package/react/components/common/css/tooltip.css +78 -78
  134. package/react/components/common/file_helpers.js.map +1 -1
  135. package/react/components/common/fixtures/FinsembleIcon.css +4 -4
  136. package/react/components/common/helpers.js.map +1 -1
  137. package/react/components/common/stories/Button.stories.js.map +1 -1
  138. package/react/components/common/stories/ButtonIcon.stories.js.map +1 -1
  139. package/react/components/common/stories/ButtonRow.stories.js.map +1 -1
  140. package/react/components/common/stories/ButtonTile.stories.js.map +1 -1
  141. package/react/components/common/stories/Checkbox.stories.js.map +1 -1
  142. package/react/components/common/stories/ColorPicker.stories.js.map +1 -1
  143. package/react/components/common/stories/DropZone.stories.js.map +1 -1
  144. package/react/components/common/stories/DropdownButton.stories.js.map +1 -1
  145. package/react/components/common/stories/FileInput.stories.js.map +1 -1
  146. package/react/components/common/stories/FinsembleIcon.stories.js.map +1 -1
  147. package/react/components/common/stories/FinsembleSelect.stories.js.map +1 -1
  148. package/react/components/common/stories/FinsembleToggle.stories.js.map +1 -1
  149. package/react/components/common/stories/FontSizeSelector.stories.js.map +1 -1
  150. package/react/components/common/stories/Header.stories.js.map +1 -1
  151. package/react/components/common/stories/ImagePreview.stories.js.map +1 -1
  152. package/react/components/common/stories/LoadingSpinner.stories.js.map +1 -1
  153. package/react/components/common/stories/Tab.stories.js.map +1 -1
  154. package/react/components/common/stories/Tooltip.stories.js.map +1 -1
  155. package/react/components/common/tests/ButtonRow.spec.js.map +1 -1
  156. package/react/components/common/tests/Checkbox.spec.js.map +1 -1
  157. package/react/components/common/tests/ColorPicker.spec.js.map +1 -1
  158. package/react/components/common/tests/DropZone.spec.js.map +1 -1
  159. package/react/components/common/tests/FileInput.spec.js.map +1 -1
  160. package/react/components/common/tests/FinsembleSelect.spec.js.map +1 -1
  161. package/react/components/common/tests/FinsembleToggle.spec.js.map +1 -1
  162. package/react/components/common/tests/Header.spec.js.map +1 -1
  163. package/react/components/common/tests/ImagePreview.spec.js.map +1 -1
  164. package/react/components/common/tests/Tab.spec.js.map +1 -1
  165. package/react/components/common/tests/Tooltip.spec.js.map +1 -1
  166. package/react/components/favorites/FavoriteMaker.js.map +1 -1
  167. package/react/components/favorites/FavoritesShell.js.map +1 -1
  168. package/react/components/favorites/FavoritesShell.spec.js.map +1 -1
  169. package/react/components/favorites/FavoritesShell.stories.js.map +1 -1
  170. package/react/components/favorites/index.js.map +1 -1
  171. package/react/components/fdc3Resolver/ResolverContainer.js.map +1 -1
  172. package/react/components/fdc3Resolver/ResolverDialog.css +126 -126
  173. package/react/components/fdc3Resolver/ResolverDialog.js.map +1 -1
  174. package/react/components/fdc3Resolver/ResolverDialog.spec.js.map +1 -1
  175. package/react/components/fdc3Resolver/ResolverDialog.stories.js.map +1 -1
  176. package/react/components/icon/Icon.js.map +1 -1
  177. package/react/components/icon/index.js.map +1 -1
  178. package/react/components/legacyControls/FinsembleDialog.js.map +1 -1
  179. package/react/components/legacyControls/FinsembleDialogButton.js.map +1 -1
  180. package/react/components/legacyControls/FinsembleDialogQuestion.js.map +1 -1
  181. package/react/components/legacyControls/FinsembleDialogTextInput.js.map +1 -1
  182. package/react/components/legacyControls/FinsembleDnDContext.js.map +1 -1
  183. package/react/components/legacyControls/FinsembleDraggable.js.map +1 -1
  184. package/react/components/legacyControls/FinsembleHoverDetector.js.map +1 -1
  185. package/react/components/legacyControls/FinsembleMenuSection.js.map +1 -1
  186. package/react/components/legacyControls/stories/FinsembleDialog.stories.js.map +1 -1
  187. package/react/components/legacyControls/stories/FinsembleDialogButton.stories.js.map +1 -1
  188. package/react/components/legacyControls/stories/FinsembleDialogQuestion.stories.js.map +1 -1
  189. package/react/components/legacyControls/stories/FinsembleDialogTextInput.stories.js.map +1 -1
  190. package/react/components/legacyControls/tests/FinsembleDialog.spec.js.map +1 -1
  191. package/react/components/legacyControls/tests/FinsembleDialogButton.spec.js.map +1 -1
  192. package/react/components/legacyControls/tests/FinsembleDialogQuestion.spec.js.map +1 -1
  193. package/react/components/legacyControls/tests/FinsembleDialogTextInput.spec.js.map +1 -1
  194. package/react/components/linker/LinkerMenu.js.map +1 -1
  195. package/react/components/linker/LinkerMenuDeprecated.js.map +1 -1
  196. package/react/components/linker/index.js.map +1 -1
  197. package/react/components/linker/remoteRedux.js.map +1 -1
  198. package/react/components/menu/Menu.js.map +1 -1
  199. package/react/components/menu/MenuAutoResizer.js.map +1 -1
  200. package/react/components/menu/MenuContent.js.map +1 -1
  201. package/react/components/menu/MenuHotKey.js.map +1 -1
  202. package/react/components/menu/MenuItem.js.map +1 -1
  203. package/react/components/menu/MenuPortal.js.map +1 -1
  204. package/react/components/menu/MenuShell.js.map +1 -1
  205. package/react/components/menu/MenuToggle.js.map +1 -1
  206. package/react/components/menu/index.js.map +1 -1
  207. package/react/components/menu/keyboardNavigation.js.map +1 -1
  208. package/react/components/menu/menuContext.js.map +1 -1
  209. package/react/components/menu/menuHelpers.js.map +1 -1
  210. package/react/components/notifications/components/NoNotifications.js.map +1 -1
  211. package/react/components/notifications/components/drawer/Drawer.js.map +1 -1
  212. package/react/components/notifications/components/drawer/DrawerControls.js.map +1 -1
  213. package/react/components/notifications/components/drawer/DrawerHeader.js.map +1 -1
  214. package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js.map +1 -1
  215. package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js.map +1 -1
  216. package/react/components/notifications/components/shared/CheckButton.js.map +1 -1
  217. package/react/components/notifications/components/shared/IconButton.js.map +1 -1
  218. package/react/components/notifications/components/shared/NotificationCardShell.js +1 -1
  219. package/react/components/notifications/components/shared/NotificationCardShell.js.map +1 -1
  220. package/react/components/notifications/components/shared/OverflowMenu.js.map +1 -1
  221. package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyActions.js.map +1 -1
  222. package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyContentLogo.js.map +1 -1
  223. package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js.map +1 -1
  224. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.js.map +1 -1
  225. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderLogo.js.map +1 -1
  226. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderShell.js.map +1 -1
  227. package/react/components/notifications/components/views/CardView.js.map +1 -1
  228. package/react/components/notifications/components/views/ListView.js +1 -1
  229. package/react/components/notifications/components/views/ListView.js.map +1 -1
  230. package/react/components/notifications/components/views/NotificationDetailsView.js.map +1 -1
  231. package/react/components/notifications/constants.js.map +1 -1
  232. package/react/components/notifications/icons/Card.js.map +1 -1
  233. package/react/components/notifications/icons/Chevron.js.map +1 -1
  234. package/react/components/notifications/icons/CloseIcon.js.map +1 -1
  235. package/react/components/notifications/icons/EnvelopeClose.js.map +1 -1
  236. package/react/components/notifications/icons/EnvelopeOpen.js.map +1 -1
  237. package/react/components/notifications/icons/SnoozeIcon.js.map +1 -1
  238. package/react/components/notifications/index.js.map +1 -1
  239. package/react/components/notifications/notificationsContext.js.map +1 -1
  240. package/react/components/notifications/types.js.map +1 -1
  241. package/react/components/notifications/utils.js.map +1 -1
  242. package/react/components/processMonitor/ProcessMonitor.js.map +1 -1
  243. package/react/components/processMonitor/ProcessMonitorTypes.js.map +1 -1
  244. package/react/components/processMonitor/components/ChildWindow.js.map +1 -1
  245. package/react/components/processMonitor/components/ListHeader.js.map +1 -1
  246. package/react/components/processMonitor/components/ProcessStatistics.js.map +1 -1
  247. package/react/components/processMonitor/constants.js.map +1 -1
  248. package/react/components/processMonitor/helpers.js.map +1 -1
  249. package/react/components/processMonitor/helpers.spec.js.map +1 -1
  250. package/react/components/processMonitor/index.js.map +1 -1
  251. package/react/components/processMonitor/stores/ProcessMonitorStore.js.map +1 -1
  252. package/react/components/quickComponentForm/QuickComponentForm.js.map +1 -1
  253. package/react/components/quickComponentForm/index.js.map +1 -1
  254. package/react/components/quickComponentForm/quickComponent.css +3 -3
  255. package/react/components/search/Highlight.js.map +1 -1
  256. package/react/components/search/Highlight.spec.js.map +1 -1
  257. package/react/components/search/Highlight.stories.js.map +1 -1
  258. package/react/components/search/Search.js.map +1 -1
  259. package/react/components/search/SearchBestMatch.js.map +1 -1
  260. package/react/components/search/SearchInput.js.map +1 -1
  261. package/react/components/search/SearchProviderResults.js.map +1 -1
  262. package/react/components/search/SearchResult.js.map +1 -1
  263. package/react/components/search/SearchResults.js.map +1 -1
  264. package/react/components/search/index.js.map +1 -1
  265. package/react/components/shared/Animate.js.map +1 -1
  266. package/react/components/shared/BellIcon.js.map +1 -1
  267. package/react/components/shared/BellIconCrossed.js.map +1 -1
  268. package/react/components/shared/Button.js.map +1 -1
  269. package/react/components/shared/ConditionalWrapper.js.map +1 -1
  270. package/react/components/shared/DefaultDropdownButton.js.map +1 -1
  271. package/react/components/shared/NavigationButton.js.map +1 -1
  272. package/react/components/shared/Tag.js.map +1 -1
  273. package/react/components/shared/TagsMenu.js.map +1 -1
  274. package/react/components/shared/addProtocolToValidURL.js.map +1 -1
  275. package/react/components/shared/linkerUtil.js.map +1 -1
  276. package/react/components/shared/openQuitConfirmationDialog.js.map +1 -1
  277. package/react/components/shared/tests/DefaultDropdownButton.spec.js.map +1 -1
  278. package/react/components/shared/tests/addProtocolToValidURL.spec.js.map +1 -1
  279. package/react/components/shared/validateURL.js.map +1 -1
  280. package/react/components/shared/validateURL.spec.js.map +1 -1
  281. package/react/components/singleInputDialog/SingleInputDialog.css +3 -3
  282. package/react/components/singleInputDialog/SingleInputDialog.js.map +1 -1
  283. package/react/components/singleInputDialog/SingleInputDialog.spec.js.map +1 -1
  284. package/react/components/singleInputDialog/SingleInputDialog.stories.js.map +1 -1
  285. package/react/components/singleInputDialog/index.js.map +1 -1
  286. package/react/components/smartDesktopDesigner/AppEditAccess.js.map +1 -1
  287. package/react/components/smartDesktopDesigner/AppEditPage.js.map +1 -1
  288. package/react/components/smartDesktopDesigner/Appearance.css +94 -94
  289. package/react/components/smartDesktopDesigner/Appearance.helpers.js.map +1 -1
  290. package/react/components/smartDesktopDesigner/Appearance.js.map +1 -1
  291. package/react/components/smartDesktopDesigner/Application.js.map +1 -1
  292. package/react/components/smartDesktopDesigner/ApplicationEdit.js.map +1 -1
  293. package/react/components/smartDesktopDesigner/ApplicationList.js.map +1 -1
  294. package/react/components/smartDesktopDesigner/ApplicationSetup.js.map +1 -1
  295. package/react/components/smartDesktopDesigner/Applications.js.map +1 -1
  296. package/react/components/smartDesktopDesigner/AssetsPage.css +26 -26
  297. package/react/components/smartDesktopDesigner/AssetsPage.js.map +1 -1
  298. package/react/components/smartDesktopDesigner/Authentication.js.map +1 -1
  299. package/react/components/smartDesktopDesigner/AuthenticationProviderConfig.js.map +1 -1
  300. package/react/components/smartDesktopDesigner/Content.js.map +1 -1
  301. package/react/components/smartDesktopDesigner/CurrentView.js.map +1 -1
  302. package/react/components/smartDesktopDesigner/Export.js.map +1 -1
  303. package/react/components/smartDesktopDesigner/ExportCloud.js.map +1 -1
  304. package/react/components/smartDesktopDesigner/ExportDeployInfo.js.map +1 -1
  305. package/react/components/smartDesktopDesigner/ExportZip.js.map +1 -1
  306. package/react/components/smartDesktopDesigner/GettingStarted.js.map +1 -1
  307. package/react/components/smartDesktopDesigner/Navigation.js.map +1 -1
  308. package/react/components/smartDesktopDesigner/ProjectErrors.js.map +1 -1
  309. package/react/components/smartDesktopDesigner/ProjectHeader.js.map +1 -1
  310. package/react/components/smartDesktopDesigner/Publish.js.map +1 -1
  311. package/react/components/smartDesktopDesigner/PublishProgress.js.map +1 -1
  312. package/react/components/smartDesktopDesigner/SmartDesktopDesigner.js.map +1 -1
  313. package/react/components/smartDesktopDesigner/ThemePage.css +110 -110
  314. package/react/components/smartDesktopDesigner/ThemePage.js.map +1 -1
  315. package/react/components/smartDesktopDesigner/Themes.js.map +1 -1
  316. package/react/components/smartDesktopDesigner/View.js.map +1 -1
  317. package/react/components/smartDesktopDesigner/common/fsbl_functions.js.map +1 -1
  318. package/react/components/smartDesktopDesigner/common/getCSSVars.js.map +1 -1
  319. package/react/components/smartDesktopDesigner/common/views.js.map +1 -1
  320. package/react/components/smartDesktopDesigner/css/appearance.css +10 -10
  321. package/react/components/smartDesktopDesigner/css/applications.css +127 -127
  322. package/react/components/smartDesktopDesigner/css/authentication.css +125 -125
  323. package/react/components/smartDesktopDesigner/css/buttons.css +12 -12
  324. package/react/components/smartDesktopDesigner/css/export.css +163 -163
  325. package/react/components/smartDesktopDesigner/css/getting-started.css +6 -6
  326. package/react/components/smartDesktopDesigner/css/nav.css +93 -93
  327. package/react/components/smartDesktopDesigner/css/project-errors.css +15 -15
  328. package/react/components/smartDesktopDesigner/css/project-header.css +121 -121
  329. package/react/components/smartDesktopDesigner/css/styles.css +179 -179
  330. package/react/components/smartDesktopDesigner/css/views.css +16 -16
  331. package/react/components/smartDesktopDesigner/fixtures/applicationEditProps.js.map +1 -1
  332. package/react/components/smartDesktopDesigner/fixtures/applicationSetupProps.js.map +1 -1
  333. package/react/components/smartDesktopDesigner/fixtures/apps.js.map +1 -1
  334. package/react/components/smartDesktopDesigner/fixtures/authenticationProps.js.map +1 -1
  335. package/react/components/smartDesktopDesigner/fixtures/configTemplate.js.map +1 -1
  336. package/react/components/smartDesktopDesigner/fixtures/exportProps.js.map +1 -1
  337. package/react/components/smartDesktopDesigner/fixtures/projectErrorsProps.js.map +1 -1
  338. package/react/components/smartDesktopDesigner/fixtures/publishProgress.js.map +1 -1
  339. package/react/components/smartDesktopDesigner/fixtures/themeProps.js.map +1 -1
  340. package/react/components/smartDesktopDesigner/fixtures/views.js.map +1 -1
  341. package/react/components/smartDesktopDesigner/sdd_helpers.js.map +1 -1
  342. package/react/components/smartDesktopDesigner/stories/AppEditPage.stories.js.map +1 -1
  343. package/react/components/smartDesktopDesigner/stories/Appearance.stories.js.map +1 -1
  344. package/react/components/smartDesktopDesigner/stories/ApplicationEdit.stories.js.map +1 -1
  345. package/react/components/smartDesktopDesigner/stories/ApplicationList.stories.js.map +1 -1
  346. package/react/components/smartDesktopDesigner/stories/ApplicationSetup.stories.js.map +1 -1
  347. package/react/components/smartDesktopDesigner/stories/Applications.stories.js.map +1 -1
  348. package/react/components/smartDesktopDesigner/stories/AssetsPage.stories.js.map +1 -1
  349. package/react/components/smartDesktopDesigner/stories/Authentication.stories.js.map +1 -1
  350. package/react/components/smartDesktopDesigner/stories/Export.stories.js.map +1 -1
  351. package/react/components/smartDesktopDesigner/stories/ExportCloud.stories.js.map +1 -1
  352. package/react/components/smartDesktopDesigner/stories/ExportZip.stories.js.map +1 -1
  353. package/react/components/smartDesktopDesigner/stories/GettingStarted.stories.js.map +1 -1
  354. package/react/components/smartDesktopDesigner/stories/Navigation.stories.js.map +1 -1
  355. package/react/components/smartDesktopDesigner/stories/ProjectErrors.stories.js.map +1 -1
  356. package/react/components/smartDesktopDesigner/stories/ProjectHeader.stories.js.map +1 -1
  357. package/react/components/smartDesktopDesigner/stories/Publish.stories.js.map +1 -1
  358. package/react/components/smartDesktopDesigner/stories/PublishProgress.stories.js.map +1 -1
  359. package/react/components/smartDesktopDesigner/stories/SmartDesktopDesigner.stories.js.map +1 -1
  360. package/react/components/smartDesktopDesigner/stories/ThemePage.stories.js.map +1 -1
  361. package/react/components/smartDesktopDesigner/stories/Themes.stories.js.map +1 -1
  362. package/react/components/smartDesktopDesigner/tests/AppEditPage.spec.js.map +1 -1
  363. package/react/components/smartDesktopDesigner/tests/ApplicationEdit.spec.js.map +1 -1
  364. package/react/components/smartDesktopDesigner/tests/ApplicationList.spec.js.map +1 -1
  365. package/react/components/smartDesktopDesigner/tests/ApplicationSetup.spec.js.map +1 -1
  366. package/react/components/smartDesktopDesigner/tests/Applications.spec.js.map +1 -1
  367. package/react/components/smartDesktopDesigner/tests/Authentication.spec.js.map +1 -1
  368. package/react/components/smartDesktopDesigner/tests/Export.spec.js.map +1 -1
  369. package/react/components/smartDesktopDesigner/tests/ExportZip.spec.js.map +1 -1
  370. package/react/components/smartDesktopDesigner/tests/Navigation.spec.js.map +1 -1
  371. package/react/components/smartDesktopDesigner/tests/ProjectErrors.spec.js.map +1 -1
  372. package/react/components/smartDesktopDesigner/tests/ProjectHeader.spec.js.map +1 -1
  373. package/react/components/smartDesktopDesigner/tests/Publish.spec.js.map +1 -1
  374. package/react/components/smartDesktopDesigner/tests/PublishProgess.spec.js.map +1 -1
  375. package/react/components/smartDesktopDesigner/tests/SmartDesktopDesigner.spec.js.map +1 -1
  376. package/react/components/smartDesktopDesigner/tests/Themes.spec.js.map +1 -1
  377. package/react/components/smartDesktopDesigner/tests/a11y_helper.js.map +1 -1
  378. package/react/components/smartDesktopDesigner/themeDefinitions.js.map +1 -1
  379. package/react/components/system/System.js.map +1 -1
  380. package/react/components/system/System.spec.js.map +1 -1
  381. package/react/components/system/System.stories.js.map +1 -1
  382. package/react/components/system/SystemTrayComponentShell.js.map +1 -1
  383. package/react/components/system/index.js.map +1 -1
  384. package/react/components/toolbar/AutoArrange.js.map +1 -1
  385. package/react/components/toolbar/DragHandle.js.map +1 -1
  386. package/react/components/toolbar/MinimizeAll.js.map +1 -1
  387. package/react/components/toolbar/MinimizeAll.spec.js.map +1 -1
  388. package/react/components/toolbar/MinimizeAll.stories.js.map +1 -1
  389. package/react/components/toolbar/NotificationControl.js.map +1 -1
  390. package/react/components/toolbar/RevealAll.js.map +1 -1
  391. package/react/components/toolbar/RevealAll.spec.js.map +1 -1
  392. package/react/components/toolbar/RevealAll.stories.js.map +1 -1
  393. package/react/components/toolbar/ToolbarIcon.js.map +1 -1
  394. package/react/components/toolbar/ToolbarSection.js.map +1 -1
  395. package/react/components/toolbar/ToolbarShell.js.map +1 -1
  396. package/react/components/toolbar/advancedAppLauncher/AdvancedAppLauncher.js.map +1 -1
  397. package/react/components/toolbar/advancedAppLauncher/AdvancedAppLauncherMenu.js.map +1 -1
  398. package/react/components/toolbar/advancedAppLauncher/components/AddNewAppForm.js.map +1 -1
  399. package/react/components/toolbar/advancedAppLauncher/components/AddNewFolder.js.map +1 -1
  400. package/react/components/toolbar/advancedAppLauncher/components/AppActionsMenu.js.map +1 -1
  401. package/react/components/toolbar/advancedAppLauncher/components/AppDefinition.js.map +1 -1
  402. package/react/components/toolbar/advancedAppLauncher/components/AppTagsList.js.map +1 -1
  403. package/react/components/toolbar/advancedAppLauncher/components/Content.js.map +1 -1
  404. package/react/components/toolbar/advancedAppLauncher/components/FilterSort.js.map +1 -1
  405. package/react/components/toolbar/advancedAppLauncher/components/FoldersList.js.map +1 -1
  406. package/react/components/toolbar/advancedAppLauncher/components/LeftNavBottomLinks.js.map +1 -1
  407. package/react/components/toolbar/advancedAppLauncher/components/NoAppsFound.js.map +1 -1
  408. package/react/components/toolbar/advancedAppLauncher/components/SearchBox.js.map +1 -1
  409. package/react/components/toolbar/advancedAppLauncher/components/SortBy.js.map +1 -1
  410. package/react/components/toolbar/advancedAppLauncher/components/TagsList.js.map +1 -1
  411. package/react/components/toolbar/advancedAppLauncher/components/TagsMenu.js.map +1 -1
  412. package/react/components/toolbar/advancedAppLauncher/components/ToggleFavoriteDropdown.js.map +1 -1
  413. package/react/components/toolbar/advancedAppLauncher/modules/AppDirectory.js.map +1 -1
  414. package/react/components/toolbar/advancedAppLauncher/modules/FDC3.js.map +1 -1
  415. package/react/components/toolbar/advancedAppLauncher/stores/LauncherStore.js.map +1 -1
  416. package/react/components/toolbar/advancedAppLauncher/stores/StoreActions.js.map +1 -1
  417. package/react/components/toolbar/advancedAppLauncher/utils/sort-functions.js.map +1 -1
  418. package/react/components/toolbar/appLauncher/AppLauncherMenu.js.map +1 -1
  419. package/react/components/toolbar/appLauncher/DynamicAppLauncher.js.map +1 -1
  420. package/react/components/toolbar/appLauncher/StaticAppLauncherMenu.js.map +1 -1
  421. package/react/components/toolbar/appLauncher/appLauncher.css +30 -30
  422. package/react/components/toolbar/appLauncher/components/componentList.js.map +1 -1
  423. package/react/components/toolbar/appLauncher/stores/appLauncherStore.js.map +1 -1
  424. package/react/components/toolbar/dashbar/Dashbar.js.map +1 -1
  425. package/react/components/toolbar/dashbar/DashbarItem.js.map +1 -1
  426. package/react/components/toolbar/index.js.map +1 -1
  427. package/react/components/toolbar/workspaceManagementMenu/WorkspaceManagementMenu.js.map +1 -1
  428. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js.map +1 -1
  429. package/react/components/toolbar/workspaceManagementMenu/components/WorkspaceActions.js.map +1 -1
  430. package/react/components/toolbar/workspaceManagementMenu/components/WorkspaceList.js.map +1 -1
  431. package/react/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.js.map +1 -1
  432. package/react/components/toolbar/workspaceManagementMenu/workspaceManagementMenu.css +90 -90
  433. package/react/components/userPreferences/NotificationsPreferencesContext.js.map +1 -1
  434. package/react/components/userPreferences/UserPreferenceTypes.js.map +1 -1
  435. package/react/components/userPreferences/UserPreferences.js.map +1 -1
  436. package/react/components/userPreferences/UserPreferencesBase.js.map +1 -1
  437. package/react/components/userPreferences/UserPreferencesWrapper.js.map +1 -1
  438. package/react/components/userPreferences/components/ContentSection.js.map +1 -1
  439. package/react/components/userPreferences/components/LeftNav.js.map +1 -1
  440. package/react/components/userPreferences/components/content/DashbarEditor.js.map +1 -1
  441. package/react/components/userPreferences/components/content/DashbarEditorItem.js.map +1 -1
  442. package/react/components/userPreferences/components/content/General.js.map +1 -1
  443. package/react/components/userPreferences/components/content/Notifications.js.map +1 -1
  444. package/react/components/userPreferences/components/content/Workspaces.js.map +1 -1
  445. package/react/components/userPreferences/components/content/notificationViews/NotificationsPreferencesHome.js.map +1 -1
  446. package/react/components/userPreferences/components/content/notificationViews/NotificationsSourceTypes.js.map +1 -1
  447. package/react/components/userPreferences/components/content/notificationViews/NotificationsSourcesPreferences.js.map +1 -1
  448. package/react/components/userPreferences/components/content/notificationViews/notificationViewsUtils.js.map +1 -1
  449. package/react/components/userPreferences/components/general/ScheduledRestart.js.map +1 -1
  450. package/react/components/userPreferences/components/workspaces/WorkspaceButton.js.map +1 -1
  451. package/react/components/userPreferences/components/workspaces/WorkspaceComponents.js.map +1 -1
  452. package/react/components/userPreferences/components/workspaces/WorkspaceItem.js.map +1 -1
  453. package/react/components/userPreferences/components/workspaces/WorkspaceItemList.js.map +1 -1
  454. package/react/components/userPreferences/index.js.map +1 -1
  455. package/react/components/userPreferences/stores/UserPreferencesStore.js.map +1 -1
  456. package/react/components/userPreferences/stories/DashbarEditor.stories.js.map +1 -1
  457. package/react/components/userPreferences/stories/DashbarEditorItem.stories.js.map +1 -1
  458. package/react/components/userPreferences/stories/General.stories.js.map +1 -1
  459. package/react/components/userPreferences/stories/Notifications.stories.js.map +1 -1
  460. package/react/components/userPreferences/stories/NotificationsSourceTypes.stories.js.map +1 -1
  461. package/react/components/userPreferences/stories/NotificationsSources.stories.js.map +1 -1
  462. package/react/components/userPreferences/stories/UserPreferences.stories.js.map +1 -1
  463. package/react/components/userPreferences/stories/WorkspaceButton.stories.js.map +1 -1
  464. package/react/components/userPreferences/stories/WorkspaceComponents.stories.js.map +1 -1
  465. package/react/components/userPreferences/stories/WorkspaceItem.stories.js.map +1 -1
  466. package/react/components/userPreferences/stories/WorkspaceItemList.stories.js.map +1 -1
  467. package/react/components/userPreferences/stories/Workspaces.stories.js.map +1 -1
  468. package/react/components/userPreferences/tests/ContentSection.spec.js.map +1 -1
  469. package/react/components/userPreferences/tests/DashbarEditor.spec.js.map +1 -1
  470. package/react/components/userPreferences/tests/DashbarEditorItem.spec.js.map +1 -1
  471. package/react/components/userPreferences/tests/General.spec.js.map +1 -1
  472. package/react/components/userPreferences/tests/LeftNav.spec.js.map +1 -1
  473. package/react/components/userPreferences/tests/NotificationSourceTypes.spec.js.map +1 -1
  474. package/react/components/userPreferences/tests/Notifications.spec.js.map +1 -1
  475. package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js.map +1 -1
  476. package/react/components/userPreferences/tests/NotificationsSourcesPreferences.spec.js.map +1 -1
  477. package/react/components/userPreferences/tests/ScheduledRestart.spec.js.map +1 -1
  478. package/react/components/userPreferences/tests/WorkspaceButton.spec.js.map +1 -1
  479. package/react/components/userPreferences/tests/WorkspaceComponents.spec.js.map +1 -1
  480. package/react/components/userPreferences/tests/WorkspaceItem.spec.js.map +1 -1
  481. package/react/components/userPreferences/tests/WorkspaceItemList.spec.js.map +1 -1
  482. package/react/components/utils.js.map +1 -1
  483. package/react/components/windowTitleBar/WindowTitleBarShell.js.map +1 -1
  484. package/react/components/windowTitleBar/components/center/Tab.js.map +1 -1
  485. package/react/components/windowTitleBar/components/center/TabList.js.map +1 -1
  486. package/react/components/windowTitleBar/components/center/TabRegion.js.map +1 -1
  487. package/react/components/windowTitleBar/components/left/LinkerButton.js.map +1 -1
  488. package/react/components/windowTitleBar/components/left/LinkerButtonDeprecated.js.map +1 -1
  489. package/react/components/windowTitleBar/components/left/LinkerGroups.js.map +1 -1
  490. package/react/components/windowTitleBar/components/left/LinkerGroupsDeprecated.js.map +1 -1
  491. package/react/components/windowTitleBar/components/left/ShareButton.js.map +1 -1
  492. package/react/components/windowTitleBar/components/right/AlwaysOnTopButton.js.map +1 -1
  493. package/react/components/windowTitleBar/components/right/CloseButton.js.map +1 -1
  494. package/react/components/windowTitleBar/components/right/GroupingButton.js.map +1 -1
  495. package/react/components/windowTitleBar/components/right/MaximizeButton.js.map +1 -1
  496. package/react/components/windowTitleBar/components/right/MinimizeButton.js.map +1 -1
  497. package/react/components/windowTitleBar/components/windowTitle.js.map +1 -1
  498. package/react/components/windowTitleBar/index.js.map +1 -1
  499. package/react/components/windowTitleBar/stores/windowTitleBarStore.js.map +1 -1
  500. package/react/components/windowTitleBar/stores/windowTitleBarStoreDefaults.js.map +1 -1
  501. package/react/components/windowTitleBar/windowTitleBarContext.js.map +1 -1
  502. package/react/components/yesNoDialog/Timer.spec.js.map +1 -1
  503. package/react/components/yesNoDialog/Timer.stories.js.map +1 -1
  504. package/react/components/yesNoDialog/YesNoDialog.css +3 -3
  505. package/react/components/yesNoDialog/YesNoDialog.js.map +1 -1
  506. package/react/components/yesNoDialog/YesNoDialog.spec.js.map +1 -1
  507. package/react/components/yesNoDialog/YesNoDialog.stories.js.map +1 -1
  508. package/react/components/yesNoDialog/index.js.map +1 -1
  509. package/react/components/yesNoDialog/timer.js.map +1 -1
  510. package/react/enzymeSetup.js.map +1 -1
  511. package/react/hooks/index.js.map +1 -1
  512. package/react/hooks/useAuth.js.map +1 -1
  513. package/react/hooks/useDeepEffect.js.map +1 -1
  514. package/react/hooks/useFavorites.js.map +1 -1
  515. package/react/hooks/useFavoritesShell.js.map +1 -1
  516. package/react/hooks/useHotkey.js.map +1 -1
  517. package/react/hooks/useLinker.js.map +1 -1
  518. package/react/hooks/useMenu.js.map +1 -1
  519. package/react/hooks/useNotifications.js.map +1 -1
  520. package/react/hooks/useOutsideClickDetector.js.map +1 -1
  521. package/react/hooks/usePubSub.js.map +1 -1
  522. package/react/hooks/useSearch.js.map +1 -1
  523. package/react/hooks/useToolbar.js.map +1 -1
  524. package/react/hooks/useWorkspace.js.map +1 -1
  525. package/react/reducers/favoriteReducer.js.map +1 -1
  526. package/react/reducers/linkerReducer.js.map +1 -1
  527. package/react/reducers/menuReducer.js.map +1 -1
  528. package/react/reducers/rootReducer.js.map +1 -1
  529. package/react/reducers/searchReducer.js.map +1 -1
  530. package/react/reducers/smartDesktopDesignerReducer.js.map +1 -1
  531. package/react/reducers/toolbarReducer.js.map +1 -1
  532. package/react/reducers/workspaceReducer.js.map +1 -1
  533. package/react/store.js.map +1 -1
  534. package/react/types/advancedAppLauncherTypes.js.map +1 -1
  535. package/react/types/dashbarTypes.js.map +1 -1
  536. package/react/types/favoriteTypes.js.map +1 -1
  537. package/react/types/fdc3.js.map +1 -1
  538. package/react/types/hotkeyTypes.js.map +1 -1
  539. package/react/types/iconTypes.js.map +1 -1
  540. package/react/types/linkerTypes.js.map +1 -1
  541. package/react/types/searchTypes.js.map +1 -1
  542. package/react/types/smartDesktopDesignerTypes.js.map +1 -1
  543. package/react/types/windowTitleBar.js.map +1 -1
  544. package/react/types/workspaceTypes.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"YesNoDialog.js","sourceRoot":"","sources":["../../../src/components/yesNoDialog/YesNoDialog.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,uBAAuB,GAAG;IAC/B,KAAK,EAAE,aAAa;IACpB,QAAQ,EAAE,cAAc;IACxB,qBAAqB,EAAE,IAAI;IAC3B,wBAAwB,EAAE,KAAK;IAC/B,mBAAmB,EAAE,QAAQ;IAC7B,kBAAkB,EAAE,IAAI;IACxB,qBAAqB,EA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BAAyB,EAAE,IAAI,CAAC,mBAAmB,EAAE,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,aAAa,GAAI,CACvG,CACwB;YAC1B,6BAAK,SAAS,EAAC,gBAAgB;gBAC9B,oBAAC,qBAAqB,IACrB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,EACnC,SAAS,EAAC,qBAAqB,EAC/B,OAAO,EAAE,IAAI,CAAC,oBAAoB,IAEjC,IAAI,CAAC,KAAK,CAAC,qBAAqB,CACV;gBAExB,oBAAC,qBAAqB,IACrB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,EACjC,SAAS,EAAC,qBAAqB,EAC/B,OAAO,EAAE,IAAI,CAAC,kBAAkB,IAE/B,IAAI,CAAC,KAAK,CAAC,mBAAmB,CACR;gBAExB,oBAAC,qBAAqB,IACrB,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,qBAAqB,EACtC,SAAS,EAAC,yBAAyB,EACnC,OAAO,EAAE,IAAI,CAAC,uBAAuB,IAEpC,IAAI,CAAC,KAAK,CAAC,wBAAwB,CACb,CACnB,CACW,CAClB,CAAC;IACH,CAAC;CACD;AAKD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,oBAAC,eAAe,OAAG,CAAC","sourcesContent":["/*!\r\n * Copyright 2017 by ChartIQ, Inc.\r\n * All rights reserved.\r\n */\r\nimport React from \"react\";\r\nimport \"./YesNoDialog.css\";\r\nimport \"../../assets/css/dialogs.css\";\r\nimport { FinsembleDialog } from \"../legacyControls/FinsembleDialog\";\r\nimport { FinsembleDialogQuestion } from \"../legacyControls/FinsembleDialogQuestion\";\r\nimport { FinsembleDialogButton } from \"../legacyControls/FinsembleDialogButton\";\r\nimport Timer from \"./timer\";\r\nconst DEFAULT_TITLE = \"\";\r\nconst DEFAULT_COMPONENT_STATE = {\r\n\ttitle: DEFAULT_TITLE,\r\n\tquestion: \"No question.\",\r\n\tnegativeResponseLabel: \"No\",\r\n\taffirmativeResponseLabel: \"Yes\",\r\n\tcancelResponseLabel: \"Cancel\",\r\n\tshowNegativeButton: true,\r\n\tshowAffirmativeButton: true,\r\n\tshowCancelButton: true,\r\n};\r\n\r\ninterface IProps {}\r\ninterface IState {\r\n\ttitle: string;\r\n\tquestion: string;\r\n\tnegativeResponseLabel: string;\r\n\taffirmativeResponseLabel: string;\r\n\tcancelResponseLabel: string;\r\n\tshowNegativeButton: boolean;\r\n\tshowAffirmativeButton: boolean;\r\n\tshowCancelButton: boolean;\r\n\thideModalOnClose?: boolean;\r\n\tshowTimer?: boolean;\r\n\ttimerDuration?: number | null;\r\n}\r\n\r\n/**\r\n * This is our standard dialog that presents the user with 1 - 3 choices. It can be used to allow the user to confirm, reject, or cancel an action. All of these options can be included, and all can be excluded.\r\n *\r\n * @class YesNoDialog\r\n * @extends {React.Component}\r\n */\r\nclass YesNoDialogBase extends React.Component<IProps, IState> {\r\n\tconstructor(props = {}) {\r\n\t\tsuper(props);\r\n\t\tthis.bindCorrectContext();\r\n\t\tthis.state = DEFAULT_COMPONENT_STATE;\r\n\t\tdocument.body.addEventListener(\"keydown\", this.handleKeydownOnBody);\r\n\t}\r\n\r\n\t/**\r\n\t * Handles escape and enter.\r\n\t *\r\n\t * @param {any} e\r\n\t * @memberof YesNoDialog\r\n\t */\r\n\thandleKeydownOnBody(e: any) {\r\n\t\tif (e.code === \"Enter\" && e.shiftKey === false) {\r\n\t\t\tthis.sendResponse(\"affirmative\");\r\n\t\t}\r\n\r\n\t\tif (e.code === \"Escape\") {\r\n\t\t\tthis.sendResponse(\"cancel\");\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Necessary to ensure that `this` is correct when our methods are invoked.\r\n\t *\r\n\t * @memberof YesNoDialog\r\n\t */\r\n\tbindCorrectContext() {\r\n\t\tthis.handleKeydownOnBody = this.handleKeydownOnBody.bind(this);\r\n\t\tthis.onShowRequested = this.onShowRequested.bind(this);\r\n\t\tthis.sendAffirmativeResponse = this.sendAffirmativeResponse.bind(this);\r\n\t\tthis.sendCancelResponse = this.sendCancelResponse.bind(this);\r\n\t\tthis.sendNegativeResponse = this.sendNegativeResponse.bind(this);\r\n\t\tthis.sendExpiredResponse = this.sendExpiredResponse.bind(this);\r\n\t\tthis.sendResponse = this.sendResponse.bind(this);\r\n\t}\r\n\r\n\t/**\r\n\t * When the opener requests that the dialog show itself, it also passes in initialization data. This function grabs that data, calls setState, and then fits the window to the contents of the DOM. Then we call `showDialog`, which will display the dialog on the proper monitor.\r\n\t *\r\n\t * @param {any} err\r\n\t * @param {any} response\r\n\t * @memberof YesNoDialog\r\n\t */\r\n\tonShowRequested(err: any, response: any) {\r\n\t\tlet { data } = response;\r\n\t\tthis.setState(\r\n\t\t\t{\r\n\t\t\t\ttitle: typeof data.title === \"undefined\" ? DEFAULT_TITLE : data.title,\r\n\t\t\t\thideModalOnClose: typeof data.hideModalOnClose === \"undefined\" ? true : data.hideModalOnClose,\r\n\t\t\t\tquestion: data.question,\r\n\t\t\t\tnegativeResponseLabel: data.negativeResponseLabel || \"No\",\r\n\t\t\t\taffirmativeResponseLabel: data.affirmativeResponseLabel || \"Yes\",\r\n\t\t\t\tcancelResponseLabel: data.cancelResponseLabel || \"Cancel\",\r\n\t\t\t\tshowNegativeButton: typeof data.showNegativeButton === \"undefined\" ? true : data.showNegativeButton,\r\n\t\t\t\tshowAffirmativeButton: typeof data.showAffirmativeButton === \"undefined\" ? true : data.showAffirmativeButton,\r\n\t\t\t\tshowCancelButton: typeof data.showCancelButton === \"undefined\" ? true : data.showCancelButton,\r\n\t\t\t\tshowTimer: typeof data.showTimer === \"undefined\" ? false : data.showTimer,\r\n\t\t\t\ttimerDuration: typeof data.timerDuration === \"undefined\" ? null : data.timerDuration,\r\n\t\t\t},\r\n\t\t\tthis.fitAndShow\r\n\t\t);\r\n\t}\r\n\r\n\t/**\r\n\t * Fits the contents of the DOM to the window, then calls `showDialog`, which positions the dialog on the proper monitor and toggles the visibility of the window.\r\n\t *\r\n\t * @memberof YesNoDialog\r\n\t */\r\n\tfitAndShow() {\r\n\t\tFSBL.Clients.WindowClient.fitToDOM(null, () => {\r\n\t\t\tFSBL.Clients.DialogManager.showDialog();\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Sends user input to the opener.\r\n\t *\r\n\t * @param {any} response\r\n\t * @memberof YesNoDialog\r\n\t */\r\n\tsendResponse(response: any) {\r\n\t\tconsole.log(\"Response: \", response);\r\n\t\tFSBL.Clients.DialogManager.respondToOpener({\r\n\t\t\tchoice: response,\r\n\t\t\thideModalOnClose: this.state.hideModalOnClose,\r\n\t\t});\r\n\t\t// This will detach the timer component from the dom. Next time the component comes up, it'll have a fresh timer.\r\n\t\tthis.setState({\r\n\t\t\tshowTimer: false,\r\n\t\t});\r\n\t}\r\n\r\n\t/**\r\n\t * Sends an affirmative response to the opener.\r\n\t *\r\n\t * @memberof YesNoDialog\r\n\t */\r\n\tsendAffirmativeResponse() {\r\n\t\tthis.sendResponse(\"affirmative\");\r\n\t}\r\n\r\n\t/**\r\n\t * Sends a negative response to the opener.\r\n\t *\r\n\t * @memberof YesNoDialog\r\n\t */\r\n\tsendNegativeResponse() {\r\n\t\tthis.sendResponse(\"negative\");\r\n\t}\r\n\r\n\t/**\r\n\t * Sends a cancel response to the opener.\r\n\t *\r\n\t * @memberof YesNoDialog\r\n\t */\r\n\tsendCancelResponse() {\r\n\t\tthis.sendResponse(\"cancel\");\r\n\t}\r\n\r\n\t/**\r\n\t * Sends an expired response to the opener.\r\n\t *\r\n\t * @memberof YesNoDialog\r\n\t */\r\n\tsendExpiredResponse() {\r\n\t\tthis.sendResponse(\"expired\");\r\n\t}\r\n\r\n\trender() {\r\n\t\treturn (\r\n\t\t\t<FinsembleDialog\r\n\t\t\t\tuserInputTimeout={10000}\r\n\t\t\t\tbehaviorOnResponse=\"hide\"\r\n\t\t\t\tonShowRequested={this.onShowRequested}\r\n\t\t\t\tisModal={true}\r\n\t\t\t>\r\n\t\t\t\t<div className=\"dialog-title\">{this.state.title}</div>\r\n\t\t\t\t<FinsembleDialogQuestion>\r\n\t\t\t\t\t{this.state.question}\r\n\t\t\t\t\t{this.state.showTimer && typeof this.state.timerDuration === \"number\" && (\r\n\t\t\t\t\t\t<Timer ontimerDurationExpiration={this.sendExpiredResponse} timerDuration={this.state.timerDuration} />\r\n\t\t\t\t\t)}\r\n\t\t\t\t</FinsembleDialogQuestion>\r\n\t\t\t\t<div className=\"button-wrapper\">\r\n\t\t\t\t\t<FinsembleDialogButton\r\n\t\t\t\t\t\tshow={this.state.showNegativeButton}\r\n\t\t\t\t\t\tclassName=\"fsbl-button-neutral\"\r\n\t\t\t\t\t\tonClick={this.sendNegativeResponse}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t{this.state.negativeResponseLabel}\r\n\t\t\t\t\t</FinsembleDialogButton>\r\n\r\n\t\t\t\t\t<FinsembleDialogButton\r\n\t\t\t\t\t\tshow={this.state.showCancelButton}\r\n\t\t\t\t\t\tclassName=\"fsbl-button-neutral\"\r\n\t\t\t\t\t\tonClick={this.sendCancelResponse}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t{this.state.cancelResponseLabel}\r\n\t\t\t\t\t</FinsembleDialogButton>\r\n\r\n\t\t\t\t\t<FinsembleDialogButton\r\n\t\t\t\t\t\tshow={this.state.showAffirmativeButton}\r\n\t\t\t\t\t\tclassName=\"fsbl-button-affirmative\"\r\n\t\t\t\t\t\tonClick={this.sendAffirmativeResponse}\r\n\t\t\t\t\t>\r\n\t\t\t\t\t\t{this.state.affirmativeResponseLabel}\r\n\t\t\t\t\t</FinsembleDialogButton>\r\n\t\t\t\t</div>\r\n\t\t\t</FinsembleDialog>\r\n\t\t);\r\n\t}\r\n}\r\n\r\n/**\r\n * This dialog window provides a binary choice to the user, and reports back the response to the opener.\r\n */\r\nexport const YesNoDialog = () => <YesNoDialogBase />;\r\n"]}
1
+ {"version":3,"file":"YesNoDialog.js","sourceRoot":"","sources":["../../../src/components/yesNo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,wBAAwB,CACb,CACnB,CACW,CAClB,CAAC;IACH,CAAC;CACD;AAKD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,oBAAC,eAAe,OAAG,CAAC","sourcesContent":["/*!\n * Copyright 2017 by ChartIQ, Inc.\n * All rights reserved.\n */\nimport React from \"react\";\nimport \"./YesNoDialog.css\";\nimport \"../../assets/css/dialogs.css\";\nimport { FinsembleDialog } from \"../legacyControls/FinsembleDialog\";\nimport { FinsembleDialogQuestion } from \"../legacyControls/FinsembleDialogQuestion\";\nimport { FinsembleDialogButton } from \"../legacyControls/FinsembleDialogButton\";\nimport Timer from \"./timer\";\nconst DEFAULT_TITLE = \"\";\nconst DEFAULT_COMPONENT_STATE = {\n\ttitle: DEFAULT_TITLE,\n\tquestion: \"No question.\",\n\tnegativeResponseLabel: \"No\",\n\taffirmativeResponseLabel: \"Yes\",\n\tcancelResponseLabel: \"Cancel\",\n\tshowNegativeButton: true,\n\tshowAffirmativeButton: true,\n\tshowCancelButton: true,\n};\n\ninterface IProps {}\ninterface IState {\n\ttitle: string;\n\tquestion: string;\n\tnegativeResponseLabel: string;\n\taffirmativeResponseLabel: string;\n\tcancelResponseLabel: string;\n\tshowNegativeButton: boolean;\n\tshowAffirmativeButton: boolean;\n\tshowCancelButton: boolean;\n\thideModalOnClose?: boolean;\n\tshowTimer?: boolean;\n\ttimerDuration?: number | null;\n}\n\n/**\n * This is our standard dialog that presents the user with 1 - 3 choices. It can be used to allow the user to confirm, reject, or cancel an action. All of these options can be included, and all can be excluded.\n *\n * @class YesNoDialog\n * @extends {React.Component}\n */\nclass YesNoDialogBase extends React.Component<IProps, IState> {\n\tconstructor(props = {}) {\n\t\tsuper(props);\n\t\tthis.bindCorrectContext();\n\t\tthis.state = DEFAULT_COMPONENT_STATE;\n\t\tdocument.body.addEventListener(\"keydown\", this.handleKeydownOnBody);\n\t}\n\n\t/**\n\t * Handles escape and enter.\n\t *\n\t * @param {any} e\n\t * @memberof YesNoDialog\n\t */\n\thandleKeydownOnBody(e: any) {\n\t\tif (e.code === \"Enter\" && e.shiftKey === false) {\n\t\t\tthis.sendResponse(\"affirmative\");\n\t\t}\n\n\t\tif (e.code === \"Escape\") {\n\t\t\tthis.sendResponse(\"cancel\");\n\t\t}\n\t}\n\n\t/**\n\t * Necessary to ensure that `this` is correct when our methods are invoked.\n\t *\n\t * @memberof YesNoDialog\n\t */\n\tbindCorrectContext() {\n\t\tthis.handleKeydownOnBody = this.handleKeydownOnBody.bind(this);\n\t\tthis.onShowRequested = this.onShowRequested.bind(this);\n\t\tthis.sendAffirmativeResponse = this.sendAffirmativeResponse.bind(this);\n\t\tthis.sendCancelResponse = this.sendCancelResponse.bind(this);\n\t\tthis.sendNegativeResponse = this.sendNegativeResponse.bind(this);\n\t\tthis.sendExpiredResponse = this.sendExpiredResponse.bind(this);\n\t\tthis.sendResponse = this.sendResponse.bind(this);\n\t}\n\n\t/**\n\t * When the opener requests that the dialog show itself, it also passes in initialization data. This function grabs that data, calls setState, and then fits the window to the contents of the DOM. Then we call `showDialog`, which will display the dialog on the proper monitor.\n\t *\n\t * @param {any} err\n\t * @param {any} response\n\t * @memberof YesNoDialog\n\t */\n\tonShowRequested(err: any, response: any) {\n\t\tlet { data } = response;\n\t\tthis.setState(\n\t\t\t{\n\t\t\t\ttitle: typeof data.title === \"undefined\" ? DEFAULT_TITLE : data.title,\n\t\t\t\thideModalOnClose: typeof data.hideModalOnClose === \"undefined\" ? true : data.hideModalOnClose,\n\t\t\t\tquestion: data.question,\n\t\t\t\tnegativeResponseLabel: data.negativeResponseLabel || \"No\",\n\t\t\t\taffirmativeResponseLabel: data.affirmativeResponseLabel || \"Yes\",\n\t\t\t\tcancelResponseLabel: data.cancelResponseLabel || \"Cancel\",\n\t\t\t\tshowNegativeButton: typeof data.showNegativeButton === \"undefined\" ? true : data.showNegativeButton,\n\t\t\t\tshowAffirmativeButton: typeof data.showAffirmativeButton === \"undefined\" ? true : data.showAffirmativeButton,\n\t\t\t\tshowCancelButton: typeof data.showCancelButton === \"undefined\" ? true : data.showCancelButton,\n\t\t\t\tshowTimer: typeof data.showTimer === \"undefined\" ? false : data.showTimer,\n\t\t\t\ttimerDuration: typeof data.timerDuration === \"undefined\" ? null : data.timerDuration,\n\t\t\t},\n\t\t\tthis.fitAndShow\n\t\t);\n\t}\n\n\t/**\n\t * Fits the contents of the DOM to the window, then calls `showDialog`, which positions the dialog on the proper monitor and toggles the visibility of the window.\n\t *\n\t * @memberof YesNoDialog\n\t */\n\tfitAndShow() {\n\t\tFSBL.Clients.WindowClient.fitToDOM(null, () => {\n\t\t\tFSBL.Clients.DialogManager.showDialog();\n\t\t});\n\t}\n\n\t/**\n\t * Sends user input to the opener.\n\t *\n\t * @param {any} response\n\t * @memberof YesNoDialog\n\t */\n\tsendResponse(response: any) {\n\t\tconsole.log(\"Response: \", response);\n\t\tFSBL.Clients.DialogManager.respondToOpener({\n\t\t\tchoice: response,\n\t\t\thideModalOnClose: this.state.hideModalOnClose,\n\t\t});\n\t\t// This will detach the timer component from the dom. Next time the component comes up, it'll have a fresh timer.\n\t\tthis.setState({\n\t\t\tshowTimer: false,\n\t\t});\n\t}\n\n\t/**\n\t * Sends an affirmative response to the opener.\n\t *\n\t * @memberof YesNoDialog\n\t */\n\tsendAffirmativeResponse() {\n\t\tthis.sendResponse(\"affirmative\");\n\t}\n\n\t/**\n\t * Sends a negative response to the opener.\n\t *\n\t * @memberof YesNoDialog\n\t */\n\tsendNegativeResponse() {\n\t\tthis.sendResponse(\"negative\");\n\t}\n\n\t/**\n\t * Sends a cancel response to the opener.\n\t *\n\t * @memberof YesNoDialog\n\t */\n\tsendCancelResponse() {\n\t\tthis.sendResponse(\"cancel\");\n\t}\n\n\t/**\n\t * Sends an expired response to the opener.\n\t *\n\t * @memberof YesNoDialog\n\t */\n\tsendExpiredResponse() {\n\t\tthis.sendResponse(\"expired\");\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<FinsembleDialog\n\t\t\t\tuserInputTimeout={10000}\n\t\t\t\tbehaviorOnResponse=\"hide\"\n\t\t\t\tonShowRequested={this.onShowRequested}\n\t\t\t\tisModal={true}\n\t\t\t>\n\t\t\t\t<div className=\"dialog-title\">{this.state.title}</div>\n\t\t\t\t<FinsembleDialogQuestion>\n\t\t\t\t\t{this.state.question}\n\t\t\t\t\t{this.state.showTimer && typeof this.state.timerDuration === \"number\" && (\n\t\t\t\t\t\t<Timer ontimerDurationExpiration={this.sendExpiredResponse} timerDuration={this.state.timerDuration} />\n\t\t\t\t\t)}\n\t\t\t\t</FinsembleDialogQuestion>\n\t\t\t\t<div className=\"button-wrapper\">\n\t\t\t\t\t<FinsembleDialogButton\n\t\t\t\t\t\tshow={this.state.showNegativeButton}\n\t\t\t\t\t\tclassName=\"fsbl-button-neutral\"\n\t\t\t\t\t\tonClick={this.sendNegativeResponse}\n\t\t\t\t\t>\n\t\t\t\t\t\t{this.state.negativeResponseLabel}\n\t\t\t\t\t</FinsembleDialogButton>\n\n\t\t\t\t\t<FinsembleDialogButton\n\t\t\t\t\t\tshow={this.state.showCancelButton}\n\t\t\t\t\t\tclassName=\"fsbl-button-neutral\"\n\t\t\t\t\t\tonClick={this.sendCancelResponse}\n\t\t\t\t\t>\n\t\t\t\t\t\t{this.state.cancelResponseLabel}\n\t\t\t\t\t</FinsembleDialogButton>\n\n\t\t\t\t\t<FinsembleDialogButton\n\t\t\t\t\t\tshow={this.state.showAffirmativeButton}\n\t\t\t\t\t\tclassName=\"fsbl-button-affirmative\"\n\t\t\t\t\t\tonClick={this.sendAffirmativeResponse}\n\t\t\t\t\t>\n\t\t\t\t\t\t{this.state.affirmativeResponseLabel}\n\t\t\t\t\t</FinsembleDialogButton>\n\t\t\t\t</div>\n\t\t\t</FinsembleDialog>\n\t\t);\n\t}\n}\n\n/**\n * This dialog window provides a binary choice to the user, and reports back the response to the opener.\n */\nexport const YesNoDialog = () => <YesNoDialogBase />;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"YesNoDial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,WAAW,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,IAAI,CAAC,qCAAqC,EAAE,GAAG,EAAE;IAKpD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as React from \"react\";\r\nimport { mount } from \"enzyme\";\r\nimport { describe, it } from \"mocha\";\r\nimport { expect } from \"chai\";\r\nimport sinon from \"sinon\";\r\nimport { Basic, Empty, WithTimer, NoText, NoButtons, CustomButtonLabels } from \"./YesNoDialog.stories\";\r\nimport { accessibilityAssessor } from \"../smartDesktopDesigner/tests/a11y_helper\";\r\n\r\ndescribe(\"<YesNoDialog/>\", () => {\r\n\tit(\"should pass accessibility scans\", async () => {\r\n\t\tconst wrapper = mount(<Basic />);\r\n\r\n\t\texpect(await accessibilityAssessor(wrapper)).to.be.true;\r\n\t});\r\n\tit(\"should display Yes, No, and Cancel by default\", async () => {\r\n\t\tconst wrapper = mount(<Empty />);\r\n\r\n\t\tconst dialog_text = wrapper.find(\".dialog\").text();\r\n\t\texpect(dialog_text).to.contain(\"Yes\");\r\n\t\texpect(dialog_text).to.contain(\"No\");\r\n\t\texpect(dialog_text).to.contain(\"Cancel\");\r\n\t});\r\n\tit(\"should display Yes and Cancel, but not No\", async () => {\r\n\t\tconst wrapper = mount(<Basic {...(Basic.args as any)} />);\r\n\r\n\t\tconst dialog_text = wrapper.find(\".dialog\").text();\r\n\t\texpect(dialog_text).to.contain(\"Yes\");\r\n\t\texpect(dialog_text).to.not.contain(\"No\");\r\n\t\texpect(dialog_text).to.contain(\"Cancel\");\r\n\t});\r\n\tit(\"should show 'Time remaining' until the clock ticks away\", () => {\r\n\t\tconst clock = sinon.useFakeTimers();\r\n\t\tconst wrapper = mount(<WithTimer {...(WithTimer.args as any)} />);\r\n\r\n\t\texpect(wrapper.find(\".dialog\").text(), \"Before countdown\").to.contain(\"Time remaining:\");\r\n\t\tclock.tick(1000);\r\n\t\tclock.tick(1000);\r\n\t\tclock.tick(1000);\r\n\t\texpect(wrapper.find(\".dialog\").text(), \"After countdown\").to.not.contain(\"Time remaining:\");\r\n\t\tclock.restore();\r\n\t});\r\n\tit(\"should display empty text if no title is provided\", () => {\r\n\t\tconst wrapper = mount(<NoText {...(NoText.args as any)} />);\r\n\t\tconst titleText = wrapper.find(\".dialog-title\").text();\r\n\t\texpect(titleText).to.be.empty;\r\n\t});\r\n\tit(\"should not display any buttons if none are approved\", () => {\r\n\t\tconst wrapper = mount(<NoButtons {...(NoButtons.args as any)} />);\r\n\t\texpect(wrapper.find(\"button\").length).to.equal(0);\r\n\t});\r\n\tit(\"should display custom button labels when provided\", () => {\r\n\t\tconst wrapper = mount(<CustomButtonLabels {...(CustomButtonLabels.args as any)} />);\r\n\r\n\t\tconst dialog_text = wrapper.find(\".dialog\").text();\r\n\t\texpect(dialog_text).to.contain(\"Tak\");\r\n\t\texpect(dialog_text).to.contain(\"Nie\");\r\n\t\texpect(dialog_text).to.contain(\"Anuluj\");\r\n\t\texpect(dialog_text).to.not.contain(\"Yes\");\r\n\t\texpect(dialog_text).to.not.contain(\"No\");\r\n\t\texpect(dialog_text).to.not.contain(\"Cancel\");\r\n\t});\r\n\tit.skip(\"should handle keyboard interactions\", () => {\r\n\t\t// const wrapper = mount(<Basic {...(Basic.args as any)} />);\r\n\t\t// Keyboard interactions are wired up to document.body.addEventListener, and Enzyme doesn't let us mock that\r\n\t\t// This is a possibility, but it would require simulant and maybe also jsdom:\r\n\t\t// https://github.com/enzymejs/enzyme/issues/426\r\n\t});\r\n});\r\n"]}
1
+ {"version":3,"file":"YesNoDialog.spec.js","sourceRoot":"","sources":["../../../src/components/yesNoDialog/YesNoDialog.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,QAAQ,EA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C,CAAC","sourcesContent":["import * as React from \"react\";\nimport { mount } from \"enzyme\";\nimport { describe, it } from \"mocha\";\nimport { expect } from \"chai\";\nimport sinon from \"sinon\";\nimport { Basic, Empty, WithTimer, NoText, NoButtons, CustomButtonLabels } from \"./YesNoDialog.stories\";\nimport { accessibilityAssessor } from \"../smartDesktopDesigner/tests/a11y_helper\";\n\ndescribe(\"<YesNoDialog/>\", () => {\n\tit(\"should pass accessibility scans\", async () => {\n\t\tconst wrapper = mount(<Basic />);\n\n\t\texpect(await accessibilityAssessor(wrapper)).to.be.true;\n\t});\n\tit(\"should display Yes, No, and Cancel by default\", async () => {\n\t\tconst wrapper = mount(<Empty />);\n\n\t\tconst dialog_text = wrapper.find(\".dialog\").text();\n\t\texpect(dialog_text).to.contain(\"Yes\");\n\t\texpect(dialog_text).to.contain(\"No\");\n\t\texpect(dialog_text).to.contain(\"Cancel\");\n\t});\n\tit(\"should display Yes and Cancel, but not No\", async () => {\n\t\tconst wrapper = mount(<Basic {...(Basic.args as any)} />);\n\n\t\tconst dialog_text = wrapper.find(\".dialog\").text();\n\t\texpect(dialog_text).to.contain(\"Yes\");\n\t\texpect(dialog_text).to.not.contain(\"No\");\n\t\texpect(dialog_text).to.contain(\"Cancel\");\n\t});\n\tit(\"should show 'Time remaining' until the clock ticks away\", () => {\n\t\tconst clock = sinon.useFakeTimers();\n\t\tconst wrapper = mount(<WithTimer {...(WithTimer.args as any)} />);\n\n\t\texpect(wrapper.find(\".dialog\").text(), \"Before countdown\").to.contain(\"Time remaining:\");\n\t\tclock.tick(1000);\n\t\tclock.tick(1000);\n\t\tclock.tick(1000);\n\t\texpect(wrapper.find(\".dialog\").text(), \"After countdown\").to.not.contain(\"Time remaining:\");\n\t\tclock.restore();\n\t});\n\tit(\"should display empty text if no title is provided\", () => {\n\t\tconst wrapper = mount(<NoText {...(NoText.args as any)} />);\n\t\tconst titleText = wrapper.find(\".dialog-title\").text();\n\t\texpect(titleText).to.be.empty;\n\t});\n\tit(\"should not display any buttons if none are approved\", () => {\n\t\tconst wrapper = mount(<NoButtons {...(NoButtons.args as any)} />);\n\t\texpect(wrapper.find(\"button\").length).to.equal(0);\n\t});\n\tit(\"should display custom button labels when provided\", () => {\n\t\tconst wrapper = mount(<CustomButtonLabels {...(CustomButtonLabels.args as any)} />);\n\n\t\tconst dialog_text = wrapper.find(\".dialog\").text();\n\t\texpect(dialog_text).to.contain(\"Tak\");\n\t\texpect(dialog_text).to.contain(\"Nie\");\n\t\texpect(dialog_text).to.contain(\"Anuluj\");\n\t\texpect(dialog_text).to.not.contain(\"Yes\");\n\t\texpect(dialog_text).to.not.contain(\"No\");\n\t\texpect(dialog_text).to.not.contain(\"Cancel\");\n\t});\n\tit.skip(\"should handle keyboard interactions\", () => {\n\t\t// const wrapper = mount(<Basic {...(Basic.args as any)} />);\n\t\t// Keyboard interactions are wired up to document.body.addEventListener, and Enzyme doesn't let us mock that\n\t\t// This is a possibility, but it would require simulant and maybe also jsdom:\n\t\t// https://github.com/enzymejs/enzyme/issues/426\n\t});\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"YesNoDialog.stories.js","sourceRoot":"","sources":["../../../src/components/yesNoDialog/YesNoDialog.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,8BAA8B,CAAC;AAEtC,eAAe;IACd,KAAK,EAAE,yBAAyB;IAChC,SAAS,EAAE,WAAW;CACtB,CAAC;AAEF,MAAM,QAAQ,GAAc,CAAC,IAAS,EAAE,EAAE;IACzC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEjB,IAAI,IAAI,CAAC,KAAK,EAAE;QACf,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,sBAAsB,GAAG,CAAC,EAAY,EAAE,EAAE;YACpE,EAAE,CAAC,EAAE,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AAY;QACnB,QAAQ,EAAE,oCAAoC;QAC9C,kBAAkB,EAAE,KAAK;QACzB,qBAAqB,EAAE,KAAK;QAC5B,gBAAgB,EAAE,KAAK;KACvB;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpD,kBAAkB,CAAC,IAAI,GAAG;IACzB,KAAK,EAAE;QACN,KAAK,EAAE,gBAAgB;QACvB,QAAQ,EAAE,qBAAqB;QAC/B,kBAAkB,EAAE,IAAI;QACxB,qBAAqB,EAAE,IAAI;QAC3B,gBAAgB,EAAE,IAAI;QACtB,wBAAwB,EAAE,KAAK;QAC/B,qBAAqB,EAAE,KAAK;QAC5B,mBAAmB,EAAE,QAAQ;QAC7B,SAAS,EAAE,KAAK;KAChB;CACD,CAAC","sourcesContent":["import React from \"react\";\r\nimport { YesNoDialog } from \"./YesNoDialog\";\r\nimport { initFSBL } from \"../common/helpers\";\r\nimport { Story } from \"@storybook/react/types-6-0\";\r\nimport \"../../assets/css/dialogs.css\";\r\n\r\nexport default {\r\n\ttitle: \"YesNoDialog/YesNoDialog\",\r\n\tcomponent: YesNoDialog,\r\n};\r\n\r\nconst Template: Story<{}> = (args: any) => {\r\n\tinitFSBL(window);\r\n\r\n\tif (args._data) {\r\n\t\tFSBL.Clients.DialogManager.registerDialogCallback = (cb: Function) => {\r\n\t\t\tcb(\"\", { data: args._data });\r\n\t\t};\r\n\t}\r\n\r\n\treturn <YesNoDialog {...args} />;\r\n};\r\n\r\nexport const Empty = Template.bind({});\r\n\r\nexport const Basic = Template.bind({});\r\nBasic.args = {\r\n\t_data: {\r\n\t\ttitle: \"Example titles\",\r\n\t\tquestion: \"Is this a question?\",\r\n\t\tshowNegativeButton: false,\r\n\t\tshowAffirmativeButton: true,\r\n\t\tshowCancelButton: true,\r\n\t\tshowTimer: false,\r\n\t},\r\n};\r\n\r\nexport const NoText = Template.bind({});\r\nNoText.args = {\r\n\t_data: {\r\n\t\tshowNegativeButton: false,\r\n\t\tshowAffirmativeButton: true,\r\n\t\tshowCancelButton: true,\r\n\t},\r\n};\r\n\r\nexport const WithTimer = Template.bind({});\r\nWithTimer.args = {\r\n\t_data: {\r\n\t\ttitle: \"Example titles\",\r\n\t\tquestion: \"Is this a question?\",\r\n\t\tshowNegativeButton: false,\r\n\t\tshowAffirmativeButton: true,\r\n\t\tshowCancelButton: true,\r\n\t\tshowTimer: true,\r\n\t\ttimerDuration: 3000,\r\n\t},\r\n};\r\n\r\nexport const NoButtons = Template.bind({});\r\nNoButtons.args = {\r\n\t_data: {\r\n\t\ttitle: \"No buttons\",\r\n\t\tquestion: \"What are you going to do about it?\",\r\n\t\tshowNegativeButton: false,\r\n\t\tshowAffirmativeButton: false,\r\n\t\tshowCancelButton: false,\r\n\t},\r\n};\r\n\r\nexport const CustomButtonLabels = Template.bind({});\r\nCustomButtonLabels.args = {\r\n\t_data: {\r\n\t\ttitle: \"Example titles\",\r\n\t\tquestion: \"Is this a question?\",\r\n\t\tshowNegativeButton: true,\r\n\t\tshowAffirmativeButton: true,\r\n\t\tshowCancelButton: true,\r\n\t\taffirmativeResponseLabel: \"Tak\",\r\n\t\tnegativeResponseLabel: \"Nie\",\r\n\t\tcancelResponseLabel: \"Anuluj\",\r\n\t\tshowTimer: false,\r\n\t},\r\n};\r\n"]}
1
+ {"version":3,"file":"YesNoDialog.stories.js","sourceRoot":"","sources":["../../../src/components/yesNoDialog/YesNoDialog.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,8BAA8B,CAAC;AAEtC,eAAe;IACd,KAAK,EAAE,yBAAyB;IAChC,SAAS,EAAE,WAAW;CACtB,CAAC;AAEF,MAAM,QAAQ,GAAc,CAAC,IAAS,EAAE,EAAE;IACz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AAE,IAAI;KACnB;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC3C,SAAS,CAAC,IAAI,GAAG;IAChB,KAAK,EAAE;QACN,KAAK,EAAE,YAAY;QACnB,QAAQ,EAAE,oCAAoC;QAC9C,kBAAkB,EAAE,KAAK;QACzB,qBAAqB,EAAE,KAAK;QAC5B,gBAAgB,EAAE,KAAK;KACvB;CACD,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpD,kBAAkB,CAAC,IAAI,GAAG;IACzB,KAAK,EAAE;QACN,KAAK,EAAE,gBAAgB;QACvB,QAAQ,EAAE,qBAAqB;QAC/B,kBAAkB,EAAE,IAAI;QACxB,qBAAqB,EAAE,IAAI;QAC3B,gBAAgB,EAAE,IAAI;QACtB,wBAAwB,EAAE,KAAK;QAC/B,qBAAqB,EAAE,KAAK;QAC5B,mBAAmB,EAAE,QAAQ;QAC7B,SAAS,EAAE,KAAK;KAChB;CACD,CAAC","sourcesContent":["import React from \"react\";\nimport { YesNoDialog } from \"./YesNoDialog\";\nimport { initFSBL } from \"../common/helpers\";\nimport { Story } from \"@storybook/react/types-6-0\";\nimport \"../../assets/css/dialogs.css\";\n\nexport default {\n\ttitle: \"YesNoDialog/YesNoDialog\",\n\tcomponent: YesNoDialog,\n};\n\nconst Template: Story<{}> = (args: any) => {\n\tinitFSBL(window);\n\n\tif (args._data) {\n\t\tFSBL.Clients.DialogManager.registerDialogCallback = (cb: Function) => {\n\t\t\tcb(\"\", { data: args._data });\n\t\t};\n\t}\n\n\treturn <YesNoDialog {...args} />;\n};\n\nexport const Empty = Template.bind({});\n\nexport const Basic = Template.bind({});\nBasic.args = {\n\t_data: {\n\t\ttitle: \"Example titles\",\n\t\tquestion: \"Is this a question?\",\n\t\tshowNegativeButton: false,\n\t\tshowAffirmativeButton: true,\n\t\tshowCancelButton: true,\n\t\tshowTimer: false,\n\t},\n};\n\nexport const NoText = Template.bind({});\nNoText.args = {\n\t_data: {\n\t\tshowNegativeButton: false,\n\t\tshowAffirmativeButton: true,\n\t\tshowCancelButton: true,\n\t},\n};\n\nexport const WithTimer = Template.bind({});\nWithTimer.args = {\n\t_data: {\n\t\ttitle: \"Example titles\",\n\t\tquestion: \"Is this a question?\",\n\t\tshowNegativeButton: false,\n\t\tshowAffirmativeButton: true,\n\t\tshowCancelButton: true,\n\t\tshowTimer: true,\n\t\ttimerDuration: 3000,\n\t},\n};\n\nexport const NoButtons = Template.bind({});\nNoButtons.args = {\n\t_data: {\n\t\ttitle: \"No buttons\",\n\t\tquestion: \"What are you going to do about it?\",\n\t\tshowNegativeButton: false,\n\t\tshowAffirmativeButton: false,\n\t\tshowCancelButton: false,\n\t},\n};\n\nexport const CustomButtonLabels = Template.bind({});\nCustomButtonLabels.args = {\n\t_data: {\n\t\ttitle: \"Example titles\",\n\t\tquestion: \"Is this a question?\",\n\t\tshowNegativeButton: true,\n\t\tshowAffirmativeButton: true,\n\t\tshowCancelButton: true,\n\t\taffirmativeResponseLabel: \"Tak\",\n\t\tnegativeResponseLabel: \"Nie\",\n\t\tcancelResponseLabel: \"Anuluj\",\n\t\tshowTimer: false,\n\t},\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/yesNoDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { YesNoDialog } from \"./YesNoDialog\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/yesNoDialog/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { YesNoDialog } from \"./YesNoDialog\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"timer.js","sourceRoot":"","sources":["../../../src/components/yesNoDialog/timer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,KAAK,CAAC,SAAyB;IAGjE,YAAY,KAAU;QACrB,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG;YACZ,aAAa,EAAE,KAAK,CAAC,aAAa;SAClC,CAAC;IACH,CAAC;IAGD,iBAAiB;QAChB,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;YAChC,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;YAC9C,IAAI,OAAO,IAAI,CAAC,EAAE;gBACjB,IAAI,CAAC,KAAK,CAAC,yBAAyB,EAAE,CAAC;gBACvC,IAAI,IAAI,CAAC,QAAQ;oBAAE,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAChD;iBAAM;gBACN,IAAI,CAAC,QAAQ,CAAC;oBACb,aAAa,EAAE,OAAO;iBACtB,CAAC,CAAC;aACH;QACF,CAAC,EAAE,IAAI,CAAC,CAAC;IACV,CAAC;IAGD,MAAM;QACL,OAAO;;YAAsB,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAO,CAAC;IACrE,CAAC;CACD","sourcesContent":["import React from \"react\";\r\n\r\nexport interface IProps {\r\n\ttimerDuration: number;\r\n\tontimerDurationExpiration: () => void;\r\n}\r\ninterface IState {\r\n\ttimerDuration: number;\r\n}\r\n\r\nexport default class Timer extends React.Component<IProps, IState> {\r\n\tinterval?: NodeJS.Timeout;\r\n\r\n\tconstructor(props: any) {\r\n\t\tsuper(props);\r\n\t\tthis.state = {\r\n\t\t\ttimerDuration: props.timerDuration,\r\n\t\t};\r\n\t}\r\n\r\n\t//Every second, subtract a second.\r\n\tcomponentDidMount() {\r\n\t\tthis.interval = setInterval(() => {\r\n\t\t\tlet newTime = this.state.timerDuration - 1000;\r\n\t\t\tif (newTime <= 0) {\r\n\t\t\t\tthis.props.ontimerDurationExpiration();\r\n\t\t\t\tif (this.interval) clearInterval(this.interval);\r\n\t\t\t} else {\r\n\t\t\t\tthis.setState({\r\n\t\t\t\t\ttimerDuration: newTime,\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}, 1000);\r\n\t}\r\n\r\n\t//Countdown clock.\r\n\trender() {\r\n\t\treturn <div>Time remaining: {this.state.timerDuration / 1000}</div>;\r\n\t}\r\n}\r\n"]}
1
+ {"version":3,"file":"timer.js","sourceRoot":"","sources":["../../../src/components/yesNoDialog/timer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,KAAK,CAAC,SAAyB;IAGjE,YAAY,KAAU;QACrB,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG;YACZ,aAAa,EAAE,KAAK,CAAC,aAAa;SAClC,CAAC;IACH,CAAC;IAGD,iBAAiB;QAChB,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;YAChC,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;YAC9C,IAAI,OAAO,IAAI,CAAC,EAAE;gBACjB,IAAI,CAAC,KAAK,CAAC,yBAAyB,EAAE,CAAC;gBACvC,IAAI,IAAI,CAAC,QAAQ;oBAAE,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aAChD;iBAAM;gBACN,IAAI,CAAC,QAAQ,CAAC;oBACb,aAAa,EAAE,OAAO;iBACtB,CAAC,CAAC;aACH;QACF,CAAC,EAAE,IAAI,CAAC,CAAC;IACV,CAAC;IAGD,MAAM;QACL,OAAO;;YAAsB,IAAI,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAO,CAAC;IACrE,CAAC;CACD","sourcesContent":["import React from \"react\";\n\nexport interface IProps {\n\ttimerDuration: number;\n\tontimerDurationExpiration: () => void;\n}\ninterface IState {\n\ttimerDuration: number;\n}\n\nexport default class Timer extends React.Component<IProps, IState> {\n\tinterval?: NodeJS.Timeout;\n\n\tconstructor(props: any) {\n\t\tsuper(props);\n\t\tthis.state = {\n\t\t\ttimerDuration: props.timerDuration,\n\t\t};\n\t}\n\n\t//Every second, subtract a second.\n\tcomponentDidMount() {\n\t\tthis.interval = setInterval(() => {\n\t\t\tlet newTime = this.state.timerDuration - 1000;\n\t\t\tif (newTime <= 0) {\n\t\t\t\tthis.props.ontimerDurationExpiration();\n\t\t\t\tif (this.interval) clearInterval(this.interval);\n\t\t\t} else {\n\t\t\t\tthis.setState({\n\t\t\t\t\ttimerDuration: newTime,\n\t\t\t\t});\n\t\t\t}\n\t\t}, 1000);\n\t}\n\n\t//Countdown clock.\n\trender() {\n\t\treturn <div>Time remaining: {this.state.timerDuration / 1000}</div>;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"enzymeSetup.js","sourceRoot":"","sources":["../src/enzymeSetup.js"],"names":[],"mappings":"AAMA,OAAO,OAAO,MAAM,oCAAoC,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;AAE5B,SAAS,SAAS,CAAC,GAAG,EAAE,MAAM;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC;SAC3C,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,WAAW,CAAC;SACrD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAC5D,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,mBAAmB;IAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,2CAA2C,EAAE,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAC;IACjG,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAEvB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAClC,MAAM,CAAC,SAAS,GAAG;QAClB,SAAS,EAAE,SAAS;KACpB,CAAC;IACF,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IAC1B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED,mBAAmB,EAAE,CAAC;AAEtB,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,OAAO,EAAE,EAAE,CAAC,CAAC","sourcesContent":["// This is a helper/setup script that should be `--require`d when calling mocha to run enzyme tests\r\n// that require more real-world browser DOM objects to be exposed, like `.document` and `.window`.\r\n// This is needed to use methods like `.mount()` within enzyme.\r\n// It uses jsdom to set up a fake web browser in JavaScript.\r\n\r\n//import Adapter from \"enzyme-adapter-react-16\";\r\nimport Adapter from \"@wojtekmaj/enzyme-adapter-react-17\";\r\nimport { configure } from \"enzyme\";\r\nimport jsdom from \"jsdom\";\r\n\r\nrequire(\"babel-register\")();\r\n\r\nfunction copyProps(src, target) {\r\n\tconst props = Object.getOwnPropertyNames(src)\r\n\t\t.filter((prop) => typeof target[prop] === \"undefined\")\r\n\t\t.map((prop) => Object.getOwnPropertyDescriptor(src, prop));\r\n\tObject.defineProperties(target, props);\r\n}\r\n\r\nfunction setUpDomEnvironment() {\r\n\tconst { JSDOM } = jsdom;\r\n\tconst dom = new JSDOM(\"<!doctype html><html><body></body></html>\", { url: \"http://localhost/\" });\r\n\tconst { window } = dom;\r\n\r\n\tglobal.window = window;\r\n\tglobal.document = window.document;\r\n\tglobal.navigator = {\r\n\t\tuserAgent: \"node.js\",\r\n\t};\r\n\tglobal.File = window.File;\r\n\tcopyProps(window, global);\r\n}\r\n\r\nsetUpDomEnvironment();\r\n\r\nconfigure({ adapter: new Adapter() });\r\n"]}
1
+ {"version":3,"file":"enzymeSetup.js","sourceRoot":"","sources":["../src/enzymeSetup.js"],"names":[],"mappings":"AAMA,OAAO,OAAO,MAAM,oCAAoC,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;AAE5B,SAAS,SAAS,CAAC,GAAG,EAAE,MAAM;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,mBAAmB,CAAC,GAAG,CAAC;SAC3C,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,WAAW,CAAC;SACrD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;IAC5D,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,mBAAmB;IAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IACxB,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,2CAA2C,EAAE,EAAE,GAAG,EAAE,mBAAmB,EAAE,CAAC,CAAC;IACjG,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAEvB,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAClC,MAAM,CAAC,SAAS,GAAG;QAClB,SAAS,EAAE,SAAS;KACpB,CAAC;IACF,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IAC1B,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED,mBAAmB,EAAE,CAAC;AAEtB,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,OAAO,EAAE,EAAE,CAAC,CAAC","sourcesContent":["// This is a helper/setup script that should be `--require`d when calling mocha to run enzyme tests\n// that require more real-world browser DOM objects to be exposed, like `.document` and `.window`.\n// This is needed to use methods like `.mount()` within enzyme.\n// It uses jsdom to set up a fake web browser in JavaScript.\n\n//import Adapter from \"enzyme-adapter-react-16\";\nimport Adapter from \"@wojtekmaj/enzyme-adapter-react-17\";\nimport { configure } from \"enzyme\";\nimport jsdom from \"jsdom\";\n\nrequire(\"babel-register\")();\n\nfunction copyProps(src, target) {\n\tconst props = Object.getOwnPropertyNames(src)\n\t\t.filter((prop) => typeof target[prop] === \"undefined\")\n\t\t.map((prop) => Object.getOwnPropertyDescriptor(src, prop));\n\tObject.defineProperties(target, props);\n}\n\nfunction setUpDomEnvironment() {\n\tconst { JSDOM } = jsdom;\n\tconst dom = new JSDOM(\"<!doctype html><html><body></body></html>\", { url: \"http://localhost/\" });\n\tconst { window } = dom;\n\n\tglobal.window = window;\n\tglobal.document = window.document;\n\tglobal.navigator = {\n\t\tuserAgent: \"node.js\",\n\t};\n\tglobal.File = window.File;\n\tcopyProps(window, global);\n}\n\nsetUpDomEnvironment();\n\nconfigure({ adapter: new Adapter() });\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { useAuth, useAuthSimulator } from \"./useAuth\";\r\nexport { useHotkey } from \"./useHotkey\";\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC","sourcesContent":["export { useAuth, useAuthSimulator } from \"./useAuth\";\nexport { useHotkey } from \"./useHotkey\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useAuth.js","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE;IAC3B,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,WAAiB,EAAE,EAAE;QAChE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC3E,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,GAAG,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO;QACN,oBAAoB;QACpB,eAAe;KACf,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACpC,MAAM,YAAY,GAAG,KAAK,EAAE,QAAgB,EAAE,QAAgB,EAAgD,EAAE;QAC/G,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,2BAA2B,EAAE,CAAC,CAAC;QACxG,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,2BAA2B,EAAE,CAAC,CAAC;QACxG,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC;IAEF,OAAO;QACN,YAAY;KACZ,CAAC;AACH,CAAC,CAAC","sourcesContent":["export const useAuth = () => {\r\n\tconst publishAuthorization = (user: string, credentials?: any) => {\r\n\t\tFSBL.System.Window.getCurrent().hide();\r\n\t\tFSBL.Clients.AuthenticationClient.publishAuthorization(user, credentials);\r\n\t};\r\n\r\n\tconst quitApplication = () => {\r\n\t\tFSBL.System.exit();\r\n\t};\r\n\r\n\treturn {\r\n\t\tpublishAuthorization,\r\n\t\tquitApplication,\r\n\t};\r\n};\r\n\r\nexport const useAuthSimulator = () => {\r\n\tconst sendToServer = async (username: string, password: string): Promise<{ result?: string; error?: string }> => {\r\n\t\tif (!username || !username.length) return await Promise.resolve({ error: \"Missing or empty username\" });\r\n\t\tif (!password || !password.length) return await Promise.resolve({ error: \"Missing or empty password\" });\r\n\t\treturn await Promise.resolve({ result: \"ok\" });\r\n\t};\r\n\r\n\treturn {\r\n\t\tsendToServer,\r\n\t};\r\n};\r\n"]}
1
+ {"version":3,"file":"useAuth.js","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,EAAE;IAC3B,MAAM,oBAAoB,GAAG,CAAC,IAAY,EAAE,WAAiB,EAAE,EAAE;QAChE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,CAAC;QACvC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAC3E,CAAC,CAAC;IAEF,MAAM,eAAe,GAAG,GAAG,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC,CAAC;IAEF,OAAO;QACN,oBAAoB;QACpB,eAAe;KACf,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACpC,MAAM,YAAY,GAAG,KAAK,EAAE,QAAgB,EAAE,QAAgB,EAAgD,EAAE;QAC/G,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,2BAA2B,EAAE,CAAC,CAAC;QACxG,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,MAAM;YAAE,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,2BAA2B,EAAE,CAAC,CAAC;QACxG,OAAO,MAAM,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC;IAEF,OAAO;QACN,YAAY;KACZ,CAAC;AACH,CAAC,CAAC","sourcesContent":["export const useAuth = () => {\n\tconst publishAuthorization = (user: string, credentials?: any) => {\n\t\tFSBL.System.Window.getCurrent().hide();\n\t\tFSBL.Clients.AuthenticationClient.publishAuthorization(user, credentials);\n\t};\n\n\tconst quitApplication = () => {\n\t\tFSBL.System.exit();\n\t};\n\n\treturn {\n\t\tpublishAuthorization,\n\t\tquitApplication,\n\t};\n};\n\nexport const useAuthSimulator = () => {\n\tconst sendToServer = async (username: string, password: string): Promise<{ result?: string; error?: string }> => {\n\t\tif (!username || !username.length) return await Promise.resolve({ error: \"Missing or empty username\" });\n\t\tif (!password || !password.length) return await Promise.resolve({ error: \"Missing or empty password\" });\n\t\treturn await Promise.resolve({ result: \"ok\" });\n\t};\n\n\treturn {\n\t\tsendToServer,\n\t};\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useDeepEffect.js","sourceRoot":"","sources":["../../src/hooks/useDeepEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,SAAS,qBAAqB,CAAC,KAAU;IACxC,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IAErB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE;QACjC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;KACpB;IAED,OAAO,GAAG,CAAC,OAAO,CAAC;AACpB,CAAC;AAMD,MAAM,UAAU,aAAa,CAAC,QAAa,EAAE,YAAwB;IACpE,SAAS,CAAC,QAAQ,EAAE,qBAAqB,CAAC,YAAY,CAAC,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import { useEffect, useRef } from \"react\";\r\nimport isEqual from \"lodash/isEqual\";\r\n\r\nfunction useDeepCompareMemoize(value: any) {\r\n\tconst ref = useRef();\r\n\r\n\tif (!isEqual(value, ref.current)) {\r\n\t\tref.current = value;\r\n\t}\r\n\r\n\treturn ref.current;\r\n}\r\n\r\n/**\r\n * Use this just like useEffect() except that this will compare objects and arrays using lodash's isEqual() method.\r\n * Always pass an array of dependencies as the second parameter!!!\r\n */\r\nexport function useDeepEffect(callback: any, dependencies: Array<any>) {\r\n\tuseEffect(callback, useDeepCompareMemoize(dependencies));\r\n}\r\n\r\n/*\r\n// Previous implementation that had bugs. Keep around for a bit until we shake out the new version.\r\nexport function useDeepEffect(effectFunc : Function, deps : Array<any>) {\r\n\tconst isFirst = useRef(true);\r\n\tconst prevDeps = useRef(deps);\r\n\r\n\tuseEffect(() => {\r\n\t\tconst isSame = prevDeps.current.every((obj: any, index: any) => isEqual(obj, deps[index]));\r\n\t\tif (isFirst.current || !isSame) {\r\n\t\t\teffectFunc();\r\n\t\t}\r\n\r\n\t\tisFirst.current = false;\r\n\t\tprevDeps.current = deps;\r\n\t}, deps);\r\n}\r\n*/\r\n"]}
1
+ {"version":3,"file":"useDeepEffect.js","sourceRoot":"","sources":["../../src/hooks/useDeepEffect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,SAAS,qBAAqB,CAAC,KAAU;IACxC,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IAErB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE;QACjC,GAAG,CAAC,OAAO,GAAG,KAAK,CAAC;KACpB;IAED,OAAO,GAAG,CAAC,OAAO,CAAC;AACpB,CAAC;AAMD,MAAM,UAAU,aAAa,CAAC,QAAa,EAAE,YAAwB;IACpE,SAAS,CAAC,QAAQ,EAAE,qBAAqB,CAAC,YAAY,CAAC,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["import { useEffect, useRef } from \"react\";\nimport isEqual from \"lodash/isEqual\";\n\nfunction useDeepCompareMemoize(value: any) {\n\tconst ref = useRef();\n\n\tif (!isEqual(value, ref.current)) {\n\t\tref.current = value;\n\t}\n\n\treturn ref.current;\n}\n\n/**\n * Use this just like useEffect() except that this will compare objects and arrays using lodash's isEqual() method.\n * Always pass an array of dependencies as the second parameter!!!\n */\nexport function useDeepEffect(callback: any, dependencies: Array<any>) {\n\tuseEffect(callback, useDeepCompareMemoize(dependencies));\n}\n\n/*\n// Previous implementation that had bugs. Keep around for a bit until we shake out the new version.\nexport function useDeepEffect(effectFunc : Function, deps : Array<any>) {\n\tconst isFirst = useRef(true);\n\tconst prevDeps = useRef(deps);\n\n\tuseEffect(() => {\n\t\tconst isSame = prevDeps.current.every((obj: any, index: any) => isEqual(obj, deps[index]));\n\t\tif (isFirst.current || !isSame) {\n\t\t\teffectFunc();\n\t\t}\n\n\t\tisFirst.current = false;\n\t\tprevDeps.current = deps;\n\t}, deps);\n}\n*/\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useFavorites.js","sourceRoot":"","sources":["../../src/hooks/useFavorites.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AA2B7D,MAAM,CAAC,MAAM,YAAY,GAAG,GAAkB,EAAE;IAC/C,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEpD,MAAM,WAAW,GAAG,CAAC,QAAkB,EAAE,EAAE;QAC1C,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,CAAC,EAAkB,EAAE,EAAE;QAC7C,QAAQ,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,EAAkB,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEtE,OAAO;QACN,SAAS;QACT,WAAW;QACX,cAAc;QACd,WAAW;KACX,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { useDispatch, useSelector } from \"../store\";\r\nimport { Favorite } from \"../types/favoriteTypes\";\r\nimport { FavoriteActions } from \"../actions/favoriteActions\";\r\n\r\ntype FavoritesHook = {\r\n\t/**\r\n\t * The current favorites list from the store.\r\n\t */\r\n\tfavorites: Favorite[];\r\n\r\n\t/**\r\n\t * Adds a favorite to the favorites store.\r\n\t */\r\n\taddFavorite: (favorite: Favorite) => void;\r\n\r\n\t/**\r\n\t * Removes the favorite for the given id from the favorites store.\r\n\t */\r\n\tremoveFavorite: (id: Favorite[\"id\"]) => void;\r\n\r\n\t/**\r\n\t * Returns true if the current id has been favorited.\r\n\t */\r\n\tisFavorited: (id: Favorite[\"id\"]) => boolean;\r\n};\r\n\r\n/**\r\n * The useFavorites() hook is used by FavoriteMaker to interact with the redux store.\r\n */\r\nexport const useFavorites = (): FavoritesHook => {\r\n\tconst dispatch = useDispatch();\r\n\tconst { favorites } = useSelector((state) => state.favorite);\r\n\tconst favoritesIds = favorites.map((fav) => fav.id);\r\n\r\n\tconst addFavorite = (favorite: Favorite) => {\r\n\t\tdispatch(FavoriteActions.ADD_FAVORITE(favorite));\r\n\t};\r\n\r\n\tconst removeFavorite = (id: Favorite[\"id\"]) => {\r\n\t\tdispatch(FavoriteActions.REMOVE_FAVORITE(id));\r\n\t};\r\n\r\n\tconst isFavorited = (id: Favorite[\"id\"]) => favoritesIds.includes(id);\r\n\r\n\treturn {\r\n\t\tfavorites,\r\n\t\taddFavorite,\r\n\t\tremoveFavorite,\r\n\t\tisFavorited,\r\n\t};\r\n};\r\n"]}
1
+ {"version":3,"file":"useFavorites.js","sourceRoot":"","sources":["../../src/hooks/useFavorites.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AA2B7D,MAAM,CAAC,MAAM,YAAY,GAAG,GAAkB,EAAE;IAC/C,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAEpD,MAAM,WAAW,GAAG,CAAC,QAAkB,EAAE,EAAE;QAC1C,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,CAAC,EAAkB,EAAE,EAAE;QAC7C,QAAQ,CAAC,eAAe,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,EAAkB,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEtE,OAAO;QACN,SAAS;QACT,WAAW;QACX,cAAc;QACd,WAAW;KACX,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { useDispatch, useSelector } from \"../store\";\nimport { Favorite } from \"../types/favoriteTypes\";\nimport { FavoriteActions } from \"../actions/favoriteActions\";\n\ntype FavoritesHook = {\n\t/**\n\t * The current favorites list from the store.\n\t */\n\tfavorites: Favorite[];\n\n\t/**\n\t * Adds a favorite to the favorites store.\n\t */\n\taddFavorite: (favorite: Favorite) => void;\n\n\t/**\n\t * Removes the favorite for the given id from the favorites store.\n\t */\n\tremoveFavorite: (id: Favorite[\"id\"]) => void;\n\n\t/**\n\t * Returns true if the current id has been favorited.\n\t */\n\tisFavorited: (id: Favorite[\"id\"]) => boolean;\n};\n\n/**\n * The useFavorites() hook is used by FavoriteMaker to interact with the redux store.\n */\nexport const useFavorites = (): FavoritesHook => {\n\tconst dispatch = useDispatch();\n\tconst { favorites } = useSelector((state) => state.favorite);\n\tconst favoritesIds = favorites.map((fav) => fav.id);\n\n\tconst addFavorite = (favorite: Favorite) => {\n\t\tdispatch(FavoriteActions.ADD_FAVORITE(favorite));\n\t};\n\n\tconst removeFavorite = (id: Favorite[\"id\"]) => {\n\t\tdispatch(FavoriteActions.REMOVE_FAVORITE(id));\n\t};\n\n\tconst isFavorited = (id: Favorite[\"id\"]) => favoritesIds.includes(id);\n\n\treturn {\n\t\tfavorites,\n\t\taddFavorite,\n\t\tremoveFavorite,\n\t\tisFavorited,\n\t};\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useFavoritesShell.js","sourceRoot":"","sources":["../../src/hooks/useFavoritesShell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAA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B;YAAE,OAAO;QACjC,oBAAoB,GAAG,IAAI,CAAC;QAE5B,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,qBAAqB,EAAE,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YAChG,IAAI,GAAG,EAAE;gBACR,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CACtC,qEAAqE,GAAG,EAAE,CAC1E,CAAC;aACF;YACD,QAAQ,CAAC,eAAe,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAGf,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC;YAC/B,KAAK,EAAE,WAAW;YAClB,GAAG,EAAE,qBAAqB;YAC1B,KAAK,EAAE,SAAS;SAChB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO;QACN,SAAS;QACT,cAAc;QACd,eAAe;QACf,iBAAiB;KACjB,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { useDispatch } from \"../store\";\r\nimport { Favorite } from \"../types/favoriteTypes\";\r\nimport { FavoriteActions } from \"../actions/favoriteActions\";\r\nimport { useFavorites } from \"./useFavorites\";\r\nimport { useEffect } from \"react\";\r\nimport { types } from \"@finsemble/finsemble-core\";\r\n\r\ntype StandardError = types.StandardError;\r\n\r\nlet storageIsInitialized: boolean = false;\r\n\r\n/**\r\n * The useFavoritesShell() hook is used by FavoritesShell to interact with the redux store\r\n * and storage.\r\n */\r\nexport const useFavoritesShell = () => {\r\n\tconst dispatch = useDispatch();\r\n\tconst { favorites, removeFavorite } = useFavorites();\r\n\r\n\t// Ideally in the future the following function will be decoupled from implementation, allowing Favorites to generically dispatch actions.\r\n\t/**\r\n\t * Given a favorite item, trigger the associated action on that item.\r\n\t * I.e. If it's a finsemble component, a new window of that component is launched. If it's a workspace, the workspace would be switched to.\r\n\t * @param id The favorite item's id\r\n\t * @param category The to be triggered favorite item's category\r\n\t */\r\n\tconst triggerFavorite = async (id: Favorite[\"id\"], category: Favorite[\"category\"]) => {\r\n\t\tif (category === \"Application\") {\r\n\t\t\tFSBL.Clients.LauncherClient.spawn(id, {\r\n\t\t\t\taddToWorkspace: true,\r\n\t\t\t\tmonitor: \"mine\",\r\n\t\t\t});\r\n\t\t} else if (category === \"Workspace\") {\r\n\t\t\tFSBL.Clients.DistributedStoreClient.getStore(\r\n\t\t\t\t{ store: \"Finsemble-WorkspaceMenu-Global-Store\", global: true },\r\n\t\t\t\t(err: StandardError, store?: any) => {\r\n\t\t\t\t\tstore.Dispatcher.dispatch({\r\n\t\t\t\t\t\tactionType: \"switchToWorkspace\",\r\n\t\t\t\t\t\tdata: {\r\n\t\t\t\t\t\t\tname: id,\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t);\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * We need to persist the right order in whent he user reorders favorites in the toolbar. This ensures\r\n\t * that favorites will appear in the right order on future Toolbar launches.\r\n\t * @param favElements The ordered collection of favorite elements\r\n\t */\r\n\tconst setFavoritesOrder = ({ oldIndex, newIndex }: { oldIndex: number; newIndex: number }) => {\r\n\t\tdispatch(FavoriteActions.REORDER_FAVORITES({ oldIndex, newIndex }));\r\n\t};\r\n\r\n\t/**\r\n\t * This effect initializes the favorites redux store. The store must only be initialized once, even though useFavorites may be\r\n\t * referenced by many different React components. We use the module level variable `storageIsInitialized` as a simple flag to\r\n\t * prevent initialization from occuring more than once.\r\n\t */\r\n\tuseEffect(() => {\r\n\t\tif (storageIsInitialized) return;\r\n\t\tstorageIsInitialized = true;\r\n\t\t// Copy the persisted favorites from Storage to the redux store\r\n\t\tFSBL.Clients.StorageClient.get({ topic: \"favorites\", key: \"allCurrentFavorites\" }, (err, data) => {\r\n\t\t\tif (err) {\r\n\t\t\t\treturn FSBL.Clients.Logger.system.error(\r\n\t\t\t\t\t`Favorite Hook -> Failed to retrieve favorites from StorageClient: ${err}`\r\n\t\t\t\t);\r\n\t\t\t}\r\n\t\t\tdispatch(FavoriteActions.INITIALIZE_FAVORITES(data));\r\n\t\t});\r\n\t}, [dispatch]);\r\n\r\n\t// When the list of favorite items change, we want to persist that data to the store.\r\n\tuseEffect(() => {\r\n\t\tFSBL.Clients.StorageClient.save({\r\n\t\t\ttopic: \"favorites\",\r\n\t\t\tkey: \"allCurrentFavorites\",\r\n\t\t\tvalue: favorites,\r\n\t\t});\r\n\t}, [favorites]);\r\n\r\n\treturn {\r\n\t\tfavorites,\r\n\t\tremoveFavorite,\r\n\t\ttriggerFavorite,\r\n\t\tsetFavoritesOrder,\r\n\t};\r\n};\r\n"]}
1
+ {"version":3,"file":"useFavoritesShell.js","sourceRoot":"","sources":["../../src/hooks/useFavoritesShell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,IAAI,oBAAoB,GAAY,KAAK,CAAC;AAM1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACrC,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,YAAY,EAAE,CAAC;IASrD,MAAM,eAAe,GAAG,KAAK,EAAE,EAAkB,EAAE,QAA8B,EAAE,EAAE;QACpF,IAAI,QAAQ,KAAK,aAAa,EAAE;YAC/B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE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,CAAC,aAAa,CAAC,IAAI,CAAC;YAC/B,KAAK,EAAE,WAAW;YAClB,GAAG,EAAE,qBAAqB;YAC1B,KAAK,EAAE,SAAS;SAChB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO;QACN,SAAS;QACT,cAAc;QACd,eAAe;QACf,iBAAiB;KACjB,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { useDispatch } from \"../store\";\nimport { Favorite } from \"../types/favoriteTypes\";\nimport { FavoriteActions } from \"../actions/favoriteActions\";\nimport { useFavorites } from \"./useFavorites\";\nimport { useEffect } from \"react\";\nimport { types } from \"@finsemble/finsemble-core\";\n\ntype StandardError = types.StandardError;\n\nlet storageIsInitialized: boolean = false;\n\n/**\n * The useFavoritesShell() hook is used by FavoritesShell to interact with the redux store\n * and storage.\n */\nexport const useFavoritesShell = () => {\n\tconst dispatch = useDispatch();\n\tconst { favorites, removeFavorite } = useFavorites();\n\n\t// Ideally in the future the following function will be decoupled from implementation, allowing Favorites to generically dispatch actions.\n\t/**\n\t * Given a favorite item, trigger the associated action on that item.\n\t * I.e. If it's a finsemble component, a new window of that component is launched. If it's a workspace, the workspace would be switched to.\n\t * @param id The favorite item's id\n\t * @param category The to be triggered favorite item's category\n\t */\n\tconst triggerFavorite = async (id: Favorite[\"id\"], category: Favorite[\"category\"]) => {\n\t\tif (category === \"Application\") {\n\t\t\tFSBL.Clients.LauncherClient.spawn(id, {\n\t\t\t\taddToWorkspace: true,\n\t\t\t\tmonitor: \"mine\",\n\t\t\t});\n\t\t} else if (category === \"Workspace\") {\n\t\t\tFSBL.Clients.DistributedStoreClient.getStore(\n\t\t\t\t{ store: \"Finsemble-WorkspaceMenu-Global-Store\", global: true },\n\t\t\t\t(err: StandardError, store?: any) => {\n\t\t\t\t\tstore.Dispatcher.dispatch({\n\t\t\t\t\t\tactionType: \"switchToWorkspace\",\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\tname: id,\n\t\t\t\t\t\t},\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\t/**\n\t * We need to persist the right order in whent he user reorders favorites in the toolbar. This ensures\n\t * that favorites will appear in the right order on future Toolbar launches.\n\t * @param favElements The ordered collection of favorite elements\n\t */\n\tconst setFavoritesOrder = ({ oldIndex, newIndex }: { oldIndex: number; newIndex: number }) => {\n\t\tdispatch(FavoriteActions.REORDER_FAVORITES({ oldIndex, newIndex }));\n\t};\n\n\t/**\n\t * This effect initializes the favorites redux store. The store must only be initialized once, even though useFavorites may be\n\t * referenced by many different React components. We use the module level variable `storageIsInitialized` as a simple flag to\n\t * prevent initialization from occuring more than once.\n\t */\n\tuseEffect(() => {\n\t\tif (storageIsInitialized) return;\n\t\tstorageIsInitialized = true;\n\t\t// Copy the persisted favorites from Storage to the redux store\n\t\tFSBL.Clients.StorageClient.get({ topic: \"favorites\", key: \"allCurrentFavorites\" }, (err, data) => {\n\t\t\tif (err) {\n\t\t\t\treturn FSBL.Clients.Logger.system.error(\n\t\t\t\t\t`Favorite Hook -> Failed to retrieve favorites from StorageClient: ${err}`\n\t\t\t\t);\n\t\t\t}\n\t\t\tdispatch(FavoriteActions.INITIALIZE_FAVORITES(data));\n\t\t});\n\t}, [dispatch]);\n\n\t// When the list of favorite items change, we want to persist that data to the store.\n\tuseEffect(() => {\n\t\tFSBL.Clients.StorageClient.save({\n\t\t\ttopic: \"favorites\",\n\t\t\tkey: \"allCurrentFavorites\",\n\t\t\tvalue: favorites,\n\t\t});\n\t}, [favorites]);\n\n\treturn {\n\t\tfavorites,\n\t\tremoveFavorite,\n\t\ttriggerFavorite,\n\t\tsetFavoritesOrder,\n\t};\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useHotkey.js","sourceRoot":"","sources":["../../src/hooks/useHotkey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAShD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,cAAoD,EAAE,MAAgB,EAAE,EAAE;IAKnG,aAAa,CAAC,GAAG,EAAE;QAClB,IAAI,iBAAiB,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC;QACrD,IAAI,CAAC,iBAAiB;YAAE,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAClG,cAAc,IAAI,iBAAiB,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QACzG,OAAO,SAAS,OAAO;YACtB,cAAc,IAAI,iBAAiB,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QAC7G,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { useDeepEffect } from \"./useDeepEffect\";\r\nimport { HotkeyCombination } from \"../types/hotkeyTypes\";\r\n\r\n/**\r\n * This hook can be used to register a global hotkey. It makes use of Finsemble's HotkeyClient API.\r\n *\r\n * @param keyCombination [Array<string>] - A hotkey Combination. If null or undefined then no operation will occur.\r\n * @param action Function - The function to call when the hotkey combination is pressed.\r\n */\r\nexport const useHotkey = (keyCombination: HotkeyCombination | undefined | null, action: Function) => {\r\n\t// We use a deep effect comparison because we expect arrays to be passed in.\r\n\t// React's useEffect() hook only performs shallow comparisons. We use the literal [\"escape\"] which would trigger an effect with every render.\r\n\t// useDeepEffect() is a custom hook that will compare the *contents* of the arrays. This way, two literal instances will still be perceived by React as identical.\r\n\r\n\tuseDeepEffect(() => {\r\n\t\tlet actionIsAFunction = typeof action === \"function\";\r\n\t\tif (!actionIsAFunction) console.error(\"useHotkey() invalid parameters: action is not a function\");\r\n\t\tkeyCombination && actionIsAFunction && FSBL.Clients.HotkeyClient.addGlobalHotkey(keyCombination, action);\r\n\t\treturn function cleanup() {\r\n\t\t\tkeyCombination && actionIsAFunction && FSBL.Clients.HotkeyClient.removeGlobalHotkey(keyCombination, action);\r\n\t\t};\r\n\t}, [keyCombination, action]);\r\n};\r\n"]}
1
+ {"version":3,"file":"useHotkey.js","sourceRoot":"","sources":["../../src/hooks/useHotkey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAShD,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,cAAoD,EAAE,MAAgB,EAAE,EAAE;IAKnG,aAAa,CAAC,GAAG,EAAE;QAClB,IAAI,iBAAiB,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC;QACrD,IAAI,CAAC,iBAAiB;YAAE,OAAO,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAClG,cAAc,IAAI,iBAAiB,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,eAAe,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QACzG,OAAO,SAAS,OAAO;YACtB,cAAc,IAAI,iBAAiB,IAAI,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QAC7G,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["import { useDeepEffect } from \"./useDeepEffect\";\nimport { HotkeyCombination } from \"../types/hotkeyTypes\";\n\n/**\n * This hook can be used to register a global hotkey. It makes use of Finsemble's HotkeyClient API.\n *\n * @param keyCombination [Array<string>] - A hotkey Combination. If null or undefined then no operation will occur.\n * @param action Function - The function to call when the hotkey combination is pressed.\n */\nexport const useHotkey = (keyCombination: HotkeyCombination | undefined | null, action: Function) => {\n\t// We use a deep effect comparison because we expect arrays to be passed in.\n\t// React's useEffect() hook only performs shallow comparisons. We use the literal [\"escape\"] which would trigger an effect with every render.\n\t// useDeepEffect() is a custom hook that will compare the *contents* of the arrays. This way, two literal instances will still be perceived by React as identical.\n\n\tuseDeepEffect(() => {\n\t\tlet actionIsAFunction = typeof action === \"function\";\n\t\tif (!actionIsAFunction) console.error(\"useHotkey() invalid parameters: action is not a function\");\n\t\tkeyCombination && actionIsAFunction && FSBL.Clients.HotkeyClient.addGlobalHotkey(keyCombination, action);\n\t\treturn function cleanup() {\n\t\t\tkeyCombination && actionIsAFunction && FSBL.Clients.HotkeyClient.removeGlobalHotkey(keyCombination, action);\n\t\t};\n\t}, [keyCombination, action]);\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useLinker.js","sourceRoot":"","sources":["../../src/hooks/useLinker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAW,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AAKhF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE;IAC7B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAEzD,MAAM,UAAU,GAAG,GAAG,EAAE;QAIvB,eAAe,CAAC,IAAI,EAAE,CAAC;QACvB,eAAe,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,kBAAkB,GAAG,GAAG,EAAE;YAC/B,MAAM,QAAQ,GAAc,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC;YACvE,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC;QAEF,MAAM,WAAW,GAAG,GAAG,EAAE;YACxB,eAAe,CAAC,K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OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,mCAAmC,EAAE,GAAG,CAAC,CAAC;gBAC3E,OAAO;aACP;YAED,QAAQ,CACP,aAAa,CAAC,qBAAqB,CAAC;gBACnC,SAAS;gBACT,MAAM,EAAE,QAAQ;aAChB,CAAC,CACF,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,sBAAsB,GAAG,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,MAAM,CAAC,CAAC,MAAM,CAAC;QAGnG,MAAM,UAAU,GAAG,CAAC,aAAa,CAAC;QAClC,MAAM,YAAY,GAAG,aAAa,CAAC;QACnC,MAAM,+BAA+B,GAAG,sBAAsB,GAAG,+BAA+B,CAAC;QAIjG,IAAI,YAAY,EAAE;YACjB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;SACtG;aAAM,IAAI,UAAU,IAAI,+BAA+B,EAAE;YACzD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;SACjG;aAAM;YACN,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAC/B,iCAAiC,+BAA+B,8HAA8H,+BAA+B,2CAA2C,CACxQ,CAAC;SACF;QACD,UAAU,EAAE,CAAC;IACd,CAAC,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["import { useDispatch, useSelector } from \"../store\";\r\nimport { useEffect } from \"react\";\r\nimport { LinkerActions } from \"../actions/linkerActions\";\r\nimport { Channel, MAXIMUM_ALLOWED_ACTIVE_CHANNELS } from \"../types/linkerTypes\";\r\n\r\ndeclare const finsembleWindow: any;\r\n\r\n// Encapsulate the linker initialization and Redux dispatch functions inside the hook\r\nexport const useLinker = () => {\r\n\tconst dispatch = useDispatch();\r\n\tconst linkerState = useSelector((state) => state.linker);\r\n\r\n\tconst hideWindow = () => {\r\n\t\t// Must blur or you end up having to click twice to show the window.\r\n\t\t// If you just hide, the first time the user clicks\r\n\t\t// on the linker button, the blur will trigger, which will hide the window.\r\n\t\tfinsembleWindow.blur();\r\n\t\tfinsembleWindow.hide();\r\n\t};\r\n\r\n\tuseEffect(() => {\r\n\t\tconst setInitialChannels = () => {\r\n\t\t\tconst channels: Channel[] = FSBL.Clients.LinkerClient.getAllChannels();\r\n\t\t\tdispatch(LinkerActions.SET_CHANNELS({ channels }));\r\n\t\t};\r\n\r\n\t\tconst focusWindow = () => {\r\n\t\t\tfinsembleWindow.focus();\r\n\t\t};\r\n\r\n\t\tconst initAccessibleLinkerMode = () => {\r\n\t\t\tconst accessibilityCallback = (err: any, value: any) => {\r\n\t\t\t\tif (err) {\r\n\t\t\t\t\tFSBL.Clients.Logger.system.error(`Failed to get accessibleLinker value: ${err}`);\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tdispatch(\r\n\t\t\t\t\tLinkerActions.SET_ACCESSIBILITY({\r\n\t\t\t\t\t\tisAccessibleLinker: Boolean(value),\r\n\t\t\t\t\t})\r\n\t\t\t\t);\r\n\t\t\t};\r\n\t\t\tFSBL.Clients.ConfigClient.getValue(\"finsemble.accessibleLinker\", accessibilityCallback);\r\n\t\t};\r\n\r\n\t\t/** If user switches the linker channel for different components, this function would be invoked. It will dispatch another\r\n\t\t * action to update the linker's state according to the linker setup on the switched component.\r\n\t\t *\r\n\t\t * @param err error from FSBL\r\n\t\t * @param msg msg from FSBL\r\n\t\t */\r\n\t\tconst onActiveChannelsChanged = (err: any, msg: any) => {\r\n\t\t\tconst componentLinkerState = FSBL.Clients.LinkerClient.getState(msg.data.windowIdentifier);\r\n\r\n\t\t\tif (err) {\r\n\t\t\t\tFSBL.Clients.Logger.system.error(\"Failed to update the linker state.\");\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tdispatch(\r\n\t\t\t\tLinkerActions.UPDATE_ACTIVE_CHANNELS({\r\n\t\t\t\t\tchannelNames: componentLinkerState.channels,\r\n\t\t\t\t\twindowIdentifier: msg.data.windowIdentifier,\r\n\t\t\t\t})\r\n\t\t\t);\r\n\r\n\t\t\tmsg.sendQueryResponse(null, null);\r\n\t\t};\r\n\r\n\t\tFSBL.Clients.Logger.system.log(\"Linker component is mounted. Initializing.\");\r\n\t\tfinsembleWindow.addEventListener(\"blurred\", hideWindow);\r\n\t\tfinsembleWindow.addEventListener(\"shown\", focusWindow);\r\n\t\tsetInitialChannels();\r\n\t\tinitAccessibleLinkerMode();\r\n\t\tFSBL.Clients.RouterClient.addResponder(\"Finsemble.LinkerWindow.SetActiveChannels\", onActiveChannelsChanged);\r\n\r\n\t\treturn () => {\r\n\t\t\tFSBL.Clients.Logger.system.log(\"Linker component is unmounted. Cleaning up the event listeners.\");\r\n\t\t\tfinsembleWindow.removeEventListener(\"blurred\", hideWindow);\r\n\t\t\tfinsembleWindow.removeEventListener(\"shown\", focusWindow);\r\n\t\t\tFSBL.Clients.RouterClient.removeResponder(\"Finsemble.LinkerWindow.SetActiveChannels\");\r\n\t\t};\r\n\t}, []);\r\n\r\n\tuseEffect(() => {\r\n\t\tFSBL.Clients.WindowClient.fitToDOM();\r\n\t}, [linkerState]);\r\n\r\n\tconst toggleChannel = (channelId: number) => {\r\n\t\tconst channel = linkerState.channels[channelId];\r\n\t\tif (!channel) {\r\n\t\t\tFSBL.Clients.Logger.system.error(\"Targeted channel to toggle is not found.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tconst channelName = channel.name;\r\n\t\tconst channelActive = channel.active;\r\n\t\tconst { windowIdentifier } = linkerState;\r\n\r\n\t\tconst updateActivationTo = (isActive: boolean) => (err: any) => {\r\n\t\t\tif (err) {\r\n\t\t\t\tFSBL.Clients.Logger.system.error(\"Error in linkerHook, linkCallback\", err);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\r\n\t\t\tdispatch(\r\n\t\t\t\tLinkerActions.UPDATE_CHANNEL_STATUS({\r\n\t\t\t\t\tchannelId,\r\n\t\t\t\t\tactive: isActive,\r\n\t\t\t\t})\r\n\t\t\t);\r\n\t\t};\r\n\r\n\t\tconst numberOfActiveChannels = Object.values(linkerState.channels).filter((c) => c?.active).length;\r\n\r\n\t\t// We're activating if the channel is currently inactive\r\n\t\tconst activating = !channelActive;\r\n\t\tconst deactivating = channelActive;\r\n\t\tconst allowedToActivateAnotherChannel = numberOfActiveChannels < MAXIMUM_ALLOWED_ACTIVE_CHANNELS;\r\n\t\t// if we're toggling a channel to be inactive OR\r\n\t\t// we're trying to toggle one to be active AND we have not hit our maximum,\r\n\t\t// let the call go through. Otherwise log an error.\r\n\t\tif (deactivating) {\r\n\t\t\tFSBL.Clients.LinkerClient.unlinkFromChannel(channelName, windowIdentifier, updateActivationTo(false));\r\n\t\t} else if (activating && allowedToActivateAnotherChannel) {\r\n\t\t\tFSBL.Clients.LinkerClient.linkToChannel(channelName, windowIdentifier, updateActivationTo(true));\r\n\t\t} else {\r\n\t\t\tFSBL.Clients.Logger.system.error(\r\n\t\t\t\t`Attempted to toggle more than ${MAXIMUM_ALLOWED_ACTIVE_CHANNELS} channels. This could result in an unacceptable UX. Please contact finsemble support if you would like to render more than ${MAXIMUM_ALLOWED_ACTIVE_CHANNELS} linker channels in the window title bar.`\r\n\t\t\t);\r\n\t\t}\r\n\t\thideWindow();\r\n\t};\r\n\r\n\treturn { state: linkerState, toggleChannel };\r\n};\r\n"]}
1
+ {"version":3,"file":"useLinker.js","sourceRoot":"","sources":["../../src/hooks/useLinker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,C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C;QAClC,MAAM,YAAY,GAAG,aAAa,CAAC;QACnC,MAAM,+BAA+B,GAAG,sBAAsB,GAAG,+BAA+B,CAAC;QAIjG,IAAI,YAAY,EAAE;YACjB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,iBAAiB,CAAC,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;SACtG;aAAM,IAAI,UAAU,IAAI,+BAA+B,EAAE;YACzD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,WAAW,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC;SACjG;aAAM;YACN,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAC/B,iCAAiC,+BAA+B,8HAA8H,+BAA+B,2CAA2C,CACxQ,CAAC;SACF;QACD,UAAU,EAAE,CAAC;IACd,CAAC,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["import { useDispatch, useSelector } from \"../store\";\nimport { useEffect } from \"react\";\nimport { LinkerActions } from \"../actions/linkerActions\";\nimport { Channel, MAXIMUM_ALLOWED_ACTIVE_CHANNELS } from \"../types/linkerTypes\";\n\ndeclare const finsembleWindow: any;\n\n// Encapsulate the linker initialization and Redux dispatch functions inside the hook\nexport const useLinker = () => {\n\tconst dispatch = useDispatch();\n\tconst linkerState = useSelector((state) => state.linker);\n\n\tconst hideWindow = () => {\n\t\t// Must blur or you end up having to click twice to show the window.\n\t\t// If you just hide, the first time the user clicks\n\t\t// on the linker button, the blur will trigger, which will hide the window.\n\t\tfinsembleWindow.blur();\n\t\tfinsembleWindow.hide();\n\t};\n\n\tuseEffect(() => {\n\t\tconst setInitialChannels = () => {\n\t\t\tconst channels: Channel[] = FSBL.Clients.LinkerClient.getAllChannels();\n\t\t\tdispatch(LinkerActions.SET_CHANNELS({ channels }));\n\t\t};\n\n\t\tconst focusWindow = () => {\n\t\t\tfinsembleWindow.focus();\n\t\t};\n\n\t\tconst initAccessibleLinkerMode = () => {\n\t\t\tconst accessibilityCallback = (err: any, value: any) => {\n\t\t\t\tif (err) {\n\t\t\t\t\tFSBL.Clients.Logger.system.error(`Failed to get accessibleLinker value: ${err}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tdispatch(\n\t\t\t\t\tLinkerActions.SET_ACCESSIBILITY({\n\t\t\t\t\t\tisAccessibleLinker: Boolean(value),\n\t\t\t\t\t})\n\t\t\t\t);\n\t\t\t};\n\t\t\tFSBL.Clients.ConfigClient.getValue(\"finsemble.accessibleLinker\", accessibilityCallback);\n\t\t};\n\n\t\t/** If user switches the linker channel for different components, this function would be invoked. It will dispatch another\n\t\t * action to update the linker's state according to the linker setup on the switched component.\n\t\t *\n\t\t * @param err error from FSBL\n\t\t * @param msg msg from FSBL\n\t\t */\n\t\tconst onActiveChannelsChanged = (err: any, msg: any) => {\n\t\t\tconst componentLinkerState = FSBL.Clients.LinkerClient.getState(msg.data.windowIdentifier);\n\n\t\t\tif (err) {\n\t\t\t\tFSBL.Clients.Logger.system.error(\"Failed to update the linker state.\");\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdispatch(\n\t\t\t\tLinkerActions.UPDATE_ACTIVE_CHANNELS({\n\t\t\t\t\tchannelNames: componentLinkerState.channels,\n\t\t\t\t\twindowIdentifier: msg.data.windowIdentifier,\n\t\t\t\t})\n\t\t\t);\n\n\t\t\tmsg.sendQueryResponse(null, null);\n\t\t};\n\n\t\tFSBL.Clients.Logger.system.log(\"Linker component is mounted. Initializing.\");\n\t\tfinsembleWindow.addEventListener(\"blurred\", hideWindow);\n\t\tfinsembleWindow.addEventListener(\"shown\", focusWindow);\n\t\tsetInitialChannels();\n\t\tinitAccessibleLinkerMode();\n\t\tFSBL.Clients.RouterClient.addResponder(\"Finsemble.LinkerWindow.SetActiveChannels\", onActiveChannelsChanged);\n\n\t\treturn () => {\n\t\t\tFSBL.Clients.Logger.system.log(\"Linker component is unmounted. Cleaning up the event listeners.\");\n\t\t\tfinsembleWindow.removeEventListener(\"blurred\", hideWindow);\n\t\t\tfinsembleWindow.removeEventListener(\"shown\", focusWindow);\n\t\t\tFSBL.Clients.RouterClient.removeResponder(\"Finsemble.LinkerWindow.SetActiveChannels\");\n\t\t};\n\t}, []);\n\n\tuseEffect(() => {\n\t\tFSBL.Clients.WindowClient.fitToDOM();\n\t}, [linkerState]);\n\n\tconst toggleChannel = (channelId: number) => {\n\t\tconst channel = linkerState.channels[channelId];\n\t\tif (!channel) {\n\t\t\tFSBL.Clients.Logger.system.error(\"Targeted channel to toggle is not found.\");\n\t\t\treturn;\n\t\t}\n\t\tconst channelName = channel.name;\n\t\tconst channelActive = channel.active;\n\t\tconst { windowIdentifier } = linkerState;\n\n\t\tconst updateActivationTo = (isActive: boolean) => (err: any) => {\n\t\t\tif (err) {\n\t\t\t\tFSBL.Clients.Logger.system.error(\"Error in linkerHook, linkCallback\", err);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tdispatch(\n\t\t\t\tLinkerActions.UPDATE_CHANNEL_STATUS({\n\t\t\t\t\tchannelId,\n\t\t\t\t\tactive: isActive,\n\t\t\t\t})\n\t\t\t);\n\t\t};\n\n\t\tconst numberOfActiveChannels = Object.values(linkerState.channels).filter((c) => c?.active).length;\n\n\t\t// We're activating if the channel is currently inactive\n\t\tconst activating = !channelActive;\n\t\tconst deactivating = channelActive;\n\t\tconst allowedToActivateAnotherChannel = numberOfActiveChannels < MAXIMUM_ALLOWED_ACTIVE_CHANNELS;\n\t\t// if we're toggling a channel to be inactive OR\n\t\t// we're trying to toggle one to be active AND we have not hit our maximum,\n\t\t// let the call go through. Otherwise log an error.\n\t\tif (deactivating) {\n\t\t\tFSBL.Clients.LinkerClient.unlinkFromChannel(channelName, windowIdentifier, updateActivationTo(false));\n\t\t} else if (activating && allowedToActivateAnotherChannel) {\n\t\t\tFSBL.Clients.LinkerClient.linkToChannel(channelName, windowIdentifier, updateActivationTo(true));\n\t\t} else {\n\t\t\tFSBL.Clients.Logger.system.error(\n\t\t\t\t`Attempted to toggle more than ${MAXIMUM_ALLOWED_ACTIVE_CHANNELS} channels. This could result in an unacceptable UX. Please contact finsemble support if you would like to render more than ${MAXIMUM_ALLOWED_ACTIVE_CHANNELS} linker channels in the window title bar.`\n\t\t\t);\n\t\t}\n\t\thideWindow();\n\t};\n\n\treturn { state: linkerState, toggleChannel };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useMenu.js","sourceRoot":"","sources":["../../src/hooks/useMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAwC7D,MAAM,CAAC,MAAM,OAAO,GAAG,GAAa,EAAE;IACrC,MAAM,QAAQ,GAAW,GAAG,CAAC;IAC7B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAE/C,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/C,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3B,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAEjC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;QACzC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7C,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3B,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9C,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3B,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QACjC,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK;YAAE,OAAO;QAGxB,MAAM,cAAc,GAAG,GAAG,EAAE;YAC3B,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC;QAEF,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QAG5C,UAAU,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3B,MAAM,YAAY,GAAG,GAAY,EAAE,CAAC,UAAU,KAAK,UAAU,CAAC;IAE9D,OAAO;QACN,UAAU;QACV,UAAU;QACV,SAAS;QACT,QAAQ;QACR,QAAQ;QACR,YAAY;KACZ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { useDispatch, useSelector } from \"../store\";\r\nimport { MenuActions } from \"../actions/menuActions\";\r\nimport { useCallback, useContext } from \"react\";\r\nimport { MenuContext } from \"../components/menu/menuContext\";\r\n\r\ntype MenuHook = {\r\n\t/**\r\n\t * The Id of the menu that is currently open\r\n\t *\r\n\t * @type {string | null}\r\n\t */\r\n\topenMenuId: string | null;\r\n\t/**\r\n\t * Dispatches a TOGGLE_MENU action, which should cause the menu to close if it is open, or to open if it is closed.\r\n\t */\r\n\ttoggleMenu: () => void;\r\n\t/**\r\n\t * Dispatches a CLOSE_MENU action, which should cause the menu to close if it is open.\r\n\t */\r\n\tcloseMenu: () => void;\r\n\t/**\r\n\t * Dispatches a CLOSE_MENU action after a timeout (DURATION in ms). See description in useMenu comments.\r\n\t */\r\n\tblurMenu: () => void;\r\n\t/**\r\n\t * Dispatches a OPEN_MENU action, which should cause the menu to open if it is closed.\r\n\t */\r\n\topenMenu: () => void;\r\n\t/**\r\n\t * Returns true if the id of the menu matches the currently active menu\r\n\t * @return boolean - Returns true if the menu is active\r\n\t */\r\n\tisMenuActive: () => boolean;\r\n};\r\n\r\n/**\r\n * A hook for working with menus. It gets its implicit menu \"id\" from React context.\r\n * It dispatches actions to the reducer to modify menu state across MenuShell instances.\r\n *\r\n * See menuReducer.ts for \"toggle/blur\" race condition algorithm\r\n *\r\n * Setting window.FSBL.debug=true will override menu close on blur, to make it easier to debug windows\r\n */\r\nexport const useMenu = (): MenuHook => {\r\n\tconst DURATION: number = 120;\r\n\tconst dispatch = useDispatch();\r\n\tconst { openMenuId } = useSelector((state) => state.menu);\r\n\tconst { thisMenuId } = useContext(MenuContext);\r\n\r\n\tconst toggleMenu = useCallback(() => {\r\n\t\tdispatch(MenuActions.TOGGLE_MENU(thisMenuId));\r\n\t}, [dispatch, thisMenuId]);\r\n\r\n\tconst openMenu = useCallback(() => {\r\n\t\t// without this call, the toolbar will stay hidden behind other content, and the menus will not be visible\r\n\t\tFSBL.Clients.WindowClient.bringToFront();\r\n\t\tdispatch(MenuActions.OPEN_MENU(thisMenuId));\r\n\t}, [dispatch, thisMenuId]);\r\n\r\n\tconst closeMenu = useCallback(() => {\r\n\t\tdispatch(MenuActions.CLOSE_MENU(thisMenuId));\r\n\t}, [dispatch, thisMenuId]);\r\n\r\n\tconst blurMenu = useCallback(() => {\r\n\t\tif (FSBL?.debug) return; // If we're debugging then don't blur menus\r\n\r\n\t\t// This is a purposeful closure. There is no need to update it with new state.\r\n\t\tconst closeIfPending = () => {\r\n\t\t\tdispatch(MenuActions.CLOSE_MENU_IF_PENDING(thisMenuId));\r\n\t\t};\r\n\r\n\t\tdispatch(MenuActions.BLUR_MENU(thisMenuId));\r\n\r\n\t\t// See menuReducer.ts for how this timeout is used. Removing the timeout will cause a race condition.\r\n\t\tsetTimeout(closeIfPending, DURATION);\r\n\t}, [dispatch, thisMenuId]);\r\n\r\n\tconst isMenuActive = (): boolean => openMenuId === thisMenuId;\r\n\r\n\treturn {\r\n\t\topenMenuId,\r\n\t\ttoggleMenu,\r\n\t\tcloseMenu,\r\n\t\topenMenu,\r\n\t\tblurMenu,\r\n\t\tisMenuActive,\r\n\t};\r\n};\r\n"]}
1
+ {"version":3,"file":"useMenu.js","sourceRoot":"","sources":["../../src/hooks/useMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAwC7D,MAAM,CAAC,MAAM,OAAO,GAAG,GAAa,EAAE;IACrC,MAAM,QAAQ,GAAW,GAAG,CAAC;IAC7B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC1D,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IAE/C,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;QACnC,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC;IAC/C,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3B,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAEjC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,CAAC;QACzC,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7C,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3B,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;QAClC,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9C,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3B,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QACjC,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK;YAAE,OAAO;QAGxB,MAAM,cAAc,GAAG,GAAG,EAAE;YAC3B,QAAQ,CAAC,WAAW,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC;QAEF,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;QAG5C,UAAU,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;IAE3B,MAAM,YAAY,GAAG,GAAY,EAAE,CAAC,UAAU,KAAK,UAAU,CAAC;IAE9D,OAAO;QACN,UAAU;QACV,UAAU;QACV,SAAS;QACT,QAAQ;QACR,QAAQ;QACR,YAAY;KACZ,CAAC;AACH,CAAC,CAAC","sourcesContent":["import { useDispatch, useSelector } from \"../store\";\nimport { MenuActions } from \"../actions/menuActions\";\nimport { useCallback, useContext } from \"react\";\nimport { MenuContext } from \"../components/menu/menuContext\";\n\ntype MenuHook = {\n\t/**\n\t * The Id of the menu that is currently open\n\t *\n\t * @type {string | null}\n\t */\n\topenMenuId: string | null;\n\t/**\n\t * Dispatches a TOGGLE_MENU action, which should cause the menu to close if it is open, or to open if it is closed.\n\t */\n\ttoggleMenu: () => void;\n\t/**\n\t * Dispatches a CLOSE_MENU action, which should cause the menu to close if it is open.\n\t */\n\tcloseMenu: () => void;\n\t/**\n\t * Dispatches a CLOSE_MENU action after a timeout (DURATION in ms). See description in useMenu comments.\n\t */\n\tblurMenu: () => void;\n\t/**\n\t * Dispatches a OPEN_MENU action, which should cause the menu to open if it is closed.\n\t */\n\topenMenu: () => void;\n\t/**\n\t * Returns true if the id of the menu matches the currently active menu\n\t * @return boolean - Returns true if the menu is active\n\t */\n\tisMenuActive: () => boolean;\n};\n\n/**\n * A hook for working with menus. It gets its implicit menu \"id\" from React context.\n * It dispatches actions to the reducer to modify menu state across MenuShell instances.\n *\n * See menuReducer.ts for \"toggle/blur\" race condition algorithm\n *\n * Setting window.FSBL.debug=true will override menu close on blur, to make it easier to debug windows\n */\nexport const useMenu = (): MenuHook => {\n\tconst DURATION: number = 120;\n\tconst dispatch = useDispatch();\n\tconst { openMenuId } = useSelector((state) => state.menu);\n\tconst { thisMenuId } = useContext(MenuContext);\n\n\tconst toggleMenu = useCallback(() => {\n\t\tdispatch(MenuActions.TOGGLE_MENU(thisMenuId));\n\t}, [dispatch, thisMenuId]);\n\n\tconst openMenu = useCallback(() => {\n\t\t// without this call, the toolbar will stay hidden behind other content, and the menus will not be visible\n\t\tFSBL.Clients.WindowClient.bringToFront();\n\t\tdispatch(MenuActions.OPEN_MENU(thisMenuId));\n\t}, [dispatch, thisMenuId]);\n\n\tconst closeMenu = useCallback(() => {\n\t\tdispatch(MenuActions.CLOSE_MENU(thisMenuId));\n\t}, [dispatch, thisMenuId]);\n\n\tconst blurMenu = useCallback(() => {\n\t\tif (FSBL?.debug) return; // If we're debugging then don't blur menus\n\n\t\t// This is a purposeful closure. There is no need to update it with new state.\n\t\tconst closeIfPending = () => {\n\t\t\tdispatch(MenuActions.CLOSE_MENU_IF_PENDING(thisMenuId));\n\t\t};\n\n\t\tdispatch(MenuActions.BLUR_MENU(thisMenuId));\n\n\t\t// See menuReducer.ts for how this timeout is used. Removing the timeout will cause a race condition.\n\t\tsetTimeout(closeIfPending, DURATION);\n\t}, [dispatch, thisMenuId]);\n\n\tconst isMenuActive = (): boolean => openMenuId === thisMenuId;\n\n\treturn {\n\t\topenMenuId,\n\t\ttoggleMenu,\n\t\tcloseMenu,\n\t\topenMenu,\n\t\tblurMenu,\n\t\tisMenuActive,\n\t};\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useNotifications.js","sourceRoot":"","sources":["../../src/hooks/useNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AASnF,MAAM,EAAE,YAAY,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;AAE1D,MAAM,YAAY,GAAQ,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC;AAKhD,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC1C,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,MAAM,MAAM,GAAG,QAAQ,CAAC;AAKxB,SAAS,OAAO,CAAC,KAAyC,EAAE,MAAsC;IACjG,QAAQ,MAAM,CAAC,IAAI,EAAE;QACpB,KAAK,eAAe;YACnB,OAAO;gBACN,aAAa,EAAE,CAAC,GAAG,KAAK,CAAC,aAAa,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;aAC1D,CAAC;QACH,KAAK,MAAM,CAAC,CAAC;YAEZ,MAAM,yBAAyB,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CACzD,CAAC,YAA2B,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,EAAE,CACtE,CAAC;YAGF,MAAM,aAAa,GAAG,yBAAyB;gBAC9C,CAAC,CAAC,K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QACpB,sBAAsB;QACtB,wBAAwB;QACxB,aAAa,EAAE,KAAK,CAAC,aAAa;QAClC,kBAAkB;QAClB,kBAAkB;KAClB,CAAC;AACH,CAAC","sourcesContent":["import { useEffect, useReducer } from \"react\";\r\nimport { WindowConfig, NotificationsConfig } from \"../components/notifications/types\";\r\nimport { usePubSub } from \"./usePubSub\";\r\nimport { NOTIFICATIONS_PUBSUB_TOPIC } from \"../components/notifications/constants\";\r\nimport { services } from \"@finsemble/finsemble-core\";\r\ntype NotificationServiceState = services.notification.types.NotificationServiceState;\r\n\r\ntype IFilter = services.notification.types.IFilter;\r\ntype IMuteFilter = services.notification.types.IMuteFilter;\r\ntype INotification = services.notification.types.INotification;\r\ntype INotificationHistoryOptions = services.notification.types.INotificationHistoryOptions;\r\n\r\nconst { WindowClient, NotificationClient } = FSBL.Clients;\r\n\r\nconst initialState: any = { notifications: [] };\r\n\r\n/*\r\nAction Types\r\n*/\r\nconst CREATE_MULTIPLE = \"CREATE_MULTIPLE\";\r\nconst UPDATE = \"UPDATE\";\r\nconst REMOVE = \"REMOVE\";\r\n\r\n/*\r\n\tReducer\r\n\t*/\r\nfunction reducer(state: { notifications: INotification[] }, action: { type: string; payload: any }) {\r\n\tswitch (action.type) {\r\n\t\tcase CREATE_MULTIPLE:\r\n\t\t\treturn {\r\n\t\t\t\tnotifications: [...state.notifications, ...action.payload],\r\n\t\t\t};\r\n\t\tcase UPDATE: {\r\n\t\t\t// check to see if the notification exists if so update the values\r\n\t\t\tconst notificationExistsInArray = state.notifications.find(\r\n\t\t\t\t(notification: INotification) => notification.id === action.payload.id\r\n\t\t\t);\r\n\r\n\t\t\t//if the notification exists then do nothing and return the current state else add the the new notification to the state\r\n\t\t\tconst notifications = notificationExistsInArray\r\n\t\t\t\t? state.notifications.map((notification: INotification) =>\r\n\t\t\t\t\t\tnotification.id === action.payload.id ? action.payload : notification\r\n\t\t\t\t )\r\n\t\t\t\t: [action.payload, ...state.notifications];\r\n\r\n\t\t\treturn { notifications };\r\n\t\t}\r\n\t\tcase REMOVE:\r\n\t\t\treturn {\r\n\t\t\t\tnotifications: state.notifications.filter((notification) => notification.id !== action.payload.id),\r\n\t\t\t};\r\n\t\tdefault:\r\n\t\t\tthrow new Error();\r\n\t}\r\n}\r\n\r\ntype NotificationUIStatePublish = (state: NotificationServiceState) => void;\r\n\r\n/**\r\n * Thin wrapper around usePubSub to give us typesafety for the notification service's UI state.\r\n * Automatically appends this client's windowName which is used by the notification service to\r\n * display the notification center on an appropriate monitor.\r\n */\r\nexport const useNotificationUI = (): [state: NotificationServiceState, setState: NotificationUIStatePublish] => {\r\n\tconst [state, setState] = usePubSub(NOTIFICATIONS_PUBSUB_TOPIC);\r\n\r\n\tconst setStateAndAddWindowName = (newState: NotificationServiceState) => {\r\n\t\tsetState({\r\n\t\t\t...newState,\r\n\t\t\tmostRecentWindowName: finsembleWindow.name,\r\n\t\t});\r\n\t};\r\n\treturn [state as NotificationServiceState, setStateAndAddWindowName];\r\n};\r\n\r\nconst getActiveDescriptorsByType = (componentType: string): Promise<any[]> =>\r\n\tnew Promise(async (resolve, reject) => {\r\n\t\tFSBL.Clients.LauncherClient.getActiveDescriptors((err: any, data: any) => {\r\n\t\t\tconst activeDescriptors: any[] = [];\r\n\t\t\tif (err) {\r\n\t\t\t\treject(err);\r\n\t\t\t} else {\r\n\t\t\t\tfor (const key in data) {\r\n\t\t\t\t\tif (data.hasOwnProperty(key) && data[key]?.componentType === componentType) {\r\n\t\t\t\t\t\tactiveDescriptors.push(data[key]);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tresolve(activeDescriptors);\r\n\t\t});\r\n\t});\r\n\r\nlet toolbarWindowName: string;\r\n\r\nexport const moveToToolbarMonitor = async () => {\r\n\tconst getToolbarMonitorData = async () =>\r\n\t\tnew Promise(async (resolve, reject) => {\r\n\t\t\tif (!toolbarWindowName) {\r\n\t\t\t\tconst activeDescriptors = await getActiveDescriptorsByType(\"Toolbar\");\r\n\t\t\t\ttoolbarWindowName = activeDescriptors[0]?.name;\r\n\t\t\t}\r\n\t\t\tconst { err, data } = (await FSBL.Clients.LauncherClient.getMonitorInfo({\r\n\t\t\t\twindowIdentifier: { windowName: toolbarWindowName },\r\n\t\t\t})) as any;\r\n\r\n\t\t\tif (err) {\r\n\t\t\t\tFSBL.Clients.Logger.system.error(\"Could not get Monitor info\", err);\r\n\t\t\t\treject(err);\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tresolve(data);\r\n\t\t});\r\n\r\n\tconst data = (await getToolbarMonitorData()) as any;\r\n\tconst { data: bounds } = await finsembleWindow.getBounds();\r\n\tconst width = (bounds?.right ?? 0) - (bounds?.left ?? 0);\r\n\r\n\tfinsembleWindow.setBounds(\r\n\t\t{\r\n\t\t\tbounds: {\r\n\t\t\t\ttop: data[\"availableRect\"][\"top\"],\r\n\t\t\t\tleft: data[\"availableRect\"][\"right\"] - width,\r\n\t\t\t\theight: data[\"availableRect\"][\"height\"],\r\n\t\t\t\twidth: width,\r\n\t\t\t},\r\n\t\t},\r\n\t\t(err: any) => {\r\n\t\t\tif (err) {\r\n\t\t\t\tFSBL.Clients.Logger.system.error(\"Could not update position\", err);\r\n\t\t\t}\r\n\t\t}\r\n\t);\r\n};\r\n\r\nexport const getOS = () => {\r\n\tif (navigator.platform.indexOf(\"Win\") != -1) {\r\n\t\treturn \"Windows\";\r\n\t} else if (navigator.platform.indexOf(\"Linux\") != -1) {\r\n\t\treturn \"Linux\";\r\n\t} else if (navigator.platform.indexOf(\"Mac\") != -1) {\r\n\t\treturn \"Mac\";\r\n\t}\r\n};\r\n\r\n/**\r\n * Example for setting up button clicks\r\n *\r\n * @param notification\r\n * @param action\r\n */\r\nexport const doAction = (notification: INotification, action: any) => {\r\n\ttry {\r\n\t\tNotificationClient.performAction([notification], action).then(() => {\r\n\t\t\t// NOTE: The request to perform the action has be sent to the notifications service successfully\r\n\t\t\t// The action itself has not necessarily been perform successfully\r\n\t\t\t// 1) alert user notification has been sent (action may not have completed)\r\n\t\t});\r\n\t} catch (e) {\r\n\t\t// NOTE: The request to perform the action has failed\r\n\t\tconsole.error(\"could not create a notification client\", e);\r\n\t\tFSBL.Clients.Logger.system.error(\"could not create a notification client\", e);\r\n\t}\r\n};\r\n\r\n/**\r\n * Example for setting up button clicks\r\n *\r\n * @param filter\r\n */\r\nexport const mute = async (filter: IMuteFilter) => {\r\n\ttry {\r\n\t\tawait NotificationClient.mute(filter);\r\n\t} catch (e) {\r\n\t\t// NOTE: The request to perform the action has failed\r\n\t\tconsole.error(\"Could not save mute preferences\", e);\r\n\t\tFSBL.Clients.Logger.system.error(\"Could not save mute preferences\", e);\r\n\t}\r\n};\r\n\r\n/**\r\n * Example for setting up button clicks\r\n *\r\n * @param filter\r\n */\r\nexport const unmute = async (filter: IMuteFilter) => {\r\n\ttry {\r\n\t\tawait NotificationClient.unmute(filter);\r\n\t} catch (e) {\r\n\t\t// NOTE: The request to perform the action has failed\r\n\t\tconsole.error(\"Could not save mute preferences\", e);\r\n\t\tFSBL.Clients.Logger.system.error(\"Could not save mute preferences\", e);\r\n\t}\r\n};\r\n\r\n/**\r\n * Snooze a notification\r\n *\r\n * @param {INotification[]} notifications\r\n */\r\nexport const snoozeNotifications = async (notifications: INotification[]) => {\r\n\tconst preferences: any = await FSBL.Clients.NotificationClient.getPreferences();\r\n\tconst snoozeAction = new FSBL.Clients.NotificationClient.Action();\r\n\tsnoozeAction.type = FSBL.Clients.NotificationClient.ActionTypes.SNOOZE;\r\n\tif (preferences && preferences.defaultSnoozePeriodSeconds) {\r\n\t\tsnoozeAction.milliseconds = preferences.defaultSnoozePeriodSeconds * 1000;\r\n\t}\r\n\tsnoozeAction.buttonText = \"Snooze\";\r\n\r\n\tfor (let i = 0; i < notifications.length; i++) {\r\n\t\tdoAction(notifications[i], snoozeAction);\r\n\t}\r\n};\r\n\r\n/**\r\n * Marks a notification as read\r\n *\r\n * @param {INotification[]} notifications\r\n */\r\nexport const markNotificationsUnread = (notifications: INotification[]) => {\r\n\ttry {\r\n\t\tNotificationClient.markUnread(notifications).then(() => {\r\n\t\t\t// NOTE: The request to perform the action has be sent to the notifications service successfully\r\n\t\t\t// The action itself has not necessarily been perform successfully\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.error(\"Error marking messages as unread\", e);\r\n\t\tFSBL.Clients.Logger.system.error(\"Could not mark notification as unread\", e);\r\n\t}\r\n};\r\n\r\n/**\r\n * Marks a notification as read\r\n *\r\n * @param {INotification[]} notifications\r\n */\r\nexport const markNotificationsRead = (notifications: INotification[]) => {\r\n\ttry {\r\n\t\tNotificationClient.markRead(notifications).then(() => {\r\n\t\t\t// NOTE: The request to perform the action has be sent to the notifications service successfully\r\n\t\t\t// The action itself has not necessarily been perform successfully\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.error(\"Error marking messages as read\", e);\r\n\t\tFSBL.Clients.Logger.system.error(\"Could not mark notification as read\", e);\r\n\t}\r\n};\r\n\r\n/**\r\n * Dismisses a notification\r\n *\r\n * @param {INotification[]} notifications\r\n */\r\nexport const dismissNotification = (notifications: INotification[]) => {\r\n\ttry {\r\n\t\tNotificationClient.deleteNotifications(notifications).then(() => {\r\n\t\t\t// NOTE: The request to perform the action has be sent to the notifications service successfully\r\n\t\t\t// The action itself has not necessarily been perform successfully\r\n\t\t});\r\n\t} catch (e) {\r\n\t\tconsole.error(\"Error marking messages as read\", e);\r\n\t\tFSBL.Clients.Logger.system.error(\"Could not mark notification as read\", e);\r\n\t}\r\n};\r\n\r\nexport const initializeCenterToggle = () => {\r\n\tconst [uiState, setUIState] = useNotificationUI();\r\n\r\n\tconst toggleCenter = () => {\r\n\t\tsetUIState({\r\n\t\t\t...uiState,\r\n\t\t\tshowCenter: !uiState.showCenter,\r\n\t\t});\r\n\t};\r\n\r\n\treturn {\r\n\t\ttoggleCenter,\r\n\t};\r\n};\r\n\r\n/**\r\n * Get Notification's config from\r\n */\r\nexport const getNotificationConfig = (): NotificationsConfig => {\r\n\tconst config: WindowConfig = WindowClient.options.customData;\r\n\r\n\treturn Object.assign(config?.window?.data?.notifications || {}, {\r\n\t\tisTransparent: config?.window?.options?.transparent || false,\r\n\t});\r\n};\r\n\r\nexport const getFetchHistoryParams = (config: any, params: any) => {\r\n\tconst notificationsHistory = config?.notificationsHistory || params?.config?.notificationsHistory;\r\n\r\n\t// Backwards compatibility - `since` replaced with `options` object\r\n\tlet options = notificationsHistory.since ? notificationsHistory.since : null;\r\n\r\n\t// Use options object if it's been set in the component config\r\n\tif (!options) {\r\n\t\toptions = notificationsHistory?.options;\r\n\t}\r\n\r\n\t// If no options object set and notificationsHistory is true set in config, use the params\r\n\tif (!options && typeof notificationsHistory === \"boolean\" && notificationsHistory) {\r\n\t\toptions = params?.config?.notificationsHistory.options;\r\n\t}\r\n\r\n\tconst filter = notificationsHistory.filter ? notificationsHistory.filter : null;\r\n\r\n\treturn [options, filter];\r\n};\r\n\r\nexport default function useNotifications(params: any = {}) {\r\n\tconst [state, dispatch] = useReducer(reducer, initialState);\r\n\r\n\t/*\r\n\t\tAction Creators\r\n\t*/\r\n\tconst removeNotification = (notification: INotification) => {\r\n\t\tdispatch({ type: REMOVE, payload: notification });\r\n\t};\r\n\r\n\tconst addNotification = (notification: INotification) => {\r\n\t\tdispatch({ type: UPDATE, payload: notification });\r\n\t};\r\n\r\n\tconst addMultipleNotifications = (notifications: INotification[]) => {\r\n\t\tdispatch({ type: CREATE_MULTIPLE, payload: notifications });\r\n\t};\r\n\r\n\t/**\r\n\t * Group Notifications by Type\r\n\t * @param notifications\r\n\t */\r\n\tconst groupNotificationsByType = (notifications: INotification[]) => {\r\n\t\tconst groupBy = (arr: INotification[]) =>\r\n\t\t\tarr\r\n\t\t\t\t.map((notification: INotification): string => notification.type ?? \"unknown\")\r\n\t\t\t\t.reduce((acc: { [x: string]: any }, notificationType: string, index: number) => {\r\n\t\t\t\t\tacc[notificationType] = [...(acc[notificationType] || []), arr[index]];\r\n\t\t\t\t\treturn acc;\r\n\t\t\t\t}, {});\r\n\r\n\t\treturn groupBy(notifications);\r\n\t};\r\n\r\n\t/**\r\n\t * \t * get the past notifications\r\n\t * WARNING - The default will get all notifications all the way back from 1969!!!\r\n\t * @param since\r\n\t * @param filter\r\n\t */\r\n\tconst getNotificationHistory = (\r\n\t\tsince: INotificationHistoryOptions = { sentAfter: \"1969-12-31T23:59:59.999Z\" },\r\n\t\tfilter: null | IFilter = null\r\n\t): Promise<INotification[]> => NotificationClient.fetchHistory(since, filter as IFilter);\r\n\r\n\tconst notificationIsActive = (notification: INotification, applyMuteFilterOverride?: boolean | undefined) => {\r\n\t\tlet applyMuteFilters = applyMuteFilterOverride;\r\n\r\n\t\tif (typeof applyMuteFilterOverride === \"undefined\") {\r\n\t\t\tconst config = getNotificationConfig();\r\n\t\t\tapplyMuteFilters = config?.applyMuteFilters ? config.applyMuteFilters : false;\r\n\t\t}\r\n\r\n\t\treturn (\r\n\t\t\t!notification.isSnoozed &&\r\n\t\t\t!notification.isRead &&\r\n\t\t\t!notification.isDeleted &&\r\n\t\t\t(applyMuteFilters ? !notification.isMuted : true)\r\n\t\t);\r\n\t};\r\n\r\n\tconst activeNotifications = (notifications: INotification[], applyMuteFilterOverride?: boolean | undefined) =>\r\n\t\tnotifications.filter((notification) => notificationIsActive(notification, applyMuteFilterOverride));\r\n\r\n\t/**\r\n\t * Main init function to start the subscription\r\n\t */\r\n\tasync function init() {\r\n\t\ttry {\r\n\t\t\tconst subscription = new NotificationClient.Subscription();\r\n\r\n\t\t\tconst notificationConfig: NotificationsConfig = getNotificationConfig();\r\n\r\n\t\t\tconst filter: IFilter = new NotificationClient.Filter();\r\n\r\n\t\t\t// make filters from the config\r\n\t\t\tif (notificationConfig) {\r\n\t\t\t\tnotificationConfig.filter &&\r\n\t\t\t\t\tnotificationConfig.filter.include &&\r\n\t\t\t\t\tfilter.include.push(...notificationConfig.filter.include);\r\n\r\n\t\t\t\tnotificationConfig.filter &&\r\n\t\t\t\t\tnotificationConfig.filter.exclude &&\r\n\t\t\t\t\tfilter.exclude.push(...notificationConfig.filter.exclude);\r\n\t\t\t}\r\n\r\n\t\t\tsubscription.filter = filter;\r\n\r\n\t\t\tconst notificationsHistory = notificationConfig?.notificationsHistory || params?.config?.notificationsHistory;\r\n\r\n\t\t\tif (notificationsHistory) {\r\n\t\t\t\tconst [options, historyFilter] = getFetchHistoryParams(notificationConfig, params);\r\n\r\n\t\t\t\tconst pastNotifications = await getNotificationHistory(options, historyFilter);\r\n\t\t\t\taddMultipleNotifications(pastNotifications);\r\n\t\t\t}\r\n\t\t\tconst onNotification = function (notification: INotification) {\r\n\t\t\t\t// This function will be called when a notification arrives\r\n\t\t\t\tif (notification.isDeleted) {\r\n\t\t\t\t\tremoveNotification(notification);\r\n\t\t\t\t} else {\r\n\t\t\t\t\taddNotification(notification);\r\n\t\t\t\t}\r\n\t\t\t};\r\n\r\n\t\t\treturn NotificationClient.subscribe(subscription, onNotification);\r\n\t\t} catch (error) {\r\n\t\t\tconsole.error(error);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Set opaque class to html element\r\n\t */\r\n\tfunction setOpaqueClassName(isOpaque: boolean) {\r\n\t\tif (isOpaque) {\r\n\t\t\tconst htmlElement = document.getElementsByTagName(\"html\")[0];\r\n\t\t\tif (!htmlElement.className.includes(\"opaque\")) {\r\n\t\t\t\thtmlElement.className = `${htmlElement.className} opaque`;\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t// start receiving Notifications and putting them in state\r\n\tuseEffect(() => {\r\n\t\tconst subscribe = init();\r\n\t\treturn () => {\r\n\t\t\t// Unsubscribe using the subscription ID\r\n\t\t\t(async () => {\r\n\t\t\t\tconst subscribeObject = (await subscribe) as any;\r\n\t\t\t\tif (subscribeObject) {\r\n\t\t\t\t\tawait NotificationClient.unsubscribe(subscribeObject.id);\r\n\t\t\t\t}\r\n\t\t\t})();\r\n\t\t};\r\n\t}, []);\r\n\r\n\treturn {\r\n\t\tactiveNotifications,\r\n\t\taddNotification,\r\n\t\tnotificationIsActive,\r\n\t\tgetNotificationHistory,\r\n\t\tgroupNotificationsByType,\r\n\t\tnotifications: state.notifications,\r\n\t\tremoveNotification,\r\n\t\tsetOpaqueClassName,\r\n\t};\r\n}\r\n"]}
1
+ {"version":3,"file":"useNotifications.js","sourceRoot":"","sources":["../../src/hooks/useNotifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AASnF,MAAM,EAAE,YAAY,EAAE,kBAAkB,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;AAE1D,MAAM,YAAY,GAAQ,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC;AAKhD,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAC1C,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,MAAM,MAAM,GAAG,QAAQ,CAAC;AAKxB,SAAS,OAAO,CAAC,KAAyC,EAAE,MAAsC;IACjG,QAAQ,MAAM,CAAC,IAAI,EAAE;QACpB,KAAK,eAAe;YACnB,OAAO;gBACN,aAAa,EAAE,CAAC,GAAG,KAAK,CAAC,aAAa,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC;aAC1D,CAAC;QACH,KAAK,MAAM,CAAC,CAAC;YAEZ,MAAM,yBAAyB,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CACzD,CAAC,YAA2B,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAAC,EAAE,CACtE,CAAC;YAGF,MAAM,aAAa,GAAG,yBAAyB;gBAC9C,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,YAA2B,EAAE,EAAE,CACxD,YAAY,CAAC,EAAE,KAAK,MAAM,CAAC,OAAO,CAA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AAC","sourcesContent":["import { useEffect, useReducer } from \"react\";\nimport { WindowConfig, NotificationsConfig } from \"../components/notifications/types\";\nimport { usePubSub } from \"./usePubSub\";\nimport { NOTIFICATIONS_PUBSUB_TOPIC } from \"../components/notifications/constants\";\nimport { services } from \"@finsemble/finsemble-core\";\ntype NotificationServiceState = services.notification.types.NotificationServiceState;\n\ntype IFilter = services.notification.types.IFilter;\ntype IMuteFilter = services.notification.types.IMuteFilter;\ntype INotification = services.notification.types.INotification;\ntype INotificationHistoryOptions = services.notification.types.INotificationHistoryOptions;\n\nconst { WindowClient, NotificationClient } = FSBL.Clients;\n\nconst initialState: any = { notifications: [] };\n\n/*\nAction Types\n*/\nconst CREATE_MULTIPLE = \"CREATE_MULTIPLE\";\nconst UPDATE = \"UPDATE\";\nconst REMOVE = \"REMOVE\";\n\n/*\n\tReducer\n\t*/\nfunction reducer(state: { notifications: INotification[] }, action: { type: string; payload: any }) {\n\tswitch (action.type) {\n\t\tcase CREATE_MULTIPLE:\n\t\t\treturn {\n\t\t\t\tnotifications: [...state.notifications, ...action.payload],\n\t\t\t};\n\t\tcase UPDATE: {\n\t\t\t// check to see if the notification exists if so update the values\n\t\t\tconst notificationExistsInArray = state.notifications.find(\n\t\t\t\t(notification: INotification) => notification.id === action.payload.id\n\t\t\t);\n\n\t\t\t//if the notification exists then do nothing and return the current state else add the the new notification to the state\n\t\t\tconst notifications = notificationExistsInArray\n\t\t\t\t? state.notifications.map((notification: INotification) =>\n\t\t\t\t\t\tnotification.id === action.payload.id ? action.payload : notification\n\t\t\t\t )\n\t\t\t\t: [action.payload, ...state.notifications];\n\n\t\t\treturn { notifications };\n\t\t}\n\t\tcase REMOVE:\n\t\t\treturn {\n\t\t\t\tnotifications: state.notifications.filter((notification) => notification.id !== action.payload.id),\n\t\t\t};\n\t\tdefault:\n\t\t\tthrow new Error();\n\t}\n}\n\ntype NotificationUIStatePublish = (state: NotificationServiceState) => void;\n\n/**\n * Thin wrapper around usePubSub to give us typesafety for the notification service's UI state.\n * Automatically appends this client's windowName which is used by the notification service to\n * display the notification center on an appropriate monitor.\n */\nexport const useNotificationUI = (): [state: NotificationServiceState, setState: NotificationUIStatePublish] => {\n\tconst [state, setState] = usePubSub(NOTIFICATIONS_PUBSUB_TOPIC);\n\n\tconst setStateAndAddWindowName = (newState: NotificationServiceState) => {\n\t\tsetState({\n\t\t\t...newState,\n\t\t\tmostRecentWindowName: finsembleWindow.name,\n\t\t});\n\t};\n\treturn [state as NotificationServiceState, setStateAndAddWindowName];\n};\n\nconst getActiveDescriptorsByType = (componentType: string): Promise<any[]> =>\n\tnew Promise(async (resolve, reject) => {\n\t\tFSBL.Clients.LauncherClient.getActiveDescriptors((err: any, data: any) => {\n\t\t\tconst activeDescriptors: any[] = [];\n\t\t\tif (err) {\n\t\t\t\treject(err);\n\t\t\t} else {\n\t\t\t\tfor (const key in data) {\n\t\t\t\t\tif (data.hasOwnProperty(key) && data[key]?.componentType === componentType) {\n\t\t\t\t\t\tactiveDescriptors.push(data[key]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tresolve(activeDescriptors);\n\t\t});\n\t});\n\nlet toolbarWindowName: string;\n\nexport const moveToToolbarMonitor = async () => {\n\tconst getToolbarMonitorData = async () =>\n\t\tnew Promise(async (resolve, reject) => {\n\t\t\tif (!toolbarWindowName) {\n\t\t\t\tconst activeDescriptors = await getActiveDescriptorsByType(\"Toolbar\");\n\t\t\t\ttoolbarWindowName = activeDescriptors[0]?.name;\n\t\t\t}\n\t\t\tconst { err, data } = (await FSBL.Clients.LauncherClient.getMonitorInfo({\n\t\t\t\twindowIdentifier: { windowName: toolbarWindowName },\n\t\t\t})) as any;\n\n\t\t\tif (err) {\n\t\t\t\tFSBL.Clients.Logger.system.error(\"Could not get Monitor info\", err);\n\t\t\t\treject(err);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve(data);\n\t\t});\n\n\tconst data = (await getToolbarMonitorData()) as any;\n\tconst { data: bounds } = await finsembleWindow.getBounds();\n\tconst width = (bounds?.right ?? 0) - (bounds?.left ?? 0);\n\n\tfinsembleWindow.setBounds(\n\t\t{\n\t\t\tbounds: {\n\t\t\t\ttop: data[\"availableRect\"][\"top\"],\n\t\t\t\tleft: data[\"availableRect\"][\"right\"] - width,\n\t\t\t\theight: data[\"availableRect\"][\"height\"],\n\t\t\t\twidth: width,\n\t\t\t},\n\t\t},\n\t\t(err: any) => {\n\t\t\tif (err) {\n\t\t\t\tFSBL.Clients.Logger.system.error(\"Could not update position\", err);\n\t\t\t}\n\t\t}\n\t);\n};\n\nexport const getOS = () => {\n\tif (navigator.platform.indexOf(\"Win\") != -1) {\n\t\treturn \"Windows\";\n\t} else if (navigator.platform.indexOf(\"Linux\") != -1) {\n\t\treturn \"Linux\";\n\t} else if (navigator.platform.indexOf(\"Mac\") != -1) {\n\t\treturn \"Mac\";\n\t}\n};\n\n/**\n * Example for setting up button clicks\n *\n * @param notification\n * @param action\n */\nexport const doAction = (notification: INotification, action: any) => {\n\ttry {\n\t\tNotificationClient.performAction([notification], action).then(() => {\n\t\t\t// NOTE: The request to perform the action has be sent to the notifications service successfully\n\t\t\t// The action itself has not necessarily been perform successfully\n\t\t\t// 1) alert user notification has been sent (action may not have completed)\n\t\t});\n\t} catch (e) {\n\t\t// NOTE: The request to perform the action has failed\n\t\tconsole.error(\"could not create a notification client\", e);\n\t\tFSBL.Clients.Logger.system.error(\"could not create a notification client\", e);\n\t}\n};\n\n/**\n * Example for setting up button clicks\n *\n * @param filter\n */\nexport const mute = async (filter: IMuteFilter) => {\n\ttry {\n\t\tawait NotificationClient.mute(filter);\n\t} catch (e) {\n\t\t// NOTE: The request to perform the action has failed\n\t\tconsole.error(\"Could not save mute preferences\", e);\n\t\tFSBL.Clients.Logger.system.error(\"Could not save mute preferences\", e);\n\t}\n};\n\n/**\n * Example for setting up button clicks\n *\n * @param filter\n */\nexport const unmute = async (filter: IMuteFilter) => {\n\ttry {\n\t\tawait NotificationClient.unmute(filter);\n\t} catch (e) {\n\t\t// NOTE: The request to perform the action has failed\n\t\tconsole.error(\"Could not save mute preferences\", e);\n\t\tFSBL.Clients.Logger.system.error(\"Could not save mute preferences\", e);\n\t}\n};\n\n/**\n * Snooze a notification\n *\n * @param {INotification[]} notifications\n */\nexport const snoozeNotifications = async (notifications: INotification[]) => {\n\tconst preferences: any = await FSBL.Clients.NotificationClient.getPreferences();\n\tconst snoozeAction = new FSBL.Clients.NotificationClient.Action();\n\tsnoozeAction.type = FSBL.Clients.NotificationClient.ActionTypes.SNOOZE;\n\tif (preferences && preferences.defaultSnoozePeriodSeconds) {\n\t\tsnoozeAction.milliseconds = preferences.defaultSnoozePeriodSeconds * 1000;\n\t}\n\tsnoozeAction.buttonText = \"Snooze\";\n\n\tfor (let i = 0; i < notifications.length; i++) {\n\t\tdoAction(notifications[i], snoozeAction);\n\t}\n};\n\n/**\n * Marks a notification as read\n *\n * @param {INotification[]} notifications\n */\nexport const markNotificationsUnread = (notifications: INotification[]) => {\n\ttry {\n\t\tNotificationClient.markUnread(notifications).then(() => {\n\t\t\t// NOTE: The request to perform the action has be sent to the notifications service successfully\n\t\t\t// The action itself has not necessarily been perform successfully\n\t\t});\n\t} catch (e) {\n\t\tconsole.error(\"Error marking messages as unread\", e);\n\t\tFSBL.Clients.Logger.system.error(\"Could not mark notification as unread\", e);\n\t}\n};\n\n/**\n * Marks a notification as read\n *\n * @param {INotification[]} notifications\n */\nexport const markNotificationsRead = (notifications: INotification[]) => {\n\ttry {\n\t\tNotificationClient.markRead(notifications).then(() => {\n\t\t\t// NOTE: The request to perform the action has be sent to the notifications service successfully\n\t\t\t// The action itself has not necessarily been perform successfully\n\t\t});\n\t} catch (e) {\n\t\tconsole.error(\"Error marking messages as read\", e);\n\t\tFSBL.Clients.Logger.system.error(\"Could not mark notification as read\", e);\n\t}\n};\n\n/**\n * Dismisses a notification\n *\n * @param {INotification[]} notifications\n */\nexport const dismissNotification = (notifications: INotification[]) => {\n\ttry {\n\t\tNotificationClient.deleteNotifications(notifications).then(() => {\n\t\t\t// NOTE: The request to perform the action has be sent to the notifications service successfully\n\t\t\t// The action itself has not necessarily been perform successfully\n\t\t});\n\t} catch (e) {\n\t\tconsole.error(\"Error marking messages as read\", e);\n\t\tFSBL.Clients.Logger.system.error(\"Could not mark notification as read\", e);\n\t}\n};\n\nexport const initializeCenterToggle = () => {\n\tconst [uiState, setUIState] = useNotificationUI();\n\n\tconst toggleCenter = () => {\n\t\tsetUIState({\n\t\t\t...uiState,\n\t\t\tshowCenter: !uiState.showCenter,\n\t\t});\n\t};\n\n\treturn {\n\t\ttoggleCenter,\n\t};\n};\n\n/**\n * Get Notification's config from\n */\nexport const getNotificationConfig = (): NotificationsConfig => {\n\tconst config: WindowConfig = WindowClient.options.customData;\n\n\treturn Object.assign(config?.window?.data?.notifications || {}, {\n\t\tisTransparent: config?.window?.options?.transparent || false,\n\t});\n};\n\nexport const getFetchHistoryParams = (config: any, params: any) => {\n\tconst notificationsHistory = config?.notificationsHistory || params?.config?.notificationsHistory;\n\n\t// Backwards compatibility - `since` replaced with `options` object\n\tlet options = notificationsHistory.since ? notificationsHistory.since : null;\n\n\t// Use options object if it's been set in the component config\n\tif (!options) {\n\t\toptions = notificationsHistory?.options;\n\t}\n\n\t// If no options object set and notificationsHistory is true set in config, use the params\n\tif (!options && typeof notificationsHistory === \"boolean\" && notificationsHistory) {\n\t\toptions = params?.config?.notificationsHistory.options;\n\t}\n\n\tconst filter = notificationsHistory.filter ? notificationsHistory.filter : null;\n\n\treturn [options, filter];\n};\n\nexport default function useNotifications(params: any = {}) {\n\tconst [state, dispatch] = useReducer(reducer, initialState);\n\n\t/*\n\t\tAction Creators\n\t*/\n\tconst removeNotification = (notification: INotification) => {\n\t\tdispatch({ type: REMOVE, payload: notification });\n\t};\n\n\tconst addNotification = (notification: INotification) => {\n\t\tdispatch({ type: UPDATE, payload: notification });\n\t};\n\n\tconst addMultipleNotifications = (notifications: INotification[]) => {\n\t\tdispatch({ type: CREATE_MULTIPLE, payload: notifications });\n\t};\n\n\t/**\n\t * Group Notifications by Type\n\t * @param notifications\n\t */\n\tconst groupNotificationsByType = (notifications: INotification[]) => {\n\t\tconst groupBy = (arr: INotification[]) =>\n\t\t\tarr\n\t\t\t\t.map((notification: INotification): string => notification.type ?? \"unknown\")\n\t\t\t\t.reduce((acc: { [x: string]: any }, notificationType: string, index: number) => {\n\t\t\t\t\tacc[notificationType] = [...(acc[notificationType] || []), arr[index]];\n\t\t\t\t\treturn acc;\n\t\t\t\t}, {});\n\n\t\treturn groupBy(notifications);\n\t};\n\n\t/**\n\t * \t * get the past notifications\n\t * WARNING - The default will get all notifications all the way back from 1969!!!\n\t * @param since\n\t * @param filter\n\t */\n\tconst getNotificationHistory = (\n\t\tsince: INotificationHistoryOptions = { sentAfter: \"1969-12-31T23:59:59.999Z\" },\n\t\tfilter: null | IFilter = null\n\t): Promise<INotification[]> => NotificationClient.fetchHistory(since, filter as IFilter);\n\n\tconst notificationIsActive = (notification: INotification, applyMuteFilterOverride?: boolean | undefined) => {\n\t\tlet applyMuteFilters = applyMuteFilterOverride;\n\n\t\tif (typeof applyMuteFilterOverride === \"undefined\") {\n\t\t\tconst config = getNotificationConfig();\n\t\t\tapplyMuteFilters = config?.applyMuteFilters ? config.applyMuteFilters : false;\n\t\t}\n\n\t\treturn (\n\t\t\t!notification.isSnoozed &&\n\t\t\t!notification.isRead &&\n\t\t\t!notification.isDeleted &&\n\t\t\t(applyMuteFilters ? !notification.isMuted : true)\n\t\t);\n\t};\n\n\tconst activeNotifications = (notifications: INotification[], applyMuteFilterOverride?: boolean | undefined) =>\n\t\tnotifications.filter((notification) => notificationIsActive(notification, applyMuteFilterOverride));\n\n\t/**\n\t * Main init function to start the subscription\n\t */\n\tasync function init() {\n\t\ttry {\n\t\t\tconst subscription = new NotificationClient.Subscription();\n\n\t\t\tconst notificationConfig: NotificationsConfig = getNotificationConfig();\n\n\t\t\tconst filter: IFilter = new NotificationClient.Filter();\n\n\t\t\t// make filters from the config\n\t\t\tif (notificationConfig) {\n\t\t\t\tnotificationConfig.filter &&\n\t\t\t\t\tnotificationConfig.filter.include &&\n\t\t\t\t\tfilter.include.push(...notificationConfig.filter.include);\n\n\t\t\t\tnotificationConfig.filter &&\n\t\t\t\t\tnotificationConfig.filter.exclude &&\n\t\t\t\t\tfilter.exclude.push(...notificationConfig.filter.exclude);\n\t\t\t}\n\n\t\t\tsubscription.filter = filter;\n\n\t\t\tconst notificationsHistory = notificationConfig?.notificationsHistory || params?.config?.notificationsHistory;\n\n\t\t\tif (notificationsHistory) {\n\t\t\t\tconst [options, historyFilter] = getFetchHistoryParams(notificationConfig, params);\n\n\t\t\t\tconst pastNotifications = await getNotificationHistory(options, historyFilter);\n\t\t\t\taddMultipleNotifications(pastNotifications);\n\t\t\t}\n\t\t\tconst onNotification = function (notification: INotification) {\n\t\t\t\t// This function will be called when a notification arrives\n\t\t\t\tif (notification.isDeleted) {\n\t\t\t\t\tremoveNotification(notification);\n\t\t\t\t} else {\n\t\t\t\t\taddNotification(notification);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\treturn NotificationClient.subscribe(subscription, onNotification);\n\t\t} catch (error) {\n\t\t\tconsole.error(error);\n\t\t}\n\t}\n\n\t/**\n\t * Set opaque class to html element\n\t */\n\tfunction setOpaqueClassName(isOpaque: boolean) {\n\t\tif (isOpaque) {\n\t\t\tconst htmlElement = document.getElementsByTagName(\"html\")[0];\n\t\t\tif (!htmlElement.className.includes(\"opaque\")) {\n\t\t\t\thtmlElement.className = `${htmlElement.className} opaque`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// start receiving Notifications and putting them in state\n\tuseEffect(() => {\n\t\tconst subscribe = init();\n\t\treturn () => {\n\t\t\t// Unsubscribe using the subscription ID\n\t\t\t(async () => {\n\t\t\t\tconst subscribeObject = (await subscribe) as any;\n\t\t\t\tif (subscribeObject) {\n\t\t\t\t\tawait NotificationClient.unsubscribe(subscribeObject.id);\n\t\t\t\t}\n\t\t\t})();\n\t\t};\n\t}, []);\n\n\treturn {\n\t\tactiveNotifications,\n\t\taddNotification,\n\t\tnotificationIsActive,\n\t\tgetNotificationHistory,\n\t\tgroupNotificationsByType,\n\t\tnotifications: state.notifications,\n\t\tremoveNotification,\n\t\tsetOpaqueClassName,\n\t};\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useOutsideClickDetector.js","sourceRoot":"","sources":["../../src/hooks/useOutsideClickDetector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,OAAO,CAAC;AAKpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAA4C,EAAE,EAAY,EAAE,EAAE;IACrG,SAAS,CAAC,GAAG,EAAE;QACd,SAAS,kBAAkB,CAAC,KAAiB;YAC5C,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,EAAE;gBAC/D,EAAE,EAAE,CAAC;aACL;QACF,CAAC;QACD,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAC3D,OAAO,GAAG,EAAE;YACX,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAC/D,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACX,CAAC,CAAC","sourcesContent":["import { MutableRefObject, useEffect } from \"react\";\r\n\r\n/**\r\n * Hook that detects clicks outside of the passed ref and executes a function\r\n */\r\nexport const useOutsideClickDetector = (ref: MutableRefObject<null | HTMLDivElement>, fn: Function) => {\r\n\tuseEffect(() => {\r\n\t\tfunction handleClickOutside(event: MouseEvent) {\r\n\t\t\tif (ref.current && !ref.current.contains(event.target as Node)) {\r\n\t\t\t\tfn();\r\n\t\t\t}\r\n\t\t}\r\n\t\tdocument.addEventListener(\"mousedown\", handleClickOutside);\r\n\t\treturn () => {\r\n\t\t\tdocument.removeEventListener(\"mousedown\", handleClickOutside);\r\n\t\t};\r\n\t}, [ref]);\r\n};\r\n"]}
1
+ {"version":3,"file":"useOutsideClickDetector.js","sourceRoot":"","sources":["../../src/hooks/useOutsideClickDetector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAM,OAAO,CAAC;AAKpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAA4C,EAAE,EAAY,EAAE,EAAE;IACrG,SAAS,CAAC,GAAG,EAAE;QACd,SAAS,kBAAkB,CAAC,KAAiB;YAC5C,IAAI,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAc,CAAC,EAAE;gBAC/D,EAAE,EAAE,CAAC;aACL;QACF,CAAC;QACD,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAC3D,OAAO,GAAG,EAAE;YACX,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAAC;QAC/D,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACX,CAAC,CAAC","sourcesContent":["import { MutableRefObject, useEffect } from \"react\";\n\n/**\n * Hook that detects clicks outside of the passed ref and executes a function\n */\nexport const useOutsideClickDetector = (ref: MutableRefObject<null | HTMLDivElement>, fn: Function) => {\n\tuseEffect(() => {\n\t\tfunction handleClickOutside(event: MouseEvent) {\n\t\t\tif (ref.current && !ref.current.contains(event.target as Node)) {\n\t\t\t\tfn();\n\t\t\t}\n\t\t}\n\t\tdocument.addEventListener(\"mousedown\", handleClickOutside);\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(\"mousedown\", handleClickOutside);\n\t\t};\n\t}, [ref]);\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"usePubSub.js","sourceRoot":"","sources":["../../src/hooks/usePubSub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;AAmBtC,SAAS,SAAS,CAAC,KAAa,EAAE,iBAAyB,EAAE;IAC5D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEvD,MAAM,GAAG,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAE5E,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC3E,IAAI,GAAG,EAAE;gBAER,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACnB;YACD,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACX,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QACpD,CAAC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import * as React from \"react\";\r\n\r\nconst { useState, useEffect } = React;\r\n\r\n/**\r\n * A generic effect for getting and setting state dynamically from a Router pubsub channel.\r\n *\r\n * @param {string} topic The pubsub topic (i.e. channel) to subscribe\r\n * @param {object} initialMessage The initial state (defaults to empty object)\r\n * @returns [object, function] The current state of the pubsub channel (or initialMessage if no state exists).\r\n * The second returned array parameter is a publish function which can be used to update state.\r\n *\r\n * @example\r\n * // Inside a React functional component\r\n * const [currentState, publish] = usePubSub(\"topic\", {});\r\n * console.log(currentState);\r\n *\r\n * onClick = () => {\r\n * publish(someNewState);\r\n * }\r\n */\r\nfunction usePubSub(topic: string, initialMessage: object = {}): [{ [key: string]: any }, Function] {\r\n\tconst [message, setMessage] = useState(initialMessage);\r\n\r\n\tconst pub = (value: any) => FSBL.Clients.RouterClient.publish(topic, value);\r\n\r\n\tuseEffect(() => {\r\n\t\tconst subscribeId = FSBL.Clients.RouterClient.subscribe(topic, (err, res) => {\r\n\t\t\tif (err) {\r\n\t\t\t\t// Use Finsemble Logger?\r\n\t\t\t\tconsole.error(err);\r\n\t\t\t}\r\n\t\t\tsetMessage(res.data);\r\n\t\t});\r\n\t\treturn () => {\r\n\t\t\tFSBL.Clients.RouterClient.unsubscribe(subscribeId);\r\n\t\t};\r\n\t}, []);\r\n\r\n\treturn [message, pub];\r\n}\r\n\r\nexport { usePubSub };\r\n"]}
1
+ {"version":3,"file":"usePubSub.js","sourceRoot":"","sources":["../../src/hooks/usePubSub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;AAmBtC,SAAS,SAAS,CAAC,KAAa,EAAE,iBAAyB,EAAE;IAC5D,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;IAEvD,MAAM,GAAG,GAAG,CAAC,KAAU,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAE5E,SAAS,CAAC,GAAG,EAAE;QACd,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC3E,IAAI,GAAG,EAAE;gBAER,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACnB;YACD,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACX,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QACpD,CAAC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import * as React from \"react\";\n\nconst { useState, useEffect } = React;\n\n/**\n * A generic effect for getting and setting state dynamically from a Router pubsub channel.\n *\n * @param {string} topic The pubsub topic (i.e. channel) to subscribe\n * @param {object} initialMessage The initial state (defaults to empty object)\n * @returns [object, function] The current state of the pubsub channel (or initialMessage if no state exists).\n * The second returned array parameter is a publish function which can be used to update state.\n *\n * @example\n * // Inside a React functional component\n * const [currentState, publish] = usePubSub(\"topic\", {});\n * console.log(currentState);\n *\n * onClick = () => {\n * publish(someNewState);\n * }\n */\nfunction usePubSub(topic: string, initialMessage: object = {}): [{ [key: string]: any }, Function] {\n\tconst [message, setMessage] = useState(initialMessage);\n\n\tconst pub = (value: any) => FSBL.Clients.RouterClient.publish(topic, value);\n\n\tuseEffect(() => {\n\t\tconst subscribeId = FSBL.Clients.RouterClient.subscribe(topic, (err, res) => {\n\t\t\tif (err) {\n\t\t\t\t// Use Finsemble Logger?\n\t\t\t\tconsole.error(err);\n\t\t\t}\n\t\t\tsetMessage(res.data);\n\t\t});\n\t\treturn () => {\n\t\t\tFSBL.Clients.RouterClient.unsubscribe(subscribeId);\n\t\t};\n\t}, []);\n\n\treturn [message, pub];\n}\n\nexport { usePubSub };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useSearch.js","sourceRoot":"","sources":["../../src/hooks/useSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM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MAAM,uBAAuB,GAAG,QAAQ,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;IAEtE,MAAM,WAAW,GAAG,WAAW,CAC9B,CAAC,KAAa,EAAE,EAAE;QACjB,QAAQ,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5C,YAAY,CAAC,OAAO,GAAG,KAAK,CAAC;QAE7B,YAAY,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAM,EAAE,SAAmC,EAAE,EAAE;YACpF,uBAAuB,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACJ,CAAC,EACD,CAAC,QAAQ,EAAE,aAAa,CAAC,CACzB,CAAC;IAEF,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACpC,QAAQ,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;IACxC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO;QACN,aAAa;QACb,WAAW;QACX,WAAW;QACX,WAAW;KACX,CAAC;AACH,CAAC,CAAC;AACF,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { useRef, useCallback } from \"react\";\r\nimport { useDispatch, useSelector } from \"../store\";\r\nimport { SearchActions } from \"../actions/searchActions\";\r\nimport { SearchProviderResponse } from \"../types/searchTypes\";\r\nimport { debounce } from \"lodash\";\r\n\r\nconst { SearchClient } = FSBL.Clients;\r\n\r\ntype SearchHook = {\r\n\tsearchResults: Array<SearchProviderResponse>;\r\n\tsearchQuery: string;\r\n\tupdateQuery: (query: string) => void;\r\n\tresetSearch: () => void;\r\n};\r\n\r\n/**\r\n * A hook for working with search. Search results stream back, and this hook will relay those through\r\n * a reducer. Note that the reducer implementation is a singleton (if you have multiple search) inputs\r\n * across a component then they will all be synchronized to query and results.\r\n */\r\nconst useSearch = (): SearchHook => {\r\n\tconst dispatch = useDispatch();\r\n\tconst { searchQuery, searchResults } = useSelector((state) => state.search);\r\n\tconst currentQuery = useRef({});\r\n\r\n\tconst updateResults = useCallback(\r\n\t\t(results: Array<any>) => {\r\n\t\t\tdispatch(SearchActions.UPDATE_RESULTS(results));\r\n\t\t},\r\n\t\t[dispatch]\r\n\t);\r\n\tconst onSearchClientResponse = (searchError: any, responses: SearchProviderResponse[], query: string) => {\r\n\t\t// If we get a response back from an older query then drop the results\r\n\t\tif (query !== currentQuery.current) return;\r\n\t\t/**\r\n\t\t * The callback from `SearchClient.search` can return *multiple times*, and it uses a single global array\r\n\t\t * that it is constantly mutating. React isn't doing a deep comparison, so it never updates the results, we\r\n\t\t * therefore force an update by cloning the array into a new reference.\r\n\t\t */\r\n\t\tconst clonedProviderResponses = JSON.parse(JSON.stringify(responses));\r\n\r\n\t\tif (!clonedProviderResponses) return updateResults([]);\r\n\r\n\t\tlet providersWithData = clonedProviderResponses.filter(\r\n\t\t\t(provider: SearchProviderResponse) => provider?.data?.length\r\n\t\t);\r\n\t\tif (providersWithData.length === 0) providersWithData = [];\r\n\r\n\t\tupdateResults(providersWithData);\r\n\t};\r\n\r\n\t/**\r\n\t * The seach client callback procedure is a little strange. In order to prevent a hangup for slow search\r\n\t * providers, your callback to searchClient.search is invoked multiple times -- one time per search provider.\r\n\t *\r\n\t * Your search goes out for \"De\", you get a response from the WindowService saying \"No components match\".\r\n\t * Then you get a response from the WorkspaceService saying \"Hey DefaultWorkspace matches!\". Your callback\r\n\t * has been hit twice. On the 2nd time, you get all of the data you would've gotten the first time.\r\n\t *\r\n\t * Without debouncing the search client response, we end up setting intermediary state, which forces the DOM to\r\n\t * render, which forces the window size to change to fit the DOM. Imagine the situation above.\r\n\t *\r\n\t * We send out a search for \"DE\", and the WindowService comes back at us first saying 'no components'. There's no data,\r\n\t * so there's no results. So there's no DOM spit out for the search results. This causes the window to size down\r\n\t * to its minimum. Miliseconds later, the workspace service comes at us saying \"Hey I have workspaces!\", which\r\n\t * causes the search menu to expand to fit the results in the DOM. By setting the intermediary\r\n\t * state, we cause unnecessary renders and we end up resizing resizing the window in a very jarring manner.\r\n\t * By waiting until they've had a chance to come at us in a burst, we make the menu resizing smoother and less prone to jitter.\r\n\t */\r\n\tconst debouncedSearchResponse = debounce(onSearchClientResponse, 100);\r\n\r\n\tconst updateQuery = useCallback(\r\n\t\t(query: string) => {\r\n\t\t\tdispatch(SearchActions.UPDATE_QUERY(query));\r\n\t\t\tcurrentQuery.current = query;\r\n\t\t\t// Run the search() effect. One day, move this to effects middleware.\r\n\t\t\tSearchClient.search({ text: query }, (e: any, responses: SearchProviderResponse[]) => {\r\n\t\t\t\tdebouncedSearchResponse(e, responses, query);\r\n\t\t\t});\r\n\t\t},\r\n\t\t[dispatch, updateResults]\r\n\t);\r\n\r\n\tconst resetSearch = useCallback(() => {\r\n\t\tdispatch(SearchActions.RESET_SEARCH());\r\n\t}, [dispatch]);\r\n\r\n\treturn {\r\n\t\tsearchResults,\r\n\t\tupdateQuery,\r\n\t\tsearchQuery,\r\n\t\tresetSearch,\r\n\t};\r\n};\r\nexport { useSearch };\r\n"]}
1
+ {"version":3,"file":"useSearch.js","sourceRoot":"","sources":["../../src/hooks/useSearch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;AActC,MAAM,SAAS,GAAG,GAAe,EAAE;IAClC,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,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,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACJ,CAAC,EACD,CAAC,QAAQ,EAAE,aAAa,CAAC,CACzB,CAAC;IAEF,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE;QACpC,QAAQ,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC,CAAC;IACxC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO;QACN,aAAa;QACb,WAAW;QACX,WAAW;QACX,WAAW;KACX,CAAC;AACH,CAAC,CAAC;AACF,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import { useRef, useCallback } from \"react\";\nimport { useDispatch, useSelector } from \"../store\";\nimport { SearchActions } from \"../actions/searchActions\";\nimport { SearchProviderResponse } from \"../types/searchTypes\";\nimport { debounce } from \"lodash\";\n\nconst { SearchClient } = FSBL.Clients;\n\ntype SearchHook = {\n\tsearchResults: Array<SearchProviderResponse>;\n\tsearchQuery: string;\n\tupdateQuery: (query: string) => void;\n\tresetSearch: () => void;\n};\n\n/**\n * A hook for working with search. Search results stream back, and this hook will relay those through\n * a reducer. Note that the reducer implementation is a singleton (if you have multiple search) inputs\n * across a component then they will all be synchronized to query and results.\n */\nconst useSearch = (): SearchHook => {\n\tconst dispatch = useDispatch();\n\tconst { searchQuery, searchResults } = useSelector((state) => state.search);\n\tconst currentQuery = useRef({});\n\n\tconst updateResults = useCallback(\n\t\t(results: Array<any>) => {\n\t\t\tdispatch(SearchActions.UPDATE_RESULTS(results));\n\t\t},\n\t\t[dispatch]\n\t);\n\tconst onSearchClientResponse = (searchError: any, responses: SearchProviderResponse[], query: string) => {\n\t\t// If we get a response back from an older query then drop the results\n\t\tif (query !== currentQuery.current) return;\n\t\t/**\n\t\t * The callback from `SearchClient.search` can return *multiple times*, and it uses a single global array\n\t\t * that it is constantly mutating. React isn't doing a deep comparison, so it never updates the results, we\n\t\t * therefore force an update by cloning the array into a new reference.\n\t\t */\n\t\tconst clonedProviderResponses = JSON.parse(JSON.stringify(responses));\n\n\t\tif (!clonedProviderResponses) return updateResults([]);\n\n\t\tlet providersWithData = clonedProviderResponses.filter(\n\t\t\t(provider: SearchProviderResponse) => provider?.data?.length\n\t\t);\n\t\tif (providersWithData.length === 0) providersWithData = [];\n\n\t\tupdateResults(providersWithData);\n\t};\n\n\t/**\n\t * The seach client callback procedure is a little strange. In order to prevent a hangup for slow search\n\t * providers, your callback to searchClient.search is invoked multiple times -- one time per search provider.\n\t *\n\t * Your search goes out for \"De\", you get a response from the WindowService saying \"No components match\".\n\t * Then you get a response from the WorkspaceService saying \"Hey DefaultWorkspace matches!\". Your callback\n\t * has been hit twice. On the 2nd time, you get all of the data you would've gotten the first time.\n\t *\n\t * Without debouncing the search client response, we end up setting intermediary state, which forces the DOM to\n\t * render, which forces the window size to change to fit the DOM. Imagine the situation above.\n\t *\n\t * We send out a search for \"DE\", and the WindowService comes back at us first saying 'no components'. There's no data,\n\t * so there's no results. So there's no DOM spit out for the search results. This causes the window to size down\n\t * to its minimum. Miliseconds later, the workspace service comes at us saying \"Hey I have workspaces!\", which\n\t * causes the search menu to expand to fit the results in the DOM. By setting the intermediary\n\t * state, we cause unnecessary renders and we end up resizing resizing the window in a very jarring manner.\n\t * By waiting until they've had a chance to come at us in a burst, we make the menu resizing smoother and less prone to jitter.\n\t */\n\tconst debouncedSearchResponse = debounce(onSearchClientResponse, 100);\n\n\tconst updateQuery = useCallback(\n\t\t(query: string) => {\n\t\t\tdispatch(SearchActions.UPDATE_QUERY(query));\n\t\t\tcurrentQuery.current = query;\n\t\t\t// Run the search() effect. One day, move this to effects middleware.\n\t\t\tSearchClient.search({ text: query }, (e: any, responses: SearchProviderResponse[]) => {\n\t\t\t\tdebouncedSearchResponse(e, responses, query);\n\t\t\t});\n\t\t},\n\t\t[dispatch, updateResults]\n\t);\n\n\tconst resetSearch = useCallback(() => {\n\t\tdispatch(SearchActions.RESET_SEARCH());\n\t}, [dispatch]);\n\n\treturn {\n\t\tsearchResults,\n\t\tupdateQuery,\n\t\tsearchQuery,\n\t\tresetSearch,\n\t};\n};\nexport { useSearch };\n"]}