Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@descope/user-management-widget

Package Overview
Dependencies
Maintainers
0
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@descope/user-management-widget - npm Package Compare versions

Comparing version 0.4.128 to 0.4.129

4

dist/esm/index.js
/**
* @descope/user-management-widget v0.4.128
* @descope/user-management-widget v0.4.129
*/
import{pluralize as e,compareArrays as t,createSingletonMixin as s,compose as i,createTemplate as o,withMemCache as r,debounce as a}from"@descope/sdk-helpers";import{__awaiter as n,__classPrivateFieldGet as d,__classPrivateFieldSet as l,__rest as u}from"tslib";import{projectIdMixin as c,observeAttributesMixin as h,loggerMixin as v,baseUrlMixin as g,createValidateAttributesMixin as m,createStateManagementMixin as p,initLifecycleMixin as y,staticResourcesMixin as f,descopeUiMixin as b,initElementMixin as w,modalMixin as R,formMixin as M,notificationsMixin as W,debuggerMixin as P,themeMixin as U}from"@descope/sdk-mixins";import{ButtonDriver as k,MultiSelectDriver as C,TextDriver as S,TextFieldDriver as x,GridDriver as I}from"@descope/sdk-component-drivers";import{createSelector as j}from"reselect";import{createAsyncThunk as N}from"@reduxjs/toolkit";import L from"@descope/web-js-sdk";import O from"libphonenumber-js/min";const T=(e,t)=>Object.entries(e).reduce(((e,[s,i])=>{const[o,...r]=s.split(".");return t!==o?Object.assign(e,{[s]:i}):(e[o]||(e[o]={}),e[o][r.join(".")]=i,e)}),{}),A=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,s])=>[`${t}.${e}`,s]))),q={enabled:"active",disabled:"disabled",invited:"invited"},F=e=>e.tenantRoles.data,$=e=>e.selectedUsersLoginIds,B=e=>e.notifications,E=e=>e.customAttributes.data,D=j((e=>e.usersList.data),(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),A(null==e?void 0:e.customAttributes,"customAttributes")),{status:q[e.status]||e.status,roles:e.roleNames}))))),H=j($,D,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),Z=j(H,(e=>e.map((e=>e.userId)))),V=j(H,(e=>e.map((e=>e.status)))),z=j(H,(e=>e.every((e=>e.editable)))),J=j($,(e=>!!e.length)),G=j($,(e=>1===e.length)),K=j($,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),Q=j(G,V,((e,t)=>e&&t.every((e=>e===q.enabled)))),X=j(V,(e=>e.every((e=>e===q.disabled)))),Y=j(H,(e=>{var t;return 1===e.length?e[0].name||e[0].email||(null===(t=e[0].loginIds)||void 0===t?void 0:t[0]):`${e.length} users`})),_=j(G,X,z,((e,t,s)=>e&&t&&s)),ee=j(G,Q,z,((e,t,s)=>e&&t&&s)),te=j(G,z,((e,t)=>e&&t)),se=j(G,z,((e,t)=>e&&t)),ie=j(G,z,((e,t)=>e&&t)),oe=J,re=e=>(...t)=>s=>{s.addCase(e.pending,((e,s)=>{t.forEach((({onPending:t})=>{null==t||t(e,s)}))})),s.addCase(e.fulfilled,((e,s)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,s)}))})),s.addCase(e.rejected,((e,s)=>{t.forEach((({onRejected:t})=>{null==t||t(e,s)}))}))},ae=e=>({onFulfilled:t=>{e(t).loading=!1},onPending:t=>{e(t).loading=!0,e(t).error=null},onRejected:(t,s)=>{e(t).loading=!1,e(t).error=s.error}}),ne=({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,s)=>{t&&e.notifications.push({type:"success",msg:t(s)})},onRejected:(t,s)=>{e&&t.notifications.push({type:"error",msg:e(s)})}}),de=N("users/create",((e,{extra:{api:t}})=>t.user.create(e))),le=re(de)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},ae((e=>e.createUser)),ne({getSuccessMsg:()=>"User created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),ue={action:de,reducer:le},ce=N("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),he=re(ce)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},ae((e=>e.deleteUser)),ne({getSuccessMsg:t=>e(t.meta.arg.length)`${["",t.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:t=>e(t.meta.arg.length)`Failed to delete user${["","s"]}`})),ve={action:ce,reducer:he},ge=N("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),me=re(ge)(ae((e=>e.setTempUserPassword)),ne({getSuccessMsg:()=>"Successfully reset user password",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to reset user's password</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),pe={action:ge,reducer:me},ye=N("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),fe=re(ye)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},ae((e=>e.customAttributes))),be={action:ye,reducer:fe},we=N("users/search",((e,{extra:{api:t},getState:s})=>{const i=s().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),Re=re(we)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},ae((e=>e.usersList))),Me={action:we,reducer:Re},We=N("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Pe=re(We)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},ae((e=>e.tenantRoles))),Ue={action:We,reducer:Pe},ke=N("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Ce=re(ke)({onFulfilled:(e,s)=>{const i=e.usersList.data.findIndex((e=>t(e.loginIds,s.payload.loginIds)));-1!==i&&(e.usersList.data[i]=s.payload)}},ae((e=>e.updateUser)),ne({getSuccessMsg:()=>"User updated successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to update user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Se={action:ke,reducer:Ce},xe=N("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Ie=re(xe)({onFulfilled:(e,s)=>{var i;const o=e.usersList.data.findIndex((e=>{var i;return t(e.loginIds,null===(i=s.payload.user)||void 0===i?void 0:i.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(i=s.payload.user)||void 0===i?void 0:i.status)}},ae((e=>e.enableUser)),ne({getSuccessMsg:()=>"User enabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to enable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),je={action:xe,reducer:Ie},Ne=N("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Le=re(Ne)({onFulfilled:(e,s)=>{var i;const o=e.usersList.data.findIndex((e=>{var i;return t(e.loginIds,null===(i=s.payload.user)||void 0===i?void 0:i.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(i=s.payload.user)||void 0===i?void 0:i.status)}},ae((e=>e.disableUser)),ne({getSuccessMsg:()=>"User disabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to disable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Oe={action:Ne,reducer:Le},Te=N("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),Ae={action:Te,reducer:re(Te)(ae((e=>e.removePasskey)),ne({getSuccessMsg:()=>"Successfully removed user's passkey",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to remove user's passkey</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}}))},qe={usersList:{data:[],loading:!1,error:null},createUser:{loading:!1,error:null},updateUser:{loading:!1,error:null},deleteUser:{loading:!1,error:null},enableUser:{loading:!1,error:null},disableUser:{loading:!1,error:null},removePasskey:{loading:!1,error:null},setTempUserPassword:{loading:!1,error:null},customAttributes:{loading:!1,error:null,data:[]},tenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedUsersLoginIds:[],notifications:[]},Fe={search:"/v1/mgmt/user/search",deleteBatch:"/v1/mgmt/user/delete/batch",create:"/v1/mgmt/user/create",update:"/v1/mgmt/user/update",status:"/v1/mgmt/user/update/status",setTempPassword:"/v1/mgmt/user/password/set/temporary",removePasskey:"/v1/mgmt/user/passkeys/delete",customAttributes:"/v1/mgmt/user/customattributes"},$e={roles:"/v1/mgmt/role/all"},Be=e=>n(void 0,void 0,void 0,(function*(){const t=yield e.text(),s=JSON.parse(t);if(!e.ok){const t=`${s.errorDescription}${s.errorMessage?`: ${s.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(s),e.text=()=>Promise.resolve(t)})),Ee=e=>n(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((s=>{const i=[];for(let e=1;e<10;e+=1)i.push({loginIds:[`user${e}@company.com`],externalIds:[`user${e}@company.com`],userId:`user-${e}`,name:`User ${e}`,email:`user${e}@company.com`,roleNames:[`Role ${e}`],phone:`+1-202-555-010${e}`,verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{i.sort(((t,s)=>{var i,o;return e.desc?null===(o=s[e.field])||void 0===o?void 0:o.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(s[e.field])}))})),s(i.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.phone.toLowerCase().includes(e.toLowerCase())||t.status.toLowerCase().includes(e.toLowerCase())||"active"===e.toLowerCase()||t.familyName.toLowerCase().includes(e.toLowerCase())||t.givenName.toLowerCase().includes(e.toLowerCase())||t.middleName.toLowerCase().includes(e.toLowerCase())||t.email.toLowerCase().includes(e.toLowerCase()))))}))})),De=e=>n(void 0,[e],void 0,(function*({loginId:e,email:t,phone:s,displayName:i,roles:o,customAttributes:r,picture:a,verifiedEmail:n,verifiedPhone:d,givenName:l,middleName:u,familyName:c}){return new Promise((h=>{const v=Math.random().toString(10).substring(15);h({loginIds:[e],externalIds:[e],userId:`user-${v}`,email:t,phone:s,name:i,roleNames:o,customAttributes:r,picture:a,verifiedEmail:n,verifiedPhone:d,givenName:l,middleName:u,familyName:c,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})),He=e=>n(void 0,[e],void 0,(function*({loginId:e,email:t,phone:s,displayName:i,roles:o,customAttributes:r,picture:a,verifiedEmail:n,verifiedPhone:d,givenName:l,middleName:u,familyName:c}){return new Promise((h=>{h({loginIds:[e],externalIds:[e],userId:e,email:t,phone:s,name:i,roleNames:o,customAttributes:r,picture:a,verifiedEmail:n,verifiedPhone:d,givenName:l,middleName:u,familyName:c,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})),Ze=()=>n(void 0,void 0,void 0,(function*(){})),Ve=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))})),ze=()=>n(void 0,void 0,void 0,(function*(){})),Je=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})),Ge=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})),Ke=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))})),Qe=e=>new Promise((t=>{const s=[];for(let t=1;t<5;t+=1)s.push({name:`Role ${t}`,description:`Role description ${t}`,createdTime:new Date,permissionNames:[`Permission ${t}`],tenantId:e});t({roles:s})})),Xe=({httpClient:e,tenant:t,mock:s})=>({search:(...i)=>n(void 0,[...i],void 0,(function*({page:i,limit:o=1e4,customAttributes:r,statuses:a,emails:n,phones:d,text:l,sort:u}={}){if(s)return Ee({page:i,limit:o,customAttributes:r,statuses:a,emails:n,phones:d,text:l,sort:u});const c=yield e.post(Fe.search,{limit:o,page:i,withTestUser:!1,customAttributes:r,statuses:a,emails:n,phones:d,text:l,sort:u},{queryParams:{tenant:t}});yield Be(c);return(yield c.json()).users})),deleteBatch:i=>n(void 0,void 0,void 0,(function*(){if(s)return Ze();const o=yield e.post(Fe.deleteBatch,{userIds:i},{queryParams:{tenant:t}});return yield Be(o),o.json()})),create:i=>n(void 0,[i],void 0,(function*({loginId:i,email:o,phone:r,displayName:a,roles:n,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,givenName:h,middleName:v,familyName:g,additionalLoginIds:m,sendSMS:p,sendMail:y,inviteUrl:f,invite:b}){if(s)return De({loginId:i,email:o,phone:r,displayName:a,roles:n,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,givenName:h,middleName:v,familyName:g,additionalLoginIds:m,sendSMS:p,sendMail:y,inviteUrl:f,invite:b});const w=yield e.post(Fe.create,{loginId:i,email:o,phone:r,displayName:a,givenName:h,middleName:v,familyName:g,roleNames:n,userTenants:[{tenantId:t}],customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,additionalLoginIds:m,sendSMS:p,sendMail:y,inviteUrl:f,invite:b},{queryParams:{tenant:t}});yield Be(w);return(yield w.json()).user})),update:i=>n(void 0,[i],void 0,(function*({loginId:i,email:o,phone:r,displayName:a,roles:n,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,givenName:h,middleName:v,familyName:g,additionalLoginIds:m}){if(s)return He({loginId:i,email:o,phone:r,displayName:a,roles:n,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,givenName:h,middleName:v,familyName:g,additionalLoginIds:m});const p=yield e.post(Fe.update,{loginId:i,email:o,phone:r,displayName:a,givenName:h,middleName:v,familyName:g,roleNames:n,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,additionalLoginIds:m},{queryParams:{tenant:t}});yield Be(p);return(yield p.json()).user})),enable:i=>n(void 0,void 0,void 0,(function*(){if(s)return Je(i);const o=yield e.post(Fe.status,{loginId:i,status:"enabled"},{queryParams:{tenant:t}});return yield Be(o),o.json()})),disable:i=>n(void 0,void 0,void 0,(function*(){if(s)return Ge(i);const o=yield e.post(Fe.status,{loginId:i,status:"disabled"},{queryParams:{tenant:t}});return yield Be(o),o.json()})),removePasskey:i=>n(void 0,void 0,void 0,(function*(){if(s)return ze();const o=yield e.post(Fe.removePasskey,{loginId:i},{queryParams:{tenant:t}});return yield Be(o),o.json()})),setTempPassword:i=>n(void 0,void 0,void 0,(function*(){if(s)return Ve();const o=yield e.post(Fe.setTempPassword,{loginId:i},{queryParams:{tenant:t}});return yield Be(o),o.json()})),getCustomAttributes:()=>n(void 0,void 0,void 0,(function*(){if(s)return Ke();const i=yield e.get(Fe.customAttributes,{queryParams:{tenant:t}});yield Be(i);return(yield i.json()).data}))}),Ye=({httpClient:e,tenant:t,mock:s})=>({getTenantRoles:()=>n(void 0,void 0,void 0,(function*(){if(s)return Qe(t);const i=yield e.get($e.roles,{queryParams:{tenant:t}});return yield Be(i),i.json()}))}),_e=s((e=>{var t,s,o,r;const a=i(c,h,v,g,m({tenant:m.missingAttrValidator}))(e);return r=class extends a{constructor(){super(...arguments),t.add(this),s.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return d(this,s,"f")||d(this,t,"m",o).call(this),d(this,s,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{d(this,s,"f")&&d(this,t,"m",o).call(this)}))}))}},s=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),l(this,s,((e,t,s,i)=>{const o=L(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.4.128"}}));return{user:Xe({httpClient:o.httpClient,tenant:t,mock:s}),tenant:Ye({httpClient:o.httpClient,tenant:t,mock:s})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),et=s((e=>{const t=i(p({name:"widget",initialState:qe,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{ue.reducer(e),Se.reducer(e),je.reducer(e),Oe.reducer(e),ve.reducer(e),Me.reducer(e),pe.reducer(e),Ae.reducer(e),be.reducer(e),Ue.reducer(e)},asyncActions:{searchUsers:Me.action,createUser:ue.action,updateUser:Se.action,enableUser:je.action,disableUser:Oe.action,deleteUsers:ve.action,removePasskey:Ae.action,getCustomAttributes:be.action,getTenantRoles:Ue.action,setTempUserPassword:pe.action}}),y,v,_e)(e);return class extends t{constructor(...e){super(...e),this.state=qe,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),tt=s((e=>{const t=i(f,m({"widget-id":m.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return n(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),st=s((e=>{var t,s,r;return r=class extends(i(v,y,b,w,tt,et)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return n(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([d(this,t,"m",s).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),this.onWidgetRootReady()}))}},t=new WeakSet,s=function(){return n(this,void 0,void 0,(function*(){const e=o(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},r})),it=s((e=>{var t,s,r,a,u,c;return c=class extends(i(et,R,M,v,st)(e)){constructor(){super(...arguments),t.add(this),s.set(this,void 0),u.set(this,(()=>n(this,void 0,void 0,(function*(){yield d(this,s,"f").setData(F(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),d(this,t,"m",r).call(this)}))}},s=new WeakMap,u=new WeakMap,t=new WeakSet,r=function(){return n(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(o(yield this.fetchWidgetPage("create-user-modal.html")));new k((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}));new k((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>n(this,void 0,void 0,(function*(){if(this.validateForm(this.createUserModal.ele)){const e=this.getFormData(this.createUserModal.ele);this.actions.createUser(Object.assign(Object.assign({},T(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),l(this,s,new C((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),d(this,u,"f").call(this),this.createUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){yield d(this,u,"f").call(this),d(this,t,"m",a).call(this)}))}))},a=function(){const e=E(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[s,i]=t.split(".");if("customAttributes"!==s)return;const o=e.find((e=>e.name===i));o?o.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},c})),ot=s((e=>{var t,s,o;return o=class extends(i(v,it,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),d(this,t,"m",s).call(this)}))}},t=new WeakSet,s=function(){var e;this.createButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},o})),rt=s((e=>{var t,s,r;return r=class extends(i(et,R,v,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield d(this,t,"m",s).call(this)}))}},t=new WeakSet,s=function(){return n(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(o(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new k((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteUsersModal.close()));const s=new k((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});s.onClick((()=>{const e=Z(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new S(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=Y(this.state);i.text=`Delete ${e}?`}}))},r})),at=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,rt)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),oe)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.deleteButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-users"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteUsersModal.open()}))},a})),nt=s((e=>{var t,s,r,a,l;return l=class extends(i(et,R,v,M,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),yield d(this,t,"m",a).call(this)}))}},t=new WeakSet,s=function(){new k((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.disableUserModal.close()))},r=function(){new k((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=K(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},a=function(){return n(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(o(yield this.fetchWidgetPage("disable-user-modal.html"))),d(this,t,"m",s).call(this),d(this,t,"m",r).call(this);const i=new S(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=Y(this.state);i.text=`Disable ${e}?`}))}))},l})),dt=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,nt,M)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),ee)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.disableButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="disable-user"]'),{logger:this.logger}),this.disableButton.disable(),this.disableButton.onClick((()=>{this.disableUserModal.open()}))},a})),lt=e=>{if(!e)return e;const t=O(e),s=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(s,"$1-$2")},ut=s((e=>{var t,s,r,a,c,h,g,m,p,y;return y=class extends(i(et,R,v,M,st)(e)){constructor(){super(...arguments),t.add(this),s.set(this,void 0),r.set(this,void 0),h.set(this,(()=>n(this,void 0,void 0,(function*(){yield d(this,r,"f").setData(F(this.state).map((({name:e})=>({value:e,label:e}))))})))),m.set(this,(()=>{var e,t;const s=null===(e=H(this.state))||void 0===e?void 0:e[0],i=Object.assign({loginId:null===(t=null==s?void 0:s.loginIds)||void 0===t?void 0:t.join(", "),displayName:null==s?void 0:s.name,email:null==s?void 0:s.email,phone:lt(null==s?void 0:s.phone),roles:null==s?void 0:s.roles},A(s.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,i)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),yield d(this,t,"m",p).call(this)}))}},s=new WeakMap,r=new WeakMap,h=new WeakMap,m=new WeakMap,t=new WeakSet,a=function(){new k((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.editUserModal.close()))},c=function(){new k((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{if(this.validateForm(this.editUserModal.ele)){const e=this.getFormData(this.editUserModal.ele),{loginId:t}=e,s=u(e,["loginId"]);this.actions.updateUser(Object.assign({loginId:t.split(", ")[0]},T(s,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},g=function(){const e=E(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[s,i]=t.split(".");if("customAttributes"!==s)return;const o=e.find((e=>e.name===i));o?o.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},p=function(){return n(this,void 0,void 0,(function*(){var e;this.editUserModal=this.createModal(),this.editUserModal.setContent(o(yield this.fetchWidgetPage("edit-user-modal.html"))),d(this,t,"m",a).call(this),d(this,t,"m",c).call(this),l(this,s,new x(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),l(this,r,new C((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),this.editUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){yield d(this,h,"f").call(this),d(this,s,"f").disable(),d(this,m,"f").call(this),d(this,t,"m",g).call(this)}))}))},y})),ct=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,ut,M)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),te)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.editButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="edit-user"]'),{logger:this.logger}),this.editButton.disable(),this.editButton.onClick((()=>{this.editUserModal.open()}))},a})),ht=s((e=>{var t,s,r,a,l;return l=class extends(i(et,R,v,M,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),yield d(this,t,"m",a).call(this)}))}},t=new WeakSet,s=function(){new k((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.enableUserModal.close()))},r=function(){new k((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=K(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},a=function(){return n(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(o(yield this.fetchWidgetPage("enable-user-modal.html"))),d(this,t,"m",s).call(this),d(this,t,"m",r).call(this);const i=new S(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=Y(this.state);i.text=`Activate ${e}?`}))}))},l})),vt=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,ht,M)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),_)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.enableButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="enable-user"]'),{logger:this.logger}),this.enableButton.disable(),this.enableButton.onClick((()=>{this.enableUserModal.open()}))},a})),gt=s((e=>{var t,s,o,r;return r=class extends(i(v,st,et)(e)){constructor(){super(...arguments),t.add(this),s.set(this,a((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),d(this,t,"m",o).call(this)}))}},s=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new x(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(d(this,s,"f"))},r}));const mt={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},pt=s((e=>{var t,s,o,a,l;return l=class extends(i(v,et,W,y)(e)){constructor(){super(...arguments),t.add(this),a.set(this,r((e=>{e.length&&(e.forEach((({type:e,msg:i})=>{const r=d(this,t,"m",o).call(this,e);r.setContent(d(this,t,"m",s).call(this,{type:e,msg:i})),r.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(d(this,a,"f").bind(this),B)}))}},a=new WeakMap,t=new WeakSet,s=function({type:e,msg:t}){const s=mt[e],i=Object.assign((new DOMParser).parseFromString('<svg width="2em" height="2em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Shape" d="M10.6712 12L7.27521 8.60406C6.90826 8.23711 6.90826 7.64216 7.27521 7.27521C7.64216 6.90826 8.23711 6.90826 8.60406 7.27521L12 10.6712L15.3959 7.27521C15.7629 6.90826 16.3578 6.90826 16.7248 7.27521C17.0917 7.64216 17.0917 8.23711 16.7248 8.60406L13.3288 12L16.7248 15.3959C17.0917 15.7629 17.0917 16.3578 16.7248 16.7248C16.3578 17.0917 15.7629 17.0917 15.3959 16.7248L12 13.3288L8.60406 16.7248C8.23711 17.0917 7.64216 17.0917 7.27521 16.7248C6.90826 16.3578 6.90826 15.7629 7.27521 15.3959L10.6712 12Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,{slot:"close"});return`${(null==s?void 0:s.outerHTML)||""}${t}${i.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},l})),yt=s((e=>{var t,s,r,a,l;return l=class extends(i(et,R,v,M,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),yield d(this,t,"m",a).call(this)}))}},t=new WeakSet,s=function(){new k((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.removePasskeyModal.close()))},r=function(){new k((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=K(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},a=function(){return n(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(o(yield this.fetchWidgetPage("remove-passkey-modal.html"))),d(this,t,"m",s).call(this),d(this,t,"m",r).call(this);const i=new S(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=Y(this.state);i.text=`Remove passkey for ${e}?`}))}))},l})),ft=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,yt,M)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),se)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.removePasskeyButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="remove-passkey"]'),{logger:this.logger}),this.removePasskeyButton.disable(),this.removePasskeyButton.onClick((()=>{this.removePasskeyModal.open()}))},a})),bt=s((e=>{var t,s,o,l,u,c,h,g;return g=class extends(i(et,v,st)(e)){constructor(){super(...arguments),t.add(this),l.set(this,r((e=>{this.usersTable.data=e}))),u.set(this,a(((e,t)=>{const s=[],{value:i}=t;if(i){const t=e.path;s.push({field:t,desc:"desc"===i})}this.actions.searchUsers({sort:s})}))),c.set(this,r((e=>{this.usersTable.filterColumns((t=>{var s;const[i,o]=(null===(s=t.path)||void 0===s?void 0:s.split("."))||[];return"customAttributes"!==i||!!(null==e?void 0:e.find((e=>e.name===o)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),d(this,t,"m",o).call(this),d(this,l,"f").call(this,D(this.state)),d(this,c,"f").call(this,E(this.state)),this.subscribe(d(this,c,"f").bind(this),E),this.subscribe(d(this,l,"f").bind(this),D)}))}},l=new WeakMap,u=new WeakMap,c=new WeakMap,t=new WeakSet,s=function(){const e=e=>{var t;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(`[path="${e}"]`)},t=e=>{var t;const s=`descope-grid-${e}-column`;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(s)},s=this.usersTable.renderColumn;this.usersTable.renderColumn=({path:i,header:o,type:r,attrs:a})=>{const n=e(i)||t(r);if(!n)return s({path:i,header:o,type:r,attrs:a});const d=n.cloneNode(!0),l=Object.assign(Object.assign({},a),{header:o});return Object.entries(l).forEach((([e,t])=>{d.setAttribute(e,t)})),d.outerHTML}},o=function(){var e;this.usersTable=new I(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="users-table"]'),{logger:this.logger}),this.usersTable.onSelectedItemsChange((e=>{this.actions.setSelectedUsersIds(e.detail.value.map((({loginIds:e})=>e)))})),this.usersTable.onColumnsChange(d(this,t,"m",h).bind(this)),d(this,t,"m",s).call(this),d(this,t,"m",h).call(this)},h=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{d(this,u,"f").call(this,e.target,e.detail)}))}))},g})),wt=s((e=>{var t,s,r;return r=class extends(i(et,R,v,M,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield d(this,t,"m",s).call(this)}))}},t=new WeakSet,s=function(){return n(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(o(yield this.fetchWidgetPage("generated-password-modal.html")));new k((()=>{var e;return null===(e=this.generatedPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger}).onClick((()=>{navigator.clipboard.writeText(this.getFormData(this.generatedPasswordModal.ele)["generated-password"]),this.resetFormData(this.generatedPasswordModal.ele),this.generatedPasswordModal.close()}))}))},r})),Rt=s((e=>{var t,s,r,a,l;return l=class extends(i(et,R,v,M,st,wt)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),yield d(this,t,"m",a).call(this)}))}},t=new WeakSet,s=function(){new k((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.resetPasswordModal.close()))},r=function(){new k((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>n(this,void 0,void 0,(function*(){var e;const t=K(this.state),s=yield this.actions.setTempUserPassword(t);this.resetPasswordModal.close(),this.setFormData(this.generatedPasswordModal.ele,{"generated-password":null===(e=null==s?void 0:s.payload)||void 0===e?void 0:e.cleartext}),this.generatedPasswordModal.open()}))))},a=function(){return n(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(o(yield this.fetchWidgetPage("reset-password-modal.html"))),d(this,t,"m",s).call(this),d(this,t,"m",r).call(this);const i=new S(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=Y(this.state);i.text=`This will generate a new temporary password for ${e}?`}))}))},l})),Mt=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,Rt,M)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),ie)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.resetPasswordButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="reset-password"]'),{logger:this.logger}),this.resetPasswordButton.disable(),this.resetPasswordButton.onClick((()=>{this.resetPasswordModal.open()}))},a})),Wt=s((e=>class extends(i(P,U,bt,ot,at,ct,vt,dt,Mt,ft,gt,pt)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Pt=i((e=>class extends(Wt(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",Pt);export{Pt as default};
import{pluralize as e,compareArrays as t,createSingletonMixin as s,compose as i,createTemplate as o,withMemCache as r,debounce as a}from"@descope/sdk-helpers";import{__awaiter as n,__classPrivateFieldGet as d,__classPrivateFieldSet as l,__rest as u}from"tslib";import{projectIdMixin as c,observeAttributesMixin as h,loggerMixin as v,baseUrlMixin as g,createValidateAttributesMixin as m,createStateManagementMixin as p,initLifecycleMixin as y,staticResourcesMixin as f,descopeUiMixin as b,initElementMixin as w,modalMixin as R,formMixin as M,notificationsMixin as W,debuggerMixin as P,themeMixin as U}from"@descope/sdk-mixins";import{ButtonDriver as k,MultiSelectDriver as C,TextDriver as S,TextFieldDriver as x,GridDriver as I}from"@descope/sdk-component-drivers";import{createSelector as j}from"reselect";import{createAsyncThunk as N}from"@reduxjs/toolkit";import L from"@descope/web-js-sdk";import O from"libphonenumber-js/min";const T=(e,t)=>Object.entries(e).reduce(((e,[s,i])=>{const[o,...r]=s.split(".");return t!==o?Object.assign(e,{[s]:i}):(e[o]||(e[o]={}),e[o][r.join(".")]=i,e)}),{}),A=(e,t)=>Object.fromEntries(Object.entries(e||{}).map((([e,s])=>[`${t}.${e}`,s]))),q={enabled:"active",disabled:"disabled",invited:"invited"},F=e=>e.tenantRoles.data,$=e=>e.selectedUsersLoginIds,B=e=>e.notifications,E=e=>e.customAttributes.data,D=j((e=>e.usersList.data),(e=>e.map((e=>Object.assign(Object.assign(Object.assign({},e),A(null==e?void 0:e.customAttributes,"customAttributes")),{status:q[e.status]||e.status,roles:e.roleNames}))))),H=j($,D,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),Z=j(H,(e=>e.map((e=>e.userId)))),V=j(H,(e=>e.map((e=>e.status)))),z=j(H,(e=>e.every((e=>e.editable)))),J=j($,(e=>!!e.length)),G=j($,(e=>1===e.length)),K=j($,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),Q=j(G,V,((e,t)=>e&&t.every((e=>e===q.enabled)))),X=j(V,(e=>e.every((e=>e===q.disabled)))),Y=j(H,(e=>{var t;return 1===e.length?e[0].name||e[0].email||(null===(t=e[0].loginIds)||void 0===t?void 0:t[0]):`${e.length} users`})),_=j(G,X,z,((e,t,s)=>e&&t&&s)),ee=j(G,Q,z,((e,t,s)=>e&&t&&s)),te=j(G,z,((e,t)=>e&&t)),se=j(G,z,((e,t)=>e&&t)),ie=j(G,z,((e,t)=>e&&t)),oe=J,re=e=>(...t)=>s=>{s.addCase(e.pending,((e,s)=>{t.forEach((({onPending:t})=>{null==t||t(e,s)}))})),s.addCase(e.fulfilled,((e,s)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,s)}))})),s.addCase(e.rejected,((e,s)=>{t.forEach((({onRejected:t})=>{null==t||t(e,s)}))}))},ae=e=>({onFulfilled:t=>{e(t).loading=!1},onPending:t=>{e(t).loading=!0,e(t).error=null},onRejected:(t,s)=>{e(t).loading=!1,e(t).error=s.error}}),ne=({getErrorMsg:e,getSuccessMsg:t})=>({onFulfilled:(e,s)=>{t&&e.notifications.push({type:"success",msg:t(s)})},onRejected:(t,s)=>{e&&t.notifications.push({type:"error",msg:e(s)})}}),de=N("users/create",((e,{extra:{api:t}})=>t.user.create(e))),le=re(de)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},ae((e=>e.createUser)),ne({getSuccessMsg:()=>"User created successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to create user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),ue={action:de,reducer:le},ce=N("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),he=re(ce)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},ae((e=>e.deleteUser)),ne({getSuccessMsg:t=>e(t.meta.arg.length)`${["",t.meta.arg.length]} ${["U","u"]}ser${["","s"]} deleted successfully`,getErrorMsg:t=>e(t.meta.arg.length)`Failed to delete user${["","s"]}`})),ve={action:ce,reducer:he},ge=N("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),me=re(ge)(ae((e=>e.setTempUserPassword)),ne({getSuccessMsg:()=>"Successfully reset user password",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to reset user's password</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),pe={action:ge,reducer:me},ye=N("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),fe=re(ye)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},ae((e=>e.customAttributes))),be={action:ye,reducer:fe},we=N("users/search",((e,{extra:{api:t},getState:s})=>{const i=s().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),Re=re(we)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},ae((e=>e.usersList))),Me={action:we,reducer:Re},We=N("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Pe=re(We)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},ae((e=>e.tenantRoles))),Ue={action:We,reducer:Pe},ke=N("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Ce=re(ke)({onFulfilled:(e,s)=>{const i=e.usersList.data.findIndex((e=>t(e.loginIds,s.payload.loginIds)));-1!==i&&(e.usersList.data[i]=s.payload)}},ae((e=>e.updateUser)),ne({getSuccessMsg:()=>"User updated successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to update user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Se={action:ke,reducer:Ce},xe=N("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Ie=re(xe)({onFulfilled:(e,s)=>{var i;const o=e.usersList.data.findIndex((e=>{var i;return t(e.loginIds,null===(i=s.payload.user)||void 0===i?void 0:i.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(i=s.payload.user)||void 0===i?void 0:i.status)}},ae((e=>e.enableUser)),ne({getSuccessMsg:()=>"User enabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to enable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),je={action:xe,reducer:Ie},Ne=N("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Le=re(Ne)({onFulfilled:(e,s)=>{var i;const o=e.usersList.data.findIndex((e=>{var i;return t(e.loginIds,null===(i=s.payload.user)||void 0===i?void 0:i.loginIds)}));-1!==o&&(e.usersList.data[o].status=null===(i=s.payload.user)||void 0===i?void 0:i.status)}},ae((e=>e.disableUser)),ne({getSuccessMsg:()=>"User disabled successfully",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to disable user</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}})),Oe={action:Ne,reducer:Le},Te=N("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),Ae={action:Te,reducer:re(Te)(ae((e=>e.removePasskey)),ne({getSuccessMsg:()=>"Successfully removed user's passkey",getErrorMsg:e=>{var t;return`\n <div>\n <div>Failed to remove user's passkey</div>\n ${null===(t=e.error)||void 0===t?void 0:t.message}\n </div>`}}))},qe={usersList:{data:[],loading:!1,error:null},createUser:{loading:!1,error:null},updateUser:{loading:!1,error:null},deleteUser:{loading:!1,error:null},enableUser:{loading:!1,error:null},disableUser:{loading:!1,error:null},removePasskey:{loading:!1,error:null},setTempUserPassword:{loading:!1,error:null},customAttributes:{loading:!1,error:null,data:[]},tenantRoles:{loading:!1,error:null,data:[]},searchParams:{text:"",sort:[]},selectedUsersLoginIds:[],notifications:[]},Fe={search:"/v1/mgmt/user/search",deleteBatch:"/v1/mgmt/user/delete/batch",create:"/v1/mgmt/user/create",update:"/v1/mgmt/user/update",status:"/v1/mgmt/user/update/status",setTempPassword:"/v1/mgmt/user/password/set/temporary",removePasskey:"/v1/mgmt/user/passkeys/delete",customAttributes:"/v1/mgmt/user/customattributes"},$e={roles:"/v1/mgmt/role/all"},Be=e=>n(void 0,void 0,void 0,(function*(){const t=yield e.text(),s=JSON.parse(t);if(!e.ok){const t=`${s.errorDescription}${s.errorMessage?`: ${s.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(s),e.text=()=>Promise.resolve(t)})),Ee=e=>n(void 0,[e],void 0,(function*({text:e,sort:t}){return new Promise((s=>{const i=[];for(let e=1;e<10;e+=1)i.push({loginIds:[`user${e}@company.com`],externalIds:[`user${e}@company.com`],userId:`user-${e}`,name:`User ${e}`,email:`user${e}@company.com`,roleNames:[`Role ${e}`],phone:`+1-202-555-010${e}`,verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:"",password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!1});t.forEach((e=>{i.sort(((t,s)=>{var i,o;return e.desc?null===(o=s[e.field])||void 0===o?void 0:o.localeCompare(t[e.field]):null===(i=t[e.field])||void 0===i?void 0:i.localeCompare(s[e.field])}))})),s(i.filter((t=>t.name.toLowerCase().includes(e.toLowerCase())||t.phone.toLowerCase().includes(e.toLowerCase())||t.status.toLowerCase().includes(e.toLowerCase())||"active"===e.toLowerCase()||t.familyName.toLowerCase().includes(e.toLowerCase())||t.givenName.toLowerCase().includes(e.toLowerCase())||t.middleName.toLowerCase().includes(e.toLowerCase())||t.email.toLowerCase().includes(e.toLowerCase()))))}))})),De=e=>n(void 0,[e],void 0,(function*({loginId:e,email:t,phone:s,displayName:i,roles:o,customAttributes:r,picture:a,verifiedEmail:n,verifiedPhone:d,givenName:l,middleName:u,familyName:c}){return new Promise((h=>{const v=Math.random().toString(10).substring(15);h({loginIds:[e],externalIds:[e],userId:`user-${v}`,email:t,phone:s,name:i,roleNames:o,customAttributes:r,picture:a,verifiedEmail:n,verifiedPhone:d,givenName:l,middleName:u,familyName:c,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})),He=e=>n(void 0,[e],void 0,(function*({loginId:e,email:t,phone:s,displayName:i,roles:o,customAttributes:r,picture:a,verifiedEmail:n,verifiedPhone:d,givenName:l,middleName:u,familyName:c}){return new Promise((h=>{h({loginIds:[e],externalIds:[e],userId:e,email:t,phone:s,name:i,roleNames:o,customAttributes:r,picture:a,verifiedEmail:n,verifiedPhone:d,givenName:l,middleName:u,familyName:c,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})),Ze=()=>n(void 0,void 0,void 0,(function*(){})),Ve=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))})),ze=()=>n(void 0,void 0,void 0,(function*(){})),Je=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})),Ge=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})),Ke=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))})),Qe=e=>new Promise((t=>{const s=[];for(let t=1;t<5;t+=1)s.push({name:`Role ${t}`,description:`Role description ${t}`,createdTime:new Date,permissionNames:[`Permission ${t}`],tenantId:e});t({roles:s})})),Xe=({httpClient:e,tenant:t,mock:s})=>({search:(...i)=>n(void 0,[...i],void 0,(function*({page:i,limit:o=1e4,customAttributes:r,statuses:a,emails:n,phones:d,text:l,sort:u}={}){if(s)return Ee({page:i,limit:o,customAttributes:r,statuses:a,emails:n,phones:d,text:l,sort:u});const c=yield e.post(Fe.search,{limit:o,page:i,withTestUser:!1,customAttributes:r,statuses:a,emails:n,phones:d,text:l,sort:u},{queryParams:{tenant:t}});yield Be(c);return(yield c.json()).users})),deleteBatch:i=>n(void 0,void 0,void 0,(function*(){if(s)return Ze();const o=yield e.post(Fe.deleteBatch,{userIds:i},{queryParams:{tenant:t}});return yield Be(o),o.json()})),create:i=>n(void 0,[i],void 0,(function*({loginId:i,email:o,phone:r,displayName:a,roles:n,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,givenName:h,middleName:v,familyName:g,additionalLoginIds:m,sendSMS:p,sendMail:y,inviteUrl:f,invite:b}){if(s)return De({loginId:i,email:o,phone:r,displayName:a,roles:n,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,givenName:h,middleName:v,familyName:g,additionalLoginIds:m,sendSMS:p,sendMail:y,inviteUrl:f,invite:b});const w=yield e.post(Fe.create,{loginId:i,email:o,phone:r,displayName:a,givenName:h,middleName:v,familyName:g,roleNames:n,userTenants:[{tenantId:t}],customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,additionalLoginIds:m,sendSMS:p,sendMail:y,inviteUrl:f,invite:b},{queryParams:{tenant:t}});yield Be(w);return(yield w.json()).user})),update:i=>n(void 0,[i],void 0,(function*({loginId:i,email:o,phone:r,displayName:a,roles:n,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,givenName:h,middleName:v,familyName:g,additionalLoginIds:m}){if(s)return He({loginId:i,email:o,phone:r,displayName:a,roles:n,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,givenName:h,middleName:v,familyName:g,additionalLoginIds:m});const p=yield e.post(Fe.update,{loginId:i,email:o,phone:r,displayName:a,givenName:h,middleName:v,familyName:g,roleNames:n,customAttributes:d,picture:l,verifiedEmail:u,verifiedPhone:c,additionalLoginIds:m},{queryParams:{tenant:t}});yield Be(p);return(yield p.json()).user})),enable:i=>n(void 0,void 0,void 0,(function*(){if(s)return Je(i);const o=yield e.post(Fe.status,{loginId:i,status:"enabled"},{queryParams:{tenant:t}});return yield Be(o),o.json()})),disable:i=>n(void 0,void 0,void 0,(function*(){if(s)return Ge(i);const o=yield e.post(Fe.status,{loginId:i,status:"disabled"},{queryParams:{tenant:t}});return yield Be(o),o.json()})),removePasskey:i=>n(void 0,void 0,void 0,(function*(){if(s)return ze();const o=yield e.post(Fe.removePasskey,{loginId:i},{queryParams:{tenant:t}});return yield Be(o),o.json()})),setTempPassword:i=>n(void 0,void 0,void 0,(function*(){if(s)return Ve();const o=yield e.post(Fe.setTempPassword,{loginId:i},{queryParams:{tenant:t}});return yield Be(o),o.json()})),getCustomAttributes:()=>n(void 0,void 0,void 0,(function*(){if(s)return Ke();const i=yield e.get(Fe.customAttributes,{queryParams:{tenant:t}});yield Be(i);return(yield i.json()).data}))}),Ye=({httpClient:e,tenant:t,mock:s})=>({getTenantRoles:()=>n(void 0,void 0,void 0,(function*(){if(s)return Qe(t);const i=yield e.get($e.roles,{queryParams:{tenant:t}});return yield Be(i),i.json()}))}),_e=s((e=>{var t,s,o,r;const a=i(c,h,v,g,m({tenant:m.missingAttrValidator}))(e);return r=class extends a{constructor(){super(...arguments),t.add(this),s.set(this,void 0)}get tenant(){return this.getAttribute("tenant")}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return d(this,s,"f")||d(this,t,"m",o).call(this),d(this,s,"f")}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{d(this,s,"f")&&d(this,t,"m",o).call(this)}))}))}},s=new WeakMap,t=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),l(this,s,((e,t,s,i)=>{const o=L(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-management-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.4.129"}}));return{user:Xe({httpClient:o.httpClient,tenant:t,mock:s}),tenant:Ye({httpClient:o.httpClient,tenant:t,mock:s})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock,this.widgetId),"f")},r})),et=s((e=>{const t=i(p({name:"widget",initialState:qe,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{ue.reducer(e),Se.reducer(e),je.reducer(e),Oe.reducer(e),ve.reducer(e),Me.reducer(e),pe.reducer(e),Ae.reducer(e),be.reducer(e),Ue.reducer(e)},asyncActions:{searchUsers:Me.action,createUser:ue.action,updateUser:Se.action,enableUser:je.action,disableUser:Oe.action,deleteUsers:ve.action,removePasskey:Ae.action,getCustomAttributes:be.action,getTenantRoles:Ue.action,setTempUserPassword:pe.action}}),y,v,_e)(e);return class extends t{constructor(...e){super(...e),this.state=qe,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),tt=s((e=>{const t=i(f,m({"widget-id":m.missingAttrValidator}))(e);return class extends t{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return n(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-management-widget/${this.widgetId}/${e}`,"text")).body}))}}})),st=s((e=>{var t,s,r;return r=class extends(i(v,y,b,w,tt,et)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){return n(this,void 0,void 0,(function*(){}))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var i;yield null===(i=e.init)||void 0===i?void 0:i.call(this),yield Promise.all([d(this,t,"m",s).call(this),this.actions.searchUsers(),this.actions.getTenantRoles(),this.actions.getCustomAttributes()]),this.onWidgetRootReady()}))}},t=new WeakSet,s=function(){return n(this,void 0,void 0,(function*(){const e=o(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},r})),it=s((e=>{var t,s,r,a,u,c;return c=class extends(i(et,R,M,v,st)(e)){constructor(){super(...arguments),t.add(this),s.set(this,void 0),u.set(this,(()=>n(this,void 0,void 0,(function*(){yield d(this,s,"f").setData(F(this.state).map((({name:e})=>({value:e,label:e}))))}))))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),d(this,t,"m",r).call(this)}))}},s=new WeakMap,u=new WeakMap,t=new WeakSet,r=function(){return n(this,void 0,void 0,(function*(){this.createUserModal=this.createModal(),this.createUserModal.setContent(o(yield this.fetchWidgetPage("create-user-modal.html")));new k((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>{this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}));new k((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>n(this,void 0,void 0,(function*(){if(this.validateForm(this.createUserModal.ele)){const e=this.getFormData(this.createUserModal.ele);this.actions.createUser(Object.assign(Object.assign({},T(e,"customAttributes")),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}})))),l(this,s,new C((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),d(this,u,"f").call(this),this.createUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){yield d(this,u,"f").call(this),d(this,t,"m",a).call(this)}))}))},a=function(){const e=E(this.state);this.getFormFieldNames(this.createUserModal.ele).forEach((t=>{const[s,i]=t.split(".");if("customAttributes"!==s)return;const o=e.find((e=>e.name===i));o?o.editable||this.disableFormField(this.createUserModal.ele,t):this.removeFormField(this.createUserModal.ele,t)}))},c})),ot=s((e=>{var t,s,o;return o=class extends(i(v,it,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),d(this,t,"m",s).call(this)}))}},t=new WeakSet,s=function(){var e;this.createButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="create-user"]'),{logger:this.logger}),this.createButton.onClick((()=>this.createUserModal.open()))},o})),rt=s((e=>{var t,s,r;return r=class extends(i(et,R,v,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield d(this,t,"m",s).call(this)}))}},t=new WeakSet,s=function(){return n(this,void 0,void 0,(function*(){var e;this.deleteUsersModal=this.createModal(),this.deleteUsersModal.setContent(o(yield this.fetchWidgetPage("delete-users-modal.html")));const t=new k((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});t.onClick((()=>this.deleteUsersModal.close()));const s=new k((()=>{var e;return null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});s.onClick((()=>{const e=Z(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new S(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=Y(this.state);i.text=`Delete ${e}?`}}))},r})),at=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,rt)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.deleteButton.enable():this.deleteButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),oe)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.deleteButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="delete-users"]'),{logger:this.logger}),this.deleteButton.disable(),this.deleteButton.onClick((()=>{this.deleteUsersModal.open()}))},a})),nt=s((e=>{var t,s,r,a,l;return l=class extends(i(et,R,v,M,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),yield d(this,t,"m",a).call(this)}))}},t=new WeakSet,s=function(){new k((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.disableUserModal.close()))},r=function(){new k((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=K(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},a=function(){return n(this,void 0,void 0,(function*(){var e;this.disableUserModal=this.createModal(),this.disableUserModal.setContent(o(yield this.fetchWidgetPage("disable-user-modal.html"))),d(this,t,"m",s).call(this),d(this,t,"m",r).call(this);const i=new S(null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.disableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=Y(this.state);i.text=`Disable ${e}?`}))}))},l})),dt=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,nt,M)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.disableButton.enable():this.disableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),ee)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.disableButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="disable-user"]'),{logger:this.logger}),this.disableButton.disable(),this.disableButton.onClick((()=>{this.disableUserModal.open()}))},a})),lt=e=>{if(!e)return e;const t=O(e),s=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(s,"$1-$2")},ut=s((e=>{var t,s,r,a,c,h,g,m,p,y;return y=class extends(i(et,R,v,M,st)(e)){constructor(){super(...arguments),t.add(this),s.set(this,void 0),r.set(this,void 0),h.set(this,(()=>n(this,void 0,void 0,(function*(){yield d(this,r,"f").setData(F(this.state).map((({name:e})=>({value:e,label:e}))))})))),m.set(this,(()=>{var e,t;const s=null===(e=H(this.state))||void 0===e?void 0:e[0],i=Object.assign({loginId:null===(t=null==s?void 0:s.loginIds)||void 0===t?void 0:t.join(", "),displayName:null==s?void 0:s.name,email:null==s?void 0:s.email,phone:lt(null==s?void 0:s.phone),roles:null==s?void 0:s.roles},A(s.customAttributes,"customAttributes"));this.setFormData(this.editUserModal.ele,i)}))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),yield d(this,t,"m",p).call(this)}))}},s=new WeakMap,r=new WeakMap,h=new WeakMap,m=new WeakMap,t=new WeakSet,a=function(){new k((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.editUserModal.close()))},c=function(){new k((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{if(this.validateForm(this.editUserModal.ele)){const e=this.getFormData(this.editUserModal.ele),{loginId:t}=e,s=u(e,["loginId"]);this.actions.updateUser(Object.assign({loginId:t.split(", ")[0]},T(s,"customAttributes"))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},g=function(){const e=E(this.state);this.getFormFieldNames(this.editUserModal.ele).forEach((t=>{const[s,i]=t.split(".");if("customAttributes"!==s)return;const o=e.find((e=>e.name===i));o?o.editable||this.disableFormField(this.editUserModal.ele,t):this.removeFormField(this.editUserModal.ele,t)}))},p=function(){return n(this,void 0,void 0,(function*(){var e;this.editUserModal=this.createModal(),this.editUserModal.setContent(o(yield this.fetchWidgetPage("edit-user-modal.html"))),d(this,t,"m",a).call(this),d(this,t,"m",c).call(this),l(this,s,new x(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),l(this,r,new C((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="roles-multiselect"]')}),{logger:this.logger}),"f"),this.editUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){yield d(this,h,"f").call(this),d(this,s,"f").disable(),d(this,m,"f").call(this),d(this,t,"m",g).call(this)}))}))},y})),ct=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,ut,M)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.editButton.enable():this.editButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),te)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.editButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="edit-user"]'),{logger:this.logger}),this.editButton.disable(),this.editButton.onClick((()=>{this.editUserModal.open()}))},a})),ht=s((e=>{var t,s,r,a,l;return l=class extends(i(et,R,v,M,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),yield d(this,t,"m",a).call(this)}))}},t=new WeakSet,s=function(){new k((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.enableUserModal.close()))},r=function(){new k((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=K(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},a=function(){return n(this,void 0,void 0,(function*(){var e;this.enableUserModal=this.createModal(),this.enableUserModal.setContent(o(yield this.fetchWidgetPage("enable-user-modal.html"))),d(this,t,"m",s).call(this),d(this,t,"m",r).call(this);const i=new S(null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.enableUserModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=Y(this.state);i.text=`Activate ${e}?`}))}))},l})),vt=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,ht,M)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.enableButton.enable():this.enableButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),_)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.enableButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="enable-user"]'),{logger:this.logger}),this.enableButton.disable(),this.enableButton.onClick((()=>{this.enableUserModal.open()}))},a})),gt=s((e=>{var t,s,o,r;return r=class extends(i(v,st,et)(e)){constructor(){super(...arguments),t.add(this),s.set(this,a((()=>{this.actions.searchUsers({text:this.searchInput.value})})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),d(this,t,"m",o).call(this)}))}},s=new WeakMap,t=new WeakSet,o=function(){var e;this.searchInput=new x(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="search-input"]'),{logger:this.logger}),this.searchInput.onInput(d(this,s,"f"))},r}));const mt={success:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Checkmark">\n<path id="Shape" d="M10.0485 15.6396C9.5799 15.171 8.8201 15.171 8.35147 15.6396C7.88284 16.1082 7.88284 16.868 8.35147 17.3367L12.7072 21.6924C13.1759 22.1611 13.9357 22.1611 14.4043 21.6924L24.7152 11.3815C25.1838 10.9129 25.1838 10.1531 24.7152 9.68448C24.2466 9.21585 23.4868 9.21585 23.0181 9.68448L13.5558 19.1469L10.0485 15.6396Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,error:(new DOMParser).parseFromString('<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Vector" d="M15.9998 26.6558C10.1118 26.6558 5.34375 21.8878 5.34375 15.9998C5.34375 10.1118 10.1118 5.34375 15.9998 5.34375C21.8878 5.34375 26.6558 10.1118 26.6558 15.9998C26.6558 21.8878 21.8878 26.6558 15.9998 26.6558ZM15.9998 24.4798C20.6718 24.4798 24.4798 20.7038 24.4798 15.9998C24.4798 11.3278 20.7038 7.51975 15.9998 7.51975C11.3278 7.51975 7.51975 11.2958 7.51975 15.9998C7.51975 20.6718 11.2958 24.4798 15.9998 24.4798ZM15.3278 9.34375H16.6718C17.0558 9.34375 17.3438 9.63175 17.3118 9.98375L16.9598 16.9278C16.9598 17.1838 16.7678 17.3438 16.5438 17.3438H15.4558C15.2318 17.3438 15.0398 17.1518 15.0398 16.9278L14.6878 9.98375C14.6878 9.63175 14.9758 9.34375 15.3278 9.34375ZM15.4558 19.4558H16.5438C16.9278 19.4558 17.2158 19.7438 17.1838 20.1278V21.1838C17.1838 21.5678 16.8958 21.8558 16.5438 21.8558H15.4558C15.0718 21.8558 14.7838 21.5678 14.7838 21.1838V20.1278C14.7838 19.7438 15.0718 19.4558 15.4558 19.4558Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild},pt=s((e=>{var t,s,o,a,l;return l=class extends(i(v,et,W,y)(e)){constructor(){super(...arguments),t.add(this),a.set(this,r((e=>{e.length&&(e.forEach((({type:e,msg:i})=>{const r=d(this,t,"m",o).call(this,e);r.setContent(d(this,t,"m",s).call(this,{type:e,msg:i})),r.show()})),setTimeout((()=>this.actions.clearNotifications())))})))}init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this),this.subscribe(d(this,a,"f").bind(this),B)}))}},a=new WeakMap,t=new WeakSet,s=function({type:e,msg:t}){const s=mt[e],i=Object.assign((new DOMParser).parseFromString('<svg width="2em" height="2em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g id="Icon">\n<path id="Shape" d="M10.6712 12L7.27521 8.60406C6.90826 8.23711 6.90826 7.64216 7.27521 7.27521C7.64216 6.90826 8.23711 6.90826 8.60406 7.27521L12 10.6712L15.3959 7.27521C15.7629 6.90826 16.3578 6.90826 16.7248 7.27521C17.0917 7.64216 17.0917 8.23711 16.7248 8.60406L13.3288 12L16.7248 15.3959C17.0917 15.7629 17.0917 16.3578 16.7248 16.7248C16.3578 17.0917 15.7629 17.0917 15.3959 16.7248L12 13.3288L8.60406 16.7248C8.23711 17.0917 7.64216 17.0917 7.27521 16.7248C6.90826 16.3578 6.90826 15.7629 7.27521 15.3959L10.6712 12Z" fill="currentcolor"/>\n</g>\n</svg>\n',"image/svg+xml").firstChild,{slot:"close"});return`${(null==s?void 0:s.outerHTML)||""}${t}${i.outerHTML}`},o=function(e){return this.createNotification({mode:e,duration:"error"===e?0:3e3,position:"bottom-start",size:"sm"})},l})),yt=s((e=>{var t,s,r,a,l;return l=class extends(i(et,R,v,M,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),yield d(this,t,"m",a).call(this)}))}},t=new WeakSet,s=function(){new k((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.removePasskeyModal.close()))},r=function(){new k((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>{const e=K(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},a=function(){return n(this,void 0,void 0,(function*(){var e;this.removePasskeyModal=this.createModal(),this.removePasskeyModal.setContent(o(yield this.fetchWidgetPage("remove-passkey-modal.html"))),d(this,t,"m",s).call(this),d(this,t,"m",r).call(this);const i=new S(null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.removePasskeyModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=Y(this.state);i.text=`Remove passkey for ${e}?`}))}))},l})),ft=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,yt,M)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.removePasskeyButton.enable():this.removePasskeyButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),se)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.removePasskeyButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="remove-passkey"]'),{logger:this.logger}),this.removePasskeyButton.disable(),this.removePasskeyButton.onClick((()=>{this.removePasskeyModal.open()}))},a})),bt=s((e=>{var t,s,o,l,u,c,h,g;return g=class extends(i(et,v,st)(e)){constructor(){super(...arguments),t.add(this),l.set(this,r((e=>{this.usersTable.data=e}))),u.set(this,a(((e,t)=>{const s=[],{value:i}=t;if(i){const t=e.path;s.push({field:t,desc:"desc"===i})}this.actions.searchUsers({sort:s})}))),c.set(this,r((e=>{this.usersTable.filterColumns((t=>{var s;const[i,o]=(null===(s=t.path)||void 0===s?void 0:s.split("."))||[];return"customAttributes"!==i||!!(null==e?void 0:e.find((e=>e.name===o)))}))})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),d(this,t,"m",o).call(this),d(this,l,"f").call(this,D(this.state)),d(this,c,"f").call(this,E(this.state)),this.subscribe(d(this,c,"f").bind(this),E),this.subscribe(d(this,l,"f").bind(this),D)}))}},l=new WeakMap,u=new WeakMap,c=new WeakMap,t=new WeakSet,s=function(){const e=e=>{var t;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(`[path="${e}"]`)},t=e=>{var t;const s=`descope-grid-${e}-column`;return null===(t=this.usersTable.ele)||void 0===t?void 0:t.querySelector(s)},s=this.usersTable.renderColumn;this.usersTable.renderColumn=({path:i,header:o,type:r,attrs:a})=>{const n=e(i)||t(r);if(!n)return s({path:i,header:o,type:r,attrs:a});const d=n.cloneNode(!0),l=Object.assign(Object.assign({},a),{header:o});return Object.entries(l).forEach((([e,t])=>{d.setAttribute(e,t)})),d.outerHTML}},o=function(){var e;this.usersTable=new I(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="users-table"]'),{logger:this.logger}),this.usersTable.onSelectedItemsChange((e=>{this.actions.setSelectedUsersIds(e.detail.value.map((({loginIds:e})=>e)))})),this.usersTable.onColumnsChange(d(this,t,"m",h).bind(this)),d(this,t,"m",s).call(this),d(this,t,"m",h).call(this)},h=function(){this.usersTable.columns.forEach((e=>{e.onSortDirectionChange((e=>{d(this,u,"f").call(this,e.target,e.detail)}))}))},g})),wt=s((e=>{var t,s,r;return r=class extends(i(et,R,v,M,st)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),yield d(this,t,"m",s).call(this)}))}},t=new WeakSet,s=function(){return n(this,void 0,void 0,(function*(){this.generatedPasswordModal=this.createModal(),this.generatedPasswordModal.setContent(o(yield this.fetchWidgetPage("generated-password-modal.html")));new k((()=>{var e;return null===(e=this.generatedPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger}).onClick((()=>{navigator.clipboard.writeText(this.getFormData(this.generatedPasswordModal.ele)["generated-password"]),this.resetFormData(this.generatedPasswordModal.ele),this.generatedPasswordModal.close()}))}))},r})),Rt=s((e=>{var t,s,r,a,l;return l=class extends(i(et,R,v,M,st,wt)(e)){constructor(){super(...arguments),t.add(this)}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var s;yield null===(s=e.onWidgetRootReady)||void 0===s?void 0:s.call(this),yield d(this,t,"m",a).call(this)}))}},t=new WeakSet,s=function(){new k((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger}).onClick((()=>this.resetPasswordModal.close()))},r=function(){new k((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger}).onClick((()=>n(this,void 0,void 0,(function*(){var e;const t=K(this.state),s=yield this.actions.setTempUserPassword(t);this.resetPasswordModal.close(),this.setFormData(this.generatedPasswordModal.ele,{"generated-password":null===(e=null==s?void 0:s.payload)||void 0===e?void 0:e.cleartext}),this.generatedPasswordModal.open()}))))},a=function(){return n(this,void 0,void 0,(function*(){var e;this.resetPasswordModal=this.createModal(),this.resetPasswordModal.setContent(o(yield this.fetchWidgetPage("reset-password-modal.html"))),d(this,t,"m",s).call(this),d(this,t,"m",r).call(this);const i=new S(null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.resetPasswordModal.beforeOpen=()=>n(this,void 0,void 0,(function*(){const e=Y(this.state);i.text=`This will generate a new temporary password for ${e}?`}))}))},l})),Mt=s((e=>{var t,s,o,a;return a=class extends(i(v,st,et,Rt,M)(e)){constructor(){super(...arguments),t.add(this),o.set(this,r((e=>{e?this.resetPasswordButton.enable():this.resetPasswordButton.disable()})))}onWidgetRootReady(){const e=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return n(this,void 0,void 0,(function*(){var i;d(this,t,"m",s).call(this),yield null===(i=e.onWidgetRootReady)||void 0===i?void 0:i.call(this),this.subscribe(d(this,o,"f").bind(this),ie)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.resetPasswordButton=new k(null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('[data-id="reset-password"]'),{logger:this.logger}),this.resetPasswordButton.disable(),this.resetPasswordButton.onClick((()=>{this.resetPasswordModal.open()}))},a})),Wt=s((e=>class extends(i(P,U,bt,ot,at,ct,vt,dt,Mt,ft,gt,pt)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return n(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),Pt=i((e=>class extends(Wt(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",Pt);export{Pt as default};
//# sourceMappingURL=index.js.map
{
"name": "@descope/user-management-widget",
"version": "0.4.128",
"version": "0.4.129",
"author": "Descope Team <info@descope.com>",

@@ -80,6 +80,6 @@ "homepage": "https://github.com/descope/descope-js",

"immer": "^10.0.3",
"@descope/web-js-sdk": "1.19.1",
"@descope/web-js-sdk": "1.19.2",
"@descope/sdk-helpers": "0.1.60",
"@descope/sdk-component-drivers": "0.2.42",
"@descope/sdk-mixins": "0.3.2"
"@descope/sdk-mixins": "0.3.2",
"@descope/sdk-component-drivers": "0.2.42"
},

@@ -86,0 +86,0 @@ "overrides": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc