@descope/user-profile-widget 0.6.4 → 0.6.5
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 +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/index.d.ts +37 -37
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* @descope/user-profile-widget v0.6.
|
|
3
|
+
* @descope/user-profile-widget v0.6.5
|
|
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())),f={action:_,reducer:n(_)({})},g={me:{loading:!1,error:null,data:{}}},m={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})}))})),p=({httpClient:t,mock:i})=>({me:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(i)return w();const s=yield t.get(m.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()}))}),F=t.createSingletonMixin((s=>{var a,r,o,d;const n=t.compose(i.projectIdMixin,i.observeAttributesMixin,i.loggerMixin,i.baseUrlMixin,i.cookieConfigMixin)(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.6.4"}}));return{user:Object.assign(Object.assign({},p({httpClient:a.httpClient,mock:i})),{logout:i?()=>e.__awaiter(void 0,void 0,void 0,(function*(){})):a.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},d})),P=t.createSingletonMixin((e=>{const s=t.compose(i.createStateManagementMixin({name:"widget",initialState:g,reducers:{},extraReducers:e=>{u.reducer(e),f.reducer(e)},asyncActions:{getMe:u.action,logout:f.action}}),i.initLifecycleMixin,i.loggerMixin,F)(e);return class extends s{constructor(...e){super(...e),this.state=g,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.cookieConfigMixin,i.loggerMixin,i.themeMixin)(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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme}));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,U=r.createSelector(M,(e=>e.picture)),S=r.createSelector(M,(e=>e.email)),C=r.createSelector(M,(e=>e.verifiedEmail)),k=r.createSelector(M,(e=>e.name)),y=r.createSelector(M,(e=>e.phone)),x=r.createSelector(M,(e=>e.verifiedPhone)),R=r.createSelector(M,(e=>e.webauthn));r.createSelector(M,(e=>e.password));const W=r.createSelector(M,(e=>e.TOTP)),A=r.createSelector(M,(e=>e.customAttributes)),I=r.createSelector(M,(e=>({givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}))),j=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}))}}})),N=t.createSingletonMixin((s=>{var a,l,r;return r=class extends(t.compose(i.loggerMixin,i.initLifecycleMixin,i.descopeUiMixin,i.initElementMixin,j,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})),T=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}))}})),D=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_;return _=class extends(t.compose(T,i.themeMixin,P,i.loggerMixin,i.cookieConfigMixin,N,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.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,U(this.state)),e.__classPrivateFieldGet(this,u,"f").call(this,k(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),U),this.subscribe(e.__classPrivateFieldGet(this,u,"f").bind(this),k)}))}},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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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,_,f,g,m,w;return w=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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),g.set(this,t.withMemCache((e=>{this.emailUserAttr.value=e}))),m.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",f).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,g,"f").call(this,S(this.state)),e.__classPrivateFieldGet(this,m,"f").call(this,C(this.state)),this.subscribe(e.__classPrivateFieldGet(this,g,"f").bind(this),S),this.subscribe(e.__classPrivateFieldGet(this,m,"f").bind(this),C)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,g=new WeakMap,m=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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},f=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})),E=t.createSingletonMixin((a=>{var l,r,o;return o=class extends(t.compose(P,i.loggerMixin,N,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})),O=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,f,g,m;return m=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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),g.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",f).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,g,"f").call(this,k(this.state)),this.subscribe(e.__classPrivateFieldGet(this,g,"f").bind(this),k)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,g=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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},f=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()}))},m})),L=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,f,g,m;return m=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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),g.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",f).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,g,"f").call(this,R(this.state)),this.subscribe(e.__classPrivateFieldGet(this,g,"f").bind(this),R)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,g=new WeakMap,l=new WeakSet,h=function(){this.passkeyUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"add-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",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.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.passkeyUserAuthMethod.fulfilledFlowId&&(e.__classPrivateFieldSet(this,n,this.createModal({"data-id":"remove-passkey"}),"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.passkeyUserAuthMethod.fulfilledFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},f=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.onUnfulfilledButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.passkeyUserAuthMethod.onFulfilledButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},m})),$=t.createSingletonMixin((a=>{var l,r,d,n,c,h;return h=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0)}initPasswordAuthMethod(){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.onUnfulfilledButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))}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),this.initPasswordAuthMethod(),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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close()}))},h})),B=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,f,g,m,w;return w=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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),g.set(this,t.withMemCache((e=>{this.phoneUserAttr.value=e}))),m.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",f).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,g,"f").call(this,y(this.state)),e.__classPrivateFieldGet(this,m,"f").call(this,x(this.state)),this.subscribe(e.__classPrivateFieldGet(this,g,"f").bind(this),y),this.subscribe(e.__classPrivateFieldGet(this,m,"f").bind(this),x)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,g=new WeakMap,m=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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},f=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})),V=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u;return u=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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.totpUserAuthMethod.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.totpUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"totp"}),"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.totpUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},h=function(){this.totpUserAuthMethod=new s.UserAuthMethodDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="totp"]')}),{logger:this.logger}),this.totpUserAuthMethod.onUnfulfilledButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},u})),H=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,f,g;return g=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,{}),d.set(this,{}),n.set(this,{}),c.set(this,{}),u.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^="builtin."]');Array.from(a).forEach((i=>{const a=i.getAttribute("data-id").replace("builtin.",""),r=t[a],o=new s.UserAttributeDriver(i,{logger:this.logger});o.value=(r||"").toString(),e.__classPrivateFieldGet(this,l,"m",_).call(this,i,a,o),e.__classPrivateFieldGet(this,l,"m",f).call(this,i,a,o)}))})))}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,u,"f").call(this,I(this.state)),this.subscribe(e.__classPrivateFieldGet(this,u,"f").bind(this),I)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,u=new WeakMap,l=new WeakSet,h=function(t){var i,s;null===(i=e.__classPrivateFieldGet(this,r,"f")[t])||void 0===i||i.setContent(o({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=e.__classPrivateFieldGet(this,d,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,r,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},v=function(t){var i,s;null===(i=e.__classPrivateFieldGet(this,n,"f")[t])||void 0===i||i.setContent(o({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=e.__classPrivateFieldGet(this,c,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,n,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},_=function(t,i,a){const o=t.getAttribute("edit-flow-id");o&&(e.__classPrivateFieldGet(this,r,"f")[o]=this.createModal({"data-id":`edit-${i}`}),e.__classPrivateFieldGet(this,d,"f")[o]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,r,"f")[o])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,r,"f")[o].afterClose=e.__classPrivateFieldGet(this,l,"m",h).bind(this,o),a.onEditClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t?void 0:t[o])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,l,"m",h).call(this,o),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")[o]))},f=function(t,i,a){const r=t.getAttribute("delete-flow-id");r&&(e.__classPrivateFieldGet(this,n,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e.__classPrivateFieldGet(this,c,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,n,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,n,"f")[r].afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this,r),a.onDeleteClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,n,"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,c,"f")[r]))},g}));var X;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(X||(X={}));const J=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,f,g;return r=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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")||X.TEXT,d=t[a],n=new s.UserAttributeDriver(i,{logger:this.logger});n.value=r.getFormattedValue(o,d),e.__classPrivateFieldGet(this,l,"m",f).call(this,i,a,n),e.__classPrivateFieldGet(this,l,"m",g).call(this,i,a,n)}))})))}static getFormattedValue(e,t){return e===X.DATE&&t?new Date(t).toLocaleString():e===X.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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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()}))},f=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]))},g=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})),Y=t.createSingletonMixin((s=>class extends(t.compose(i.debuggerMixin,i.themeMixin,G,J,q,D,O,B,L,$,V,H,E)(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)}))}})),z=t.compose((t=>class extends(Y(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.6.4"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",z),module.exports=z;
|
|
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())),f={action:_,reducer:n(_)({})},g={me:{loading:!1,error:null,data:{}}},m={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})}))})),p=({httpClient:t,mock:i})=>({me:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(i)return w();const s=yield t.get(m.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()}))}),F=t.createSingletonMixin((s=>{var a,r,o,d;const n=t.compose(i.projectIdMixin,i.observeAttributesMixin,i.loggerMixin,i.baseUrlMixin,i.cookieConfigMixin)(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.6.5"}}));return{user:Object.assign(Object.assign({},p({httpClient:a.httpClient,mock:i})),{logout:i?()=>e.__awaiter(void 0,void 0,void 0,(function*(){})):a.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},d})),P=t.createSingletonMixin((e=>{const s=t.compose(i.createStateManagementMixin({name:"widget",initialState:g,reducers:{},extraReducers:e=>{u.reducer(e),f.reducer(e)},asyncActions:{getMe:u.action,logout:f.action}}),i.initLifecycleMixin,i.loggerMixin,F)(e);return class extends s{constructor(...e){super(...e),this.state=g,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.cookieConfigMixin,i.loggerMixin,i.themeMixin)(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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme}));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,U=r.createSelector(M,(e=>e.picture)),S=r.createSelector(M,(e=>e.email)),C=r.createSelector(M,(e=>e.verifiedEmail)),k=r.createSelector(M,(e=>e.name)),y=r.createSelector(M,(e=>e.phone)),x=r.createSelector(M,(e=>e.verifiedPhone)),R=r.createSelector(M,(e=>e.webauthn));r.createSelector(M,(e=>e.password));const W=r.createSelector(M,(e=>e.TOTP)),A=r.createSelector(M,(e=>e.customAttributes)),I=r.createSelector(M,(e=>({givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}))),j=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}))}}})),N=t.createSingletonMixin((s=>{var a,l,r;return r=class extends(t.compose(i.loggerMixin,i.initLifecycleMixin,i.descopeUiMixin,i.initElementMixin,j,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})),T=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}))}})),D=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_;return _=class extends(t.compose(T,i.themeMixin,P,i.loggerMixin,i.cookieConfigMixin,N,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.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,U(this.state)),e.__classPrivateFieldGet(this,u,"f").call(this,k(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),U),this.subscribe(e.__classPrivateFieldGet(this,u,"f").bind(this),k)}))}},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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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,_,f,g,m,w;return w=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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),g.set(this,t.withMemCache((e=>{this.emailUserAttr.value=e}))),m.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",f).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,g,"f").call(this,S(this.state)),e.__classPrivateFieldGet(this,m,"f").call(this,C(this.state)),this.subscribe(e.__classPrivateFieldGet(this,g,"f").bind(this),S),this.subscribe(e.__classPrivateFieldGet(this,m,"f").bind(this),C)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,g=new WeakMap,m=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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},f=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})),E=t.createSingletonMixin((a=>{var l,r,o;return o=class extends(t.compose(P,i.loggerMixin,N,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})),O=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,f,g,m;return m=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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),g.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",f).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,g,"f").call(this,k(this.state)),this.subscribe(e.__classPrivateFieldGet(this,g,"f").bind(this),k)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,g=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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},f=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()}))},m})),L=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,f,g,m;return m=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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),g.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",f).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,g,"f").call(this,R(this.state)),this.subscribe(e.__classPrivateFieldGet(this,g,"f").bind(this),R)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,g=new WeakMap,l=new WeakSet,h=function(){this.passkeyUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"add-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",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.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.passkeyUserAuthMethod.fulfilledFlowId&&(e.__classPrivateFieldSet(this,n,this.createModal({"data-id":"remove-passkey"}),"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.passkeyUserAuthMethod.fulfilledFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},f=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.onUnfulfilledButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.passkeyUserAuthMethod.onFulfilledButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},m})),$=t.createSingletonMixin((a=>{var l,r,d,n,c,h;return h=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0)}initPasswordAuthMethod(){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.onUnfulfilledButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))}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),this.initPasswordAuthMethod(),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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close()}))},h})),B=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,f,g,m,w;return w=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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),g.set(this,t.withMemCache((e=>{this.phoneUserAttr.value=e}))),m.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",f).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,g,"f").call(this,y(this.state)),e.__classPrivateFieldGet(this,m,"f").call(this,x(this.state)),this.subscribe(e.__classPrivateFieldGet(this,g,"f").bind(this),y),this.subscribe(e.__classPrivateFieldGet(this,m,"f").bind(this),x)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,g=new WeakMap,m=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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},f=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})),V=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u;return u=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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.totpUserAuthMethod.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.totpUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"totp"}),"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.totpUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},h=function(){this.totpUserAuthMethod=new s.UserAuthMethodDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="totp"]')}),{logger:this.logger}),this.totpUserAuthMethod.onUnfulfilledButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},u})),H=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,f,g;return g=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,{}),d.set(this,{}),n.set(this,{}),c.set(this,{}),u.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^="builtin."]');Array.from(a).forEach((i=>{const a=i.getAttribute("data-id").replace("builtin.",""),r=t[a],o=new s.UserAttributeDriver(i,{logger:this.logger});o.value=(r||"").toString(),e.__classPrivateFieldGet(this,l,"m",_).call(this,i,a,o),e.__classPrivateFieldGet(this,l,"m",f).call(this,i,a,o)}))})))}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,u,"f").call(this,I(this.state)),this.subscribe(e.__classPrivateFieldGet(this,u,"f").bind(this),I)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,u=new WeakMap,l=new WeakSet,h=function(t){var i,s;null===(i=e.__classPrivateFieldGet(this,r,"f")[t])||void 0===i||i.setContent(o({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=e.__classPrivateFieldGet(this,d,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,r,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},v=function(t){var i,s;null===(i=e.__classPrivateFieldGet(this,n,"f")[t])||void 0===i||i.setContent(o({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=e.__classPrivateFieldGet(this,c,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,n,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},_=function(t,i,a){const o=t.getAttribute("edit-flow-id");o&&(e.__classPrivateFieldGet(this,r,"f")[o]=this.createModal({"data-id":`edit-${i}`}),e.__classPrivateFieldGet(this,d,"f")[o]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,r,"f")[o])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,r,"f")[o].afterClose=e.__classPrivateFieldGet(this,l,"m",h).bind(this,o),a.onEditClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t?void 0:t[o])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,l,"m",h).call(this,o),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")[o]))},f=function(t,i,a){const r=t.getAttribute("delete-flow-id");r&&(e.__classPrivateFieldGet(this,n,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e.__classPrivateFieldGet(this,c,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,n,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,n,"f")[r].afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this,r),a.onDeleteClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,n,"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,c,"f")[r]))},g}));var X;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(X||(X={}));const J=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,f,g;return r=class extends(t.compose(T,P,i.loggerMixin,N,i.cookieConfigMixin,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")||X.TEXT,d=t[a],n=new s.UserAttributeDriver(i,{logger:this.logger});n.value=r.getFormattedValue(o,d),e.__classPrivateFieldGet(this,l,"m",f).call(this,i,a,n),e.__classPrivateFieldGet(this,l,"m",g).call(this,i,a,n)}))})))}static getFormattedValue(e,t){return e===X.DATE&&t?new Date(t).toLocaleString():e===X.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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),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()}))},f=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]))},g=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})),Y=t.createSingletonMixin((s=>class extends(t.compose(i.debuggerMixin,i.themeMixin,G,J,q,D,O,B,L,$,V,H,E)(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)}))}})),z=t.compose((t=>class extends(Y(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.6.5"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",z),module.exports=z;
|
|
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.6.
|
|
3
|
+
* @descope/user-profile-widget v0.6.5
|
|
4
4
|
*/
|
|
5
|
-
import{__awaiter as e,__classPrivateFieldGet as t,__classPrivateFieldSet as i}from"tslib";import{createTemplate as s,kebabCase as o,createSingletonMixin as r,compose as a,withMemCache as h}from"@descope/sdk-helpers";import{projectIdMixin as l,observeAttributesMixin as n,loggerMixin as d,baseUrlMixin as c,cookieConfigMixin as u,createStateManagementMixin as f,initLifecycleMixin as v,modalMixin as g,themeMixin as m,staticResourcesMixin as p,createValidateAttributesMixin as w,descopeUiMixin as b,initElementMixin as U,debuggerMixin as y}from"@descope/sdk-mixins";import{FlowDriver as k,AvatarDriver as C,UserAttributeDriver as R,ButtonDriver as S,UserAuthMethodDriver as M}from"@descope/sdk-component-drivers";import{createAsyncThunk as W}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import I from"@descope/web-js-sdk";import{createSelector as A}from"reselect";import"@descope/web-component";const j=(e={})=>{const t=s("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,i])=>{t.content.querySelector("descope-wc").setAttribute(o(e),i)})),t};function N(e){return new URLSearchParams(window.location.search).get(e)}const F=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)}))}))},x=W("users/me",((e,{extra:{api:t}})=>t.user.me())),T=F(x)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(E=e=>e.me,{onFulfilled:e=>{E(e).loading=!1},onPending:e=>{E(e).loading=!0,E(e).error=null},onRejected:(e,t)=>{E(e).loading=!1,E(e).error=t.error}}));var E;const O={action:x,reducer:T},q=W("users/logout",((e,{extra:{api:t}})=>t.user.logout())),P={action:q,reducer:F(q)({})},L={me:{loading:!1,error:null,data:{}}},D={me:"/v1/auth/me"},$=()=>e(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})}))})),B=({httpClient:t,mock:i})=>({me:()=>e(void 0,void 0,void 0,(function*(){if(i)return $();const s=yield t.get(D.me);return yield(t=>e(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()}))}),H=r((s=>{var o,r,h,f;const v=a(l,n,d,c,u)(s);return f=class extends v{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 t(this,r,"f")||t(this,o,"m",h).call(this),t(this,r,"f")}init(){const i=Object.create(null,{init:{get:()=>super.init}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.init)||void 0===e?void 0:e.call(this),this.observeAttributes(["project-id","base-url"],(()=>{t(this,r,"f")&&t(this,o,"m",h).call(this)}))}))}},r=new WeakMap,o=new WeakSet,h=function(){this.logger.debug("creating an sdk instance"),i(this,r,((t,i,s)=>{const o=I(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.6.4"}}));return{user:Object.assign(Object.assign({},B({httpClient:o.httpClient,mock:i})),{logout:i?()=>e(void 0,void 0,void 0,(function*(){})):o.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},f})),V=r((e=>{const t=a(f({name:"widget",initialState:L,reducers:{},extraReducers:e=>{O.reducer(e),P.reducer(e)},asyncActions:{getMe:O.action,logout:P.action}}),v,d,H)(e);return class extends t{constructor(...e){super(...e),this.state=L,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),X="widget-flow",G=r((i=>{var s,o,r;return r=class extends(a(v,g,V,u,d,m)(i)){constructor(){super(...arguments),s.add(this)}init(){const i=Object.create(null,{init:{get:()=>super.init}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.init)||void 0===e?void 0:e.call(this);const r=N(X);r&&(!function(e){if(window.history.replaceState&&N(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())}}(X),t(this,s,"m",o).call(this,r))}))}},s=new WeakSet,o=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(j({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme}));new k((()=>{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()},r})),J=e=>e.me.data,Y=A(J,(e=>e.picture)),_=A(J,(e=>e.email)),z=A(J,(e=>e.verifiedEmail)),K=A(J,(e=>e.name)),Q=A(J,(e=>e.phone)),Z=A(J,(e=>e.verifiedPhone)),ee=A(J,(e=>e.webauthn));A(J,(e=>e.password));const te=A(J,(e=>e.TOTP)),ie=A(J,(e=>e.customAttributes)),se=A(J,(e=>({givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}))),oe=r((t=>{const i=a(p,w({"widget-id":w.missingAttrValidator}))(t);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(t){return e(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${t}`,"text")).body}))}}})),re=r((i=>{var o,r,h;return h=class extends(a(d,v,b,U,oe,V)(i)){constructor(){super(...arguments),o.add(this)}onWidgetRootReady(){return e(this,void 0,void 0,(function*(){}))}init(){const i=Object.create(null,{init:{get:()=>super.init}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.init)||void 0===e?void 0:e.call(this),yield Promise.all([this.actions.getMe(),t(this,o,"m",r).call(this)]),this.onWidgetRootReady()}))}},o=new WeakSet,r=function(){return e(this,void 0,void 0,(function*(){const e=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},h})),ae=r((e=>class extends(a(m,n)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),he=r((s=>{var o,r,l,n,c,f,v,p,w;return w=class extends(a(ae,m,V,d,u,re,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),v.set(this,h((e=>{this.avatar.image=e}))),p.set(this,h((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",f).call(this),t(this,o,"m",n).call(this),t(this,v,"f").call(this,Y(this.state)),t(this,p,"f").call(this,K(this.state)),this.subscribe(t(this,v,"f").bind(this),Y),this.subscribe(t(this,p,"f").bind(this),K)}))}},r=new WeakMap,l=new WeakMap,v=new WeakMap,p=new WeakMap,o=new WeakSet,n=function(){this.avatar.flowId&&(i(this,r,this.createModal({"data-id":"update-pic"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",c).bind(this),t(this,o,"m",c).call(this),this.syncFlowTheme(t(this,l,"f")))},c=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.avatar=new C((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var e;null===(e=t(this,r,"f"))||void 0===e||e.open()}))},w})),le=r((s=>{var o,r,l,n,c,f,v,m,p,w,b,U,y;return y=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),n.set(this,void 0),c.set(this,void 0),b.set(this,h((e=>{this.emailUserAttr.value=e}))),U.set(this,h((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",w).call(this),t(this,o,"m",f).call(this),t(this,o,"m",m).call(this),t(this,b,"f").call(this,_(this.state)),t(this,U,"f").call(this,z(this.state)),this.subscribe(t(this,b,"f").bind(this),_),this.subscribe(t(this,U,"f").bind(this),z)}))}},r=new WeakMap,l=new WeakMap,n=new WeakMap,c=new WeakMap,b=new WeakMap,U=new WeakMap,o=new WeakSet,f=function(){this.emailUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-email"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",v).bind(this),t(this,o,"m",v).call(this),this.syncFlowTheme(t(this,l,"f")))},v=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},m=function(){this.emailUserAttr.deleteFlowId&&(i(this,n,this.createModal({"data-id":"delete-email"}),"f"),i(this,c,new k((()=>{var e;return null===(e=t(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,n,"f").afterClose=t(this,o,"m",p).bind(this),t(this,o,"m",p).call(this),this.syncFlowTheme(t(this,c,"f")))},p=function(){t(this,n,"f").setContent(j({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,c,"f").onSuccess((()=>{t(this,n,"f").close(),this.actions.getMe()}))},w=function(){this.emailUserAttr=new R((()=>{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 e;null===(e=t(this,r,"f"))||void 0===e||e.open()})),this.emailUserAttr.onDeleteClick((()=>{var e;null===(e=t(this,n,"f"))||void 0===e||e.open()}))},y})),ne=r((i=>{var s,o,r;return r=class extends(a(V,d,re,g)(i)){constructor(){super(...arguments),s.add(this)}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,s,"m",o).call(this)}))}},s=new WeakSet,o=function(){this.logout=new S((()=>{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(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},r})),de=r((s=>{var o,r,l,n,c,f,v,m,p,w,b,U;return U=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),n.set(this,void 0),c.set(this,void 0),b.set(this,h((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",w).call(this),t(this,o,"m",f).call(this),t(this,o,"m",m).call(this),t(this,b,"f").call(this,K(this.state)),this.subscribe(t(this,b,"f").bind(this),K)}))}},r=new WeakMap,l=new WeakMap,n=new WeakMap,c=new WeakMap,b=new WeakMap,o=new WeakSet,f=function(){this.nameUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-name"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",v).bind(this),t(this,o,"m",v).call(this),this.syncFlowTheme(t(this,l,"f")))},v=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},m=function(){this.nameUserAttr.deleteFlowId&&(i(this,n,this.createModal({"data-id":"delete-name"}),"f"),i(this,c,new k((()=>{var e;return null===(e=t(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,n,"f").afterClose=t(this,o,"m",p).bind(this),t(this,o,"m",p).call(this),this.syncFlowTheme(t(this,c,"f")))},p=function(){t(this,n,"f").setContent(j({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,c,"f").onSuccess((()=>{t(this,n,"f").close(),this.actions.getMe()}))},w=function(){this.nameUserAttr=new R((()=>{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 e;null===(e=t(this,r,"f"))||void 0===e||e.open()})),this.nameUserAttr.onDeleteClick((()=>{var e;null===(e=t(this,n,"f"))||void 0===e||e.open()}))},U})),ce=r((s=>{var o,r,l,n,c,f,v,m,p,w,b,U;return U=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),n.set(this,void 0),c.set(this,void 0),b.set(this,h((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",w).call(this),t(this,o,"m",f).call(this),t(this,o,"m",m).call(this),t(this,b,"f").call(this,ee(this.state)),this.subscribe(t(this,b,"f").bind(this),ee)}))}},r=new WeakMap,l=new WeakMap,n=new WeakMap,c=new WeakMap,b=new WeakMap,o=new WeakSet,f=function(){this.passkeyUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"add-passkey"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",v).bind(this),t(this,o,"m",v).call(this),this.syncFlowTheme(t(this,l,"f")))},v=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},m=function(){this.passkeyUserAuthMethod.fulfilledFlowId&&(i(this,n,this.createModal({"data-id":"remove-passkey"}),"f"),i(this,c,new k((()=>{var e;return null===(e=t(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,n,"f").afterClose=t(this,o,"m",p).bind(this),t(this,o,"m",p).call(this),this.syncFlowTheme(t(this,c,"f")))},p=function(){t(this,n,"f").setContent(j({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.fulfilledFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,c,"f").onSuccess((()=>{t(this,n,"f").close(),this.actions.getMe()}))},w=function(){this.passkeyUserAuthMethod=new M((()=>{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.onUnfulfilledButtonClick((()=>{var e;null===(e=t(this,r,"f"))||void 0===e||e.open()})),this.passkeyUserAuthMethod.onFulfilledButtonClick((()=>{var e;null===(e=t(this,n,"f"))||void 0===e||e.open()}))},U})),ue=r((s=>{var o,r,h,l,n,c;return c=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),h.set(this,void 0)}initPasswordAuthMethod(){this.passwordUserAuthMethod=new M((()=>{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.onUnfulfilledButtonClick((()=>{var e;null===(e=t(this,r,"f"))||void 0===e||e.open()}))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),this.initPasswordAuthMethod(),t(this,o,"m",l).call(this)}))}},r=new WeakMap,h=new WeakMap,o=new WeakSet,l=function(){this.passwordUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"password"}),"f"),i(this,h,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",n).bind(this),t(this,o,"m",n).call(this),this.syncFlowTheme(t(this,h,"f")))},n=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,h,"f").onSuccess((()=>{t(this,r,"f").close()}))},c})),fe=r((s=>{var o,r,l,n,c,f,v,m,p,w,b,U,y;return y=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),n.set(this,void 0),c.set(this,void 0),b.set(this,h((e=>{this.phoneUserAttr.value=e}))),U.set(this,h((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",w).call(this),t(this,o,"m",f).call(this),t(this,o,"m",m).call(this),t(this,b,"f").call(this,Q(this.state)),t(this,U,"f").call(this,Z(this.state)),this.subscribe(t(this,b,"f").bind(this),Q),this.subscribe(t(this,U,"f").bind(this),Z)}))}},r=new WeakMap,l=new WeakMap,n=new WeakMap,c=new WeakMap,b=new WeakMap,U=new WeakMap,o=new WeakSet,f=function(){this.phoneUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-phone"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",v).bind(this),t(this,o,"m",v).call(this),this.syncFlowTheme(t(this,l,"f")))},v=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},m=function(){this.phoneUserAttr.deleteFlowId&&(i(this,n,this.createModal({"data-id":"delete-phone"}),"f"),i(this,c,new k((()=>{var e;return null===(e=t(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,n,"f").afterClose=t(this,o,"m",p).bind(this),t(this,o,"m",p).call(this),this.syncFlowTheme(t(this,c,"f")))},p=function(){t(this,n,"f").setContent(j({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,c,"f").onSuccess((()=>{t(this,n,"f").close(),this.actions.getMe()}))},w=function(){this.phoneUserAttr=new R((()=>{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 e;null===(e=t(this,r,"f"))||void 0===e||e.open()})),this.phoneUserAttr.onDeleteClick((()=>{var e;null===(e=t(this,n,"f"))||void 0===e||e.open()}))},y})),ve=r((s=>{var o,r,l,n,c,f,v,m;return m=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),v.set(this,h((e=>{this.totpUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",f).call(this),t(this,o,"m",n).call(this),t(this,v,"f").call(this,te(this.state)),this.subscribe(t(this,v,"f").bind(this),te)}))}},r=new WeakMap,l=new WeakMap,v=new WeakMap,o=new WeakSet,n=function(){this.totpUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"totp"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",c).bind(this),t(this,o,"m",c).call(this),this.syncFlowTheme(t(this,l,"f")))},c=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.totpUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.totpUserAuthMethod=new M((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="totp"]')}),{logger:this.logger}),this.totpUserAuthMethod.onUnfulfilledButtonClick((()=>{var e;null===(e=t(this,r,"f"))||void 0===e||e.open()}))},m})),ge=r((i=>{var s,o,r,l,n,c,f,v,m,p,w;return w=class extends(a(ae,V,d,re,u,g)(i)){constructor(){super(...arguments),s.add(this),o.set(this,{}),r.set(this,{}),l.set(this,{}),n.set(this,{}),v.set(this,h((e=>{var i;const o=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="builtin."]');Array.from(o).forEach((i=>{const o=i.getAttribute("data-id").replace("builtin.",""),r=e[o],a=new R(i,{logger:this.logger});a.value=(r||"").toString(),t(this,s,"m",m).call(this,i,o,a),t(this,s,"m",p).call(this,i,o,a)}))})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,v,"f").call(this,se(this.state)),this.subscribe(t(this,v,"f").bind(this),se)}))}},o=new WeakMap,r=new WeakMap,l=new WeakMap,n=new WeakMap,v=new WeakMap,s=new WeakSet,c=function(e){var i,s;null===(i=t(this,o,"f")[e])||void 0===i||i.setContent(j({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=t(this,r,"f")[e])||void 0===s||s.onSuccess((()=>{var i;null===(i=t(this,o,"f")[e])||void 0===i||i.close(),this.actions.getMe()}))},f=function(e){var i,s;null===(i=t(this,l,"f")[e])||void 0===i||i.setContent(j({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=t(this,n,"f")[e])||void 0===s||s.onSuccess((()=>{var i;null===(i=t(this,l,"f")[e])||void 0===i||i.close(),this.actions.getMe()}))},m=function(e,i,a){const h=e.getAttribute("edit-flow-id");h&&(t(this,o,"f")[h]=this.createModal({"data-id":`edit-${i}`}),t(this,r,"f")[h]=new k((()=>{var e,i;return null===(i=null===(e=t(this,o,"f")[h])||void 0===e?void 0:e.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),t(this,o,"f")[h].afterClose=t(this,s,"m",c).bind(this,h),a.onEditClick((()=>{var e,i;null===(i=null===(e=t(this,o,"f"))||void 0===e?void 0:e[h])||void 0===i||i.open()})),t(this,s,"m",c).call(this,h),this.syncFlowTheme(t(this,r,"f")[h]))},p=function(e,i,o){const r=e.getAttribute("delete-flow-id");r&&(t(this,l,"f")[r]=this.createModal({"data-id":`delete-${i}`}),t(this,n,"f")[r]=new k((()=>{var e,i;return null===(i=null===(e=t(this,l,"f")[r])||void 0===e?void 0:e.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),t(this,l,"f")[r].afterClose=t(this,s,"m",f).bind(this,r),o.onDeleteClick((()=>{var e,i;null===(i=null===(e=t(this,l,"f"))||void 0===e?void 0:e[r])||void 0===i||i.open()})),t(this,s,"m",f).call(this,r),this.syncFlowTheme(t(this,n,"f")[r]))},w}));var me;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(me||(me={}));const pe=r((i=>{var s,o,r,l,n,c,f,v,m,p,w;return o=class extends(a(ae,V,d,re,u,g)(i)){constructor(){super(...arguments),s.add(this),r.set(this,{}),l.set(this,{}),n.set(this,{}),c.set(this,{}),m.set(this,h((e=>{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.",""),a=i.getAttribute("data-type")||me.TEXT,h=e[r],l=new R(i,{logger:this.logger});l.value=o.getFormattedValue(a,h),t(this,s,"m",p).call(this,i,r,l),t(this,s,"m",w).call(this,i,r,l)}))})))}static getFormattedValue(e,t){return e===me.DATE&&t?new Date(t).toLocaleString():e===me.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,m,"f").call(this,ie(this.state)),this.subscribe(t(this,m,"f").bind(this),ie)}))}},r=new WeakMap,l=new WeakMap,n=new WeakMap,c=new WeakMap,m=new WeakMap,s=new WeakSet,f=function(e){var i,s;null===(i=t(this,r,"f")[e])||void 0===i||i.setContent(j({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=t(this,l,"f")[e])||void 0===s||s.onSuccess((()=>{var i;null===(i=t(this,r,"f")[e])||void 0===i||i.close(),this.actions.getMe()}))},v=function(e){var i,s;null===(i=t(this,n,"f")[e])||void 0===i||i.setContent(j({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=t(this,c,"f")[e])||void 0===s||s.onSuccess((()=>{var i;null===(i=t(this,n,"f")[e])||void 0===i||i.close(),this.actions.getMe()}))},p=function(e,i,o){const a=e.getAttribute("edit-flow-id");a&&(t(this,r,"f")[a]=this.createModal({"data-id":`edit-${i}`}),t(this,l,"f")[a]=new k((()=>{var e,i;return null===(i=null===(e=t(this,r,"f")[a])||void 0===e?void 0:e.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),t(this,r,"f")[a].afterClose=t(this,s,"m",f).bind(this,a),o.onEditClick((()=>{var e,i;null===(i=null===(e=t(this,r,"f"))||void 0===e?void 0:e[a])||void 0===i||i.open()})),t(this,s,"m",f).call(this,a),this.syncFlowTheme(t(this,l,"f")[a]))},w=function(e,i,o){const r=e.getAttribute("delete-flow-id");r&&(t(this,n,"f")[r]=this.createModal({"data-id":`delete-${i}`}),t(this,c,"f")[r]=new k((()=>{var e,i;return null===(i=null===(e=t(this,n,"f")[r])||void 0===e?void 0:e.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),t(this,n,"f")[r].afterClose=t(this,s,"m",v).bind(this,r),o.onDeleteClick((()=>{var e,i;null===(i=null===(e=t(this,n,"f"))||void 0===e?void 0:e[r])||void 0===i||i.open()})),t(this,s,"m",v).call(this,r),this.syncFlowTheme(t(this,c,"f")[r]))},o})),we=r((t=>class extends(a(y,m,G,pe,le,he,de,fe,ce,ue,ve,ge,ne)(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this)}))}})),be=a((t=>class extends(we(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e(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.6.4"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",be);export{be as default};
|
|
5
|
+
import{__awaiter as e,__classPrivateFieldGet as t,__classPrivateFieldSet as i}from"tslib";import{createTemplate as s,kebabCase as o,createSingletonMixin as r,compose as a,withMemCache as h}from"@descope/sdk-helpers";import{projectIdMixin as l,observeAttributesMixin as n,loggerMixin as d,baseUrlMixin as c,cookieConfigMixin as u,createStateManagementMixin as f,initLifecycleMixin as v,modalMixin as g,themeMixin as m,staticResourcesMixin as p,createValidateAttributesMixin as w,descopeUiMixin as b,initElementMixin as U,debuggerMixin as y}from"@descope/sdk-mixins";import{FlowDriver as k,AvatarDriver as C,UserAttributeDriver as R,ButtonDriver as S,UserAuthMethodDriver as M}from"@descope/sdk-component-drivers";import{createAsyncThunk as W}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import I from"@descope/web-js-sdk";import{createSelector as A}from"reselect";import"@descope/web-component";const j=(e={})=>{const t=s("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,i])=>{t.content.querySelector("descope-wc").setAttribute(o(e),i)})),t};function N(e){return new URLSearchParams(window.location.search).get(e)}const F=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)}))}))},x=W("users/me",((e,{extra:{api:t}})=>t.user.me())),T=F(x)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(E=e=>e.me,{onFulfilled:e=>{E(e).loading=!1},onPending:e=>{E(e).loading=!0,E(e).error=null},onRejected:(e,t)=>{E(e).loading=!1,E(e).error=t.error}}));var E;const O={action:x,reducer:T},q=W("users/logout",((e,{extra:{api:t}})=>t.user.logout())),P={action:q,reducer:F(q)({})},L={me:{loading:!1,error:null,data:{}}},D={me:"/v1/auth/me"},$=()=>e(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})}))})),B=({httpClient:t,mock:i})=>({me:()=>e(void 0,void 0,void 0,(function*(){if(i)return $();const s=yield t.get(D.me);return yield(t=>e(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()}))}),H=r((s=>{var o,r,h,f;const v=a(l,n,d,c,u)(s);return f=class extends v{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 t(this,r,"f")||t(this,o,"m",h).call(this),t(this,r,"f")}init(){const i=Object.create(null,{init:{get:()=>super.init}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.init)||void 0===e?void 0:e.call(this),this.observeAttributes(["project-id","base-url"],(()=>{t(this,r,"f")&&t(this,o,"m",h).call(this)}))}))}},r=new WeakMap,o=new WeakSet,h=function(){this.logger.debug("creating an sdk instance"),i(this,r,((t,i,s)=>{const o=I(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.6.5"}}));return{user:Object.assign(Object.assign({},B({httpClient:o.httpClient,mock:i})),{logout:i?()=>e(void 0,void 0,void 0,(function*(){})):o.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},f})),V=r((e=>{const t=a(f({name:"widget",initialState:L,reducers:{},extraReducers:e=>{O.reducer(e),P.reducer(e)},asyncActions:{getMe:O.action,logout:P.action}}),v,d,H)(e);return class extends t{constructor(...e){super(...e),this.state=L,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),X="widget-flow",G=r((i=>{var s,o,r;return r=class extends(a(v,g,V,u,d,m)(i)){constructor(){super(...arguments),s.add(this)}init(){const i=Object.create(null,{init:{get:()=>super.init}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.init)||void 0===e?void 0:e.call(this);const r=N(X);r&&(!function(e){if(window.history.replaceState&&N(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())}}(X),t(this,s,"m",o).call(this,r))}))}},s=new WeakSet,o=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(j({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme}));new k((()=>{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()},r})),J=e=>e.me.data,Y=A(J,(e=>e.picture)),_=A(J,(e=>e.email)),z=A(J,(e=>e.verifiedEmail)),K=A(J,(e=>e.name)),Q=A(J,(e=>e.phone)),Z=A(J,(e=>e.verifiedPhone)),ee=A(J,(e=>e.webauthn));A(J,(e=>e.password));const te=A(J,(e=>e.TOTP)),ie=A(J,(e=>e.customAttributes)),se=A(J,(e=>({givenName:e.givenName,middleName:e.middleName,familyName:e.familyName}))),oe=r((t=>{const i=a(p,w({"widget-id":w.missingAttrValidator}))(t);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(t){return e(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${t}`,"text")).body}))}}})),re=r((i=>{var o,r,h;return h=class extends(a(d,v,b,U,oe,V)(i)){constructor(){super(...arguments),o.add(this)}onWidgetRootReady(){return e(this,void 0,void 0,(function*(){}))}init(){const i=Object.create(null,{init:{get:()=>super.init}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.init)||void 0===e?void 0:e.call(this),yield Promise.all([this.actions.getMe(),t(this,o,"m",r).call(this)]),this.onWidgetRootReady()}))}},o=new WeakSet,r=function(){return e(this,void 0,void 0,(function*(){const e=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},h})),ae=r((e=>class extends(a(m,n)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),he=r((s=>{var o,r,l,n,c,f,v,p,w;return w=class extends(a(ae,m,V,d,u,re,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),v.set(this,h((e=>{this.avatar.image=e}))),p.set(this,h((e=>{this.avatar.displayName=e})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",f).call(this),t(this,o,"m",n).call(this),t(this,v,"f").call(this,Y(this.state)),t(this,p,"f").call(this,K(this.state)),this.subscribe(t(this,v,"f").bind(this),Y),this.subscribe(t(this,p,"f").bind(this),K)}))}},r=new WeakMap,l=new WeakMap,v=new WeakMap,p=new WeakMap,o=new WeakSet,n=function(){this.avatar.flowId&&(i(this,r,this.createModal({"data-id":"update-pic"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",c).bind(this),t(this,o,"m",c).call(this),this.syncFlowTheme(t(this,l,"f")))},c=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.avatar=new C((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var e;null===(e=t(this,r,"f"))||void 0===e||e.open()}))},w})),le=r((s=>{var o,r,l,n,c,f,v,m,p,w,b,U,y;return y=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),n.set(this,void 0),c.set(this,void 0),b.set(this,h((e=>{this.emailUserAttr.value=e}))),U.set(this,h((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",w).call(this),t(this,o,"m",f).call(this),t(this,o,"m",m).call(this),t(this,b,"f").call(this,_(this.state)),t(this,U,"f").call(this,z(this.state)),this.subscribe(t(this,b,"f").bind(this),_),this.subscribe(t(this,U,"f").bind(this),z)}))}},r=new WeakMap,l=new WeakMap,n=new WeakMap,c=new WeakMap,b=new WeakMap,U=new WeakMap,o=new WeakSet,f=function(){this.emailUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-email"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",v).bind(this),t(this,o,"m",v).call(this),this.syncFlowTheme(t(this,l,"f")))},v=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},m=function(){this.emailUserAttr.deleteFlowId&&(i(this,n,this.createModal({"data-id":"delete-email"}),"f"),i(this,c,new k((()=>{var e;return null===(e=t(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,n,"f").afterClose=t(this,o,"m",p).bind(this),t(this,o,"m",p).call(this),this.syncFlowTheme(t(this,c,"f")))},p=function(){t(this,n,"f").setContent(j({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,c,"f").onSuccess((()=>{t(this,n,"f").close(),this.actions.getMe()}))},w=function(){this.emailUserAttr=new R((()=>{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 e;null===(e=t(this,r,"f"))||void 0===e||e.open()})),this.emailUserAttr.onDeleteClick((()=>{var e;null===(e=t(this,n,"f"))||void 0===e||e.open()}))},y})),ne=r((i=>{var s,o,r;return r=class extends(a(V,d,re,g)(i)){constructor(){super(...arguments),s.add(this)}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,s,"m",o).call(this)}))}},s=new WeakSet,o=function(){this.logout=new S((()=>{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(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},r})),de=r((s=>{var o,r,l,n,c,f,v,m,p,w,b,U;return U=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),n.set(this,void 0),c.set(this,void 0),b.set(this,h((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",w).call(this),t(this,o,"m",f).call(this),t(this,o,"m",m).call(this),t(this,b,"f").call(this,K(this.state)),this.subscribe(t(this,b,"f").bind(this),K)}))}},r=new WeakMap,l=new WeakMap,n=new WeakMap,c=new WeakMap,b=new WeakMap,o=new WeakSet,f=function(){this.nameUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-name"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",v).bind(this),t(this,o,"m",v).call(this),this.syncFlowTheme(t(this,l,"f")))},v=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},m=function(){this.nameUserAttr.deleteFlowId&&(i(this,n,this.createModal({"data-id":"delete-name"}),"f"),i(this,c,new k((()=>{var e;return null===(e=t(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,n,"f").afterClose=t(this,o,"m",p).bind(this),t(this,o,"m",p).call(this),this.syncFlowTheme(t(this,c,"f")))},p=function(){t(this,n,"f").setContent(j({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,c,"f").onSuccess((()=>{t(this,n,"f").close(),this.actions.getMe()}))},w=function(){this.nameUserAttr=new R((()=>{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 e;null===(e=t(this,r,"f"))||void 0===e||e.open()})),this.nameUserAttr.onDeleteClick((()=>{var e;null===(e=t(this,n,"f"))||void 0===e||e.open()}))},U})),ce=r((s=>{var o,r,l,n,c,f,v,m,p,w,b,U;return U=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),n.set(this,void 0),c.set(this,void 0),b.set(this,h((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",w).call(this),t(this,o,"m",f).call(this),t(this,o,"m",m).call(this),t(this,b,"f").call(this,ee(this.state)),this.subscribe(t(this,b,"f").bind(this),ee)}))}},r=new WeakMap,l=new WeakMap,n=new WeakMap,c=new WeakMap,b=new WeakMap,o=new WeakSet,f=function(){this.passkeyUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"add-passkey"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",v).bind(this),t(this,o,"m",v).call(this),this.syncFlowTheme(t(this,l,"f")))},v=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},m=function(){this.passkeyUserAuthMethod.fulfilledFlowId&&(i(this,n,this.createModal({"data-id":"remove-passkey"}),"f"),i(this,c,new k((()=>{var e;return null===(e=t(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,n,"f").afterClose=t(this,o,"m",p).bind(this),t(this,o,"m",p).call(this),this.syncFlowTheme(t(this,c,"f")))},p=function(){t(this,n,"f").setContent(j({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.fulfilledFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,c,"f").onSuccess((()=>{t(this,n,"f").close(),this.actions.getMe()}))},w=function(){this.passkeyUserAuthMethod=new M((()=>{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.onUnfulfilledButtonClick((()=>{var e;null===(e=t(this,r,"f"))||void 0===e||e.open()})),this.passkeyUserAuthMethod.onFulfilledButtonClick((()=>{var e;null===(e=t(this,n,"f"))||void 0===e||e.open()}))},U})),ue=r((s=>{var o,r,h,l,n,c;return c=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),h.set(this,void 0)}initPasswordAuthMethod(){this.passwordUserAuthMethod=new M((()=>{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.onUnfulfilledButtonClick((()=>{var e;null===(e=t(this,r,"f"))||void 0===e||e.open()}))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),this.initPasswordAuthMethod(),t(this,o,"m",l).call(this)}))}},r=new WeakMap,h=new WeakMap,o=new WeakSet,l=function(){this.passwordUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"password"}),"f"),i(this,h,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",n).bind(this),t(this,o,"m",n).call(this),this.syncFlowTheme(t(this,h,"f")))},n=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,h,"f").onSuccess((()=>{t(this,r,"f").close()}))},c})),fe=r((s=>{var o,r,l,n,c,f,v,m,p,w,b,U,y;return y=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),n.set(this,void 0),c.set(this,void 0),b.set(this,h((e=>{this.phoneUserAttr.value=e}))),U.set(this,h((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",w).call(this),t(this,o,"m",f).call(this),t(this,o,"m",m).call(this),t(this,b,"f").call(this,Q(this.state)),t(this,U,"f").call(this,Z(this.state)),this.subscribe(t(this,b,"f").bind(this),Q),this.subscribe(t(this,U,"f").bind(this),Z)}))}},r=new WeakMap,l=new WeakMap,n=new WeakMap,c=new WeakMap,b=new WeakMap,U=new WeakMap,o=new WeakSet,f=function(){this.phoneUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-phone"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",v).bind(this),t(this,o,"m",v).call(this),this.syncFlowTheme(t(this,l,"f")))},v=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},m=function(){this.phoneUserAttr.deleteFlowId&&(i(this,n,this.createModal({"data-id":"delete-phone"}),"f"),i(this,c,new k((()=>{var e;return null===(e=t(this,n,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,n,"f").afterClose=t(this,o,"m",p).bind(this),t(this,o,"m",p).call(this),this.syncFlowTheme(t(this,c,"f")))},p=function(){t(this,n,"f").setContent(j({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,c,"f").onSuccess((()=>{t(this,n,"f").close(),this.actions.getMe()}))},w=function(){this.phoneUserAttr=new R((()=>{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 e;null===(e=t(this,r,"f"))||void 0===e||e.open()})),this.phoneUserAttr.onDeleteClick((()=>{var e;null===(e=t(this,n,"f"))||void 0===e||e.open()}))},y})),ve=r((s=>{var o,r,l,n,c,f,v,m;return m=class extends(a(ae,V,d,re,u,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),v.set(this,h((e=>{this.totpUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,o,"m",f).call(this),t(this,o,"m",n).call(this),t(this,v,"f").call(this,te(this.state)),this.subscribe(t(this,v,"f").bind(this),te)}))}},r=new WeakMap,l=new WeakMap,v=new WeakMap,o=new WeakSet,n=function(){this.totpUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"totp"}),"f"),i(this,l,new k((()=>{var e;return null===(e=t(this,r,"f").ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}),"f"),t(this,r,"f").afterClose=t(this,o,"m",c).bind(this),t(this,o,"m",c).call(this),this.syncFlowTheme(t(this,l,"f")))},c=function(){t(this,r,"f").setContent(j({projectId:this.projectId,flowId:this.totpUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),t(this,l,"f").onSuccess((()=>{t(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.totpUserAuthMethod=new M((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="totp"]')}),{logger:this.logger}),this.totpUserAuthMethod.onUnfulfilledButtonClick((()=>{var e;null===(e=t(this,r,"f"))||void 0===e||e.open()}))},m})),ge=r((i=>{var s,o,r,l,n,c,f,v,m,p,w;return w=class extends(a(ae,V,d,re,u,g)(i)){constructor(){super(...arguments),s.add(this),o.set(this,{}),r.set(this,{}),l.set(this,{}),n.set(this,{}),v.set(this,h((e=>{var i;const o=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="builtin."]');Array.from(o).forEach((i=>{const o=i.getAttribute("data-id").replace("builtin.",""),r=e[o],a=new R(i,{logger:this.logger});a.value=(r||"").toString(),t(this,s,"m",m).call(this,i,o,a),t(this,s,"m",p).call(this,i,o,a)}))})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,v,"f").call(this,se(this.state)),this.subscribe(t(this,v,"f").bind(this),se)}))}},o=new WeakMap,r=new WeakMap,l=new WeakMap,n=new WeakMap,v=new WeakMap,s=new WeakSet,c=function(e){var i,s;null===(i=t(this,o,"f")[e])||void 0===i||i.setContent(j({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=t(this,r,"f")[e])||void 0===s||s.onSuccess((()=>{var i;null===(i=t(this,o,"f")[e])||void 0===i||i.close(),this.actions.getMe()}))},f=function(e){var i,s;null===(i=t(this,l,"f")[e])||void 0===i||i.setContent(j({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=t(this,n,"f")[e])||void 0===s||s.onSuccess((()=>{var i;null===(i=t(this,l,"f")[e])||void 0===i||i.close(),this.actions.getMe()}))},m=function(e,i,a){const h=e.getAttribute("edit-flow-id");h&&(t(this,o,"f")[h]=this.createModal({"data-id":`edit-${i}`}),t(this,r,"f")[h]=new k((()=>{var e,i;return null===(i=null===(e=t(this,o,"f")[h])||void 0===e?void 0:e.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),t(this,o,"f")[h].afterClose=t(this,s,"m",c).bind(this,h),a.onEditClick((()=>{var e,i;null===(i=null===(e=t(this,o,"f"))||void 0===e?void 0:e[h])||void 0===i||i.open()})),t(this,s,"m",c).call(this,h),this.syncFlowTheme(t(this,r,"f")[h]))},p=function(e,i,o){const r=e.getAttribute("delete-flow-id");r&&(t(this,l,"f")[r]=this.createModal({"data-id":`delete-${i}`}),t(this,n,"f")[r]=new k((()=>{var e,i;return null===(i=null===(e=t(this,l,"f")[r])||void 0===e?void 0:e.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),t(this,l,"f")[r].afterClose=t(this,s,"m",f).bind(this,r),o.onDeleteClick((()=>{var e,i;null===(i=null===(e=t(this,l,"f"))||void 0===e?void 0:e[r])||void 0===i||i.open()})),t(this,s,"m",f).call(this,r),this.syncFlowTheme(t(this,n,"f")[r]))},w}));var me;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}(me||(me={}));const pe=r((i=>{var s,o,r,l,n,c,f,v,m,p,w;return o=class extends(a(ae,V,d,re,u,g)(i)){constructor(){super(...arguments),s.add(this),r.set(this,{}),l.set(this,{}),n.set(this,{}),c.set(this,{}),m.set(this,h((e=>{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.",""),a=i.getAttribute("data-type")||me.TEXT,h=e[r],l=new R(i,{logger:this.logger});l.value=o.getFormattedValue(a,h),t(this,s,"m",p).call(this,i,r,l),t(this,s,"m",w).call(this,i,r,l)}))})))}static getFormattedValue(e,t){return e===me.DATE&&t?new Date(t).toLocaleString():e===me.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=i.onWidgetRootReady)||void 0===e?void 0:e.call(this),t(this,m,"f").call(this,ie(this.state)),this.subscribe(t(this,m,"f").bind(this),ie)}))}},r=new WeakMap,l=new WeakMap,n=new WeakMap,c=new WeakMap,m=new WeakMap,s=new WeakSet,f=function(e){var i,s;null===(i=t(this,r,"f")[e])||void 0===i||i.setContent(j({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=t(this,l,"f")[e])||void 0===s||s.onSuccess((()=>{var i;null===(i=t(this,r,"f")[e])||void 0===i||i.close(),this.actions.getMe()}))},v=function(e){var i,s;null===(i=t(this,n,"f")[e])||void 0===i||i.setContent(j({projectId:this.projectId,flowId:e,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=t(this,c,"f")[e])||void 0===s||s.onSuccess((()=>{var i;null===(i=t(this,n,"f")[e])||void 0===i||i.close(),this.actions.getMe()}))},p=function(e,i,o){const a=e.getAttribute("edit-flow-id");a&&(t(this,r,"f")[a]=this.createModal({"data-id":`edit-${i}`}),t(this,l,"f")[a]=new k((()=>{var e,i;return null===(i=null===(e=t(this,r,"f")[a])||void 0===e?void 0:e.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),t(this,r,"f")[a].afterClose=t(this,s,"m",f).bind(this,a),o.onEditClick((()=>{var e,i;null===(i=null===(e=t(this,r,"f"))||void 0===e?void 0:e[a])||void 0===i||i.open()})),t(this,s,"m",f).call(this,a),this.syncFlowTheme(t(this,l,"f")[a]))},w=function(e,i,o){const r=e.getAttribute("delete-flow-id");r&&(t(this,n,"f")[r]=this.createModal({"data-id":`delete-${i}`}),t(this,c,"f")[r]=new k((()=>{var e,i;return null===(i=null===(e=t(this,n,"f")[r])||void 0===e?void 0:e.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),t(this,n,"f")[r].afterClose=t(this,s,"m",v).bind(this,r),o.onDeleteClick((()=>{var e,i;null===(i=null===(e=t(this,n,"f"))||void 0===e?void 0:e[r])||void 0===i||i.open()})),t(this,s,"m",v).call(this,r),this.syncFlowTheme(t(this,c,"f")[r]))},o})),we=r((t=>class extends(a(y,m,G,pe,le,he,de,fe,ce,ue,ve,ge,ne)(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this)}))}})),be=a((t=>class extends(we(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e(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.6.5"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",be);export{be 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>) & (() => Promise<void>) & (() => Promise<void>);
|
|
21
|
-
"__#
|
|
21
|
+
"__#29622@#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
|
-
"__#
|
|
30
|
+
"__#29621@#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
|
-
"__#
|
|
38
|
+
"__#29619@#private": any;
|
|
39
39
|
logger: {
|
|
40
40
|
error(...data: any[]): void;
|
|
41
41
|
warn(...data: any[]): void;
|
|
@@ -46,11 +46,11 @@ declare const UserProfileWidget: {
|
|
|
46
46
|
readonly ele: Element;
|
|
47
47
|
};
|
|
48
48
|
createModal(config?: Record<string, string>): _descope_sdk_component_drivers.ModalDriver;
|
|
49
|
-
"__#
|
|
50
|
-
"__#
|
|
49
|
+
"__#29618@#getComponentsVersion": (() => Promise<string>) & (() => Promise<string>) & (() => Promise<string>);
|
|
50
|
+
"__#29618@#descopeUi": Promise<any>;
|
|
51
51
|
readonly descopeUi: Promise<any>;
|
|
52
|
-
"__#
|
|
53
|
-
"__#
|
|
52
|
+
"__#29618@#loadDescopeUiComponent": ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>);
|
|
53
|
+
"__#29618@#getDescopeUi": (() => Promise<any>) & (() => Promise<any>) & (() => Promise<any>);
|
|
54
54
|
loadDescopeUiComponents: ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>) & ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>) & ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>);
|
|
55
55
|
readonly baseCdnUrl: string;
|
|
56
56
|
injectNpmLib: ((libName: string, version: string, filePath?: string, overrides?: string[]) => Promise<{
|
|
@@ -63,8 +63,8 @@ declare const UserProfileWidget: {
|
|
|
63
63
|
id: string;
|
|
64
64
|
url: URL;
|
|
65
65
|
}>);
|
|
66
|
-
"__#
|
|
67
|
-
"__#
|
|
66
|
+
"__#29608@#logger": _descope_sdk_mixins.Logger;
|
|
67
|
+
"__#29608@#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) & ((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);
|
|
68
68
|
logger: _descope_sdk_mixins.Logger;
|
|
69
69
|
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", 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);
|
|
70
70
|
accessKey: string;
|
|
@@ -1022,20 +1022,20 @@ declare const UserProfileWidget: {
|
|
|
1022
1022
|
blur: (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void);
|
|
1023
1023
|
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);
|
|
1024
1024
|
readonly config: Promise<_descope_sdk_mixins.Config>;
|
|
1025
|
-
"__#
|
|
1026
|
-
"__#
|
|
1027
|
-
"__#
|
|
1028
|
-
"__#
|
|
1029
|
-
"__#
|
|
1025
|
+
"__#29614@#configCacheClear": (() => void) & (() => void) & (() => void) & (() => void);
|
|
1026
|
+
"__#29614@#_configResource": Promise<_descope_sdk_mixins.Config>;
|
|
1027
|
+
"__#29614@#fetchConfig": (() => Promise<_descope_sdk_mixins.Config>) & (() => Promise<_descope_sdk_mixins.Config>) & (() => Promise<_descope_sdk_mixins.Config>) & (() => Promise<_descope_sdk_mixins.Config>);
|
|
1028
|
+
"__#29609@#isInit": boolean;
|
|
1029
|
+
"__#29613@#callbacks": Map<string, () => void> & Map<string, () => void> & Map<string, () => void> & Map<string, () => void>;
|
|
1030
1030
|
onReset: ((sectionId: string, callback: () => void | Promise<void>) => () => void) & ((sectionId: string, callback: () => void | Promise<void>) => () => void) & ((sectionId: string, callback: () => void | Promise<void>) => () => void) & ((sectionId: string, callback: () => void | Promise<void>) => () => void);
|
|
1031
1031
|
reset: ((...sectionIds: string[]) => Promise<void>) & ((...sectionIds: string[]) => Promise<void>) & ((...sectionIds: string[]) => Promise<void>) & ((...sectionIds: string[]) => Promise<void>);
|
|
1032
|
-
"__#
|
|
1033
|
-
"__#
|
|
1032
|
+
"__#29611@#handleError": ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void);
|
|
1033
|
+
"__#29610@#observeMappings": {};
|
|
1034
1034
|
observeAttribute: ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((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);
|
|
1035
1035
|
observeAttributes: ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((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);
|
|
1036
|
-
"__#
|
|
1037
|
-
"__#
|
|
1038
|
-
"__#
|
|
1036
|
+
"__#29612@#lastBaseUrl"?: string;
|
|
1037
|
+
"__#29612@#workingBaseUrl"?: string;
|
|
1038
|
+
"__#29612@#getResourceUrls": ((filename: string) => (URL & {
|
|
1039
1039
|
baseUrl: string;
|
|
1040
1040
|
}) | (URL & {
|
|
1041
1041
|
baseUrl: string;
|
|
@@ -1113,7 +1113,7 @@ declare const UserProfileWidget: {
|
|
|
1113
1113
|
replaceSync(cssString: string): void;
|
|
1114
1114
|
readonly cssRules: CSSRuleList;
|
|
1115
1115
|
});
|
|
1116
|
-
"__#
|
|
1116
|
+
"__#29615@#setNonce": (() => void) & (() => void) & (() => void) & (() => void);
|
|
1117
1117
|
"__#7@#initWidgetRoot": (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>);
|
|
1118
1118
|
state: State;
|
|
1119
1119
|
"__#5@#api": {
|
|
@@ -1884,22 +1884,22 @@ declare const UserProfileWidget: {
|
|
|
1884
1884
|
"__#16@#initEditFlow"(nodeEle: Element, field: string, compInstance: _descope_sdk_component_drivers.UserAttributeDriver): void;
|
|
1885
1885
|
"__#16@#initDeleteFlow"(nodeEle: Element, field: string, compInstance: _descope_sdk_component_drivers.UserAttributeDriver): void;
|
|
1886
1886
|
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) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void);
|
|
1887
|
-
"__#
|
|
1887
|
+
"__#29624@#globalStyle": _descope_sdk_mixins.InjectedStyle;
|
|
1888
1888
|
readonly theme: _descope_sdk_mixins.ThemeOptions;
|
|
1889
1889
|
readonly styleId: string;
|
|
1890
|
-
"__#
|
|
1891
|
-
"__#
|
|
1892
|
-
readonly "__#
|
|
1893
|
-
"__#
|
|
1894
|
-
"__#
|
|
1895
|
-
"__#
|
|
1890
|
+
"__#29624@#_themeResource": Promise<void | Record<string, any>>;
|
|
1891
|
+
"__#29624@#fetchTheme"(): Promise<Record<string, any>>;
|
|
1892
|
+
readonly "__#29624@#themeResource": Promise<void | Record<string, any>>;
|
|
1893
|
+
"__#29624@#loadGlobalStyle"(): Promise<void>;
|
|
1894
|
+
"__#29624@#loadComponentsStyle"(): Promise<void>;
|
|
1895
|
+
"__#29624@#getFontsConfig"(): Promise<Record<string, {
|
|
1896
1896
|
url?: string;
|
|
1897
1897
|
}>>;
|
|
1898
|
-
"__#
|
|
1899
|
-
"__#
|
|
1900
|
-
"__#
|
|
1901
|
-
"__#
|
|
1902
|
-
"__#
|
|
1898
|
+
"__#29624@#loadFonts"(): Promise<void>;
|
|
1899
|
+
"__#29624@#applyTheme"(): Promise<void>;
|
|
1900
|
+
"__#29624@#onThemeChange": () => void;
|
|
1901
|
+
"__#29624@#loadTheme"(): void;
|
|
1902
|
+
"__#29624@#toggleOsThemeChangeListener": (listen: boolean) => void;
|
|
1903
1903
|
totpUserAuthMethod: _descope_sdk_component_drivers.UserAuthMethodDriver;
|
|
1904
1904
|
"__#15@#modal": _descope_sdk_component_drivers.ModalDriver;
|
|
1905
1905
|
"__#15@#flow": _descope_sdk_component_drivers.FlowDriver;
|
|
@@ -1977,7 +1977,7 @@ declare const UserProfileWidget: {
|
|
|
1977
1977
|
"__#17@#initEditFlow"(nodeEle: Element, customAttrName: string, compInstance: _descope_sdk_component_drivers.UserAttributeDriver): void;
|
|
1978
1978
|
"__#17@#initDeleteFlow"(nodeEle: Element, customAttrName: string, compInstance: _descope_sdk_component_drivers.UserAttributeDriver): void;
|
|
1979
1979
|
"__#6@#createFlowRedirectModal"(widgetFlow: string): void;
|
|
1980
|
-
"__#
|
|
1980
|
+
"__#29617@#debuggerEle": HTMLElement & {
|
|
1981
1981
|
updateData: (data: {
|
|
1982
1982
|
title: string;
|
|
1983
1983
|
description?: string;
|
|
@@ -1986,11 +1986,11 @@ declare const UserProfileWidget: {
|
|
|
1986
1986
|
description?: string;
|
|
1987
1987
|
}[]) => void;
|
|
1988
1988
|
};
|
|
1989
|
-
"__#
|
|
1990
|
-
"__#
|
|
1989
|
+
"__#29617@#disableDebugger"(): void;
|
|
1990
|
+
"__#29617@#enableDebugger"(): Promise<void>;
|
|
1991
1991
|
readonly debug: boolean;
|
|
1992
|
-
"__#
|
|
1993
|
-
"__#
|
|
1992
|
+
"__#29617@#handleDebugMode"(): void;
|
|
1993
|
+
"__#29617@#updateDebuggerMessages"(title: string, description: string): void;
|
|
1994
1994
|
};
|
|
1995
1995
|
getFormattedValue(type: string, val: any): any;
|
|
1996
1996
|
};
|