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