@descope/user-profile-widget 0.2.19 → 0.2.20
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 +42 -42
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* @descope/user-profile-widget v0.2.
|
|
3
|
+
* @descope/user-profile-widget v0.2.20
|
|
4
4
|
*/
|
|
5
|
-
"use strict";var e=require("tslib"),t=require("@descope/sdk-helpers"),i=require("@descope/sdk-mixins"),s=require("@descope/sdk-component-drivers"),a=require("@reduxjs/toolkit");require("@descope/core-js-sdk");var l=require("@descope/web-js-sdk"),r=require("reselect");require("@descope/web-component");const o=(e={})=>{const i=t.createTemplate("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,s])=>{i.content.querySelector("descope-wc").setAttribute(t.kebabCase(e),s)})),i};function d(e){return new URLSearchParams(window.location.search).get(e)}const n=e=>(...t)=>i=>{i.addCase(e.pending,((e,i)=>{t.forEach((({onPending:t})=>{null==t||t(e,i)}))})),i.addCase(e.fulfilled,((e,i)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,i)}))})),i.addCase(e.rejected,((e,i)=>{t.forEach((({onRejected:t})=>{null==t||t(e,i)}))}))},c=a.createAsyncThunk("users/me",((e,{extra:{api:t}})=>t.user.me())),h=n(c)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(v=e=>e.me,{onFulfilled:e=>{v(e).loading=!1},onPending:e=>{v(e).loading=!0,v(e).error=null},onRejected:(e,t)=>{v(e).loading=!1,v(e).error=t.error}}));var v;const u={action:c,reducer:h},_=a.createAsyncThunk("users/logout",((e,{extra:{api:t}})=>t.user.logout())),g={action:_,reducer:n(_)({})},f={me:{loading:!1,error:null,data:{}}},p={me:"/v1/auth/me"},w=()=>e.__awaiter(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))})),F=({httpClient:t,mock:i})=>({me:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(i)return w();const s=yield t.get(p.me);return yield(t=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=yield t.text(),i=JSON.parse(e);if(!t.ok){const e=`${i.errorDescription}${i.errorMessage?`: ${i.errorMessage}`:""}`;throw Error(e||`${t.status} ${t.statusText}`)}t.json=()=>Promise.resolve(i),t.text=()=>Promise.resolve(e)})))(s),s.json()}))}),m=t.createSingletonMixin((s=>{var a,r,o,d;const n=t.compose(i.projectIdMixin,i.observeAttributesMixin,i.loggerMixin,i.baseUrlMixin)(s);return d=class extends n{constructor(){super(...arguments),a.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return e.__classPrivateFieldGet(this,r,"f")||e.__classPrivateFieldGet(this,a,"m",o).call(this),e.__classPrivateFieldGet(this,r,"f")}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this),this.observeAttributes(["project-id","base-url"],(()=>{e.__classPrivateFieldGet(this,r,"f")&&e.__classPrivateFieldGet(this,a,"m",o).call(this)}))}))}},r=new WeakMap,a=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),e.__classPrivateFieldSet(this,r,((t,i,s)=>{const a=l(Object.assign(Object.assign({},t),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.2.19"}}));return{user:Object.assign(Object.assign({},F({httpClient:a.httpClient,mock:i})),{logout:i?()=>e.__awaiter(void 0,void 0,void 0,(function*(){})):a.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},d})),b=t.createSingletonMixin((e=>{const s=t.compose(i.createStateManagementMixin({name:"widget",initialState:f,reducers:{},extraReducers:e=>{u.reducer(e),g.reducer(e)},asyncActions:{getMe:u.action,logout:g.action}}),i.initLifecycleMixin,i.loggerMixin,m)(e);return class extends s{constructor(...e){super(...e),this.state=f,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),P="widget-flow",G=t.createSingletonMixin((a=>{var l,r,n;return n=class extends(t.compose(i.initLifecycleMixin,i.modalMixin,b,i.loggerMixin)(a)){constructor(){super(...arguments),l.add(this)}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this);const s=d(P);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())}}(P),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}));new s.FlowDriver((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},n})),M=e=>e.me.data,S=r.createSelector(M,(e=>e.picture)),U=r.createSelector(M,(e=>e.email)),y=r.createSelector(M,(e=>e.verifiedEmail)),R=r.createSelector(M,(e=>e.name)),x=r.createSelector(M,(e=>e.phone)),k=r.createSelector(M,(e=>e.verifiedPhone)),W=r.createSelector(M,(e=>e.webauthn));r.createSelector(M,(e=>e.password));const C=r.createSelector(M,(e=>e.customAttributes)),A=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}))}}})),I=t.createSingletonMixin((s=>{var a,l,r;return r=class extends(t.compose(i.loggerMixin,i.initLifecycleMixin,i.descopeUiMixin,i.initElementMixin,A,b)(s)){constructor(){super(...arguments),a.add(this)}onWidgetRootReady(){return e.__awaiter(this,void 0,void 0,(function*(){}))}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this),yield Promise.all([this.actions.getMe(),e.__classPrivateFieldGet(this,a,"m",l).call(this)]),this.onWidgetRootReady()}))}},a=new WeakSet,l=function(){return e.__awaiter(this,void 0,void 0,(function*(){const e=t.createTemplate(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},r})),j=t.createSingletonMixin((e=>class extends(t.compose(i.themeMixin,i.observeAttributesMixin)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),T=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_;return _=class extends(t.compose(j,i.themeMixin,b,i.loggerMixin,I,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,S(this.state)),e.__classPrivateFieldGet(this,u,"f").call(this,R(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),S),this.subscribe(e.__classPrivateFieldGet(this,u,"f").bind(this),R)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,u=new WeakMap,l=new WeakSet,n=function(){this.avatar.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"update-pic"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},h=function(){this.avatar=new s.AvatarDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},_})),q=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p,w;return w=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.emailUserAttr.value=e}))),p.set(this,t.withMemCache((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,U(this.state)),e.__classPrivateFieldGet(this,p,"f").call(this,y(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),U),this.subscribe(e.__classPrivateFieldGet(this,p,"f").bind(this),y)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,p=new WeakMap,l=new WeakSet,h=function(){this.emailUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-email"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.emailUserAttr.deleteFlowId&&(e.__classPrivateFieldSet(this,n,this.createModal({"data-id":"delete-email"}),"f"),e.__classPrivateFieldSet(this,c,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,n,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",_).bind(this),e.__classPrivateFieldGet(this,l,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,n,"f").setContent(o({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.emailUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.emailUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},w})),D=t.createSingletonMixin((a=>{var l,r,o;return o=class extends(t.compose(b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",r).call(this)}))}},l=new WeakSet,r=function(){this.logout=new s.ButtonDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>e.__awaiter(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},o})),E=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p;return p=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,R(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),R)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,l=new WeakSet,h=function(){this.nameUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-name"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),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})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.nameUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.nameUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},p})),O=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u;return u=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),v.set(this,t.withMemCache((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",n).call(this),e.__classPrivateFieldGet(this,v,"f").call(this,W(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),W)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,l=new WeakSet,n=function(){this.passkeyUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"passkey"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},h=function(){this.passkeyUserAuthMethod=new s.UserAuthMethodDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},u})),L=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v;return v=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",n).call(this)}))}},r=new WeakMap,d=new WeakMap,l=new WeakSet,n=function(){this.passwordUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"password"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close()}))},h=function(){this.passwordUserAuthMethod=new s.UserAuthMethodDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},v})),N=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p,w;return w=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.phoneUserAttr.value=e}))),p.set(this,t.withMemCache((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,x(this.state)),e.__classPrivateFieldGet(this,p,"f").call(this,k(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),x),this.subscribe(e.__classPrivateFieldGet(this,p,"f").bind(this),k)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,p=new WeakMap,l=new WeakSet,h=function(){this.phoneUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-phone"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),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})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.phoneUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.phoneUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},w}));var $;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}($||($={}));const B=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f;return r=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),d.set(this,{}),n.set(this,{}),c.set(this,{}),h.set(this,{}),_.set(this,t.withMemCache((t=>{var i;const a=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(a).forEach((i=>{const a=i.getAttribute("data-id").replace("customAttributes.",""),o=i.getAttribute("data-type")||$.TEXT,d=t[a],n=new s.UserAttributeDriver(i,{logger:this.logger});n.value=r.getFormattedValue(o,d),e.__classPrivateFieldGet(this,l,"m",g).call(this,i,a,n),e.__classPrivateFieldGet(this,l,"m",f).call(this,i,a,n)}))})))}static getFormattedValue(e,t){return e===$.DATE&&t?new Date(t).toLocaleString():e===$.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,_,"f").call(this,C(this.state)),this.subscribe(e.__classPrivateFieldGet(this,_,"f").bind(this),C)}))}},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})),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})),null===(s=e.__classPrivateFieldGet(this,h,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,c,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},g=function(t,i,a){const r=t.getAttribute("edit-flow-id");r&&(e.__classPrivateFieldGet(this,d,"f")[r]=this.createModal({"data-id":`edit-${i}`}),e.__classPrivateFieldGet(this,n,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,d,"f")[r].afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this,r),a.onEditClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,l,"m",v).call(this,r),this.syncFlowTheme(e.__classPrivateFieldGet(this,n,"f")[r]))},f=function(t,i,a){const r=t.getAttribute("delete-flow-id");r&&(e.__classPrivateFieldGet(this,c,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e.__classPrivateFieldGet(this,h,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,c,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,c,"f")[r].afterClose=e.__classPrivateFieldGet(this,l,"m",u).bind(this,r),a.onDeleteClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,c,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,l,"m",u).call(this,r),this.syncFlowTheme(e.__classPrivateFieldGet(this,h,"f")[r]))},r})),V=t.createSingletonMixin((s=>class extends(t.compose(i.debuggerMixin,i.themeMixin,G,B,q,T,E,N,O,L,D)(s)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this)}))}})),H=t.compose((t=>class extends(V(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this);(customElements.get("descope-wc")||(yield import("@descope/web-component").then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.19"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",H),module.exports=H;
|
|
5
|
+
"use strict";var e=require("tslib"),t=require("@descope/sdk-helpers"),i=require("@descope/sdk-mixins"),s=require("@descope/sdk-component-drivers"),a=require("@reduxjs/toolkit");require("@descope/core-js-sdk");var l=require("@descope/web-js-sdk"),r=require("reselect");require("@descope/web-component");const o=(e={})=>{const i=t.createTemplate("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,s])=>{i.content.querySelector("descope-wc").setAttribute(t.kebabCase(e),s)})),i};function d(e){return new URLSearchParams(window.location.search).get(e)}const n=e=>(...t)=>i=>{i.addCase(e.pending,((e,i)=>{t.forEach((({onPending:t})=>{null==t||t(e,i)}))})),i.addCase(e.fulfilled,((e,i)=>{t.forEach((({onFulfilled:t})=>{null==t||t(e,i)}))})),i.addCase(e.rejected,((e,i)=>{t.forEach((({onRejected:t})=>{null==t||t(e,i)}))}))},c=a.createAsyncThunk("users/me",((e,{extra:{api:t}})=>t.user.me())),h=n(c)({onFulfilled:(e,t)=>{e.me.data=t.payload}},(v=e=>e.me,{onFulfilled:e=>{v(e).loading=!1},onPending:e=>{v(e).loading=!0,v(e).error=null},onRejected:(e,t)=>{v(e).loading=!1,v(e).error=t.error}}));var v;const u={action:c,reducer:h},_=a.createAsyncThunk("users/logout",((e,{extra:{api:t}})=>t.user.logout())),g={action:_,reducer:n(_)({})},f={me:{loading:!1,error:null,data:{}}},p={me:"/v1/auth/me"},w=()=>e.__awaiter(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))})),F=({httpClient:t,mock:i})=>({me:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(i)return w();const s=yield t.get(p.me);return yield(t=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=yield t.text(),i=JSON.parse(e);if(!t.ok){const e=`${i.errorDescription}${i.errorMessage?`: ${i.errorMessage}`:""}`;throw Error(e||`${t.status} ${t.statusText}`)}t.json=()=>Promise.resolve(i),t.text=()=>Promise.resolve(e)})))(s),s.json()}))}),m=t.createSingletonMixin((s=>{var a,r,o,d;const n=t.compose(i.projectIdMixin,i.observeAttributesMixin,i.loggerMixin,i.baseUrlMixin)(s);return d=class extends n{constructor(){super(...arguments),a.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return e.__classPrivateFieldGet(this,r,"f")||e.__classPrivateFieldGet(this,a,"m",o).call(this),e.__classPrivateFieldGet(this,r,"f")}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this),this.observeAttributes(["project-id","base-url"],(()=>{e.__classPrivateFieldGet(this,r,"f")&&e.__classPrivateFieldGet(this,a,"m",o).call(this)}))}))}},r=new WeakMap,a=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),e.__classPrivateFieldSet(this,r,((t,i,s)=>{const a=l(Object.assign(Object.assign({},t),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.2.20"}}));return{user:Object.assign(Object.assign({},F({httpClient:a.httpClient,mock:i})),{logout:i?()=>e.__awaiter(void 0,void 0,void 0,(function*(){})):a.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},d})),b=t.createSingletonMixin((e=>{const s=t.compose(i.createStateManagementMixin({name:"widget",initialState:f,reducers:{},extraReducers:e=>{u.reducer(e),g.reducer(e)},asyncActions:{getMe:u.action,logout:g.action}}),i.initLifecycleMixin,i.loggerMixin,m)(e);return class extends s{constructor(...e){super(...e),this.state=f,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),P="widget-flow",G=t.createSingletonMixin((a=>{var l,r,n;return n=class extends(t.compose(i.initLifecycleMixin,i.modalMixin,b,i.loggerMixin)(a)){constructor(){super(...arguments),l.add(this)}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this);const s=d(P);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())}}(P),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}));new s.FlowDriver((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close(),this.actions.getMe()})),t.afterClose=()=>{t.remove()},t.open()},n})),M=e=>e.me.data,S=r.createSelector(M,(e=>e.picture)),U=r.createSelector(M,(e=>e.email)),y=r.createSelector(M,(e=>e.verifiedEmail)),R=r.createSelector(M,(e=>e.name)),x=r.createSelector(M,(e=>e.phone)),k=r.createSelector(M,(e=>e.verifiedPhone)),W=r.createSelector(M,(e=>e.webauthn));r.createSelector(M,(e=>e.password));const C=r.createSelector(M,(e=>e.customAttributes)),A=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}))}}})),I=t.createSingletonMixin((s=>{var a,l,r;return r=class extends(t.compose(i.loggerMixin,i.initLifecycleMixin,i.descopeUiMixin,i.initElementMixin,A,b)(s)){constructor(){super(...arguments),a.add(this)}onWidgetRootReady(){return e.__awaiter(this,void 0,void 0,(function*(){}))}init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.init)||void 0===i?void 0:i.call(this),yield Promise.all([this.actions.getMe(),e.__classPrivateFieldGet(this,a,"m",l).call(this)]),this.onWidgetRootReady()}))}},a=new WeakSet,l=function(){return e.__awaiter(this,void 0,void 0,(function*(){const e=t.createTemplate(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(e),this.contentRootElement.append(e.content.cloneNode(!0))}))},r})),j=t.createSingletonMixin((e=>class extends(t.compose(i.themeMixin,i.observeAttributesMixin)(e)){syncFlowTheme(e){e.theme=this.theme,this.observeAttributes(["theme"],(()=>{e.theme=this.theme}))}})),T=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_;return _=class extends(t.compose(j,i.themeMixin,b,i.loggerMixin,I,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,S(this.state)),e.__classPrivateFieldGet(this,u,"f").call(this,R(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),S),this.subscribe(e.__classPrivateFieldGet(this,u,"f").bind(this),R)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,u=new WeakMap,l=new WeakSet,n=function(){this.avatar.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"update-pic"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},h=function(){this.avatar=new s.AvatarDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},_})),q=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p,w;return w=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.emailUserAttr.value=e}))),p.set(this,t.withMemCache((e=>{this.emailUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,U(this.state)),e.__classPrivateFieldGet(this,p,"f").call(this,y(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),U),this.subscribe(e.__classPrivateFieldGet(this,p,"f").bind(this),y)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,p=new WeakMap,l=new WeakSet,h=function(){this.emailUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-email"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.emailUserAttr.deleteFlowId&&(e.__classPrivateFieldSet(this,n,this.createModal({"data-id":"delete-email"}),"f"),e.__classPrivateFieldSet(this,c,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,n,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",_).bind(this),e.__classPrivateFieldGet(this,l,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,n,"f").setContent(o({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.emailUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.emailUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},w})),D=t.createSingletonMixin((a=>{var l,r,o;return o=class extends(t.compose(b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",r).call(this)}))}},l=new WeakSet,r=function(){this.logout=new s.ButtonDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>e.__awaiter(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},o})),E=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p;return p=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.nameUserAttr.value=e})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,R(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),R)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,l=new WeakSet,h=function(){this.nameUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-name"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),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})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.nameUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.nameUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},p})),O=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u;return u=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),v.set(this,t.withMemCache((e=>{this.passkeyUserAuthMethod.fulfilled=e})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",n).call(this),e.__classPrivateFieldGet(this,v,"f").call(this,W(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),W)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,l=new WeakSet,n=function(){this.passkeyUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"passkey"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getMe()}))},h=function(){this.passkeyUserAuthMethod=new s.UserAuthMethodDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},u})),L=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v;return v=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",n).call(this)}))}},r=new WeakMap,d=new WeakMap,l=new WeakSet,n=function(){this.passwordUserAuthMethod.flowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"password"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",c).bind(this),e.__classPrivateFieldGet(this,l,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e.__classPrivateFieldGet(this,d,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close()}))},h=function(){this.passwordUserAuthMethod=new s.UserAuthMethodDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()}))},v})),N=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f,p,w;return w=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),r.set(this,void 0),d.set(this,void 0),n.set(this,void 0),c.set(this,void 0),f.set(this,t.withMemCache((e=>{this.phoneUserAttr.value=e}))),p.set(this,t.withMemCache((e=>{this.phoneUserAttr.badgeLabel=e?"":"Unverified"})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,l,"m",g).call(this),e.__classPrivateFieldGet(this,l,"m",h).call(this),e.__classPrivateFieldGet(this,l,"m",u).call(this),e.__classPrivateFieldGet(this,f,"f").call(this,x(this.state)),e.__classPrivateFieldGet(this,p,"f").call(this,k(this.state)),this.subscribe(e.__classPrivateFieldGet(this,f,"f").bind(this),x),this.subscribe(e.__classPrivateFieldGet(this,p,"f").bind(this),k)}))}},r=new WeakMap,d=new WeakMap,n=new WeakMap,c=new WeakMap,f=new WeakMap,p=new WeakMap,l=new WeakSet,h=function(){this.phoneUserAttr.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-phone"}),"f"),e.__classPrivateFieldSet(this,d,new s.FlowDriver((()=>{var t;return null===(t=e.__classPrivateFieldGet(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e.__classPrivateFieldGet(this,r,"f").afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this),e.__classPrivateFieldGet(this,l,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,d,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),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})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,n,"f").close(),this.actions.getMe()}))},g=function(){this.phoneUserAttr=new s.UserAttributeDriver((()=>{var e;return null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t||t.open()})),this.phoneUserAttr.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,n,"f"))||void 0===t||t.open()}))},w}));var $;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}($||($={}));const B=t.createSingletonMixin((a=>{var l,r,d,n,c,h,v,u,_,g,f;return r=class extends(t.compose(j,b,i.loggerMixin,I,i.modalMixin)(a)){constructor(){super(...arguments),l.add(this),d.set(this,{}),n.set(this,{}),c.set(this,{}),h.set(this,{}),_.set(this,t.withMemCache((t=>{var i;const a=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(a).forEach((i=>{const a=i.getAttribute("data-id").replace("customAttributes.",""),o=i.getAttribute("data-type")||$.TEXT,d=t[a],n=new s.UserAttributeDriver(i,{logger:this.logger});n.value=r.getFormattedValue(o,d),e.__classPrivateFieldGet(this,l,"m",g).call(this,i,a,n),e.__classPrivateFieldGet(this,l,"m",f).call(this,i,a,n)}))})))}static getFormattedValue(e,t){return e===$.DATE&&t?new Date(t).toLocaleString():e===$.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString()}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return e.__awaiter(this,void 0,void 0,(function*(){var i;yield null===(i=t.onWidgetRootReady)||void 0===i?void 0:i.call(this),e.__classPrivateFieldGet(this,_,"f").call(this,C(this.state)),this.subscribe(e.__classPrivateFieldGet(this,_,"f").bind(this),C)}))}},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})),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})),null===(s=e.__classPrivateFieldGet(this,h,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,c,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},g=function(t,i,a){const r=t.getAttribute("edit-flow-id");r&&(e.__classPrivateFieldGet(this,d,"f")[r]=this.createModal({"data-id":`edit-${i}`}),e.__classPrivateFieldGet(this,n,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,d,"f")[r].afterClose=e.__classPrivateFieldGet(this,l,"m",v).bind(this,r),a.onEditClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,l,"m",v).call(this,r),this.syncFlowTheme(e.__classPrivateFieldGet(this,n,"f")[r]))},f=function(t,i,a){const r=t.getAttribute("delete-flow-id");r&&(e.__classPrivateFieldGet(this,c,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e.__classPrivateFieldGet(this,h,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,c,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,c,"f")[r].afterClose=e.__classPrivateFieldGet(this,l,"m",u).bind(this,r),a.onDeleteClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,c,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,l,"m",u).call(this,r),this.syncFlowTheme(e.__classPrivateFieldGet(this,h,"f")[r]))},r})),V=t.createSingletonMixin((s=>class extends(t.compose(i.debuggerMixin,i.themeMixin,G,B,q,T,E,N,O,L,D)(s)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this)}))}})),H=t.compose((t=>class extends(V(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return e.__awaiter(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this);(customElements.get("descope-wc")||(yield import("@descope/web-component").then((e=>e.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.20"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",H),module.exports=H;
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* @descope/user-profile-widget v0.2.
|
|
3
|
+
* @descope/user-profile-widget v0.2.20
|
|
4
4
|
*/
|
|
5
|
-
import{__awaiter as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{createTemplate as s,kebabCase as o,createSingletonMixin as r,compose as n,withMemCache as a}from"@descope/sdk-helpers";import{projectIdMixin as l,observeAttributesMixin as d,loggerMixin as h,baseUrlMixin as c,createStateManagementMixin as u,initLifecycleMixin as f,modalMixin as v,staticResourcesMixin as g,createValidateAttributesMixin as p,descopeUiMixin as w,initElementMixin as b,themeMixin as m,debuggerMixin as U}from"@descope/sdk-mixins";import{FlowDriver as y,AvatarDriver as R,UserAttributeDriver as S,ButtonDriver as W,UserAuthMethodDriver as k}from"@descope/sdk-component-drivers";import{createAsyncThunk as M}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import C from"@descope/web-js-sdk";import{createSelector as I}from"reselect";import"@descope/web-component";const A=(t={})=>{const e=s("<descope-wc></descope-wc>");return Object.entries(t).forEach((([t,i])=>{e.content.querySelector("descope-wc").setAttribute(o(t),i)})),e};function j(t){return new URLSearchParams(window.location.search).get(t)}const x=t=>(...e)=>i=>{i.addCase(t.pending,((t,i)=>{e.forEach((({onPending:e})=>{null==e||e(t,i)}))})),i.addCase(t.fulfilled,((t,i)=>{e.forEach((({onFulfilled:e})=>{null==e||e(t,i)}))})),i.addCase(t.rejected,((t,i)=>{e.forEach((({onRejected:e})=>{null==e||e(t,i)}))}))},F=M("users/me",((t,{extra:{api:e}})=>e.user.me())),T=x(F)({onFulfilled:(t,e)=>{t.me.data=e.payload}},(E=t=>t.me,{onFulfilled:t=>{E(t).loading=!1},onPending:t=>{E(t).loading=!0,E(t).error=null},onRejected:(t,e)=>{E(t).loading=!1,E(t).error=e.error}}));var E;const O={action:F,reducer:T},q=M("users/logout",((t,{extra:{api:e}})=>e.user.logout())),P={action:q,reducer:x(q)({})},L={me:{loading:!1,error:null,data:{}}},N={me:"/v1/auth/me"},D=()=>t(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))})),$=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return D();const s=yield e.get(N.me);return yield(e=>t(void 0,void 0,void 0,(function*(){const t=yield e.text(),i=JSON.parse(t);if(!e.ok){const t=`${i.errorDescription}${i.errorMessage?`: ${i.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(i),e.text=()=>Promise.resolve(t)})))(s),s.json()}))}),B=r((s=>{var o,r,a,u;const f=n(l,d,h,c)(s);return u=class extends f{constructor(){super(...arguments),o.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return e(this,r,"f")||e(this,o,"m",a).call(this),e(this,r,"f")}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this),this.observeAttributes(["project-id","base-url"],(()=>{e(this,r,"f")&&e(this,o,"m",a).call(this)}))}))}},r=new WeakMap,o=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),i(this,r,((e,i,s)=>{const o=C(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.2.19"}}));return{user:Object.assign(Object.assign({},$({httpClient:o.httpClient,mock:i})),{logout:i?()=>t(void 0,void 0,void 0,(function*(){})):o.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},u})),H=r((t=>{const e=n(u({name:"widget",initialState:L,reducers:{},extraReducers:t=>{O.reducer(t),P.reducer(t)},asyncActions:{getMe:O.action,logout:P.action}}),f,h,B)(t);return class extends e{constructor(...t){super(...t),this.state=L,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),V="widget-flow",X=r((i=>{var s,o,r;return r=class extends(n(f,v,H,h)(i)){constructor(){super(...arguments),s.add(this)}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this);const r=j(V);r&&(!function(t){if(window.history.replaceState&&j(t)){const e=new URL(window.location.href),i=new URLSearchParams(e.search);i.delete(t),e.search=i.toString(),window.history.replaceState({},"",e.toString())}}(V),e(this,s,"m",o).call(this,r))}))}},s=new WeakSet,o=function(t){const e=this.createModal({"data-id":"redirect-flow"});e.setContent(A({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl}));new y((()=>{var t;return null===(t=e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{e.close(),this.actions.getMe()})),e.afterClose=()=>{e.remove()},e.open()},r})),G=t=>t.me.data,J=I(G,(t=>t.picture)),Y=I(G,(t=>t.email)),_=I(G,(t=>t.verifiedEmail)),z=I(G,(t=>t.name)),K=I(G,(t=>t.phone)),Q=I(G,(t=>t.verifiedPhone)),Z=I(G,(t=>t.webauthn));I(G,(t=>t.password));const tt=I(G,(t=>t.customAttributes)),et=r((e=>{const i=n(g,p({"widget-id":p.missingAttrValidator}))(e);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return t(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),it=r((i=>{var o,r,a;return a=class extends(n(h,f,w,b,et,H)(i)){constructor(){super(...arguments),o.add(this)}onWidgetRootReady(){return t(this,void 0,void 0,(function*(){}))}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this),yield Promise.all([this.actions.getMe(),e(this,o,"m",r).call(this)]),this.onWidgetRootReady()}))}},o=new WeakSet,r=function(){return t(this,void 0,void 0,(function*(){const t=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(t),this.contentRootElement.append(t.content.cloneNode(!0))}))},a})),st=r((t=>class extends(n(m,d)(t)){syncFlowTheme(t){t.theme=this.theme,this.observeAttributes(["theme"],(()=>{t.theme=this.theme}))}})),ot=r((s=>{var o,r,l,d,c,u,f,g,p;return p=class extends(n(st,m,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),f.set(this,a((t=>{this.avatar.image=t}))),g.set(this,a((t=>{this.avatar.displayName=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",u).call(this),e(this,o,"m",d).call(this),e(this,f,"f").call(this,J(this.state)),e(this,g,"f").call(this,z(this.state)),this.subscribe(e(this,f,"f").bind(this),J),this.subscribe(e(this,g,"f").bind(this),z)}))}},r=new WeakMap,l=new WeakMap,f=new WeakMap,g=new WeakMap,o=new WeakSet,d=function(){this.avatar.flowId&&(i(this,r,this.createModal({"data-id":"update-pic"}),"f"),i(this,l,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",c).bind(this),e(this,o,"m",c).call(this),this.syncFlowTheme(e(this,l,"f")))},c=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.avatar=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},p})),rt=r((s=>{var o,r,l,d,c,u,f,g,p,w,b,m,U;return U=class extends(n(st,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),b.set(this,a((t=>{this.emailUserAttr.value=t}))),m.set(this,a((t=>{this.emailUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,b,"f").call(this,Y(this.state)),e(this,m,"f").call(this,_(this.state)),this.subscribe(e(this,b,"f").bind(this),Y),this.subscribe(e(this,m,"f").bind(this),_)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,b=new WeakMap,m=new WeakMap,o=new WeakSet,u=function(){this.emailUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-email"}),"f"),i(this,l,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.emailUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-email"}),"f"),i(this,c,new y((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(A({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.emailUserAttr=new S((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.emailUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},U})),nt=r((i=>{var s,o,r;return r=class extends(n(H,h,it,v)(i)){constructor(){super(...arguments),s.add(this)}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,s,"m",o).call(this)}))}},s=new WeakSet,o=function(){this.logout=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>t(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},r})),at=r((s=>{var o,r,l,d,c,u,f,g,p,w,b,m;return m=class extends(n(st,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),b.set(this,a((t=>{this.nameUserAttr.value=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,b,"f").call(this,z(this.state)),this.subscribe(e(this,b,"f").bind(this),z)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,b=new WeakMap,o=new WeakSet,u=function(){this.nameUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-name"}),"f"),i(this,l,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.nameUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-name"}),"f"),i(this,c,new y((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(A({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.nameUserAttr=new S((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.nameUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},m})),lt=r((s=>{var o,r,l,d,c,u,f,g;return g=class extends(n(st,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),f.set(this,a((t=>{this.passkeyUserAuthMethod.fulfilled=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",u).call(this),e(this,o,"m",d).call(this),e(this,f,"f").call(this,Z(this.state)),this.subscribe(e(this,f,"f").bind(this),Z)}))}},r=new WeakMap,l=new WeakMap,f=new WeakMap,o=new WeakSet,d=function(){this.passkeyUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"passkey"}),"f"),i(this,l,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",c).bind(this),e(this,o,"m",c).call(this),this.syncFlowTheme(e(this,l,"f")))},c=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.passkeyUserAuthMethod=new k((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},g})),dt=r((s=>{var o,r,a,l,d,c,u;return u=class extends(n(st,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),a.set(this,void 0)}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",c).call(this),e(this,o,"m",l).call(this)}))}},r=new WeakMap,a=new WeakMap,o=new WeakSet,l=function(){this.passwordUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"password"}),"f"),i(this,a,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",d).bind(this),e(this,o,"m",d).call(this),this.syncFlowTheme(e(this,a,"f")))},d=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,a,"f").onSuccess((()=>{e(this,r,"f").close()}))},c=function(){this.passwordUserAuthMethod=new k((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},u})),ht=r((s=>{var o,r,l,d,c,u,f,g,p,w,b,m,U;return U=class extends(n(st,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),b.set(this,a((t=>{this.phoneUserAttr.value=t}))),m.set(this,a((t=>{this.phoneUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,b,"f").call(this,K(this.state)),e(this,m,"f").call(this,Q(this.state)),this.subscribe(e(this,b,"f").bind(this),K),this.subscribe(e(this,m,"f").bind(this),Q)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,b=new WeakMap,m=new WeakMap,o=new WeakSet,u=function(){this.phoneUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-phone"}),"f"),i(this,l,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.phoneUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-phone"}),"f"),i(this,c,new y((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(A({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.phoneUserAttr=new S((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.phoneUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},U}));var ct;!function(t){t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t.SINGLE_SELECT="singleSelect",t.ARRAY="array",t.DATE="date"}(ct||(ct={}));const ut=r((i=>{var s,o,r,l,d,c,u,f,g,p,w;return o=class extends(n(st,H,h,it,v)(i)){constructor(){super(...arguments),s.add(this),r.set(this,{}),l.set(this,{}),d.set(this,{}),c.set(this,{}),g.set(this,a((t=>{var i;const r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(r).forEach((i=>{const r=i.getAttribute("data-id").replace("customAttributes.",""),n=i.getAttribute("data-type")||ct.TEXT,a=t[r],l=new S(i,{logger:this.logger});l.value=o.getFormattedValue(n,a),e(this,s,"m",p).call(this,i,r,l),e(this,s,"m",w).call(this,i,r,l)}))})))}static getFormattedValue(t,e){return t===ct.DATE&&e?new Date(e).toLocaleString():t===ct.BOOLEAN&&void 0!==e?e?"True":"False":(e||"").toString()}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,g,"f").call(this,tt(this.state)),this.subscribe(e(this,g,"f").bind(this),tt)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,g=new WeakMap,s=new WeakSet,u=function(t){var i,s;null===(i=e(this,r,"f")[t])||void 0===i||i.setContent(A({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),null===(s=e(this,l,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,r,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},f=function(t){var i,s;null===(i=e(this,d,"f")[t])||void 0===i||i.setContent(A({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),null===(s=e(this,c,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,d,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},p=function(t,i,o){const n=t.getAttribute("edit-flow-id");n&&(e(this,r,"f")[n]=this.createModal({"data-id":`edit-${i}`}),e(this,l,"f")[n]=new y((()=>{var t,i;return null===(i=null===(t=e(this,r,"f")[n])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,r,"f")[n].afterClose=e(this,s,"m",u).bind(this,n),o.onEditClick((()=>{var t,i;null===(i=null===(t=e(this,r,"f"))||void 0===t?void 0:t[n])||void 0===i||i.open()})),e(this,s,"m",u).call(this,n),this.syncFlowTheme(e(this,l,"f")[n]))},w=function(t,i,o){const r=t.getAttribute("delete-flow-id");r&&(e(this,d,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e(this,c,"f")[r]=new y((()=>{var t,i;return null===(i=null===(t=e(this,d,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,d,"f")[r].afterClose=e(this,s,"m",f).bind(this,r),o.onDeleteClick((()=>{var t,i;null===(i=null===(t=e(this,d,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e(this,s,"m",f).call(this,r),this.syncFlowTheme(e(this,c,"f")[r]))},o})),ft=r((e=>class extends(n(U,m,X,ut,rt,ot,at,ht,lt,dt,nt)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),vt=n((e=>class extends(ft(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this);(customElements.get("descope-wc")||(yield import("@descope/web-component").then((t=>t.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.19"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",vt);export{vt as default};
|
|
5
|
+
import{__awaiter as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{createTemplate as s,kebabCase as o,createSingletonMixin as r,compose as n,withMemCache as a}from"@descope/sdk-helpers";import{projectIdMixin as l,observeAttributesMixin as d,loggerMixin as h,baseUrlMixin as c,createStateManagementMixin as u,initLifecycleMixin as f,modalMixin as v,staticResourcesMixin as g,createValidateAttributesMixin as p,descopeUiMixin as w,initElementMixin as b,themeMixin as m,debuggerMixin as U}from"@descope/sdk-mixins";import{FlowDriver as y,AvatarDriver as R,UserAttributeDriver as S,ButtonDriver as W,UserAuthMethodDriver as k}from"@descope/sdk-component-drivers";import{createAsyncThunk as M}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import C from"@descope/web-js-sdk";import{createSelector as I}from"reselect";import"@descope/web-component";const A=(t={})=>{const e=s("<descope-wc></descope-wc>");return Object.entries(t).forEach((([t,i])=>{e.content.querySelector("descope-wc").setAttribute(o(t),i)})),e};function j(t){return new URLSearchParams(window.location.search).get(t)}const x=t=>(...e)=>i=>{i.addCase(t.pending,((t,i)=>{e.forEach((({onPending:e})=>{null==e||e(t,i)}))})),i.addCase(t.fulfilled,((t,i)=>{e.forEach((({onFulfilled:e})=>{null==e||e(t,i)}))})),i.addCase(t.rejected,((t,i)=>{e.forEach((({onRejected:e})=>{null==e||e(t,i)}))}))},F=M("users/me",((t,{extra:{api:e}})=>e.user.me())),T=x(F)({onFulfilled:(t,e)=>{t.me.data=e.payload}},(E=t=>t.me,{onFulfilled:t=>{E(t).loading=!1},onPending:t=>{E(t).loading=!0,E(t).error=null},onRejected:(t,e)=>{E(t).loading=!1,E(t).error=e.error}}));var E;const O={action:F,reducer:T},q=M("users/logout",((t,{extra:{api:e}})=>e.user.logout())),P={action:q,reducer:x(q)({})},L={me:{loading:!1,error:null,data:{}}},N={me:"/v1/auth/me"},D=()=>t(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({loginIds:["user@company.com"],externalIds:["user@company.com"],userId:"user-1",name:"Test User",email:"user@company.com",roleNames:["Role"],phone:"+1-202-555-010",verifiedEmail:!0,verifiedPhone:!0,userTenants:[],status:"enabled",editable:!0,createdTime:(new Date).getTime(),customAttributes:{},familyName:"",givenName:"",middleName:"",picture:void 0,password:!0,SAML:!1,test:!1,TOTP:!1,webauthn:!0})}))})),$=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return D();const s=yield e.get(N.me);return yield(e=>t(void 0,void 0,void 0,(function*(){const t=yield e.text(),i=JSON.parse(t);if(!e.ok){const t=`${i.errorDescription}${i.errorMessage?`: ${i.errorMessage}`:""}`;throw Error(t||`${e.status} ${e.statusText}`)}e.json=()=>Promise.resolve(i),e.text=()=>Promise.resolve(t)})))(s),s.json()}))}),B=r((s=>{var o,r,a,u;const f=n(l,d,h,c)(s);return u=class extends f{constructor(){super(...arguments),o.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return e(this,r,"f")||e(this,o,"m",a).call(this),e(this,r,"f")}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this),this.observeAttributes(["project-id","base-url"],(()=>{e(this,r,"f")&&e(this,o,"m",a).call(this)}))}))}},r=new WeakMap,o=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),i(this,r,((e,i,s)=>{const o=C(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.2.20"}}));return{user:Object.assign(Object.assign({},$({httpClient:o.httpClient,mock:i})),{logout:i?()=>t(void 0,void 0,void 0,(function*(){})):o.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},u})),H=r((t=>{const e=n(u({name:"widget",initialState:L,reducers:{},extraReducers:t=>{O.reducer(t),P.reducer(t)},asyncActions:{getMe:O.action,logout:P.action}}),f,h,B)(t);return class extends e{constructor(...t){super(...t),this.state=L,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),V="widget-flow",X=r((i=>{var s,o,r;return r=class extends(n(f,v,H,h)(i)){constructor(){super(...arguments),s.add(this)}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this);const r=j(V);r&&(!function(t){if(window.history.replaceState&&j(t)){const e=new URL(window.location.href),i=new URLSearchParams(e.search);i.delete(t),e.search=i.toString(),window.history.replaceState({},"",e.toString())}}(V),e(this,s,"m",o).call(this,r))}))}},s=new WeakSet,o=function(t){const e=this.createModal({"data-id":"redirect-flow"});e.setContent(A({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl}));new y((()=>{var t;return null===(t=e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{e.close(),this.actions.getMe()})),e.afterClose=()=>{e.remove()},e.open()},r})),G=t=>t.me.data,J=I(G,(t=>t.picture)),Y=I(G,(t=>t.email)),_=I(G,(t=>t.verifiedEmail)),z=I(G,(t=>t.name)),K=I(G,(t=>t.phone)),Q=I(G,(t=>t.verifiedPhone)),Z=I(G,(t=>t.webauthn));I(G,(t=>t.password));const tt=I(G,(t=>t.customAttributes)),et=r((e=>{const i=n(g,p({"widget-id":p.missingAttrValidator}))(e);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return t(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}})),it=r((i=>{var o,r,a;return a=class extends(n(h,f,w,b,et,H)(i)){constructor(){super(...arguments),o.add(this)}onWidgetRootReady(){return t(this,void 0,void 0,(function*(){}))}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this),yield Promise.all([this.actions.getMe(),e(this,o,"m",r).call(this)]),this.onWidgetRootReady()}))}},o=new WeakSet,r=function(){return t(this,void 0,void 0,(function*(){const t=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(t),this.contentRootElement.append(t.content.cloneNode(!0))}))},a})),st=r((t=>class extends(n(m,d)(t)){syncFlowTheme(t){t.theme=this.theme,this.observeAttributes(["theme"],(()=>{t.theme=this.theme}))}})),ot=r((s=>{var o,r,l,d,c,u,f,g,p;return p=class extends(n(st,m,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),f.set(this,a((t=>{this.avatar.image=t}))),g.set(this,a((t=>{this.avatar.displayName=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",u).call(this),e(this,o,"m",d).call(this),e(this,f,"f").call(this,J(this.state)),e(this,g,"f").call(this,z(this.state)),this.subscribe(e(this,f,"f").bind(this),J),this.subscribe(e(this,g,"f").bind(this),z)}))}},r=new WeakMap,l=new WeakMap,f=new WeakMap,g=new WeakMap,o=new WeakSet,d=function(){this.avatar.flowId&&(i(this,r,this.createModal({"data-id":"update-pic"}),"f"),i(this,l,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",c).bind(this),e(this,o,"m",c).call(this),this.syncFlowTheme(e(this,l,"f")))},c=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.avatar=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},p})),rt=r((s=>{var o,r,l,d,c,u,f,g,p,w,b,m,U;return U=class extends(n(st,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),b.set(this,a((t=>{this.emailUserAttr.value=t}))),m.set(this,a((t=>{this.emailUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,b,"f").call(this,Y(this.state)),e(this,m,"f").call(this,_(this.state)),this.subscribe(e(this,b,"f").bind(this),Y),this.subscribe(e(this,m,"f").bind(this),_)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,b=new WeakMap,m=new WeakMap,o=new WeakSet,u=function(){this.emailUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-email"}),"f"),i(this,l,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.emailUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-email"}),"f"),i(this,c,new y((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(A({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.emailUserAttr=new S((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.emailUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},U})),nt=r((i=>{var s,o,r;return r=class extends(n(H,h,it,v)(i)){constructor(){super(...arguments),s.add(this)}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,s,"m",o).call(this)}))}},s=new WeakSet,o=function(){this.logout=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-button[data-id="logout"]')}),{logger:this.logger}),this.logout.onClick((()=>t(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},r})),at=r((s=>{var o,r,l,d,c,u,f,g,p,w,b,m;return m=class extends(n(st,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),b.set(this,a((t=>{this.nameUserAttr.value=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,b,"f").call(this,z(this.state)),this.subscribe(e(this,b,"f").bind(this),z)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,b=new WeakMap,o=new WeakSet,u=function(){this.nameUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-name"}),"f"),i(this,l,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.nameUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-name"}),"f"),i(this,c,new y((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(A({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.nameUserAttr=new S((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.nameUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},m})),lt=r((s=>{var o,r,l,d,c,u,f,g;return g=class extends(n(st,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),f.set(this,a((t=>{this.passkeyUserAuthMethod.fulfilled=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",u).call(this),e(this,o,"m",d).call(this),e(this,f,"f").call(this,Z(this.state)),this.subscribe(e(this,f,"f").bind(this),Z)}))}},r=new WeakMap,l=new WeakMap,f=new WeakMap,o=new WeakSet,d=function(){this.passkeyUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"passkey"}),"f"),i(this,l,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",c).bind(this),e(this,o,"m",c).call(this),this.syncFlowTheme(e(this,l,"f")))},c=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.passkeyUserAuthMethod=new k((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},g})),dt=r((s=>{var o,r,a,l,d,c,u;return u=class extends(n(st,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),a.set(this,void 0)}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",c).call(this),e(this,o,"m",l).call(this)}))}},r=new WeakMap,a=new WeakMap,o=new WeakSet,l=function(){this.passwordUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"password"}),"f"),i(this,a,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",d).bind(this),e(this,o,"m",d).call(this),this.syncFlowTheme(e(this,a,"f")))},d=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,a,"f").onSuccess((()=>{e(this,r,"f").close()}))},c=function(){this.passwordUserAuthMethod=new k((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},u})),ht=r((s=>{var o,r,l,d,c,u,f,g,p,w,b,m,U;return U=class extends(n(st,H,h,it,v)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),b.set(this,a((t=>{this.phoneUserAttr.value=t}))),m.set(this,a((t=>{this.phoneUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",g).call(this),e(this,b,"f").call(this,K(this.state)),e(this,m,"f").call(this,Q(this.state)),this.subscribe(e(this,b,"f").bind(this),K),this.subscribe(e(this,m,"f").bind(this),Q)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,b=new WeakMap,m=new WeakMap,o=new WeakSet,u=function(){this.phoneUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-phone"}),"f"),i(this,l,new y((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,r,"f").afterClose=e(this,o,"m",f).bind(this),e(this,o,"m",f).call(this),this.syncFlowTheme(e(this,l,"f")))},f=function(){e(this,r,"f").setContent(A({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,l,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},g=function(){this.phoneUserAttr.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-phone"}),"f"),i(this,c,new y((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").afterClose=e(this,o,"m",p).bind(this),e(this,o,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,d,"f").setContent(A({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getMe()}))},w=function(){this.phoneUserAttr=new S((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.phoneUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},U}));var ct;!function(t){t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t.SINGLE_SELECT="singleSelect",t.ARRAY="array",t.DATE="date"}(ct||(ct={}));const ut=r((i=>{var s,o,r,l,d,c,u,f,g,p,w;return o=class extends(n(st,H,h,it,v)(i)){constructor(){super(...arguments),s.add(this),r.set(this,{}),l.set(this,{}),d.set(this,{}),c.set(this,{}),g.set(this,a((t=>{var i;const r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(r).forEach((i=>{const r=i.getAttribute("data-id").replace("customAttributes.",""),n=i.getAttribute("data-type")||ct.TEXT,a=t[r],l=new S(i,{logger:this.logger});l.value=o.getFormattedValue(n,a),e(this,s,"m",p).call(this,i,r,l),e(this,s,"m",w).call(this,i,r,l)}))})))}static getFormattedValue(t,e){return t===ct.DATE&&e?new Date(e).toLocaleString():t===ct.BOOLEAN&&void 0!==e?e?"True":"False":(e||"").toString()}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,g,"f").call(this,tt(this.state)),this.subscribe(e(this,g,"f").bind(this),tt)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,g=new WeakMap,s=new WeakSet,u=function(t){var i,s;null===(i=e(this,r,"f")[t])||void 0===i||i.setContent(A({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),null===(s=e(this,l,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,r,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},f=function(t){var i,s;null===(i=e(this,d,"f")[t])||void 0===i||i.setContent(A({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl})),null===(s=e(this,c,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,d,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},p=function(t,i,o){const n=t.getAttribute("edit-flow-id");n&&(e(this,r,"f")[n]=this.createModal({"data-id":`edit-${i}`}),e(this,l,"f")[n]=new y((()=>{var t,i;return null===(i=null===(t=e(this,r,"f")[n])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,r,"f")[n].afterClose=e(this,s,"m",u).bind(this,n),o.onEditClick((()=>{var t,i;null===(i=null===(t=e(this,r,"f"))||void 0===t?void 0:t[n])||void 0===i||i.open()})),e(this,s,"m",u).call(this,n),this.syncFlowTheme(e(this,l,"f")[n]))},w=function(t,i,o){const r=t.getAttribute("delete-flow-id");r&&(e(this,d,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e(this,c,"f")[r]=new y((()=>{var t,i;return null===(i=null===(t=e(this,d,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,d,"f")[r].afterClose=e(this,s,"m",f).bind(this,r),o.onDeleteClick((()=>{var t,i;null===(i=null===(t=e(this,d,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e(this,s,"m",f).call(this,r),this.syncFlowTheme(e(this,c,"f")[r]))},o})),ft=r((e=>class extends(n(U,m,X,ut,rt,ot,at,ht,lt,dt,nt)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),vt=n((e=>class extends(ft(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this);(customElements.get("descope-wc")||(yield import("@descope/web-component").then((t=>t.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.20"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",vt);export{vt as default};
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ declare const UserProfileWidget: {
|
|
|
18
18
|
logout: _descope_sdk_component_drivers.ButtonDriver;
|
|
19
19
|
"__#10@#initLogout"(): void;
|
|
20
20
|
onWidgetRootReady: (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>);
|
|
21
|
-
"__#
|
|
21
|
+
"__#27136@#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
|
+
"__#27135@#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
|
+
"__#27133@#private": any;
|
|
39
39
|
logger: {
|
|
40
40
|
error(...data: any[]): void;
|
|
41
41
|
warn(...data: any[]): void;
|
|
@@ -46,24 +46,24 @@ declare const UserProfileWidget: {
|
|
|
46
46
|
readonly ele: Element;
|
|
47
47
|
};
|
|
48
48
|
createModal(config?: Record<string, string>): _descope_sdk_component_drivers.ModalDriver;
|
|
49
|
-
"__#
|
|
50
|
-
"__#
|
|
51
|
-
"__#
|
|
52
|
-
"__#
|
|
53
|
-
"__#
|
|
54
|
-
"__#
|
|
55
|
-
"__#
|
|
56
|
-
"__#
|
|
49
|
+
"__#27132@#errorCbsSym": symbol;
|
|
50
|
+
"__#27132@#loadCbsSym": symbol;
|
|
51
|
+
"__#27132@#getComponentsVersion": (() => Promise<string>) & (() => Promise<string>) & (() => Promise<string>);
|
|
52
|
+
"__#27132@#exposeAlternateEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
|
|
53
|
+
"__#27132@#handleFallbackScript": ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[], elemId: string, scriptUrl: string) => Promise<void>) & ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[], elemId: string, scriptUrl: string) => Promise<void>) & ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[], elemId: string, scriptUrl: string) => Promise<void>);
|
|
54
|
+
"__#27132@#registerEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
|
|
55
|
+
"__#27132@#getDescopeUiLoadingScript": (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>);
|
|
56
|
+
"__#27132@#descopeUi": Promise<any>;
|
|
57
57
|
readonly descopeUi: Promise<any>;
|
|
58
|
-
"__#
|
|
58
|
+
"__#27132@#loadDescopeUiComponent": ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>);
|
|
59
59
|
loadDescopeUiComponents: ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>) & ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>) & ((templateOrComponentNames: string[] | HTMLTemplateElement) => Promise<any[]>);
|
|
60
|
-
"__#
|
|
60
|
+
"__#27132@#getDescopeUi": (() => Promise<unknown>) & (() => Promise<unknown>) & (() => Promise<unknown>);
|
|
61
61
|
readonly baseCdnUrl: string;
|
|
62
62
|
readonly config: Promise<_descope_sdk_mixins.Config>;
|
|
63
|
-
"__#
|
|
64
|
-
"__#
|
|
65
|
-
"__#
|
|
66
|
-
"__#
|
|
63
|
+
"__#27129@#configCacheClear": (() => void) & (() => void) & (() => void) & (() => void);
|
|
64
|
+
"__#27129@#_configResource": Promise<_descope_sdk_mixins.Config>;
|
|
65
|
+
"__#27129@#fetchConfig": (() => Promise<_descope_sdk_mixins.Config>) & (() => Promise<_descope_sdk_mixins.Config>) & (() => Promise<_descope_sdk_mixins.Config>) & (() => Promise<_descope_sdk_mixins.Config>);
|
|
66
|
+
"__#27124@#isInit": boolean;
|
|
67
67
|
connectedCallback: (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & {
|
|
68
68
|
(): void;
|
|
69
69
|
(): void;
|
|
@@ -975,20 +975,20 @@ declare const UserProfileWidget: {
|
|
|
975
975
|
tabIndex: number;
|
|
976
976
|
blur: (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void);
|
|
977
977
|
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);
|
|
978
|
-
"__#
|
|
978
|
+
"__#27128@#callbacks": Map<string, () => void> & Map<string, () => void> & Map<string, () => void> & Map<string, () => void>;
|
|
979
979
|
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);
|
|
980
980
|
reset: ((...sectionIds: string[]) => Promise<void>) & ((...sectionIds: string[]) => Promise<void>) & ((...sectionIds: string[]) => Promise<void>) & ((...sectionIds: string[]) => Promise<void>);
|
|
981
|
-
"__#
|
|
982
|
-
"__#
|
|
981
|
+
"__#27126@#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);
|
|
982
|
+
"__#27125@#observeMappings": {};
|
|
983
983
|
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);
|
|
984
984
|
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);
|
|
985
|
-
"__#
|
|
986
|
-
"__#
|
|
985
|
+
"__#27123@#logger": _descope_sdk_mixins.Logger;
|
|
986
|
+
"__#27123@#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);
|
|
987
987
|
logger: _descope_sdk_mixins.Logger;
|
|
988
988
|
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", args: any[]) => void);
|
|
989
|
-
"__#
|
|
990
|
-
"__#
|
|
991
|
-
"__#
|
|
989
|
+
"__#27127@#lastBaseUrl"?: string;
|
|
990
|
+
"__#27127@#workingBaseUrl"?: string;
|
|
991
|
+
"__#27127@#getResourceUrls": ((filename: string) => (URL & {
|
|
992
992
|
baseUrl: string;
|
|
993
993
|
}) | (URL & {
|
|
994
994
|
baseUrl: string;
|
|
@@ -1659,22 +1659,22 @@ declare const UserProfileWidget: {
|
|
|
1659
1659
|
"__#13@#initModalContent"(): void;
|
|
1660
1660
|
"__#13@#initPhoneUserAttr"(): void;
|
|
1661
1661
|
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);
|
|
1662
|
-
"__#
|
|
1662
|
+
"__#27138@#globalStyleTag": HTMLStyleElement;
|
|
1663
1663
|
readonly theme: _descope_sdk_mixins.ThemeOptions;
|
|
1664
1664
|
readonly styleId: string;
|
|
1665
|
-
"__#
|
|
1666
|
-
"__#
|
|
1667
|
-
readonly "__#
|
|
1668
|
-
"__#
|
|
1669
|
-
"__#
|
|
1670
|
-
"__#
|
|
1665
|
+
"__#27138@#_themeResource": Promise<void | Record<string, any>>;
|
|
1666
|
+
"__#27138@#fetchTheme"(): Promise<Record<string, any>>;
|
|
1667
|
+
readonly "__#27138@#themeResource": Promise<void | Record<string, any>>;
|
|
1668
|
+
"__#27138@#loadGlobalStyle"(): Promise<void>;
|
|
1669
|
+
"__#27138@#loadComponentsStyle"(): Promise<void>;
|
|
1670
|
+
"__#27138@#getFontsConfig"(): Promise<Record<string, {
|
|
1671
1671
|
url?: string;
|
|
1672
1672
|
}>>;
|
|
1673
|
-
"__#
|
|
1674
|
-
"__#
|
|
1675
|
-
"__#
|
|
1676
|
-
"__#
|
|
1677
|
-
"__#
|
|
1673
|
+
"__#27138@#loadFonts"(): Promise<void>;
|
|
1674
|
+
"__#27138@#applyTheme"(): Promise<void>;
|
|
1675
|
+
"__#27138@#onThemeChange": () => void;
|
|
1676
|
+
"__#27138@#loadTheme"(): void;
|
|
1677
|
+
"__#27138@#toggleOsThemeChangeListener": (listen: boolean) => void;
|
|
1678
1678
|
passkeyUserAuthMethod: _descope_sdk_component_drivers.UserAuthMethodDriver;
|
|
1679
1679
|
"__#12@#modal": _descope_sdk_component_drivers.ModalDriver;
|
|
1680
1680
|
"__#12@#flow": _descope_sdk_component_drivers.FlowDriver;
|
|
@@ -1735,7 +1735,7 @@ declare const UserProfileWidget: {
|
|
|
1735
1735
|
"__#15@#initEditFlow"(nodeEle: Element, customAttrName: string, compInstance: _descope_sdk_component_drivers.UserAttributeDriver): void;
|
|
1736
1736
|
"__#15@#initDeleteFlow"(nodeEle: Element, customAttrName: string, compInstance: _descope_sdk_component_drivers.UserAttributeDriver): void;
|
|
1737
1737
|
"__#6@#createFlowRedirectModal"(widgetFlow: string): void;
|
|
1738
|
-
"__#
|
|
1738
|
+
"__#27131@#debuggerEle": HTMLElement & {
|
|
1739
1739
|
updateData: (data: {
|
|
1740
1740
|
title: string;
|
|
1741
1741
|
description?: string;
|
|
@@ -1744,11 +1744,11 @@ declare const UserProfileWidget: {
|
|
|
1744
1744
|
description?: string;
|
|
1745
1745
|
}[]) => void;
|
|
1746
1746
|
};
|
|
1747
|
-
"__#
|
|
1748
|
-
"__#
|
|
1747
|
+
"__#27131@#disableDebugger"(): void;
|
|
1748
|
+
"__#27131@#enableDebugger"(): Promise<void>;
|
|
1749
1749
|
readonly debug: boolean;
|
|
1750
|
-
"__#
|
|
1751
|
-
"__#
|
|
1750
|
+
"__#27131@#handleDebugMode"(): void;
|
|
1751
|
+
"__#27131@#updateDebuggerMessages"(title: string, description: string): void;
|
|
1752
1752
|
};
|
|
1753
1753
|
getFormattedValue(type: string, val: any): any;
|
|
1754
1754
|
};
|