New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@descope/user-profile-widget

Package Overview
Dependencies
Maintainers
3
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@descope/user-profile-widget - npm Package Compare versions

Comparing version 0.0.14 to 0.0.15

2

dist/esm/index.js
/**
* @descope/user-profile-widget v0.0.14
* @descope/user-profile-widget v0.0.15
*/
import{createSingletonMixin as t,compose as e,createTemplate as i,kebabCase as s,withMemCache as o}from"@descope/sdk-helpers";import{__awaiter as r,__classPrivateFieldGet as n,__classPrivateFieldSet as a}from"tslib";import{projectIdMixin as d,observeAttributesMixin as l,loggerMixin as h,createValidateAttributesMixin as c,createStateManagementMixin as u,initLifecycleMixin as f,staticResourcesMixin as g,descopeUiMixin as v,initElementMixin as p,modalMixin as m,debuggerMixin as w,themeMixin as b}from"@descope/sdk-mixins";import{FlowDriver as y,AvatarDriver as R,UserAttributeDriver as W,UserAuthMethodDriver as k,ButtonDriver as M}from"@descope/sdk-component-drivers";import{createSelector as U}from"reselect";import{createAsyncThunk as j}from"@reduxjs/toolkit";import I from"@descope/web-js-sdk";import"@descope/core-js-sdk";import"@descope/web-component";const S=t=>t.me.data,A=U(S,(t=>t.picture)),C=U(S,(t=>t.email)),x=U(S,(t=>t.verifiedEmail)),q=U(S,(t=>t.name)),O=U(S,(t=>t.phone)),E=U(S,(t=>t.verifiedPhone)),P=U(S,(t=>t.webauthn));U(S,(t=>t.password));const F=t=>(...e)=>i=>{i.addCase(t.pending,((t,i)=>{e.forEach((({onPending:e})=>{null==e||e(t,i)}))})),i.addCase(t.fulfilled,((t,i)=>{e.forEach((({onFulfilled:e})=>{null==e||e(t,i)}))})),i.addCase(t.rejected,((t,i)=>{e.forEach((({onRejected:e})=>{null==e||e(t,i)}))}))},T=j("users/me",((t,{extra:{api:e}})=>e.user.me())),N=F(T)({onFulfilled:(t,e)=>{t.me.data=e.payload}},($=t=>t.me,{onFulfilled:t=>{$(t).loading=!1},onPending:t=>{$(t).loading=!0,$(t).error=null},onRejected:(t,e)=>{$(t).loading=!1,$(t).error=e.error}}));var $;const D={action:T,reducer:N},L=j("users/logout",((t,{extra:{api:e}})=>e.user.logout())),B={action:L,reducer:F(L)({})},V={me:{loading:!1,error:null,data:{}}},H={me:"/v1/auth/me"},J=()=>r(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})}))})),z=({httpClient:t,mock:e})=>({me:()=>r(void 0,void 0,void 0,(function*(){if(e)return J();const i=yield t.get(H.me);return yield(t=>r(void 0,void 0,void 0,(function*(){const e=yield t.text(),i=JSON.parse(e);if(!t.ok){const e=`${i.errorDescription}${i.errorMessage?`: ${i.errorMessage}`:""}`;throw Error(e||`${t.status} ${t.statusText}`)}t.json=()=>Promise.resolve(i),t.text=()=>Promise.resolve(e)})))(i),i.json()}))}),G=t((t=>{var i,s,o,u;const f=e(d,l,h,c({tenant:c.missingAttrValidator}))(t);return u=class extends f{constructor(){super(...arguments),i.add(this),s.set(this,void 0)}get baseUrl(){return this.getAttribute("base-url")}get tenant(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get api(){return n(this,s,"f")||n(this,i,"m",o).call(this),n(this,s,"f")}init(){const t=Object.create(null,{init:{get:()=>super.init}});var e;return r(this,void 0,void 0,(function*(){yield null===(e=t.init)||void 0===e?void 0:e.call(this),this.observeAttributes(["project-id","base-url","tenant"],(()=>{n(this,s,"f")&&n(this,i,"m",o).call(this)}))}))}},s=new WeakMap,i=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),a(this,s,((t,e,i)=>{const s=I(Object.assign(Object.assign({},t),{persistTokens:!0}));return{user:Object.assign(Object.assign({},z({httpClient:s.httpClient,tenant:e,mock:i})),{logout:i?()=>r(void 0,void 0,void 0,(function*(){})):s.logout})}})({projectId:this.projectId,baseUrl:this.baseUrl},this.tenant,"true"===this.mock),"f")},u})),K=t((t=>{const i=e(u({name:"widget",initialState:V,reducers:{},extraReducers:t=>{D.reducer(t),B.reducer(t)},asyncActions:{getMe:D.action,logout:B.action}}),f,h,G)(t);return class extends i{constructor(...t){super(...t),this.state=V,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),Q=t((t=>{const i=e(g,c({"widget-id":c.missingAttrValidator}))(t);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(t){return r(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`user-profile-widget/${this.widgetId}/${t}`,"text")).body}))}}})),X=t((t=>{var s,o,a;return a=class extends(e(h,f,v,p,Q,K)(t)){constructor(){super(...arguments),s.add(this)}onWidgetRootReady(){return r(this,void 0,void 0,(function*(){}))}init(){const t=Object.create(null,{init:{get:()=>super.init}});var e;return r(this,void 0,void 0,(function*(){yield null===(e=t.init)||void 0===e?void 0:e.call(this),yield Promise.all([this.actions.getMe(),n(this,s,"m",o).call(this)]),this.onWidgetRootReady()}))}},s=new WeakSet,o=function(){return r(this,void 0,void 0,(function*(){const t=i(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(t),this.contentRootElement.append(t.content.cloneNode(!0))}))},a})),Y=(t={})=>{const e=i("<descope-wc></descope-wc>");return Object.entries(t).forEach((([t,i])=>{e.content.querySelector("descope-wc").setAttribute(s(t),i)})),e},Z=t((t=>{var i,s,d,l,c,u,f,g,v;return v=class extends(e(K,h,X,m)(t)){constructor(){super(...arguments),i.add(this),s.set(this,void 0),d.set(this,void 0),f.set(this,o((t=>{this.avatar.image=t}))),g.set(this,o((t=>{this.avatar.displayName=t})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var e;return r(this,void 0,void 0,(function*(){yield null===(e=t.onWidgetRootReady)||void 0===e?void 0:e.call(this),n(this,i,"m",u).call(this),n(this,i,"m",l).call(this),n(this,f,"f").call(this,A(this.state)),n(this,g,"f").call(this,q(this.state)),this.subscribe(n(this,f,"f").bind(this),A),this.subscribe(n(this,g,"f").bind(this),q)}))}},s=new WeakMap,d=new WeakMap,f=new WeakMap,g=new WeakMap,i=new WeakSet,l=function(){a(this,s,this.createModal({"data-id":"update-pic"}),"f"),a(this,d,new y((()=>{var t;return null===(t=n(this,s,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),n(this,s,"f").afterClose=n(this,i,"m",c).bind(this),n(this,i,"m",c).call(this)},c=function(){n(this,s,"f").setContent(Y({projectId:this.projectId,flowId:this.avatar.flowId,baseUrl:this.baseUrl})),n(this,d,"f").onSuccess((()=>{n(this,s,"f").close(),this.actions.getMe()}))},u=function(){this.avatar=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-avatar")}),{logger:this.logger}),this.avatar.onClick((()=>{n(this,s,"f").open()}))},v})),_=t((t=>{var i,s,d,l,c,u,f,g,v,p,w,b,R;return R=class extends(e(K,h,X,m)(t)){constructor(){super(...arguments),i.add(this),s.set(this,void 0),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),w.set(this,o((t=>{this.emailUserAttr.value=t}))),b.set(this,o((t=>{this.emailUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var e;return r(this,void 0,void 0,(function*(){yield null===(e=t.onWidgetRootReady)||void 0===e?void 0:e.call(this),n(this,i,"m",p).call(this),n(this,i,"m",u).call(this),n(this,i,"m",g).call(this),n(this,w,"f").call(this,C(this.state)),n(this,b,"f").call(this,x(this.state)),this.subscribe(n(this,w,"f").bind(this),C),this.subscribe(n(this,b,"f").bind(this),x)}))}},s=new WeakMap,d=new WeakMap,l=new WeakMap,c=new WeakMap,w=new WeakMap,b=new WeakMap,i=new WeakSet,u=function(){a(this,s,this.createModal({"data-id":"edit-email"}),"f"),a(this,d,new y((()=>{var t;return null===(t=n(this,s,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),n(this,s,"f").afterClose=n(this,i,"m",f).bind(this),n(this,i,"m",f).call(this)},f=function(){n(this,s,"f").setContent(Y({projectId:this.projectId,flowId:this.emailUserAttr.editFlowId,baseUrl:this.baseUrl})),n(this,d,"f").onSuccess((()=>{n(this,s,"f").close(),this.actions.getMe()}))},g=function(){a(this,l,this.createModal({"data-id":"delete-email"}),"f"),a(this,c,new y((()=>{var t;return null===(t=n(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),n(this,l,"f").afterClose=n(this,i,"m",v).bind(this),n(this,i,"m",v).call(this)},v=function(){n(this,l,"f").setContent(Y({projectId:this.projectId,flowId:this.emailUserAttr.deleteFlowId,baseUrl:this.baseUrl})),n(this,c,"f").onSuccess((()=>{n(this,l,"f").close(),this.actions.getMe()}))},p=function(){this.emailUserAttr=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="email"]')}),{logger:this.logger}),this.emailUserAttr.onEditClick((()=>{n(this,s,"f").open()})),this.emailUserAttr.onDeleteClick((()=>{n(this,l,"f").open()}))},R})),tt=t((t=>{var i,s,d,l,c,u,f,g,v,p,w,b;return b=class extends(e(K,h,X,m)(t)){constructor(){super(...arguments),i.add(this),s.set(this,void 0),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),w.set(this,o((t=>{this.nameUserAttr.value=t})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var e;return r(this,void 0,void 0,(function*(){yield null===(e=t.onWidgetRootReady)||void 0===e?void 0:e.call(this),n(this,i,"m",p).call(this),n(this,i,"m",u).call(this),n(this,i,"m",g).call(this),n(this,w,"f").call(this,q(this.state)),this.subscribe(n(this,w,"f").bind(this),q)}))}},s=new WeakMap,d=new WeakMap,l=new WeakMap,c=new WeakMap,w=new WeakMap,i=new WeakSet,u=function(){a(this,s,this.createModal({"data-id":"edit-name"}),"f"),a(this,d,new y((()=>{var t;return null===(t=n(this,s,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),n(this,s,"f").afterClose=n(this,i,"m",f).bind(this),n(this,i,"m",f).call(this)},f=function(){n(this,s,"f").setContent(Y({projectId:this.projectId,flowId:this.nameUserAttr.editFlowId,baseUrl:this.baseUrl})),n(this,d,"f").onSuccess((()=>{n(this,s,"f").close(),this.actions.getMe()}))},g=function(){a(this,l,this.createModal({"data-id":"delete-name"}),"f"),a(this,c,new y((()=>{var t;return null===(t=n(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),n(this,l,"f").afterClose=n(this,i,"m",v).bind(this),n(this,i,"m",v).call(this)},v=function(){n(this,l,"f").setContent(Y({projectId:this.projectId,flowId:this.nameUserAttr.deleteFlowId,baseUrl:this.baseUrl})),n(this,c,"f").onSuccess((()=>{n(this,l,"f").close(),this.actions.getMe()}))},p=function(){this.nameUserAttr=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="name"]')}),{logger:this.logger}),this.nameUserAttr.onEditClick((()=>{n(this,s,"f").open()})),this.nameUserAttr.onDeleteClick((()=>{n(this,l,"f").open()}))},b})),et=t((t=>{var i,s,d,l,c,u,f,g,v,p,w,b,R;return R=class extends(e(K,h,X,m)(t)){constructor(){super(...arguments),i.add(this),s.set(this,void 0),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),w.set(this,o((t=>{this.phoneUserAttr.value=t}))),b.set(this,o((t=>{this.phoneUserAttr.badgeLabel=t?"":"Unverified"})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var e;return r(this,void 0,void 0,(function*(){yield null===(e=t.onWidgetRootReady)||void 0===e?void 0:e.call(this),n(this,i,"m",p).call(this),n(this,i,"m",u).call(this),n(this,i,"m",g).call(this),n(this,w,"f").call(this,O(this.state)),n(this,b,"f").call(this,E(this.state)),this.subscribe(n(this,w,"f").bind(this),O),this.subscribe(n(this,b,"f").bind(this),E)}))}},s=new WeakMap,d=new WeakMap,l=new WeakMap,c=new WeakMap,w=new WeakMap,b=new WeakMap,i=new WeakSet,u=function(){a(this,s,this.createModal({"data-id":"edit-phone"}),"f"),a(this,d,new y((()=>{var t;return null===(t=n(this,s,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),n(this,s,"f").afterClose=n(this,i,"m",f).bind(this),n(this,i,"m",f).call(this)},f=function(){n(this,s,"f").setContent(Y({projectId:this.projectId,flowId:this.phoneUserAttr.editFlowId,baseUrl:this.baseUrl})),n(this,d,"f").onSuccess((()=>{n(this,s,"f").close(),this.actions.getMe()}))},g=function(){a(this,l,this.createModal({"data-id":"delete-phone"}),"f"),a(this,c,new y((()=>{var t;return null===(t=n(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),n(this,l,"f").afterClose=n(this,i,"m",v).bind(this),n(this,i,"m",v).call(this)},v=function(){n(this,l,"f").setContent(Y({projectId:this.projectId,flowId:this.phoneUserAttr.deleteFlowId,baseUrl:this.baseUrl})),n(this,c,"f").onSuccess((()=>{n(this,l,"f").close(),this.actions.getMe()}))},p=function(){this.phoneUserAttr=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="phone"]')}),{logger:this.logger}),this.phoneUserAttr.onEditClick((()=>{n(this,s,"f").open()})),this.phoneUserAttr.onDeleteClick((()=>{n(this,l,"f").open()}))},R})),it=t((t=>{var i,s,d,l,c,u,f,g;return g=class extends(e(K,h,X,m)(t)){constructor(){super(...arguments),i.add(this),s.set(this,void 0),d.set(this,void 0),f.set(this,o((t=>{this.passkeyUserAuthMethod.fulfilled=t})))}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var e;return r(this,void 0,void 0,(function*(){yield null===(e=t.onWidgetRootReady)||void 0===e?void 0:e.call(this),n(this,i,"m",u).call(this),n(this,i,"m",l).call(this),n(this,f,"f").call(this,P(this.state)),this.subscribe(n(this,f,"f").bind(this),P)}))}},s=new WeakMap,d=new WeakMap,f=new WeakMap,i=new WeakSet,l=function(){a(this,s,this.createModal({"data-id":"passkey"}),"f"),a(this,d,new y((()=>{var t;return null===(t=n(this,s,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),n(this,s,"f").afterClose=n(this,i,"m",c).bind(this),n(this,i,"m",c).call(this)},c=function(){n(this,s,"f").setContent(Y({projectId:this.projectId,flowId:this.passkeyUserAuthMethod.flowId,baseUrl:this.baseUrl})),n(this,d,"f").onSuccess((()=>{n(this,s,"f").close(),this.actions.getMe()}))},u=function(){this.passkeyUserAuthMethod=new k((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="passkey"]')}),{logger:this.logger}),this.passkeyUserAuthMethod.onButtonClick((()=>{n(this,s,"f").open()}))},g})),st=t((t=>{var i,s,o,d,l,c,u;return u=class extends(e(K,h,X,m)(t)){constructor(){super(...arguments),i.add(this),s.set(this,void 0),o.set(this,void 0)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var e;return r(this,void 0,void 0,(function*(){yield null===(e=t.onWidgetRootReady)||void 0===e?void 0:e.call(this),n(this,i,"m",c).call(this),n(this,i,"m",d).call(this)}))}},s=new WeakMap,o=new WeakMap,i=new WeakSet,d=function(){a(this,s,this.createModal({"data-id":"password"}),"f"),a(this,o,new y((()=>{var t;return null===(t=n(this,s,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),n(this,s,"f").afterClose=n(this,i,"m",l).bind(this),n(this,i,"m",l).call(this)},l=function(){n(this,s,"f").setContent(Y({projectId:this.projectId,flowId:this.passwordUserAuthMethod.flowId,baseUrl:this.baseUrl})),n(this,o,"f").onSuccess((()=>{n(this,s,"f").close()}))},c=function(){this.passwordUserAuthMethod=new k((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="password"]')}),{logger:this.logger}),this.passwordUserAuthMethod.onButtonClick((()=>{n(this,s,"f").open()}))},u})),ot=t((t=>{var i,s,o;return o=class extends(e(K,h,X,m)(t)){constructor(){super(...arguments),i.add(this)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});var e;return r(this,void 0,void 0,(function*(){yield null===(e=t.onWidgetRootReady)||void 0===e?void 0:e.call(this),n(this,i,"m",s).call(this)}))}},i=new WeakSet,s=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((()=>r(this,void 0,void 0,(function*(){yield this.actions.logout(),this.dispatchEvent(new CustomEvent("logout"))}))))},o})),rt=t((t=>class extends(e(w,b,Z,_,tt,et,it,st,ot)(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});var e;return r(this,void 0,void 0,(function*(){yield null===(e=t.init)||void 0===e?void 0:e.call(this)}))}})),nt=e((t=>class extends(rt(t)){}))(HTMLElement);customElements.define("descope-user-profile-widget",nt);export{nt as default};
//# sourceMappingURL=index.js.map
{
"name": "@descope/user-profile-widget",
"version": "0.0.14",
"version": "0.0.15",
"author": "Descope Team <info@descope.com>",

@@ -43,3 +43,3 @@ "homepage": "https://github.com/descope/descope-js",

"eslint-plugin-import": "2.29.1",
"eslint-plugin-jest": "28.0.0",
"eslint-plugin-jest": "28.2.0",
"eslint-plugin-jest-dom": "5.1.0",

@@ -81,10 +81,10 @@ "eslint-plugin-jest-formatting": "3.1.0",

"immer": "^10.0.3",
"@descope/web-component": "3.11.8",
"@descope/sdk-helpers": "0.1.25",
"@descope/sdk-mixins": "0.2.7",
"@descope/sdk-component-drivers": "0.2.6",
"@descope/web-js-sdk": "1.10.40"
"@descope/web-js-sdk": "1.10.41",
"@descope/web-component": "3.11.9",
"@descope/sdk-helpers": "0.1.26",
"@descope/sdk-mixins": "0.2.8",
"@descope/sdk-component-drivers": "0.2.7"
},
"optionalDependencies": {
"@descope/core-js-sdk": "2.14.3"
"@descope/core-js-sdk": "2.14.4"
},

@@ -91,0 +91,0 @@ "overrides": {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc