@finsemble/finsemble-ui 7.2.1 → 7.3.0-beta.1

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 (124) 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/notifications/components/drawer/DrawerHeader.js +3 -3
  37. package/react/components/notifications/components/drawer/DrawerHeader.js.map +1 -1
  38. package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js +1 -0
  39. package/react/components/notifications/components/notificationsCenter/NotificationsCenter.js.map +1 -1
  40. package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js +2 -0
  41. package/react/components/notifications/components/notificationsToasts/NotificationsToasts.js.map +1 -1
  42. package/react/components/notifications/components/shared/IconButton.js +2 -1
  43. package/react/components/notifications/components/shared/IconButton.js.map +1 -1
  44. package/react/components/notifications/components/shared/NotificationCardShell.d.ts +2 -0
  45. package/react/components/notifications/components/shared/NotificationCardShell.js +55 -49
  46. package/react/components/notifications/components/shared/NotificationCardShell.js.map +1 -1
  47. package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js +2 -3
  48. package/react/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.js.map +1 -1
  49. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.d.ts +4 -0
  50. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.js +92 -13
  51. package/react/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.js.map +1 -1
  52. package/react/components/notifications/components/views/ListView.js +5 -9
  53. package/react/components/notifications/components/views/ListView.js.map +1 -1
  54. package/react/components/notifications/css/notification-card.css +165 -0
  55. package/react/components/notifications/stories/NotificationCardShell.stories.d.ts +14 -0
  56. package/react/components/notifications/stories/NotificationCardShell.stories.js +108 -0
  57. package/react/components/notifications/stories/NotificationCardShell.stories.js.map +1 -0
  58. package/react/components/notifications/tests/NotificationCardShell.spec.d.ts +1 -0
  59. package/react/components/notifications/tests/NotificationCardShell.spec.js +91 -0
  60. package/react/components/notifications/tests/NotificationCardShell.spec.js.map +1 -0
  61. package/react/components/notifications/types.d.ts +4 -2
  62. package/react/components/notifications/types.js.map +1 -1
  63. package/react/components/sdd/AddApp.d.ts +3 -3
  64. package/react/components/sdd/AddApp.js +29 -21
  65. package/react/components/sdd/AddApp.js.map +1 -1
  66. package/react/components/sdd/AppEditPage.js +1 -8
  67. package/react/components/sdd/AppEditPage.js.map +1 -1
  68. package/react/components/sdd/Appearance.css +2 -1
  69. package/react/components/sdd/Applications.js +7 -7
  70. package/react/components/sdd/Applications.js.map +1 -1
  71. package/react/components/sdd/Navigation.js +2 -4
  72. package/react/components/sdd/Navigation.js.map +1 -1
  73. package/react/components/sdd/common/views.js +1 -14
  74. package/react/components/sdd/common/views.js.map +1 -1
  75. package/react/components/sdd/css/addApp.css +64 -1
  76. package/react/components/sdd/css/nav.css +50 -29
  77. package/react/components/sdd/fixtures/views.js +1 -14
  78. package/react/components/sdd/fixtures/views.js.map +1 -1
  79. package/react/components/sdd/tests/AddApp.spec.js +2 -2
  80. package/react/components/sdd/tests/AddApp.spec.js.map +1 -1
  81. package/react/components/sdd/tests/AppEditPage.spec.js +5 -8
  82. package/react/components/sdd/tests/AppEditPage.spec.js.map +1 -1
  83. package/react/components/sdd/tests/Export.spec.js +11 -11
  84. package/react/components/sdd/tests/Export.spec.js.map +1 -1
  85. package/react/components/sdd/tests/ExportZip.spec.js +3 -3
  86. package/react/components/sdd/tests/ExportZip.spec.js.map +1 -1
  87. package/react/components/sdd/tests/Navigation.spec.js +3 -2
  88. package/react/components/sdd/tests/Navigation.spec.js.map +1 -1
  89. package/react/components/sdd/tests/SmartDesktopDesigner.spec.js +1 -2
  90. package/react/components/sdd/tests/SmartDesktopDesigner.spec.js.map +1 -1
  91. package/react/components/toolbar/dashbar/Dashbar.js +18 -14
  92. package/react/components/toolbar/dashbar/Dashbar.js.map +1 -1
  93. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.d.ts +9 -1
  94. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js +35 -1
  95. package/react/components/toolbar/workspaceManagementMenu/components/Workspace.js.map +1 -1
  96. package/react/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.js +1 -1
  97. package/react/components/toolbar/workspaceManagementMenu/stores/workspaceManagementMenuStore.js.map +1 -1
  98. package/react/components/userPreferences/components/content/Workspaces.d.ts +3 -1
  99. package/react/components/userPreferences/components/content/Workspaces.js +20 -3
  100. package/react/components/userPreferences/components/content/Workspaces.js.map +1 -1
  101. package/react/components/userPreferences/components/workspaces/WorkspaceItem.d.ts +1 -0
  102. package/react/components/userPreferences/components/workspaces/WorkspaceItem.js +3 -2
  103. package/react/components/userPreferences/components/workspaces/WorkspaceItem.js.map +1 -1
  104. package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js +12 -9
  105. package/react/components/userPreferences/tests/NotificationsPreferencesHome.spec.js.map +1 -1
  106. package/react/components/userPreferences/tests/UserPreferencesBase.spec.js +2 -0
  107. package/react/components/userPreferences/tests/UserPreferencesBase.spec.js.map +1 -1
  108. package/react/components/windowTitleBar/WindowTitleBarShell.d.ts +99 -26
  109. package/react/components/windowTitleBar/WindowTitleBarShell.js +204 -131
  110. package/react/components/windowTitleBar/WindowTitleBarShell.js.map +1 -1
  111. package/react/components/windowTitleBar/components/left/LinkerButton.js +30 -21
  112. package/react/components/windowTitleBar/components/left/LinkerButton.js.map +1 -1
  113. package/react/hooks/useNotifications.js +8 -7
  114. package/react/hooks/useNotifications.js.map +1 -1
  115. package/react/tsconfig.tsbuildinfo +1 -1
  116. package/react/components/notifications/components/shared/OverflowMenu.d.ts +0 -16
  117. package/react/components/notifications/components/shared/OverflowMenu.js +0 -114
  118. package/react/components/notifications/components/shared/OverflowMenu.js.map +0 -1
  119. package/react/components/sdd/GettingStarted.d.ts +0 -8
  120. package/react/components/sdd/GettingStarted.js +0 -25
  121. package/react/components/sdd/GettingStarted.js.map +0 -1
  122. package/react/components/sdd/stories/GettingStarted.stories.d.ts +0 -11
  123. package/react/components/sdd/stories/GettingStarted.stories.js +0 -18
  124. package/react/components/sdd/stories/GettingStarted.stories.js.map +0 -1
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { services } from "@finsemble/finsemble-api";
3
+ import "../../css/notification-card.css";
3
4
  declare type INotification = services.notification.types.INotification;
4
5
  export declare type NotificationCardPropType = {
5
6
  /**
@@ -14,6 +15,7 @@ export declare type NotificationCardPropType = {
14
15
  * The internal function that will be called on toasts when dismissed or marked as read
15
16
  */
16
17
  removeNotification: Function;
18
+ preferences?: any;
17
19
  };
18
20
  export declare const NotificationCardShell: React.FunctionComponent<NotificationCardPropType>;
19
21
  export {};
@@ -4,45 +4,70 @@ import { isNewNotification, isReNotification, getMostRecentAction } from "../../
4
4
  import { NotificationCardHeaderShell } from "./notificationCard/NotificationCardHeaderShell";
