@descope/user-profile-widget 0.2.1 → 0.2.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * @descope/user-profile-widget v0.2.1
3
+ * @descope/user-profile-widget v0.2.2
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 d from"@descope/web-component";import{projectIdMixin as l,observeAttributesMixin as h,loggerMixin as c,baseUrlMixin as u,createStateManagementMixin as v,initLifecycleMixin as f,modalMixin as g,staticResourcesMixin as p,createValidateAttributesMixin as w,descopeUiMixin as m,initElementMixin as b,baseStaticUrlMixin as y,debuggerMixin as U,themeMixin as R}from"@descope/sdk-mixins";import{FlowDriver as S,AvatarDriver as W,UserAttributeDriver as k,ButtonDriver as M,UserAuthMethodDriver as I}from"@descope/sdk-component-drivers";import{createAsyncThunk as A}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import j from"@descope/web-js-sdk";import{createSelector as C}from"reselect";const x=(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 E(t){return new URLSearchParams(window.location.search).get(t)}const O=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)}))}))},q=A("users/me",((t,{extra:{api:e}})=>e.user.me())),F=O(q)({onFulfilled:(t,e)=>{t.me.data=e.payload}},(T=t=>t.me,{onFulfilled:t=>{T(t).loading=!1},onPending:t=>{T(t).loading=!0,T(t).error=null},onRejected:(t,e)=>{T(t).loading=!1,T(t).error=e.error}}));var T;const P={action:q,reducer:F},L=A("users/logout",((t,{extra:{api:e}})=>e.user.logout())),N={action:L,reducer:O(L)({})},D={me:{loading:!1,error:null,data:{}}},$={me:"/v1/auth/me"},B=()=>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})}))})),H=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return B();const s=yield e.get($.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()}))}),V=r((s=>{var o,r,a,d;const v=n(l,h,c,u)(s);return d=class extends v{constructor(){super(...arguments),o.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return 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=j(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.1"}}));return{user:Object.assign(Object.assign({},H({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})),X=r((t=>{const e=n(v({name:"widget",initialState:D,reducers:{},extraReducers:t=>{P.reducer(t),N.reducer(t)},asyncActions:{getMe:P.action,logout:N.action}}),f,c,V)(t);return class extends e{constructor(...t){super(...t),this.state=D,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),G="widget-flow",J=r((i=>{var s,o,r;return r=class extends(n(f,g,X,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 r=E(G);r&&(!function(t){if(window.history.replaceState&&E(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())}}(G),e(this,s,"m",o).call(this,r))}))}},s=new WeakSet,o=function(t){const e=this.createModal({"data-id":"redirect-flow"});e.setContent(x({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()},r})),Y=t=>t.me.data,_=C(Y,(t=>t.picture)),z=C(Y,(t=>t.email)),K=C(Y,(t=>t.verifiedEmail)),Q=C(Y,(t=>t.name)),Z=C(Y,(t=>t.phone)),tt=C(Y,(t=>t.verifiedPhone)),et=C(Y,(t=>t.webauthn));C(Y,(t=>t.password));const it=C(Y,(t=>t.customAttributes)),st=r((e=>{const i=n(p,w({"widget-id":w.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}))}}})),ot=r((i=>{var o,r,a;return a=class extends(n(c,f,m,b,st,X)(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})),rt=r((s=>{var o,r,d,l,h,u,v,f,p;return p=class extends(n(X,c,ot,g,y)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),v.set(this,a((t=>{this.avatar.image=t}))),f.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",l).call(this),e(this,v,"f").call(this,_(this.state)),e(this,f,"f").call(this,Q(this.state)),this.subscribe(e(this,v,"f").bind(this),_),this.subscribe(e(this,f,"f").bind(this),Q)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,f=new WeakMap,o=new WeakSet,l=function(){this.avatar.flowId&&(i(this,r,this.createModal({"data-id":"update-pic"}),"f"),i(this,d,new S((()=>{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",h).bind(this),e(this,o,"m",h).call(this))},h=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,r,"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((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},p})),nt=r((s=>{var o,r,d,l,h,u,v,f,p,w,m,b,y;return y=class extends(n(X,c,ot,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),m.set(this,a((t=>{this.emailUserAttr.value=t}))),b.set(this,a((t=>{this.emailUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",f).call(this),e(this,m,"f").call(this,z(this.state)),e(this,b,"f").call(this,K(this.state)),this.subscribe(e(this,m,"f").bind(this),z),this.subscribe(e(this,b,"f").bind(this),K)}))}},r=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,m=new WeakMap,b=new WeakMap,o=new WeakSet,u=function(){this.emailUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-email"}),"f"),i(this,d,new S((()=>{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",v).bind(this),e(this,o,"m",v).call(this))},v=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.emailUserAttr.deleteFlowId&&(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,o,"m",p).bind(this),e(this,o,"m",p).call(this))},p=function(){e(this,l,"f").setContent(x({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()}))},w=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((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.emailUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},y})),at=r((i=>{var s,o,r;return r=class extends(n(X,c,ot,g)(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 M((()=>{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})),dt=r((s=>{var o,r,d,l,h,u,v,f,p,w,m,b;return b=class extends(n(X,c,ot,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),m.set(this,a((t=>{this.nameUserAttr.value=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",f).call(this),e(this,m,"f").call(this,Q(this.state)),this.subscribe(e(this,m,"f").bind(this),Q)}))}},r=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,m=new WeakMap,o=new WeakSet,u=function(){this.nameUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-name"}),"f"),i(this,d,new S((()=>{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",v).bind(this),e(this,o,"m",v).call(this))},v=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.nameUserAttr.deleteFlowId&&(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,o,"m",p).bind(this),e(this,o,"m",p).call(this))},p=function(){e(this,l,"f").setContent(x({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()}))},w=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((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.nameUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},b})),lt=r((s=>{var o,r,d,l,h,u,v,f;return f=class extends(n(X,c,ot,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),v.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",l).call(this),e(this,v,"f").call(this,et(this.state)),this.subscribe(e(this,v,"f").bind(this),et)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,o=new WeakSet,l=function(){this.passkeyUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"passkey"}),"f"),i(this,d,new S((()=>{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",h).bind(this),e(this,o,"m",h).call(this))},h=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.passkeyUserAuthMethod=new I((()=>{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()}))},f})),ht=r((s=>{var o,r,a,d,l,h,u;return u=class extends(n(X,c,ot,g)(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",h).call(this),e(this,o,"m",d).call(this)}))}},r=new WeakMap,a=new WeakMap,o=new WeakSet,d=function(){this.passwordUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"password"}),"f"),i(this,a,new S((()=>{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",l).bind(this),e(this,o,"m",l).call(this))},l=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,a,"f").onSuccess((()=>{e(this,r,"f").close()}))},h=function(){this.passwordUserAuthMethod=new I((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},u})),ct=r((s=>{var o,r,d,l,h,u,v,f,p,w,m,b,y;return y=class extends(n(X,c,ot,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),m.set(this,a((t=>{this.phoneUserAttr.value=t}))),b.set(this,a((t=>{this.phoneUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",f).call(this),e(this,m,"f").call(this,Z(this.state)),e(this,b,"f").call(this,tt(this.state)),this.subscribe(e(this,m,"f").bind(this),Z),this.subscribe(e(this,b,"f").bind(this),tt)}))}},r=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,m=new WeakMap,b=new WeakMap,o=new WeakSet,u=function(){this.phoneUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-phone"}),"f"),i(this,d,new S((()=>{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",v).bind(this),e(this,o,"m",v).call(this))},v=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.phoneUserAttr.deleteFlowId&&(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,o,"m",p).bind(this),e(this,o,"m",p).call(this))},p=function(){e(this,l,"f").setContent(x({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()}))},w=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((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.phoneUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},y}));var ut;!function(t){t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t.SINGLE_SELECT="singleSelect",t.ARRAY="array",t.DATE="date"}(ut||(ut={}));const vt=r((i=>{var s,o,r,d,l,h,u,v,f,p,w;return o=class extends(n(X,c,ot,g)(i)){constructor(){super(...arguments),s.add(this),r.set(this,{}),d.set(this,{}),l.set(this,{}),h.set(this,{}),f.set(this,a((t=>{var i;const r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(r).forEach((i=>{const r=i.getAttribute("data-id").replace("customAttributes.",""),n=i.getAttribute("data-type")||ut.TEXT,a=t[r],d=new k(i,{logger:this.logger});d.value=o.getFormattedValue(n,a),e(this,s,"m",p).call(this,i,r,d),e(this,s,"m",w).call(this,i,r,d)}))})))}static getFormattedValue(t,e){return t===ut.DATE&&e?new Date(e).toLocaleString():t===ut.BOOLEAN&&void 0!==e?e?"True":"False":(e||"").toString()}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,f,"f").call(this,it(this.state)),this.subscribe(e(this,f,"f").bind(this),it)}))}},r=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,f=new WeakMap,s=new WeakSet,u=function(t){var i,s;null===(i=e(this,r,"f")[t])||void 0===i||i.setContent(x({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e(this,d,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,r,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},v=function(t){var i,s;null===(i=e(this,l,"f")[t])||void 0===i||i.setContent(x({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e(this,h,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,l,"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,d,"f")[n]=new S((()=>{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))},w=function(t,i,o){const r=t.getAttribute("delete-flow-id");r&&(e(this,l,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e(this,h,"f")[r]=new S((()=>{var t,i;return null===(i=null===(t=e(this,l,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,l,"f")[r].afterClose=e(this,s,"m",v).bind(this,r),o.onDeleteClick((()=>{var t,i;null===(i=null===(t=e(this,l,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e(this,s,"m",v).call(this,r))},o})),ft=r((e=>class extends(n(U,R,J,vt,nt,rt,dt,ct,lt,ht,at)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),gt=n((e=>class extends(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),d.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.1"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",gt);export{gt as default};
5
+ import{__awaiter as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{createTemplate as s,kebabCase as o,createSingletonMixin as r,compose as n,withMemCache as a}from"@descope/sdk-helpers";import d from"@descope/web-component";import{projectIdMixin as l,observeAttributesMixin as h,loggerMixin as c,baseUrlMixin as u,createStateManagementMixin as v,initLifecycleMixin as f,modalMixin as g,staticResourcesMixin as p,createValidateAttributesMixin as w,descopeUiMixin as m,initElementMixin as b,baseStaticUrlMixin as y,debuggerMixin as U,themeMixin as R}from"@descope/sdk-mixins";import{FlowDriver as S,AvatarDriver as W,UserAttributeDriver as k,ButtonDriver as M,UserAuthMethodDriver as I}from"@descope/sdk-component-drivers";import{createAsyncThunk as A}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import j from"@descope/web-js-sdk";import{createSelector as C}from"reselect";const x=(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 E(t){return new URLSearchParams(window.location.search).get(t)}const O=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)}))}))},q=A("users/me",((t,{extra:{api:e}})=>e.user.me())),F=O(q)({onFulfilled:(t,e)=>{t.me.data=e.payload}},(T=t=>t.me,{onFulfilled:t=>{T(t).loading=!1},onPending:t=>{T(t).loading=!0,T(t).error=null},onRejected:(t,e)=>{T(t).loading=!1,T(t).error=e.error}}));var T;const P={action:q,reducer:F},L=A("users/logout",((t,{extra:{api:e}})=>e.user.logout())),N={action:L,reducer:O(L)({})},D={me:{loading:!1,error:null,data:{}}},$={me:"/v1/auth/me"},B=()=>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})}))})),H=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return B();const s=yield e.get($.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()}))}),V=r((s=>{var o,r,a,d;const v=n(l,h,c,u)(s);return d=class extends v{constructor(){super(...arguments),o.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return 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=j(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.2"}}));return{user:Object.assign(Object.assign({},H({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})),X=r((t=>{const e=n(v({name:"widget",initialState:D,reducers:{},extraReducers:t=>{P.reducer(t),N.reducer(t)},asyncActions:{getMe:P.action,logout:N.action}}),f,c,V)(t);return class extends e{constructor(...t){super(...t),this.state=D,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),G="widget-flow",J=r((i=>{var s,o,r;return r=class extends(n(f,g,X,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 r=E(G);r&&(!function(t){if(window.history.replaceState&&E(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())}}(G),e(this,s,"m",o).call(this,r))}))}},s=new WeakSet,o=function(t){const e=this.createModal({"data-id":"redirect-flow"});e.setContent(x({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()},r})),Y=t=>t.me.data,_=C(Y,(t=>t.picture)),z=C(Y,(t=>t.email)),K=C(Y,(t=>t.verifiedEmail)),Q=C(Y,(t=>t.name)),Z=C(Y,(t=>t.phone)),tt=C(Y,(t=>t.verifiedPhone)),et=C(Y,(t=>t.webauthn));C(Y,(t=>t.password));const it=C(Y,(t=>t.customAttributes)),st=r((e=>{const i=n(p,w({"widget-id":w.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}))}}})),ot=r((i=>{var o,r,a;return a=class extends(n(c,f,m,b,st,X)(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})),rt=r((s=>{var o,r,d,l,h,u,v,f,p;return p=class extends(n(X,c,ot,g,y)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),v.set(this,a((t=>{this.avatar.image=t}))),f.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",l).call(this),e(this,v,"f").call(this,_(this.state)),e(this,f,"f").call(this,Q(this.state)),this.subscribe(e(this,v,"f").bind(this),_),this.subscribe(e(this,f,"f").bind(this),Q)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,f=new WeakMap,o=new WeakSet,l=function(){this.avatar.flowId&&(i(this,r,this.createModal({"data-id":"update-pic"}),"f"),i(this,d,new S((()=>{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",h).bind(this),e(this,o,"m",h).call(this))},h=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,r,"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((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},p})),nt=r((s=>{var o,r,d,l,h,u,v,f,p,w,m,b,y;return y=class extends(n(X,c,ot,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),m.set(this,a((t=>{this.emailUserAttr.value=t}))),b.set(this,a((t=>{this.emailUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",f).call(this),e(this,m,"f").call(this,z(this.state)),e(this,b,"f").call(this,K(this.state)),this.subscribe(e(this,m,"f").bind(this),z),this.subscribe(e(this,b,"f").bind(this),K)}))}},r=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,m=new WeakMap,b=new WeakMap,o=new WeakSet,u=function(){this.emailUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-email"}),"f"),i(this,d,new S((()=>{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",v).bind(this),e(this,o,"m",v).call(this))},v=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.emailUserAttr.deleteFlowId&&(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,o,"m",p).bind(this),e(this,o,"m",p).call(this))},p=function(){e(this,l,"f").setContent(x({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()}))},w=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((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.emailUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},y})),at=r((i=>{var s,o,r;return r=class extends(n(X,c,ot,g)(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 M((()=>{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})),dt=r((s=>{var o,r,d,l,h,u,v,f,p,w,m,b;return b=class extends(n(X,c,ot,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),m.set(this,a((t=>{this.nameUserAttr.value=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",f).call(this),e(this,m,"f").call(this,Q(this.state)),this.subscribe(e(this,m,"f").bind(this),Q)}))}},r=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,m=new WeakMap,o=new WeakSet,u=function(){this.nameUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-name"}),"f"),i(this,d,new S((()=>{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",v).bind(this),e(this,o,"m",v).call(this))},v=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.nameUserAttr.deleteFlowId&&(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,o,"m",p).bind(this),e(this,o,"m",p).call(this))},p=function(){e(this,l,"f").setContent(x({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()}))},w=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((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.nameUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},b})),lt=r((s=>{var o,r,d,l,h,u,v,f;return f=class extends(n(X,c,ot,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),v.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",l).call(this),e(this,v,"f").call(this,et(this.state)),this.subscribe(e(this,v,"f").bind(this),et)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,o=new WeakSet,l=function(){this.passkeyUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"passkey"}),"f"),i(this,d,new S((()=>{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",h).bind(this),e(this,o,"m",h).call(this))},h=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},u=function(){this.passkeyUserAuthMethod=new I((()=>{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()}))},f})),ht=r((s=>{var o,r,a,d,l,h,u;return u=class extends(n(X,c,ot,g)(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",h).call(this),e(this,o,"m",d).call(this)}))}},r=new WeakMap,a=new WeakMap,o=new WeakSet,d=function(){this.passwordUserAuthMethod.flowId&&(i(this,r,this.createModal({"data-id":"password"}),"f"),i(this,a,new S((()=>{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",l).bind(this),e(this,o,"m",l).call(this))},l=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,a,"f").onSuccess((()=>{e(this,r,"f").close()}))},h=function(){this.passwordUserAuthMethod=new I((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},u})),ct=r((s=>{var o,r,d,l,h,u,v,f,p,w,m,b,y;return y=class extends(n(X,c,ot,g)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),l.set(this,void 0),h.set(this,void 0),m.set(this,a((t=>{this.phoneUserAttr.value=t}))),b.set(this,a((t=>{this.phoneUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,o,"m",w).call(this),e(this,o,"m",u).call(this),e(this,o,"m",f).call(this),e(this,m,"f").call(this,Z(this.state)),e(this,b,"f").call(this,tt(this.state)),this.subscribe(e(this,m,"f").bind(this),Z),this.subscribe(e(this,b,"f").bind(this),tt)}))}},r=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,m=new WeakMap,b=new WeakMap,o=new WeakSet,u=function(){this.phoneUserAttr.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-phone"}),"f"),i(this,d,new S((()=>{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",v).bind(this),e(this,o,"m",v).call(this))},v=function(){e(this,r,"f").setContent(x({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getMe()}))},f=function(){this.phoneUserAttr.deleteFlowId&&(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,o,"m",p).bind(this),e(this,o,"m",p).call(this))},p=function(){e(this,l,"f").setContent(x({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()}))},w=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((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.phoneUserAttr.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},y}));var ut;!function(t){t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t.SINGLE_SELECT="singleSelect",t.ARRAY="array",t.DATE="date"}(ut||(ut={}));const vt=r((i=>{var s,o,r,d,l,h,u,v,f,p,w;return o=class extends(n(X,c,ot,g)(i)){constructor(){super(...arguments),s.add(this),r.set(this,{}),d.set(this,{}),l.set(this,{}),h.set(this,{}),f.set(this,a((t=>{var i;const r=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(r).forEach((i=>{const r=i.getAttribute("data-id").replace("customAttributes.",""),n=i.getAttribute("data-type")||ut.TEXT,a=t[r],d=new k(i,{logger:this.logger});d.value=o.getFormattedValue(n,a),e(this,s,"m",p).call(this,i,r,d),e(this,s,"m",w).call(this,i,r,d)}))})))}static getFormattedValue(t,e){return t===ut.DATE&&e?new Date(e).toLocaleString():t===ut.BOOLEAN&&void 0!==e?e?"True":"False":(e||"").toString()}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,f,"f").call(this,it(this.state)),this.subscribe(e(this,f,"f").bind(this),it)}))}},r=new WeakMap,d=new WeakMap,l=new WeakMap,h=new WeakMap,f=new WeakMap,s=new WeakSet,u=function(t){var i,s;null===(i=e(this,r,"f")[t])||void 0===i||i.setContent(x({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e(this,d,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,r,"f")[t])||void 0===i||i.close(),this.actions.getMe()}))},v=function(t){var i,s;null===(i=e(this,l,"f")[t])||void 0===i||i.setContent(x({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl})),null===(s=e(this,h,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,l,"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,d,"f")[n]=new S((()=>{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))},w=function(t,i,o){const r=t.getAttribute("delete-flow-id");r&&(e(this,l,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e(this,h,"f")[r]=new S((()=>{var t,i;return null===(i=null===(t=e(this,l,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,l,"f")[r].afterClose=e(this,s,"m",v).bind(this,r),o.onDeleteClick((()=>{var t,i;null===(i=null===(t=e(this,l,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e(this,s,"m",v).call(this,r))},o})),ft=r((e=>class extends(n(U,R,J,vt,nt,rt,dt,ct,lt,ht,at)(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this)}))}})),gt=n((e=>class extends(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),d.sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"user-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.2.2"}}}))}}))(HTMLElement);customElements.define("descope-user-profile-widget",gt);export{gt as default};
6
6
  //# sourceMappingURL=index.js.map
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@ declare const UserProfileWidget: {
18
18
  logout: _descope_sdk_component_drivers.ButtonDriver;
19
19
  "__#13@#initLogout"(): void;
20
20
  onWidgetRootReady: (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>);
21
- "__#12370@#ModalDriverWrapper": new (refOrRefFn: Element | (() => HTMLElement), config: {
21
+ "__#24150@#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
- "__#12369@#private": any;
30
+ "__#24149@#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
- "__#12367@#private": any;
38
+ "__#24147@#private": any;
39
39
  logger: {
40
40
  error(...data: any[]): void;
41
41
  warn(...data: any[]): void;
@@ -46,39 +46,39 @@ declare const UserProfileWidget: {
46
46
  readonly ele: Element;
47
47
  };
48
48
  createModal(config?: Record<string, string>): _descope_sdk_component_drivers.ModalDriver;
49
- "__#12366@#errorCbsSym": symbol;
50
- "__#12366@#loadCbsSym": symbol;
51
- "__#12366@#getComponentsVersion": (() => Promise<any>) & (() => Promise<any>) & (() => Promise<any>);
52
- "__#12366@#exposeAlternateEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
53
- "__#12366@#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
- "__#12366@#registerEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
55
- "__#12366@#getDescopeUiLoadingScript": (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>);
56
- "__#12366@#descopeUi": Promise<any>;
49
+ "__#24146@#errorCbsSym": symbol;
50
+ "__#24146@#loadCbsSym": symbol;
51
+ "__#24146@#getComponentsVersion": (() => Promise<any>) & (() => Promise<any>) & (() => Promise<any>);
52
+ "__#24146@#exposeAlternateEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
53
+ "__#24146@#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
+ "__#24146@#registerEvents": ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void) & ((scriptEle: HTMLScriptElement) => void);
55
+ "__#24146@#getDescopeUiLoadingScript": (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>) & (() => Promise<HTMLElement>);
56
+ "__#24146@#descopeUi": Promise<any>;
57
57
  readonly descopeUi: Promise<any>;
58
- "__#12366@#loadDescopeUiComponent": ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>);
58
+ "__#24146@#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
- "__#12366@#getDescopeUi": (() => Promise<unknown>) & (() => Promise<unknown>) & (() => Promise<unknown>);
60
+ "__#24146@#getDescopeUi": (() => Promise<unknown>) & (() => Promise<unknown>) & (() => Promise<unknown>);
61
61
  readonly config: any;
62
- "__#12363@#_configResource": any;
63
- "__#12363@#fetchConfig": (() => Promise<{
62
+ "__#24143@#_configResource": any;
63
+ "__#24143@#fetchConfig": (() => Promise<{
64
64
  projectConfig: _descope_sdk_mixins.ProjectConfiguration;
65
65
  executionContext: {
66
- geo: string;
66
+ geo: any;
67
67
  };
68
68
  }>) & (() => Promise<{
69
69
  projectConfig: _descope_sdk_mixins.ProjectConfiguration;
70
70
  executionContext: {
71
- geo: string;
71
+ geo: any;
72
72
  };
73
73
  }>) & (() => Promise<{
74
74
  projectConfig: _descope_sdk_mixins.ProjectConfiguration;
75
75
  executionContext: {
76
- geo: string;
76
+ geo: any;
77
77
  };
78
78
  }>) & (() => Promise<{
79
79
  projectConfig: _descope_sdk_mixins.ProjectConfiguration;
80
80
  executionContext: {
81
- geo: string;
81
+ geo: any;
82
82
  };
83
83
  }>);
84
84
  fetchStaticResource: (<F extends "text" | "json">(filename: string, format: F) => Promise<{
@@ -1057,344 +1057,14 @@ 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
- "__#12362@#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
- "__#12361@#observeMappings": {};
1060
+ "__#24142@#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
+ "__#24141@#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
- "__#12360@#isInit": boolean;
1065
- "__#12359@#logger": {
1066
- error(...data: any[]): void;
1067
- warn(...data: any[]): void;
1068
- info(...data: any[]): void;
1069
- debug(...data: any[]): void;
1070
- };
1071
- "__#12359@#wrapLogger": ((logger: Partial<{
1072
- error(...data: any[]): void;
1073
- warn(...data: any[]): void;
1074
- info(...data: any[]): void;
1075
- debug(...data: any[]): void;
1076
- }>) => {
1077
- error(...data: any[]): void;
1078
- warn(...data: any[]): void;
1079
- info(...data: any[]): void;
1080
- debug(...data: any[]): void;
1081
- }) & ((logger: Partial<{
1082
- error(...data: any[]): void;
1083
- warn(...data: any[]): void;
1084
- info(...data: any[]): void;
1085
- debug(...data: any[]): void;
1086
- }>) => {
1087
- error(...data: any[]): void;
1088
- warn(...data: any[]): void;
1089
- info(...data: any[]): void;
1090
- debug(...data: any[]): void;
1091
- }) & ((logger: Partial<{
1092
- error(...data: any[]): void;
1093
- warn(...data: any[]): void;
1094
- info(...data: any[]): void;
1095
- debug(...data: any[]): void;
1096
- }>) => {
1097
- error(...data: any[]): void;
1098
- warn(...data: any[]): void;
1099
- info(...data: any[]): void;
1100
- debug(...data: any[]): void;
1101
- }) & ((logger: Partial<{
1102
- error(...data: any[]): void;
1103
- warn(...data: any[]): void;
1104
- info(...data: any[]): void;
1105
- debug(...data: any[]): void;
1106
- }>) => {
1107
- error(...data: any[]): void;
1108
- warn(...data: any[]): void;
1109
- info(...data: any[]): void;
1110
- debug(...data: any[]): void;
1111
- }) & ((logger: Partial<{
1112
- error(...data: any[]): void;
1113
- warn(...data: any[]): void;
1114
- info(...data: any[]): void;
1115
- debug(...data: any[]): void;
1116
- }>) => {
1117
- error(...data: any[]): void;
1118
- warn(...data: any[]): void;
1119
- info(...data: any[]): void;
1120
- debug(...data: any[]): void;
1121
- }) & ((logger: Partial<{
1122
- error(...data: any[]): void;
1123
- warn(...data: any[]): void;
1124
- info(...data: any[]): void;
1125
- debug(...data: any[]): void;
1126
- }>) => {
1127
- error(...data: any[]): void;
1128
- warn(...data: any[]): void;
1129
- info(...data: any[]): void;
1130
- debug(...data: any[]): void;
1131
- }) & ((logger: Partial<{
1132
- error(...data: any[]): void;
1133
- warn(...data: any[]): void;
1134
- info(...data: any[]): void;
1135
- debug(...data: any[]): void;
1136
- }>) => {
1137
- error(...data: any[]): void;
1138
- warn(...data: any[]): void;
1139
- info(...data: any[]): void;
1140
- debug(...data: any[]): void;
1141
- }) & ((logger: Partial<{
1142
- error(...data: any[]): void;
1143
- warn(...data: any[]): void;
1144
- info(...data: any[]): void;
1145
- debug(...data: any[]): void;
1146
- }>) => {
1147
- error(...data: any[]): void;
1148
- warn(...data: any[]): void;
1149
- info(...data: any[]): void;
1150
- debug(...data: any[]): void;
1151
- }) & ((logger: Partial<{
1152
- error(...data: any[]): void;
1153
- warn(...data: any[]): void;
1154
- info(...data: any[]): void;
1155
- debug(...data: any[]): void;
1156
- }>) => {
1157
- error(...data: any[]): void;
1158
- warn(...data: any[]): void;
1159
- info(...data: any[]): void;
1160
- debug(...data: any[]): void;
1161
- }) & ((logger: Partial<{
1162
- error(...data: any[]): void;
1163
- warn(...data: any[]): void;
1164
- info(...data: any[]): void;
1165
- debug(...data: any[]): void;
1166
- }>) => {
1167
- error(...data: any[]): void;
1168
- warn(...data: any[]): void;
1169
- info(...data: any[]): void;
1170
- debug(...data: any[]): void;
1171
- }) & ((logger: Partial<{
1172
- error(...data: any[]): void;
1173
- warn(...data: any[]): void;
1174
- info(...data: any[]): void;
1175
- debug(...data: any[]): void;
1176
- }>) => {
1177
- error(...data: any[]): void;
1178
- warn(...data: any[]): void;
1179
- info(...data: any[]): void;
1180
- debug(...data: any[]): void;
1181
- }) & ((logger: Partial<{
1182
- error(...data: any[]): void;
1183
- warn(...data: any[]): void;
1184
- info(...data: any[]): void;
1185
- debug(...data: any[]): void;
1186
- }>) => {
1187
- error(...data: any[]): void;
1188
- warn(...data: any[]): void;
1189
- info(...data: any[]): void;
1190
- debug(...data: any[]): void;
1191
- }) & ((logger: Partial<{
1192
- error(...data: any[]): void;
1193
- warn(...data: any[]): void;
1194
- info(...data: any[]): void;
1195
- debug(...data: any[]): void;
1196
- }>) => {
1197
- error(...data: any[]): void;
1198
- warn(...data: any[]): void;
1199
- info(...data: any[]): void;
1200
- debug(...data: any[]): void;
1201
- }) & ((logger: Partial<{
1202
- error(...data: any[]): void;
1203
- warn(...data: any[]): void;
1204
- info(...data: any[]): void;
1205
- debug(...data: any[]): void;
1206
- }>) => {
1207
- error(...data: any[]): void;
1208
- warn(...data: any[]): void;
1209
- info(...data: any[]): void;
1210
- debug(...data: any[]): void;
1211
- }) & ((logger: Partial<{
1212
- error(...data: any[]): void;
1213
- warn(...data: any[]): void;
1214
- info(...data: any[]): void;
1215
- debug(...data: any[]): void;
1216
- }>) => {
1217
- error(...data: any[]): void;
1218
- warn(...data: any[]): void;
1219
- info(...data: any[]): void;
1220
- debug(...data: any[]): void;
1221
- }) & ((logger: Partial<{
1222
- error(...data: any[]): void;
1223
- warn(...data: any[]): void;
1224
- info(...data: any[]): void;
1225
- debug(...data: any[]): void;
1226
- }>) => {
1227
- error(...data: any[]): void;
1228
- warn(...data: any[]): void;
1229
- info(...data: any[]): void;
1230
- debug(...data: any[]): void;
1231
- }) & ((logger: Partial<{
1232
- error(...data: any[]): void;
1233
- warn(...data: any[]): void;
1234
- info(...data: any[]): void;
1235
- debug(...data: any[]): void;
1236
- }>) => {
1237
- error(...data: any[]): void;
1238
- warn(...data: any[]): void;
1239
- info(...data: any[]): void;
1240
- debug(...data: any[]): void;
1241
- }) & ((logger: Partial<{
1242
- error(...data: any[]): void;
1243
- warn(...data: any[]): void;
1244
- info(...data: any[]): void;
1245
- debug(...data: any[]): void;
1246
- }>) => {
1247
- error(...data: any[]): void;
1248
- warn(...data: any[]): void;
1249
- info(...data: any[]): void;
1250
- debug(...data: any[]): void;
1251
- }) & ((logger: Partial<{
1252
- error(...data: any[]): void;
1253
- warn(...data: any[]): void;
1254
- info(...data: any[]): void;
1255
- debug(...data: any[]): void;
1256
- }>) => {
1257
- error(...data: any[]): void;
1258
- warn(...data: any[]): void;
1259
- info(...data: any[]): void;
1260
- debug(...data: any[]): void;
1261
- }) & ((logger: Partial<{
1262
- error(...data: any[]): void;
1263
- warn(...data: any[]): void;
1264
- info(...data: any[]): void;
1265
- debug(...data: any[]): void;
1266
- }>) => {
1267
- error(...data: any[]): void;
1268
- warn(...data: any[]): void;
1269
- info(...data: any[]): void;
1270
- debug(...data: any[]): void;
1271
- }) & ((logger: Partial<{
1272
- error(...data: any[]): void;
1273
- warn(...data: any[]): void;
1274
- info(...data: any[]): void;
1275
- debug(...data: any[]): void;
1276
- }>) => {
1277
- error(...data: any[]): void;
1278
- warn(...data: any[]): void;
1279
- info(...data: any[]): void;
1280
- debug(...data: any[]): void;
1281
- }) & ((logger: Partial<{
1282
- error(...data: any[]): void;
1283
- warn(...data: any[]): void;
1284
- info(...data: any[]): void;
1285
- debug(...data: any[]): void;
1286
- }>) => {
1287
- error(...data: any[]): void;
1288
- warn(...data: any[]): void;
1289
- info(...data: any[]): void;
1290
- debug(...data: any[]): void;
1291
- }) & ((logger: Partial<{
1292
- error(...data: any[]): void;
1293
- warn(...data: any[]): void;
1294
- info(...data: any[]): void;
1295
- debug(...data: any[]): void;
1296
- }>) => {
1297
- error(...data: any[]): void;
1298
- warn(...data: any[]): void;
1299
- info(...data: any[]): void;
1300
- debug(...data: any[]): void;
1301
- }) & ((logger: Partial<{
1302
- error(...data: any[]): void;
1303
- warn(...data: any[]): void;
1304
- info(...data: any[]): void;
1305
- debug(...data: any[]): void;
1306
- }>) => {
1307
- error(...data: any[]): void;
1308
- warn(...data: any[]): void;
1309
- info(...data: any[]): void;
1310
- debug(...data: any[]): void;
1311
- }) & ((logger: Partial<{
1312
- error(...data: any[]): void;
1313
- warn(...data: any[]): void;
1314
- info(...data: any[]): void;
1315
- debug(...data: any[]): void;
1316
- }>) => {
1317
- error(...data: any[]): void;
1318
- warn(...data: any[]): void;
1319
- info(...data: any[]): void;
1320
- debug(...data: any[]): void;
1321
- }) & ((logger: Partial<{
1322
- error(...data: any[]): void;
1323
- warn(...data: any[]): void;
1324
- info(...data: any[]): void;
1325
- debug(...data: any[]): void;
1326
- }>) => {
1327
- error(...data: any[]): void;
1328
- warn(...data: any[]): void;
1329
- info(...data: any[]): void;
1330
- debug(...data: any[]): void;
1331
- }) & ((logger: Partial<{
1332
- error(...data: any[]): void;
1333
- warn(...data: any[]): void;
1334
- info(...data: any[]): void;
1335
- debug(...data: any[]): void;
1336
- }>) => {
1337
- error(...data: any[]): void;
1338
- warn(...data: any[]): void;
1339
- info(...data: any[]): void;
1340
- debug(...data: any[]): void;
1341
- }) & ((logger: Partial<{
1342
- error(...data: any[]): void;
1343
- warn(...data: any[]): void;
1344
- info(...data: any[]): void;
1345
- debug(...data: any[]): void;
1346
- }>) => {
1347
- error(...data: any[]): void;
1348
- warn(...data: any[]): void;
1349
- info(...data: any[]): void;
1350
- debug(...data: any[]): void;
1351
- }) & ((logger: Partial<{
1352
- error(...data: any[]): void;
1353
- warn(...data: any[]): void;
1354
- info(...data: any[]): void;
1355
- debug(...data: any[]): void;
1356
- }>) => {
1357
- error(...data: any[]): void;
1358
- warn(...data: any[]): void;
1359
- info(...data: any[]): void;
1360
- debug(...data: any[]): void;
1361
- }) & ((logger: Partial<{
1362
- error(...data: any[]): void;
1363
- warn(...data: any[]): void;
1364
- info(...data: any[]): void;
1365
- debug(...data: any[]): void;
1366
- }>) => {
1367
- error(...data: any[]): void;
1368
- warn(...data: any[]): void;
1369
- info(...data: any[]): void;
1370
- debug(...data: any[]): void;
1371
- }) & ((logger: Partial<{
1372
- error(...data: any[]): void;
1373
- warn(...data: any[]): void;
1374
- info(...data: any[]): void;
1375
- debug(...data: any[]): void;
1376
- }>) => {
1377
- error(...data: any[]): void;
1378
- warn(...data: any[]): void;
1379
- info(...data: any[]): void;
1380
- debug(...data: any[]): void;
1381
- }) & ((logger: Partial<{
1382
- error(...data: any[]): void;
1383
- warn(...data: any[]): void;
1384
- info(...data: any[]): void;
1385
- debug(...data: any[]): void;
1386
- }>) => {
1387
- error(...data: any[]): void;
1388
- warn(...data: any[]): void;
1389
- info(...data: any[]): void;
1390
- debug(...data: any[]): void;
1391
- });
1392
- logger: {
1393
- error(...data: any[]): void;
1394
- warn(...data: any[]): void;
1395
- info(...data: any[]): void;
1396
- debug(...data: any[]): void;
1397
- };
1064
+ "__#24140@#isInit": boolean;
1065
+ "__#24139@#logger": _descope_sdk_mixins.Logger;
1066
+ "__#24139@#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);
1067
+ logger: _descope_sdk_mixins.Logger;
1398
1068
  onLogEvent: ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", args: any[]) => void);
1399
1069
  contentRootElement: HTMLElement;
1400
1070
  rootElement: HTMLElement;
@@ -2079,23 +1749,23 @@ declare const UserProfileWidget: {
2079
1749
  "__#18@#initEditFlow"(nodeEle: Element, customAttrName: string, compInstance: _descope_sdk_component_drivers.UserAttributeDriver): void;
2080
1750
  "__#18@#initDeleteFlow"(nodeEle: Element, customAttrName: string, compInstance: _descope_sdk_component_drivers.UserAttributeDriver): void;
2081
1751
  "__#9@#createFlowRedirectModal"(widgetFlow: string): void;
2082
- "__#12372@#globalStyleTag": HTMLStyleElement;
1752
+ "__#24152@#globalStyleTag": HTMLStyleElement;
2083
1753
  readonly theme: _descope_sdk_mixins.ThemeOptions;
2084
1754
  readonly styleId: string;
2085
- "__#12372@#_themeResource": Promise<void | Record<string, any>>;
2086
- "__#12372@#fetchTheme"(): Promise<Record<string, any>>;
2087
- readonly "__#12372@#themeResource": Promise<void | Record<string, any>>;
2088
- "__#12372@#loadGlobalStyle"(): Promise<void>;
2089
- "__#12372@#loadComponentsStyle"(): Promise<void>;
2090
- "__#12372@#getFontsConfig"(): Promise<Record<string, {
1755
+ "__#24152@#_themeResource": Promise<void | Record<string, any>>;
1756
+ "__#24152@#fetchTheme"(): Promise<Record<string, any>>;
1757
+ readonly "__#24152@#themeResource": Promise<void | Record<string, any>>;
1758
+ "__#24152@#loadGlobalStyle"(): Promise<void>;
1759
+ "__#24152@#loadComponentsStyle"(): Promise<void>;
1760
+ "__#24152@#getFontsConfig"(): Promise<Record<string, {
2091
1761
  url?: string;
2092
1762
  }>>;
2093
- "__#12372@#loadFonts"(): Promise<void>;
2094
- "__#12372@#applyTheme"(): Promise<void>;
2095
- "__#12372@#onThemeChange": () => void;
2096
- "__#12372@#loadTheme"(): void;
2097
- "__#12372@#toggleOsThemeChangeListener": (listen: boolean) => void;
2098
- "__#12365@#debuggerEle": HTMLElement & {
1763
+ "__#24152@#loadFonts"(): Promise<void>;
1764
+ "__#24152@#applyTheme"(): Promise<void>;
1765
+ "__#24152@#onThemeChange": () => void;
1766
+ "__#24152@#loadTheme"(): void;
1767
+ "__#24152@#toggleOsThemeChangeListener": (listen: boolean) => void;
1768
+ "__#24145@#debuggerEle": HTMLElement & {
2099
1769
  updateData: (data: {
2100
1770
  title: string;
2101
1771
  description?: string;
@@ -2104,11 +1774,11 @@ declare const UserProfileWidget: {
2104
1774
  description?: string;
2105
1775
  }[]) => void;
2106
1776
  };
2107
- "__#12365@#disableDebugger"(): void;
2108
- "__#12365@#enableDebugger"(): Promise<void>;
1777
+ "__#24145@#disableDebugger"(): void;
1778
+ "__#24145@#enableDebugger"(): Promise<void>;
2109
1779
  readonly debug: boolean;
2110
- "__#12365@#handleDebugMode"(): void;
2111
- "__#12365@#updateDebuggerMessages"(title: string, description: string): void;
1780
+ "__#24145@#handleDebugMode"(): void;
1781
+ "__#24145@#updateDebuggerMessages"(title: string, description: string): void;
2112
1782
  };
2113
1783
  getFormattedValue(type: string, val: any): any;
2114
1784
  };