@digital-realty/ui-user-management 16.0.14 → 16.0.15
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/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist/ui-user-management6.js +1 -1
- package/package.json +1 -1
package/dist/sw.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
if(!self.define){let e,n={};const i=(i,r)=>(i=new URL(i+".js",r).href,n[i]||new Promise(n=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=n,document.head.appendChild(e)}else e=i,importScripts(i),n()}).then(()=>{let e=n[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(r,s)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(n[t])return;let u={};const
|
|
1
|
+
if(!self.define){let e,n={};const i=(i,r)=>(i=new URL(i+".js",r).href,n[i]||new Promise(n=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=n,document.head.appendChild(e)}else e=i,importScripts(i),n()}).then(()=>{let e=n[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(r,s)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(n[t])return;let u={};const f=e=>i(e,t),o={module:{uri:t},exports:u,require:f};n[t]=Promise.all(r.map(e=>o[e]||f(e))).then(e=>(s(...e),u))}}define(["./workbox-b865b753"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"d89f572522c250fdce8f56d27a121caf"},{url:"ui-user-management.js",revision:"7d8981e6015b5a852fcdbc808a8f8bab"},{url:"ui-user-management2.js",revision:"5bb6f4d5bf81f289d7330abc60af3ad4"},{url:"ui-user-management3.js",revision:"1d9683a9642d22c08b490058b88b4725"},{url:"ui-user-management4.js",revision:"cf03e1494811bef0a29454be4284c4d4"},{url:"ui-user-management5.js",revision:"7e74f8ac52d6fb6510d61a0e795f1f89"},{url:"ui-user-management6.js",revision:"e1f1303f016a561bf5a114f180ed3ad1"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("/index.html"))),e.registerRoute("polyfills/*.js",new e.CacheFirst,"GET")});
|
|
2
2
|
//# sourceMappingURL=sw.js.map
|
package/dist/sw.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sw.js","sources":["../../../../../../tmp/
|
|
1
|
+
{"version":3,"file":"sw.js","sources":["../../../../../../tmp/fb87e38b8680125945928bf975fba372/sw.js"],"sourcesContent":["import {registerRoute as workbox_routing_registerRoute} from '/home/vsts/work/1/s/ui-user-management/node_modules/.pnpm/workbox-routing@6.6.0/node_modules/workbox-routing/registerRoute.mjs';\nimport {CacheFirst as workbox_strategies_CacheFirst} from '/home/vsts/work/1/s/ui-user-management/node_modules/.pnpm/workbox-strategies@6.6.0/node_modules/workbox-strategies/CacheFirst.mjs';\nimport {clientsClaim as workbox_core_clientsClaim} from '/home/vsts/work/1/s/ui-user-management/node_modules/.pnpm/workbox-core@6.6.0/node_modules/workbox-core/clientsClaim.mjs';\nimport {precacheAndRoute as workbox_precaching_precacheAndRoute} from '/home/vsts/work/1/s/ui-user-management/node_modules/.pnpm/workbox-precaching@6.6.0/node_modules/workbox-precaching/precacheAndRoute.mjs';\nimport {NavigationRoute as workbox_routing_NavigationRoute} from '/home/vsts/work/1/s/ui-user-management/node_modules/.pnpm/workbox-routing@6.6.0/node_modules/workbox-routing/NavigationRoute.mjs';\nimport {createHandlerBoundToURL as workbox_precaching_createHandlerBoundToURL} from '/home/vsts/work/1/s/ui-user-management/node_modules/.pnpm/workbox-precaching@6.6.0/node_modules/workbox-precaching/createHandlerBoundToURL.mjs';/**\n * Welcome to your Workbox-powered service worker!\n *\n * You'll need to register this file in your web app.\n * See https://goo.gl/nhQhGp\n *\n * The rest of the code is auto-generated. Please don't update this file\n * directly; instead, make changes to your Workbox build configuration\n * and re-run your build process.\n * See https://goo.gl/2aRDsh\n */\n\n\n\n\n\n\n\n\nself.skipWaiting();\n\nworkbox_core_clientsClaim();\n\n\n/**\n * The precacheAndRoute() method efficiently caches and responds to\n * requests for URLs in the manifest.\n * See https://goo.gl/S9QRab\n */\nworkbox_precaching_precacheAndRoute([\n {\n \"url\": \"index.html\",\n \"revision\": \"d89f572522c250fdce8f56d27a121caf\"\n },\n {\n \"url\": \"ui-user-management.js\",\n \"revision\": \"7d8981e6015b5a852fcdbc808a8f8bab\"\n },\n {\n \"url\": \"ui-user-management2.js\",\n \"revision\": \"5bb6f4d5bf81f289d7330abc60af3ad4\"\n },\n {\n \"url\": \"ui-user-management3.js\",\n \"revision\": \"1d9683a9642d22c08b490058b88b4725\"\n },\n {\n \"url\": \"ui-user-management4.js\",\n \"revision\": \"cf03e1494811bef0a29454be4284c4d4\"\n },\n {\n \"url\": \"ui-user-management5.js\",\n \"revision\": \"7e74f8ac52d6fb6510d61a0e795f1f89\"\n },\n {\n \"url\": \"ui-user-management6.js\",\n \"revision\": \"e1f1303f016a561bf5a114f180ed3ad1\"\n }\n], {});\n\nworkbox_routing_registerRoute(new workbox_routing_NavigationRoute(workbox_precaching_createHandlerBoundToURL(\"/index.html\")));\n\n\nworkbox_routing_registerRoute(\"polyfills/*.js\", new workbox_strategies_CacheFirst(), 'GET');\n\n\n\n\n"],"names":["self","skipWaiting","workbox_core_clientsClaim","workbox_precaching_precacheAndRoute","url","revision","workbox","registerRoute","workbox_routing_NavigationRoute","workbox_precaching_createHandlerBoundToURL","workbox_strategies_CacheFirst"],"mappings":"inBAwBAA,KAAKC,cAELC,EAAAA,eAQAC,EAAAA,iBAAoC,CAClC,CACEC,IAAO,aACPC,SAAY,oCAEd,CACED,IAAO,wBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,oCAEd,CACED,IAAO,yBACPC,SAAY,qCAEb,CAAE,GAEwBC,EAAAC,cAAC,IAAIC,EAAAA,gBAAgCC,EAAAA,wBAA2C,iBAGhFH,EAAAC,cAAC,iBAAkB,IAAIG,aAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate as i}from"tslib";import{LitElement as H,html as c,nothing as p,css as tt}from"lit";import{property as r,query as C,queryAsync as W,customElement as N,state as d}from"lit/decorators.js";import{MobxLitElement as lt}from"@adobe/lit-mobx";import{reaction as Ae}from"mobx";import{elementTheme as nt,baseTheme as Ft}from"@digital-realty/theme";import{cache as $e}from"lit/directives/cache.js";import{E as vt,U as $t,T as U,A as dt,u as rt,F as we,G as wt,H as Lt,I as Bt,y as Et,x as et,B as Pt,J as ut,K as gt,c as E,L as Vt,M as Ee,N as zt,O as Ht,P as jt,Q as Kt,S as k,V as ot,W as qt,X as Gt,Y as Wt,Z as Yt,_ as Dt,$ as Qt,a0 as Zt,e as Jt,a1 as De,C as Re,a2 as Rt,a3 as Y,a4 as Ct,D as Xt,a5 as Ce,a6 as Ne,a7 as Se,a8 as _e,a9 as Ie,s as Nt,aa as te,ab as Te,ac as ht,ad as ee,p as St,ae as oe,af as Oe,ag as Ue,ah as se,ai as ie,aj as Me,ak as ae,al as ke,am as ne,an as _t,ao as ce,ap as Fe,aq as le,ar as Le,as as Be,at as I,au as Pe,av as Ve,aw as ze,ax as He,ay as je,z as Ke,az as qe,aA as de,aB as Ge,j as re,k as We,l as Ye,a as It,aC as Qe,f as Tt,aD as Ze,aE as ue,aF as Je,v as Xe,n as to,g as he,R as Ot}from"./ui-user-management.js";import"@digital-realty/ix-tabs/ix-tabs.js";import"@digital-realty/ix-tabs/ix-primary-tab.js";import{format as eo}from"date-fns";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-date/ix-date.js";import"@digital-realty/ix-menu/ix-menu.js";import"@digital-realty/ix-menu/ix-menu-item.js";import"@digital-realty/ix-progress/ix-progress.js";import{findChildNodeById as oo,updateNodeCheckedStatus as Ut,isAnyNodeChecked as so,calculateCheckedEndNodesCount as io}from"@digital-realty/ix-generic-tree";import{keyed as pe}from"lit/directives/keyed.js";import"@digital-realty/ix-dialog/ix-dialog.js";import"@digital-realty/ix-select/ix-select.js";import"@digital-realty/ix-select/ix-select-option.js";import"@digital-realty/ix-file-uploader/ix-file-uploader.js";import"@digital-realty/ix-phone-input/ix-phone-input.js";import"@digital-realty/ix-textbox/ix-textbox.js";import"@digital-realty/ix-checkbox/ix-checkbox.js";import"@digital-realty/ix-phone-number/ix-phone-number.js";import"@digital-realty/ix-divider/ix-divider.js";import{computePosition as ao,offset as no,flip as co,shift as lo}from"@floating-ui/dom";import"@digital-realty/ix-icon/ix-icon.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import"@digital-realty/ix-tree/ix-tree.js";import"@digital-realty/ix-multi-select/ix-multi-select.js";import"./ui-user-management5.js";import"toastify-js";import"@microsoft/applicationinsights-web";import"graphql-request";import"oidc-client-ts";import"i18next";import"lit-i18n";import"@vaadin/router";import"libphonenumber-js";import"lit/directives/class-map.js";import"validator";import"lit/directives/ref.js";import"lit/directives/repeat.js";import"@digital-realty/ix-card/ix-card.js";import"lodash.debounce";import"@digital-realty/ix-generic-tree/ix-generic-tree.js";import"@digital-realty/ix-accordion/ix-accordion.js";import"@material/web/icon/icon.js";const ro={ACTIVE:"Active",DRAFT:"Draft",INVITED:"Invited",REMOVED:"Removed",SUSPENDED:"Suspended",DECLINED:"Declined"},me={ACTIVE:"check_circle",DRAFT:"edit",INVITED:"mail",REMOVED:"delete_forever",SUSPENDED:"warning",DECLINED:"do_not_disturb_on"},x={ACTIVE:"ACTIVE",DRAFT:"DRAFT",INVITED:"INVITED",DECLINED:"DECLINED",SUSPENDED:"SUSPENDED",REMOVED:"REMOVED"},Mt={ACTIVE:"#4CAF50",DRAFT:"#1456E0",SUSPENDED:"#DB0028",INVITED:"rgb(255, 152, 0)",REMOVED:"rgb(109, 117, 140)",DECLINED:"rgb(109, 117, 140)"},Q={ROLES:{key:"roles",text:"ROLES AND PORTAL ACCESS"},USERFLAGS:{key:"flags",text:"USER FLAGS"}};class st{}st.USER_DETAILS_NAVIGATION="user-details-navigation",st.USER_DETAILS_TABS="user-details-navigation-tabs",st.TAB=t=>`user-details-navigation-tab-${t}`,st.MODIFICATION_DETAILS="user-details-navigation-modification-details";let j=class extends H{constructor(){super(...arguments),this.disableEscapeKeyBinding=this.disableEscapeKey.bind(this),this.view=Q.ROLES,this.showFlags=!1,this.showRoles=!0,this.showModificationDetails=!1}get viewIndex(){return this.view===Q.ROLES?0:1}connectedCallback(){super.connectedCallback(),this.tabs&&this.tabs.addEventListener("keydown",this.disableEscapeKeyBinding)}disconnectedCallback(){super.disconnectedCallback(),this.tabs&&this.tabs.removeEventListener("keydown",this.disableEscapeKeyBinding)}disableEscapeKey(t){return t.which===27?!1:null}firstUpdated(){this.tabsAsync.then(t=>{t.activeTabIndex=this.viewIndex})}dispatchNavigationEvent(t){this.navigate&&(this.view=t,this.navigate(t))}renderNavigation(t){return c`<ix-primary-tab @click="${()=>this.dispatchNavigationEvent(t)}" .activeDisabled="${t.key===this.view.key}" data-testid="${st.TAB(t.key)}"><span class="font-bold flex items-center uppercase">${t.text}</span> </ix-primary-tab>`}renderTabs(){return!this.showRoles&&!this.showFlags?p:c`<ix-tabs id="navigation-tabs" hideScrollBar left-align data-testid="${st.USER_DETAILS_TABS}"> ${this.renderNavigation(Q.ROLES)} ${this.showFlags?this.renderNavigation(Q.USERFLAGS):p} </ix-tabs>`}dispatchOpenModificationDetails(){this.dispatchEvent(new CustomEvent(dt.OpenModificationDetails,{bubbles:!0,composed:!0}))}renderModificationDetails(){return this.showModificationDetails?c` <ix-button data-testid="${st.MODIFICATION_DETAILS}" appearance="text" @click="${()=>this.dispatchOpenModificationDetails()}" class="primary" aria-label="Modification Details"> Modification Details </ix-button> `:p}render(){return c` <div class="user-detail-navigation-contents" data-testid="${st.USER_DETAILS_NAVIGATION}"> ${this.renderTabs()} ${this.renderModificationDetails()} </div> <div class="user-detail-navigation"></div>`}};j.styles=[vt,$t,U,nt],i([r({type:Object})],j.prototype,"navigate",void 0),i([r({type:Object})],j.prototype,"view",void 0),i([r({type:Boolean})],j.prototype,"showFlags",void 0),i([r({type:Boolean})],j.prototype,"showRoles",void 0),i([r({type:Boolean})],j.prototype,"showModificationDetails",void 0),i([C("#navigation-tabs")],j.prototype,"tabs",void 0),i([W("#navigation-tabs")],j.prototype,"tabsAsync",void 0),j=i([N("user-details-navigation")],j);class K{}K.HEADER="view-modification-details-header",K.ON_BEHALF_OF="view-modification-details-on-behalf-of",K.DOCUMENTS="view-modification-details-documents",K.CLOSE_BUTTON="view-modification-details-close-button",K.DOCUMENT_LINK=t=>`view-modification-details-document-link-${t}`;const uo=tt`.authority-documents{display:flex;flex-wrap:wrap;gap:10px;max-width:560px}.authority-document{background-color:#f5f7ff;width:fit-content;max-width:250px;height:40px;box-sizing:border-box}.authority-document button{display:flex;align-items:center;max-width:100%;min-width:0;height:100%;padding:0 15px;box-sizing:border-box;border:0;background:0 0;font:inherit;color:inherit;cursor:pointer}.authority-document-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.authority-document-extension{flex-shrink:0;white-space:nowrap}.modification-details-label{padding:0 0 8px 0}[slot=content]{padding-top:12px;min-width:min(520px,calc(100vw - 32px))}[slot=content]+[slot=content]{padding-top:24px}#confirmation-header{padding-bottom:12px}`;let Z=class extends H{constructor(){super(...arguments),this.isOpen=!1,this.loading=!1,this.obofMessage="",this.handleEscapeKeyBinding=this.handleEscapeKey.bind(this),this.handleCancelChangesBinding=this.handleCancelChanges.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleEscapeKeyBinding),this.addEventListener("blur",this.handleCancelChangesBinding)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleEscapeKeyBinding),this.removeEventListener("blur",this.handleCancelChangesBinding)}updated(t){super.updated(t),t.has("isOpen")&&this.isOpen&&this.loadObofMessage()}handleEscapeKey(t){return t.which===27&&(this.isOpen=!1),null}handleOpenDialog(){this.isOpen=!0}async loadObofMessage(){this.obofMessage="",this.obofMessage=await this.getObofMessage()}async getObofMessage(){var t,e;const o=(e=(t=this.changeHistory)===null||t===void 0?void 0:t.authoriserDetails)===null||e===void 0?void 0:e.find(s=>{var a;return s.accountNumber===((a=this.account)===null||a===void 0?void 0:a.accountNumber)});switch(o==null?void 0:o.reason){case"REQUESTED_BY_CUSTOMER":{if(!o.authoriserUserId)return"Authorized User";const s=await rt.get({id:o.authoriserUserId,failSilently:!0});return s!=null&&s.firstName&&s!=null&&s.lastName?`${s.firstName} ${s.lastName}`:"Authorized User"}case"NEW_CUSTOMER":return"New Customer";default:return"No User with Proper Permissions Available"}}async handleCancelChanges(){this.isOpen=!1}renderHeader(){return c` <div id="confirmation-header" slot="headline" data-testid="${K.HEADER}"> <h1 class="dlr-text-heading break-words">Modification Details</h1> </div>`}renderOnBehalfOf(){var t,e;const o=!((t=this.changeHistory)===null||t===void 0)&&t.createdAt?eo(new Date(this.changeHistory.createdAt),((e=this.userProfileSettings)===null||e===void 0?void 0:e.preferredDateFormat)||"yyyy/MM/dd"):"";return c`<div slot="content" method="dialog" data-testid="${K.ON_BEHALF_OF}"> <div class="modification-details-label">Modified on behalf of:</div> <div>${this.obofMessage} on ${o}</div> </div>`}async downloadAuthorityDocument(t){const e=await we.download(t.authorityDocumentId);if(!e)return;const o=URL.createObjectURL(e),s=document.createElement("a");s.href=o,s.download=t.fileName,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(o)}getAuthorityDocuments(){var t;const e=(t=this.changeHistory)===null||t===void 0?void 0:t.authorityDocuments;return!e||e.length===0?"":e.map(o=>{var s,a;if(!o.authorityDocumentId)return"";const n=(a=(s=o.fileName)===null||s===void 0?void 0:s.lastIndexOf("."))!==null&&a!==void 0?a:0,l=n>0?o.fileName.substring(0,n):o.fileName,u=n>0?o.fileName.substring(n):"";return c` <li class="authority-document"> <button type="button" @click="${()=>this.downloadAuthorityDocument(o)}" data-testid="${K.DOCUMENT_LINK(o.authorityDocumentId)}"> <span class="authority-document-name">${l}</span> <span class="authority-document-extension">${u}</span> </button> </li>`})}renderDocuments(){return c`<div slot="content" method="dialog" data-testid="${K.DOCUMENTS}"> <div class="modification-details-label">Document(s) of Request</div> <ul class="authority-documents"> ${this.getAuthorityDocuments()} </ul> </div>`}renderFooter(){return c` <div class="add-roles-dialog-actions" slot="actions"> <ix-button form="confirm-updates" appearance="text" text="Close" ?disabled="${this.loading}" @click="${()=>this.handleCancelChanges()}" data-testid="${K.CLOSE_BUTTON}"> Close </ix-button> </div> `}render(){return c` <ix-dialog class="z-50 relative" id="view-modification-details" ?open="${this.isOpen}"> ${this.renderHeader()} ${this.renderOnBehalfOf()} ${this.renderDocuments()} ${this.renderFooter()} </ix-dialog>`}};Z.styles=[uo,U],i([r({type:Object})],Z.prototype,"account",void 0),i([r({type:Object})],Z.prototype,"userProfileSettings",void 0),i([r({type:Object})],Z.prototype,"changeHistory",void 0),i([r({type:Boolean,reflect:!0})],Z.prototype,"isOpen",void 0),i([d()],Z.prototype,"loading",void 0),i([d()],Z.prototype,"obofMessage",void 0),Z=i([N("view-modification-details")],Z);var T;(function(t){t[t.hidden=0]="hidden",t[t.disabled=1]="disabled",t[t.enabled=2]="enabled"})(T||(T={}));const bt={Active:"ACTIVE",Draft:"DRAFT",Invited:"INVITED",Suspended:"SUSPENDED",Removed:"REMOVED",Declined:"DECLINED"},ho=async(t,e,o)=>{const s={contactId:e,accountNumber:t,changeHistoryId:o};return await wt.create({accountAssociationInput:s})},ft=async(t,e,o,s)=>{const a=(await wt.get({accountNumber:t,contactId:e})).find(n=>n.accountNumber===t);if(!(a!=null&&a.id))throw new Error("Account data not found.");return await wt.update({id:a.id,accountAssociationStatusUpdate:{status:o,changeHistoryId:s}})},ve=t=>{const e=Object.keys(x);return t.sort((o,s)=>e.indexOf(o.status)-e.indexOf(s.status))};var pt;(function(t){t.Checked="CHECKED",t.Indeterminate="INDETERMINATE",t.Inherited="INHERITED",t.Unchecked="UNCHECKED"})(pt||(pt={}));const po=async(t,e)=>await Bt.get({contactId:t,accountNumber:e}),mo=async t=>{for(const e of t)Bt.delete({id:e.id})},ge=async(t,e,o,s)=>{const a={accountNumber:e,contactId:t,flagLocations:[],changeHistoryId:s};return o.forEach(n=>{const l={flag:n.key,locations:[]};n.items.forEach(u=>{if(!u.customerKnownSpaceName&&u.label!=="Global")throw new Error("Customer Known Space Name is missing.");l.locations.push({id:u.id,customerKnownName:u.customerKnownSpaceName,permissionStatus:u.checked?pt.Checked:pt.Unchecked})}),a.flagLocations.push(l)}),Lt.saveAccountFlagInventory(a)},be=async(t,e)=>await Et.get({contactId:t,accountNumber:e}),fe=async(t,e)=>{await Promise.all(t.map(o=>Et.delete({id:o.id,changeHistoryId:e})))},ye=async(t,e,o,s)=>{const a={accountNumber:e,contactId:t,roleLocations:[],changeHistoryId:s};return o.forEach(n=>{const l={roleId:n.key,locations:[]};n.items.forEach(u=>{if(!u.customerKnownSpaceName&&u.label!=="Global")throw new Error("Customer Known Space Name is missing.");l.locations.push({id:u.id,customerKnownName:u.customerKnownSpaceName,permissionStatus:u.checked?pt.Checked:pt.Unchecked})}),a.roleLocations.push(l)}),Lt.saveAccountRoleInventory(a)};class xe{constructor(e){(this._host=e).addController(this)}hostConnected(){}hostDisconnected(){}hostUpdate(){}async add(e,o,s=!0,a=void 0){try{const n=await ho(e,o,a);if(n)return a||await ft(e,o,bt.Active,a),s&&et("Account association added.",3e3,"center"),n;throw new Error("Account association could not be created.")}catch(n){return null}}async restore(e,o,s=!0,a=void 0){try{await ft(e,o,bt.Active,a),s&&et("Account association restored.",3e3,"center")}catch(n){throw new Error("Account association could not be restored.")}}async suspend(e,o){try{await ft(e,o,bt.Suspended),et("Account association suspended.",3e3,"center")}catch(s){throw new Error("Account association could not be suspended.")}}async remove(e,o){try{await ft(e,o,bt.Removed);const s=await po(o,e);await mo(s);const a=(await be(o,e)).filter(n=>n.isActive);await fe(a),et("Account association removed.",3e3,"center")}catch(s){throw new Error("Account association could not be removed.")}}}class vo extends Pt{async refresh(){const e=await rt.get({id:this.get().id});e&&this.set(e)}}const O=new vo({});class b{}b.BTN_RESTORE_ACCESS="udc-btn-restore-access",b.BTN_SUSPEND_ACCESS="udc-btn-suspend-access",b.BTN_REMOVE_ACCOUNT="udc-btn-remove-account",b.BTN_RESEND_INVITE="udc-btn-resend-invite",b.BTN_DRAFT_CANCEL="udc-btn-draft-cancel",b.BTN_DRAFT_SAVE="udc-btn-draft-save",b.ACCOUNT_NAME="udc-account-name",b.ACCOUNT_STATUS="udc-account-status",b.BTN_SAVE="udc-btn-save",b.BTN_CANCEL="udc-btn-cancel",b.MODIFICATION_DETAILS="udc-modification-details";let $=class extends lt{constructor(){super(...arguments),this.accountAssociationController=new xe(this),this.roles=[],this.saveControls=T.hidden,this.isLoading=!1,this.readonly=!1,this.showModificationDetails=!1,this.actionsDisabled=!1,this.removeAccountDialogOpen=!1,this.suspendingAccess=!1,this.restoringAccess=!1,this.removingAccount=!1,this.savingChanges=!1,this.cancellingChanges=!1,this.mobileMenuOpen=!1}statusIcon(t){return me[t]}dispatchUpdateEvent(){this.dispatchEvent(new CustomEvent(dt.UpdateChanges,{detail:"no-toast"}))}dispatchReloadAccountEvent(t=!1){var e;this.dispatchEvent(new CustomEvent(dt.ReloadAccount,{detail:{accountNumber:(e=this.account)===null||e===void 0?void 0:e.accountNumber,overrideUnsavedChanges:t}}))}async addAccount(){var t,e,o;this.actionsDisabled=!0,this.savingChanges=!0,!((t=this.contact)===null||t===void 0)&&t.accounts.some(s=>{var a;return s.accountNumber===((a=this.account)===null||a===void 0?void 0:a.accountNumber)&&s.status==="REMOVED"})?await this.accountAssociationController.restore((e=this.account)===null||e===void 0?void 0:e.accountNumber,this.contact.id):await this.accountAssociationController.add((o=this.account)===null||o===void 0?void 0:o.accountNumber,this.contact.id),this.emitRoleUpdates&&await this.emitRoleUpdates(),await O.refresh(),ut.clear(),this.dispatchUpdateEvent(),this.actionsDisabled=!1,this.savingChanges=!1}async restoreAccount(){var t;this.actionsDisabled=!0,this.restoringAccess=!0,await this.accountAssociationController.restore((t=this.account)===null||t===void 0?void 0:t.accountNumber,this.contact.id),await O.refresh(),this.dispatchReloadAccountEvent(!0),this.actionsDisabled=!1,this.restoringAccess=!1}async suspendAccount(){var t;this.actionsDisabled=!0,this.suspendingAccess=!0,await this.accountAssociationController.suspend((t=this.account)===null||t===void 0?void 0:t.accountNumber,this.contact.id),await O.refresh(),this.dispatchReloadAccountEvent(!0),this.actionsDisabled=!1,this.suspendingAccess=!1}async removeAccount(){var t;this.actionsDisabled=!0,this.removingAccount=!0,await this.accountAssociationController.remove((t=this.account)===null||t===void 0?void 0:t.accountNumber,this.contact.id),await O.refresh(),this.actionsDisabled=!1,this.removingAccount=!1,this.removeAccountDialogOpen=!1,this.dispatchReloadAccountEvent()}cancelChanges(){var t,e,o;this.actionsDisabled=!0;const s=`${ut.get().accountNumber}:${(t=this.contact)===null||t===void 0?void 0:t.id}`;if(gt.remove(s),!(!((e=this.contact)===null||e===void 0)&&e.accounts.find(a=>{var n;return a.accountNumber===((n=this.account)===null||n===void 0?void 0:n.accountNumber)}))){const[a]=((o=this.contact)===null||o===void 0?void 0:o.accounts)||[];a&&(this.account=a)}this.dispatchReloadAccountEvent(!0),this.actionsDisabled=!1}openMobileOptions(){this.mobileMenuOpen=!this.mobileMenuOpen}resendInvite(){et("Invitation has been re-sent.",3e3,"center")}renderRemoveAccountButton(){return c`<ix-button appearance="filled" class="cancel" ?disabled="${this.actionsDisabled}" @click="${()=>{this.removeAccountDialogOpen=!0}}" id="remove-account-button" data-testid="${b.BTN_REMOVE_ACCOUNT}"><span class="remove-account">Remove Account</span></ix-button>`}renderRestoreSuspendRemove(){var t,e,o;return this.isLoading?p:this.saveControls?p:this.readonly?p:((t=this.account)===null||t===void 0?void 0:t.status)===x.SUSPENDED?c`<ix-button @click="${this.restoreAccount}" ?disabled="${this.actionsDisabled&&!this.restoringAccess}" ?submitting="${this.restoringAccess}" id="restore-account-button" class="mr-1" data-testid="${b.BTN_RESTORE_ACCESS}"> <span class="font-bold">Restore Access</span> </ix-button> ${this.renderRemoveAccountButton()}`:((e=this.account)===null||e===void 0?void 0:e.status)===x.ACTIVE?c`<ix-button id="suspend-button" class="suspend-button cancel" appearance="outlined" ?disabled="${this.actionsDisabled&&!this.suspendingAccess}" ?submitting="${this.suspendingAccess}" @click="${this.suspendAccount}" data-testid="${b.BTN_SUSPEND_ACCESS}"> Suspend Access </ix-button> ${this.renderRemoveAccountButton()}`:((o=this.account)===null||o===void 0?void 0:o.status)===x.INVITED?c` ${this.renderRemoveAccountButton()}`:p}renderRestoreSuspendRemoveMobile(){var t,e,o,s,a;return this.isLoading?p:this.saveControls?p:E.isProfileOfLoggedInUser((t=this.contact)===null||t===void 0?void 0:t.email)?p:!E.hasExternalUserUpdate((e=this.account)===null||e===void 0?void 0:e.accountNumber)&&!E.hasExternalUserCreate((o=this.account)===null||o===void 0?void 0:o.accountNumber)?p:((s=this.account)===null||s===void 0?void 0:s.status)===x.SUSPENDED?c`<ix-menu-item @click="${this.restoreAccount}"><span class="font-bold">Restore Access</span> </ix-menu-item> <ix-menu-item @click="${()=>{this.removeAccountDialogOpen=!0}}"><span class="font-bold">Remove Account</span> </ix-menu-item>`:((a=this.account)===null||a===void 0?void 0:a.status)===x.ACTIVE?c`<ix-menu-item @click="${this.suspendAccount}"><span class="font-bold">Suspend Access</span> </ix-menu-item> <ix-menu-item @click="${()=>{this.removeAccountDialogOpen=!0}}"><span class="font-bold">Remove Account</span> </ix-menu-item>`:p}renderResendInviteButton(){var t;return((t=this.account)===null||t===void 0?void 0:t.status)!==x.INVITED||this.isLoading?p:c`<ix-button appearance="filled" @click="${()=>this.resendInvite()}" id="resend-invite-button" data-testid="${b.BTN_RESEND_INVITE}"><span class="font-bold">Resend <br>Invite</span> </ix-button>`}renderButtons(){return this.isLoading||this.saveControls===T.hidden?p:c`<div id="draft-assignment-controls" class="panel-button-container"> <ix-button appearance="outlined" ?disabled="${this.actionsDisabled}" ?submitting="${this.cancellingChanges}" @click="${()=>this.cancelChanges()}" id="cancel-role-button" data-testid="${b.BTN_CANCEL}"> Cancel </ix-button> <ix-button id="save-role-button" ?disabled="${this.saveControls===T.disabled||this.actionsDisabled}" ?submitting="${this.savingChanges}" @click="${this.dispatchUpdateEvent}" data-testid="${b.BTN_SAVE}"> Save </ix-button> </div>`}renderDraftButtons(){return this.isLoading?p:c`<div id="draft-association-controls" class="panel-button-container"> <ix-button id="cancel-role-button" appearance="outlined" ?disabled="${this.actionsDisabled}" @click="${this.cancelChanges}" data-testid="${b.BTN_DRAFT_CANCEL}"> Cancel </ix-button> <ix-button appearance="filled" id="save-role-button" ?disabled="${(this.actionsDisabled||this.saveControls===T.disabled||this.saveControls===T.hidden)&&!this.savingChanges}" ?submitting="${this.actionsDisabled}" @click="${this.addAccount}" data-testid="${b.BTN_DRAFT_SAVE}"> Save </ix-button> </div>`}renderStatus(){var t,e;if(!this.account||this.isLoading)return p;const o=this.account.status;return o===x.REMOVED?c`<div class="panel-status"> <p class="dlr-text-small" data-testid="${b.ACCOUNT_STATUS}">Account Removed</p> <ix-icon filled>${this.statusIcon(o)}</ix-icon> </div>`:o===x.DECLINED?c`<div class="panel-status"> <p class="dlr-text-small" data-testid="${b.ACCOUNT_STATUS}"> Account Invitation Declined By User </p> <ix-icon filled>${this.statusIcon(o)}</ix-icon> </div>`:o===x.SUSPENDED?c`<div class="panel-status"> <p class="dlr-text-small account-status-suspend" data-testid="${b.ACCOUNT_STATUS}"> Suspended on <ix-date type="static" value="${(t=this.account)===null||t===void 0?void 0:t.statusUpdateAt}"></ix-date> </p> <ix-icon filled class="warning text-2xl">${this.statusIcon(o)}</ix-icon> </div>`:this.account.status===x.INVITED?c`<div class="panel-status"> <p class="dlr-text-small" data-testid="${b.ACCOUNT_STATUS}"> Invited on <ix-date type="static" value="${(e=this.account)===null||e===void 0?void 0:e.statusUpdateAt}"></ix-date> </p> <ix-icon filled style="${`color: ${Mt[o]}`}">${this.statusIcon(o)}</ix-icon> </div>`:this.account.status===x.DRAFT?c`<div class="panel-status"> <p class="dlr-text-small" data-testid="${b.ACCOUNT_STATUS}">Draft</p> <ix-icon class="text-2xl" filled style="${`color: ${Mt[o]}`}">${this.statusIcon(o)}</ix-icon> </div>`:c`<div class="panel-status"> <ix-icon style="color:#4caf50" filled class="mt-1 text-2xl">${this.statusIcon(o)}</ix-icon> <p class="dlr-text-small" data-testid="${b.ACCOUNT_STATUS}">Active</p> </div>`}renderRemoveAccountConfirmation(){return c`<changes-confirmation id="remove-account-dialog" data-testid="remove-account-dialog" class="z-50 relative" ?isOpen="${this.removeAccountDialogOpen}" ?submitting="${this.removingAccount}" .headerText="${"The user will no longer be able to access this account."}" .confirmationButtonText="${"Remove Account"}" @confirm="${()=>{this.removeAccount()}}" @cancel="${()=>{this.removeAccountDialogOpen=!1}}"> </changes-confirmation>`}dispatchOpenModificationDetails(){this.dispatchEvent(new CustomEvent(dt.OpenModificationDetails,{bubbles:!0,composed:!0}))}renderModificationDetails(){return this.showModificationDetails?c` <ix-button data-testid="${b.MODIFICATION_DETAILS}" appearance="text" @click="${()=>this.dispatchOpenModificationDetails()}" class="primary" aria-label="Modification Details"> Modification Details </ix-button> `:p}render(){var t;return this.account?c`<div> <div class="flex items-center p-4 pb-0 lg:p-2 justify-between user-status"> <div class="flex items-center user-status-header"> <h1 class="dlr-text-heading lg:pl-4" data-testid="${b.ACCOUNT_NAME}"> ${(t=this.account.displayName)!==null&&t!==void 0?t:this.account.name} </h1> <span style="position:relative"> <ix-icon id="anchor" filled class="cursor-pointer mobile-options" @click="${this.openMobileOptions}">more_vert</ix-icon> <ix-menu anchor="anchor" ?open="${this.mobileMenuOpen}"> ${this.renderRestoreSuspendRemoveMobile()} </ix-menu> </span> </div> <div class="user-details-controls flex items-center pr-4"> ${this.renderStatus()} ${this.renderResendInviteButton()} ${this.renderRestoreSuspendRemove()} ${this.account.status===x.DRAFT?this.renderDraftButtons():this.renderButtons()} ${this.renderRemoveAccountConfirmation()} </div> </div> <div class="flex items-center pr-4">${this.renderModificationDetails()}</div> </div>`:p}};$.styles=[vt,$t,U,nt],i([r()],$.prototype,"account",void 0),i([r()],$.prototype,"contact",void 0),i([r()],$.prototype,"roles",void 0),i([r()],$.prototype,"saveControls",void 0),i([r()],$.prototype,"isLoading",void 0),i([r({type:Boolean})],$.prototype,"readonly",void 0),i([r({type:Boolean})],$.prototype,"showModificationDetails",void 0),i([d()],$.prototype,"actionsDisabled",void 0),i([d()],$.prototype,"removeAccountDialogOpen",void 0),i([d()],$.prototype,"suspendingAccess",void 0),i([d()],$.prototype,"restoringAccess",void 0),i([d()],$.prototype,"removingAccount",void 0),i([d()],$.prototype,"savingChanges",void 0),i([d()],$.prototype,"cancellingChanges",void 0),i([d()],$.prototype,"mobileMenuOpen",void 0),i([r()],$.prototype,"emitRoleUpdates",void 0),$=i([N("user-details-controls")],$);const go=tt`@font-face{font-family:'Material Icons';font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/materialicons/v145/flUhRq6tzZclQEJ-Vdg-IuiaDsNZ.ttf) format('truetype')}.material-icons{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr}ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.removed-account-container{padding:1.5rem;display:flex;flex-direction:column;gap:24px}.removed-account-row{display:flex;flex-direction:column;overflow-wrap:anywhere}.removed-account-title{margin:0;text-transform:uppercase;color:rgba(9,34,65,.7)}.removed-account-text{margin:0;color:#092241}`;let q=class extends H{constructor(){super(...arguments),this.roles=[],this.userRoleAssignments=[]}get dateText(){return this.status==="DECLINED"?"Account Invitation Declined By User On":"Account Removed On"}renderRoles(){var t;return this.roles&&((t=this.role)===null||t===void 0?void 0:t.length)===1?c`${this.roles[0].name}`:this.userRoleAssignments.map(e=>c`${e.name}<br>`)}update(t){(t.has("contactID")||t.has("accountNumber"))&&this.getRoleAssignments(),super.update(t)}async getRoleAssignments(){if(!this.contactID)return;const t=await Et.get({contactId:this.contactID,accountNumber:this.accountNumber}),e=new Set(t.map(o=>o.roleId));this.userRoleAssignments=this.roles.filter(o=>e.has(o.id))}render(){return c`<div class="removed-account-container"> <div class="removed-account-row"> <span class="removed-account-title">${this.dateText}</span> <p class="removed-account-text"> <ix-date type="static" value="${this.changedAt}"></ix-date> </p> </div> ${this.status==="REMOVED"?c`<div class="removed-account-row"> <span class="removed-account-title">Account Removed by</span> <p class="removed-account-text">${this.changedBy}</p> </div>`:p} <div class="removed-account-row"> <span class="removed-account-title">Roles</span> <p class="removed-account-text">${this.renderRoles()}</p> </div> </div>`}};q.styles=[go],i([r({type:String})],q.prototype,"status",void 0),i([r({type:String})],q.prototype,"accountNumber",void 0),i([r({type:String})],q.prototype,"contactID",void 0),i([r({type:Array,attribute:!1})],q.prototype,"roles",void 0),i([r({type:String,attribute:!1})],q.prototype,"changedBy",void 0),i([r({type:String,attribute:!1})],q.prototype,"changedAt",void 0),i([d()],q.prototype,"userRoleAssignments",void 0),q=i([N("user-account-removed-declined")],q);class bo extends Pt{getAsRoles(){return Vt(this.get())}removeRole(e){const o=this.get().filter(s=>s.roleId!==e);this.set(o)}}const P=new bo([]);class it{}it.DIALOG_ADD_ROLE="user-details-panel-dialog-add-role",it.DIALOG_REMOVE_ROLE="user-details-panel-dialog-remove-role",it.DIALOG_MODIFICATION_DETAILS="user-details-panel-dialog-modification-details",it.PROGRESS_BAR="user-details-panel-progress-bar";let S=class extends H{constructor(){super(...arguments),this.isOpen=!1,this.obofEnabled=!1,this.accountId="",this.attachments=[],this.obofCreators=[],this._loading=!1,this._selectedObofValue="",this._selectedObofDisplayText="",this._obofCreators=[],this._accountHasUsers=!1,this._showDocumentUpload=!1,this._uploaderInstanceKey=0,this._attachmentManager=Ee()}async connectedCallback(){super.connectedCallback(),this._attachmentManager.setDocumentsRequired(!0),this.obofEnabled&&this.accountId&&await this.loadObofCreators()}async updated(t){super.updated(t),t.has("isOpen")&&this.isOpen&&(this._uploaderInstanceKey+=1,this._attachmentManager.clearAll(),this.syncSelectedObofStateFromProperty()),t.has("selectedObof")&&this.isOpen&&this.syncSelectedObofStateFromProperty(),t.has("accountId")&&this.accountId&&(this.syncSelectedObofStateFromProperty(),this.obofEnabled&&await this.loadObofCreators())}syncSelectedObofStateFromProperty(){var t,e,o;this._selectedObofValue=(e=(t=this.selectedObof)===null||t===void 0?void 0:t.value)!==null&&e!==void 0?e:"",this._selectedObofDisplayText=((o=this.selectedObof)===null||o===void 0?void 0:o.displayText)||"",this.syncDocumentUploadRequirement()}syncDocumentUploadRequirement(){this._showDocumentUpload=!0,this._attachmentManager.setDocumentsRequired(!0)}async loadObofCreators(){this._loading=!0;try{const t=await zt(this.accountId,Ht);if(this._obofCreators=t.filter(e=>e.accountPermissionGroup===jt.OnBehalfUserUpdater),this._obofCreators.length===0){const e=await rt.search({accountNumber:this.accountId,page:0,size:1});this._accountHasUsers=e&&e.recordCount>0}else this._accountHasUsers=!0}catch(t){this._obofCreators=[],this._accountHasUsers=!1}finally{this._loading=!1,(this._selectedObofValue==="loading"||this._selectedObofDisplayText==="Loading users...")&&(this._selectedObofValue="",this._selectedObofDisplayText=""),this.syncDocumentUploadRequirement()}}onFileRemoved(t){if(!(t!=null&&t.detail))return;const e=t.detail.allFiles||[];this._attachmentManager.clearAll(),this._attachmentManager.addFiles(e),this.attachments=[...this._attachmentManager.attachments],this.dispatchAttachmentsUpdateEvent(this.attachments),this.requestUpdate()}onUploaded(t){const{filesUploaded:e}=t.detail,o=e.map(s=>s.file);this._attachmentManager.addFiles(o),o.some(s=>this._attachmentManager.getFileErrors(s.name).length>0)&&(this._uploaderInstanceKey+=1),this.attachments=[...this._attachmentManager.attachments],this.dispatchAttachmentsUpdateEvent(this.attachments),this.requestUpdate()}handleObofSelect(t,e){if(this._selectedObofValue=t,this._selectedObofDisplayText=e,this.syncDocumentUploadRequirement(),!t){this.dispatchObofSelectionEvent("","");return}this.dispatchObofSelectionEvent(t,e)}handleCancel(){this.dispatchEvent(new CustomEvent("cancel-modification",{bubbles:!0,composed:!0}))}handleOk(){if(!this._selectedObofValue||!this._attachmentManager.canProceed){this.requestUpdate();return}this.dispatchEvent(new CustomEvent("confirm-modification",{detail:{obofValue:this._selectedObofValue,obofDisplayText:this._selectedObofDisplayText,attachments:this.attachments},bubbles:!0,composed:!0}))}dispatchAttachmentsUpdateEvent(t){this.dispatchEvent(new CustomEvent("update-attachments",{detail:{attachments:t},bubbles:!0,composed:!0}))}dispatchObofSelectionEvent(t,e){this.dispatchEvent(new CustomEvent("update-obof-selection",{detail:{value:t,displayText:e},bubbles:!0,composed:!0}))}renderObofDropdown(){const t=Kt(this._loading,this._obofCreators.length,this._accountHasUsers);let e="";this._loading?e="Loading users...":this._selectedObofValue&&this._selectedObofDisplayText&&(e=this._selectedObofDisplayText);let o;return t==="loading"?o=c` <ix-select-option value="loading" display-text="Loading users..." disabled="disabled"> Loading users... </ix-select-option> `:t==="selectable"?o=c` ${this._obofCreators.map(s=>{const a=s.id;if(!a)return p;const n=`${s.firstName} ${s.lastName} (${s.email})`;return c` <ix-select-option value="${a}" display-text="${n}" ?selected="${this._selectedObofValue===a}" @click="${()=>this.handleObofSelect(a,n)}"> ${n} </ix-select-option> `})} `:t==="no-user"?o=c` <ix-select-option value="${k.NoUserAvailable}" display-text="${ot.noUserAvailable}" ?selected="${this._selectedObofValue===k.NoUserAvailable}" @click="${()=>this.handleObofSelect(k.NoUserAvailable,ot.noUserAvailable)}"> ${ot.noUserAvailable} </ix-select-option> `:o=c` <ix-select-option value="${k.NewCustomer}" display-text="${ot.newCustomer}" ?selected="${this._selectedObofValue===k.NewCustomer}" @click="${()=>this.handleObofSelect(k.NewCustomer,ot.newCustomer)}"> ${ot.newCustomer} </ix-select-option> `,c` <div style="margin-bottom:20px"> <label for="modification-obof-select" class="text-sm font-medium" style="display:block;margin-bottom:8px"> Modification on behalf of </label> <ix-select quick menu-below class="w-full" id="modification-obof-select" menu-positioning="fixed" label="${this._loading?"Loading users...":"Created on Behalf of*"}" .displayText="${e}" ?disabled="${this._loading}"> ${o} </ix-select> </div> `}renderDocumentUpload(){const t=qt(),e=Gt(),o=e.map(a=>a.toUpperCase()).join(", "),s=`Max file size is ${t} MB with accepted file formats of ${o}`;return c` <div> <label class="text-sm font-medium" style="display:block;margin-bottom:8px"> Document(s) of Request* </label> ${pe(this._uploaderInstanceKey,c` <ix-file-uploader .allowDeleteDefaultFiles="${!0}" .allowMultipleFiles="${!0}" .defaultFiles="${this.attachments}" .extensions="${e}" .maxFileSizeValue="${t}" .headerText="${"CLICK HERE TO BROWSE YOUR DEVICE OR DROP FILES TO UPLOAD"}" .bodyText="${s}" .hideBody="${!1}" .validateFile="${Wt}" @on-file-removed="${this.onFileRemoved}" @on-files-uploaded="${this.onUploaded}"></ix-file-uploader> `)} </div> `}render(){return c` <ix-dialog class="z-50 relative" id="modification-authority-modal" ?open="${this.isOpen}" @closed="${this.handleCancel}"> <div slot="headline"> <h1 class="dlr-text-heading">Modification Details</h1> </div> <div slot="content" style="padding:24px;width:min(600px,90vw);min-height:290px;box-sizing:border-box"> ${this.renderObofDropdown()} ${this._showDocumentUpload?this.renderDocumentUpload():p} </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.handleCancel}" ?disabled="${this._loading}"> CANCEL </ix-button> <ix-button appearance="text" @click="${this.handleOk}" ?disabled="${this._loading||!this._selectedObofValue||this._showDocumentUpload&&!this._attachmentManager.canProceed}"> OK </ix-button> </div> </ix-dialog> `}};S.styles=[vt,U,nt],i([r({type:Boolean})],S.prototype,"isOpen",void 0),i([r({type:Boolean})],S.prototype,"obofEnabled",void 0),i([r({type:String})],S.prototype,"accountId",void 0),i([r({type:Array})],S.prototype,"attachments",void 0),i([r({type:Object})],S.prototype,"selectedObof",void 0),i([r({type:Array})],S.prototype,"obofCreators",void 0),i([d()],S.prototype,"_loading",void 0),i([d()],S.prototype,"_selectedObofValue",void 0),i([d()],S.prototype,"_selectedObofDisplayText",void 0),i([d()],S.prototype,"_obofCreators",void 0),i([d()],S.prototype,"_accountHasUsers",void 0),i([d()],S.prototype,"_showDocumentUpload",void 0),i([d()],S.prototype,"_uploaderInstanceKey",void 0),S=i([N("modification-authority-modal")],S);let g=class extends lt{constructor(){super(...arguments),this.onSuccess=et,this.roles=[],this.userFlagTrees=[],this.assignedRoleTrees=[],this.readonly=!1,this.isPanelLoading=!1,this.roleAssignments=[],this.viewRoute=Q.ROLES,this.saveControls=T.hidden,this.flagUpdates=[],this.roleUpdates=[],this.removedRoleAssignments=[],this.activeRoleId="",this.permissionData=[],this.removeRoleDialogOpen=!1,this.modificationModalOpen=!1,this.modificationModalAttachments=[],this.redundantStatuses=["DECLINED","REMOVED"],this.emitRoleUpdates=async()=>{const t=await this.userDetailsAssignments;t&&t.emitUpdates()},this.saveAssignments=async t=>{var e;const o=this.roleUpdates.length>0||this.flagUpdates.length>0||this.removedRoleAssignments.length>0;if(this.obofEnabled&&o&&!((e=this.account)===null||e===void 0)&&e.accountNumber){this.modificationModalOpen=!0,this.modificationModalAttachments=[],this.modificationModalSelectedObof=void 0;return}await this.performSave(t)},this.handleModificationModalCancel=()=>{this.modificationModalOpen=!1,this.modificationModalAttachments=[],this.modificationModalSelectedObof=void 0},this.handleModificationModalConfirm=async t=>{var e;try{const{obofValue:o,obofDisplayText:s,attachments:a}=t.detail,n=a.length?await Yt(a):[],l=new Map([[this.account.accountNumber,new Dt(o,s||((e=this.modificationModalSelectedObof)===null||e===void 0?void 0:e.displayText)||"")]]),u=Qt(l);if(!(u!=null&&u.length))throw new Error("Failed to determine authoriser details for change history.");const v=await Zt({authoriserDetails:u,authorityDocuments:n.length?n:void 0});if(!(v!=null&&v.changeHistoryId))throw new Error("Failed to create change history.");this.modificationModalOpen=!1,this.modificationModalAttachments=[],this.modificationModalSelectedObof=void 0,await this.performSave(void 0,v.changeHistoryId)}catch(o){const s=o instanceof Error?o.message:"Failed to process modification request";Jt(s,3e3,"center")}},this.performSave=async(t,e)=>{var o,s,a;const n=`${(o=this.account)===null||o===void 0?void 0:o.accountNumber}:${(s=this.contact)===null||s===void 0?void 0:s.id}`,l=gt.capture(n);if(!this.flagUpdates.length&&l){gt.lock(n);for(const B of this.userFlagTrees)B.updateService=new De,l.forEach(X=>{var xt;const At=oo(B.rootNode,X.id);At&&(At.checked=!0,Ut(At,B.rootNode),(xt=B.updateService)===null||xt===void 0||xt.update(B.rootNode))}),B.updateService.updates.length&&this.flagUpdates.push({key:B.label,items:B.updateService.updates})}const u=await this.controlsComponent;if(u.actionsDisabled=!0,u.savingChanges=!0,!(this.roleUpdates.length>0||this.flagUpdates.length>0||this.removedRoleAssignments.length>0)){u.actionsDisabled=!1,u.savingChanges=!1;return}const v={role:void 0,flag:void 0},h=this.removedRoleAssignments.length>0;let m=!1;if(this.roleUpdates.length&&(v.role=await ye(this.contact.id,this.account.accountNumber,this.roleUpdates,e),P.clear(),this.roleUpdates=[]),this.flagUpdates.length&&(v.flag=await ge(this.contact.id,this.account.accountNumber,this.flagUpdates,e),v.flag&>.remove(n),this.flagUpdates=[]),this.removedRoleAssignments.length)try{await fe(this.removedRoleAssignments,e),this.removedRoleAssignments=[]}catch(B){m=!0}this.dispatchReloadAccountEvent((a=this.account)===null||a===void 0?void 0:a.accountNumber,!0),u.actionsDisabled=!1,u.savingChanges=!1,this.isPanelLoading=!1;const A=(t==null?void 0:t.detail)==="no-toast",R=!!v.flag||!!v.role||h&&!m,w=[];v.role===null&&w.push("role"),v.flag===null&&w.push("flag"),m&&w.push("role removal"),R&&!A&&et("Changes saved.",3e3,"center"),w.length>0&&Jt(`Could not save ${w.join(", ")} assignments.`,3e3,"center")},this.dispatchOpenConfirmation=()=>{this.removeRoleDialogOpen=!0},this.dispatchReloadAccountEvent=async(t,e=!1)=>{this.resetForm(),this.dispatchEvent(new CustomEvent(dt.ReloadAccount,{detail:{accountNumber:t,overrideUnsavedChanges:e}}))}}updated(t){super.updated(t),window.sessionStorage.setItem(Re.SessionStorage.HasOutstandingChanges,this.isDirty?"true":"false"),t.has("account")&&(this.viewRoute=Q.ROLES)}get fullName(){var t,e;return`${(t=this.contact)===null||t===void 0?void 0:t.firstName} ${(e=this.contact)===null||e===void 0?void 0:e.lastName}`}get obofEnabled(){var t;return Rt()&&!Y((t=this.contact)===null||t===void 0?void 0:t.email)}get canAddRoles(){return!this.readonly&&this.addableRoles.length>0}get canRemoveRoles(){var t;return!this.readonly&&((t=this.assignedRoles)===null||t===void 0?void 0:t.length)}get addRolesDisabled(){var t,e,o,s,a;if(!(!((t=this.account)===null||t===void 0)&&t.accountNumber))return!0;const n=Ct(this.account.accountNumber,this.roles,Y((e=this.contact)===null||e===void 0?void 0:e.email)&&E.hasAssignInternalRoleCreate((o=this.account)===null||o===void 0?void 0:o.accountNumber)).length;return((a=(s=this.assignedRoles)===null||s===void 0?void 0:s.length)!==null&&a!==void 0?a:0)>=n}get addableRoles(){return this.roles.filter(t=>{var e;return!(!((e=this.assignedRoles)===null||e===void 0)&&e.find(o=>o.id===t.id))})}get isDirty(){return this.roleUpdates.length>0||this.flagUpdates.length>0||P.get().length||this.removedRoleAssignments.length>0}get showUserFlags(){var t,e;return E.hasExternalUserRead((t=this.account)===null||t===void 0?void 0:t.accountNumber)&&((e=this.account)===null||e===void 0?void 0:e.status)!=="REMOVED"}get showRoles(){var t;return((t=this.account)===null||t===void 0?void 0:t.status)!=="REMOVED"}get showModificationDetails(){var t;return this.changeHistory&&E.hasUserRead((t=this.account)===null||t===void 0?void 0:t.accountNumber)}async firstUpdated(){this.account&&this.loadAccount()}async loadAccount(){const t=await this.userDetailsAssignments;t==null||t.assignmentUpdateManagers.forEach(e=>e.nodeManager.reset()),this.roleUpdates=[],this.flagUpdates=[],this.removedRoleAssignments=[],this.isPanelLoading=!0,await this.getAssignedRoles(),this.isPanelLoading=!1,this.displayDefaultRole(),this.setShowControls(),await this.loadUserProfileSettings(),await this.loadChangeHistory()}async loadUserProfileSettings(){this.userProfileSettings=await E.getUserProfileSettings()}async loadChangeHistory(){var t,e,o;if(!(!((t=this.contact)===null||t===void 0)&&t.id)||!(!((e=this.account)===null||e===void 0)&&e.accountNumber)||!Xt().EnableUMChangeHistory)return;const s=await Ce(this.contact.id,{accountNumber:this.account.accountNumber});this.changeHistory=(o=s.content)===null||o===void 0?void 0:o[0]}async getAssignedRoles(){this.roleAssignments=(await be(this.contact.id,this.account.accountNumber)).filter(t=>t.isActive),this.assignedRoles=[...Vt(this.roleAssignments),...P.getAsRoles()],await this.getRoleAndFlagTrees()}async getRoleAndFlagTrees(){var t,e,o;if(!(!((t=this.assignedRoles)===null||t===void 0)&&t.length))return;const s=this.assignedRoles.map(l=>l.id),[a,n]=await Ne(s,this.contact.id,this.account.accountNumber,Y((e=this.contact)===null||e===void 0?void 0:e.email));this.assignedRoleTrees=(o=structuredClone(a))===null||o===void 0?void 0:o.filter(l=>l!==void 0),this.userFlagTrees=structuredClone(n)}displayDefaultRole(){var t;!((t=this.assignedRoles)===null||t===void 0)&&t.length&&(this.activeRoleId=this.assignedRoles[0].id,this.selectRole(this.activeRoleId))}async selectRoleEventHandler(t){this.selectRole(t.detail.roleId)}async selectRole(t){this.activeRoleId=t;const e=await this.roleTabComponent;e==null||e.setActiveRole(this.activeRoleId),this.setShowControls()}setShowControls(){var t;if(this.isPanelLoading||((t=this.account)===null||t===void 0?void 0:t.status)===x.REMOVED){this.saveControls=T.hidden;return}const e=this.assignedRoleTrees.filter(o=>o!==void 0).every(o=>so(o.rootNode));P.get().length?this.saveControls=this.isDirty&&e?T.enabled:T.disabled:this.saveControls=this.isDirty?e?T.enabled:T.disabled:T.hidden}async addRole(t){const e=await this.addRoleDialog;e&&(e.isOpen=!1),this.isPanelLoading=!0;const o={roleId:t,contactId:this.contact.id,accountNumber:this.account.accountNumber,isActive:!0};P.set([...P.get(),o]);const s=Se(o.roleId);if(!s||!this.assignedRoles)return;this.assignedRoles=[...this.assignedRoles,s];const[a]=await _e([t],this.contact.id,this.account.accountNumber,Y(this.contact.email));this.assignedRoleTrees.push(a);const n=await this.addRoleDialog;n&&(n.isOpen=!1),this.isPanelLoading=!1,this.selectRole(s.id)}async removeRole(t){var e;const o=await this.userDetailsAssignments,s=this.assignedRoles.find(n=>n.id===t);if(!s)return;if(P.getAsRoles().findIndex(n=>n.id===s.id)>-1){P.removeRole(t);const n=o==null?void 0:o.assignmentUpdateManagers.find(l=>{var u;return l.accountId===((u=this.account)===null||u===void 0?void 0:u.accountNumber)});n&&n.nodeManager.nodeUpdates.find(l=>l.key===t)&&n.nodeManager.remove(t),this.assignedRoles=this.assignedRoles.filter(l=>l.id!==s.id),this.assignedRoleTrees=(e=this.assignedRoleTrees)===null||e===void 0?void 0:e.filter(l=>l!==void 0).filter(l=>l.role!==s.id)}else{const n=this.roleAssignments.filter(l=>l.roleId===t&&l.isActive);this.removedRoleAssignments=[...this.removedRoleAssignments,...n.filter(l=>!this.removedRoleAssignments.some(u=>u.id===l.id))],this.roleAssignments=this.roleAssignments.filter(l=>!(l.roleId===t&&l.isActive)),this.assignedRoles=this.assignedRoles.filter(l=>l.id!==s.id)}this.roleUpdates=this.roleUpdates.filter(n=>n.key!==t),this.assignedRoleTrees=this.assignedRoleTrees.filter(n=>!!n&&n.role!==s.id);const a=await this.roleTabComponent;a==null||a.requestUpdate("assignedRoles",[]),this.displayDefaultRole(),this.setShowControls()}resetForm(){this.displayDefaultRole(),this.roleUpdates=[],this.flagUpdates=[],this.removedRoleAssignments=[],ut.clear(),P.clear(),this.setShowControls()}updateView(t){this.viewRoute=t,t===Q.ROLES&&this.selectRole(this.activeRoleId)}async openAddRoleDialog(){const t=await this.addRoleDialog;t&&t.handleOpenDialog()}async openModificationDetailsDialog(){const t=await this.modificationDetailsDialog;t&&t.handleOpenDialog()}removeRoleButtonStatus(){var t,e;const o=P.get().map(a=>a.roleId),s=(e=((t=this.assignedRoles)!==null&&t!==void 0?t:[]).filter(a=>!o.includes(a.id)))!==null&&e!==void 0?e:[];return o.find(a=>a===this.activeRoleId)!=null?!1:s.length<2}renderPermissions(){var t,e;return!(!((t=this.assignedRoles)===null||t===void 0)&&t.length)||this.redundantStatuses.includes((e=this.account)===null||e===void 0?void 0:e.status)?p:c` <user-details-permission .activeRoleId="${this.activeRoleId}"> </user-details-permission> `}renderRemovedOrDeclinedAccount(){var t;return this.account?c` <user-account-removed-declined .status="${this.account.status}" .roles="${this.roles}" .accountNumber="${this.account.accountNumber}" .contactID="${(t=this.contact)===null||t===void 0?void 0:t.id}" .changedBy="${this.account.statusUpdateBy}" .changedAt="${this.account.statusUpdateAt}"></user-account-removed-declined> `:p}renderRoles(){return!this.account||!this.contact||!this.assignedRoles?p:this.redundantStatuses.includes(this.account.status)?p:c` <user-details-tab-roles id="role-data-element" .assignedRoles="${this.assignedRoles}" .activeRoleId="${this.activeRoleId}" .canRemoveRoles="${this.canRemoveRoles}" .canAddRoles="${this.canAddRoles}" .removeRolesDisabled="${this.removeRoleButtonStatus()}" .addRolesDisabled="${this.addRolesDisabled}" @role-select="${t=>this.selectRoleEventHandler(t)}" @open-role-menu="${()=>this.openAddRoleDialog()}" @open-remove-role-menu="${()=>this.dispatchOpenConfirmation()}"> </user-details-tab-roles> `}renderLoading(){return this.isPanelLoading?c`<ix-progress aria-label="User details panel" .indeterminate="${!0}" data-testid="${it.PROGRESS_BAR}"> </ix-progress>`:p}renderTree(){var t,e,o;if(!(!((t=this.assignedRoles)===null||t===void 0)&&t.length))return p;let s;if(this.activeRoleId)s=this.assignedRoleTrees.filter(n=>n!==void 0).find(n=>n.role===this.activeRoleId);else{const[n]=this.assignedRoleTrees;s=n}const a=n=>{this.roleUpdates=n.detail.message.updates,this.setShowControls()};return s&&s.rootNode&&!this.redundantStatuses.includes((e=this.account)===null||e===void 0?void 0:e.status)?c`<user-details-assignments .assignment="${s}" .contact="${this.contact}" .accountNumber="${(o=this.account)===null||o===void 0?void 0:o.accountNumber}" .readonly="${this.readonly}" .activeRoleId="${this.activeRoleId}" @check-toggle="${a}"></user-details-assignments>`:p}renderFlags(){const t=e=>{this.flagUpdates=structuredClone(e.detail.message.updates),this.setShowControls()};return!this.account||!this.userFlagTrees?p:c`<user-flags .flags="${this.userFlagTrees}" searchEnabled showCheckboxes .disableCheckboxes="${this.readonly}" .contact="${this.contact}" @check-toggle="${t}"></user-flags>`}renderControls(){var t;return c`<user-details-controls .roles="${this.roles}" .account="${this.account}" .contact="${O.get()}" .saveControls="${this.saveControls}" .readonly="${this.readonly}" .emitRoleUpdates="${this.emitRoleUpdates}" ?isPanelLoading="${this.isPanelLoading}" ?showModificationDetails="${this.showModificationDetails&&this.redundantStatuses.includes((t=this.account)===null||t===void 0?void 0:t.status)}" @reset-changes="${()=>this.resetForm()}" @update-changes="${this.saveAssignments}" @reload-account="${e=>this.dispatchReloadAccountEvent(e.detail.accountNumber,e.detail.overrideUnsavedChanges)}" @open-modification-details="${()=>this.openModificationDetailsDialog()}"> </user-details-controls>`}renderRemoveRoleConfirmation(){return c`<changes-confirmation id="data-loss-dialog" class="z-50 relative" .headerText="${"Are you sure you want to remove this role?"}" .bodyText="${"The user will no longer be able to perform the permissions of this role for this account."}" .confirmationButtonText="${"Remove Role"}" ?isOpen="${this.removeRoleDialogOpen}" @confirm="${()=>{this.removeRole(this.activeRoleId),this.removeRoleDialogOpen=!1}}" @cancel="${()=>{this.removeRoleDialogOpen=!1}}" data-testid="${it.DIALOG_REMOVE_ROLE}"> </changes-confirmation>`}renderAddAccountRoleConfirmation(){return this.assignedRoles?c`<add-account-role id="add-role-dialog" .contact="${this.contact}" .account="${this.account}" .roles="${this.roles}" .assignedRoles="${this.assignedRoles}" ?loading="${this.isPanelLoading}" @add-role="${t=>this.addRole(t.detail.roleId)}" data-testid="${it.DIALOG_ADD_ROLE}"> </add-account-role>`:p}renderViewModificationDetails(){return c`<view-modification-details id="modification-details-dialog" .account="${this.account}" .userProfileSettings="${this.userProfileSettings}" .changeHistory="${this.changeHistory}" ?loading="${this.isPanelLoading}" data-testid="${it.DIALOG_MODIFICATION_DETAILS}"> </view-modification-details>`}renderRoleView(){return c`<div id="roles-view"> <div>${this.renderRoles()}</div> <div class="grid grid-cols-1 xl:grid-cols-2 h-full p-4"> <div class="grow h-full">${this.renderPermissions()}</div> <div class="tree-view grow h-full lg:overflow-auto pl-2">${this.renderTree()}</div> </div> </div>`}renderFlagsView(){return this.showUserFlags===!1?p:c`<div id="flags-view"> <div class="grid grid-cols-1 xl:grid-cols-1 h-full"> <div class="grow h-full mt-6 px-4">${this.renderFlags()}</div> <div class="grow h-full mt-2 flag-text"> Learn more about user flags <a id="flag-text-link" href="#">here.</a> </div> </div> </div>`}renderNavigation(){var t;return this.isPanelLoading||this.redundantStatuses.includes((t=this.account)===null||t===void 0?void 0:t.status)?p:c`<div class="user-details-navigation"> <user-details-navigation .view="${this.viewRoute}" ?showFlags="${this.showUserFlags}" ?showRoles="${this.showRoles}" ?showModificationDetails="${this.showModificationDetails}" .navigate="${e=>this.updateView(e)}" @open-modification-details="${()=>this.openModificationDetailsDialog()}"></user-details-navigation> </div>`}renderView(){var t;let e=p;return this.showRoles&&this.viewRoute===Q.ROLES&&(e=this.renderRoleView()),this.showUserFlags&&this.viewRoute===Q.USERFLAGS&&(e=this.renderFlagsView()),this.redundantStatuses.includes((t=this.account)===null||t===void 0?void 0:t.status)&&(e=this.renderRemovedOrDeclinedAccount()),e}render(){var t;return c` <div class="user-details-panel"> ${this.renderControls()} ${this.renderNavigation()} ${$e(this.isPanelLoading?this.renderLoading():this.renderView())} </div> ${this.renderAddAccountRoleConfirmation()} ${this.renderRemoveRoleConfirmation()} ${this.renderViewModificationDetails()} <modification-authority-modal ?isOpen="${this.modificationModalOpen}" .obofEnabled="${this.obofEnabled}" .accountId="${((t=this.account)===null||t===void 0?void 0:t.accountNumber)||""}" .attachments="${this.modificationModalAttachments}" .selectedObof="${this.modificationModalSelectedObof}" @cancel-modification="${this.handleModificationModalCancel}" @confirm-modification="${this.handleModificationModalConfirm}" @update-attachments="${e=>{this.modificationModalAttachments=e.detail.attachments}}" @update-obof-selection="${e=>{this.modificationModalSelectedObof=e.detail}}"></modification-authority-modal> `}};g.styles=[vt,$t,U,nt],i([r({type:Object,attribute:!1})],g.prototype,"account",void 0),i([r({type:Object,attribute:!1})],g.prototype,"changeHistory",void 0),i([r({type:Object,attribute:!1})],g.prototype,"contact",void 0),i([r({type:Array,attribute:!1})],g.prototype,"assignedRoles",void 0),i([r({type:Array,attribute:!1})],g.prototype,"roles",void 0),i([r({type:Array,attribute:!1})],g.prototype,"userFlagTrees",void 0),i([r({type:Array,attribute:!1})],g.prototype,"assignedRoleTrees",void 0),i([r({type:Object,attribute:!1})],g.prototype,"userProfileSettings",void 0),i([r({type:Boolean})],g.prototype,"readonly",void 0),i([d()],g.prototype,"isPanelLoading",void 0),i([d()],g.prototype,"roleAssignments",void 0),i([d()],g.prototype,"viewRoute",void 0),i([d()],g.prototype,"saveControls",void 0),i([d()],g.prototype,"flagUpdates",void 0),i([d()],g.prototype,"roleUpdates",void 0),i([d()],g.prototype,"removedRoleAssignments",void 0),i([d()],g.prototype,"activeRoleId",void 0),i([d()],g.prototype,"permissionData",void 0),i([d()],g.prototype,"removeRoleDialogOpen",void 0),i([d()],g.prototype,"modificationModalOpen",void 0),i([d()],g.prototype,"modificationModalAttachments",void 0),i([d()],g.prototype,"modificationModalSelectedObof",void 0),i([W("#role-data-element")],g.prototype,"roleTabComponent",void 0),i([W("user-details-controls")],g.prototype,"controlsComponent",void 0),i([W("#add-role-dialog")],g.prototype,"addRoleDialog",void 0),i([W("#modification-details-dialog")],g.prototype,"modificationDetailsDialog",void 0),i([W("user-details-assignments")],g.prototype,"userDetailsAssignments",void 0),i([W("user-flags")],g.prototype,"userFlags",void 0),i([W("modification-authority-modal")],g.prototype,"modificationModal",void 0),g=i([N("user-details-panel")],g);class at{}at.FIRST_NAME="user-details-view-first-name",at.LAST_NAME="user-details-view-last-name",at.EMAIL="user-details-view-email",at.PHONE="user-details-view-phone";let M=class extends lt{constructor(){super(...arguments),this.allowSave=!0,this.isEditProfileDialogOpen=!1}firstUpdated(){this.allowSave=!1}shouldUpdate(){return!!this.contact}willUpdate(t){t.has("contact")&&this.handleDialogReset()}handleDialogClose(){this.isEditProfileDialogOpen=!1,this.handleDialogReset()}handleDialogOpen(){this.isEditProfileDialogOpen=!0,this.validateDialogFields()}handleDialogReset(){Nt(this.firstName,this.contact.firstName),Nt(this.lastName,this.contact.lastName),Nt(this.email,this.contact.email),te(this.phoneNumber,this.contact.phone),Te(this.evacAssistance,this.contact.evacAssistance),this.allowSave=!0}validateDialogFields(){ht(this.firstName,this.firstName.value,"Invalid first name"),ht(this.lastName,this.lastName.value,"Invalid last name"),ht(this.email,this.email.value,"Invalid email"),ee(this.phoneNumber,this.phoneNumber.value)}dispatchUpdateUserEvent(){var t,e,o,s,a;const n={...this.contact};n.firstName=(t=St(this.firstName))!==null&&t!==void 0?t:this.firstName.value,n.lastName=(e=St(this.lastName))!==null&&e!==void 0?e:this.lastName.value,n.email=(o=St(this.email))!==null&&o!==void 0?o:this.email.value,n.phone=(s=oe(this.phoneNumber))!==null&&s!==void 0?s:this.phoneNumber.value,n.evacAssistance=(a=Oe(this.evacAssistance))!==null&&a!==void 0?a:this.evacAssistance.checked,O.set({...n});try{this.saveChanges(n),et("Changes saved.",3e3,"center")}catch(l){if(l.statusCode==="400"){Ue([this.firstName,this.lastName,this.email],l.errors),this.phoneNumber.error=!0;const u=l.errors.find(v=>v.field===this.phoneNumber.id);u&&(this.phoneNumber.errorText=u.error)}}finally{this.isEditProfileDialogOpen=!1}}renderEditForm(){var t,e,o,s,a,n,l,u;return c`<ix-dialog class="dialog z-50 relative" id="edit-profile-dialog" ?open="${this.isEditProfileDialogOpen}" @close="${()=>this.handleDialogClose()}"> <div class="dlr-text-heading" slot="headline">Edit Profile</div> <form class="dialog-form min-w-0 max-w-full max-[640px]:w-screen" slot="content" id="edit-profile-id" method="dialog"> <div class="user-profile-name-input-group grid grid-cols-1 sm:grid-cols-2"> <div class="user-profile-input"> <ix-textbox required="true" id="first-name" class="textbox" type="text" pattern="${se.name}" maxLength="50" label="First Name" placeholder="i.e. First Name" value="${(e=(t=this.contact)===null||t===void 0?void 0:t.firstName)!==null&&e!==void 0?e:""}" @input="${()=>{this.allowSave=ht(this.firstName,this.firstName.value,"Invalid first name")}}"></ix-textbox> </div> <div class="user-profile-input"> <ix-textbox required="true" id="last-name" class="textbox" type="text" pattern="${se.name}" maxLength="50" label="Last Name" placeholder="i.e. Last Name" value="${(s=(o=this.contact)===null||o===void 0?void 0:o.lastName)!==null&&s!==void 0?s:""}" @input="${()=>{this.allowSave=ht(this.lastName,this.lastName.value,"Invalid last name")}}"></ix-textbox> </div> </div> <div class="user-profile-input"> <ix-phone-input required id="phone-number" class="single-row-textbox" label="Phone Number" value="${(n=ie((a=this.contact)===null||a===void 0?void 0:a.phone))!==null&&n!==void 0?n:""}" @input="${()=>{te(this.phoneNumber,ie(oe(this.phoneNumber))),this.allowSave=ee(this.phoneNumber,"Invalid phone number")}}"></ix-phone-input> </div> <div class="user-profile-input"> <ix-textbox required="true" id="email" class="single-row-textbox" type="email" label="Email Address" value="${(u=(l=this.contact)===null||l===void 0?void 0:l.email)!==null&&u!==void 0?u:""}" @input="${()=>{this.allowSave=ht(this.email,this.email.value,"Invalid email")}}"></ix-textbox> </div> </form> <div class="dialog-actions" slot="actions"> <ix-button form="edit-profile-id" appearance="text" text="Cancel" @click="${()=>this.handleDialogClose()}"> Cancel </ix-button> <ix-button id="save-user-button" appearance="text" text="Save Changes" .disabled="${!this.allowSave}" @click="${()=>{this.dispatchUpdateUserEvent()}}"> Save Changes </ix-button> </div> </ix-dialog>`}renderButton(){return E.hasExternalUserUpdate(this.selectedAccountNumber)&&!E.isProfileOfLoggedInUser(this.contact.email)?c`<ix-button id="open-user-button" appearance="text" has-icon @click="${()=>this.handleDialogOpen()}"> <md-icon class="edit-icon" slot="icon">edit</md-icon> Edit Profile </ix-button>`:p}render(){var t,e,o,s;return c` <div class="user-details-card"> <div class="user-details-header"> <h1 class="dlr-text-heading">User Details</h1> </div> <div> <div class="user-details-body grid md:grid-cols-2 gap-x-8 gap-y-4 pb-[1.5rem]"> <div class="first-name-container"> <p class="dlr-text-caption-alt text-on-surface-variant">FIRST NAME</p> <div class="first-name" data-testid="${at.FIRST_NAME}"> ${(t=this.contact)===null||t===void 0?void 0:t.firstName} </div> </div> <div class="last-name-container"> <p class="dlr-text-caption-alt text-on-surface-variant">LAST NAME</p> <div class="last-name" data-testid="${at.LAST_NAME}"> ${(e=this.contact)===null||e===void 0?void 0:e.lastName} </div> </div> <div class="email-container"> <p class="dlr-text-caption-alt text-on-surface-variant">EMAIL ADDRESS</p> <div class="email" data-testid="${at.EMAIL}">${(o=this.contact)===null||o===void 0?void 0:o.email}</div> </div> <div class="phone-number-container"> <p class="dlr-text-caption-alt text-on-surface-variant">PHONE NUMBER</p> <ix-phone-number .number="${(s=this.contact)===null||s===void 0?void 0:s.phone}" data-testid="${at.PHONE}"></ix-phone-number> </div> </div> </div> </div> ${this.renderEditForm()} `}};M.styles=[Ie,U],i([r({type:String})],M.prototype,"selectedAccountNumber",void 0),i([r({type:Object})],M.prototype,"contact",void 0),i([r({type:Object})],M.prototype,"saveChanges",void 0),i([d()],M.prototype,"allowSave",void 0),i([d()],M.prototype,"isEditProfileDialogOpen",void 0),i([C("#first-name")],M.prototype,"firstName",void 0),i([C("#last-name")],M.prototype,"lastName",void 0),i([C("#email")],M.prototype,"email",void 0),i([C("#phone-number")],M.prototype,"phoneNumber",void 0),i([C("#evac-assistance")],M.prototype,"evacAssistance",void 0),M=i([N("user-details-view")],M);const fo=tt`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}:host{display:flex;align-items:center;width:100%}.account-rhs-section{display:flex;align-items:center}.check_circle{color:#4caf50}.mail{color:#ff9800}.warning{color:#db0028}.delete_forever{color:#6d758c}.account-name{background:0 0;border:0;padding:0;margin:0;font:inherit;color:inherit;cursor:pointer;display:flex;justify-content:space-between;align-items:center;width:100%;text-align:left}.account-name-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}`,yo=tt`.account-name:focus-visible{outline:2px solid var(--md-sys-color-primary,#1456e0);outline-offset:2px;border-radius:2px}.account-name-tooltip{position:fixed;top:0;left:0;z-index:1300;min-width:200px;max-width:480px;width:max-content;padding:6px 10px;border-radius:4px;background-color:#071454;color:#fff;font-size:.75rem;line-height:1rem;white-space:normal;overflow-wrap:anywhere;word-break:break-word;pointer-events:none;box-shadow:0 2px 6px rgba(0,0,0,.2)}.account-name-tooltip[hidden]{display:none!important}`;class ct{}ct.STATUS=t=>`dr-account-status-${t!=null?t:""}`,ct.ICON=t=>`dr-account-icon-${t!=null?t:""}`,ct.NAME=t=>`dr-account-name-${t!=null?t:""}`,ct.EVENT_DISPATCH_EL=t=>`dr-account-event-el-${t!=null?t:""}`;const xo=300;let G=class extends H{constructor(){super(...arguments),this.active=!1,this.isSelected=!1,this.tooltipVisible=!1,this.showTooltip=()=>{this.clearTooltipTimer(),this.tooltipShowTimer=setTimeout(()=>{this.tooltipVisible=!0,this.updateComplete.then(()=>this.positionTooltip())},xo)},this.hideTooltip=()=>{this.clearTooltipTimer(),this.tooltipVisible=!1},this.handleTooltipKeyDown=t=>{t.key==="Escape"&&this.tooltipVisible&&(t.stopPropagation(),this.hideTooltip())}}get statusText(){return ro[this.status]}get statusIcon(){return me[this.status]}get accountDisplayName(){var t,e,o,s;return(s=(e=(t=this.account)===null||t===void 0?void 0:t.displayName)!==null&&e!==void 0?e:(o=this.account)===null||o===void 0?void 0:o.name)!==null&&s!==void 0?s:""}dispatchChangeAccountEvent(){var t;this.dispatchEvent(new CustomEvent("account-click",{detail:{accountNumber:(t=this.account)===null||t===void 0?void 0:t.accountNumber}}))}disconnectedCallback(){super.disconnectedCallback(),this.clearTooltipTimer()}clearTooltipTimer(){this.tooltipShowTimer&&(clearTimeout(this.tooltipShowTimer),this.tooltipShowTimer=void 0)}positionTooltip(){!this.isConnected||!this.accountNameEl||!this.tooltipEl||ao(this.accountNameEl,this.tooltipEl,{strategy:"fixed",placement:"top",middleware:[no(8),co(),lo({padding:8})]}).then(({x:t,y:e})=>{!this.isConnected||!this.tooltipVisible||!this.tooltipEl||(this.tooltipEl.style.left=`${t}px`,this.tooltipEl.style.top=`${e}px`)}).catch(()=>{})}render(){var t,e,o;return c` <button type="button" class="${`account-name ${this.active||this.isSelected?"font-bold":""}`}" aria-label="${this.accountDisplayName}, Status: ${this.statusText}" aria-current="${this.active?"true":p}" data-testid="${ct.NAME((t=this.account)===null||t===void 0?void 0:t.accountNumber)}" @click="${()=>this.dispatchChangeAccountEvent()}" @mouseenter="${this.showTooltip}" @mouseleave="${this.hideTooltip}" @focus="${this.showTooltip}" @blur="${this.hideTooltip}" @keydown="${this.handleTooltipKeyDown}"> <span class="${`account-name-text ml-4 dlr-text-small ${this.active||this.isSelected?"font-bold":""}`}" aria-hidden="true">${this.accountDisplayName}</span> <div class="flex items-center mr-4" aria-hidden="true"> <div class="account-rhs-section"> <p class="dlr-text-small" data-testid="${ct.STATUS((e=this.account)===null||e===void 0?void 0:e.accountNumber)}"> ${this.statusText} </p> </div> <ix-icon filled class="mt-1 ml-2 text-2xl" data-testid="${ct.ICON((o=this.account)===null||o===void 0?void 0:o.accountNumber)}" style="${`color: ${Mt[this.status]}`}">${this.statusIcon}</ix-icon> </div> </button> <div class="account-name-tooltip" aria-hidden="true" ?hidden="${!this.tooltipVisible}"> ${this.accountDisplayName} </div> `}};G.styles=[fo,U,yo],i([r({type:Object})],G.prototype,"account",void 0),i([r({type:Boolean,reflect:!0})],G.prototype,"active",void 0),i([r({type:String})],G.prototype,"status",void 0),i([r({type:Boolean})],G.prototype,"isSelected",void 0),i([d()],G.prototype,"tooltipVisible",void 0),i([C(".account-name-tooltip")],G.prototype,"tooltipEl",void 0),i([C(".account-name-text")],G.prototype,"accountNameEl",void 0),G=i([N("dr-account")],G);const Ao=tt`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.accounts-card{display:flex;flex-direction:column;width:100%;background:0 0;border-radius:20px}.accounts-card-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.divider{width:100%;display:flex;align-items:center;min-height:40px}.option{display:block;width:100%}.accounts-list{padding-left:0;list-style-type:none;margin:0}.accounts-list li{display:flex;align-items:center;width:100%;height:24px;padding-top:20px;padding-bottom:20px;margin-bottom:8px;color:#092241;border-radius:0 30px 30px 0;cursor:pointer;gap:1rem}.accounts-list li:last-child{margin-bottom:0}.accounts-list li:focus-within,.accounts-list li:has(dr-account[active]),.accounts-list li:hover{background-color:rgba(20,86,224,.1)}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (max-width:600px){.accounts-card-header{margin-bottom:1.5rem}.dialog-form{min-width:initial}}`;class f{}f.ACCOUNTS_LIST="acc-card-accounts-list",f.ACCOUNT=t=>`acc-card-account-${t!=null?t:""}`,f.ACCOUNT_OPTION=t=>`acc-card-account-option-${t!=null?t:""}`,f.ACCOUNT_DIVIDER="acc-card-account-divider",f.ROLE_OPTION=t=>`acc-card-role-option-${t.replace(/ /g,"_")}`,f.BTN_ADD_ACCOUNT="acc-card-btn-add-account",f.ACCOUNT_DIALOG="acc-card-add-account-dialog",f.ACCOUNT_DIALOG_HEADER="acc-card-add-account-header",f.ACCOUNT_DIALOG_SELECT="acc-card-add-account-select",f.ACCOUNT_DIALOG_CANCEL="acc-card-add-account-cancel",f.ACCOUNT_DIALOG_CONFIRM="acc-card-add-account-confirm",f.ROLE_DIALOG="acc-card-add-role-dialog",f.ROLE_DIALOG_HEADER="acc-card-add-role-header",f.ROLE_DIALOG_SELECT="acc-card-add-role-select",f.ROLE_DIALOG_CANCEL="acc-card-add-role-cancel",f.ROLE_DIALOG_CONFIRM="acc-card-add-role-confirm",f.CARD_HEADER="acc-card-header",f.CARD_BODY="acc-card-body",f.ACCOUNT_DIALOG_ACCOUNT_TREE="acc-card-add-account-tree";const yt=tt`.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}`,kt=t=>t.id||`${t.name}-${t.size}-${t.lastModified}`;let _=class extends H{constructor(){super(...arguments),this.obofEnabled=!1,this.accountStructure="flat",this.attachments=[],this._nextButtonEnabled=!1,this._validationMessage="Select at least one account to proceed",this._obofCreatorsByAccount=new Map,this._accountHierarchyHasUsers=new Map,this._loadingObofForAccounts=new Set,this._uploaderInstanceKey=0,this._isDocumentUploadVisible=!1,this.handleNextButtonKeydown=t=>{if(!this._nextButtonEnabled)return;const e=t.target;(e.getAttribute("data-testid")==="step-two-next-button"||e.closest('[data-testid="step-two-next-button"]'))&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),t.stopPropagation(),this.dispatchNextStepEvent())}}async connectedCallback(){super.connectedCallback(),this._accountTree=this.accountTree,this.obofSelections||(this.obofSelections=new Map),await this.syncObofState(),this._isDocumentUploadVisible=this.shouldRenderDocumentUpload(),this.validateStep(),this.updateValidationMessage(),this.dispatchValidateStepEvent()}async updated(t){super.updated(t),t.has("accountTree")&&this.accountTree!==this._accountTree&&(this._accountTree=this.accountTree,await this.syncObofState(),this.handleDocumentUploadVisibilityTransition(),this.validateStep(),this.dispatchValidateStepEvent(),this.dispatchNextButtonToggleEvent()),t.has("attachments")&&(this.validateStep(this.getDedupedAttachments()),this.dispatchValidateStepEvent(),this.dispatchNextButtonToggleEvent(),this.requestUpdate())}getSelectedAccountNodes(){return this._accountTree?ae(this._accountTree.children||[],this.accountStructure):[]}getSelectedAccountIds(){return this.getSelectedAccountNodes().map(t=>t.id||t.label)}getAllCheckedAccountIds(t){const e=[];for(const o of t){if(o.checked){const s=o.id||o.label;s&&e.push(s)}o.children&&o.children.length>0&&e.push(...this.getAllCheckedAccountIds(o.children))}return e}async syncObofState(){if(!this.obofEnabled||!this._accountTree)return;const t=this.getSelectedAccountIds();t.length&&await this.loadObofCreatorsForAccounts(t)}getDedupedAttachments(t=this.attachments){const e=new Map;return t.forEach(o=>{e.set(kt(o),o)}),[...e.values()]}areAttachmentsValid(t){return t.length===0||ke(t,ne()).isValid}shouldRenderDocumentUpload(t=this.getSelectedAccountIds()){return _t(this.obofEnabled,t.length>0,this.obofSelections,t)}handleDocumentUploadVisibilityTransition(){const t=this.shouldRenderDocumentUpload();this._isDocumentUploadVisible&&!t&&this.getDedupedAttachments().length>0&&(this.attachments=[],this._uploaderInstanceKey+=1,this.dispatchAttachmentsUpdateEvent([])),this._isDocumentUploadVisible=t}getAncestorAccountIds(t){const e=[t],o=(a,n)=>{if(!a.children)return null;for(const l of a.children){if((l.id||l.label)===n)return a;const u=o(l,n);if(u)return u}return null};if(!this._accountTree)return e;let s=t;for(;s;){const a=o(this._accountTree,s);if(!a||a.id==="root")break;const n=a.id||a.label;if(n&&n!=="root")e.push(n),s=n;else break}return e}async loadObofCreatorsForAccounts(t){if(!this.obofEnabled)return;const e=t.filter(h=>!this._obofCreatorsByAccount.has(h)&&!this._loadingObofForAccounts.has(h));if(!e.length)return;const o=new Set(this._loadingObofForAccounts);e.forEach(h=>o.add(h)),this._loadingObofForAccounts=o;const s=this._accountTree?this.getAllCheckedAccountIds([this._accountTree]):[];let a=[];if(s.length>0)try{const h=this.getAncestorAccountIds(e[0]),m=h[h.length-1],A=await rt.search({accountNumber:m,page:0,size:1e3});A.contacts&&A.contacts.length>0&&(a=A.contacts.filter(R=>R.accounts.some(w=>s.includes(w.accountNumber))))}catch(h){}const n=await Promise.all(e.map(async h=>{try{const m=(await zt(h,Ht)).filter(R=>R.accountPermissionGroup===jt.OnBehalfUserUpdater);let A=!1;return m.length||(A=a.some(R=>R.accounts.some(w=>w.accountNumber===h))),{accountId:h,creators:m,hierarchyHasUsers:A}}catch(m){return{accountId:h,creators:[],hierarchyHasUsers:!1}}})),l=new Map(this._obofCreatorsByAccount),u=new Map(this._accountHierarchyHasUsers),v=new Set(this._loadingObofForAccounts);n.forEach(({accountId:h,creators:m,hierarchyHasUsers:A})=>{l.set(h,m),u.set(h,A),v.delete(h)}),this._obofCreatorsByAccount=l,this._accountHierarchyHasUsers=u,this._loadingObofForAccounts=v,this.requestUpdate(),await this.updateComplete,this.validateStep(),this.dispatchNextButtonToggleEvent()}renderAccounts(){var t,e;if(!this._accountTree)return p;const o=(e=(t=this._accountTree)===null||t===void 0?void 0:t.children)===null||e===void 0?void 0:e.some(s=>{var a;return(a=s.children)===null||a===void 0?void 0:a.length});return c` <div class="overflow-auto pb-[2px]" role="region" aria-labelledby="account-instructions"> <ix-tree checkboxesEnabled .rootNode="${this._accountTree}" .rollup="${!1}" .disableEndNodePointer="${!0}" .selectNodeOnClick="${!0}" ?removeChevron="${!o}" @on-tree-node-checked="${()=>this.toggleAccountChecked()}" data-testid="step-two-account-tree" aria-label="Account hierarchy tree" aria-describedby="account-tree-help" role="tree"></ix-tree> </div> `}validateStep(t){if(!this._accountTree||!this.ixTree)return;const e=ce([this._accountTree]);if(this.obofEnabled&&e){const o=this.getSelectedAccountIds(),s=Fe(o,this.obofSelections),a=_t(!0,e,this.obofSelections,o),n=t!=null?t:this.getDedupedAttachments(),l=!a||n.length>0,u=this.areAttachmentsValid(n);this._nextButtonEnabled=e&&s&&l&&u;return}this._nextButtonEnabled=e}async toggleAccountChecked(){if(!(!this._accountTree||!this.ixTree)){if(await this.ixTree.updateComplete,this._accountTree=this.ixTree.rootNode,this.obofEnabled){const t=this.getSelectedAccountNodes(),e=t.map(s=>s.id||s.label),o=t.flatMap(le);this.obofSelections=Le(this.obofSelections,o),this.dispatchObofSelectionsUpdateEvent(),await this.loadObofCreatorsForAccounts(e)}this.handleDocumentUploadVisibilityTransition(),this.dispatchUpdateAccountsEvent(),this.validateStep(),this.updateValidationMessage(),this.dispatchNextButtonToggleEvent()}}onFileRemoved(t){if(!(t!=null&&t.detail))return;const e=this.getDedupedAttachments(t.detail.allFiles||[]);this.attachments=e,this.dispatchAttachmentsUpdateEvent(e),this.validateStep(e),this.dispatchNextButtonToggleEvent()}onUploaded(t){const e=t.detail.filesUploaded||[],o=ne(),s=new Map;this.getDedupedAttachments().forEach(l=>s.set(kt(l),l));let a=!1;e.forEach(l=>{if(Be(l.file,o).length>0){a=!0;return}s.set(kt(l.file),l.file)});const n=[...s.values()];this.attachments=n,a&&(this._uploaderInstanceKey+=1),this.dispatchAttachmentsUpdateEvent(n),this.validateStep(n),this.dispatchNextButtonToggleEvent()}handleObofOptionClick(t,e,o,s=o,a=""){const n=new Dt(e,o,s,a),l=new Map(this.obofSelections);for(const u of le(t))l.set(u,n);this.obofSelections=l,this.dispatchObofSelectionsUpdateEvent(),this.requestUpdate(),this.handleDocumentUploadVisibilityTransition(),this.validateStep(),this.dispatchNextButtonToggleEvent()}renderObofs(){if(!this.obofEnabled)return p;const t=this.getSelectedAccountNodes();return t.length?c` <div class="mt-4 overflow-y-auto" style="max-height:200px"> ${t.map(e=>this.renderObofUserSelect(e))} </div> `:p}renderObofUserSelect(t){var e;const o=t.id||t.label,s=this._loadingObofForAccounts.has(o),a=this._obofCreatorsByAccount.get(o)||[],n=this._accountHierarchyHasUsers.get(o)||!1,l=((e=this.obofSelections)===null||e===void 0?void 0:e.get(o))||new Dt,u=l.value,v=Kt(s,a.length,n);let h;if(v==="loading")h=c` <ix-select-option value="loading" display-text="Loading users..." disabled="disabled" selected="selected"> Loading users... </ix-select-option> `;else if(v==="selectable")h=c` ${a.map(m=>{const A=m.id;if(!A)return p;const R=`${m.firstName} ${m.lastName}`,w=`${R} (${m.email})`;return c` <ix-select-option value="${A}" display-text="${w}" ?selected="${u===A}" @click="${()=>this.handleObofOptionClick(t,A,w,R,m.email)}"> ${w} </ix-select-option> `})} `;else if(v==="no-user"){const m=ot.noUserAvailable;h=c` <ix-select-option value="${k.NoUserAvailable}" display-text="${m}" ?selected="${u===k.NoUserAvailable}" @click="${()=>this.handleObofOptionClick(t,k.NoUserAvailable,m)}"> ${m} </ix-select-option> `}else{const m=ot.newCustomer;h=c` <ix-select-option value="${k.NewCustomer}" display-text="${m}" ?selected="${u===k.NewCustomer}" @click="${()=>this.handleObofOptionClick(t,k.NewCustomer,m)}"> ${m} </ix-select-option> `}return c` <div class="mb-3"> <label for="obof-${o}-menu" class="text-sm font-medium" style="display:block;margin-bottom:8px"> ${t.label} </label> <ix-select quick menu-below class="w-full" id="obof-${o}-menu" menu-positioning="fixed" label="${s?"Loading users...":"Created on Behalf of*"}" .displayText="${s?"Loading users...":l.displayText}" ?disabled="${s}"> ${h} </ix-select> </div> `}renderDocumentUpload(){if(!this.shouldRenderDocumentUpload())return p;const t=qt(),e=Gt(),o=e.map(a=>a.toUpperCase()).join(", "),s=`Max file size is ${t} MB with accepted file formats of ${o}`;return c` <div class="mt-4"> <label class="text-sm font-medium" style="display:block;margin-bottom:8px"> Document(s) of Request* </label> ${pe(this._uploaderInstanceKey,c` <ix-file-uploader .allowDeleteDefaultFiles="${!0}" .allowMultipleFiles="${!0}" .defaultFiles="${this.getDedupedAttachments()}" .extensions="${e}" .maxFileSizeValue="${t}" .headerText="${"CLICK HERE TO BROWSE YOUR DEVICE OR DROP FILES TO UPLOAD"}" .bodyText="${s}" .hideBody="${!1}" .validateFile="${Wt}" @on-file-removed="${this.onFileRemoved}" @on-files-uploaded="${this.onUploaded}"></ix-file-uploader> `)} </div> `}updateValidationMessage(){this._accountTree&&ce([this._accountTree])?this._validationMessage="Account(s) selected. Ready to proceed.":this._validationMessage="Select at least one account to proceed"}dispatchUpdateAccountsEvent(){this.dispatchEvent(new CustomEvent(I.UpdateAccounts,{detail:{rootNode:this._accountTree},bubbles:!0,composed:!0}))}dispatchObofSelectionsUpdateEvent(){this.dispatchEvent(new CustomEvent(I.UpdateObofSelections,{detail:{obofSelections:this.obofSelections},bubbles:!0,composed:!0}))}dispatchAttachmentsUpdateEvent(t){this.dispatchEvent(new CustomEvent(I.UpdateAttachments,{detail:{attachments:t},bubbles:!0,composed:!0}))}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(I.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(I.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(I.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}render(){return c` <div class="flex flex-col overflow-hidden"> <div id="account-instructions" class="sr-only" role="status"> Select one or more accounts from the list below to add to this contact. </div> <div id="account-tree-help" class="sr-only"> Use arrow keys to navigate through accounts. Press Space or Enter to select or deselect accounts. Parent accounts can be expanded or collapsed to show child accounts. </div> <div role="status" aria-live="polite" aria-atomic="true" class="sr-only" id="validation-status"> ${this._validationMessage} </div> ${this.renderAccounts()} ${this.renderObofs()} ${this.renderDocumentUpload()} <div class="flex justify-end mt-6"> <ix-button type="submit" ?disabled="${!this._nextButtonEnabled}" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" @keydown="${this.handleNextButtonKeydown}" data-testid="step-two-next-button" aria-label="${this._nextButtonEnabled?"Proceed to next step: Select roles":"Next step disabled. Please select at least one account to continue."}"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}};_.styles=[U,nt,yt,Me],i([r({type:Object})],_.prototype,"accountTree",void 0),i([r({type:Boolean})],_.prototype,"obofEnabled",void 0),i([r({type:String})],_.prototype,"accountStructure",void 0),i([r({type:Object})],_.prototype,"obofSelections",void 0),i([r({type:Array})],_.prototype,"attachments",void 0),i([d()],_.prototype,"_accountTree",void 0),i([d()],_.prototype,"_nextButtonEnabled",void 0),i([d()],_.prototype,"_validationMessage",void 0),i([d()],_.prototype,"_obofCreatorsByAccount",void 0),i([d()],_.prototype,"_accountHierarchyHasUsers",void 0),i([d()],_.prototype,"_loadingObofForAccounts",void 0),i([d()],_.prototype,"_uploaderInstanceKey",void 0),i([C("ix-tree")],_.prototype,"ixTree",void 0),_=i([N("append-accounts-select-accounts")],_);let F=class extends H{constructor(){super(...arguments),this.checkedAccounts=[],this.roles=[],this.dataForAccounts=[],this.treeData=[],this._dataForAccounts=[],this._treeData=[],this._nextButtonEnabled=!1,this._validationMessage="Select at least one role for each account to proceed",this.multiSelectOpen=!1}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._treeData=this.treeData,this.validateStep(),this.dispatchValidateStepEvent()}getRoles(t){return this.roles.filter(e=>e.accountId===t)[0].roles}getRolesData(t){const e=this.roles.filter(s=>s.accountId===t)[0],o=[];return e.roles.forEach(s=>{var a;s.removed=!0;const n={id:"root",label:"",children:[],customerKnownSpaceName:""},l=(a=this._treeData.find(v=>v.accountNumber===t))===null||a===void 0?void 0:a.data;l&&l.length&&Ve(l[0],n);const u={accountId:t,role:s,locations:[],genericTreeView:n};o.push(u)}),o}getFlagsData(t){const e=[];return ze.forEach(o=>{const s={accountId:t,flag:o,locations:[],genericFlagsData:[]};e.push(s)}),e}renderMultiSelectRoles(){this._dataForAccounts.length===0&&(this._dataForAccounts=this.checkedAccounts.map(e=>({accountId:e.id,accountName:e.label,rolesData:this.getRolesData(e.id),flagsData:this.getFlagsData(e.id),flagData:[],active:!1})),this.dispatchUpdateDFAEvent());const t={};return this._dataForAccounts.forEach(e=>{t[e.accountId]=e.rolesData.filter(o=>o.role.removed===!0).map(o=>o.role.name)}),this._dataForAccounts.map(e=>{const o=[...new Set(this.getRoles(e.accountId).map(s=>s.name))].map(s=>({label:s,selected:!t[e.accountId].includes(s)}));return c` <div role="group" aria-labelledby="account-label-${e.accountId}"> <div class="account-roles-name" id="account-label-${e.accountId}"> ${e.accountName} </div> <ix-multi-select data-testid="multi-select-roles-${e.accountId}" required id="${`${e.accountId}-multi-select`}" style="max-width:99%" class="multi-select" .menuPositioning="${"popover"}" .items="${o}" .label="${"Roles"}" aria-label="Select roles for ${e.accountName}" aria-describedby="roles-help-${e.accountId}" @toggle-multi-select-item="${s=>this.handleMultiSelect(e.accountId,s.detail.label,s.detail.selected)}" @remove-multi-select-item="${s=>this.handleMultiSelect(e.accountId,s.detail,!1)}" @clear-multi-select="${()=>this.handleMultiSelectClear(e.accountId)}" @select-menu="${s=>this.handleSelectMenu(s)}"></ix-multi-select> <div id="roles-help-${e.accountId}" class="sr-only"> At least one role must be selected for ${e.accountName} to proceed. </div> </div> `})}handleSelectMenu(t){t.detail.value==="open"?this.multiSelectOpen=!0:this.multiSelectOpen=!1}handleMultiSelect(t,e,o){var s,a;const[n]=this._dataForAccounts.filter(h=>h.accountId===t),l=this.getRoles(n.accountId).find(h=>h.name===e);if(!l)return;const u=n.rolesData.findIndex(h=>h.role.id===l.id);if(l.permissions.every(h=>h.isNonLocation)){const h=(s=n.rolesData[u])===null||s===void 0?void 0:s.genericTreeView;if(!((a=h==null?void 0:h.children)===null||a===void 0)&&a.length){const m=h.children[0];m.checked=o,Ut(m,h),n.rolesData[u].locations=o?[m]:[]}}const v=n.rolesData.findIndex(h=>h.role.id===(l==null?void 0:l.id));n.rolesData[v].role.removed=!(o&&v>=0),this.validateStep(),this._validationMessage=this._nextButtonEnabled?"All accounts have a role selected. Ready to proceed.":"Select at least one role for each account to proceed",this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()}validateStep(){const t=this._dataForAccounts.every(o=>o.rolesData.filter(s=>s.role.removed===!1).length),e=this._dataForAccounts.length===this.checkedAccounts.length;this._nextButtonEnabled=t&&e}handleMultiSelectClear(t){const e=this._dataForAccounts.filter(o=>o.accountId===t)[0];this._dataForAccounts.find(o=>o.accountId===t).rolesData=this.getRolesData(e.accountId),this._nextButtonEnabled=!1,this._validationMessage="Select at least one role for each account to proceed",this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()}dispatchUpdateDFAEvent(){const t=new CustomEvent(I.UpdateDFA,{detail:{dataForAccounts:this._dataForAccounts},bubbles:!0,composed:!0});this.dispatchEvent(t)}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(I.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(I.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(I.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}render(){const t=this.multiSelectOpen?"overflow-hidden":"overflow-auto";return c` <div class="wizard-step-content flex flex-col overflow-hidden"> <div role="status" aria-live="polite" aria-atomic="true" class="sr-only"> ${this._validationMessage} </div> <div class="p-1 dlr-text-default ${t}">${this.renderMultiSelectRoles()}</div> <div class="flex justify-end" style="padding-top:8px"> <ix-button class="pt-2" type="submit" ?disabled="${!this._nextButtonEnabled}" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" @keydown="${e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),this.dispatchNextStepEvent())}}" data-testid="step-three-next-button" aria-label="${this._nextButtonEnabled?"Proceed to next step: Portal access":"Next step disabled. Please select at least one role for each account."}"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}};F.styles=[Pe,U,Ft,yt],i([r({type:Array})],F.prototype,"checkedAccounts",void 0),i([r({type:Array})],F.prototype,"roles",void 0),i([r({type:Array})],F.prototype,"dataForAccounts",void 0),i([r({type:Array})],F.prototype,"treeData",void 0),i([d()],F.prototype,"_dataForAccounts",void 0),i([d()],F.prototype,"_treeData",void 0),i([d()],F.prototype,"_nextButtonEnabled",void 0),i([d()],F.prototype,"_validationMessage",void 0),i([d()],F.prototype,"multiSelectOpen",void 0),F=i([N("append-accounts-select-roles")],F);let D=class extends H{constructor(){super(...arguments),this.dataForAccounts=[],this.permissions=[],this._dataForAccounts=[],this.showPermissionsDialog=!1,this.removeRoleDialogOpen=!1,this._nextButtonEnabled=!1}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._selectedAccountId=this.selectedAccountId,this._selectedRoleId=this.selectedRoleId,this.validateStep(),this.dispatchValidateStepEvent(),this.setInitialRole()}get noOfLocations(){var t;return io((t=this.selectedRoleData)===null||t===void 0?void 0:t.genericTreeView)}get canAddRolesDisabled(){var t;return!(!((t=this.unAvailableRoles)===null||t===void 0)&&t.length)}get availableRoles(){const t=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId),e=t==null?void 0:t.rolesData.filter(o=>o.role.removed===!1);return e==null?void 0:e.flatMap(o=>o.role)}get unAvailableRoles(){const t=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId),e=t==null?void 0:t.rolesData.filter(o=>o.role.removed===!0);return e==null?void 0:e.flatMap(o=>o.role)}get roles(){const t=this._dataForAccounts.find(e=>e.accountId===this._selectedAccountId);return t==null?void 0:t.rolesData.flatMap(e=>e.role)}get selectedAccount(){return this._dataForAccounts.find(t=>t.accountId===this._selectedAccountId)}get selectedRole(){return this.selectedAccount.rolesData.find(t=>t.role.id===this._selectedRoleId).role}get selectedRolePermissions(){var t,e;return(e=(t=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId))===null||t===void 0?void 0:t.rolesData.find(o=>o.role.id===this._selectedRoleId))===null||e===void 0?void 0:e.role.permissions}get selectedRoleData(){return this.selectedAccount.rolesData.find(t=>t.role.id===this._selectedRoleId)}toggleActiveCard(t){this._selectedAccountId=t,this._dataForAccounts.forEach(e=>{e.accountId!==t?e.active=!1:e.active=!0}),this.setInitialRole(),this.roleTabComponent.setActiveRole(this._selectedRoleId),this.requestUpdate()}setInitialRole(){this.availableRoles&&this.availableRoles.length>0&&(this._selectedRoleId=this.availableRoles[0].id)}dispatchOpenAddAccountRole(){this.addRoleDialog.handleOpenDialog()}dispatchTabControl(t){this._selectedRoleId=this.roles[t].id,this.roleTabComponent.setActiveRole(this._selectedRoleId)}addRole(t){var e;const o=this.selectedAccount.rolesData.findIndex(s=>s.role.id===t);if(this.selectedAccount.rolesData[o].role.permissions.every(s=>s.isNonLocation)){const s=this.selectedAccount.rolesData[o].genericTreeView;if(!(!((e=s==null?void 0:s.children)===null||e===void 0)&&e.length))return;const a=s.children[0];a.checked=!0,Ut(a,s),this.selectedAccount.rolesData[o].locations.push(a)}else this.selectedAccount.rolesData[o].locations=[];this.selectedAccount.rolesData[o].role.removed=!1,this.requestUpdate(),this.dispatchTabControl(o),this.addRoleDialog.handleCancelChanges()}dispatchRemoveRoleEvent(){const t=this.roles.findIndex(o=>o.id===this._selectedRoleId);this.roles[t].removed=!0;const e=this.selectedAccount.rolesData.findIndex(o=>o.role.id===this._selectedRoleId);this.selectedAccount.rolesData[e].locations=[],this.selectedAccount.rolesData[e].role.removed=!0,this.selectedAccount.rolesData[e].genericTreeView&&je(this.selectedAccount.rolesData[e].genericTreeView),this.validateStep(),this.setInitialRole(),this.requestUpdate()}renderTree(){const t=this._dataForAccounts.find(a=>a.accountId===this._selectedAccountId),e=t==null?void 0:t.rolesData.find(a=>a.role.id===this._selectedRoleId);if(!e)return p;const o={role:e.role.id,rootNode:e.genericTreeView},s=a=>{this.requestUpdate();const{updates:n}=a.detail.message,l=n.find(u=>u.key===e.role.id);l!=null&&l.items?e.locations=l.items.filter(u=>u.checked):e.locations=[],this.validateStep(),this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()};if(o&&o.rootNode){const a=e==null?void 0:e.role.permissions.every(n=>n.isNonLocation);return c`<user-details-assignments .assignment="${o}" .contact="${this.contact}" .accountNumber="${t==null?void 0:t.accountId}" @check-toggle="${s}" ?disableTree="${a}"></user-details-assignments>`}return p}validateStep(){let t=!0;for(const e of this._dataForAccounts)if(!e.rolesData.filter(o=>o.role.removed===!1).every(o=>o.locations.length)){t=!1;break}this._nextButtonEnabled=t}renderRoles(){var t,e;return c` <user-details-tab-roles id="role-data-element" .assignedRoles="${this.availableRoles}" .activeRoleId="${(t=this._selectedRoleId)!==null&&t!==void 0?t:""}" .canRemoveRoles="${!0}" .removeRolesDisabled="${((e=this.availableRoles)===null||e===void 0?void 0:e.length)<=1}" .canAddRoles="${!0}" .addRolesDisabled="${this.canAddRolesDisabled}" @role-select="${o=>this._selectedRoleId=o.detail.roleId}" @open-role-menu="${()=>this.dispatchOpenAddAccountRole()}" @open-remove-role-menu="${()=>this.removeRoleDialogOpen=!0}"></user-details-tab-roles> `}renderAddAccountRoleConfirmation(){var t;return c`<add-account-role id="add-role-dialog" .contact="${this.contact}" .account="${Ke((t=this.selectedAccount)===null||t===void 0?void 0:t.accountId)||""}" .assignedRoles="${this.availableRoles}" .roles="${this.roles}" @add-role="${e=>this.addRole(e.detail.roleId)}"> </add-account-role>`}renderRemoveRoleConfirmation(){return c`<changes-confirmation id="remove-role-dialog" ?isOpen="${this.removeRoleDialogOpen}" .headerText="${"Are you sure you want to remove this role?"}" .bodyText="${"The user will no longer be able to perform the permissions of this role for this account."}" .confirmationButtonText="${"Remove Role"}" @confirm="${()=>{this.dispatchRemoveRoleEvent(),this.validateStep(),this.removeRoleDialogOpen=!1}}" @cancel="${()=>this.removeRoleDialogOpen=!1}"> </changes-confirmation>`}renderControls(){return c` <div class="controls"> <div class="flex justify-between py-2 items-center permissions-locations"> ${this.renderViewPermissionsButton()} <div class="flex items-center">${this.renderLocationsCount()}</div> </div> <div class="next-control"> <ix-button id="next-button" type="submit" has-icon trailing-icon ?disabled="${!this._nextButtonEnabled}" @click="${()=>{this.dispatchNextStepEvent()}}" @keydown="${t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),t.stopPropagation(),this.dispatchNextStepEvent())}}" data-testid="step-four-next-button" aria-label="${this._nextButtonEnabled?"Proceed to next step: User flags":"Next step disabled. Please select locations for all roles."}"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}renderPermissionsDialog(){var t,e;return c` <ix-dialog id="permissions-dialog" ?open="${this.showPermissionsDialog}" @close="${()=>this.showPermissionsDialog=!1}" @opened="${()=>{this.permissionsDialog.focus()}}" aria-modal="true" aria-labelledby="permissions-dialog-title"> <div class="dlr-text-heading" slot="headline" id="permissions-dialog-title"> ${this.selectedRole.name} — Permissions </div> <div class="permissions-content" slot="content"> <user-details-permission inPermissionsDialog .permissionData="${(e=qe((t=this.selectedRolePermissions)!==null&&t!==void 0?t:[]))!==null&&e!==void 0?e:[]}"> </user-details-permission> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.togglePermissionsDialog}" slot="secondary" aria-label="Dismiss permissions dialog"><span class="dismiss-btn">Dismiss</span></ix-button> </div> </ix-dialog> `}togglePermissionsDialog(){this.showPermissionsDialog=!this.showPermissionsDialog}renderViewPermissionsButton(){var t,e;return c` <div class="tree-view-permissions"> <ix-button class="temp-button view-permissions" appearance="text" @click="${this.togglePermissionsDialog}" aria-label="View permissions for ${(e=(t=this.selectedRole)===null||t===void 0?void 0:t.name)!==null&&e!==void 0?e:"selected role"}" aria-haspopup="dialog"> View Permissions </ix-button> </div> `}renderLocationsCount(){const t=`font-bold uppercase ${this.noOfLocations?"tree-role-locations-count-active":"tree-role-locations-count"}`,e=this.noOfLocations?`${this.noOfLocations} location${this.noOfLocations===1?"":"s"} selected`:"No locations selected";return c`<div class="tree-role-locations" aria-live="polite" aria-atomic="true"> <span class="${t}" aria-label="${e}"> ${this.noOfLocations?c`${this.noOfLocations} locations`:c`Select Locations`} </span> </div>`}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(I.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(I.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(I.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchUpdateDFAEvent(){const t=new CustomEvent(I.UpdateDFA,{detail:{dataForAccounts:this._dataForAccounts},bubbles:!0,composed:!0});this.dispatchEvent(t)}renderAccountTabbingCard(){return c` <account-tabbing-card data-testid="step-four-account-cards" isRoles .dataForAccounts="${this._dataForAccounts}" .selectedAccountId="${this._selectedAccountId}" @toggle-active-card="${t=>this.toggleActiveCard(t.detail.accountId)}"> </account-tabbing-card> <p class="assign-portal-access-text">Assign portal access to all roles before continuing</p> `}render(){return c` <div class="wizard-step-content overflow-y-auto h-full max-h-screen md:p-1"> ${this.renderAccountTabbingCard()} <div class="tree-view-container-content">${this.renderRoles()}</div> <div class="controls-container">${this.renderControls()}</div> <div class="tree-view-container-footer">${this.renderTree()}</div> </div> ${this.renderAddAccountRoleConfirmation()} ${this.renderRemoveRoleConfirmation()} ${this.renderPermissionsDialog()} `}};D.styles=[He,U,nt],i([C("#permissions-dialog ix-button")],D.prototype,"permissionsDialog",void 0),i([r({type:Array})],D.prototype,"dataForAccounts",void 0),i([r({type:Array})],D.prototype,"permissions",void 0),i([r({type:String})],D.prototype,"selectedAccountId",void 0),i([r({type:String})],D.prototype,"selectedRoleId",void 0),i([r({type:Object})],D.prototype,"contact",void 0),i([d()],D.prototype,"_dataForAccounts",void 0),i([d()],D.prototype,"_selectedAccountId",void 0),i([d()],D.prototype,"_selectedRoleId",void 0),i([d()],D.prototype,"showPermissionsDialog",void 0),i([d()],D.prototype,"removeRoleDialogOpen",void 0),i([d()],D.prototype,"_nextButtonEnabled",void 0),i([C("#add-role-dialog")],D.prototype,"addRoleDialog",void 0),i([C("#role-data-element")],D.prototype,"roleTabComponent",void 0),i([C("user-details-assignments")],D.prototype,"assignmentTreeComponent",void 0),D=i([N("append-accounts-select-locations")],D);const $o=tt`.results-icon ix-icon{font-size:75px;display:block;height:75px}.success-icon{color:#4caf50}.failed-icon{color:#ff9800}.wizard-step-content{height:calc(100vh - 8.5rem);overflow-y:auto}.header{text-align:center;margin-bottom:24px;font-family:var(--root-secondary-font);font-weight:700;font-size:34px;line-height:40px;letter-spacing:.35px;vertical-align:middle}.header h2{font-size:34px}.section__header{padding:16px 24px;font-family:var(--root-secondary-font);font-weight:700;font-size:20px;line-height:24px;letter-spacing:.15px;border-bottom:1px solid #0922411F;display:flex;align-items:center}.section__header ix-icon{--ix-icon-font-size:1.25rem;height:1.25rem;margin-right:16px;display:block}.section__body{padding:24px 32px;display:flex;flex-direction:column;gap:24px}.result__item{display:flex;align-items:center}.result__item .icon{--ix-icon-font-size:2rem;height:2rem;margin-right:24px;display:block}.result__item span{font-weight:400;font-size:16px;line-height:20px;letter-spacing:.15px}.message{overflow:hidden;border-radius:1rem;margin-bottom:1.5rem;border:1px solid #0922411F;box-shadow:0 1px 1px 0 #0000002E;font-family:Open Sans;font-weight:400;font-size:16px;line-height:20px;letter-spacing:.15px}.success-message .section__header{background-color:#edf7ed}.result__details{display:flex;flex-direction:column}.result__item.with-message{align-items:flex-start}.result__details .error-message{color:#db0028;line-height:24px;font-size:14px}.failed-message .section__header{background-color:#fdeded}.failed-message .failed-icon{color:#db0028}.controls{text-align:center}ix-button{display:inline-block;font-family:var(--root-secondary-font)}`;let mt=class extends H{constructor(){super(...arguments),this.addAccountResults={success:[],failed:[]},this.errorMsg="Failed to create the account to user association. Please try again."}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("refresh-accounts-list",{composed:!0,bubbles:!0})),this.updateComplete.then(()=>{var t;const e=(t=this.shadowRoot)===null||t===void 0?void 0:t.querySelector("[data-focus-target]");e==null||e.focus()})}resultsCard(t){if(this.addAccountResults[t].length===0)return p;const e=t==="success"?"Successfully added accounts":"Accounts that failed to add";return c` <div class="${t}-message message" role="region" aria-label="${e}"> <div class="section__header"> <ix-icon class="${t}-icon" aria-hidden="true">${t==="success"?"check_circle":"error"}</ix-icon> <span class="section__title">${t==="success"?"Accounts Added":"Error Adding Account"}</span> </div> <ul class="section__body" aria-label="${e} list"> ${this.addAccountResults[t].map(o=>c` <li class="result__item ${o.message?"with-message":""}"> <ix-icon class="icon ${t}-icon" aria-label="${t==="success"?"Success":"Error"}" role="img">${t==="success"?"check_circle":"error"}</ix-icon> <div class="result__details"> <span>${o.accountName}</span> ${o.message?c`<div class="error-message" role="alert">${this.errorMsg}</div>`:p} </div> </li> `)} </ul> </div> `}renderHeader(t="success"){return c`<div class="results-icon"> <ix-icon class="icon ${t}-icon" aria-hidden="true">${t==="success"?"check_circle":"warning"}</ix-icon> <h2 tabindex="-1" data-focus-target> ${t==="success"?"Accounts Added":"Some Accounts could not be added"} </h2> </div>`}navigateToUserDetails(){this.dispatchEvent(new CustomEvent("close-wizard",{composed:!0,bubbles:!0}))}render(){var t;const e=((t=this.addAccountResults)===null||t===void 0?void 0:t.failed.length)>0;return c` <div class="wizard-step-content md:p-1"> <div> <div class="header">${this.renderHeader(e?"failed":"success")}</div> ${this.resultsCard("success")} ${this.resultsCard("failed")} <div class="controls"> <ix-button data-testid="${de.BACK_TO_USERS}" appearance="filled" class="p-1" @click="${this.navigateToUserDetails}" aria-label="View user details and close this wizard"><span>View user details</span></ix-button> </div> </div> </div> `}};mt.styles=[$o,yt],i([r({type:Object})],mt.prototype,"addAccountResults",void 0),i([r({type:String})],mt.prototype,"errorMsg",void 0),mt=i([N("append-accounts-results")],mt);let y=class extends H{constructor(){super(...arguments),this.showDrawer=!1,this.showResults=!1,this.submitting=!1,this.selectedAccount={},this.contact={},this.permissions=[],this.roles=[],this.treeData=[],this.loading=!1,this.selectedAccountId="",this.selectedRoleId="",this.step=1,this.dataForAccounts=[],this.isNextButtonEnabled=!1,this.obofSelections=new Map,this.attachments=[]}get stepTitle(){return`Add an Account to ${this.contact.firstName} ${this.contact.lastName}`}get obofEnabled(){return Rt()&&!Y(this.contact.email)}connectedCallback(){super.connectedCallback(),this.setupAccountSelector()}setupAccountSelector(){const t=re().filter(e=>E.hasExternalUserUpdate(e.accountNumber));this.accounts=We(t),Ye(this.accounts),this.accountTree=this.addFixedToAlreadyAddedAccounts(this.selectedAccount),this.permissions=It.getPermissions()}addFixedToAlreadyAddedAccounts(t){if(!t)return t;const e=Array.isArray(t.children)?t.children.map(o=>this.addFixedToAlreadyAddedAccounts(o)):t.children;return{...t,fixed:t.disabled?!0:t.fixed,children:e}}resetStep(){this.handleDialogReset()}setStep(t){this.step=t}onNextButtonToggle(t){this.isNextButtonEnabled=t.detail}onPrevStep(){this.step!==1&&(this.step-=1)}async onNextStep(){var t,e;if(this.isNextButtonEnabled){if(this.loading=!0,this.step===1){if(!this.accountTree){this.loading=!1;return}const o=((t=this.checkedAccounts)===null||t===void 0?void 0:t.map(l=>l.id))||[],s=await Qe.getAccountData(o),a=Tt.get(),n=Y(this.contact.email)&&E.hasAssignInternalRoleCreate(It.getAccountNumber());this.roles=[],this.treeData=[];for(let l=0;l<o.length;l+=1){const u=Ct(o[l],a,n),v=o[l];this.roles.push({accountId:v,roles:structuredClone(u)}),this.treeData.push({contactId:"",accountNumber:v,roleId:"",data:s[l]})}}else if(this.step===2){const o=this.dataForAccounts[0],s=(e=o==null?void 0:o.rolesData)===null||e===void 0?void 0:e[0];if(!o||!s){this.isNextButtonEnabled=!1,this.loading=!1;return}this.selectedAccountId=o.accountId,this.selectedRoleId=s.role.id}else if(this.step===3)for(const o of this.dataForAccounts){const s=this.treeData.find(a=>a.accountNumber===o.accountId);s&&Ze(o,s)}this.step<3&&(this.isNextButtonEnabled=!1),this.loading=!1,this.step+=1}}handleDialogReset(){this.dispatchEvent(new CustomEvent("close-wizard",{bubbles:!0,composed:!0}))}updateAccounts(t){if(this.accountTree=t.detail.rootNode,!this.accountTree||!Array.isArray(this.accountTree.children)){this.checkedAccounts=[],this.dataForAccounts=[];return}this.checkedAccounts=ae([this.accountTree],ue(this.accounts||[])),this.dataForAccounts=[]}renderWizardStep(){switch(this.step){case 1:{const t=this.accountTree&&Array.isArray(this.accountTree.children)?this.accountTree:void 0;return c` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Accounts*"}" data-testid="append-accounts-select-accounts"> <append-accounts-select-accounts class="flex flex-col overflow-auto grow" .accountTree="${t}" .accountStructure="${ue(this.accounts||[])}" .obofEnabled="${this.obofEnabled}" .obofSelections="${this.obofSelections}" .attachments="${this.attachments}" @update-accounts="${e=>this.updateAccounts(e)}" @update-obof-selections="${e=>{this.obofSelections=e.detail.obofSelections}}" @update-attachments="${e=>{this.attachments=e.detail.attachments}}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></append-accounts-select-accounts> </ui-um-wizard-step> `}case 2:return c` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Roles"}" data-testid="append-accounts-select-roles"> <append-accounts-select-roles class="flex flex-col overflow-auto grow" .checkedAccounts="${this.checkedAccounts||[]}" .roles="${this.roles}" .dataForAccounts="${this.dataForAccounts}" .treeData="${this.treeData}" @update-dfa="${t=>{this.dataForAccounts=t.detail.dataForAccounts}}" @next-step="${this.onNextStep}" @validate-step="${t=>this.isNextButtonEnabled=t.detail}" @next-button-toggle="${t=>this.onNextButtonToggle(t)}"></append-accounts-select-roles> </ui-um-wizard-step> `;case 3:return c` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Portal Access"}" data-testid="append-accounts-select-locations"> <append-accounts-select-locations class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .selectedRoleId="${this.selectedRoleId}" .permissions="${this.permissions}" .contact="${this.contact}" @update-dfa="${t=>this.dataForAccounts=t.detail.dataForAccounts}" @next-step="${this.onNextStep}" @validate-step="${t=>this.isNextButtonEnabled=t.detail}" @next-button-toggle="${t=>this.onNextButtonToggle(t)}"></append-accounts-select-locations> </ui-um-wizard-step> `;case 4:return c` <ui-um-wizard-step slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"User Flags"}" data-testid="append-accounts-select-flags"> <create-user-step-five class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .evacAssistanceRequired="${this.contact.evacAssistance}" @evac-assistance-required="${t=>this.contact.evacAssistance=t.detail}" @next-step="${this.onNextStep}"> </create-user-step-five> </ui-um-wizard-step> `;case 5:return c` <ui-um-wizard-step isLastStep slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"Are these details correct?"}" ?submitting="${this.submitting}" @create-contact="${this.dispatchCreateNewContactEvent}" data-testid="append-accounts-review"> <create-user-step-six class="step" .dataForAccounts="${this.dataForAccounts}" .newContact="${this.contact}" .obofEnabled="${this.obofEnabled}" .attachments="${this.attachments}" .obofSelections="${this.obofSelections}" hideContactDetails ?submitting="${this.submitting}" @set-step="${t=>this.setStep(t.detail.step)}"></create-user-step-six> </ui-um-wizard-step> `}return p}renderProgress(){return c`<ix-progress slot="wizard-content" indeterminate></ix-progress>`}dispatchCreateNewContactEvent(){this.dispatchEvent(new CustomEvent(I.CreateNewContact,{detail:{newContact:this.contact,dataForAccounts:this.dataForAccounts,attachments:this.attachments,obofSelections:this.obofSelections},bubbles:!0,composed:!0}))}renderDrawerControls(){const t={1:"Select Accounts",2:"Select Roles",3:"Portal Access",4:"User Flags",5:"Review"},e=t[this.step-1],o=t[this.step+1];return c` <div slot="centre-top"> <div role="status" aria-live="polite" aria-atomic="true" class="sr-only"> ${this.showResults?"Results":`Step ${this.step} of 5: ${t[this.step]}`} </div> <div class="flex"> ${this.showResults?p:c` <ix-icon-button class="icon-btn_primary" style="${this.step===1?"visibility: hidden":""}" ?disabled="${this.step===1||this.loading}" @click="${()=>{this.step!==1&&this.onPrevStep()}}" @keydown="${s=>{s.key==="Enter"||s.key===" "?(s.preventDefault(),this.onPrevStep()):s.shiftKey&&s.key==="Tab"&&(s.stopPropagation(),s.preventDefault())}}" icon="chevron_left" data-testid="prev-step-icon" aria-label="Go back to ${e!=null?e:"previous step"}"> </ix-icon-button> <span class="dlr-text-small uppercase font-bold pt-[10px] px-2 step-progress" data-testid="step-progress" aria-hidden="true"> ${this.step} of 5 </span> <ix-icon-button style="${this.step===5?"visibility: hidden":""}" class="icon-btn_primary ${this.step===5||!this.isNextButtonEnabled||this.loading?"disabled":""}" ?disabled="${!this.isNextButtonEnabled||this.loading}" @click="${()=>this.onNextStep()}" @keydown="${s=>{s.key==="Enter"||s.key===" "?(s.preventDefault(),this.onNextStep()):this.step===1&&s.shiftKey&&s.key==="Tab"&&(s.stopPropagation(),s.preventDefault())}}" icon="chevron_right" data-testid="next-step-icon" aria-label="${this.isNextButtonEnabled?`Proceed to ${o!=null?o:"next step"}`:"Next step disabled. Complete the current step to continue."}"> </ix-icon-button> `} </div> </div> `}render(){return c` <ui-um-drawer ?isVisible="${this.showDrawer}" ?summaryScreen="${this.showResults}" ?submitting="${this.submitting}" @close-success="${this.handleDialogReset}" @blur-drawer="${this.handleDialogReset}" @toggle-dialog="${t=>{var e,o;t==null||t.stopPropagation(),this.dispatchEvent(new CustomEvent("close-wizard",{detail:{originElement:(o=(e=t==null?void 0:t.detail)===null||e===void 0?void 0:e.originElement)!==null&&o!==void 0?o:this.drawer},bubbles:!0,composed:!0}))}}" @keydown="${t=>{t.key==="Escape"&&(t.stopPropagation(),this.dispatchEvent(new CustomEvent("close-wizard",{detail:{originElement:this.drawer},bubbles:!0,composed:!0})))}}" data-testid="ui-um-drawer" aria-label="Add account to ${this.contact.firstName} ${this.contact.lastName}" aria-busy="${this.loading}"> ${this.renderDrawerControls()} ${this.showResults?c` <div data-testid="${de.SUCCESS_CREATED}" slot="content" class=""> <append-accounts-results .addAccountResults="${this.addAccountResults}"></append-accounts-results> </div> `:c` <ui-um-wizard class="create-user-wizard" slot="content" data-testid="add-accounts-wizard" aria-label="Add accounts wizard, step ${this.step} of 5"> ${this.loading?c` <div role="status" aria-live="polite" aria-label="Loading step content"> ${this.renderProgress()} </div> `:this.renderWizardStep()} </ui-um-wizard> `} </ui-um-drawer> `}};y.styles=[Ge,U,Ft,yt],i([C("ui-um-drawer")],y.prototype,"drawer",void 0),i([r({type:Boolean})],y.prototype,"showDrawer",void 0),i([r({type:Boolean})],y.prototype,"showResults",void 0),i([r({type:Boolean})],y.prototype,"submitting",void 0),i([r({type:Object})],y.prototype,"selectedAccount",void 0),i([r({type:Object})],y.prototype,"contact",void 0),i([r({type:Object})],y.prototype,"addAccountResults",void 0),i([d()],y.prototype,"accounts",void 0),i([d()],y.prototype,"accountTree",void 0),i([d()],y.prototype,"permissions",void 0),i([d()],y.prototype,"roles",void 0),i([d()],y.prototype,"treeData",void 0),i([d()],y.prototype,"loading",void 0),i([d()],y.prototype,"selectedAccountId",void 0),i([d()],y.prototype,"selectedRoleId",void 0),i([d()],y.prototype,"step",void 0),i([d()],y.prototype,"dataForAccounts",void 0),i([d()],y.prototype,"isNextButtonEnabled",void 0),i([d()],y.prototype,"checkedAccounts",void 0),i([d()],y.prototype,"obofSelections",void 0),i([d()],y.prototype,"attachments",void 0),y=i([N("append-accounts")],y);let L=class extends lt{constructor(){super(...arguments),this.showDrawer=!1,this.showCancelDialog=!1,this.showResults=!1,this.submitting=!1,this.addAccountResults={success:[],failed:[]},this.accountAssociationController=new xe(this)}static get styles(){return[Je,nt,U]}async addAccountsToContact(t){this.submitting=!0;const e=t.detail.newContact,o=t.detail.dataForAccounts,s=t.detail.attachments||[],a=t.detail.obofSelections||new Map,n=o.map(v=>v.accountId),l=Rt()&&!Y(e.email)&&n.length>0,u={success:[],failed:[]};try{let v;if(l){if(_t(!0,n.length>0,a,n)&&s.length===0)throw new Error("At least one authority document is required before submitting.");const h=s.length?await Yt(s):[],m=Qt(a),A=await Zt({authoriserDetails:m,authorityDocuments:h.length?h:void 0});if(!(A!=null&&A.changeHistoryId))throw new Error("Failed to create change history.");v=A.changeHistoryId}(await Promise.allSettled(o.map(async h=>{const{accountId:m,accountName:A}=h,R=e.id,w=e.accounts.find(({accountNumber:X})=>X===m);if((w==null?void 0:w.status)==="REMOVED")await this.accountAssociationController.restore(m,R,!1,v);else if(!w&&!await this.accountAssociationController.add(m,R,!1,v))throw new Error(`Failed to associate account ${m} to contact ${R}`);const B=h.rolesData.filter(X=>!X.role.removed).map(X=>({key:X.role.id,items:X.locations}));return await ye(R,m,B,v),await ge(R,m,h.flagData,v),w||e.accounts.push({accountNumber:m}),{accountName:A,accountId:m}}))).forEach((h,m)=>{if(h.status==="fulfilled"){u.success.push(h.value);return}u.failed.push({accountId:o[m].accountId,accountName:o[m].accountName,message:h.reason instanceof Error?h.reason.message:"An error occurred"})})}catch(v){const h=v instanceof Error?v.message:"An error occurred";o.forEach(m=>{u.failed.push({accountId:m.accountId,accountName:m.accountName,message:h})})}finally{this.submitting=!1}this.addAccountResults={success:[...u.success],failed:[...u.failed]},this.showResults=!0}handleCloseWizard(t){var e,o,s,a,n;!((o=(e=this.addAccountResults)===null||e===void 0?void 0:e.success)===null||o===void 0)&&o.length||!((a=(s=this.addAccountResults)===null||s===void 0?void 0:s.failed)===null||a===void 0)&&a.length||(t==null||t.stopPropagation(),this.lastFocusedElement=(n=t==null?void 0:t.detail)===null||n===void 0?void 0:n.originElement,this.showCancelDialog=!0)}renderCancelDialog(){return c` <ix-dialog id="cancel-add-account-dialog" ?open="${this.showCancelDialog}" @cancel="${()=>{this.showCancelDialog=!1,setTimeout(()=>{this.lastFocusedElement&&this.lastFocusedElement.focus()},10)}}" @opened="${()=>{this.cancelDialog.focus()}}" data-testid="dialog-cancel-add-account" aria-modal="true" aria-labelledby="cancel-add-account-dialog-title"> <div class="dlr-text-heading md:w-[560px]" slot="headline"> <p tabindex="-1" id="cancel-add-account-dialog-title" @keydown="${t=>{t.shiftKey&&t.key==="Tab"&&(t.preventDefault(),this.cancelDialog.focus())}}"> Are you sure you want to cancel? </p> </div> <div class="dialog-content" slot="content"> <p>All the details provided will be lost.</p> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${()=>{this.showCancelDialog=!1,setTimeout(()=>{this.lastFocusedElement&&this.lastFocusedElement.focus()},10)}}" slot="secondary" data-testid="dismiss-close-add-account-button" aria-label="Dismiss — continue adding account"> Dismiss </ix-button> <ix-button appearance="text" @click="${()=>{this.dispatchEvent(new CustomEvent("close-wizard",{bubbles:!0,composed:!0}))}}" @keydown="${t=>{t.key==="Tab"&&(t.preventDefault(),this.cancelDialog.focus())}}" slot="primary" data-testid="cancel-add-account-button" aria-label="Confirm cancel — discard all entered details and close wizard"> Cancel adding account </ix-button> </div> </ix-dialog> `}render(){return c` <append-accounts .contact="${this.contact}" ?showDrawer="${this.showDrawer}" ?submitting="${this.submitting}" ?showResults="${this.showResults}" .addAccountResults="${this.addAccountResults}" .selectedAccount="${this.selectedAccount}" @create-new-contact="${t=>this.addAccountsToContact(t)}" @close-wizard="${this.handleCloseWizard}" data-testid="um-append-accounts" aria-busy="${this.submitting}"></append-accounts> ${this.showCancelDialog?this.renderCancelDialog():p} `}};i([C('#cancel-add-account-dialog [tabindex="-1"]')],L.prototype,"cancelDialog",void 0),i([r({type:Boolean})],L.prototype,"showDrawer",void 0),i([r({type:Boolean})],L.prototype,"showCancelDialog",void 0),i([r({type:Object})],L.prototype,"contact",void 0),i([r({type:Object})],L.prototype,"selectedAccount",void 0),i([d()],L.prototype,"showResults",void 0),i([d()],L.prototype,"submitting",void 0),i([d()],L.prototype,"lastFocusedElement",void 0),i([d()],L.prototype,"addAccountResults",void 0),i([C("append-accounts")],L.prototype,"appendAccounts",void 0),L=i([N("add-accounts-to-contact")],L);let V=class extends lt{constructor(){super(...arguments),this.assignableAccounts=[],this.activeAccountNumber="",this.readonly=!1,this.selectedAccountNumber="",this.activeAccountIndex=0,this.showAppendAccountWizard=!1,this.selectedAccount={},this.changeSelectedAccount=async(t,e=!1)=>{this.activeAccountIndex=this.assignedAccounts.findIndex(o=>o.accountNumber===t),!(this.activeAccountNumber===this.assignedAccounts[this.activeAccountIndex].accountNumber&&x.DRAFT!==this.assignedAccounts[this.activeAccountIndex].status)&&this.activeAccountIndex>-1&&this.dispatchEvent(new CustomEvent(dt.ChangeAccountAssociation,{detail:{accountNumber:t,overrideUnsavedChanges:e}}))},this.onAccountClick=t=>{this.changeSelectedAccount(t)},this.handleAddAccounts=()=>{this.selectedAccount=Xe(this.assignableAccounts),this.disableAssignedAccountsInTree(this.selectedAccount),this.showAppendAccountWizard=!0}}get assignedAccounts(){return[...this.contact.accounts,ut.get()]}get assignedAccountNames(){var t,e,o;return(o=(e=(t=this.contact)===null||t===void 0?void 0:t.accounts)===null||e===void 0?void 0:e.filter(s=>s.status!==x.REMOVED))===null||o===void 0?void 0:o.map(s=>s.name)}get selectedAccountName(){var t;const e=this.assignableAccounts.find(o=>o.accountNumber===this.selectedAccountNumber);return(t=e==null?void 0:e.displayName)!==null&&t!==void 0?t:e==null?void 0:e.name}get roleNames(){const t=It.getAccounts().find(s=>s.accountNumber===this.selectedAccountNumber)||null,e=Y(this.contact.email)&&E.hasAssignInternalRoleCreate(this.selectedAccountNumber),o=Ct(t==null?void 0:t.accountNumber,Tt.get(),e);return o==null?void 0:o.map(s=>s.name)}get fullName(){var t,e;return`${(t=this.contact)===null||t===void 0?void 0:t.firstName} ${(e=this.contact)===null||e===void 0?void 0:e.lastName}`}firstUpdated(){this.changeSelectedAccount(this.assignedAccounts[this.activeAccountIndex].accountNumber)}willUpdate(){!this.assignedAccounts[this.activeAccountIndex].accountNumber&&this.assignedAccounts.length&&this.changeSelectedAccount(this.assignedAccounts[0].accountNumber)}renderAccounts(){var t;const e=(t=this.assignedAccounts)===null||t===void 0?void 0:t.filter(s=>s.status===x.ACTIVE||s.status===x.INVITED||s.status===x.DRAFT),o=this.assignedAccounts.filter(s=>s.status===x.SUSPENDED||s.status===x.REMOVED||s.status===x.DECLINED).filter(s=>!e.find(a=>a.displayName===s.displayName));return c` <ul class="accounts-list" aria-label="Active accounts" data-testid="${f.ACCOUNTS_LIST}"> ${e==null?void 0:e.map(s=>c` <li> <dr-account data-testid="${f.ACCOUNT(s.accountNumber)}" .account="${s}" .active="${s.accountNumber===this.activeAccountNumber}" .status="${s.status}" @account-click="${a=>this.onAccountClick(a.detail.accountNumber)}"></dr-account> </li> `)} </ul> ${o.length>0?c` <ix-divider class="divider" aria-hidden="true" data-testid="${f.ACCOUNT_DIVIDER}"></ix-divider> <ul class="accounts-list" aria-label="Inactive accounts"> ${o.map(s=>c` <li> <dr-account data-testid="${f.ACCOUNT(s.accountNumber)}" .account="${s}" .active="${s.accountNumber===this.activeAccountNumber}" .status="${s.status}" @account-click="${a=>this.onAccountClick(a.detail.accountNumber)}"></dr-account> </li> `)} </ul> `:p} `}disableAssignedAccountsInTree(t){t&&(Array.isArray(t)?t.forEach(e=>this.disableAssignedAccountsInTree(e)):(t.id&&this.assignedAccounts.some(e=>{var o;return e.accountNumber===t.id&&((o=e.status)===null||o===void 0?void 0:o.toLowerCase())!==x.REMOVED.toLowerCase()})&&(t.disabled=!0,t.children&&t.children.length>0&&(t.expanded=!0)),t.children&&Array.isArray(t.children)&&t.children.forEach(e=>this.disableAssignedAccountsInTree(e))))}renderAccountsCard(){return c` <div class="accounts-card"> <div class="accounts-card-header" data-testid="${f.CARD_HEADER}"> <div class="dlr-text-heading accounts-card-header-text">Accounts</div> ${this.renderButton()} </div> <div class="accounts-card-body" data-testid="${f.CARD_BODY}"> ${this.contact.accounts.length>0?this.renderAccounts():c`You have no accounts`} </div> </div> `}renderButton(){return this.readonly?p:c`<ix-button data-testid="${f.BTN_ADD_ACCOUNT}" appearance="text" text="Add Account" has-icon @click="${this.handleAddAccounts}"> <md-icon slot="icon">add</md-icon> Add Account </ix-button>`}render(){return c` ${this.renderAccountsCard()} ${this.showAppendAccountWizard?c`<add-accounts-to-contact ?showDrawer="${!0}" .selectedAccount="${this.selectedAccount}" .contact="${O.get()}" @close-wizard="${()=>{this.showAppendAccountWizard=!1,document.body.style.overflow="auto",document.documentElement.style.overflow="initial"}}"></add-accounts-to-contact>`:p} `}};V.styles=[Ao,U],i([r()],V.prototype,"contact",void 0),i([r({type:Array,attribute:!1})],V.prototype,"assignableAccounts",void 0),i([r({type:String})],V.prototype,"activeAccountNumber",void 0),i([r({type:Boolean})],V.prototype,"readonly",void 0),i([d()],V.prototype,"selectedAccountNumber",void 0),i([d()],V.prototype,"activeAccountIndex",void 0),i([d()],V.prototype,"showAppendAccountWizard",void 0),i([d()],V.prototype,"selectedAccount",void 0),V=i([N("accounts-card")],V);const wo=tt`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.um-card{padding:.5rem;background:#fff;border-radius:12px 12px 0 0;box-shadow:rgba(0,0,0,.12) 0 12px 20px -12px,#e1e4e8 0 0 0 1px inset}#user-management{color:rgba(9,34,65,.7)}nav{margin-top:2px;margin-bottom:1.5rem}user-details{margin-bottom:16px}.crumbs ol{list-style-type:none;padding-left:0;display:flex}.crumb{display:inline-block}.crumb a::after{display:inline-block;padding:0 3px}.crumbs-separator{display:flex;user-select:none;margin-left:12.5px;margin-right:12.5px}#current-nav{pointer-events:none;cursor:default}@media only screen and (max-width:600px){.um-card.rounded-lg{border-radius:0;box-shadow:none}.user-details{margin:0 .5rem}}@media only screen and (max-width:767px){.user-details-view{margin:0 1rem}}@media only screen and (min-width:601px) and (max-width:1200px){.user-details-view{margin:0 1rem}.user-details-account-panel{display:flex;flex-direction:row}.user-details-account-panel>div{flex:1;width:50px}.user-details-account-panel>div:first-child{margin-top:6px}}`;class Eo{constructor(e){(this._host=e).addController(this)}hostConnected(){}hostDisconnected(){}hostUpdate(){}async getContact(e){return await rt.get({id:e})}}class J{}J.CRUMBS="user-management-details-view-crumbs",J.USER_DETAILS="user-management-details-view-user-details",J.ACCOUNTS_CARD="user-management-details-view-accounts-card",J.USER_DETAILS_PANEL="user-management-details-view-user-details-panel",J.USER_MANAGEMENT_PANEL="user-management-details-view-user-management-panel";let z=class extends lt{constructor(){super(...arguments),this.contactController=new Eo(this),this.roles=[],this.isPageLoading=!1,this.confirmationDialogIsOpen=!1,this.refreshAccountList=async()=>{var t;this.contact=await this.contactController.getContact(this.contactId),this.contact.accounts=ve(this.contact.accounts),O.set(this.contact);const e=(t=this.contact.accounts[0])===null||t===void 0?void 0:t.accountNumber;e&&await this.handleAccountChange(e,!0)}}get assignableAccounts(){return re().filter(t=>E.hasExternalUserUpdate(t.accountNumber))}get fullName(){var t,e;return`${(t=this.contact)===null||t===void 0?void 0:t.firstName} ${(e=this.contact)===null||e===void 0?void 0:e.lastName}`}get readonly(){var t,e,o,s,a;let n;return Xt().UserManagement.InternalUserRetired?n=E.hasUserUpdate((t=this.account)===null||t===void 0?void 0:t.accountNumber):n=Y((e=this.contact)===null||e===void 0?void 0:e.email)?E.hasInternalUserUpdate((o=this.account)===null||o===void 0?void 0:o.accountNumber):E.hasExternalUserUpdate((s=this.account)===null||s===void 0?void 0:s.accountNumber),!n||E.isProfileOfLoggedInUser((a=this.contact)===null||a===void 0?void 0:a.email)}async connectedCallback(){super.connectedCallback(),this.getCurrentContactFromUrl(),await E.refreshAccounts(),this.disposeReaction=Ae(()=>O.get(),()=>{this.contact=O.get()})}disconnectedCallback(){super.disconnectedCallback(),this.disposeReaction()}async firstUpdated(){P.clear(),ut.clear(),this.roles=Tt.get(),this.contact=await this.contactController.getContact(this.contactId),this.contact.accounts=ve(this.contact.accounts),O.set(this.contact)}async saveUser(){await rt.update({id:this.contact.id,contactInput:{...this.contact}}),O.refresh()}async getCurrentContactFromUrl(){this.contactId=new URL(window.location.href).searchParams.get("id")||void 0,this.contactId||to(Ot.UserManagement)}openDirtyPageWarning(t){this.confirmationDialogIsOpen=!0,this.requestedAccount=t}async handleAccountChange(t,e=!1){var o,s,a;if(!((o=this.contact)===null||o===void 0)&&o.accounts){if(!e&&!((s=this.userDetailsPanel)===null||s===void 0)&&s.isDirty){this.openDirtyPageWarning(t);return}this.account=[ut.get(),...this.contact.accounts].find(n=>n.accountNumber===t),this.userDetailsPanel=await this.userDetailsPanelAsync,(a=this.userDetailsPanel)===null||a===void 0||a.loadAccount()}}renderDialogs(){return c`<changes-confirmation id="confirmation-dialog" ?isOpen="${this.confirmationDialogIsOpen}" headerText="You have unsaved changes." bodyText="If you leave this account, you will lose the changes you made." confirmationButtonText="Discard Changes" cancelButtonText="Dismiss" @confirm="${async()=>{this.handleAccountChange(this.requestedAccount,!0);const t=await this.userDetailsPanel;t==null||t.resetForm(),this.confirmationDialogIsOpen=!1}}" @cancel="${()=>{this.confirmationDialogIsOpen=!1}}"> </changes-confirmation> <before-leave-dialog .isDirtyCallback="${()=>{var t;return(t=this.userDetailsPanel)===null||t===void 0?void 0:t.isDirty}}"> </before-leave-dialog>`}renderLoading(){return c`<ix-progress aria-label="User details panel" indeterminate> </ix-progress>`}renderContent(){var t,e,o;return!this.contact||!this.contact.accounts?this.renderLoading():c` <div class="flex flex-col h-full overflow-hidden lg:flex-row gap-6"> <div class="lg:w-1/3 user-details-view"> <nav class="crumbs" data-testid="${J.CRUMBS}"> <ol> <li class="crumb"> <a id="user-management" href="${he(Ot.UserManagement)}">User Management</a> </li> <li class="crumbs-separator">></li> <li class="crumb"> <a id="current-nav" href="${he(Ot.UserManagementDetails)}">${c`${this.fullName}`}</a> </li> </ol> </nav> <div class="user-details-account-panel"> <div> <user-details-view data-testid="${J.USER_DETAILS}" .contact="${O.get()}" .saveChanges="${()=>this.saveUser()}" .selectedAccountNumber="${(t=this.account)===null||t===void 0?void 0:t.accountNumber}"></user-details-view> </div> <div> <accounts-card data-testid="${J.ACCOUNTS_CARD}" .contact="${O.get()}" .activeAccountNumber="${(o=(e=this.account)===null||e===void 0?void 0:e.accountNumber)!==null&&o!==void 0?o:""}" .assignableAccounts="${this.assignableAccounts}" .readonly="${this.readonly}" @refresh-accounts-list="${this.refreshAccountList}" @change-account="${s=>this.handleAccountChange(s.detail.accountNumber,s.detail.overrideUnsavedChanges)}"></accounts-card> </div> </div> </div> <div class="rounded-lg um-card grow overflow-auto md:mx-4 lg:mx-0"> <user-details-panel data-testid="${J.USER_MANAGEMENT_PANEL}" id="user-management-panel" .contact="${O.get()}" .account="${this.account}" .roles="${this.roles}" .readonly="${this.readonly}" @reload-account="${s=>this.handleAccountChange(s.detail.accountNumber,s.detail.overrideUnsavedChanges)}"> </user-details-panel> </div> </div> ${this.renderDialogs()} `}render(){return this.isPageLoading?this.renderLoading():this.renderContent()}};z.styles=[wo,U],i([d()],z.prototype,"account",void 0),i([d()],z.prototype,"contact",void 0),i([d()],z.prototype,"contactId",void 0),i([d()],z.prototype,"roles",void 0),i([d()],z.prototype,"isPageLoading",void 0),i([d()],z.prototype,"confirmationDialogIsOpen",void 0),i([W("#user-management-panel")],z.prototype,"userDetailsPanelAsync",void 0),z=i([N("user-management-details-view")],z);export{z as UserManagementDetailsView};
|
|
1
|
+
import{__decorate as i}from"tslib";import{LitElement as H,html as c,nothing as p,css as tt}from"lit";import{property as r,query as C,queryAsync as W,customElement as N,state as d}from"lit/decorators.js";import{MobxLitElement as lt}from"@adobe/lit-mobx";import{reaction as Ae}from"mobx";import{elementTheme as nt,baseTheme as Ft}from"@digital-realty/theme";import{cache as $e}from"lit/directives/cache.js";import{E as vt,U as $t,T as U,A as dt,u as rt,F as we,G as wt,H as Lt,I as Bt,y as Et,x as et,B as Pt,J as ut,K as gt,c as E,L as Vt,M as Ee,N as zt,O as Ht,P as jt,Q as Kt,S as k,V as ot,W as qt,X as Gt,Y as Wt,Z as Yt,_ as Dt,$ as Qt,a0 as Zt,e as Jt,a1 as De,C as Re,a2 as Rt,a3 as Y,a4 as Ct,D as Xt,a5 as Ce,a6 as Ne,a7 as Se,a8 as _e,a9 as Ie,s as Nt,aa as te,ab as Te,ac as ht,ad as ee,p as St,ae as oe,af as Oe,ag as Ue,ah as se,ai as ie,aj as Me,ak as ae,al as ke,am as ne,an as _t,ao as ce,ap as Fe,aq as le,ar as Le,as as Be,at as I,au as Pe,av as Ve,aw as ze,ax as He,ay as je,z as Ke,az as qe,aA as de,aB as Ge,j as re,k as We,l as Ye,a as It,aC as Qe,f as Tt,aD as Ze,aE as ue,aF as Je,v as Xe,n as to,g as he,R as Ot}from"./ui-user-management.js";import"@digital-realty/ix-tabs/ix-tabs.js";import"@digital-realty/ix-tabs/ix-primary-tab.js";import{format as eo}from"date-fns";import"@digital-realty/ix-button/ix-button.js";import"@digital-realty/ix-date/ix-date.js";import"@digital-realty/ix-menu/ix-menu.js";import"@digital-realty/ix-menu/ix-menu-item.js";import"@digital-realty/ix-progress/ix-progress.js";import{findChildNodeById as oo,updateNodeCheckedStatus as Ut,isAnyNodeChecked as so,calculateCheckedEndNodesCount as io}from"@digital-realty/ix-generic-tree";import{keyed as pe}from"lit/directives/keyed.js";import"@digital-realty/ix-dialog/ix-dialog.js";import"@digital-realty/ix-select/ix-select.js";import"@digital-realty/ix-select/ix-select-option.js";import"@digital-realty/ix-file-uploader/ix-file-uploader.js";import"@digital-realty/ix-phone-input/ix-phone-input.js";import"@digital-realty/ix-textbox/ix-textbox.js";import"@digital-realty/ix-checkbox/ix-checkbox.js";import"@digital-realty/ix-phone-number/ix-phone-number.js";import"@digital-realty/ix-divider/ix-divider.js";import{computePosition as ao,offset as no,flip as co,shift as lo}from"@floating-ui/dom";import"@digital-realty/ix-icon/ix-icon.js";import"@digital-realty/ix-icon-button/ix-icon-button.js";import"@digital-realty/ix-tree/ix-tree.js";import"@digital-realty/ix-multi-select/ix-multi-select.js";import"./ui-user-management5.js";import"toastify-js";import"@microsoft/applicationinsights-web";import"graphql-request";import"oidc-client-ts";import"i18next";import"lit-i18n";import"@vaadin/router";import"libphonenumber-js";import"lit/directives/class-map.js";import"validator";import"lit/directives/ref.js";import"lit/directives/repeat.js";import"@digital-realty/ix-card/ix-card.js";import"lodash.debounce";import"@digital-realty/ix-generic-tree/ix-generic-tree.js";import"@digital-realty/ix-accordion/ix-accordion.js";import"@material/web/icon/icon.js";const ro={ACTIVE:"Active",DRAFT:"Draft",INVITED:"Invited",REMOVED:"Removed",SUSPENDED:"Suspended",DECLINED:"Declined"},me={ACTIVE:"check_circle",DRAFT:"edit",INVITED:"mail",REMOVED:"delete_forever",SUSPENDED:"warning",DECLINED:"do_not_disturb_on"},x={ACTIVE:"ACTIVE",DRAFT:"DRAFT",INVITED:"INVITED",DECLINED:"DECLINED",SUSPENDED:"SUSPENDED",REMOVED:"REMOVED"},Mt={ACTIVE:"#4CAF50",DRAFT:"#1456E0",SUSPENDED:"#DB0028",INVITED:"rgb(255, 152, 0)",REMOVED:"rgb(109, 117, 140)",DECLINED:"rgb(109, 117, 140)"},Q={ROLES:{key:"roles",text:"ROLES AND PORTAL ACCESS"},USERFLAGS:{key:"flags",text:"USER FLAGS"}};class st{}st.USER_DETAILS_NAVIGATION="user-details-navigation",st.USER_DETAILS_TABS="user-details-navigation-tabs",st.TAB=t=>`user-details-navigation-tab-${t}`,st.MODIFICATION_DETAILS="user-details-navigation-modification-details";let j=class extends H{constructor(){super(...arguments),this.disableEscapeKeyBinding=this.disableEscapeKey.bind(this),this.view=Q.ROLES,this.showFlags=!1,this.showRoles=!0,this.showModificationDetails=!1}get viewIndex(){return this.view===Q.ROLES?0:1}connectedCallback(){super.connectedCallback(),this.tabs&&this.tabs.addEventListener("keydown",this.disableEscapeKeyBinding)}disconnectedCallback(){super.disconnectedCallback(),this.tabs&&this.tabs.removeEventListener("keydown",this.disableEscapeKeyBinding)}disableEscapeKey(t){return t.which===27?!1:null}firstUpdated(){this.tabsAsync.then(t=>{t.activeTabIndex=this.viewIndex})}dispatchNavigationEvent(t){this.navigate&&(this.view=t,this.navigate(t))}renderNavigation(t){return c`<ix-primary-tab @click="${()=>this.dispatchNavigationEvent(t)}" .activeDisabled="${t.key===this.view.key}" data-testid="${st.TAB(t.key)}"><span class="font-bold flex items-center uppercase">${t.text}</span> </ix-primary-tab>`}renderTabs(){return!this.showRoles&&!this.showFlags?p:c`<ix-tabs id="navigation-tabs" hideScrollBar left-align data-testid="${st.USER_DETAILS_TABS}"> ${this.renderNavigation(Q.ROLES)} ${this.showFlags?this.renderNavigation(Q.USERFLAGS):p} </ix-tabs>`}dispatchOpenModificationDetails(){this.dispatchEvent(new CustomEvent(dt.OpenModificationDetails,{bubbles:!0,composed:!0}))}renderModificationDetails(){return this.showModificationDetails?c` <ix-button data-testid="${st.MODIFICATION_DETAILS}" appearance="text" @click="${()=>this.dispatchOpenModificationDetails()}" class="primary" aria-label="Modification Details"> Modification Details </ix-button> `:p}render(){return c` <div class="user-detail-navigation-contents" data-testid="${st.USER_DETAILS_NAVIGATION}"> ${this.renderTabs()} ${this.renderModificationDetails()} </div> <div class="user-detail-navigation"></div>`}};j.styles=[vt,$t,U,nt],i([r({type:Object})],j.prototype,"navigate",void 0),i([r({type:Object})],j.prototype,"view",void 0),i([r({type:Boolean})],j.prototype,"showFlags",void 0),i([r({type:Boolean})],j.prototype,"showRoles",void 0),i([r({type:Boolean})],j.prototype,"showModificationDetails",void 0),i([C("#navigation-tabs")],j.prototype,"tabs",void 0),i([W("#navigation-tabs")],j.prototype,"tabsAsync",void 0),j=i([N("user-details-navigation")],j);class K{}K.HEADER="view-modification-details-header",K.ON_BEHALF_OF="view-modification-details-on-behalf-of",K.DOCUMENTS="view-modification-details-documents",K.CLOSE_BUTTON="view-modification-details-close-button",K.DOCUMENT_LINK=t=>`view-modification-details-document-link-${t}`;const uo=tt`.authority-documents{display:flex;flex-wrap:wrap;gap:10px;max-width:560px}.authority-document{background-color:#f5f7ff;width:fit-content;max-width:250px;height:40px;box-sizing:border-box}.authority-document button{display:flex;align-items:center;max-width:100%;min-width:0;height:100%;padding:0 15px;box-sizing:border-box;border:0;background:0 0;font:inherit;color:inherit;cursor:pointer}.authority-document-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.authority-document-extension{flex-shrink:0;white-space:nowrap}.modification-details-label{padding:0 0 8px 0}[slot=content]{padding-top:12px;min-width:min(520px,calc(100vw - 32px))}[slot=content]+[slot=content]{padding-top:24px}#confirmation-header{padding-bottom:12px}`;let Z=class extends H{constructor(){super(...arguments),this.isOpen=!1,this.loading=!1,this.obofMessage="",this.handleEscapeKeyBinding=this.handleEscapeKey.bind(this),this.handleCancelChangesBinding=this.handleCancelChanges.bind(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this.handleEscapeKeyBinding),this.addEventListener("blur",this.handleCancelChangesBinding)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this.handleEscapeKeyBinding),this.removeEventListener("blur",this.handleCancelChangesBinding)}updated(t){super.updated(t),t.has("isOpen")&&this.isOpen&&this.loadObofMessage()}handleEscapeKey(t){return t.which===27&&(this.isOpen=!1),null}handleOpenDialog(){this.isOpen=!0}async loadObofMessage(){this.obofMessage="",this.obofMessage=await this.getObofMessage()}async getObofMessage(){var t,e;const o=(e=(t=this.changeHistory)===null||t===void 0?void 0:t.authoriserDetails)===null||e===void 0?void 0:e.find(s=>{var a;return s.accountNumber===((a=this.account)===null||a===void 0?void 0:a.accountNumber)});switch(o==null?void 0:o.reason){case"REQUESTED_BY_CUSTOMER":{if(!o.authoriserUserId)return"Authorized User";const s=await rt.get({id:o.authoriserUserId,failSilently:!0});return s!=null&&s.firstName&&s!=null&&s.lastName?`${s.firstName} ${s.lastName}`:"Authorized User"}case"NEW_CUSTOMER":return"New Customer";default:return"No User with Proper Permissions Available"}}async handleCancelChanges(){this.isOpen=!1}renderHeader(){return c` <div id="confirmation-header" slot="headline" data-testid="${K.HEADER}"> <h1 class="dlr-text-heading break-words">Modification Details</h1> </div>`}renderOnBehalfOf(){var t,e;const o=!((t=this.changeHistory)===null||t===void 0)&&t.createdAt?eo(new Date(this.changeHistory.createdAt),((e=this.userProfileSettings)===null||e===void 0?void 0:e.preferredDateFormat)||"yyyy/MM/dd"):"";return c`<div slot="content" method="dialog" data-testid="${K.ON_BEHALF_OF}"> <div class="modification-details-label">Modified on behalf of:</div> <div>${this.obofMessage} on ${o}</div> </div>`}async downloadAuthorityDocument(t){const e=await we.download(t.authorityDocumentId);if(!e)return;const o=URL.createObjectURL(e),s=document.createElement("a");s.href=o,s.download=t.fileName,document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(o)}getAuthorityDocuments(){var t;const e=(t=this.changeHistory)===null||t===void 0?void 0:t.authorityDocuments;return!e||e.length===0?"":e.map(o=>{var s,a;if(!o.authorityDocumentId)return"";const n=(a=(s=o.fileName)===null||s===void 0?void 0:s.lastIndexOf("."))!==null&&a!==void 0?a:0,l=n>0?o.fileName.substring(0,n):o.fileName,u=n>0?o.fileName.substring(n):"";return c` <li class="authority-document"> <button type="button" @click="${()=>this.downloadAuthorityDocument(o)}" data-testid="${K.DOCUMENT_LINK(o.authorityDocumentId)}"> <span class="authority-document-name">${l}</span> <span class="authority-document-extension">${u}</span> </button> </li>`})}renderDocuments(){return c`<div slot="content" method="dialog" data-testid="${K.DOCUMENTS}"> <div class="modification-details-label">Document(s) of Request</div> <ul class="authority-documents"> ${this.getAuthorityDocuments()} </ul> </div>`}renderFooter(){return c` <div class="add-roles-dialog-actions" slot="actions"> <ix-button form="confirm-updates" appearance="text" text="Close" ?disabled="${this.loading}" @click="${()=>this.handleCancelChanges()}" data-testid="${K.CLOSE_BUTTON}"> Close </ix-button> </div> `}render(){return c` <ix-dialog class="z-50 relative" id="view-modification-details" ?open="${this.isOpen}"> ${this.renderHeader()} ${this.renderOnBehalfOf()} ${this.renderDocuments()} ${this.renderFooter()} </ix-dialog>`}};Z.styles=[uo,U],i([r({type:Object})],Z.prototype,"account",void 0),i([r({type:Object})],Z.prototype,"userProfileSettings",void 0),i([r({type:Object})],Z.prototype,"changeHistory",void 0),i([r({type:Boolean,reflect:!0})],Z.prototype,"isOpen",void 0),i([d()],Z.prototype,"loading",void 0),i([d()],Z.prototype,"obofMessage",void 0),Z=i([N("view-modification-details")],Z);var T;(function(t){t[t.hidden=0]="hidden",t[t.disabled=1]="disabled",t[t.enabled=2]="enabled"})(T||(T={}));const bt={Active:"ACTIVE",Draft:"DRAFT",Invited:"INVITED",Suspended:"SUSPENDED",Removed:"REMOVED",Declined:"DECLINED"},ho=async(t,e,o)=>{const s={contactId:e,accountNumber:t,changeHistoryId:o};return await wt.create({accountAssociationInput:s})},ft=async(t,e,o,s)=>{const a=(await wt.get({accountNumber:t,contactId:e})).find(n=>n.accountNumber===t);if(!(a!=null&&a.id))throw new Error("Account data not found.");return await wt.update({id:a.id,accountAssociationStatusUpdate:{status:o,changeHistoryId:s}})},ve=t=>{const e=Object.keys(x);return t.sort((o,s)=>e.indexOf(o.status)-e.indexOf(s.status))};var pt;(function(t){t.Checked="CHECKED",t.Indeterminate="INDETERMINATE",t.Inherited="INHERITED",t.Unchecked="UNCHECKED"})(pt||(pt={}));const po=async(t,e)=>await Bt.get({contactId:t,accountNumber:e}),mo=async t=>{for(const e of t)Bt.delete({id:e.id})},ge=async(t,e,o,s)=>{const a={accountNumber:e,contactId:t,flagLocations:[],changeHistoryId:s};return o.forEach(n=>{const l={flag:n.key,locations:[]};n.items.forEach(u=>{if(!u.customerKnownSpaceName&&u.label!=="Global")throw new Error("Customer Known Space Name is missing.");l.locations.push({id:u.id,customerKnownName:u.customerKnownSpaceName,permissionStatus:u.checked?pt.Checked:pt.Unchecked})}),a.flagLocations.push(l)}),Lt.saveAccountFlagInventory(a)},be=async(t,e)=>await Et.get({contactId:t,accountNumber:e}),fe=async(t,e)=>{await Promise.all(t.map(o=>Et.delete({id:o.id,changeHistoryId:e})))},ye=async(t,e,o,s)=>{const a={accountNumber:e,contactId:t,roleLocations:[],changeHistoryId:s};return o.forEach(n=>{const l={roleId:n.key,locations:[]};n.items.forEach(u=>{if(!u.customerKnownSpaceName&&u.label!=="Global")throw new Error("Customer Known Space Name is missing.");l.locations.push({id:u.id,customerKnownName:u.customerKnownSpaceName,permissionStatus:u.checked?pt.Checked:pt.Unchecked})}),a.roleLocations.push(l)}),Lt.saveAccountRoleInventory(a)};class xe{constructor(e){(this._host=e).addController(this)}hostConnected(){}hostDisconnected(){}hostUpdate(){}async add(e,o,s=!0,a=void 0){try{const n=await ho(e,o,a);if(n)return a||await ft(e,o,bt.Active,a),s&&et("Account association added.",3e3,"center"),n;throw new Error("Account association could not be created.")}catch(n){return null}}async restore(e,o,s=!0,a=void 0){try{await ft(e,o,bt.Active,a),s&&et("Account association restored.",3e3,"center")}catch(n){throw new Error("Account association could not be restored.")}}async suspend(e,o){try{await ft(e,o,bt.Suspended),et("Account association suspended.",3e3,"center")}catch(s){throw new Error("Account association could not be suspended.")}}async remove(e,o){try{await ft(e,o,bt.Removed);const s=await po(o,e);await mo(s);const a=(await be(o,e)).filter(n=>n.isActive);await fe(a),et("Account association removed.",3e3,"center")}catch(s){throw new Error("Account association could not be removed.")}}}class vo extends Pt{async refresh(){const e=await rt.get({id:this.get().id});e&&this.set(e)}}const O=new vo({});class b{}b.BTN_RESTORE_ACCESS="udc-btn-restore-access",b.BTN_SUSPEND_ACCESS="udc-btn-suspend-access",b.BTN_REMOVE_ACCOUNT="udc-btn-remove-account",b.BTN_RESEND_INVITE="udc-btn-resend-invite",b.BTN_DRAFT_CANCEL="udc-btn-draft-cancel",b.BTN_DRAFT_SAVE="udc-btn-draft-save",b.ACCOUNT_NAME="udc-account-name",b.ACCOUNT_STATUS="udc-account-status",b.BTN_SAVE="udc-btn-save",b.BTN_CANCEL="udc-btn-cancel",b.MODIFICATION_DETAILS="udc-modification-details";let $=class extends lt{constructor(){super(...arguments),this.accountAssociationController=new xe(this),this.roles=[],this.saveControls=T.hidden,this.isLoading=!1,this.readonly=!1,this.showModificationDetails=!1,this.actionsDisabled=!1,this.removeAccountDialogOpen=!1,this.suspendingAccess=!1,this.restoringAccess=!1,this.removingAccount=!1,this.savingChanges=!1,this.cancellingChanges=!1,this.mobileMenuOpen=!1}statusIcon(t){return me[t]}dispatchUpdateEvent(){this.dispatchEvent(new CustomEvent(dt.UpdateChanges,{detail:"no-toast"}))}dispatchReloadAccountEvent(t=!1){var e;this.dispatchEvent(new CustomEvent(dt.ReloadAccount,{detail:{accountNumber:(e=this.account)===null||e===void 0?void 0:e.accountNumber,overrideUnsavedChanges:t}}))}async addAccount(){var t,e,o;this.actionsDisabled=!0,this.savingChanges=!0,!((t=this.contact)===null||t===void 0)&&t.accounts.some(s=>{var a;return s.accountNumber===((a=this.account)===null||a===void 0?void 0:a.accountNumber)&&s.status==="REMOVED"})?await this.accountAssociationController.restore((e=this.account)===null||e===void 0?void 0:e.accountNumber,this.contact.id):await this.accountAssociationController.add((o=this.account)===null||o===void 0?void 0:o.accountNumber,this.contact.id),this.emitRoleUpdates&&await this.emitRoleUpdates(),await O.refresh(),ut.clear(),this.dispatchUpdateEvent(),this.actionsDisabled=!1,this.savingChanges=!1}async restoreAccount(){var t;this.actionsDisabled=!0,this.restoringAccess=!0,await this.accountAssociationController.restore((t=this.account)===null||t===void 0?void 0:t.accountNumber,this.contact.id),await O.refresh(),this.dispatchReloadAccountEvent(!0),this.actionsDisabled=!1,this.restoringAccess=!1}async suspendAccount(){var t;this.actionsDisabled=!0,this.suspendingAccess=!0,await this.accountAssociationController.suspend((t=this.account)===null||t===void 0?void 0:t.accountNumber,this.contact.id),await O.refresh(),this.dispatchReloadAccountEvent(!0),this.actionsDisabled=!1,this.suspendingAccess=!1}async removeAccount(){var t;this.actionsDisabled=!0,this.removingAccount=!0,await this.accountAssociationController.remove((t=this.account)===null||t===void 0?void 0:t.accountNumber,this.contact.id),await O.refresh(),this.actionsDisabled=!1,this.removingAccount=!1,this.removeAccountDialogOpen=!1,this.dispatchReloadAccountEvent()}cancelChanges(){var t,e,o;this.actionsDisabled=!0;const s=`${ut.get().accountNumber}:${(t=this.contact)===null||t===void 0?void 0:t.id}`;if(gt.remove(s),!(!((e=this.contact)===null||e===void 0)&&e.accounts.find(a=>{var n;return a.accountNumber===((n=this.account)===null||n===void 0?void 0:n.accountNumber)}))){const[a]=((o=this.contact)===null||o===void 0?void 0:o.accounts)||[];a&&(this.account=a)}this.dispatchReloadAccountEvent(!0),this.actionsDisabled=!1}openMobileOptions(){this.mobileMenuOpen=!this.mobileMenuOpen}resendInvite(){et("Invitation has been re-sent.",3e3,"center")}renderRemoveAccountButton(){return c`<ix-button appearance="filled" class="cancel" ?disabled="${this.actionsDisabled}" @click="${()=>{this.removeAccountDialogOpen=!0}}" id="remove-account-button" data-testid="${b.BTN_REMOVE_ACCOUNT}"><span class="remove-account">Remove Account</span></ix-button>`}renderRestoreSuspendRemove(){var t,e,o;return this.isLoading?p:this.saveControls?p:this.readonly?p:((t=this.account)===null||t===void 0?void 0:t.status)===x.SUSPENDED?c`<ix-button @click="${this.restoreAccount}" ?disabled="${this.actionsDisabled&&!this.restoringAccess}" ?submitting="${this.restoringAccess}" id="restore-account-button" class="mr-1" data-testid="${b.BTN_RESTORE_ACCESS}"> <span class="font-bold">Restore Access</span> </ix-button> ${this.renderRemoveAccountButton()}`:((e=this.account)===null||e===void 0?void 0:e.status)===x.ACTIVE?c`<ix-button id="suspend-button" class="suspend-button cancel" appearance="outlined" ?disabled="${this.actionsDisabled&&!this.suspendingAccess}" ?submitting="${this.suspendingAccess}" @click="${this.suspendAccount}" data-testid="${b.BTN_SUSPEND_ACCESS}"> Suspend Access </ix-button> ${this.renderRemoveAccountButton()}`:((o=this.account)===null||o===void 0?void 0:o.status)===x.INVITED?c` ${this.renderRemoveAccountButton()}`:p}renderRestoreSuspendRemoveMobile(){var t,e,o,s,a;return this.isLoading?p:this.saveControls?p:E.isProfileOfLoggedInUser((t=this.contact)===null||t===void 0?void 0:t.email)?p:!E.hasExternalUserUpdate((e=this.account)===null||e===void 0?void 0:e.accountNumber)&&!E.hasExternalUserCreate((o=this.account)===null||o===void 0?void 0:o.accountNumber)?p:((s=this.account)===null||s===void 0?void 0:s.status)===x.SUSPENDED?c`<ix-menu-item @click="${this.restoreAccount}"><span class="font-bold">Restore Access</span> </ix-menu-item> <ix-menu-item @click="${()=>{this.removeAccountDialogOpen=!0}}"><span class="font-bold">Remove Account</span> </ix-menu-item>`:((a=this.account)===null||a===void 0?void 0:a.status)===x.ACTIVE?c`<ix-menu-item @click="${this.suspendAccount}"><span class="font-bold">Suspend Access</span> </ix-menu-item> <ix-menu-item @click="${()=>{this.removeAccountDialogOpen=!0}}"><span class="font-bold">Remove Account</span> </ix-menu-item>`:p}renderResendInviteButton(){var t;return((t=this.account)===null||t===void 0?void 0:t.status)!==x.INVITED||this.isLoading?p:c`<ix-button appearance="filled" @click="${()=>this.resendInvite()}" id="resend-invite-button" data-testid="${b.BTN_RESEND_INVITE}"><span class="font-bold">Resend <br>Invite</span> </ix-button>`}renderButtons(){return this.isLoading||this.saveControls===T.hidden?p:c`<div id="draft-assignment-controls" class="panel-button-container"> <ix-button appearance="outlined" ?disabled="${this.actionsDisabled}" ?submitting="${this.cancellingChanges}" @click="${()=>this.cancelChanges()}" id="cancel-role-button" data-testid="${b.BTN_CANCEL}"> Cancel </ix-button> <ix-button id="save-role-button" ?disabled="${this.saveControls===T.disabled||this.actionsDisabled}" ?submitting="${this.savingChanges}" @click="${this.dispatchUpdateEvent}" data-testid="${b.BTN_SAVE}"> Save </ix-button> </div>`}renderDraftButtons(){return this.isLoading?p:c`<div id="draft-association-controls" class="panel-button-container"> <ix-button id="cancel-role-button" appearance="outlined" ?disabled="${this.actionsDisabled}" @click="${this.cancelChanges}" data-testid="${b.BTN_DRAFT_CANCEL}"> Cancel </ix-button> <ix-button appearance="filled" id="save-role-button" ?disabled="${(this.actionsDisabled||this.saveControls===T.disabled||this.saveControls===T.hidden)&&!this.savingChanges}" ?submitting="${this.actionsDisabled}" @click="${this.addAccount}" data-testid="${b.BTN_DRAFT_SAVE}"> Save </ix-button> </div>`}renderStatus(){var t,e;if(!this.account||this.isLoading)return p;const o=this.account.status;return o===x.REMOVED?c`<div class="panel-status"> <p class="dlr-text-small" data-testid="${b.ACCOUNT_STATUS}">Account Removed</p> <ix-icon filled>${this.statusIcon(o)}</ix-icon> </div>`:o===x.DECLINED?c`<div class="panel-status"> <p class="dlr-text-small" data-testid="${b.ACCOUNT_STATUS}"> Account Invitation Declined By User </p> <ix-icon filled>${this.statusIcon(o)}</ix-icon> </div>`:o===x.SUSPENDED?c`<div class="panel-status"> <p class="dlr-text-small account-status-suspend" data-testid="${b.ACCOUNT_STATUS}"> Suspended on <ix-date type="static" value="${(t=this.account)===null||t===void 0?void 0:t.statusUpdateAt}"></ix-date> </p> <ix-icon filled class="warning text-2xl">${this.statusIcon(o)}</ix-icon> </div>`:this.account.status===x.INVITED?c`<div class="panel-status"> <p class="dlr-text-small" data-testid="${b.ACCOUNT_STATUS}"> Invited on <ix-date type="static" value="${(e=this.account)===null||e===void 0?void 0:e.statusUpdateAt}"></ix-date> </p> <ix-icon filled style="${`color: ${Mt[o]}`}">${this.statusIcon(o)}</ix-icon> </div>`:this.account.status===x.DRAFT?c`<div class="panel-status"> <p class="dlr-text-small" data-testid="${b.ACCOUNT_STATUS}">Draft</p> <ix-icon class="text-2xl" filled style="${`color: ${Mt[o]}`}">${this.statusIcon(o)}</ix-icon> </div>`:c`<div class="panel-status"> <ix-icon style="color:#4caf50" filled class="mt-1 text-2xl">${this.statusIcon(o)}</ix-icon> <p class="dlr-text-small" data-testid="${b.ACCOUNT_STATUS}">Active</p> </div>`}renderRemoveAccountConfirmation(){return c`<changes-confirmation id="remove-account-dialog" data-testid="remove-account-dialog" class="z-50 relative" ?isOpen="${this.removeAccountDialogOpen}" ?submitting="${this.removingAccount}" .headerText="${"The user will no longer be able to access this account."}" .confirmationButtonText="${"Remove Account"}" @confirm="${()=>{this.removeAccount()}}" @cancel="${()=>{this.removeAccountDialogOpen=!1}}"> </changes-confirmation>`}dispatchOpenModificationDetails(){this.dispatchEvent(new CustomEvent(dt.OpenModificationDetails,{bubbles:!0,composed:!0}))}renderModificationDetails(){return this.showModificationDetails?c` <ix-button data-testid="${b.MODIFICATION_DETAILS}" appearance="text" @click="${()=>this.dispatchOpenModificationDetails()}" class="primary" aria-label="Modification Details"> Modification Details </ix-button> `:p}render(){var t;return this.account?c`<div> <div class="flex items-center p-4 pb-0 lg:p-2 justify-between user-status"> <div class="flex items-center user-status-header"> <h1 class="dlr-text-heading lg:pl-4" data-testid="${b.ACCOUNT_NAME}"> ${(t=this.account.displayName)!==null&&t!==void 0?t:this.account.name} </h1> <span style="position:relative"> <ix-icon id="anchor" filled class="cursor-pointer mobile-options" @click="${this.openMobileOptions}">more_vert</ix-icon> <ix-menu anchor="anchor" ?open="${this.mobileMenuOpen}"> ${this.renderRestoreSuspendRemoveMobile()} </ix-menu> </span> </div> <div class="user-details-controls flex items-center pr-4"> ${this.renderStatus()} ${this.renderResendInviteButton()} ${this.renderRestoreSuspendRemove()} ${this.account.status===x.DRAFT?this.renderDraftButtons():this.renderButtons()} ${this.renderRemoveAccountConfirmation()} </div> </div> <div class="flex items-center pr-4">${this.renderModificationDetails()}</div> </div>`:p}};$.styles=[vt,$t,U,nt],i([r()],$.prototype,"account",void 0),i([r()],$.prototype,"contact",void 0),i([r()],$.prototype,"roles",void 0),i([r()],$.prototype,"saveControls",void 0),i([r()],$.prototype,"isLoading",void 0),i([r({type:Boolean})],$.prototype,"readonly",void 0),i([r({type:Boolean})],$.prototype,"showModificationDetails",void 0),i([d()],$.prototype,"actionsDisabled",void 0),i([d()],$.prototype,"removeAccountDialogOpen",void 0),i([d()],$.prototype,"suspendingAccess",void 0),i([d()],$.prototype,"restoringAccess",void 0),i([d()],$.prototype,"removingAccount",void 0),i([d()],$.prototype,"savingChanges",void 0),i([d()],$.prototype,"cancellingChanges",void 0),i([d()],$.prototype,"mobileMenuOpen",void 0),i([r()],$.prototype,"emitRoleUpdates",void 0),$=i([N("user-details-controls")],$);const go=tt`@font-face{font-family:'Material Icons';font-style:normal;font-weight:400;src:url(https://fonts.gstatic.com/s/materialicons/v145/flUhRq6tzZclQEJ-Vdg-IuiaDsNZ.ttf) format('truetype')}.material-icons{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr}ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.removed-account-container{padding:1.5rem;display:flex;flex-direction:column;gap:24px}.removed-account-row{display:flex;flex-direction:column;overflow-wrap:anywhere}.removed-account-title{margin:0;text-transform:uppercase;color:rgba(9,34,65,.7)}.removed-account-text{margin:0;color:#092241}`;let q=class extends H{constructor(){super(...arguments),this.roles=[],this.userRoleAssignments=[]}get dateText(){return this.status==="DECLINED"?"Account Invitation Declined By User On":"Account Removed On"}renderRoles(){var t;return this.roles&&((t=this.role)===null||t===void 0?void 0:t.length)===1?c`${this.roles[0].name}`:this.userRoleAssignments.map(e=>c`${e.name}<br>`)}update(t){(t.has("contactID")||t.has("accountNumber"))&&this.getRoleAssignments(),super.update(t)}async getRoleAssignments(){if(!this.contactID)return;const t=await Et.get({contactId:this.contactID,accountNumber:this.accountNumber}),e=new Set(t.map(o=>o.roleId));this.userRoleAssignments=this.roles.filter(o=>e.has(o.id))}render(){return c`<div class="removed-account-container"> <div class="removed-account-row"> <span class="removed-account-title">${this.dateText}</span> <p class="removed-account-text"> <ix-date type="static" value="${this.changedAt}"></ix-date> </p> </div> ${this.status==="REMOVED"?c`<div class="removed-account-row"> <span class="removed-account-title">Account Removed by</span> <p class="removed-account-text">${this.changedBy}</p> </div>`:p} <div class="removed-account-row"> <span class="removed-account-title">Roles</span> <p class="removed-account-text">${this.renderRoles()}</p> </div> </div>`}};q.styles=[go],i([r({type:String})],q.prototype,"status",void 0),i([r({type:String})],q.prototype,"accountNumber",void 0),i([r({type:String})],q.prototype,"contactID",void 0),i([r({type:Array,attribute:!1})],q.prototype,"roles",void 0),i([r({type:String,attribute:!1})],q.prototype,"changedBy",void 0),i([r({type:String,attribute:!1})],q.prototype,"changedAt",void 0),i([d()],q.prototype,"userRoleAssignments",void 0),q=i([N("user-account-removed-declined")],q);class bo extends Pt{getAsRoles(){return Vt(this.get())}removeRole(e){const o=this.get().filter(s=>s.roleId!==e);this.set(o)}}const P=new bo([]);class it{}it.DIALOG_ADD_ROLE="user-details-panel-dialog-add-role",it.DIALOG_REMOVE_ROLE="user-details-panel-dialog-remove-role",it.DIALOG_MODIFICATION_DETAILS="user-details-panel-dialog-modification-details",it.PROGRESS_BAR="user-details-panel-progress-bar";let S=class extends H{constructor(){super(...arguments),this.isOpen=!1,this.obofEnabled=!1,this.accountId="",this.attachments=[],this.obofCreators=[],this._loading=!1,this._selectedObofValue="",this._selectedObofDisplayText="",this._obofCreators=[],this._accountHasUsers=!1,this._showDocumentUpload=!1,this._uploaderInstanceKey=0,this._attachmentManager=Ee()}async connectedCallback(){super.connectedCallback(),this._attachmentManager.setDocumentsRequired(!0),this.obofEnabled&&this.accountId&&await this.loadObofCreators()}async updated(t){super.updated(t),t.has("isOpen")&&this.isOpen&&(this._uploaderInstanceKey+=1,this._attachmentManager.clearAll(),this.syncSelectedObofStateFromProperty()),t.has("selectedObof")&&this.isOpen&&this.syncSelectedObofStateFromProperty(),t.has("accountId")&&this.accountId&&(this.syncSelectedObofStateFromProperty(),this.obofEnabled&&await this.loadObofCreators())}syncSelectedObofStateFromProperty(){var t,e,o;this._selectedObofValue=(e=(t=this.selectedObof)===null||t===void 0?void 0:t.value)!==null&&e!==void 0?e:"",this._selectedObofDisplayText=((o=this.selectedObof)===null||o===void 0?void 0:o.displayText)||"",this.syncDocumentUploadRequirement()}syncDocumentUploadRequirement(){this._showDocumentUpload=!0,this._attachmentManager.setDocumentsRequired(!0)}async loadObofCreators(){this._loading=!0;try{const t=await zt(this.accountId,Ht);if(this._obofCreators=t.filter(e=>e.accountPermissionGroup===jt.OnBehalfUserUpdater),this._obofCreators.length===0){const e=await rt.search({accountNumber:this.accountId,page:0,size:1});this._accountHasUsers=e&&e.recordCount>0}else this._accountHasUsers=!0}catch(t){this._obofCreators=[],this._accountHasUsers=!1}finally{this._loading=!1,(this._selectedObofValue==="loading"||this._selectedObofDisplayText==="Loading users...")&&(this._selectedObofValue="",this._selectedObofDisplayText=""),this.syncDocumentUploadRequirement()}}onFileRemoved(t){if(!(t!=null&&t.detail))return;const e=t.detail.allFiles||[];this._attachmentManager.clearAll(),this._attachmentManager.addFiles(e),this.attachments=[...this._attachmentManager.attachments],this.dispatchAttachmentsUpdateEvent(this.attachments),this.requestUpdate()}onUploaded(t){const{filesUploaded:e}=t.detail,o=e.map(s=>s.file);this._attachmentManager.addFiles(o),o.some(s=>this._attachmentManager.getFileErrors(s.name).length>0)&&(this._uploaderInstanceKey+=1),this.attachments=[...this._attachmentManager.attachments],this.dispatchAttachmentsUpdateEvent(this.attachments),this.requestUpdate()}handleObofSelect(t,e){if(this._selectedObofValue=t,this._selectedObofDisplayText=e,this.syncDocumentUploadRequirement(),!t){this.dispatchObofSelectionEvent("","");return}this.dispatchObofSelectionEvent(t,e)}handleCancel(){this.dispatchEvent(new CustomEvent("cancel-modification",{bubbles:!0,composed:!0}))}handleOk(){if(!this._selectedObofValue||!this._attachmentManager.canProceed){this.requestUpdate();return}this.dispatchEvent(new CustomEvent("confirm-modification",{detail:{obofValue:this._selectedObofValue,obofDisplayText:this._selectedObofDisplayText,attachments:this.attachments},bubbles:!0,composed:!0}))}dispatchAttachmentsUpdateEvent(t){this.dispatchEvent(new CustomEvent("update-attachments",{detail:{attachments:t},bubbles:!0,composed:!0}))}dispatchObofSelectionEvent(t,e){this.dispatchEvent(new CustomEvent("update-obof-selection",{detail:{value:t,displayText:e},bubbles:!0,composed:!0}))}renderObofDropdown(){const t=Kt(this._loading,this._obofCreators.length,this._accountHasUsers);let e="";this._loading?e="Loading users...":this._selectedObofValue&&this._selectedObofDisplayText&&(e=this._selectedObofDisplayText);let o;return t==="loading"?o=c` <ix-select-option value="loading" display-text="Loading users..." disabled="disabled"> Loading users... </ix-select-option> `:t==="selectable"?o=c` ${this._obofCreators.map(s=>{const a=s.id;if(!a)return p;const n=`${s.firstName} ${s.lastName} (${s.email})`;return c` <ix-select-option value="${a}" display-text="${n}" ?selected="${this._selectedObofValue===a}" @click="${()=>this.handleObofSelect(a,n)}"> ${n} </ix-select-option> `})} `:t==="no-user"?o=c` <ix-select-option value="${k.NoUserAvailable}" display-text="${ot.noUserAvailable}" ?selected="${this._selectedObofValue===k.NoUserAvailable}" @click="${()=>this.handleObofSelect(k.NoUserAvailable,ot.noUserAvailable)}"> ${ot.noUserAvailable} </ix-select-option> `:o=c` <ix-select-option value="${k.NewCustomer}" display-text="${ot.newCustomer}" ?selected="${this._selectedObofValue===k.NewCustomer}" @click="${()=>this.handleObofSelect(k.NewCustomer,ot.newCustomer)}"> ${ot.newCustomer} </ix-select-option> `,c` <div style="margin-bottom:20px"> <label for="modification-obof-select" class="text-sm font-medium" style="display:block;margin-bottom:8px"> Modification on behalf of </label> <ix-select quick menu-below class="w-full" id="modification-obof-select" menu-positioning="fixed" label="${this._loading?"Loading users...":"Created on Behalf of*"}" .displayText="${e}" ?disabled="${this._loading}"> ${o} </ix-select> </div> `}renderDocumentUpload(){const t=qt(),e=Gt(),o=e.map(a=>a.toUpperCase()).join(", "),s=`Max file size is ${t} MB with accepted file formats of ${o}`;return c` <div> <label class="text-sm font-medium" style="display:block;margin-bottom:8px"> Document(s) of Request* </label> ${pe(this._uploaderInstanceKey,c` <ix-file-uploader .allowDeleteDefaultFiles="${!0}" .allowMultipleFiles="${!0}" .defaultFiles="${this.attachments}" .extensions="${e}" .maxFileSizeValue="${t}" .headerText="${"CLICK HERE TO BROWSE YOUR DEVICE OR DROP FILES TO UPLOAD"}" .bodyText="${s}" .hideBody="${!1}" .validateFile="${Wt}" @on-file-removed="${this.onFileRemoved}" @on-files-uploaded="${this.onUploaded}"></ix-file-uploader> `)} </div> `}render(){return c` <ix-dialog class="z-50 relative" id="modification-authority-modal" ?open="${this.isOpen}" @closed="${this.handleCancel}"> <div slot="headline"> <h1 class="dlr-text-heading">Modification Details</h1> </div> <div slot="content" style="padding:24px;width:min(600px,90vw);min-height:290px;box-sizing:border-box"> ${this.renderObofDropdown()} ${this._showDocumentUpload?this.renderDocumentUpload():p} </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.handleCancel}" ?disabled="${this._loading}"> CANCEL </ix-button> <ix-button appearance="text" @click="${this.handleOk}" ?disabled="${this._loading||!this._selectedObofValue||this._showDocumentUpload&&!this._attachmentManager.canProceed}"> OK </ix-button> </div> </ix-dialog> `}};S.styles=[vt,U,nt],i([r({type:Boolean})],S.prototype,"isOpen",void 0),i([r({type:Boolean})],S.prototype,"obofEnabled",void 0),i([r({type:String})],S.prototype,"accountId",void 0),i([r({type:Array})],S.prototype,"attachments",void 0),i([r({type:Object})],S.prototype,"selectedObof",void 0),i([r({type:Array})],S.prototype,"obofCreators",void 0),i([d()],S.prototype,"_loading",void 0),i([d()],S.prototype,"_selectedObofValue",void 0),i([d()],S.prototype,"_selectedObofDisplayText",void 0),i([d()],S.prototype,"_obofCreators",void 0),i([d()],S.prototype,"_accountHasUsers",void 0),i([d()],S.prototype,"_showDocumentUpload",void 0),i([d()],S.prototype,"_uploaderInstanceKey",void 0),S=i([N("modification-authority-modal")],S);let g=class extends lt{constructor(){super(...arguments),this.onSuccess=et,this.roles=[],this.userFlagTrees=[],this.assignedRoleTrees=[],this.readonly=!1,this.isPanelLoading=!1,this.roleAssignments=[],this.viewRoute=Q.ROLES,this.saveControls=T.hidden,this.flagUpdates=[],this.roleUpdates=[],this.removedRoleAssignments=[],this.activeRoleId="",this.permissionData=[],this.removeRoleDialogOpen=!1,this.modificationModalOpen=!1,this.modificationModalAttachments=[],this.redundantStatuses=["DECLINED","REMOVED"],this.emitRoleUpdates=async()=>{const t=await this.userDetailsAssignments;t&&t.emitUpdates()},this.saveAssignments=async t=>{var e;const o=this.roleUpdates.length>0||this.flagUpdates.length>0||this.removedRoleAssignments.length>0;if(this.obofEnabled&&o&&!((e=this.account)===null||e===void 0)&&e.accountNumber){this.modificationModalOpen=!0,this.modificationModalAttachments=[],this.modificationModalSelectedObof=void 0;return}await this.performSave(t)},this.handleModificationModalCancel=()=>{this.modificationModalOpen=!1,this.modificationModalAttachments=[],this.modificationModalSelectedObof=void 0},this.handleModificationModalConfirm=async t=>{var e;try{const{obofValue:o,obofDisplayText:s,attachments:a}=t.detail,n=a.length?await Yt(a):[],l=new Map([[this.account.accountNumber,new Dt(o,s||((e=this.modificationModalSelectedObof)===null||e===void 0?void 0:e.displayText)||"")]]),u=Qt(l);if(!(u!=null&&u.length))throw new Error("Failed to determine authoriser details for change history.");const v=await Zt({authoriserDetails:u,authorityDocuments:n.length?n:void 0});if(!(v!=null&&v.changeHistoryId))throw new Error("Failed to create change history.");this.modificationModalOpen=!1,this.modificationModalAttachments=[],this.modificationModalSelectedObof=void 0,await this.performSave(void 0,v.changeHistoryId)}catch(o){const s=o instanceof Error?o.message:"Failed to process modification request";Jt(s,3e3,"center")}},this.performSave=async(t,e)=>{var o,s,a;const n=`${(o=this.account)===null||o===void 0?void 0:o.accountNumber}:${(s=this.contact)===null||s===void 0?void 0:s.id}`,l=gt.capture(n);if(!this.flagUpdates.length&&l){gt.lock(n);for(const B of this.userFlagTrees)B.updateService=new De,l.forEach(X=>{var xt;const At=oo(B.rootNode,X.id);At&&(At.checked=!0,Ut(At,B.rootNode),(xt=B.updateService)===null||xt===void 0||xt.update(B.rootNode))}),B.updateService.updates.length&&this.flagUpdates.push({key:B.label,items:B.updateService.updates})}const u=await this.controlsComponent;if(u.actionsDisabled=!0,u.savingChanges=!0,!(this.roleUpdates.length>0||this.flagUpdates.length>0||this.removedRoleAssignments.length>0)){u.actionsDisabled=!1,u.savingChanges=!1;return}const v={role:void 0,flag:void 0},h=this.removedRoleAssignments.length>0;let m=!1;if(this.roleUpdates.length&&(v.role=await ye(this.contact.id,this.account.accountNumber,this.roleUpdates,e),P.clear(),this.roleUpdates=[]),this.flagUpdates.length&&(v.flag=await ge(this.contact.id,this.account.accountNumber,this.flagUpdates,e),v.flag&>.remove(n),this.flagUpdates=[]),this.removedRoleAssignments.length)try{await fe(this.removedRoleAssignments,e),this.removedRoleAssignments=[]}catch(B){m=!0}this.dispatchReloadAccountEvent((a=this.account)===null||a===void 0?void 0:a.accountNumber,!0),u.actionsDisabled=!1,u.savingChanges=!1,this.isPanelLoading=!1;const A=(t==null?void 0:t.detail)==="no-toast",R=!!v.flag||!!v.role||h&&!m,w=[];v.role===null&&w.push("role"),v.flag===null&&w.push("flag"),m&&w.push("role removal"),R&&!A&&et("Changes saved.",3e3,"center"),w.length>0&&Jt(`Could not save ${w.join(", ")} assignments.`,3e3,"center")},this.dispatchOpenConfirmation=()=>{this.removeRoleDialogOpen=!0},this.dispatchReloadAccountEvent=async(t,e=!1)=>{this.resetForm(),this.dispatchEvent(new CustomEvent(dt.ReloadAccount,{detail:{accountNumber:t,overrideUnsavedChanges:e}}))}}updated(t){super.updated(t),window.sessionStorage.setItem(Re.SessionStorage.HasOutstandingChanges,this.isDirty?"true":"false"),t.has("account")&&(this.viewRoute=Q.ROLES)}get fullName(){var t,e;return`${(t=this.contact)===null||t===void 0?void 0:t.firstName} ${(e=this.contact)===null||e===void 0?void 0:e.lastName}`}get obofEnabled(){var t;return Rt()&&!Y((t=this.contact)===null||t===void 0?void 0:t.email)}get canAddRoles(){return!this.readonly&&this.addableRoles.length>0}get canRemoveRoles(){var t;return!this.readonly&&((t=this.assignedRoles)===null||t===void 0?void 0:t.length)}get addRolesDisabled(){var t,e,o,s,a;if(!(!((t=this.account)===null||t===void 0)&&t.accountNumber))return!0;const n=Ct(this.account.accountNumber,this.roles,Y((e=this.contact)===null||e===void 0?void 0:e.email)&&E.hasAssignInternalRoleCreate((o=this.account)===null||o===void 0?void 0:o.accountNumber)).length;return((a=(s=this.assignedRoles)===null||s===void 0?void 0:s.length)!==null&&a!==void 0?a:0)>=n}get addableRoles(){return this.roles.filter(t=>{var e;return!(!((e=this.assignedRoles)===null||e===void 0)&&e.find(o=>o.id===t.id))})}get isDirty(){return this.roleUpdates.length>0||this.flagUpdates.length>0||P.get().length||this.removedRoleAssignments.length>0}get showUserFlags(){var t,e;return E.hasExternalUserRead((t=this.account)===null||t===void 0?void 0:t.accountNumber)&&((e=this.account)===null||e===void 0?void 0:e.status)!=="REMOVED"}get showRoles(){var t;return((t=this.account)===null||t===void 0?void 0:t.status)!=="REMOVED"}get showModificationDetails(){var t;return this.changeHistory&&E.hasUserRead((t=this.account)===null||t===void 0?void 0:t.accountNumber)}async firstUpdated(){this.account&&this.loadAccount()}async loadAccount(){const t=await this.userDetailsAssignments;t==null||t.assignmentUpdateManagers.forEach(e=>e.nodeManager.reset()),this.roleUpdates=[],this.flagUpdates=[],this.removedRoleAssignments=[],this.isPanelLoading=!0,await this.getAssignedRoles(),this.isPanelLoading=!1,this.displayDefaultRole(),this.setShowControls(),await this.loadUserProfileSettings(),await this.loadChangeHistory()}async loadUserProfileSettings(){this.userProfileSettings=await E.getUserProfileSettings()}async loadChangeHistory(){var t,e,o;if(!(!((t=this.contact)===null||t===void 0)&&t.id)||!(!((e=this.account)===null||e===void 0)&&e.accountNumber)||!Xt().EnableUMChangeHistory)return;const s=await Ce(this.contact.id,{accountNumber:this.account.accountNumber});this.changeHistory=(o=s.content)===null||o===void 0?void 0:o[0]}async getAssignedRoles(){this.roleAssignments=(await be(this.contact.id,this.account.accountNumber)).filter(t=>t.isActive),this.assignedRoles=[...Vt(this.roleAssignments),...P.getAsRoles()],await this.getRoleAndFlagTrees()}async getRoleAndFlagTrees(){var t,e,o;if(!(!((t=this.assignedRoles)===null||t===void 0)&&t.length))return;const s=this.assignedRoles.map(l=>l.id),[a,n]=await Ne(s,this.contact.id,this.account.accountNumber,Y((e=this.contact)===null||e===void 0?void 0:e.email));this.assignedRoleTrees=(o=structuredClone(a))===null||o===void 0?void 0:o.filter(l=>l!==void 0),this.userFlagTrees=structuredClone(n)}displayDefaultRole(){var t;!((t=this.assignedRoles)===null||t===void 0)&&t.length&&(this.activeRoleId=this.assignedRoles[0].id,this.selectRole(this.activeRoleId))}async selectRoleEventHandler(t){this.selectRole(t.detail.roleId)}async selectRole(t){this.activeRoleId=t;const e=await this.roleTabComponent;e==null||e.setActiveRole(this.activeRoleId),this.setShowControls()}setShowControls(){var t;if(this.isPanelLoading||((t=this.account)===null||t===void 0?void 0:t.status)===x.REMOVED){this.saveControls=T.hidden;return}const e=this.assignedRoleTrees.filter(o=>o!==void 0).every(o=>so(o.rootNode));P.get().length?this.saveControls=this.isDirty&&e?T.enabled:T.disabled:this.saveControls=this.isDirty?e?T.enabled:T.disabled:T.hidden}async addRole(t){const e=await this.addRoleDialog;e&&(e.isOpen=!1),this.isPanelLoading=!0;const o={roleId:t,contactId:this.contact.id,accountNumber:this.account.accountNumber,isActive:!0};P.set([...P.get(),o]);const s=Se(o.roleId);if(!s||!this.assignedRoles)return;this.assignedRoles=[...this.assignedRoles,s];const[a]=await _e([t],this.contact.id,this.account.accountNumber,Y(this.contact.email));this.assignedRoleTrees.push(a);const n=await this.addRoleDialog;n&&(n.isOpen=!1),this.isPanelLoading=!1,this.selectRole(s.id)}async removeRole(t){var e;const o=await this.userDetailsAssignments,s=this.assignedRoles.find(n=>n.id===t);if(!s)return;if(P.getAsRoles().findIndex(n=>n.id===s.id)>-1){P.removeRole(t);const n=o==null?void 0:o.assignmentUpdateManagers.find(l=>{var u;return l.accountId===((u=this.account)===null||u===void 0?void 0:u.accountNumber)});n&&n.nodeManager.nodeUpdates.find(l=>l.key===t)&&n.nodeManager.remove(t),this.assignedRoles=this.assignedRoles.filter(l=>l.id!==s.id),this.assignedRoleTrees=(e=this.assignedRoleTrees)===null||e===void 0?void 0:e.filter(l=>l!==void 0).filter(l=>l.role!==s.id)}else{const n=this.roleAssignments.filter(l=>l.roleId===t&&l.isActive);this.removedRoleAssignments=[...this.removedRoleAssignments,...n.filter(l=>!this.removedRoleAssignments.some(u=>u.id===l.id))],this.roleAssignments=this.roleAssignments.filter(l=>!(l.roleId===t&&l.isActive)),this.assignedRoles=this.assignedRoles.filter(l=>l.id!==s.id)}this.roleUpdates=this.roleUpdates.filter(n=>n.key!==t),this.assignedRoleTrees=this.assignedRoleTrees.filter(n=>!!n&&n.role!==s.id);const a=await this.roleTabComponent;a==null||a.requestUpdate("assignedRoles",[]),this.displayDefaultRole(),this.setShowControls()}resetForm(){this.displayDefaultRole(),this.roleUpdates=[],this.flagUpdates=[],this.removedRoleAssignments=[],ut.clear(),P.clear(),this.setShowControls()}updateView(t){this.viewRoute=t,t===Q.ROLES&&this.selectRole(this.activeRoleId)}async openAddRoleDialog(){const t=await this.addRoleDialog;t&&t.handleOpenDialog()}async openModificationDetailsDialog(){const t=await this.modificationDetailsDialog;t&&t.handleOpenDialog()}removeRoleButtonStatus(){var t,e;const o=P.get().map(a=>a.roleId),s=(e=((t=this.assignedRoles)!==null&&t!==void 0?t:[]).filter(a=>!o.includes(a.id)))!==null&&e!==void 0?e:[];return o.find(a=>a===this.activeRoleId)!=null?!1:s.length<2}renderPermissions(){var t,e;return!(!((t=this.assignedRoles)===null||t===void 0)&&t.length)||this.redundantStatuses.includes((e=this.account)===null||e===void 0?void 0:e.status)?p:c` <user-details-permission .activeRoleId="${this.activeRoleId}"> </user-details-permission> `}renderRemovedOrDeclinedAccount(){var t;return this.account?c` <user-account-removed-declined .status="${this.account.status}" .roles="${this.roles}" .accountNumber="${this.account.accountNumber}" .contactID="${(t=this.contact)===null||t===void 0?void 0:t.id}" .changedBy="${this.account.statusUpdateBy}" .changedAt="${this.account.statusUpdateAt}"></user-account-removed-declined> `:p}renderRoles(){return!this.account||!this.contact||!this.assignedRoles?p:this.redundantStatuses.includes(this.account.status)?p:c` <user-details-tab-roles id="role-data-element" .assignedRoles="${this.assignedRoles}" .activeRoleId="${this.activeRoleId}" .canRemoveRoles="${this.canRemoveRoles}" .canAddRoles="${this.canAddRoles}" .removeRolesDisabled="${this.removeRoleButtonStatus()}" .addRolesDisabled="${this.addRolesDisabled}" @role-select="${t=>this.selectRoleEventHandler(t)}" @open-role-menu="${()=>this.openAddRoleDialog()}" @open-remove-role-menu="${()=>this.dispatchOpenConfirmation()}"> </user-details-tab-roles> `}renderLoading(){return this.isPanelLoading?c`<ix-progress aria-label="User details panel" .indeterminate="${!0}" data-testid="${it.PROGRESS_BAR}"> </ix-progress>`:p}renderTree(){var t,e,o;if(!(!((t=this.assignedRoles)===null||t===void 0)&&t.length))return p;let s;if(this.activeRoleId)s=this.assignedRoleTrees.filter(n=>n!==void 0).find(n=>n.role===this.activeRoleId);else{const[n]=this.assignedRoleTrees;s=n}const a=n=>{this.roleUpdates=n.detail.message.updates,this.setShowControls()};return s&&s.rootNode&&!this.redundantStatuses.includes((e=this.account)===null||e===void 0?void 0:e.status)?c`<user-details-assignments .assignment="${s}" .contact="${this.contact}" .accountNumber="${(o=this.account)===null||o===void 0?void 0:o.accountNumber}" .readonly="${this.readonly}" .activeRoleId="${this.activeRoleId}" @check-toggle="${a}"></user-details-assignments>`:p}renderFlags(){const t=e=>{this.flagUpdates=structuredClone(e.detail.message.updates),this.setShowControls()};return!this.account||!this.userFlagTrees?p:c`<user-flags .flags="${this.userFlagTrees}" searchEnabled showCheckboxes .disableCheckboxes="${this.readonly}" .contact="${this.contact}" @check-toggle="${t}"></user-flags>`}renderControls(){var t;return c`<user-details-controls .roles="${this.roles}" .account="${this.account}" .contact="${O.get()}" .saveControls="${this.saveControls}" .readonly="${this.readonly}" .emitRoleUpdates="${this.emitRoleUpdates}" ?isPanelLoading="${this.isPanelLoading}" ?showModificationDetails="${this.showModificationDetails&&this.redundantStatuses.includes((t=this.account)===null||t===void 0?void 0:t.status)}" @reset-changes="${()=>this.resetForm()}" @update-changes="${this.saveAssignments}" @reload-account="${e=>this.dispatchReloadAccountEvent(e.detail.accountNumber,e.detail.overrideUnsavedChanges)}" @open-modification-details="${()=>this.openModificationDetailsDialog()}"> </user-details-controls>`}renderRemoveRoleConfirmation(){return c`<changes-confirmation id="data-loss-dialog" class="z-50 relative" .headerText="${"Are you sure you want to remove this role?"}" .bodyText="${"The user will no longer be able to perform the permissions of this role for this account."}" .confirmationButtonText="${"Remove Role"}" ?isOpen="${this.removeRoleDialogOpen}" @confirm="${()=>{this.removeRole(this.activeRoleId),this.removeRoleDialogOpen=!1}}" @cancel="${()=>{this.removeRoleDialogOpen=!1}}" data-testid="${it.DIALOG_REMOVE_ROLE}"> </changes-confirmation>`}renderAddAccountRoleConfirmation(){return this.assignedRoles?c`<add-account-role id="add-role-dialog" .contact="${this.contact}" .account="${this.account}" .roles="${this.roles}" .assignedRoles="${this.assignedRoles}" ?loading="${this.isPanelLoading}" @add-role="${t=>this.addRole(t.detail.roleId)}" data-testid="${it.DIALOG_ADD_ROLE}"> </add-account-role>`:p}renderViewModificationDetails(){return c`<view-modification-details id="modification-details-dialog" .account="${this.account}" .userProfileSettings="${this.userProfileSettings}" .changeHistory="${this.changeHistory}" ?loading="${this.isPanelLoading}" data-testid="${it.DIALOG_MODIFICATION_DETAILS}"> </view-modification-details>`}renderRoleView(){return c`<div id="roles-view"> <div>${this.renderRoles()}</div> <div class="grid grid-cols-1 xl:grid-cols-2 h-full p-4"> <div class="grow h-full">${this.renderPermissions()}</div> <div class="tree-view grow h-full lg:overflow-auto pl-2">${this.renderTree()}</div> </div> </div>`}renderFlagsView(){return this.showUserFlags===!1?p:c`<div id="flags-view"> <div class="grid grid-cols-1 xl:grid-cols-1 h-full"> <div class="grow h-full mt-6 px-4">${this.renderFlags()}</div> <div class="grow h-full mt-2 flag-text"> Learn more about user flags <a id="flag-text-link" href="#">here.</a> </div> </div> </div>`}renderNavigation(){var t;return this.isPanelLoading||this.redundantStatuses.includes((t=this.account)===null||t===void 0?void 0:t.status)?p:c`<div class="user-details-navigation"> <user-details-navigation .view="${this.viewRoute}" ?showFlags="${this.showUserFlags}" ?showRoles="${this.showRoles}" ?showModificationDetails="${this.showModificationDetails}" .navigate="${e=>this.updateView(e)}" @open-modification-details="${()=>this.openModificationDetailsDialog()}"></user-details-navigation> </div>`}renderView(){var t;let e=p;return this.showRoles&&this.viewRoute===Q.ROLES&&(e=this.renderRoleView()),this.showUserFlags&&this.viewRoute===Q.USERFLAGS&&(e=this.renderFlagsView()),this.redundantStatuses.includes((t=this.account)===null||t===void 0?void 0:t.status)&&(e=this.renderRemovedOrDeclinedAccount()),e}render(){var t;return c` <div class="user-details-panel"> ${this.renderControls()} ${this.renderNavigation()} ${$e(this.isPanelLoading?this.renderLoading():this.renderView())} </div> ${this.renderAddAccountRoleConfirmation()} ${this.renderRemoveRoleConfirmation()} ${this.renderViewModificationDetails()} <modification-authority-modal ?isOpen="${this.modificationModalOpen}" .obofEnabled="${this.obofEnabled}" .accountId="${((t=this.account)===null||t===void 0?void 0:t.accountNumber)||""}" .attachments="${this.modificationModalAttachments}" .selectedObof="${this.modificationModalSelectedObof}" @cancel-modification="${this.handleModificationModalCancel}" @confirm-modification="${this.handleModificationModalConfirm}" @update-attachments="${e=>{this.modificationModalAttachments=e.detail.attachments}}" @update-obof-selection="${e=>{this.modificationModalSelectedObof=e.detail}}"></modification-authority-modal> `}};g.styles=[vt,$t,U,nt],i([r({type:Object,attribute:!1})],g.prototype,"account",void 0),i([r({type:Object,attribute:!1})],g.prototype,"changeHistory",void 0),i([r({type:Object,attribute:!1})],g.prototype,"contact",void 0),i([r({type:Array,attribute:!1})],g.prototype,"assignedRoles",void 0),i([r({type:Array,attribute:!1})],g.prototype,"roles",void 0),i([r({type:Array,attribute:!1})],g.prototype,"userFlagTrees",void 0),i([r({type:Array,attribute:!1})],g.prototype,"assignedRoleTrees",void 0),i([r({type:Object,attribute:!1})],g.prototype,"userProfileSettings",void 0),i([r({type:Boolean})],g.prototype,"readonly",void 0),i([d()],g.prototype,"isPanelLoading",void 0),i([d()],g.prototype,"roleAssignments",void 0),i([d()],g.prototype,"viewRoute",void 0),i([d()],g.prototype,"saveControls",void 0),i([d()],g.prototype,"flagUpdates",void 0),i([d()],g.prototype,"roleUpdates",void 0),i([d()],g.prototype,"removedRoleAssignments",void 0),i([d()],g.prototype,"activeRoleId",void 0),i([d()],g.prototype,"permissionData",void 0),i([d()],g.prototype,"removeRoleDialogOpen",void 0),i([d()],g.prototype,"modificationModalOpen",void 0),i([d()],g.prototype,"modificationModalAttachments",void 0),i([d()],g.prototype,"modificationModalSelectedObof",void 0),i([W("#role-data-element")],g.prototype,"roleTabComponent",void 0),i([W("user-details-controls")],g.prototype,"controlsComponent",void 0),i([W("#add-role-dialog")],g.prototype,"addRoleDialog",void 0),i([W("#modification-details-dialog")],g.prototype,"modificationDetailsDialog",void 0),i([W("user-details-assignments")],g.prototype,"userDetailsAssignments",void 0),i([W("user-flags")],g.prototype,"userFlags",void 0),i([W("modification-authority-modal")],g.prototype,"modificationModal",void 0),g=i([N("user-details-panel")],g);class at{}at.FIRST_NAME="user-details-view-first-name",at.LAST_NAME="user-details-view-last-name",at.EMAIL="user-details-view-email",at.PHONE="user-details-view-phone";let M=class extends lt{constructor(){super(...arguments),this.allowSave=!0,this.isEditProfileDialogOpen=!1}firstUpdated(){this.allowSave=!1}shouldUpdate(){return!!this.contact}willUpdate(t){t.has("contact")&&this.handleDialogReset()}handleDialogClose(){this.isEditProfileDialogOpen=!1,this.handleDialogReset()}handleDialogOpen(){this.isEditProfileDialogOpen=!0,this.validateDialogFields()}handleDialogReset(){Nt(this.firstName,this.contact.firstName),Nt(this.lastName,this.contact.lastName),Nt(this.email,this.contact.email),te(this.phoneNumber,this.contact.phone),Te(this.evacAssistance,this.contact.evacAssistance),this.allowSave=!0}validateDialogFields(){ht(this.firstName,this.firstName.value,"Invalid first name"),ht(this.lastName,this.lastName.value,"Invalid last name"),ht(this.email,this.email.value,"Invalid email"),ee(this.phoneNumber,this.phoneNumber.value)}dispatchUpdateUserEvent(){var t,e,o,s,a;const n={...this.contact};n.firstName=(t=St(this.firstName))!==null&&t!==void 0?t:this.firstName.value,n.lastName=(e=St(this.lastName))!==null&&e!==void 0?e:this.lastName.value,n.email=(o=St(this.email))!==null&&o!==void 0?o:this.email.value,n.phone=(s=oe(this.phoneNumber))!==null&&s!==void 0?s:this.phoneNumber.value,n.evacAssistance=(a=Oe(this.evacAssistance))!==null&&a!==void 0?a:this.evacAssistance.checked,O.set({...n});try{this.saveChanges(n),et("Changes saved.",3e3,"center")}catch(l){if(l.statusCode==="400"){Ue([this.firstName,this.lastName,this.email],l.errors),this.phoneNumber.error=!0;const u=l.errors.find(v=>v.field===this.phoneNumber.id);u&&(this.phoneNumber.errorText=u.error)}}finally{this.isEditProfileDialogOpen=!1}}renderEditForm(){var t,e,o,s,a,n,l,u;return c`<ix-dialog class="dialog z-50 relative" id="edit-profile-dialog" ?open="${this.isEditProfileDialogOpen}" @close="${()=>this.handleDialogClose()}"> <div class="dlr-text-heading" slot="headline">Edit Profile</div> <form class="dialog-form min-w-0 max-w-full max-[640px]:w-screen" slot="content" id="edit-profile-id" method="dialog"> <div class="user-profile-name-input-group grid grid-cols-1 sm:grid-cols-2"> <div class="user-profile-input"> <ix-textbox required="true" id="first-name" class="textbox" type="text" pattern="${se.name}" maxLength="50" label="First Name" placeholder="i.e. First Name" value="${(e=(t=this.contact)===null||t===void 0?void 0:t.firstName)!==null&&e!==void 0?e:""}" @input="${()=>{this.allowSave=ht(this.firstName,this.firstName.value,"Invalid first name")}}"></ix-textbox> </div> <div class="user-profile-input"> <ix-textbox required="true" id="last-name" class="textbox" type="text" pattern="${se.name}" maxLength="50" label="Last Name" placeholder="i.e. Last Name" value="${(s=(o=this.contact)===null||o===void 0?void 0:o.lastName)!==null&&s!==void 0?s:""}" @input="${()=>{this.allowSave=ht(this.lastName,this.lastName.value,"Invalid last name")}}"></ix-textbox> </div> </div> <div class="user-profile-input"> <ix-phone-input required id="phone-number" class="single-row-textbox" label="Phone Number" value="${(n=ie((a=this.contact)===null||a===void 0?void 0:a.phone))!==null&&n!==void 0?n:""}" @input="${()=>{te(this.phoneNumber,ie(oe(this.phoneNumber))),this.allowSave=ee(this.phoneNumber,"Invalid phone number")}}"></ix-phone-input> </div> <div class="user-profile-input"> <ix-textbox required="true" id="email" class="single-row-textbox" type="email" label="Email Address" value="${(u=(l=this.contact)===null||l===void 0?void 0:l.email)!==null&&u!==void 0?u:""}" @input="${()=>{this.allowSave=ht(this.email,this.email.value,"Invalid email")}}"></ix-textbox> </div> </form> <div class="dialog-actions" slot="actions"> <ix-button form="edit-profile-id" appearance="text" text="Cancel" @click="${()=>this.handleDialogClose()}"> Cancel </ix-button> <ix-button id="save-user-button" appearance="text" text="Save Changes" .disabled="${!this.allowSave}" @click="${()=>{this.dispatchUpdateUserEvent()}}"> Save Changes </ix-button> </div> </ix-dialog>`}renderButton(){return E.hasExternalUserUpdate(this.selectedAccountNumber)&&!E.isProfileOfLoggedInUser(this.contact.email)?c`<ix-button id="open-user-button" appearance="text" has-icon @click="${()=>this.handleDialogOpen()}"> <md-icon class="edit-icon" slot="icon">edit</md-icon> Edit Profile </ix-button>`:p}render(){var t,e,o,s;return c` <div class="user-details-card"> <div class="user-details-header"> <h1 class="dlr-text-heading">User Details</h1> </div> <div> <div class="user-details-body grid md:grid-cols-2 gap-x-8 gap-y-4 pb-[1.5rem]"> <div class="first-name-container"> <p class="dlr-text-caption-alt text-on-surface-variant">FIRST NAME</p> <div class="first-name" data-testid="${at.FIRST_NAME}"> ${(t=this.contact)===null||t===void 0?void 0:t.firstName} </div> </div> <div class="last-name-container"> <p class="dlr-text-caption-alt text-on-surface-variant">LAST NAME</p> <div class="last-name" data-testid="${at.LAST_NAME}"> ${(e=this.contact)===null||e===void 0?void 0:e.lastName} </div> </div> <div class="email-container"> <p class="dlr-text-caption-alt text-on-surface-variant">EMAIL ADDRESS</p> <div class="email" data-testid="${at.EMAIL}">${(o=this.contact)===null||o===void 0?void 0:o.email}</div> </div> <div class="phone-number-container"> <p class="dlr-text-caption-alt text-on-surface-variant">PHONE NUMBER</p> <ix-phone-number .number="${(s=this.contact)===null||s===void 0?void 0:s.phone}" data-testid="${at.PHONE}"></ix-phone-number> </div> </div> </div> </div> ${this.renderEditForm()} `}};M.styles=[Ie,U],i([r({type:String})],M.prototype,"selectedAccountNumber",void 0),i([r({type:Object})],M.prototype,"contact",void 0),i([r({type:Object})],M.prototype,"saveChanges",void 0),i([d()],M.prototype,"allowSave",void 0),i([d()],M.prototype,"isEditProfileDialogOpen",void 0),i([C("#first-name")],M.prototype,"firstName",void 0),i([C("#last-name")],M.prototype,"lastName",void 0),i([C("#email")],M.prototype,"email",void 0),i([C("#phone-number")],M.prototype,"phoneNumber",void 0),i([C("#evac-assistance")],M.prototype,"evacAssistance",void 0),M=i([N("user-details-view")],M);const fo=tt`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}:host{display:flex;align-items:center;width:100%}.account-rhs-section{display:flex;align-items:center}.check_circle{color:#4caf50}.mail{color:#ff9800}.warning{color:#db0028}.delete_forever{color:#6d758c}.account-name{background:0 0;border:0;padding:0;margin:0;font:inherit;color:inherit;cursor:pointer;display:flex;justify-content:space-between;align-items:center;width:100%;text-align:left}.account-name-text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}`,yo=tt`.account-name:focus-visible{outline:2px solid var(--md-sys-color-primary,#1456e0);outline-offset:2px;border-radius:2px}.account-name-tooltip{position:fixed;top:0;left:0;z-index:1300;min-width:200px;max-width:480px;width:max-content;padding:6px 10px;border-radius:4px;background-color:#071454;color:#fff;font-size:.75rem;line-height:1rem;white-space:normal;overflow-wrap:anywhere;word-break:break-word;pointer-events:none;box-shadow:0 2px 6px rgba(0,0,0,.2)}.account-name-tooltip[hidden]{display:none!important}`;class ct{}ct.STATUS=t=>`dr-account-status-${t!=null?t:""}`,ct.ICON=t=>`dr-account-icon-${t!=null?t:""}`,ct.NAME=t=>`dr-account-name-${t!=null?t:""}`,ct.EVENT_DISPATCH_EL=t=>`dr-account-event-el-${t!=null?t:""}`;const xo=300;let G=class extends H{constructor(){super(...arguments),this.active=!1,this.isSelected=!1,this.tooltipVisible=!1,this.showTooltip=()=>{this.clearTooltipTimer(),this.tooltipShowTimer=setTimeout(()=>{this.tooltipVisible=!0,this.updateComplete.then(()=>this.positionTooltip())},xo)},this.hideTooltip=()=>{this.clearTooltipTimer(),this.tooltipVisible=!1},this.handleTooltipKeyDown=t=>{t.key==="Escape"&&this.tooltipVisible&&(t.stopPropagation(),this.hideTooltip())}}get statusText(){return ro[this.status]}get statusIcon(){return me[this.status]}get accountDisplayName(){var t,e,o,s;return(s=(e=(t=this.account)===null||t===void 0?void 0:t.displayName)!==null&&e!==void 0?e:(o=this.account)===null||o===void 0?void 0:o.name)!==null&&s!==void 0?s:""}dispatchChangeAccountEvent(){var t;this.dispatchEvent(new CustomEvent("account-click",{detail:{accountNumber:(t=this.account)===null||t===void 0?void 0:t.accountNumber}}))}disconnectedCallback(){super.disconnectedCallback(),this.clearTooltipTimer()}clearTooltipTimer(){this.tooltipShowTimer&&(clearTimeout(this.tooltipShowTimer),this.tooltipShowTimer=void 0)}positionTooltip(){!this.isConnected||!this.accountNameEl||!this.tooltipEl||ao(this.accountNameEl,this.tooltipEl,{strategy:"fixed",placement:"top",middleware:[no(8),co(),lo({padding:8})]}).then(({x:t,y:e})=>{!this.isConnected||!this.tooltipVisible||!this.tooltipEl||(this.tooltipEl.style.left=`${t}px`,this.tooltipEl.style.top=`${e}px`)}).catch(()=>{})}render(){var t,e,o;return c` <button type="button" class="${`account-name ${this.active||this.isSelected?"font-bold":""}`}" aria-label="${this.accountDisplayName}, Status: ${this.statusText}" aria-current="${this.active?"true":p}" data-testid="${ct.NAME((t=this.account)===null||t===void 0?void 0:t.accountNumber)}" @click="${()=>this.dispatchChangeAccountEvent()}" @mouseenter="${this.showTooltip}" @mouseleave="${this.hideTooltip}" @focus="${this.showTooltip}" @blur="${this.hideTooltip}" @keydown="${this.handleTooltipKeyDown}"> <span class="${`account-name-text ml-4 dlr-text-small ${this.active||this.isSelected?"font-bold":""}`}" aria-hidden="true">${this.accountDisplayName}</span> <div class="flex items-center mr-4" aria-hidden="true"> <div class="account-rhs-section"> <p class="dlr-text-small" data-testid="${ct.STATUS((e=this.account)===null||e===void 0?void 0:e.accountNumber)}"> ${this.statusText} </p> </div> <ix-icon filled class="mt-1 ml-2 text-2xl" data-testid="${ct.ICON((o=this.account)===null||o===void 0?void 0:o.accountNumber)}" style="${`color: ${Mt[this.status]}`}">${this.statusIcon}</ix-icon> </div> </button> <div class="account-name-tooltip" aria-hidden="true" ?hidden="${!this.tooltipVisible}"> ${this.accountDisplayName} </div> `}};G.styles=[fo,U,yo],i([r({type:Object})],G.prototype,"account",void 0),i([r({type:Boolean,reflect:!0})],G.prototype,"active",void 0),i([r({type:String})],G.prototype,"status",void 0),i([r({type:Boolean})],G.prototype,"isSelected",void 0),i([d()],G.prototype,"tooltipVisible",void 0),i([C(".account-name-tooltip")],G.prototype,"tooltipEl",void 0),i([C(".account-name-text")],G.prototype,"accountNameEl",void 0),G=i([N("dr-account")],G);const Ao=tt`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.accounts-card{display:flex;flex-direction:column;width:100%;background:0 0;border-radius:20px}.accounts-card-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px}.divider{width:100%;display:flex;align-items:center;min-height:40px}.option{display:block;width:100%}.accounts-list{padding-left:0;list-style-type:none;margin:0}.accounts-list li{display:flex;align-items:center;width:100%;height:24px;padding-top:20px;padding-bottom:20px;margin-bottom:8px;color:#092241;border-radius:0 30px 30px 0;cursor:pointer;gap:1rem}.accounts-list li:last-child{margin-bottom:0}.accounts-list li:focus-within,.accounts-list li:has(dr-account[active]),.accounts-list li:hover{background-color:rgba(20,86,224,.1)}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (max-width:600px){.accounts-card-header{margin-bottom:1.5rem}.dialog-form{min-width:initial}}`;class f{}f.ACCOUNTS_LIST="acc-card-accounts-list",f.ACCOUNT=t=>`acc-card-account-${t!=null?t:""}`,f.ACCOUNT_OPTION=t=>`acc-card-account-option-${t!=null?t:""}`,f.ACCOUNT_DIVIDER="acc-card-account-divider",f.ROLE_OPTION=t=>`acc-card-role-option-${t.replace(/ /g,"_")}`,f.BTN_ADD_ACCOUNT="acc-card-btn-add-account",f.ACCOUNT_DIALOG="acc-card-add-account-dialog",f.ACCOUNT_DIALOG_HEADER="acc-card-add-account-header",f.ACCOUNT_DIALOG_SELECT="acc-card-add-account-select",f.ACCOUNT_DIALOG_CANCEL="acc-card-add-account-cancel",f.ACCOUNT_DIALOG_CONFIRM="acc-card-add-account-confirm",f.ROLE_DIALOG="acc-card-add-role-dialog",f.ROLE_DIALOG_HEADER="acc-card-add-role-header",f.ROLE_DIALOG_SELECT="acc-card-add-role-select",f.ROLE_DIALOG_CANCEL="acc-card-add-role-cancel",f.ROLE_DIALOG_CONFIRM="acc-card-add-role-confirm",f.CARD_HEADER="acc-card-header",f.CARD_BODY="acc-card-body",f.ACCOUNT_DIALOG_ACCOUNT_TREE="acc-card-add-account-tree";const yt=tt`.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}`,kt=t=>t.id||`${t.name}-${t.size}-${t.lastModified}`;let _=class extends H{constructor(){super(...arguments),this.obofEnabled=!1,this.accountStructure="flat",this.attachments=[],this._nextButtonEnabled=!1,this._validationMessage="Select at least one account to proceed",this._obofCreatorsByAccount=new Map,this._accountHierarchyHasUsers=new Map,this._loadingObofForAccounts=new Set,this._uploaderInstanceKey=0,this._isDocumentUploadVisible=!1,this.handleNextButtonKeydown=t=>{if(!this._nextButtonEnabled)return;const e=t.target;(e.getAttribute("data-testid")==="step-two-next-button"||e.closest('[data-testid="step-two-next-button"]'))&&(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),t.stopPropagation(),this.dispatchNextStepEvent())}}async connectedCallback(){super.connectedCallback(),this._accountTree=this.accountTree,this.obofSelections||(this.obofSelections=new Map),await this.syncObofState(),this._isDocumentUploadVisible=this.shouldRenderDocumentUpload(),this.validateStep(),this.updateValidationMessage(),this.dispatchValidateStepEvent()}async updated(t){super.updated(t),t.has("accountTree")&&this.accountTree!==this._accountTree&&(this._accountTree=this.accountTree,await this.syncObofState(),this.handleDocumentUploadVisibilityTransition(),this.validateStep(),this.dispatchValidateStepEvent(),this.dispatchNextButtonToggleEvent()),t.has("attachments")&&(this.validateStep(this.getDedupedAttachments()),this.dispatchValidateStepEvent(),this.dispatchNextButtonToggleEvent(),this.requestUpdate())}getSelectedAccountNodes(){return this._accountTree?ae(this._accountTree.children||[],this.accountStructure):[]}getSelectedAccountIds(){return this.getSelectedAccountNodes().map(t=>t.id||t.label)}getAllCheckedAccountIds(t){const e=[];for(const o of t){if(o.checked){const s=o.id||o.label;s&&e.push(s)}o.children&&o.children.length>0&&e.push(...this.getAllCheckedAccountIds(o.children))}return e}async syncObofState(){if(!this.obofEnabled||!this._accountTree)return;const t=this.getSelectedAccountIds();t.length&&await this.loadObofCreatorsForAccounts(t)}getDedupedAttachments(t=this.attachments){const e=new Map;return t.forEach(o=>{e.set(kt(o),o)}),[...e.values()]}areAttachmentsValid(t){return t.length===0||ke(t,ne()).isValid}shouldRenderDocumentUpload(t=this.getSelectedAccountIds()){return _t(this.obofEnabled,t.length>0,this.obofSelections,t)}handleDocumentUploadVisibilityTransition(){const t=this.shouldRenderDocumentUpload();this._isDocumentUploadVisible&&!t&&this.getDedupedAttachments().length>0&&(this.attachments=[],this._uploaderInstanceKey+=1,this.dispatchAttachmentsUpdateEvent([])),this._isDocumentUploadVisible=t}getAncestorAccountIds(t){const e=[t],o=(a,n)=>{if(!a.children)return null;for(const l of a.children){if((l.id||l.label)===n)return a;const u=o(l,n);if(u)return u}return null};if(!this._accountTree)return e;let s=t;for(;s;){const a=o(this._accountTree,s);if(!a||a.id==="root")break;const n=a.id||a.label;if(n&&n!=="root")e.push(n),s=n;else break}return e}async loadObofCreatorsForAccounts(t){if(!this.obofEnabled)return;const e=t.filter(h=>!this._obofCreatorsByAccount.has(h)&&!this._loadingObofForAccounts.has(h));if(!e.length)return;const o=new Set(this._loadingObofForAccounts);e.forEach(h=>o.add(h)),this._loadingObofForAccounts=o;const s=this._accountTree?this.getAllCheckedAccountIds([this._accountTree]):[];let a=[];if(s.length>0)try{const h=this.getAncestorAccountIds(e[0]),m=h[h.length-1],A=await rt.search({accountNumber:m,page:0,size:1e3});A.contacts&&A.contacts.length>0&&(a=A.contacts.filter(R=>R.accounts.some(w=>s.includes(w.accountNumber))))}catch(h){}const n=await Promise.all(e.map(async h=>{try{const m=(await zt(h,Ht)).filter(R=>R.accountPermissionGroup===jt.OnBehalfUserUpdater);let A=!1;return m.length||(A=a.some(R=>R.accounts.some(w=>w.accountNumber===h))),{accountId:h,creators:m,hierarchyHasUsers:A}}catch(m){return{accountId:h,creators:[],hierarchyHasUsers:!1}}})),l=new Map(this._obofCreatorsByAccount),u=new Map(this._accountHierarchyHasUsers),v=new Set(this._loadingObofForAccounts);n.forEach(({accountId:h,creators:m,hierarchyHasUsers:A})=>{l.set(h,m),u.set(h,A),v.delete(h)}),this._obofCreatorsByAccount=l,this._accountHierarchyHasUsers=u,this._loadingObofForAccounts=v,this.requestUpdate(),await this.updateComplete,this.validateStep(),this.dispatchNextButtonToggleEvent()}renderAccounts(){var t,e;if(!this._accountTree)return p;const o=(e=(t=this._accountTree)===null||t===void 0?void 0:t.children)===null||e===void 0?void 0:e.some(s=>{var a;return(a=s.children)===null||a===void 0?void 0:a.length});return c` <div class="overflow-auto pb-[2px]" role="region" aria-labelledby="account-instructions"> <ix-tree checkboxesEnabled .rootNode="${this._accountTree}" .rollup="${!1}" .disableEndNodePointer="${!0}" .selectNodeOnClick="${!0}" ?removeChevron="${!o}" @on-tree-node-checked="${()=>this.toggleAccountChecked()}" data-testid="step-two-account-tree" aria-label="Account hierarchy tree" aria-describedby="account-tree-help" role="tree"></ix-tree> </div> `}validateStep(t){if(!this._accountTree||!this.ixTree)return;const e=ce([this._accountTree]);if(this.obofEnabled&&e){const o=this.getSelectedAccountIds(),s=Fe(o,this.obofSelections),a=_t(!0,e,this.obofSelections,o),n=t!=null?t:this.getDedupedAttachments(),l=!a||n.length>0,u=this.areAttachmentsValid(n);this._nextButtonEnabled=e&&s&&l&&u;return}this._nextButtonEnabled=e}async toggleAccountChecked(){if(!(!this._accountTree||!this.ixTree)){if(await this.ixTree.updateComplete,this._accountTree=this.ixTree.rootNode,this.obofEnabled){const t=this.getSelectedAccountNodes(),e=t.map(s=>s.id||s.label),o=t.flatMap(le);this.obofSelections=Le(this.obofSelections,o),this.dispatchObofSelectionsUpdateEvent(),await this.loadObofCreatorsForAccounts(e)}this.handleDocumentUploadVisibilityTransition(),this.dispatchUpdateAccountsEvent(),this.validateStep(),this.updateValidationMessage(),this.dispatchNextButtonToggleEvent()}}onFileRemoved(t){if(!(t!=null&&t.detail))return;const e=this.getDedupedAttachments(t.detail.allFiles||[]);this.attachments=e,this.dispatchAttachmentsUpdateEvent(e),this.validateStep(e),this.dispatchNextButtonToggleEvent()}onUploaded(t){const e=t.detail.filesUploaded||[],o=ne(),s=new Map;this.getDedupedAttachments().forEach(l=>s.set(kt(l),l));let a=!1;e.forEach(l=>{if(Be(l.file,o).length>0){a=!0;return}s.set(kt(l.file),l.file)});const n=[...s.values()];this.attachments=n,a&&(this._uploaderInstanceKey+=1),this.dispatchAttachmentsUpdateEvent(n),this.validateStep(n),this.dispatchNextButtonToggleEvent()}handleObofOptionClick(t,e,o,s=o,a=""){const n=new Dt(e,o,s,a),l=new Map(this.obofSelections);for(const u of le(t))l.set(u,n);this.obofSelections=l,this.dispatchObofSelectionsUpdateEvent(),this.requestUpdate(),this.handleDocumentUploadVisibilityTransition(),this.validateStep(),this.dispatchNextButtonToggleEvent()}renderObofs(){if(!this.obofEnabled)return p;const t=this.getSelectedAccountNodes();return t.length?c` <div class="mt-4 overflow-y-auto" style="max-height:200px"> ${t.map(e=>this.renderObofUserSelect(e))} </div> `:p}renderObofUserSelect(t){var e;const o=t.id||t.label,s=this._loadingObofForAccounts.has(o),a=this._obofCreatorsByAccount.get(o)||[],n=this._accountHierarchyHasUsers.get(o)||!1,l=((e=this.obofSelections)===null||e===void 0?void 0:e.get(o))||new Dt,u=l.value,v=Kt(s,a.length,n);let h;if(v==="loading")h=c` <ix-select-option value="loading" display-text="Loading users..." disabled="disabled" selected="selected"> Loading users... </ix-select-option> `;else if(v==="selectable")h=c` ${a.map(m=>{const A=m.id;if(!A)return p;const R=`${m.firstName} ${m.lastName}`,w=`${R} (${m.email})`;return c` <ix-select-option value="${A}" display-text="${w}" ?selected="${u===A}" @click="${()=>this.handleObofOptionClick(t,A,w,R,m.email)}"> ${w} </ix-select-option> `})} `;else if(v==="no-user"){const m=ot.noUserAvailable;h=c` <ix-select-option value="${k.NoUserAvailable}" display-text="${m}" ?selected="${u===k.NoUserAvailable}" @click="${()=>this.handleObofOptionClick(t,k.NoUserAvailable,m)}"> ${m} </ix-select-option> `}else{const m=ot.newCustomer;h=c` <ix-select-option value="${k.NewCustomer}" display-text="${m}" ?selected="${u===k.NewCustomer}" @click="${()=>this.handleObofOptionClick(t,k.NewCustomer,m)}"> ${m} </ix-select-option> `}return c` <div class="mb-3"> <label for="obof-${o}-menu" class="text-sm font-medium" style="display:block;margin-bottom:8px"> ${t.label} </label> <ix-select quick menu-below class="w-full" id="obof-${o}-menu" menu-positioning="fixed" label="${s?"Loading users...":"Created on Behalf of*"}" .displayText="${s?"Loading users...":l.displayText}" ?disabled="${s}"> ${h} </ix-select> </div> `}renderDocumentUpload(){if(!this.shouldRenderDocumentUpload())return p;const t=qt(),e=Gt(),o=e.map(a=>a.toUpperCase()).join(", "),s=`Max file size is ${t} MB with accepted file formats of ${o}`;return c` <div class="mt-4"> <label class="text-sm font-medium" style="display:block;margin-bottom:8px"> Document(s) of Request* </label> ${pe(this._uploaderInstanceKey,c` <ix-file-uploader .allowDeleteDefaultFiles="${!0}" .allowMultipleFiles="${!0}" .defaultFiles="${this.getDedupedAttachments()}" .extensions="${e}" .maxFileSizeValue="${t}" .headerText="${"CLICK HERE TO BROWSE YOUR DEVICE OR DROP FILES TO UPLOAD"}" .bodyText="${s}" .hideBody="${!1}" .validateFile="${Wt}" @on-file-removed="${this.onFileRemoved}" @on-files-uploaded="${this.onUploaded}"></ix-file-uploader> `)} </div> `}updateValidationMessage(){this._accountTree&&ce([this._accountTree])?this._validationMessage="Account(s) selected. Ready to proceed.":this._validationMessage="Select at least one account to proceed"}dispatchUpdateAccountsEvent(){this.dispatchEvent(new CustomEvent(I.UpdateAccounts,{detail:{rootNode:this._accountTree},bubbles:!0,composed:!0}))}dispatchObofSelectionsUpdateEvent(){this.dispatchEvent(new CustomEvent(I.UpdateObofSelections,{detail:{obofSelections:this.obofSelections},bubbles:!0,composed:!0}))}dispatchAttachmentsUpdateEvent(t){this.dispatchEvent(new CustomEvent(I.UpdateAttachments,{detail:{attachments:t},bubbles:!0,composed:!0}))}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(I.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(I.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(I.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}render(){return c` <div class="flex flex-col overflow-hidden"> <div id="account-instructions" class="sr-only" role="status"> Select one or more accounts from the list below to add to this contact. </div> <div id="account-tree-help" class="sr-only"> Use arrow keys to navigate through accounts. Press Space or Enter to select or deselect accounts. Parent accounts can be expanded or collapsed to show child accounts. </div> <div role="status" aria-live="polite" aria-atomic="true" class="sr-only" id="validation-status"> ${this._validationMessage} </div> ${this.renderAccounts()} ${this.renderObofs()} ${this.renderDocumentUpload()} <div class="flex justify-end mt-6"> <ix-button type="submit" ?disabled="${!this._nextButtonEnabled}" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" @keydown="${this.handleNextButtonKeydown}" data-testid="step-two-next-button" aria-label="${this._nextButtonEnabled?"Proceed to next step: Select roles":"Next step disabled. Please select at least one account to continue."}"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}};_.styles=[U,nt,yt,Me],i([r({type:Object})],_.prototype,"accountTree",void 0),i([r({type:Boolean})],_.prototype,"obofEnabled",void 0),i([r({type:String})],_.prototype,"accountStructure",void 0),i([r({type:Object})],_.prototype,"obofSelections",void 0),i([r({type:Array})],_.prototype,"attachments",void 0),i([d()],_.prototype,"_accountTree",void 0),i([d()],_.prototype,"_nextButtonEnabled",void 0),i([d()],_.prototype,"_validationMessage",void 0),i([d()],_.prototype,"_obofCreatorsByAccount",void 0),i([d()],_.prototype,"_accountHierarchyHasUsers",void 0),i([d()],_.prototype,"_loadingObofForAccounts",void 0),i([d()],_.prototype,"_uploaderInstanceKey",void 0),i([C("ix-tree")],_.prototype,"ixTree",void 0),_=i([N("append-accounts-select-accounts")],_);let F=class extends H{constructor(){super(...arguments),this.checkedAccounts=[],this.roles=[],this.dataForAccounts=[],this.treeData=[],this._dataForAccounts=[],this._treeData=[],this._nextButtonEnabled=!1,this._validationMessage="Select at least one role for each account to proceed",this.multiSelectOpen=!1}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._treeData=this.treeData,this.validateStep(),this.dispatchValidateStepEvent()}getRoles(t){return this.roles.filter(e=>e.accountId===t)[0].roles}getRolesData(t){const e=this.roles.filter(s=>s.accountId===t)[0],o=[];return e.roles.forEach(s=>{var a;s.removed=!0;const n={id:"root",label:"",children:[],customerKnownSpaceName:""},l=(a=this._treeData.find(v=>v.accountNumber===t))===null||a===void 0?void 0:a.data;l&&l.length&&Ve(l[0],n);const u={accountId:t,role:s,locations:[],genericTreeView:n};o.push(u)}),o}getFlagsData(t){const e=[];return ze.forEach(o=>{const s={accountId:t,flag:o,locations:[],genericFlagsData:[]};e.push(s)}),e}renderMultiSelectRoles(){this._dataForAccounts.length===0&&(this._dataForAccounts=this.checkedAccounts.map(e=>({accountId:e.id,accountName:e.label,rolesData:this.getRolesData(e.id),flagsData:this.getFlagsData(e.id),flagData:[],active:!1})),this.dispatchUpdateDFAEvent());const t={};return this._dataForAccounts.forEach(e=>{t[e.accountId]=e.rolesData.filter(o=>o.role.removed===!0).map(o=>o.role.name)}),this._dataForAccounts.map(e=>{const o=[...new Set(this.getRoles(e.accountId).map(s=>s.name))].map(s=>({label:s,selected:!t[e.accountId].includes(s)}));return c` <div role="group" aria-labelledby="account-label-${e.accountId}"> <div class="account-roles-name" id="account-label-${e.accountId}"> ${e.accountName} </div> <ix-multi-select data-testid="multi-select-roles-${e.accountId}" required id="${`${e.accountId}-multi-select`}" style="max-width:99%" class="multi-select" .menuPositioning="${"popover"}" .items="${o}" .label="${"Roles"}" aria-label="Select roles for ${e.accountName}" aria-describedby="roles-help-${e.accountId}" @toggle-multi-select-item="${s=>this.handleMultiSelect(e.accountId,s.detail.label,s.detail.selected)}" @remove-multi-select-item="${s=>this.handleMultiSelect(e.accountId,s.detail,!1)}" @clear-multi-select="${()=>this.handleMultiSelectClear(e.accountId)}" @select-menu="${s=>this.handleSelectMenu(s)}"></ix-multi-select> <div id="roles-help-${e.accountId}" class="sr-only"> At least one role must be selected for ${e.accountName} to proceed. </div> </div> `})}handleSelectMenu(t){t.detail.value==="open"?this.multiSelectOpen=!0:this.multiSelectOpen=!1}handleMultiSelect(t,e,o){var s,a;const[n]=this._dataForAccounts.filter(h=>h.accountId===t),l=this.getRoles(n.accountId).find(h=>h.name===e);if(!l)return;const u=n.rolesData.findIndex(h=>h.role.id===l.id);if(l.permissions.every(h=>h.isNonLocation)){const h=(s=n.rolesData[u])===null||s===void 0?void 0:s.genericTreeView;if(!((a=h==null?void 0:h.children)===null||a===void 0)&&a.length){const m=h.children[0];m.checked=o,Ut(m,h),n.rolesData[u].locations=o?[m]:[]}}const v=n.rolesData.findIndex(h=>h.role.id===(l==null?void 0:l.id));n.rolesData[v].role.removed=!(o&&v>=0),this.validateStep(),this._validationMessage=this._nextButtonEnabled?"All accounts have a role selected. Ready to proceed.":"Select at least one role for each account to proceed",this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()}validateStep(){const t=this._dataForAccounts.every(o=>o.rolesData.filter(s=>s.role.removed===!1).length),e=this._dataForAccounts.length===this.checkedAccounts.length;this._nextButtonEnabled=t&&e}handleMultiSelectClear(t){const e=this._dataForAccounts.filter(o=>o.accountId===t)[0];this._dataForAccounts.find(o=>o.accountId===t).rolesData=this.getRolesData(e.accountId),this._nextButtonEnabled=!1,this._validationMessage="Select at least one role for each account to proceed",this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()}dispatchUpdateDFAEvent(){const t=new CustomEvent(I.UpdateDFA,{detail:{dataForAccounts:this._dataForAccounts},bubbles:!0,composed:!0});this.dispatchEvent(t)}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(I.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(I.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(I.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}render(){const t=this.multiSelectOpen?"overflow-hidden":"overflow-auto";return c` <div class="wizard-step-content flex flex-col overflow-hidden"> <div role="status" aria-live="polite" aria-atomic="true" class="sr-only"> ${this._validationMessage} </div> <div class="p-1 dlr-text-default ${t}">${this.renderMultiSelectRoles()}</div> <div class="flex justify-end" style="padding-top:8px"> <ix-button class="pt-2" type="submit" ?disabled="${!this._nextButtonEnabled}" has-icon trailing-icon @click="${this.dispatchNextStepEvent}" @keydown="${e=>{(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation(),this.dispatchNextStepEvent())}}" data-testid="step-three-next-button" aria-label="${this._nextButtonEnabled?"Proceed to next step: Portal access":"Next step disabled. Please select at least one role for each account."}"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}};F.styles=[Pe,U,Ft,yt],i([r({type:Array})],F.prototype,"checkedAccounts",void 0),i([r({type:Array})],F.prototype,"roles",void 0),i([r({type:Array})],F.prototype,"dataForAccounts",void 0),i([r({type:Array})],F.prototype,"treeData",void 0),i([d()],F.prototype,"_dataForAccounts",void 0),i([d()],F.prototype,"_treeData",void 0),i([d()],F.prototype,"_nextButtonEnabled",void 0),i([d()],F.prototype,"_validationMessage",void 0),i([d()],F.prototype,"multiSelectOpen",void 0),F=i([N("append-accounts-select-roles")],F);let D=class extends H{constructor(){super(...arguments),this.dataForAccounts=[],this.permissions=[],this._dataForAccounts=[],this.showPermissionsDialog=!1,this.removeRoleDialogOpen=!1,this._nextButtonEnabled=!1}connectedCallback(){super.connectedCallback(),this._dataForAccounts=this.dataForAccounts,this._selectedAccountId=this.selectedAccountId,this._selectedRoleId=this.selectedRoleId,this.validateStep(),this.dispatchValidateStepEvent(),this.setInitialRole()}get noOfLocations(){var t;return io((t=this.selectedRoleData)===null||t===void 0?void 0:t.genericTreeView)}get canAddRolesDisabled(){var t;return!(!((t=this.unAvailableRoles)===null||t===void 0)&&t.length)}get availableRoles(){const t=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId),e=t==null?void 0:t.rolesData.filter(o=>o.role.removed===!1);return e==null?void 0:e.flatMap(o=>o.role)}get unAvailableRoles(){const t=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId),e=t==null?void 0:t.rolesData.filter(o=>o.role.removed===!0);return e==null?void 0:e.flatMap(o=>o.role)}get roles(){const t=this._dataForAccounts.find(e=>e.accountId===this._selectedAccountId);return t==null?void 0:t.rolesData.flatMap(e=>e.role)}get selectedAccount(){return this._dataForAccounts.find(t=>t.accountId===this._selectedAccountId)}get selectedRole(){return this.selectedAccount.rolesData.find(t=>t.role.id===this._selectedRoleId).role}get selectedRolePermissions(){var t,e;return(e=(t=this._dataForAccounts.find(o=>o.accountId===this._selectedAccountId))===null||t===void 0?void 0:t.rolesData.find(o=>o.role.id===this._selectedRoleId))===null||e===void 0?void 0:e.role.permissions}get selectedRoleData(){return this.selectedAccount.rolesData.find(t=>t.role.id===this._selectedRoleId)}toggleActiveCard(t){this._selectedAccountId=t,this._dataForAccounts.forEach(e=>{e.accountId!==t?e.active=!1:e.active=!0}),this.setInitialRole(),this.roleTabComponent.setActiveRole(this._selectedRoleId),this.requestUpdate()}setInitialRole(){this.availableRoles&&this.availableRoles.length>0&&(this._selectedRoleId=this.availableRoles[0].id)}dispatchOpenAddAccountRole(){this.addRoleDialog.handleOpenDialog()}dispatchTabControl(t){this._selectedRoleId=this.roles[t].id,this.roleTabComponent.setActiveRole(this._selectedRoleId)}addRole(t){var e;const o=this.selectedAccount.rolesData.findIndex(s=>s.role.id===t);if(this.selectedAccount.rolesData[o].role.permissions.every(s=>s.isNonLocation)){const s=this.selectedAccount.rolesData[o].genericTreeView;if(!(!((e=s==null?void 0:s.children)===null||e===void 0)&&e.length))return;const a=s.children[0];a.checked=!0,Ut(a,s),this.selectedAccount.rolesData[o].locations.push(a)}else this.selectedAccount.rolesData[o].locations=[];this.selectedAccount.rolesData[o].role.removed=!1,this.requestUpdate(),this.dispatchTabControl(o),this.addRoleDialog.handleCancelChanges()}dispatchRemoveRoleEvent(){const t=this.roles.findIndex(o=>o.id===this._selectedRoleId);this.roles[t].removed=!0;const e=this.selectedAccount.rolesData.findIndex(o=>o.role.id===this._selectedRoleId);this.selectedAccount.rolesData[e].locations=[],this.selectedAccount.rolesData[e].role.removed=!0,this.selectedAccount.rolesData[e].genericTreeView&&je(this.selectedAccount.rolesData[e].genericTreeView),this.validateStep(),this.setInitialRole(),this.requestUpdate()}renderTree(){const t=this._dataForAccounts.find(a=>a.accountId===this._selectedAccountId),e=t==null?void 0:t.rolesData.find(a=>a.role.id===this._selectedRoleId);if(!e)return p;const o={role:e.role.id,rootNode:e.genericTreeView},s=a=>{this.requestUpdate();const{updates:n}=a.detail.message,l=n.find(u=>u.key===e.role.id);l!=null&&l.items?e.locations=l.items.filter(u=>u.checked):e.locations=[],this.validateStep(),this.dispatchUpdateDFAEvent(),this.dispatchNextButtonToggleEvent()};if(o&&o.rootNode){const a=e==null?void 0:e.role.permissions.every(n=>n.isNonLocation);return c`<user-details-assignments .assignment="${o}" .contact="${this.contact}" .accountNumber="${t==null?void 0:t.accountId}" @check-toggle="${s}" ?disableTree="${a}"></user-details-assignments>`}return p}validateStep(){let t=!0;for(const e of this._dataForAccounts)if(!e.rolesData.filter(o=>o.role.removed===!1).every(o=>o.locations.length)){t=!1;break}this._nextButtonEnabled=t}renderRoles(){var t,e;return c` <user-details-tab-roles id="role-data-element" .assignedRoles="${this.availableRoles}" .activeRoleId="${(t=this._selectedRoleId)!==null&&t!==void 0?t:""}" .canRemoveRoles="${!0}" .removeRolesDisabled="${((e=this.availableRoles)===null||e===void 0?void 0:e.length)<=1}" .canAddRoles="${!0}" .addRolesDisabled="${this.canAddRolesDisabled}" @role-select="${o=>this._selectedRoleId=o.detail.roleId}" @open-role-menu="${()=>this.dispatchOpenAddAccountRole()}" @open-remove-role-menu="${()=>this.removeRoleDialogOpen=!0}"></user-details-tab-roles> `}renderAddAccountRoleConfirmation(){var t;return c`<add-account-role id="add-role-dialog" .contact="${this.contact}" .account="${Ke((t=this.selectedAccount)===null||t===void 0?void 0:t.accountId)||""}" .assignedRoles="${this.availableRoles}" .roles="${this.roles}" @add-role="${e=>this.addRole(e.detail.roleId)}"> </add-account-role>`}renderRemoveRoleConfirmation(){return c`<changes-confirmation id="remove-role-dialog" ?isOpen="${this.removeRoleDialogOpen}" .headerText="${"Are you sure you want to remove this role?"}" .bodyText="${"The user will no longer be able to perform the permissions of this role for this account."}" .confirmationButtonText="${"Remove Role"}" @confirm="${()=>{this.dispatchRemoveRoleEvent(),this.validateStep(),this.removeRoleDialogOpen=!1}}" @cancel="${()=>this.removeRoleDialogOpen=!1}"> </changes-confirmation>`}renderControls(){return c` <div class="controls"> <div class="flex justify-between py-2 items-center permissions-locations"> ${this.renderViewPermissionsButton()} <div class="flex items-center">${this.renderLocationsCount()}</div> </div> <div class="next-control"> <ix-button id="next-button" type="submit" has-icon trailing-icon ?disabled="${!this._nextButtonEnabled}" @click="${()=>{this.dispatchNextStepEvent()}}" @keydown="${t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),t.stopPropagation(),this.dispatchNextStepEvent())}}" data-testid="step-four-next-button" aria-label="${this._nextButtonEnabled?"Proceed to next step: User flags":"Next step disabled. Please select locations for all roles."}"> Next <md-icon slot="icon">east</md-icon> </ix-button> </div> </div> `}renderPermissionsDialog(){var t,e;return c` <ix-dialog id="permissions-dialog" ?open="${this.showPermissionsDialog}" @close="${()=>this.showPermissionsDialog=!1}" @opened="${()=>{this.permissionsDialog.focus()}}" aria-modal="true" aria-labelledby="permissions-dialog-title"> <div class="dlr-text-heading" slot="headline" id="permissions-dialog-title"> ${this.selectedRole.name} — Permissions </div> <div class="permissions-content" slot="content"> <user-details-permission inPermissionsDialog .permissionData="${(e=qe((t=this.selectedRolePermissions)!==null&&t!==void 0?t:[]))!==null&&e!==void 0?e:[]}"> </user-details-permission> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${this.togglePermissionsDialog}" slot="secondary" aria-label="Dismiss permissions dialog"><span class="dismiss-btn">Dismiss</span></ix-button> </div> </ix-dialog> `}togglePermissionsDialog(){this.showPermissionsDialog=!this.showPermissionsDialog}renderViewPermissionsButton(){var t,e;return c` <div class="tree-view-permissions"> <ix-button class="temp-button view-permissions" appearance="text" @click="${this.togglePermissionsDialog}" aria-label="View permissions for ${(e=(t=this.selectedRole)===null||t===void 0?void 0:t.name)!==null&&e!==void 0?e:"selected role"}" aria-haspopup="dialog"> View Permissions </ix-button> </div> `}renderLocationsCount(){const t=`font-bold uppercase ${this.noOfLocations?"tree-role-locations-count-active":"tree-role-locations-count"}`,e=this.noOfLocations?`${this.noOfLocations} location${this.noOfLocations===1?"":"s"} selected`:"No locations selected";return c`<div class="tree-role-locations" aria-live="polite" aria-atomic="true"> <span class="${t}" aria-label="${e}"> ${this.noOfLocations?c`${this.noOfLocations} locations`:c`Select Locations`} </span> </div>`}dispatchNextStepEvent(){this.dispatchEvent(new CustomEvent(I.NextStep,{bubbles:!0,composed:!0}))}dispatchNextButtonToggleEvent(){this.dispatchEvent(new CustomEvent(I.NextButtonToggle,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchValidateStepEvent(){this.dispatchEvent(new CustomEvent(I.ValidateStep,{detail:this._nextButtonEnabled,bubbles:!0,composed:!0}))}dispatchUpdateDFAEvent(){const t=new CustomEvent(I.UpdateDFA,{detail:{dataForAccounts:this._dataForAccounts},bubbles:!0,composed:!0});this.dispatchEvent(t)}renderAccountTabbingCard(){return c` <account-tabbing-card data-testid="step-four-account-cards" isRoles .dataForAccounts="${this._dataForAccounts}" .selectedAccountId="${this._selectedAccountId}" @toggle-active-card="${t=>this.toggleActiveCard(t.detail.accountId)}"> </account-tabbing-card> <p class="assign-portal-access-text">Assign portal access to all roles before continuing</p> `}render(){return c` <div class="wizard-step-content overflow-y-auto h-full max-h-screen md:p-1"> ${this.renderAccountTabbingCard()} <div class="tree-view-container-content">${this.renderRoles()}</div> <div class="controls-container">${this.renderControls()}</div> <div class="tree-view-container-footer">${this.renderTree()}</div> </div> ${this.renderAddAccountRoleConfirmation()} ${this.renderRemoveRoleConfirmation()} ${this.renderPermissionsDialog()} `}};D.styles=[He,U,nt],i([C("#permissions-dialog ix-button")],D.prototype,"permissionsDialog",void 0),i([r({type:Array})],D.prototype,"dataForAccounts",void 0),i([r({type:Array})],D.prototype,"permissions",void 0),i([r({type:String})],D.prototype,"selectedAccountId",void 0),i([r({type:String})],D.prototype,"selectedRoleId",void 0),i([r({type:Object})],D.prototype,"contact",void 0),i([d()],D.prototype,"_dataForAccounts",void 0),i([d()],D.prototype,"_selectedAccountId",void 0),i([d()],D.prototype,"_selectedRoleId",void 0),i([d()],D.prototype,"showPermissionsDialog",void 0),i([d()],D.prototype,"removeRoleDialogOpen",void 0),i([d()],D.prototype,"_nextButtonEnabled",void 0),i([C("#add-role-dialog")],D.prototype,"addRoleDialog",void 0),i([C("#role-data-element")],D.prototype,"roleTabComponent",void 0),i([C("user-details-assignments")],D.prototype,"assignmentTreeComponent",void 0),D=i([N("append-accounts-select-locations")],D);const $o=tt`.results-icon ix-icon{font-size:75px;display:block;height:75px}.success-icon{color:#4caf50}.failed-icon{color:#ff9800}.wizard-step-content{height:calc(100vh - 8.5rem);overflow-y:auto}.header{text-align:center;margin-bottom:24px;font-family:var(--root-secondary-font);font-weight:700;font-size:34px;line-height:40px;letter-spacing:.35px;vertical-align:middle}.header h2{font-size:34px}.section__header{padding:16px 24px;font-family:var(--root-secondary-font);font-weight:700;font-size:20px;line-height:24px;letter-spacing:.15px;border-bottom:1px solid #0922411F;display:flex;align-items:center}.section__header ix-icon{--ix-icon-font-size:1.25rem;height:1.25rem;margin-right:16px;display:block}.section__body{padding:24px 32px;display:flex;flex-direction:column;gap:24px}.result__item{display:flex;align-items:center}.result__item .icon{--ix-icon-font-size:2rem;height:2rem;margin-right:24px;display:block}.result__item span{font-weight:400;font-size:16px;line-height:20px;letter-spacing:.15px}.message{overflow:hidden;border-radius:1rem;margin-bottom:1.5rem;border:1px solid #0922411F;box-shadow:0 1px 1px 0 #0000002E;font-family:Open Sans;font-weight:400;font-size:16px;line-height:20px;letter-spacing:.15px}.success-message .section__header{background-color:#edf7ed}.result__details{display:flex;flex-direction:column}.result__item.with-message{align-items:flex-start}.result__details .error-message{color:#db0028;line-height:24px;font-size:14px}.failed-message .section__header{background-color:#fdeded}.failed-message .failed-icon{color:#db0028}.controls{text-align:center}ix-button{display:inline-block;font-family:var(--root-secondary-font)}`;let mt=class extends H{constructor(){super(...arguments),this.addAccountResults={success:[],failed:[]},this.errorMsg="Failed to create the account to user association. Please try again."}connectedCallback(){super.connectedCallback(),this.dispatchEvent(new CustomEvent("refresh-accounts-list",{composed:!0,bubbles:!0})),this.updateComplete.then(()=>{var t;const e=(t=this.shadowRoot)===null||t===void 0?void 0:t.querySelector("[data-focus-target]");e==null||e.focus()})}resultsCard(t){if(this.addAccountResults[t].length===0)return p;const e=t==="success"?"Successfully added accounts":"Accounts that failed to add";return c` <div class="${t}-message message" role="region" aria-label="${e}"> <div class="section__header"> <ix-icon class="${t}-icon" aria-hidden="true">${t==="success"?"check_circle":"error"}</ix-icon> <span class="section__title">${t==="success"?"Accounts Added":"Error Adding Account"}</span> </div> <ul class="section__body" aria-label="${e} list"> ${this.addAccountResults[t].map(o=>c` <li class="result__item ${o.message?"with-message":""}"> <ix-icon class="icon ${t}-icon" aria-label="${t==="success"?"Success":"Error"}" role="img">${t==="success"?"check_circle":"error"}</ix-icon> <div class="result__details"> <span>${o.accountName}</span> ${o.message?c`<div class="error-message" role="alert">${this.errorMsg}</div>`:p} </div> </li> `)} </ul> </div> `}renderHeader(t="success"){return c`<div class="results-icon"> <ix-icon class="icon ${t}-icon" aria-hidden="true">${t==="success"?"check_circle":"warning"}</ix-icon> <h2 tabindex="-1" data-focus-target> ${t==="success"?"Accounts Added":"Some Accounts could not be added"} </h2> </div>`}navigateToUserDetails(){this.dispatchEvent(new CustomEvent("close-wizard",{composed:!0,bubbles:!0}))}render(){var t;const e=((t=this.addAccountResults)===null||t===void 0?void 0:t.failed.length)>0;return c` <div class="wizard-step-content md:p-1"> <div> <div class="header">${this.renderHeader(e?"failed":"success")}</div> ${this.resultsCard("success")} ${this.resultsCard("failed")} <div class="controls"> <ix-button data-testid="${de.BACK_TO_USERS}" appearance="filled" class="p-1" @click="${this.navigateToUserDetails}" aria-label="View user details and close this wizard"><span>View user details</span></ix-button> </div> </div> </div> `}};mt.styles=[$o,yt],i([r({type:Object})],mt.prototype,"addAccountResults",void 0),i([r({type:String})],mt.prototype,"errorMsg",void 0),mt=i([N("append-accounts-results")],mt);let y=class extends H{constructor(){super(...arguments),this.showDrawer=!1,this.showResults=!1,this.submitting=!1,this.selectedAccount={},this.contact={},this.permissions=[],this.roles=[],this.treeData=[],this.loading=!1,this.selectedAccountId="",this.selectedRoleId="",this.step=1,this.dataForAccounts=[],this.isNextButtonEnabled=!1,this.obofSelections=new Map,this.attachments=[]}get stepTitle(){return`Add an Account to ${this.contact.firstName} ${this.contact.lastName}`}get obofEnabled(){return Rt()&&!Y(this.contact.email)}connectedCallback(){super.connectedCallback(),this.setupAccountSelector()}setupAccountSelector(){const t=re().filter(e=>E.hasExternalUserUpdate(e.accountNumber));this.accounts=We(t),Ye(this.accounts),this.accountTree=this.addFixedToAlreadyAddedAccounts(this.selectedAccount),this.permissions=It.getPermissions()}addFixedToAlreadyAddedAccounts(t){if(!t)return t;const e=Array.isArray(t.children)?t.children.map(o=>this.addFixedToAlreadyAddedAccounts(o)):t.children;return{...t,fixed:t.disabled?!0:t.fixed,children:e}}resetStep(){this.handleDialogReset()}setStep(t){this.step=t}onNextButtonToggle(t){this.isNextButtonEnabled=t.detail}onPrevStep(){this.step!==1&&(this.step-=1)}async onNextStep(){var t,e;if(this.isNextButtonEnabled){if(this.loading=!0,this.step===1){if(!this.accountTree){this.loading=!1;return}const o=((t=this.checkedAccounts)===null||t===void 0?void 0:t.map(l=>l.id))||[],s=await Qe.getAccountData(o),a=Tt.get(),n=Y(this.contact.email)&&E.hasAssignInternalRoleCreate(It.getAccountNumber());this.roles=[],this.treeData=[];for(let l=0;l<o.length;l+=1){const u=Ct(o[l],a,n),v=o[l];this.roles.push({accountId:v,roles:structuredClone(u)}),this.treeData.push({contactId:"",accountNumber:v,roleId:"",data:s[l]})}}else if(this.step===2){const o=this.dataForAccounts[0],s=(e=o==null?void 0:o.rolesData)===null||e===void 0?void 0:e[0];if(!o||!s){this.isNextButtonEnabled=!1,this.loading=!1;return}this.selectedAccountId=o.accountId,this.selectedRoleId=s.role.id}else if(this.step===3)for(const o of this.dataForAccounts){const s=this.treeData.find(a=>a.accountNumber===o.accountId);s&&Ze(o,s)}this.step<3&&(this.isNextButtonEnabled=!1),this.loading=!1,this.step+=1}}handleDialogReset(){this.dispatchEvent(new CustomEvent("close-wizard",{bubbles:!0,composed:!0}))}updateAccounts(t){if(this.accountTree=t.detail.rootNode,!this.accountTree||!Array.isArray(this.accountTree.children)){this.checkedAccounts=[],this.dataForAccounts=[];return}const e=ue(this.accounts||[]);this.checkedAccounts=ae(e==="flat"?this.accountTree.children:[this.accountTree],e),this.dataForAccounts=[]}renderWizardStep(){switch(this.step){case 1:{const t=this.accountTree&&Array.isArray(this.accountTree.children)?this.accountTree:void 0;return c` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Accounts*"}" data-testid="append-accounts-select-accounts"> <append-accounts-select-accounts class="flex flex-col overflow-auto grow" .accountTree="${t}" .accountStructure="${ue(this.accounts||[])}" .obofEnabled="${this.obofEnabled}" .obofSelections="${this.obofSelections}" .attachments="${this.attachments}" @update-accounts="${e=>this.updateAccounts(e)}" @update-obof-selections="${e=>{this.obofSelections=e.detail.obofSelections}}" @update-attachments="${e=>{this.attachments=e.detail.attachments}}" @next-step="${this.onNextStep}" @validate-step="${e=>this.isNextButtonEnabled=e.detail}" @next-button-toggle="${e=>this.onNextButtonToggle(e)}"></append-accounts-select-accounts> </ui-um-wizard-step> `}case 2:return c` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Roles"}" data-testid="append-accounts-select-roles"> <append-accounts-select-roles class="flex flex-col overflow-auto grow" .checkedAccounts="${this.checkedAccounts||[]}" .roles="${this.roles}" .dataForAccounts="${this.dataForAccounts}" .treeData="${this.treeData}" @update-dfa="${t=>{this.dataForAccounts=t.detail.dataForAccounts}}" @next-step="${this.onNextStep}" @validate-step="${t=>this.isNextButtonEnabled=t.detail}" @next-button-toggle="${t=>this.onNextButtonToggle(t)}"></append-accounts-select-roles> </ui-um-wizard-step> `;case 3:return c` <ui-um-wizard-step slot="wizard-content" isRequired .stepTitle="${this.stepTitle}" .stepSubTitle="${"Portal Access"}" data-testid="append-accounts-select-locations"> <append-accounts-select-locations class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .selectedRoleId="${this.selectedRoleId}" .permissions="${this.permissions}" .contact="${this.contact}" @update-dfa="${t=>this.dataForAccounts=t.detail.dataForAccounts}" @next-step="${this.onNextStep}" @validate-step="${t=>this.isNextButtonEnabled=t.detail}" @next-button-toggle="${t=>this.onNextButtonToggle(t)}"></append-accounts-select-locations> </ui-um-wizard-step> `;case 4:return c` <ui-um-wizard-step slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"User Flags"}" data-testid="append-accounts-select-flags"> <create-user-step-five class="step" .dataForAccounts="${this.dataForAccounts}" .selectedAccountId="${this.selectedAccountId}" .evacAssistanceRequired="${this.contact.evacAssistance}" @evac-assistance-required="${t=>this.contact.evacAssistance=t.detail}" @next-step="${this.onNextStep}"> </create-user-step-five> </ui-um-wizard-step> `;case 5:return c` <ui-um-wizard-step isLastStep slot="wizard-content" .stepTitle="${this.stepTitle}" .stepSubTitle="${"Are these details correct?"}" ?submitting="${this.submitting}" @create-contact="${this.dispatchCreateNewContactEvent}" data-testid="append-accounts-review"> <create-user-step-six class="step" .dataForAccounts="${this.dataForAccounts}" .newContact="${this.contact}" .obofEnabled="${this.obofEnabled}" .attachments="${this.attachments}" .obofSelections="${this.obofSelections}" hideContactDetails ?submitting="${this.submitting}" @set-step="${t=>this.setStep(t.detail.step)}"></create-user-step-six> </ui-um-wizard-step> `}return p}renderProgress(){return c`<ix-progress slot="wizard-content" indeterminate></ix-progress>`}dispatchCreateNewContactEvent(){this.dispatchEvent(new CustomEvent(I.CreateNewContact,{detail:{newContact:this.contact,dataForAccounts:this.dataForAccounts,attachments:this.attachments,obofSelections:this.obofSelections},bubbles:!0,composed:!0}))}renderDrawerControls(){const t={1:"Select Accounts",2:"Select Roles",3:"Portal Access",4:"User Flags",5:"Review"},e=t[this.step-1],o=t[this.step+1];return c` <div slot="centre-top"> <div role="status" aria-live="polite" aria-atomic="true" class="sr-only"> ${this.showResults?"Results":`Step ${this.step} of 5: ${t[this.step]}`} </div> <div class="flex"> ${this.showResults?p:c` <ix-icon-button class="icon-btn_primary" style="${this.step===1?"visibility: hidden":""}" ?disabled="${this.step===1||this.loading}" @click="${()=>{this.step!==1&&this.onPrevStep()}}" @keydown="${s=>{s.key==="Enter"||s.key===" "?(s.preventDefault(),this.onPrevStep()):s.shiftKey&&s.key==="Tab"&&(s.stopPropagation(),s.preventDefault())}}" icon="chevron_left" data-testid="prev-step-icon" aria-label="Go back to ${e!=null?e:"previous step"}"> </ix-icon-button> <span class="dlr-text-small uppercase font-bold pt-[10px] px-2 step-progress" data-testid="step-progress" aria-hidden="true"> ${this.step} of 5 </span> <ix-icon-button style="${this.step===5?"visibility: hidden":""}" class="icon-btn_primary ${this.step===5||!this.isNextButtonEnabled||this.loading?"disabled":""}" ?disabled="${!this.isNextButtonEnabled||this.loading}" @click="${()=>this.onNextStep()}" @keydown="${s=>{s.key==="Enter"||s.key===" "?(s.preventDefault(),this.onNextStep()):this.step===1&&s.shiftKey&&s.key==="Tab"&&(s.stopPropagation(),s.preventDefault())}}" icon="chevron_right" data-testid="next-step-icon" aria-label="${this.isNextButtonEnabled?`Proceed to ${o!=null?o:"next step"}`:"Next step disabled. Complete the current step to continue."}"> </ix-icon-button> `} </div> </div> `}render(){return c` <ui-um-drawer ?isVisible="${this.showDrawer}" ?summaryScreen="${this.showResults}" ?submitting="${this.submitting}" @close-success="${this.handleDialogReset}" @blur-drawer="${this.handleDialogReset}" @toggle-dialog="${t=>{var e,o;t==null||t.stopPropagation(),this.dispatchEvent(new CustomEvent("close-wizard",{detail:{originElement:(o=(e=t==null?void 0:t.detail)===null||e===void 0?void 0:e.originElement)!==null&&o!==void 0?o:this.drawer},bubbles:!0,composed:!0}))}}" @keydown="${t=>{t.key==="Escape"&&(t.stopPropagation(),this.dispatchEvent(new CustomEvent("close-wizard",{detail:{originElement:this.drawer},bubbles:!0,composed:!0})))}}" data-testid="ui-um-drawer" aria-label="Add account to ${this.contact.firstName} ${this.contact.lastName}" aria-busy="${this.loading}"> ${this.renderDrawerControls()} ${this.showResults?c` <div data-testid="${de.SUCCESS_CREATED}" slot="content" class=""> <append-accounts-results .addAccountResults="${this.addAccountResults}"></append-accounts-results> </div> `:c` <ui-um-wizard class="create-user-wizard" slot="content" data-testid="add-accounts-wizard" aria-label="Add accounts wizard, step ${this.step} of 5"> ${this.loading?c` <div role="status" aria-live="polite" aria-label="Loading step content"> ${this.renderProgress()} </div> `:this.renderWizardStep()} </ui-um-wizard> `} </ui-um-drawer> `}};y.styles=[Ge,U,Ft,yt],i([C("ui-um-drawer")],y.prototype,"drawer",void 0),i([r({type:Boolean})],y.prototype,"showDrawer",void 0),i([r({type:Boolean})],y.prototype,"showResults",void 0),i([r({type:Boolean})],y.prototype,"submitting",void 0),i([r({type:Object})],y.prototype,"selectedAccount",void 0),i([r({type:Object})],y.prototype,"contact",void 0),i([r({type:Object})],y.prototype,"addAccountResults",void 0),i([d()],y.prototype,"accounts",void 0),i([d()],y.prototype,"accountTree",void 0),i([d()],y.prototype,"permissions",void 0),i([d()],y.prototype,"roles",void 0),i([d()],y.prototype,"treeData",void 0),i([d()],y.prototype,"loading",void 0),i([d()],y.prototype,"selectedAccountId",void 0),i([d()],y.prototype,"selectedRoleId",void 0),i([d()],y.prototype,"step",void 0),i([d()],y.prototype,"dataForAccounts",void 0),i([d()],y.prototype,"isNextButtonEnabled",void 0),i([d()],y.prototype,"checkedAccounts",void 0),i([d()],y.prototype,"obofSelections",void 0),i([d()],y.prototype,"attachments",void 0),y=i([N("append-accounts")],y);let L=class extends lt{constructor(){super(...arguments),this.showDrawer=!1,this.showCancelDialog=!1,this.showResults=!1,this.submitting=!1,this.addAccountResults={success:[],failed:[]},this.accountAssociationController=new xe(this)}static get styles(){return[Je,nt,U]}async addAccountsToContact(t){this.submitting=!0;const e=t.detail.newContact,o=t.detail.dataForAccounts,s=t.detail.attachments||[],a=t.detail.obofSelections||new Map,n=o.map(v=>v.accountId),l=Rt()&&!Y(e.email)&&n.length>0,u={success:[],failed:[]};try{let v;if(l){if(_t(!0,n.length>0,a,n)&&s.length===0)throw new Error("At least one authority document is required before submitting.");const h=s.length?await Yt(s):[],m=Qt(a),A=await Zt({authoriserDetails:m,authorityDocuments:h.length?h:void 0});if(!(A!=null&&A.changeHistoryId))throw new Error("Failed to create change history.");v=A.changeHistoryId}(await Promise.allSettled(o.map(async h=>{const{accountId:m,accountName:A}=h,R=e.id,w=e.accounts.find(({accountNumber:X})=>X===m);if((w==null?void 0:w.status)==="REMOVED")await this.accountAssociationController.restore(m,R,!1,v);else if(!w&&!await this.accountAssociationController.add(m,R,!1,v))throw new Error(`Failed to associate account ${m} to contact ${R}`);const B=h.rolesData.filter(X=>!X.role.removed).map(X=>({key:X.role.id,items:X.locations}));return await ye(R,m,B,v),await ge(R,m,h.flagData,v),w||e.accounts.push({accountNumber:m}),{accountName:A,accountId:m}}))).forEach((h,m)=>{if(h.status==="fulfilled"){u.success.push(h.value);return}u.failed.push({accountId:o[m].accountId,accountName:o[m].accountName,message:h.reason instanceof Error?h.reason.message:"An error occurred"})})}catch(v){const h=v instanceof Error?v.message:"An error occurred";o.forEach(m=>{u.failed.push({accountId:m.accountId,accountName:m.accountName,message:h})})}finally{this.submitting=!1}this.addAccountResults={success:[...u.success],failed:[...u.failed]},this.showResults=!0}handleCloseWizard(t){var e,o,s,a,n;!((o=(e=this.addAccountResults)===null||e===void 0?void 0:e.success)===null||o===void 0)&&o.length||!((a=(s=this.addAccountResults)===null||s===void 0?void 0:s.failed)===null||a===void 0)&&a.length||(t==null||t.stopPropagation(),this.lastFocusedElement=(n=t==null?void 0:t.detail)===null||n===void 0?void 0:n.originElement,this.showCancelDialog=!0)}renderCancelDialog(){return c` <ix-dialog id="cancel-add-account-dialog" ?open="${this.showCancelDialog}" @cancel="${()=>{this.showCancelDialog=!1,setTimeout(()=>{this.lastFocusedElement&&this.lastFocusedElement.focus()},10)}}" @opened="${()=>{this.cancelDialog.focus()}}" data-testid="dialog-cancel-add-account" aria-modal="true" aria-labelledby="cancel-add-account-dialog-title"> <div class="dlr-text-heading md:w-[560px]" slot="headline"> <p tabindex="-1" id="cancel-add-account-dialog-title" @keydown="${t=>{t.shiftKey&&t.key==="Tab"&&(t.preventDefault(),this.cancelDialog.focus())}}"> Are you sure you want to cancel? </p> </div> <div class="dialog-content" slot="content"> <p>All the details provided will be lost.</p> </div> <div class="dialog-actions" slot="actions"> <ix-button appearance="text" @click="${()=>{this.showCancelDialog=!1,setTimeout(()=>{this.lastFocusedElement&&this.lastFocusedElement.focus()},10)}}" slot="secondary" data-testid="dismiss-close-add-account-button" aria-label="Dismiss — continue adding account"> Dismiss </ix-button> <ix-button appearance="text" @click="${()=>{this.dispatchEvent(new CustomEvent("close-wizard",{bubbles:!0,composed:!0}))}}" @keydown="${t=>{t.key==="Tab"&&(t.preventDefault(),this.cancelDialog.focus())}}" slot="primary" data-testid="cancel-add-account-button" aria-label="Confirm cancel — discard all entered details and close wizard"> Cancel adding account </ix-button> </div> </ix-dialog> `}render(){return c` <append-accounts .contact="${this.contact}" ?showDrawer="${this.showDrawer}" ?submitting="${this.submitting}" ?showResults="${this.showResults}" .addAccountResults="${this.addAccountResults}" .selectedAccount="${this.selectedAccount}" @create-new-contact="${t=>this.addAccountsToContact(t)}" @close-wizard="${this.handleCloseWizard}" data-testid="um-append-accounts" aria-busy="${this.submitting}"></append-accounts> ${this.showCancelDialog?this.renderCancelDialog():p} `}};i([C('#cancel-add-account-dialog [tabindex="-1"]')],L.prototype,"cancelDialog",void 0),i([r({type:Boolean})],L.prototype,"showDrawer",void 0),i([r({type:Boolean})],L.prototype,"showCancelDialog",void 0),i([r({type:Object})],L.prototype,"contact",void 0),i([r({type:Object})],L.prototype,"selectedAccount",void 0),i([d()],L.prototype,"showResults",void 0),i([d()],L.prototype,"submitting",void 0),i([d()],L.prototype,"lastFocusedElement",void 0),i([d()],L.prototype,"addAccountResults",void 0),i([C("append-accounts")],L.prototype,"appendAccounts",void 0),L=i([N("add-accounts-to-contact")],L);let V=class extends lt{constructor(){super(...arguments),this.assignableAccounts=[],this.activeAccountNumber="",this.readonly=!1,this.selectedAccountNumber="",this.activeAccountIndex=0,this.showAppendAccountWizard=!1,this.selectedAccount={},this.changeSelectedAccount=async(t,e=!1)=>{this.activeAccountIndex=this.assignedAccounts.findIndex(o=>o.accountNumber===t),!(this.activeAccountNumber===this.assignedAccounts[this.activeAccountIndex].accountNumber&&x.DRAFT!==this.assignedAccounts[this.activeAccountIndex].status)&&this.activeAccountIndex>-1&&this.dispatchEvent(new CustomEvent(dt.ChangeAccountAssociation,{detail:{accountNumber:t,overrideUnsavedChanges:e}}))},this.onAccountClick=t=>{this.changeSelectedAccount(t)},this.handleAddAccounts=()=>{this.selectedAccount=Xe(this.assignableAccounts),this.disableAssignedAccountsInTree(this.selectedAccount),this.showAppendAccountWizard=!0}}get assignedAccounts(){return[...this.contact.accounts,ut.get()]}get assignedAccountNames(){var t,e,o;return(o=(e=(t=this.contact)===null||t===void 0?void 0:t.accounts)===null||e===void 0?void 0:e.filter(s=>s.status!==x.REMOVED))===null||o===void 0?void 0:o.map(s=>s.name)}get selectedAccountName(){var t;const e=this.assignableAccounts.find(o=>o.accountNumber===this.selectedAccountNumber);return(t=e==null?void 0:e.displayName)!==null&&t!==void 0?t:e==null?void 0:e.name}get roleNames(){const t=It.getAccounts().find(s=>s.accountNumber===this.selectedAccountNumber)||null,e=Y(this.contact.email)&&E.hasAssignInternalRoleCreate(this.selectedAccountNumber),o=Ct(t==null?void 0:t.accountNumber,Tt.get(),e);return o==null?void 0:o.map(s=>s.name)}get fullName(){var t,e;return`${(t=this.contact)===null||t===void 0?void 0:t.firstName} ${(e=this.contact)===null||e===void 0?void 0:e.lastName}`}firstUpdated(){this.changeSelectedAccount(this.assignedAccounts[this.activeAccountIndex].accountNumber)}willUpdate(){!this.assignedAccounts[this.activeAccountIndex].accountNumber&&this.assignedAccounts.length&&this.changeSelectedAccount(this.assignedAccounts[0].accountNumber)}renderAccounts(){var t;const e=(t=this.assignedAccounts)===null||t===void 0?void 0:t.filter(s=>s.status===x.ACTIVE||s.status===x.INVITED||s.status===x.DRAFT),o=this.assignedAccounts.filter(s=>s.status===x.SUSPENDED||s.status===x.REMOVED||s.status===x.DECLINED).filter(s=>!e.find(a=>a.displayName===s.displayName));return c` <ul class="accounts-list" aria-label="Active accounts" data-testid="${f.ACCOUNTS_LIST}"> ${e==null?void 0:e.map(s=>c` <li> <dr-account data-testid="${f.ACCOUNT(s.accountNumber)}" .account="${s}" .active="${s.accountNumber===this.activeAccountNumber}" .status="${s.status}" @account-click="${a=>this.onAccountClick(a.detail.accountNumber)}"></dr-account> </li> `)} </ul> ${o.length>0?c` <ix-divider class="divider" aria-hidden="true" data-testid="${f.ACCOUNT_DIVIDER}"></ix-divider> <ul class="accounts-list" aria-label="Inactive accounts"> ${o.map(s=>c` <li> <dr-account data-testid="${f.ACCOUNT(s.accountNumber)}" .account="${s}" .active="${s.accountNumber===this.activeAccountNumber}" .status="${s.status}" @account-click="${a=>this.onAccountClick(a.detail.accountNumber)}"></dr-account> </li> `)} </ul> `:p} `}disableAssignedAccountsInTree(t){t&&(Array.isArray(t)?t.forEach(e=>this.disableAssignedAccountsInTree(e)):(t.id&&this.assignedAccounts.some(e=>{var o;return e.accountNumber===t.id&&((o=e.status)===null||o===void 0?void 0:o.toLowerCase())!==x.REMOVED.toLowerCase()})&&(t.disabled=!0,t.children&&t.children.length>0&&(t.expanded=!0)),t.children&&Array.isArray(t.children)&&t.children.forEach(e=>this.disableAssignedAccountsInTree(e))))}renderAccountsCard(){return c` <div class="accounts-card"> <div class="accounts-card-header" data-testid="${f.CARD_HEADER}"> <div class="dlr-text-heading accounts-card-header-text">Accounts</div> ${this.renderButton()} </div> <div class="accounts-card-body" data-testid="${f.CARD_BODY}"> ${this.contact.accounts.length>0?this.renderAccounts():c`You have no accounts`} </div> </div> `}renderButton(){return this.readonly?p:c`<ix-button data-testid="${f.BTN_ADD_ACCOUNT}" appearance="text" text="Add Account" has-icon @click="${this.handleAddAccounts}"> <md-icon slot="icon">add</md-icon> Add Account </ix-button>`}render(){return c` ${this.renderAccountsCard()} ${this.showAppendAccountWizard?c`<add-accounts-to-contact ?showDrawer="${!0}" .selectedAccount="${this.selectedAccount}" .contact="${O.get()}" @close-wizard="${()=>{this.showAppendAccountWizard=!1,document.body.style.overflow="auto",document.documentElement.style.overflow="initial"}}"></add-accounts-to-contact>`:p} `}};V.styles=[Ao,U],i([r()],V.prototype,"contact",void 0),i([r({type:Array,attribute:!1})],V.prototype,"assignableAccounts",void 0),i([r({type:String})],V.prototype,"activeAccountNumber",void 0),i([r({type:Boolean})],V.prototype,"readonly",void 0),i([d()],V.prototype,"selectedAccountNumber",void 0),i([d()],V.prototype,"activeAccountIndex",void 0),i([d()],V.prototype,"showAppendAccountWizard",void 0),i([d()],V.prototype,"selectedAccount",void 0),V=i([N("accounts-card")],V);const wo=tt`ix-dialog{--md-dialog-container-color:#fff}ix-icon-button{--md-sys-color-on-surface-variant:var(--md-sys-color-primary)}ix-select{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd;--md-menu-container-color:#fff}ix-select.thick{--md-menu-container-shape:10px}ix-select.slim{--md-outlined-field-bottom-space:2px;--md-outlined-field-top-space:2px}ix-button{--md-outlined-button-outline-color:var(--md-sys-color-primary);--md-outlined-select-text-field-outline-color:#ddd}ix-button .disabled{color:var(--md-sys-text-color-disabled)}.btn_primary{--md-filled-button-container-color:var(--md-sys-color-primary)}.btn_primary ix-icon{color:var(--md-sys-color-on-primary)}.btn_secondary{--md-filled-button-container-color:var(--md-sys-color-secondary)}.btn_secondary ix-icon{color:var(--md-sys-color-on-secondary)}.btn_tertiary{--md-filled-button-container-color:var(--md-sys-color-tertiary)}.btn_tertiary ix-icon{color:var(--md-sys-color-on-tertiary)}.btn_danger{--md-filled-button-container-color:var(--md-sys-color-error)}.btn_danger ix-icon{color:var(--md-sys-color-on-error)}.icon-btn_primary ix-icon{color:var(--md-sys-color-primary)}.icon-btn_secondary ix-icon{color:var(--md-sys-color-secondary)}.icon-btn_tertiary ix-icon{color:var(--md-sys-color-tertiary)}.icon-btn_danger ix-icon{color:var(--md-sys-color-error)}ix-icon.icon-lg{--ix-icon-font-size:32px}.dialog-form{min-width:500px;display:flex;flex-direction:column;justify-content:space-between;padding:8px 24px 20px}.dialog-form .textfield{width:100%}.dialog-form.sm{min-width:560px}.dialog-form__textbox{padding-top:1rem}.dialog-actions{display:flex;justify-content:flex-end;padding:8px 15px 8px 20px}@media only screen and (min-width:5px) and (max-width:600px){ix-dialog{--md-dialog-container-shape:6px}}@media only screen and (min-width:601px){ix-dialog{--md-dialog-container-shape:3px}}.um-card{padding:.5rem;background:#fff;border-radius:12px 12px 0 0;box-shadow:rgba(0,0,0,.12) 0 12px 20px -12px,#e1e4e8 0 0 0 1px inset}#user-management{color:rgba(9,34,65,.7)}nav{margin-top:2px;margin-bottom:1.5rem}user-details{margin-bottom:16px}.crumbs ol{list-style-type:none;padding-left:0;display:flex}.crumb{display:inline-block}.crumb a::after{display:inline-block;padding:0 3px}.crumbs-separator{display:flex;user-select:none;margin-left:12.5px;margin-right:12.5px}#current-nav{pointer-events:none;cursor:default}@media only screen and (max-width:600px){.um-card.rounded-lg{border-radius:0;box-shadow:none}.user-details{margin:0 .5rem}}@media only screen and (max-width:767px){.user-details-view{margin:0 1rem}}@media only screen and (min-width:601px) and (max-width:1200px){.user-details-view{margin:0 1rem}.user-details-account-panel{display:flex;flex-direction:row}.user-details-account-panel>div{flex:1;width:50px}.user-details-account-panel>div:first-child{margin-top:6px}}`;class Eo{constructor(e){(this._host=e).addController(this)}hostConnected(){}hostDisconnected(){}hostUpdate(){}async getContact(e){return await rt.get({id:e})}}class J{}J.CRUMBS="user-management-details-view-crumbs",J.USER_DETAILS="user-management-details-view-user-details",J.ACCOUNTS_CARD="user-management-details-view-accounts-card",J.USER_DETAILS_PANEL="user-management-details-view-user-details-panel",J.USER_MANAGEMENT_PANEL="user-management-details-view-user-management-panel";let z=class extends lt{constructor(){super(...arguments),this.contactController=new Eo(this),this.roles=[],this.isPageLoading=!1,this.confirmationDialogIsOpen=!1,this.refreshAccountList=async()=>{var t;this.contact=await this.contactController.getContact(this.contactId),this.contact.accounts=ve(this.contact.accounts),O.set(this.contact);const e=(t=this.contact.accounts[0])===null||t===void 0?void 0:t.accountNumber;e&&await this.handleAccountChange(e,!0)}}get assignableAccounts(){return re().filter(t=>E.hasExternalUserUpdate(t.accountNumber))}get fullName(){var t,e;return`${(t=this.contact)===null||t===void 0?void 0:t.firstName} ${(e=this.contact)===null||e===void 0?void 0:e.lastName}`}get readonly(){var t,e,o,s,a;let n;return Xt().UserManagement.InternalUserRetired?n=E.hasUserUpdate((t=this.account)===null||t===void 0?void 0:t.accountNumber):n=Y((e=this.contact)===null||e===void 0?void 0:e.email)?E.hasInternalUserUpdate((o=this.account)===null||o===void 0?void 0:o.accountNumber):E.hasExternalUserUpdate((s=this.account)===null||s===void 0?void 0:s.accountNumber),!n||E.isProfileOfLoggedInUser((a=this.contact)===null||a===void 0?void 0:a.email)}async connectedCallback(){super.connectedCallback(),this.getCurrentContactFromUrl(),await E.refreshAccounts(),this.disposeReaction=Ae(()=>O.get(),()=>{this.contact=O.get()})}disconnectedCallback(){super.disconnectedCallback(),this.disposeReaction()}async firstUpdated(){P.clear(),ut.clear(),this.roles=Tt.get(),this.contact=await this.contactController.getContact(this.contactId),this.contact.accounts=ve(this.contact.accounts),O.set(this.contact)}async saveUser(){await rt.update({id:this.contact.id,contactInput:{...this.contact}}),O.refresh()}async getCurrentContactFromUrl(){this.contactId=new URL(window.location.href).searchParams.get("id")||void 0,this.contactId||to(Ot.UserManagement)}openDirtyPageWarning(t){this.confirmationDialogIsOpen=!0,this.requestedAccount=t}async handleAccountChange(t,e=!1){var o,s,a;if(!((o=this.contact)===null||o===void 0)&&o.accounts){if(!e&&!((s=this.userDetailsPanel)===null||s===void 0)&&s.isDirty){this.openDirtyPageWarning(t);return}this.account=[ut.get(),...this.contact.accounts].find(n=>n.accountNumber===t),this.userDetailsPanel=await this.userDetailsPanelAsync,(a=this.userDetailsPanel)===null||a===void 0||a.loadAccount()}}renderDialogs(){return c`<changes-confirmation id="confirmation-dialog" ?isOpen="${this.confirmationDialogIsOpen}" headerText="You have unsaved changes." bodyText="If you leave this account, you will lose the changes you made." confirmationButtonText="Discard Changes" cancelButtonText="Dismiss" @confirm="${async()=>{this.handleAccountChange(this.requestedAccount,!0);const t=await this.userDetailsPanel;t==null||t.resetForm(),this.confirmationDialogIsOpen=!1}}" @cancel="${()=>{this.confirmationDialogIsOpen=!1}}"> </changes-confirmation> <before-leave-dialog .isDirtyCallback="${()=>{var t;return(t=this.userDetailsPanel)===null||t===void 0?void 0:t.isDirty}}"> </before-leave-dialog>`}renderLoading(){return c`<ix-progress aria-label="User details panel" indeterminate> </ix-progress>`}renderContent(){var t,e,o;return!this.contact||!this.contact.accounts?this.renderLoading():c` <div class="flex flex-col h-full overflow-hidden lg:flex-row gap-6"> <div class="lg:w-1/3 user-details-view"> <nav class="crumbs" data-testid="${J.CRUMBS}"> <ol> <li class="crumb"> <a id="user-management" href="${he(Ot.UserManagement)}">User Management</a> </li> <li class="crumbs-separator">></li> <li class="crumb"> <a id="current-nav" href="${he(Ot.UserManagementDetails)}">${c`${this.fullName}`}</a> </li> </ol> </nav> <div class="user-details-account-panel"> <div> <user-details-view data-testid="${J.USER_DETAILS}" .contact="${O.get()}" .saveChanges="${()=>this.saveUser()}" .selectedAccountNumber="${(t=this.account)===null||t===void 0?void 0:t.accountNumber}"></user-details-view> </div> <div> <accounts-card data-testid="${J.ACCOUNTS_CARD}" .contact="${O.get()}" .activeAccountNumber="${(o=(e=this.account)===null||e===void 0?void 0:e.accountNumber)!==null&&o!==void 0?o:""}" .assignableAccounts="${this.assignableAccounts}" .readonly="${this.readonly}" @refresh-accounts-list="${this.refreshAccountList}" @change-account="${s=>this.handleAccountChange(s.detail.accountNumber,s.detail.overrideUnsavedChanges)}"></accounts-card> </div> </div> </div> <div class="rounded-lg um-card grow overflow-auto md:mx-4 lg:mx-0"> <user-details-panel data-testid="${J.USER_MANAGEMENT_PANEL}" id="user-management-panel" .contact="${O.get()}" .account="${this.account}" .roles="${this.roles}" .readonly="${this.readonly}" @reload-account="${s=>this.handleAccountChange(s.detail.accountNumber,s.detail.overrideUnsavedChanges)}"> </user-details-panel> </div> </div> ${this.renderDialogs()} `}render(){return this.isPageLoading?this.renderLoading():this.renderContent()}};z.styles=[wo,U],i([d()],z.prototype,"account",void 0),i([d()],z.prototype,"contact",void 0),i([d()],z.prototype,"contactId",void 0),i([d()],z.prototype,"roles",void 0),i([d()],z.prototype,"isPageLoading",void 0),i([d()],z.prototype,"confirmationDialogIsOpen",void 0),i([W("#user-management-panel")],z.prototype,"userDetailsPanelAsync",void 0),z=i([N("user-management-details-view")],z);export{z as UserManagementDetailsView};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Webcomponent ui-user-management following open-wc recommendations",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "ui-user-management",
|
|
6
|
-
"version": "16.0.
|
|
6
|
+
"version": "16.0.15",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"exports": {
|
|
9
9
|
"./ui-user-management.js": "./dist/ui-user-management.js",
|