@digital-realty/app-shell 13.0.2 → 13.0.3-IXUAT-10198.532096
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.
|
@@ -1470,11 +1470,11 @@ video {
|
|
|
1470
1470
|
.xl\\:flex-row {
|
|
1471
1471
|
flex-direction: row;
|
|
1472
1472
|
}
|
|
1473
|
-
} `;var N;(function(i){i.READ="read",i.UNREAD="unread"})(N||(N={}));var m;(function(i){i.PLANNED_MAINTENANCE="Planned Maintenance",i.INCIDENTS="Incidents",i.DCIM_ALERTS="DCIM Alerts",i.SERVICE_TICKETS="Service Tickets"})(m||(m={}));var v;(function(i){i.Remote_Hands="Remote Hands",i.Deliveries="Deliveries",i.Removals="Removals",i.Facility_Access="Facility Access",i.Trouble_Ticket="Trouble Ticket",i.Customer_Care="Customer Care",i.FacilityAccessVisitorAccess="FacilityAccessVisitorAccess",i.FacilityAccessPermanentBadge="FacilityAccessPermanentBadge",i.FacilityAccessOspAccess="FacilityAccessOspAccess",i.FacilityAccessPopPoeAccess="FacilityAccessPopPoeAccess"})(v||(v={}));var U;(function(i){i.LOADING="Loading",i.ERROR="Error",i.SUCCESS="Success"})(U||(U={}));const ee="yyyy-MM-dd",ti=30,Pe="yyyy-MM-dd HH:mm:ss",ii="http://api.digitalrealty.com/notifications".replace(/\/+$/,"");class ze{constructor(e={}){this.configuration=e}set config(e){this.configuration=e}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:ii}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Fe}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const e=this.configuration.apiKey;if(e)return typeof e=="function"?e:()=>e}get accessToken(){const e=this.configuration.accessToken;if(e)return typeof e=="function"?e:async()=>e}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const oi=new ze;class pe{constructor(e=oi){this.configuration=e,this.fetchApi=async(t,o)=>{let a={url:t,init:o};for(const r of this.middleware)r.pre&&(a=await r.pre({fetch:this.fetchApi,...a})||a);let n;try{n=await(this.configuration.fetchApi||fetch)(a.url,a.init)}catch(r){for(const s of this.middleware)s.onError&&(n=await s.onError({fetch:this.fetchApi,url:a.url,init:a.init,error:r,response:n?n.clone():void 0})||n);if(n===void 0)throw r instanceof Error?new ri(r,"The request failed and the interceptors did not return an alternative response"):r}for(const r of this.middleware)r.post&&(n=await r.post({fetch:this.fetchApi,url:a.url,init:a.init,response:n.clone()})||n);return n},this.middleware=e.middleware}withMiddleware(...e){const t=this.clone();return t.middleware=t.middleware.concat(...e),t}withPreMiddleware(...e){const t=e.map(o=>({pre:o}));return this.withMiddleware(...t)}withPostMiddleware(...e){const t=e.map(o=>({post:o}));return this.withMiddleware(...t)}isJsonMime(e){return e?pe.jsonRegex.test(e):!1}async request(e,t){const{url:o,init:a}=await this.createFetchParams(e,t),n=await this.fetchApi(o,a);if(n&&n.status>=200&&n.status<300)return n;throw new Oe(n,"Response returned an error code")}async createFetchParams(e,t){let o=this.configuration.basePath+e.path;e.query!==void 0&&Object.keys(e.query).length!==0&&(o+="?"+this.configuration.queryParamsStringify(e.query));const a=Object.assign({},this.configuration.headers,e.headers);Object.keys(a).forEach(u=>a[u]===void 0?delete a[u]:{});const n=typeof t=="function"?t:async()=>t,r={method:e.method,headers:a,body:e.body,credentials:this.configuration.credentials},s={...r,...await n({init:r,context:e})};let l;ni(s.body)||s.body instanceof URLSearchParams||ai(s.body)?l=s.body:this.isJsonMime(a["Content-Type"])?l=JSON.stringify(s.body):l=s.body;const d={...s,body:l};return{url:o,init:d}}clone(){const e=this.constructor,t=new e(this.configuration);return t.middleware=this.middleware.slice(),t}}pe.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function ai(i){return typeof Blob<"u"&&i instanceof Blob}function ni(i){return typeof FormData<"u"&&i instanceof FormData}class Oe extends Error{constructor(e,t){super(t),this.response=e,this.name="ResponseError"}}class ri extends Error{constructor(e,t){super(t),this.cause=e,this.name="FetchError"}}class ce extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const si={csv:","};function Fe(i,e=""){return Object.keys(i).map(t=>Ze(t,i[t],e)).filter(t=>t.length>0).join("&")}function Ze(i,e,t=""){const o=t+(t.length?`[${i}]`:i);if(e instanceof Array){const a=e.map(n=>encodeURIComponent(String(n))).join(`&${encodeURIComponent(o)}=`);return`${encodeURIComponent(o)}=${a}`}if(e instanceof Set){const a=Array.from(e);return Ze(i,a,t)}return e instanceof Date?`${encodeURIComponent(o)}=${encodeURIComponent(e.toISOString())}`:e instanceof Object?Fe(e,o):`${encodeURIComponent(o)}=${encodeURIComponent(String(e))}`}class j{constructor(e,t=o=>o){this.raw=e,this.transformer=t}async value(){return this.transformer(await this.raw.json())}}function Be(i){return li(i)}function li(i,e){return i}function Ha(i){return i}function ve(i){return ci(i)}function ci(i,e){return i==null?i:{id:i.id==null?void 0:i.id,resourceType:i.resource_type==null?void 0:i.resource_type,subGroup:i.sub_group==null?void 0:i.sub_group,createdAt:i.created_at==null?void 0:new Date(i.created_at),createdBy:i.created_by==null?void 0:i.created_by,subject:i.subject==null?void 0:i.subject,locations:i.locations==null?void 0:i.locations,resourceId:i.resource_id==null?void 0:i.resource_id,status:i.status==null?void 0:Be(i.status),accountNumber:i.account_number==null?void 0:i.account_number}}function di(i){return ui(i)}function ui(i,e){return i==null?i:{self:i.self==null?void 0:i.self,first:i.first==null?void 0:i.first,prev:i.prev==null?void 0:i.prev,next:i.next==null?void 0:i.next,last:i.last==null?void 0:i.last,items:i.items.map(ve)}}function hi(i){return pi(i,!1)}function pi(i,e=!1){return i==null?i:{status:i.status}}function mi(i){return gi(i)}function gi(i,e){return i==null?i:{updatedCount:i.updated_count==null?void 0:i.updated_count}}function fi(i){return wi(i)}function wi(i,e){return i==null?i:{success:i.success==null?void 0:i.success}}function bi(i){return vi(i)}function vi(i,e){return i==null?i:{status:Be(i.status)}}function xi(i){return yi(i,!1)}function yi(i,e=!1){return i==null?i:{status:i.status}}function Ci(i){return _i(i,!1)}function _i(i,e=!1){return i==null?i:{resource_type:i.resourceType,sub_group:i.subGroup,recipients:i.recipients,account_number:i.accountNumber,locations:i.locations,resource_id:i.resourceId,subject:i.subject,created_at:i.createdAt==null?i.createdAt:i.createdAt.toISOString()}}class ki extends pe{async createNotificationRaw(e,t){const o={},a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const r=this.configuration.accessToken,s=await r("bearerToken",[]);s&&(a.Authorization=`Bearer ${s}`)}const n=await this.request({path:"/notifications",method:"POST",headers:a,query:o,body:Ci(e.notificationRequest)},t);return new j(n,r=>ve(r))}async createNotification(e={},t){return await(await this.createNotificationRaw(e,t)).value()}async deleteNotificationsByIdRaw(e,t){if(e.id==null)throw new ce("id",'Required parameter "id" was null or undefined when calling deleteNotificationsById().');const o={},a={};if(this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,l=await s("bearerToken",[]);l&&(a.Authorization=`Bearer ${l}`)}let n="/notifications/{id}";n=n.replace("{id}",encodeURIComponent(String(e.id)));const r=await this.request({path:n,method:"DELETE",headers:a,query:o},t);return new j(r,s=>fi(s))}async deleteNotificationsById(e,t){return await(await this.deleteNotificationsByIdRaw(e,t)).value()}async getNotificationsRaw(e,t){const o={};e.sort!=null&&(o.sort=e.sort),e.cursor!=null&&(o.cursor=e.cursor),e.resourceType!=null&&(o.resource_type=e.resourceType),e.accountNumber!=null&&(o.account_number=e.accountNumber),e.createdAfter!=null&&(o.created_after=e.createdAfter.toISOString()),e.createdBefore!=null&&(o.created_before=e.createdBefore.toISOString()),e.locationId!=null&&(o.location_id=e.locationId),e.subGroup!=null&&(o.sub_group=e.subGroup),e.status!=null&&(o.status=e.status);const a={};if(e.prefer!=null&&(a.Prefer=e.prefer.join(si.csv)),this.configuration&&this.configuration.accessToken){const r=this.configuration.accessToken,s=await r("bearerToken",[]);s&&(a.Authorization=`Bearer ${s}`)}const n=await this.request({path:"/notifications",method:"GET",headers:a,query:o},t);return new j(n,r=>di(r))}async getNotifications(e={},t){return await(await this.getNotificationsRaw(e,t)).value()}async getNotificationsByIdRaw(e,t){if(e.id==null)throw new ce("id",'Required parameter "id" was null or undefined when calling getNotificationsById().');const o={},a={};if(this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,l=await s("bearerToken",[]);l&&(a.Authorization=`Bearer ${l}`)}let n="/notifications/{id}";n=n.replace("{id}",encodeURIComponent(String(e.id)));const r=await this.request({path:n,method:"GET",headers:a,query:o},t);return new j(r,s=>ve(s))}async getNotificationsById(e,t){return await(await this.getNotificationsByIdRaw(e,t)).value()}async patchNotificationsRaw(e,t){if(e.notificationBulkPatch==null)throw new ce("notificationBulkPatch",'Required parameter "notificationBulkPatch" was null or undefined when calling patchNotifications().');const o={},a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const r=this.configuration.accessToken,s=await r("bearerToken",[]);s&&(a.Authorization=`Bearer ${s}`)}const n=await this.request({path:"/notifications",method:"PATCH",headers:a,query:o,body:hi(e.notificationBulkPatch)},t);return new j(n,r=>mi(r))}async patchNotifications(e,t){return await(await this.patchNotificationsRaw(e,t)).value()}async patchNotificationsByIdRaw(e,t){if(e.id==null)throw new ce("id",'Required parameter "id" was null or undefined when calling patchNotificationsById().');const o={},a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,l=await s("bearerToken",[]);l&&(a.Authorization=`Bearer ${l}`)}let n="/notifications/{id}";n=n.replace("{id}",encodeURIComponent(String(e.id)));const r=await this.request({path:n,method:"PATCH",headers:a,query:o,body:xi(e.notificationPatch)},t);return new j(r,s=>bi(s))}async patchNotificationsById(e,t){return await(await this.patchNotificationsByIdRaw(e,t)).value()}}const Ai={Notifications:"notifications"};class Ei{constructor(e){this.noInit=!1,this.configuration=e}get notificationsApi(){return new ki(new ze({basePath:`${this.configuration.NotificationApiUrl}/${Ai.Notifications}`,headers:{Authorization:this.getAuthorization()}}))}getAuthorization(){return this.configuration.getAuthorizationFn?this.configuration.getAuthorizationFn():""}}const xe=i=>i==null||i==="",Si=i=>{switch(i.toLowerCase()){case"planned maintenance":return m.PLANNED_MAINTENANCE;case"incidents":return m.INCIDENTS;case"dcim alerts":return m.DCIM_ALERTS;case"service tickets":return m.SERVICE_TICKETS;default:return m.PLANNED_MAINTENANCE}},$i=i=>{switch(i.toLowerCase()){case"unread":return N.UNREAD;case"read":return N.READ;default:return N.UNREAD}},Ni=i=>({sort:"-created_at",cursor:i,prefer:[""]}),Ti=(i,e)=>({id:i,notificationPatch:{status:e}}),Mi=i=>({id:i}),Ue=i=>{var e,t,o,a,n,r,s,l;return{subject:(e=i.subject)!=null?e:"",id:i.id,accountNumber:(t=i.accountNumber)!=null?t:"",resourceType:Si((o=i.resourceType)!=null?o:""),subGroup:(a=i.subGroup)!=null?a:"",resourceId:(n=i.resourceId)!=null?n:"",status:$i((r=i.status)!=null?r:""),createdAt:xe(i.createdAt)?Z(new Date,Pe):Z(i.createdAt,Pe),createdBy:(s=i.createdBy)!=null?s:"",locations:(l=i.locations)!=null?l:[]}},je=i=>i.map(e=>Ue(e)),Li=i=>{const e=new URLSearchParams(i),t=e.has("cursor")?e.get("cursor"):"";return t!==null?t:""},te=async(i,e=!0)=>{let t="An error occurred";if(i instanceof Oe&&i.response.status===400)try{const{detail:o}=await i.response.json();t=o,e&&console.error(t)}catch(o){console.error(i)}else console.error(i)},Ii=i=>{const e=localStorage.getItem(i);return e?JSON.parse(e):null},Di=i=>{var e;return`Bearer ${(e=Ii(i))==null?void 0:e.access_token}`};let Hi=class{constructor(){this.showDrawer=!1,this.apiClient={noInit:!0},this.baseApiUrl="",this.localStorageKey="",this.NewApiClient=()=>{this.apiClient=new Ei({NotificationApiUrl:this.baseApiUrl,getAuthorizationFn:()=>Di(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:m.PLANNED_MAINTENANCE,subGroup:"",subject:"",resourceId:"",locations:[],createdAt:"",accountNumber:"",createdBy:"",status:N.READ},this.dateFilters={FROM_DATE:At(new Date,ti),TO_DATE:new Date},bt(this),xt(this,{name:"notification-state",properties:["notificationFilters","nextPageCursor"],storage:window.localStorage})}get isHydrated(){return yt(this)}async hydrateStore(){await Ct(this)}async clearStoredData(){await _t(this)}async getStoredData(){return kt(this)}ConstructApiClient(){return this.apiClient.noInit?this.NewApiClient():this.apiClient}async clearStoredNotificationsData(){this.notifications=[],this.unreadNotificationCount=0,this.nextPageCursor="",this.apiClient={noInit:!0}}async setNotificationReadStatus(e){const t=await this.setNotificationAsRead(e.toString());if(await t===!0){this.ReduceUnreadNotificationCount();const o=this.notifications.findIndex(a=>a.id===e);this.notifications[o].status=N.READ,this.selectedNotification=this.notifications[o]}return t}async setNotificationDeleted(e){const t=await this.DeleteNotification(e.toString());if(t===!0){const o=this.notifications.find(n=>n.id===e);(o==null?void 0:o.status)==="unread"&&this.ReduceUnreadNotificationCount();const a=this.notifications.findIndex(n=>n.id===e);this.notifications.splice(a,1)}return{State:t===!0?U.SUCCESS:U.ERROR,Message:t===!0?"Successfully deleted the notification":"Error while deleting the notification"}}setNotificationDateFilter(e,t){e!==void 0?this.dateFilters.FROM_DATE=Ne(e,ee,new Date):this.dateFilters.FROM_DATE=void 0,t!==void 0?this.dateFilters.TO_DATE=Ne(t,ee,new Date):this.dateFilters.TO_DATE=void 0}setNotificationFilter(e,t){switch(e){case m.PLANNED_MAINTENANCE:this.notificationFilters.SHOW_PLANNED_MAINTENANCE=t;break;case m.SERVICE_TICKETS:this.notificationFilters.SHOW_SERVICE_TICKETS=t;break;case m.DCIM_ALERTS:this.notificationFilters.SHOW_DCIM_ALERTS=t;break}}async getNotifications(){var e;let t;if(this.nextPageCursor!==void 0&&(t=await((e=this.apiClient)==null?void 0:e.notificationsApi.getNotificationsRaw(Ni(Li(this.nextPageCursor))).catch(o=>{te(o,!1)})),t)){const o=await(t==null?void 0:t.value());this.notifications=this.nextPageCursor===""?je(o==null?void 0:o.items):this.notifications.concat(je(o==null?void 0:o.items)),this.nextPageCursor=(o==null?void 0:o.next)!==void 0?o==null?void 0:o.next:void 0,this.unreadNotificationCount=t.raw.headers.get("x-total-unread-count")!==null&&t.raw.headers.get("x-total-unread-count")!==void 0?t.raw.headers.get("x-total-unread-count"):0}}async getNotificationsById(e){var t;let o;e&&(o=await((t=this.apiClient)==null?void 0:t.notificationsApi.getNotificationsById({id:e}).catch(a=>{te(a,!1)}))),o&&(this.selectedNotification=Ue(o))}async setNotificationAsRead(e){var t;return e?(await((t=this.apiClient)==null?void 0:t.notificationsApi.patchNotificationsById(Ti(e,"read")).catch(o=>(te(o,!1),!1))),!0):!1}async setAllNotificationAsRead(){var e;const t=await((e=this.apiClient)==null?void 0:e.notificationsApi.patchNotifications({notificationBulkPatch:{status:N.READ}}).catch(o=>(te(o,!1),!1)));return this.notifications=this.notifications.map(o=>({...o,status:N.READ})),this.unreadNotificationCount=0,t}async DeleteNotification(e){var t;let o=!1;return e&&await((t=this.apiClient)==null?void 0:t.notificationsApi.deleteNotificationsById(Mi(e)).catch(a=>{te(a,!1),o=!1}).then(()=>{o=!0})),o}ReduceUnreadNotificationCount(){this.unreadNotificationCount>0&&(this.unreadNotificationCount-=1)}};const h=new Hi,H=I`:host{--ix-drawer-border-radius:0;--ix-drawer-padding:0;--ix-drawer-width-sm:320px;--ix-drawer-width-md:320px;--ix-drawer-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}`;let de=class extends M{constructor(){super(...arguments),this.textMessage="Are you sure?",this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("confirm-dialog-closed")),this.onClick(!1)}}static get styles(){return[A,H]}onClick(e){const t=new CustomEvent("on-confirm-selection",{detail:{returnValue:e},bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return c` <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>`}};p([k({type:String,attribute:!0})],de.prototype,"textMessage",void 0),p([k({type:Boolean,attribute:!0})],de.prototype,"open",void 0),de=p([z("confirmation-dialog")],de);let ue=class extends M{constructor(){super(...arguments),this.notification={},this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("view-item-dialog-closed"))},this.viewRecord=()=>{this.dialogClosed(),h.showDrawer=!1}}static get styles(){return[A,H]}getUrl(){const e=this.notification.resourceId;switch(this.notification.resourceType){case m.PLANNED_MAINTENANCE:return`/service-management/reports?ticketId=${e}`;case m.SERVICE_TICKETS:switch(this.notification.subGroup){case v.Remote_Hands:return`/service-management/service-tickets/remote-hands/${e}`;case v.Customer_Care:return`/service-management/service-tickets/customer-care/${e}`;case v.Deliveries:return`/service-management/service-tickets/${v.Deliveries}/${e}`;case v.Facility_Access:return`/service-management/service-tickets/facility-access/${e}`;case v.Removals:return`/service-management/service-tickets/removals/${e}`;case v.Trouble_Ticket:return`/service-management/service-tickets/trouble-tickets/${e}`;case v.FacilityAccessVisitorAccess:return`/service-management/service-tickets/facility-access/visitor-access/${e}`;case v.FacilityAccessPermanentBadge:return`/service-management/service-tickets/facility-access/permanent-badge/${e}`;case v.FacilityAccessOspAccess:return`/service-management/service-tickets/facility-access/osp-access/${e}`;case v.FacilityAccessPopPoeAccess:return`/service-management/service-tickets/facility-access/pop-poe-access/${e}`;default:return""}case m.INCIDENTS:return`/service-management/reports?ticketId=${e}`;case m.DCIM_ALERTS:return`/dcim/${e}`;default:return""}}getLocation(){return this.notification.locations===void 0||this.notification.locations.length<1?"":this.notification.locations.length>1?"Multiple Sites":this.notification.locations[0]}getSubGroupDisplayName(){switch(this.notification.subGroup){case v.FacilityAccessVisitorAccess:case v.FacilityAccessPermanentBadge:case v.FacilityAccessOspAccess:case v.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 c` <ix-dialog ?open="${this.open}" @closed="${this.dialogClosed}" class="notification-modal" data-testclass="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" data-testid="notification-view-item-ticket-type"> ${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" data-testid="notification-view-item-subject"> ${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" data-testid="notification-view-item-date"> ${Z(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" data-testid="notification-view-item-site-text"> ${this.getLocation()} </div> </form> <div slot="actions" class="flex flex-row flex-end"> <ix-button data-testid="notification-view-item-close" form="form-id" appearance="text"> Close </ix-button> <ix-button data-testid="notification-view-item-view-record" href="${this.getUrl()}" @click="${this.viewRecord}" appearance="text">View Record</ix-button> </div> </ix-dialog>`}};p([k({type:Object,attribute:!1})],ue.prototype,"notification",void 0),p([k({type:Boolean,attribute:!0})],ue.prototype,"open",void 0),ue=p([z("view-item-dialog")],ue);let O=class extends M{constructor(){super(...arguments),this.disabled=!1,this.read=!1,this.notification={},this.showModal=!1,this.showDeleteConfirmation=!1}static get styles(){return[A,H]}displayItem(){this.notification.status===N.UNREAD&&(h.setNotificationReadStatus(this.notification.id),this.read=!0),this.showModal=!0}deleteItem(){this.disabled||(this.showDeleteConfirmation=!0)}confirmedDelete(e){e.detail.returnValue&&h.setNotificationDeleted(this.notification.id).then(t=>{this.showDeleteResultMessage(t,this.notification.id)}),this.showDeleteConfirmation=!1}showDeleteResultMessage(e,t){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:t,content:c` <ix-message-toast data-testid="notification-delete-toast" toastId="${t}" .TMessageToast="${e.State.toLowerCase()}" forceClose> ${e.Message} </ix-message-toast>`,autoClose:2e3,durationOut:2e3,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))}calculateDuration(){return this.notification.createdAt!==void 0?me(new Date,new Date(this.notification.createdAt))<24?Et(new Date(this.notification.createdAt),new Date,{addSuffix:!0}):c`<ix-date type="static" variant="date-time" .value="${this.notification.createdAt}"></ix-date>`:"N/A"}getNotificationIcon(){switch(this.notification.resourceType){case m.PLANNED_MAINTENANCE:return Re;case m.SERVICE_TICKETS:return"sync_saved_locally";case m.INCIDENTS:return"report";case m.DCIM_ALERTS:return Ve;default:return"sync_saved_locally"}}getNotificationTitle(){switch(this.notification.resourceType){case m.PLANNED_MAINTENANCE:return"Planned Maintenance";case m.SERVICE_TICKETS:return`${this.getServiceTicketSubGroup()} Service Ticket Update`;case m.INCIDENTS:return"Emergency Repair";case m.DCIM_ALERTS:return"DCIM Alert";default:return"sync_saved_locally"}}getServiceTicketSubGroup(){var e,t;switch((e=this.notification)==null?void 0:e.subGroup){case v.FacilityAccessVisitorAccess:case v.FacilityAccessPermanentBadge:case v.FacilityAccessOspAccess:case v.FacilityAccessPopPoeAccess:return"Facility Access";default:return(t=this.notification)==null?void 0:t.subGroup}}render(){return c` <div data-testid="notification-item" 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 ${this.read?"notification-item-read border-l-3 border-transparent":"notification-item-unread border-l-3 border-success"}"> <ix-icon style="--ix-icon-font-size:24px;--ix-icon-line-height:24px" icon="${this.getNotificationIcon()}" class="${this.read?"inactive-icon":"active-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?" data-testclass="notification-delete-confirmation"> </confirmation-dialog> </div> <ix-icon-button style="--md-icon-button-icon-size:24px" data-testclass="delete-notification" @click="${this.deleteItem}" @mouseover="${e=>{this.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:this.disabled?"Emergency Repair Notification cannot be removed":"Remove Notification",target:e.target}}))}}" @mouseout="${()=>this.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" ?disabled="${this.disabled}"> <ix-icon slot="default" class="${this.disabled?"inactive-icon":"destructive-icon"}"> ${Xt} </ix-icon> </ix-icon-button> </div> </div> `}};p([k({type:Boolean})],O.prototype,"disabled",void 0),p([k({type:Boolean})],O.prototype,"read",void 0),p([k({type:Object,attribute:!1})],O.prototype,"notification",void 0),p([$()],O.prototype,"showModal",void 0),p([$()],O.prototype,"showDeleteConfirmation",void 0),O=p([z("notification-item")],O);let q=class extends M{constructor(){super(...arguments),this.groupTitle="Group 1",this.groupIcon="public",this.childItems=h.notifications,this.isOpen=!1,this.onClick=()=>{this.isOpen=!this.isOpen}}static get styles(){return[A,H]}renderNotificationItems(){var e,t,o;return this.isOpen?((e=this.childItems)==null?void 0:e.length)!==void 0&&((t=this.childItems)==null?void 0:t.length)>0?c`<div> ${(o=this.childItems)==null?void 0:o.map(a=>c`<notification-item .notification="${a}" ?disabled="${a.resourceType===m.INCIDENTS}" data-testclass="notification-item"> </notification-item>`)} </div>`:c`<p class="dlr-text-caption ml-14 font-bold mr-4" data-testid="msg-no-notifications"> No notifications yet. </p>`:c`${b}`}render(){var e;return c`<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}" data-testclass="grouped-item-toggle-expand"> </ix-icon-button> <ix-icon slot="default" class="ix-icon-groups">${St(this.groupIcon)}</ix-icon> <p class="m-0 group-name font-bold pl-1">${this.groupTitle}</p> <p class="m-0 pl-4"> ${(e=this.childItems)==null?void 0:e.length.toString().padStart(2,"0")} </p> </div> </div> ${this.renderNotificationItems()} </div>`}};p([k({type:String,attribute:!0})],q.prototype,"groupTitle",void 0),p([k({type:String,attribute:!0})],q.prototype,"groupIcon",void 0),p([k({type:Array,attribute:!0})],q.prototype,"childItems",void 0),p([$()],q.prototype,"isOpen",void 0),q=p([z("grouped-item")],q);let qe=class extends M{static get styles(){return[A,H]}onSwitchChange(e){var t;const o=e.target,a=(t=o.attributes.getNamedItem("name"))==null?void 0:t.value;h.setNotificationFilter(a,o.selected),this.requestUpdate()}render(){return c` <div class="flex flex-col"> <label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"> <ix-switch data-testid="planned-maintenance-switch" class="flex" name="${m.PLANNED_MAINTENANCE}" selected="${h.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 data-testid="service-tickets-switch" class="flex" name="${m.SERVICE_TICKETS}" selected="${h.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 data-testid="dcim-alerts-switch" class="flex" name="${m.DCIM_ALERTS}" selected="${h.notificationFilters.SHOW_DCIM_ALERTS}" @change="${this.onSwitchChange}"></ix-switch> <span>${m.DCIM_ALERTS}</span></label> </div>`}};qe=p([z("group-filters")],qe);let F=class extends M{constructor(){super(...arguments),this.fromDate=xe(h.dateFilters.FROM_DATE)?void 0:Z(h.dateFilters.FROM_DATE,ee),this.toDate=xe(h.dateFilters.TO_DATE)?void 0:Z(h.dateFilters.TO_DATE,ee),this.maxDate=Z(new Date,ee),this.fromDateErrorText="",this.toDateErrorText=""}static get styles(){return[A,H]}onFromDateChange(e){e===null||e===""?this.fromDate=void 0:(this.fromDate=e,this.fromDate!==void 0&&(this.fromDateErrorText=void 0))}onToDateChange(e){e===null||e===""?this.toDate=void 0:(this.toDate=e,this.toDate!==void 0&&(this.toDateErrorText=void 0))}onApplyDateFilter(e){if(e){if(this.toDate===void 0&&this.fromDate!==void 0){this.toDateErrorText="Please select to date";return}if(this.fromDate===void 0&&this.toDate!==void 0){this.fromDateErrorText="Please select from date";return}if(this.fromDate>this.toDate){this.fromDateErrorText="From date cannot be later than To date.",this.fromDate=void 0;return}if(this.fromDateErrorText=void 0,this.toDate<this.fromDate){this.toDateErrorText="To date cannot be earlier than From date.",this.toDate=void 0;return}this.toDateErrorText=void 0}const t=e&&this.toDateErrorText===void 0&&this.fromDateErrorText===void 0;t&&(h.setNotificationDateFilter(this.fromDate,this.toDate),this.requestUpdate());const o=new CustomEvent("on-selection",{detail:{returnValue:t},bubbles:!0,composed:!0});this.dispatchEvent(o)}clearDateFilters(){this.fromDate=void 0,this.toDate=void 0,this.fromDateErrorText=void 0,this.toDateErrorText=void 0}render(){return c` <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 data-testid="notifications-clear-date-filter" 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 data-testid="notifications-from-date" .value="${this.fromDate}" max="${this.maxDate}" label="From" name="FromDate" .errorText="${this.fromDateErrorText}" .onChanged="${e=>this.onFromDateChange(e)}"> </ix-date> <ix-date data-testid="notifications-to-date" .value="${this.toDate}" max="${this.maxDate}" label="To" name="ToDate" .errorText="${this.toDateErrorText}" .onChanged="${e=>this.onToDateChange(e)}"></ix-date> </div> </div> <div class="flex flex-row justify-between"> <ix-button data-testid="notifications-cancel-date-filter" type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!1)}">Cancel</ix-button> <ix-button data-testid="notifications-activate-date-filter" type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!0)}">Filter List</ix-button> </div> </div>`}};p([$()],F.prototype,"fromDate",void 0),p([$()],F.prototype,"toDate",void 0),p([$()],F.prototype,"maxDate",void 0),p([$()],F.prototype,"fromDateErrorText",void 0),p([$()],F.prototype,"toDateErrorText",void 0),F=p([z("date-filters")],F);let G=class extends M{constructor(){super(...arguments),this.isVisible=!1,this.label="",this.hoveredElement=void 0,this.configureNotificationTooltip=e=>{const{label:t,target:o}=e.detail;this.hoveredElement=o,this.label=t,this.isVisible=!0},this.hideNotificationTooltip=()=>{this.isVisible=!1,this.hoveredElement=void 0,this.label=""}}static get styles(){return[A,H]}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(e){e.has("hoveredElement")&&this.isVisible&&this.hoveredElement&&Te(this.hoveredElement,this.notificationTooltip,{placement:"bottom-end"}).then(({x:t,y:o})=>{this.notificationTooltip.style.left=`${t}px`,this.notificationTooltip.style.top=`${o+12}px`})}render(){const e={hidden:!this.isVisible};return c`<div class="notification-tooltip z-[9999] rounded absolute p-2 white-text ${$t(e)}"> ${this.label} </div> <slot></slot>`}};p([J(".notification-tooltip")],G.prototype,"notificationTooltip",void 0),p([k({type:Boolean,reflect:!0})],G.prototype,"isVisible",void 0),p([k({type:String,reflect:!0})],G.prototype,"label",void 0),p([$()],G.prototype,"hoveredElement",void 0),G=p([z("notification-tooltip")],G);class T extends M{constructor(){super(...arguments),this.showGroupedView=!1,this.showFilters=!1,this.showDateFilters=!1,this.showMarkAllReadConfirmation=!1,this.baseApiUrl="",this.localStorageKey=""}async firstUpdated(){h.baseApiUrl=this.baseApiUrl,h.localStorageKey=this.localStorageKey,h.ConstructApiClient()}connectedCallback(){super.connectedCallback(),window.addEventListener("account-switched",h.NewApiClient),window.addEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.addEventListener("beforeunload",this.handleOnbeforeunload)}disconnectedCallback(){super.disconnectedCallback(),this.handleOnbeforeunload(),window.removeEventListener("account-switched",h.NewApiClient),window.removeEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.removeEventListener("beforeunload",this.handleOnbeforeunload)}handleOnbeforeunload(){h.clearStoredNotificationsData()}toggleDrawer(){h.showDrawer=!h.showDrawer,h.showDrawer||(this.showFilters=!1,this.showDateFilters=!1)}markAllread(){h.unreadNotificationCount>0&&(this.showMarkAllReadConfirmation=!0)}async confirmedMarkAllRead(e){if(e.detail.returnValue){try{const t=await h.setAllNotificationAsRead();this.showResultMessage({State:U.SUCCESS,Message:`Successfully marked ${t.updatedCount} notifications as read`},"all-read")}catch(t){this.showResultMessage({State:U.ERROR,Message:"Error while marking the notifications read, Please try again"},"all-read")}this.requestUpdate()}this.showMarkAllReadConfirmation=!1}showResultMessage(e,t){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:t,content:c` <ix-message-toast data-testid="notification-read-all-toast" toastId="${t}" .TMessageToast="${e.State.toLowerCase()}" forceClose> ${e.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 e;const t=(e=h.notifications)==null?void 0:e.filter(o=>o.resourceType===m.PLANNED_MAINTENANCE&&h.notificationFilters.SHOW_PLANNED_MAINTENANCE===!0||o.resourceType===m.SERVICE_TICKETS&&h.notificationFilters.SHOW_SERVICE_TICKETS===!0||o.resourceType===m.DCIM_ALERTS&&h.notificationFilters.SHOW_DCIM_ALERTS===!0||o.resourceType===m.INCIDENTS);return h.dateFilters.FROM_DATE!==void 0&&h.dateFilters.TO_DATE!==void 0?t.filter(o=>me(new Date(o.createdAt),h.dateFilters.FROM_DATE)>=0&&ne(new Date(o.createdAt),h.dateFilters.TO_DATE)<=0):h.dateFilters.FROM_DATE!==void 0&&h.dateFilters.TO_DATE===void 0?t.filter(o=>me(new Date(o.createdAt),h.dateFilters.FROM_DATE)>=0):h.dateFilters.FROM_DATE===void 0&&h.dateFilters.TO_DATE!==void 0?t.filter(o=>ne(new Date(o.createdAt),h.dateFilters.TO_DATE)<=0):t}displayDateFilters(){this.showDateFilters=!this.showDateFilters}renderGroupedView(){const e=this.applyNotificationFilters();return c`<div class="-mx-4 -mt-2"> <grouped-item data-testid="planned-maintenance-group" groupTitle="Planned Maintenance" groupIcon="${Re.strings[0]}" .childItems="${e==null?void 0:e.filter(t=>t.resourceType===m.PLANNED_MAINTENANCE)}"></grouped-item> <grouped-item data-testid="emergency-repairs-group" groupTitle="Emergency Repairs" groupIcon="report" .childItems="${e==null?void 0:e.filter(t=>t.resourceType===m.INCIDENTS)}"></grouped-item> <grouped-item data-testid="service-ticket-updates-group" groupTitle="Service Ticket Updates" groupIcon="sync_saved_locally" .childItems="${e==null?void 0:e.filter(t=>t.resourceType===m.SERVICE_TICKETS)}"></grouped-item> <grouped-item data-testid="dcim-alerts-group" groupTitle="${m.DCIM_ALERTS}" groupIcon="${Ve.strings[0]}" .childItems="${e==null?void 0:e.filter(t=>t.resourceType===m.DCIM_ALERTS)}"></grouped-item> </div>`}renderDefaultView(){const e=this.applyNotificationFilters(),t=e.filter(a=>ne(new Date(a.createdAt),new Date)===0),o=e.filter(a=>ne(new Date(a.createdAt),new Date)!==0);return(e==null?void 0:e.length)>0?c` <h3>Today</h3> ${t.length>0?c`<div class="-mx-4"> ${t==null?void 0:t.map(a=>c`<notification-item ?read="${a.status!==N.UNREAD}" data-testclass="today-notification" .notification="${a}" ?disabled="${a.resourceType===m.INCIDENTS}"> </notification-item> `)} </div>`:this.renderNoResult()} <h3>Earlier</h3> ${o.length>0?c`<div class="-mx-4" data-testid="earlier-notifications"> ${o==null?void 0:o.map(a=>c`<notification-item ?read="${a.status!==N.UNREAD}" data-testclass="earlier-notification" .notification="${a}" ?disabled="${a.resourceType===m.INCIDENTS}"> </notification-item> `)} </div>`:this.renderNoResult()} `:c`<h3>Today</h3> ${this.renderNoResult()}`}renderNoResult(){return c`<p class="dlr-text-caption my-4"> <strong>No notifications yet.</strong> </p>`}handleCloseClick(e){this.showDateFilters=!1,this.showFilters=!1}handleContentScroll(e){e!==null&&e.detail.scrollTop+e.detail.clientHeight>=e.detail.scrollHeight-2&&h.getNotifications()}manageFilterVisibility(e){const t=e.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 c` <notification-tooltip data-testid="notifications-tooltip"> </notification-tooltip> <confirmation-dialog data-testid="notifications-confirm-read-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 data-testid="notifications-drawer" ?isVisible="${h.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 data-testid="notifications-heading" 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 data-testid="notifications-cta-all-read" data-testclass="notifications-cta" @click="${this.markAllread}" @mouseover="${e=>{h.unreadNotificationCount>0&&window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Mark All Read",target:e.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" icon="markunread_mailbox" class="${h.unreadNotificationCount<=0?"inactive-icon":"active-icon"}" .disabled="${h.unreadNotificationCount<=0}" filledIcon="true"></ix-icon-button> <ix-icon-button data-testid="notifications-cta-sort-type" data-testclass="notifications-cta" @click="${this.toggleGroupView}" @mouseover="${e=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Sort by Type",target:e.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" label="Sort by Type"> <ix-icon slot="default">${this.showGroupedView?ei:"sort"}</ix-icon> </ix-icon-button> <ix-icon-button data-testid="notifications-cta-filter-type" data-testclass="notifications-cta" @click="${this.displayFilters}" @mouseover="${e=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Type",target:e.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" id="group-filter-button" label="Filter by Type"> <ix-icon slot="default"> ${Yt} </ix-icon> </ix-icon-button> <div data-testid="notifications-filter-dropdown" class="filter-dropdown-content ${this.showFilters?"active z-50":"hidden"}"> <group-filters></group-filters> </div> <ix-icon-button data-testid="notifications-cta-filter-date" data-testclass="notifications-cta" @click="${this.displayDateFilters}" @mouseover="${e=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Date",target:e.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 data-testid="notifications-date-filter-dropdown" 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> `}}T.styles=[A,H],p([J("group-filters")],T.prototype,"groupFilters",void 0),p([J("ix-icon-button#group-filter-button")],T.prototype,"groupFiltersButton",void 0),p([J("date-filters")],T.prototype,"dateFilters",void 0),p([J("ix-icon-button#date-filters-button")],T.prototype,"dateFiltersButton",void 0),p([$()],T.prototype,"showGroupedView",void 0),p([$()],T.prototype,"showFilters",void 0),p([$()],T.prototype,"showDateFilters",void 0),p([$()],T.prototype,"showMarkAllReadConfirmation",void 0),p([k({type:String})],T.prototype,"baseApiUrl",void 0),p([k({type:String})],T.prototype,"localStorageKey",void 0),window.customElements.define("ix-notifications",T);const Vi=Object.keys(window.registeredApps).map(i=>{const e=window.registeredApps[i],{host:t,blob:o,copyNS:a}=e,n=e.entry?`${t}${e.entry}`:null;return{name:i,path:window.registeredApps[i].path,host:t,blob:o,entry:n,serviceWorker:`${t||""}${e.serviceWorker}`,enabled:window.registeredApps[i].enabled,copyNS:a}}),Ge=()=>{const i=[],e={Error:"Failed to get version info"};return window.registeredApps["ui-gom"].enabled&&i.push((async()=>{try{return{"ui-gom":(await import("http://localhost:8090/versions.js")).default}}catch(t){return{"ui-gom":e}}})()),Promise.all(i)},Ri=async()=>{const i=await Ge();return console.log(JSON.stringify(i,void 0,2)),i},Pi=i=>Vi.find(e=>{const t=Array.isArray(e.path)?e.path:[e.path];return e.enabled&&t.some(o=>i.startsWith(o))}),zi=async()=>{var i,e;const{GPV2GtmContainerId:t,EnvironmentType:o,AnalyticsEmailBlacklist:a}=L();if(!t)return;const n=await Lt();if(!n)return;const r=(e=(i=Me())==null?void 0:i.toLowerCase())!=null?e:"",s=a.split(",").map(d=>d.trim().toLowerCase()).some(d=>d.includes("*")?new RegExp(`^${d.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`).test(r):r.includes(d));window.dataLayer=[{environmentType:o,hashedUserId:n,internalUser:s}];const l=document.createElement("script");l.type="text/javascript",l.text=`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
|
1473
|
+
} `;var N;(function(i){i.READ="read",i.UNREAD="unread"})(N||(N={}));var m;(function(i){i.PLANNED_MAINTENANCE="Planned Maintenance",i.INCIDENTS="Incidents",i.DCIM_ALERTS="DCIM Alerts",i.SERVICE_TICKETS="Service Tickets"})(m||(m={}));var v;(function(i){i.Remote_Hands="Remote Hands",i.Deliveries="Deliveries",i.Removals="Removals",i.Facility_Access="Facility Access",i.Trouble_Ticket="Trouble Ticket",i.Customer_Care="Customer Care",i.FacilityAccessVisitorAccess="FacilityAccessVisitorAccess",i.FacilityAccessPermanentBadge="FacilityAccessPermanentBadge",i.FacilityAccessOspAccess="FacilityAccessOspAccess",i.FacilityAccessPopPoeAccess="FacilityAccessPopPoeAccess"})(v||(v={}));var U;(function(i){i.LOADING="Loading",i.ERROR="Error",i.SUCCESS="Success"})(U||(U={}));const ee="yyyy-MM-dd",ti=30,Pe="yyyy-MM-dd HH:mm:ss",ii="http://api.digitalrealty.com/notifications".replace(/\/+$/,"");class ze{constructor(e={}){this.configuration=e}set config(e){this.configuration=e}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:ii}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Fe}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const e=this.configuration.apiKey;if(e)return typeof e=="function"?e:()=>e}get accessToken(){const e=this.configuration.accessToken;if(e)return typeof e=="function"?e:async()=>e}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const oi=new ze;class pe{constructor(e=oi){this.configuration=e,this.fetchApi=async(t,o)=>{let a={url:t,init:o};for(const r of this.middleware)r.pre&&(a=await r.pre({fetch:this.fetchApi,...a})||a);let n;try{n=await(this.configuration.fetchApi||fetch)(a.url,a.init)}catch(r){for(const s of this.middleware)s.onError&&(n=await s.onError({fetch:this.fetchApi,url:a.url,init:a.init,error:r,response:n?n.clone():void 0})||n);if(n===void 0)throw r instanceof Error?new ri(r,"The request failed and the interceptors did not return an alternative response"):r}for(const r of this.middleware)r.post&&(n=await r.post({fetch:this.fetchApi,url:a.url,init:a.init,response:n.clone()})||n);return n},this.middleware=e.middleware}withMiddleware(...e){const t=this.clone();return t.middleware=t.middleware.concat(...e),t}withPreMiddleware(...e){const t=e.map(o=>({pre:o}));return this.withMiddleware(...t)}withPostMiddleware(...e){const t=e.map(o=>({post:o}));return this.withMiddleware(...t)}isJsonMime(e){return e?pe.jsonRegex.test(e):!1}async request(e,t){const{url:o,init:a}=await this.createFetchParams(e,t),n=await this.fetchApi(o,a);if(n&&n.status>=200&&n.status<300)return n;throw new Oe(n,"Response returned an error code")}async createFetchParams(e,t){let o=this.configuration.basePath+e.path;e.query!==void 0&&Object.keys(e.query).length!==0&&(o+="?"+this.configuration.queryParamsStringify(e.query));const a=Object.assign({},this.configuration.headers,e.headers);Object.keys(a).forEach(u=>a[u]===void 0?delete a[u]:{});const n=typeof t=="function"?t:async()=>t,r={method:e.method,headers:a,body:e.body,credentials:this.configuration.credentials},s={...r,...await n({init:r,context:e})};let l;ni(s.body)||s.body instanceof URLSearchParams||ai(s.body)?l=s.body:this.isJsonMime(a["Content-Type"])?l=JSON.stringify(s.body):l=s.body;const d={...s,body:l};return{url:o,init:d}}clone(){const e=this.constructor,t=new e(this.configuration);return t.middleware=this.middleware.slice(),t}}pe.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");function ai(i){return typeof Blob<"u"&&i instanceof Blob}function ni(i){return typeof FormData<"u"&&i instanceof FormData}class Oe extends Error{constructor(e,t){super(t),this.response=e,this.name="ResponseError"}}class ri extends Error{constructor(e,t){super(t),this.cause=e,this.name="FetchError"}}class ce extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const si={csv:","};function Fe(i,e=""){return Object.keys(i).map(t=>Ze(t,i[t],e)).filter(t=>t.length>0).join("&")}function Ze(i,e,t=""){const o=t+(t.length?`[${i}]`:i);if(e instanceof Array){const a=e.map(n=>encodeURIComponent(String(n))).join(`&${encodeURIComponent(o)}=`);return`${encodeURIComponent(o)}=${a}`}if(e instanceof Set){const a=Array.from(e);return Ze(i,a,t)}return e instanceof Date?`${encodeURIComponent(o)}=${encodeURIComponent(e.toISOString())}`:e instanceof Object?Fe(e,o):`${encodeURIComponent(o)}=${encodeURIComponent(String(e))}`}class j{constructor(e,t=o=>o){this.raw=e,this.transformer=t}async value(){return this.transformer(await this.raw.json())}}function Be(i){return li(i)}function li(i,e){return i}function Ha(i){return i}function ve(i){return ci(i)}function ci(i,e){return i==null?i:{id:i.id==null?void 0:i.id,resourceType:i.resource_type==null?void 0:i.resource_type,subGroup:i.sub_group==null?void 0:i.sub_group,createdAt:i.created_at==null?void 0:new Date(i.created_at),createdBy:i.created_by==null?void 0:i.created_by,subject:i.subject==null?void 0:i.subject,locations:i.locations==null?void 0:i.locations,resourceId:i.resource_id==null?void 0:i.resource_id,status:i.status==null?void 0:Be(i.status),accountNumber:i.account_number==null?void 0:i.account_number}}function di(i){return ui(i)}function ui(i,e){return i==null?i:{self:i.self==null?void 0:i.self,first:i.first==null?void 0:i.first,prev:i.prev==null?void 0:i.prev,next:i.next==null?void 0:i.next,last:i.last==null?void 0:i.last,items:i.items.map(ve)}}function hi(i){return pi(i,!1)}function pi(i,e=!1){return i==null?i:{status:i.status}}function mi(i){return gi(i)}function gi(i,e){return i==null?i:{updatedCount:i.updated_count==null?void 0:i.updated_count}}function fi(i){return wi(i)}function wi(i,e){return i==null?i:{success:i.success==null?void 0:i.success}}function bi(i){return vi(i)}function vi(i,e){return i==null?i:{status:Be(i.status)}}function xi(i){return yi(i,!1)}function yi(i,e=!1){return i==null?i:{status:i.status}}function Ci(i){return _i(i,!1)}function _i(i,e=!1){return i==null?i:{resource_type:i.resourceType,sub_group:i.subGroup,recipients:i.recipients,account_number:i.accountNumber,locations:i.locations,resource_id:i.resourceId,subject:i.subject,created_at:i.createdAt==null?i.createdAt:i.createdAt.toISOString()}}class ki extends pe{async createNotificationRaw(e,t){const o={},a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const r=this.configuration.accessToken,s=await r("bearerToken",[]);s&&(a.Authorization=`Bearer ${s}`)}const n=await this.request({path:"/notifications",method:"POST",headers:a,query:o,body:Ci(e.notificationRequest)},t);return new j(n,r=>ve(r))}async createNotification(e={},t){return await(await this.createNotificationRaw(e,t)).value()}async deleteNotificationsByIdRaw(e,t){if(e.id==null)throw new ce("id",'Required parameter "id" was null or undefined when calling deleteNotificationsById().');const o={},a={};if(this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,l=await s("bearerToken",[]);l&&(a.Authorization=`Bearer ${l}`)}let n="/notifications/{id}";n=n.replace("{id}",encodeURIComponent(String(e.id)));const r=await this.request({path:n,method:"DELETE",headers:a,query:o},t);return new j(r,s=>fi(s))}async deleteNotificationsById(e,t){return await(await this.deleteNotificationsByIdRaw(e,t)).value()}async getNotificationsRaw(e,t){const o={};e.sort!=null&&(o.sort=e.sort),e.cursor!=null&&(o.cursor=e.cursor),e.resourceType!=null&&(o.resource_type=e.resourceType),e.accountNumber!=null&&(o.account_number=e.accountNumber),e.createdAfter!=null&&(o.created_after=e.createdAfter.toISOString()),e.createdBefore!=null&&(o.created_before=e.createdBefore.toISOString()),e.locationId!=null&&(o.location_id=e.locationId),e.subGroup!=null&&(o.sub_group=e.subGroup),e.status!=null&&(o.status=e.status);const a={};if(e.prefer!=null&&(a.Prefer=e.prefer.join(si.csv)),this.configuration&&this.configuration.accessToken){const r=this.configuration.accessToken,s=await r("bearerToken",[]);s&&(a.Authorization=`Bearer ${s}`)}const n=await this.request({path:"/notifications",method:"GET",headers:a,query:o},t);return new j(n,r=>di(r))}async getNotifications(e={},t){return await(await this.getNotificationsRaw(e,t)).value()}async getNotificationsByIdRaw(e,t){if(e.id==null)throw new ce("id",'Required parameter "id" was null or undefined when calling getNotificationsById().');const o={},a={};if(this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,l=await s("bearerToken",[]);l&&(a.Authorization=`Bearer ${l}`)}let n="/notifications/{id}";n=n.replace("{id}",encodeURIComponent(String(e.id)));const r=await this.request({path:n,method:"GET",headers:a,query:o},t);return new j(r,s=>ve(s))}async getNotificationsById(e,t){return await(await this.getNotificationsByIdRaw(e,t)).value()}async patchNotificationsRaw(e,t){if(e.notificationBulkPatch==null)throw new ce("notificationBulkPatch",'Required parameter "notificationBulkPatch" was null or undefined when calling patchNotifications().');const o={},a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const r=this.configuration.accessToken,s=await r("bearerToken",[]);s&&(a.Authorization=`Bearer ${s}`)}const n=await this.request({path:"/notifications",method:"PATCH",headers:a,query:o,body:hi(e.notificationBulkPatch)},t);return new j(n,r=>mi(r))}async patchNotifications(e,t){return await(await this.patchNotificationsRaw(e,t)).value()}async patchNotificationsByIdRaw(e,t){if(e.id==null)throw new ce("id",'Required parameter "id" was null or undefined when calling patchNotificationsById().');const o={},a={};if(a["Content-Type"]="application/json",this.configuration&&this.configuration.accessToken){const s=this.configuration.accessToken,l=await s("bearerToken",[]);l&&(a.Authorization=`Bearer ${l}`)}let n="/notifications/{id}";n=n.replace("{id}",encodeURIComponent(String(e.id)));const r=await this.request({path:n,method:"PATCH",headers:a,query:o,body:xi(e.notificationPatch)},t);return new j(r,s=>bi(s))}async patchNotificationsById(e,t){return await(await this.patchNotificationsByIdRaw(e,t)).value()}}const Ai={Notifications:"notifications"};class Ei{constructor(e){this.noInit=!1,this.configuration=e}get notificationsApi(){return new ki(new ze({basePath:`${this.configuration.NotificationApiUrl}/${Ai.Notifications}`,headers:{Authorization:this.getAuthorization()}}))}getAuthorization(){return this.configuration.getAuthorizationFn?this.configuration.getAuthorizationFn():""}}const xe=i=>i==null||i==="",Si=i=>{switch(i.toLowerCase()){case"planned maintenance":return m.PLANNED_MAINTENANCE;case"incidents":return m.INCIDENTS;case"dcim alerts":return m.DCIM_ALERTS;case"service tickets":return m.SERVICE_TICKETS;default:return m.PLANNED_MAINTENANCE}},$i=i=>{switch(i.toLowerCase()){case"unread":return N.UNREAD;case"read":return N.READ;default:return N.UNREAD}},Ni=i=>({sort:"-created_at",cursor:i,prefer:[""]}),Ti=(i,e)=>({id:i,notificationPatch:{status:e}}),Mi=i=>({id:i}),Ue=i=>{var e,t,o,a,n,r,s,l;return{subject:(e=i.subject)!=null?e:"",id:i.id,accountNumber:(t=i.accountNumber)!=null?t:"",resourceType:Si((o=i.resourceType)!=null?o:""),subGroup:(a=i.subGroup)!=null?a:"",resourceId:(n=i.resourceId)!=null?n:"",status:$i((r=i.status)!=null?r:""),createdAt:xe(i.createdAt)?Z(new Date,Pe):Z(i.createdAt,Pe),createdBy:(s=i.createdBy)!=null?s:"",locations:(l=i.locations)!=null?l:[]}},je=i=>i.map(e=>Ue(e)),Li=i=>{const e=new URLSearchParams(i),t=e.has("cursor")?e.get("cursor"):"";return t!==null?t:""},te=async(i,e=!0)=>{let t="An error occurred";if(i instanceof Oe&&i.response.status===400)try{const{detail:o}=await i.response.json();t=o,e&&console.error(t)}catch(o){console.error(i)}else console.error(i)},Ii=i=>{const e=localStorage.getItem(i);return e?JSON.parse(e):null},Di=i=>{var e;return`Bearer ${(e=Ii(i))==null?void 0:e.access_token}`};let Hi=class{constructor(){this.showDrawer=!1,this.apiClient={noInit:!0},this.baseApiUrl="",this.localStorageKey="",this.NewApiClient=()=>{this.apiClient=new Ei({NotificationApiUrl:this.baseApiUrl,getAuthorizationFn:()=>Di(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:m.PLANNED_MAINTENANCE,subGroup:"",subject:"",resourceId:"",locations:[],createdAt:"",accountNumber:"",createdBy:"",status:N.READ},this.dateFilters={FROM_DATE:At(new Date,ti),TO_DATE:new Date},bt(this),xt(this,{name:"notification-state",properties:["notificationFilters","nextPageCursor"],storage:window.localStorage})}get isHydrated(){return yt(this)}async hydrateStore(){await Ct(this)}async clearStoredData(){await _t(this)}async getStoredData(){return kt(this)}ConstructApiClient(){return this.apiClient.noInit?this.NewApiClient():this.apiClient}async clearStoredNotificationsData(){this.notifications=[],this.unreadNotificationCount=0,this.nextPageCursor="",this.apiClient={noInit:!0}}async setNotificationReadStatus(e){const t=await this.setNotificationAsRead(e.toString());if(await t===!0){this.ReduceUnreadNotificationCount();const o=this.notifications.findIndex(a=>a.id===e);this.notifications[o].status=N.READ,this.selectedNotification=this.notifications[o]}return t}async setNotificationDeleted(e){const t=await this.DeleteNotification(e.toString());if(t===!0){const o=this.notifications.find(n=>n.id===e);(o==null?void 0:o.status)==="unread"&&this.ReduceUnreadNotificationCount();const a=this.notifications.findIndex(n=>n.id===e);this.notifications.splice(a,1)}return{State:t===!0?U.SUCCESS:U.ERROR,Message:t===!0?"Successfully deleted the notification":"Error while deleting the notification"}}setNotificationDateFilter(e,t){e!==void 0?this.dateFilters.FROM_DATE=Ne(e,ee,new Date):this.dateFilters.FROM_DATE=void 0,t!==void 0?this.dateFilters.TO_DATE=Ne(t,ee,new Date):this.dateFilters.TO_DATE=void 0}setNotificationFilter(e,t){switch(e){case m.PLANNED_MAINTENANCE:this.notificationFilters.SHOW_PLANNED_MAINTENANCE=t;break;case m.SERVICE_TICKETS:this.notificationFilters.SHOW_SERVICE_TICKETS=t;break;case m.DCIM_ALERTS:this.notificationFilters.SHOW_DCIM_ALERTS=t;break}}async getNotifications(){var e;let t;if(this.nextPageCursor!==void 0&&(t=await((e=this.apiClient)==null?void 0:e.notificationsApi.getNotificationsRaw(Ni(Li(this.nextPageCursor))).catch(o=>{te(o,!1)})),t)){const o=await(t==null?void 0:t.value());this.notifications=this.nextPageCursor===""?je(o==null?void 0:o.items):this.notifications.concat(je(o==null?void 0:o.items)),this.nextPageCursor=(o==null?void 0:o.next)!==void 0?o==null?void 0:o.next:void 0,this.unreadNotificationCount=t.raw.headers.get("x-total-unread-count")!==null&&t.raw.headers.get("x-total-unread-count")!==void 0?t.raw.headers.get("x-total-unread-count"):0}}async getNotificationsById(e){var t;let o;e&&(o=await((t=this.apiClient)==null?void 0:t.notificationsApi.getNotificationsById({id:e}).catch(a=>{te(a,!1)}))),o&&(this.selectedNotification=Ue(o))}async setNotificationAsRead(e){var t;return e?(await((t=this.apiClient)==null?void 0:t.notificationsApi.patchNotificationsById(Ti(e,"read")).catch(o=>(te(o,!1),!1))),!0):!1}async setAllNotificationAsRead(){var e;const t=await((e=this.apiClient)==null?void 0:e.notificationsApi.patchNotifications({notificationBulkPatch:{status:N.READ}}).catch(o=>(te(o,!1),!1)));return this.notifications=this.notifications.map(o=>({...o,status:N.READ})),this.unreadNotificationCount=0,t}async DeleteNotification(e){var t;let o=!1;return e&&await((t=this.apiClient)==null?void 0:t.notificationsApi.deleteNotificationsById(Mi(e)).catch(a=>{te(a,!1),o=!1}).then(()=>{o=!0})),o}ReduceUnreadNotificationCount(){this.unreadNotificationCount>0&&(this.unreadNotificationCount-=1)}};const h=new Hi,H=I`:host{--ix-drawer-border-radius:0;--ix-drawer-padding:0;--ix-drawer-width-sm:320px;--ix-drawer-width-md:320px;--ix-drawer-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}`;let de=class extends M{constructor(){super(...arguments),this.textMessage="Are you sure?",this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("confirm-dialog-closed")),this.onClick(!1)}}static get styles(){return[A,H]}onClick(e){const t=new CustomEvent("on-confirm-selection",{detail:{returnValue:e},bubbles:!0,composed:!0});this.dispatchEvent(t)}render(){return c` <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>`}};p([k({type:String,attribute:!0})],de.prototype,"textMessage",void 0),p([k({type:Boolean,attribute:!0})],de.prototype,"open",void 0),de=p([z("confirmation-dialog")],de);let ue=class extends M{constructor(){super(...arguments),this.notification={},this.open=!1,this.dialogClosed=()=>{this.dispatchEvent(new CustomEvent("view-item-dialog-closed"))},this.viewRecord=()=>{this.dialogClosed(),h.showDrawer=!1}}static get styles(){return[A,H]}getUrl(){const e=this.notification.resourceId;switch(this.notification.resourceType){case m.PLANNED_MAINTENANCE:return`/service-management/reports?ticketId=${e}`;case m.SERVICE_TICKETS:switch(this.notification.subGroup){case v.Remote_Hands:return`/service-management/service-tickets/remote-hands/${e}`;case v.Customer_Care:return`/service-management/service-tickets/customer-care/${e}`;case v.Deliveries:return`/service-management/service-tickets/${v.Deliveries}/${e}`;case v.Facility_Access:return`/service-management/service-tickets/facility-access/${e}`;case v.Removals:return`/service-management/service-tickets/removals/${e}`;case v.Trouble_Ticket:return`/service-management/service-tickets/trouble-tickets/${e}`;case v.FacilityAccessVisitorAccess:return`/service-management/service-tickets/facility-access/visitor-access/${e}`;case v.FacilityAccessPermanentBadge:return`/service-management/service-tickets/facility-access/permanent-badge/${e}`;case v.FacilityAccessOspAccess:return`/service-management/service-tickets/facility-access/osp-access/${e}`;case v.FacilityAccessPopPoeAccess:return`/service-management/service-tickets/facility-access/pop-poe-access/${e}`;default:return""}case m.INCIDENTS:return`/service-management/reports?ticketId=${e}`;case m.DCIM_ALERTS:return`/dcim/${e}`;default:return""}}getLocation(){return this.notification.locations===void 0||this.notification.locations.length<1?"":this.notification.locations.length>1?"Multiple Sites":this.notification.locations[0]}getSubGroupDisplayName(){switch(this.notification.subGroup){case v.FacilityAccessVisitorAccess:case v.FacilityAccessPermanentBadge:case v.FacilityAccessOspAccess:case v.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 c` <ix-dialog ?open="${this.open}" @closed="${this.dialogClosed}" class="notification-modal" data-testclass="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" data-testid="notification-view-item-ticket-type"> ${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" data-testid="notification-view-item-subject"> ${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" data-testid="notification-view-item-date"> ${Z(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" data-testid="notification-view-item-site-text"> ${this.getLocation()} </div> </form> <div slot="actions" class="flex flex-row flex-end"> <ix-button data-testid="notification-view-item-close" form="form-id" appearance="text"> Close </ix-button> <ix-button data-testid="notification-view-item-view-record" href="${this.getUrl()}" @click="${this.viewRecord}" appearance="text">View Record</ix-button> </div> </ix-dialog>`}};p([k({type:Object,attribute:!1})],ue.prototype,"notification",void 0),p([k({type:Boolean,attribute:!0})],ue.prototype,"open",void 0),ue=p([z("view-item-dialog")],ue);let O=class extends M{constructor(){super(...arguments),this.disabled=!1,this.read=!1,this.notification={},this.showModal=!1,this.showDeleteConfirmation=!1}static get styles(){return[A,H]}displayItem(){this.notification.status===N.UNREAD&&(h.setNotificationReadStatus(this.notification.id),this.read=!0),this.showModal=!0}deleteItem(){this.disabled||(this.showDeleteConfirmation=!0)}confirmedDelete(e){e.detail.returnValue&&h.setNotificationDeleted(this.notification.id).then(t=>{this.showDeleteResultMessage(t,this.notification.id)}),this.showDeleteConfirmation=!1}showDeleteResultMessage(e,t){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:t,content:c` <ix-message-toast data-testid="notification-delete-toast" toastId="${t}" .TMessageToast="${e.State.toLowerCase()}" forceClose> ${e.Message} </ix-message-toast>`,autoClose:2e3,durationOut:2e3,vertical:"bottom",horizontal:"center",animated:!0,above:!1}}))}calculateDuration(){return this.notification.createdAt!==void 0?me(new Date,new Date(this.notification.createdAt))<24?Et(new Date(this.notification.createdAt),new Date,{addSuffix:!0}):c`<ix-date type="static" variant="date-time" .value="${this.notification.createdAt}"></ix-date>`:"N/A"}getNotificationIcon(){switch(this.notification.resourceType){case m.PLANNED_MAINTENANCE:return Re;case m.SERVICE_TICKETS:return"sync_saved_locally";case m.INCIDENTS:return"report";case m.DCIM_ALERTS:return Ve;default:return"sync_saved_locally"}}getNotificationTitle(){switch(this.notification.resourceType){case m.PLANNED_MAINTENANCE:return"Planned Maintenance";case m.SERVICE_TICKETS:return`${this.getServiceTicketSubGroup()} Service Ticket Update`;case m.INCIDENTS:return"Emergency Repair";case m.DCIM_ALERTS:return"DCIM Alert";default:return"sync_saved_locally"}}getServiceTicketSubGroup(){var e,t;switch((e=this.notification)==null?void 0:e.subGroup){case v.FacilityAccessVisitorAccess:case v.FacilityAccessPermanentBadge:case v.FacilityAccessOspAccess:case v.FacilityAccessPopPoeAccess:return"Facility Access";default:return(t=this.notification)==null?void 0:t.subGroup}}render(){return c` <div data-testid="notification-item" 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 ${this.read?"notification-item-read border-l-3 border-transparent":"notification-item-unread border-l-3 border-success"}"> <ix-icon style="--ix-icon-font-size:24px;--ix-icon-line-height:24px" icon="${this.getNotificationIcon()}" class="${this.read?"inactive-icon":"active-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?" data-testclass="notification-delete-confirmation"> </confirmation-dialog> </div> <ix-icon-button style="--md-icon-button-icon-size:24px" data-testclass="delete-notification" @click="${this.deleteItem}" @mouseover="${e=>{this.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:this.disabled?"Emergency Repair Notification cannot be removed":"Remove Notification",target:e.target}}))}}" @mouseout="${()=>this.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" ?disabled="${this.disabled}"> <ix-icon slot="default" class="${this.disabled?"inactive-icon":"destructive-icon"}"> ${Xt} </ix-icon> </ix-icon-button> </div> </div> `}};p([k({type:Boolean})],O.prototype,"disabled",void 0),p([k({type:Boolean})],O.prototype,"read",void 0),p([k({type:Object,attribute:!1})],O.prototype,"notification",void 0),p([$()],O.prototype,"showModal",void 0),p([$()],O.prototype,"showDeleteConfirmation",void 0),O=p([z("notification-item")],O);let q=class extends M{constructor(){super(...arguments),this.groupTitle="Group 1",this.groupIcon="public",this.childItems=h.notifications,this.isOpen=!1,this.onClick=()=>{this.isOpen=!this.isOpen}}static get styles(){return[A,H]}renderNotificationItems(){var e,t,o;return this.isOpen?((e=this.childItems)==null?void 0:e.length)!==void 0&&((t=this.childItems)==null?void 0:t.length)>0?c`<div> ${(o=this.childItems)==null?void 0:o.map(a=>c`<notification-item .notification="${a}" ?disabled="${a.resourceType===m.INCIDENTS}" data-testclass="notification-item"> </notification-item>`)} </div>`:c`<p class="dlr-text-caption ml-14 font-bold mr-4" data-testid="msg-no-notifications"> No notifications yet. </p>`:c`${b}`}render(){var e;return c`<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}" data-testclass="grouped-item-toggle-expand"> </ix-icon-button> <ix-icon slot="default" class="ix-icon-groups">${St(this.groupIcon)}</ix-icon> <p class="m-0 group-name font-bold pl-1">${this.groupTitle}</p> <p class="m-0 pl-4"> ${(e=this.childItems)==null?void 0:e.length.toString().padStart(2,"0")} </p> </div> </div> ${this.renderNotificationItems()} </div>`}};p([k({type:String,attribute:!0})],q.prototype,"groupTitle",void 0),p([k({type:String,attribute:!0})],q.prototype,"groupIcon",void 0),p([k({type:Array,attribute:!0})],q.prototype,"childItems",void 0),p([$()],q.prototype,"isOpen",void 0),q=p([z("grouped-item")],q);let qe=class extends M{static get styles(){return[A,H]}onSwitchChange(e){var t;const o=e.target,a=(t=o.attributes.getNamedItem("name"))==null?void 0:t.value;h.setNotificationFilter(a,o.selected),this.requestUpdate()}render(){return c` <div class="flex flex-col"> <label class="whitespace-nowrap p-2 flex gap-3 items-center hover:bg-primary-subtle"> <ix-switch data-testid="planned-maintenance-switch" class="flex" name="${m.PLANNED_MAINTENANCE}" selected="${h.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 data-testid="service-tickets-switch" class="flex" name="${m.SERVICE_TICKETS}" selected="${h.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 data-testid="dcim-alerts-switch" class="flex" name="${m.DCIM_ALERTS}" selected="${h.notificationFilters.SHOW_DCIM_ALERTS}" @change="${this.onSwitchChange}"></ix-switch> <span>${m.DCIM_ALERTS}</span></label> </div>`}};qe=p([z("group-filters")],qe);let F=class extends M{constructor(){super(...arguments),this.fromDate=xe(h.dateFilters.FROM_DATE)?void 0:Z(h.dateFilters.FROM_DATE,ee),this.toDate=xe(h.dateFilters.TO_DATE)?void 0:Z(h.dateFilters.TO_DATE,ee),this.maxDate=Z(new Date,ee),this.fromDateErrorText="",this.toDateErrorText=""}static get styles(){return[A,H]}onFromDateChange(e){e===null||e===""?this.fromDate=void 0:(this.fromDate=e,this.fromDate!==void 0&&(this.fromDateErrorText=void 0))}onToDateChange(e){e===null||e===""?this.toDate=void 0:(this.toDate=e,this.toDate!==void 0&&(this.toDateErrorText=void 0))}onApplyDateFilter(e){if(e){if(this.toDate===void 0&&this.fromDate!==void 0){this.toDateErrorText="Please select to date";return}if(this.fromDate===void 0&&this.toDate!==void 0){this.fromDateErrorText="Please select from date";return}if(this.fromDate>this.toDate){this.fromDateErrorText="From date cannot be later than To date.",this.fromDate=void 0;return}if(this.fromDateErrorText=void 0,this.toDate<this.fromDate){this.toDateErrorText="To date cannot be earlier than From date.",this.toDate=void 0;return}this.toDateErrorText=void 0}const t=e&&this.toDateErrorText===void 0&&this.fromDateErrorText===void 0;t&&(h.setNotificationDateFilter(this.fromDate,this.toDate),this.requestUpdate());const o=new CustomEvent("on-selection",{detail:{returnValue:t},bubbles:!0,composed:!0});this.dispatchEvent(o)}clearDateFilters(){this.fromDate=void 0,this.toDate=void 0,this.fromDateErrorText=void 0,this.toDateErrorText=void 0}render(){return c` <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 data-testid="notifications-clear-date-filter" 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 data-testid="notifications-from-date" .value="${this.fromDate}" max="${this.maxDate}" label="From" name="FromDate" .errorText="${this.fromDateErrorText}" .onChanged="${e=>this.onFromDateChange(e)}"> </ix-date> <ix-date data-testid="notifications-to-date" .value="${this.toDate}" max="${this.maxDate}" label="To" name="ToDate" .errorText="${this.toDateErrorText}" .onChanged="${e=>this.onToDateChange(e)}"></ix-date> </div> </div> <div class="flex flex-row justify-between"> <ix-button data-testid="notifications-cancel-date-filter" type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!1)}">Cancel</ix-button> <ix-button data-testid="notifications-activate-date-filter" type="" target="" appearance="text" @click="${()=>this.onApplyDateFilter(!0)}">Filter List</ix-button> </div> </div>`}};p([$()],F.prototype,"fromDate",void 0),p([$()],F.prototype,"toDate",void 0),p([$()],F.prototype,"maxDate",void 0),p([$()],F.prototype,"fromDateErrorText",void 0),p([$()],F.prototype,"toDateErrorText",void 0),F=p([z("date-filters")],F);let G=class extends M{constructor(){super(...arguments),this.isVisible=!1,this.label="",this.hoveredElement=void 0,this.configureNotificationTooltip=e=>{const{label:t,target:o}=e.detail;this.hoveredElement=o,this.label=t,this.isVisible=!0},this.hideNotificationTooltip=()=>{this.isVisible=!1,this.hoveredElement=void 0,this.label=""}}static get styles(){return[A,H]}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(e){e.has("hoveredElement")&&this.isVisible&&this.hoveredElement&&Te(this.hoveredElement,this.notificationTooltip,{placement:"bottom-end"}).then(({x:t,y:o})=>{this.notificationTooltip.style.left=`${t}px`,this.notificationTooltip.style.top=`${o+12}px`})}render(){const e={hidden:!this.isVisible};return c`<div class="notification-tooltip z-[9999] rounded absolute p-2 white-text ${$t(e)}"> ${this.label} </div> <slot></slot>`}};p([J(".notification-tooltip")],G.prototype,"notificationTooltip",void 0),p([k({type:Boolean,reflect:!0})],G.prototype,"isVisible",void 0),p([k({type:String,reflect:!0})],G.prototype,"label",void 0),p([$()],G.prototype,"hoveredElement",void 0),G=p([z("notification-tooltip")],G);class T extends M{constructor(){super(...arguments),this.showGroupedView=!1,this.showFilters=!1,this.showDateFilters=!1,this.showMarkAllReadConfirmation=!1,this.baseApiUrl="",this.localStorageKey=""}async firstUpdated(){h.baseApiUrl=this.baseApiUrl,h.localStorageKey=this.localStorageKey,h.ConstructApiClient()}connectedCallback(){super.connectedCallback(),window.addEventListener("account-switched",h.NewApiClient),window.addEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.addEventListener("beforeunload",this.handleOnbeforeunload)}disconnectedCallback(){super.disconnectedCallback(),this.handleOnbeforeunload(),window.removeEventListener("account-switched",h.NewApiClient),window.removeEventListener("ix-notifications-toggle-drawer",this.toggleDrawer),window.removeEventListener("beforeunload",this.handleOnbeforeunload)}handleOnbeforeunload(){h.clearStoredNotificationsData()}toggleDrawer(){h.showDrawer=!h.showDrawer,h.showDrawer||(this.showFilters=!1,this.showDateFilters=!1)}markAllread(){h.unreadNotificationCount>0&&(this.showMarkAllReadConfirmation=!0)}async confirmedMarkAllRead(e){if(e.detail.returnValue){try{const t=await h.setAllNotificationAsRead();this.showResultMessage({State:U.SUCCESS,Message:`Successfully marked ${t.updatedCount} notifications as read`},"all-read")}catch(t){this.showResultMessage({State:U.ERROR,Message:"Error while marking the notifications read, Please try again"},"all-read")}this.requestUpdate()}this.showMarkAllReadConfirmation=!1}showResultMessage(e,t){window.dispatchEvent(new CustomEvent("add-toast",{detail:{id:t,content:c` <ix-message-toast data-testid="notification-read-all-toast" toastId="${t}" .TMessageToast="${e.State.toLowerCase()}" forceClose> ${e.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 e;const t=(e=h.notifications)==null?void 0:e.filter(o=>o.resourceType===m.PLANNED_MAINTENANCE&&h.notificationFilters.SHOW_PLANNED_MAINTENANCE===!0||o.resourceType===m.SERVICE_TICKETS&&h.notificationFilters.SHOW_SERVICE_TICKETS===!0||o.resourceType===m.DCIM_ALERTS&&h.notificationFilters.SHOW_DCIM_ALERTS===!0||o.resourceType===m.INCIDENTS);return h.dateFilters.FROM_DATE!==void 0&&h.dateFilters.TO_DATE!==void 0?t.filter(o=>me(new Date(o.createdAt),h.dateFilters.FROM_DATE)>=0&&ne(new Date(o.createdAt),h.dateFilters.TO_DATE)<=0):h.dateFilters.FROM_DATE!==void 0&&h.dateFilters.TO_DATE===void 0?t.filter(o=>me(new Date(o.createdAt),h.dateFilters.FROM_DATE)>=0):h.dateFilters.FROM_DATE===void 0&&h.dateFilters.TO_DATE!==void 0?t.filter(o=>ne(new Date(o.createdAt),h.dateFilters.TO_DATE)<=0):t}displayDateFilters(){this.showDateFilters=!this.showDateFilters}renderGroupedView(){const e=this.applyNotificationFilters();return c`<div class="-mx-4 -mt-2"> <grouped-item data-testid="planned-maintenance-group" groupTitle="Planned Maintenance" groupIcon="${Re.strings[0]}" .childItems="${e==null?void 0:e.filter(t=>t.resourceType===m.PLANNED_MAINTENANCE)}"></grouped-item> <grouped-item data-testid="emergency-repairs-group" groupTitle="Emergency Repairs" groupIcon="report" .childItems="${e==null?void 0:e.filter(t=>t.resourceType===m.INCIDENTS)}"></grouped-item> <grouped-item data-testid="service-ticket-updates-group" groupTitle="Service Ticket Updates" groupIcon="sync_saved_locally" .childItems="${e==null?void 0:e.filter(t=>t.resourceType===m.SERVICE_TICKETS)}"></grouped-item> <grouped-item data-testid="dcim-alerts-group" groupTitle="${m.DCIM_ALERTS}" groupIcon="${Ve.strings[0]}" .childItems="${e==null?void 0:e.filter(t=>t.resourceType===m.DCIM_ALERTS)}"></grouped-item> </div>`}renderDefaultView(){const e=this.applyNotificationFilters(),t=e.filter(a=>ne(new Date(a.createdAt),new Date)===0),o=e.filter(a=>ne(new Date(a.createdAt),new Date)!==0);return(e==null?void 0:e.length)>0?c` <h3>Today</h3> ${t.length>0?c`<div class="-mx-4"> ${t==null?void 0:t.map(a=>c`<notification-item ?read="${a.status!==N.UNREAD}" data-testclass="today-notification" .notification="${a}" ?disabled="${a.resourceType===m.INCIDENTS}"> </notification-item> `)} </div>`:this.renderNoResult()} <h3>Earlier</h3> ${o.length>0?c`<div class="-mx-4" data-testid="earlier-notifications"> ${o==null?void 0:o.map(a=>c`<notification-item ?read="${a.status!==N.UNREAD}" data-testclass="earlier-notification" .notification="${a}" ?disabled="${a.resourceType===m.INCIDENTS}"> </notification-item> `)} </div>`:this.renderNoResult()} `:c`<h3>Today</h3> ${this.renderNoResult()}`}renderNoResult(){return c`<p class="dlr-text-caption my-4"> <strong>No notifications yet.</strong> </p>`}handleCloseClick(e){this.showDateFilters=!1,this.showFilters=!1}handleContentScroll(e){e!==null&&e.detail.scrollTop+e.detail.clientHeight>=e.detail.scrollHeight-2&&h.getNotifications()}manageFilterVisibility(e){const t=e.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 c` <notification-tooltip data-testid="notifications-tooltip"> </notification-tooltip> <confirmation-dialog data-testid="notifications-confirm-read-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 data-testid="notifications-drawer" ?isVisible="${h.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 data-testid="notifications-heading" 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 data-testid="notifications-cta-all-read" data-testclass="notifications-cta" @click="${this.markAllread}" @mouseover="${e=>{h.unreadNotificationCount>0&&window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Mark All Read",target:e.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" icon="markunread_mailbox" class="${h.unreadNotificationCount<=0?"inactive-icon":"active-icon"}" .disabled="${h.unreadNotificationCount<=0}" filledIcon="true"></ix-icon-button> <ix-icon-button data-testid="notifications-cta-sort-type" data-testclass="notifications-cta" @click="${this.toggleGroupView}" @mouseover="${e=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Sort by Type",target:e.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" label="Sort by Type"> <ix-icon slot="default">${this.showGroupedView?ei:"sort"}</ix-icon> </ix-icon-button> <ix-icon-button data-testid="notifications-cta-filter-type" data-testclass="notifications-cta" @click="${this.displayFilters}" @mouseover="${e=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Type",target:e.target}}))}}" @mouseout="${()=>window.dispatchEvent(new CustomEvent("hide-notification-tooltip"))}" class="active-icon" id="group-filter-button" label="Filter by Type"> <ix-icon slot="default"> ${Yt} </ix-icon> </ix-icon-button> <div data-testid="notifications-filter-dropdown" class="filter-dropdown-content ${this.showFilters?"active z-50":"hidden"}"> <group-filters></group-filters> </div> <ix-icon-button data-testid="notifications-cta-filter-date" data-testclass="notifications-cta" @click="${this.displayDateFilters}" @mouseover="${e=>{window.dispatchEvent(new CustomEvent("show-notification-tooltip",{detail:{label:"Filter by Date",target:e.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 data-testid="notifications-date-filter-dropdown" 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> `}}T.styles=[A,H],p([J("group-filters")],T.prototype,"groupFilters",void 0),p([J("ix-icon-button#group-filter-button")],T.prototype,"groupFiltersButton",void 0),p([J("date-filters")],T.prototype,"dateFilters",void 0),p([J("ix-icon-button#date-filters-button")],T.prototype,"dateFiltersButton",void 0),p([$()],T.prototype,"showGroupedView",void 0),p([$()],T.prototype,"showFilters",void 0),p([$()],T.prototype,"showDateFilters",void 0),p([$()],T.prototype,"showMarkAllReadConfirmation",void 0),p([k({type:String})],T.prototype,"baseApiUrl",void 0),p([k({type:String})],T.prototype,"localStorageKey",void 0),window.customElements.define("ix-notifications",T);const Vi=Object.keys(window.registeredApps).map(i=>{const e=window.registeredApps[i],{host:t,blob:o,copyNS:a}=e,n=e.entry?`${t}${e.entry}`:null;return{name:i,path:window.registeredApps[i].path,host:t,blob:o,entry:n,serviceWorker:`${t||""}${e.serviceWorker}`,enabled:window.registeredApps[i].enabled,copyNS:a}}),Ge=()=>{const i=[],e={Error:"Failed to get version info"};return window.registeredApps["ui-gom"].enabled&&i.push((async()=>{try{return{"ui-gom":(await import("ui-gom/versions.js")).default}}catch(t){return{"ui-gom":e}}})()),Promise.all(i)},Ri=async()=>{const i=await Ge();return console.log(JSON.stringify(i,void 0,2)),i},Pi=i=>Vi.find(e=>{const t=Array.isArray(e.path)?e.path:[e.path];return e.enabled&&t.some(o=>i.startsWith(o))}),zi=async()=>{var i,e;const{GPV2GtmContainerId:t,EnvironmentType:o,AnalyticsEmailBlacklist:a}=L();if(!t)return;const n=await Lt();if(!n)return;const r=(e=(i=Me())==null?void 0:i.toLowerCase())!=null?e:"",s=a.split(",").map(d=>d.trim().toLowerCase()).some(d=>d.includes("*")?new RegExp(`^${d.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`).test(r):r.includes(d));window.dataLayer=[{environmentType:o,hashedUserId:n,internalUser:s}];const l=document.createElement("script");l.type="text/javascript",l.text=`(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
|
1474
1474
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
|
1475
1475
|
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
|
1476
1476
|
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
|
1477
|
-
})(window,document,'script','dataLayer','${t}')`,document.head.appendChild(l)},Oi=async()=>{const{LoginAuthority:i}=L(),e=Le();return await(await fetch(`${i}/user-profile`,{headers:{Authorization:`Bearer ${e}`}})).json()};function We(i){document.cookie=`${i}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`,document.cookie=`${i}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=${location.hostname}`;const e=location.hostname.split(".").slice(-2).join(".");document.cookie=`${i}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=.${e}`}function Ke(){const i=document.cookie.split(";");for(let e of i){const t=e.indexOf("="),o=t>-1?e.substring(0,t).trim():e.trim();We(o)}}function Fi(){document.cookie.split(";").map(i=>i.trim().split("=")[0]).filter(i=>/^_ga(_|$)/.test(i)).forEach(i=>We(i))}const Zi=50,W={full:{first:0,last:0,total:0,items:[]},exclude_child_accounts:{first:0,last:0,total:0,items:[]}};let Bi=0;const ie=new Map,V=async({search_term:i="",page_number:e=0,page_size:t=Zi,exclude_child_accounts:o=!1,account_number:a=null}={})=>{if(i===""&&e===0){if(o){if(W.exclude_child_accounts.items.length>0)return W.exclude_child_accounts}else if(W.full.items.length>0)return W.full}const n=Q(),r=a!=null?a:n.profile.account_number,s=new URLSearchParams;s.set("account_number",r),s.set("page_number",e),s.set("page_size",t),s.set("search_term",i),s.set("exclude_child_accounts",!!o);const l=++Bi,d=new AbortController;ie.set(l,d);try{const{LoginAuthority:u}=L(),f=await fetch(`${u}/AuthorizedAccountHierarchyV2?${s.toString()}`,{method:"GET",headers:{Authorization:`Bearer ${n.access_token}`},signal:d.signal});for(const[y,S]of ie.entries())y<l&&(S.abort(),ie.delete(y));if(ie.delete(l),!f.ok)return console.error("Error fetching account hierarchy:",f==null?void 0:f.status),null;const w=await f.json();return qi({search_term:i,page_number:e,result:w,exclude_child_accounts:o})}catch(u){return ie.delete(l),u.name==="AbortError"||console.error("Error fetching account hierarchy:",u),null}},Ui=()=>{const{location:i}=window;return`${i.protocol}//${i.hostname}${i.port?`:${i.port}`:""}`},ji=async(i,e)=>{const{LoginAuthority:t,GlobalPortalClientId:o}=L(),a=Ui();return await(await fetch(`${t}/connect/token`,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:o,grant_type:"refresh_token",refresh_token:e,redirect_uri:a,acr_values:`account_number:${i}`}),method:"POST"})).json()},he=async i=>{const e=Q(),t=await ji(i,e.refresh_token);It(t,e),window.location.reload()},qi=({search_term:i,page_number:e,result:t,exclude_child_accounts:o})=>{if(i===""){const a=o?W.exclude_child_accounts:W.full;e===0?(a.items=t==null?void 0:t.items,a.first=t==null?void 0:t.self,a.last=t==null?void 0:t.self):a.last<t.self?(a.items=[...a.items,...t.items],a.last=t==null?void 0:t.self,a.first===0&&(a.first=t==null?void 0:t.self)):(a.items=[...t==null?void 0:t.items,...a.items],a.first=t==null?void 0:t.self,a.last===0&&(a.last=t==null?void 0:t.self)),a.total=t==null?void 0:t.last,dispatchEvent(new CustomEvent("accountsloaded"))}return t.total=t==null?void 0:t.last,t.first=t==null?void 0:t.self,t.last=t==null?void 0:t.self,t},Je=async i=>{const{ApiBaseUrl:e}=L(),t=Le(),o=await fetch(`${e}/cookie-consent/cookie-consent`,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify(i),method:"POST"});return o.ok?await o.json():!1},Gi=I`:host{--left-bar-width:288px;--left-bar-width-lg:96px;--open-menu-width-md:276px;--content-height:calc(100vh - calc(var(--intraportal-nav-height, 0px) + var(--header-height, 0px) + var(--mobile-nav-height, 0px) + 1rem));--body-height:calc(100vh - var(--intraportal-nav-height, 0px));--main-height:calc(100vh - calc(var(--intraportal-nav-height, 0px) + var(--mobile-nav-height, 0px)));--main-height-tablet-nav:calc(var(--main-height) - 2rem);--top-height:calc(var(--header-height, 0px) + var(--intraportal-nav-height, 0px))}:host([compact]){--left-bar-width:112px}.zero-width-height{width:0;height:0;overflow:hidden}.no-display{display:none}ix-intraportal-nav{position:sticky;top:0;left:0;right:0;z-index:9}:host,:host :root,:root,body{--ix-top-nav-offset:2rem}`,Qe=I`:host{--logo-padding-left:0px;--navbar-icon-min-width:24px}@-moz-document url-prefix(){nav *{scrollbar-width:thin;scrollbar-color:#002274 #5b73d6}}nav ::-webkit-scrollbar{max-width:8px;background-color:#002274}nav ::-webkit-scrollbar-thumb{background-color:#5b73d6;border-radius:100px;max-height:183px;max-width:6px;border:1px solid #002274}.nav-bar-bg{background:linear-gradient(#1456e0 20.5%,#0d2497 113.5%)}.nav-bar-bg.wide{background:linear-gradient(90.27deg,#1456e0 0,#0d2497 99.23%)}.on-primary-icon{--md-icon-button-icon-color:var(--clr-on-primary, #fff);--md-sys-color-on-surface-variant:var(--clr-on-primary, #fff)}.animate-width{transition:width .3s ease,viewBox .3s ease,left .3s ease,opacity .3s ease,grid-template-columns .3s ease}.expand-cta{--md-icon-button-icon-color:var(--clr-graphics-fill, rgba(9, 34, 65, 0.6))}.divider{border-color:var(--clr-on-primary,#fff);opacity:.2;margin:0;flex-shrink:0;border-width:0 0 thin;border-style:solid}.nav-toggle{--ix-nav-toggle:var(--clr-graphics-fill, rgba(9, 34, 65, 0.6));--md-icon-button-icon-color:var(--ix-nav-toggle);--md-icon-button-hover-icon-color:var(--ix-nav-toggle);--md-icon-button-pressed-icon-color:var(--ix-nav-toggle);--md-icon-button-focus-icon-color:var(--ix-nav-toggle)}@media only screen and (max-width:600px){.dlr-logo{display:none}}`,Ye=I`#menu{--md-sys-color-on-surface-variant:var(--clr-surface-container-lowest, #fff);--md-menu-item-label-text-color:var(--clr-surface-container-lowest, #fff);--md-menu-container-color:var(--clr-secondary, #092241);--ix-icon-font-size:1.4rem;--md-menu-container-shape:8px}.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)}.header-container{background-color:rgba(245,247,255,.85);backdrop-filter:blur(6px)}.header__account__menu__text{white-space:nowrap}.flex-container{display:flex;gap:1rem;align-items:center;justify-content:center}.header__accounts{--md-outlined-field-top-space:0.5rem;--md-outlined-field-bottom-space:0.5rem;--ix-outline-color:var(--clr-graphics-fill)}.divider{margin:0 10px 0 10px;flex-shrink:0;border-width:0 thin 0 0;border-style:solid;border-color:var(--clr-secondary,#092241);opacity:.12;height:24px;align-self:center}.last-login-info{padding:16px;font-size:13px;line-height:1.6;color:var(--clr-surface-container-lowest,#fff);display:flex;flex-direction:column;gap:8px}.last-login-info__warning{font-size:12px}`;var Wi=Object.defineProperty,Ki=(i,e,t)=>e in i?Wi(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Xe=(i,e,t)=>Ki(i,typeof e!="symbol"?e+"":e,t);const Ji="accountSelection:selectedAccount",Qi="/user-management/user-management",Yi="/user-management/role-management";let et=class extends P{constructor(){super(),Xe(this,"isUserOrRoleManagement",()=>{const e=window.location.pathname;return e.startsWith(Qi)||e.startsWith(Yi)}),this.accountsPaged=[],this.nextDataAvailable=!1,this.lastFetchedRequest=0,this.rangeLoaded={first:void 0,last:void 0},this.loading=!1,this.showingFlattenedAccounts=!1,this.selectedAccountNumber=Q().profile.account_number,this.selectedAccountNumberRootNode=null}firstUpdated(){if(this.getAccounts(),window.location.search.includes("selected_account_number")){sessionStorage.setItem(Ji,this.selectedAccountNumber);return}window.addEventListener(D.VaadinRouterLocationChanged,()=>{this.getAccounts({routeChanged:!0})})}async switchAccount(e){this.selectedAccountNumber=e,await he(e)}async getAccounts({routeChanged:e=!1}={}){if(this.loading)return;const t=this.isUserOrRoleManagement();if(e&&this.showingFlattenedAccounts===t)return;if(this.showingFlattenedAccounts=t,t&&this.selectedAccountNumberRootNode&&this.selectedAccountNumber!==this.selectedAccountNumberRootNode){await he(this.selectedAccountNumberRootNode);return}this.loading=!0;const o=await V({exclude_child_accounts:t});if(!o){this.loading=!1;return}if(this.accountsPaged=this.mapToSwitcherAccounts(o==null?void 0:o.items,null),this.nextDataAvailable=o.last<o.total,this.prevDataAvailable=o.first>1,this.rangeLoaded={first:o.first,last:o.last},this.accountsPaged.length<10&&this.prevDataAvailable){this.rangeLoaded.first-=1;const a=this.rangeLoaded.first,n=await V({page_number:a,exclude_child_accounts:t});this.accountsPaged=[...this.mapToSwitcherAccounts(n==null?void 0:n.items,null),...this.accountsPaged],this.prevDataAvailable=this.rangeLoaded.first>1}this.loading=!1}async getMoreAccounts(e){const t=e.detail,o=t.filterString||"",a=this.isUserOrRoleManagement(),n=Date.now();if(t.next){const r=this.rangeLoaded.last+1,s=await V({search_term:o,page_number:r,exclude_child_accounts:a});if(!s||n<this.lastFetchedRequest)return;this.lastFetchedRequest=n,this.rangeLoaded.last+=1,this.accountsPaged=[...this.accountsPaged,...this.mapToSwitcherAccounts(s==null?void 0:s.items,null)],this.nextDataAvailable=s.total>s.last}else if(t.prev){const r=this.rangeLoaded.first-1,s=await V({search_term:o,page_number:r,exclude_child_accounts:a});if(!s||n<this.lastFetchedRequest)return;this.lastFetchedRequest=n,this.rangeLoaded.first-=1,this.accountsPaged=[...this.mapToSwitcherAccounts(s==null?void 0:s.items,null),...this.accountsPaged],this.prevDataAvailable=this.rangeLoaded.first>1}else if(o===""){const r=await V({exclude_child_accounts:a});if(!r||n<this.lastFetchedRequest)return;this.lastFetchedRequest=n,this.accountsPaged=this.mapToSwitcherAccounts(r==null?void 0:r.items,null),this.rangeLoaded={first:r.first,last:r.last},this.nextDataAvailable=r.total>this.rangeLoaded.last,this.prevDataAvailable=this.rangeLoaded.first>1}else{const r=await V({search_term:o,page_number:1,exclude_child_accounts:a});if(!r||n<this.lastFetchedRequest)return;this.lastFetchedRequest=n,this.accountsPaged=this.mapToSwitcherAccounts(r==null?void 0:r.items,null),this.rangeLoaded={first:r.self,last:r.self},this.nextDataAvailable=r.last>r.self,this.prevDataAvailable=this.rangeLoaded.first>1}}mapToSwitcherAccounts(e,t){return e.map(o=>{const a={id:o.accountNumber,rootId:t?t.rootId:o.accountNumber,status:void 0,accountNumber:o.accountNumber,name:o.accountName||o.accountNumber,displayName:o.displayName||`[${o.accountNumber}] ${o.accountName}`};return this.selectedAccountNumber===o.accountNumber&&(this.selectedAccountNumberRootNode=a.rootId),{...a,subaccounts:this.mapToSwitcherAccounts(o.subAccounts,a)}})}renderEmpty(){return c` <ix-account-switcher class="w-200"></ix-account-switcher> `}render(){return c` <ix-account-switcher .accounts="${this.accountsPaged}" .loading="${this.loading}" .selectedAccountNumber="${this.selectedAccountNumber}" .enableFilterDialog="${!0}" ?nextDataAvailable="${this.nextDataAvailable}" ?prevDataAvailable="${this.prevDataAvailable}" @account-switched="${e=>this.switchAccount(e.detail)}" @account-fetch="${this.getMoreAccounts}" class="w-200"></ix-account-switcher> `}};Xe(et,"properties",{accountsPaged:{type:Array,state:!0},selectedAccountNumber:{type:String}}),window.customElements.define("account-selection",et);var Xi=Object.defineProperty,eo=(i,e,t)=>e in i?Xi(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,tt=(i,e,t)=>eo(i,typeof e!="symbol"?e+"":e,t);let to=class extends M{constructor(){super(...arguments),tt(this,"_notificationsState",h),tt(this,"toggleNotificationsDrawer",()=>{window.dispatchEvent(new CustomEvent("ix-notifications-toggle-drawer"))})}static get properties(){return{mobile:{type:Boolean}}}static get styles(){return[A,I`.unread{padding:0 5px;font-size:12px;line-height:16px;left:14px;top:-2px;background:var(--clr-critical,#db0028)}`]}renderUnReadCountText(){if(this._notificationsState.unreadNotificationCount<=0)return c` ${b} `;let e="";return this._notificationsState.unreadNotificationCount>99?e="99+":e=this._notificationsState.unreadNotificationCount.toString(),c` <div class="unread rounded-full text-center text-white text-sm absolute icon-position -start-0"> ${e} </div> `}render(){return c` <div class="relative"> <ix-icon-button style="--md-icon-button-icon-size:24px" class="flex" @click="${()=>this.toggleNotificationsDrawer()}" small aria-label="Open notifications"> <svg slot="default" focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="${this.mobile?"white":"rgb(20, 86, 224)"}"> <path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"></path> </svg> </ix-icon-button> ${this.renderUnReadCountText()} </div> `}};window.customElements.define("notifications-icon",to);let io=class extends P{static get styles(){return[A,I`ix-icon-button{--md-icon-button-icon-size:32px}ix-icon-button.mobile{--md-icon-button-icon-size:40px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}`]}static get properties(){return{mobile:{type:Boolean},lastLogin:{type:String}}}render(){const e=this.lastLogin?"user-profile-last-login":void 0;return c` <ix-icon-button class="${`flex ${this.mobile?"mobile":""}`}" tabindex="0" type="button" aria-label="Open profile options" aria-describedby="${Qt(e)}" small> <svg slot="default" focusable="false" aria-hidden="true" viewBox="0 0 40 40" data-testid="AccountCircleIcon"> <rect xmlns="http://www.w3.org/2000/svg" width="40" height="40" rx="20" fill="#1456E0"/> <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M25 15C25 17.7625 22.7625 20 20 20C17.2375 20 15 17.7625 15 15C15 12.2375 17.2375 10 20 10C22.7625 10 25 12.2375 25 15ZM10 27.5C10 24.175 16.6625 22.5 20 22.5C23.3375 22.5 30 24.175 30 27.5V30H10V27.5Z" fill="white"/> </svg> <span></span> </ix-icon-button> ${this.lastLogin?c`<span id="user-profile-last-login" class="sr-only"> Last login ${this.lastLogin}. If this wasn't you, please reset your password immediately. </span>`:""} `}};window.customElements.define("user-profile-icon",io);const oo="uppercase font-bold tracking-wider";let ao=class extends P{dispatchCreateUserEvent(){const e=new CustomEvent(D.CreateUserClicked,{bubbles:!1,composed:!1});window.dispatchEvent(e)}render(){return c` <ix-button @click="${this.dispatchCreateUserEvent}" has-icon> <md-icon slot="icon">add</md-icon> <span class="${oo}">Create User</span> </ix-button> `}};customElements.define("create-user-button",ao);const no="mm/dd/yyyy",ro="h:mm a",so=i=>!i||i==="12h"?!0:i==="24h"?!1:/a/i.test(i)?!0:!/H/.test(i),lo=(i,e)=>{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(i),o=u=>{var f;return Number((f=t.find(w=>w.type===u))==null?void 0:f.value)},a=Date.UTC(o("year"),o("month")-1,o("day"),o("hour"),o("minute"),o("second")),n=Math.round((a-i.getTime())/6e4),r=n>=0?"+":"-",s=Math.abs(n),l=Math.floor(s/60),d=s%60;return d===0?`GMT${r}${l}`:`GMT${r}${l}:${String(d).padStart(2,"0")}`},co=(i,e,t)=>{const o=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i),a=w=>{var y;return((y=o.find(S=>S.type===w))==null?void 0:y.value)||""},n=a("year"),r=a("month"),s=a("day"),l=new Intl.DateTimeFormat("en-US",{timeZone:e,month:"long"}).format(i),d=new Intl.DateTimeFormat("en-US",{timeZone:e,month:"short"}).format(i),u={yyyy:n,yy:n.slice(-2),mmmm:l,mmm:d,mm:r,dd:s},f=new RegExp(Object.keys(u).sort((w,y)=>y.length-w.length).join("|"),"gi");return t.replace(f,w=>u[w.toLowerCase()])},it=i=>{if(!i)return"Not available";try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;let t=ro,o=no;const a=localStorage.getItem(Ie);if(a){const d=JSON.parse(a);t=d.preferredTimeFormat||t,o=d.preferredDateFormat||o}const n=new Date(i),r=co(n,e,o),s=n.toLocaleTimeString("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:so(t)}),l=lo(n,e);return`${r} at ${s} ${l}`}catch(e){return console.error("Error formatting last login date:",e),i}};let uo=class extends P{static get properties(){return{isAccountMenuOpen:{state:!0},mobile:{type:Boolean},showManualLogout:{state:!0}}}constructor(){super(),this.isAccountMenuOpen=!1,this.showManualLogout=!1}static get styles(){return[Ye,A]}async firstUpdated(){this.menuElem=this.shadowRoot.querySelector("#menu")}logout(){window.location="/logout"}navigateToUserSettings(){window.dispatchEvent(new CustomEvent("edit-profile",{bubbles:!0,composed:!0}))}navigateToAuthenticationOptions(){const{LoginAuthority:e}=L();window.location=`${e}/PhoneNumber?returnUrl=${window.location.href}`}handleAccountMenuToggle(){this.isAccountMenuOpen=!this.isAccountMenuOpen,this.menuElem.open=this.isAccountMenuOpen}handleMenuClosed(){this.menuElem.open=!1,this.isAccountMenuOpen=!1}render(){const e=De(),t=e?it(e):null;return c` <div class="relative"> <user-profile-icon id="accountBtn" @click="${this.handleAccountMenuToggle}" ?mobile="${this.mobile}" .lastLogin="${t||""}"></user-profile-icon> <ix-menu y-offset="0" anchor-corner="end-end" menu-corner="start-end" anchor="accountBtn" has-overflow id="menu" @closed="${this.handleMenuClosed}"> <ix-menu-item @click="${this.navigateToUserSettings}"> <ix-icon slot="start">edit</ix-icon> <div slot="headline" class="header__account__menu__text"> Edit Profile </div> </ix-menu-item> ${Dt()?b:c` <ix-menu-item @click="${this.navigateToAuthenticationOptions}"> <ix-icon slot="start">settings</ix-icon> <div slot="headline" class="header__account__menu__text"> Authentication Options </div> </ix-menu-item> `} <ix-menu-item @click="${()=>this.showManualLogout=!0}"> <ix-icon slot="start">exit_to_app</ix-icon> <div slot="headline" class="header__account__menu__text"> Log out </div> </ix-menu-item> ${t?c` <div class="last-login-info" aria-hidden="true"> <div class="last-login-info__label"> <b>Last Login:</b> </div> <div class="last-login-info__value"> ${t} </div> <div class="last-login-info__warning"> If this wasn't you, please reset your password immediately. </div> </div> `:b} </ix-menu> </div> <ix-manual-logout-dialog ?open="${this.showManualLogout}" @closed="${()=>this.showManualLogout=!1}"></ix-manual-logout-dialog> `}};window.customElements.define("user-profile-ui",uo);var ho=Object.defineProperty,po=(i,e,t)=>e in i?ho(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ot=(i,e,t)=>po(i,typeof e!="symbol"?e+"":e,t);class mo extends P{constructor(){super(),ot(this,"setHeaderHeight",async()=>{const e=this.offsetHeight;e&&document.body.style.setProperty("--header-height",`${e}px`)}),ot(this,"locationChangeHandler",e=>{var t,o,a;if(sessionStorage.getItem(re.SessionStorage.HasOutstandingChanges)==="true")return;const{location:n}=e.detail;(this.currentLocation!==e.srcElement.location.href||((t=n==null?void 0:n.route)==null?void 0:t.hideAccountSwitcher)===!0)&&(this.hideAccountSwitcher=(a=(o=n==null?void 0:n.route)==null?void 0:o.hideAccountSwitcher)!=null?a:!1,this.currentLocation=e.srcElement.location.href),this.updateHeaderByLocation(n!=null&&n.pathname?n:window.location),this.setHeaderHeight()}),this.headerLeft=null,this.headerRight=null,this.isAccountMenuOpen=!1}static get properties(){return{headerLeft:{attribute:!1},headerRight:{attribute:!1},pageTitle:{state:!0},isAccountMenuOpen:{state:!0},hideAccountSwitcher:{state:!1},currentLocation:{state:""}}}static get styles(){return[Ye,A]}headerClass(){const e=window.location.pathname.split("/");return e[2]?null:e[1]||"launchpad"}chartsHeader(){this.pageTitle="",this.headerRight=null,this.headerLeft=c` <ix-button appearance="text" has-icon @click="${()=>window.history.back()}"> <md-icon slot="icon">arrow_back</md-icon> <span class="uppercase font-bold tracking-wider">Back</span> </ix-button> `}userManagementHeader(){this.pageTitle="User Management",this.headerLeft=null,this.headerRight=Y.hasExternalUserCreate()?c` <create-user-button></create-user-button> `:null}dispatchAddConnectivityEvent(){document.dispatchEvent(new CustomEvent("add-connectivity",{detail:{},bubbles:!0,composed:!0}))}inventoryManagementHeader(){this.pageTitle="Inventory",this.headerLeft=null,this.headerRight=Y.hasConnectivityCreate()?c` <ix-button @click="${this.dispatchAddConnectivityEvent}" has-icon> <ix-icon slot="icon">add</ix-icon> <span>Add Connectivity</span> </ix-button> `:null}orderManagementHeader(){this.pageTitle="Order Management",this.headerLeft=null,this.headerRight=Y.hasConnectivityCreate()?c` <ix-button @click="${this.dispatchAddConnectivityEvent}" has-icon> <ix-icon slot="icon">add</ix-icon> <span>Add Connectivity</span> </ix-button> `:null}orderDetailsHeader(){this.pageTitle="",this.headerLeft=c` <ix-button appearance="text" has-icon @click="${()=>window.history.back()}"> <md-icon slot="icon">arrow_back</md-icon> <span class="uppercase font-bold tracking-wider">Back</span> </ix-button> `,this.headerRight=c` <gom-cancel-order-button></gom-cancel-order-button> `,this.hideAccountSwitcher=!0}emptyHeader(){this.pageTitle="",this.headerLeft=null,this.headerRight=null,this.hideAccountSwitcher=!0}roleManagementHeader(){this.pageTitle="Role Management",this.headerLeft=null,this.headerRight=null}knowledgeBaseHeader(){this.pageTitle="Knowledge Base",this.headerLeft=null,this.headerRight=null}reportsHeader(){this.pageTitle="Reports, Maintenance & Incident Notifications",this.headerRight=null,this.headerLeft=null}launchPadHeader(){this.pageTitle="Launchpad",this.headerLeft=null,this.headerRight=null}myAccountHeader(){this.pageTitle="My Account",this.headerLeft=null,this.headerRight=null}esgHeader(){this.pageTitle="ESG Reporting",this.headerLeft=null,this.headerRight=null}updateHeaderByLocation(e=window.location){var t,o,a;if(sessionStorage.getItem(re.SessionStorage.HasOutstandingChanges)==="true")return;if(e.pathname.startsWith(window.registeredApps["ui-dcim-charts"].path)){this.chartsHeader();return}if(e.pathname.startsWith(window.registeredApps["ui-knowledge-base"].path)&&this.knowledgeBaseHeader(),e.pathname.startsWith(window.registeredApps["ui-dcim-reports"].path)||e.pathname.startsWith(`${window.registeredApps["ui-service-management"].path}/reports`)||e.pathname.startsWith(`${window.registeredApps["ui-service-management"].path}/incidents`)){this.reportsHeader();return}if(e.pathname.startsWith(window.registeredApps["ui-my-account"].path)){this.myAccountHeader();return}if(e.pathname.startsWith(window.registeredApps["ui-esg"].path)){this.esgHeader();return}if(e.baseUrl==="/"&&e.pathname==="/"){this.launchPadHeader();return}const n=e.pathname.split("/"),{IsInventoryManagementEnabled:r}=L();if(r){if(n[1]==="inventory"){this.inventoryManagementHeader();return}if(n[1]==="order-management"){if(n[2]==="order-details"){this.orderDetailsHeader();return}if(n[2]==="open-orders"||n[2]==="closed-orders"){this.orderManagementHeader();return}this.emptyHeader();return}}if(n[1]==="user-management"){if(n[2]==="user-management"){this.userManagementHeader();return}if(n[2]==="role-management"){this.roleManagementHeader();return}}const s=(t=e.route)==null?void 0:t.name;s&&(this.pageTitle=s,this.headerLeft=(o=e.route)==null?void 0:o.headerLeft,this.headerRight=(a=e.route)==null?void 0:a.headerRight)}async firstUpdated(){this.menuElem=this.shadowRoot.querySelector("#menu"),this.updateHeaderByLocation()}updated(){this.setHeaderHeight(),setTimeout(()=>{this.setHeaderHeight()},2e3)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.setHeaderHeight),window.addEventListener("scroll",this.setHeaderHeight),window.addEventListener(D.VaadinRouterLocationChanged,this.locationChangeHandler),window.addEventListener(D.LocationChanged,this.locationChangeHandler)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.setHeaderHeight),window.removeEventListener("scroll",this.setHeaderHeight),window.removeEventListener(D.VaadinRouterLocationChanged,this.locationChangeHandler),window.removeEventListener(D.LocationChanged,this.locationChangeHandler)}render(){return c` <div class="header-container p-4 md:p-6 lg:px-4 lg:pt-8 lg:pl-12"> <div class="flex flex-col flex-col-reverse gap-4 lg:gap-6 md:flex-row md:items-center justify-start"> <div class="grow flex flex-col gap-4 lg:gap-6 md:flex-row md:items-center md:justify-between"> ${this.headerLeft?this.headerLeft:c` <h1 class="dlr-text-page-title grow">${this.pageTitle}</h1> `} <div class="flex gap-4 lg:gap-6 md:justify-end"> ${this.headerRight?c` <div class="flex gap-4 lg:gap-6 relative items-center md:justify-end"> ${this.headerRight} <hr class="divider hidden lg:block m-0"> </div> `:b} <div class="hidden relative lg:flex gap-6 items-center md:justify-end"> ${L().IsInventoryManagementEnabled&&window.registeredApps["ui-gom"].enabled?c`<gom-cart-icon-button></gom-cart-icon-button>`:b} <notifications-icon></notifications-icon> <user-profile-ui></user-profile-ui> </div> </div> </div> ${this.hideAccountSwitcher?b:c` <account-selection class="header__accounts grow md:grow-0 -m-4 mb-0 md:m-0 md:w-[260px]"></account-selection> `} </div> </div> `}}window.customElements.define("app-shell-header",mo);const C={digitalRealtyLogo:x`
|
|
1477
|
+
})(window,document,'script','dataLayer','${t}')`,document.head.appendChild(l)},Oi=async()=>{const{LoginAuthority:i}=L(),e=Le();return await(await fetch(`${i}/user-profile`,{headers:{Authorization:`Bearer ${e}`}})).json()};function We(i){document.cookie=`${i}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/`,document.cookie=`${i}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=${location.hostname}`;const e=location.hostname.split(".").slice(-2).join(".");document.cookie=`${i}=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/;domain=.${e}`}function Ke(){const i=document.cookie.split(";");for(let e of i){const t=e.indexOf("="),o=t>-1?e.substring(0,t).trim():e.trim();We(o)}}function Fi(){document.cookie.split(";").map(i=>i.trim().split("=")[0]).filter(i=>/^_ga(_|$)/.test(i)).forEach(i=>We(i))}const Zi=50,W={full:{first:0,last:0,total:0,items:[]},exclude_child_accounts:{first:0,last:0,total:0,items:[]}};let Bi=0;const ie=new Map,V=async({search_term:i="",page_number:e=0,page_size:t=Zi,exclude_child_accounts:o=!1,account_number:a=null}={})=>{if(i===""&&e===0){if(o){if(W.exclude_child_accounts.items.length>0)return W.exclude_child_accounts}else if(W.full.items.length>0)return W.full}const n=Q(),r=a!=null?a:n.profile.account_number,s=new URLSearchParams;s.set("account_number",r),s.set("page_number",e),s.set("page_size",t),s.set("search_term",i),s.set("exclude_child_accounts",!!o);const l=++Bi,d=new AbortController;ie.set(l,d);try{const{LoginAuthority:u}=L(),f=await fetch(`${u}/AuthorizedAccountHierarchyV2?${s.toString()}`,{method:"GET",headers:{Authorization:`Bearer ${n.access_token}`},signal:d.signal});for(const[y,S]of ie.entries())y<l&&(S.abort(),ie.delete(y));if(ie.delete(l),!f.ok)return console.error("Error fetching account hierarchy:",f==null?void 0:f.status),null;const w=await f.json();return qi({search_term:i,page_number:e,result:w,exclude_child_accounts:o})}catch(u){return ie.delete(l),u.name==="AbortError"||console.error("Error fetching account hierarchy:",u),null}},Ui=()=>{const{location:i}=window;return`${i.protocol}//${i.hostname}${i.port?`:${i.port}`:""}`},ji=async(i,e)=>{const{LoginAuthority:t,GlobalPortalClientId:o}=L(),a=Ui();return await(await fetch(`${t}/connect/token`,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:o,grant_type:"refresh_token",refresh_token:e,redirect_uri:a,acr_values:`account_number:${i}`}),method:"POST"})).json()},he=async i=>{const e=Q(),t=await ji(i,e.refresh_token);It(t,e),window.location.reload()},qi=({search_term:i,page_number:e,result:t,exclude_child_accounts:o})=>{if(i===""){const a=o?W.exclude_child_accounts:W.full;e===0?(a.items=t==null?void 0:t.items,a.first=t==null?void 0:t.self,a.last=t==null?void 0:t.self):a.last<t.self?(a.items=[...a.items,...t.items],a.last=t==null?void 0:t.self,a.first===0&&(a.first=t==null?void 0:t.self)):(a.items=[...t==null?void 0:t.items,...a.items],a.first=t==null?void 0:t.self,a.last===0&&(a.last=t==null?void 0:t.self)),a.total=t==null?void 0:t.last,dispatchEvent(new CustomEvent("accountsloaded"))}return t.total=t==null?void 0:t.last,t.first=t==null?void 0:t.self,t.last=t==null?void 0:t.self,t},Je=async i=>{const{ApiBaseUrl:e}=L(),t=Le(),o=await fetch(`${e}/cookie-consent/cookie-consent`,{headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"},body:JSON.stringify(i),method:"POST"});return o.ok?await o.json():!1},Gi=I`:host{--left-bar-width:288px;--left-bar-width-lg:96px;--open-menu-width-md:276px;--content-height:calc(100vh - calc(var(--intraportal-nav-height, 0px) + var(--header-height, 0px) + var(--mobile-nav-height, 0px) + 1rem));--body-height:calc(100vh - var(--intraportal-nav-height, 0px));--main-height:calc(100vh - calc(var(--intraportal-nav-height, 0px) + var(--mobile-nav-height, 0px)));--main-height-tablet-nav:calc(var(--main-height) - 2rem);--top-height:calc(var(--header-height, 0px) + var(--intraportal-nav-height, 0px))}:host([compact]){--left-bar-width:112px}.zero-width-height{width:0;height:0;overflow:hidden}.no-display{display:none}ix-intraportal-nav{position:sticky;top:0;left:0;right:0;z-index:9}:host,:host :root,:root,body{--ix-top-nav-offset:2rem}`,Qe=I`:host{--logo-padding-left:0px;--navbar-icon-min-width:24px}@-moz-document url-prefix(){nav *{scrollbar-width:thin;scrollbar-color:#002274 #5b73d6}}nav ::-webkit-scrollbar{max-width:8px;background-color:#002274}nav ::-webkit-scrollbar-thumb{background-color:#5b73d6;border-radius:100px;max-height:183px;max-width:6px;border:1px solid #002274}.nav-bar-bg{background:linear-gradient(#1456e0 20.5%,#0d2497 113.5%)}.nav-bar-bg.wide{background:linear-gradient(90.27deg,#1456e0 0,#0d2497 99.23%)}.on-primary-icon{--md-icon-button-icon-color:var(--clr-on-primary, #fff);--md-sys-color-on-surface-variant:var(--clr-on-primary, #fff)}.animate-width{transition:width .3s ease,viewBox .3s ease,left .3s ease,opacity .3s ease,grid-template-columns .3s ease}.expand-cta{--md-icon-button-icon-color:var(--clr-graphics-fill, rgba(9, 34, 65, 0.6))}.divider{border-color:var(--clr-on-primary,#fff);opacity:.2;margin:0;flex-shrink:0;border-width:0 0 thin;border-style:solid}.nav-toggle{--ix-nav-toggle:var(--clr-graphics-fill, rgba(9, 34, 65, 0.6));--md-icon-button-icon-color:var(--ix-nav-toggle);--md-icon-button-hover-icon-color:var(--ix-nav-toggle);--md-icon-button-pressed-icon-color:var(--ix-nav-toggle);--md-icon-button-focus-icon-color:var(--ix-nav-toggle)}@media only screen and (max-width:600px){.dlr-logo{display:none}}`,Ye=I`#menu{--md-sys-color-on-surface-variant:var(--clr-surface-container-lowest, #fff);--md-menu-item-label-text-color:var(--clr-surface-container-lowest, #fff);--md-menu-container-color:var(--clr-secondary, #092241);--ix-icon-font-size:1.4rem;--md-menu-container-shape:8px}.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)}.header-container{background-color:rgba(245,247,255,.85);backdrop-filter:blur(6px)}.header__account__menu__text{white-space:nowrap}.flex-container{display:flex;gap:1rem;align-items:center;justify-content:center}.header__accounts{--md-outlined-field-top-space:0.5rem;--md-outlined-field-bottom-space:0.5rem;--ix-outline-color:var(--clr-graphics-fill)}.divider{margin:0 10px 0 10px;flex-shrink:0;border-width:0 thin 0 0;border-style:solid;border-color:var(--clr-secondary,#092241);opacity:.12;height:24px;align-self:center}.last-login-info{padding:16px;font-size:13px;line-height:1.6;color:var(--clr-surface-container-lowest,#fff);display:flex;flex-direction:column;gap:8px}.last-login-info__warning{font-size:12px}`;var Wi=Object.defineProperty,Ki=(i,e,t)=>e in i?Wi(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Xe=(i,e,t)=>Ki(i,typeof e!="symbol"?e+"":e,t);const Ji="accountSelection:selectedAccount",Qi="/user-management/user-management",Yi="/user-management/role-management";let et=class extends P{constructor(){super(),Xe(this,"isUserOrRoleManagement",()=>{const e=window.location.pathname;return e.startsWith(Qi)||e.startsWith(Yi)}),this.accountsPaged=[],this.nextDataAvailable=!1,this.lastFetchedRequest=0,this.rangeLoaded={first:void 0,last:void 0},this.loading=!1,this.showingFlattenedAccounts=!1,this.selectedAccountNumber=Q().profile.account_number,this.selectedAccountNumberRootNode=null}firstUpdated(){if(this.getAccounts(),window.location.search.includes("selected_account_number")){sessionStorage.setItem(Ji,this.selectedAccountNumber);return}window.addEventListener(D.VaadinRouterLocationChanged,()=>{this.getAccounts({routeChanged:!0})})}async switchAccount(e){this.selectedAccountNumber=e,await he(e)}async getAccounts({routeChanged:e=!1}={}){if(this.loading)return;const t=this.isUserOrRoleManagement();if(e&&this.showingFlattenedAccounts===t)return;if(this.showingFlattenedAccounts=t,t&&this.selectedAccountNumberRootNode&&this.selectedAccountNumber!==this.selectedAccountNumberRootNode){await he(this.selectedAccountNumberRootNode);return}this.loading=!0;const o=await V({exclude_child_accounts:t});if(!o){this.loading=!1;return}if(this.accountsPaged=this.mapToSwitcherAccounts(o==null?void 0:o.items,null),this.nextDataAvailable=o.last<o.total,this.prevDataAvailable=o.first>1,this.rangeLoaded={first:o.first,last:o.last},this.accountsPaged.length<10&&this.prevDataAvailable){this.rangeLoaded.first-=1;const a=this.rangeLoaded.first,n=await V({page_number:a,exclude_child_accounts:t});this.accountsPaged=[...this.mapToSwitcherAccounts(n==null?void 0:n.items,null),...this.accountsPaged],this.prevDataAvailable=this.rangeLoaded.first>1}this.loading=!1}async getMoreAccounts(e){const t=e.detail,o=t.filterString||"",a=this.isUserOrRoleManagement(),n=Date.now();if(t.next){const r=this.rangeLoaded.last+1,s=await V({search_term:o,page_number:r,exclude_child_accounts:a});if(!s||n<this.lastFetchedRequest)return;this.lastFetchedRequest=n,this.rangeLoaded.last+=1,this.accountsPaged=[...this.accountsPaged,...this.mapToSwitcherAccounts(s==null?void 0:s.items,null)],this.nextDataAvailable=s.total>s.last}else if(t.prev){const r=this.rangeLoaded.first-1,s=await V({search_term:o,page_number:r,exclude_child_accounts:a});if(!s||n<this.lastFetchedRequest)return;this.lastFetchedRequest=n,this.rangeLoaded.first-=1,this.accountsPaged=[...this.mapToSwitcherAccounts(s==null?void 0:s.items,null),...this.accountsPaged],this.prevDataAvailable=this.rangeLoaded.first>1}else if(o===""){const r=await V({exclude_child_accounts:a});if(!r||n<this.lastFetchedRequest)return;this.lastFetchedRequest=n,this.accountsPaged=this.mapToSwitcherAccounts(r==null?void 0:r.items,null),this.rangeLoaded={first:r.first,last:r.last},this.nextDataAvailable=r.total>this.rangeLoaded.last,this.prevDataAvailable=this.rangeLoaded.first>1}else{const r=await V({search_term:o,page_number:1,exclude_child_accounts:a});if(!r||n<this.lastFetchedRequest)return;this.lastFetchedRequest=n,this.accountsPaged=this.mapToSwitcherAccounts(r==null?void 0:r.items,null),this.rangeLoaded={first:r.self,last:r.self},this.nextDataAvailable=r.last>r.self,this.prevDataAvailable=this.rangeLoaded.first>1}}mapToSwitcherAccounts(e,t){return e.map(o=>{const a={id:o.accountNumber,rootId:t?t.rootId:o.accountNumber,status:void 0,accountNumber:o.accountNumber,name:o.accountName||o.accountNumber,displayName:o.displayName||`[${o.accountNumber}] ${o.accountName}`};return this.selectedAccountNumber===o.accountNumber&&(this.selectedAccountNumberRootNode=a.rootId),{...a,subaccounts:this.mapToSwitcherAccounts(o.subAccounts,a)}})}renderEmpty(){return c` <ix-account-switcher class="w-200"></ix-account-switcher> `}render(){return c` <ix-account-switcher .accounts="${this.accountsPaged}" .loading="${this.loading}" .selectedAccountNumber="${this.selectedAccountNumber}" .enableFilterDialog="${!0}" ?nextDataAvailable="${this.nextDataAvailable}" ?prevDataAvailable="${this.prevDataAvailable}" @account-switched="${e=>this.switchAccount(e.detail)}" @account-fetch="${this.getMoreAccounts}" class="w-200"></ix-account-switcher> `}};Xe(et,"properties",{accountsPaged:{type:Array,state:!0},selectedAccountNumber:{type:String}}),window.customElements.define("account-selection",et);var Xi=Object.defineProperty,eo=(i,e,t)=>e in i?Xi(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,tt=(i,e,t)=>eo(i,typeof e!="symbol"?e+"":e,t);let to=class extends M{constructor(){super(...arguments),tt(this,"_notificationsState",h),tt(this,"toggleNotificationsDrawer",()=>{window.dispatchEvent(new CustomEvent("ix-notifications-toggle-drawer"))})}static get properties(){return{mobile:{type:Boolean}}}static get styles(){return[A,I`.unread{padding:0 5px;font-size:12px;line-height:16px;left:14px;top:-2px;background:var(--clr-critical,#db0028)}`]}renderUnReadCountText(){if(this._notificationsState.unreadNotificationCount<=0)return c` ${b} `;let e="";return this._notificationsState.unreadNotificationCount>99?e="99+":e=this._notificationsState.unreadNotificationCount.toString(),c` <div class="unread rounded-full text-center text-white text-sm absolute icon-position -start-0"> ${e} </div> `}render(){return c` <div class="relative"> <ix-icon-button style="--md-icon-button-icon-size:24px" class="flex" @click="${()=>this.toggleNotificationsDrawer()}" small aria-label="Open notifications"> <svg slot="default" focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="${this.mobile?"white":"rgb(20, 86, 224)"}"> <path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"></path> </svg> </ix-icon-button> ${this.renderUnReadCountText()} </div> `}};window.customElements.define("notifications-icon",to);let io=class extends P{static get styles(){return[A,I`ix-icon-button{--md-icon-button-icon-size:32px}ix-icon-button.mobile{--md-icon-button-icon-size:40px}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}`]}static get properties(){return{mobile:{type:Boolean},lastLogin:{type:String}}}render(){const e=this.lastLogin?"user-profile-last-login":void 0;return c` <ix-icon-button class="${`flex ${this.mobile?"mobile":""}`}" type="button" aria-label="Open profile options" aria-describedby="${Qt(e)}" small> <svg slot="default" focusable="false" aria-hidden="true" viewBox="0 0 40 40" data-testid="AccountCircleIcon"> <rect xmlns="http://www.w3.org/2000/svg" width="40" height="40" rx="20" fill="#1456E0"/> <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M25 15C25 17.7625 22.7625 20 20 20C17.2375 20 15 17.7625 15 15C15 12.2375 17.2375 10 20 10C22.7625 10 25 12.2375 25 15ZM10 27.5C10 24.175 16.6625 22.5 20 22.5C23.3375 22.5 30 24.175 30 27.5V30H10V27.5Z" fill="white"/> </svg> <span></span> </ix-icon-button> ${this.lastLogin?c`<span id="user-profile-last-login" class="sr-only"> Last login ${this.lastLogin}. If this wasn't you, please reset your password immediately. </span>`:""} `}};window.customElements.define("user-profile-icon",io);const oo="uppercase font-bold tracking-wider";let ao=class extends P{dispatchCreateUserEvent(){const e=new CustomEvent(D.CreateUserClicked,{bubbles:!1,composed:!1});window.dispatchEvent(e)}render(){return c` <ix-button @click="${this.dispatchCreateUserEvent}" has-icon> <md-icon slot="icon">add</md-icon> <span class="${oo}">Create User</span> </ix-button> `}};customElements.define("create-user-button",ao);const no="mm/dd/yyyy",ro="h:mm a",so=i=>!i||i==="12h"?!0:i==="24h"?!1:/a/i.test(i)?!0:!/H/.test(i),lo=(i,e)=>{const t=new Intl.DateTimeFormat("en-US",{timeZone:e,hourCycle:"h23",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).formatToParts(i),o=u=>{var f;return Number((f=t.find(w=>w.type===u))==null?void 0:f.value)},a=Date.UTC(o("year"),o("month")-1,o("day"),o("hour"),o("minute"),o("second")),n=Math.round((a-i.getTime())/6e4),r=n>=0?"+":"-",s=Math.abs(n),l=Math.floor(s/60),d=s%60;return d===0?`GMT${r}${l}`:`GMT${r}${l}:${String(d).padStart(2,"0")}`},co=(i,e,t)=>{const o=new Intl.DateTimeFormat("en-US",{timeZone:e,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i),a=w=>{var y;return((y=o.find(S=>S.type===w))==null?void 0:y.value)||""},n=a("year"),r=a("month"),s=a("day"),l=new Intl.DateTimeFormat("en-US",{timeZone:e,month:"long"}).format(i),d=new Intl.DateTimeFormat("en-US",{timeZone:e,month:"short"}).format(i),u={yyyy:n,yy:n.slice(-2),mmmm:l,mmm:d,mm:r,dd:s},f=new RegExp(Object.keys(u).sort((w,y)=>y.length-w.length).join("|"),"gi");return t.replace(f,w=>u[w.toLowerCase()])},it=i=>{if(!i)return"Not available";try{const e=Intl.DateTimeFormat().resolvedOptions().timeZone;let t=ro,o=no;const a=localStorage.getItem(Ie);if(a){const d=JSON.parse(a);t=d.preferredTimeFormat||t,o=d.preferredDateFormat||o}const n=new Date(i),r=co(n,e,o),s=n.toLocaleTimeString("en-US",{timeZone:e,hour:"numeric",minute:"2-digit",hour12:so(t)}),l=lo(n,e);return`${r} at ${s} ${l}`}catch(e){return console.error("Error formatting last login date:",e),i}};let uo=class extends P{static get properties(){return{isAccountMenuOpen:{state:!0},mobile:{type:Boolean},showManualLogout:{state:!0}}}constructor(){super(),this.isAccountMenuOpen=!1,this.showManualLogout=!1}static get styles(){return[Ye,A]}async firstUpdated(){this.menuElem=this.shadowRoot.querySelector("#menu")}logout(){window.location="/logout"}navigateToUserSettings(){window.dispatchEvent(new CustomEvent("edit-profile",{bubbles:!0,composed:!0}))}navigateToAuthenticationOptions(){const{LoginAuthority:e}=L();window.location=`${e}/PhoneNumber?returnUrl=${window.location.href}`}handleAccountMenuToggle(){this.isAccountMenuOpen=!this.isAccountMenuOpen,this.menuElem.open=this.isAccountMenuOpen}handleMenuClosed(){this.menuElem.open=!1,this.isAccountMenuOpen=!1}render(){const e=De(),t=e?it(e):null;return c` <div class="relative"> <user-profile-icon id="accountBtn" @click="${this.handleAccountMenuToggle}" ?mobile="${this.mobile}" .lastLogin="${t||""}"></user-profile-icon> <ix-menu y-offset="0" anchor-corner="end-end" menu-corner="start-end" anchor="accountBtn" has-overflow id="menu" @closed="${this.handleMenuClosed}"> <ix-menu-item @click="${this.navigateToUserSettings}"> <ix-icon slot="start">edit</ix-icon> <div slot="headline" class="header__account__menu__text"> Edit Profile </div> </ix-menu-item> ${Dt()?b:c` <ix-menu-item @click="${this.navigateToAuthenticationOptions}"> <ix-icon slot="start">settings</ix-icon> <div slot="headline" class="header__account__menu__text"> Authentication Options </div> </ix-menu-item> `} <ix-menu-item @click="${()=>this.showManualLogout=!0}"> <ix-icon slot="start">exit_to_app</ix-icon> <div slot="headline" class="header__account__menu__text"> Log out </div> </ix-menu-item> ${t?c` <div class="last-login-info" aria-hidden="true"> <div class="last-login-info__label"> <b>Last Login:</b> </div> <div class="last-login-info__value"> ${t} </div> <div class="last-login-info__warning"> If this wasn't you, please reset your password immediately. </div> </div> `:b} </ix-menu> </div> <ix-manual-logout-dialog ?open="${this.showManualLogout}" @closed="${()=>this.showManualLogout=!1}"></ix-manual-logout-dialog> `}};window.customElements.define("user-profile-ui",uo);var ho=Object.defineProperty,po=(i,e,t)=>e in i?ho(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,ot=(i,e,t)=>po(i,typeof e!="symbol"?e+"":e,t);class mo extends P{constructor(){super(),ot(this,"setHeaderHeight",async()=>{const e=this.offsetHeight;e&&document.body.style.setProperty("--header-height",`${e}px`)}),ot(this,"locationChangeHandler",e=>{var t,o,a;if(sessionStorage.getItem(re.SessionStorage.HasOutstandingChanges)==="true")return;const{location:n}=e.detail;(this.currentLocation!==e.srcElement.location.href||((t=n==null?void 0:n.route)==null?void 0:t.hideAccountSwitcher)===!0)&&(this.hideAccountSwitcher=(a=(o=n==null?void 0:n.route)==null?void 0:o.hideAccountSwitcher)!=null?a:!1,this.currentLocation=e.srcElement.location.href),this.updateHeaderByLocation(n!=null&&n.pathname?n:window.location),this.setHeaderHeight()}),this.headerLeft=null,this.headerRight=null,this.isAccountMenuOpen=!1}static get properties(){return{headerLeft:{attribute:!1},headerRight:{attribute:!1},pageTitle:{state:!0},isAccountMenuOpen:{state:!0},hideAccountSwitcher:{state:!1},currentLocation:{state:""}}}static get styles(){return[Ye,A]}headerClass(){const e=window.location.pathname.split("/");return e[2]?null:e[1]||"launchpad"}chartsHeader(){this.pageTitle="",this.headerRight=null,this.headerLeft=c` <ix-button appearance="text" has-icon @click="${()=>window.history.back()}"> <md-icon slot="icon">arrow_back</md-icon> <span class="uppercase font-bold tracking-wider">Back</span> </ix-button> `}userManagementHeader(){this.pageTitle="User Management",this.headerLeft=null,this.headerRight=Y.hasExternalUserCreate()?c` <create-user-button></create-user-button> `:null}dispatchAddConnectivityEvent(){document.dispatchEvent(new CustomEvent("add-connectivity",{detail:{},bubbles:!0,composed:!0}))}inventoryManagementHeader(){this.pageTitle="Inventory",this.headerLeft=null,this.headerRight=Y.hasConnectivityCreate()?c` <ix-button @click="${this.dispatchAddConnectivityEvent}" has-icon> <ix-icon slot="icon">add</ix-icon> <span>Add Connectivity</span> </ix-button> `:null}orderManagementHeader(){this.pageTitle="Order Management",this.headerLeft=null,this.headerRight=Y.hasConnectivityCreate()?c` <ix-button @click="${this.dispatchAddConnectivityEvent}" has-icon> <ix-icon slot="icon">add</ix-icon> <span>Add Connectivity</span> </ix-button> `:null}orderDetailsHeader(){this.pageTitle="",this.headerLeft=c` <ix-button appearance="text" has-icon @click="${()=>window.history.back()}"> <md-icon slot="icon">arrow_back</md-icon> <span class="uppercase font-bold tracking-wider">Back</span> </ix-button> `,this.headerRight=c` <gom-cancel-order-button></gom-cancel-order-button> `,this.hideAccountSwitcher=!0}emptyHeader(){this.pageTitle="",this.headerLeft=null,this.headerRight=null,this.hideAccountSwitcher=!0}roleManagementHeader(){this.pageTitle="Role Management",this.headerLeft=null,this.headerRight=null}knowledgeBaseHeader(){this.pageTitle="Knowledge Base",this.headerLeft=null,this.headerRight=null}reportsHeader(){this.pageTitle="Reports, Maintenance & Incident Notifications",this.headerRight=null,this.headerLeft=null}launchPadHeader(){this.pageTitle="Launchpad",this.headerLeft=null,this.headerRight=null}myAccountHeader(){this.pageTitle="My Account",this.headerLeft=null,this.headerRight=null}esgHeader(){this.pageTitle="ESG Reporting",this.headerLeft=null,this.headerRight=null}updateHeaderByLocation(e=window.location){var t,o,a;if(sessionStorage.getItem(re.SessionStorage.HasOutstandingChanges)==="true")return;if(e.pathname.startsWith(window.registeredApps["ui-dcim-charts"].path)){this.chartsHeader();return}if(e.pathname.startsWith(window.registeredApps["ui-knowledge-base"].path)&&this.knowledgeBaseHeader(),e.pathname.startsWith(window.registeredApps["ui-dcim-reports"].path)||e.pathname.startsWith(`${window.registeredApps["ui-service-management"].path}/reports`)||e.pathname.startsWith(`${window.registeredApps["ui-service-management"].path}/incidents`)){this.reportsHeader();return}if(e.pathname.startsWith(window.registeredApps["ui-my-account"].path)){this.myAccountHeader();return}if(e.pathname.startsWith(window.registeredApps["ui-esg"].path)){this.esgHeader();return}if(e.baseUrl==="/"&&e.pathname==="/"){this.launchPadHeader();return}const n=e.pathname.split("/"),{IsInventoryManagementEnabled:r}=L();if(r){if(n[1]==="inventory"){this.inventoryManagementHeader();return}if(n[1]==="order-management"){if(n[2]==="order-details"){this.orderDetailsHeader();return}if(n[2]==="open-orders"||n[2]==="closed-orders"){this.orderManagementHeader();return}this.emptyHeader();return}}if(n[1]==="user-management"){if(n[2]==="user-management"){this.userManagementHeader();return}if(n[2]==="role-management"){this.roleManagementHeader();return}}const s=(t=e.route)==null?void 0:t.name;s&&(this.pageTitle=s,this.headerLeft=(o=e.route)==null?void 0:o.headerLeft,this.headerRight=(a=e.route)==null?void 0:a.headerRight)}async firstUpdated(){this.menuElem=this.shadowRoot.querySelector("#menu"),this.updateHeaderByLocation()}updated(){this.setHeaderHeight(),setTimeout(()=>{this.setHeaderHeight()},2e3)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.setHeaderHeight),window.addEventListener("scroll",this.setHeaderHeight),window.addEventListener(D.VaadinRouterLocationChanged,this.locationChangeHandler),window.addEventListener(D.LocationChanged,this.locationChangeHandler)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.setHeaderHeight),window.removeEventListener("scroll",this.setHeaderHeight),window.removeEventListener(D.VaadinRouterLocationChanged,this.locationChangeHandler),window.removeEventListener(D.LocationChanged,this.locationChangeHandler)}render(){return c` <div class="header-container p-4 md:p-6 lg:px-4 lg:pt-8 lg:pl-12"> <div class="flex flex-col flex-col-reverse gap-4 lg:gap-6 md:flex-row md:items-center justify-start"> <div class="grow flex flex-col gap-4 lg:gap-6 md:flex-row md:items-center md:justify-between"> ${this.headerLeft?this.headerLeft:c` <h1 class="dlr-text-page-title grow">${this.pageTitle}</h1> `} <div class="flex gap-4 lg:gap-6 md:justify-end"> ${this.headerRight?c` <div class="flex gap-4 lg:gap-6 relative items-center md:justify-end"> ${this.headerRight} <hr class="divider hidden lg:block m-0"> </div> `:b} <div class="hidden relative lg:flex gap-6 items-center md:justify-end"> ${L().IsInventoryManagementEnabled&&window.registeredApps["ui-gom"].enabled?c`<gom-cart-icon-button></gom-cart-icon-button>`:b} <notifications-icon></notifications-icon> <user-profile-ui></user-profile-ui> </div> </div> </div> ${this.hideAccountSwitcher?b:c` <account-selection class="header__accounts grow md:grow-0 -m-4 mb-0 md:m-0 md:w-[260px]"></account-selection> `} </div> </div> `}}window.customElements.define("app-shell-header",mo);const C={digitalRealtyLogo:x`
|
|
1478
1478
|
<path d="M17.6281 26.4421V23.1369C20.6656 23.1369 23.1369 20.6657 23.1369 17.6281H26.4421C26.4421 22.4881 22.4881 26.4421 17.6281 26.4421ZM17.6281 0V3.30527C20.6656 3.30527 23.1369 5.77647 23.1369 8.81404H26.4421C26.4421 3.95398 22.4881 0 17.6281 0ZM8.81404 23.1369H3.30527V17.6281H0V26.4421H8.81404V23.1369ZM3.30527 3.30527H8.81404V0H0V8.81404H3.30527V3.30527Z"></path>
|
|
1479
1479
|
`,digitalRealtyLogoWithText:x`
|
|
1480
1480
|
<path d="M174.823 18.1256V18.338H174.216V19.7581H173.986V18.338H173.379V18.1256H174.823ZM175.376 18.1256L176.025 19.4728L176.68 18.1256H177.002V19.7581H176.784V18.3865L176.116 19.7581H175.928L175.272 18.3865V19.7581H175.06V18.1256H175.376Z"></path>
|
package/dist/bootstrap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate as S}from"tslib";import{LitElement as A,html as c}from"lit";import{property as w}from"lit/decorators.js";import{ApplicationInsights as Q,DistributedTracingModes as Z}from"@microsoft/applicationinsights-web";import{authedUser as I}from"@digital-realty/ix-account-switcher";import{UserManager as ee}from"oidc-client-ts";import"@digital-realty/ix-app-logic/views/splash-screen.js";import{makeObservable as te,action as se,observable as oe,toJS as re}from"mobx";function a(){var e;const t=(e=window.gpConfig)==null?void 0:e["app-shell"];if(!t)throw new Error("App-shell config not loaded. Ensure config.json is fetched before app bootstrap.");return t}const{PortalInterxion:ne,PortalGlobalPortal:ae,PortalServiceFabric:ie,PortalMarketplacePortal:le}=a(),ce={strict:"strictly_necessary",performance:"performance",targeting:"targeting"},pe={accept:"accept_all",reject:"reject_all",custom:"customize",no:"no_sell"},P="globalportalappshell",p="user-authentication",h="redirect-url",ue="ui-cookie-policy",de="date-format",R="Global Portal",b="Service Fabric",T="Marketplace Portal",N="EMEA Customer Portal",v="x-auth",[u,he,ge,me]=["CREATE","UPDATE","READ","APPROVE"],[y,g,_e,Ee,O,fe,_t,Ce,L,Et,Se,Ae,k,x,U,ft,we,Ct,Ie,M,D,V,Pe,G,Re,be,j,Te]=["Cloud Connect","Cross Connect","Custom Roles","Customer Care","Customer Equipment Connection (CEC)","Customer Support","DCIM-enabled location data","Default System Roles","External User","Facility Access","Internal Roles","Internal User","Internet Exchange","Intra-Customer Connectivity (ICC)","IP Bandwidth","OSP Access","Permanent Badge","PoP/POE Room Access","Remote Hands","Remote Hands Package","Service Exchange Cloud Router","Service Exchange Port","Shipping & Receiving","Space & Power","Trouble Ticket","Visitor Access","User","ESG Reporting"],Ne=[Ie,fe,Re,Pe,be,we,Ee],ve=[g,y,O,k,x,U,M,D,V,G],ye=[g,y,O,k,x,U,M,D,V,G],Oe={LocationChanged:"location-changed",VaadinRouterLocationChanged:"vaadin-router-location-changed",CreateUserClicked:"create-user-clicked"},H={SessionStorage:{HasOutstandingChanges:"hasOutstandingChanges",ShowLastLoginPopup:"showLastLoginPopup"}},[Le,ke,xe]=["Security","DCIM","Planned Site Maintenance"],Ue=[Le,ke,xe],Me=[{label:R,href:ae,selected:!0},{label:T,href:le},{label:N,href:ne},{label:b,href:ie,target:"_blank"}],B={appInsights:"_appInsights"},De=()=>{const{ApplicationInsightsInstrumentationKey:e,ApplicationInsightsCorrelationHeaderExcludedDomains:t}=a(),s=new Q({config:{instrumentationKey:e,enableCorsCorrelation:!0,enableRequestHeaderTracking:!0,enableResponseHeaderTracking:!0,enableAutoRouteTracking:!0,autoTrackPageVisitTime:!0,enableAjaxErrorStatusText:!0,enableAjaxPerfTracking:!0,enableUnhandledPromiseRejectionTracking:!0,isCookieUseDisabled:!0,distributedTracingMode:Z.AI_AND_W3C,correlationHeaderExcludedDomains:t.split(",").map(o=>o.trim())}});return s.loadAppInsights(),s.trackPageView(),s.addTelemetryInitializer(o=>{o.tags["ai.cloud.role"]=P}),s},d=(e,t,s)=>(...o)=>{const[r,...n]=o;typeof r=="string"&&r.startsWith("[mobx]")&&t===4?s.trackException({exception:{message:n[0].message,stack:n[0].stack,name:r},severityLevel:4}):s.trackTrace({severityLevel:t,message:r},n),e.apply(console,[r,...n])},Ve=e=>{console.log=d(console.log,2,e),console.info=d(console.info,2,e),console.warn=d(console.warn,3,e),console.error=d(console.error,4,e),window.console=console},Ge=()=>{const e=De();window[B.appInsights]=e,window.dispatchEvent(new Event("appInsightsInitialized")),Ve(e)},$=async e=>{const t=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(s)).map(o=>o.toString(16).padStart(2,"0")).join("")};function je(){const{location:e}=window,t=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`,{LoginAuthority:s,GlobalPortalClientId:o,GlobalPortalUIScopes:r,GlobalPlanBShellPostLogoutRedirectUrl:n}=a();return{authority:s,client_id:o,redirect_uri:`${t}/auth-callback`,response_type:"code",scope:r,post_logout_redirect_uri:n,monitorSession:!1}}const m=new ee(je()),He=e=>{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(window.atob(t).split("").map(o=>`%${`00${o.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(s)},Be=()=>{localStorage.removeItem(p)},i=()=>{const e=localStorage.getItem(p);return e?JSON.parse(e):null},F=()=>{var e;const t=localStorage.getItem(v);return t?(e=JSON.parse(t))==null?void 0:e.email:null},$e=async()=>{const e=i();if(!e)return null;const t=(e.profile.given_name||"")+(e.profile.family_name||"")+e.profile.sub;return await $(t)},K=()=>{const e=i();return e?e.id_token:null},z=(e,t)=>{const s={...t,...e},o=He(e.access_token);return s.profile.sub=o.sub,s.profile.account_number=o.account_number,s.expires_at=o.exp,s.is_federated=o.is_federated,o.previous_login_date&&(s.profile.previous_login_date=o.previous_login_date),I.setAccount({accountNumber:o.account_number,email:o.email,name:o.name,givenName:o.given_name,familyName:o.family_name,authTime:o.exp,accessToken:e.access_token,idToken:e.id_token}),localStorage.setItem(p,JSON.stringify(s)),s},Fe=e=>{z(e,null)},Ke=()=>{const e=i();return e?e.access_token:null},ze=()=>{const e=i();return e&&e.is_federated!==null&&e.is_federated!==void 0?String(e.is_federated).toLowerCase()==="true":!1},Je=()=>{const e=i();return e!=null&&e.expires_at?e.expires_at>Date.now()/1e3:!1},We=()=>{var e;const t=i();return((e=t==null?void 0:t.profile)==null?void 0:e.previous_login_date)||null},Ye=["authenticate","auth-callback","logout"],qe=e=>e.expires_at&&new Date(e.expires_at*1e3),Xe=e=>e.expires_at&&new Date(e.expires_at*1e3+a().TokenValidForOfflineUsePostExpiryInHours*60*60*1e3),J=()=>{if(!a().IsLoginEnabled)return!1;const e=i();if(!K())return!0;if(!e.expires_at)return!1;const t=new Date;return navigator.onLine?t>qe(e):t>Xe(e)},Qe=()=>{const e=window.location.pathname.split("/");return Ye.includes(e[e.length-1])},Ze=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="authenticate"?(a().IsLoginEnabled?m.signinRedirect():window.location.href="/",!0):!1},et=()=>{let e="/";const t=localStorage.getItem(h);t&&(localStorage.removeItem(h),e=t),sessionStorage.setItem(H.SessionStorage.ShowLastLoginPopup,"true"),window.location.href=e},tt=e=>{if(!e.id_token)throw new Error("Missing property:id_token");return e},_=e=>{const t=Qe();(!t||e)&&(t||localStorage.setItem(h,window.location.href),window.location.href="/authenticate")},st=async e=>{const t=`${e.profile.sub}-${e.profile.customer_id}`,s=await $(t);return{...e,profile:{...e.profile,hashed_identifier:s}}},ot=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="auth-callback"?(m.signinRedirectCallback().then(tt).then(st).then(Fe).then(et).catch(_),!0):!1};class rt extends A{render(){return c` <ix-splash-screen></ix-splash-screen> `}}window.customElements.define("splash-screen",rt);var nt=Object.defineProperty,at=(e,t,s)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,E=(e,t,s)=>at(e,typeof t!="symbol"?t+"":t,s);class it{constructor(){E(this,"permissions",[]),E(this,"loading",!1),E(this,"getPermissions",async()=>{var t;const s=(t=I)==null?void 0:t.access_token;if(!s)return[];const{ApiBaseUrl:o}=a(),r=await fetch(`${o}/usermanagement/my-permissions?exclude_parents=false&exclude_siblings=true`,{headers:{Authorization:`Bearer ${s}`}});return r.ok?r.json():[]}),te(this,{permissions:oe,setPermissions:se})}setPermissions(t){this.permissions=t.reduce((s,o)=>(s[o.permission_name]=o.privilege,s),{})}tryLoadPermissions(){try{this.loading||(this.loading=!0,this.getPermissions().then(t=>{this.setPermissions(t),this.loading=!1}).catch(()=>{this.loading=!1}))}catch(t){this.loading=!1}}clearPermissions(){this.setPermissions([])}hasExternalUserCreate(){return this.hasPermission(L,u)||this.hasPermission(j,u)}hasConnectivityCreate(){return this.hasPermission(g,u)}hasPrivilegeLevel(t,s){const o=[me,u,he,ge],r=o.findIndex(l=>l===t),n=o.findIndex(l=>l===s);return r>=n}hasPermission(t,s){let o=!1;const r=re(this.permissions),n=Object.keys(r).find(l=>l===t);return n&&(o=this.hasPrivilegeLevel(s,r[n])),o}}const f=new it;class C extends A{constructor(){super(),this._currentView="splash",this.appLoaded=!1,this._onPopState=()=>{a().IsLoginEnabled&&J()&&_()};try{Ge()}catch(s){console.error("Telemetry initialization failed:",s)}const t=window.location.pathname;if(t==="/session-expired"){this._currentView="session-expired",this._loadView("session-expired");return}if(t==="/logout"){this._currentView="logout",this._loadView("logout");return}if(Ze()||ot()){this._currentView="splash";return}if(J()){this._currentView="splash",_();return}this._currentView="app",this._loadApp()}async _loadView(t){t==="session-expired"?await import("@digital-realty/ix-app-logic/views/session-expiry.js"):t==="logout"&&await import("./logout-CjljBIWK.js")}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._onPopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this._onPopState)}_getAccountNumber(){var t,s,o;return(o=new URLSearchParams(window.location.search).get("selected_account_number"))!=null?o:(s=(t=i())==null?void 0:t.profile)==null?void 0:s.account_number}_isESGAccessOnly(t,s){const o=t.filter(r=>r.account_number===s);return o.length===1&&o[0].permission_name==="ESG Reporting"}_applyGomFfBypass(t){var s;const o=F();if(!o||!((s=a().SuperusersWhitelist)!=null?s:"").split(",").map(n=>n.trim().toLowerCase()).includes(o.toLowerCase()))return t;const r=window.gpConfig;return r&&(window.gpConfig={...r,"app-shell":r["app-shell"]?{...r["app-shell"],IsInventoryManagementEnabled:!0}:r["app-shell"],"ui-launchpad":r["ui-launchpad"]?{...r["ui-launchpad"],IsInventoryManagementEnabled:!0}:r["ui-launchpad"]}),t["ui-gom"]?{...t,"ui-gom":{...t["ui-gom"],enabled:!0}}:t}_applyMfeOverrides(t,s){const o={};for(const r of Object.keys(t))o[r]={...t[r],enabled:s.includes(r)};return o}async _loadApp(){var t;const{authedUser:s}=await import("@digital-realty/ix-account-switcher");await s.hydrateStore();const[o,r]=await Promise.allSettled([fetch("./registered-apps.json").then(X=>X.json()),f.getPermissions()]);if(o.status==="rejected"){console.error("Failed to load registered apps:",o.reason);return}if(r.status==="rejected"){console.error("Failed to load permissions:",r.reason);return}const{registeredApps:n}=o.value,l=r.value,W=(t=this._getAccountNumber())!=null?t:"",Y=this._isESGAccessOnly(l,W)?this._applyMfeOverrides(n,["ui-esg"]):n,q=this._applyGomFfBypass(Y);window.registeredApps=Object.freeze(q),f.setPermissions(l),await import("./app-BPh3_-Bt.js"),this.appLoaded=!0}render(){switch(this._currentView){case"session-expired":return c`<ix-session-expiry></ix-session-expiry>`;case"logout":return c`<ixp-logout></ixp-logout>`;case"app":return this.appLoaded?c`<global-portal-app appTitle="DLR" showDrawer></global-portal-app>`:c`<splash-screen></splash-screen>`;default:return c`<splash-screen></splash-screen>`}}}S([w({type:String})],C.prototype,"_currentView",void 0),S([w({type:Boolean})],C.prototype,"appLoaded",void 0),window.customElements.define("gp-bootstrap",C);export{Oe as A,m as B,ue as C,Ce as D,N as E,v as F,R as G,Se as I,T as M,ye as O,Ue as R,b as S,j as U,P as a,H as b,_e as c,ce as d,pe as e,de as f,Te as g,L as h,Ae as i,ve as j,Me as k,p as l,Ne as m,Be as n,Ke as o,a as p,$e as q,K as r,We as s,i as t,F as u,B as v,Je as w,ze as x,f as y,z};
|
|
1
|
+
import{__decorate as S}from"tslib";import{LitElement as A,html as c}from"lit";import{property as w}from"lit/decorators.js";import{ApplicationInsights as Q,DistributedTracingModes as Z}from"@microsoft/applicationinsights-web";import{authedUser as I}from"@digital-realty/ix-account-switcher";import{UserManager as ee}from"oidc-client-ts";import"@digital-realty/ix-app-logic/views/splash-screen.js";import{makeObservable as te,action as se,observable as oe,toJS as re}from"mobx";function a(){var e;const t=(e=window.gpConfig)==null?void 0:e["app-shell"];if(!t)throw new Error("App-shell config not loaded. Ensure config.json is fetched before app bootstrap.");return t}const{PortalInterxion:ne,PortalGlobalPortal:ae,PortalServiceFabric:ie,PortalMarketplacePortal:le}=a(),ce={strict:"strictly_necessary",performance:"performance",targeting:"targeting"},pe={accept:"accept_all",reject:"reject_all",custom:"customize",no:"no_sell"},P="globalportalappshell",p="user-authentication",h="redirect-url",ue="ui-cookie-policy",de="date-format",R="Global Portal",b="Service Fabric",T="Marketplace Portal",N="EMEA Customer Portal",v="x-auth",[u,he,ge,me]=["CREATE","UPDATE","READ","APPROVE"],[y,g,_e,Ee,O,fe,_t,Ce,L,Et,Se,Ae,k,x,U,ft,we,Ct,Ie,M,D,V,Pe,G,Re,be,j,Te]=["Cloud Connect","Cross Connect","Custom Roles","Customer Care","Customer Equipment Connection (CEC)","Customer Support","DCIM-enabled location data","Default System Roles","External User","Facility Access","Internal Roles","Internal User","Internet Exchange","Intra-Customer Connectivity (ICC)","IP Bandwidth","OSP Access","Permanent Badge","PoP/POE Room Access","Remote Hands","Remote Hands Package","Service Exchange Cloud Router","Service Exchange Port","Shipping & Receiving","Space & Power","Trouble Ticket","Visitor Access","User","ESG Reporting"],Ne=[Ie,fe,Re,Pe,be,we,Ee],ve=[g,y,O,k,x,U,M,D,V,G],ye=[g,y,O,k,x,U,M,D,V,G],Oe={LocationChanged:"location-changed",VaadinRouterLocationChanged:"vaadin-router-location-changed",CreateUserClicked:"create-user-clicked"},H={SessionStorage:{HasOutstandingChanges:"hasOutstandingChanges",ShowLastLoginPopup:"showLastLoginPopup"}},[Le,ke,xe]=["Security","DCIM","Planned Site Maintenance"],Ue=[Le,ke,xe],Me=[{label:R,href:ae,selected:!0},{label:T,href:le},{label:N,href:ne},{label:b,href:ie,target:"_blank"}],B={appInsights:"_appInsights"},De=()=>{const{ApplicationInsightsInstrumentationKey:e,ApplicationInsightsCorrelationHeaderExcludedDomains:t}=a(),s=new Q({config:{instrumentationKey:e,enableCorsCorrelation:!0,enableRequestHeaderTracking:!0,enableResponseHeaderTracking:!0,enableAutoRouteTracking:!0,autoTrackPageVisitTime:!0,enableAjaxErrorStatusText:!0,enableAjaxPerfTracking:!0,enableUnhandledPromiseRejectionTracking:!0,isCookieUseDisabled:!0,distributedTracingMode:Z.AI_AND_W3C,correlationHeaderExcludedDomains:t.split(",").map(o=>o.trim())}});return s.loadAppInsights(),s.trackPageView(),s.addTelemetryInitializer(o=>{o.tags["ai.cloud.role"]=P}),s},d=(e,t,s)=>(...o)=>{const[r,...n]=o;typeof r=="string"&&r.startsWith("[mobx]")&&t===4?s.trackException({exception:{message:n[0].message,stack:n[0].stack,name:r},severityLevel:4}):s.trackTrace({severityLevel:t,message:r},n),e.apply(console,[r,...n])},Ve=e=>{console.log=d(console.log,2,e),console.info=d(console.info,2,e),console.warn=d(console.warn,3,e),console.error=d(console.error,4,e),window.console=console},Ge=()=>{const e=De();window[B.appInsights]=e,window.dispatchEvent(new Event("appInsightsInitialized")),Ve(e)},$=async e=>{const t=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(s)).map(o=>o.toString(16).padStart(2,"0")).join("")};function je(){const{location:e}=window,t=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`,{LoginAuthority:s,GlobalPortalClientId:o,GlobalPortalUIScopes:r,GlobalPlanBShellPostLogoutRedirectUrl:n}=a();return{authority:s,client_id:o,redirect_uri:`${t}/auth-callback`,response_type:"code",scope:r,post_logout_redirect_uri:n,monitorSession:!1}}const m=new ee(je()),He=e=>{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(window.atob(t).split("").map(o=>`%${`00${o.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(s)},Be=()=>{localStorage.removeItem(p)},i=()=>{const e=localStorage.getItem(p);return e?JSON.parse(e):null},F=()=>{var e;const t=localStorage.getItem(v);return t?(e=JSON.parse(t))==null?void 0:e.email:null},$e=async()=>{const e=i();if(!e)return null;const t=(e.profile.given_name||"")+(e.profile.family_name||"")+e.profile.sub;return await $(t)},K=()=>{const e=i();return e?e.id_token:null},z=(e,t)=>{const s={...t,...e},o=He(e.access_token);return s.profile.sub=o.sub,s.profile.account_number=o.account_number,s.expires_at=o.exp,s.is_federated=o.is_federated,o.previous_login_date&&(s.profile.previous_login_date=o.previous_login_date),I.setAccount({accountNumber:o.account_number,email:o.email,name:o.name,givenName:o.given_name,familyName:o.family_name,authTime:o.exp,accessToken:e.access_token,idToken:e.id_token}),localStorage.setItem(p,JSON.stringify(s)),s},Fe=e=>{z(e,null)},Ke=()=>{const e=i();return e?e.access_token:null},ze=()=>{const e=i();return e&&e.is_federated!==null&&e.is_federated!==void 0?String(e.is_federated).toLowerCase()==="true":!1},Je=()=>{const e=i();return e!=null&&e.expires_at?e.expires_at>Date.now()/1e3:!1},We=()=>{var e;const t=i();return((e=t==null?void 0:t.profile)==null?void 0:e.previous_login_date)||null},Ye=["authenticate","auth-callback","logout"],qe=e=>e.expires_at&&new Date(e.expires_at*1e3),Xe=e=>e.expires_at&&new Date(e.expires_at*1e3+a().TokenValidForOfflineUsePostExpiryInHours*60*60*1e3),J=()=>{if(!a().IsLoginEnabled)return!1;const e=i();if(!K())return!0;if(!e.expires_at)return!1;const t=new Date;return navigator.onLine?t>qe(e):t>Xe(e)},Qe=()=>{const e=window.location.pathname.split("/");return Ye.includes(e[e.length-1])},Ze=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="authenticate"?(a().IsLoginEnabled?m.signinRedirect():window.location.href="/",!0):!1},et=()=>{let e="/";const t=localStorage.getItem(h);t&&(localStorage.removeItem(h),e=t),sessionStorage.setItem(H.SessionStorage.ShowLastLoginPopup,"true"),window.location.href=e},tt=e=>{if(!e.id_token)throw new Error("Missing property:id_token");return e},_=e=>{const t=Qe();(!t||e)&&(t||localStorage.setItem(h,window.location.href),window.location.href="/authenticate")},st=async e=>{const t=`${e.profile.sub}-${e.profile.customer_id}`,s=await $(t);return{...e,profile:{...e.profile,hashed_identifier:s}}},ot=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="auth-callback"?(m.signinRedirectCallback().then(tt).then(st).then(Fe).then(et).catch(_),!0):!1};class rt extends A{render(){return c` <ix-splash-screen></ix-splash-screen> `}}window.customElements.define("splash-screen",rt);var nt=Object.defineProperty,at=(e,t,s)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,E=(e,t,s)=>at(e,typeof t!="symbol"?t+"":t,s);class it{constructor(){E(this,"permissions",[]),E(this,"loading",!1),E(this,"getPermissions",async()=>{var t;const s=(t=I)==null?void 0:t.access_token;if(!s)return[];const{ApiBaseUrl:o}=a(),r=await fetch(`${o}/usermanagement/my-permissions?exclude_parents=false&exclude_siblings=true`,{headers:{Authorization:`Bearer ${s}`}});return r.ok?r.json():[]}),te(this,{permissions:oe,setPermissions:se})}setPermissions(t){this.permissions=t.reduce((s,o)=>(s[o.permission_name]=o.privilege,s),{})}tryLoadPermissions(){try{this.loading||(this.loading=!0,this.getPermissions().then(t=>{this.setPermissions(t),this.loading=!1}).catch(()=>{this.loading=!1}))}catch(t){this.loading=!1}}clearPermissions(){this.setPermissions([])}hasExternalUserCreate(){return this.hasPermission(L,u)||this.hasPermission(j,u)}hasConnectivityCreate(){return this.hasPermission(g,u)}hasPrivilegeLevel(t,s){const o=[me,u,he,ge],r=o.findIndex(l=>l===t),n=o.findIndex(l=>l===s);return r>=n}hasPermission(t,s){let o=!1;const r=re(this.permissions),n=Object.keys(r).find(l=>l===t);return n&&(o=this.hasPrivilegeLevel(s,r[n])),o}}const f=new it;class C extends A{constructor(){super(),this._currentView="splash",this.appLoaded=!1,this._onPopState=()=>{a().IsLoginEnabled&&J()&&_()};try{Ge()}catch(s){console.error("Telemetry initialization failed:",s)}const t=window.location.pathname;if(t==="/session-expired"){this._currentView="session-expired",this._loadView("session-expired");return}if(t==="/logout"){this._currentView="logout",this._loadView("logout");return}if(Ze()||ot()){this._currentView="splash";return}if(J()){this._currentView="splash",_();return}this._currentView="app",this._loadApp()}async _loadView(t){t==="session-expired"?await import("@digital-realty/ix-app-logic/views/session-expiry.js"):t==="logout"&&await import("./logout-CjljBIWK.js")}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._onPopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this._onPopState)}_getAccountNumber(){var t,s,o;return(o=new URLSearchParams(window.location.search).get("selected_account_number"))!=null?o:(s=(t=i())==null?void 0:t.profile)==null?void 0:s.account_number}_isESGAccessOnly(t,s){const o=t.filter(r=>r.account_number===s);return o.length===1&&o[0].permission_name==="ESG Reporting"}_applyGomFfBypass(t){var s;const o=F();if(!o||!((s=a().SuperusersWhitelist)!=null?s:"").split(",").map(n=>n.trim().toLowerCase()).includes(o.toLowerCase()))return t;const r=window.gpConfig;return r&&(window.gpConfig={...r,"app-shell":r["app-shell"]?{...r["app-shell"],IsInventoryManagementEnabled:!0}:r["app-shell"],"ui-launchpad":r["ui-launchpad"]?{...r["ui-launchpad"],IsInventoryManagementEnabled:!0}:r["ui-launchpad"]}),t["ui-gom"]?{...t,"ui-gom":{...t["ui-gom"],enabled:!0}}:t}_applyMfeOverrides(t,s){const o={};for(const r of Object.keys(t))o[r]={...t[r],enabled:s.includes(r)};return o}async _loadApp(){var t;const{authedUser:s}=await import("@digital-realty/ix-account-switcher");await s.hydrateStore();const[o,r]=await Promise.allSettled([fetch("./registered-apps.json").then(X=>X.json()),f.getPermissions()]);if(o.status==="rejected"){console.error("Failed to load registered apps:",o.reason);return}if(r.status==="rejected"){console.error("Failed to load permissions:",r.reason);return}const{registeredApps:n}=o.value,l=r.value,W=(t=this._getAccountNumber())!=null?t:"",Y=this._isESGAccessOnly(l,W)?this._applyMfeOverrides(n,["ui-esg"]):n,q=this._applyGomFfBypass(Y);window.registeredApps=Object.freeze(q),f.setPermissions(l),await import("./app-DLgYx-dJ.js"),this.appLoaded=!0}render(){switch(this._currentView){case"session-expired":return c`<ix-session-expiry></ix-session-expiry>`;case"logout":return c`<ixp-logout></ixp-logout>`;case"app":return this.appLoaded?c`<global-portal-app appTitle="DLR" showDrawer></global-portal-app>`:c`<splash-screen></splash-screen>`;default:return c`<splash-screen></splash-screen>`}}}S([w({type:String})],C.prototype,"_currentView",void 0),S([w({type:Boolean})],C.prototype,"appLoaded",void 0),window.customElements.define("gp-bootstrap",C);export{Oe as A,m as B,ue as C,Ce as D,N as E,v as F,R as G,Se as I,T as M,ye as O,Ue as R,b as S,j as U,P as a,H as b,_e as c,ce as d,pe as e,de as f,Te as g,L as h,Ae as i,ve as j,Me as k,p as l,Ne as m,Be as n,Ke as o,a as p,$e as q,K as r,We as s,i as t,F as u,B as v,Je as w,ze as x,f as y,z};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digital-realty/app-shell",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.3-IXUAT-10198.532096",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"DLR"
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"generate-import-map": "ix-import-map write-import-map --latest-packages=true && node build_scripts/inject-mfe-importmap.cjs",
|
|
30
30
|
"inject-mfe-importmap": "node build_scripts/inject-mfe-importmap.cjs",
|
|
31
31
|
"build": "run-s build:step:*",
|
|
32
|
-
"build:step:generate": "npm run generate-
|
|
32
|
+
"build:step:generate": "npm run generate-api:notifications && npm run compile-less-to-styles && npm run tailwindcss:build && npm run twlit:build",
|
|
33
33
|
"build:step:package": "rimraf dist && tsc && rollup -c rollup.config.mjs",
|
|
34
34
|
"serve:dist": "web-dev-server --config web-dist-server.config.mjs",
|
|
35
35
|
"ts:watch": "concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"npm run tailwindcss:watch\" \"npm run twlit:watch\"",
|
|
@@ -37,10 +37,9 @@
|
|
|
37
37
|
"start:pre-serve": "rimraf lib && rollup -c preserve.rollup.config.mjs && tsc",
|
|
38
38
|
"start:serve": "web-dev-server",
|
|
39
39
|
"compile-less-to-styles": "rimraf --glob \"src/styles/*.js\" && node build_scripts/compile-less-to-styles.cjs",
|
|
40
|
-
"generate-config": "node build_scripts/generate-config.cjs",
|
|
41
40
|
"serve": "npm run build && prpl-server --root dist",
|
|
42
41
|
"test": "npm run test:prebuild && web-test-runner --coverage",
|
|
43
|
-
"test:prebuild": "rimraf lib && tsc && rollup -c preserve.rollup.config.mjs && npm run compile-less-to-styles && npm run tailwindcss:build && npm run twlit:build
|
|
42
|
+
"test:prebuild": "rimraf lib && tsc && rollup -c preserve.rollup.config.mjs && npm run compile-less-to-styles && npm run tailwindcss:build && npm run twlit:build",
|
|
44
43
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
|
|
45
44
|
"lint": "npm run lint:eslint && npm run lint:prettier",
|
|
46
45
|
"lint:eslint": "eslint --ext .js,.html .",
|
|
@@ -86,7 +85,7 @@
|
|
|
86
85
|
"@webcomponents/custom-elements": "^1.4.2",
|
|
87
86
|
"@webcomponents/webcomponentsjs": "^2.4.3",
|
|
88
87
|
"cross-fetch": "^4.0.0",
|
|
89
|
-
"date-fns": "
|
|
88
|
+
"date-fns": "4.1.0",
|
|
90
89
|
"http-request-mock": "^1.8.28",
|
|
91
90
|
"http-status-codes": "^1.4.0",
|
|
92
91
|
"lit": "^3.1.0",
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"registeredApps": {
|
|
3
|
-
"ui-service-management": {
|
|
4
|
-
"path": "/service-management",
|
|
5
|
-
"host": "http://localhost:8083",
|
|
6
|
-
"blob": "http://localhost:8083",
|
|
7
|
-
"entry": "/ui-service-management.js",
|
|
8
|
-
"serviceWorker": "",
|
|
9
|
-
"enabled": true,
|
|
10
|
-
"copyNS": "sm"
|
|
11
|
-
},
|
|
12
|
-
"ui-user-management": {
|
|
13
|
-
"path": "/user-management",
|
|
14
|
-
"host": "http://localhost:8082",
|
|
15
|
-
"blob": "http://localhost:8082",
|
|
16
|
-
"entry": "/ui-user-management.js",
|
|
17
|
-
"serviceWorker": "",
|
|
18
|
-
"enabled": true,
|
|
19
|
-
"copyNS": "um"
|
|
20
|
-
},
|
|
21
|
-
"ui-knowledge-base": {
|
|
22
|
-
"path": "/knowledge-base",
|
|
23
|
-
"enabled": true,
|
|
24
|
-
"copyNS": "kb"
|
|
25
|
-
},
|
|
26
|
-
"ui-inventory": {
|
|
27
|
-
"path": "/inventory/",
|
|
28
|
-
"host": "http://localhost:8089",
|
|
29
|
-
"blob": "http://localhost:8089",
|
|
30
|
-
"entry": "/ui-inventory.js",
|
|
31
|
-
"serviceWorker": "",
|
|
32
|
-
"enabled": true,
|
|
33
|
-
"copyNS": "inv"
|
|
34
|
-
},
|
|
35
|
-
"ui-gom": {
|
|
36
|
-
"path": [
|
|
37
|
-
"/inventory",
|
|
38
|
-
"/order-management"
|
|
39
|
-
],
|
|
40
|
-
"pathAndQuerystring": [
|
|
41
|
-
{
|
|
42
|
-
"path": "/inventory",
|
|
43
|
-
"mppProcessQueryString": "Inventory"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"path": "/order-management",
|
|
47
|
-
"mppProcessQueryString": "Cross_connect"
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
"host": "http://localhost:8090",
|
|
51
|
-
"blob": "http://localhost:8090",
|
|
52
|
-
"entry": "/ui-mfe-gom.js",
|
|
53
|
-
"enabled": true,
|
|
54
|
-
"copyNS": "gom"
|
|
55
|
-
},
|
|
56
|
-
"ui-sites": {
|
|
57
|
-
"path": "/sites/",
|
|
58
|
-
"host": "http://localhost:8089",
|
|
59
|
-
"blob": "http://localhost:8089",
|
|
60
|
-
"entry": "/ui-inventory.js",
|
|
61
|
-
"serviceWorker": "",
|
|
62
|
-
"enabled": true,
|
|
63
|
-
"copyNS": "sit"
|
|
64
|
-
},
|
|
65
|
-
"ui-dcim-charts": {
|
|
66
|
-
"path": "/charts",
|
|
67
|
-
"host": "http://localhost:8084",
|
|
68
|
-
"blob": "http://localhost:8084",
|
|
69
|
-
"entry": "/ui-mfe-dcim.js",
|
|
70
|
-
"serviceWorker": "",
|
|
71
|
-
"enabled": true,
|
|
72
|
-
"copyNS": "dc"
|
|
73
|
-
},
|
|
74
|
-
"ui-dcim-reports": {
|
|
75
|
-
"path": "/reports",
|
|
76
|
-
"host": "http://localhost:8085",
|
|
77
|
-
"blob": "http://localhost:8085",
|
|
78
|
-
"entry": "/ui-mfe-reports.js",
|
|
79
|
-
"serviceWorker": "",
|
|
80
|
-
"enabled": true,
|
|
81
|
-
"copyNS": "dr"
|
|
82
|
-
},
|
|
83
|
-
"ui-launchpad": {
|
|
84
|
-
"path": "/lp",
|
|
85
|
-
"host": "http://localhost:8087",
|
|
86
|
-
"blob": "http://localhost:8087",
|
|
87
|
-
"entry": "/ui-launchpad.js",
|
|
88
|
-
"enabled": true,
|
|
89
|
-
"copyNS": "lp"
|
|
90
|
-
},
|
|
91
|
-
"ui-my-account": {
|
|
92
|
-
"path": "/my-account",
|
|
93
|
-
"host": "http://localhost:8088",
|
|
94
|
-
"blob": "http://localhost:8088",
|
|
95
|
-
"entry": "/ui-my-account.js",
|
|
96
|
-
"enabled": true,
|
|
97
|
-
"copyNS": "acc"
|
|
98
|
-
},
|
|
99
|
-
"ui-cookie-policy": {
|
|
100
|
-
"path": "/cookie-policy",
|
|
101
|
-
"enabled": true,
|
|
102
|
-
"copyNS": "cp"
|
|
103
|
-
},
|
|
104
|
-
"ui-esg": {
|
|
105
|
-
"path": "/esg-reporting",
|
|
106
|
-
"host": "http://localhost:8091",
|
|
107
|
-
"blob": "http://localhost:8091",
|
|
108
|
-
"entry": "/ui-mfe-esg.js",
|
|
109
|
-
"enabled": true,
|
|
110
|
-
"copyNS": "esg"
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
package/dist/scripts/config.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var GLOBAL_PORTAL_CLIENT_ID = "planbglobalportalui";
|
|
2
|
-
var GLOBAL_PORTAL_UI_SCOPES = "openid service_management_profile offline_access user_management_profile resource.notifications resource.usermanagementapi resource.servicemanagementapi resource.inventory resource.cookieconsents";
|
|
3
|
-
var LOGIN_AUTHORITY = "https://login-a1.digitalrealty.com";
|
|
4
|
-
var GLOBAL_PLAN_B_SHELL_POST_LOGOUT_REDIRECT_URL = "https://inxn-a1-gpappshell.azureedge.net/?logout=true";
|
|
5
|
-
var API_BASE_URL = "https://api-a1.interxion.com";
|
|
6
|
-
var DISABLE_REDIRECTS = false;
|
|
7
|
-
var IS_LOGIN_ENABLED = true;
|
|
8
|
-
var IS_APP_DISABLED = false;
|
|
9
|
-
var APPLICATION_INSIGHTS_INSTRUMENTATION_KEY = "";
|
|
10
|
-
var ENVIRONMENT_TYPE = "local";
|
|
11
|
-
var APPLICATION_INSIGHTS_CORRELATION_HEADER_DOMAINS = "*.localtest.me";
|
|
12
|
-
var GPV2_GTM_CONTAINER_ID = "GTM-KXBK8CQP";
|
|
13
|
-
var GTM_CONTAINER_ID = "GTM-NBZ9MM2";
|
|
14
|
-
var TOKEN_VALID_FOR_OFFLINE_USE_POST_EXPIRY_IN_HOURS = 24;
|
|
15
|
-
var NOTIFICATION_API_BASE_URL = "https://api-a1.interxion.com";
|
|
16
|
-
var PRESERVE_LOCAL_STORAGE_ITEMS = "ui-ticket-updates-accessAt,ix-grid-,-grid,app-state,releaseNotesViewed";
|
|
17
|
-
var KNOWLEDGE_BASE_IFRAME_URL = "https://gp-dev.digitalrealty.com/standalone/knowledge-base";
|
|
18
|
-
var PORTAL_INTERXION = "https://portal.interxion.com";
|
|
19
|
-
var PORTAL_GLOBAL_PORTAL = "https://inxn-a1-gpappshell.azureedge.net";
|
|
20
|
-
var PORTAL_SCALE = "https://portal.digitalrealty.com";
|
|
21
|
-
var PORTAL_SERVICE_FABRIC = "https://demo.servicefabric.digitalrealty.com/";
|
|
22
|
-
var PORTAL_MARKETPLACE_PORTAL = "https://marketplaceportal.com/group/telx-new-portal";
|
|
23
|
-
var APPLICATION_INSIGHTS_CORRELATION_HEADER_EXCLUDED_DOMAINS = "gp-uat.digitalrealty.com";
|
|
24
|
-
var IS_INTRAPORTAL_NAVBAR_ENABLED = false;
|
|
25
|
-
var PREVENT_LOGOUT_ON_TIMEOUT = false;
|
|
26
|
-
var IS_INVENTORY_MANAGEMENT_ENABLED = true;
|
|
27
|
-
var GPV2_COOKIE_POLICY_URL = "/cookie-policy";
|
|
28
|
-
var ENABLE_COOKIE_POLICY = true;
|
|
29
|
-
var ENABLE_QUALTRICS = false;
|
|
30
|
-
var COOKIE_POLICY_VERSION = "1.0";
|
|
31
|
-
var ANALYTICS_EMAIL_BLACKLIST = "*digitalrealty.com,gpportaltests-b@yahoo.com";
|
|
32
|
-
var TRANSLATION_DEBUG = true;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const registeredServiceWorkers = [];
|