@descope/user-profile-widget 0.2.14 → 0.2.16

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/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * @descope/user-profile-widget v0.2.14
3
+ * @descope/user-profile-widget v0.2.16
4
4
  */
5
- "use strict";var e=require("tslib"),t=require("@descope/sdk-helpers"),i=require("@descope/sdk-mixins"),s=require("@descope/sdk-component-drivers"),a=require("@reduxjs/toolkit");require("@descope/core-js-sdk");var l=require("@descope/web-js-sdk"),r=require("reselect");require("@descope/web-component");const o=(e={})=>{const i=t.createTemplate("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,s])=>{i.content.querySelector("descope-wc").setAttribute(t.kebabCase(e),s)})),i};function d(e){return new URLSearchParams(window.location.search).get(e)}const n=e=>(...t)=>i=>{i.addCase(e.pending,((e,i)=>{t.forEach((({onPending:t})=>{null==t||t(e,i)}))})),i.addCase(e.fulfilled,((e,i)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,i)}))})),i.addCase(e.rejected,((e,i)=>{t.forEach((({onRejected:t})=>{null==t||t(e,i)}))}))},c=a.createAsyncThunk("users/me",((e,{extra:{api:t}})=>t.user.me())),h=n(c)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(v=e=>e.me,{onFulfilled:e=>{v(e).loading=!1},onPending:e=>{v(e).loading=!0,v(e).error=null},onRejected:(e,t)=>{v(e).loading=!1,v(e).error=t.error}}));var v;const u={action:c,reducer:h},_=a.createAsyncThunk("users/logout",((e,{extra:{api:t}})=>t.user.logout())),g={action:_,reducer:n(_)({})},f={me:{loading:!1,error:null,data:{}}},p={me:"/v1/auth/me"},w=()=>e.__awaiter(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))})),F=({httpClient:t,mock:i})=>({me:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(i)return w();const s=yield t.get(p.me);return yield(t=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=yield t.text(),i=JSON.parse(e);if(!t.ok){const e=`${i.errorDescription}${i.errorMessage?`: ${i.errorMessage}`:""}`;throw Error(e||`${t.status} ${t.statusText}`)}t.json=()=>Promise.resolve(i),t.text=()=>Promise.resolve(e)})))(s),s.json()}))}),m=t.createSingletonMixin((s=>{var a,r,o,d;const n=t.compose(i.projectIdMixin,i.observeAttributesMixin,i.loggerMixin,i.baseUrlMixin)(s);return d=class extends n{constructor(){super(...arguments),a.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return e.__classPrivateFieldGet(this,r,"f")||e.__classPrivateFieldGet(this,a,"m",o).call(this),e.__classPrivateFieldGet(this,r,"f")}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this),this.observeAttributes(["project-id","base-url"],(()=>{e.__classPrivateFieldGet(this,r,"f")&&e.__classPrivateFieldGet(this,a,"m",o).call(this)}))}))}},r=new WeakMap,a=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),e.__classPrivateFieldSet(this,r,((t,i,s)=>{const a=l(Object.assign(Object.assign({},t),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.2.14"}}));return{user:Object.assign(Object.assign({},F({httpClient:a.httpClient,mock:i})),{logout:i?()=>e.__awaiter(void 0,void 0,void 0,(function*(){})):a.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},d})),P=t.createSingletonMixin((e=>{const s=t.compose(i.createStateManagementMixin({name:"widget",initialState:f,reducers:{},extraReducers:e=>{u.reducer(e),g.reducer(e)},asyncActions:{getMe:u.action,logout:g.action}}),i.initLifecycleMixin,i.loggerMixin,m)(e);return class extends s{constructor(...e){super(...e),this.state=f,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),b="widget-flow",G=t.createSingletonMixin((a=>{var l,r,n;return n=class extends(t.compose(i.initLifecycleMixin,i.modalMixin,P,i.loggerMixin)(a)){constructor(){super(...arguments),l.add(this)}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this);const s=d(b);s&&(!function(e){if(window.history.replaceState&&d(e)){const t=new URL(window.location.href),i=new URLSearchParams(t.search);i.delete(e),t.search=i.toString(),window.history.replaceState({},"",t.toString())}}(b),e.__classPrivateFieldGet(this,l,"m",r).call(this,s))}))}},l=new WeakSet,r=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(o({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl}));new s.FlowDriver((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},n})),M=e=>e.me.data,S=r.createSelector(M,(e=>e.picture)),y=r.createSelector(M,(e=>e.email)),U=r.createSelector(M,(e=>e.verifiedEmail)),R=r.createSelector(M,(e=>e.name)),x=r.createSelector(M,(e=>e.phone)),k=r.createSelector(M,(e=>e.verifiedPhone)),W=r.createSelector(M,(e=>e.webauthn));r.createSelector(M,(e=>e.password));const A=r.createSelector(M,(e=>e.customAttributes)),I=t.createSingletonMixin((s=>{const a=t.compose(i.staticResourcesMixin,i.createValidateAttributesMixin({"widget-id":i.createValidateAttributesMixin.missingAttrValidator}))(s);return class extends a{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(t){return e.__awaiter(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${t}`,"text")).body}))}}})),C=t.createSingletonMixin((s=>{var a,l,r;return r=class extends(t.compose(i.loggerMixin,i.initLifecycleMixin,i.descopeUiMixin,i.initElementMixin,I,P)(s)){constructor(){super(...arguments),a.add(this)}onWidgetRootReady(){return e.__awaiter(this,void 0,void 0,(function*(){}))}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this),yield Promise.all([this.actions.getMe(),e.__classPrivateFieldGet(this,a,"m",l).call(this)]),this.onWidgetRootReady()}))}},a=new WeakSet,l=function(){return e.__awaiter(this,void 0,void 0,(function*(){const e=t.createTemplate(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},r})),j=t.createSingletonMixin((e=>class extends(t.compose(i.themeMixin,i.observeAttributesMixin)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),T=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_;return _=class extends(t.compose(j,i.themeMixin,P,i.loggerMixin,C,i.modalMixin,i.baseStaticUrlMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),v.set(this,t.withMemCache((e=>{this.avatar.image=e}))),u.set(this,t.withMemCache((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",n).call(this),e.__classPrivateFieldGet(this,v,"f").call(this,S(this.state)),e.__classPrivateFieldGet(this,u,"f").call(this,R(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),S),this.subscribe(e.__classPrivateFieldGet(this,u,"f").bind(this),R)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,u=new WeakMap,l=new WeakSet,n=function(){this.avatar.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"update-pic"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},h=function(){this.avatar=new s.AvatarDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},_})),q=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p,w;return w=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.emailUserAttr.value=e}))),p.set(this,t.withMemCache((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,y(this.state)),e.__classPrivateFieldGet(this,p,"f").call(this,U(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),y),this.subscribe(e.__classPrivateFieldGet(this,p,"f").bind(this),U)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,p=new WeakMap,l=new WeakSet,h=function(){this.emailUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-email"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.emailUserAttr.deleteFlowId&&(e.__classPrivateFieldSet(this,n,this.createModal({"data-id":"delete-email"}),"f"),e.__classPrivateFieldSet(this,c,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,n,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",_).bind(this),e.__classPrivateFieldGet(this,l,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,n,"f").setContent(o({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.emailUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.emailUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},w})),D=t.createSingletonMixin((a=>{var l,r,o;return o=class extends(t.compose(P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",r).call(this)}))}},l=new WeakSet,r=function(){this.logout=new s.ButtonDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>e.__awaiter(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},o})),E=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p;return p=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,R(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),R)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,l=new WeakSet,h=function(){this.nameUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-name"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.nameUserAttr.deleteFlowId&&(e.__classPrivateFieldSet(this,n,this.createModal({"data-id":"delete-name"}),"f"),e.__classPrivateFieldSet(this,c,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,n,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",_).bind(this),e.__classPrivateFieldGet(this,l,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,n,"f").setContent(o({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.nameUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.nameUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},p})),O=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u;return u=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),v.set(this,t.withMemCache((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",n).call(this),e.__classPrivateFieldGet(this,v,"f").call(this,W(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),W)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,l=new WeakSet,n=function(){this.passkeyUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"passkey"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},h=function(){this.passkeyUserAuthMethod=new s.UserAuthMethodDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},u})),L=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v;return v=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",n).call(this)}))}},r=new WeakMap,d=new WeakMap,l=new WeakSet,n=function(){this.passwordUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"password"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close()}))},h=function(){this.passwordUserAuthMethod=new s.UserAuthMethodDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},v})),N=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p,w;return w=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.phoneUserAttr.value=e}))),p.set(this,t.withMemCache((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,x(this.state)),e.__classPrivateFieldGet(this,p,"f").call(this,k(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),x),this.subscribe(e.__classPrivateFieldGet(this,p,"f").bind(this),k)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,p=new WeakMap,l=new WeakSet,h=function(){this.phoneUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-phone"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.phoneUserAttr.deleteFlowId&&(e.__classPrivateFieldSet(this,n,this.createModal({"data-id":"delete-phone"}),"f"),e.__classPrivateFieldSet(this,c,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,n,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",_).bind(this),e.__classPrivateFieldGet(this,l,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,n,"f").setContent(o({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.phoneUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.phoneUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},w}));var $;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}($||($={}));const B=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f;return r=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),d.set(this,{}),n.set(this,{}),c.set(this,{}),h.set(this,{}),_.set(this,t.withMemCache((t=>{var i;const a=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(a).forEach((i=>{const a=i.getAttribute("data-id").replace("customAttributes.",""),o=i.getAttribute("data-type")||$.TEXT,d=t[a],n=new s.UserAttributeDriver(i,{logger:this.logger});n.value=r.getFormattedValue(o,d),e.__classPrivateFieldGet(this,l,"m",g).call(this,i,a,n),e.__classPrivateFieldGet(this,l,"m",f).call(this,i,a,n)}))})))}static getFormattedValue(e,t){return e===$.DATE&&t?new Date(t).toLocaleString():e===$.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,_,"f").call(this,A(this.state)),this.subscribe(e.__classPrivateFieldGet(this,_,"f").bind(this),A)}))}},d=new WeakMap,n=new WeakMap,c=new WeakMap,h=new WeakMap,_=new WeakMap,l=new WeakSet,v=function(t){var i,s;null===(i=e.__classPrivateFieldGet(this,d,"f")[t])||void 0===i||i.setContent(o({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e.__classPrivateFieldGet(this,n,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,d,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},u=function(t){var i,s;null===(i=e.__classPrivateFieldGet(this,c,"f")[t])||void 0===i||i.setContent(o({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e.__classPrivateFieldGet(this,h,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,c,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},g=function(t,i,a){const r=t.getAttribute("edit-flow-id");r&&(e.__classPrivateFieldGet(this,d,"f")[r]=this.createModal({"data-id":`edit-${i}`}),e.__classPrivateFieldGet(this,n,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,d,"f")[r].afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this,r),a.onEditClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,l,"m",v).call(this,r),this.syncFlowTheme(e.__classPrivateFieldGet(this,n,"f")[r]))},f=function(t,i,a){const r=t.getAttribute("delete-flow-id");r&&(e.__classPrivateFieldGet(this,c,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e.__classPrivateFieldGet(this,h,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,c,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,c,"f")[r].afterClose=e.__classPrivateFieldGet(this,l,"m",u).bind(this,r),a.onDeleteClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,c,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,l,"m",u).call(this,r),this.syncFlowTheme(e.__classPrivateFieldGet(this,h,"f")[r]))},r})),V=t.createSingletonMixin((s=>class extends(t.compose(i.debuggerMixin,i.themeMixin,G,B,q,T,E,N,O,L,D)(s)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this)}))}})),H=t.compose((t=>class extends(V(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this);(customElements.get("descope-wc")||(yield import("@descope/web-component").then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.14"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",H),module.exports=H;
5
+ "use strict";var e=require("tslib"),t=require("@descope/sdk-helpers"),i=require("@descope/sdk-mixins"),s=require("@descope/sdk-component-drivers"),a=require("@reduxjs/toolkit");require("@descope/core-js-sdk");var l=require("@descope/web-js-sdk"),r=require("reselect");require("@descope/web-component");const o=(e={})=>{const i=t.createTemplate("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,s])=>{i.content.querySelector("descope-wc").setAttribute(t.kebabCase(e),s)})),i};function d(e){return new URLSearchParams(window.location.search).get(e)}const n=e=>(...t)=>i=>{i.addCase(e.pending,((e,i)=>{t.forEach((({onPending:t})=>{null==t||t(e,i)}))})),i.addCase(e.fulfilled,((e,i)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,i)}))})),i.addCase(e.rejected,((e,i)=>{t.forEach((({onRejected:t})=>{null==t||t(e,i)}))}))},c=a.createAsyncThunk("users/me",((e,{extra:{api:t}})=>t.user.me())),h=n(c)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(v=e=>e.me,{onFulfilled:e=>{v(e).loading=!1},onPending:e=>{v(e).loading=!0,v(e).error=null},onRejected:(e,t)=>{v(e).loading=!1,v(e).error=t.error}}));var v;const u={action:c,reducer:h},_=a.createAsyncThunk("users/logout",((e,{extra:{api:t}})=>t.user.logout())),g={action:_,reducer:n(_)({})},f={me:{loading:!1,error:null,data:{}}},p={me:"/v1/auth/me"},w=()=>e.__awaiter(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))})),F=({httpClient:t,mock:i})=>({me:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(i)return w();const s=yield t.get(p.me);return yield(t=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=yield t.text(),i=JSON.parse(e);if(!t.ok){const e=`${i.errorDescription}${i.errorMessage?`: ${i.errorMessage}`:""}`;throw Error(e||`${t.status} ${t.statusText}`)}t.json=()=>Promise.resolve(i),t.text=()=>Promise.resolve(e)})))(s),s.json()}))}),m=t.createSingletonMixin((s=>{var a,r,o,d;const n=t.compose(i.projectIdMixin,i.observeAttributesMixin,i.loggerMixin,i.baseUrlMixin)(s);return d=class extends n{constructor(){super(...arguments),a.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return e.__classPrivateFieldGet(this,r,"f")||e.__classPrivateFieldGet(this,a,"m",o).call(this),e.__classPrivateFieldGet(this,r,"f")}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this),this.observeAttributes(["project-id","base-url"],(()=>{e.__classPrivateFieldGet(this,r,"f")&&e.__classPrivateFieldGet(this,a,"m",o).call(this)}))}))}},r=new WeakMap,a=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),e.__classPrivateFieldSet(this,r,((t,i,s)=>{const a=l(Object.assign(Object.assign({},t),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.2.16"}}));return{user:Object.assign(Object.assign({},F({httpClient:a.httpClient,mock:i})),{logout:i?()=>e.__awaiter(void 0,void 0,void 0,(function*(){})):a.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},d})),P=t.createSingletonMixin((e=>{const s=t.compose(i.createStateManagementMixin({name:"widget",initialState:f,reducers:{},extraReducers:e=>{u.reducer(e),g.reducer(e)},asyncActions:{getMe:u.action,logout:g.action}}),i.initLifecycleMixin,i.loggerMixin,m)(e);return class extends s{constructor(...e){super(...e),this.state=f,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),b="widget-flow",G=t.createSingletonMixin((a=>{var l,r,n;return n=class extends(t.compose(i.initLifecycleMixin,i.modalMixin,P,i.loggerMixin)(a)){constructor(){super(...arguments),l.add(this)}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this);const s=d(b);s&&(!function(e){if(window.history.replaceState&&d(e)){const t=new URL(window.location.href),i=new URLSearchParams(t.search);i.delete(e),t.search=i.toString(),window.history.replaceState({},"",t.toString())}}(b),e.__classPrivateFieldGet(this,l,"m",r).call(this,s))}))}},l=new WeakSet,r=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(o({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl}));new s.FlowDriver((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},n})),M=e=>e.me.data,S=r.createSelector(M,(e=>e.picture)),y=r.createSelector(M,(e=>e.email)),U=r.createSelector(M,(e=>e.verifiedEmail)),R=r.createSelector(M,(e=>e.name)),x=r.createSelector(M,(e=>e.phone)),k=r.createSelector(M,(e=>e.verifiedPhone)),W=r.createSelector(M,(e=>e.webauthn));r.createSelector(M,(e=>e.password));const A=r.createSelector(M,(e=>e.customAttributes)),I=t.createSingletonMixin((s=>{const a=t.compose(i.staticResourcesMixin,i.createValidateAttributesMixin({"widget-id":i.createValidateAttributesMixin.missingAttrValidator}))(s);return class extends a{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(t){return e.__awaiter(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${t}`,"text")).body}))}}})),C=t.createSingletonMixin((s=>{var a,l,r;return r=class extends(t.compose(i.loggerMixin,i.initLifecycleMixin,i.descopeUiMixin,i.initElementMixin,I,P)(s)){constructor(){super(...arguments),a.add(this)}onWidgetRootReady(){return e.__awaiter(this,void 0,void 0,(function*(){}))}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this),yield Promise.all([this.actions.getMe(),e.__classPrivateFieldGet(this,a,"m",l).call(this)]),this.onWidgetRootReady()}))}},a=new WeakSet,l=function(){return e.__awaiter(this,void 0,void 0,(function*(){const e=t.createTemplate(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},r})),j=t.createSingletonMixin((e=>class extends(t.compose(i.themeMixin,i.observeAttributesMixin)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),T=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_;return _=class extends(t.compose(j,i.themeMixin,P,i.loggerMixin,C,i.modalMixin,i.baseStaticUrlMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),v.set(this,t.withMemCache((e=>{this.avatar.image=e}))),u.set(this,t.withMemCache((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",n).call(this),e.__classPrivateFieldGet(this,v,"f").call(this,S(this.state)),e.__classPrivateFieldGet(this,u,"f").call(this,R(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),S),this.subscribe(e.__classPrivateFieldGet(this,u,"f").bind(this),R)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,u=new WeakMap,l=new WeakSet,n=function(){this.avatar.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"update-pic"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},h=function(){this.avatar=new s.AvatarDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},_})),q=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p,w;return w=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.emailUserAttr.value=e}))),p.set(this,t.withMemCache((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,y(this.state)),e.__classPrivateFieldGet(this,p,"f").call(this,U(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),y),this.subscribe(e.__classPrivateFieldGet(this,p,"f").bind(this),U)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,p=new WeakMap,l=new WeakSet,h=function(){this.emailUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-email"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.emailUserAttr.deleteFlowId&&(e.__classPrivateFieldSet(this,n,this.createModal({"data-id":"delete-email"}),"f"),e.__classPrivateFieldSet(this,c,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,n,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",_).bind(this),e.__classPrivateFieldGet(this,l,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,n,"f").setContent(o({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.emailUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.emailUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},w})),D=t.createSingletonMixin((a=>{var l,r,o;return o=class extends(t.compose(P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",r).call(this)}))}},l=new WeakSet,r=function(){this.logout=new s.ButtonDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>e.__awaiter(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},o})),E=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p;return p=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,R(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),R)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,l=new WeakSet,h=function(){this.nameUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-name"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.nameUserAttr.deleteFlowId&&(e.__classPrivateFieldSet(this,n,this.createModal({"data-id":"delete-name"}),"f"),e.__classPrivateFieldSet(this,c,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,n,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",_).bind(this),e.__classPrivateFieldGet(this,l,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,n,"f").setContent(o({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.nameUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.nameUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},p})),O=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u;return u=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),v.set(this,t.withMemCache((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",n).call(this),e.__classPrivateFieldGet(this,v,"f").call(this,W(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),W)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,l=new WeakSet,n=function(){this.passkeyUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"passkey"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},h=function(){this.passkeyUserAuthMethod=new s.UserAuthMethodDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},u})),L=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v;return v=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",n).call(this)}))}},r=new WeakMap,d=new WeakMap,l=new WeakSet,n=function(){this.passwordUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"password"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close()}))},h=function(){this.passwordUserAuthMethod=new s.UserAuthMethodDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},v})),N=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p,w;return w=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.phoneUserAttr.value=e}))),p.set(this,t.withMemCache((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,x(this.state)),e.__classPrivateFieldGet(this,p,"f").call(this,k(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),x),this.subscribe(e.__classPrivateFieldGet(this,p,"f").bind(this),k)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,p=new WeakMap,l=new WeakSet,h=function(){this.phoneUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-phone"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.phoneUserAttr.deleteFlowId&&(e.__classPrivateFieldSet(this,n,this.createModal({"data-id":"delete-phone"}),"f"),e.__classPrivateFieldSet(this,c,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,n,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",_).bind(this),e.__classPrivateFieldGet(this,l,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,n,"f").setContent(o({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.phoneUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.phoneUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},w}));var $;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}($||($={}));const B=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f;return r=class extends(t.compose(j,P,i.loggerMixin,C,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),d.set(this,{}),n.set(this,{}),c.set(this,{}),h.set(this,{}),_.set(this,t.withMemCache((t=>{var i;const a=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(a).forEach((i=>{const a=i.getAttribute("data-id").replace("customAttributes.",""),o=i.getAttribute("data-type")||$.TEXT,d=t[a],n=new s.UserAttributeDriver(i,{logger:this.logger});n.value=r.getFormattedValue(o,d),e.__classPrivateFieldGet(this,l,"m",g).call(this,i,a,n),e.__classPrivateFieldGet(this,l,"m",f).call(this,i,a,n)}))})))}static getFormattedValue(e,t){return e===$.DATE&&t?new Date(t).toLocaleString():e===$.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,_,"f").call(this,A(this.state)),this.subscribe(e.__classPrivateFieldGet(this,_,"f").bind(this),A)}))}},d=new WeakMap,n=new WeakMap,c=new WeakMap,h=new WeakMap,_=new WeakMap,l=new WeakSet,v=function(t){var i,s;null===(i=e.__classPrivateFieldGet(this,d,"f")[t])||void 0===i||i.setContent(o({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e.__classPrivateFieldGet(this,n,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,d,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},u=function(t){var i,s;null===(i=e.__classPrivateFieldGet(this,c,"f")[t])||void 0===i||i.setContent(o({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e.__classPrivateFieldGet(this,h,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,c,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},g=function(t,i,a){const r=t.getAttribute("edit-flow-id");r&&(e.__classPrivateFieldGet(this,d,"f")[r]=this.createModal({"data-id":`edit-${i}`}),e.__classPrivateFieldGet(this,n,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,d,"f")[r].afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this,r),a.onEditClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,l,"m",v).call(this,r),this.syncFlowTheme(e.__classPrivateFieldGet(this,n,"f")[r]))},f=function(t,i,a){const r=t.getAttribute("delete-flow-id");r&&(e.__classPrivateFieldGet(this,c,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e.__classPrivateFieldGet(this,h,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,c,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,c,"f")[r].afterClose=e.__classPrivateFieldGet(this,l,"m",u).bind(this,r),a.onDeleteClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,c,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,l,"m",u).call(this,r),this.syncFlowTheme(e.__classPrivateFieldGet(this,h,"f")[r]))},r})),V=t.createSingletonMixin((s=>class extends(t.compose(i.debuggerMixin,i.themeMixin,G,B,q,T,E,N,O,L,D)(s)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this)}))}})),H=t.compose((t=>class extends(V(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this);(customElements.get("descope-wc")||(yield import("@descope/web-component").then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.16"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",H),module.exports=H;
6
6
  //# sourceMappingURL=index.js.map
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * @descope/user-profile-widget v0.2.14
3
+ * @descope/user-profile-widget v0.2.16
4
4
  */
5
- import{__awaiter as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{createTemplate as s,kebabCase as o,createSingletonMixin as r,compose as n,withMemCache as a}from"@descope/sdk-helpers";import{projectIdMixin as l,observeAttributesMixin as d,loggerMixin as h,baseUrlMixin as c,createStateManagementMixin as u,initLifecycleMixin as f,modalMixin as v,staticResourcesMixin as g,createValidateAttributesMixin as p,descopeUiMixin as w,initElementMixin as m,themeMixin as b,baseStaticUrlMixin as y,debuggerMixin as U}from"@descope/sdk-mixins";import{FlowDriver as R,AvatarDriver as S,UserAttributeDriver as W,ButtonDriver as k,UserAuthMethodDriver as M}from"@descope/sdk-component-drivers";import{createAsyncThunk as I}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import A from"@descope/web-js-sdk";import{createSelector as j}from"reselect";import"@descope/web-component";const C=(t={})=>{const e=s("<descope-wc></descope-wc>");return Object.entries(t).forEach((([t,i])=>{e.content.querySelector("descope-wc").setAttribute(o(t),i)})),e};function x(t){return new URLSearchParams(window.location.search).get(t)}const F=t=>(...e)=>i=>{i.addCase(t.pending,((t,i)=>{e.forEach((({onPending:e})=>{null==e||e(t,i)}))})),i.addCase(t.fulfilled,((t,i)=>{e.forEach((({onFulfilled:e})=>{null==e||e(t,i)}))})),i.addCase(t.rejected,((t,i)=>{e.forEach((({onRejected:e})=>{null==e||e(t,i)}))}))},T=I("users/me",((t,{extra:{api:e}})=>e.user.me())),E=F(T)({onFulfilled:(t,e)=>{t.me.data=e.payload}},(O=t=>t.me,{onFulfilled:t=>{O(t).loading=!1},onPending:t=>{O(t).loading=!0,O(t).error=null},onRejected:(t,e)=>{O(t).loading=!1,O(t).error=e.error}}));var O;const q={action:T,reducer:E},P=I("users/logout",((t,{extra:{api:e}})=>e.user.logout())),L={action:P,reducer:F(P)({})},N={me:{loading:!1,error:null,data:{}}},D={me:"/v1/auth/me"},$=()=>t(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))})),B=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return $();const s=yield e.get(D.me);return yield(e=>t(void 0,void 0,void 0,(function*(){const t=yield e.text(),i=JSON.parse(t);if(!e.ok){const t=`${i.errorDescription}${i.errorMessage?`: ${i.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(i),e.text=()=>Promise.resolve(t)})))(s),s.json()}))}),H=r((s=>{var o,r,a,u;const f=n(l,d,h,c)(s);return u=class extends f{constructor(){super(...arguments),o.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return e(this,r,"f")||e(this,o,"m",a).call(this),e(this,r,"f")}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this),this.observeAttributes(["project-id","base-url"],(()=>{e(this,r,"f")&&e(this,o,"m",a).call(this)}))}))}},r=new WeakMap,o=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),i(this,r,((e,i,s)=>{const o=A(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.2.14"}}));return{user:Object.assign(Object.assign({},B({httpClient:o.httpClient,mock:i})),{logout:i?()=>t(void 0,void 0,void 0,(function*(){})):o.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},u})),V=r((t=>{const e=n(u({name:"widget",initialState:N,reducers:{},extraReducers:t=>{q.reducer(t),L.reducer(t)},asyncActions:{getMe:q.action,logout:L.action}}),f,h,H)(t);return class extends e{constructor(...t){super(...t),this.state=N,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),X="widget-flow",G=r((i=>{var s,o,r;return r=class extends(n(f,v,V,h)(i)){constructor(){super(...arguments),s.add(this)}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this);const r=x(X);r&&(!function(t){if(window.history.replaceState&&x(t)){const e=new URL(window.location.href),i=new URLSearchParams(e.search);i.delete(t),e.search=i.toString(),window.history.replaceState({},"",e.toString())}}(X),e(this,s,"m",o).call(this,r))}))}},s=new WeakSet,o=function(t){const e=this.createModal({"data-id":"redirect-flow"});e.setContent(C({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl}));new R((()=>{var t;return null===(t=e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{e.close(),this.actions.getMe()})),e.afterClose=()=>{e.remove()},e.open()},r})),J=t=>t.me.data,Y=j(J,(t=>t.picture)),_=j(J,(t=>t.email)),z=j(J,(t=>t.verifiedEmail)),K=j(J,(t=>t.name)),Q=j(J,(t=>t.phone)),Z=j(J,(t=>t.verifiedPhone)),tt=j(J,(t=>t.webauthn));j(J,(t=>t.password));const et=j(J,(t=>t.customAttributes)),it=r((e=>{const i=n(g,p({"widget-id":p.missingAttrValidator}))(e);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return t(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),st=r((i=>{var o,r,a;return a=class extends(n(h,f,w,m,it,V)(i)){constructor(){super(...arguments),o.add(this)}onWidgetRootReady(){return t(this,void 0,void 0,(function*(){}))}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this),yield Promise.all([this.actions.getMe(),e(this,o,"m",r).call(this)]),this.onWidgetRootReady()}))}},o=new WeakSet,r=function(){return t(this,void 0,void 0,(function*(){const t=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(t),this.contentRootElement.append(t.content.cloneNode(!0))}))},a})),ot=r((t=>class extends(n(b,d)(t)){syncFlowTheme(t){t.theme=this.theme,this.observeAttributes(["theme"],(()=>{t.theme=this.theme}))}})),rt=r((s=>{var o,r,l,d,c,u,f,g,p;return p=class extends(n(ot,b,V,h,st,v,y)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),f.set(this,a((t=>{this.avatar.image=t}))),g.set(this,a((t=>{this.avatar.displayName=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",u).call(this),e(this,o,"m",d).call(this),e(this,f,"f").call(this,Y(this.state)),e(this,g,"f").call(this,K(this.state)),this.subscribe(e(this,f,"f").bind(this),Y),this.subscribe(e(this,g,"f").bind(this),K)}))}},r=new WeakMap,l=new WeakMap,f=new WeakMap,g=new WeakMap,o=new WeakSet,d=function(){this.avatar.flowId&&(i(this,r,this.createModal({"data-id":"update-pic"}),"f"),i(this,l,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",c).bind(this),e(this,o,"m",c).call(this),this.syncFlowTheme(e(this,l,"f")))},c=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.avatar=new S((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},p})),nt=r((s=>{var o,r,l,d,c,u,f,g,p,w,m,b,y;return y=class extends(n(ot,V,h,st,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.set(this,a((t=>{this.emailUserAttr.value=t}))),b.set(this,a((t=>{this.emailUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,m,"f").call(this,_(this.state)),e(this,b,"f").call(this,z(this.state)),this.subscribe(e(this,m,"f").bind(this),_),this.subscribe(e(this,b,"f").bind(this),z)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,b=new WeakMap,o=new WeakSet,u=function(){this.emailUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-email"}),"f"),i(this,l,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.emailUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-email"}),"f"),i(this,c,new R((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(C({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.emailUserAttr=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.emailUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},y})),at=r((i=>{var s,o,r;return r=class extends(n(V,h,st,v)(i)){constructor(){super(...arguments),s.add(this)}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,s,"m",o).call(this)}))}},s=new WeakSet,o=function(){this.logout=new k((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>t(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},r})),lt=r((s=>{var o,r,l,d,c,u,f,g,p,w,m,b;return b=class extends(n(ot,V,h,st,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.set(this,a((t=>{this.nameUserAttr.value=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,m,"f").call(this,K(this.state)),this.subscribe(e(this,m,"f").bind(this),K)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,o=new WeakSet,u=function(){this.nameUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-name"}),"f"),i(this,l,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.nameUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-name"}),"f"),i(this,c,new R((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(C({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.nameUserAttr=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.nameUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},b})),dt=r((s=>{var o,r,l,d,c,u,f,g;return g=class extends(n(ot,V,h,st,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),f.set(this,a((t=>{this.passkeyUserAuthMethod.fulfilled=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",u).call(this),e(this,o,"m",d).call(this),e(this,f,"f").call(this,tt(this.state)),this.subscribe(e(this,f,"f").bind(this),tt)}))}},r=new WeakMap,l=new WeakMap,f=new WeakMap,o=new WeakSet,d=function(){this.passkeyUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"passkey"}),"f"),i(this,l,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",c).bind(this),e(this,o,"m",c).call(this),this.syncFlowTheme(e(this,l,"f")))},c=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.passkeyUserAuthMethod=new M((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},g})),ht=r((s=>{var o,r,a,l,d,c,u;return u=class extends(n(ot,V,h,st,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),a.set(this,void 0)}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",c).call(this),e(this,o,"m",l).call(this)}))}},r=new WeakMap,a=new WeakMap,o=new WeakSet,l=function(){this.passwordUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"password"}),"f"),i(this,a,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",d).bind(this),e(this,o,"m",d).call(this),this.syncFlowTheme(e(this,a,"f")))},d=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,a,"f").onSuccess((()=>{e(this,r,"f").close()}))},c=function(){this.passwordUserAuthMethod=new M((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},u})),ct=r((s=>{var o,r,l,d,c,u,f,g,p,w,m,b,y;return y=class extends(n(ot,V,h,st,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.set(this,a((t=>{this.phoneUserAttr.value=t}))),b.set(this,a((t=>{this.phoneUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,m,"f").call(this,Q(this.state)),e(this,b,"f").call(this,Z(this.state)),this.subscribe(e(this,m,"f").bind(this),Q),this.subscribe(e(this,b,"f").bind(this),Z)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,b=new WeakMap,o=new WeakSet,u=function(){this.phoneUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-phone"}),"f"),i(this,l,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.phoneUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-phone"}),"f"),i(this,c,new R((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(C({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.phoneUserAttr=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.phoneUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},y}));var ut;!function(t){t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t.SINGLE_SELECT="singleSelect",t.ARRAY="array",t.DATE="date"}(ut||(ut={}));const ft=r((i=>{var s,o,r,l,d,c,u,f,g,p,w;return o=class extends(n(ot,V,h,st,v)(i)){constructor(){super(...arguments),s.add(this),r.set(this,{}),l.set(this,{}),d.set(this,{}),c.set(this,{}),g.set(this,a((t=>{var i;const r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(r).forEach((i=>{const r=i.getAttribute("data-id").replace("customAttributes.",""),n=i.getAttribute("data-type")||ut.TEXT,a=t[r],l=new W(i,{logger:this.logger});l.value=o.getFormattedValue(n,a),e(this,s,"m",p).call(this,i,r,l),e(this,s,"m",w).call(this,i,r,l)}))})))}static getFormattedValue(t,e){return t===ut.DATE&&e?new Date(e).toLocaleString():t===ut.BOOLEAN&&void 0!==e?e?"True":"False":(e||"").toString()}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,g,"f").call(this,et(this.state)),this.subscribe(e(this,g,"f").bind(this),et)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,g=new WeakMap,s=new WeakSet,u=function(t){var i,s;null===(i=e(this,r,"f")[t])||void 0===i||i.setContent(C({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e(this,l,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,r,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},f=function(t){var i,s;null===(i=e(this,d,"f")[t])||void 0===i||i.setContent(C({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e(this,c,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,d,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},p=function(t,i,o){const n=t.getAttribute("edit-flow-id");n&&(e(this,r,"f")[n]=this.createModal({"data-id":`edit-${i}`}),e(this,l,"f")[n]=new R((()=>{var t,i;return null===(i=null===(t=e(this,r,"f")[n])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,r,"f")[n].afterClose=e(this,s,"m",u).bind(this,n),o.onEditClick((()=>{var t,i;null===(i=null===(t=e(this,r,"f"))||void 0===t?void 0:t[n])||void 0===i||i.open()})),e(this,s,"m",u).call(this,n),this.syncFlowTheme(e(this,l,"f")[n]))},w=function(t,i,o){const r=t.getAttribute("delete-flow-id");r&&(e(this,d,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e(this,c,"f")[r]=new R((()=>{var t,i;return null===(i=null===(t=e(this,d,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,d,"f")[r].afterClose=e(this,s,"m",f).bind(this,r),o.onDeleteClick((()=>{var t,i;null===(i=null===(t=e(this,d,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e(this,s,"m",f).call(this,r),this.syncFlowTheme(e(this,c,"f")[r]))},o})),vt=r((e=>class extends(n(U,b,G,ft,nt,rt,lt,ct,dt,ht,at)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),gt=n((e=>class extends(vt(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this);(customElements.get("descope-wc")||(yield import("@descope/web-component").then((t=>t.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.14"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",gt);export{gt as default};
5
+ import{__awaiter as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{createTemplate as s,kebabCase as o,createSingletonMixin as r,compose as n,withMemCache as a}from"@descope/sdk-helpers";import{projectIdMixin as l,observeAttributesMixin as d,loggerMixin as h,baseUrlMixin as c,createStateManagementMixin as u,initLifecycleMixin as f,modalMixin as v,staticResourcesMixin as g,createValidateAttributesMixin as p,descopeUiMixin as w,initElementMixin as m,themeMixin as b,baseStaticUrlMixin as y,debuggerMixin as U}from"@descope/sdk-mixins";import{FlowDriver as R,AvatarDriver as S,UserAttributeDriver as W,ButtonDriver as k,UserAuthMethodDriver as M}from"@descope/sdk-component-drivers";import{createAsyncThunk as I}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import A from"@descope/web-js-sdk";import{createSelector as j}from"reselect";import"@descope/web-component";const C=(t={})=>{const e=s("<descope-wc></descope-wc>");return Object.entries(t).forEach((([t,i])=>{e.content.querySelector("descope-wc").setAttribute(o(t),i)})),e};function x(t){return new URLSearchParams(window.location.search).get(t)}const F=t=>(...e)=>i=>{i.addCase(t.pending,((t,i)=>{e.forEach((({onPending:e})=>{null==e||e(t,i)}))})),i.addCase(t.fulfilled,((t,i)=>{e.forEach((({onFulfilled:e})=>{null==e||e(t,i)}))})),i.addCase(t.rejected,((t,i)=>{e.forEach((({onRejected:e})=>{null==e||e(t,i)}))}))},T=I("users/me",((t,{extra:{api:e}})=>e.user.me())),E=F(T)({onFulfilled:(t,e)=>{t.me.data=e.payload}},(O=t=>t.me,{onFulfilled:t=>{O(t).loading=!1},onPending:t=>{O(t).loading=!0,O(t).error=null},onRejected:(t,e)=>{O(t).loading=!1,O(t).error=e.error}}));var O;const q={action:T,reducer:E},P=I("users/logout",((t,{extra:{api:e}})=>e.user.logout())),L={action:P,reducer:F(P)({})},N={me:{loading:!1,error:null,data:{}}},D={me:"/v1/auth/me"},$=()=>t(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))})),B=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return $();const s=yield e.get(D.me);return yield(e=>t(void 0,void 0,void 0,(function*(){const t=yield e.text(),i=JSON.parse(t);if(!e.ok){const t=`${i.errorDescription}${i.errorMessage?`: ${i.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(i),e.text=()=>Promise.resolve(t)})))(s),s.json()}))}),H=r((s=>{var o,r,a,u;const f=n(l,d,h,c)(s);return u=class extends f{constructor(){super(...arguments),o.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return e(this,r,"f")||e(this,o,"m",a).call(this),e(this,r,"f")}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this),this.observeAttributes(["project-id","base-url"],(()=>{e(this,r,"f")&&e(this,o,"m",a).call(this)}))}))}},r=new WeakMap,o=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),i(this,r,((e,i,s)=>{const o=A(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.2.16"}}));return{user:Object.assign(Object.assign({},B({httpClient:o.httpClient,mock:i})),{logout:i?()=>t(void 0,void 0,void 0,(function*(){})):o.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},u})),V=r((t=>{const e=n(u({name:"widget",initialState:N,reducers:{},extraReducers:t=>{q.reducer(t),L.reducer(t)},asyncActions:{getMe:q.action,logout:L.action}}),f,h,H)(t);return class extends e{constructor(...t){super(...t),this.state=N,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),X="widget-flow",G=r((i=>{var s,o,r;return r=class extends(n(f,v,V,h)(i)){constructor(){super(...arguments),s.add(this)}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this);const r=x(X);r&&(!function(t){if(window.history.replaceState&&x(t)){const e=new URL(window.location.href),i=new URLSearchParams(e.search);i.delete(t),e.search=i.toString(),window.history.replaceState({},"",e.toString())}}(X),e(this,s,"m",o).call(this,r))}))}},s=new WeakSet,o=function(t){const e=this.createModal({"data-id":"redirect-flow"});e.setContent(C({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl}));new R((()=>{var t;return null===(t=e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{e.close(),this.actions.getMe()})),e.afterClose=()=>{e.remove()},e.open()},r})),J=t=>t.me.data,Y=j(J,(t=>t.picture)),_=j(J,(t=>t.email)),z=j(J,(t=>t.verifiedEmail)),K=j(J,(t=>t.name)),Q=j(J,(t=>t.phone)),Z=j(J,(t=>t.verifiedPhone)),tt=j(J,(t=>t.webauthn));j(J,(t=>t.password));const et=j(J,(t=>t.customAttributes)),it=r((e=>{const i=n(g,p({"widget-id":p.missingAttrValidator}))(e);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return t(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),st=r((i=>{var o,r,a;return a=class extends(n(h,f,w,m,it,V)(i)){constructor(){super(...arguments),o.add(this)}onWidgetRootReady(){return t(this,void 0,void 0,(function*(){}))}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this),yield Promise.all([this.actions.getMe(),e(this,o,"m",r).call(this)]),this.onWidgetRootReady()}))}},o=new WeakSet,r=function(){return t(this,void 0,void 0,(function*(){const t=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(t),this.contentRootElement.append(t.content.cloneNode(!0))}))},a})),ot=r((t=>class extends(n(b,d)(t)){syncFlowTheme(t){t.theme=this.theme,this.observeAttributes(["theme"],(()=>{t.theme=this.theme}))}})),rt=r((s=>{var o,r,l,d,c,u,f,g,p;return p=class extends(n(ot,b,V,h,st,v,y)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),f.set(this,a((t=>{this.avatar.image=t}))),g.set(this,a((t=>{this.avatar.displayName=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",u).call(this),e(this,o,"m",d).call(this),e(this,f,"f").call(this,Y(this.state)),e(this,g,"f").call(this,K(this.state)),this.subscribe(e(this,f,"f").bind(this),Y),this.subscribe(e(this,g,"f").bind(this),K)}))}},r=new WeakMap,l=new WeakMap,f=new WeakMap,g=new WeakMap,o=new WeakSet,d=function(){this.avatar.flowId&&(i(this,r,this.createModal({"data-id":"update-pic"}),"f"),i(this,l,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",c).bind(this),e(this,o,"m",c).call(this),this.syncFlowTheme(e(this,l,"f")))},c=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.avatar=new S((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},p})),nt=r((s=>{var o,r,l,d,c,u,f,g,p,w,m,b,y;return y=class extends(n(ot,V,h,st,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.set(this,a((t=>{this.emailUserAttr.value=t}))),b.set(this,a((t=>{this.emailUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,m,"f").call(this,_(this.state)),e(this,b,"f").call(this,z(this.state)),this.subscribe(e(this,m,"f").bind(this),_),this.subscribe(e(this,b,"f").bind(this),z)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,b=new WeakMap,o=new WeakSet,u=function(){this.emailUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-email"}),"f"),i(this,l,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.emailUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-email"}),"f"),i(this,c,new R((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(C({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.emailUserAttr=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.emailUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},y})),at=r((i=>{var s,o,r;return r=class extends(n(V,h,st,v)(i)){constructor(){super(...arguments),s.add(this)}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,s,"m",o).call(this)}))}},s=new WeakSet,o=function(){this.logout=new k((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>t(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},r})),lt=r((s=>{var o,r,l,d,c,u,f,g,p,w,m,b;return b=class extends(n(ot,V,h,st,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.set(this,a((t=>{this.nameUserAttr.value=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,m,"f").call(this,K(this.state)),this.subscribe(e(this,m,"f").bind(this),K)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,o=new WeakSet,u=function(){this.nameUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-name"}),"f"),i(this,l,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.nameUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-name"}),"f"),i(this,c,new R((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(C({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.nameUserAttr=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.nameUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},b})),dt=r((s=>{var o,r,l,d,c,u,f,g;return g=class extends(n(ot,V,h,st,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),f.set(this,a((t=>{this.passkeyUserAuthMethod.fulfilled=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",u).call(this),e(this,o,"m",d).call(this),e(this,f,"f").call(this,tt(this.state)),this.subscribe(e(this,f,"f").bind(this),tt)}))}},r=new WeakMap,l=new WeakMap,f=new WeakMap,o=new WeakSet,d=function(){this.passkeyUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"passkey"}),"f"),i(this,l,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",c).bind(this),e(this,o,"m",c).call(this),this.syncFlowTheme(e(this,l,"f")))},c=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.passkeyUserAuthMethod=new M((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},g})),ht=r((s=>{var o,r,a,l,d,c,u;return u=class extends(n(ot,V,h,st,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),a.set(this,void 0)}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",c).call(this),e(this,o,"m",l).call(this)}))}},r=new WeakMap,a=new WeakMap,o=new WeakSet,l=function(){this.passwordUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"password"}),"f"),i(this,a,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",d).bind(this),e(this,o,"m",d).call(this),this.syncFlowTheme(e(this,a,"f")))},d=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,a,"f").onSuccess((()=>{e(this,r,"f").close()}))},c=function(){this.passwordUserAuthMethod=new M((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},u})),ct=r((s=>{var o,r,l,d,c,u,f,g,p,w,m,b,y;return y=class extends(n(ot,V,h,st,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.set(this,a((t=>{this.phoneUserAttr.value=t}))),b.set(this,a((t=>{this.phoneUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,m,"f").call(this,Q(this.state)),e(this,b,"f").call(this,Z(this.state)),this.subscribe(e(this,m,"f").bind(this),Q),this.subscribe(e(this,b,"f").bind(this),Z)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,b=new WeakMap,o=new WeakSet,u=function(){this.phoneUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-phone"}),"f"),i(this,l,new R((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(C({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.phoneUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-phone"}),"f"),i(this,c,new R((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(C({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.phoneUserAttr=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.phoneUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},y}));var ut;!function(t){t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t.SINGLE_SELECT="singleSelect",t.ARRAY="array",t.DATE="date"}(ut||(ut={}));const ft=r((i=>{var s,o,r,l,d,c,u,f,g,p,w;return o=class extends(n(ot,V,h,st,v)(i)){constructor(){super(...arguments),s.add(this),r.set(this,{}),l.set(this,{}),d.set(this,{}),c.set(this,{}),g.set(this,a((t=>{var i;const r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(r).forEach((i=>{const r=i.getAttribute("data-id").replace("customAttributes.",""),n=i.getAttribute("data-type")||ut.TEXT,a=t[r],l=new W(i,{logger:this.logger});l.value=o.getFormattedValue(n,a),e(this,s,"m",p).call(this,i,r,l),e(this,s,"m",w).call(this,i,r,l)}))})))}static getFormattedValue(t,e){return t===ut.DATE&&e?new Date(e).toLocaleString():t===ut.BOOLEAN&&void 0!==e?e?"True":"False":(e||"").toString()}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,g,"f").call(this,et(this.state)),this.subscribe(e(this,g,"f").bind(this),et)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,g=new WeakMap,s=new WeakSet,u=function(t){var i,s;null===(i=e(this,r,"f")[t])||void 0===i||i.setContent(C({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e(this,l,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,r,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},f=function(t){var i,s;null===(i=e(this,d,"f")[t])||void 0===i||i.setContent(C({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e(this,c,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,d,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},p=function(t,i,o){const n=t.getAttribute("edit-flow-id");n&&(e(this,r,"f")[n]=this.createModal({"data-id":`edit-${i}`}),e(this,l,"f")[n]=new R((()=>{var t,i;return null===(i=null===(t=e(this,r,"f")[n])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,r,"f")[n].afterClose=e(this,s,"m",u).bind(this,n),o.onEditClick((()=>{var t,i;null===(i=null===(t=e(this,r,"f"))||void 0===t?void 0:t[n])||void 0===i||i.open()})),e(this,s,"m",u).call(this,n),this.syncFlowTheme(e(this,l,"f")[n]))},w=function(t,i,o){const r=t.getAttribute("delete-flow-id");r&&(e(this,d,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e(this,c,"f")[r]=new R((()=>{var t,i;return null===(i=null===(t=e(this,d,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,d,"f")[r].afterClose=e(this,s,"m",f).bind(this,r),o.onDeleteClick((()=>{var t,i;null===(i=null===(t=e(this,d,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e(this,s,"m",f).call(this,r),this.syncFlowTheme(e(this,c,"f")[r]))},o})),vt=r((e=>class extends(n(U,b,G,ft,nt,rt,lt,ct,dt,ht,at)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),gt=n((e=>class extends(vt(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this);(customElements.get("descope-wc")||(yield import("@descope/web-component").then((t=>t.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.16"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",gt);export{gt as default};
6
6
  //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@ declare const UserProfileWidget: {
18
18
  logout: _descope_sdk_component_drivers.ButtonDriver;
19
19
  "__#10@#initLogout"(): void;
20
20
  onWidgetRootReady: (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>);
21
- "__#24322@#ModalDriverWrapper": new (refOrRefFn: Element | (() => HTMLElement), config: {
21
+ "__#24344@#ModalDriverWrapper": new (refOrRefFn: Element | (() => HTMLElement), config: {
22
22
  logger: {
23
23
  error(...data: any[]): void;
24
24
  warn(...data: any[]): void;
@@ -27,7 +27,7 @@ declare const UserProfileWidget: {
27
27
  };
28
28
  }) => {
29
29
  setContent(template: HTMLTemplateElement): void;
30
- "__#24321@#private": any;
30
+ "__#24343@#private": any;
31
31
  beforeOpen: () => void | Promise<void>;
32
32
  afterClose: () => void;
33
33
  nodeName: string;
@@ -35,7 +35,7 @@ declare const UserProfileWidget: {
35
35
  open(): Promise<void>;
36
36
  reset(): void;
37
37
  remove(): void;
38
- "__#24319@#private": any;
38
+ "__#24341@#private": any;
39
39
  logger: {
40
40
  error(...data: any[]): void;
41
41
  warn(...data: any[]): void;
@@ -46,21 +46,21 @@ declare const UserProfileWidget: {
46
46
  readonly ele: Element;
47
47
  };
48
48
  createModal(config?: Record<string, string>): _descope_sdk_component_drivers.ModalDriver;
49
- "__#24318@#errorCbsSym": symbol;
50
- "__#24318@#loadCbsSym": symbol;
51
- "__#24318@#getComponentsVersion": (() => Promise<any>) & (() => Promise<any>) & (() => Promise<any>);
52
- "__#24318@#exposeAlternateEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
53
- "__#24318@#handleFallbackScript": ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[], elemId: string, scriptUrl: string) => Promise<void>) & ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[], elemId: string, scriptUrl: string) => Promise<void>) & ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[], elemId: string, scriptUrl: string) => Promise<void>);
54
- "__#24318@#registerEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
55
- "__#24318@#getDescopeUiLoadingScript": (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>);
56
- "__#24318@#descopeUi": Promise<any>;
49
+ "__#24340@#errorCbsSym": symbol;
50
+ "__#24340@#loadCbsSym": symbol;
51
+ "__#24340@#getComponentsVersion": (() => Promise<any>) & (() => Promise<any>) & (() => Promise<any>);
52
+ "__#24340@#exposeAlternateEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
53
+ "__#24340@#handleFallbackScript": ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[], elemId: string, scriptUrl: string) => Promise<void>) & ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[], elemId: string, scriptUrl: string) => Promise<void>) & ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[], elemId: string, scriptUrl: string) => Promise<void>);
54
+ "__#24340@#registerEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
55
+ "__#24340@#getDescopeUiLoadingScript": (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>);
56
+ "__#24340@#descopeUi": Promise<any>;
57
57
  readonly descopeUi: Promise<any>;
