@digital-realty/app-shell 13.0.3 → 13.0.4-IXUAT-10198.536708

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.
@@ -1474,7 +1474,7 @@ video {
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(c)},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 c=++Bi,d=new AbortController;ie.set(c,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<c&&(S.abort(),ie.delete(y));if(ie.delete(c),!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(c),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&&(document.dispatchEvent(new CustomEvent("selected-account",{detail:a,bubbles:!0,composed:!0})),this.selectedAccountNumberRootNode=a.rootId),{...a,subaccounts:this.mapToSwitcherAccounts(o.subAccounts,a)}})}renderEmpty(){return l` <ix-account-switcher class="w-200"></ix-account-switcher> `}render(){return l` <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 l` ${b} `;let e="";return this._notificationsState.unreadNotificationCount>99?e="99+":e=this._notificationsState.unreadNotificationCount.toString(),l` <div class="unread rounded-full text-center text-white text-sm absolute icon-position -start-0"> ${e} </div> `}render(){return l` <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 l` <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?l`<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 l` <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),c=Math.floor(s/60),d=s%60;return d===0?`GMT${r}${c}`:`GMT${r}${c}:${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"),c=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:c,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)}),c=lo(n,e);return`${r} at ${s} ${c}`}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 l` <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:l` <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?l` <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=l` <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()?l` <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()?l` <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()?l` <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=l` <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=l` <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 l` <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:l` <h1 class="dlr-text-page-title grow">${this.pageTitle}</h1> `} <div class="flex gap-4 lg:gap-6 md:justify-end"> ${this.headerRight?l` <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?l`<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:l` <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(c)},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 c=++Bi,d=new AbortController;ie.set(c,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<c&&(S.abort(),ie.delete(y));if(ie.delete(c),!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(c),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&&(document.dispatchEvent(new CustomEvent("selected-account",{detail:a,bubbles:!0,composed:!0})),this.selectedAccountNumberRootNode=a.rootId),{...a,subaccounts:this.mapToSwitcherAccounts(o.subAccounts,a)}})}renderEmpty(){return l` <ix-account-switcher class="w-200"></ix-account-switcher> `}render(){return l` <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 l` ${b} `;let e="";return this._notificationsState.unreadNotificationCount>99?e="99+":e=this._notificationsState.unreadNotificationCount.toString(),l` <div class="unread rounded-full text-center text-white text-sm absolute icon-position -start-0"> ${e} </div> `}render(){return l` <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 l` <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?l`<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 l` <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),c=Math.floor(s/60),d=s%60;return d===0?`GMT${r}${c}`:`GMT${r}${c}:${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"),c=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:c,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)}),c=lo(n,e);return`${r} at ${s} ${c}`}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 l` <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:l` <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?l` <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=l` <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()?l` <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()?l` <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()?l` <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=l` <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=l` <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 l` <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:l` <h1 class="dlr-text-page-title grow">${this.pageTitle}</h1> `} <div class="flex gap-4 lg:gap-6 md:justify-end"> ${this.headerRight?l` <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?l`<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:l` <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-CEMELcLl.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-BYU6fX9E.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,ue as B,_e as C,de as D,Te as E,pe as F,R as G,ve as I,T as M,ye as O,Ue as R,Ne as S,j as U,K as a,$e as b,Be as c,F as d,Ke as e,i as f,a as g,z as h,We as i,ze as j,H as k,Ae as l,L as m,Ce as n,Se as o,f as p,N as q,Me as r,b as s,B as t,m as u,P as v,Je as w,p as x,v as y,ce as 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-CEMELcLl.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-3ukRjcHW.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,ue as B,_e as C,de as D,Te as E,pe as F,R as G,ve as I,T as M,ye as O,Ue as R,Ne as S,j as U,K as a,$e as b,Be as c,F as d,Ke as e,i as f,a as g,z as h,We as i,ze as j,H as k,Ae as l,L as m,Ce as n,Se as o,f as p,N as q,Me as r,b as s,B as t,m as u,P as v,Je as w,p as x,v as y,ce as z};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-realty/app-shell",
3
- "version": "13.0.3",
3
+ "version": "13.0.4-IXUAT-10198.536708",
4
4
  "license": "UNLICENSED",
5
5
  "contributors": [
6
6
  "DLR"