@descope/user-management-widget
Advanced tools
Comparing version 0.4.43 to 0.4.44
/** | ||
* @descope/user-management-widget v0.4.43 | ||
* @descope/user-management-widget v0.4.44 | ||
*/ | ||
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,createValidateAttributesMixin as g,createStateManagementMixin as m,initLifecycleMixin as p,staticResourcesMixin as y,descopeUiMixin as f,initElementMixin as b,modalMixin as w,formMixin as R,notificationsMixin as M,debuggerMixin as W,themeMixin as P}from"@descope/sdk-mixins";import{ButtonDriver as U,MultiSelectDriver as k,TextDriver as C,TextFieldDriver as S,GridDriver as x}from"@descope/sdk-component-drivers";import{createSelector as I}from"reselect";import{createAsyncThunk as j}from"@reduxjs/toolkit";import N from"@descope/web-js-sdk";import L from"libphonenumber-js/min";const O={enabled:"active",disabled:"disabled",invited:"invited"},T=e=>e.tenantRoles.data,q=e=>e.selectedUsersLoginIds,A=e=>e.notifications,F=e=>e.customAttributes.data,$=I((e=>e.usersList.data),(e=>e.map((e=>Object.assign(Object.assign({},e),{status:O[e.status]||e.status,roles:e.roleNames}))))),B=I(q,$,((e,t)=>t.filter((t=>e.includes(t.loginIds))))),E=I(B,(e=>e.map((e=>e.userId)))),D=I(B,(e=>e.map((e=>e.status)))),H=I(B,(e=>e.every((e=>e.editable)))),Z=I(q,(e=>!!e.length)),V=I(q,(e=>1===e.length)),z=I(q,(e=>{var t;return null===(t=null==e?void 0:e[0])||void 0===t?void 0:t[0]})),J=I(V,D,((e,t)=>e&&t.every((e=>e===O.enabled)))),G=I(D,(e=>e.every((e=>e===O.disabled)))),K=I(B,(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`})),Q=I(V,G,H,((e,t,s)=>e&&t&&s)),X=I(V,J,H,((e,t,s)=>e&&t&&s)),Y=I(V,H,((e,t)=>e&&t)),_=I(V,H,((e,t)=>e&&t)),ee=I(V,H,((e,t)=>e&&t)),te=I(Z,H,((e,t)=>e&&t)),se=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)}))}))},ie=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}}),oe=({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)})}}),re=j("users/create",((e,{extra:{api:t}})=>t.user.create(e))),ae=se(re)({onFulfilled:(e,t)=>{e.usersList.data.unshift(t.payload)}},ie((e=>e.createUser)),oe({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>`}})),ne={action:re,reducer:ae},de=j("users/delete",((e,{extra:{api:t}})=>t.user.deleteBatch(e))),le=se(de)({onFulfilled:(e,t)=>{e.usersList.data=e.usersList.data.filter((e=>!t.meta.arg.includes(e.userId))),e.selectedUsersLoginIds=[]}},ie((e=>e.deleteUser)),oe({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"]}`})),ue={action:de,reducer:le},ce=j("users/setTempPassword",((e,{extra:{api:t}})=>t.user.setTempPassword(e))),he=se(ce)(ie((e=>e.setTempUserPassword)),oe({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>`}})),ve={action:ce,reducer:he},ge=j("users/getCustomAttributes",((e,{extra:{api:t}})=>t.user.getCustomAttributes())),me=se(ge)({onFulfilled:(e,t)=>{e.customAttributes.data=t.payload}},ie((e=>e.customAttributes))),pe={action:ge,reducer:me},ye=j("users/search",((e,{extra:{api:t},getState:s})=>{const i=s().searchParams;return t.user.search(Object.assign(Object.assign({},i),e))})),fe=se(ye)({onPending:(e,t)=>{e.searchParams=Object.assign(Object.assign({},e.searchParams),t.meta.arg)},onFulfilled:(e,t)=>{e.usersList.data=t.payload}},ie((e=>e.usersList))),be={action:ye,reducer:fe},we=j("tenant/getTenantRoles",((e,{extra:{api:t}})=>t.tenant.getTenantRoles())),Re=se(we)({onFulfilled:(e,t)=>{e.tenantRoles.data=t.payload.roles}},ie((e=>e.tenantRoles))),Me={action:we,reducer:Re},We=j("users/update",((e,{extra:{api:t}})=>t.user.update(e))),Pe=se(We)({onFulfilled:(e,s)=>{const i=e.usersList.data.findIndex((e=>t(e.loginIds,s.payload.loginIds)));-1!==i&&(e.usersList.data[i]=s.payload)}},ie((e=>e.updateUser)),oe({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>`}})),Ue={action:We,reducer:Pe},ke=j("users/enable",((e,{extra:{api:t}})=>t.user.enable(e))),Ce=se(ke)({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)}},ie((e=>e.enableUser)),oe({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>`}})),Se={action:ke,reducer:Ce},xe=j("users/disable",((e,{extra:{api:t}})=>t.user.disable(e))),Ie=se(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)}},ie((e=>e.disableUser)),oe({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>`}})),je={action:xe,reducer:Ie},Ne=j("users/removePasskey",((e,{extra:{api:t}})=>t.user.removePasskey(e))),Le={action:Ne,reducer:se(Ne)(ie((e=>e.removePasskey)),oe({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>`}}))},Oe={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:[]},Te={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"},qe={roles:"/v1/mgmt/role/all"},Ae=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)})),Fe=({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()))))}))})),$e=({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})}))})),Be=({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})}))})),Ee=()=>n(void 0,void 0,void 0,(function*(){})),De=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({cleartext:Math.random().toString(20).substring(2)})}))})),He=()=>n(void 0,void 0,void 0,(function*(){})),Ze=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"enabled"}})}))})),Ve=e=>n(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({user:{loginIds:[e],status:"disabled"}})}))})),ze=()=>n(void 0,void 0,void 0,(function*(){return new Promise((e=>{e([])}))})),Je=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})})),Ge=({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 Fe({page:i,limit:o,customAttributes:r,statuses:a,emails:d,phones:l,text:u,sort:c});const n=yield e.post(Te.search,{limit:o,page:i,withTestUser:!1,customAttributes:r,statuses:a,emails:d,phones:l,text:u,sort:c},{queryParams:{tenant:t}});yield Ae(n);return(yield n.json()).users})),deleteBatch:i=>n(void 0,void 0,void 0,(function*(){if(s)return Ee();const o=yield e.post(Te.deleteBatch,{userIds:i},{queryParams:{tenant:t}});return yield Ae(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 $e({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(Te.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 Ae(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 Be({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(Te.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 Ae(n);return(yield n.json()).user})),enable:i=>n(void 0,void 0,void 0,(function*(){if(s)return Ze(i);const o=yield e.post(Te.status,{loginId:i,status:"enabled"},{queryParams:{tenant:t}});return yield Ae(o),o.json()})),disable:i=>n(void 0,void 0,void 0,(function*(){if(s)return Ve(i);const o=yield e.post(Te.status,{loginId:i,status:"disabled"},{queryParams:{tenant:t}});return yield Ae(o),o.json()})),removePasskey:i=>n(void 0,void 0,void 0,(function*(){if(s)return He();const o=yield e.post(Te.removePasskey,{loginId:i},{queryParams:{tenant:t}});return yield Ae(o),o.json()})),setTempPassword:i=>n(void 0,void 0,void 0,(function*(){if(s)return De();const o=yield e.post(Te.setTempPassword,{loginId:i},{queryParams:{tenant:t}});return yield Ae(o),o.json()})),getCustomAttributes:()=>n(void 0,void 0,void 0,(function*(){if(s)return ze();const i=yield e.get(Te.customAttributes,{queryParams:{tenant:t}});yield Ae(i);return(yield i.json()).data}))}),Ke=({httpClient:e,tenant:t,mock:s})=>({getTenantRoles:()=>n(void 0,void 0,void 0,(function*(){if(s)return Je(t);const i=yield e.get(qe.roles,{queryParams:{tenant:t}});return yield Ae(i),i.json()}))}),Qe=s((e=>{var t,s,o,r;const a=i(c,h,v,g({tenant:g.missingAttrValidator}))(e);return r=class extends a{constructor(){super(...arguments),t.add(this),s.set(this,void 0)}get baseUrl(){return this.getAttribute("base-url")}get tenant(){return this.getAttribute("tenant")}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)=>{const i=N(Object.assign(Object.assign({},e),{persistTokens:!0}));return{user:Ge({httpClient:i.httpClient,tenant:t,mock:s}),tenant:Ke({httpClient:i.httpClient,tenant:t,mock:s})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock),"f")},r})),Xe=s((e=>{const t=i(m({name:"widget",initialState:Oe,reducers:{setSelectedUsersIds:(e,{payload:t})=>{e.selectedUsersLoginIds=t},clearNotifications:e=>{e.notifications=[]}},extraReducers:e=>{ne.reducer(e),Ue.reducer(e),Se.reducer(e),je.reducer(e),ue.reducer(e),be.reducer(e),ve.reducer(e),Le.reducer(e),pe.reducer(e),Me.reducer(e)},asyncActions:{searchUsers:be.action,createUser:ne.action,updateUser:Ue.action,enableUser:Se.action,disableUser:je.action,deleteUsers:ue.action,removePasskey:Le.action,getCustomAttributes:pe.action,getTenantRoles:Me.action,setTempUserPassword:ve.action}}),p,v,Qe)(e);return class extends t{constructor(...e){super(...e),this.state=Oe,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),Ye=s((e=>{const t=i(y,g({"widget-id":g.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}))}}})),_e=s((e=>{var t,s,r;return r=class extends(i(v,p,f,b,Ye,Xe)(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})),et=s((e=>{var t,s,r,a,u,c;return c=class extends(i(Xe,w,R,v,_e)(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(T(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 U((()=>{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 U((()=>{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*(){this.validateForm(this.createUserModal.ele)&&(this.actions.createUser(Object.assign(Object.assign({},this.getFormData(this.createUserModal.ele)),{invite:!0,verifiedEmail:!0,verifiedPhone:!0})),this.createUserModal.close(),this.resetFormData(this.createUserModal.ele))})))),l(this,s,new k((()=>{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=F(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})),tt=s((e=>{var t,s,o;return o=class extends(i(v,et,_e)(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 U(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})),st=s((e=>{var t,s,r;return r=class extends(i(Xe,w,v,_e)(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 U((()=>{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 U((()=>{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=E(this.state);this.actions.deleteUsers(e),this.deleteUsersModal.close()}));const i=new C(null===(e=this.deleteUsersModal.ele)||void 0===e?void 0:e.querySelector('[data-id="body-text"]'),{logger:this.logger});this.deleteUsersModal.beforeOpen=()=>{const e=K(this.state);i.text=`Delete ${e}?`}}))},r})),it=s((e=>{var t,s,o,a;return a=class extends(i(v,_e,Xe,st)(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),te)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.deleteButton=new U(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})),ot=s((e=>{var t,s,r,a,l;return l=class extends(i(Xe,w,v,R,_e)(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 U((()=>{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 U((()=>{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=z(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 C(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=K(this.state);i.text=`Disable ${e}?`}))}))},l})),rt=s((e=>{var t,s,o,a;return a=class extends(i(v,_e,Xe,ot,R)(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),X)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.disableButton=new U(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})),at=["customAttributes"],nt=e=>{if(!e)return e;const t=L(e),s=new RegExp(`(\\+?${null==t?void 0:t.countryCallingCode})(.*)`);return t.number.replace(s,"$1-$2")},dt=s((e=>{var t,s,r,a,c,h,g,m,p,y;return y=class extends(i(Xe,w,v,R,_e)(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(T(this.state).map((({name:e})=>({value:e,label:e}))))})))),m.set(this,(()=>{var e,t;const s=null===(e=B(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:nt(null==s?void 0:s.phone),roles:null==s?void 0:s.roles},(o=s.customAttributes,r="customAttributes.",Object.fromEntries(Object.entries(o||{}).map((([e,t])=>[`${r}${e}`,t])))));var o,r;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 U((()=>{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 U((()=>{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]},(e=>Object.entries(e).reduce(((e,[t,s])=>{const[i,...o]=t.split(".");return at.includes(i)?(e[i]||(e[i]={}),e[i][o.join(".")]=s,e):Object.assign(e,{[t]:s})}),{}))(s))),this.editUserModal.close(),this.resetFormData(this.editUserModal.ele)}}))},g=function(){const e=F(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 S(null===(e=this.editUserModal.ele)||void 0===e?void 0:e.querySelector('[name="loginId"]'),{logger:this.logger}),"f"),l(this,r,new k((()=>{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})),lt=s((e=>{var t,s,o,a;return a=class extends(i(v,_e,Xe,dt,R)(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),Y)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.editButton=new U(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})),ut=s((e=>{var t,s,r,a,l;return l=class extends(i(Xe,w,v,R,_e)(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 U((()=>{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 U((()=>{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=z(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 C(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=K(this.state);i.text=`Activate ${e}?`}))}))},l})),ct=s((e=>{var t,s,o,a;return a=class extends(i(v,_e,Xe,ut,R)(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),Q)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.enableButton=new U(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})),ht=s((e=>{var t,s,o,r;return r=class extends(i(v,_e,Xe)(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 S(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 vt={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},gt=s((e=>{var t,s,o,a,l;return l=class extends(i(v,Xe,M,p)(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),A)}))}},a=new WeakMap,t=new WeakSet,s=function({type:e,msg:t}){const s=vt[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})),mt=s((e=>{var t,s,r,a,l;return l=class extends(i(Xe,w,v,R,_e)(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 U((()=>{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 U((()=>{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=z(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 C(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=K(this.state);i.text=`Remove passkey for ${e}?`}))}))},l})),pt=s((e=>{var t,s,o,a;return a=class extends(i(v,_e,Xe,mt,R)(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),_)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.removePasskeyButton=new U(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})),yt=s((e=>{var t,s,o,l,u,c,h,g;return g=class extends(i(Xe,v,_e)(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,$(this.state)),d(this,c,"f").call(this,F(this.state)),this.subscribe(d(this,c,"f").bind(this),F),this.subscribe(d(this,l,"f").bind(this),$)}))}},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 x(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})),ft=s((e=>{var t,s,r;return r=class extends(i(Xe,w,v,R,_e)(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 U((()=>{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})),bt=s((e=>{var t,s,r,a,l;return l=class extends(i(Xe,w,v,R,_e,ft)(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 U((()=>{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 U((()=>{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=z(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 C(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=K(this.state);i.text=`This will generate a new temporary password for ${e}?`}))}))},l})),wt=s((e=>{var t,s,o,a;return a=class extends(i(v,_e,Xe,bt,R)(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),ee)}))}},o=new WeakMap,t=new WeakSet,s=function(){var e;this.resetPasswordButton=new U(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})),Rt=s((e=>class extends(i(W,P,yt,tt,it,lt,ct,rt,wt,pt,ht,gt)(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)}))}})),Mt=i((e=>class extends(Rt(e)){}))(HTMLElement);customElements.define("descope-user-management-widget",Mt);export{Mt as default}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@descope/user-management-widget", | ||
"version": "0.4.43", | ||
"version": "0.4.44", | ||
"author": "Descope Team <info@descope.com>", | ||
@@ -33,3 +33,3 @@ "homepage": "https://github.com/descope/descope-js", | ||
"@types/jest": "^29.0.0", | ||
"@types/node": "20.11.30", | ||
"@types/node": "20.12.2", | ||
"@types/testing-library__jest-dom": "5.14.9", | ||
@@ -81,6 +81,6 @@ "dotenv": "^16.0.3", | ||
"immer": "^10.0.3", | ||
"@descope/web-js-sdk": "1.10.35", | ||
"@descope/sdk-helpers": "0.1.20", | ||
"@descope/sdk-mixins": "0.2.2", | ||
"@descope/sdk-component-drivers": "0.2.1" | ||
"@descope/sdk-helpers": "0.1.21", | ||
"@descope/web-js-sdk": "1.10.36", | ||
"@descope/sdk-mixins": "0.2.3", | ||
"@descope/sdk-component-drivers": "0.2.2" | ||
}, | ||
@@ -87,0 +87,0 @@ "overrides": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3891447
+ Added@descope/core-js-sdk@2.14.1(transitive)
+ Added@descope/sdk-component-drivers@0.2.2(transitive)
+ Added@descope/sdk-helpers@0.1.21(transitive)
+ Added@descope/sdk-mixins@0.2.3(transitive)
+ Added@descope/web-js-sdk@1.10.36(transitive)
- Removed@descope/core-js-sdk@2.14.0(transitive)
- Removed@descope/sdk-component-drivers@0.2.1(transitive)
- Removed@descope/sdk-helpers@0.1.20(transitive)
- Removed@descope/sdk-mixins@0.2.2(transitive)
- Removed@descope/web-js-sdk@1.10.35(transitive)
Updated@descope/sdk-helpers@0.1.21
Updated@descope/sdk-mixins@0.2.3
Updated@descope/web-js-sdk@1.10.36