58
- "__#24318@#loadDescopeUiComponent": ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>);
58
+ "__#24340@#loadDescopeUiComponent": ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>);
59
59
  loadDescopeUiComponents: ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>) & ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>) & ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>);
60
- "__#24318@#getDescopeUi": (() => Promise<unknown>) & (() => Promise<unknown>) & (() => Promise<unknown>);
60
+ "__#24340@#getDescopeUi": (() => Promise<unknown>) & (() => Promise<unknown>) & (() => Promise<unknown>);
61
61
  readonly config: any;
62
- "__#24315@#_configResource": any;
63
- "__#24315@#fetchConfig": (() => Promise<{
62
+ "__#24337@#_configResource": any;
63
+ "__#24337@#fetchConfig": (() => Promise<{
64
64
  projectConfig: _descope_sdk_mixins.ProjectConfiguration;
65
65
  executionContext: {
66
66
  geo: any;
@@ -81,9 +81,9 @@ declare const UserProfileWidget: {
81
81
  geo: any;
82
82
  };
83
83
  }>);
84
- "__#24314@#lastBaseUrl"?: string;
85
- "__#24314@#workingBaseUrl"?: string;
86
- "__#24314@#getResourceUrls": ((filename: string) => (URL & {
84
+ "__#24336@#lastBaseUrl"?: string;
85
+ "__#24336@#workingBaseUrl"?: string;
86
+ "__#24336@#getResourceUrls": ((filename: string) => (URL & {
87
87
  baseUrl: string;
88
88
  }) | (URL & {
89
89
  baseUrl: string;
@@ -1084,13 +1084,13 @@ declare const UserProfileWidget: {
1084
1084
  blur: (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void);
1085
1085
  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);
1086
1086
  readonly projectId: string;
1087
- "__#24313@#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);
1088
- "__#24312@#observeMappings": {};
1087
+ "__#24335@#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);
1088
+ "__#24334@#observeMappings": {};
1089
1089
  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);
1090
1090
  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);
1091
- "__#24311@#isInit": boolean;
1092
- "__#24310@#logger": _descope_sdk_mixins.Logger;
1093
- "__#24310@#wrapLogger": ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger);
1091
+ "__#24333@#isInit": boolean;
1092
+ "__#24332@#logger": _descope_sdk_mixins.Logger;
1093
+ "__#24332@#wrapLogger": ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger);
1094
1094
  logger: _descope_sdk_mixins.Logger;
1095
1095
  onLogEvent: ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", args: any[]) => void);
1096
1096
  contentRootElement: HTMLElement;
@@ -1717,22 +1717,22 @@ declare const UserProfileWidget: {
1717
1717
  "__#13@#initModalContent"(): void;
1718
1718
  "__#13@#initPhoneUserAttr"(): void;
1719
1719
  syncFlowTheme: ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void);
1720
- "__#24324@#globalStyleTag": HTMLStyleElement;
1720
+ "__#24346@#globalStyleTag": HTMLStyleElement;
1721
1721
  readonly theme: _descope_sdk_mixins.ThemeOptions;
1722
1722
  readonly styleId: string;
1723
- "__#24324@#_themeResource": Promise<void | Record<string, any>>;
1724
- "__#24324@#fetchTheme"(): Promise<Record<string, any>>;
1725
- readonly "__#24324@#themeResource": Promise<void | Record<string, any>>;
1726
- "__#24324@#loadGlobalStyle"(): Promise<void>;
1727
- "__#24324@#loadComponentsStyle"(): Promise<void>;
1728
- "__#24324@#getFontsConfig"(): Promise<Record<string, {
1723
+ "__#24346@#_themeResource": Promise<void | Record<string, any>>;
1724
+ "__#24346@#fetchTheme"(): Promise<Record<string, any>>;
1725
+ readonly "__#24346@#themeResource": Promise<void | Record<string, any>>;
1726
+ "__#24346@#loadGlobalStyle"(): Promise<void>;
1727
+ "__#24346@#loadComponentsStyle"(): Promise<void>;
1728
+ "__#24346@#getFontsConfig"(): Promise<Record<string, {
1729
1729
  url?: string;
1730
1730
  }>>;
1731
- "__#24324@#loadFonts"(): Promise<void>;
1732
- "__#24324@#applyTheme"(): Promise<void>;
1733
- "__#24324@#onThemeChange": () => void;
1734
- "__#24324@#loadTheme"(): void;
1735
- "__#24324@#toggleOsThemeChangeListener": (listen: boolean) => void;
1731
+ "__#24346@#loadFonts"(): Promise<void>;
1732
+ "__#24346@#applyTheme"(): Promise<void>;
1733
+ "__#24346@#onThemeChange": () => void;
1734
+ "__#24346@#loadTheme"(): void;
1735
+ "__#24346@#toggleOsThemeChangeListener": (listen: boolean) => void;
1736
1736
  passkeyUserAuthMethod: _descope_sdk_component_drivers.UserAuthMethodDriver;
1737
1737
  "__#12@#modal": _descope_sdk_component_drivers.ModalDriver;
1738
1738
  "__#12@#flow": _descope_sdk_component_drivers.FlowDriver;
@@ -1793,7 +1793,7 @@ declare const UserProfileWidget: {
1793
1793
  "__#15@#initEditFlow"(nodeEle: Element, customAttrName: string, compInstance: _descope_sdk_component_drivers.UserAttributeDriver): void;
1794
1794
  "__#15@#initDeleteFlow"(nodeEle: Element, customAttrName: string, compInstance: _descope_sdk_component_drivers.UserAttributeDriver): void;
1795
1795
  "__#6@#createFlowRedirectModal"(widgetFlow: string): void;
1796
- "__#24317@#debuggerEle": HTMLElement & {
1796
+ "__#24339@#debuggerEle": HTMLElement & {
1797
1797
  updateData: (data: {
1798
1798
  title: string;
1799
1799
  description?: string;
@@ -1802,11 +1802,11 @@ declare const UserProfileWidget: {
1802
1802
  description?: string;
1803
1803
  }[]) => void;
1804
1804
  };
1805
- "__#24317@#disableDebugger"(): void;
1806
- "__#24317@#enableDebugger"(): Promise<void>;
1805
+ "__#24339@#disableDebugger"(): void;
1806
+ "__#24339@#enableDebugger"(): Promise<void>;
1807
1807
  readonly debug: boolean;
1808
- "__#24317@#handleDebugMode"(): void;
1809
- "__#24317@#updateDebuggerMessages"(title: string, description: string): void;
1808
+ "__#24339@#handleDebugMode"(): void;
1809
+ "__#24339@#updateDebuggerMessages"(title: string, description: string): void;
1810
1810
  };
1811
1811
  getFormattedValue(type: string, val: any): any;
1812
1812
  };