@digital-realty/app-shell 13.0.6 → 13.0.7-IXUAT-11023.541050
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bootstrap.js +1 -1
- package/package.json +1 -1
package/dist/bootstrap.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate as C}from"tslib";import{LitElement as S,html as c}from"lit";import{property as A}from"lit/decorators.js";import{ApplicationInsights as X,DistributedTracingModes as Q}from"@microsoft/applicationinsights-web";import{authedUser as w}from"@digital-realty/ix-account-switcher";import{UserManager as Z}from"oidc-client-ts";import"@digital-realty/ix-app-logic/views/splash-screen.js";import{makeObservable as ee,action as te,observable as se,toJS as ne}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:oe,PortalGlobalPortal:re,PortalServiceFabric:ae,PortalMarketplacePortal:ie}=a(),le={strict:"strictly_necessary",performance:"performance",targeting:"targeting"},ce={accept:"accept_all",reject:"reject_all",custom:"customize",no:"no_sell",bypass:"gpc_bypass"},I="globalportalappshell",p="user-authentication",h="redirect-url",pe="ui-cookie-policy",ue="date-format",P="Global Portal",R="Service Fabric",T="Marketplace Portal",b="EMEA Customer Portal",N="x-auth",[u,de,he,ge]=["CREATE","UPDATE","READ","APPROVE"],[y,g,me,_e,v,Ee,ht,fe,O,gt,Ce,Se,L,k,x,mt,Ae,_t,we,U,M,D,Ie,V,Pe,Re,G,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"],be=[we,Ee,Pe,Ie,Re,Ae,_e],Ne=[g,y,v,L,k,x,U,M,D,V],ye=[g,y,v,L,k,x,U,M,D,V],ve={LocationChanged:"location-changed",VaadinRouterLocationChanged:"vaadin-router-location-changed",CreateUserClicked:"create-user-clicked"},j={SessionStorage:{HasOutstandingChanges:"hasOutstandingChanges",ShowLastLoginPopup:"showLastLoginPopup"}},[Oe,Le,ke]=["Security","DCIM","Planned Site Maintenance"],xe=[Oe,Le,ke],Ue=[{label:P,href:re,selected:!0},{label:T,href:ie},{label:b,href:oe},{label:R,href:ae,target:"_blank"}],H={appInsights:"_appInsights"},Me=()=>{const{ApplicationInsightsInstrumentationKey:e,ApplicationInsightsCorrelationHeaderExcludedDomains:t}=a(),n=new X({config:{instrumentationKey:e,enableCorsCorrelation:!0,enableRequestHeaderTracking:!0,enableResponseHeaderTracking:!0,enableAutoRouteTracking:!0,autoTrackPageVisitTime:!0,enableAjaxErrorStatusText:!0,enableAjaxPerfTracking:!0,enableUnhandledPromiseRejectionTracking:!0,isCookieUseDisabled:!0,distributedTracingMode:Q.AI_AND_W3C,correlationHeaderExcludedDomains:t.split(",").map(s=>s.trim())}});return n.loadAppInsights(),n.trackPageView(),n.addTelemetryInitializer(s=>{s.tags["ai.cloud.role"]=I}),n},d=(e,t,n)=>(...s)=>{const[o,...r]=s;typeof o=="string"&&o.startsWith("[mobx]")&&t===4?n.trackException({exception:{message:r[0].message,stack:r[0].stack,name:o},severityLevel:4}):n.trackTrace({severityLevel:t,message:o},r),e.apply(console,[o,...r])},De=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},Ve=()=>{const{ApplicationInsightsInstrumentationKey:e}=a();if(!e)return;const t=Me();window[H.appInsights]=t,window.dispatchEvent(new Event("appInsightsInitialized")),De(t)},B=async e=>{const t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")};function Ge(){const{location:e}=window,t=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`,{LoginAuthority:n,GlobalPortalClientId:s,GlobalPortalUIScopes:o,GlobalPlanBShellPostLogoutRedirectUrl:r}=a();return{authority:n,client_id:s,redirect_uri:`${t}/auth-callback`,response_type:"code",scope:o,post_logout_redirect_uri:r,monitorSession:!1}}const m=new Z(Ge()),je=e=>{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),n=decodeURIComponent(window.atob(t).split("").map(s=>`%${`00${s.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(n)},He=()=>{localStorage.removeItem(p)},i=()=>{const e=localStorage.getItem(p);return e?JSON.parse(e):null},F=()=>{var e;const t=localStorage.getItem(N);return t?(e=JSON.parse(t))==null?void 0:e.email:null},Be=async()=>{const e=i();if(!e)return null;const t=(e.profile.given_name||"")+(e.profile.family_name||"")+e.profile.sub;return await B(t)},$=()=>{const e=i();return e?e.id_token:null},K=(e,t)=>{const n={...t,...e},s=je(e.access_token);return n.profile.sub=s.sub,n.profile.account_number=s.account_number,n.expires_at=s.exp,n.is_federated=s.is_federated,s.previous_login_date&&(n.profile.previous_login_date=s.previous_login_date),w.setAccount({accountNumber:s.account_number,email:s.email,name:s.name,givenName:s.given_name,familyName:s.family_name,authTime:s.exp,accessToken:e.access_token,idToken:e.id_token}),localStorage.setItem(p,JSON.stringify(n)),n},Fe=e=>{K(e,null)},$e=()=>{const e=i();return e?e.access_token:null},Ke=()=>{const e=i();return e&&e.is_federated!==null&&e.is_federated!==void 0?String(e.is_federated).toLowerCase()==="true":!1},ze=()=>{const e=i();return e!=null&&e.expires_at?e.expires_at>Date.now()/1e3:!1},Je=()=>{var e;const t=i();return((e=t==null?void 0:t.profile)==null?void 0:e.previous_login_date)||null},We=["authenticate","auth-callback","logout"],Ye=e=>e.expires_at&&new Date(e.expires_at*1e3),qe=e=>e.expires_at&&new Date(e.expires_at*1e3+a().TokenValidForOfflineUsePostExpiryInHours*60*60*1e3),z=()=>{if(!a().IsLoginEnabled)return!1;const e=i();if(!$())return!0;if(!e.expires_at)return!1;const t=new Date;return navigator.onLine?t>Ye(e):t>qe(e)},Xe=()=>{const e=window.location.pathname.split("/");return We.includes(e[e.length-1])},Qe=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="authenticate"?(a().IsLoginEnabled?m.signinRedirect():window.location.href="/",!0):!1},Ze=()=>{let e="/";const t=localStorage.getItem(h);t&&(localStorage.removeItem(h),e=t),sessionStorage.setItem(j.SessionStorage.ShowLastLoginPopup,"true"),window.location.href=e},et=e=>{if(!e.id_token)throw new Error("Missing property:id_token");return e},_=e=>{const t=Xe();(!t||e)&&(t||localStorage.setItem(h,window.location.href),window.location.href="/authenticate")},tt=async e=>{const t=`${e.profile.sub}-${e.profile.customer_id}`,n=await B(t);return{...e,profile:{...e.profile,hashed_identifier:n}}},st=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="auth-callback"?(m.signinRedirectCallback().then(et).then(tt).then(Fe).then(Ze).catch(_),!0):!1};class nt extends S{render(){return c` <ix-splash-screen></ix-splash-screen> `}}window.customElements.define("splash-screen",nt);class ot{constructor(){this.permissions=[],this.loading=!1,this.getPermissions=async()=>{var t;const n=(t=w)==null?void 0:t.access_token;if(!n)return[];const{ApiBaseUrl:s}=a(),o=await fetch(`${s}/usermanagement/my-permissions?exclude_parents=false&exclude_siblings=true`,{headers:{Authorization:`Bearer ${n}`}});return o.ok?o.json():[]},ee(this,{permissions:se,setPermissions:te})}setPermissions(t){this.permissions=t.reduce((n,s)=>(n[s.permission_name]=s.privilege,n),{})}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(O,u)||this.hasPermission(G,u)}hasConnectivityCreate(){return this.hasPermission(g,u)}hasPrivilegeLevel(t,n){const s=[ge,u,de,he],o=s.findIndex(l=>l===t),r=s.findIndex(l=>l===n);return o>=r}hasPermission(t,n){let s=!1;const o=ne(this.permissions),r=Object.keys(o).find(l=>l===t);return r&&(s=this.hasPrivilegeLevel(n,o[r])),s}}const E=new ot;class f extends S{constructor(){super(),this._currentView="splash",this.appLoaded=!1,this._onPopState=()=>{a().IsLoginEnabled&&z()&&_()};try{Ve()}catch(n){console.error("Telemetry initialization failed:",n)}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(Qe()||st()){this._currentView="splash";return}if(z()){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-DHu3NPe-.js")}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._onPopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this._onPopState)}_getAccountNumber(){var t,n,s;return(s=new URLSearchParams(window.location.search).get("selected_account_number"))!=null?s:(n=(t=i())==null?void 0:t.profile)==null?void 0:n.account_number}_isESGAccessOnly(t,n){const s=t.filter(o=>o.account_number===n);return s.length===1&&s[0].permission_name==="ESG Reporting"}_applyGomFfBypass(t){var n;const s=F();if(!s||!((n=a().SuperusersWhitelist)!=null?n:"").split(",").map(r=>r.trim().toLowerCase()).includes(s.toLowerCase()))return t;const o=window.gpConfig;return o&&(window.gpConfig={...o,"app-shell":o["app-shell"]?{...o["app-shell"],IsInventoryManagementEnabled:!0}:o["app-shell"],"ui-launchpad":o["ui-launchpad"]?{...o["ui-launchpad"],IsInventoryManagementEnabled:!0}:o["ui-launchpad"]}),t["ui-gom"]?{...t,"ui-gom":{...t["ui-gom"],enabled:!0}}:t}_applyMfeOverrides(t,n){const s={};for(const o of Object.keys(t))s[o]={...t[o],enabled:n.includes(o)};return s}async _loadApp(){var t;const{authedUser:n}=await import("@digital-realty/ix-account-switcher");await n.hydrateStore();const[s,o]=await Promise.allSettled([fetch("./registered-apps.json").then(q=>q.json()),E.getPermissions()]);if(s.status==="rejected"){console.error("Failed to load registered apps:",s.reason);return}if(o.status==="rejected"){console.error("Failed to load permissions:",o.reason);return}const{registeredApps:r}=s.value,l=o.value,J=(t=this._getAccountNumber())!=null?t:"",W=this._isESGAccessOnly(l,J)?this._applyMfeOverrides(r,["ui-esg"]):r,Y=this._applyGomFfBypass(W);window.registeredApps=Object.freeze(Y),E.setPermissions(l),await import("./app-V8jsWuSg.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>`}}}C([A({type:String})],f.prototype,"_currentView",void 0),C([A({type:Boolean})],f.prototype,"appLoaded",void 0),window.customElements.define("gp-bootstrap",f);export{ve as A,N as B,me as C,ue as D,Te as E,pe as F,P as G,Ne as I,T as M,ye as O,xe as R,be as S,G as U,$ as a,Be as b,He as c,F as d,$e as e,i as f,a as g,K as h,Je as i,Ke as j,j as k,Se as l,O as m,fe as n,Ce as o,E as p,b as q,Ue as r,R as s,H as t,m as u,I as v,le as w,ze as x,ce as y,p as z};
|
|
1
|
+
import{__decorate as I}from"tslib";import{LitElement as P,html as p}from"lit";import{property as b}from"lit/decorators.js";import{ApplicationInsights as ee,DistributedTracingModes as te}from"@microsoft/applicationinsights-web";import{authedUser as R}from"@digital-realty/ix-account-switcher";import{UserManager as se}from"oidc-client-ts";import"@digital-realty/ix-app-logic/views/splash-screen.js";import{makeObservable as ne,action as oe,observable as ae,toJS as re}from"mobx";function i(){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:ie,PortalGlobalPortal:le,PortalServiceFabric:ce,PortalMarketplacePortal:pe}=i(),ue={strict:"strictly_necessary",performance:"performance",targeting:"targeting"},de={accept:"accept_all",reject:"reject_all",custom:"customize",no:"no_sell",bypass:"gpc_bypass"},T="globalportalappshell",d="user-authentication",E="redirect-url",ge="ui-cookie-policy",he="date-format",y="Global Portal",v="Service Fabric",N="Marketplace Portal",O="EMEA Customer Portal",k="x-auth",[g,me,_e,Ee]=["CREATE","UPDATE","READ","APPROVE"],[L,f,fe,Ce,x,Se,ft,we,U,Ct,Ae,Ie,M,D,V,St,Pe,wt,be,G,j,$,Re,H,Te,ye,B,ve]=["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=[be,Se,Te,Re,ye,Pe,Ce],Oe=[f,L,x,M,D,V,G,j,$,H],ke=[f,L,x,M,D,V,G,j,$,H],Le={LocationChanged:"location-changed",VaadinRouterLocationChanged:"vaadin-router-location-changed",CreateUserClicked:"create-user-clicked"},F={SessionStorage:{HasOutstandingChanges:"hasOutstandingChanges",ShowLastLoginPopup:"showLastLoginPopup"}},[xe,Ue,Me]=["Security","DCIM","Planned Site Maintenance"],De=[xe,Ue,Me],Ve=[{label:y,href:le,selected:!0},{label:N,href:pe},{label:O,href:ie},{label:v,href:ce,target:"_blank"}],z={appInsights:"_appInsights"},Ge=()=>{const{ApplicationInsightsInstrumentationKey:e,ApplicationInsightsCorrelationHeaderExcludedDomains:t}=i(),s=new ee({config:{instrumentationKey:e,enableCorsCorrelation:!0,enableRequestHeaderTracking:!0,enableResponseHeaderTracking:!0,enableAutoRouteTracking:!0,autoTrackPageVisitTime:!0,enableAjaxErrorStatusText:!0,enableAjaxPerfTracking:!0,enableUnhandledPromiseRejectionTracking:!0,isCookieUseDisabled:!0,distributedTracingMode:te.AI_AND_W3C,correlationHeaderExcludedDomains:t.split(",").map(n=>n.trim())}});return s.loadAppInsights(),s.trackPageView(),s.addTelemetryInitializer(n=>{n.tags["ai.cloud.role"]=T}),s},h=(e,t,s)=>(...n)=>{const[o,...a]=n;typeof o=="string"&&o.startsWith("[mobx]")&&t===4?s.trackException({exception:{message:a[0].message,stack:a[0].stack,name:o},severityLevel:4}):s.trackTrace({severityLevel:t,message:o},a),e.apply(console,[o,...a])},je=e=>{console.log=h(console.log,2,e),console.info=h(console.info,2,e),console.warn=h(console.warn,3,e),console.error=h(console.error,4,e),window.console=console},$e=()=>{const{ApplicationInsightsInstrumentationKey:e}=i();if(!e)return;const t=Ge();window[z.appInsights]=t,window.dispatchEvent(new Event("appInsightsInitialized")),je(t)},K=async e=>{const t=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(s)).map(n=>n.toString(16).padStart(2,"0")).join("")};function He(){const{location:e}=window,t=`${e.protocol}//${e.hostname}${e.port?`:${e.port}`:""}`,{LoginAuthority:s,GlobalPortalClientId:n,GlobalPortalUIScopes:o,GlobalPlanBShellPostLogoutRedirectUrl:a}=i();return{authority:s,client_id:n,redirect_uri:`${t}/auth-callback`,response_type:"code",scope:o,post_logout_redirect_uri:a,monitorSession:!1}}const C=new se(He()),Be=e=>{const t=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(window.atob(t).split("").map(n=>`%${`00${n.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(s)},Fe=()=>{localStorage.removeItem(d)},l=()=>{const e=localStorage.getItem(d);return e?JSON.parse(e):null},J=()=>{var e;const t=localStorage.getItem(k);return t?(e=JSON.parse(t))==null?void 0:e.email:null},ze=async()=>{const e=l();if(!e)return null;const t=(e.profile.given_name||"")+(e.profile.family_name||"")+e.profile.sub;return await K(t)},W=()=>{const e=l();return e?e.id_token:null},Y=(e,t)=>{const s={...t,...e},n=Be(e.access_token);return s.profile.sub=n.sub,s.profile.account_number=n.account_number,s.expires_at=n.exp,s.is_federated=n.is_federated,n.previous_login_date&&(s.profile.previous_login_date=n.previous_login_date),R.setAccount({accountNumber:n.account_number,email:n.email,name:n.name,givenName:n.given_name,familyName:n.family_name,authTime:n.exp,accessToken:e.access_token,idToken:e.id_token}),localStorage.setItem(d,JSON.stringify(s)),s},Ke=e=>{Y(e,null)},q=()=>{const e=l();return e?e.access_token:null},Je=()=>{const e=l();return e&&e.is_federated!==null&&e.is_federated!==void 0?String(e.is_federated).toLowerCase()==="true":!1},We=()=>{const e=l();return e!=null&&e.expires_at?e.expires_at>Date.now()/1e3:!1},Ye=()=>{var e;const t=l();return((e=t==null?void 0:t.profile)==null?void 0:e.previous_login_date)||null},qe=["authenticate","auth-callback","logout"],Xe=e=>e.expires_at&&new Date(e.expires_at*1e3),Qe=e=>e.expires_at&&new Date(e.expires_at*1e3+i().TokenValidForOfflineUsePostExpiryInHours*60*60*1e3),X=()=>{if(!i().IsLoginEnabled)return!1;const e=l();if(!W())return!0;if(!e.expires_at)return!1;const t=new Date;return navigator.onLine?t>Xe(e):t>Qe(e)},Ze=()=>{const e=window.location.pathname.split("/");return qe.includes(e[e.length-1])},et=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="authenticate"?(i().IsLoginEnabled?C.signinRedirect():window.location.href="/",!0):!1},tt=()=>{let e="/";const t=localStorage.getItem(E);t&&(localStorage.removeItem(E),e=t),sessionStorage.setItem(F.SessionStorage.ShowLastLoginPopup,"true"),window.location.href=e},st=e=>{if(!e.id_token)throw new Error("Missing property:id_token");return e},S=e=>{const t=Ze();(!t||e)&&(t||localStorage.setItem(E,window.location.href),window.location.href="/authenticate")},nt=async e=>{const t=`${e.profile.sub}-${e.profile.customer_id}`,s=await K(t);return{...e,profile:{...e.profile,hashed_identifier:s}}},ot=()=>{const e=window.location.pathname.split("/");return e[e.length-1]==="auth-callback"?(C.signinRedirectCallback().then(st).then(nt).then(Ke).then(tt).catch(S),!0):!1};class at extends P{render(){return p` <ix-splash-screen></ix-splash-screen> `}}window.customElements.define("splash-screen",at);class rt{constructor(){this.permissions=[],this.loading=!1,this.getPermissions=async()=>{var t;const s=(t=R)==null?void 0:t.access_token;if(!s)return[];const{ApiBaseUrl:n}=i(),o=await fetch(`${n}/usermanagement/my-permissions?exclude_parents=false&exclude_siblings=true`,{headers:{Authorization:`Bearer ${s}`}});return o.ok?o.json():[]},ne(this,{permissions:ae,setPermissions:oe})}setPermissions(t){this.permissions=t.reduce((s,n)=>(s[n.permission_name]=n.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(U,g)||this.hasPermission(B,g)}hasConnectivityCreate(){return this.hasPermission(f,g)}hasPrivilegeLevel(t,s){const n=[Ee,g,me,_e],o=n.findIndex(r=>r===t),a=n.findIndex(r=>r===s);return o>=a}hasPermission(t,s){let n=!1;const o=re(this.permissions),a=Object.keys(o).find(r=>r===t);return a&&(n=this.hasPrivilegeLevel(s,o[a])),n}}const w=new rt,Q=()=>{const e=new Headers;return e.append("Authorization",`Bearer ${q()}`),e},it=async()=>{const{ApiBaseUrl:e}=i(),t=`${e}/inventory/locations?location_type=Site&permission_type=Cross+Connect&permission_privilege=Read&page_size=1000`,s=[];let n=1;for(;;){const a=await fetch(`${t}&cursor=${n}`,{headers:Q()});if(!a.ok)return Promise.reject();const r=await a.json();if(s.push(...r.items),r.self===r.last)break;n++}const o=new Map;for(const a of s)o.has(a.account_number)?o.get(a.account_number).push(a.site_id):o.set(a.account_number,[a.site_id]);return o},lt=async e=>{const{ApiBaseUrl:t}=i(),s=new URLSearchParams;s.append("process","Cross_connect"),e.forEach((o,a)=>{s.append("account_number",a),s.append("site",o.join(","))});const n=await fetch(`${t}/site-navigations/site-configurations?${s}`,{headers:Q()});return n.ok?await n.json():Promise.reject()},ct=async()=>{const e=await it();return(await lt(e)).some(t=>{var s;return t.portal==="GlobalPortal"&&!!((s=e.get(t.account_number))!=null&&s.includes(t.site))})};class A extends P{constructor(){super(),this._currentView="splash",this.appLoaded=!1,this._onPopState=()=>{i().IsLoginEnabled&&X()&&S()};try{$e()}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(et()||ot()){this._currentView="splash";return}if(X()){this._currentView="splash",S();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-DHu3NPe-.js")}connectedCallback(){super.connectedCallback(),window.addEventListener("popstate",this._onPopState)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("popstate",this._onPopState)}_getAccountNumber(){var t,s,n;return(n=new URLSearchParams(window.location.search).get("selected_account_number"))!=null?n:(s=(t=l())==null?void 0:t.profile)==null?void 0:s.account_number}_isESGAccessOnly(t,s){const n=t.filter(o=>o.account_number===s);return n.length===1&&n[0].permission_name==="ESG Reporting"}async _applyGomFF(t){var s,n,o;const a=J(),r=structuredClone(window.gpConfig);if(!a||!r)return t;const m=((s=i().SuperusersWhitelist)!=null?s:"").split(",").map(Z=>Z.trim().toLowerCase()).includes(a.toLowerCase()),_=!!((n=t["ui-gom"])!=null&&n.enabled)&&!!((o=r["ui-launchpad"])!=null&&o.IsInventoryManagementEnabled),u=await ct();let c=!1;return(m&&u||_&&u)&&(c=!0),r["app-shell"].IsInventoryManagementEnabled=c,r["ui-launchpad"].IsInventoryManagementEnabled=c,window.gpConfig=Object.freeze(r),t["ui-gom"]?{...t,"ui-gom":{...t["ui-gom"],enabled:c}}:t}_applyMfeOverrides(t,s){const n={};for(const o of Object.keys(t))n[o]={...t[o],enabled:s.includes(o)};return n}async _loadApp(){var t;const{authedUser:s}=await import("@digital-realty/ix-account-switcher");await s.hydrateStore();const[n,o]=await Promise.allSettled([fetch("./registered-apps.json").then(c=>c.json()),w.getPermissions()]);if(n.status==="rejected"){console.error("Failed to load registered apps:",n.reason);return}if(o.status==="rejected"){console.error("Failed to load permissions:",o.reason);return}const{registeredApps:a}=n.value,r=o.value,m=(t=this._getAccountNumber())!=null?t:"",_=this._isESGAccessOnly(r,m)?this._applyMfeOverrides(a,["ui-esg"]):a,u=await this._applyGomFF(_);window.registeredApps=Object.freeze(u),w.setPermissions(r),await import("./app-V8jsWuSg.js"),this.appLoaded=!0}render(){switch(this._currentView){case"session-expired":return p`<ix-session-expiry></ix-session-expiry>`;case"logout":return p`<ixp-logout></ixp-logout>`;case"app":return this.appLoaded?p`<global-portal-app appTitle="DLR" showDrawer></global-portal-app>`:p`<splash-screen></splash-screen>`;default:return p`<splash-screen></splash-screen>`}}}I([b({type:String})],A.prototype,"_currentView",void 0),I([b({type:Boolean})],A.prototype,"appLoaded",void 0),window.customElements.define("gp-bootstrap",A);export{Le as A,k as B,fe as C,he as D,ve as E,ge as F,y as G,Oe as I,N as M,ke as O,De as R,Ne as S,B as U,W as a,ze as b,Fe as c,J as d,q as e,l as f,i as g,Y as h,Ye as i,Je as j,F as k,Ie as l,U as m,we as n,Ae as o,w as p,O as q,Ve as r,v as s,z as t,C as u,T as v,ue as w,We as x,de as y,d as z};
|