@digital-realty/ix-notifications 1.1.26 → 1.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/notifications/notification-item.d.ts +1 -0
- package/dist/components/notifications/notification-item.js +14 -3
- package/dist/components/notifications/notification-item.js.map +1 -1
- package/dist/components/notifications/view-item-dialog.js +13 -0
- package/dist/components/notifications/view-item-dialog.js.map +1 -1
- package/dist/constants/notifications.d.ts +5 -1
- package/dist/constants/notifications.js +4 -0
- package/dist/constants/notifications.js.map +1 -1
- package/dist/ix-notifications.min.js +1 -1
- package/package.json +2 -2
|
@@ -18,5 +18,6 @@ export declare class NotificationItem extends MobxLitElement {
|
|
|
18
18
|
calculateDuration(): string | import("lit-html").TemplateResult<1>;
|
|
19
19
|
getNotificationIcon(): import("lit-html").TemplateResult<2> | "sync_saved_locally" | "report";
|
|
20
20
|
getNotificationTitle(): string;
|
|
21
|
+
getServiceTicketSubGroup(): string;
|
|
21
22
|
render(): import("lit-html").TemplateResult<1>;
|
|
22
23
|
}
|
|
@@ -8,7 +8,7 @@ import { formatDistance } from 'date-fns/formatDistance.js';
|
|
|
8
8
|
import { differenceInHours } from 'date-fns/differenceInHours.js';
|
|
9
9
|
import { TWStyles } from '../../tw.js';
|
|
10
10
|
import { NotificationsState } from '../../state/NotificationState.js';
|
|
11
|
-
import { NotificationStatus, NotificationGroups, } from '../../constants/notifications.js';
|
|
11
|
+
import { NotificationStatus, NotificationGroups, SubGroups } from '../../constants/notifications.js';
|
|
12
12
|
import { NotificationsStyle } from '../../styles/notifications-style.js';
|
|
13
13
|
import './confirmation-dialog.js';
|
|
14
14
|
import './view-item-dialog.js';
|
|
@@ -96,12 +96,11 @@ let NotificationItem = class NotificationItem extends MobxLitElement {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
getNotificationTitle() {
|
|
99
|
-
var _a;
|
|
100
99
|
switch (this.notification.resourceType) {
|
|
101
100
|
case NotificationGroups.PLANNED_MAINTENANCE:
|
|
102
101
|
return 'Planned Maintenance';
|
|
103
102
|
case NotificationGroups.SERVICE_TICKETS:
|
|
104
|
-
return `${
|
|
103
|
+
return `${this.getServiceTicketSubGroup()} Service Ticket Update`;
|
|
105
104
|
case NotificationGroups.INCIDENTS:
|
|
106
105
|
return 'Emergency Repair';
|
|
107
106
|
case NotificationGroups.DCIM_ALERTS:
|
|
@@ -110,6 +109,18 @@ let NotificationItem = class NotificationItem extends MobxLitElement {
|
|
|
110
109
|
return 'sync_saved_locally';
|
|
111
110
|
}
|
|
112
111
|
}
|
|
112
|
+
getServiceTicketSubGroup() {
|
|
113
|
+
var _a, _b;
|
|
114
|
+
switch ((_a = this.notification) === null || _a === void 0 ? void 0 : _a.subGroup) {
|
|
115
|
+
case SubGroups.FacilityAccessVisitorAccess:
|
|
116
|
+
case SubGroups.FacilityAccessPermanentBadge:
|
|
117
|
+
case SubGroups.FacilityAccessOspAccess:
|
|
118
|
+
case SubGroups.FacilityAccessPopPoeAccess:
|
|
119
|
+
return "Facility Access";
|
|
120
|
+
default:
|
|
121
|
+
return (_b = this.notification) === null || _b === void 0 ? void 0 : _b.subGroup;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
113
124
|
/* eslint-disable lit-a11y/click-events-have-key-events */
|
|
114
125
|
render() {
|
|
115
126
|
var _a, _b;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-item.js","sourceRoot":"","sources":["../../../src/components/notifications/notification-item.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D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;8BACN,IAAI,CAAC,YAAY;yCACN,GAAG,EAAE;YAC9B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;;;;sBAIO,IAAI,CAAC,sBAAsB;sCACX,IAAI,CAAC,eAAe;uCACnB,GAAG,EAAE;YAC5B,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACzB,CAAC;;;;;;;qBAOM,IAAI,CAAC,UAAU;yBACX,CAAC,CAAM,EAAE,EAAE;YACtB,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,2BAA2B,EAAE;gBAC3C,MAAM,EAAE;oBACN,KAAK,EAAE,IAAI,CAAC,QAAQ;wBAClB,CAAC,CAAC,iDAAiD;wBACnD,CAAC,CAAC,qBAAqB;oBACzB,MAAM,EAAE,CAAC,CAAC,MAAM;iBACjB;aACF,CAAC,CACH,CAAC;QACJ,CAAC;wBACW,GAAG,EAAE,CACf,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,2BAA2B,CAAC,CAAC;wBACtD,IAAI,CAAC,QAAQ;;;;uBAId,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,kBAAkB;;gBAE3D,KAAK;;;;;KAKhB,CAAC;IACJ,CAAC;CACF,CAAA;AAhM8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAkB;AAEA;IAA7C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;sDACxB;AAEJ;IAAhB,KAAK,EAAE;mDAA2B;AAElB;IAAhB,KAAK,EAAE;gEAAwC;AARrC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CAiM5B","sourcesContent":["import { html } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-icon/ix-icon.js';\nimport { formatDistance } from 'date-fns/formatDistance.js';\nimport { differenceInHours } from 'date-fns/differenceInHours.js';\nimport { TWStyles } from '../../tw.js';\nimport { NotificationsState } from '../../state/NotificationState.js';\nimport { ApiCallResult, Notification } from '../../models/notification.js';\nimport {\n NotificationStatus,\n NotificationGroups,\n} from '../../constants/notifications.js';\nimport { ConfirmationDialogEventDetail } from '../../constants/notification-types.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\nimport './confirmation-dialog.js';\nimport './view-item-dialog.js';\nimport '@digital-realty/ix-toast/ix-message-toast.js';\nimport { dcim, plannedMaintenance, trash } from '../../assets/iconset.js';\n\n@customElement('notification-item')\nexport class NotificationItem extends MobxLitElement {\n @property({ type: Boolean }) disabled = false;\n\n @property({ type: Object, attribute: false }) notification =\n {} as Notification;\n\n @state() private showModal = false;\n\n @state() private showDeleteConfirmation = false;\n\n static get styles() {\n return [TWStyles, NotificationsStyle];\n }\n\n displayItem() {\n if (this.notification.status === NotificationStatus.UNREAD) {\n NotificationsState.setNotificationReadStatus(this.notification.id);\n }\n this.showModal = true;\n }\n\n deleteItem() {\n if (!this.disabled) {\n this.showDeleteConfirmation = true;\n }\n }\n\n private confirmedDelete(e: CustomEvent<ConfirmationDialogEventDetail>) {\n // DELETE IF CONFIRMED TRUE\n if (e.detail.returnValue) {\n NotificationsState.setNotificationDeleted(this.notification.id).then(\n (result: ApiCallResult) => {\n this.showDeleteResultMessage(result, this.notification.id);\n }\n );\n }\n this.showDeleteConfirmation = false;\n }\n\n // eslint-disable-next-line class-methods-use-this\n private showDeleteResultMessage(result: ApiCallResult, id: string) {\n window.dispatchEvent(\n new CustomEvent('add-toast', {\n detail: {\n id,\n content: html` <ix-message-toast\n toastId=${id}\n .TMessageToast=${result.State.toLowerCase()}\n forceClose\n >\n ${result.Message}\n </ix-message-toast>`,\n autoClose: 2000,\n durationOut: 2000,\n vertical: 'bottom',\n horizontal: 'center',\n animated: true,\n above: false,\n },\n })\n );\n }\n\n calculateDuration() {\n if (this.notification.createdAt !== undefined) {\n if (\n differenceInHours(new Date(), new Date(this.notification.createdAt)) <\n 24\n )\n return formatDistance(\n new Date(this.notification.createdAt),\n new Date(),\n {\n addSuffix: true,\n }\n );\n return html`<ix-date\n type=\"static\"\n variant=\"date-time\"\n .value=${this.notification.createdAt}\n ></ix-date>`;\n }\n return 'N/A';\n }\n\n getNotificationIcon() {\n switch (this.notification.resourceType) {\n case NotificationGroups.PLANNED_MAINTENANCE:\n return plannedMaintenance;\n case NotificationGroups.SERVICE_TICKETS:\n return 'sync_saved_locally';\n case NotificationGroups.INCIDENTS:\n return 'report';\n case NotificationGroups.DCIM_ALERTS:\n return dcim;\n default:\n return 'sync_saved_locally';\n }\n }\n\n getNotificationTitle() {\n switch (this.notification.resourceType) {\n case NotificationGroups.PLANNED_MAINTENANCE:\n return 'Planned Maintenance';\n case NotificationGroups.SERVICE_TICKETS:\n return `${this.notification?.subGroup} Service Ticket Update`;\n case NotificationGroups.INCIDENTS:\n return 'Emergency Repair';\n case NotificationGroups.DCIM_ALERTS:\n return 'DCIM Alert';\n default:\n return 'sync_saved_locally';\n }\n }\n\n /* eslint-disable lit-a11y/click-events-have-key-events */\n render() {\n return html`\n <div class=\"relative notification-item\">\n <div\n class=\"hover:bg-[rgba(0,0,0,0.04)] p-2 pl-3.5 flex gap-3 relative cursor-pointer items-center font-bold ${this\n .notification?.status === 'unread'\n ? 'notification-item-unread border-l-3 border-success'\n : 'notification-item-read border-l-3 border-transparent'}\"\n >\n <ix-icon\n style=\"--ix-icon-font-size: 24px;--ix-icon-line-height: 24px;\"\n icon=${this.getNotificationIcon()}\n class=${this.notification?.status === 'unread'\n ? 'active-icon'\n : 'inactive-icon'}\n @click=${this.displayItem}\n >${this.getNotificationIcon()}\n </ix-icon>\n <div class=\"flex flex-col grow\" @click=${this.displayItem}>\n <div class=\"grow text-base\">\n <h2 class=\"dlr-text-caption\">${this.getNotificationTitle()}</h2>\n </div>\n <div class=\"grow text-xs\">\n <h3 class=\"dlr-text-caption text-on-surface-disabled\">\n ${this.calculateDuration()}\n </h3>\n </div>\n </div>\n <div>\n <view-item-dialog\n ?open=${this.showModal}\n .notification=${this.notification}\n @view-item-dialog-closed=${() => {\n this.showModal = false;\n }}\n >\n </view-item-dialog>\n <confirmation-dialog\n ?open=${this.showDeleteConfirmation}\n @on-confirm-selection=${this.confirmedDelete}\n @confirm-dialog-closed=${() => {\n this.showModal = false;\n }}\n textMessage=\"Are you sure you want to delete this notification?\"\n >\n </confirmation-dialog>\n </div>\n <ix-icon-button\n style=\"--md-icon-button-icon-size:24px;\"\n @click=${this.deleteItem}\n @mouseover=${(e: any) => {\n this.dispatchEvent(\n new CustomEvent('show-notification-tooltip', {\n detail: {\n label: this.disabled\n ? 'Emergency Repair Notification cannot be removed'\n : 'Remove Notification',\n target: e.target,\n },\n })\n );\n }}\n @mouseout=${() =>\n this.dispatchEvent(new CustomEvent('hide-notification-tooltip'))}\n ?disabled=${this.disabled}\n >\n <ix-icon\n slot=\"default\"\n class=\"${this.disabled ? 'inactive-icon' : 'destructive-icon'}\"\n >\n ${trash}\n </ix-icon>\n </ix-icon-button>\n </div>\n </div>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"notification-item.js","sourceRoot":"","sources":["../../../src/components/notifications/notification-item.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,kDAAkD,CAAC;AAC1D,OAAO,oCAAoC,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,O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ElB;IAAhB,KAAK,EAAE;gEAAwC;AARrC,gBAAgB;IAD5B,aAAa,CAAC,mBAAmB,CAAC;GACtB,gBAAgB,CA8M5B","sourcesContent":["import { html } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-icon/ix-icon.js';\nimport { formatDistance } from 'date-fns/formatDistance.js';\nimport { differenceInHours } from 'date-fns/differenceInHours.js';\nimport { TWStyles } from '../../tw.js';\nimport { NotificationsState } from '../../state/NotificationState.js';\nimport { ApiCallResult, Notification } from '../../models/notification.js';\nimport {\n NotificationStatus,\n NotificationGroups,\n SubGroups\n} from '../../constants/notifications.js';\nimport { ConfirmationDialogEventDetail } from '../../constants/notification-types.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\nimport './confirmation-dialog.js';\nimport './view-item-dialog.js';\nimport '@digital-realty/ix-toast/ix-message-toast.js';\nimport { dcim, plannedMaintenance, trash } from '../../assets/iconset.js';\n\n@customElement('notification-item')\nexport class NotificationItem extends MobxLitElement {\n @property({ type: Boolean }) disabled = false;\n\n @property({ type: Object, attribute: false }) notification =\n {} as Notification;\n\n @state() private showModal = false;\n\n @state() private showDeleteConfirmation = false;\n\n static get styles() {\n return [TWStyles, NotificationsStyle];\n }\n\n displayItem() {\n if (this.notification.status === NotificationStatus.UNREAD) {\n NotificationsState.setNotificationReadStatus(this.notification.id);\n }\n this.showModal = true;\n }\n\n deleteItem() {\n if (!this.disabled) {\n this.showDeleteConfirmation = true;\n }\n }\n\n private confirmedDelete(e: CustomEvent<ConfirmationDialogEventDetail>) {\n // DELETE IF CONFIRMED TRUE\n if (e.detail.returnValue) {\n NotificationsState.setNotificationDeleted(this.notification.id).then(\n (result: ApiCallResult) => {\n this.showDeleteResultMessage(result, this.notification.id);\n }\n );\n }\n this.showDeleteConfirmation = false;\n }\n\n // eslint-disable-next-line class-methods-use-this\n private showDeleteResultMessage(result: ApiCallResult, id: string) {\n window.dispatchEvent(\n new CustomEvent('add-toast', {\n detail: {\n id,\n content: html` <ix-message-toast\n toastId=${id}\n .TMessageToast=${result.State.toLowerCase()}\n forceClose\n >\n ${result.Message}\n </ix-message-toast>`,\n autoClose: 2000,\n durationOut: 2000,\n vertical: 'bottom',\n horizontal: 'center',\n animated: true,\n above: false,\n },\n })\n );\n }\n\n calculateDuration() {\n if (this.notification.createdAt !== undefined) {\n if (\n differenceInHours(new Date(), new Date(this.notification.createdAt)) <\n 24\n )\n return formatDistance(\n new Date(this.notification.createdAt),\n new Date(),\n {\n addSuffix: true,\n }\n );\n return html`<ix-date\n type=\"static\"\n variant=\"date-time\"\n .value=${this.notification.createdAt}\n ></ix-date>`;\n }\n return 'N/A';\n }\n\n getNotificationIcon() {\n switch (this.notification.resourceType) {\n case NotificationGroups.PLANNED_MAINTENANCE:\n return plannedMaintenance;\n case NotificationGroups.SERVICE_TICKETS:\n return 'sync_saved_locally';\n case NotificationGroups.INCIDENTS:\n return 'report';\n case NotificationGroups.DCIM_ALERTS:\n return dcim;\n default:\n return 'sync_saved_locally';\n }\n }\n\n getNotificationTitle() {\n switch (this.notification.resourceType) {\n case NotificationGroups.PLANNED_MAINTENANCE:\n return 'Planned Maintenance';\n case NotificationGroups.SERVICE_TICKETS:\n return `${this.getServiceTicketSubGroup()} Service Ticket Update`;\n case NotificationGroups.INCIDENTS:\n return 'Emergency Repair';\n case NotificationGroups.DCIM_ALERTS:\n return 'DCIM Alert';\n default:\n return 'sync_saved_locally';\n }\n }\n\n getServiceTicketSubGroup()\n {\n switch(this.notification?.subGroup) {\n case SubGroups.FacilityAccessVisitorAccess: \n case SubGroups.FacilityAccessPermanentBadge:\n case SubGroups.FacilityAccessOspAccess: \n case SubGroups.FacilityAccessPopPoeAccess: \n return \"Facility Access\"; \n default:\n return this.notification?.subGroup; \n }\n }\n\n /* eslint-disable lit-a11y/click-events-have-key-events */\n render() {\n return html`\n <div class=\"relative notification-item\">\n <div\n class=\"hover:bg-[rgba(0,0,0,0.04)] p-2 pl-3.5 flex gap-3 relative cursor-pointer items-center font-bold ${this\n .notification?.status === 'unread'\n ? 'notification-item-unread border-l-3 border-success'\n : 'notification-item-read border-l-3 border-transparent'}\"\n >\n <ix-icon\n style=\"--ix-icon-font-size: 24px;--ix-icon-line-height: 24px;\"\n icon=${this.getNotificationIcon()}\n class=${this.notification?.status === 'unread'\n ? 'active-icon'\n : 'inactive-icon'}\n @click=${this.displayItem}\n >${this.getNotificationIcon()}\n </ix-icon>\n <div class=\"flex flex-col grow\" @click=${this.displayItem}>\n <div class=\"grow text-base\">\n <h2 class=\"dlr-text-caption\">${this.getNotificationTitle()}</h2>\n </div>\n <div class=\"grow text-xs\">\n <h3 class=\"dlr-text-caption text-on-surface-disabled\">\n ${this.calculateDuration()}\n </h3>\n </div>\n </div>\n <div>\n <view-item-dialog\n ?open=${this.showModal}\n .notification=${this.notification}\n @view-item-dialog-closed=${() => {\n this.showModal = false;\n }}\n >\n </view-item-dialog>\n <confirmation-dialog\n ?open=${this.showDeleteConfirmation}\n @on-confirm-selection=${this.confirmedDelete}\n @confirm-dialog-closed=${() => {\n this.showModal = false;\n }}\n textMessage=\"Are you sure you want to delete this notification?\"\n >\n </confirmation-dialog>\n </div>\n <ix-icon-button\n style=\"--md-icon-button-icon-size:24px;\"\n @click=${this.deleteItem}\n @mouseover=${(e: any) => {\n this.dispatchEvent(\n new CustomEvent('show-notification-tooltip', {\n detail: {\n label: this.disabled\n ? 'Emergency Repair Notification cannot be removed'\n : 'Remove Notification',\n target: e.target,\n },\n })\n );\n }}\n @mouseout=${() =>\n this.dispatchEvent(new CustomEvent('hide-notification-tooltip'))}\n ?disabled=${this.disabled}\n >\n <ix-icon\n slot=\"default\"\n class=\"${this.disabled ? 'inactive-icon' : 'destructive-icon'}\"\n >\n ${trash}\n </ix-icon>\n </ix-icon-button>\n </div>\n </div>\n `;\n }\n}\n"]}
|
|
@@ -44,6 +44,14 @@ let ViewItemDialog = class ViewItemDialog extends MobxLitElement {
|
|
|
44
44
|
return `/service-management/service-tickets/removals/${ticketId}`;
|
|
45
45
|
case SubGroups.Trouble_Ticket:
|
|
46
46
|
return `/service-management/service-tickets/trouble-tickets/${ticketId}`;
|
|
47
|
+
case SubGroups.FacilityAccessVisitorAccess:
|
|
48
|
+
return `/service-management/service-tickets/facility-access/visitor-access/${ticketId}`;
|
|
49
|
+
case SubGroups.FacilityAccessPermanentBadge:
|
|
50
|
+
return `/service-management/service-tickets/facility-access/permanent-badge/${ticketId}`;
|
|
51
|
+
case SubGroups.FacilityAccessOspAccess:
|
|
52
|
+
return `/service-management/service-tickets/facility-access/osp-access/${ticketId}`;
|
|
53
|
+
case SubGroups.FacilityAccessPopPoeAccess:
|
|
54
|
+
return `/service-management/service-tickets/facility-access/pop-poe-access/${ticketId}`;
|
|
47
55
|
default:
|
|
48
56
|
return '';
|
|
49
57
|
}
|
|
@@ -67,6 +75,11 @@ let ViewItemDialog = class ViewItemDialog extends MobxLitElement {
|
|
|
67
75
|
}
|
|
68
76
|
getSubGroupDisplayName() {
|
|
69
77
|
switch (this.notification.subGroup) {
|
|
78
|
+
case SubGroups.FacilityAccessVisitorAccess:
|
|
79
|
+
case SubGroups.FacilityAccessPermanentBadge:
|
|
80
|
+
case SubGroups.FacilityAccessOspAccess:
|
|
81
|
+
case SubGroups.FacilityAccessPopPoeAccess:
|
|
82
|
+
return "Facility Access";
|
|
70
83
|
case "Incidents (GSN)":
|
|
71
84
|
return "Incidents";
|
|
72
85
|
case "Emergency Repairs (InSite 1.0)":
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view-item-dialog.js","sourceRoot":"","sources":["../../../src/components/notifications/view-item-dialog.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,QAAQ,EA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C,IAAI;gBACP,IAAI,CAAC,YAAY;;;;;;cAMnB,IAAI,CAAC,YAAY,CAAC,YAAY;;;;;cAK9B,IAAI,CAAC,sBAAsB,EAAE;;;;;;;;;;;;;;;;YAgB/B,IAAI,CAAC,YAAY,CAAC,OAAO;;;;;;;;YAQzB,MAAM,CACN,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EACrC,qBAAqB,CACtB;;;;;;;;YAQC,IAAI,CAAC,WAAW,EAAE;;;;;;kBAMZ,IAAI,CAAC,MAAM,EAAE;oBACX,IAAI,CAAC,UAAU;;;;;iBAKlB,CAAC;IAChB,CAAC;CACF,CAAA;AApJ+C;IAA7C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oDACxB;AAEyB;IAA7C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;4CAAc;AARhD,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAyJ1B","sourcesContent":["import { html } from 'lit';\nimport { MobxLitElement } from '@adobe/lit-mobx';\nimport { customElement, property } from 'lit/decorators.js';\nimport '@digital-realty/ix-icon-button/ix-icon-button.js';\nimport '@digital-realty/ix-button/ix-button.js';\nimport { format } from 'date-fns/format.js';\nimport { TWStyles } from '../../tw.js';\nimport { Notification } from '../../models/notification.js';\nimport {\n NotificationGroups,\n SubGroups,\n} from '../../constants/notifications.js';\nimport { NotificationsStyle } from '../../styles/notifications-style.js';\nimport { NotificationsState } from '../../state/NotificationState.js';\n\n@customElement('view-item-dialog')\nexport class ViewItemDialog extends MobxLitElement {\n static get styles() {\n return [TWStyles, NotificationsStyle];\n }\n\n @property({ type: Object, attribute: false }) notification =\n {} as Notification;\n\n @property({ type: Boolean, attribute: true }) open = false;\n\n getUrl(): string {\n const ticketId = this.notification.resourceId;\n\n switch (this.notification.resourceType) {\n case NotificationGroups.PLANNED_MAINTENANCE:\n return `/service-management/reports?ticketId=${ticketId}`;\n case NotificationGroups.SERVICE_TICKETS:\n switch (this.notification.subGroup) {\n case SubGroups.Remote_Hands:\n return `/service-management/service-tickets/remote-hands/${ticketId}`;\n case SubGroups.Customer_Care:\n return `/service-management/service-tickets/customer-care/${ticketId}`;\n case SubGroups.Deliveries:\n return `/service-management/service-tickets/${SubGroups.Deliveries}/${ticketId}`;\n case SubGroups.Facility_Access:\n return `/service-management/service-tickets/facility-access/${ticketId}`;\n case SubGroups.Removals:\n return `/service-management/service-tickets/removals/${ticketId}`;\n case SubGroups.Trouble_Ticket:\n return `/service-management/service-tickets/trouble-tickets/${ticketId}`;\n case SubGroups.FacilityAccessVisitorAccess:\n return `/service-management/service-tickets/facility-access/visitor-access/${ticketId}`;\n case SubGroups.FacilityAccessPermanentBadge:\n return `/service-management/service-tickets/facility-access/permanent-badge/${ticketId}`;\n case SubGroups.FacilityAccessOspAccess:\n return `/service-management/service-tickets/facility-access/osp-access/${ticketId}`;\n case SubGroups.FacilityAccessPopPoeAccess:\n return `/service-management/service-tickets/facility-access/pop-poe-access/${ticketId}`;\n default:\n return '';\n }\n case NotificationGroups.INCIDENTS:\n return `/service-management/reports?ticketId=${ticketId}`;\n case NotificationGroups.DCIM_ALERTS:\n return `/dcim/${ticketId}`;\n default:\n return '';\n }\n }\n\n getLocation() {\n if (\n this.notification.locations === undefined ||\n this.notification.locations.length < 1\n ) {\n return '';\n }\n if (this.notification.locations.length > 1) {\n return 'Multiple Sites';\n }\n return this.notification.locations[0];\n }\n\n dialogClosed = () => {\n this.dispatchEvent(new CustomEvent('view-item-dialog-closed'));\n };\n\n viewRecord = () => {\n this.dialogClosed();\n NotificationsState.showDrawer = false;\n };\n\n getSubGroupDisplayName()\n {\n switch(this.notification.subGroup)\n {\n case SubGroups.FacilityAccessVisitorAccess: \n case SubGroups.FacilityAccessPermanentBadge:\n case SubGroups.FacilityAccessOspAccess: \n case SubGroups.FacilityAccessPopPoeAccess: \n return \"Facility Access\"; \n case \"Incidents (GSN)\" : \n return \"Incidents\"; \n case \"Emergency Repairs (InSite 1.0)\" : \n return \"Emergency Repairs\"; \n default:\n return this.notification.subGroup;\n }\n };\n\n render() {\n return html` <ix-dialog\n ?open=${this.open}\n @closed=${this.dialogClosed}\n class=\"notification-modal\"\n >\n <div slot=\"headline\" class=\"w-[560px]\">\n <div class=\"flex flex-col flex-start\">\n <div class=\"notification-modal-title text-2xl font-bold text-balance\">\n ${this.notification.resourceType}\n </div>\n <div\n class=\"notification-modal-subtitle pt-4 pb-0 font-bold text-balance\"\n >\n ${this.getSubGroupDisplayName()}\n </div>\n </div>\n </div>\n <form\n class=\"notification-modal-content\"\n slot=\"content\"\n id=\"form-id\"\n method=\"dialog\"\n >\n <div\n class=\"notification-modal-content-title notification-modal-subject-title\"\n >\n Subject\n </div>\n <div class=\"notification-modal-subject-text font-normal text-wrap\">\n ${this.notification.subject}\n </div>\n <div\n class=\"notification-modal-content-title notification-modal-created-date-title\"\n >\n Create Date\n </div>\n <div class=\"notification-modal-created-date-text font-normal text-wrap\">\n ${format(\n new Date(this.notification.createdAt),\n 'dd/MM/yyyy HH:mm:ss'\n )}\n </div>\n <div\n class=\"notification-modal-content-title notification-modal-site-title\"\n >\n Site\n </div>\n <div class=\"notification-modal-site-text font-normal text-wrap\">\n ${this.getLocation()}\n </div>\n </form>\n <div slot=\"actions\" class=\"flex flex-row flex-end\">\n <ix-button form=\"form-id\" appearance=\"text\"> Close </ix-button>\n <ix-button\n href=\"${this.getUrl()}\"\n @click=\"${this.viewRecord}\"\n appearance=\"text\"\n >View Record</ix-button\n >\n </div>\n </ix-dialog>`;\n }\n}\n"]}
|
|
@@ -14,7 +14,11 @@ export declare enum SubGroups {
|
|
|
14
14
|
Removals = "Removals",
|
|
15
15
|
Facility_Access = "Facility Access",
|
|
16
16
|
Trouble_Ticket = "Trouble Ticket",
|
|
17
|
-
Customer_Care = "Customer Care"
|
|
17
|
+
Customer_Care = "Customer Care",
|
|
18
|
+
FacilityAccessVisitorAccess = "FacilityAccessVisitorAccess",
|
|
19
|
+
FacilityAccessPermanentBadge = "FacilityAccessPermanentBadge",
|
|
20
|
+
FacilityAccessOspAccess = "FacilityAccessOspAccess",
|
|
21
|
+
FacilityAccessPopPoeAccess = "FacilityAccessPopPoeAccess"
|
|
18
22
|
}
|
|
19
23
|
export declare enum ApiCallState {
|
|
20
24
|
LOADING = "Loading",
|
|
@@ -19,6 +19,10 @@ export var SubGroups;
|
|
|
19
19
|
SubGroups["Facility_Access"] = "Facility Access";
|
|
20
20
|
SubGroups["Trouble_Ticket"] = "Trouble Ticket";
|
|
21
21
|
SubGroups["Customer_Care"] = "Customer Care";
|
|
22
|
+
SubGroups["FacilityAccessVisitorAccess"] = "FacilityAccessVisitorAccess";
|
|
23
|
+
SubGroups["FacilityAccessPermanentBadge"] = "FacilityAccessPermanentBadge";
|
|
24
|
+
SubGroups["FacilityAccessOspAccess"] = "FacilityAccessOspAccess";
|
|
25
|
+
SubGroups["FacilityAccessPopPoeAccess"] = "FacilityAccessPopPoeAccess";
|
|
22
26
|
})(SubGroups || (SubGroups = {}));
|
|
23
27
|
export var ApiCallState;
|
|
24
28
|
(function (ApiCallState) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/constants/notifications.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,uCAAiB,CAAA;AACnB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,iEAA2C,CAAA;IAC3C,6CAAuB,CAAA;IACvB,iDAA2B,CAAA;IAC3B,yDAAmC,CAAA;AACrC,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAED,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../src/constants/notifications.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,uCAAiB,CAAA;AACnB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B;AAED,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,iEAA2C,CAAA;IAC3C,6CAAuB,CAAA;IACvB,iDAA2B,CAAA;IAC3B,yDAAmC,CAAA;AACrC,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAED,MAAM,CAAN,IAAY,SAWX;AAXD,WAAY,SAAS;IACnB,0CAA6B,CAAA;IAC7B,sCAAyB,CAAA;IACzB,kCAAqB,CAAA;IACrB,gDAAmC,CAAA;IACnC,8CAAiC,CAAA;IACjC,4CAA+B,CAAA;IAC/B,wEAA2D,CAAA;IAC3D,0EAA6D,CAAA;IAC7D,gEAAmD,CAAA;IACnD,sEAAyD,CAAA;AAC3D,CAAC,EAXW,SAAS,KAAT,SAAS,QAWpB;AAED,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,+BAAe,CAAA;IACf,mCAAmB,CAAA;AACrB,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC;AAE5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAErC,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC","sourcesContent":["/* eslint-disable */\nexport enum NotificationStatus {\n READ = 'read',\n UNREAD = 'unread',\n}\n\nexport enum NotificationGroups {\n PLANNED_MAINTENANCE = 'Planned Maintenance',\n INCIDENTS = 'Incidents',\n DCIM_ALERTS = 'DCIM Alerts',\n SERVICE_TICKETS = 'Service Tickets',\n}\n\nexport enum SubGroups {\n Remote_Hands = 'Remote Hands',\n Deliveries = 'Deliveries',\n Removals = 'Removals',\n Facility_Access = 'Facility Access',\n Trouble_Ticket = 'Trouble Ticket',\n Customer_Care = 'Customer Care',\n FacilityAccessVisitorAccess = 'FacilityAccessVisitorAccess',\n FacilityAccessPermanentBadge = 'FacilityAccessPermanentBadge',\n FacilityAccessOspAccess = 'FacilityAccessOspAccess',\n FacilityAccessPopPoeAccess = 'FacilityAccessPopPoeAccess',\n}\n\nexport enum ApiCallState {\n LOADING = 'Loading',\n ERROR = 'Error',\n SUCCESS = 'Success',\n}\n\nexport const DefaultDateFormat = 'yyyy-MM-dd';\n\nexport const DefaultTimeFormat = 'HH:mm:ss';\n\nexport const DefaultDisplayDays = 30;\n\nexport const DefaultDateTimeFormat = 'yyyy-MM-dd HH:mm:ss';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{svg,css,html,nothing}from"lit";import{property,customElement,state,query}from"lit/decorators.js";import{MobxLitElement}from"@adobe/lit-mobx";import{differenceInDays}from"date-fns/differenceInDays.js";import{differenceInHours}from"date-fns/differenceInHours.js";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-drawer/ix-drawer.js";import"@digital-realty/ix-icon";import"@material/web/icon/icon.js";import{makeAutoObservable}from"mobx";import{makePersistable,isHydrated,hydrateStore,clearPersistedStore,getPersistedStore}from"mobx-persist-store";import{parse}from"date-fns/parse.js";import{subDays}from"date-fns/subDays.js";import{format}from"date-fns/format.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import"@digital-realty/ix-icon/ix-icon.js";import{formatDistance}from"date-fns/formatDistance.js";import"@digital-realty/ix-toast/ix-message-toast.js";import{unsafeSVG}from"lit/directives/unsafe-svg.js";import"@digital-realty/ix-switch/ix-switch.js";import"@digital-realty/ix-date/ix-date.js";import"@digital-realty/ix-divider/ix-divider.js";import{computePosition}from"@floating-ui/dom";import{classMap}from"lit/directives/class-map.js";let viewList=svg`<svg viewBox="0 0 24 24"><path d="M3 9H7V5H3V9ZM7 14H3V10H7V14ZM7 19H3V15H7V19ZM20 14H8V10H20V14ZM8 19H20V15H8V19ZM8 9V5H20V9H8Z"/></svg>`,dcim=svg`<svg viewBox="0 0 24 24"><path d="M20 0C17.791 0 16 1.791 16 4C16 6.857 20 11 20 11C20 11 24 6.857 24 4C24 1.791 22.209 0 20 0ZM12 2C6.486 2 2 6.486 2 12C2 17.514 6.486 22 12 22C17.514 22 22 17.514 22 12C22 11.93 21.9912 11.862 21.9902 11.793C21.7532 12.059 21.5575 12.2677 21.4395 12.3887L19.6504 14.3047C19.4484 14.9657 19.1695 15.5919 18.8145 16.1699C18.4985 15.4819 17.806 15 17 15H16V13C16 12.447 15.552 12 15 12H9V10H10C10.552 10 11 9.553 11 9V7.02344L13.0156 7.00781C13.5986 7.00381 14.1175 6.74289 14.4805 6.33789C14.3145 5.89389 14.1875 5.445 14.1035 5L9.99219 5.03125C9.44319 5.03525 9 5.48225 9 6.03125V8H8C7.448 8 7 8.447 7 9V10.1855L4.98047 8.16797C6.34047 5.68697 8.977 4 12 4H14C14 3.397 14.0908 2.81658 14.2578 2.26758C13.5308 2.09858 12.777 2 12 2ZM20 2.57031C20.789 2.57031 21.4297 3.211 21.4297 4C21.4297 4.789 20.789 5.42969 20 5.42969C19.211 5.42969 18.5703 4.789 18.5703 4C18.5703 3.211 19.211 2.57031 20 2.57031ZM4.20703 10.2207L9 15.0137V16C9 17.103 9.897 18 11 18V19.9316C7.06 19.4366 4 16.072 4 12C4 11.388 4.07603 10.7947 4.20703 10.2207ZM10.7793 14H14V16C14 16.553 14.448 17 15 17H17V18.2344C15.875 19.1384 14.502 19.7417 13 19.9297V17C13 16.447 12.552 16 12 16H11V14.5996C11 14.3776 10.9123 14.174 10.7793 14Z"/></svg>`,plannedMaintenance=svg`<svg viewBox="0 0 24 24"><path d="M6 2C4.90575 2 4 2.90575 4 4V20C4 21.0943 4.90575 22 6 22H11V20H6V4H13V9H18V13H20V8L14 2H6ZM12 11V14H15C15 12.343 13.641 11.031 12 11ZM11 12C9.343 12 8 13.343 8 15C8 16.657 9.343 18 11 18C12.657 18 13.969 16.641 14 15H11V12ZM16 15V21H13C13 22.654 14.346 24 16 24H21C22.645 24 24 22.645 24 21V15H16ZM18 17H22V21C22 21.565 21.565 22 21 22C20.449 22 20 21.552 20 21H18V17Z"/></svg>`,trash=svg`<svg viewBox="0 0 24 24"><path d="M15.5 4H19V6H5V4H8.5L9.5 3H14.5L15.5 4ZM8 21C6.9 21 6 20.1 6 19V7H18V19C18 20.1 17.1 21 16 21H8Z"/></svg>`,sortCheck=(svg`<svg viewBox="0 0 24 24"><path d="M11 12C13.21 12 15 10.21 15 8C15 5.79 13.21 4 11 4C8.79 4 7 5.79 7 8C7 10.21 8.79 12 11 12ZM9 17L12 14.06C11.61 14.02 11.32 14 11 14C8.33 14 3 15.34 3 18V20H12L9 17ZM12 17L15.47 20.5L22 13.91L20.6 12.5L15.47 17.67L13.4 15.59L12 17Z"/></svg>`,svg`<svg viewbox="0 0 24 24"><path d="M 3,6 V 8 H 21 V 6 Z M 3,18 H 9 V 16 H 3 Z M 15,13 H 3 v -2 h 12 z"/><rect x="8" y="0.5" width="16" height="16" rx="8"/><path d="M 14.5,10.585 12.415,8.50001 11.705,9.20501 14.5,12 l 6,-5.99999 -0.705,-0.705 z" style="fill:#fff"/></svg>`),TWStyles=css`*,::after,::before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}::after,::before{--tw-content:''}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.dlr-text-default,:host,:host :root,:root,html{font-family:var(--root-primary-font);font-size:var(--text-default-size);line-height:var(--text-default-line-height);letter-spacing:var(--text-default-letter-spacing);font-weight:var(--text-default-weight);-webkit-text-decoration:var(--text-default-decoration);text-decoration:var(--text-default-decoration);text-transform:var(--text-default-transform)}.dlr-text-heading{font-family:var(--root-secondary-font);font-size:var(--text-heading-size);line-height:var(--text-heading-line-height);letter-spacing:var(--text-heading-letter-spacing);font-weight:var(--text-heading-weight);-webkit-text-decoration:var(--text-heading-decoration);text-decoration:var(--text-heading-decoration);text-transform:var(--text-heading-transform)}.dlr-text-caption{font-family:var(--root-primary-font);font-size:var(--text-caption-size);line-height:var(--text-caption-line-height);letter-spacing:var(--text-caption-letter-spacing);font-weight:var(--text-caption-weight);-webkit-text-decoration:var(--text-caption-decoration);text-decoration:var(--text-caption-decoration);text-transform:var(--text-caption-transform)}.static{position:static}.absolute{position:absolute}.relative{position:relative}.z-50{z-index:50}.z-\\[9999\\]{z-index:9999}.m-0{margin:0}.m-4{margin:1rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-4{margin-bottom:1rem}.ml-14{margin-left:3.5rem}.mr-4{margin-right:1rem}.flex{display:flex}.hidden{display:none}.w-\\[560px\\]{width:560px}.w-\\[580px\\]{width:580px}.grow{flex-grow:1}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.whitespace-nowrap{white-space:nowrap}.text-wrap{text-wrap:wrap}.text-balance{text-wrap:balance}.rounded{border-radius:.25rem}.border-b{border-bottom-width:1px}.border-l-3{border-left-width:3px}.border-outline{border-color:var(--cp-neutral-blue-12p)}.border-success{border-color:var(--cp-success-50)}.border-transparent{border-color:transparent}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-0{padding-bottom:0}.pl-1{padding-left:.25rem}.pl-3\\.5{padding-left:.875rem}.pl-4{padding-left:1rem}.pr-1{padding-right:.25rem}.pt-4{padding-top:1rem}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.text-on-surface-disabled{color:var(--cp-neutral-blue-50p)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:150ms}.hover\\:bg-\\[rgba\\(0\\2c 0\\2c 0\\2c 0\\.04\\)\\]:hover{background-color:rgba(0,0,0,.04)}.hover\\:bg-primary-subtle:hover{background-color:var(--cp-dlr-blue-10p)}@media (min-width:640px){.sm\\:flex-col{flex-direction:column}}@media (min-width:768px){.md\\:flex-col{flex-direction:column}}@media (min-width:1024px){.lg\\:flex-col{flex-direction:column}}@media (min-width:1280px){.xl\\:flex-row{flex-direction:row}}`;var NotificationStatus,NotificationGroups,SubGroups,ApiCallState;(t=>{t.READ="read",t.UNREAD="unread"})(NotificationStatus=NotificationStatus||{}),(t=>{t.PLANNED_MAINTENANCE="Planned Maintenance",t.INCIDENTS="Incidents",t.DCIM_ALERTS="DCIM Alerts",t.SERVICE_TICKETS="Service Tickets"})(NotificationGroups=NotificationGroups||{}),(t=>{t.Remote_Hands="Remote Hands",t.Deliveries="Deliveries",t.Removals="Removals",t.Facility_Access="Facility Access",t.Trouble_Ticket="Trouble Ticket",t.Customer_Care="Customer Care"})(SubGroups=SubGroups||{}),(t=>{t.LOADING="Loading",t.ERROR="Error",t.SUCCESS="Success"})(ApiCallState=ApiCallState||{});let DefaultDateFormat="yyyy-MM-dd",DefaultDisplayDays=30,DefaultDateTimeFormat="yyyy-MM-dd HH:mm:ss",BASE_PATH="http://api.digitalrealty.com/notifications".replace(/\/+$/,"");class Configuration{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return null!=this.configuration.basePath?this.configuration.basePath:BASE_PATH}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||querystring}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){let t=this.configuration.apiKey;if(t)return"function"==typeof t?t:()=>t}get accessToken(){let t=this.configuration.accessToken;if(t)return"function"==typeof t?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}let DefaultConfig=new Configuration;class BaseAPI{constructor(t=DefaultConfig){this.configuration=t,this.fetchApi=async(t,e)=>{let i={url:t,init:e};for(var o of this.middleware)o.pre&&(i=await o.pre({fetch:this.fetchApi,...i})||i);let a=void 0;try{a=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(t){for(var r of this.middleware)r.onError&&(a=await r.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:t,response:a?a.clone():void 0})||a);if(void 0===a)throw t instanceof Error?new FetchError(t,"The request failed and the interceptors did not return an alternative response"):t}for(var n of this.middleware)n.post&&(a=await n.post({fetch:this.fetchApi,url:i.url,init:i.init,response:a.clone()})||a);return a},this.middleware=t.middleware}withMiddleware(...t){var e=this.clone();return e.middleware=e.middleware.concat(...t),e}withPreMiddleware(...t){t=t.map(t=>({pre:t}));return this.withMiddleware(...t)}withPostMiddleware(...t){t=t.map(t=>({post:t}));return this.withMiddleware(...t)}isJsonMime(t){return!!t&&BaseAPI.jsonRegex.test(t)}async request(t,e){var{url:t,init:e}=await this.createFetchParams(t,e),t=await this.fetchApi(t,e);if(t&&200<=t.status&&t.status<300)return t;throw new ResponseError(t,"Response returned an error code")}async createFetchParams(t,e){let i=this.configuration.basePath+t.path,o=(void 0!==t.query&&0!==Object.keys(t.query).length&&(i+="?"+this.configuration.queryParamsStringify(t.query)),Object.assign({},this.configuration.headers,t.headers));Object.keys(o).forEach(t=>void 0===o[t]?delete o[t]:{});var a="function"==typeof e?e:async()=>e,r={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...r,...await a({init:r,context:t})};let n;n=!(isFormData(a.body)||a.body instanceof URLSearchParams||isBlob(a.body))&&this.isJsonMime(o["Content-Type"])?JSON.stringify(a.body):a.body;r={...a,body:n};return{url:i,init:r}}clone(){var t=new this.constructor(this.configuration);return t.middleware=this.middleware.slice(),t}}function isBlob(t){return"undefined"!=typeof Blob&&t instanceof Blob}function isFormData(t){return"undefined"!=typeof FormData&&t instanceof FormData}BaseAPI.jsonRegex=new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$","i");class ResponseError extends Error{constructor(t,e){super(e),this.response=t,this.name="ResponseError"}}class FetchError extends Error{constructor(t,e){super(e),this.cause=t,this.name="FetchError"}}class RequiredError extends Error{constructor(t,e){super(e),this.field=t,this.name="RequiredError"}}let COLLECTION_FORMATS={csv:",",ssv:" ",tsv:"\t",pipes:"|"};function exists(t,e){t=t[e];return null!=t}function querystring(e,i=""){return Object.keys(e).map(t=>querystringSingleKey(t,e[t],i)).filter(t=>0<t.length).join("&")}function querystringSingleKey(t,e,i=""){var o,a=i+(i.length?`[${t}]`:t);return e instanceof Array?(o=e.map(t=>encodeURIComponent(String(t))).join(`&${encodeURIComponent(a)}=`),encodeURIComponent(a)+"="+o):e instanceof Set?querystringSingleKey(t,Array.from(e),i):e instanceof Date?encodeURIComponent(a)+"="+encodeURIComponent(e.toISOString()):e instanceof Object?querystring(e,a):encodeURIComponent(a)+"="+encodeURIComponent(String(e))}class JSONApiResponse{constructor(t,e=t=>t){this.raw=t,this.transformer=e}async value(){return this.transformer(await this.raw.json())}}class VoidApiResponse{constructor(t){this.raw=t}async value(){}}function StatusFromJSON(t){return StatusFromJSONTyped(t)}function StatusFromJSONTyped(t,e){return t}function StatusToJSON(t){return t}function NotificationFromJSON(t){return NotificationFromJSONTyped(t)}function NotificationFromJSONTyped(t,e){return null==t?t:{id:exists(t,"id")?t.id:void 0,resourceType:exists(t,"resource_type")?t.resource_type:void 0,subGroup:exists(t,"sub_group")?t.sub_group:void 0,createdAt:exists(t,"created_at")?null===t.created_at?null:new Date(t.created_at):void 0,createdBy:exists(t,"created_by")?t.created_by:void 0,subject:exists(t,"subject")?t.subject:void 0,locations:exists(t,"locations")?t.locations:void 0,resourceId:exists(t,"resource_id")?t.resource_id:void 0,status:exists(t,"status")?StatusFromJSON(t.status):void 0,accountNumber:exists(t,"account_number")?t.account_number:void 0}}function GetNotifications200ResponseFromJSON(t){return GetNotifications200ResponseFromJSONTyped(t)}function GetNotifications200ResponseFromJSONTyped(t,e){return null==t?t:{self:exists(t,"self")?t.self:void 0,first:exists(t,"first")?t.first:void 0,prev:exists(t,"prev")?t.prev:void 0,next:exists(t,"next")?t.next:void 0,last:exists(t,"last")?t.last:void 0,items:t.items.map(NotificationFromJSON)}}function NotificationPatchFromJSON(t){return NotificationPatchFromJSONTyped(t)}function NotificationPatchFromJSONTyped(t,e){return null==t?t:{status:StatusFromJSON(t.status)}}function NotificationPatchToJSON(t){if(void 0!==t)return null===t?null:{status:StatusToJSON(t.status)}}function NotificationRequestToJSON(t){if(void 0!==t)return null===t?null:{resource_type:t.resourceType,sub_group:t.subGroup,recipients:t.recipients,account_number:t.accountNumber,locations:t.locations,resource_id:t.resourceId,subject:t.subject,created_at:void 0===t.createdAt?void 0:null===t.createdAt?null:t.createdAt.toISOString()}}class NotificationsApi extends BaseAPI{async createNotificationRaw(t,e){var i={"Content-Type":"application/json"},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications",method:"POST",headers:i,query:{},body:NotificationRequestToJSON(t.notificationRequest)},e));return new JSONApiResponse(o,t=>NotificationFromJSON(t))}async createNotification(t={},e){return(await this.createNotificationRaw(t,e)).value()}async deleteNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling deleteNotificationsById.");var i={},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"DELETE",headers:i,query:{}},e));return new VoidApiResponse(o)}async deleteNotificationsById(t,e){await this.deleteNotificationsByIdRaw(t,e)}async getNotificationsRaw(t,e){var i={},o=(void 0!==t.sort&&(i.sort=t.sort),void 0!==t.cursor&&(i.cursor=t.cursor),void 0!==t.resourceType&&(i.resource_type=t.resourceType),void 0!==t.accountNumber&&(i.account_number=t.accountNumber),void 0!==t.createdAfter&&(i.created_after=t.createdAfter.toISOString()),void 0!==t.createdBefore&&(i.created_before=t.createdBefore.toISOString()),void 0!==t.locationId&&(i.location_id=t.locationId),void 0!==t.subGroup&&(i.sub_group=t.subGroup),void 0!==t.status&&(i.status=t.status),{}),t=(t.prefer&&(o.Prefer=t.prefer.join(COLLECTION_FORMATS.csv)),this.configuration&&this.configuration.accessToken&&(t=await(0,this.configuration.accessToken)("bearerToken",[]))&&(o.Authorization="Bearer "+t),await this.request({path:"/notifications",method:"GET",headers:o,query:i},e));return new JSONApiResponse(t,t=>GetNotifications200ResponseFromJSON(t))}async getNotifications(t={},e){return(await this.getNotificationsRaw(t,e)).value()}async getNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling getNotificationsById.");var i={},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:i,query:{}},e));return new JSONApiResponse(o,t=>NotificationFromJSON(t))}async getNotificationsById(t,e){return(await this.getNotificationsByIdRaw(t,e)).value()}async patchNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling patchNotificationsById.");var i={"Content-Type":"application/json"},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"PATCH",headers:i,query:{},body:NotificationPatchToJSON(t.notificationPatch)},e));return new JSONApiResponse(o,t=>NotificationPatchFromJSON(t))}async patchNotificationsById(t,e){return(await this.patchNotificationsByIdRaw(t,e)).value()}}let APIEndpointPrefixes={Notifications:"notifications"};class ApiClient{constructor(t){this.noInit=!1,this.configuration=t}get notificationsApi(){return new NotificationsApi(new Configuration({basePath:this.configuration.NotificationApiUrl+"/"+APIEndpointPrefixes.Notifications,headers:{Authorization:this.getAuthorization()}}))}getAuthorization(){return this.configuration.getAuthorizationFn?this.configuration.getAuthorizationFn():""}}let isNullOrUndefinedOrEmpty=t=>null==t||""===t,mapResourceTypeToNotificationGroups=t=>{switch(t.toLowerCase()){case"planned maintenance":return NotificationGroups.PLANNED_MAINTENANCE;case"incidents":return NotificationGroups.INCIDENTS;case"dcim alerts":return NotificationGroups.DCIM_ALERTS;case"service tickets":return NotificationGroups.SERVICE_TICKETS;default:return NotificationGroups.PLANNED_MAINTENANCE}},mapStringToNotificationStatus=t=>{switch(t.toLowerCase()){case"unread":return NotificationStatus.UNREAD;case"read":return NotificationStatus.READ;default:return NotificationStatus.UNREAD}},mapParametersToNotificationRequest=t=>({sort:"-created_at",cursor:t,prefer:[""]}),mapParametersToPatchNotificationRequest=(t,e)=>({id:t,notificationPatch:{status:e}}),mapParametersToDeleteNotificationRequest=t=>({id:t}),mapNotificationDataToNotification=t=>{var e;return{subject:null!=(e=t.subject)?e:"",id:t.id,accountNumber:null!=(e=t.accountNumber)?e:"",resourceType:mapResourceTypeToNotificationGroups(null!=(e=t.resourceType)?e:""),subGroup:null!=(e=t.subGroup)?e:"",resourceId:null!=(e=t.resourceId)?e:"",status:mapStringToNotificationStatus(null!=(e=t.status)?e:""),createdAt:isNullOrUndefinedOrEmpty(t.createdAt)?format(new Date,DefaultDateTimeFormat):format(t.createdAt,DefaultDateTimeFormat),createdBy:null!=(e=t.createdBy)?e:"",locations:null!=(e=t.locations)?e:[]}},mapNotificationResponseToNotifications=t=>t.map(t=>mapNotificationDataToNotification(t)),getNextPageCursorfromQueryParam=t=>{t=new URLSearchParams(t),t=t.has("cursor")?t.get("cursor"):"";return null!==t?t:""},handleError=async(e,t=!0)=>{if(e instanceof ResponseError&&400===e.response.status)try{var i=(await e.response.json()).detail;t&&console.error(i)}catch(t){console.error(e)}else console.error(e)},getLocalStorageUser=t=>{t=localStorage.getItem(t);return t?JSON.parse(t):null},getUserAuthorization=t=>"Bearer "+(null==(t=getLocalStorageUser(t))?void 0:t.access_token);class NotificationState{constructor(){this.showDrawer=!1,this.apiClient={noInit:!0},this.baseApiUrl="",this.localStorageKey="",this.NewApiClient=()=>{this.apiClient=new ApiClient({NotificationApiUrl:this.baseApiUrl,getAuthorizationFn:()=>getUserAuthorization(this.localStorageKey)}),this.getNotifications()},this.nextPageCursor="",this.notifications=[],this.unreadNotificationCount=0,this.notificationFilters={SHOW_PLANNED_MAINTENANCE:!0,SHOW_SERVICE_TICKETS:!0,SHOW_DCIM_ALERTS:!0},this.selectedNotification={id:"",resourceType:NotificationGroups.PLANNED_MAINTENANCE,subGroup:"",subject:"",resourceId:"",locations:[],createdAt:"",accountNumber:"",createdBy:"",status:NotificationStatus.READ},this.dateFilters={FROM_DATE:subDays(new Date,DefaultDisplayDays),TO_DATE:new Date},makeAutoObservable(this),makePersistable(this,{name:"notification-state",properties:["notificationFilters","nextPageCursor"],storage:window.localStorage})}get isHydrated(){return isHydrated(this)}async hydrateStore(){await hydrateStore(this)}async clearStoredData(){await clearPersistedStore(this)}async getStoredData(){return getPersistedStore(this)}ConstructApiClient(){return this.apiClient.noInit?this.NewApiClient():this.apiClient}async clearStoredNotificationsData(){this.notifications=[],this.unreadNotificationCount=0,this.nextPageCursor=""}async setNotificationReadStatus(e){var t,i=await this.setNotificationAsRead(e.toString());return!0===await i&&(this.ReduceUnreadNotificationCount(),t=this.notifications.findIndex(t=>t.id===e),this.notifications[t].status=NotificationStatus.READ,this.selectedNotification=this.notifications[t]),i}async setNotificationDeleted(e){var t,i=await this.DeleteNotification(e.toString());return!0===i&&("unread"===(null==(t=this.notifications.find(t=>t.id===e))?void 0:t.status)&&this.ReduceUnreadNotificationCount(),t=this.notifications.findIndex(t=>t.id===e),this.notifications.splice(t,1)),{State:!0===i?ApiCallState.SUCCESS:ApiCallState.ERROR,Message:!0===i?"Successfully deleted the notification":"Error while deleting the notification"}}setNotificationDateFilter(t,e){this.dateFilters.FROM_DATE=void 0!==t?parse(t,DefaultDateFormat,new Date):void 0,this.dateFilters.TO_DATE=void 0!==e?parse(e,DefaultDateFormat,new Date):void 0}setNotificationFilter(t,e){switch(t){case NotificationGroups.PLANNED_MAINTENANCE:this.notificationFilters.SHOW_PLANNED_MAINTENANCE=e;break;case NotificationGroups.SERVICE_TICKETS:this.notificationFilters.SHOW_SERVICE_TICKETS=e;break;case NotificationGroups.DCIM_ALERTS:this.notificationFilters.SHOW_DCIM_ALERTS=e}}async getNotifications(){var t;void 0!==this.nextPageCursor&&(t=await(null==(t=this.apiClient)?void 0:t.notificationsApi.getNotificationsRaw(mapParametersToNotificationRequest(getNextPageCursorfromQueryParam(this.nextPageCursor))).catch(t=>{handleError(t,!1)})))&&(t=await(null==t?void 0:t.value()),this.notifications=""===this.nextPageCursor?mapNotificationResponseToNotifications(null==t?void 0:t.items):this.notifications.concat(mapNotificationResponseToNotifications(null==t?void 0:t.items)),this.nextPageCursor=void 0===(null==t?void 0:t.next)||null==t?void 0:t.next,this.unreadNotificationCount=this.notifications.filter(t=>t.status===NotificationStatus.UNREAD).length)}async getNotificationsById(t){let e,i;(i=t?await(null==(e=this.apiClient)?void 0:e.notificationsApi.getNotificationsById({id:t}).catch(t=>{handleError(t,!1)})):i)&&(this.selectedNotification=mapNotificationDataToNotification(i))}async setNotificationAsRead(t){var e;return!!t&&(await(null==(e=this.apiClient)?void 0:e.notificationsApi.patchNotificationsById(mapParametersToPatchNotificationRequest(t,"read")).catch(t=>(handleError(t,!1),!1))),!0)}async DeleteNotification(t){let e,i=!1;return t&&await(null==(e=this.apiClient)?void 0:e.notificationsApi.deleteNotificationsById(mapParametersToDeleteNotificationRequest(t)).catch(t=>{handleError(t,!1),i=!1}).then(()=>{i=!0})),i}ReduceUnreadNotificationCount(){0<this.unreadNotificationCount&&--this.unreadNotificationCount}}let NotificationsState=new NotificationState,NotificationsStyle=css`:host{--ix-drawer-border-radius:0;--ix-drawer-padding:0;--ix-draw-width-sm:320px;--ix-draw-width-lg:400px}.destructive-icon{color:var(--clr-critical,#db0028);--md-icon-button-icon-color:var(--clr-critical, #DB0028);--md-sys-color-on-surface-variant:var(--clr-critical, #DB0028)}.destructive-icon path{fill:var(--clr-critical,#db0028)}.active-icon{color:var(--clr-primary,#1456e0);--md-icon-button-icon-color:var(--clr-primary, #1456E0);--md-sys-color-on-surface-variant:var(--clr-primary, #1456E0)}.active-icon path{fill:var(--clr-primary,#1456e0)}.inactive-icon{color:var(--clr-on-surface,#092241);--md-icon-button-icon-color:var(--clr-on-surface, #092241);--md-sys-color-on-surface-variant:var(--clr-on-surface, #092241);cursor:default;opacity:.6}.inactive-icon path{fill:var(--clr-on-surface,#092241);opacity:.6}ix-icon-button.sharp{--md-icon-font:'Material Symbols Sharp'!important}.ix-icon-groups{--ix-icon-font-size:32px;--ix-icon-line-height:32px}.ix-icon-groups ix-icon{color:var(--clr-on-surface,#092241);opacity:.6}.ix-icon-groups ix-icon path{fill:var(--clr-on-surface,#092241)}.datefilter-dropdown-content,.filter-dropdown-content{position:absolute;right:5%;top:3rem;box-shadow:0 8px 16px 0 rgba(0,0,0,.2);z-index:3;transition:box-shadow .3s cubic-bezier(.4,0,.2,1) 0s;border-radius:3px;box-shadow:rgba(0,0,0,.2) 0 5px 5px -3px,rgba(0,0,0,.14) 0 8px 10px 1px,rgba(0,0,0,.12) 0 3px 14px 2px;background-color:var(--clr-surface-container-lowest,#fff)}.unread{font-family:var(--root-primary-font, 'sans-serif');padding:0 5px;font-size:var(--text-caption-size,.75rem);line-height:var(--text-caption-line-height,1.33333333em);left:22px;top:0;background:var(--clr-critical,#db0028);letter-spacing:var(--text-caption-letter-spacing,.03333333em)}.notification-tooltip{background-color:var(--cp-neutral-blue-4,#040d19);white-space:nowrap;font-size:var(--text-caption-size,.75rem);z-index:9999;color:var(--clr-on-secondary,#fff)}.notification-modal-subtitle,.notification-modal-title{color:var(--clr-on-surface,#092241);font-family:var(--root-secondary-font, 'sans-serif')}.notification-modal-subtitle{font-size:var(--text-heading-size,1.25rem);line-height:var(--text-heading-line-height,1.2em)}.notification-modal-content{display:inline-grid;grid-template-columns:fit-content(183px) 1fr;grid-template-rows:auto auto;grid-column-gap:24px;grid-row-gap:8px;font-family:var(--root-primary-font, 'sans-serif');font-size:var(--text-default-size,16px);line-height:28px;width:560px;padding-bottom:16px;color:var(--clr-on-surface,#092241)}.notification-modal-content-title{width:183px;color:var(--clr-on-surface-variant,#092241B3)}.notification-modal-subject-title{grid-area:1/1/2/2}.notification-modal-subject-text{grid-area:1/2/2/3}.notification-modal-created-date-title{grid-area:2/1/3/2}.notification-modal-created-date-text{grid-area:2/2/3/3}.notification-modal-site-title{grid-area:3/1/4/2}.notification-modal-site-text{grid-area:3/2/4/3}`,ConfirmationDialog=class extends MobxLitElement{constructor(){super(...arguments),this.textMessage="Are you sure?",this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("confirm-dialog-closed"))}}static get styles(){return[TWStyles,NotificationsStyle]}onClick(t){t=new CustomEvent("on-confirm-selection",{detail:{returnValue:t},bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return html`<ix-dialog ?open="${this.open}" class="w-[580px]" @closed="${this.dialogClosed}"><div slot="headline">${this.textMessage}</div><div slot="actions"><div class="flex flex-row justify-end p-1"><ix-button name="cancel" appearance="text" @click="${()=>this.onClick(!1)}">DISMISS</ix-button><ix-button name="confirm" appearance="text" @click="${()=>this.onClick(!0)}">YES</ix-button></div></div></ix-dialog>`}},ViewItemDialog=(__decorate([property({type:String,attribute:!0})],ConfirmationDialog.prototype,"textMessage",void 0),__decorate([property({type:Boolean,attribute:!0})],ConfirmationDialog.prototype,"open",void 0),ConfirmationDialog=__decorate([customElement("confirmation-dialog")],ConfirmationDialog),class extends MobxLitElement{constructor(){super(...arguments),this.notification={},this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("view-item-dialog-closed"))},this.viewRecord=()=>{this.dialogClosed(),NotificationsState.showDrawer=!1}}static get styles(){return[TWStyles,NotificationsStyle]}getUrl(){var t=this.notification.resourceId;switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return"/service-management/reports?ticketId="+t;case NotificationGroups.SERVICE_TICKETS:switch(this.notification.subGroup){case SubGroups.Remote_Hands:return"/service-management/service-tickets/remote-hands/"+t;case SubGroups.Customer_Care:return"/service-management/service-tickets/customer-care/"+t;case SubGroups.Deliveries:return`/service-management/service-tickets/${SubGroups.Deliveries}/`+t;case SubGroups.Facility_Access:return"/service-management/service-tickets/facility-access/"+t;case SubGroups.Removals:return"/service-management/service-tickets/removals/"+t;case SubGroups.Trouble_Ticket:return"/service-management/service-tickets/trouble-tickets/"+t;default:return""}case NotificationGroups.INCIDENTS:return"/service-management/reports?ticketId="+t;case NotificationGroups.DCIM_ALERTS:return"/dcim/"+t;default:return""}}getLocation(){return void 0===this.notification.locations||this.notification.locations.length<1?"":1<this.notification.locations.length?"Multiple Sites":this.notification.locations[0]}getSubGroupDisplayName(){switch(this.notification.subGroup){case"Incidents (GSN)":return"Incidents";case"Emergency Repairs (InSite 1.0)":return"Emergency Repairs";default:return this.notification.subGroup}}render(){return html`<ix-dialog ?open="${this.open}" @closed="${this.dialogClosed}" class="notification-modal"><div slot="headline" class="w-[560px]"><div class="flex flex-col flex-start"><div class="notification-modal-title text-2xl font-bold text-balance">${this.notification.resourceType}</div><div class="notification-modal-subtitle pt-4 pb-0 font-bold text-balance">${this.getSubGroupDisplayName()}</div></div></div><form class="notification-modal-content" slot="content" id="form-id" method="dialog"><div class="notification-modal-content-title notification-modal-subject-title">Subject</div><div class="notification-modal-subject-text font-normal text-wrap">${this.notification.subject}</div><div class="notification-modal-content-title notification-modal-created-date-title">Create Date</div><div class="notification-modal-created-date-text font-normal text-wrap">${format(new Date(this.notification.createdAt),"dd/MM/yyyy HH:mm:ss")}</div><div class="notification-modal-content-title notification-modal-site-title">Site</div><div class="notification-modal-site-text font-normal text-wrap">${this.getLocation()}</div></form><div slot="actions" class="flex flex-row flex-end"><ix-button form="form-id" appearance="text">Close</ix-button><ix-button href="${this.getUrl()}" @click="${this.viewRecord}" appearance="text">View Record</ix-button></div></ix-dialog>`}}),NotificationItem=(__decorate([property({type:Object,attribute:!1})],ViewItemDialog.prototype,"notification",void 0),__decorate([property({type:Boolean,attribute:!0})],ViewItemDialog.prototype,"open",void 0),ViewItemDialog=__decorate([customElement("view-item-dialog")],ViewItemDialog),class extends MobxLitElement{constructor(){super(...arguments),this.disabled=!1,this.notification={},this.showModal=!1,this.showDeleteConfirmation=!1}static get styles(){return[TWStyles,NotificationsStyle]}displayItem(){this.notification.status===NotificationStatus.UNREAD&&NotificationsState.setNotificationReadStatus(this.notification.id),this.showModal=!0}deleteItem(){this.disabled||(this.showDeleteConfirmation=!0)}confirmedDelete(t){t.detail.returnValue&&NotificationsState.setNotificationDeleted(this.notification.id).then(t=>{this.showDeleteResultMessage(t,this.notification.id)}),this.showDeleteConfirmation=!1}showDeleteResultMessage(t,e){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:e,content:html`<ix-message-toast toastId="${e}" .TMessageToast="${t.State.toLowerCase()}" forceClose>${t.Message}</ix-message-toast>`,autoClose:2e3,durationOut:2e3,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))}calculateDuration(){return void 0!==this.notification.createdAt?differenceInHours(new Date,new Date(this.notification.createdAt))<24?formatDistance(new Date(this.notification.createdAt),new Date,{addSuffix:!0}):html`<ix-date type="static" variant="date-time" .value="${this.notification.createdAt}"></ix-date>`:"N/A"}getNotificationIcon(){switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return plannedMaintenance;case NotificationGroups.SERVICE_TICKETS:return"sync_saved_locally";case NotificationGroups.INCIDENTS:return"report";case NotificationGroups.DCIM_ALERTS:return dcim;default:return"sync_saved_locally"}}getNotificationTitle(){var t;switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return"Planned Maintenance";case NotificationGroups.SERVICE_TICKETS:return`${null==(t=this.notification)?void 0:t.subGroup} Service Ticket Update`;case NotificationGroups.INCIDENTS:return"Emergency Repair";case NotificationGroups.DCIM_ALERTS:return"DCIM Alert";default:return"sync_saved_locally"}}render(){var t;return html`<div class="relative notification-item"><div class="hover:bg-[rgba(0,0,0,0.04)] p-2 pl-3.5 flex gap-3 relative cursor-pointer items-center font-bold ${"unread"===(null==(t=this.notification)?void 0:t.status)?"notification-item-unread border-l-3 border-success":"notification-item-read border-l-3 border-transparent"}"><ix-icon style="--ix-icon-font-size:24px;--ix-icon-line-height:24px" icon="${this.getNotificationIcon()}" class="${"unread"===(null==(t=this.notification)?void 0:t.status)?"active-icon":"inactive-icon"}" @click="${this.displayItem}">${this.getNotificationIcon()}</ix-icon><div class="flex flex-col grow" @click="${this.displayItem}"><div class="grow text-base"><h2 class="dlr-text-caption">${this.getNotificationTitle()}</h2></div><div class="grow text-xs"><h3 class="dlr-text-caption text-on-surface-disabled">${this.calculateDuration()}</h3></div></div><div><view-item-dialog ?open="${this.showModal}" .notification="${this.notification}" @view-item-dialog-closed="${()=>{this.showModal=!1}}"></view-item-dialog><confirmation-dialog ?open="${this.showDeleteConfirmation}" @on-confirm-selection="${this.confirmedDelete}" @confirm-dialog-closed="${()=>{this.showModal=!1}}" textMessage="Are you sure you want to delete this notification?"></confirmation-dialog></div><ix-icon-button style="--md-icon-button-icon-size:24px" @click="${this.deleteItem}" @mouseover="${t=>{this.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:this.disabled?"Emergency Repair Notification cannot be removed":"Remove Notification",target:t.target}}))}}" @mouseout="${()=>this.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" ?disabled="${this.disabled}"><ix-icon slot="default" class="${this.disabled?"inactive-icon":"destructive-icon"}">${trash}</ix-icon></ix-icon-button></div></div>`}}),GroupedItem=(__decorate([property({type:Boolean})],NotificationItem.prototype,"disabled",void 0),__decorate([property({type:Object,attribute:!1})],NotificationItem.prototype,"notification",void 0),__decorate([state()],NotificationItem.prototype,"showModal",void 0),__decorate([state()],NotificationItem.prototype,"showDeleteConfirmation",void 0),NotificationItem=__decorate([customElement("notification-item")],NotificationItem),class extends MobxLitElement{constructor(){super(...arguments),this.groupTitle="Group 1",this.groupIcon="public",this.childItems=NotificationsState.notifications,this.isOpen=!1,this.onClick=()=>{this.isOpen=!this.isOpen}}static get styles(){return[TWStyles,NotificationsStyle]}renderNotificationItems(){var t;return this.isOpen?void 0!==(null==(t=this.childItems)?void 0:t.length)&&0<(null==(t=this.childItems)?void 0:t.length)?html`<div>${null==(t=this.childItems)?void 0:t.map(t=>html`<notification-item .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:html`<p class="dlr-text-caption ml-14 font-bold mr-4">No notifications yet.</p>`:html`${nothing}`}render(){var t;return html`<div class="group-container-row border-b border-outline py-3"><div class="flex items-center justify-between"><div class="flex items-center align-middle"><ix-icon-button icon="${this.isOpen?"arrow_drop_down":"arrow_right"}" @click="${this.onClick}"></ix-icon-button><ix-icon slot="default" class="ix-icon-groups">${unsafeSVG(this.groupIcon)}</ix-icon><p class="m-0 group-name font-bold pl-1">${this.groupTitle}</p><p class="m-0 pl-4">${null==(t=this.childItems)?void 0:t.length.toString().padStart(2,"0")}</p></div></div>${this.renderNotificationItems()}</div>`}}),GroupFilters=(__decorate([property({type:String,attribute:!0})],GroupedItem.prototype,"groupTitle",void 0),__decorate([property({type:String,attribute:!0})],GroupedItem.prototype,"groupIcon",void 0),__decorate([property({type:Array,attribute:!0})],GroupedItem.prototype,"childItems",void 0),__decorate([state()],GroupedItem.prototype,"isOpen",void 0),GroupedItem=__decorate([customElement("grouped-item")],GroupedItem),class extends MobxLitElement{static get styles(){return[TWStyles,NotificationsStyle]}onSwitchChange(t){var t=t.target,e=null==(e=t.attributes.getNamedItem("name"))?void 0:e.value;NotificationsState.setNotificationFilter(e,t.selected),this.requestUpdate()}render(){return html`<div class="flex flex-col"><label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch class="flex" name="${NotificationGroups.PLANNED_MAINTENANCE}" selected="${NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE}" @change="${this.onSwitchChange}"></ix-switch><span>Planned Maintenance</span></label> <label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch class="flex" name="${NotificationGroups.SERVICE_TICKETS}" selected="${NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS}" @change="${this.onSwitchChange}"></ix-switch><span>Service Ticket Updates</span></label> <label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch class="flex" name="${NotificationGroups.DCIM_ALERTS}" selected="${NotificationsState.notificationFilters.SHOW_DCIM_ALERTS}" @change="${this.onSwitchChange}"></ix-switch><span>${NotificationGroups.DCIM_ALERTS}</span></label></div>`}}),DateFilters=(GroupFilters=__decorate([customElement("group-filters")],GroupFilters),class extends MobxLitElement{constructor(){super(...arguments),this.fromDate=isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.FROM_DATE)?void 0:format(NotificationsState.dateFilters.FROM_DATE,DefaultDateFormat),this.toDate=isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.TO_DATE)?void 0:format(NotificationsState.dateFilters.TO_DATE,DefaultDateFormat),this.maxDate=format(new Date,DefaultDateFormat),this.fromDateErrorText="",this.toDateErrorText=""}static get styles(){return[TWStyles,NotificationsStyle]}onFromDateChange(t){null===t||""===t?this.fromDate=void 0:(this.fromDate=t,void 0!==this.fromDate&&(this.fromDateErrorText=void 0))}onToDateChange(t){null===t||""===t?this.toDate=void 0:(this.toDate=t,void 0!==this.toDate&&(this.toDateErrorText=void 0))}onApplyDateFilter(t){if(t){if(void 0===this.toDate&&void 0!==this.fromDate)return void(this.toDateErrorText="Please select to date");if(void 0===this.fromDate&&void 0!==this.toDate)return void(this.fromDateErrorText="Please select from date");if(this.fromDate>this.toDate)return this.fromDateErrorText="From date cannot be later than To date.",void(this.fromDate=void 0);if(this.fromDateErrorText=void 0,this.toDate<this.fromDate)return this.toDateErrorText="To date cannot be earlier than From date.",void(this.toDate=void 0);this.toDateErrorText=void 0}t=t&&void 0===this.toDateErrorText&&void 0===this.fromDateErrorText,t&&(NotificationsState.setNotificationDateFilter(this.fromDate,this.toDate),this.requestUpdate()),t=new CustomEvent("on-selection",{detail:{returnValue:t},bubbles:!0,composed:!0});this.dispatchEvent(t)}clearDateFilters(){this.fromDate=void 0,this.toDate=void 0,this.fromDateErrorText=void 0,this.toDateErrorText=void 0}render(){return html`<div class="flex flex-col p-4"><div class="flex flex-row items-center"><div class="grow items-center text-xl font-bold">Filter by Date</div><div class="flex flex-row items-center" @click="${this.clearDateFilters}"><label class="grow text-sm text-right pr-1 cursor-pointer">Clear Filter</label><ix-icon-button small appearance="default" icon="domain_verification_off" class="active-icon"></ix-icon-button></div></div><ix-divider class="my-2"></ix-divider><div class="flex xl:flex-row lg:flex-col md:flex-col sm:flex-col justify-between item-center my-4"><div class="flex gap-2"><ix-date .value="${this.fromDate}" max="${this.maxDate}" label="From" name="FromDate" .errorText="${this.fromDateErrorText}" .onChanged="${t=>this.onFromDateChange(t)}"></ix-date><ix-date .value="${this.toDate}" max="${this.maxDate}" label="To" name="ToDate" .errorText="${this.toDateErrorText}" .onChanged="${t=>this.onToDateChange(t)}"></ix-date></div></div><div class="flex flex-row justify-between"><ix-button type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!1)}">Cancel</ix-button><ix-button type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!0)}">Filter List</ix-button></div></div>`}}),NotificationTooltip=(__decorate([state()],DateFilters.prototype,"fromDate",void 0),__decorate([state()],DateFilters.prototype,"toDate",void 0),__decorate([state()],DateFilters.prototype,"maxDate",void 0),__decorate([state()],DateFilters.prototype,"fromDateErrorText",void 0),__decorate([state()],DateFilters.prototype,"toDateErrorText",void 0),DateFilters=__decorate([customElement("date-filters")],DateFilters),class extends MobxLitElement{constructor(){super(...arguments),this.isVisible=!1,this.label="",this.hoveredElement=void 0,this.configureNotificationTooltip=t=>{var{label:t,target:e}=t.detail;this.hoveredElement=e,this.label=t,this.isVisible=!0},this.hideNotificationTooltip=()=>{this.isVisible=!1,this.hoveredElement=void 0,this.label=""}}static get styles(){return[TWStyles,NotificationsStyle]}connectedCallback(){super.connectedCallback(),window.addEventListener("show-notification-tooltip",this.configureNotificationTooltip),window.addEventListener("hide-notification-tooltip",this.hideNotificationTooltip)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("show-notification-tooltip",this.configureNotificationTooltip),window.removeEventListener("hide-notification-tooltip",this.hideNotificationTooltip)}updated(t){t.has("hoveredElement")&&this.isVisible&&this.hoveredElement&&computePosition(this.hoveredElement,this.notificationTooltip,{placement:"bottom-end"}).then(({x:t,y:e})=>{this.notificationTooltip.style.left=t+"px",this.notificationTooltip.style.top=e+12+"px"})}render(){var t={hidden:!this.isVisible};return html`<div class="notification-tooltip z-[9999] rounded absolute p-2 white-text ${classMap(t)}">${this.label}</div><slot></slot>`}});__decorate([query(".notification-tooltip")],NotificationTooltip.prototype,"notificationTooltip",void 0),__decorate([property({type:Boolean,reflect:!0})],NotificationTooltip.prototype,"isVisible",void 0),__decorate([property({type:String,reflect:!0})],NotificationTooltip.prototype,"label",void 0),__decorate([state()],NotificationTooltip.prototype,"hoveredElement",void 0),NotificationTooltip=__decorate([customElement("notification-tooltip")],NotificationTooltip);class IxNotifications extends MobxLitElement{constructor(){super(...arguments),this.showGroupedView=!1,this.showFilters=!1,this.showDateFilters=!1,this.showMarkAllReadConfirmation=!1,this.baseApiUrl="",this.localStorageKey=""}async firstUpdated(){NotificationsState.baseApiUrl=this.baseApiUrl,NotificationsState.localStorageKey=this.localStorageKey,NotificationsState.ConstructApiClient()}connectedCallback(){super.connectedCallback(),window.addEventListener("account-switched",NotificationsState.NewApiClient),window.addEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.addEventListener("beforeunload",this.handleOnbeforeunload)}disconnectedCallback(){window.removeEventListener("account-switched",NotificationsState.NewApiClient),window.removeEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.removeEventListener("beforeunload",this.handleOnbeforeunload),super.disconnectedCallback()}handleOnbeforeunload(t){NotificationsState.clearStoredNotificationsData()}toggleDrawer(){NotificationsState.showDrawer=!NotificationsState.showDrawer,NotificationsState.showDrawer||(this.showFilters=!1,this.showDateFilters=!1)}markAllread(){0<NotificationsState.unreadNotificationCount&&(this.showMarkAllReadConfirmation=!0)}confirmedMarkAllRead(t){if(t.detail.returnValue){var t=this.applyNotificationFilters(),i=null==t?void 0:t.filter(t=>t.status===NotificationStatus.UNREAD);if(0<i.length){let e=!0;null!=t&&t.forEach(t=>{NotificationsState.setNotificationReadStatus(t.id).then(t=>{e=e&&t})});t={State:!0===e?ApiCallState.SUCCESS:ApiCallState.ERROR,Message:!0===e?"Successfully marked all the notifications as read":"Error while marking the notifications read, Please try again"};this.showResultMessage(t,i[0].id),this.requestUpdate()}}this.showMarkAllReadConfirmation=!1}showResultMessage(t,e){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:e,content:html`<ix-message-toast toastId="${e}" .TMessageToast="${t.State.toLowerCase()}" forceClose>${t.Message}</ix-message-toast>`,autoClose:3e3,durationOut:3e3,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))}toggleGroupView(){this.showGroupedView=!this.showGroupedView}displayFilters(){this.showFilters=!this.showFilters}applyNotificationFilters(){var t=null==(t=NotificationsState.notifications)?void 0:t.filter(t=>t.resourceType===NotificationGroups.PLANNED_MAINTENANCE&&!0===NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE||t.resourceType===NotificationGroups.SERVICE_TICKETS&&!0===NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS||t.resourceType===NotificationGroups.DCIM_ALERTS&&!0===NotificationsState.notificationFilters.SHOW_DCIM_ALERTS||t.resourceType===NotificationGroups.INCIDENTS);return void 0!==NotificationsState.dateFilters.FROM_DATE&&void 0!==NotificationsState.dateFilters.TO_DATE?t.filter(t=>0<=differenceInHours(new Date(t.createdAt),NotificationsState.dateFilters.FROM_DATE)&&differenceInDays(new Date(t.createdAt),NotificationsState.dateFilters.TO_DATE)<=0):void 0!==NotificationsState.dateFilters.FROM_DATE&&void 0===NotificationsState.dateFilters.TO_DATE?t.filter(t=>0<=differenceInHours(new Date(t.createdAt),NotificationsState.dateFilters.FROM_DATE)):void 0===NotificationsState.dateFilters.FROM_DATE&&void 0!==NotificationsState.dateFilters.TO_DATE?t.filter(t=>differenceInDays(new Date(t.createdAt),NotificationsState.dateFilters.TO_DATE)<=0):t}displayDateFilters(){this.showDateFilters=!this.showDateFilters}renderGroupedView(){var t=this.applyNotificationFilters();return html`<div class="-mx-4 -mt-2"><grouped-item groupTitle="Planned Maintenance" groupIcon="${plannedMaintenance.strings[0]}" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.PLANNED_MAINTENANCE)}"></grouped-item><grouped-item groupTitle="Emergency Repairs" groupIcon="report" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.INCIDENTS)}"></grouped-item><grouped-item groupTitle="Service Ticket Updates" groupIcon="sync_saved_locally" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.SERVICE_TICKETS)}"></grouped-item><grouped-item groupTitle="${NotificationGroups.DCIM_ALERTS}" groupIcon="${dcim.strings[0]}" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.DCIM_ALERTS)}"></grouped-item></div>`}renderDefaultView(){var t=this.applyNotificationFilters(),e=t.filter(t=>0===differenceInDays(new Date(t.createdAt),new Date)),i=t.filter(t=>0!==differenceInDays(new Date(t.createdAt),new Date));return 0<(null==t?void 0:t.length)?html`<h3>Today</h3>${0<e.length?html`<div class="-mx-4">${null==e?void 0:e.map(t=>html`<notification-item .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:this.renderNoResult()}<h3>Earlier</h3>${0<i.length?html`<div class="-mx-4">${null==i?void 0:i.map(t=>html`<notification-item .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:this.renderNoResult()}`:html`<h3>Today</h3>${this.renderNoResult()}`}renderNoResult(){return html`<p class="dlr-text-caption my-4"><strong>No notifications yet.</strong></p>`}handleCloseClick(t){this.showDateFilters=!1,this.showFilters=!1}handleContentScroll(t){null!==t&&t.detail.scrollTop+t.detail.clientHeight>=t.detail.scrollHeight&&NotificationsState.getNotifications()}manageFilterVisibility(t){t=t.composedPath();!this.showFilters||t.includes(this.groupFilters)||t.includes(this.groupFiltersButton)||(this.showFilters=!1),!this.showDateFilters||t.includes(this.dateFilters)||t.includes(this.dateFiltersButton)||(this.showDateFilters=!1)}render(){return html`<notification-tooltip></notification-tooltip><confirmation-dialog ?open="${this.showMarkAllReadConfirmation}" @confirm-dialog-closed="${()=>{this.showMarkAllReadConfirmation=!1}}" @on-confirm-selection="${this.confirmedMarkAllRead}" textMessage="Are you sure you want to mark all notifications as read?"></confirmation-dialog><ix-drawer ?isVisible="${NotificationsState.showDrawer}" .onClosed="${()=>this.toggleDrawer()}" animate-vertical hide-close @on-content-scroll="${this.handleContentScroll}" @click="${this.manageFilterVisibility}" compact="compact"><div slot="content" class="m-4"><div class="flex flex-row justify-between grow items-center notification-header-container mb-4"><h2 class="grow items-center dlr-text-heading">Notifications</h2><div class="flex flex-row justify-end grow items-center options" style="--md-icon-button-icon-size:24px"><ix-icon-button @click="${this.markAllread}" @mouseover="${t=>{0<NotificationsState.unreadNotificationCount&&window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Mark All Read",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" icon="markunread_mailbox" class="${NotificationsState.unreadNotificationCount<=0?"inactive-icon":"active-icon"}" .disabled="${NotificationsState.unreadNotificationCount<=0}" filledIcon="true"></ix-icon-button><ix-icon-button @click="${this.toggleGroupView}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Sort by Type",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" label="Sort by Type"><ix-icon slot="default">${this.showGroupedView?sortCheck:"sort"}</ix-icon></ix-icon-button><ix-icon-button @click="${this.displayFilters}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Type",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" id="group-filter-button" label="Filter by Type"><ix-icon slot="default">${viewList}</ix-icon></ix-icon-button><div class="filter-dropdown-content ${this.showFilters?"active z-50":"hidden"}"><group-filters></group-filters></div><ix-icon-button @click="${this.displayDateFilters}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Date",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" icon="date_range" class="active-icon" filledIcon="true" id="date-filters-button" label="Filter by Date"></ix-icon-button><div class="datefilter-dropdown-content ${this.showDateFilters?"active z-50":"hidden"}" @on-selection="${this.handleCloseClick}"><date-filters></date-filters></div></div></div>${this.showGroupedView?this.renderGroupedView():this.renderDefaultView()}</div></ix-drawer>`}}IxNotifications.styles=[TWStyles,NotificationsStyle],__decorate([query("group-filters")],IxNotifications.prototype,"groupFilters",void 0),__decorate([query("ix-icon-button#group-filter-button")],IxNotifications.prototype,"groupFiltersButton",void 0),__decorate([query("date-filters")],IxNotifications.prototype,"dateFilters",void 0),__decorate([query("ix-icon-button#date-filters-button")],IxNotifications.prototype,"dateFiltersButton",void 0),__decorate([state()],IxNotifications.prototype,"showGroupedView",void 0),__decorate([state()],IxNotifications.prototype,"showFilters",void 0),__decorate([state()],IxNotifications.prototype,"showDateFilters",void 0),__decorate([state()],IxNotifications.prototype,"showMarkAllReadConfirmation",void 0),__decorate([property({type:String})],IxNotifications.prototype,"baseApiUrl",void 0),__decorate([property({type:String})],IxNotifications.prototype,"localStorageKey",void 0),window.customElements.define("ix-notifications",IxNotifications);
|
|
1
|
+
import{__decorate}from"tslib";import{svg,css,html,nothing}from"lit";import{property,customElement,state,query}from"lit/decorators.js";import{MobxLitElement}from"@adobe/lit-mobx";import{differenceInDays}from"date-fns/differenceInDays.js";import{differenceInHours}from"date-fns/differenceInHours.js";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-drawer/ix-drawer.js";import"@digital-realty/ix-icon";import"@material/web/icon/icon.js";import{makeAutoObservable}from"mobx";import{makePersistable,isHydrated,hydrateStore,clearPersistedStore,getPersistedStore}from"mobx-persist-store";import{parse}from"date-fns/parse.js";import{subDays}from"date-fns/subDays.js";import{format}from"date-fns/format.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import"@digital-realty/ix-icon/ix-icon.js";import{formatDistance}from"date-fns/formatDistance.js";import"@digital-realty/ix-toast/ix-message-toast.js";import{unsafeSVG}from"lit/directives/unsafe-svg.js";import"@digital-realty/ix-switch/ix-switch.js";import"@digital-realty/ix-date/ix-date.js";import"@digital-realty/ix-divider/ix-divider.js";import{computePosition}from"@floating-ui/dom";import{classMap}from"lit/directives/class-map.js";let viewList=svg`<svg viewBox="0 0 24 24"><path d="M3 9H7V5H3V9ZM7 14H3V10H7V14ZM7 19H3V15H7V19ZM20 14H8V10H20V14ZM8 19H20V15H8V19ZM8 9V5H20V9H8Z"/></svg>`,dcim=svg`<svg viewBox="0 0 24 24"><path d="M20 0C17.791 0 16 1.791 16 4C16 6.857 20 11 20 11C20 11 24 6.857 24 4C24 1.791 22.209 0 20 0ZM12 2C6.486 2 2 6.486 2 12C2 17.514 6.486 22 12 22C17.514 22 22 17.514 22 12C22 11.93 21.9912 11.862 21.9902 11.793C21.7532 12.059 21.5575 12.2677 21.4395 12.3887L19.6504 14.3047C19.4484 14.9657 19.1695 15.5919 18.8145 16.1699C18.4985 15.4819 17.806 15 17 15H16V13C16 12.447 15.552 12 15 12H9V10H10C10.552 10 11 9.553 11 9V7.02344L13.0156 7.00781C13.5986 7.00381 14.1175 6.74289 14.4805 6.33789C14.3145 5.89389 14.1875 5.445 14.1035 5L9.99219 5.03125C9.44319 5.03525 9 5.48225 9 6.03125V8H8C7.448 8 7 8.447 7 9V10.1855L4.98047 8.16797C6.34047 5.68697 8.977 4 12 4H14C14 3.397 14.0908 2.81658 14.2578 2.26758C13.5308 2.09858 12.777 2 12 2ZM20 2.57031C20.789 2.57031 21.4297 3.211 21.4297 4C21.4297 4.789 20.789 5.42969 20 5.42969C19.211 5.42969 18.5703 4.789 18.5703 4C18.5703 3.211 19.211 2.57031 20 2.57031ZM4.20703 10.2207L9 15.0137V16C9 17.103 9.897 18 11 18V19.9316C7.06 19.4366 4 16.072 4 12C4 11.388 4.07603 10.7947 4.20703 10.2207ZM10.7793 14H14V16C14 16.553 14.448 17 15 17H17V18.2344C15.875 19.1384 14.502 19.7417 13 19.9297V17C13 16.447 12.552 16 12 16H11V14.5996C11 14.3776 10.9123 14.174 10.7793 14Z"/></svg>`,plannedMaintenance=svg`<svg viewBox="0 0 24 24"><path d="M6 2C4.90575 2 4 2.90575 4 4V20C4 21.0943 4.90575 22 6 22H11V20H6V4H13V9H18V13H20V8L14 2H6ZM12 11V14H15C15 12.343 13.641 11.031 12 11ZM11 12C9.343 12 8 13.343 8 15C8 16.657 9.343 18 11 18C12.657 18 13.969 16.641 14 15H11V12ZM16 15V21H13C13 22.654 14.346 24 16 24H21C22.645 24 24 22.645 24 21V15H16ZM18 17H22V21C22 21.565 21.565 22 21 22C20.449 22 20 21.552 20 21H18V17Z"/></svg>`,trash=svg`<svg viewBox="0 0 24 24"><path d="M15.5 4H19V6H5V4H8.5L9.5 3H14.5L15.5 4ZM8 21C6.9 21 6 20.1 6 19V7H18V19C18 20.1 17.1 21 16 21H8Z"/></svg>`,sortCheck=(svg`<svg viewBox="0 0 24 24"><path d="M11 12C13.21 12 15 10.21 15 8C15 5.79 13.21 4 11 4C8.79 4 7 5.79 7 8C7 10.21 8.79 12 11 12ZM9 17L12 14.06C11.61 14.02 11.32 14 11 14C8.33 14 3 15.34 3 18V20H12L9 17ZM12 17L15.47 20.5L22 13.91L20.6 12.5L15.47 17.67L13.4 15.59L12 17Z"/></svg>`,svg`<svg viewbox="0 0 24 24"><path d="M 3,6 V 8 H 21 V 6 Z M 3,18 H 9 V 16 H 3 Z M 15,13 H 3 v -2 h 12 z"/><rect x="8" y="0.5" width="16" height="16" rx="8"/><path d="M 14.5,10.585 12.415,8.50001 11.705,9.20501 14.5,12 l 6,-5.99999 -0.705,-0.705 z" style="fill:#fff"/></svg>`),TWStyles=css`*,::after,::before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scroll-snap-strictness:proximity;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgb(59 130 246 / 0.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000}*,::after,::before{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}::after,::before{--tw-content:''}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.dlr-text-default,:host,:host :root,:root,html{font-family:var(--root-primary-font);font-size:var(--text-default-size);line-height:var(--text-default-line-height);letter-spacing:var(--text-default-letter-spacing);font-weight:var(--text-default-weight);-webkit-text-decoration:var(--text-default-decoration);text-decoration:var(--text-default-decoration);text-transform:var(--text-default-transform)}.dlr-text-heading{font-family:var(--root-secondary-font);font-size:var(--text-heading-size);line-height:var(--text-heading-line-height);letter-spacing:var(--text-heading-letter-spacing);font-weight:var(--text-heading-weight);-webkit-text-decoration:var(--text-heading-decoration);text-decoration:var(--text-heading-decoration);text-transform:var(--text-heading-transform)}.dlr-text-caption{font-family:var(--root-primary-font);font-size:var(--text-caption-size);line-height:var(--text-caption-line-height);letter-spacing:var(--text-caption-letter-spacing);font-weight:var(--text-caption-weight);-webkit-text-decoration:var(--text-caption-decoration);text-decoration:var(--text-caption-decoration);text-transform:var(--text-caption-transform)}.static{position:static}.absolute{position:absolute}.relative{position:relative}.z-50{z-index:50}.z-\\[9999\\]{z-index:9999}.m-0{margin:0}.m-4{margin:1rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-4{margin-bottom:1rem}.ml-14{margin-left:3.5rem}.mr-4{margin-right:1rem}.flex{display:flex}.hidden{display:none}.w-\\[560px\\]{width:560px}.w-\\[580px\\]{width:580px}.grow{flex-grow:1}.cursor-pointer{cursor:pointer}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.whitespace-nowrap{white-space:nowrap}.text-wrap{text-wrap:wrap}.text-balance{text-wrap:balance}.rounded{border-radius:.25rem}.border-b{border-bottom-width:1px}.border-l-3{border-left-width:3px}.border-outline{border-color:var(--cp-neutral-blue-12p)}.border-success{border-color:var(--cp-success-50)}.border-transparent{border-color:transparent}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.pb-0{padding-bottom:0}.pl-1{padding-left:.25rem}.pl-3\\.5{padding-left:.875rem}.pl-4{padding-left:1rem}.pr-1{padding-right:.25rem}.pt-4{padding-top:1rem}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-normal{font-weight:400}.text-on-surface-disabled{color:var(--cp-neutral-blue-50p)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:150ms}.hover\\:bg-\\[rgba\\(0\\2c 0\\2c 0\\2c 0\\.04\\)\\]:hover{background-color:rgba(0,0,0,.04)}.hover\\:bg-primary-subtle:hover{background-color:var(--cp-dlr-blue-10p)}@media (min-width:640px){.sm\\:flex-col{flex-direction:column}}@media (min-width:768px){.md\\:flex-col{flex-direction:column}}@media (min-width:1024px){.lg\\:flex-col{flex-direction:column}}@media (min-width:1280px){.xl\\:flex-row{flex-direction:row}}`;var NotificationStatus,NotificationGroups,SubGroups,ApiCallState;(t=>{t.READ="read",t.UNREAD="unread"})(NotificationStatus=NotificationStatus||{}),(t=>{t.PLANNED_MAINTENANCE="Planned Maintenance",t.INCIDENTS="Incidents",t.DCIM_ALERTS="DCIM Alerts",t.SERVICE_TICKETS="Service Tickets"})(NotificationGroups=NotificationGroups||{}),(t=>{t.Remote_Hands="Remote Hands",t.Deliveries="Deliveries",t.Removals="Removals",t.Facility_Access="Facility Access",t.Trouble_Ticket="Trouble Ticket",t.Customer_Care="Customer Care",t.FacilityAccessVisitorAccess="FacilityAccessVisitorAccess",t.FacilityAccessPermanentBadge="FacilityAccessPermanentBadge",t.FacilityAccessOspAccess="FacilityAccessOspAccess",t.FacilityAccessPopPoeAccess="FacilityAccessPopPoeAccess"})(SubGroups=SubGroups||{}),(t=>{t.LOADING="Loading",t.ERROR="Error",t.SUCCESS="Success"})(ApiCallState=ApiCallState||{});let DefaultDateFormat="yyyy-MM-dd",DefaultDisplayDays=30,DefaultDateTimeFormat="yyyy-MM-dd HH:mm:ss",BASE_PATH="http://api.digitalrealty.com/notifications".replace(/\/+$/,"");class Configuration{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return null!=this.configuration.basePath?this.configuration.basePath:BASE_PATH}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||querystring}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){let t=this.configuration.apiKey;if(t)return"function"==typeof t?t:()=>t}get accessToken(){let t=this.configuration.accessToken;if(t)return"function"==typeof t?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}let DefaultConfig=new Configuration;class BaseAPI{constructor(t=DefaultConfig){this.configuration=t,this.fetchApi=async(t,e)=>{let i={url:t,init:e};for(var o of this.middleware)o.pre&&(i=await o.pre({fetch:this.fetchApi,...i})||i);let a=void 0;try{a=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(t){for(var r of this.middleware)r.onError&&(a=await r.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:t,response:a?a.clone():void 0})||a);if(void 0===a)throw t instanceof Error?new FetchError(t,"The request failed and the interceptors did not return an alternative response"):t}for(var n of this.middleware)n.post&&(a=await n.post({fetch:this.fetchApi,url:i.url,init:i.init,response:a.clone()})||a);return a},this.middleware=t.middleware}withMiddleware(...t){var e=this.clone();return e.middleware=e.middleware.concat(...t),e}withPreMiddleware(...t){t=t.map(t=>({pre:t}));return this.withMiddleware(...t)}withPostMiddleware(...t){t=t.map(t=>({post:t}));return this.withMiddleware(...t)}isJsonMime(t){return!!t&&BaseAPI.jsonRegex.test(t)}async request(t,e){var{url:t,init:e}=await this.createFetchParams(t,e),t=await this.fetchApi(t,e);if(t&&200<=t.status&&t.status<300)return t;throw new ResponseError(t,"Response returned an error code")}async createFetchParams(t,e){let i=this.configuration.basePath+t.path,o=(void 0!==t.query&&0!==Object.keys(t.query).length&&(i+="?"+this.configuration.queryParamsStringify(t.query)),Object.assign({},this.configuration.headers,t.headers));Object.keys(o).forEach(t=>void 0===o[t]?delete o[t]:{});var a="function"==typeof e?e:async()=>e,r={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...r,...await a({init:r,context:t})};let n;n=!(isFormData(a.body)||a.body instanceof URLSearchParams||isBlob(a.body))&&this.isJsonMime(o["Content-Type"])?JSON.stringify(a.body):a.body;r={...a,body:n};return{url:i,init:r}}clone(){var t=new this.constructor(this.configuration);return t.middleware=this.middleware.slice(),t}}function isBlob(t){return"undefined"!=typeof Blob&&t instanceof Blob}function isFormData(t){return"undefined"!=typeof FormData&&t instanceof FormData}BaseAPI.jsonRegex=new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$","i");class ResponseError extends Error{constructor(t,e){super(e),this.response=t,this.name="ResponseError"}}class FetchError extends Error{constructor(t,e){super(e),this.cause=t,this.name="FetchError"}}class RequiredError extends Error{constructor(t,e){super(e),this.field=t,this.name="RequiredError"}}let COLLECTION_FORMATS={csv:",",ssv:" ",tsv:"\t",pipes:"|"};function exists(t,e){t=t[e];return null!=t}function querystring(e,i=""){return Object.keys(e).map(t=>querystringSingleKey(t,e[t],i)).filter(t=>0<t.length).join("&")}function querystringSingleKey(t,e,i=""){var o,a=i+(i.length?`[${t}]`:t);return e instanceof Array?(o=e.map(t=>encodeURIComponent(String(t))).join(`&${encodeURIComponent(a)}=`),encodeURIComponent(a)+"="+o):e instanceof Set?querystringSingleKey(t,Array.from(e),i):e instanceof Date?encodeURIComponent(a)+"="+encodeURIComponent(e.toISOString()):e instanceof Object?querystring(e,a):encodeURIComponent(a)+"="+encodeURIComponent(String(e))}class JSONApiResponse{constructor(t,e=t=>t){this.raw=t,this.transformer=e}async value(){return this.transformer(await this.raw.json())}}class VoidApiResponse{constructor(t){this.raw=t}async value(){}}function StatusFromJSON(t){return StatusFromJSONTyped(t)}function StatusFromJSONTyped(t,e){return t}function StatusToJSON(t){return t}function NotificationFromJSON(t){return NotificationFromJSONTyped(t)}function NotificationFromJSONTyped(t,e){return null==t?t:{id:exists(t,"id")?t.id:void 0,resourceType:exists(t,"resource_type")?t.resource_type:void 0,subGroup:exists(t,"sub_group")?t.sub_group:void 0,createdAt:exists(t,"created_at")?null===t.created_at?null:new Date(t.created_at):void 0,createdBy:exists(t,"created_by")?t.created_by:void 0,subject:exists(t,"subject")?t.subject:void 0,locations:exists(t,"locations")?t.locations:void 0,resourceId:exists(t,"resource_id")?t.resource_id:void 0,status:exists(t,"status")?StatusFromJSON(t.status):void 0,accountNumber:exists(t,"account_number")?t.account_number:void 0}}function GetNotifications200ResponseFromJSON(t){return GetNotifications200ResponseFromJSONTyped(t)}function GetNotifications200ResponseFromJSONTyped(t,e){return null==t?t:{self:exists(t,"self")?t.self:void 0,first:exists(t,"first")?t.first:void 0,prev:exists(t,"prev")?t.prev:void 0,next:exists(t,"next")?t.next:void 0,last:exists(t,"last")?t.last:void 0,items:t.items.map(NotificationFromJSON)}}function NotificationPatchFromJSON(t){return NotificationPatchFromJSONTyped(t)}function NotificationPatchFromJSONTyped(t,e){return null==t?t:{status:StatusFromJSON(t.status)}}function NotificationPatchToJSON(t){if(void 0!==t)return null===t?null:{status:StatusToJSON(t.status)}}function NotificationRequestToJSON(t){if(void 0!==t)return null===t?null:{resource_type:t.resourceType,sub_group:t.subGroup,recipients:t.recipients,account_number:t.accountNumber,locations:t.locations,resource_id:t.resourceId,subject:t.subject,created_at:void 0===t.createdAt?void 0:null===t.createdAt?null:t.createdAt.toISOString()}}class NotificationsApi extends BaseAPI{async createNotificationRaw(t,e){var i={"Content-Type":"application/json"},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications",method:"POST",headers:i,query:{},body:NotificationRequestToJSON(t.notificationRequest)},e));return new JSONApiResponse(o,t=>NotificationFromJSON(t))}async createNotification(t={},e){return(await this.createNotificationRaw(t,e)).value()}async deleteNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling deleteNotificationsById.");var i={},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"DELETE",headers:i,query:{}},e));return new VoidApiResponse(o)}async deleteNotificationsById(t,e){await this.deleteNotificationsByIdRaw(t,e)}async getNotificationsRaw(t,e){var i={},o=(void 0!==t.sort&&(i.sort=t.sort),void 0!==t.cursor&&(i.cursor=t.cursor),void 0!==t.resourceType&&(i.resource_type=t.resourceType),void 0!==t.accountNumber&&(i.account_number=t.accountNumber),void 0!==t.createdAfter&&(i.created_after=t.createdAfter.toISOString()),void 0!==t.createdBefore&&(i.created_before=t.createdBefore.toISOString()),void 0!==t.locationId&&(i.location_id=t.locationId),void 0!==t.subGroup&&(i.sub_group=t.subGroup),void 0!==t.status&&(i.status=t.status),{}),t=(t.prefer&&(o.Prefer=t.prefer.join(COLLECTION_FORMATS.csv)),this.configuration&&this.configuration.accessToken&&(t=await(0,this.configuration.accessToken)("bearerToken",[]))&&(o.Authorization="Bearer "+t),await this.request({path:"/notifications",method:"GET",headers:o,query:i},e));return new JSONApiResponse(t,t=>GetNotifications200ResponseFromJSON(t))}async getNotifications(t={},e){return(await this.getNotificationsRaw(t,e)).value()}async getNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling getNotificationsById.");var i={},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"GET",headers:i,query:{}},e));return new JSONApiResponse(o,t=>NotificationFromJSON(t))}async getNotificationsById(t,e){return(await this.getNotificationsByIdRaw(t,e)).value()}async patchNotificationsByIdRaw(t,e){if(null==t.id)throw new RequiredError("id","Required parameter requestParameters.id was null or undefined when calling patchNotificationsById.");var i={"Content-Type":"application/json"},o=(this.configuration&&this.configuration.accessToken&&(o=await(0,this.configuration.accessToken)("bearerToken",[]))&&(i.Authorization="Bearer "+o),await this.request({path:"/notifications/{id}".replace("{id}",encodeURIComponent(String(t.id))),method:"PATCH",headers:i,query:{},body:NotificationPatchToJSON(t.notificationPatch)},e));return new JSONApiResponse(o,t=>NotificationPatchFromJSON(t))}async patchNotificationsById(t,e){return(await this.patchNotificationsByIdRaw(t,e)).value()}}let APIEndpointPrefixes={Notifications:"notifications"};class ApiClient{constructor(t){this.noInit=!1,this.configuration=t}get notificationsApi(){return new NotificationsApi(new Configuration({basePath:this.configuration.NotificationApiUrl+"/"+APIEndpointPrefixes.Notifications,headers:{Authorization:this.getAuthorization()}}))}getAuthorization(){return this.configuration.getAuthorizationFn?this.configuration.getAuthorizationFn():""}}let isNullOrUndefinedOrEmpty=t=>null==t||""===t,mapResourceTypeToNotificationGroups=t=>{switch(t.toLowerCase()){case"planned maintenance":return NotificationGroups.PLANNED_MAINTENANCE;case"incidents":return NotificationGroups.INCIDENTS;case"dcim alerts":return NotificationGroups.DCIM_ALERTS;case"service tickets":return NotificationGroups.SERVICE_TICKETS;default:return NotificationGroups.PLANNED_MAINTENANCE}},mapStringToNotificationStatus=t=>{switch(t.toLowerCase()){case"unread":return NotificationStatus.UNREAD;case"read":return NotificationStatus.READ;default:return NotificationStatus.UNREAD}},mapParametersToNotificationRequest=t=>({sort:"-created_at",cursor:t,prefer:[""]}),mapParametersToPatchNotificationRequest=(t,e)=>({id:t,notificationPatch:{status:e}}),mapParametersToDeleteNotificationRequest=t=>({id:t}),mapNotificationDataToNotification=t=>{var e;return{subject:null!=(e=t.subject)?e:"",id:t.id,accountNumber:null!=(e=t.accountNumber)?e:"",resourceType:mapResourceTypeToNotificationGroups(null!=(e=t.resourceType)?e:""),subGroup:null!=(e=t.subGroup)?e:"",resourceId:null!=(e=t.resourceId)?e:"",status:mapStringToNotificationStatus(null!=(e=t.status)?e:""),createdAt:isNullOrUndefinedOrEmpty(t.createdAt)?format(new Date,DefaultDateTimeFormat):format(t.createdAt,DefaultDateTimeFormat),createdBy:null!=(e=t.createdBy)?e:"",locations:null!=(e=t.locations)?e:[]}},mapNotificationResponseToNotifications=t=>t.map(t=>mapNotificationDataToNotification(t)),getNextPageCursorfromQueryParam=t=>{t=new URLSearchParams(t),t=t.has("cursor")?t.get("cursor"):"";return null!==t?t:""},handleError=async(e,t=!0)=>{if(e instanceof ResponseError&&400===e.response.status)try{var i=(await e.response.json()).detail;t&&console.error(i)}catch(t){console.error(e)}else console.error(e)},getLocalStorageUser=t=>{t=localStorage.getItem(t);return t?JSON.parse(t):null},getUserAuthorization=t=>"Bearer "+(null==(t=getLocalStorageUser(t))?void 0:t.access_token);class NotificationState{constructor(){this.showDrawer=!1,this.apiClient={noInit:!0},this.baseApiUrl="",this.localStorageKey="",this.NewApiClient=()=>{this.apiClient=new ApiClient({NotificationApiUrl:this.baseApiUrl,getAuthorizationFn:()=>getUserAuthorization(this.localStorageKey)}),this.getNotifications()},this.nextPageCursor="",this.notifications=[],this.unreadNotificationCount=0,this.notificationFilters={SHOW_PLANNED_MAINTENANCE:!0,SHOW_SERVICE_TICKETS:!0,SHOW_DCIM_ALERTS:!0},this.selectedNotification={id:"",resourceType:NotificationGroups.PLANNED_MAINTENANCE,subGroup:"",subject:"",resourceId:"",locations:[],createdAt:"",accountNumber:"",createdBy:"",status:NotificationStatus.READ},this.dateFilters={FROM_DATE:subDays(new Date,DefaultDisplayDays),TO_DATE:new Date},makeAutoObservable(this),makePersistable(this,{name:"notification-state",properties:["notificationFilters","nextPageCursor"],storage:window.localStorage})}get isHydrated(){return isHydrated(this)}async hydrateStore(){await hydrateStore(this)}async clearStoredData(){await clearPersistedStore(this)}async getStoredData(){return getPersistedStore(this)}ConstructApiClient(){return this.apiClient.noInit?this.NewApiClient():this.apiClient}async clearStoredNotificationsData(){this.notifications=[],this.unreadNotificationCount=0,this.nextPageCursor=""}async setNotificationReadStatus(e){var t,i=await this.setNotificationAsRead(e.toString());return!0===await i&&(this.ReduceUnreadNotificationCount(),t=this.notifications.findIndex(t=>t.id===e),this.notifications[t].status=NotificationStatus.READ,this.selectedNotification=this.notifications[t]),i}async setNotificationDeleted(e){var t,i=await this.DeleteNotification(e.toString());return!0===i&&("unread"===(null==(t=this.notifications.find(t=>t.id===e))?void 0:t.status)&&this.ReduceUnreadNotificationCount(),t=this.notifications.findIndex(t=>t.id===e),this.notifications.splice(t,1)),{State:!0===i?ApiCallState.SUCCESS:ApiCallState.ERROR,Message:!0===i?"Successfully deleted the notification":"Error while deleting the notification"}}setNotificationDateFilter(t,e){this.dateFilters.FROM_DATE=void 0!==t?parse(t,DefaultDateFormat,new Date):void 0,this.dateFilters.TO_DATE=void 0!==e?parse(e,DefaultDateFormat,new Date):void 0}setNotificationFilter(t,e){switch(t){case NotificationGroups.PLANNED_MAINTENANCE:this.notificationFilters.SHOW_PLANNED_MAINTENANCE=e;break;case NotificationGroups.SERVICE_TICKETS:this.notificationFilters.SHOW_SERVICE_TICKETS=e;break;case NotificationGroups.DCIM_ALERTS:this.notificationFilters.SHOW_DCIM_ALERTS=e}}async getNotifications(){var t;void 0!==this.nextPageCursor&&(t=await(null==(t=this.apiClient)?void 0:t.notificationsApi.getNotificationsRaw(mapParametersToNotificationRequest(getNextPageCursorfromQueryParam(this.nextPageCursor))).catch(t=>{handleError(t,!1)})))&&(t=await(null==t?void 0:t.value()),this.notifications=""===this.nextPageCursor?mapNotificationResponseToNotifications(null==t?void 0:t.items):this.notifications.concat(mapNotificationResponseToNotifications(null==t?void 0:t.items)),this.nextPageCursor=void 0===(null==t?void 0:t.next)||null==t?void 0:t.next,this.unreadNotificationCount=this.notifications.filter(t=>t.status===NotificationStatus.UNREAD).length)}async getNotificationsById(t){let e,i;(i=t?await(null==(e=this.apiClient)?void 0:e.notificationsApi.getNotificationsById({id:t}).catch(t=>{handleError(t,!1)})):i)&&(this.selectedNotification=mapNotificationDataToNotification(i))}async setNotificationAsRead(t){var e;return!!t&&(await(null==(e=this.apiClient)?void 0:e.notificationsApi.patchNotificationsById(mapParametersToPatchNotificationRequest(t,"read")).catch(t=>(handleError(t,!1),!1))),!0)}async DeleteNotification(t){let e,i=!1;return t&&await(null==(e=this.apiClient)?void 0:e.notificationsApi.deleteNotificationsById(mapParametersToDeleteNotificationRequest(t)).catch(t=>{handleError(t,!1),i=!1}).then(()=>{i=!0})),i}ReduceUnreadNotificationCount(){0<this.unreadNotificationCount&&--this.unreadNotificationCount}}let NotificationsState=new NotificationState,NotificationsStyle=css`:host{--ix-drawer-border-radius:0;--ix-drawer-padding:0;--ix-draw-width-sm:320px;--ix-draw-width-lg:400px}.destructive-icon{color:var(--clr-critical,#db0028);--md-icon-button-icon-color:var(--clr-critical, #DB0028);--md-sys-color-on-surface-variant:var(--clr-critical, #DB0028)}.destructive-icon path{fill:var(--clr-critical,#db0028)}.active-icon{color:var(--clr-primary,#1456e0);--md-icon-button-icon-color:var(--clr-primary, #1456E0);--md-sys-color-on-surface-variant:var(--clr-primary, #1456E0)}.active-icon path{fill:var(--clr-primary,#1456e0)}.inactive-icon{color:var(--clr-on-surface,#092241);--md-icon-button-icon-color:var(--clr-on-surface, #092241);--md-sys-color-on-surface-variant:var(--clr-on-surface, #092241);cursor:default;opacity:.6}.inactive-icon path{fill:var(--clr-on-surface,#092241);opacity:.6}ix-icon-button.sharp{--md-icon-font:'Material Symbols Sharp'!important}.ix-icon-groups{--ix-icon-font-size:32px;--ix-icon-line-height:32px}.ix-icon-groups ix-icon{color:var(--clr-on-surface,#092241);opacity:.6}.ix-icon-groups ix-icon path{fill:var(--clr-on-surface,#092241)}.datefilter-dropdown-content,.filter-dropdown-content{position:absolute;right:5%;top:3rem;box-shadow:0 8px 16px 0 rgba(0,0,0,.2);z-index:3;transition:box-shadow .3s cubic-bezier(.4,0,.2,1) 0s;border-radius:3px;box-shadow:rgba(0,0,0,.2) 0 5px 5px -3px,rgba(0,0,0,.14) 0 8px 10px 1px,rgba(0,0,0,.12) 0 3px 14px 2px;background-color:var(--clr-surface-container-lowest,#fff)}.unread{font-family:var(--root-primary-font, 'sans-serif');padding:0 5px;font-size:var(--text-caption-size,.75rem);line-height:var(--text-caption-line-height,1.33333333em);left:22px;top:0;background:var(--clr-critical,#db0028);letter-spacing:var(--text-caption-letter-spacing,.03333333em)}.notification-tooltip{background-color:var(--cp-neutral-blue-4,#040d19);white-space:nowrap;font-size:var(--text-caption-size,.75rem);z-index:9999;color:var(--clr-on-secondary,#fff)}.notification-modal-subtitle,.notification-modal-title{color:var(--clr-on-surface,#092241);font-family:var(--root-secondary-font, 'sans-serif')}.notification-modal-subtitle{font-size:var(--text-heading-size,1.25rem);line-height:var(--text-heading-line-height,1.2em)}.notification-modal-content{display:inline-grid;grid-template-columns:fit-content(183px) 1fr;grid-template-rows:auto auto;grid-column-gap:24px;grid-row-gap:8px;font-family:var(--root-primary-font, 'sans-serif');font-size:var(--text-default-size,16px);line-height:28px;width:560px;padding-bottom:16px;color:var(--clr-on-surface,#092241)}.notification-modal-content-title{width:183px;color:var(--clr-on-surface-variant,#092241B3)}.notification-modal-subject-title{grid-area:1/1/2/2}.notification-modal-subject-text{grid-area:1/2/2/3}.notification-modal-created-date-title{grid-area:2/1/3/2}.notification-modal-created-date-text{grid-area:2/2/3/3}.notification-modal-site-title{grid-area:3/1/4/2}.notification-modal-site-text{grid-area:3/2/4/3}`,ConfirmationDialog=class extends MobxLitElement{constructor(){super(...arguments),this.textMessage="Are you sure?",this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("confirm-dialog-closed"))}}static get styles(){return[TWStyles,NotificationsStyle]}onClick(t){t=new CustomEvent("on-confirm-selection",{detail:{returnValue:t},bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return html`<ix-dialog ?open="${this.open}" class="w-[580px]" @closed="${this.dialogClosed}"><div slot="headline">${this.textMessage}</div><div slot="actions"><div class="flex flex-row justify-end p-1"><ix-button name="cancel" appearance="text" @click="${()=>this.onClick(!1)}">DISMISS</ix-button><ix-button name="confirm" appearance="text" @click="${()=>this.onClick(!0)}">YES</ix-button></div></div></ix-dialog>`}},ViewItemDialog=(__decorate([property({type:String,attribute:!0})],ConfirmationDialog.prototype,"textMessage",void 0),__decorate([property({type:Boolean,attribute:!0})],ConfirmationDialog.prototype,"open",void 0),ConfirmationDialog=__decorate([customElement("confirmation-dialog")],ConfirmationDialog),class extends MobxLitElement{constructor(){super(...arguments),this.notification={},this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("view-item-dialog-closed"))},this.viewRecord=()=>{this.dialogClosed(),NotificationsState.showDrawer=!1}}static get styles(){return[TWStyles,NotificationsStyle]}getUrl(){var t=this.notification.resourceId;switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return"/service-management/reports?ticketId="+t;case NotificationGroups.SERVICE_TICKETS:switch(this.notification.subGroup){case SubGroups.Remote_Hands:return"/service-management/service-tickets/remote-hands/"+t;case SubGroups.Customer_Care:return"/service-management/service-tickets/customer-care/"+t;case SubGroups.Deliveries:return`/service-management/service-tickets/${SubGroups.Deliveries}/`+t;case SubGroups.Facility_Access:return"/service-management/service-tickets/facility-access/"+t;case SubGroups.Removals:return"/service-management/service-tickets/removals/"+t;case SubGroups.Trouble_Ticket:return"/service-management/service-tickets/trouble-tickets/"+t;case SubGroups.FacilityAccessVisitorAccess:return"/service-management/service-tickets/facility-access/visitor-access/"+t;case SubGroups.FacilityAccessPermanentBadge:return"/service-management/service-tickets/facility-access/permanent-badge/"+t;case SubGroups.FacilityAccessOspAccess:return"/service-management/service-tickets/facility-access/osp-access/"+t;case SubGroups.FacilityAccessPopPoeAccess:return"/service-management/service-tickets/facility-access/pop-poe-access/"+t;default:return""}case NotificationGroups.INCIDENTS:return"/service-management/reports?ticketId="+t;case NotificationGroups.DCIM_ALERTS:return"/dcim/"+t;default:return""}}getLocation(){return void 0===this.notification.locations||this.notification.locations.length<1?"":1<this.notification.locations.length?"Multiple Sites":this.notification.locations[0]}getSubGroupDisplayName(){switch(this.notification.subGroup){case SubGroups.FacilityAccessVisitorAccess:case SubGroups.FacilityAccessPermanentBadge:case SubGroups.FacilityAccessOspAccess:case SubGroups.FacilityAccessPopPoeAccess:return"Facility Access";case"Incidents (GSN)":return"Incidents";case"Emergency Repairs (InSite 1.0)":return"Emergency Repairs";default:return this.notification.subGroup}}render(){return html`<ix-dialog ?open="${this.open}" @closed="${this.dialogClosed}" class="notification-modal"><div slot="headline" class="w-[560px]"><div class="flex flex-col flex-start"><div class="notification-modal-title text-2xl font-bold text-balance">${this.notification.resourceType}</div><div class="notification-modal-subtitle pt-4 pb-0 font-bold text-balance">${this.getSubGroupDisplayName()}</div></div></div><form class="notification-modal-content" slot="content" id="form-id" method="dialog"><div class="notification-modal-content-title notification-modal-subject-title">Subject</div><div class="notification-modal-subject-text font-normal text-wrap">${this.notification.subject}</div><div class="notification-modal-content-title notification-modal-created-date-title">Create Date</div><div class="notification-modal-created-date-text font-normal text-wrap">${format(new Date(this.notification.createdAt),"dd/MM/yyyy HH:mm:ss")}</div><div class="notification-modal-content-title notification-modal-site-title">Site</div><div class="notification-modal-site-text font-normal text-wrap">${this.getLocation()}</div></form><div slot="actions" class="flex flex-row flex-end"><ix-button form="form-id" appearance="text">Close</ix-button><ix-button href="${this.getUrl()}" @click="${this.viewRecord}" appearance="text">View Record</ix-button></div></ix-dialog>`}}),NotificationItem=(__decorate([property({type:Object,attribute:!1})],ViewItemDialog.prototype,"notification",void 0),__decorate([property({type:Boolean,attribute:!0})],ViewItemDialog.prototype,"open",void 0),ViewItemDialog=__decorate([customElement("view-item-dialog")],ViewItemDialog),class extends MobxLitElement{constructor(){super(...arguments),this.disabled=!1,this.notification={},this.showModal=!1,this.showDeleteConfirmation=!1}static get styles(){return[TWStyles,NotificationsStyle]}displayItem(){this.notification.status===NotificationStatus.UNREAD&&NotificationsState.setNotificationReadStatus(this.notification.id),this.showModal=!0}deleteItem(){this.disabled||(this.showDeleteConfirmation=!0)}confirmedDelete(t){t.detail.returnValue&&NotificationsState.setNotificationDeleted(this.notification.id).then(t=>{this.showDeleteResultMessage(t,this.notification.id)}),this.showDeleteConfirmation=!1}showDeleteResultMessage(t,e){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:e,content:html`<ix-message-toast toastId="${e}" .TMessageToast="${t.State.toLowerCase()}" forceClose>${t.Message}</ix-message-toast>`,autoClose:2e3,durationOut:2e3,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))}calculateDuration(){return void 0!==this.notification.createdAt?differenceInHours(new Date,new Date(this.notification.createdAt))<24?formatDistance(new Date(this.notification.createdAt),new Date,{addSuffix:!0}):html`<ix-date type="static" variant="date-time" .value="${this.notification.createdAt}"></ix-date>`:"N/A"}getNotificationIcon(){switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return plannedMaintenance;case NotificationGroups.SERVICE_TICKETS:return"sync_saved_locally";case NotificationGroups.INCIDENTS:return"report";case NotificationGroups.DCIM_ALERTS:return dcim;default:return"sync_saved_locally"}}getNotificationTitle(){switch(this.notification.resourceType){case NotificationGroups.PLANNED_MAINTENANCE:return"Planned Maintenance";case NotificationGroups.SERVICE_TICKETS:return this.getServiceTicketSubGroup()+" Service Ticket Update";case NotificationGroups.INCIDENTS:return"Emergency Repair";case NotificationGroups.DCIM_ALERTS:return"DCIM Alert";default:return"sync_saved_locally"}}getServiceTicketSubGroup(){var t,e;switch(null==(t=this.notification)?void 0:t.subGroup){case SubGroups.FacilityAccessVisitorAccess:case SubGroups.FacilityAccessPermanentBadge:case SubGroups.FacilityAccessOspAccess:case SubGroups.FacilityAccessPopPoeAccess:return"Facility Access";default:return null==(e=this.notification)?void 0:e.subGroup}}render(){var t;return html`<div class="relative notification-item"><div class="hover:bg-[rgba(0,0,0,0.04)] p-2 pl-3.5 flex gap-3 relative cursor-pointer items-center font-bold ${"unread"===(null==(t=this.notification)?void 0:t.status)?"notification-item-unread border-l-3 border-success":"notification-item-read border-l-3 border-transparent"}"><ix-icon style="--ix-icon-font-size:24px;--ix-icon-line-height:24px" icon="${this.getNotificationIcon()}" class="${"unread"===(null==(t=this.notification)?void 0:t.status)?"active-icon":"inactive-icon"}" @click="${this.displayItem}">${this.getNotificationIcon()}</ix-icon><div class="flex flex-col grow" @click="${this.displayItem}"><div class="grow text-base"><h2 class="dlr-text-caption">${this.getNotificationTitle()}</h2></div><div class="grow text-xs"><h3 class="dlr-text-caption text-on-surface-disabled">${this.calculateDuration()}</h3></div></div><div><view-item-dialog ?open="${this.showModal}" .notification="${this.notification}" @view-item-dialog-closed="${()=>{this.showModal=!1}}"></view-item-dialog><confirmation-dialog ?open="${this.showDeleteConfirmation}" @on-confirm-selection="${this.confirmedDelete}" @confirm-dialog-closed="${()=>{this.showModal=!1}}" textMessage="Are you sure you want to delete this notification?"></confirmation-dialog></div><ix-icon-button style="--md-icon-button-icon-size:24px" @click="${this.deleteItem}" @mouseover="${t=>{this.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:this.disabled?"Emergency Repair Notification cannot be removed":"Remove Notification",target:t.target}}))}}" @mouseout="${()=>this.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" ?disabled="${this.disabled}"><ix-icon slot="default" class="${this.disabled?"inactive-icon":"destructive-icon"}">${trash}</ix-icon></ix-icon-button></div></div>`}}),GroupedItem=(__decorate([property({type:Boolean})],NotificationItem.prototype,"disabled",void 0),__decorate([property({type:Object,attribute:!1})],NotificationItem.prototype,"notification",void 0),__decorate([state()],NotificationItem.prototype,"showModal",void 0),__decorate([state()],NotificationItem.prototype,"showDeleteConfirmation",void 0),NotificationItem=__decorate([customElement("notification-item")],NotificationItem),class extends MobxLitElement{constructor(){super(...arguments),this.groupTitle="Group 1",this.groupIcon="public",this.childItems=NotificationsState.notifications,this.isOpen=!1,this.onClick=()=>{this.isOpen=!this.isOpen}}static get styles(){return[TWStyles,NotificationsStyle]}renderNotificationItems(){var t;return this.isOpen?void 0!==(null==(t=this.childItems)?void 0:t.length)&&0<(null==(t=this.childItems)?void 0:t.length)?html`<div>${null==(t=this.childItems)?void 0:t.map(t=>html`<notification-item .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:html`<p class="dlr-text-caption ml-14 font-bold mr-4">No notifications yet.</p>`:html`${nothing}`}render(){var t;return html`<div class="group-container-row border-b border-outline py-3"><div class="flex items-center justify-between"><div class="flex items-center align-middle"><ix-icon-button icon="${this.isOpen?"arrow_drop_down":"arrow_right"}" @click="${this.onClick}"></ix-icon-button><ix-icon slot="default" class="ix-icon-groups">${unsafeSVG(this.groupIcon)}</ix-icon><p class="m-0 group-name font-bold pl-1">${this.groupTitle}</p><p class="m-0 pl-4">${null==(t=this.childItems)?void 0:t.length.toString().padStart(2,"0")}</p></div></div>${this.renderNotificationItems()}</div>`}}),GroupFilters=(__decorate([property({type:String,attribute:!0})],GroupedItem.prototype,"groupTitle",void 0),__decorate([property({type:String,attribute:!0})],GroupedItem.prototype,"groupIcon",void 0),__decorate([property({type:Array,attribute:!0})],GroupedItem.prototype,"childItems",void 0),__decorate([state()],GroupedItem.prototype,"isOpen",void 0),GroupedItem=__decorate([customElement("grouped-item")],GroupedItem),class extends MobxLitElement{static get styles(){return[TWStyles,NotificationsStyle]}onSwitchChange(t){var t=t.target,e=null==(e=t.attributes.getNamedItem("name"))?void 0:e.value;NotificationsState.setNotificationFilter(e,t.selected),this.requestUpdate()}render(){return html`<div class="flex flex-col"><label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch class="flex" name="${NotificationGroups.PLANNED_MAINTENANCE}" selected="${NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE}" @change="${this.onSwitchChange}"></ix-switch><span>Planned Maintenance</span></label> <label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch class="flex" name="${NotificationGroups.SERVICE_TICKETS}" selected="${NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS}" @change="${this.onSwitchChange}"></ix-switch><span>Service Ticket Updates</span></label> <label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"><ix-switch class="flex" name="${NotificationGroups.DCIM_ALERTS}" selected="${NotificationsState.notificationFilters.SHOW_DCIM_ALERTS}" @change="${this.onSwitchChange}"></ix-switch><span>${NotificationGroups.DCIM_ALERTS}</span></label></div>`}}),DateFilters=(GroupFilters=__decorate([customElement("group-filters")],GroupFilters),class extends MobxLitElement{constructor(){super(...arguments),this.fromDate=isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.FROM_DATE)?void 0:format(NotificationsState.dateFilters.FROM_DATE,DefaultDateFormat),this.toDate=isNullOrUndefinedOrEmpty(NotificationsState.dateFilters.TO_DATE)?void 0:format(NotificationsState.dateFilters.TO_DATE,DefaultDateFormat),this.maxDate=format(new Date,DefaultDateFormat),this.fromDateErrorText="",this.toDateErrorText=""}static get styles(){return[TWStyles,NotificationsStyle]}onFromDateChange(t){null===t||""===t?this.fromDate=void 0:(this.fromDate=t,void 0!==this.fromDate&&(this.fromDateErrorText=void 0))}onToDateChange(t){null===t||""===t?this.toDate=void 0:(this.toDate=t,void 0!==this.toDate&&(this.toDateErrorText=void 0))}onApplyDateFilter(t){if(t){if(void 0===this.toDate&&void 0!==this.fromDate)return void(this.toDateErrorText="Please select to date");if(void 0===this.fromDate&&void 0!==this.toDate)return void(this.fromDateErrorText="Please select from date");if(this.fromDate>this.toDate)return this.fromDateErrorText="From date cannot be later than To date.",void(this.fromDate=void 0);if(this.fromDateErrorText=void 0,this.toDate<this.fromDate)return this.toDateErrorText="To date cannot be earlier than From date.",void(this.toDate=void 0);this.toDateErrorText=void 0}t=t&&void 0===this.toDateErrorText&&void 0===this.fromDateErrorText,t&&(NotificationsState.setNotificationDateFilter(this.fromDate,this.toDate),this.requestUpdate()),t=new CustomEvent("on-selection",{detail:{returnValue:t},bubbles:!0,composed:!0});this.dispatchEvent(t)}clearDateFilters(){this.fromDate=void 0,this.toDate=void 0,this.fromDateErrorText=void 0,this.toDateErrorText=void 0}render(){return html`<div class="flex flex-col p-4"><div class="flex flex-row items-center"><div class="grow items-center text-xl font-bold">Filter by Date</div><div class="flex flex-row items-center" @click="${this.clearDateFilters}"><label class="grow text-sm text-right pr-1 cursor-pointer">Clear Filter</label><ix-icon-button small appearance="default" icon="domain_verification_off" class="active-icon"></ix-icon-button></div></div><ix-divider class="my-2"></ix-divider><div class="flex xl:flex-row lg:flex-col md:flex-col sm:flex-col justify-between item-center my-4"><div class="flex gap-2"><ix-date .value="${this.fromDate}" max="${this.maxDate}" label="From" name="FromDate" .errorText="${this.fromDateErrorText}" .onChanged="${t=>this.onFromDateChange(t)}"></ix-date><ix-date .value="${this.toDate}" max="${this.maxDate}" label="To" name="ToDate" .errorText="${this.toDateErrorText}" .onChanged="${t=>this.onToDateChange(t)}"></ix-date></div></div><div class="flex flex-row justify-between"><ix-button type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!1)}">Cancel</ix-button><ix-button type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!0)}">Filter List</ix-button></div></div>`}}),NotificationTooltip=(__decorate([state()],DateFilters.prototype,"fromDate",void 0),__decorate([state()],DateFilters.prototype,"toDate",void 0),__decorate([state()],DateFilters.prototype,"maxDate",void 0),__decorate([state()],DateFilters.prototype,"fromDateErrorText",void 0),__decorate([state()],DateFilters.prototype,"toDateErrorText",void 0),DateFilters=__decorate([customElement("date-filters")],DateFilters),class extends MobxLitElement{constructor(){super(...arguments),this.isVisible=!1,this.label="",this.hoveredElement=void 0,this.configureNotificationTooltip=t=>{var{label:t,target:e}=t.detail;this.hoveredElement=e,this.label=t,this.isVisible=!0},this.hideNotificationTooltip=()=>{this.isVisible=!1,this.hoveredElement=void 0,this.label=""}}static get styles(){return[TWStyles,NotificationsStyle]}connectedCallback(){super.connectedCallback(),window.addEventListener("show-notification-tooltip",this.configureNotificationTooltip),window.addEventListener("hide-notification-tooltip",this.hideNotificationTooltip)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("show-notification-tooltip",this.configureNotificationTooltip),window.removeEventListener("hide-notification-tooltip",this.hideNotificationTooltip)}updated(t){t.has("hoveredElement")&&this.isVisible&&this.hoveredElement&&computePosition(this.hoveredElement,this.notificationTooltip,{placement:"bottom-end"}).then(({x:t,y:e})=>{this.notificationTooltip.style.left=t+"px",this.notificationTooltip.style.top=e+12+"px"})}render(){var t={hidden:!this.isVisible};return html`<div class="notification-tooltip z-[9999] rounded absolute p-2 white-text ${classMap(t)}">${this.label}</div><slot></slot>`}});__decorate([query(".notification-tooltip")],NotificationTooltip.prototype,"notificationTooltip",void 0),__decorate([property({type:Boolean,reflect:!0})],NotificationTooltip.prototype,"isVisible",void 0),__decorate([property({type:String,reflect:!0})],NotificationTooltip.prototype,"label",void 0),__decorate([state()],NotificationTooltip.prototype,"hoveredElement",void 0),NotificationTooltip=__decorate([customElement("notification-tooltip")],NotificationTooltip);class IxNotifications extends MobxLitElement{constructor(){super(...arguments),this.showGroupedView=!1,this.showFilters=!1,this.showDateFilters=!1,this.showMarkAllReadConfirmation=!1,this.baseApiUrl="",this.localStorageKey=""}async firstUpdated(){NotificationsState.baseApiUrl=this.baseApiUrl,NotificationsState.localStorageKey=this.localStorageKey,NotificationsState.ConstructApiClient()}connectedCallback(){super.connectedCallback(),window.addEventListener("account-switched",NotificationsState.NewApiClient),window.addEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.addEventListener("beforeunload",this.handleOnbeforeunload)}disconnectedCallback(){window.removeEventListener("account-switched",NotificationsState.NewApiClient),window.removeEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.removeEventListener("beforeunload",this.handleOnbeforeunload),super.disconnectedCallback()}handleOnbeforeunload(t){NotificationsState.clearStoredNotificationsData()}toggleDrawer(){NotificationsState.showDrawer=!NotificationsState.showDrawer,NotificationsState.showDrawer||(this.showFilters=!1,this.showDateFilters=!1)}markAllread(){0<NotificationsState.unreadNotificationCount&&(this.showMarkAllReadConfirmation=!0)}confirmedMarkAllRead(t){if(t.detail.returnValue){var t=this.applyNotificationFilters(),i=null==t?void 0:t.filter(t=>t.status===NotificationStatus.UNREAD);if(0<i.length){let e=!0;null!=t&&t.forEach(t=>{NotificationsState.setNotificationReadStatus(t.id).then(t=>{e=e&&t})});t={State:!0===e?ApiCallState.SUCCESS:ApiCallState.ERROR,Message:!0===e?"Successfully marked all the notifications as read":"Error while marking the notifications read, Please try again"};this.showResultMessage(t,i[0].id),this.requestUpdate()}}this.showMarkAllReadConfirmation=!1}showResultMessage(t,e){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:e,content:html`<ix-message-toast toastId="${e}" .TMessageToast="${t.State.toLowerCase()}" forceClose>${t.Message}</ix-message-toast>`,autoClose:3e3,durationOut:3e3,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))}toggleGroupView(){this.showGroupedView=!this.showGroupedView}displayFilters(){this.showFilters=!this.showFilters}applyNotificationFilters(){var t=null==(t=NotificationsState.notifications)?void 0:t.filter(t=>t.resourceType===NotificationGroups.PLANNED_MAINTENANCE&&!0===NotificationsState.notificationFilters.SHOW_PLANNED_MAINTENANCE||t.resourceType===NotificationGroups.SERVICE_TICKETS&&!0===NotificationsState.notificationFilters.SHOW_SERVICE_TICKETS||t.resourceType===NotificationGroups.DCIM_ALERTS&&!0===NotificationsState.notificationFilters.SHOW_DCIM_ALERTS||t.resourceType===NotificationGroups.INCIDENTS);return void 0!==NotificationsState.dateFilters.FROM_DATE&&void 0!==NotificationsState.dateFilters.TO_DATE?t.filter(t=>0<=differenceInHours(new Date(t.createdAt),NotificationsState.dateFilters.FROM_DATE)&&differenceInDays(new Date(t.createdAt),NotificationsState.dateFilters.TO_DATE)<=0):void 0!==NotificationsState.dateFilters.FROM_DATE&&void 0===NotificationsState.dateFilters.TO_DATE?t.filter(t=>0<=differenceInHours(new Date(t.createdAt),NotificationsState.dateFilters.FROM_DATE)):void 0===NotificationsState.dateFilters.FROM_DATE&&void 0!==NotificationsState.dateFilters.TO_DATE?t.filter(t=>differenceInDays(new Date(t.createdAt),NotificationsState.dateFilters.TO_DATE)<=0):t}displayDateFilters(){this.showDateFilters=!this.showDateFilters}renderGroupedView(){var t=this.applyNotificationFilters();return html`<div class="-mx-4 -mt-2"><grouped-item groupTitle="Planned Maintenance" groupIcon="${plannedMaintenance.strings[0]}" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.PLANNED_MAINTENANCE)}"></grouped-item><grouped-item groupTitle="Emergency Repairs" groupIcon="report" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.INCIDENTS)}"></grouped-item><grouped-item groupTitle="Service Ticket Updates" groupIcon="sync_saved_locally" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.SERVICE_TICKETS)}"></grouped-item><grouped-item groupTitle="${NotificationGroups.DCIM_ALERTS}" groupIcon="${dcim.strings[0]}" .childItems="${null==t?void 0:t.filter(t=>t.resourceType===NotificationGroups.DCIM_ALERTS)}"></grouped-item></div>`}renderDefaultView(){var t=this.applyNotificationFilters(),e=t.filter(t=>0===differenceInDays(new Date(t.createdAt),new Date)),i=t.filter(t=>0!==differenceInDays(new Date(t.createdAt),new Date));return 0<(null==t?void 0:t.length)?html`<h3>Today</h3>${0<e.length?html`<div class="-mx-4">${null==e?void 0:e.map(t=>html`<notification-item .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:this.renderNoResult()}<h3>Earlier</h3>${0<i.length?html`<div class="-mx-4">${null==i?void 0:i.map(t=>html`<notification-item .notification="${t}" ?disabled="${t.resourceType===NotificationGroups.INCIDENTS}"></notification-item>`)}</div>`:this.renderNoResult()}`:html`<h3>Today</h3>${this.renderNoResult()}`}renderNoResult(){return html`<p class="dlr-text-caption my-4"><strong>No notifications yet.</strong></p>`}handleCloseClick(t){this.showDateFilters=!1,this.showFilters=!1}handleContentScroll(t){null!==t&&t.detail.scrollTop+t.detail.clientHeight>=t.detail.scrollHeight&&NotificationsState.getNotifications()}manageFilterVisibility(t){t=t.composedPath();!this.showFilters||t.includes(this.groupFilters)||t.includes(this.groupFiltersButton)||(this.showFilters=!1),!this.showDateFilters||t.includes(this.dateFilters)||t.includes(this.dateFiltersButton)||(this.showDateFilters=!1)}render(){return html`<notification-tooltip></notification-tooltip><confirmation-dialog ?open="${this.showMarkAllReadConfirmation}" @confirm-dialog-closed="${()=>{this.showMarkAllReadConfirmation=!1}}" @on-confirm-selection="${this.confirmedMarkAllRead}" textMessage="Are you sure you want to mark all notifications as read?"></confirmation-dialog><ix-drawer ?isVisible="${NotificationsState.showDrawer}" .onClosed="${()=>this.toggleDrawer()}" animate-vertical hide-close @on-content-scroll="${this.handleContentScroll}" @click="${this.manageFilterVisibility}" compact="compact"><div slot="content" class="m-4"><div class="flex flex-row justify-between grow items-center notification-header-container mb-4"><h2 class="grow items-center dlr-text-heading">Notifications</h2><div class="flex flex-row justify-end grow items-center options" style="--md-icon-button-icon-size:24px"><ix-icon-button @click="${this.markAllread}" @mouseover="${t=>{0<NotificationsState.unreadNotificationCount&&window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Mark All Read",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" icon="markunread_mailbox" class="${NotificationsState.unreadNotificationCount<=0?"inactive-icon":"active-icon"}" .disabled="${NotificationsState.unreadNotificationCount<=0}" filledIcon="true"></ix-icon-button><ix-icon-button @click="${this.toggleGroupView}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Sort by Type",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" label="Sort by Type"><ix-icon slot="default">${this.showGroupedView?sortCheck:"sort"}</ix-icon></ix-icon-button><ix-icon-button @click="${this.displayFilters}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Type",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" id="group-filter-button" label="Filter by Type"><ix-icon slot="default">${viewList}</ix-icon></ix-icon-button><div class="filter-dropdown-content ${this.showFilters?"active z-50":"hidden"}"><group-filters></group-filters></div><ix-icon-button @click="${this.displayDateFilters}" @mouseover="${t=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Date",target:t.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" icon="date_range" class="active-icon" filledIcon="true" id="date-filters-button" label="Filter by Date"></ix-icon-button><div class="datefilter-dropdown-content ${this.showDateFilters?"active z-50":"hidden"}" @on-selection="${this.handleCloseClick}"><date-filters></date-filters></div></div></div>${this.showGroupedView?this.renderGroupedView():this.renderDefaultView()}</div></ix-drawer>`}}IxNotifications.styles=[TWStyles,NotificationsStyle],__decorate([query("group-filters")],IxNotifications.prototype,"groupFilters",void 0),__decorate([query("ix-icon-button#group-filter-button")],IxNotifications.prototype,"groupFiltersButton",void 0),__decorate([query("date-filters")],IxNotifications.prototype,"dateFilters",void 0),__decorate([query("ix-icon-button#date-filters-button")],IxNotifications.prototype,"dateFiltersButton",void 0),__decorate([state()],IxNotifications.prototype,"showGroupedView",void 0),__decorate([state()],IxNotifications.prototype,"showFilters",void 0),__decorate([state()],IxNotifications.prototype,"showDateFilters",void 0),__decorate([state()],IxNotifications.prototype,"showMarkAllReadConfirmation",void 0),__decorate([property({type:String})],IxNotifications.prototype,"baseApiUrl",void 0),__decorate([property({type:String})],IxNotifications.prototype,"localStorageKey",void 0),window.customElements.define("ix-notifications",IxNotifications);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Webcomponent ix-notifications following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Digital Realty",
|
|
6
|
-
"version": "1.1.
|
|
6
|
+
"version": "1.1.27",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"module": "dist/index.js",
|
|
@@ -138,5 +138,5 @@
|
|
|
138
138
|
"README.md",
|
|
139
139
|
"LICENSE"
|
|
140
140
|
],
|
|
141
|
-
"gitHead": "
|
|
141
|
+
"gitHead": "c4df969f31b4b56f8187d26947a65b77730b9bd0"
|
|
142
142
|
}
|