@descope/user-profile-widget 0.0.97 → 0.0.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +2 -2
- package/dist/index.d.ts +37 -32
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* @descope/user-profile-widget v0.0.
|
|
3
|
+
* @descope/user-profile-widget v0.0.98
|
|
4
4
|
*/
|
|
5
|
-
import{__awaiter as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{createSingletonMixin as s,compose as o,createTemplate as r,kebabCase as n,withMemCache as a}from"@descope/sdk-helpers";import d from"@descope/web-component";import{projectIdMixin as l,observeAttributesMixin as h,loggerMixin as c,baseUrlMixin as u,createStateManagementMixin as f,initLifecycleMixin as g,staticResourcesMixin as v,createValidateAttributesMixin as p,descopeUiMixin as w,initElementMixin as m,modalMixin as b,baseStaticUrlMixin as y,debuggerMixin as R,themeMixin as U}from"@descope/sdk-mixins";import{FlowDriver as S,AvatarDriver as W,UserAttributeDriver as k,UserAuthMethodDriver as M,ButtonDriver as j}from"@descope/sdk-component-drivers";import{createSelector as I}from"reselect";import{createAsyncThunk as C}from"@reduxjs/toolkit";import A from"@descope/web-js-sdk";import"@descope/core-js-sdk";const x=t=>t.me.data,O=I(x,(t=>t.picture)),q=I(x,(t=>t.email)),E=I(x,(t=>t.verifiedEmail)),P=I(x,(t=>t.name)),F=I(x,(t=>t.phone)),T=I(x,(t=>t.verifiedPhone)),L=I(x,(t=>t.webauthn));I(x,(t=>t.password));const N=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)}))}))},$=C("users/me",((t,{extra:{api:e}})=>e.user.me())),D=N($)({onFulfilled:(t,e)=>{t.me.data=e.payload}},(H=t=>t.me,{onFulfilled:t=>{H(t).loading=!1},onPending:t=>{H(t).loading=!0,H(t).error=null},onRejected:(t,e)=>{H(t).loading=!1,H(t).error=e.error}}));var H;const B={action:$,reducer:D},J=C("users/logout",((t,{extra:{api:e}})=>e.user.logout())),V={action:J,reducer:N(J)({})},z={me:{loading:!1,error:null,data:{}}},G={me:"/v1/auth/me"},K=()=>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})}))})),Q=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return K();const s=yield e.get(G.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()}))}),X=s((s=>{var r,n,a,d;const f=o(l,h,c,u)(s);return d=class extends f{constructor(){super(...arguments),r.add(this),n.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return e(this,n,"f")||e(this,r,"m",a).call(this),e(this,n,"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,n,"f")&&e(this,r,"m",a).call(this)}))}))}},n=new WeakMap,r=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),i(this,n,((e,i,s)=>{const o=A(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.0.97"}}));return{user:Object.assign(Object.assign({},Q({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")},d})),Y=s((t=>{const e=o(f({name:"widget",initialState:z,reducers:{},extraReducers:t=>{B.reducer(t),V.reducer(t)},asyncActions:{getMe:B.action,logout:V.action}}),g,c,X)(t);return class extends e{constructor(...t){super(...t),this.state=z,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),Z=s((e=>{const i=o(v,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}))}}})),_=s((i=>{var s,n,a;return a=class extends(o(c,g,w,m,Z,Y)(i)){constructor(){super(...arguments),s.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,s,"m",n).call(this)]),this.onWidgetRootReady()}))}},s=new WeakSet,n=function(){return t(this,void 0,void 0,(function*(){const t=r(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(t),this.contentRootElement.append(t.content.cloneNode(!0))}))},a})),tt=(t={})=>{const e=r("<descope-wc></descope-wc>");return Object.entries(t).forEach((([t,i])=>{e.content.querySelector("descope-wc").setAttribute(n(t),i)})),e};function et(t){return new URLSearchParams(window.location.search).get(t)}const it=s((s=>{var r,n,d,l,h,u,f,g,v;return v=class extends(o(Y,c,_,b,y)(s)){constructor(){super(...arguments),r.add(this),n.set(this,void 0),d.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,r,"m",u).call(this),e(this,r,"m",l).call(this),e(this,f,"f").call(this,O(this.state)),e(this,g,"f").call(this,P(this.state)),this.subscribe(e(this,f,"f").bind(this),O),this.subscribe(e(this,g,"f").bind(this),P)}))}},n=new WeakMap,d=new WeakMap,f=new WeakMap,g=new WeakMap,r=new WeakSet,l=function(){i(this,n,this.createModal({"data-id":"update-pic"}),"f"),i(this,d,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",h).bind(this),e(this,r,"m",h).call(this)},h=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,n,"f").close(),this.actions.getMe()}))},u=function(){this.avatar=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{e(this,n,"f").open()}))},v})),st=s((s=>{var r,n,d,l,h,u,f,g,v,p,w,m,y;return y=class extends(o(Y,c,_,b)(s)){constructor(){super(...arguments),r.add(this),n.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),w.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,r,"m",p).call(this),e(this,r,"m",u).call(this),e(this,r,"m",g).call(this),e(this,w,"f").call(this,q(this.state)),e(this,m,"f").call(this,E(this.state)),this.subscribe(e(this,w,"f").bind(this),q),this.subscribe(e(this,m,"f").bind(this),E)}))}},n=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,w=new WeakMap,m=new WeakMap,r=new WeakSet,u=function(){i(this,n,this.createModal({"data-id":"edit-email"}),"f"),i(this,d,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",f).bind(this),e(this,r,"m",f).call(this)},f=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,n,"f").close(),this.actions.getMe()}))},g=function(){i(this,l,this.createModal({"data-id":"delete-email"}),"f"),i(this,h,new S((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,r,"m",v).bind(this),e(this,r,"m",v).call(this)},v=function(){e(this,l,"f").setContent(tt({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,h,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getMe()}))},p=function(){this.emailUserAttr=new k((()=>{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((()=>{e(this,n,"f").open()})),this.emailUserAttr.onDeleteClick((()=>{e(this,l,"f").open()}))},y})),ot=s((s=>{var r,n,d,l,h,u,f,g,v,p,w,m;return m=class extends(o(Y,c,_,b)(s)){constructor(){super(...arguments),r.add(this),n.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),w.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,r,"m",p).call(this),e(this,r,"m",u).call(this),e(this,r,"m",g).call(this),e(this,w,"f").call(this,P(this.state)),this.subscribe(e(this,w,"f").bind(this),P)}))}},n=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,w=new WeakMap,r=new WeakSet,u=function(){i(this,n,this.createModal({"data-id":"edit-name"}),"f"),i(this,d,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",f).bind(this),e(this,r,"m",f).call(this)},f=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,n,"f").close(),this.actions.getMe()}))},g=function(){i(this,l,this.createModal({"data-id":"delete-name"}),"f"),i(this,h,new S((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,r,"m",v).bind(this),e(this,r,"m",v).call(this)},v=function(){e(this,l,"f").setContent(tt({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,h,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getMe()}))},p=function(){this.nameUserAttr=new k((()=>{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((()=>{e(this,n,"f").open()})),this.nameUserAttr.onDeleteClick((()=>{e(this,l,"f").open()}))},m})),rt=s((s=>{var r,n,d,l,h,u,f,g,v,p,w,m,y;return y=class extends(o(Y,c,_,b)(s)){constructor(){super(...arguments),r.add(this),n.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),w.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,r,"m",p).call(this),e(this,r,"m",u).call(this),e(this,r,"m",g).call(this),e(this,w,"f").call(this,F(this.state)),e(this,m,"f").call(this,T(this.state)),this.subscribe(e(this,w,"f").bind(this),F),this.subscribe(e(this,m,"f").bind(this),T)}))}},n=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,w=new WeakMap,m=new WeakMap,r=new WeakSet,u=function(){i(this,n,this.createModal({"data-id":"edit-phone"}),"f"),i(this,d,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",f).bind(this),e(this,r,"m",f).call(this)},f=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,n,"f").close(),this.actions.getMe()}))},g=function(){i(this,l,this.createModal({"data-id":"delete-phone"}),"f"),i(this,h,new S((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,r,"m",v).bind(this),e(this,r,"m",v).call(this)},v=function(){e(this,l,"f").setContent(tt({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,h,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getMe()}))},p=function(){this.phoneUserAttr=new k((()=>{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((()=>{e(this,n,"f").open()})),this.phoneUserAttr.onDeleteClick((()=>{e(this,l,"f").open()}))},y})),nt=s((s=>{var r,n,d,l,h,u,f,g;return g=class extends(o(Y,c,_,b)(s)){constructor(){super(...arguments),r.add(this),n.set(this,void 0),d.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,r,"m",u).call(this),e(this,r,"m",l).call(this),e(this,f,"f").call(this,L(this.state)),this.subscribe(e(this,f,"f").bind(this),L)}))}},n=new WeakMap,d=new WeakMap,f=new WeakMap,r=new WeakSet,l=function(){i(this,n,this.createModal({"data-id":"passkey"}),"f"),i(this,d,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",h).bind(this),e(this,r,"m",h).call(this)},h=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,n,"f").close(),this.actions.getMe()}))},u=function(){this.passkeyUserAuthMethod=new M((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{e(this,n,"f").open()}))},g})),at=s((s=>{var r,n,a,d,l,h,u;return u=class extends(o(Y,c,_,b)(s)){constructor(){super(...arguments),r.add(this),n.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,r,"m",h).call(this),e(this,r,"m",d).call(this)}))}},n=new WeakMap,a=new WeakMap,r=new WeakSet,d=function(){i(this,n,this.createModal({"data-id":"password"}),"f"),i(this,a,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",l).bind(this),e(this,r,"m",l).call(this)},l=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,a,"f").onSuccess((()=>{e(this,n,"f").close()}))},h=function(){this.passwordUserAuthMethod=new M((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{e(this,n,"f").open()}))},u})),dt=s((i=>{var s,r,n;return n=class extends(o(Y,c,_,b)(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",r).call(this)}))}},s=new WeakSet,r=function(){this.logout=new j((()=>{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"))}))))},n})),lt="widget-flow",ht=s((i=>{var s,r,n;return n=class extends(o(g,b,Y,c)(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 o=et(lt);o&&(!function(t){if(window.history.replaceState&&et(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())}}(lt),e(this,s,"m",r).call(this,o))}))}},s=new WeakSet,r=function(t){const e=this.createModal({"data-id":"redirect-flow"});e.setContent(tt({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl}));new S((()=>{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()},n})),ct=s((e=>class extends(o(R,U,ht,st,it,ot,rt,nt,at,dt)(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)}))}})),ut=o((e=>class extends(ct(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),d.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.0.97"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",ut);export{ut as default};
|
|
5
|
+
import{__awaiter as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{createSingletonMixin as s,compose as o,createTemplate as r,kebabCase as n,withMemCache as a}from"@descope/sdk-helpers";import d from"@descope/web-component";import{projectIdMixin as l,observeAttributesMixin as h,loggerMixin as c,baseUrlMixin as u,createStateManagementMixin as f,initLifecycleMixin as g,staticResourcesMixin as v,createValidateAttributesMixin as p,descopeUiMixin as w,initElementMixin as m,modalMixin as b,baseStaticUrlMixin as y,debuggerMixin as R,themeMixin as U}from"@descope/sdk-mixins";import{FlowDriver as S,AvatarDriver as W,UserAttributeDriver as k,UserAuthMethodDriver as M,ButtonDriver as j}from"@descope/sdk-component-drivers";import{createSelector as I}from"reselect";import{createAsyncThunk as C}from"@reduxjs/toolkit";import A from"@descope/web-js-sdk";import"@descope/core-js-sdk";const x=t=>t.me.data,O=I(x,(t=>t.picture)),q=I(x,(t=>t.email)),E=I(x,(t=>t.verifiedEmail)),P=I(x,(t=>t.name)),F=I(x,(t=>t.phone)),T=I(x,(t=>t.verifiedPhone)),L=I(x,(t=>t.webauthn));I(x,(t=>t.password));const N=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)}))}))},$=C("users/me",((t,{extra:{api:e}})=>e.user.me())),D=N($)({onFulfilled:(t,e)=>{t.me.data=e.payload}},(H=t=>t.me,{onFulfilled:t=>{H(t).loading=!1},onPending:t=>{H(t).loading=!0,H(t).error=null},onRejected:(t,e)=>{H(t).loading=!1,H(t).error=e.error}}));var H;const B={action:$,reducer:D},J=C("users/logout",((t,{extra:{api:e}})=>e.user.logout())),V={action:J,reducer:N(J)({})},z={me:{loading:!1,error:null,data:{}}},G={me:"/v1/auth/me"},K=()=>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})}))})),Q=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return K();const s=yield e.get(G.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()}))}),X=s((s=>{var r,n,a,d;const f=o(l,h,c,u)(s);return d=class extends f{constructor(){super(...arguments),r.add(this),n.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return e(this,n,"f")||e(this,r,"m",a).call(this),e(this,n,"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,n,"f")&&e(this,r,"m",a).call(this)}))}))}},n=new WeakMap,r=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),i(this,n,((e,i,s)=>{const o=A(Object.assign(Object.assign({},e),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.0.98"}}));return{user:Object.assign(Object.assign({},Q({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")},d})),Y=s((t=>{const e=o(f({name:"widget",initialState:z,reducers:{},extraReducers:t=>{B.reducer(t),V.reducer(t)},asyncActions:{getMe:B.action,logout:V.action}}),g,c,X)(t);return class extends e{constructor(...t){super(...t),this.state=z,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),Z=s((e=>{const i=o(v,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}))}}})),_=s((i=>{var s,n,a;return a=class extends(o(c,g,w,m,Z,Y)(i)){constructor(){super(...arguments),s.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,s,"m",n).call(this)]),this.onWidgetRootReady()}))}},s=new WeakSet,n=function(){return t(this,void 0,void 0,(function*(){const t=r(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(t),this.contentRootElement.append(t.content.cloneNode(!0))}))},a})),tt=(t={})=>{const e=r("<descope-wc></descope-wc>");return Object.entries(t).forEach((([t,i])=>{e.content.querySelector("descope-wc").setAttribute(n(t),i)})),e};function et(t){return new URLSearchParams(window.location.search).get(t)}const it=s((s=>{var r,n,d,l,h,u,f,g,v;return v=class extends(o(Y,c,_,b,y)(s)){constructor(){super(...arguments),r.add(this),n.set(this,void 0),d.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,r,"m",u).call(this),e(this,r,"m",l).call(this),e(this,f,"f").call(this,O(this.state)),e(this,g,"f").call(this,P(this.state)),this.subscribe(e(this,f,"f").bind(this),O),this.subscribe(e(this,g,"f").bind(this),P)}))}},n=new WeakMap,d=new WeakMap,f=new WeakMap,g=new WeakMap,r=new WeakSet,l=function(){i(this,n,this.createModal({"data-id":"update-pic"}),"f"),i(this,d,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",h).bind(this),e(this,r,"m",h).call(this)},h=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,n,"f").close(),this.actions.getMe()}))},u=function(){this.avatar=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{e(this,n,"f").open()}))},v})),st=s((s=>{var r,n,d,l,h,u,f,g,v,p,w,m,y;return y=class extends(o(Y,c,_,b)(s)){constructor(){super(...arguments),r.add(this),n.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),w.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,r,"m",p).call(this),e(this,r,"m",u).call(this),e(this,r,"m",g).call(this),e(this,w,"f").call(this,q(this.state)),e(this,m,"f").call(this,E(this.state)),this.subscribe(e(this,w,"f").bind(this),q),this.subscribe(e(this,m,"f").bind(this),E)}))}},n=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,w=new WeakMap,m=new WeakMap,r=new WeakSet,u=function(){i(this,n,this.createModal({"data-id":"edit-email"}),"f"),i(this,d,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",f).bind(this),e(this,r,"m",f).call(this)},f=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,n,"f").close(),this.actions.getMe()}))},g=function(){i(this,l,this.createModal({"data-id":"delete-email"}),"f"),i(this,h,new S((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,r,"m",v).bind(this),e(this,r,"m",v).call(this)},v=function(){e(this,l,"f").setContent(tt({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,h,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getMe()}))},p=function(){this.emailUserAttr=new k((()=>{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((()=>{e(this,n,"f").open()})),this.emailUserAttr.onDeleteClick((()=>{e(this,l,"f").open()}))},y})),ot=s((s=>{var r,n,d,l,h,u,f,g,v,p,w,m;return m=class extends(o(Y,c,_,b)(s)){constructor(){super(...arguments),r.add(this),n.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),w.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,r,"m",p).call(this),e(this,r,"m",u).call(this),e(this,r,"m",g).call(this),e(this,w,"f").call(this,P(this.state)),this.subscribe(e(this,w,"f").bind(this),P)}))}},n=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,w=new WeakMap,r=new WeakSet,u=function(){i(this,n,this.createModal({"data-id":"edit-name"}),"f"),i(this,d,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",f).bind(this),e(this,r,"m",f).call(this)},f=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,n,"f").close(),this.actions.getMe()}))},g=function(){i(this,l,this.createModal({"data-id":"delete-name"}),"f"),i(this,h,new S((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,r,"m",v).bind(this),e(this,r,"m",v).call(this)},v=function(){e(this,l,"f").setContent(tt({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,h,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getMe()}))},p=function(){this.nameUserAttr=new k((()=>{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((()=>{e(this,n,"f").open()})),this.nameUserAttr.onDeleteClick((()=>{e(this,l,"f").open()}))},m})),rt=s((s=>{var r,n,d,l,h,u,f,g,v,p,w,m,y;return y=class extends(o(Y,c,_,b)(s)){constructor(){super(...arguments),r.add(this),n.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),w.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,r,"m",p).call(this),e(this,r,"m",u).call(this),e(this,r,"m",g).call(this),e(this,w,"f").call(this,F(this.state)),e(this,m,"f").call(this,T(this.state)),this.subscribe(e(this,w,"f").bind(this),F),this.subscribe(e(this,m,"f").bind(this),T)}))}},n=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,w=new WeakMap,m=new WeakMap,r=new WeakSet,u=function(){i(this,n,this.createModal({"data-id":"edit-phone"}),"f"),i(this,d,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",f).bind(this),e(this,r,"m",f).call(this)},f=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,n,"f").close(),this.actions.getMe()}))},g=function(){i(this,l,this.createModal({"data-id":"delete-phone"}),"f"),i(this,h,new S((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,r,"m",v).bind(this),e(this,r,"m",v).call(this)},v=function(){e(this,l,"f").setContent(tt({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,h,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getMe()}))},p=function(){this.phoneUserAttr=new k((()=>{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((()=>{e(this,n,"f").open()})),this.phoneUserAttr.onDeleteClick((()=>{e(this,l,"f").open()}))},y})),nt=s((s=>{var r,n,d,l,h,u,f,g;return g=class extends(o(Y,c,_,b)(s)){constructor(){super(...arguments),r.add(this),n.set(this,void 0),d.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,r,"m",u).call(this),e(this,r,"m",l).call(this),e(this,f,"f").call(this,L(this.state)),this.subscribe(e(this,f,"f").bind(this),L)}))}},n=new WeakMap,d=new WeakMap,f=new WeakMap,r=new WeakSet,l=function(){i(this,n,this.createModal({"data-id":"passkey"}),"f"),i(this,d,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",h).bind(this),e(this,r,"m",h).call(this)},h=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,n,"f").close(),this.actions.getMe()}))},u=function(){this.passkeyUserAuthMethod=new M((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{e(this,n,"f").open()}))},g})),at=s((s=>{var r,n,a,d,l,h,u;return u=class extends(o(Y,c,_,b)(s)){constructor(){super(...arguments),r.add(this),n.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,r,"m",h).call(this),e(this,r,"m",d).call(this)}))}},n=new WeakMap,a=new WeakMap,r=new WeakSet,d=function(){i(this,n,this.createModal({"data-id":"password"}),"f"),i(this,a,new S((()=>{var t;return null===(t=e(this,n,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,n,"f").afterClose=e(this,r,"m",l).bind(this),e(this,r,"m",l).call(this)},l=function(){e(this,n,"f").setContent(tt({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,a,"f").onSuccess((()=>{e(this,n,"f").close()}))},h=function(){this.passwordUserAuthMethod=new M((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{e(this,n,"f").open()}))},u})),dt=s((i=>{var s,r,n;return n=class extends(o(Y,c,_,b)(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",r).call(this)}))}},s=new WeakSet,r=function(){this.logout=new j((()=>{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"))}))))},n})),lt="widget-flow",ht=s((i=>{var s,r,n;return n=class extends(o(g,b,Y,c)(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 o=et(lt);o&&(!function(t){if(window.history.replaceState&&et(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())}}(lt),e(this,s,"m",r).call(this,o))}))}},s=new WeakSet,r=function(t){const e=this.createModal({"data-id":"redirect-flow"});e.setContent(tt({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl}));new S((()=>{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()},n})),ct=s((e=>class extends(o(R,U,ht,st,it,ot,rt,nt,at,dt)(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)}))}})),ut=o((e=>class extends(ct(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),d.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.0.98"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",ut);export{ut 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
|
"__#16@#initLogout"(): void;
|
|
20
20
|
onWidgetRootReady: (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>);
|
|
21
|
-
"__#
|
|
21
|
+
"__#12333@#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
|
+
"__#12332@#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
|
+
"__#12330@#private": any;
|
|
39
39
|
logger: {
|
|
40
40
|
error(...data: any[]): void;
|
|
41
41
|
warn(...data: any[]): void;
|
|
@@ -46,21 +46,21 @@ declare const UserProfileWidget: {
|
|
|
46
46
|
readonly ele: Element;
|
|
47
47
|
};
|
|
48
48
|
createModal(config?: Record<string, string>): _descope_sdk_component_drivers.ModalDriver;
|
|
49
|
-
"__#
|
|
50
|
-
"__#
|
|
51
|
-
"__#
|
|
52
|
-
"__#
|
|
53
|
-
"__#
|
|
54
|
-
"__#
|
|
55
|
-
"__#
|
|
56
|
-
"__#
|
|
49
|
+
"__#12329@#errorCbsSym": symbol;
|
|
50
|
+
"__#12329@#loadCbsSym": symbol;
|
|
51
|
+
"__#12329@#getComponentsVersion": (() => Promise<any>) & (() => Promise<any>) & (() => Promise<any>);
|
|
52
|
+
"__#12329@#exposeAlternateEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
|
|
53
|
+
"__#12329@#handleFallbackScript": ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[]) => Promise<void>) & ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[]) => Promise<void>) & ((errorCbs: ((error: string) => void)[], loadCbs: (() => void)[]) => Promise<void>);
|
|
54
|
+
"__#12329@#registerEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
|
|
55
|
+
"__#12329@#getDescopeUiLoadingScript": (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>);
|
|
56
|
+
"__#12329@#descopeUi": Promise<any>;
|
|
57
57
|
readonly descopeUi: Promise<any>;
|
|
58
|
-
"__#
|
|
58
|
+
"__#12329@#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
|
+
"__#12329@#getDescopeUi": (() => Promise<unknown>) & (() => Promise<unknown>) & (() => Promise<unknown>);
|
|
61
61
|
readonly config: any;
|
|
62
|
-
"__#
|
|
63
|
-
"__#
|
|
62
|
+
"__#12326@#_configResource": any;
|
|
63
|
+
"__#12326@#fetchConfig": (() => Promise<{
|
|
64
64
|
projectConfig: _descope_sdk_mixins.ProjectConfiguration;
|
|
65
65
|
executionContext: {
|
|
66
66
|
geo: string;
|
|
@@ -1057,18 +1057,18 @@ declare const UserProfileWidget: {
|
|
|
1057
1057
|
blur: (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void);
|
|
1058
1058
|
focus: ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void);
|
|
1059
1059
|
readonly projectId: string;
|
|
1060
|
-
"__#
|
|
1061
|
-
"__#
|
|
1060
|
+
"__#12325@#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);
|
|
1061
|
+
"__#12324@#observeMappings": {};
|
|
1062
1062
|
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);
|
|
1063
1063
|
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);
|
|
1064
|
-
"__#
|
|
1065
|
-
"__#
|
|
1064
|
+
"__#12323@#isInit": boolean;
|
|
1065
|
+
"__#12322@#logger": {
|
|
1066
1066
|
error(...data: any[]): void;
|
|
1067
1067
|
warn(...data: any[]): void;
|
|
1068
1068
|
info(...data: any[]): void;
|
|
1069
1069
|
debug(...data: any[]): void;
|
|
1070
1070
|
};
|
|
1071
|
-
"__#
|
|
1071
|
+
"__#12322@#wrapLogger": ((logger: Partial<{
|
|
1072
1072
|
error(...data: any[]): void;
|
|
1073
1073
|
warn(...data: any[]): void;
|
|
1074
1074
|
info(...data: any[]): void;
|
|
@@ -2000,15 +2000,20 @@ declare const UserProfileWidget: {
|
|
|
2000
2000
|
"__#11@#onValueUpdate": (email: any) => void;
|
|
2001
2001
|
"__#11@#onValueBadgeLabelUpdate": (isEmailVerified: any) => void;
|
|
2002
2002
|
"__#17@#createFlowRedirectModal"(widgetFlow: string): void;
|
|
2003
|
+
"__#12335@#globalStyleTag": HTMLStyleElement;
|
|
2003
2004
|
readonly theme: _descope_sdk_mixins.ThemeOptions;
|
|
2004
|
-
|
|
2005
|
-
"__#
|
|
2006
|
-
|
|
2007
|
-
"__#
|
|
2008
|
-
"__#
|
|
2009
|
-
"__#
|
|
2010
|
-
"__#
|
|
2011
|
-
|
|
2005
|
+
readonly styleId: string;
|
|
2006
|
+
"__#12335@#_themeResource": Promise<void | Record<string, any>>;
|
|
2007
|
+
"__#12335@#fetchTheme"(): Promise<Record<string, any>>;
|
|
2008
|
+
readonly "__#12335@#themeResource": Promise<void | Record<string, any>>;
|
|
2009
|
+
"__#12335@#loadGlobalStyle"(): Promise<void>;
|
|
2010
|
+
"__#12335@#loadComponentsStyle"(): Promise<void>;
|
|
2011
|
+
"__#12335@#getFontsConfig"(): Promise<Record<string, {
|
|
2012
|
+
url?: string;
|
|
2013
|
+
}>>;
|
|
2014
|
+
"__#12335@#loadFonts"(): Promise<void>;
|
|
2015
|
+
"__#12335@#applyTheme"(): Promise<void>;
|
|
2016
|
+
"__#12328@#debuggerEle": HTMLElement & {
|
|
2012
2017
|
updateData: (data: {
|
|
2013
2018
|
title: string;
|
|
2014
2019
|
description?: string;
|
|
@@ -2017,11 +2022,11 @@ declare const UserProfileWidget: {
|
|
|
2017
2022
|
description?: string;
|
|
2018
2023
|
}[]) => void;
|
|
2019
2024
|
};
|
|
2020
|
-
"__#
|
|
2021
|
-
"__#
|
|
2025
|
+
"__#12328@#disableDebugger"(): void;
|
|
2026
|
+
"__#12328@#enableDebugger"(): Promise<void>;
|
|
2022
2027
|
readonly debug: boolean;
|
|
2023
|
-
"__#
|
|
2024
|
-
"__#
|
|
2028
|
+
"__#12328@#handleDebugMode"(): void;
|
|
2029
|
+
"__#12328@#updateDebuggerMessages"(title: string, description: string): void;
|
|
2025
2030
|
};
|
|
2026
2031
|
};
|
|
2027
2032
|
|