@descope/user-management-widget 0.4.88 → 0.4.90
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/esm/index.js +2 -2
- package/dist/index.d.ts +36 -36
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* @descope/user-management-widget v0.4.
|
|
3
|
+
* @descope/user-management-widget v0.4.90
|
|
4
4
|
*/
|
|
5
|
-
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(J,(e=>e)),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=({text:e,sort:t})=>n(void 0,void 0,void 0,(function*(){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=({loginId:e,email:t,phone:s,displayName:i,roles:o,customAttributes:r,picture:a,verifiedEmail:d,verifiedPhone:l,givenName:u,middleName:c,familyName:h})=>n(void 0,void 0,void 0,(function*(){return new Promise((n=>{const v=Math.random().toString(10).substring(15);n({loginIds:[e],externalIds:[e],userId:`user-${v}`,email:t,phone:s,name:i,roleNames:o,customAttributes:r,picture:a,verifiedEmail:d,verifiedPhone:l,givenName:u,middleName:c,familyName:h,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})),He=({loginId:e,email:t,phone:s,displayName:i,roles:o,customAttributes:r,picture:a,verifiedEmail:d,verifiedPhone:l,givenName:u,middleName:c,familyName:h})=>n(void 0,void 0,void 0,(function*(){return new Promise((n=>{n({loginIds:[e],externalIds:[e],userId:e,email:t,phone:s,name:i,roleNames:o,customAttributes:r,picture:a,verifiedEmail:d,verifiedPhone:l,givenName:u,middleName:c,familyName:h,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:({page:i,limit:o=1e4,customAttributes:r,statuses:a,emails:d,phones:l,text:u,sort:c}={})=>n(void 0,void 0,void 0,(function*(){if(s)return Ee({page:i,limit:o,customAttributes:r,statuses:a,emails:d,phones:l,text:u,sort:c});const n=yield e.post(Fe.search,{limit:o,page:i,withTestUser:!1,customAttributes:r,statuses:a,emails:d,phones:l,text:u,sort:c},{queryParams:{tenant:t}});yield Be(n);return(yield n.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:({loginId:i,email:o,phone:r,displayName:a,roles:d,customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,givenName:v,middleName:g,familyName:m,additionalLoginIds:p,sendSMS:y,sendMail:f,inviteUrl:b,invite:w})=>n(void 0,void 0,void 0,(function*(){if(s)return De({loginId:i,email:o,phone:r,displayName:a,roles:d,customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,givenName:v,middleName:g,familyName:m,additionalLoginIds:p,sendSMS:y,sendMail:f,inviteUrl:b,invite:w});const n=yield e.post(Fe.create,{loginId:i,email:o,phone:r,displayName:a,givenName:v,middleName:g,familyName:m,roleNames:d,userTenants:[{tenantId:t}],customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:p,sendSMS:y,sendMail:f,inviteUrl:b,invite:w},{queryParams:{tenant:t}});yield Be(n);return(yield n.json()).user})),update:({loginId:i,email:o,phone:r,displayName:a,roles:d,customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,givenName:v,middleName:g,familyName:m,additionalLoginIds:p})=>n(void 0,void 0,void 0,(function*(){if(s)return He({loginId:i,email:o,phone:r,displayName:a,roles:d,customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,givenName:v,middleName:g,familyName:m,additionalLoginIds:p});const n=yield e.post(Fe.update,{loginId:i,email:o,phone:r,displayName:a,givenName:v,middleName:g,familyName:m,roleNames:d,customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:p},{queryParams:{tenant:t}});yield Be(n);return(yield n.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}});var i;return n(this,void 0,void 0,(function*(){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.88"}}));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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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")));const e=new k((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>{this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}));const i=new k((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});i.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}});var i;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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(){const e=new k((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>this.disableUserModal.close()))},r=function(){const e=new k((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>{const e=K(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},a=function(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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(){const e=new k((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>this.editUserModal.close()))},c=function(){const e=new k((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.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(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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(){const e=new k((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>this.enableUserModal.close()))},r=function(){const e=new k((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>{const e=K(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},a=function(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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}});var t;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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(){const e=new k((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>this.removePasskeyModal.close()))},r=function(){const e=new k((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>{const e=K(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},a=function(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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")));const e=new k((()=>{var e;return null===(e=this.generatedPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger});e.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}});var s;return n(this,void 0,void 0,(function*(){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(){const e=new k((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>this.resetPasswordModal.close()))},r=function(){const e=new k((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.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(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var t;return n(this,void 0,void 0,(function*(){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};
|
|
5
|
+
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(J,(e=>e)),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=({text:e,sort:t})=>n(void 0,void 0,void 0,(function*(){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=({loginId:e,email:t,phone:s,displayName:i,roles:o,customAttributes:r,picture:a,verifiedEmail:d,verifiedPhone:l,givenName:u,middleName:c,familyName:h})=>n(void 0,void 0,void 0,(function*(){return new Promise((n=>{const v=Math.random().toString(10).substring(15);n({loginIds:[e],externalIds:[e],userId:`user-${v}`,email:t,phone:s,name:i,roleNames:o,customAttributes:r,picture:a,verifiedEmail:d,verifiedPhone:l,givenName:u,middleName:c,familyName:h,createdTime:(new Date).getTime(),editable:!0,password:!0,SAML:!1,status:"enabled",test:!1,TOTP:!1,userTenants:[],webauthn:!1})}))})),He=({loginId:e,email:t,phone:s,displayName:i,roles:o,customAttributes:r,picture:a,verifiedEmail:d,verifiedPhone:l,givenName:u,middleName:c,familyName:h})=>n(void 0,void 0,void 0,(function*(){return new Promise((n=>{n({loginIds:[e],externalIds:[e],userId:e,email:t,phone:s,name:i,roleNames:o,customAttributes:r,picture:a,verifiedEmail:d,verifiedPhone:l,givenName:u,middleName:c,familyName:h,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:({page:i,limit:o=1e4,customAttributes:r,statuses:a,emails:d,phones:l,text:u,sort:c}={})=>n(void 0,void 0,void 0,(function*(){if(s)return Ee({page:i,limit:o,customAttributes:r,statuses:a,emails:d,phones:l,text:u,sort:c});const n=yield e.post(Fe.search,{limit:o,page:i,withTestUser:!1,customAttributes:r,statuses:a,emails:d,phones:l,text:u,sort:c},{queryParams:{tenant:t}});yield Be(n);return(yield n.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:({loginId:i,email:o,phone:r,displayName:a,roles:d,customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,givenName:v,middleName:g,familyName:m,additionalLoginIds:p,sendSMS:y,sendMail:f,inviteUrl:b,invite:w})=>n(void 0,void 0,void 0,(function*(){if(s)return De({loginId:i,email:o,phone:r,displayName:a,roles:d,customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,givenName:v,middleName:g,familyName:m,additionalLoginIds:p,sendSMS:y,sendMail:f,inviteUrl:b,invite:w});const n=yield e.post(Fe.create,{loginId:i,email:o,phone:r,displayName:a,givenName:v,middleName:g,familyName:m,roleNames:d,userTenants:[{tenantId:t}],customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:p,sendSMS:y,sendMail:f,inviteUrl:b,invite:w},{queryParams:{tenant:t}});yield Be(n);return(yield n.json()).user})),update:({loginId:i,email:o,phone:r,displayName:a,roles:d,customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,givenName:v,middleName:g,familyName:m,additionalLoginIds:p})=>n(void 0,void 0,void 0,(function*(){if(s)return He({loginId:i,email:o,phone:r,displayName:a,roles:d,customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,givenName:v,middleName:g,familyName:m,additionalLoginIds:p});const n=yield e.post(Fe.update,{loginId:i,email:o,phone:r,displayName:a,givenName:v,middleName:g,familyName:m,roleNames:d,customAttributes:l,picture:u,verifiedEmail:c,verifiedPhone:h,additionalLoginIds:p},{queryParams:{tenant:t}});yield Be(n);return(yield n.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}});var i;return n(this,void 0,void 0,(function*(){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.90"}}));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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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")));const e=new k((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>{this.createUserModal.close(),this.resetFormData(this.createUserModal.ele)}));const i=new k((()=>{var e;return null===(e=this.createUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});i.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}});var i;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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(){const e=new k((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>this.disableUserModal.close()))},r=function(){const e=new k((()=>{var e;return null===(e=this.disableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>{const e=K(this.state);this.actions.disableUser(e),this.disableUserModal.close()}))},a=function(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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(){const e=new k((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>this.editUserModal.close()))},c=function(){const e=new k((()=>{var e;return null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.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(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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(){const e=new k((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>this.enableUserModal.close()))},r=function(){const e=new k((()=>{var e;return null===(e=this.enableUserModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>{const e=K(this.state);this.actions.enableUser(e),this.enableUserModal.close()}))},a=function(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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}});var t;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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(){const e=new k((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>this.removePasskeyModal.close()))},r=function(){const e=new k((()=>{var e;return null===(e=this.removePasskeyModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.onClick((()=>{const e=K(this.state);this.actions.removePasskey(e),this.removePasskeyModal.close()}))},a=function(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var s;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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")));const e=new k((()=>{var e;return null===(e=this.generatedPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-close"]')}),{logger:this.logger});e.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}});var s;return n(this,void 0,void 0,(function*(){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(){const e=new k((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-cancel"]')}),{logger:this.logger});e.onClick((()=>this.resetPasswordModal.close()))},r=function(){const e=new k((()=>{var e;return null===(e=this.resetPasswordModal.ele)||void 0===e?void 0:e.querySelector('[data-id="modal-submit"]')}),{logger:this.logger});e.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(){var e;return n(this,void 0,void 0,(function*(){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}});var i;return n(this,void 0,void 0,(function*(){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}});var t;return n(this,void 0,void 0,(function*(){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};
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -161,7 +161,7 @@ declare const UserManagementWidget: {
|
|
|
161
161
|
close(): void;
|
|
162
162
|
show(): void;
|
|
163
163
|
remove(): void;
|
|
164
|
-
"__#
|
|
164
|
+
"__#12128@#private": any;
|
|
165
165
|
logger: {
|
|
166
166
|
error(...data: any[]): void;
|
|
167
167
|
warn(...data: any[]): void;
|
|
@@ -175,7 +175,7 @@ declare const UserManagementWidget: {
|
|
|
175
175
|
type: "success" | "error";
|
|
176
176
|
msg: string;
|
|
177
177
|
}[]) => void;
|
|
178
|
-
"__#
|
|
178
|
+
"__#12121@#isInit": boolean;
|
|
179
179
|
connectedCallback: (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & {
|
|
180
180
|
(): void;
|
|
181
181
|
(): void;
|
|
@@ -1037,7 +1037,7 @@ declare const UserManagementWidget: {
|
|
|
1037
1037
|
tabIndex: number;
|
|
1038
1038
|
blur: (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void);
|
|
1039
1039
|
focus: ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void);
|
|
1040
|
-
"__#
|
|
1040
|
+
"__#12132@#NotificationDriverWrapper": new (refOrRefFn: Element | (() => HTMLElement), config: {
|
|
1041
1041
|
logger: {
|
|
1042
1042
|
error(...data: any[]): void;
|
|
1043
1043
|
warn(...data: any[]): void;
|
|
@@ -1050,7 +1050,7 @@ declare const UserManagementWidget: {
|
|
|
1050
1050
|
close(): void;
|
|
1051
1051
|
show(): void;
|
|
1052
1052
|
remove(): void;
|
|
1053
|
-
"__#
|
|
1053
|
+
"__#12128@#private": any;
|
|
1054
1054
|
logger: {
|
|
1055
1055
|
error(...data: any[]): void;
|
|
1056
1056
|
warn(...data: any[]): void;
|
|
@@ -1075,7 +1075,7 @@ declare const UserManagementWidget: {
|
|
|
1075
1075
|
close(): void;
|
|
1076
1076
|
show(): void;
|
|
1077
1077
|
remove(): void;
|
|
1078
|
-
"__#
|
|
1078
|
+
"__#12128@#private": any;
|
|
1079
1079
|
logger: {
|
|
1080
1080
|
error(...data: any[]): void;
|
|
1081
1081
|
warn(...data: any[]): void;
|
|
@@ -1085,21 +1085,21 @@ declare const UserManagementWidget: {
|
|
|
1085
1085
|
readonly asyncEle: Promise<Element>;
|
|
1086
1086
|
readonly ele: Element;
|
|
1087
1087
|
};
|
|
1088
|
-
"__#
|
|
1089
|
-
"__#
|
|
1090
|
-
"__#
|
|
1091
|
-
"__#
|
|
1092
|
-
"__#
|
|
1093
|
-
"__#
|
|
1094
|
-
"__#
|
|
1095
|
-
"__#
|
|
1088
|
+
"__#12127@#errorCbsSym": symbol;
|
|
1089
|
+
"__#12127@#loadCbsSym": symbol;
|
|
1090
|
+
"__#12127@#getComponentsVersion": (() => Promise<any>) & (() => Promise<any>) & (() => Promise<any>) & (() => Promise<any>);
|
|
1091
|
+
"__#12127@#exposeAlternateEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
|
|
1092
|
+
"__#12127@#handleFallbackScript": ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[]) => Promise<void>) & ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[]) => Promise<void>) & ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[]) => Promise<void>) & ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[]) => Promise<void>);
|
|
1093
|
+
"__#12127@#registerEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
|
|
1094
|
+
"__#12127@#getDescopeUiLoadingScript": (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>);
|
|
1095
|
+
"__#12127@#descopeUi": Promise<any>;
|
|
1096
1096
|
readonly descopeUi: Promise<any>;
|
|
1097
|
-
"__#
|
|
1097
|
+
"__#12127@#loadDescopeUiComponent": ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>);
|
|
1098
1098
|
loadDescopeUiComponents: ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>) & ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>) & ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>) & ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>);
|
|
1099
|
-
"__#
|
|
1099
|
+
"__#12127@#getDescopeUi": (() => Promise<unknown>) & (() => Promise<unknown>) & (() => Promise<unknown>) & (() => Promise<unknown>);
|
|
1100
1100
|
readonly config: any;
|
|
1101
|
-
"__#
|
|
1102
|
-
"__#
|
|
1101
|
+
"__#12124@#_configResource": any;
|
|
1102
|
+
"__#12124@#fetchConfig": (() => Promise<{
|
|
1103
1103
|
projectConfig: _descope_sdk_mixins.ProjectConfiguration;
|
|
1104
1104
|
executionContext: {
|
|
1105
1105
|
geo: string;
|
|
@@ -1150,17 +1150,17 @@ declare const UserManagementWidget: {
|
|
|
1150
1150
|
readonly baseStaticUrl: string;
|
|
1151
1151
|
readonly baseUrl: string;
|
|
1152
1152
|
readonly projectId: string;
|
|
1153
|
-
"__#
|
|
1154
|
-
"__#
|
|
1153
|
+
"__#12123@#handleError": ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void);
|
|
1154
|
+
"__#12122@#observeMappings": {};
|
|
1155
1155
|
observeAttribute: ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any);
|
|
1156
1156
|
observeAttributes: ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void);
|
|
1157
|
-
"__#
|
|
1157
|
+
"__#12120@#logger": {
|
|
1158
1158
|
error(...data: any[]): void;
|
|
1159
1159
|
warn(...data: any[]): void;
|
|
1160
1160
|
info(...data: any[]): void;
|
|
1161
1161
|
debug(...data: any[]): void;
|
|
1162
1162
|
};
|
|
1163
|
-
"__#
|
|
1163
|
+
"__#12120@#wrapLogger": ((logger: Partial<{
|
|
1164
1164
|
error(...data: any[]): void;
|
|
1165
1165
|
warn(...data: any[]): void;
|
|
1166
1166
|
info(...data: any[]): void;
|
|
@@ -18809,7 +18809,7 @@ declare const UserManagementWidget: {
|
|
|
18809
18809
|
"__#19@#initCancelButton"(): void;
|
|
18810
18810
|
"__#19@#initSubmitButton"(): void;
|
|
18811
18811
|
"__#19@#initRemovePasskeyModal"(): Promise<void>;
|
|
18812
|
-
"__#
|
|
18812
|
+
"__#12131@#ModalDriverWrapper": new (refOrRefFn: Element | (() => HTMLElement), config: {
|
|
18813
18813
|
logger: {
|
|
18814
18814
|
error(...data: any[]): void;
|
|
18815
18815
|
warn(...data: any[]): void;
|
|
@@ -18818,7 +18818,7 @@ declare const UserManagementWidget: {
|
|
|
18818
18818
|
};
|
|
18819
18819
|
}) => {
|
|
18820
18820
|
setContent(template: HTMLTemplateElement): void;
|
|
18821
|
-
"__#
|
|
18821
|
+
"__#12130@#private": any;
|
|
18822
18822
|
beforeOpen: () => void | Promise<void>;
|
|
18823
18823
|
afterClose: () => void;
|
|
18824
18824
|
nodeName: string;
|
|
@@ -18826,7 +18826,7 @@ declare const UserManagementWidget: {
|
|
|
18826
18826
|
open(): Promise<void>;
|
|
18827
18827
|
reset(): void;
|
|
18828
18828
|
remove(): void;
|
|
18829
|
-
"__#
|
|
18829
|
+
"__#12128@#private": any;
|
|
18830
18830
|
logger: {
|
|
18831
18831
|
error(...data: any[]): void;
|
|
18832
18832
|
warn(...data: any[]): void;
|
|
@@ -18921,14 +18921,14 @@ declare const UserManagementWidget: {
|
|
|
18921
18921
|
"__#21@#onCustomAttrsUpdate": (customAttrs: CustomAttr[]) => void;
|
|
18922
18922
|
"__#21@#registerSortColumnEvent"(): void;
|
|
18923
18923
|
readonly theme: _descope_sdk_mixins.ThemeOptions;
|
|
18924
|
-
"__#
|
|
18925
|
-
"__#
|
|
18926
|
-
readonly "__#
|
|
18927
|
-
"__#
|
|
18928
|
-
"__#
|
|
18929
|
-
"__#
|
|
18930
|
-
"__#
|
|
18931
|
-
"__#
|
|
18924
|
+
"__#12133@#_themeResource": Promise<void | Record<string, any>>;
|
|
18925
|
+
"__#12133@#fetchTheme"(): Promise<Record<string, any>>;
|
|
18926
|
+
readonly "__#12133@#themeResource": Promise<void | Record<string, any>>;
|
|
18927
|
+
"__#12133@#loadGlobalStyle"(): Promise<void>;
|
|
18928
|
+
"__#12133@#loadComponentsStyle"(): Promise<void>;
|
|
18929
|
+
"__#12133@#loadFonts"(): Promise<void>;
|
|
18930
|
+
"__#12133@#applyTheme"(): Promise<void>;
|
|
18931
|
+
"__#12126@#debuggerEle": HTMLElement & {
|
|
18932
18932
|
updateData: (data: {
|
|
18933
18933
|
title: string;
|
|
18934
18934
|
description?: string;
|
|
@@ -18937,11 +18937,11 @@ declare const UserManagementWidget: {
|
|
|
18937
18937
|
description?: string;
|
|
18938
18938
|
}[]) => void;
|
|
18939
18939
|
};
|
|
18940
|
-
"__#
|
|
18941
|
-
"__#
|
|
18940
|
+
"__#12126@#disableDebugger"(): void;
|
|
18941
|
+
"__#12126@#enableDebugger"(): Promise<void>;
|
|
18942
18942
|
readonly debug: boolean;
|
|
18943
|
-
"__#
|
|
18944
|
-
"__#
|
|
18943
|
+
"__#12126@#handleDebugMode"(): void;
|
|
18944
|
+
"__#12126@#updateDebuggerMessages"(title: string, description: string): void;
|
|
18945
18945
|
};
|
|
18946
18946
|
};
|
|
18947
18947
|
|