5
5
  import { NotificationCardBodyShell } from "./notificationCard/NotificationCardBodyShell";
6
6
  import { ErrorBoundary } from "../../../common/ErrorBoundary";
7
- export const NotificationCardShell = ({ notification, uiContext, removeNotification, children, }) => {
7
+ import "../../css/notification-card.css";
8
+ export const NotificationCardShell = ({ notification, uiContext = "center", removeNotification, children, }) => {
8
9
  const { isRead } = notification;
9
10
  const [newNotificationHaloPeriodSeconds, setNotificationHaloPeriodSeconds] = useState(0);
10
11
  const [isNew, setIsNew] = useState(isNewNotification(notification, newNotificationHaloPeriodSeconds));
11
12
  const [componentUnmounted, setComponentUnmounted] = useState(false);
12
13
  const [wokeFromSnooze, setWokeFromSnooze] = useState(isReNotification(notification, newNotificationHaloPeriodSeconds));
13
- // Sets the current default preference
14
- useEffect(() => {
15
- const getNotificationsPreferences = async () => {
16
- const preferences = await FSBL.Clients.NotificationClient.getPreferences();
17
- setNotificationHaloPeriodSeconds(preferences.newNotificationHaloPeriodSeconds);
14
+ if (uiContext == "center") {
15
+ // Sets the current default preference
16
+ useEffect(() => {
17
+ const getNotificationsPreferences = async () => {
18
+ var _a;
19
+ const preferences = await FSBL.Clients.NotificationClient.getPreferences();
20
+ const haloPeriod = (_a = preferences === null || preferences === void 0 ? void 0 : preferences.newNotificationHaloPeriodSeconds) !== null && _a !== void 0 ? _a : 0;
21
+ setNotificationHaloPeriodSeconds(haloPeriod);
22
+ if (!componentUnmounted) {
23
+ setIsNew(isNewNotification(notification, haloPeriod));
24
+ }
25
+ };
18
26
  if (!componentUnmounted) {
19
- setIsNew(isNewNotification(notification, preferences.newNotificationHaloPeriodSeconds));
27
+ getNotificationsPreferences();
20
28
  }
21
- };
22
- getNotificationsPreferences();
23
- return () => {
24
- setComponentUnmounted(true);
25
- };
26
- }, []);
27
- // Listens for preferences change
28
- useEffect(() => {
29
- async function listenForPreferenceChange(error, response) {
30
- if (error) {
31
- console.error("FinsembleUserPreferencesChannel: ", error);
29
+ return () => {
30
+ setComponentUnmounted(true);
31
+ };
32
+ }, []);
33
+ // Listens for preferences change
34
+ useEffect(() => {
35
+ function listenForPreferenceChange(error, response) {
36
+ var _a, _b;
37
+ if (error) {
38
+ console.error("FinsembleUserPreferencesChannel: ", error);
39
+ FSBL.Clients.Logger.system.error("FinsembleUserPreferencesChannel: ", error);
40
+ }
41
+ else {
42
+ const { data } = response;
43
+ setNotificationHaloPeriodSeconds((_b = (_a = data === null || data === void 0 ? void 0 : data.notificationPreferences) === null || _a === void 0 ? void 0 : _a.newNotificationHaloPeriodSeconds) !== null && _b !== void 0 ? _b : 0);
44
+ }
32
45
  }
33
- else {
34
- const { data } = response;
35
- if (data.notificationPreferences &&
36
- data.notificationPreferences.hasOwnProperty("newNotificationHaloPeriodSeconds")) {
37
- setNotificationHaloPeriodSeconds(data.notificationPreferences.newNotificationHaloPeriodSeconds);
46
+ FSBL.Clients.RouterClient.addListener("FinsembleUserPreferencesChannel", listenForPreferenceChange);
47
+ return () => {
48
+ FSBL.Clients.RouterClient.removeListener("FinsembleUserPreferencesChannel", listenForPreferenceChange);
49
+ };
50
+ }, []);
51
+ useEffect(() => {
52
+ let isRenotificationTimerId;
53
+ if (isReNotification(notification, newNotificationHaloPeriodSeconds)) {
54
+ const mostRecentAction = getMostRecentAction(notification);
55
+ if (mostRecentAction) {
56
+ setWokeFromSnooze(true);
57
+ isRenotificationTimerId = setTimeout(() => {
58
+ setWokeFromSnooze(false);
59
+ }, differenceInMilliseconds(addSeconds(parseISO(mostRecentAction.datePerformed), newNotificationHaloPeriodSeconds), Date.now()));
38
60
  }
39
61
  }
40
- }
41
- FSBL.Clients.RouterClient.addListener("FinsembleUserPreferencesChannel", listenForPreferenceChange);
42
- return () => {
43
- FSBL.Clients.RouterClient.removeListener("FinsembleUserPreferencesChannel", listenForPreferenceChange);
44
- };
45
- }, []);
62
+ else {
63
+ setWokeFromSnooze(false);
64
+ clearTimeout(isRenotificationTimerId);
65
+ }
66
+ return () => {
67
+ clearTimeout(isRenotificationTimerId);
68
+ };
69
+ }, [newNotificationHaloPeriodSeconds, notification]);
70
+ }
46
71
  useEffect(() => {
47
72
  let isNewTimerId;
48
73
  if (isNew) {
@@ -60,27 +85,8 @@ export const NotificationCardShell = ({ notification, uiContext, removeNotificat
60
85
  clearTimeout(isNewTimerId);
61
86
  };
62
87
  }, [isNew, notification]);
63
- useEffect(() => {
64
- let isRenotificationTimerId;
65
- if (isReNotification(notification, newNotificationHaloPeriodSeconds)) {
66
- const mostRecentAction = getMostRecentAction(notification);
67
- if (mostRecentAction) {
68
- setWokeFromSnooze(true);
69
- isRenotificationTimerId = setTimeout(() => {
70
- setWokeFromSnooze(false);
71
- }, differenceInMilliseconds(addSeconds(parseISO(mostRecentAction.datePerformed), newNotificationHaloPeriodSeconds), Date.now()));
72
- }
73
- }
74
- else {
75
- setWokeFromSnooze(false);
76
- clearTimeout(isRenotificationTimerId);
77
- }
78
- return () => {
79
- clearTimeout(isRenotificationTimerId);
80
- };
81
- }, [newNotificationHaloPeriodSeconds, notification]);
82
88
  return (React.createElement("div", { className: `notification-card ${isRead ? "read" : ""} ${isNew || wokeFromSnooze ? "new" : ""}
83
- ${notification.cssClassName ? notification.cssClassName : ""}` }, children ? (React.createElement(ErrorBoundary, null, children)) : (React.createElement(React.Fragment, null,
89
+ ${notification.cssClassName ? notification.cssClassName : ""} js-${uiContext}` }, children ? (React.createElement(ErrorBoundary, null, children)) : (React.createElement(React.Fragment, null,
84
90
  React.createElement(NotificationCardHeaderShell, { notification: notification, removeNotification: removeNotification, uiContext: uiContext }),
85
91
  React.createElement(NotificationCardBodyShell, { notification: notification })))));
86
92
  };
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationCardShell.js","sourceRoot":"","sources":["../../../../../src/components/notifications/components/shared/NotificationCardShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAEzF,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAsB9D,MAAM,CAAC,MAAM,qBAAqB,GAAsD,CAAC,EACxF,YAAY,EACZ,SAAS,EACT,kBAAkB,EAClB,QAAQ,GACR,EAAE,EAAE;IACJ,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC;IAEhC,MAAM,CAAC,gCAAgC,EAAE,gCAAgC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEzF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAC,YAAY,EAAE,gCAAgC,CAAC,CAAC,CAAC;IACtG,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAC7E,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CACnD,gBAAgB,CAAC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CAAC;QACvC,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,gCAAgC,EAAE,YAAY,CAAC,CAAC,CAAC;IACrD,OAAO,CACN,6BACC,SAAS,EAAE,qBAAqB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;KAC1F,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,IAE7D,QAAQ,CAAC,CAAC,CAAC,CACX,oBAAC,aAAa,QAAE,QAAQ,CAAiB,CACzC,CAAC,CAAC,CAAC,CACH;QACC,oBAAC,2BAA2B,IAC3B,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,kBAAkB,EACtC,SAAS,EAAE,SAAS,GACnB;QACF,oBAAC,yBAAyB,IAAC,YAAY,EAAE,YAAY,GAAI,CACvD,CACH,CACI,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React, { useState, useEffect } from \"react\";\nimport { parseISO, differenceInMilliseconds, addSeconds } from \"date-fns\";\nimport { isNewNotification, isReNotification, getMostRecentAction } from \"../../utils\";\nimport { NotificationCardHeaderShell } from \"./notificationCard/NotificationCardHeaderShell\";\nimport { NotificationCardBodyShell } from \"./notificationCard/NotificationCardBodyShell\";\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\nexport type NotificationCardPropType = {\n\t/**\n\t * The Notification to be displayed\n\t */\n\tnotification: INotification;\n\n\t/**\n\t * Which UI context the Card is being used in\n\t */\n\tuiContext: \"toasts\" | \"center\";\n\n\t/**\n\t * The internal function that will be called on toasts when dismissed or marked as read\n\t */\n\tremoveNotification: Function;\n};\n\nexport const NotificationCardShell: React.FunctionComponent<NotificationCardPropType> = ({\n\tnotification,\n\tuiContext,\n\tremoveNotification,\n\tchildren,\n}) => {\n\tconst { isRead } = notification;\n\n\tconst [newNotificationHaloPeriodSeconds, setNotificationHaloPeriodSeconds] = useState(0);\n\n\tconst [isNew, setIsNew] = useState(isNewNotification(notification, newNotificationHaloPeriodSeconds));\n\tconst [componentUnmounted, setComponentUnmounted] = useState<boolean>(false);\n\tconst [wokeFromSnooze, setWokeFromSnooze] = useState(\n\t\tisReNotification(notification, newNotificationHaloPeriodSeconds)\n\t);\n\n\t// Sets the current default preference\n\tuseEffect(() => {\n\t\tconst getNotificationsPreferences = async () => {\n\t\t\tconst preferences: any = await FSBL.Clients.NotificationClient.getPreferences();\n\t\t\tsetNotificationHaloPeriodSeconds(preferences.newNotificationHaloPeriodSeconds);\n\t\t\tif (!componentUnmounted) {\n\t\t\t\tsetIsNew(isNewNotification(notification, preferences.newNotificationHaloPeriodSeconds));\n\t\t\t}\n\t\t};\n\n\t\tgetNotificationsPreferences();\n\t\treturn () => {\n\t\t\tsetComponentUnmounted(true);\n\t\t};\n\t}, []);\n\n\t// Listens for preferences change\n\tuseEffect(() => {\n\t\tasync function listenForPreferenceChange(error: any, response: any) {\n\t\t\tif (error) {\n\t\t\t\tconsole.error(\"FinsembleUserPreferencesChannel: \", error);\n\t\t\t} else {\n\t\t\t\tconst { data } = response;\n\t\t\t\tif (\n\t\t\t\t\tdata.notificationPreferences &&\n\t\t\t\t\tdata.notificationPreferences.hasOwnProperty(\"newNotificationHaloPeriodSeconds\")\n\t\t\t\t) {\n\t\t\t\t\tsetNotificationHaloPeriodSeconds(data.notificationPreferences.newNotificationHaloPeriodSeconds);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tFSBL.Clients.RouterClient.addListener(\"FinsembleUserPreferencesChannel\", listenForPreferenceChange);\n\t\treturn () => {\n\t\t\tFSBL.Clients.RouterClient.removeListener(\"FinsembleUserPreferencesChannel\", listenForPreferenceChange);\n\t\t};\n\t}, []);\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\tsetWokeFromSnooze(true);\n\t\t\t\tisRenotificationTimerId = setTimeout(() => {\n\t\t\t\t\tsetWokeFromSnooze(false);\n\t\t\t\t}, differenceInMilliseconds(addSeconds(parseISO(mostRecentAction.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\treturn (\n\t\t<div\n\t\t\tclassName={`notification-card ${isRead ? \"read\" : \"\"} ${isNew || wokeFromSnooze ? \"new\" : \"\"} \n\t\t\t${notification.cssClassName ? notification.cssClassName : \"\"}`}\n\t\t>\n\t\t\t{children ? (\n\t\t\t\t<ErrorBoundary>{children}</ErrorBoundary>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NotificationCardHeaderShell\n\t\t\t\t\t\tnotification={notification}\n\t\t\t\t\t\tremoveNotification={removeNotification}\n\t\t\t\t\t\tuiContext={uiContext}\n\t\t\t\t\t/>\n\t\t\t\t\t<NotificationCardBodyShell notification={notification} />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"]}
1
+ {"version":3,"file":"NotificationCardShell.js","sourceRoot":"","sources":["../../../../../src/components/notifications/components/shared/NotificationCardShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAEzF,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,iCAAiC,CAAC;AAuBzC,MAAM,CAAC,MAAM,qBAAqB,GAAsD,CAAC,EACxF,YAAY,EACZ,SAAS,GAAG,QAAQ,EACpB,kBAAkB,EAClB,QAAQ,GACR,EAAE,EAAE;IACJ,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC;IAEhC,MAAM,CAAC,gCAAgC,EAAE,gCAAgC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEzF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAC,YAAY,EAAE,gCAAgC,CAAC,CAAC,CAAC;IACtG,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IAC7E,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CACnD,gBAAgB,CAAC,YAAY,EAAE,gCAAgC,CAAC,CAChE,CAAC;IAEF,IAAI,SAAS,IAAI,QAAQ,EAAE;QAC1B,sCAAs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gCAAgC,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;aACxH;SACD;QACD,OAAO,GAAG,EAAE;YACX,YAAY,CAAC,YAAY,CAAC,CAAC;QAC5B,CAAC,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC;IAE1B,OAAO,CACN,6BACC,SAAS,EAAE,qBAAqB,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;KAC1F,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,OAAO,SAAS,EAAE,IAE7E,QAAQ,CAAC,CAAC,CAAC,CACX,oBAAC,aAAa,QAAE,QAAQ,CAAiB,CACzC,CAAC,CAAC,CAAC,CACH;QACC,oBAAC,2BAA2B,IAC3B,YAAY,EAAE,YAAY,EAC1B,kBAAkB,EAAE,kBAAkB,EACtC,SAAS,EAAE,SAAS,GACnB;QACF,oBAAC,yBAAyB,IAAC,YAAY,EAAE,YAAY,GAAI,CACvD,CACH,CACI,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React, { useState, useEffect } from \"react\";\nimport { parseISO, differenceInMilliseconds, addSeconds } from \"date-fns\";\nimport { isNewNotification, isReNotification, getMostRecentAction } from \"../../utils\";\nimport { NotificationCardHeaderShell } from \"./notificationCard/NotificationCardHeaderShell\";\nimport { NotificationCardBodyShell } from \"./notificationCard/NotificationCardBodyShell\";\nimport { services } from \"@finsemble/finsemble-api\";\nimport { ErrorBoundary } from \"../../../common/ErrorBoundary\";\nimport \"../../css/notification-card.css\";\n\ntype INotification = services.notification.types.INotification;\ntype IPerformedAction = services.notification.types.IPerformedAction;\n\nexport type NotificationCardPropType = {\n\t/**\n\t * The Notification to be displayed\n\t */\n\tnotification: INotification;\n\n\t/**\n\t * Which UI context the Card is being used in\n\t */\n\tuiContext: \"toasts\" | \"center\";\n\n\t/**\n\t * The internal function that will be called on toasts when dismissed or marked as read\n\t */\n\tremoveNotification: Function;\n\tpreferences?: any;\n};\n\nexport const NotificationCardShell: React.FunctionComponent<NotificationCardPropType> = ({\n\tnotification,\n\tuiContext = \"center\",\n\tremoveNotification,\n\tchildren,\n}) => {\n\tconst { isRead } = notification;\n\n\tconst [newNotificationHaloPeriodSeconds, setNotificationHaloPeriodSeconds] = useState(0);\n\n\tconst [isNew, setIsNew] = useState(isNewNotification(notification, newNotificationHaloPeriodSeconds));\n\tconst [componentUnmounted, setComponentUnmounted] = useState<boolean>(false);\n\tconst [wokeFromSnooze, setWokeFromSnooze] = useState(\n\t\tisReNotification(notification, newNotificationHaloPeriodSeconds)\n\t);\n\n\tif (uiContext == \"center\") {\n\t\t// Sets the current default preference\n\t\tuseEffect(() => {\n\t\t\tconst getNotificationsPreferences = async () => {\n\t\t\t\tconst preferences: any = await FSBL.Clients.NotificationClient.getPreferences();\n\t\t\t\tconst haloPeriod = preferences?.newNotificationHaloPeriodSeconds ?? 0;\n\t\t\t\tsetNotificationHaloPeriodSeconds(haloPeriod);\n\t\t\t\tif (!componentUnmounted) {\n\t\t\t\t\tsetIsNew(isNewNotification(notification, haloPeriod));\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tif (!componentUnmounted) {\n\t\t\t\tgetNotificationsPreferences();\n\t\t\t}\n\t\t\treturn () => {\n\t\t\t\tsetComponentUnmounted(true);\n\t\t\t};\n\t\t}, []);\n\n\t\t// Listens for preferences change\n\t\tuseEffect(() => {\n\t\t\tfunction listenForPreferenceChange(error: any, response: any) {\n\t\t\t\tif (error) {\n\t\t\t\t\tconsole.error(\"FinsembleUserPreferencesChannel: \", error);\n\t\t\t\t\tFSBL.Clients.Logger.system.error(\"FinsembleUserPreferencesChannel: \", error);\n\t\t\t\t} else {\n\t\t\t\t\tconst { data } = response;\n\t\t\t\t\tsetNotificationHaloPeriodSeconds(data?.notificationPreferences?.newNotificationHaloPeriodSeconds ?? 0);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tFSBL.Clients.RouterClient.addListener(\"FinsembleUserPreferencesChannel\", listenForPreferenceChange);\n\t\t\treturn () => {\n\t\t\t\tFSBL.Clients.RouterClient.removeListener(\"FinsembleUserPreferencesChannel\", listenForPreferenceChange);\n\t\t\t};\n\t\t}, []);\n\n\t\tuseEffect(() => {\n\t\t\tlet isRenotificationTimerId: any;\n\t\t\tif (isReNotification(notification, newNotificationHaloPeriodSeconds)) {\n\t\t\t\tconst mostRecentAction: IPerformedAction | null = getMostRecentAction(notification);\n\t\t\t\tif (mostRecentAction) {\n\t\t\t\t\tsetWokeFromSnooze(true);\n\t\t\t\t\tisRenotificationTimerId = setTimeout(() => {\n\t\t\t\t\t\tsetWokeFromSnooze(false);\n\t\t\t\t\t}, differenceInMilliseconds(addSeconds(parseISO(mostRecentAction.datePerformed), newNotificationHaloPeriodSeconds), Date.now()));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsetWokeFromSnooze(false);\n\t\t\t\tclearTimeout(isRenotificationTimerId);\n\t\t\t}\n\t\t\treturn () => {\n\t\t\t\tclearTimeout(isRenotificationTimerId);\n\t\t\t};\n\t\t}, [newNotificationHaloPeriodSeconds, notification]);\n\t}\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\treturn (\n\t\t<div\n\t\t\tclassName={`notification-card ${isRead ? \"read\" : \"\"} ${isNew || wokeFromSnooze ? \"new\" : \"\"} \n\t\t\t${notification.cssClassName ? notification.cssClassName : \"\"} js-${uiContext}`}\n\t\t>\n\t\t\t{children ? (\n\t\t\t\t<ErrorBoundary>{children}</ErrorBoundary>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NotificationCardHeaderShell\n\t\t\t\t\t\tnotification={notification}\n\t\t\t\t\t\tremoveNotification={removeNotification}\n\t\t\t\t\t\tuiContext={uiContext}\n\t\t\t\t\t/>\n\t\t\t\t\t<NotificationCardBodyShell notification={notification} />\n\t\t\t\t</>\n\t\t\t)}\n\t\t</div>\n\t);\n};\n"]}
@@ -3,9 +3,8 @@ import { NotificationCardBodyActions } from "./NotificationCardBodyActions";
3
3
  import { NotificationCardBodyContentLogo } from "./NotificationCardBodyContentLogo";
4
4
  import { ErrorBoundary } from "../../../../common/ErrorBoundary";
5
5
  export const NotificationCardBodyShell = ({ notification, children, }) => {
6
- const { actions, details, contentLogo } = notification;
7
- const hasActions = actions && actions.length > 0;
8
- return (React.createElement("div", { className: `notification-card__body ${hasActions ? "actions" : ""}` },
6
+ const { details, contentLogo } = notification;
7
+ return (React.createElement("div", { className: "notification-card__body" },
9
8
  children ? (React.createElement(ErrorBoundary, null, children)) : (React.createElement(React.Fragment, null,
10
9
  React.createElement(NotificationCardBodyContentLogo, { contentLogo: contentLogo }),
11
10
  React.createElement("div", { className: "notification-card__body_text" }, details))),
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationCardBodyShell.js","sourceRoot":"","sources":["../../../../../../src/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAIjE,MAAM,CAAC,MAAM,yBAAyB,GAA6D,CAAC,EACnG,YAAY,EACZ,QAAQ,GACR,EAAE,EAAE;IACJ,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC;IACvD,MAAM,UAAU,GAAG,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;IAEjD,OAAO,CACN,6BAAK,SAAS,EAAE,2BAA2B,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;QACtE,QAAQ,CAAC,CAAC,CAAC,CACX,oBAAC,aAAa,QAAE,QAAQ,CAAiB,CACzC,CAAC,CAAC,CAAC,CACH;YACC,oBAAC,+BAA+B,IAAC,WAAW,EAAE,WAAW,GAAI;YAC7D,6BAAK,SAAS,EAAC,8BAA8B,IAAE,OAAO,CAAO,CAC3D,CACH;QACD,oBAAC,2BAA2B,IAAC,YAAY,EAAE,YAAY,GAAI,CACtD,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { NotificationCardBodyActions } from \"./NotificationCardBodyActions\";\nimport { NotificationCardBodyContentLogo } from \"./NotificationCardBodyContentLogo\";\nimport { services } from \"@finsemble/finsemble-api\";\nimport { ErrorBoundary } from \"../../../../common/ErrorBoundary\";\n\ntype INotification = services.notification.types.INotification;\n\nexport const NotificationCardBodyShell: React.FunctionComponent<{ notification: INotification }> = ({\n\tnotification,\n\tchildren,\n}) => {\n\tconst { actions, details, contentLogo } = notification;\n\tconst hasActions = actions && actions.length > 0;\n\n\treturn (\n\t\t<div className={`notification-card__body ${hasActions ? \"actions\" : \"\"}`}>\n\t\t\t{children ? (\n\t\t\t\t<ErrorBoundary>{children}</ErrorBoundary>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NotificationCardBodyContentLogo contentLogo={contentLogo} />\n\t\t\t\t\t<div className=\"notification-card__body_text\">{details}</div>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t<NotificationCardBodyActions notification={notification} />\n\t\t</div>\n\t);\n};\n"]}
1
+ {"version":3,"file":"NotificationCardBodyShell.js","sourceRoot":"","sources":["../../../../../../src/components/notifications/components/shared/notificationCard/NotificationCardBodyShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAIjE,MAAM,CAAC,MAAM,yBAAyB,GAA6D,CAAC,EACnG,YAAY,EACZ,QAAQ,GACR,EAAE,EAAE;IACJ,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC;IAE9C,OAAO,CACN,6BAAK,SAAS,EAAC,yBAAyB;QACtC,QAAQ,CAAC,CAAC,CAAC,CACX,oBAAC,aAAa,QAAE,QAAQ,CAAiB,CACzC,CAAC,CAAC,CAAC,CACH;YACC,oBAAC,+BAA+B,IAAC,WAAW,EAAE,WAAW,GAAI;YAC7D,6BAAK,SAAS,EAAC,8BAA8B,IAAE,OAAO,CAAO,CAC3D,CACH;QACD,oBAAC,2BAA2B,IAAC,YAAY,EAAE,YAAY,GAAI,CACtD,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React from \"react\";\nimport { NotificationCardBodyActions } from \"./NotificationCardBodyActions\";\nimport { NotificationCardBodyContentLogo } from \"./NotificationCardBodyContentLogo\";\nimport { services } from \"@finsemble/finsemble-api\";\nimport { ErrorBoundary } from \"../../../../common/ErrorBoundary\";\n\ntype INotification = services.notification.types.INotification;\n\nexport const NotificationCardBodyShell: React.FunctionComponent<{ notification: INotification }> = ({\n\tnotification,\n\tchildren,\n}) => {\n\tconst { details, contentLogo } = notification;\n\n\treturn (\n\t\t<div className=\"notification-card__body\">\n\t\t\t{children ? (\n\t\t\t\t<ErrorBoundary>{children}</ErrorBoundary>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<NotificationCardBodyContentLogo contentLogo={contentLogo} />\n\t\t\t\t\t<div className=\"notification-card__body_text\">{details}</div>\n\t\t\t\t</>\n\t\t\t)}\n\t\t\t<NotificationCardBodyActions notification={notification} />\n\t\t</div>\n\t);\n};\n"]}
@@ -1,6 +1,10 @@
1
1
  import React from "react";
2
2
  import { services } from "@finsemble/finsemble-api";
3
+ import { ContextMenuAction } from "../../../types";
3
4
  declare type INotification = services.notification.types.INotification;
5
+ export declare const ContextMenuActions: {
6
+ [key: string]: ContextMenuAction;
7
+ };
4
8
  export declare const NotificationCardHeaderControls: React.FunctionComponent<{
5
9
  notification: INotification;
6
10
  uiContext?: string;
@@ -1,12 +1,84 @@
1
1
  import React, { useContext, useEffect, useState } from "react";
2
- import IconButton from "../IconButton";
3
- import OverflowMenu, { OverflowMenuActions, renderOverflowMenuAction } from "../OverflowMenu";
2
+ import ContextMenuToggle from "../../../../common/ContextMenu";
4
3
  import { NotificationsContext } from "../../../notificationsContext";
5
4
  import { formatDistanceToNow } from "date-fns";
5
+ import { markNotificationsRead, markNotificationsUnread, snoozeNotifications, } from "../../../../../hooks/useNotifications";
6
+ // Icons
7
+ import EnvelopeCloseIcon from "../../../../notifications/icons/EnvelopeClose";
8
+ import EnvelopeOpenIcon from "../../../../notifications/icons/EnvelopeOpen";
9
+ import SnoozeIcon from "../../../../notifications/icons/SnoozeIcon";
10
+ import IconButton from "../IconButton";
11
+ export const ContextMenuActions = {
12
+ MARK_AS_UNREAD: {
13
+ name: "MARK_AS_UNREAD",
14
+ icon: React.createElement(EnvelopeCloseIcon, null),
15
+ label: "Mark Unread",
16
+ action: (notification) => markNotificationsUnread([notification]),
17
+ display: true,
18
+ },
19
+ MARK_AS_READ: {
20
+ name: "MARK_AS_READ",
21
+ icon: React.createElement(EnvelopeOpenIcon, null),
22
+ label: "Mark Read",
23
+ action: (notification) => markNotificationsRead([notification]),
24
+ display: true,
25
+ },
26
+ SNOOZE: {
27
+ name: "SNOOZE",
28
+ icon: React.createElement(SnoozeIcon, null),
29
+ label: "Snooze",
30
+ action: (notification) => snoozeNotifications([notification]),
31
+ display: true,
32
+ },
33
+ DISMISS: {
34
+ name: "DISMISS",
35
+ icon: (React.createElement("div", { className: "finsemble-icon" },
36
+ React.createElement("i", { className: "ff-close" }))),
37
+ label: "Dismiss",
38
+ action: () => {
39
+ // Empty - filled in later
40
+ },
41
+ display: true,
42
+ },
43
+ SETTINGS: {
44
+ name: "SETTINGS",
45
+ icon: (React.createElement("div", { className: "finsemble-icon" },
46
+ React.createElement("i", { className: "ff-settings" }))),
47
+ label: "Settings",
48
+ action: (notification) => {
49
+ FSBL.Clients.LauncherClient.showWindow({
50
+ componentType: "UserPreferences",
51
+ }, {
52
+ monitor: "mine",
53
+ left: "center",
54
+ top: "center",
55
+ }, () => {
56
+ FSBL.Clients.RouterClient.transmit("FinsembleUserPreferencesChannel", {
57
+ preferencesTab: "Notifications",
58
+ notification,
59
+ });
60
+ // we need this timeout otherwise the UserPreferences screen does not detect the message being transmited
61
+ setTimeout(() => {
62
+ FSBL.Clients.RouterClient.transmit("FinsembleNotificationsNavigationChannel", { notification });
63
+ }, 50);
64
+ });
65
+ },
66
+ display: true,
67
+ },
68
+ DETAILS: {
69
+ name: "DETAILS",
70
+ icon: (React.createElement("div", { className: "finsemble-icon" },
71
+ React.createElement("i", { className: "ff-dots-horz" }))),
72
+ label: "Details",
73
+ action: () => {
74
+ // Empty - filled in later
75
+ },
76
+ display: true,
77
+ },
78
+ };
6
79
  export const NotificationCardHeaderControls = ({ notification, removeNotification, uiContext = "center" }) => {
7
80
  const notificationsContext = useContext(NotificationsContext);
8
81
  const { setSelectedNotification, muteFilters } = notificationsContext;
9
- const [overflowMenuOpen, setOverflowMenuOpen] = useState(false);
10
82
  const [isMuteFilterApplied, setIsMuteFilterApplied] = useState(muteFilters
11
83
  ? muteFilters.some((filter) => filter.source === notification.source && filter.type === notification.type)
12
84
  : false);
@@ -14,22 +86,23 @@ export const NotificationCardHeaderControls = ({ notification, removeNotificatio
14
86
  includeSeconds: true,
15
87
  }));
16
88
  useEffect(() => {
89
+ var _a;
17
90
  const id = setInterval(() => {
18
91
  setTime(formatDistanceToNow(new Date(notification.issuedAt), {
19
92
  includeSeconds: true,
20
93
  }));
21
94
  }, 60000);
95
+ // when running unit tests in node.js, node does not exit until timeouts and intervals are done
96
+ // Calling this allows node to exit without waiting for setInterval to complete.
97
+ (_a = id.unref) === null || _a === void 0 ? void 0 : _a.call(id);
22
98
  return () => clearInterval(id);
23
99
  });
24
- const toggleOverflowMenu = () => {
25
- setOverflowMenuOpen(!overflowMenuOpen);
26
- };
27
- const overFlowActions = Object.assign({}, OverflowMenuActions);
100
+ const overFlowActions = Object.assign({}, ContextMenuActions);
28
101
  let optionsToggleClassName = "notification-card__more-options__toggle";
29
102
  if (uiContext === "center") {
30
103
  delete overFlowActions.DISMISS;
31
- overFlowActions.DETAILS.action = (overflowNotification) => {
32
- setSelectedNotification(overflowNotification);
104
+ overFlowActions.DETAILS.action = (contextNotification) => {
105
+ setSelectedNotification(contextNotification);
33
106
  };
34
107
  }
35
108
  else {
@@ -39,10 +112,17 @@ export const NotificationCardHeaderControls = ({ notification, removeNotificatio
39
112
  delete overFlowActions.DETAILS;
40
113
  delete overFlowActions.DISMISS;
41
114
  }
115
+ // Don't display read if notification is read
116
+ if (overFlowActions.MARK_AS_READ)
117
+ overFlowActions.MARK_AS_READ.display = !notification.isRead;
118
+ // Don't display unread if notification is unread
119
+ if (overFlowActions.MARK_AS_UNREAD)
120
+ overFlowActions.MARK_AS_UNREAD.display = notification.isRead;
42
121
  useEffect(() => {
43
122
  function listenMuteStateChanged(error, response) {
44
123
  if (error) {
45
124
  console.error("FinsembleNotificationsMuteStateChannel: ", error);
125
+ FSBL.Clients.Logger.system.error("FinsembleNotificationsMuteStateChannel: ", error);
46
126
  }
47
127
  else {
48
128
  const { data } = response;
@@ -56,10 +136,9 @@ export const NotificationCardHeaderControls = ({ notification, removeNotificatio
56
136
  FSBL.Clients.RouterClient.removeListener("FinsembleNotificationsMuteStateChannel", listenMuteStateChanged);
57
137
  };
58
138
  }, []);
59
- const menuActions = Object.values(overFlowActions).map((value) => renderOverflowMenuAction(notification, value, isMuteFilterApplied));
60
- return (React.createElement("div", { className: optionsToggleClassName, onMouseLeave: () => setOverflowMenuOpen(false) },
61
- React.createElement("span", { className: "notification-card_overflow_menu" },
62
- React.createElement(IconButton, { iconName: "ff-dots-vert", tooltip: "Options", clickHandler: toggleOverflowMenu }, overflowMenuOpen ? React.createElement(OverflowMenu, { closeSelf: setOverflowMenuOpen }, menuActions) : null)),
139
+ return (React.createElement("div", { className: optionsToggleClassName },
140
+ React.createElement("span", { className: "notification-card_context_menu" },
141
+ React.createElement(ContextMenuToggle, { menuActions: overFlowActions, message: notification, isMuteFilterApplied: isMuteFilterApplied })),
63
142
  uiContext == "toasts" && (React.createElement(IconButton, { iconName: "ff-close", classNames: "notification-card__dismiss no-hover", tooltip: "Dismiss", clickHandler: removeNotification })),
64
143
  uiContext == "center" && React.createElement("span", { className: "notification-card_timestamp" }, time)));
65
144
  };
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationCardHeaderControls.js","sourceRoot":"","sources":["../../../../../../src/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,YAAY,EAAE,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAK/C,MAAM,CAAC,MAAM,8BAA8B,GAItC,CAAC,EAAE,YAAY,EAAE,kBAAkB,EAAE,SAAS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,CAAC,CAClE,CAAC;IAEF,OAAO,CACN,6BAAK,SAAS,EAAE,sBAAsB,EAAE,YAAY,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,KAAK,CAAC;QACrF,8BAAM,SAAS,EAAC,iCAAiC;YAChD,oBAAC,UAAU,IAAC,QAAQ,EAAC,cAAc,EAAC,OAAO,EAAC,SAAS,EAAC,YAAY,EAAE,kBAAkB,IACpF,gBAAgB,CAAC,CAAC,CAAC,oBAAC,YAAY,IAAC,SAAS,EAAE,mBAAmB,IAAG,WAAW,CAAgB,CAAC,CAAC,CAAC,IAAI,CACzF,CACP;QACN,SAAS,IAAI,QAAQ,IAAI,CACzB,oBAAC,UAAU,IACV,QAAQ,EAAC,UAAU,EACnB,UAAU,EAAE,qCAAqC,EACjD,OAAO,EAAC,SAAS,EACjB,YAAY,EAAE,kBAAkB,GAC/B,CACF;QACA,SAAS,IAAI,QAAQ,IAAI,8BAAM,SAAS,EAAC,6BAA6B,IAAE,IAAI,CAAQ,CAChF,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React, { useContext, useEffect, useState } from \"react\";\nimport IconButton from \"../IconButton\";\nimport OverflowMenu, { OverflowMenuActions, renderOverflowMenuAction } from \"../OverflowMenu\";\nimport { NotificationsContext } from \"../../../notificationsContext\";\nimport { formatDistanceToNow } from \"date-fns\";\nimport { services } from \"@finsemble/finsemble-api\";\n\ntype INotification = services.notification.types.INotification;\n\nexport const NotificationCardHeaderControls: React.FunctionComponent<{\n\tnotification: INotification;\n\tuiContext?: string;\n\tremoveNotification?: Function;\n}> = ({ notification, removeNotification, uiContext = \"center\" }) => {\n\tconst notificationsContext = useContext(NotificationsContext);\n\tconst { setSelectedNotification, muteFilters } = notificationsContext;\n\n\tconst [overflowMenuOpen, setOverflowMenuOpen] = useState(false);\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\tconst [time, setTime] = useState(\n\t\tformatDistanceToNow(new Date(notification.issuedAt), {\n\t\t\tincludeSeconds: true,\n\t\t})\n\t);\n\n\tuseEffect(() => {\n\t\tconst id = setInterval(() => {\n\t\t\tsetTime(\n\t\t\t\tformatDistanceToNow(new Date(notification.issuedAt), {\n\t\t\t\t\tincludeSeconds: true,\n\t\t\t\t})\n\t\t\t);\n\t\t}, 60000);\n\t\treturn () => clearInterval(id);\n\t});\n\n\tconst toggleOverflowMenu = () => {\n\t\tsetOverflowMenuOpen(!overflowMenuOpen);\n\t};\n\n\tconst overFlowActions = Object.assign({}, OverflowMenuActions);\n\tlet optionsToggleClassName = \"notification-card__more-options__toggle\";\n\n\tif (uiContext === \"center\") {\n\t\tdelete overFlowActions.DISMISS;\n\t\toverFlowActions.DETAILS.action = (overflowNotification: INotification) => {\n\t\t\tsetSelectedNotification(overflowNotification);\n\t\t};\n\t} else {\n\t\toptionsToggleClassName = \"notification-card__more-options__no-toggle\";\n\t\tdelete overFlowActions.MARK_AS_READ;\n\t\tdelete overFlowActions.MARK_AS_UNREAD;\n\t\tdelete overFlowActions.DETAILS;\n\t\tdelete overFlowActions.DISMISS;\n\t}\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 className={optionsToggleClassName} onMouseLeave={() => setOverflowMenuOpen(false)}>\n\t\t\t<span className=\"notification-card_overflow_menu\">\n\t\t\t\t<IconButton iconName=\"ff-dots-vert\" tooltip=\"Options\" clickHandler={toggleOverflowMenu}>\n\t\t\t\t\t{overflowMenuOpen ? <OverflowMenu closeSelf={setOverflowMenuOpen}>{menuActions}</OverflowMenu> : null}\n\t\t\t\t</IconButton>\n\t\t\t</span>\n\t\t\t{uiContext == \"toasts\" && (\n\t\t\t\t<IconButton\n\t\t\t\t\ticonName=\"ff-close\"\n\t\t\t\t\tclassNames={\"notification-card__dismiss no-hover\"}\n\t\t\t\t\ttooltip=\"Dismiss\"\n\t\t\t\t\tclickHandler={removeNotification}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{uiContext == \"center\" && <span className=\"notification-card_timestamp\">{time}</span>}\n\t\t</div>\n\t);\n};\n"]}
1
+ {"version":3,"file":"NotificationCardHeaderControls.js","sourceRoot":"","sources":["../../../../../../src/components/notifications/components/shared/notificationCard/NotificationCardHeaderControls.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,iBAAiB,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,OAAO,EACN,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACnB,MAAM,uCAAuC,CAAC;AAE/C,QAAQ;AACR,OAAO,iBAAiB,MAAM,+CAA+C,CAAC;AAC9E,OAAO,gBAAgB,MAAM,8CAA8C,CAAC;AAC5E,OAAO,UAAU,MAAM,4CAA4C,CAAC;AACpE,OAAO,UAAU,MAAM,eAAe,CAAC;AAIvC,MAAM,CAAC,MAAM,k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AI,QAAQ,IAAI,8BAAM,SAAS,EAAC,6BAA6B,IAAE,IAAI,CAAQ,CAChF,CACN,CAAC;AACH,CAAC,CAAC","sourcesContent":["import React, { useContext, useEffect, useState } from \"react\";\nimport ContextMenuToggle from \"../../../../common/ContextMenu\";\nimport { NotificationsContext } from \"../../../notificationsContext\";\nimport { formatDistanceToNow } from \"date-fns\";\nimport { services } from \"@finsemble/finsemble-api\";\nimport { ContextMenuAction } from \"../../../types\";\n\nimport {\n\tmarkNotificationsRead,\n\tmarkNotificationsUnread,\n\tsnoozeNotifications,\n} from \"../../../../../hooks/useNotifications\";\n\n// Icons\nimport EnvelopeCloseIcon from \"../../../../notifications/icons/EnvelopeClose\";\nimport EnvelopeOpenIcon from \"../../../../notifications/icons/EnvelopeOpen\";\nimport SnoozeIcon from \"../../../../notifications/icons/SnoozeIcon\";\nimport IconButton from \"../IconButton\";\n\ntype INotification = services.notification.types.INotification;\n\nexport const ContextMenuActions: { [key: string]: ContextMenuAction } = {\n\tMARK_AS_UNREAD: {\n\t\tname: \"MARK_AS_UNREAD\",\n\t\ticon: <EnvelopeCloseIcon />,\n\t\tlabel: \"Mark Unread\",\n\t\taction: (notification: INotification) => markNotificationsUnread([notification]),\n\t\tdisplay: true,\n\t},\n\tMARK_AS_READ: {\n\t\tname: \"MARK_AS_READ\",\n\t\ticon: <EnvelopeOpenIcon />,\n\t\tlabel: \"Mark Read\",\n\t\taction: (notification: INotification) => markNotificationsRead([notification]),\n\t\tdisplay: true,\n\t},\n\tSNOOZE: {\n\t\tname: \"SNOOZE\",\n\t\ticon: <SnoozeIcon />,\n\t\tlabel: \"Snooze\",\n\t\taction: (notification: INotification) => snoozeNotifications([notification]),\n\t\tdisplay: true,\n\t},\n\tDISMISS: {\n\t\tname: \"DISMISS\",\n\t\ticon: (\n\t\t\t<div className=\"finsemble-icon\">\n\t\t\t\t<i className=\"ff-close\" />\n\t\t\t</div>\n\t\t),\n\t\tlabel: \"Dismiss\",\n\t\taction: () => {\n\t\t\t// Empty - filled in later\n\t\t},\n\t\tdisplay: true,\n\t},\n\tSETTINGS: {\n\t\tname: \"SETTINGS\",\n\t\ticon: (\n\t\t\t<div className=\"finsemble-icon\">\n\t\t\t\t<i className=\"ff-settings\" />\n\t\t\t</div>\n\t\t),\n\t\tlabel: \"Settings\",\n\t\taction: (notification: INotification) => {\n\t\t\tFSBL.Clients.LauncherClient.showWindow(\n\t\t\t\t{\n\t\t\t\t\tcomponentType: \"UserPreferences\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tmonitor: \"mine\",\n\t\t\t\t\tleft: \"center\",\n\t\t\t\t\ttop: \"center\",\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tFSBL.Clients.RouterClient.transmit(\"FinsembleUserPreferencesChannel\", {\n\t\t\t\t\t\tpreferencesTab: \"Notifications\",\n\t\t\t\t\t\tnotification,\n\t\t\t\t\t});\n\t\t\t\t\t// we need this timeout otherwise the UserPreferences screen does not detect the message being transmited\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tFSBL.Clients.RouterClient.transmit(\"FinsembleNotificationsNavigationChannel\", { notification });\n\t\t\t\t\t}, 50);\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\tdisplay: true,\n\t},\n\tDETAILS: {\n\t\tname: \"DETAILS\",\n\t\ticon: (\n\t\t\t<div className=\"finsemble-icon\">\n\t\t\t\t<i className=\"ff-dots-horz\" />\n\t\t\t</div>\n\t\t),\n\t\tlabel: \"Details\",\n\t\taction: () => {\n\t\t\t// Empty - filled in later\n\t\t},\n\t\tdisplay: true,\n\t},\n};\n\nexport const NotificationCardHeaderControls: React.FunctionComponent<{\n\tnotification: INotification;\n\tuiContext?: string;\n\tremoveNotification?: Function;\n}> = ({ notification, removeNotification, uiContext = \"center\" }) => {\n\tconst notificationsContext = useContext(NotificationsContext);\n\tconst { setSelectedNotification, muteFilters } = notificationsContext;\n\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\tconst [time, setTime] = useState(\n\t\tformatDistanceToNow(new Date(notification.issuedAt), {\n\t\t\tincludeSeconds: true,\n\t\t})\n\t);\n\n\tuseEffect(() => {\n\t\tconst id = setInterval(() => {\n\t\t\tsetTime(\n\t\t\t\tformatDistanceToNow(new Date(notification.issuedAt), {\n\t\t\t\t\tincludeSeconds: true,\n\t\t\t\t})\n\t\t\t);\n\t\t}, 60000);\n\n\t\t// when running unit tests in node.js, node does not exit until timeouts and intervals are done\n\t\t// Calling this allows node to exit without waiting for setInterval to complete.\n\t\tid.unref?.();\n\n\t\treturn () => clearInterval(id);\n\t});\n\n\tconst overFlowActions = Object.assign({}, ContextMenuActions);\n\tlet optionsToggleClassName = \"notification-card__more-options__toggle\";\n\n\tif (uiContext === \"center\") {\n\t\tdelete overFlowActions.DISMISS;\n\t\toverFlowActions.DETAILS.action = (contextNotification: INotification) => {\n\t\t\tsetSelectedNotification(contextNotification);\n\t\t};\n\t} else {\n\t\toptionsToggleClassName = \"notification-card__more-options__no-toggle\";\n\t\tdelete overFlowActions.MARK_AS_READ;\n\t\tdelete overFlowActions.MARK_AS_UNREAD;\n\t\tdelete overFlowActions.DETAILS;\n\t\tdelete overFlowActions.DISMISS;\n\t}\n\n\t// Don't display read if notification is read\n\tif (overFlowActions.MARK_AS_READ) overFlowActions.MARK_AS_READ.display = !notification.isRead;\n\t// Don't display unread if notification is unread\n\tif (overFlowActions.MARK_AS_UNREAD) overFlowActions.MARK_AS_UNREAD.display = notification.isRead;\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 className={optionsToggleClassName}>\n\t\t\t<span className=\"notification-card_context_menu\">\n\t\t\t\t<ContextMenuToggle\n\t\t\t\t\tmenuActions={overFlowActions}\n\t\t\t\t\tmessage={notification}\n\t\t\t\t\tisMuteFilterApplied={isMuteFilterApplied}\n\t\t\t\t/>\n\t\t\t</span>\n\t\t\t{uiContext == \"toasts\" && (\n\t\t\t\t<IconButton\n\t\t\t\t\ticonName=\"ff-close\"\n\t\t\t\t\tclassNames={\"notification-card__dismiss no-hover\"}\n\t\t\t\t\ttooltip=\"Dismiss\"\n\t\t\t\t\tclickHandler={removeNotification}\n\t\t\t\t/>\n\t\t\t)}\n\t\t\t{uiContext == \"center\" && <span className=\"notification-card_timestamp\">{time}</span>}\n\t\t</div>\n\t);\n};\n"]}
@@ -3,9 +3,9 @@ import { format, differenceInMilliseconds, parseISO, addSeconds } from "date-fns
3
3
  // Context
4
4
  import { NotificationsContext } from "../../notificationsContext";
5
5
  // Components
6
- import IconButton from "../shared/IconButton";
7
6
  import NoNotifications from "../NoNotifications";
8
- import OverflowMenu, { OverflowMenuActions, renderOverflowMenuAction } from "../shared/OverflowMenu";
7
+ import ContextMenuToggle from "../../../common/ContextMenu";
8
+ import { ContextMenuActions } from "../../../notifications/components/shared/notificationCard/NotificationCardHeaderControls";
9
9
  import { CheckButton } from "../shared/CheckButton";
10
10
  // Utils
11
11
  import { getActiveFilter, getMostRecentAction, isNewNotification, isReNotification, searchNotifications, } from "../../utils";
@@ -21,10 +21,6 @@ const ListHeaderComponent = () => (React.createElement("div", { className: "list
21
21
  export const NotificationListRowShell = ({ notification, newNotificationHaloPeriodSeconds, children, }) => {
22
22
  const notificationsContext = useContext(NotificationsContext);
23
23
  const { setSelectedNotification, muteFilters, selectionMode } = notificationsContext;
24
- const [overflowMenuOpen, setOverflowMenuOpen] = useState(false);
25
- const toggleOverflowMenu = () => {
26
- setOverflowMenuOpen(!overflowMenuOpen);
27
- };
28
24
  const [isNew, setIsNew] = useState(isNewNotification(notification, newNotificationHaloPeriodSeconds));
29
25
  const [wokeFromSnooze, setWokeFromSnooze] = useState(isReNotification(notification, newNotificationHaloPeriodSeconds));
30
26
  const [isMuteFilterApplied, setIsMuteFilterApplied] = useState(muteFilters
@@ -72,7 +68,7 @@ export const NotificationListRowShell = ({ notification, newNotificationHaloPeri
72
68
  clearTimeout(isRenotificationTimerId);
73
69
  };
74
70
  }, [newNotificationHaloPeriodSeconds, notification]);
75
- const overFlowActions = Object.assign({}, OverflowMenuActions);
71
+ const overFlowActions = Object.assign({}, ContextMenuActions);
76
72
  overFlowActions.DETAILS.action = (detailNotification) => {
77
73
  setSelectedNotification(detailNotification);
78
74
  };
@@ -81,6 +77,7 @@ export const NotificationListRowShell = ({ notification, newNotificationHaloPeri
81
77
  function listenMuteStateChanged(error, response) {
82
78
  if (error) {
83
79
  console.error("FinsembleNotificationsMuteStateChannel: ", error);
80
+ FSBL.Clients.Logger.system.error("FinsembleNotificationsMuteStateChannel: ", error);
84
81
  }
85
82
  else {
86
83
  const { data } = response;
@@ -94,7 +91,6 @@ export const NotificationListRowShell = ({ notification, newNotificationHaloPeri
94
91
  FSBL.Clients.RouterClient.removeListener("FinsembleNotificationsMuteStateChannel", listenMuteStateChanged);
95
92
  };
96
93
  }, []);
97
- const menuActions = Object.values(overFlowActions).map((value) => renderOverflowMenuAction(notification, value, isMuteFilterApplied));
98
94
  return (React.createElement("div", { className: `list-row__container notification-item ${notification.isRead ? "is-read" : ""} ${isNew || wokeFromSnooze ? "new" : ""}
99
95
  ${notification.cssClassName ? notification.cssClassName : ""}` },
100
96
  children ? (React.createElement(React.Fragment, null,
@@ -107,7 +103,7 @@ export const NotificationListRowShell = ({ notification, newNotificationHaloPeri
107
103
  React.createElement("div", { className: "list-row__cell" }, `${notification.title} - ${notification.details}`))),
108
104
  React.createElement("div", { className: "list-row__cell" },
109
105
  React.createElement("span", null,
110
- React.createElement(IconButton, { iconName: "ff-dots-vert", tooltip: "Options", clickHandler: toggleOverflowMenu }, overflowMenuOpen ? React.createElement(OverflowMenu, { closeSelf: setOverflowMenuOpen }, menuActions) : null)))));
106
+ React.createElement(ContextMenuToggle, { menuActions: overFlowActions, message: notification, isMuteFilterApplied: false })))));
111
107
  };
112
108
  const ListView = ({ notificationHeaderRow, notificationListRow, notifications, }) => {
113
109
  var _a;
@@ -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,O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AgC,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,E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AG;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"]}