@finsemble/finsemble-ui 7.2.0 → 7.3.0

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 (126) hide show
  1. package/package.json +14 -14
  2. package/react/assets/css/button.css +34 -6
  3. package/react/assets/css/contextMenu.css +118 -0
  4. package/react/assets/css/notificationsCenter.css +3 -214
  5. package/react/assets/css/userPreferences.css +2 -2
  6. package/react/components/common/Checkbox.d.ts +3 -2
  7. package/react/components/common/Checkbox.js +5 -21
  8. package/react/components/common/Checkbox.js.map +1 -1
  9. package/react/components/common/ContextMenu.d.ts +13 -0
  10. package/react/components/common/ContextMenu.js +69 -0
  11. package/react/components/common/ContextMenu.js.map +1 -0
  12. package/react/components/common/DropdownButton.d.ts +0 -4
  13. package/react/components/common/DropdownButton.js +39 -10
  14. package/react/components/common/DropdownButton.js.map +1 -1
  15. package/react/components/common/css/FinsembleToggle.css +0 -1
  16. package/react/components/common/css/application-edit-page.css +3 -4
  17. package/react/components/common/css/checkbox.css +60 -21
  18. package/react/components/common/css/icon.css +2 -2
  19. package/react/components/common/css/toggle.css +4 -1
  20. package/react/components/common/helpers.js +9 -0
  21. package/react/components/common/helpers.js.map +1 -1
  22. package/react/components/common/stories/ContextMenu.stories.d.ts +38 -0
  23. package/react/components/common/stories/ContextMenu.stories.js +70 -0
  24. package/react/components/common/stories/ContextMenu.stories.js.map +1 -0
  25. package/react/components/common/stories/DropdownButton.stories.d.ts +3 -3
  26. package/react/components/common/stories/DropdownButton.stories.js +11 -10
  27. package/react/components/common/stories/DropdownButton.stories.js.map +1 -1
  28. package/react/components/common/tests/Checkbox.spec.js +10 -12
  29. package/react/components/common/tests/Checkbox.spec.js.map +1 -1
  30. package/react/components/common/tests/ContextMenu.spec.d.ts +1 -0
  31. package/react/components/common/tests/ContextMenu.spec.js +108 -0
  32. package/react/components/common/tests/ContextMenu.spec.js.map +1 -0
  33. package/react/components/common/tests/DropdownButton.spec.d.ts +1 -0
  34. package/react/components/common/tests/DropdownButton.spec.js +32 -0
  35. package/react/components/common/tests/DropdownButton.spec.js.map +1 -0
  36. package/react/components/fdc3Resolver/ResolverDialog.js +5 -1
  37. package/react/components/fdc3Resolver/ResolverDialog.js.map +1 -1
  38. package/react/components/notifications/components/drawer/DrawerHeader.js +3 -3
  39. package/react/components/notifications/components/drawer/DrawerHeader.js.map +1 -1
  40. package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js +1 -0
  41. package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js.map +1 -1
  42. package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js +2 -0
  43. package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js.map +1 -1
  44. package/react/components/notifications/components/shared/IconButton.js +2 -1
  45. package/react/components/notifications/components/shared/IconButton.js.map +1 -1
  46. package/react/components/notifications/components/shared/NotificationCardShell.d.ts +2 -0
  47. package/react/components/notifications/components/shared/NotificationCardShell.js +55 -49
  48. package/react/components/notifications/components/shared/NotificationCardShell.js.map +1 -1
  49. package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js +2 -3
  50. package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js.map +1 -1
  51. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.d.ts +4 -0
  52. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.js +92 -13
  53. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.js.map +1 -1
  54. package/react/components/notifications/components/views/ListView.js +5 -9
  55. package/react/components/notifications/components/views/ListView.js.map +1 -1
  56. package/react/components/notifications/css/notification-card.css +165 -0
  57. package/react/components/notifications/stories/NotificationCardShell.stories.d.ts +14 -0
  58. package/react/components/notifications/stories/NotificationCardShell.stories.js +108 -0
  59. package/react/components/notifications/stories/NotificationCardShell.stories.js.map +1 -0
  60. package/react/components/notifications/tests/NotificationCardShell.spec.d.ts +1 -0
  61. package/react/components/notifications/tests/NotificationCardShell.spec.js +91 -0
  62. package/react/components/notifications/tests/NotificationCardShell.spec.js.map +1 -0
  63. package/react/components/notifications/types.d.ts +4 -2
  64. package/react/components/notifications/types.js.map +1 -1
  65. package/react/components/sdd/AddApp.d.ts +3 -3
  66. package/react/components/sdd/AddApp.js +29 -21
  67. package/react/components/sdd/AddApp.js.map +1 -1
  68. package/react/components/sdd/AppEditPage.js +1 -8
  69. package/react/components/sdd/AppEditPage.js.map +1 -1
  70. package/react/components/sdd/Appearance.css +2 -1
  71. package/react/components/sdd/Applications.js +7 -7
  72. package/react/components/sdd/Applications.js.map +1 -1
  73. package/react/components/sdd/Navigation.js +2 -4
  74. package/react/components/sdd/Navigation.js.map +1 -1
  75. package/react/components/sdd/common/views.js +1 -14
  76. package/react/components/sdd/common/views.js.map +1 -1
  77. package/react/components/sdd/css/addApp.css +64 -1
  78. package/react/components/sdd/css/nav.css +50 -29
  79. package/react/components/sdd/fixtures/views.js +1 -14
  80. package/react/components/sdd/fixtures/views.js.map +1 -1
  81. package/react/components/sdd/tests/AddApp.spec.js +2 -2
  82. package/react/components/sdd/tests/AddApp.spec.js.map +1 -1
  83. package/react/components/sdd/tests/AppEditPage.spec.js +5 -8
  84. package/react/components/sdd/tests/AppEditPage.spec.js.map +1 -1
  85. package/react/components/sdd/tests/Export.spec.js +11 -11
  86. package/react/components/sdd/tests/Export.spec.js.map +1 -1
  87. package/react/components/sdd/tests/ExportZip.spec.js +3 -3
  88. package/react/components/sdd/tests/ExportZip.spec.js.map +1 -1
  89. package/react/components/sdd/tests/Navigation.spec.js +3 -2
  90. package/react/components/sdd/tests/Navigation.spec.js.map +1 -1
  91. package/react/components/sdd/tests/SmartDesktopDesigner.spec.js +1 -2
  92. package/react/components/sdd/tests/SmartDesktopDesigner.spec.js.map +1 -1
  93. package/react/components/toolbar/dashbar/Dashbar.js +18 -14
  94. package/react/components/toolbar/dashbar/Dashbar.js.map +1 -1
  95. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.d.ts +9 -1
  96. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js +35 -1
  97. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js.map +1 -1
  98. package/react/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.js +1 -1
  99. package/react/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.js.map +1 -1
  100. package/react/components/userPreferences/components/content/Workspaces.d.ts +3 -1
  101. package/react/components/userPreferences/components/content/Workspaces.js +20 -3
  102. package/react/components/userPreferences/components/content/Workspaces.js.map +1 -1
  103. package/react/components/userPreferences/components/workspaces/WorkspaceItem.d.ts +1 -0
  104. package/react/components/userPreferences/components/workspaces/WorkspaceItem.js +3 -2
  105. package/react/components/userPreferences/components/workspaces/WorkspaceItem.js.map +1 -1
  106. package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js +12 -9
  107. package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js.map +1 -1
  108. package/react/components/userPreferences/tests/UserPreferencesBase.spec.js +2 -0
  109. package/react/components/userPreferences/tests/UserPreferencesBase.spec.js.map +1 -1
  110. package/react/components/windowTitleBar/WindowTitleBarShell.d.ts +99 -26
  111. package/react/components/windowTitleBar/WindowTitleBarShell.js +206 -138
  112. package/react/components/windowTitleBar/WindowTitleBarShell.js.map +1 -1
  113. package/react/components/windowTitleBar/components/left/LinkerButton.js +30 -21
  114. package/react/components/windowTitleBar/components/left/LinkerButton.js.map +1 -1
  115. package/react/hooks/useNotifications.js +8 -7
  116. package/react/hooks/useNotifications.js.map +1 -1
  117. package/react/tsconfig.tsbuildinfo +1 -1
  118. package/react/components/notifications/components/shared/OverflowMenu.d.ts +0 -16
  119. package/react/components/notifications/components/shared/OverflowMenu.js +0 -114
  120. package/react/components/notifications/components/shared/OverflowMenu.js.map +0 -1
  121. package/react/components/sdd/GettingStarted.d.ts +0 -8
  122. package/react/components/sdd/GettingStarted.js +0 -25
  123. package/react/components/sdd/GettingStarted.js.map +0 -1
  124. package/react/components/sdd/stories/GettingStarted.stories.d.ts +0 -11
  125. package/react/components/sdd/stories/GettingStarted.stories.js +0 -18
  126. package/react/components/sdd/stories/GettingStarted.stories.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ListView.js","sourceRoot":"","sources":["../../../../../src/components/notifications/components/views/ListView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAKlF,UAAU;AACV,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,aAAa;AACb,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,eAAe,MAAM,oBAAoB,CAAC;AACjD,OAAO,YAAY,EAAE,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AACrG,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,QAAQ;AACR,OAAO,EACN,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,0BAA0B,EAAE,MAAM,uDAAuD,CAAC;AAEnG,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAK9D,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,CACjC,6BAAK,SAAS,EAAC,wBAAwB;IACtC,6BAAK,SAAS,EAAC,kBAAkB,eAAe;IAChD,6BAAK,SAAS,EAAC,kBAAkB,UAAU;IAC3C,6BAAK,SAAS,EAAC,kBAAkB,cAAc;IAC/C,6BAAK,SAAS,EAAC,kBAAkB,IAAE,EAAE,CAAO,CACvC,CACN,CAAC;AAOF,MAAM,CAAC,MAAM,wBAAw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E,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CACvF,CAAC;IAEF,4BAA4B,GAAG,4BAA4B,CAAC,MAAM,CAAC,CAAC,YAA2B,EAAE,EAAE,CAClG,YAAY,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CACpF,CAAC;IAEF,OAAO,4BAA4B,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAClD,oBAAC,eAAe,OAAG,CACnB,CAAC,CAAC,CAAC,CACH;QACC,oBAAC,qBAAqB,OAAG;QACxB,4BAA4B,CAAC,GAAG,CAAC,CAAC,YAA2B,EAAE,KAAa,EAAE,EAAE;YAChF,MAAM,GAAG,GAAG,GAAG,KAAK,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;YACpF,OAAO,CACN,oBAAC,aAAa,IAAC,GAAG,EAAE,GAAG;gBACtB,oBAAC,mBAAmB,IACnB,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,YAAY,EAC1B,gCAAgC,EAAE,gCAAgC,GACjE,CACa,CAChB,CAAC;QACH,CAAC,CAAC,CACA,CACH,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import React, { useContext, useState, useEffect } from \"react\";\nimport { format, differenceInMilliseconds, parseISO, addSeconds } from \"date-fns\";\n\n// types\nimport { NotificationListViewProps } from \"../../types\";\n\n// Context\nimport { NotificationsContext } from \"../../notificationsContext\";\n\n// Components\nimport IconButton from \"../shared/IconButton\";\nimport NoNotifications from \"../NoNotifications\";\nimport OverflowMenu, { OverflowMenuActions, renderOverflowMenuAction } from \"../shared/OverflowMenu\";\nimport { CheckButton } from \"../shared/CheckButton\";\n\n// Utils\nimport {\n\tgetActiveFilter,\n\tgetMostRecentAction,\n\tisNewNotification,\n\tisReNotification,\n\tsearchNotifications,\n} from \"../../utils\";\n\nimport { NotificationCardHeaderLogo } from \"../shared/notificationCard/NotificationCardHeaderLogo\";\n\n// Constants\nimport { SelectionMode } from \"../../constants\";\nimport { services } from \"@finsemble/finsemble-api\";\nimport { ErrorBoundary } from \"../../../common/ErrorBoundary\";\n\ntype INotification = services.notification.types.INotification;\ntype IPerformedAction = services.notification.types.IPerformedAction;\n\nconst ListHeaderComponent = () => (\n\t<div className=\"list-header__container\">\n\t\t<div className=\"list-header_cell\">Received</div>\n\t\t<div className=\"list-header_cell\">App</div>\n\t\t<div className=\"list-header_cell\">Content</div>\n\t\t<div className=\"list-header_cell\">{\"\"}</div>\n\t</div>\n);\n\nexport type NotificationListRowPropType = {\n\tnotification: INotification;\n\tnewNotificationHaloPeriodSeconds: number;\n};\n\nexport const NotificationListRowShell: React.FunctionComponent<NotificationListRowPropType> = ({\n\tnotification,\n\tnewNotificationHaloPeriodSeconds,\n\tchildren,\n}: any) => {\n\tconst notificationsContext = useContext(NotificationsContext);\n\tconst { setSelectedNotification, muteFilters, selectionMode } = notificationsContext;\n\tconst [overflowMenuOpen, setOverflowMenuOpen] = useState(false);\n\tconst toggleOverflowMenu = () => {\n\t\tsetOverflowMenuOpen(!overflowMenuOpen);\n\t};\n\n\tconst [isNew, setIsNew] = useState(isNewNotification(notification, newNotificationHaloPeriodSeconds));\n\tconst [wokeFromSnooze, setWokeFromSnooze] = useState(\n\t\tisReNotification(notification, newNotificationHaloPeriodSeconds)\n\t);\n\tconst [isMuteFilterApplied, setIsMuteFilterApplied] = useState(\n\t\tmuteFilters\n\t\t\t? muteFilters.some((filter) => filter.source === notification.source && filter.type === notification.type)\n\t\t\t: false\n\t);\n\n\t// effect needed as the newNotificationHaloPeriodSeconds is fecthed asynchronously in the parent component\n\t// and sometimes at the first render, this value is still 0\n\tuseEffect(() => {\n\t\tsetIsNew(isNewNotification(notification, newNotificationHaloPeriodSeconds));\n\t}, [newNotificationHaloPeriodSeconds]);\n\n\tuseEffect(() => {\n\t\tlet isNewTimerId: any;\n\t\tif (isNew) {\n\t\t\tif (notification.isRead) {\n\t\t\t\tsetIsNew(false);\n\t\t\t\tclearTimeout(isNewTimerId);\n\t\t\t} else {\n\t\t\t\tisNewTimerId = setTimeout(() => {\n\t\t\t\t\tsetIsNew(false);\n\t\t\t\t}, differenceInMilliseconds(addSeconds(parseISO(notification.issuedAt), newNotificationHaloPeriodSeconds), Date.now()));\n\t\t\t}\n\t\t}\n\t\treturn () => {\n\t\t\tclearTimeout(isNewTimerId);\n\t\t};\n\t}, [isNew, notification]);\n\n\tuseEffect(() => {\n\t\tlet isRenotificationTimerId: any;\n\t\tif (isReNotification(notification, newNotificationHaloPeriodSeconds)) {\n\t\t\tconst mostRecentAction: IPerformedAction | null = getMostRecentAction(notification);\n\t\t\tif (mostRecentAction) {\n\t\t\t\tconst { datePerformed } = mostRecentAction;\n\t\t\t\tsetWokeFromSnooze(true);\n\t\t\t\tisRenotificationTimerId = setTimeout(() => {\n\t\t\t\t\tsetWokeFromSnooze(false);\n\t\t\t\t}, differenceInMilliseconds(addSeconds(parseISO(datePerformed), newNotificationHaloPeriodSeconds), Date.now()));\n\t\t\t}\n\t\t} else {\n\t\t\tsetWokeFromSnooze(false);\n\t\t\tclearTimeout(isRenotificationTimerId);\n\t\t}\n\t\treturn () => {\n\t\t\tclearTimeout(isRenotificationTimerId);\n\t\t};\n\t}, [newNotificationHaloPeriodSeconds, notification]);\n\n\tconst overFlowActions = Object.assign({}, OverflowMenuActions);\n\toverFlowActions.DETAILS.action = (detailNotification: INotification) => {\n\t\tsetSelectedNotification(detailNotification);\n\t};\n\n\tdelete overFlowActions.DISMISS;\n\n\tuseEffect(() => {\n\t\tfunction listenMuteStateChanged(error: any, response: any) {\n\t\t\tif (error) {\n\t\t\t\tconsole.error(\"FinsembleNotificationsMuteStateChannel: \", error);\n\t\t\t} else {\n\t\t\t\tconst { data } = response;\n\t\t\t\tif (notification.source === data.source && notification.type === data.type) {\n\t\t\t\t\tsetIsMuteFilterApplied(data.isMuted);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tFSBL.Clients.RouterClient.addListener(\"FinsembleNotificationsMuteStateChannel\", listenMuteStateChanged);\n\t\treturn () => {\n\t\t\tFSBL.Clients.RouterClient.removeListener(\"FinsembleNotificationsMuteStateChannel\", listenMuteStateChanged);\n\t\t};\n\t}, []);\n\n\tconst menuActions = Object.values(overFlowActions).map((value) =>\n\t\trenderOverflowMenuAction(notification, value, isMuteFilterApplied)\n\t);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`list-row__container notification-item ${notification.isRead ? \"is-read\" : \"\"} ${\n\t\t\t\tisNew || wokeFromSnooze ? \"new\" : \"\"\n\t\t\t}\n\t\t\t\t${notification.cssClassName ? notification.cssClassName : \"\"}`}\n\t\t>\n\t\t\t{children ? (\n\t\t\t\t<>\n\t\t\t\t\t{selectionMode === SelectionMode.SELECTION ? (\n\t\t\t\t\t\t<div className=\"list-row__cell\">\n\t\t\t\t\t\t\t<CheckButton notification={notification} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<></>\n\t\t\t\t\t)}\n\t\t\t\t\t{children}\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<div className=\"list-row__cell\">{format(Date.parse(notification.issuedAt), \"dd-MM-yyyy HH:mm\")}</div>\n\t\t\t\t\t<div className=\"list-row__cell\">\n\t\t\t\t\t\t{selectionMode === SelectionMode.SELECTION ? (\n\t\t\t\t\t\t\t<div className=\"list-row__cell\">\n\t\t\t\t\t\t\t\t<CheckButton notification={notification} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<NotificationCardHeaderLogo headerLogo={notification.headerLogo} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"list-row__cell\">{`${notification.title} - ${notification.details}`}</div>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t<div className=\"list-row__cell\">\n\t\t\t\t<span>\n\t\t\t\t\t<IconButton iconName=\"ff-dots-vert\" tooltip=\"Options\" clickHandler={toggleOverflowMenu}>\n\t\t\t\t\t\t{overflowMenuOpen ? <OverflowMenu closeSelf={setOverflowMenuOpen}>{menuActions}</OverflowMenu> : null}\n\t\t\t\t\t</IconButton>\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nconst ListView: React.FunctionComponent<NotificationListViewProps> = ({\n\tnotificationHeaderRow,\n\tnotificationListRow,\n\tnotifications,\n}) => {\n\tconst notificationsContext = useContext(NotificationsContext);\n\t// The context will be used to filter the notifications\n\tconst { drawerControlProps, searchString, filteredNotifications, setFilteredNotifications } = notificationsContext;\n\n\tconst activeFilter = getActiveFilter(drawerControlProps);\n\n\tconst [newNotificationHaloPeriodSeconds, setNotificationHaloPeriodSeconds] = useState(0);\n\n\tconst NotificationHeaderRow = notificationHeaderRow || ListHeaderComponent;\n\tconst NotificationListRow = notificationListRow || NotificationListRowShell;\n\n\t// Sets the current default preference\n\tuseEffect(() => {\n\t\tasync function getNotificationsPreferences() {\n\t\t\treturn await FSBL.Clients.NotificationClient.getPreferences();\n\t\t}\n\n\t\tgetNotificationsPreferences().then((preferences: any) => {\n\t\t\tsetNotificationHaloPeriodSeconds(preferences.newNotificationHaloPeriodSeconds);\n\t\t});\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (searchString === \"\") {\n\t\t\tsetFilteredNotifications(notifications);\n\t\t} else {\n\t\t\tsetFilteredNotifications(searchNotifications(notifications, searchString));\n\t\t}\n\t}, [searchString, notifications]);\n\n\tlet controlFilteredNotifications = activeFilter ? activeFilter.run?.(filteredNotifications) : [];\n\tcontrolFilteredNotifications.sort(\n\t\t(a: INotification, b: INotification) => Date.parse(b.issuedAt) - Date.parse(a.issuedAt)\n\t);\n\n\tcontrolFilteredNotifications = controlFilteredNotifications.filter((notification: INotification) =>\n\t\tactiveFilter.action === \"snoozed\" ? notification.isSnoozed : !notification.isSnoozed\n\t);\n\n\treturn controlFilteredNotifications.length === 0 ? (\n\t\t<NoNotifications />\n\t) : (\n\t\t<>\n\t\t\t<NotificationHeaderRow />\n\t\t\t{controlFilteredNotifications.map((notification: INotification, index: number) => {\n\t\t\t\tconst key = `${index}_${notification.id ? notification.id : notification.issuedAt}`;\n\t\t\t\treturn (\n\t\t\t\t\t<ErrorBoundary key={key}>\n\t\t\t\t\t\t<NotificationListRow\n\t\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\t\tnotification={notification}\n\t\t\t\t\t\t\tnewNotificationHaloPeriodSeconds={newNotificationHaloPeriodSeconds}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t);\n\t\t\t})}\n\t\t</>\n\t);\n};\n\nexport default ListView;\n"]}
