@descope/tenant-profile-widget 0.7.3 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +461 -361
- 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/tenant-profile-widget v0.
|
|
3
|
+
* @descope/tenant-profile-widget v0.8.0
|
|
4
4
|
*/
|
|
5
|
-
import{__awaiter as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{createTemplate as s,kebabCase as n,createSingletonMixin as o,compose as a,withMemCache as r}from"@descope/sdk-helpers";import{projectIdMixin as l,observeAttributesMixin as d,loggerMixin as h,baseUrlMixin as c,cookieConfigMixin as u,DEFAULT_STYLE_ID as f,createStateManagementMixin as v,initLifecycleMixin as m,localeMixin as g,modalMixin as p,themeMixin as w,descopeUiMixin as b,initElementMixin as y,createFetchWidgetPagesMixin as S,debuggerMixin as k}from"@descope/sdk-mixins";import{createSelector as I}from"reselect";import{FlowDriver as C,MultiSsoConfigurationsDriver as U,LinkDriver as R,UserAttributeDriver as W,UserAuthMethodDriver as O}from"@descope/sdk-component-drivers";import{createAsyncThunk as T}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import x from"@descope/web-js-sdk";import"@descope/web-component";const M=t=>t.tenant.data,D=t=>t.tenantAdminLinkSSO.data.defaultLink,E=I(M,(t=>t.customAttributes||{})),j=I(M,(t=>t.name||"")),A=I(M,(t=>t.selfProvisioningDomains||[])),N=I(M,(t=>t.enforceSSOExclusions||[])),F=I(M,(t=>t.enforceSSO||!1)),L=I(M,D,(t=>t.tenantAdminLinkSSO.data.ssoIdToLink),((t,e,i)=>[...t?[{id:"",name:"Default SSO Configuration",authType:t.authType,isDefault:!0,link:e}]:[],...((null==t?void 0:t.additionalSSOConfigs)||[]).map((({ssoId:t,name:e,authType:s})=>({id:t,name:e,authType:s,link:i[t]||""})))])),q=I(M,(t=>((null==t?void 0:t.additionalSSOConfigs)||[]).map((({ssoId:t})=>t)))),P=(t={})=>{const e=s("<descope-wc></descope-wc>");return Object.entries(t).forEach((([t,i])=>{e.content.querySelector("descope-wc").setAttribute(n(t),i)})),e};function $(t){return new URLSearchParams(window.location.search).get(t)}const B=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)}))}))},J=t=>({onFulfilled:e=>{t(e).loading=!1},onPending:e=>{t(e).loading=!0,t(e).error=null},onRejected:(e,i)=>{t(e).loading=!1,t(e).error=i.error}}),H=T("users/me",((t,{extra:{api:e}})=>e.user.me())),_=B(H)({onFulfilled:(t,e)=>{t.me.data=e.payload}},J((t=>t.me))),z={action:H,reducer:_},X=T("tenant/details",((t,{extra:{api:e}})=>e.tenant.details())),Y=B(X)({onFulfilled:(t,e)=>{t.tenant.data=e.payload}},J((t=>t.tenant))),G={action:X,reducer:Y},K=T("tenant/adminLinkSso",(({ssoIds:t},{extra:{api:e}})=>e.tenant.adminLinkSso({ssoIds:t}))),Q={action:K,reducer:B(K)({onFulfilled:(t,e)=>{var i;t.tenantAdminLinkSSO.data=null!==(i=e.payload)&&void 0!==i?i:{defaultLink:"",ssoIdToLink:{}}}},J((t=>t.tenantAdminLinkSSO)))},V={me:{loading:!1,error:null,data:{}},tenant:{loading:!1,error:null,data:{}},tenantAdminLinkSSO:{loading:!1,error:null,data:{defaultLink:"",ssoIdToLink:{}}}},Z={me:"/v1/auth/me"},tt={details:"/v1/mgmt/tenant",adminLinkSso:"/v1/mgmt/tenant/adminlinks/sso/authenticated/batch"},et=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)})),it=()=>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})}))})),st=()=>t(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({tenantId:"tenant-1",roleNames:["admin"],id:"tenant-1",name:"Test Tenant",selfProvisioningDomains:["example1.com","example2.com"],customAttributes:{},authType:"password",domains:[],createdTime:Date.now(),disabled:!1,enforceSSO:!0})}))})),nt=()=>t(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({defaultLink:"_blank",ssoIdToLink:{"okta-prod":"_blank?ssoId=okta-prod","entra-eu":"_blank?ssoId=entra-eu"}})}))})),ot=({httpClient:e,tenantId:i,mock:s})=>{const n=encodeURIComponent(i||""),o=`?tenant=${n}&id=${n}`;return{details:()=>t(void 0,void 0,void 0,(function*(){if(s)return st();if(!i)throw new Error("tenantId is not defined");const t=`${tt.details}${o}`,n=yield e.get(t);yield et(n);return yield n.json()})),adminLinkSso:o=>t(void 0,[o],void 0,(function*({ssoIds:t}){if(s)return nt();if(!i)throw new Error("tenantId is not defined");const o=yield e.post(`${tt.adminLinkSso}?tenant=${n}`,{tenantId:n,ssoIds:t},{headers:{"Content-Type":"application/json"}});yield et(o);return yield o.json()}))}},at=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return it();const t=yield e.get(Z.me);return yield et(t),t.json()}))}),rt=o((s=>{var n,o,r,v;const m=a(l,d,h,c,u)(s);return v=class extends m{constructor(){super(...arguments),n.add(this),o.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get styleId(){return this.getAttribute("style-id")||f}get api(){return e(this,o,"f")||e(this,n,"m",r).call(this),e(this,o,"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","tenant","mock"],(()=>{e(this,o,"f")&&e(this,n,"m",r).call(this)}))}))}},o=new WeakMap,n=new WeakSet,r=function(){this.logger.debug("creating an sdk instance"),i(this,o,((t,e,i,s)=>{const n=x(Object.assign(Object.assign({},t),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"tenant-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.7.3"}}));return{user:at({httpClient:n.httpClient,mock:i}),tenant:ot({httpClient:n.httpClient,tenantId:e,mock:i})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},v})),lt=o((t=>{const e=a(v({name:"widget",initialState:V,reducers:{},extraReducers:t=>{z.reducer(t),G.reducer(t),Q.reducer(t)},asyncActions:{getMe:z.action,getTenant:G.action,getTenantAdminLinkSSO:Q.action}}),m,h,rt)(t);return class extends e{constructor(...t){super(...t),this.state=V,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),dt="widget-flow",ht=o((i=>{var s,n,o;return o=class extends(a(g,m,p,lt,u,h,w)(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=$(dt);o&&(!function(t){if(window.history.replaceState&&$(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())}}(dt),e(this,s,"m",n).call(this,o))}))}},s=new WeakSet,n=function(e){const i=this.createModal({"data-id":"redirect-flow"});i.setContent(P({locale:this.locale,projectId:this.projectId,flowId:e,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId}));new C((()=>{var t;return null===(t=i.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>t(this,void 0,void 0,(function*(){i.close(),this.actions.getMe(),yield this.actions.getTenant();const t=q(this.state);yield this.actions.getTenantAdminLinkSSO({ssoIds:t})})))),i.afterClose=()=>{i.remove()},i.open()},o})),ct=o((t=>class extends(a(w,d)(t)){syncFlowTheme(t){t.theme=this.theme,this.observeAttributes(["theme"],(()=>{t.theme=this.theme}))}}));const ut=o((i=>{var n,o,r;return r=class extends(a(h,m,b,y,S("tenant-profile-widget"),lt)(i)){constructor(){super(...arguments),n.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);try{yield Promise.all([this.actions.getMe(),this.actions.getTenant()]);const t=q(this.state);yield this.actions.getTenantAdminLinkSSO({ssoIds:t})}catch(t){}const s=this.state.me.error||(t=>t.tenant.error)(this.state)||(t=>t.tenantAdminLinkSSO.error)(this.state);if(s){this.contentRootElement.innerHTML="";const t="object"==typeof s&&null!==s&&"message"in s?s.message:String(s)||"An error occurred";this.contentRootElement.append(function({mainMessage:t="An error occurred"}){const e=document.createElement("div");e.setAttribute("data-id","widget-error"),e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="center",e.style.justifyContent="center",e.style.padding="72px 36px",e.style.background="#fff",e.style.borderRadius="12px",e.style.boxShadow="0 2px 8px rgba(0,0,0,0.03)",e.style.margin="32px auto",e.style.maxWidth="400px";const i=document.createElement("div");i.innerHTML='\n <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="20" cy="20" r="18" stroke="#FF3B3B" stroke-width="3" fill="#fff"/>\n <text x="20" y="27" text-anchor="middle" font-size="24" font-family="Arial, sans-serif" fill="#FF3B3B">!</text>\n </svg>\n ',i.style.marginBottom="12px",e.appendChild(i);const s=document.createElement("div");return s.textContent=t,s.style.fontWeight="bold",s.style.fontSize="20px",s.style.color="#222",s.style.textAlign="center",s.style.marginTop="8px",e.appendChild(s),e}({mainMessage:t}))}else yield e(this,n,"m",o).call(this),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},n=new WeakSet,o=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))}))},r})),ft=o((s=>{var n,o,r,l,d,c,u,f,v,m,g,w;return w=class extends(a(ct,lt,p,h,ut)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0)}onWidgetRootReady(){const s=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=s.onWidgetRootReady)||void 0===t?void 0:t.call(this),i(this,o,new U((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-multi-sso")}),{logger:this.logger}),"f"),e(this,o,"f").isExists&&(e(this,n,"m",g).call(this),e(this,o,"f").data=L(this.state),this.subscribe((t=>{e(this,o,"f").data=t}),L))}))}},o=new WeakMap,r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,n=new WeakSet,u=function(){i(this,r,this.createModal({"data-id":"multi-sso-create-modal"}),"f"),i(this,l,new C((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(e(this,l,"f"))},f=function(){i(this,d,this.createModal({"data-id":"multi-sso-delete-modal"}),"f"),i(this,c,new C((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(e(this,c,"f"))},v=function(i){e(this,r,"f").setContent(P({projectId:this.projectId,flowId:i,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,tenant:this.tenantId})),e(this,r,"f").open(),e(this,l,"f").onSuccess((()=>t(this,void 0,void 0,(function*(){e(this,r,"f").close(),yield this.actions.getTenant();const t=q(this.state);yield this.actions.getTenantAdminLinkSSO({ssoIds:t})}))))},m=function(t,i){e(this,d,"f").setContent(P({projectId:this.projectId,flowId:t,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,tenant:this.tenantId,form:JSON.stringify({deleteSSOConfigurationId:i})})),e(this,d,"f").open(),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getTenant()}))},g=function(){const{createFlowId:t,deleteFlowId:i}=e(this,o,"f");i&&(e(this,n,"m",f).call(this),e(this,o,"f").onDeleteClicked((({id:t})=>e(this,n,"m",m).call(this,i,t)))),t&&(e(this,n,"m",u).call(this),e(this,o,"f").onCreateClicked((()=>e(this,n,"m",v).call(this,t))))},w})),vt=o((i=>{var s,n,o,l;return l=class extends(a(ct,lt,h,ut,u,p)(i)){constructor(){super(...arguments),s.add(this),o.set(this,r((t=>{this.tenantAdminLinkSSODriver.href=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,s,"m",n).call(this),e(this,o,"f").call(this,D(this.state)),this.subscribe(e(this,o,"f").bind(this),D)}))}},o=new WeakMap,s=new WeakSet,n=function(){this.tenantAdminLinkSSODriver=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-link[data-id="tenant-admin-link-sso"]')}),{logger:this.logger})},l}));var mt;!function(t){t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t.SINGLE_SELECT="singleSelect",t.ARRAY="array",t.DATE="date"}(mt||(mt={}));const gt=o((i=>{var s,n,o,l,d,c,f,v,m,w,b;return b=class extends(a(g,ct,lt,h,ut,u,p)(i)){constructor(){super(...arguments),s.add(this),n.set(this,{}),o.set(this,{}),l.set(this,{}),d.set(this,{}),v.set(this,r((t=>{var i;const n=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(n).forEach((i=>{const n=i.getAttribute("data-id").replace("customAttributes.",""),o=i.getAttribute("data-type")||mt.TEXT,a=t[n],r=new W(i,{logger:this.logger});r.value=((t,e)=>t===mt.DATE&&e?new Date(e).toLocaleString():t===mt.BOOLEAN&&void 0!==e?e?"True":"False":(e||"").toString())(o,a),e(this,s,"m",m).call(this,i,n,r,o,n),e(this,s,"m",w).call(this,i,n,r)}))})))}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,v,"f").call(this,E(this.state)),this.subscribe(e(this,v,"f").bind(this),E)}))}},n=new WeakMap,o=new WeakMap,l=new WeakMap,d=new WeakMap,v=new WeakMap,s=new WeakSet,c=function(t,i,s){var a,r;const l=E(this.state)[s],d=i===mt.ARRAY?(l||[]).join(","):l;null===(a=e(this,n,"f")[t])||void 0===a||a.setContent(P({locale:this.locale,projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({customAttributes:{[s]:d}})})),null===(r=e(this,o,"f")[t])||void 0===r||r.onSuccess((()=>{var i;null===(i=e(this,n,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},f=function(t){var i,s;null===(i=e(this,l,"f")[t])||void 0===i||i.setContent(P({locale:this.locale,projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),null===(s=e(this,d,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,l,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},m=function(t,i,a,r,l){const d=t.getAttribute("edit-flow-id");d&&(e(this,n,"f")[d]||(e(this,n,"f")[d]=this.createModal({"data-id":`edit-${i}`}),e(this,o,"f")[d]=new C((()=>{var t,i;return null===(i=null===(t=e(this,n,"f")[d])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,n,"f")[d].beforeOpen=e(this,s,"m",c).bind(this,d,r,l),a.onEditClick((()=>{var t,i;null===(i=null===(t=e(this,n,"f"))||void 0===t?void 0:t[d])||void 0===i||i.open()})),this.syncFlowTheme(e(this,o,"f")[d])))},w=function(t,i,n){const o=t.getAttribute("delete-flow-id");o&&(e(this,l,"f")[o]||(e(this,l,"f")[o]=this.createModal({"data-id":`delete-${i}`}),e(this,d,"f")[o]=new C((()=>{var t,i;return null===(i=null===(t=e(this,l,"f")[o])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,l,"f")[o].beforeOpen=e(this,s,"m",f).bind(this,o),n.onDeleteClick((()=>{var t,i;null===(i=null===(t=e(this,l,"f"))||void 0===t?void 0:t[o])||void 0===i||i.open()})),this.syncFlowTheme(e(this,d,"f")[o])))},b})),pt=o((s=>{var n,o,l,d,c,f,v,m,w,b,y,S;return S=class extends(a(g,ct,lt,h,ut,u,p)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),y.set(this,r((t=>{this.tenantEmailDomainsDriver.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,n,"m",b).call(this),e(this,n,"m",f).call(this),e(this,n,"m",m).call(this),e(this,y,"f").call(this,A(this.state)),this.subscribe(e(this,y,"f").bind(this),A)}))}},o=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,y=new WeakMap,n=new WeakSet,f=function(){this.tenantEmailDomainsDriver.editFlowId&&(i(this,o,this.createModal({"data-id":"edit-tenant-email-domains"}),"f"),i(this,l,new C((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").beforeOpen=e(this,n,"m",v).bind(this),e(this,n,"m",v).call(this),this.syncFlowTheme(e(this,l,"f")))},v=function(){e(this,o,"f").setContent(P({locale:this.locale,projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({tenantEmailDomains:A(this.state)})})),e(this,l,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},m=function(){this.tenantEmailDomainsDriver.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-tenant-email-domains"}),"f"),i(this,c,new C((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").beforeOpen=e(this,n,"m",w).bind(this),e(this,n,"m",w).call(this),this.syncFlowTheme(e(this,c,"f")))},w=function(){e(this,d,"f").setContent(P({locale:this.locale,projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getTenant()}))},b=function(){this.tenantEmailDomainsDriver=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-email-domains-edit"]')}),{logger:this.logger}),this.tenantEmailDomainsDriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()})),this.tenantEmailDomainsDriver.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},S})),wt=o((s=>{var n,o,l,d,c,f,v,m,w,b,y,S;return S=class extends(a(g,ct,lt,h,ut,u,p)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),y.set(this,r((t=>{this.tenantSSOExclusionsDriver.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,n,"m",b).call(this),e(this,n,"m",f).call(this),e(this,n,"m",m).call(this),e(this,y,"f").call(this,N(this.state)),this.subscribe(e(this,y,"f").bind(this),N)}))}},o=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,y=new WeakMap,n=new WeakSet,f=function(){this.tenantSSOExclusionsDriver.editFlowId&&(i(this,o,this.createModal({"data-id":"edit-tenant-sso-exclusions"}),"f"),i(this,l,new C((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").beforeOpen=e(this,n,"m",v).bind(this),e(this,n,"m",v).call(this),this.syncFlowTheme(e(this,l,"f")))},v=function(){e(this,o,"f").setContent(P({locale:this.locale,projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({enforceSSOExclusions:N(this.state)})})),e(this,l,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},m=function(){this.tenantSSOExclusionsDriver.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-tenant-sso-exclusions"}),"f"),i(this,c,new C((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").beforeOpen=e(this,n,"m",w).bind(this),e(this,n,"m",w).call(this),this.syncFlowTheme(e(this,c,"f")))},w=function(){e(this,d,"f").setContent(P({locale:this.locale,projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getTenant()}))},b=function(){this.tenantSSOExclusionsDriver=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-force-sso-exclusions-edit"]')}),{logger:this.logger}),this.tenantSSOExclusionsDriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()})),this.tenantSSOExclusionsDriver.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},S})),bt=o((s=>{var n,o,l,d,c,f,v,m,w,b,y,S;return S=class extends(a(g,ct,lt,h,ut,u,p)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),y.set(this,r((t=>{this.tenantEnforceSSODriver.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,n,"m",b).call(this),e(this,n,"m",f).call(this),e(this,n,"m",m).call(this),e(this,y,"f").call(this,F(this.state)),this.subscribe(e(this,y,"f").bind(this),F)}))}},o=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,y=new WeakMap,n=new WeakSet,f=function(){this.tenantEnforceSSODriver.editFlowId&&(i(this,o,this.createModal({"data-id":"edit-tenant-enforce-sso"}),"f"),i(this,l,new C((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").beforeOpen=e(this,n,"m",v).bind(this),e(this,n,"m",v).call(this),this.syncFlowTheme(e(this,l,"f")))},v=function(){e(this,o,"f").setContent(P({locale:this.locale,projectId:this.projectId,flowId:this.tenantEnforceSSODriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({enforceSSO:F(this.state)})})),e(this,l,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},m=function(){this.tenantEnforceSSODriver.deleteFlowId&&(i(this,d,this.createModal({"data-id":"delete-tenant-enforce-sso"}),"f"),i(this,c,new C((()=>{var t;return null===(t=e(this,d,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,d,"f").beforeOpen=e(this,n,"m",w).bind(this),e(this,n,"m",w).call(this),this.syncFlowTheme(e(this,c,"f")))},w=function(){e(this,d,"f").setContent(P({locale:this.locale,projectId:this.projectId,flowId:this.tenantEnforceSSODriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId})),e(this,c,"f").onSuccess((()=>{e(this,d,"f").close(),this.actions.getTenant()}))},b=function(){this.tenantEnforceSSODriver=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-enforce-sso-edit"]')}),{logger:this.logger}),this.tenantEnforceSSODriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()})),this.tenantEnforceSSODriver.onDeleteClick((()=>{var t;null===(t=e(this,d,"f"))||void 0===t||t.open()}))},S})),yt=o((s=>{var n,o,l,d,c,f,v,m;return m=class extends(a(g,ct,lt,h,ut,u,p)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),l.set(this,void 0),v.set(this,r((t=>{this.tenantNameDriver.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,n,"m",f).call(this),e(this,n,"m",d).call(this),e(this,v,"f").call(this,j(this.state)),this.subscribe(e(this,v,"f").bind(this),j)}))}},o=new WeakMap,l=new WeakMap,v=new WeakMap,n=new WeakSet,d=function(){this.tenantNameDriver.editFlowId&&(i(this,o,this.createModal({"data-id":"tenant-profile-set-name"}),"f"),i(this,l,new C((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").beforeOpen=e(this,n,"m",c).bind(this),e(this,n,"m",c).call(this),this.syncFlowTheme(e(this,l,"f")))},c=function(){e(this,o,"f").setContent(P({locale:this.locale,projectId:this.projectId,flowId:this.tenantNameDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,"style-id":this.styleId,form:JSON.stringify({tenantName:j(this.state)})})),e(this,l,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},f=function(){this.tenantNameDriver=new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-name-edit"]')}),{logger:this.logger}),this.tenantNameDriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()}))},m})),St=o((s=>{var n,o,r,l,d,c,f;return f=class extends(a(g,ct,lt,h,ut,u,p)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),r.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,n,"m",c).call(this),e(this,n,"m",l).call(this)}))}},o=new WeakMap,r=new WeakMap,n=new WeakSet,l=function(){this.TenantPasswordPolicyUserAuthMethodDriver.flowId&&(i(this,o,this.createModal({"data-id":"password-policy"}),"f"),i(this,r,new C((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").afterClose=e(this,n,"m",d).bind(this),e(this,n,"m",d).call(this),this.syncFlowTheme(e(this,r,"f")))},d=function(){e(this,o,"f").setContent(P({locale:this.locale,projectId:this.projectId,flowId:this.TenantPasswordPolicyUserAuthMethodDriver.flowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e(this,r,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},c=function(){this.TenantPasswordPolicyUserAuthMethodDriver=new O((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="password-policy"]')}),{logger:this.logger}),this.TenantPasswordPolicyUserAuthMethodDriver.onUnfulfilledButtonClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()}))},f})),kt=o((s=>{var n,o,r,l,d,c,f;return f=class extends(a(g,ct,lt,h,ut,u,p)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),r.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,n,"m",c).call(this),e(this,n,"m",l).call(this)}))}},o=new WeakMap,r=new WeakMap,n=new WeakSet,l=function(){this.TenantSessionSettingsUserAuthMethodDriver.flowId&&(i(this,o,this.createModal({"data-id":"session-settings"}),"f"),i(this,r,new C((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").afterClose=e(this,n,"m",d).bind(this),e(this,n,"m",d).call(this),this.syncFlowTheme(e(this,r,"f")))},d=function(){e(this,o,"f").setContent(P({locale:this.locale,projectId:this.projectId,flowId:this.TenantSessionSettingsUserAuthMethodDriver.flowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e(this,r,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},c=function(){this.TenantSessionSettingsUserAuthMethodDriver=new O((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="session-settings"]')}),{logger:this.logger}),this.TenantSessionSettingsUserAuthMethodDriver.onUnfulfilledButtonClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()}))},f})),It=o((e=>class extends(a(k,w,ht,ut,yt,pt,wt,bt,gt,vt,St,kt,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)}))}})),Ct=a((e=>class extends(It(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this);(customElements.get("descope-wc")||(yield import("@descope/web-component").then((t=>t.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"tenant-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.7.3"}}}))}}))(HTMLElement);customElements.define("descope-tenant-profile-widget",Ct);export{Ct as default};
|
|
5
|
+
import{__awaiter as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{createSingletonMixin as s,compose as n,createTemplate as o,withMemCache as a}from"@descope/sdk-helpers";import{projectIdMixin as r,observeAttributesMixin as d,loggerMixin as l,baseUrlMixin as h,cookieConfigMixin as c,DEFAULT_STYLE_ID as u,createStateManagementMixin as f,initLifecycleMixin as v,localeMixin as m,modalMixin as g,themeMixin as p,flowInputMixin as w,descopeUiMixin as y,initElementMixin as S,createFetchWidgetPagesMixin as k,debuggerMixin as b}from"@descope/sdk-mixins";import{createSelector as R}from"reselect";import{FlowDriver as T,MultiSsoConfigurationsDriver as W,LinkDriver as I,UserAttributeDriver as x,UserAuthMethodDriver as O}from"@descope/sdk-component-drivers";import{createAsyncThunk as M}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import D from"@descope/web-js-sdk";import"@descope/web-component";const E=t=>t.tenant.data,C=t=>t.tenantAdminLinkSSO.data.defaultLink,A=R(E,(t=>t.customAttributes||{})),F=R(E,(t=>t.name||"")),L=R(E,(t=>t.selfProvisioningDomains||[])),j=R(E,(t=>t.enforceSSOExclusions||[])),q=R(E,(t=>t.enforceSSO||!1)),P=R(E,C,(t=>t.tenantAdminLinkSSO.data.ssoIdToLink),((t,e,i)=>[...t?[{id:"",name:"Default SSO Configuration",authType:t.authType,isDefault:!0,link:e}]:[],...((null==t?void 0:t.additionalSSOConfigs)||[]).map((({ssoId:t,name:e,authType:s})=>({id:t,name:e,authType:s,link:i[t]||""})))])),N=R(E,(t=>((null==t?void 0:t.additionalSSOConfigs)||[]).map((({ssoId:t})=>t))));function U(t){return new URLSearchParams(window.location.search).get(t)}const $=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)}))}))},B=t=>({onFulfilled:e=>{t(e).loading=!1},onPending:e=>{t(e).loading=!0,t(e).error=null},onRejected:(e,i)=>{t(e).loading=!1,t(e).error=i.error}}),H=M("users/me",((t,{extra:{api:e}})=>e.user.me())),_=$(H)({onFulfilled:(t,e)=>{t.me.data=e.payload}},B((t=>t.me))),z={action:H,reducer:_},X=M("tenant/details",((t,{extra:{api:e}})=>e.tenant.details())),Y=$(X)({onFulfilled:(t,e)=>{t.tenant.data=e.payload}},B((t=>t.tenant))),G={action:X,reducer:Y},J=M("tenant/adminLinkSso",(({ssoIds:t},{extra:{api:e}})=>e.tenant.adminLinkSso({ssoIds:t}))),K={action:J,reducer:$(J)({onFulfilled:(t,e)=>{var i;t.tenantAdminLinkSSO.data=null!==(i=e.payload)&&void 0!==i?i:{defaultLink:"",ssoIdToLink:{}}}},B((t=>t.tenantAdminLinkSSO)))},Q={me:{loading:!1,error:null,data:{}},tenant:{loading:!1,error:null,data:{}},tenantAdminLinkSSO:{loading:!1,error:null,data:{defaultLink:"",ssoIdToLink:{}}}},V={me:"/v1/auth/me"},Z={details:"/v1/mgmt/tenant",adminLinkSso:"/v1/mgmt/tenant/adminlinks/sso/authenticated/batch"},tt=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)})),et=()=>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})}))})),it=()=>t(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({tenantId:"tenant-1",roleNames:["admin"],id:"tenant-1",name:"Test Tenant",selfProvisioningDomains:["example1.com","example2.com"],customAttributes:{},authType:"password",domains:[],createdTime:Date.now(),disabled:!1,enforceSSO:!0})}))})),st=()=>t(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({defaultLink:"_blank",ssoIdToLink:{"okta-prod":"_blank?ssoId=okta-prod","entra-eu":"_blank?ssoId=entra-eu"}})}))})),nt=({httpClient:e,tenantId:i,mock:s})=>{const n=encodeURIComponent(i||""),o=`?tenant=${n}&id=${n}`;return{details:()=>t(void 0,void 0,void 0,(function*(){if(s)return it();if(!i)throw new Error("tenantId is not defined");const t=`${Z.details}${o}`,n=yield e.get(t);yield tt(n);return yield n.json()})),adminLinkSso:o=>t(void 0,[o],void 0,(function*({ssoIds:t}){if(s)return st();if(!i)throw new Error("tenantId is not defined");const o=yield e.post(`${Z.adminLinkSso}?tenant=${n}`,{tenantId:n,ssoIds:t},{headers:{"Content-Type":"application/json"}});yield tt(o);return yield o.json()}))}},ot=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return et();const t=yield e.get(V.me);return yield tt(t),t.json()}))}),at=s((s=>{var o,a,f,v;const m=n(r,d,l,h,c)(s);return v=class extends m{constructor(){super(...arguments),o.add(this),a.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get styleId(){return this.getAttribute("style-id")||u}get api(){return e(this,a,"f")||e(this,o,"m",f).call(this),e(this,a,"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","tenant","mock"],(()=>{e(this,a,"f")&&e(this,o,"m",f).call(this)}))}))}},a=new WeakMap,o=new WeakSet,f=function(){this.logger.debug("creating an sdk instance"),i(this,a,((t,e,i,s)=>{const n=D(Object.assign(Object.assign({},t),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"tenant-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.8.0"}}));return{user:ot({httpClient:n.httpClient,mock:i}),tenant:nt({httpClient:n.httpClient,tenantId:e,mock:i})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},v})),rt=s((t=>{const e=n(f({name:"widget",initialState:Q,reducers:{},extraReducers:t=>{z.reducer(t),G.reducer(t),K.reducer(t)},asyncActions:{getMe:z.action,getTenant:G.action,getTenantAdminLinkSSO:K.action}}),v,l,at)(t);return class extends e{constructor(...t){super(...t),this.state=Q,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),dt="widget-flow",lt=s((i=>{var s,o,a;return a=class extends(n(m,v,g,rt,c,l,p,w)(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 n=U(dt);n&&(!function(t){if(window.history.replaceState&&U(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())}}(dt),e(this,s,"m",o).call(this,n))}))}},s=new WeakSet,o=function(e){const i=this.createModal({"data-id":"redirect-flow"});i.setContent(this.createFlowTemplate({flowId:e,tenant:this.tenantId}));new T((()=>{var t;return null===(t=i.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>t(this,void 0,void 0,(function*(){i.close(),this.actions.getMe(),yield this.actions.getTenant();const t=N(this.state);yield this.actions.getTenantAdminLinkSSO({ssoIds:t})})))),i.afterClose=()=>{i.remove()},i.open()},a})),ht=s((t=>class extends(n(p,d)(t)){syncFlowTheme(t){t.theme=this.theme,this.observeAttributes(["theme"],(()=>{t.theme=this.theme}))}}));const ct=s((i=>{var s,a,r;return r=class extends(n(l,v,y,S,k("tenant-profile-widget"),rt)(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);try{yield Promise.all([this.actions.getMe(),this.actions.getTenant()]);const t=N(this.state);yield this.actions.getTenantAdminLinkSSO({ssoIds:t})}catch(t){}const n=this.state.me.error||(t=>t.tenant.error)(this.state)||(t=>t.tenantAdminLinkSSO.error)(this.state);if(n){this.contentRootElement.innerHTML="";const t="object"==typeof n&&null!==n&&"message"in n?n.message:String(n)||"An error occurred";this.contentRootElement.append(function({mainMessage:t="An error occurred"}){const e=document.createElement("div");e.setAttribute("data-id","widget-error"),e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="center",e.style.justifyContent="center",e.style.padding="72px 36px",e.style.background="#fff",e.style.borderRadius="12px",e.style.boxShadow="0 2px 8px rgba(0,0,0,0.03)",e.style.margin="32px auto",e.style.maxWidth="400px";const i=document.createElement("div");i.innerHTML='\n <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="20" cy="20" r="18" stroke="#FF3B3B" stroke-width="3" fill="#fff"/>\n <text x="20" y="27" text-anchor="middle" font-size="24" font-family="Arial, sans-serif" fill="#FF3B3B">!</text>\n </svg>\n ',i.style.marginBottom="12px",e.appendChild(i);const s=document.createElement("div");return s.textContent=t,s.style.fontWeight="bold",s.style.fontSize="20px",s.style.color="#222",s.style.textAlign="center",s.style.marginTop="8px",e.appendChild(s),e}({mainMessage:t}))}else yield e(this,s,"m",a).call(this),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},s=new WeakSet,a=function(){return t(this,void 0,void 0,(function*(){const t=o(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(t),this.contentRootElement.append(t.content.cloneNode(!0))}))},r})),ut=s((s=>{var o,a,r,d,h,c,u,f,v,m,p,y;return y=class extends(n(ht,rt,g,l,ct,w)(s)){constructor(){super(...arguments),o.add(this),a.set(this,void 0),r.set(this,void 0),d.set(this,void 0),h.set(this,void 0),c.set(this,void 0)}onWidgetRootReady(){const s=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=s.onWidgetRootReady)||void 0===t?void 0:t.call(this),i(this,a,new W((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-multi-sso")}),{logger:this.logger}),"f"),e(this,a,"f").isExists&&(e(this,o,"m",p).call(this),e(this,a,"f").data=P(this.state),this.subscribe((t=>{e(this,a,"f").data=t}),P))}))}},a=new WeakMap,r=new WeakMap,d=new WeakMap,h=new WeakMap,c=new WeakMap,o=new WeakSet,u=function(){i(this,r,this.createModal({"data-id":"multi-sso-create-modal"}),"f"),i(this,d,new T((()=>{var t;return null===(t=e(this,r,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(e(this,d,"f"))},f=function(){i(this,h,this.createModal({"data-id":"multi-sso-delete-modal"}),"f"),i(this,c,new T((()=>{var t;return null===(t=e(this,h,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),this.syncFlowTheme(e(this,c,"f"))},v=function(i){e(this,r,"f").setContent(this.createFlowTemplate({flowId:i,tenant:this.tenantId})),e(this,r,"f").open(),e(this,d,"f").onSuccess((()=>t(this,void 0,void 0,(function*(){e(this,r,"f").close(),yield this.actions.getTenant();const t=N(this.state);yield this.actions.getTenantAdminLinkSSO({ssoIds:t})}))))},m=function(t,i){e(this,h,"f").setContent(this.createFlowTemplate({flowId:t,tenant:this.tenantId,form:{deleteSSOConfigurationId:i}})),e(this,h,"f").open(),e(this,c,"f").onSuccess((()=>{e(this,h,"f").close(),this.actions.getTenant()}))},p=function(){const{createFlowId:t,deleteFlowId:i}=e(this,a,"f");i&&(e(this,o,"m",f).call(this),e(this,a,"f").onDeleteClicked((({id:t})=>e(this,o,"m",m).call(this,i,t)))),t&&(e(this,o,"m",u).call(this),e(this,a,"f").onCreateClicked((()=>e(this,o,"m",v).call(this,t))))},y})),ft=s((i=>{var s,o,r,d;return d=class extends(n(ht,rt,l,ct,c,g)(i)){constructor(){super(...arguments),s.add(this),r.set(this,a((t=>{this.tenantAdminLinkSSODriver.href=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,s,"m",o).call(this),e(this,r,"f").call(this,C(this.state)),this.subscribe(e(this,r,"f").bind(this),C)}))}},r=new WeakMap,s=new WeakSet,o=function(){this.tenantAdminLinkSSODriver=new I((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-link[data-id="tenant-admin-link-sso"]')}),{logger:this.logger})},d}));var vt;!function(t){t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t.SINGLE_SELECT="singleSelect",t.ARRAY="array",t.DATE="date"}(vt||(vt={}));const mt=s((i=>{var s,o,r,d,h,u,f,v,p,y,S;return S=class extends(n(m,ht,rt,l,ct,c,g,w)(i)){constructor(){super(...arguments),s.add(this),o.set(this,{}),r.set(this,{}),d.set(this,{}),h.set(this,{}),v.set(this,a((t=>{var i;const n=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(n).forEach((i=>{const n=i.getAttribute("data-id").replace("customAttributes.",""),o=i.getAttribute("data-type")||vt.TEXT,a=t[n],r=new x(i,{logger:this.logger});r.value=((t,e)=>t===vt.DATE&&e?new Date(e).toLocaleString():t===vt.BOOLEAN&&void 0!==e?e?"True":"False":(e||"").toString())(o,a),e(this,s,"m",p).call(this,i,n,r,o,n),e(this,s,"m",y).call(this,i,n,r)}))})))}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,v,"f").call(this,A(this.state)),this.subscribe(e(this,v,"f").bind(this),A)}))}},o=new WeakMap,r=new WeakMap,d=new WeakMap,h=new WeakMap,v=new WeakMap,s=new WeakSet,u=function(t,i,s){var n,a;const d=A(this.state)[s],l=i===vt.ARRAY?(d||[]).join(","):d;null===(n=e(this,o,"f")[t])||void 0===n||n.setContent(this.createFlowTemplate({flowId:t,tenant:this.tenantId,form:{customAttributes:{[s]:l}}})),null===(a=e(this,r,"f")[t])||void 0===a||a.onSuccess((()=>{var i;null===(i=e(this,o,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},f=function(t){var i,s;null===(i=e(this,d,"f")[t])||void 0===i||i.setContent(this.createFlowTemplate({flowId:t,tenant:this.tenantId})),null===(s=e(this,h,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,d,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},p=function(t,i,n,a,d){const l=t.getAttribute("edit-flow-id");l&&(e(this,o,"f")[l]||(e(this,o,"f")[l]=this.createModal({"data-id":`edit-${i}`}),e(this,r,"f")[l]=new T((()=>{var t,i;return null===(i=null===(t=e(this,o,"f")[l])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,o,"f")[l].beforeOpen=e(this,s,"m",u).bind(this,l,a,d),n.onEditClick((()=>{var t,i;null===(i=null===(t=e(this,o,"f"))||void 0===t?void 0:t[l])||void 0===i||i.open()})),this.syncFlowTheme(e(this,r,"f")[l])))},y=function(t,i,n){const o=t.getAttribute("delete-flow-id");o&&(e(this,d,"f")[o]||(e(this,d,"f")[o]=this.createModal({"data-id":`delete-${i}`}),e(this,h,"f")[o]=new T((()=>{var t,i;return null===(i=null===(t=e(this,d,"f")[o])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,d,"f")[o].beforeOpen=e(this,s,"m",f).bind(this,o),n.onDeleteClick((()=>{var t,i;null===(i=null===(t=e(this,d,"f"))||void 0===t?void 0:t[o])||void 0===i||i.open()})),this.syncFlowTheme(e(this,h,"f")[o])))},S})),gt=s((s=>{var o,r,d,h,u,f,v,p,y,S,k,b;return b=class extends(n(m,ht,rt,l,ct,c,g,w)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),h.set(this,void 0),u.set(this,void 0),k.set(this,a((t=>{this.tenantEmailDomainsDriver.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",S).call(this),e(this,o,"m",f).call(this),e(this,o,"m",p).call(this),e(this,k,"f").call(this,L(this.state)),this.subscribe(e(this,k,"f").bind(this),L)}))}},r=new WeakMap,d=new WeakMap,h=new WeakMap,u=new WeakMap,k=new WeakMap,o=new WeakSet,f=function(){this.tenantEmailDomainsDriver.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-tenant-email-domains"}),"f"),i(this,d,new T((()=>{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").beforeOpen=e(this,o,"m",v).bind(this),e(this,o,"m",v).call(this),this.syncFlowTheme(e(this,d,"f")))},v=function(){e(this,r,"f").setContent(this.createFlowTemplate({flowId:this.tenantEmailDomainsDriver.editFlowId,tenant:this.tenantId,form:{tenantEmailDomains:L(this.state)}})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getTenant()}))},p=function(){this.tenantEmailDomainsDriver.deleteFlowId&&(i(this,h,this.createModal({"data-id":"delete-tenant-email-domains"}),"f"),i(this,u,new T((()=>{var t;return null===(t=e(this,h,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,h,"f").beforeOpen=e(this,o,"m",y).bind(this),e(this,o,"m",y).call(this),this.syncFlowTheme(e(this,u,"f")))},y=function(){e(this,h,"f").setContent(this.createFlowTemplate({flowId:this.tenantEmailDomainsDriver.deleteFlowId,tenant:this.tenantId})),e(this,u,"f").onSuccess((()=>{e(this,h,"f").close(),this.actions.getTenant()}))},S=function(){this.tenantEmailDomainsDriver=new x((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-email-domains-edit"]')}),{logger:this.logger}),this.tenantEmailDomainsDriver.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.tenantEmailDomainsDriver.onDeleteClick((()=>{var t;null===(t=e(this,h,"f"))||void 0===t||t.open()}))},b})),pt=s((s=>{var o,r,d,h,u,f,v,p,y,S,k,b;return b=class extends(n(m,ht,rt,l,ct,c,g,w)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),h.set(this,void 0),u.set(this,void 0),k.set(this,a((t=>{this.tenantSSOExclusionsDriver.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",S).call(this),e(this,o,"m",f).call(this),e(this,o,"m",p).call(this),e(this,k,"f").call(this,j(this.state)),this.subscribe(e(this,k,"f").bind(this),j)}))}},r=new WeakMap,d=new WeakMap,h=new WeakMap,u=new WeakMap,k=new WeakMap,o=new WeakSet,f=function(){this.tenantSSOExclusionsDriver.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-tenant-sso-exclusions"}),"f"),i(this,d,new T((()=>{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").beforeOpen=e(this,o,"m",v).bind(this),e(this,o,"m",v).call(this),this.syncFlowTheme(e(this,d,"f")))},v=function(){e(this,r,"f").setContent(this.createFlowTemplate({flowId:this.tenantSSOExclusionsDriver.editFlowId,tenant:this.tenantId,form:{enforceSSOExclusions:j(this.state)}})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getTenant()}))},p=function(){this.tenantSSOExclusionsDriver.deleteFlowId&&(i(this,h,this.createModal({"data-id":"delete-tenant-sso-exclusions"}),"f"),i(this,u,new T((()=>{var t;return null===(t=e(this,h,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,h,"f").beforeOpen=e(this,o,"m",y).bind(this),e(this,o,"m",y).call(this),this.syncFlowTheme(e(this,u,"f")))},y=function(){e(this,h,"f").setContent(this.createFlowTemplate({flowId:this.tenantSSOExclusionsDriver.deleteFlowId,tenant:this.tenantId})),e(this,u,"f").onSuccess((()=>{e(this,h,"f").close(),this.actions.getTenant()}))},S=function(){this.tenantSSOExclusionsDriver=new x((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-force-sso-exclusions-edit"]')}),{logger:this.logger}),this.tenantSSOExclusionsDriver.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.tenantSSOExclusionsDriver.onDeleteClick((()=>{var t;null===(t=e(this,h,"f"))||void 0===t||t.open()}))},b})),wt=s((s=>{var o,r,d,h,u,f,v,p,y,S,k,b;return b=class extends(n(m,ht,rt,l,ct,c,g,w)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),h.set(this,void 0),u.set(this,void 0),k.set(this,a((t=>{this.tenantEnforceSSODriver.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",S).call(this),e(this,o,"m",f).call(this),e(this,o,"m",p).call(this),e(this,k,"f").call(this,q(this.state)),this.subscribe(e(this,k,"f").bind(this),q)}))}},r=new WeakMap,d=new WeakMap,h=new WeakMap,u=new WeakMap,k=new WeakMap,o=new WeakSet,f=function(){this.tenantEnforceSSODriver.editFlowId&&(i(this,r,this.createModal({"data-id":"edit-tenant-enforce-sso"}),"f"),i(this,d,new T((()=>{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").beforeOpen=e(this,o,"m",v).bind(this),e(this,o,"m",v).call(this),this.syncFlowTheme(e(this,d,"f")))},v=function(){e(this,r,"f").setContent(this.createFlowTemplate({flowId:this.tenantEnforceSSODriver.editFlowId,tenant:this.tenantId,form:{enforceSSO:q(this.state)}})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getTenant()}))},p=function(){this.tenantEnforceSSODriver.deleteFlowId&&(i(this,h,this.createModal({"data-id":"delete-tenant-enforce-sso"}),"f"),i(this,u,new T((()=>{var t;return null===(t=e(this,h,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,h,"f").beforeOpen=e(this,o,"m",y).bind(this),e(this,o,"m",y).call(this),this.syncFlowTheme(e(this,u,"f")))},y=function(){e(this,h,"f").setContent(this.createFlowTemplate({flowId:this.tenantEnforceSSODriver.deleteFlowId,tenant:this.tenantId})),e(this,u,"f").onSuccess((()=>{e(this,h,"f").close(),this.actions.getTenant()}))},S=function(){this.tenantEnforceSSODriver=new x((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-enforce-sso-edit"]')}),{logger:this.logger}),this.tenantEnforceSSODriver.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()})),this.tenantEnforceSSODriver.onDeleteClick((()=>{var t;null===(t=e(this,h,"f"))||void 0===t||t.open()}))},b})),yt=s((s=>{var o,r,d,h,u,f,v,p;return p=class extends(n(m,ht,rt,l,ct,c,g,w)(s)){constructor(){super(...arguments),o.add(this),r.set(this,void 0),d.set(this,void 0),v.set(this,a((t=>{this.tenantNameDriver.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",f).call(this),e(this,o,"m",h).call(this),e(this,v,"f").call(this,F(this.state)),this.subscribe(e(this,v,"f").bind(this),F)}))}},r=new WeakMap,d=new WeakMap,v=new WeakMap,o=new WeakSet,h=function(){this.tenantNameDriver.editFlowId&&(i(this,r,this.createModal({"data-id":"tenant-profile-set-name"}),"f"),i(this,d,new T((()=>{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").beforeOpen=e(this,o,"m",u).bind(this),e(this,o,"m",u).call(this),this.syncFlowTheme(e(this,d,"f")))},u=function(){e(this,r,"f").setContent(this.createFlowTemplate({flowId:this.tenantNameDriver.editFlowId,tenant:this.tenantId,form:{tenantName:F(this.state)}})),e(this,d,"f").onSuccess((()=>{e(this,r,"f").close(),this.actions.getTenant()}))},f=function(){this.tenantNameDriver=new x((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-name-edit"]')}),{logger:this.logger}),this.tenantNameDriver.onEditClick((()=>{var t;null===(t=e(this,r,"f"))||void 0===t||t.open()}))},p})),St=s((s=>{var o,a,r,d,h,u,f;return f=class extends(n(m,ht,rt,l,ct,c,g,w)(s)){constructor(){super(...arguments),o.add(this),a.set(this,void 0),r.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",u).call(this),e(this,o,"m",d).call(this)}))}},a=new WeakMap,r=new WeakMap,o=new WeakSet,d=function(){this.TenantPasswordPolicyUserAuthMethodDriver.flowId&&(i(this,a,this.createModal({"data-id":"password-policy"}),"f"),i(this,r,new T((()=>{var t;return null===(t=e(this,a,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,a,"f").afterClose=e(this,o,"m",h).bind(this),e(this,o,"m",h).call(this),this.syncFlowTheme(e(this,r,"f")))},h=function(){e(this,a,"f").setContent(this.createFlowTemplate({flowId:this.TenantPasswordPolicyUserAuthMethodDriver.flowId,tenant:this.tenantId})),e(this,r,"f").onSuccess((()=>{e(this,a,"f").close(),this.actions.getTenant()}))},u=function(){this.TenantPasswordPolicyUserAuthMethodDriver=new O((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="password-policy"]')}),{logger:this.logger}),this.TenantPasswordPolicyUserAuthMethodDriver.onUnfulfilledButtonClick((()=>{var t;null===(t=e(this,a,"f"))||void 0===t||t.open()}))},f})),kt=s((s=>{var o,a,r,d,h,u,f;return f=class extends(n(m,ht,rt,l,ct,c,g,w)(s)){constructor(){super(...arguments),o.add(this),a.set(this,void 0),r.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",u).call(this),e(this,o,"m",d).call(this)}))}},a=new WeakMap,r=new WeakMap,o=new WeakSet,d=function(){this.TenantSessionSettingsUserAuthMethodDriver.flowId&&(i(this,a,this.createModal({"data-id":"session-settings"}),"f"),i(this,r,new T((()=>{var t;return null===(t=e(this,a,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,a,"f").afterClose=e(this,o,"m",h).bind(this),e(this,o,"m",h).call(this),this.syncFlowTheme(e(this,r,"f")))},h=function(){e(this,a,"f").setContent(this.createFlowTemplate({flowId:this.TenantSessionSettingsUserAuthMethodDriver.flowId,tenant:this.tenantId})),e(this,r,"f").onSuccess((()=>{e(this,a,"f").close(),this.actions.getTenant()}))},u=function(){this.TenantSessionSettingsUserAuthMethodDriver=new O((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-auth-method[data-id="session-settings"]')}),{logger:this.logger}),this.TenantSessionSettingsUserAuthMethodDriver.onUnfulfilledButtonClick((()=>{var t;null===(t=e(this,a,"f"))||void 0===t||t.open()}))},f})),bt=s((e=>class extends(n(b,p,lt,ct,yt,gt,pt,wt,mt,ft,St,kt,ut)(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)}))}})),Rt=n((e=>class extends(bt(e)){init(){const e=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=e.init)||void 0===t?void 0:t.call(this);(customElements.get("descope-wc")||(yield import("@descope/web-component").then((t=>t.default)))).sdkConfigOverrides={baseHeaders:{"x-descope-widget-type":"tenant-profile-widget","x-descope-widget-id":this.getAttribute("widget-id"),"x-descope-widget-version":"0.8.0"}}}))}}))(HTMLElement);customElements.define("descope-tenant-profile-widget",Rt);export{Rt as default};
|
|
6
6
|
//# sourceMappingURL=index.js.map
|