@digital-realty/ix-notifications 1.0.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 (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/dist/IxNotifications.d.ts +37 -0
  4. package/dist/IxNotifications.js +278 -0
  5. package/dist/IxNotifications.js.map +1 -0
  6. package/dist/api/notifications-api/apis/NotificationsApi.d.ts +83 -0
  7. package/dist/api/notifications-api/apis/NotificationsApi.js +204 -0
  8. package/dist/api/notifications-api/apis/NotificationsApi.js.map +1 -0
  9. package/dist/api/notifications-api/apis/index.d.ts +1 -0
  10. package/dist/api/notifications-api/apis/index.js +4 -0
  11. package/dist/api/notifications-api/apis/index.js.map +1 -0
  12. package/dist/api/notifications-api/index.d.ts +3 -0
  13. package/dist/api/notifications-api/index.js +6 -0
  14. package/dist/api/notifications-api/index.js.map +1 -0
  15. package/dist/api/notifications-api/models/ErrorResponse.d.ts +55 -0
  16. package/dist/api/notifications-api/models/ErrorResponse.js +52 -0
  17. package/dist/api/notifications-api/models/ErrorResponse.js.map +1 -0
  18. package/dist/api/notifications-api/models/GetNotifications200Response.d.ts +62 -0
  19. package/dist/api/notifications-api/models/GetNotifications200Response.js +56 -0
  20. package/dist/api/notifications-api/models/GetNotifications200Response.js.map +1 -0
  21. package/dist/api/notifications-api/models/Notification.d.ts +86 -0
  22. package/dist/api/notifications-api/models/Notification.js +63 -0
  23. package/dist/api/notifications-api/models/Notification.js.map +1 -0
  24. package/dist/api/notifications-api/models/NotificationDelete.d.ts +31 -0
  25. package/dist/api/notifications-api/models/NotificationDelete.js +44 -0
  26. package/dist/api/notifications-api/models/NotificationDelete.js.map +1 -0
  27. package/dist/api/notifications-api/models/NotificationPatch.d.ts +32 -0
  28. package/dist/api/notifications-api/models/NotificationPatch.js +45 -0
  29. package/dist/api/notifications-api/models/NotificationPatch.js.map +1 -0
  30. package/dist/api/notifications-api/models/NotificationRequest.d.ts +73 -0
  31. package/dist/api/notifications-api/models/NotificationRequest.js +62 -0
  32. package/dist/api/notifications-api/models/NotificationRequest.js.map +1 -0
  33. package/dist/api/notifications-api/models/PaginatedResponse.d.ts +61 -0
  34. package/dist/api/notifications-api/models/PaginatedResponse.js +55 -0
  35. package/dist/api/notifications-api/models/PaginatedResponse.js.map +1 -0
  36. package/dist/api/notifications-api/models/Status.d.ts +23 -0
  37. package/dist/api/notifications-api/models/Status.js +31 -0
  38. package/dist/api/notifications-api/models/Status.js.map +1 -0
  39. package/dist/api/notifications-api/models/index.d.ts +8 -0
  40. package/dist/api/notifications-api/models/index.js +11 -0
  41. package/dist/api/notifications-api/models/index.js.map +1 -0
  42. package/dist/api/notifications-api/runtime.d.ts +182 -0
  43. package/dist/api/notifications-api/runtime.js +319 -0
  44. package/dist/api/notifications-api/runtime.js.map +1 -0
  45. package/dist/components/notifications/confirmation-dialog.d.ts +10 -0
  46. package/dist/components/notifications/confirmation-dialog.js +67 -0
  47. package/dist/components/notifications/confirmation-dialog.js.map +1 -0
  48. package/dist/components/notifications/date-filters.d.ts +19 -0
  49. package/dist/components/notifications/date-filters.js +152 -0
  50. package/dist/components/notifications/date-filters.js.map +1 -0
  51. package/dist/components/notifications/group-filters.d.ts +8 -0
  52. package/dist/components/notifications/group-filters.js +75 -0
  53. package/dist/components/notifications/group-filters.js.map +1 -0
  54. package/dist/components/notifications/grouped-item.d.ts +13 -0
  55. package/dist/components/notifications/grouped-item.js +81 -0
  56. package/dist/components/notifications/grouped-item.js.map +1 -0
  57. package/dist/components/notifications/notification-item.d.ts +18 -0
  58. package/dist/components/notifications/notification-item.js +137 -0
  59. package/dist/components/notifications/notification-item.js.map +1 -0
  60. package/dist/components/notifications/view-item-dialog.d.ts +12 -0
  61. package/dist/components/notifications/view-item-dialog.js +102 -0
  62. package/dist/components/notifications/view-item-dialog.js.map +1 -0
  63. package/dist/constants/api-constants.d.ts +3 -0
  64. package/dist/constants/api-constants.js +4 -0
  65. package/dist/constants/api-constants.js.map +1 -0
  66. package/dist/constants/notification-types.d.ts +15 -0
  67. package/dist/constants/notification-types.js +2 -0
  68. package/dist/constants/notification-types.js.map +1 -0
  69. package/dist/constants/notifications.d.ts +15 -0
  70. package/dist/constants/notifications.js +19 -0
  71. package/dist/constants/notifications.js.map +1 -0
  72. package/dist/helper/errors.d.ts +1 -0
  73. package/dist/helper/errors.js +20 -0
  74. package/dist/helper/errors.js.map +1 -0
  75. package/dist/index.d.ts +1 -0
  76. package/dist/index.js +2 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/ix-notifications.d.ts +1 -0
  79. package/dist/ix-notifications.js +3 -0
  80. package/dist/ix-notifications.js.map +1 -0
  81. package/dist/ix-notifications.min.js +1 -0
  82. package/dist/models/notification.d.ts +13 -0
  83. package/dist/models/notification.js +2 -0
  84. package/dist/models/notification.js.map +1 -0
  85. package/dist/services/api-client.d.ts +13 -0
  86. package/dist/services/api-client.js +24 -0
  87. package/dist/services/api-client.js.map +1 -0
  88. package/dist/services/app-service.d.ts +1 -0
  89. package/dist/services/app-service.js +7 -0
  90. package/dist/services/app-service.js.map +1 -0
  91. package/dist/services/notifications-service.d.ts +10 -0
  92. package/dist/services/notifications-service.js +56 -0
  93. package/dist/services/notifications-service.js.map +1 -0
  94. package/dist/state/NotificationState.d.ts +28 -0
  95. package/dist/state/NotificationState.js +153 -0
  96. package/dist/state/NotificationState.js.map +1 -0
  97. package/dist/styles/notifications-style.d.ts +1 -0
  98. package/dist/styles/notifications-style.js +133 -0
  99. package/dist/styles/notifications-style.js.map +1 -0
  100. package/dist/tw.d.ts +1 -0
  101. package/dist/tw.js +890 -0
  102. package/dist/tw.js.map +1 -0
  103. package/package.json +138 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ix-notifications
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # \<ix-notifications>
2
+
3
+ This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i @digital-realty/ix-notifications
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```html
14
+ <script type="module">
15
+ import '@digital-realty/ix-notifications/ix-notifications.js';
16
+ </script>
17
+
18
+ <ix-notifications></ix-notifications>
19
+ ```
20
+
21
+ ## Linting and formatting
22
+
23
+ To scan the project for linting and formatting errors, run
24
+
25
+ ```bash
26
+ npm run lint
27
+ ```
28
+
29
+ To automatically fix linting and formatting errors, run
30
+
31
+ ```bash
32
+ npm run format
33
+ ```
34
+
35
+ ## Demoing with Storybook
36
+
37
+ To run a local instance of Storybook for your component, run
38
+
39
+ ```bash
40
+ npm run storybook
41
+ ```
42
+
43
+ To build a production version of Storybook, run
44
+
45
+ ```bash
46
+ npm run storybook:build
47
+ ```
48
+
49
+
50
+ ## Tooling configs
51
+
52
+ For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
53
+
54
+ If you customize the configuration a lot, you can consider moving them to individual files.
55
+
56
+ ## Local Demo with `web-dev-server`
57
+
58
+ ```bash
59
+ npm start
60
+ ```
61
+
62
+ To run a local development server that serves the basic demo located in `demo/index.html`
@@ -0,0 +1,37 @@
1
+ import { MobxLitElement } from '@adobe/lit-mobx';
2
+ import '@digital-realty/ix-button/ix-button.js';
3
+ import '@digital-realty/ix-drawer/ix-drawer.js';
4
+ import '@digital-realty/ix-icon';
5
+ import '@material/web/icon/icon.js';
6
+ import { Notification } from './models/notification.js';
7
+ import { FilterDialogEventDetail } from './constants/notification-types.js';
8
+ import './components/notifications/notification-item.js';
9
+ import './components/notifications/grouped-item.js';
10
+ import './components/notifications/group-filters.js';
11
+ import './components/notifications/date-filters.js';
12
+ import './components/notifications/confirmation-dialog.js';
13
+ export declare class IxNotifications extends MobxLitElement {
14
+ static styles: import("lit").CSSResult[];
15
+ private showDrawer;
16
+ private showGroupedView;
17
+ private showFilters;
18
+ private showDateFilters;
19
+ private showMarkAllReadConfirmation;
20
+ baseApiUrl: string;
21
+ firstUpdated(): Promise<void>;
22
+ connectedCallback(): void;
23
+ disconnectedCallback(): void;
24
+ toggleDrawer(): void;
25
+ renderUnReadCountText(): import("lit").TemplateResult<1>;
26
+ markAllread(): void;
27
+ private confirmedMarkAllRead;
28
+ toggleGroupView(): void;
29
+ displayFilters(): void;
30
+ applyNotificationFilters(): Notification[];
31
+ displayDateFilters(): void;
32
+ renderGroupedView(): import("lit").TemplateResult<1>;
33
+ renderDefaultView(): import("lit").TemplateResult<1>;
34
+ renderNoResult(): import("lit").TemplateResult<1>;
35
+ handleCloseClick(_e: CustomEvent<FilterDialogEventDetail>): void;
36
+ render(): import("lit").TemplateResult<1>;
37
+ }
@@ -0,0 +1,278 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, nothing } from 'lit';
3
+ import { property, state } from 'lit/decorators.js';
4
+ import { MobxLitElement } from '@adobe/lit-mobx';
5
+ import { differenceInDays, differenceInHours } from 'date-fns';
6
+ import { TWStyles } from './tw.js';
7
+ import '@digital-realty/ix-button/ix-button.js';
8
+ import '@digital-realty/ix-drawer/ix-drawer.js';
9
+ import '@digital-realty/ix-icon';
10
+ import '@material/web/icon/icon.js';
11
+ import { NotificationsState } from './state/NotificationState.js';
12
+ import { NotificationGroups, NotificationStatus, } from './constants/notifications.js';
13
+ import './components/notifications/notification-item.js';
14
+ import './components/notifications/grouped-item.js';
15
+ import './components/notifications/group-filters.js';
16
+ import './components/notifications/date-filters.js';
17
+ import './components/notifications/confirmation-dialog.js';
18
+ import { NotificationsStyle } from './styles/notifications-style.js';
19
+ export class IxNotifications extends MobxLitElement {
20
+ constructor() {
21
+ super(...arguments);
22
+ this.showDrawer = false;
23
+ this.showGroupedView = false;
24
+ this.showFilters = false;
25
+ this.showDateFilters = false;
26
+ this.showMarkAllReadConfirmation = false;
27
+ this.baseApiUrl = '';
28
+ }
29
+ async firstUpdated() {
30
+ // Construct ApiClient form baseApiUrl Prop
31
+ NotificationsState.baseApiUrl = this.baseApiUrl;
32
+ NotificationsState.ConstructApiClient();
33
+ // Load the notifications
34
+ await NotificationsState.getNotifications();
35
+ }
36
+ connectedCallback() {
37
+ super.connectedCallback();
38
+ window.addEventListener('account-switched', NotificationsState.NewApiClient);
39
+ }
40
+ disconnectedCallback() {
41
+ super.disconnectedCallback();
42
+ window.removeEventListener('account-switched', NotificationsState.NewApiClient);
43
+ }
44
+ toggleDrawer() {
45
+ this.showDrawer = !this.showDrawer;
46
+ if (!this.showDrawer) {
47
+ this.showFilters = false;
48
+ this.showDateFilters = false;
49
+ }
50
+ }
51
+ /* eslint-disable-next-line */
52
+ renderUnReadCountText() {
53
+ if (NotificationsState.unreadNotificationCount <= 0) {
54
+ return html `${nothing}`;
55
+ }
56
+ let unreadCountText = '';
57
+ if (NotificationsState.unreadNotificationCount > 99) {
58
+ unreadCountText = '99+';
59
+ }
60
+ else {
61
+ unreadCountText = NotificationsState.unreadNotificationCount.toString();
62
+ }
63
+ return html ` <div
64
+ class="px-1 bg-red-500 rounded-full text-center text-white text-sm absolute icon-position -start-0"
65
+ style="top:0.05rem ;left: 1.5rem;"
66
+ >
67
+ ${unreadCountText}
68
+ </div>`;
69
+ }
70
+ markAllread() {
71
+ this.showMarkAllReadConfirmation = true;
72
+ }
73
+ confirmedMarkAllRead(e) {
74
+ // Mark All read if Confirmed True
75
+ if (e.detail.returnValue) {
76
+ const filterNotification = this.applyNotificationFilters();
77
+ filterNotification === null || filterNotification === void 0 ? void 0 : filterNotification.forEach(item => {
78
+ if (item.status === NotificationStatus.UNREAD)
79
+ NotificationsState.setNotificationReadStatus(item.id);
80
+ });
81
+ this.renderUnReadCountText();
82
+ }
83
+ this.showMarkAllReadConfirmation = false;
84
+ }
85
+ toggleGroupView() {
86
+ this.showGroupedView = !this.showGroupedView;
87
+ }
88
+ displayFilters() {
89
+ this.showFilters = !this.showFilters;
90
+ }
91
+ /* eslint-disable-next-line */
92
+ applyNotificationFilters() {
93
+ var _a;
94
+ const filterredNotifications = (_a = NotificationsState.notifications) === null || _a === void 0 ? void 0 : _a.filter((x) => (x.resourceType === NotificationGroups.PLANNED_MAINTENANCE &&
95
+ NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE ===
96
+ true) ||
97
+ (x.resourceType === NotificationGroups.SERVICE_TICKETS &&
98
+ NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS ===
99
+ true) ||
100
+ (x.resourceType === NotificationGroups.DCIM_ALERTS &&
101
+ NotificationsState.notificationFilters.SHOW_DCIM_ALERTS === true) ||
102
+ x.resourceType === NotificationGroups.INCIDENTS); // Always display incidents
103
+ if (NotificationsState.dateFilters.FROM_DATE === undefined ||
104
+ NotificationsState.dateFilters.TO_DATE === undefined)
105
+ return filterredNotifications;
106
+ return filterredNotifications.filter(x => differenceInHours(new Date(x.createdAt), NotificationsState.dateFilters.FROM_DATE) >= 0 &&
107
+ differenceInDays(new Date(x.createdAt), NotificationsState.dateFilters.TO_DATE) <= 0);
108
+ }
109
+ displayDateFilters() {
110
+ this.showDateFilters = !this.showDateFilters;
111
+ }
112
+ renderGroupedView() {
113
+ const filteredNotifications = this.applyNotificationFilters();
114
+ return html `<div>
115
+ <grouped-item
116
+ groupTitle=${NotificationGroups.PLANNED_MAINTENANCE}
117
+ iconName="lab_profile"
118
+ .childItems=${filteredNotifications === null || filteredNotifications === void 0 ? void 0 : filteredNotifications.filter(item => item.resourceType === NotificationGroups.PLANNED_MAINTENANCE)}
119
+ ></grouped-item>
120
+ <grouped-item
121
+ groupTitle=${NotificationGroups.INCIDENTS}
122
+ iconName="emergency_home"
123
+ .childItems=${filteredNotifications === null || filteredNotifications === void 0 ? void 0 : filteredNotifications.filter(item => item.resourceType === NotificationGroups.INCIDENTS)}
124
+ ></grouped-item>
125
+ <grouped-item
126
+ groupTitle=${NotificationGroups.SERVICE_TICKETS}
127
+ iconName="dvr"
128
+ .childItems=${filteredNotifications === null || filteredNotifications === void 0 ? void 0 : filteredNotifications.filter(item => item.resourceType === NotificationGroups.SERVICE_TICKETS)}
129
+ ></grouped-item>
130
+ <grouped-item
131
+ groupTitle=${NotificationGroups.DCIM_ALERTS}
132
+ iconName="public"
133
+ .childItems=${filteredNotifications === null || filteredNotifications === void 0 ? void 0 : filteredNotifications.filter(item => item.resourceType === NotificationGroups.DCIM_ALERTS)}
134
+ ></grouped-item>
135
+ </div>`;
136
+ }
137
+ renderDefaultView() {
138
+ const filterNotification = this.applyNotificationFilters();
139
+ const filterTodayItems = filterNotification.filter(x => differenceInDays(x.createdAt, new Date()) === 0);
140
+ const filterEarlierItems = filterNotification.filter(x => differenceInDays(x.createdAt, new Date()) !== 0);
141
+ if ((filterNotification === null || filterNotification === void 0 ? void 0 : filterNotification.length) > 0) {
142
+ return html ` <div class="grow text-sm font-bold py-4 pl-2 align-top">
143
+ Latest
144
+ </div>
145
+ <div class="m-0 p-0">
146
+ ${filterTodayItems.length > 0
147
+ ? filterTodayItems === null || filterTodayItems === void 0 ? void 0 : filterTodayItems.map(item => html `<notification-item
148
+ .notificaiton=${item}
149
+ ?disabled=${item.resourceType ===
150
+ NotificationGroups.INCIDENTS}
151
+ >
152
+ </notification-item> `)
153
+ : this.renderNoResult()}
154
+ </div>
155
+ <div class="grow text-sm font-bold py-4 pl-2 align-top">Earlier</div>
156
+ <div>
157
+ ${filterEarlierItems.length > 0
158
+ ? filterEarlierItems === null || filterEarlierItems === void 0 ? void 0 : filterEarlierItems.map(item => html `<notification-item
159
+ .notificaiton=${item}
160
+ ?disabled=${item.resourceType ===
161
+ NotificationGroups.INCIDENTS}
162
+ >
163
+ </notification-item> `)
164
+ : this.renderNoResult()}
165
+ </div>`;
166
+ }
167
+ return html `<p class="m-0 pl-4 font-bold mr-4">
168
+ <small style="padding-left: 16px">No notifications yet.</small>
169
+ </p>`;
170
+ }
171
+ /* eslint-disable-next-line */
172
+ renderNoResult() {
173
+ return html `<p class="m-0 pl-4 font-bold mr-4">
174
+ <small style="padding-left: 16px">No notifications yet.</small>
175
+ </p>`;
176
+ }
177
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
178
+ handleCloseClick(_e) {
179
+ this.showDateFilters = false;
180
+ this.showFilters = false;
181
+ }
182
+ render() {
183
+ return html `
184
+ <div class="relative">
185
+ <ix-icon-button
186
+ icon="circle_notifications"
187
+ class="blue-icon"
188
+ @click=${() => this.toggleDrawer()}
189
+ >
190
+ </ix-icon-button>
191
+ ${this.renderUnReadCountText()}
192
+ </div>
193
+ <confirmation-dialog
194
+ ?open=${this.showMarkAllReadConfirmation}
195
+ @confirm-dialog-closed=${() => {
196
+ this.showMarkAllReadConfirmation = false;
197
+ }}
198
+ @on-confirm-selection=${this.confirmedMarkAllRead}
199
+ textMessage="Are you sure you want to mark all notifications as read?"
200
+ >
201
+ </confirmation-dialog>
202
+ <ix-drawer
203
+ ?isVisible=${this.showDrawer}
204
+ .onClosed=${() => this.toggleDrawer()}
205
+ animate-vertical
206
+ hide-close
207
+ >
208
+ <div class="flex flex-row justify-between grow py-2" slot="header">
209
+ <div class="grow text-xl items-center font-bold py-4 pl-2 align-top">
210
+ Notifications
211
+ </div>
212
+ <div class="flex flex-row justify-end grow items-center ">
213
+ <ix-icon-button
214
+ @click=${this.markAllread}
215
+ icon="fact_check"
216
+ class="blue-icon"
217
+ ></ix-icon-button>
218
+ <ix-icon-button
219
+ @click=${this.toggleGroupView}
220
+ icon="sort"
221
+ class="blue-icon"
222
+ ></ix-icon-button>
223
+ <ix-icon-button
224
+ @click=${this.displayFilters}
225
+ icon="menu"
226
+ class="blue-icon"
227
+ ></ix-icon-button>
228
+ <div
229
+ class="filter-dropdown-content ${this.showFilters
230
+ ? 'active z-50'
231
+ : ''}"
232
+ >
233
+ <group-filters></group-filters>
234
+ </div>
235
+ <ix-icon-button
236
+ @click=${this.displayDateFilters}
237
+ icon="calendar_month"
238
+ class="blue-icon"
239
+ ></ix-icon-button>
240
+ <div
241
+ class="datefilter-dropdown-content ${this.showDateFilters
242
+ ? 'active z-50'
243
+ : ''}"
244
+ @on-selection=${this.handleCloseClick}
245
+ >
246
+ <date-filters></date-filters>
247
+ </div>
248
+ </div>
249
+ </div>
250
+ <div slot="content">
251
+ ${this.showGroupedView
252
+ ? this.renderGroupedView()
253
+ : this.renderDefaultView()}
254
+ </div>
255
+ </ix-drawer>
256
+ `;
257
+ }
258
+ }
259
+ IxNotifications.styles = [TWStyles, NotificationsStyle];
260
+ __decorate([
261
+ state()
262
+ ], IxNotifications.prototype, "showDrawer", void 0);
263
+ __decorate([
264
+ state()
265
+ ], IxNotifications.prototype, "showGroupedView", void 0);
266
+ __decorate([
267
+ state()
268
+ ], IxNotifications.prototype, "showFilters", void 0);
269
+ __decorate([
270
+ state()
271
+ ], IxNotifications.prototype, "showDateFilters", void 0);
272
+ __decorate([
273
+ state()
274
+ ], IxNotifications.prototype, "showMarkAllReadConfirmation", void 0);
275
+ __decorate([
276
+ property({ type: String })
277
+ ], IxNotifications.prototype, "baseApiUrl", void 0);
278
+ //# sourceMappingURL=IxNotifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IxNotifications.js","sourceRoot":"","sources":["../src/IxNotifications.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,wCAAwC,CAAC;AAChD,OAAO,wCAAwC,CAAC;AAChD,OAAO,yBAAyB,CAAC;AACjC,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAMlE,OAAO,EACL,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,iDAAiD,CAAC;AACzD,OAAO,4CAA4C,CAAC;AACpD,OAAO,6CAA6C,CAAC;AACrD,OAAO,4CAA4C,CAAC;AACpD,OAAO,mDAAmD,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,MAAM,OAAO,eAAgB,SAAQ,cAAc;IAAnD;;QAGmB,eAAU,GAAG,KAAK,CAAC;QAEnB,oBAAe,GAAG,KAAK,CAAC;QAExB,gBAAW,GAAG,KAAK,CAAC;QAEpB,oBAAe,GAAG,KAAK,CAAC;QAExB,gCAA2B,GAAG,KAAK,CAAC;QAEzB,eAAU,GAAG,EAAE,CAAC;IAmS9C,CAAC;IAjSC,KAAK,CAAC,YAAY;QAChB,2CAA2C;QAC3C,kBAAkB,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;QAChD,kBAAkB,CAAC,kBAAkB,EAAE,CAAC;QAExC,yBAAyB;QACzB,MA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IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;mBAKI,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE;;;UAGlC,IAAI,CAAC,qBAAqB,EAAE;;;gBAGtB,IAAI,CAAC,2BAA2B;iCACf,GAAG,EAAE;YAC5B,IAAI,CAAC,2BAA2B,GAAG,KAAK,CAAC;QAC3C,CAAC;gCACuB,IAAI,CAAC,oBAAoB;;;;;qBAKpC,IAAI,CAAC,UAAU;oBAChB,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE;;;;;;;;;;uBAUtB,IAAI,CAAC,WAAW;;;;;uBAKhB,IAAI,CAAC,eAAe;;;;;uBAKpB,IAAI,CAAC,cAAc;;;;;gDAKM,IAAI,CAAC,WAAW;YAChD,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,EAAE;;;;;uBAKG,IAAI,CAAC,kBAAkB;;;;;oDAKM,IAAI,CAAC,eAAe;YACxD,CAAC,CAAC,aAAa;YACf,CAAC,CAAC,EAAE;8BACU,IAAI,CAAC,gBAAgB;;;;;;;YAOvC,IAAI,CAAC,eAAe;YACpB,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE;YAC1B,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE;;;KAGjC,CAAC;IACJ,CAAC;;AA9SM,sBAAM,GAAG,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AAEtC;IAAR,KAAK,EAAE;mDAA4B;AAE3B;IAAR,KAAK,EAAE;wDAAiC;AAEhC;IAAR,KAAK,EAAE;oDAA6B;AAE5B;IAAR,KAAK,EAAE;wDAAiC;AAEhC;IAAR,KAAK,EAAE;oEAA6C;AAEzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAiB","sourcesContent":["import { html, nothing } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { differenceInDays, differenceInHours } from 'date-fns';\nimport { TWStyles } from './tw.js';\nimport '@digital-realty/ix-button/ix-button.js';\nimport '@digital-realty/ix-drawer/ix-drawer.js';\nimport '@digital-realty/ix-icon';\nimport '@material/web/icon/icon.js';\nimport { NotificationsState } from './state/NotificationState.js';\nimport { Notification } from './models/notification.js';\nimport {\n ConfirmationDialogEventDetail,\n FilterDialogEventDetail,\n} from './constants/notification-types.js';\nimport {\n NotificationGroups,\n NotificationStatus,\n} from './constants/notifications.js';\nimport './components/notifications/notification-item.js';\nimport './components/notifications/grouped-item.js';\nimport './components/notifications/group-filters.js';\nimport './components/notifications/date-filters.js';\nimport './components/notifications/confirmation-dialog.js';\nimport { NotificationsStyle } from './styles/notifications-style.js';\n\nexport class IxNotifications extends MobxLitElement {\n static styles = [TWStyles, NotificationsStyle];\n\n @state() private showDrawer = false;\n\n @state() private showGroupedView = false;\n\n @state() private showFilters = false;\n\n @state() private showDateFilters = false;\n\n @state() private showMarkAllReadConfirmation = false;\n\n @property({ type: String }) baseApiUrl = '';\n\n async firstUpdated() {\n // Construct ApiClient form baseApiUrl Prop\n NotificationsState.baseApiUrl = this.baseApiUrl;\n NotificationsState.ConstructApiClient();\n\n // Load the notifications\n await NotificationsState.getNotifications();\n }\n\n connectedCallback() {\n super.connectedCallback();\n window.addEventListener(\n 'account-switched',\n NotificationsState.NewApiClient\n );\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n window.removeEventListener(\n 'account-switched',\n NotificationsState.NewApiClient\n );\n }\n\n toggleDrawer() {\n this.showDrawer = !this.showDrawer;\n if (!this.showDrawer) {\n this.showFilters = false;\n this.showDateFilters = false;\n }\n }\n\n /* eslint-disable-next-line */\n renderUnReadCountText() {\n if (NotificationsState.unreadNotificationCount <= 0) {\n return html`${nothing}`;\n }\n\n let unreadCountText = '';\n if (NotificationsState.unreadNotificationCount > 99) {\n unreadCountText = '99+';\n } else {\n unreadCountText = NotificationsState.unreadNotificationCount.toString();\n }\n\n return html` <div\n class=\"px-1 bg-red-500 rounded-full text-center text-white text-sm absolute icon-position -start-0\"\n style=\"top:0.05rem ;left: 1.5rem;\"\n >\n ${unreadCountText}\n </div>`;\n }\n\n markAllread() {\n this.showMarkAllReadConfirmation = true;\n }\n\n private confirmedMarkAllRead(e: CustomEvent<ConfirmationDialogEventDetail>) {\n // Mark All read if Confirmed True\n if (e.detail.returnValue) {\n const filterNotification = this.applyNotificationFilters();\n\n filterNotification?.forEach(item => {\n if (item.status === NotificationStatus.UNREAD)\n NotificationsState.setNotificationReadStatus(item.id);\n });\n\n this.renderUnReadCountText();\n }\n\n this.showMarkAllReadConfirmation = false;\n }\n\n toggleGroupView() {\n this.showGroupedView = !this.showGroupedView;\n }\n\n displayFilters() {\n this.showFilters = !this.showFilters;\n }\n\n /* eslint-disable-next-line */\n applyNotificationFilters() {\n const filterredNotifications = NotificationsState.notifications?.filter(\n (x: Notification) =>\n (x.resourceType === NotificationGroups.PLANNED_MAINTENANCE &&\n NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE ===\n true) ||\n (x.resourceType === NotificationGroups.SERVICE_TICKETS &&\n NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS ===\n true) ||\n (x.resourceType === NotificationGroups.DCIM_ALERTS &&\n NotificationsState.notificationFilters.SHOW_DCIM_ALERTS === true) ||\n x.resourceType === NotificationGroups.INCIDENTS\n ); // Always display incidents\n\n if (\n NotificationsState.dateFilters.FROM_DATE === undefined ||\n NotificationsState.dateFilters.TO_DATE === undefined\n )\n return filterredNotifications;\n\n return filterredNotifications.filter(\n x =>\n differenceInHours(\n new Date(x.createdAt),\n NotificationsState.dateFilters.FROM_DATE!\n ) >= 0 &&\n differenceInDays(\n new Date(x.createdAt),\n NotificationsState.dateFilters.TO_DATE!\n ) <= 0\n );\n }\n\n displayDateFilters() {\n this.showDateFilters = !this.showDateFilters;\n }\n\n renderGroupedView() {\n const filteredNotifications = this.applyNotificationFilters();\n\n return html`<div>\n <grouped-item\n groupTitle=${NotificationGroups.PLANNED_MAINTENANCE}\n iconName=\"lab_profile\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.PLANNED_MAINTENANCE\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.INCIDENTS}\n iconName=\"emergency_home\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.INCIDENTS\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.SERVICE_TICKETS}\n iconName=\"dvr\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.SERVICE_TICKETS\n )}\n ></grouped-item>\n <grouped-item\n groupTitle=${NotificationGroups.DCIM_ALERTS}\n iconName=\"public\"\n .childItems=${filteredNotifications?.filter(\n item => item.resourceType === NotificationGroups.DCIM_ALERTS\n )}\n ></grouped-item>\n </div>`;\n }\n\n renderDefaultView() {\n const filterNotification = this.applyNotificationFilters();\n const filterTodayItems = filterNotification.filter(\n x => differenceInDays(x.createdAt, new Date()) === 0\n );\n const filterEarlierItems = filterNotification.filter(\n x => differenceInDays(x.createdAt, new Date()) !== 0\n );\n\n if (filterNotification?.length! > 0) {\n return html` <div class=\"grow text-sm font-bold py-4 pl-2 align-top\">\n Latest\n </div>\n <div class=\"m-0 p-0\">\n ${filterTodayItems.length > 0\n ? filterTodayItems?.map(\n item => html`<notification-item\n .notificaiton=${item}\n ?disabled=${item.resourceType ===\n NotificationGroups.INCIDENTS}\n >\n </notification-item> `\n )\n : this.renderNoResult()}\n </div>\n <div class=\"grow text-sm font-bold py-4 pl-2 align-top\">Earlier</div>\n <div>\n ${filterEarlierItems.length > 0\n ? filterEarlierItems?.map(\n item => html`<notification-item\n .notificaiton=${item}\n ?disabled=${item.resourceType ===\n NotificationGroups.INCIDENTS}\n >\n </notification-item> `\n )\n : this.renderNoResult()}\n </div>`;\n }\n\n return html`<p class=\"m-0 pl-4 font-bold mr-4\">\n <small style=\"padding-left: 16px\">No notifications yet.</small>\n </p>`;\n }\n\n /* eslint-disable-next-line */\n renderNoResult() {\n return html`<p class=\"m-0 pl-4 font-bold mr-4\">\n <small style=\"padding-left: 16px\">No notifications yet.</small>\n </p>`;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n handleCloseClick(_e: CustomEvent<FilterDialogEventDetail>) {\n this.showDateFilters = false;\n this.showFilters = false;\n }\n\n render() {\n return html`\n <div class=\"relative\">\n <ix-icon-button\n icon=\"circle_notifications\"\n class=\"blue-icon\"\n @click=${() => this.toggleDrawer()}\n >\n </ix-icon-button>\n ${this.renderUnReadCountText()}\n </div>\n <confirmation-dialog\n ?open=${this.showMarkAllReadConfirmation}\n @confirm-dialog-closed=${() => {\n this.showMarkAllReadConfirmation = false;\n }}\n @on-confirm-selection=${this.confirmedMarkAllRead}\n textMessage=\"Are you sure you want to mark all notifications as read?\"\n >\n </confirmation-dialog>\n <ix-drawer\n ?isVisible=${this.showDrawer}\n .onClosed=${() => this.toggleDrawer()}\n animate-vertical\n hide-close\n >\n <div class=\"flex flex-row justify-between grow py-2\" slot=\"header\">\n <div class=\"grow text-xl items-center font-bold py-4 pl-2 align-top\">\n Notifications\n </div>\n <div class=\"flex flex-row justify-end grow items-center \">\n <ix-icon-button\n @click=${this.markAllread}\n icon=\"fact_check\"\n class=\"blue-icon\"\n ></ix-icon-button>\n <ix-icon-button\n @click=${this.toggleGroupView}\n icon=\"sort\"\n class=\"blue-icon\"\n ></ix-icon-button>\n <ix-icon-button\n @click=${this.displayFilters}\n icon=\"menu\"\n class=\"blue-icon\"\n ></ix-icon-button>\n <div\n class=\"filter-dropdown-content ${this.showFilters\n ? 'active z-50'\n : ''}\"\n >\n <group-filters></group-filters>\n </div>\n <ix-icon-button\n @click=${this.displayDateFilters}\n icon=\"calendar_month\"\n class=\"blue-icon\"\n ></ix-icon-button>\n <div\n class=\"datefilter-dropdown-content ${this.showDateFilters\n ? 'active z-50'\n : ''}\"\n @on-selection=${this.handleCloseClick}\n >\n <date-filters></date-filters>\n </div>\n </div>\n </div>\n <div slot=\"content\">\n ${this.showGroupedView\n ? this.renderGroupedView()\n : this.renderDefaultView()}\n </div>\n </ix-drawer>\n `;\n }\n}\n"]}
@@ -0,0 +1,83 @@
1
+ /**
2
+ * Notifications API
3
+ * An API to create and read notifications
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ * Contact: DevTeamProduct@digitalrealty.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime';
13
+ import type { GetNotifications200Response, Notification, NotificationDelete, NotificationPatch, NotificationRequest, Status } from '../models/index';
14
+ export interface CreateNotificationRequest {
15
+ notificationRequest?: NotificationRequest;
16
+ }
17
+ export interface DeleteNotificationsByIdRequest {
18
+ id: string;
19
+ }
20
+ export interface GetNotificationsRequest {
21
+ sort?: string;
22
+ cursor?: string;
23
+ resourceType?: string;
24
+ accountNumber?: string;
25
+ createdAfter?: Date;
26
+ createdBefore?: Date;
27
+ locationId?: string;
28
+ subGroup?: string;
29
+ status?: Status;
30
+ prefer?: Array<string>;
31
+ }
32
+ export interface GetNotificationsByIdRequest {
33
+ id: string;
34
+ }
35
+ export interface PatchNotificationsByIdRequest {
36
+ id: string;
37
+ notificationPatch?: NotificationPatch;
38
+ }
39
+ /**
40
+ *
41
+ */
42
+ export declare class NotificationsApi extends runtime.BaseAPI {
43
+ /**
44
+ * Submit notification to be sent to user
45
+ */
46
+ createNotificationRaw(requestParameters: CreateNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Notification>>;
47
+ /**
48
+ * Submit notification to be sent to user
49
+ */
50
+ createNotification(requestParameters?: CreateNotificationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Notification>;
51
+ /**
52
+ * Delete a notification by id
53
+ */
54
+ deleteNotificationsByIdRaw(requestParameters: DeleteNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NotificationDelete>>;
55
+ /**
56
+ * Delete a notification by id
57
+ */
58
+ deleteNotificationsById(requestParameters: DeleteNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NotificationDelete>;
59
+ /**
60
+ * Get all notifications
61
+ */
62
+ getNotificationsRaw(requestParameters: GetNotificationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GetNotifications200Response>>;
63
+ /**
64
+ * Get all notifications
65
+ */
66
+ getNotifications(requestParameters?: GetNotificationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GetNotifications200Response>;
67
+ /**
68
+ * Get an notification by id
69
+ */
70
+ getNotificationsByIdRaw(requestParameters: GetNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Notification>>;
71
+ /**
72
+ * Get an notification by id
73
+ */
74
+ getNotificationsById(requestParameters: GetNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Notification>;
75
+ /**
76
+ * Update specific fields on a notification by id
77
+ */
78
+ patchNotificationsByIdRaw(requestParameters: PatchNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NotificationPatch>>;
79
+ /**
80
+ * Update specific fields on a notification by id
81
+ */
82
+ patchNotificationsById(requestParameters: PatchNotificationsByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NotificationPatch>;
83
+ }