1
+ {"version":3,"file":"ListView.js","sourceRoot":"","sources":["../../../../../src/components/notifications/components/views/ListView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAKlF,UAAU;AACV,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,aAAa;AACb,OAAO,eAAe,MAAM,oBAAoB,CAAC;AACjD,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0FAA0F,CAAC;AAC9H,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,QAAQ;AACR,OAAO,EACN,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,GACnB,MAAM,aAAa,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CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjG,4BAA4B,CAAC,IAAI,CAChC,CAAC,CAAgB,EAAE,CAAgB,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CACvF,CAAC;IAEF,4BAA4B,GAAG,4BAA4B,CAAC,MAAM,CAAC,CAAC,YAA2B,EAAE,EAAE,CAClG,YAAY,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CACpF,CAAC;IAEF,OAAO,4BAA4B,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAClD,oBAAC,eAAe,OAAG,CACnB,CAAC,CAAC,CAAC,CACH;QACC,oBAAC,qBAAqB,OAAG;QACxB,4BAA4B,CAAC,GAAG,CAAC,CAAC,YAA2B,EAAE,KAAa,EAAE,EAAE;YAChF,MAAM,GAAG,GAAG,GAAG,KAAK,IAAI,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;YACpF,OAAO,CACN,oBAAC,aAAa,IAAC,GAAG,EAAE,GAAG;gBACtB,oBAAC,mBAAmB,IACnB,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,YAAY,EAC1B,gCAAgC,EAAE,gCAAgC,GACjE,CACa,CAChB,CAAC;QACH,CAAC,CAAC,CACA,CACH,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import React, { useContext, useState, useEffect } from \"react\";\nimport { format, differenceInMilliseconds, parseISO, addSeconds } from \"date-fns\";\n\n// types\nimport { NotificationListViewProps } from \"../../types\";\n\n// Context\nimport { NotificationsContext } from \"../../notificationsContext\";\n\n// Components\nimport NoNotifications from \"../NoNotifications\";\nimport ContextMenuToggle from \"../../../common/ContextMenu\";\nimport { ContextMenuActions } from \"../../../notifications/components/shared/notificationCard/NotificationCardHeaderControls\";\nimport { CheckButton } from \"../shared/CheckButton\";\n\n// Utils\nimport {\n\tgetActiveFilter,\n\tgetMostRecentAction,\n\tisNewNotification,\n\tisReNotification,\n\tsearchNotifications,\n} from \"../../utils\";\n\nimport { NotificationCardHeaderLogo } from \"../shared/notificationCard/NotificationCardHeaderLogo\";\n\n// Constants\nimport { SelectionMode } from \"../../constants\";\nimport { services } from \"@finsemble/finsemble-api\";\nimport { ErrorBoundary } from \"../../../common/ErrorBoundary\";\n\ntype INotification = services.notification.types.INotification;\ntype IPerformedAction = services.notification.types.IPerformedAction;\n\nconst ListHeaderComponent = () => (\n\t<div className=\"list-header__container\">\n\t\t<div className=\"list-header_cell\">Received</div>\n\t\t<div className=\"list-header_cell\">App</div>\n\t\t<div className=\"list-header_cell\">Content</div>\n\t\t<div className=\"list-header_cell\">{\"\"}</div>\n\t</div>\n);\n\nexport type NotificationListRowPropType = {\n\tnotification: INotification;\n\tnewNotificationHaloPeriodSeconds: number;\n};\n\nexport const NotificationListRowShell: React.FunctionComponent<NotificationListRowPropType> = ({\n\tnotification,\n\tnewNotificationHaloPeriodSeconds,\n\tchildren,\n}: any) => {\n\tconst notificationsContext = useContext(NotificationsContext);\n\tconst { setSelectedNotification, muteFilters, selectionMode } = notificationsContext;\n\n\tconst [isNew, setIsNew] = useState(isNewNotification(notification, newNotificationHaloPeriodSeconds));\n\tconst [wokeFromSnooze, setWokeFromSnooze] = useState(\n\t\tisReNotification(notification, newNotificationHaloPeriodSeconds)\n\t);\n\tconst [isMuteFilterApplied, setIsMuteFilterApplied] = useState(\n\t\tmuteFilters\n\t\t\t? muteFilters.some((filter) => filter.source === notification.source && filter.type === notification.type)\n\t\t\t: false\n\t);\n\n\t// effect needed as the newNotificationHaloPeriodSeconds is fecthed asynchronously in the parent component\n\t// and sometimes at the first render, this value is still 0\n\tuseEffect(() => {\n\t\tsetIsNew(isNewNotification(notification, newNotificationHaloPeriodSeconds));\n\t}, [newNotificationHaloPeriodSeconds]);\n\n\tuseEffect(() => {\n\t\tlet isNewTimerId: any;\n\t\tif (isNew) {\n\t\t\tif (notification.isRead) {\n\t\t\t\tsetIsNew(false);\n\t\t\t\tclearTimeout(isNewTimerId);\n\t\t\t} else {\n\t\t\t\tisNewTimerId = setTimeout(() => {\n\t\t\t\t\tsetIsNew(false);\n\t\t\t\t}, differenceInMilliseconds(addSeconds(parseISO(notification.issuedAt), newNotificationHaloPeriodSeconds), Date.now()));\n\t\t\t}\n\t\t}\n\t\treturn () => {\n\t\t\tclearTimeout(isNewTimerId);\n\t\t};\n\t}, [isNew, notification]);\n\n\tuseEffect(() => {\n\t\tlet isRenotificationTimerId: any;\n\t\tif (isReNotification(notification, newNotificationHaloPeriodSeconds)) {\n\t\t\tconst mostRecentAction: IPerformedAction | null = getMostRecentAction(notification);\n\t\t\tif (mostRecentAction) {\n\t\t\t\tconst { datePerformed } = mostRecentAction;\n\t\t\t\tsetWokeFromSnooze(true);\n\t\t\t\tisRenotificationTimerId = setTimeout(() => {\n\t\t\t\t\tsetWokeFromSnooze(false);\n\t\t\t\t}, differenceInMilliseconds(addSeconds(parseISO(datePerformed), newNotificationHaloPeriodSeconds), Date.now()));\n\t\t\t}\n\t\t} else {\n\t\t\tsetWokeFromSnooze(false);\n\t\t\tclearTimeout(isRenotificationTimerId);\n\t\t}\n\t\treturn () => {\n\t\t\tclearTimeout(isRenotificationTimerId);\n\t\t};\n\t}, [newNotificationHaloPeriodSeconds, notification]);\n\n\tconst overFlowActions = Object.assign({}, ContextMenuActions);\n\toverFlowActions.DETAILS.action = (detailNotification: INotification) => {\n\t\tsetSelectedNotification(detailNotification);\n\t};\n\n\tdelete overFlowActions.DISMISS;\n\n\tuseEffect(() => {\n\t\tfunction listenMuteStateChanged(error: any, response: any) {\n\t\t\tif (error) {\n\t\t\t\tconsole.error(\"FinsembleNotificationsMuteStateChannel: \", error);\n\t\t\t\tFSBL.Clients.Logger.system.error(\"FinsembleNotificationsMuteStateChannel: \", error);\n\t\t\t} else {\n\t\t\t\tconst { data } = response;\n\t\t\t\tif (notification.source === data.source && notification.type === data.type) {\n\t\t\t\t\tsetIsMuteFilterApplied(data.isMuted);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tFSBL.Clients.RouterClient.addListener(\"FinsembleNotificationsMuteStateChannel\", listenMuteStateChanged);\n\t\treturn () => {\n\t\t\tFSBL.Clients.RouterClient.removeListener(\"FinsembleNotificationsMuteStateChannel\", listenMuteStateChanged);\n\t\t};\n\t}, []);\n\n\treturn (\n\t\t<div\n\t\t\tclassName={`list-row__container notification-item ${notification.isRead ? \"is-read\" : \"\"} ${\n\t\t\t\tisNew || wokeFromSnooze ? \"new\" : \"\"\n\t\t\t}\n\t\t\t\t${notification.cssClassName ? notification.cssClassName : \"\"}`}\n\t\t>\n\t\t\t{children ? (\n\t\t\t\t<>\n\t\t\t\t\t{selectionMode === SelectionMode.SELECTION ? (\n\t\t\t\t\t\t<div className=\"list-row__cell\">\n\t\t\t\t\t\t\t<CheckButton notification={notification} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<></>\n\t\t\t\t\t)}\n\t\t\t\t\t{children}\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<div className=\"list-row__cell\">{format(Date.parse(notification.issuedAt), \"dd-MM-yyyy HH:mm\")}</div>\n\t\t\t\t\t<div className=\"list-row__cell\">\n\t\t\t\t\t\t{selectionMode === SelectionMode.SELECTION ? (\n\t\t\t\t\t\t\t<div className=\"list-row__cell\">\n\t\t\t\t\t\t\t\t<CheckButton notification={notification} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<NotificationCardHeaderLogo headerLogo={notification.headerLogo} />\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"list-row__cell\">{`${notification.title} - ${notification.details}`}</div>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t<div className=\"list-row__cell\">\n\t\t\t\t<span>\n\t\t\t\t\t<ContextMenuToggle menuActions={overFlowActions} message={notification} isMuteFilterApplied={false} />\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</div>\n\t);\n};\n\nconst ListView: React.FunctionComponent<NotificationListViewProps> = ({\n\tnotificationHeaderRow,\n\tnotificationListRow,\n\tnotifications,\n}) => {\n\tconst notificationsContext = useContext(NotificationsContext);\n\t// The context will be used to filter the notifications\n\tconst { drawerControlProps, searchString, filteredNotifications, setFilteredNotifications } = notificationsContext;\n\n\tconst activeFilter = getActiveFilter(drawerControlProps);\n\n\tconst [newNotificationHaloPeriodSeconds, setNotificationHaloPeriodSeconds] = useState(0);\n\n\tconst NotificationHeaderRow = notificationHeaderRow || ListHeaderComponent;\n\tconst NotificationListRow = notificationListRow || NotificationListRowShell;\n\n\t// Sets the current default preference\n\tuseEffect(() => {\n\t\tasync function getNotificationsPreferences() {\n\t\t\treturn await FSBL.Clients.NotificationClient.getPreferences();\n\t\t}\n\n\t\tgetNotificationsPreferences().then((preferences: any) => {\n\t\t\tsetNotificationHaloPeriodSeconds(preferences.newNotificationHaloPeriodSeconds);\n\t\t});\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (searchString === \"\") {\n\t\t\tsetFilteredNotifications(notifications);\n\t\t} else {\n\t\t\tsetFilteredNotifications(searchNotifications(notifications, searchString));\n\t\t}\n\t}, [searchString, notifications]);\n\n\tlet controlFilteredNotifications = activeFilter ? activeFilter.run?.(filteredNotifications) : [];\n\tcontrolFilteredNotifications.sort(\n\t\t(a: INotification, b: INotification) => Date.parse(b.issuedAt) - Date.parse(a.issuedAt)\n\t);\n\n\tcontrolFilteredNotifications = controlFilteredNotifications.filter((notification: INotification) =>\n\t\tactiveFilter.action === \"snoozed\" ? notification.isSnoozed : !notification.isSnoozed\n\t);\n\n\treturn controlFilteredNotifications.length === 0 ? (\n\t\t<NoNotifications />\n\t) : (\n\t\t<>\n\t\t\t<NotificationHeaderRow />\n\t\t\t{controlFilteredNotifications.map((notification: INotification, index: number) => {\n\t\t\t\tconst key = `${index}_${notification.id ? notification.id : notification.issuedAt}`;\n\t\t\t\treturn (\n\t\t\t\t\t<ErrorBoundary key={key}>\n\t\t\t\t\t\t<NotificationListRow\n\t\t\t\t\t\t\tkey={key}\n\t\t\t\t\t\t\tnotification={notification}\n\t\t\t\t\t\t\tnewNotificationHaloPeriodSeconds={newNotificationHaloPeriodSeconds}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ErrorBoundary>\n\t\t\t\t);\n\t\t\t})}\n\t\t</>\n\t);\n};\n\nexport default ListView;\n"]}
@@ -0,0 +1,165 @@
1
+ /* Notification card and views */
2
+ .notification-card {
3
+ background-color: var(--core-primary);
4
+ box-shadow: 0 0 8px 0 rgb(0 0 0 / 50%);
5
+ display: flex;
6
+ flex-direction: column;
7
+ font-family: var(--notification-font-family);
8
+ min-height: 120px;
9
+ padding: 8px 10px;
10
+ margin: 0 5px;
11
+ }
12
+
13
+ .notification-card.new {
14
+ box-shadow: 0 0 9px 0 var(--notification-highlight-border-color);
15
+ }
16
+
17
+ .notification-card.read {
18
+ background-color: var(--core-primary-opacity);
19
+ color: var(--font-shadow-light);
20
+ }
21
+
22
+ .notification-day {
23
+ color: var(--font-shadow-light);
24
+ font-size: var(--font-size);
25
+ font-weight: bold;
26
+ margin: 10px auto;
27
+ padding: 0 0 0 5px;
28
+ }
29
+
30
+ .notification-card__header {
31
+ display: grid;
32
+ grid-template-columns: 25px auto minmax(80px, auto);
33
+ grid-template-rows: 30px;
34
+ align-items: center;
35
+ }
36
+
37
+ .notification-card__title {
38
+ display: block;
39
+ font-size: var(--font-size-large);
40
+ overflow: hidden;
41
+ text-overflow: ellipsis;
42
+ white-space: nowrap;
43
+ margin-right: auto;
44
+ width: 100%;
45
+ }
46
+
47
+ .notification-card__more-options__no-toggle,
48
+ .notification-card__more-options__toggle {
49
+ cursor: pointer;
50
+ white-space: nowrap;
51
+ display: grid;
52
+ grid-template-rows: 30px;
53
+ align-items: center;
54
+ grid-template-columns: minmax(80px, auto);
55
+ justify-items: end;
56
+ margin-left: 2px;
57
+ }
58
+
59
+ .js-toasts .notification-card__more-options__no-toggle,
60
+ .js-toasts .notification-card__more-options__toggle {
61
+ grid-template-columns: 25px 20px;
62
+ }
63
+
64
+ .notification-card__more-options__toggle .notification-card_context_menu,
65
+ .notification-card__more-options__toggle:hover .notification-card_timestamp {
66
+ display: none;
67
+ }
68
+
69
+ .notification-card__more-options__no-toggle .notification-card_context_menu,
70
+ .notification-card__more-options__toggle:hover .notification-card_context_menu {
71
+ display: flex;
72
+ }
73
+
74
+ .notification-card__dismiss.finsemble-icon__btn i {
75
+ font-size: var(--titleBar-icon-font-size);
76
+ }
77
+
78
+ .notification-card__more-options__no-toggle .notification-card__dismiss:hover {
79
+ color: var(--titleBar-button-hover-negative-color);
80
+ }
81
+
82
+ .notification-card__body {
83
+ gap: 10px;
84
+ display: flex;
85
+ flex-direction: row;
86
+ font-size: var(--font-size-large);
87
+ margin-top: 8px;
88
+ }
89
+
90
+ .notification-card__body_text {
91
+ display: -webkit-box; /* stylelint-disable-line */
92
+ -webkit-box-orient: vertical;
93
+ -webkit-line-clamp: 4;
94
+ color: var(--core-primary-5);
95
+ overflow: hidden;
96
+ }
97
+
98
+ .notification-card__body_img_container {
99
+ width: 50px;
100
+ height: 50px;
101
+ padding-bottom: 5px;
102
+ }
103
+
104
+ .notification-card__body_img_container img {
105
+ width: inherit;
106
+ height: inherit;
107
+ }
108
+
109
+ .notification-card.read .notification-card__body_text {
110
+ color: var(--font-color-1-shadow);
111
+ }
112
+
113
+ .actions-panel {
114
+ max-width: 120px;
115
+ align-items: flex-end;
116
+ display: flex;
117
+ flex-direction: column;
118
+ margin-left: auto;
119
+ }
120
+
121
+ .actions-panel__btn:hover {
122
+ opacity: 0.75;
123
+ }
124
+
125
+ .notification-card .overflow-menu__container,
126
+ .notification-card.read .overflow-menu__container {
127
+ color: var(--font-color);
128
+ }
129
+
130
+ .notification-card__header img {
131
+ object-fit: contain;
132
+ margin-right: 8px;
133
+ max-width: 18px;
134
+ max-height: 18px;
135
+ width: auto;
136
+ height: auto;
137
+ }
138
+
139
+ .js-toasts .notification-card__header {
140
+ grid-template-columns: 25px auto 45px;
141
+ }
142
+
143
+ .finsemble-icon__btn {
144
+ align-items: center;
145
+ color: var(--core-primary-5);
146
+ cursor: pointer;
147
+ display: flex;
148
+ height: 24px;
149
+ justify-content: center;
150
+ position: relative;
151
+ width: 24px;
152
+ }
153
+
154
+ .finsemble-icon__btn.active {
155
+ color: var(--accent-primary);
156
+ }
157
+
158
+ .finsemble-icon__btn:hover:not(.no-hover) {
159
+ background: var(--menu-actions-hover-color);
160
+ border-radius: 50%;
161
+ }
162
+
163
+ .finsemble-icon__btn i {
164
+ font-size: var(--font-size-large);
165
+ }
@@ -0,0 +1,14 @@
1
+ import React from "react";
2
+ import { Story } from "@storybook/react/types-6-0";
3
+ import { NotificationCardPropType } from "../components/shared/NotificationCardShell";
4
+ declare const _default: {
5
+ title: string;
6
+ component: React.FunctionComponent<NotificationCardPropType>;
7
+ };
8
+ export default _default;
9
+ export declare const AllFields: Story<NotificationCardPropType>;
10
+ export declare const AllFieldsToasts: Story<NotificationCardPropType>;
11
+ export declare const NoLogos: Story<NotificationCardPropType>;
12
+ export declare const NoActionsNoLogos: Story<NotificationCardPropType>;
13
+ export declare const VeryLongActionName: Story<NotificationCardPropType>;
14
+ export declare const ALotOfDetailsText: Story<NotificationCardPropType>;
@@ -0,0 +1,108 @@
1
+ import React from "react";
2
+ import { initFSBL } from "../../common/helpers";
3
+ import { NotificationCardShell } from "../components/shared/NotificationCardShell";
4
+ export default {
5
+ title: "Notifications/NotificationCard",
6
+ component: NotificationCardShell,
7
+ };
8
+ const Template = (args) => {
9
+ initFSBL(window);
10
+ return (React.createElement("div", { style: { maxWidth: "408px", background: "#171a20", padding: "20px" } },
11
+ React.createElement(NotificationCardShell, Object.assign({}, args))));
12
+ };
13
+ const notification = {
14
+ headerLogo: "https://assets.finsemble.com/sales-demo-assets/appD/IQ-icon.png",
15
+ type: "type",
16
+ timeout: 5000,
17
+ source: "source-name",
18
+ headerText: "I am header text",
19
+ cssClassName: "css-class-name",
20
+ contentLogo: "https://assets.finsemble.com/sales-demo-assets/appD/IQ-icon.png",
21
+ isRead: false,
22
+ issuedAt: new Date().toISOString(),
23
+ title: "Title",
24
+ details: "A reasonable amount of text. One or two lines.",
25
+ isMuted: false,
26
+ isSnoozed: false,
27
+ isDeleted: false,
28
+ stateHistory: [],
29
+ actions: [
30
+ [
31
+ {
32
+ type: "SNOOZE",
33
+ buttonText: "Default Snooze",
34
+ },
35
+ {
36
+ type: "SNOOZE",
37
+ buttonText: "Snooze With Longer Text",
38
+ },
39
+ {
40
+ type: "SNOOZE",
41
+ buttonText: "Small Snooze",
42
+ },
43
+ ],
44
+ {
45
+ type: "SNOOZE",
46
+ buttonText: "Longer text",
47
+ },
48
+ {
49
+ type: "SNOOZE",
50
+ buttonText: "Much longer text",
51
+ },
52
+ ],
53
+ };
54
+ export const AllFields = Template.bind({});
55
+ AllFields.args = {
56
+ notification: notification,
57
+ uiContext: "center",
58
+ };
59
+ export const AllFieldsToasts = Template.bind({});
60
+ AllFieldsToasts.args = {
61
+ notification: notification,
62
+ uiContext: "toasts",
63
+ };
64
+ const noLogoNotification = Object.assign({}, notification);
65
+ delete noLogoNotification.headerLogo;
66
+ delete noLogoNotification.contentLogo;
67
+ noLogoNotification.contentLogo;
68
+ export const NoLogos = Template.bind({});
69
+ NoLogos.args = {
70
+ notification: noLogoNotification,
71
+ };
72
+ const noActionsNoLogosNotification = Object.assign({}, notification);
73
+ delete noActionsNoLogosNotification.headerLogo;
74
+ delete noActionsNoLogosNotification.contentLogo;
75
+ delete noActionsNoLogosNotification.actions;
76
+ export const NoActionsNoLogos = Template.bind({});
77
+ NoActionsNoLogos.args = {
78
+ notification: noActionsNoLogosNotification,
79
+ };
80
+ const veryLongActionNameNotification = Object.assign({}, notification);
81
+ veryLongActionNameNotification.actions = [
82
+ {
83
+ buttonText: "This is a very long action name. How long can we go?",
84
+ type: "DISMISS",
85
+ },
86
+ [
87
+ {
88
+ buttonText: "This is a very long action name. How long can we go?",
89
+ type: "DISMISS",
90
+ },
91
+ {
92
+ buttonText: "This is a very long action name. How long can we go?",
93
+ type: "DISMISS",
94
+ },
95
+ ],
96
+ ];
97
+ export const VeryLongActionName = Template.bind({});
98
+ VeryLongActionName.args = {
99
+ notification: veryLongActionNameNotification,
100
+ };
101
+ const aLotOfDetailsTextNotification = Object.assign({}, notification);
102
+ aLotOfDetailsTextNotification.details =
103
+ "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took . galley of type and scrambled it to make . type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.";
104
+ export const ALotOfDetailsText = Template.bind({});
105
+ ALotOfDetailsText.args = {
106
+ notification: aLotOfDetailsTextNotification,
107
+ };
108
+ //# sourceMappingURL=NotificationCardShell.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationCardShell.stories.js","sourceRoot":"","sources":["../../../../src/components/notifications/stories/NotificationCardShell.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAA4B,MAAM,4CAA4C,CAAC;AAI7G,eAAe;IACd,KAAK,EAAE,gCAAgC;IACvC,SAAS,EAAE,qBAAqB;CAChC,CAAC;AAEF,MAAM,QAAQ,GAAoC,CAAC,IAA8B,EAAE,EAAE;IACpF,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjB,OAAO,CACN,6BAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,E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Y,CAAC,CAAC;AACtE,6BAA6B,CAAC,OAAO;IACpC,gXAAgX,CAAC;AAElX,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnD,iBAAiB,CAAC,IAAI,GAAG;IACxB,YAAY,EAAE,6BAA6B;CAC3C,CAAC","sourcesContent":["import React from \"react\";\nimport { initFSBL } from \"../../common/helpers\";\nimport { Story } from \"@storybook/react/types-6-0\";\nimport { NotificationCardShell, NotificationCardPropType } from \"../components/shared/NotificationCardShell\";\nimport { services } from \"@finsemble/finsemble-api\";\ntype INotification = services.notification.types.INotification;\n\nexport default {\n\ttitle: \"Notifications/NotificationCard\",\n\tcomponent: NotificationCardShell,\n};\n\nconst Template: Story<NotificationCardPropType> = (args: NotificationCardPropType) => {\n\tinitFSBL(window);\n\treturn (\n\t\t<div style={{ maxWidth: \"408px\", background: \"#171a20\", padding: \"20px\" }}>\n\t\t\t<NotificationCardShell {...args} />\n\t\t</div>\n\t);\n};\n\nconst notification: INotification = {\n\theaderLogo: \"https://assets.finsemble.com/sales-demo-assets/appD/IQ-icon.png\",\n\ttype: \"type\",\n\ttimeout: 5000,\n\tsource: \"source-name\",\n\theaderText: \"I am header text\",\n\tcssClassName: \"css-class-name\",\n\tcontentLogo: \"https://assets.finsemble.com/sales-demo-assets/appD/IQ-icon.png\",\n\tisRead: false,\n\tissuedAt: new Date().toISOString(),\n\ttitle: \"Title\",\n\tdetails: \"A reasonable amount of text. One or two lines.\",\n\tisMuted: false,\n\tisSnoozed: false,\n\tisDeleted: false,\n\tstateHistory: [],\n\tactions: [\n\t\t[\n\t\t\t{\n\t\t\t\ttype: \"SNOOZE\",\n\t\t\t\tbuttonText: \"Default Snooze\",\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: \"SNOOZE\",\n\t\t\t\tbuttonText: \"Snooze With Longer Text\",\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: \"SNOOZE\",\n\t\t\t\tbuttonText: \"Small Snooze\",\n\t\t\t},\n\t\t],\n\t\t{\n\t\t\ttype: \"SNOOZE\",\n\t\t\tbuttonText: \"Longer text\",\n\t\t},\n\t\t{\n\t\t\ttype: \"SNOOZE\",\n\t\t\tbuttonText: \"Much longer text\",\n\t\t},\n\t],\n};\n\nexport const AllFields = Template.bind({});\nAllFields.args = {\n\tnotification: notification,\n\tuiContext: \"center\",\n};\nexport const AllFieldsToasts = Template.bind({});\nAllFieldsToasts.args = {\n\tnotification: notification,\n\tuiContext: \"toasts\",\n};\n\nconst noLogoNotification = Object.assign({}, notification);\n\ndelete noLogoNotification.headerLogo;\ndelete noLogoNotification.contentLogo;\nnoLogoNotification.contentLogo;\n\nexport const NoLogos = Template.bind({});\nNoLogos.args = {\n\tnotification: noLogoNotification,\n};\n\nconst noActionsNoLogosNotification = Object.assign({}, notification);\ndelete noActionsNoLogosNotification.headerLogo;\ndelete noActionsNoLogosNotification.contentLogo;\ndelete noActionsNoLogosNotification.actions;\n\nexport const NoActionsNoLogos = Template.bind({});\nNoActionsNoLogos.args = {\n\tnotification: noActionsNoLogosNotification,\n};\n\nconst veryLongActionNameNotification = Object.assign({}, notification);\nveryLongActionNameNotification.actions = [\n\t{\n\t\tbuttonText: \"This is a very long action name. How long can we go?\",\n\t\ttype: \"DISMISS\",\n\t},\n\t[\n\t\t{\n\t\t\tbuttonText: \"This is a very long action name. How long can we go?\",\n\t\t\ttype: \"DISMISS\",\n\t\t},\n\t\t{\n\t\t\tbuttonText: \"This is a very long action name. How long can we go?\",\n\t\t\ttype: \"DISMISS\",\n\t\t},\n\t],\n];\n\nexport const VeryLongActionName = Template.bind({});\nVeryLongActionName.args = {\n\tnotification: veryLongActionNameNotification,\n};\n\nconst aLotOfDetailsTextNotification = Object.assign({}, notification);\naLotOfDetailsTextNotification.details =\n\t\"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took . galley of type and scrambled it to make . type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.\";\n\nexport const ALotOfDetailsText = Template.bind({});\nALotOfDetailsText.args = {\n\tnotification: aLotOfDetailsTextNotification,\n};\n"]}
@@ -0,0 +1,91 @@
1
+ import * as React from "react";
2
+ import { mount } from "enzyme";
3
+ import { afterEach, describe, it } from "mocha";
4
+ import { expect } from "chai";
5
+ import { NoActionsNoLogos, NoLogos, AllFields, AllFieldsToasts } from "../stories/NotificationCardShell.stories";
6
+ import { accessibilityAssessor } from "../../sdd/tests/a11y_helper";
7
+ import { waitTime } from "../../sdd/sdd_helpers";
8
+ import sinon from "sinon";
9
+ describe("<NotificationCardShell />", () => {
10
+ afterEach(() => {
11
+ sinon.restore();
12
+ });
13
+ it("should pass accessibility scans when in the notification center", async () => {
14
+ const wrapper = mount(React.createElement(AllFields, Object.assign({}, AllFields.args)));
15
+ expect(await accessibilityAssessor(wrapper)).to.be.true;
16
+ }).timeout(10e3);
17
+ it("should pass accessibility scans when in the notification toasts", async () => {
18
+ const wrapper = mount(React.createElement(AllFields, Object.assign({}, AllFields.args, { uiContext: "toasts" })));
19
+ expect(await accessibilityAssessor(wrapper)).to.be.true;
20
+ }).timeout(10e3);
21
+ const testHalo = (args, expected) => async () => {
22
+ const { notification } = args;
23
+ // Refresh the issued at date as this tests behaviour based on the passage of time
24
+ notification.issuedAt = new Date().toISOString();
25
+ const wrapper = mount(React.createElement(AllFields, Object.assign({}, args, { notification: notification })));
26
+ await waitTime(0);
27
+ wrapper.update();
28
+ expect(wrapper.find(".notification-card.new").exists()).to.equal(expected);
29
+ expect(wrapper.find(".notification-card.read").exists(), "card should not be marked as read").to.equal(false);
30
+ };
31
+ it("should show a halo when the notification is new", testHalo(Object.assign(Object.assign({}, AllFields.args), { uiContext: "center" }), true)).timeout(10e3);
32
+ it("should not show a halo when a toast", testHalo(Object.assign(Object.assign({}, AllFields.args), { uiContext: "toasts" }), false)).timeout(10e3);
33
+ // Skipped because it fails when running the whole suite. Passes when run on its own.
34
+ // Also couldn't get sinon.useFakeTimers() to work
35
+ it("should hide the new halo after 3 seconds of time (3s comes from preferences)", async () => {
36
+ const { notification } = AllFields.args;
37
+ notification.issuedAt = new Date().toISOString();
38
+ const wrapper = mount(React.createElement(AllFields, Object.assign({}, AllFields.args, { notification: notification })));
39
+ await waitTime(0);
40
+ wrapper.update();
41
+ expect(wrapper.find(".notification-card.new").exists(), "Card is new").to.be.true;
42
+ await waitTime(2000);
43
+ wrapper.update();
44
+ expect(wrapper.find(".notification-card.new").exists(), "Card is still new").to.be.true;
45
+ await waitTime(1500);
46
+ wrapper.update();
47
+ expect(wrapper.find(".notification-card.new").exists(), "Card is no longer new").to.be.false;
48
+ }).timeout(10e3);
49
+ it("should be read", () => {
50
+ const { notification } = AllFields.args;
51
+ notification.isRead = true;
52
+ const wrapper = mount(React.createElement(AllFields, Object.assign({}, AllFields.args, { notification: notification })));
53
+ expect(wrapper.find(".notification-card.read").exists(), "card should be marked as read").to.equal(true);
54
+ });
55
+ it("should have a close button when a toast", () => {
56
+ const wrapper = mount(React.createElement(AllFieldsToasts, Object.assign({}, AllFieldsToasts.args, { uiContext: "toasts" })));
57
+ expect(wrapper.find(".notification-card__dismiss").exists(), "Toasts should have a dismiss button (x top right corner)").to.equal(true);
58
+ });
59
+ it("SHOULD have icons", () => {
60
+ const wrapper = mount(React.createElement(AllFields, Object.assign({}, AllFields.args)));
61
+ const imageExists = wrapper.find(".notification-card__header img").exists();
62
+ const defaultImageExists = wrapper.find(".notification-card__header .default-img").exists();
63
+ expect(imageExists && !defaultImageExists, "Title icon exists and default icon does not").to.equal(true);
64
+ expect(wrapper.find(".notification-card__body_img_container img").exists(), "Content icon exists").to.equal(true);
65
+ });
66
+ it("SHOULD NOT have icons", () => {
67
+ const wrapper = mount(React.createElement(NoLogos, Object.assign({}, NoLogos.args)));
68
+ const defaultImageExists = wrapper.find(".notification-card__header .default-img").exists();
69
+ expect(defaultImageExists, "Default title icon exists").to.equal(true);
70
+ expect(wrapper.find(".notification-card__body_img_container img").exists(), "Content icon exists").to.equal(true);
71
+ });
72
+ it("should have cssClass value as css class", () => {
73
+ const wrapper = mount(React.createElement(AllFields, Object.assign({}, AllFields.args)));
74
+ expect(wrapper.find(".notification-card.css-class-name").exists()).to.be.true;
75
+ });
76
+ it("SHOULD have actions", () => {
77
+ const wrapper = mount(React.createElement(AllFields, Object.assign({}, AllFields.args)));
78
+ expect(wrapper.find(".finsemble-dropdown-action__btn-container").exists(), "One grouped action should exist").to.be
79
+ .true;
80
+ const actions = wrapper.find(".actions-panel .finsemble__btn");
81
+ expect(actions.length, "Two single actions should exist").to.equal(2);
82
+ const spy = sinon.spy(FSBL.Clients.NotificationClient, "performAction");
83
+ actions.at(0).simulate("click");
84
+ expect(spy.calledOnce, "action is performed").to.be.true;
85
+ });
86
+ it("SHOULD NOT have actions", () => {
87
+ const wrapper = mount(React.createElement(NoActionsNoLogos, Object.assign({}, NoActionsNoLogos.args)));
88
+ expect(wrapper.find(".actions-panel").exists()).to.be.false;
89
+ });
90
+ });
91
+ //# sourceMappingURL=NotificationCardShell.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationCardShell.spec.js","sourceRoot":"","sources":["../../../../src/components/notifications/tests/NotificationCardShell.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAEjH,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAA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C,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC/E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;QAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,oBAAC,SAAS,oBAAM,SAAS,CAAC,IAAiC,EAAI,CAAC,CAAC;QACvF,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC,MAAM,EAAE,EAAE,iCAAiC,CAAC,CAAC,EAAE,CAAC,EAAE;aACjH,IAAI,CAAC;QACP,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAC/D,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,iCAAiC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtE,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;QACxE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChC,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QAClC,MAAM,OAAO,GAAG,KAAK,CAAC,oBAAC,gBAAgB,oBAAM,gBAAgB,CAAC,IAAiC,EAAI,CAAC,CAAC;QACrG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;IAC7D,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import * as React from \"react\";\nimport { mount } from \"enzyme\";\nimport { afterEach, describe, it } from \"mocha\";\nimport { expect } from \"chai\";\nimport { NoActionsNoLogos, NoLogos, AllFields, AllFieldsToasts } from \"../stories/NotificationCardShell.stories\";\nimport { NotificationCardPropType } from \"../components/shared/NotificationCardShell\";\nimport { accessibilityAssessor } from \"../../sdd/tests/a11y_helper\";\nimport { waitTime } from \"../../sdd/sdd_helpers\";\nimport sinon from \"sinon\";\n\ndescribe(\"<NotificationCardShell />\", () => {\n\tafterEach(() => {\n\t\tsinon.restore();\n\t});\n\n\tit(\"should pass accessibility scans when in the notification center\", async () => {\n\t\tconst wrapper = mount(<AllFields {...(AllFields.args as NotificationCardPropType)} />);\n\t\texpect(await accessibilityAssessor(wrapper)).to.be.true;\n\t}).timeout(10e3);\n\n\tit(\"should pass accessibility scans when in the notification toasts\", async () => {\n\t\tconst wrapper = mount(<AllFields {...(AllFields.args as NotificationCardPropType)} uiContext=\"toasts\" />);\n\t\texpect(await accessibilityAssessor(wrapper)).to.be.true;\n\t}).timeout(10e3);\n\n\tconst testHalo = (args: NotificationCardPropType, expected: any) => async () => {\n\t\tconst { notification } = args;\n\t\t// Refresh the issued at date as this tests behaviour based on the passage of time\n\t\tnotification.issuedAt = new Date().toISOString();\n\t\tconst wrapper = mount(<AllFields {...(args as NotificationCardPropType)} notification={notification} />);\n\t\tawait waitTime(0);\n\t\twrapper.update();\n\t\texpect(wrapper.find(\".notification-card.new\").exists()).to.equal(expected);\n\t\texpect(wrapper.find(\".notification-card.read\").exists(), \"card should not be marked as read\").to.equal(false);\n\t};\n\n\tit(\n\t\t\"should show a halo when the notification is new\",\n\t\ttestHalo({ ...AllFields.args, uiContext: \"center\" } as NotificationCardPropType, true)\n\t).timeout(10e3);\n\n\tit(\n\t\t\"should not show a halo when a toast\",\n\t\ttestHalo({ ...AllFields.args, uiContext: \"toasts\" } as NotificationCardPropType, false)\n\t).timeout(10e3);\n\n\t// Skipped because it fails when running the whole suite. Passes when run on its own.\n\t// Also couldn't get sinon.useFakeTimers() to work\n\tit(\"should hide the new halo after 3 seconds of time (3s comes from preferences)\", async () => {\n\t\tconst { notification } = AllFields.args as NotificationCardPropType;\n\t\tnotification.issuedAt = new Date().toISOString();\n\t\tconst wrapper = mount(<AllFields {...(AllFields.args as NotificationCardPropType)} notification={notification} />);\n\t\tawait waitTime(0);\n\t\twrapper.update();\n\t\texpect(wrapper.find(\".notification-card.new\").exists(), \"Card is new\").to.be.true;\n\t\tawait waitTime(2000);\n\t\twrapper.update();\n\t\texpect(wrapper.find(\".notification-card.new\").exists(), \"Card is still new\").to.be.true;\n\t\tawait waitTime(1500);\n\t\twrapper.update();\n\t\texpect(wrapper.find(\".notification-card.new\").exists(), \"Card is no longer new\").to.be.false;\n\t}).timeout(10e3);\n\n\tit(\"should be read\", () => {\n\t\tconst { notification } = AllFields.args as NotificationCardPropType;\n\t\tnotification.isRead = true;\n\t\tconst wrapper = mount(<AllFields {...(AllFields.args as NotificationCardPropType)} notification={notification} />);\n\t\texpect(wrapper.find(\".notification-card.read\").exists(), \"card should be marked as read\").to.equal(true);\n\t});\n\n\tit(\"should have a close button when a toast\", () => {\n\t\tconst wrapper = mount(\n\t\t\t<AllFieldsToasts {...(AllFieldsToasts.args as NotificationCardPropType)} uiContext=\"toasts\" />\n\t\t);\n\t\texpect(\n\t\t\twrapper.find(\".notification-card__dismiss\").exists(),\n\t\t\t\"Toasts should have a dismiss button (x top right corner)\"\n\t\t).to.equal(true);\n\t});\n\n\tit(\"SHOULD have icons\", () => {\n\t\tconst wrapper = mount(<AllFields {...(AllFields.args as NotificationCardPropType)} />);\n\t\tconst imageExists = wrapper.find(\".notification-card__header img\").exists();\n\t\tconst defaultImageExists = wrapper.find(\".notification-card__header .default-img\").exists();\n\t\texpect(imageExists && !defaultImageExists, \"Title icon exists and default icon does not\").to.equal(true);\n\n\t\texpect(wrapper.find(\".notification-card__body_img_container img\").exists(), \"Content icon exists\").to.equal(true);\n\t});\n\n\tit(\"SHOULD NOT have icons\", () => {\n\t\tconst wrapper = mount(<NoLogos {...(NoLogos.args as NotificationCardPropType)} />);\n\t\tconst defaultImageExists = wrapper.find(\".notification-card__header .default-img\").exists();\n\t\texpect(defaultImageExists, \"Default title icon exists\").to.equal(true);\n\t\texpect(wrapper.find(\".notification-card__body_img_container img\").exists(), \"Content icon exists\").to.equal(true);\n\t});\n\n\tit(\"should have cssClass value as css class\", () => {\n\t\tconst wrapper = mount(<AllFields {...(AllFields.args as NotificationCardPropType)} />);\n\t\texpect(wrapper.find(\".notification-card.css-class-name\").exists()).to.be.true;\n\t});\n\n\tit(\"SHOULD have actions\", () => {\n\t\tconst wrapper = mount(<AllFields {...(AllFields.args as NotificationCardPropType)} />);\n\t\texpect(wrapper.find(\".finsemble-dropdown-action__btn-container\").exists(), \"One grouped action should exist\").to.be\n\t\t\t.true;\n\t\tconst actions = wrapper.find(\".actions-panel .finsemble__btn\");\n\t\texpect(actions.length, \"Two single actions should exist\").to.equal(2);\n\t\tconst spy = sinon.spy(FSBL.Clients.NotificationClient, \"performAction\");\n\t\tactions.at(0).simulate(\"click\");\n\t\texpect(spy.calledOnce, \"action is performed\").to.be.true;\n\t});\n\n\tit(\"SHOULD NOT have actions\", () => {\n\t\tconst wrapper = mount(<NoActionsNoLogos {...(NoActionsNoLogos.args as NotificationCardPropType)} />);\n\t\texpect(wrapper.find(\".actions-panel\").exists()).to.be.false;\n\t});\n});\n"]}
@@ -82,10 +82,12 @@ export interface NotificationsConfig {
82
82
  export interface WindowConfig {
83
83
  window: SpawnParams & NotificationsConfig;
84
84
  }
85
- export declare type OverFlowMenuAction = {
85
+ export declare type ContextMenuAction = {
86
+ id?: string;
86
87
  name: string;
87
88
  icon: React.ReactElement;
88
- action: (notification: INotification) => void;
89
+ action?: (name: any) => void;
89
90
  label: string;
91
+ display: boolean;
90
92
  };
91
93
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/notifications/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Notification types\n */\nimport React from \"react\";\nimport { ViewMode, SelectionMode } from \"./constants\";\nimport { services } from \"@finsemble/finsemble-api\";\n\ntype INotification = services.notification.types.INotification;\ntype INotificationHistoryOptions = services.notification.types.INotificationHistoryOptions;\ntype IMuteFilter = services.notification.types.IMuteFilter;\ntype IFilter = services.notification.types.IFilter;\ntype SpawnParams = services.window.types.SpawnParams;\n\nexport interface Control {\n\taction: string;\n\tlabel: string;\n\trun?: Function;\n}\n\nexport interface NotificationCenterControlsProps {\n\tcontrols: Array<Control>;\n\tactive?: Control[\"action\"];\n}\n\nexport interface INotificationCenterProps {\n\tcontrols?: NotificationCenterControlsProps;\n\tnotificationCard?: React.ComponentType<any>;\n\tnotificationHeaderRow?: React.ComponentType<any>;\n\tnotificationListRow?: React.ComponentType<any>;\n}\n\nexport interface INotificationToastsProps {\n\tnotificationCard?: React.ComponentType<any>;\n}\n\nexport interface INotificationDetailProps {\n\tnotification: INotification;\n}\n\nexport type NotificationListViewProps = {\n\tnotifications: INotification[];\n\tnotificationListRow?: React.ComponentType<INotificationDetailProps>;\n\tnotificationHeaderRow?: React.ComponentType<any>;\n};\n\nexport type NotificationCardViewProps = {\n\tnotifications: INotification[];\n\tnotificationCard?: React.ComponentType<any>; // A custom component used to render a notification\n};\n\nexport type NotificationsContextType = {\n\tviewMode: ViewMode;\n\tsetViewMode: React.Dispatch<React.SetStateAction<ViewMode>>;\n\tselectionMode: SelectionMode;\n\tsetSelectionMode: React.Dispatch<React.SetStateAction<SelectionMode>>;\n\tisSelectAll: boolean;\n\tsetSelectAll: React.Dispatch<React.SetStateAction<boolean>>;\n\tdrawerControlProps: NotificationCenterControlsProps;\n\tsetDrawerControlProps: React.Dispatch<React.SetStateAction<NotificationCenterControlsProps>>;\n\tselectedNotification: INotification | null;\n\tsetSelectedNotification: React.Dispatch<React.SetStateAction<INotification | null>>;\n\tsearchString: string;\n\tsetSearchString: React.Dispatch<React.SetStateAction<string>>;\n\tfilteredNotifications: INotification[];\n\tcheckedNotifications: INotification[];\n\tsetCheckedNotifications: React.Dispatch<React.SetStateAction<INotification[]>>;\n\tsetFilteredNotifications: React.Dispatch<React.SetStateAction<INotification[]>>;\n\tmuteFilters: IMuteFilter[];\n\tsetMuteFilters: React.Dispatch<React.SetStateAction<IMuteFilter[]>>;\n};\n\nexport interface NotificationsConfig {\n\tfilter?: {\n\t\tinclude?: [];\n\t\texclude?: [];\n\t};\n\tposition?: {};\n\tanimation?: {\n\t\tdisplayDuration: number;\n\t\tanimateIn: string;\n\t\tanimateOut: string;\n\t};\n\tisTransparent?: boolean;\n\tnotificationsHistory?: { since?: string; filter?: IFilter; options?: INotificationHistoryOptions } | boolean;\n\tapplyMuteFilters?: boolean;\n\twindowName: string;\n}\n\nexport interface WindowConfig {\n\twindow: SpawnParams & NotificationsConfig;\n}\n\nexport type OverFlowMenuAction = {\n\tname: string;\n\ticon: React.ReactElement;\n\taction: (notification: INotification) => void;\n\tlabel: string;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/notifications/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Notification types\n */\nimport React from \"react\";\nimport { ViewMode, SelectionMode } from \"./constants\";\nimport { services } from \"@finsemble/finsemble-api\";\n\ntype INotification = services.notification.types.INotification;\ntype INotificationHistoryOptions = services.notification.types.INotificationHistoryOptions;\ntype IMuteFilter = services.notification.types.IMuteFilter;\ntype IFilter = services.notification.types.IFilter;\ntype SpawnParams = services.window.types.SpawnParams;\n\nexport interface Control {\n\taction: string;\n\tlabel: string;\n\trun?: Function;\n}\n\nexport interface NotificationCenterControlsProps {\n\tcontrols: Array<Control>;\n\tactive?: Control[\"action\"];\n}\n\nexport interface INotificationCenterProps {\n\tcontrols?: NotificationCenterControlsProps;\n\tnotificationCard?: React.ComponentType<any>;\n\tnotificationHeaderRow?: React.ComponentType<any>;\n\tnotificationListRow?: React.ComponentType<any>;\n}\n\nexport interface INotificationToastsProps {\n\tnotificationCard?: React.ComponentType<any>;\n}\n\nexport interface INotificationDetailProps {\n\tnotification: INotification;\n}\n\nexport type NotificationListViewProps = {\n\tnotifications: INotification[];\n\tnotificationListRow?: React.ComponentType<INotificationDetailProps>;\n\tnotificationHeaderRow?: React.ComponentType<any>;\n};\n\nexport type NotificationCardViewProps = {\n\tnotifications: INotification[];\n\tnotificationCard?: React.ComponentType<any>; // A custom component used to render a notification\n};\n\nexport type NotificationsContextType = {\n\tviewMode: ViewMode;\n\tsetViewMode: React.Dispatch<React.SetStateAction<ViewMode>>;\n\tselectionMode: SelectionMode;\n\tsetSelectionMode: React.Dispatch<React.SetStateAction<SelectionMode>>;\n\tisSelectAll: boolean;\n\tsetSelectAll: React.Dispatch<React.SetStateAction<boolean>>;\n\tdrawerControlProps: NotificationCenterControlsProps;\n\tsetDrawerControlProps: React.Dispatch<React.SetStateAction<NotificationCenterControlsProps>>;\n\tselectedNotification: INotification | null;\n\tsetSelectedNotification: React.Dispatch<React.SetStateAction<INotification | null>>;\n\tsearchString: string;\n\tsetSearchString: React.Dispatch<React.SetStateAction<string>>;\n\tfilteredNotifications: INotification[];\n\tcheckedNotifications: INotification[];\n\tsetCheckedNotifications: React.Dispatch<React.SetStateAction<INotification[]>>;\n\tsetFilteredNotifications: React.Dispatch<React.SetStateAction<INotification[]>>;\n\tmuteFilters: IMuteFilter[];\n\tsetMuteFilters: React.Dispatch<React.SetStateAction<IMuteFilter[]>>;\n};\n\nexport interface NotificationsConfig {\n\tfilter?: {\n\t\tinclude?: [];\n\t\texclude?: [];\n\t};\n\tposition?: {};\n\tanimation?: {\n\t\tdisplayDuration: number;\n\t\tanimateIn: string;\n\t\tanimateOut: string;\n\t};\n\tisTransparent?: boolean;\n\tnotificationsHistory?: { since?: string; filter?: IFilter; options?: INotificationHistoryOptions } | boolean;\n\tapplyMuteFilters?: boolean;\n\twindowName: string;\n}\n\nexport interface WindowConfig {\n\twindow: SpawnParams & NotificationsConfig;\n}\n\nexport type ContextMenuAction = {\n\tid?: string;\n\tname: string;\n\ticon: React.ReactElement;\n\taction?: (name: any) => void;\n\tlabel: string;\n\tdisplay: boolean;\n};\n"]}
@@ -6,11 +6,11 @@
6
6
  import "./css/addApp.css";
7
7
  export declare type AddAppProps = {
8
8
  checkValidURL: (url: string) => boolean;
9
- addAppByUrl: (url: string, name: string) => void;
10
- addAppByPath: (path: string, name: string, apiAccess: boolean) => void;
9
+ addAppByUrl: (url: string, name: string, appId?: string) => void;
10
+ addAppByPath: (path: string, name: string, apiAccess: boolean, appId?: string) => void;
11
11
  close: () => void;
12
12
  show: boolean;
13
- addAppCitrix?: (alias: string, name: string) => void;
13
+ addAppCitrix?: (alias: string, name: string, appId?: string) => void;
14
14
  includeCitrix?: boolean;
15
15
  idKey?: string;
16
16
  };