@descope/tenant-profile-widget 0.2.19 → 0.2.20
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.d.ts +37 -37
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
/**
|
|
3
|
-
* @descope/tenant-profile-widget v0.2.
|
|
3
|
+
* @descope/tenant-profile-widget v0.2.20
|
|
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"),a=require("@reduxjs/toolkit");require("@descope/core-js-sdk");var n=require("@descope/web-js-sdk"),r=require("reselect");require("@descope/web-component");const o=(e={})=>{const i=t.createTemplate("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,s])=>{i.content.querySelector("descope-wc").setAttribute(t.kebabCase(e),s)})),i};function l(e){return new URLSearchParams(window.location.search).get(e)}const d=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)}))}))},c=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}}),h=a.createAsyncThunk("users/me",((e,{extra:{api:t}})=>t.user.me())),v=d(h)({onFulfilled:(e,t)=>{e.me.data=t.payload}},c((e=>e.me))),u={action:h,reducer:v},_=a.createAsyncThunk("tenant/details",((e,{extra:{api:t}})=>t.tenant.details())),f=d(_)({onFulfilled:(e,t)=>{e.tenant.data=t.payload}},c((e=>e.tenant))),m={action:_,reducer:f},g=a.createAsyncThunk("tenant/adminLinkSso",((e,{extra:{api:t}})=>t.tenant.adminLinkSso())),p={action:g,reducer:d(g)({onFulfilled:(e,t)=>{var i;e.tenantAdminLinkSSO.data=(null===(i=t.payload)||void 0===i?void 0:i.adminSSOConfigurationLink)||""}},c((e=>e.tenantAdminLinkSSO)))},w={me:{loading:!1,error:null,data:{}},tenant:{loading:!1,error:null,data:{}},tenantAdminLinkSSO:{loading:!1,error:null,data:""}},S={me:"/v1/auth/me"},F={details:"/v1/mgmt/tenant",adminLinkSso:"/v1/mgmt/tenant/adminlinks/sso/authenticated"},b=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)})),P=()=>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})}))})),y=()=>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})}))})),x=()=>e.__awaiter(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({adminSSOConfigurationLink:"_blank"})}))})),k=({httpClient:t,tenantId:i,mock:s})=>{const a=encodeURIComponent(i||""),n=`?tenant=${a}&id=${a}`;return{details:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(s)return y();if(!i)throw new Error("tenantId is not defined");const e=`${F.details}${n}`,a=yield t.get(e);yield b(a);return yield a.json()})),adminLinkSso:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(s)return x();if(!i)throw new Error("tenantId is not defined");const e=yield t.post(`${F.adminLinkSso}?tenant=${a}`,{tenantId:a},{headers:{"Content-Type":"application/json"}});yield b(e);return yield e.json()}))}},G=({httpClient:t,mock:i})=>({me:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(i)return P();const e=yield t.get(S.me);return yield b(e),e.json()}))}),M=t.createSingletonMixin((s=>{var a,r,o,l;const d=t.compose(i.projectIdMixin,i.observeAttributesMixin,i.loggerMixin,i.baseUrlMixin,i.cookieConfigMixin)(s);return l=class extends d{constructor(){super(...arguments),a.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get api(){return e.__classPrivateFieldGet(this,r,"f")||e.__classPrivateFieldGet(this,a,"m",o).call(this),e.__classPrivateFieldGet(this,r,"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,r,"f")&&e.__classPrivateFieldGet(this,a,"m",o).call(this)}))}))}},r=new WeakMap,a=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),e.__classPrivateFieldSet(this,r,((e,t,i,s)=>{const a=n(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.2.19"}}));return{user:G({httpClient:a.httpClient,mock:i}),tenant:k({httpClient:a.httpClient,tenantId:t,mock:i})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},l})),C=t.createSingletonMixin((e=>{const s=t.compose(i.createStateManagementMixin({name:"widget",initialState:w,reducers:{},extraReducers:e=>{u.reducer(e),m.reducer(e),p.reducer(e)},asyncActions:{getMe:u.action,getTenant:m.action,getTenantAdminLinkSSO:p.action}}),i.initLifecycleMixin,i.loggerMixin,M)(e);return class extends s{constructor(...e){super(...e),this.state=w,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),R="widget-flow",U=t.createSingletonMixin((a=>{var n,r,d;return d=class extends(t.compose(i.initLifecycleMixin,i.modalMixin,C,i.cookieConfigMixin,i.loggerMixin,i.themeMixin)(a)){constructor(){super(...arguments),n.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=l(R);s&&(!function(e){if(window.history.replaceState&&l(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())}}(R),e.__classPrivateFieldGet(this,n,"m",r).call(this,s))}))}},n=new WeakSet,r=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(o({projectId:this.projectId,flowId:e,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme}));new s.FlowDriver((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close(),this.actions.getMe(),this.actions.getTenant(),this.actions.getTenantAdminLinkSSO()})),t.afterClose=()=>{t.remove()},t.open()},d})),I=e=>e.tenant.data,D=e=>e.tenantAdminLinkSSO.data,W=r.createSelector(I,(e=>e.customAttributes||{})),E=r.createSelector(I,(e=>e.name||"")),O=r.createSelector(I,(e=>e.selfProvisioningDomains||[])),A=r.createSelector(I,(e=>e.enforceSSOExclusions||[])),T=r.createSelector(I,(e=>e.enforceSSO||!1)),j=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}))}})),N=t.createSingletonMixin((s=>{const a=t.compose(i.staticResourcesMixin,i.createValidateAttributesMixin({"widget-id":i.createValidateAttributesMixin.missingAttrValidator}))(s);return class extends a{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(t){return e.__awaiter(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`tenant-profile-widget/${this.widgetId}/${t}`,"text")).body}))}}}));const L=t.createSingletonMixin((s=>{var a,n,r;return r=class extends(t.compose(i.loggerMixin,i.initLifecycleMixin,i.descopeUiMixin,i.initElementMixin,N,C)(s)){constructor(){super(...arguments),a.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(),this.actions.getTenantAdminLinkSSO()])}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,a,"m",n).call(this),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},a=new WeakSet,n=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))}))},r})),q=t.createSingletonMixin((a=>{var n,r,o,l;return l=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),o.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,n,"m",r).call(this),e.__classPrivateFieldGet(this,o,"f").call(this,D(this.state)),this.subscribe(e.__classPrivateFieldGet(this,o,"f").bind(this),D)}))}},o=new WeakMap,n=new WeakSet,r=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})},l}));var $;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}($||($={}));const B=t.createSingletonMixin((a=>{var n,r,l,d,c,h,v,u,_,f,m;return m=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),r.set(this,{}),l.set(this,{}),d.set(this,{}),c.set(this,{}),u.set(this,t.withMemCache((t=>{var i;const a=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(a).forEach((i=>{const a=i.getAttribute("data-id").replace("customAttributes.",""),r=i.getAttribute("data-type")||$.TEXT,o=t[a],l=new s.UserAttributeDriver(i,{logger:this.logger});l.value=((e,t)=>e===$.DATE&&t?new Date(t).toLocaleString():e===$.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString())(r,o),e.__classPrivateFieldGet(this,n,"m",_).call(this,i,a,l,r,a,o),e.__classPrivateFieldGet(this,n,"m",f).call(this,i,a,l)}))})))}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,W(this.state)),this.subscribe(e.__classPrivateFieldGet(this,u,"f").bind(this),W)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,u=new WeakMap,n=new WeakSet,h=function(t,i,s,a){var n,d;const c=i===$.ARRAY?(a||[]).join(","):a;null===(n=e.__classPrivateFieldGet(this,r,"f")[t])||void 0===n||n.setContent(o({projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({customAttributes:{[s]:c}})})),null===(d=e.__classPrivateFieldGet(this,l,"f")[t])||void 0===d||d.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,r,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},v=function(t){var i,s;null===(i=e.__classPrivateFieldGet(this,d,"f")[t])||void 0===i||i.setContent(o({projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=e.__classPrivateFieldGet(this,c,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,d,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},_=function(t,i,a,o,d,c){const v=t.getAttribute("edit-flow-id");v&&(e.__classPrivateFieldGet(this,r,"f")[v]=this.createModal({"data-id":`edit-${i}`}),e.__classPrivateFieldGet(this,l,"f")[v]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,r,"f")[v])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,r,"f")[v].afterClose=e.__classPrivateFieldGet(this,n,"m",h).bind(this,v),a.onEditClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t?void 0:t[v])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,n,"m",h).call(this,v,o,d,c),this.syncFlowTheme(e.__classPrivateFieldGet(this,l,"f")[v]))},f=function(t,i,a){const r=t.getAttribute("delete-flow-id");r&&(e.__classPrivateFieldGet(this,d,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e.__classPrivateFieldGet(this,c,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,d,"f")[r].afterClose=e.__classPrivateFieldGet(this,n,"m",v).bind(this,r),a.onDeleteClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,n,"m",v).call(this,r),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")[r]))},m})),J=t.createSingletonMixin((a=>{var n,r,l,d,c,h,v,u,_,f,m,g;return g=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.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,n,"m",f).call(this),e.__classPrivateFieldGet(this,n,"m",h).call(this),e.__classPrivateFieldGet(this,n,"m",u).call(this),e.__classPrivateFieldGet(this,m,"f").call(this,O(this.state)),this.subscribe(e.__classPrivateFieldGet(this,m,"f").bind(this),O)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,n=new WeakSet,h=function(){this.tenantEmailDomainsDriver.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-tenant-email-domains"}),"f"),e.__classPrivateFieldSet(this,l,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").afterClose=e.__classPrivateFieldGet(this,n,"m",v).bind(this),e.__classPrivateFieldGet(this,n,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,l,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({tenantEmailDomains:O(this.state)})})),e.__classPrivateFieldGet(this,l,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getTenant()}))},u=function(){this.tenantEmailDomainsDriver.deleteFlowId&&(e.__classPrivateFieldSet(this,d,this.createModal({"data-id":"delete-tenant-email-domains"}),"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"),e.__classPrivateFieldGet(this,d,"f").afterClose=e.__classPrivateFieldGet(this,n,"m",_).bind(this),e.__classPrivateFieldGet(this,n,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,d,"f").setContent(o({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,d,"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,r,"f"))||void 0===t||t.open()})),this.tenantEmailDomainsDriver.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t||t.open()}))},g})),H=t.createSingletonMixin((a=>{var n,r,l,d,c,h,v,u,_,f,m,g;return g=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.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,n,"m",f).call(this),e.__classPrivateFieldGet(this,n,"m",h).call(this),e.__classPrivateFieldGet(this,n,"m",u).call(this),e.__classPrivateFieldGet(this,m,"f").call(this,A(this.state)),this.subscribe(e.__classPrivateFieldGet(this,m,"f").bind(this),A)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,n=new WeakSet,h=function(){this.tenantSSOExclusionsDriver.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-tenant-sso-exclusions"}),"f"),e.__classPrivateFieldSet(this,l,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").afterClose=e.__classPrivateFieldGet(this,n,"m",v).bind(this),e.__classPrivateFieldGet(this,n,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,l,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({enforceSSOExclusions:A(this.state)})})),e.__classPrivateFieldGet(this,l,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getTenant()}))},u=function(){this.tenantSSOExclusionsDriver.deleteFlowId&&(e.__classPrivateFieldSet(this,d,this.createModal({"data-id":"delete-tenant-sso-exclusions"}),"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"),e.__classPrivateFieldGet(this,d,"f").afterClose=e.__classPrivateFieldGet(this,n,"m",_).bind(this),e.__classPrivateFieldGet(this,n,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,d,"f").setContent(o({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,d,"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,r,"f"))||void 0===t||t.open()})),this.tenantSSOExclusionsDriver.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t||t.open()}))},g})),V=t.createSingletonMixin((a=>{var n,r,l,d,c,h,v,u,_,f,m,g;return g=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.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,n,"m",f).call(this),e.__classPrivateFieldGet(this,n,"m",h).call(this),e.__classPrivateFieldGet(this,n,"m",u).call(this),e.__classPrivateFieldGet(this,m,"f").call(this,T(this.state)),this.subscribe(e.__classPrivateFieldGet(this,m,"f").bind(this),T)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,n=new WeakSet,h=function(){this.tenantEnforceSSODriver.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-tenant-enforce-sso"}),"f"),e.__classPrivateFieldSet(this,l,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").afterClose=e.__classPrivateFieldGet(this,n,"m",v).bind(this),e.__classPrivateFieldGet(this,n,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,l,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({enforceSSO:T(this.state)})})),e.__classPrivateFieldGet(this,l,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getTenant()}))},u=function(){this.tenantEnforceSSODriver.deleteFlowId&&(e.__classPrivateFieldSet(this,d,this.createModal({"data-id":"delete-tenant-enforce-sso"}),"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"),e.__classPrivateFieldGet(this,d,"f").afterClose=e.__classPrivateFieldGet(this,n,"m",_).bind(this),e.__classPrivateFieldGet(this,n,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,d,"f").setContent(o({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,d,"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,r,"f"))||void 0===t||t.open()})),this.tenantEnforceSSODriver.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t||t.open()}))},g})),z=t.createSingletonMixin((a=>{var n,r,l,d,c,h,v,u;return u=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),r.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,n,"m",h).call(this),e.__classPrivateFieldGet(this,n,"m",d).call(this),e.__classPrivateFieldGet(this,v,"f").call(this,E(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),E)}))}},r=new WeakMap,l=new WeakMap,v=new WeakMap,n=new WeakSet,d=function(){this.tenantNameDriver.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"tenant-profile-set-name"}),"f"),e.__classPrivateFieldSet(this,l,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").afterClose=e.__classPrivateFieldGet(this,n,"m",c).bind(this),e.__classPrivateFieldGet(this,n,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,l,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.tenantNameDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({tenantName:E(this.state)})})),e.__classPrivateFieldGet(this,l,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getTenant()}))},h=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,r,"f"))||void 0===t||t.open()}))},u})),X=t.createSingletonMixin((s=>class extends(t.compose(i.debuggerMixin,i.themeMixin,U,L,z,J,H,V,B,q)(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)}))}})),Y=t.compose((t=>class extends(X(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.2.19"}}}))}}))(HTMLElement);customElements.define("descope-tenant-profile-widget",Y),module.exports=Y;
|
|
5
|
+
"use strict";var e=require("tslib"),t=require("@descope/sdk-helpers"),i=require("@descope/sdk-mixins"),s=require("@descope/sdk-component-drivers"),a=require("@reduxjs/toolkit");require("@descope/core-js-sdk");var n=require("@descope/web-js-sdk"),r=require("reselect");require("@descope/web-component");const o=(e={})=>{const i=t.createTemplate("<descope-wc></descope-wc>");return Object.entries(e).forEach((([e,s])=>{i.content.querySelector("descope-wc").setAttribute(t.kebabCase(e),s)})),i};function l(e){return new URLSearchParams(window.location.search).get(e)}const d=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)}))}))},c=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}}),h=a.createAsyncThunk("users/me",((e,{extra:{api:t}})=>t.user.me())),v=d(h)({onFulfilled:(e,t)=>{e.me.data=t.payload}},c((e=>e.me))),u={action:h,reducer:v},_=a.createAsyncThunk("tenant/details",((e,{extra:{api:t}})=>t.tenant.details())),f=d(_)({onFulfilled:(e,t)=>{e.tenant.data=t.payload}},c((e=>e.tenant))),m={action:_,reducer:f},g=a.createAsyncThunk("tenant/adminLinkSso",((e,{extra:{api:t}})=>t.tenant.adminLinkSso())),p={action:g,reducer:d(g)({onFulfilled:(e,t)=>{var i;e.tenantAdminLinkSSO.data=(null===(i=t.payload)||void 0===i?void 0:i.adminSSOConfigurationLink)||""}},c((e=>e.tenantAdminLinkSSO)))},w={me:{loading:!1,error:null,data:{}},tenant:{loading:!1,error:null,data:{}},tenantAdminLinkSSO:{loading:!1,error:null,data:""}},S={me:"/v1/auth/me"},F={details:"/v1/mgmt/tenant",adminLinkSso:"/v1/mgmt/tenant/adminlinks/sso/authenticated"},b=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)})),P=()=>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})}))})),y=()=>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})}))})),x=()=>e.__awaiter(void 0,void 0,void 0,(function*(){return new Promise((e=>{e({adminSSOConfigurationLink:"_blank"})}))})),k=({httpClient:t,tenantId:i,mock:s})=>{const a=encodeURIComponent(i||""),n=`?tenant=${a}&id=${a}`;return{details:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(s)return y();if(!i)throw new Error("tenantId is not defined");const e=`${F.details}${n}`,a=yield t.get(e);yield b(a);return yield a.json()})),adminLinkSso:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(s)return x();if(!i)throw new Error("tenantId is not defined");const e=yield t.post(`${F.adminLinkSso}?tenant=${a}`,{tenantId:a},{headers:{"Content-Type":"application/json"}});yield b(e);return yield e.json()}))}},G=({httpClient:t,mock:i})=>({me:()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(i)return P();const e=yield t.get(S.me);return yield b(e),e.json()}))}),M=t.createSingletonMixin((s=>{var a,r,o,l;const d=t.compose(i.projectIdMixin,i.observeAttributesMixin,i.loggerMixin,i.baseUrlMixin,i.cookieConfigMixin)(s);return l=class extends d{constructor(){super(...arguments),a.add(this),r.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get api(){return e.__classPrivateFieldGet(this,r,"f")||e.__classPrivateFieldGet(this,a,"m",o).call(this),e.__classPrivateFieldGet(this,r,"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,r,"f")&&e.__classPrivateFieldGet(this,a,"m",o).call(this)}))}))}},r=new WeakMap,a=new WeakSet,o=function(){this.logger.debug("creating an sdk instance"),e.__classPrivateFieldSet(this,r,((e,t,i,s)=>{const a=n(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.2.20"}}));return{user:G({httpClient:a.httpClient,mock:i}),tenant:k({httpClient:a.httpClient,tenantId:t,mock:i})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},l})),C=t.createSingletonMixin((e=>{const s=t.compose(i.createStateManagementMixin({name:"widget",initialState:w,reducers:{},extraReducers:e=>{u.reducer(e),m.reducer(e),p.reducer(e)},asyncActions:{getMe:u.action,getTenant:m.action,getTenantAdminLinkSSO:p.action}}),i.initLifecycleMixin,i.loggerMixin,M)(e);return class extends s{constructor(...e){super(...e),this.state=w,this.subscribe((e=>{this.logger.debug("State update:",e),this.state=e}))}}})),R="widget-flow",U=t.createSingletonMixin((a=>{var n,r,d;return d=class extends(t.compose(i.initLifecycleMixin,i.modalMixin,C,i.cookieConfigMixin,i.loggerMixin,i.themeMixin)(a)){constructor(){super(...arguments),n.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=l(R);s&&(!function(e){if(window.history.replaceState&&l(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())}}(R),e.__classPrivateFieldGet(this,n,"m",r).call(this,s))}))}},n=new WeakSet,r=function(e){const t=this.createModal({"data-id":"redirect-flow"});t.setContent(o({projectId:this.projectId,flowId:e,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme}));new s.FlowDriver((()=>{var e;return null===(e=t.ele)||void 0===e?void 0:e.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{t.close(),this.actions.getMe(),this.actions.getTenant(),this.actions.getTenantAdminLinkSSO()})),t.afterClose=()=>{t.remove()},t.open()},d})),I=e=>e.tenant.data,D=e=>e.tenantAdminLinkSSO.data,W=r.createSelector(I,(e=>e.customAttributes||{})),E=r.createSelector(I,(e=>e.name||"")),O=r.createSelector(I,(e=>e.selfProvisioningDomains||[])),A=r.createSelector(I,(e=>e.enforceSSOExclusions||[])),T=r.createSelector(I,(e=>e.enforceSSO||!1)),j=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}))}})),N=t.createSingletonMixin((s=>{const a=t.compose(i.staticResourcesMixin,i.createValidateAttributesMixin({"widget-id":i.createValidateAttributesMixin.missingAttrValidator}))(s);return class extends a{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(t){return e.__awaiter(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`tenant-profile-widget/${this.widgetId}/${t}`,"text")).body}))}}}));const L=t.createSingletonMixin((s=>{var a,n,r;return r=class extends(t.compose(i.loggerMixin,i.initLifecycleMixin,i.descopeUiMixin,i.initElementMixin,N,C)(s)){constructor(){super(...arguments),a.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(),this.actions.getTenantAdminLinkSSO()])}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,a,"m",n).call(this),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},a=new WeakSet,n=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))}))},r})),q=t.createSingletonMixin((a=>{var n,r,o,l;return l=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),o.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,n,"m",r).call(this),e.__classPrivateFieldGet(this,o,"f").call(this,D(this.state)),this.subscribe(e.__classPrivateFieldGet(this,o,"f").bind(this),D)}))}},o=new WeakMap,n=new WeakSet,r=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})},l}));var $;!function(e){e.TEXT="text",e.NUMBER="number",e.BOOLEAN="boolean",e.SINGLE_SELECT="singleSelect",e.ARRAY="array",e.DATE="date"}($||($={}));const B=t.createSingletonMixin((a=>{var n,r,l,d,c,h,v,u,_,f,m;return m=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),r.set(this,{}),l.set(this,{}),d.set(this,{}),c.set(this,{}),u.set(this,t.withMemCache((t=>{var i;const a=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(a).forEach((i=>{const a=i.getAttribute("data-id").replace("customAttributes.",""),r=i.getAttribute("data-type")||$.TEXT,o=t[a],l=new s.UserAttributeDriver(i,{logger:this.logger});l.value=((e,t)=>e===$.DATE&&t?new Date(t).toLocaleString():e===$.BOOLEAN&&void 0!==t?t?"True":"False":(t||"").toString())(r,o),e.__classPrivateFieldGet(this,n,"m",_).call(this,i,a,l,r,a,o),e.__classPrivateFieldGet(this,n,"m",f).call(this,i,a,l)}))})))}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,W(this.state)),this.subscribe(e.__classPrivateFieldGet(this,u,"f").bind(this),W)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,u=new WeakMap,n=new WeakSet,h=function(t,i,s,a){var n,d;const c=i===$.ARRAY?(a||[]).join(","):a;null===(n=e.__classPrivateFieldGet(this,r,"f")[t])||void 0===n||n.setContent(o({projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({customAttributes:{[s]:c}})})),null===(d=e.__classPrivateFieldGet(this,l,"f")[t])||void 0===d||d.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,r,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},v=function(t){var i,s;null===(i=e.__classPrivateFieldGet(this,d,"f")[t])||void 0===i||i.setContent(o({projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=e.__classPrivateFieldGet(this,c,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e.__classPrivateFieldGet(this,d,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},_=function(t,i,a,o,d,c){const v=t.getAttribute("edit-flow-id");v&&(e.__classPrivateFieldGet(this,r,"f")[v]=this.createModal({"data-id":`edit-${i}`}),e.__classPrivateFieldGet(this,l,"f")[v]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,r,"f")[v])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,r,"f")[v].afterClose=e.__classPrivateFieldGet(this,n,"m",h).bind(this,v),a.onEditClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,r,"f"))||void 0===t?void 0:t[v])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,n,"m",h).call(this,v,o,d,c),this.syncFlowTheme(e.__classPrivateFieldGet(this,l,"f")[v]))},f=function(t,i,a){const r=t.getAttribute("delete-flow-id");r&&(e.__classPrivateFieldGet(this,d,"f")[r]=this.createModal({"data-id":`delete-${i}`}),e.__classPrivateFieldGet(this,c,"f")[r]=new s.FlowDriver((()=>{var t,i;return null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f")[r])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e.__classPrivateFieldGet(this,d,"f")[r].afterClose=e.__classPrivateFieldGet(this,n,"m",v).bind(this,r),a.onDeleteClick((()=>{var t,i;null===(i=null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t?void 0:t[r])||void 0===i||i.open()})),e.__classPrivateFieldGet(this,n,"m",v).call(this,r),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")[r]))},m})),J=t.createSingletonMixin((a=>{var n,r,l,d,c,h,v,u,_,f,m,g;return g=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.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,n,"m",f).call(this),e.__classPrivateFieldGet(this,n,"m",h).call(this),e.__classPrivateFieldGet(this,n,"m",u).call(this),e.__classPrivateFieldGet(this,m,"f").call(this,O(this.state)),this.subscribe(e.__classPrivateFieldGet(this,m,"f").bind(this),O)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,n=new WeakSet,h=function(){this.tenantEmailDomainsDriver.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-tenant-email-domains"}),"f"),e.__classPrivateFieldSet(this,l,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").afterClose=e.__classPrivateFieldGet(this,n,"m",v).bind(this),e.__classPrivateFieldGet(this,n,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,l,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({tenantEmailDomains:O(this.state)})})),e.__classPrivateFieldGet(this,l,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getTenant()}))},u=function(){this.tenantEmailDomainsDriver.deleteFlowId&&(e.__classPrivateFieldSet(this,d,this.createModal({"data-id":"delete-tenant-email-domains"}),"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"),e.__classPrivateFieldGet(this,d,"f").afterClose=e.__classPrivateFieldGet(this,n,"m",_).bind(this),e.__classPrivateFieldGet(this,n,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,d,"f").setContent(o({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,d,"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,r,"f"))||void 0===t||t.open()})),this.tenantEmailDomainsDriver.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t||t.open()}))},g})),H=t.createSingletonMixin((a=>{var n,r,l,d,c,h,v,u,_,f,m,g;return g=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.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,n,"m",f).call(this),e.__classPrivateFieldGet(this,n,"m",h).call(this),e.__classPrivateFieldGet(this,n,"m",u).call(this),e.__classPrivateFieldGet(this,m,"f").call(this,A(this.state)),this.subscribe(e.__classPrivateFieldGet(this,m,"f").bind(this),A)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,n=new WeakSet,h=function(){this.tenantSSOExclusionsDriver.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-tenant-sso-exclusions"}),"f"),e.__classPrivateFieldSet(this,l,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").afterClose=e.__classPrivateFieldGet(this,n,"m",v).bind(this),e.__classPrivateFieldGet(this,n,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,l,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({enforceSSOExclusions:A(this.state)})})),e.__classPrivateFieldGet(this,l,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getTenant()}))},u=function(){this.tenantSSOExclusionsDriver.deleteFlowId&&(e.__classPrivateFieldSet(this,d,this.createModal({"data-id":"delete-tenant-sso-exclusions"}),"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"),e.__classPrivateFieldGet(this,d,"f").afterClose=e.__classPrivateFieldGet(this,n,"m",_).bind(this),e.__classPrivateFieldGet(this,n,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,d,"f").setContent(o({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,d,"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,r,"f"))||void 0===t||t.open()})),this.tenantSSOExclusionsDriver.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t||t.open()}))},g})),V=t.createSingletonMixin((a=>{var n,r,l,d,c,h,v,u,_,f,m,g;return g=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),r.set(this,void 0),l.set(this,void 0),d.set(this,void 0),c.set(this,void 0),m.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,n,"m",f).call(this),e.__classPrivateFieldGet(this,n,"m",h).call(this),e.__classPrivateFieldGet(this,n,"m",u).call(this),e.__classPrivateFieldGet(this,m,"f").call(this,T(this.state)),this.subscribe(e.__classPrivateFieldGet(this,m,"f").bind(this),T)}))}},r=new WeakMap,l=new WeakMap,d=new WeakMap,c=new WeakMap,m=new WeakMap,n=new WeakSet,h=function(){this.tenantEnforceSSODriver.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"edit-tenant-enforce-sso"}),"f"),e.__classPrivateFieldSet(this,l,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").afterClose=e.__classPrivateFieldGet(this,n,"m",v).bind(this),e.__classPrivateFieldGet(this,n,"m",v).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,l,"f")))},v=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({enforceSSO:T(this.state)})})),e.__classPrivateFieldGet(this,l,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getTenant()}))},u=function(){this.tenantEnforceSSODriver.deleteFlowId&&(e.__classPrivateFieldSet(this,d,this.createModal({"data-id":"delete-tenant-enforce-sso"}),"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"),e.__classPrivateFieldGet(this,d,"f").afterClose=e.__classPrivateFieldGet(this,n,"m",_).bind(this),e.__classPrivateFieldGet(this,n,"m",_).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,c,"f")))},_=function(){e.__classPrivateFieldGet(this,d,"f").setContent(o({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e.__classPrivateFieldGet(this,c,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,d,"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,r,"f"))||void 0===t||t.open()})),this.tenantEnforceSSODriver.onDeleteClick((()=>{var t;null===(t=e.__classPrivateFieldGet(this,d,"f"))||void 0===t||t.open()}))},g})),z=t.createSingletonMixin((a=>{var n,r,l,d,c,h,v,u;return u=class extends(t.compose(j,C,i.loggerMixin,L,i.cookieConfigMixin,i.modalMixin)(a)){constructor(){super(...arguments),n.add(this),r.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,n,"m",h).call(this),e.__classPrivateFieldGet(this,n,"m",d).call(this),e.__classPrivateFieldGet(this,v,"f").call(this,E(this.state)),this.subscribe(e.__classPrivateFieldGet(this,v,"f").bind(this),E)}))}},r=new WeakMap,l=new WeakMap,v=new WeakMap,n=new WeakSet,d=function(){this.tenantNameDriver.editFlowId&&(e.__classPrivateFieldSet(this,r,this.createModal({"data-id":"tenant-profile-set-name"}),"f"),e.__classPrivateFieldSet(this,l,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").afterClose=e.__classPrivateFieldGet(this,n,"m",c).bind(this),e.__classPrivateFieldGet(this,n,"m",c).call(this),this.syncFlowTheme(e.__classPrivateFieldGet(this,l,"f")))},c=function(){e.__classPrivateFieldGet(this,r,"f").setContent(o({projectId:this.projectId,flowId:this.tenantNameDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({tenantName:E(this.state)})})),e.__classPrivateFieldGet(this,l,"f").onSuccess((()=>{e.__classPrivateFieldGet(this,r,"f").close(),this.actions.getTenant()}))},h=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,r,"f"))||void 0===t||t.open()}))},u})),X=t.createSingletonMixin((s=>class extends(t.compose(i.debuggerMixin,i.themeMixin,U,L,z,J,H,V,B,q)(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)}))}})),Y=t.compose((t=>class extends(X(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.2.20"}}}))}}))(HTMLElement);customElements.define("descope-tenant-profile-widget",Y),module.exports=Y;
|
|
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.2.
|
|
3
|
+
* @descope/tenant-profile-widget v0.2.20
|
|
4
4
|
*/
|
|
5
|
-
import{__awaiter as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{createTemplate as s,kebabCase as n,createSingletonMixin as o,compose as r,withMemCache as a}from"@descope/sdk-helpers";import{projectIdMixin as d,observeAttributesMixin as l,loggerMixin as h,baseUrlMixin as c,cookieConfigMixin as u,createStateManagementMixin as f,initLifecycleMixin as m,modalMixin as v,themeMixin as g,staticResourcesMixin as p,createValidateAttributesMixin as w,descopeUiMixin as b,initElementMixin as S,debuggerMixin as y}from"@descope/sdk-mixins";import{FlowDriver as k,LinkDriver as C,UserAttributeDriver as R}from"@descope/sdk-component-drivers";import{createAsyncThunk as I}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import x from"@descope/web-js-sdk";import{createSelector as U}from"reselect";import"@descope/web-component";const W=(t={})=>{const e=s("<descope-wc></descope-wc>");return Object.entries(t).forEach((([t,i])=>{e.content.querySelector("descope-wc").setAttribute(n(t),i)})),e};function E(t){return new URLSearchParams(window.location.search).get(t)}const O=t=>(...e)=>i=>{i.addCase(t.pending,((t,i)=>{e.forEach((({onPending:e})=>{null==e||e(t,i)}))})),i.addCase(t.fulfilled,((t,i)=>{e.forEach((({onFulfilled:e})=>{null==e||e(t,i)}))})),i.addCase(t.rejected,((t,i)=>{e.forEach((({onRejected:e})=>{null==e||e(t,i)}))}))},D=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}}),j=I("users/me",((t,{extra:{api:e}})=>e.user.me())),T=O(j)({onFulfilled:(t,e)=>{t.me.data=e.payload}},D((t=>t.me))),M={action:j,reducer:T},A=I("tenant/details",((t,{extra:{api:e}})=>e.tenant.details())),N=O(A)({onFulfilled:(t,e)=>{t.tenant.data=e.payload}},D((t=>t.tenant))),F={action:A,reducer:N},L=I("tenant/adminLinkSso",((t,{extra:{api:e}})=>e.tenant.adminLinkSso())),q={action:L,reducer:O(L)({onFulfilled:(t,e)=>{var i;t.tenantAdminLinkSSO.data=(null===(i=e.payload)||void 0===i?void 0:i.adminSSOConfigurationLink)||""}},D((t=>t.tenantAdminLinkSSO)))},P={me:{loading:!1,error:null,data:{}},tenant:{loading:!1,error:null,data:{}},tenantAdminLinkSSO:{loading:!1,error:null,data:""}},$={me:"/v1/auth/me"},B={details:"/v1/mgmt/tenant",adminLinkSso:"/v1/mgmt/tenant/adminlinks/sso/authenticated"},J=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)})),H=()=>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})}))})),z=()=>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})}))})),X=()=>t(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({adminSSOConfigurationLink:"_blank"})}))})),Y=({httpClient:e,tenantId:i,mock:s})=>{const n=encodeURIComponent(i||""),o=`?tenant=${n}&id=${n}`;return{details:()=>t(void 0,void 0,void 0,(function*(){if(s)return z();if(!i)throw new Error("tenantId is not defined");const t=`${B.details}${o}`,n=yield e.get(t);yield J(n);return yield n.json()})),adminLinkSso:()=>t(void 0,void 0,void 0,(function*(){if(s)return X();if(!i)throw new Error("tenantId is not defined");const t=yield e.post(`${B.adminLinkSso}?tenant=${n}`,{tenantId:n},{headers:{"Content-Type":"application/json"}});yield J(t);return yield t.json()}))}},_=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return H();const t=yield e.get($.me);return yield J(t),t.json()}))}),G=o((s=>{var n,o,a,f;const m=r(d,l,h,c,u)(s);return f=class extends m{constructor(){super(...arguments),n.add(this),o.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get api(){return e(this,o,"f")||e(this,n,"m",a).call(this),e(this,o,"f")}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this),this.observeAttributes(["project-id","base-url","tenant","mock"],(()=>{e(this,o,"f")&&e(this,n,"m",a).call(this)}))}))}},o=new WeakMap,n=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),i(this,o,((t,e,i,s)=>{const n=x(Object.assign(Object.assign({},t),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"tenant-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.2.19"}}));return{user:_({httpClient:n.httpClient,mock:i}),tenant:Y({httpClient:n.httpClient,tenantId:e,mock:i})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},f})),V=o((t=>{const e=r(f({name:"widget",initialState:P,reducers:{},extraReducers:t=>{M.reducer(t),F.reducer(t),q.reducer(t)},asyncActions:{getMe:M.action,getTenant:F.action,getTenantAdminLinkSSO:q.action}}),m,h,G)(t);return class extends e{constructor(...t){super(...t),this.state=P,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),K="widget-flow",Q=o((i=>{var s,n,o;return o=class extends(r(m,v,V,u,h,g)(i)){constructor(){super(...arguments),s.add(this)}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this);const o=E(K);o&&(!function(t){if(window.history.replaceState&&E(t)){const e=new URL(window.location.href),i=new URLSearchParams(e.search);i.delete(t),e.search=i.toString(),window.history.replaceState({},"",e.toString())}}(K),e(this,s,"m",n).call(this,o))}))}},s=new WeakSet,n=function(t){const e=this.createModal({"data-id":"redirect-flow"});e.setContent(W({projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme}));new k((()=>{var t;return null===(t=e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{e.close(),this.actions.getMe(),this.actions.getTenant(),this.actions.getTenantAdminLinkSSO()})),e.afterClose=()=>{e.remove()},e.open()},o})),Z=t=>t.tenant.data,tt=t=>t.tenantAdminLinkSSO.data,et=U(Z,(t=>t.customAttributes||{})),it=U(Z,(t=>t.name||"")),st=U(Z,(t=>t.selfProvisioningDomains||[])),nt=U(Z,(t=>t.enforceSSOExclusions||[])),ot=U(Z,(t=>t.enforceSSO||!1)),rt=o((t=>class extends(r(g,l)(t)){syncFlowTheme(t){t.theme=this.theme,this.observeAttributes(["theme"],(()=>{t.theme=this.theme}))}})),at=o((e=>{const i=r(p,w({"widget-id":w.missingAttrValidator}))(e);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return t(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`tenant-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}}));const dt=o((i=>{var n,o,a;return a=class extends(r(h,m,b,S,at,V)(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(),this.actions.getTenantAdminLinkSSO()])}catch(t){}const s=this.state.me.error||(t=>t.tenant.error)(this.state)||(t=>t.tenantAdminLinkSSO.error)(this.state);if(s){this.contentRootElement.innerHTML="";const t="object"==typeof s&&null!==s&&"message"in s?s.message:String(s)||"An error occurred";this.contentRootElement.append(function({mainMessage:t="An error occurred"}){const e=document.createElement("div");e.setAttribute("data-id","widget-error"),e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="center",e.style.justifyContent="center",e.style.padding="72px 36px",e.style.background="#fff",e.style.borderRadius="12px",e.style.boxShadow="0 2px 8px rgba(0,0,0,0.03)",e.style.margin="32px auto",e.style.maxWidth="400px";const i=document.createElement("div");i.innerHTML='\n <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="20" cy="20" r="18" stroke="#FF3B3B" stroke-width="3" fill="#fff"/>\n <text x="20" y="27" text-anchor="middle" font-size="24" font-family="Arial, sans-serif" fill="#FF3B3B">!</text>\n </svg>\n ',i.style.marginBottom="12px",e.appendChild(i);const s=document.createElement("div");return s.textContent=t,s.style.fontWeight="bold",s.style.fontSize="20px",s.style.color="#222",s.style.textAlign="center",s.style.marginTop="8px",e.appendChild(s),e}({mainMessage:t}))}else yield e(this,n,"m",o).call(this),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},n=new WeakSet,o=function(){return t(this,void 0,void 0,(function*(){const t=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(t),this.contentRootElement.append(t.content.cloneNode(!0))}))},a})),lt=o((i=>{var s,n,o,d;return d=class extends(r(rt,V,h,dt,u,v)(i)){constructor(){super(...arguments),s.add(this),o.set(this,a((t=>{this.tenantAdminLinkSSODriver.href=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,s,"m",n).call(this),e(this,o,"f").call(this,tt(this.state)),this.subscribe(e(this,o,"f").bind(this),tt)}))}},o=new WeakMap,s=new WeakSet,n=function(){this.tenantAdminLinkSSODriver=new C((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-link[data-id="tenant-admin-link-sso"]')}),{logger:this.logger})},d}));var ht;!function(t){t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t.SINGLE_SELECT="singleSelect",t.ARRAY="array",t.DATE="date"}(ht||(ht={}));const ct=o((i=>{var s,n,o,d,l,c,f,m,g,p,w;return w=class extends(r(rt,V,h,dt,u,v)(i)){constructor(){super(...arguments),s.add(this),n.set(this,{}),o.set(this,{}),d.set(this,{}),l.set(this,{}),m.set(this,a((t=>{var i;const n=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(n).forEach((i=>{const n=i.getAttribute("data-id").replace("customAttributes.",""),o=i.getAttribute("data-type")||ht.TEXT,r=t[n],a=new R(i,{logger:this.logger});a.value=((t,e)=>t===ht.DATE&&e?new Date(e).toLocaleString():t===ht.BOOLEAN&&void 0!==e?e?"True":"False":(e||"").toString())(o,r),e(this,s,"m",g).call(this,i,n,a,o,n,r),e(this,s,"m",p).call(this,i,n,a)}))})))}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,m,"f").call(this,et(this.state)),this.subscribe(e(this,m,"f").bind(this),et)}))}},n=new WeakMap,o=new WeakMap,d=new WeakMap,l=new WeakMap,m=new WeakMap,s=new WeakSet,c=function(t,i,s,r){var a,d;const l=i===ht.ARRAY?(r||[]).join(","):r;null===(a=e(this,n,"f")[t])||void 0===a||a.setContent(W({projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({customAttributes:{[s]:l}})})),null===(d=e(this,o,"f")[t])||void 0===d||d.onSuccess((()=>{var i;null===(i=e(this,n,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},f=function(t){var i,s;null===(i=e(this,d,"f")[t])||void 0===i||i.setContent(W({projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=e(this,l,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,d,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},g=function(t,i,r,a,d,l){const h=t.getAttribute("edit-flow-id");h&&(e(this,n,"f")[h]=this.createModal({"data-id":`edit-${i}`}),e(this,o,"f")[h]=new k((()=>{var t,i;return null===(i=null===(t=e(this,n,"f")[h])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,n,"f")[h].afterClose=e(this,s,"m",c).bind(this,h),r.onEditClick((()=>{var t,i;null===(i=null===(t=e(this,n,"f"))||void 0===t?void 0:t[h])||void 0===i||i.open()})),e(this,s,"m",c).call(this,h,a,d,l),this.syncFlowTheme(e(this,o,"f")[h]))},p=function(t,i,n){const o=t.getAttribute("delete-flow-id");o&&(e(this,d,"f")[o]=this.createModal({"data-id":`delete-${i}`}),e(this,l,"f")[o]=new k((()=>{var t,i;return null===(i=null===(t=e(this,d,"f")[o])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,d,"f")[o].afterClose=e(this,s,"m",f).bind(this,o),n.onDeleteClick((()=>{var t,i;null===(i=null===(t=e(this,d,"f"))||void 0===t?void 0:t[o])||void 0===i||i.open()})),e(this,s,"m",f).call(this,o),this.syncFlowTheme(e(this,l,"f")[o]))},w})),ut=o((s=>{var n,o,d,l,c,f,m,g,p,w,b,S;return S=class extends(r(rt,V,h,dt,u,v)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),b.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,n,"m",w).call(this),e(this,n,"m",f).call(this),e(this,n,"m",g).call(this),e(this,b,"f").call(this,st(this.state)),this.subscribe(e(this,b,"f").bind(this),st)}))}},o=new WeakMap,d=new WeakMap,l=new WeakMap,c=new WeakMap,b=new WeakMap,n=new WeakSet,f=function(){this.tenantEmailDomainsDriver.editFlowId&&(i(this,o,this.createModal({"data-id":"edit-tenant-email-domains"}),"f"),i(this,d,new k((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").afterClose=e(this,n,"m",m).bind(this),e(this,n,"m",m).call(this),this.syncFlowTheme(e(this,d,"f")))},m=function(){e(this,o,"f").setContent(W({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({tenantEmailDomains:st(this.state)})})),e(this,d,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},g=function(){this.tenantEmailDomainsDriver.deleteFlowId&&(i(this,l,this.createModal({"data-id":"delete-tenant-email-domains"}),"f"),i(this,c,new k((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,n,"m",p).bind(this),e(this,n,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,l,"f").setContent(W({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e(this,c,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getTenant()}))},w=function(){this.tenantEmailDomainsDriver=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-email-domains-edit"]')}),{logger:this.logger}),this.tenantEmailDomainsDriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()})),this.tenantEmailDomainsDriver.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},S})),ft=o((s=>{var n,o,d,l,c,f,m,g,p,w,b,S;return S=class extends(r(rt,V,h,dt,u,v)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),b.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,n,"m",w).call(this),e(this,n,"m",f).call(this),e(this,n,"m",g).call(this),e(this,b,"f").call(this,nt(this.state)),this.subscribe(e(this,b,"f").bind(this),nt)}))}},o=new WeakMap,d=new WeakMap,l=new WeakMap,c=new WeakMap,b=new WeakMap,n=new WeakSet,f=function(){this.tenantSSOExclusionsDriver.editFlowId&&(i(this,o,this.createModal({"data-id":"edit-tenant-sso-exclusions"}),"f"),i(this,d,new k((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").afterClose=e(this,n,"m",m).bind(this),e(this,n,"m",m).call(this),this.syncFlowTheme(e(this,d,"f")))},m=function(){e(this,o,"f").setContent(W({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({enforceSSOExclusions:nt(this.state)})})),e(this,d,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},g=function(){this.tenantSSOExclusionsDriver.deleteFlowId&&(i(this,l,this.createModal({"data-id":"delete-tenant-sso-exclusions"}),"f"),i(this,c,new k((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,n,"m",p).bind(this),e(this,n,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,l,"f").setContent(W({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e(this,c,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getTenant()}))},w=function(){this.tenantSSOExclusionsDriver=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-force-sso-exclusions-edit"]')}),{logger:this.logger}),this.tenantSSOExclusionsDriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()})),this.tenantSSOExclusionsDriver.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},S})),mt=o((s=>{var n,o,d,l,c,f,m,g,p,w,b,S;return S=class extends(r(rt,V,h,dt,u,v)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),b.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,n,"m",w).call(this),e(this,n,"m",f).call(this),e(this,n,"m",g).call(this),e(this,b,"f").call(this,ot(this.state)),this.subscribe(e(this,b,"f").bind(this),ot)}))}},o=new WeakMap,d=new WeakMap,l=new WeakMap,c=new WeakMap,b=new WeakMap,n=new WeakSet,f=function(){this.tenantEnforceSSODriver.editFlowId&&(i(this,o,this.createModal({"data-id":"edit-tenant-enforce-sso"}),"f"),i(this,d,new k((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").afterClose=e(this,n,"m",m).bind(this),e(this,n,"m",m).call(this),this.syncFlowTheme(e(this,d,"f")))},m=function(){e(this,o,"f").setContent(W({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({enforceSSO:ot(this.state)})})),e(this,d,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},g=function(){this.tenantEnforceSSODriver.deleteFlowId&&(i(this,l,this.createModal({"data-id":"delete-tenant-enforce-sso"}),"f"),i(this,c,new k((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,n,"m",p).bind(this),e(this,n,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,l,"f").setContent(W({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e(this,c,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getTenant()}))},w=function(){this.tenantEnforceSSODriver=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-enforce-sso-edit"]')}),{logger:this.logger}),this.tenantEnforceSSODriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()})),this.tenantEnforceSSODriver.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},S})),vt=o((s=>{var n,o,d,l,c,f,m,g;return g=class extends(r(rt,V,h,dt,u,v)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),d.set(this,void 0),m.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,n,"m",f).call(this),e(this,n,"m",l).call(this),e(this,m,"f").call(this,it(this.state)),this.subscribe(e(this,m,"f").bind(this),it)}))}},o=new WeakMap,d=new WeakMap,m=new WeakMap,n=new WeakSet,l=function(){this.tenantNameDriver.editFlowId&&(i(this,o,this.createModal({"data-id":"tenant-profile-set-name"}),"f"),i(this,d,new k((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").afterClose=e(this,n,"m",c).bind(this),e(this,n,"m",c).call(this),this.syncFlowTheme(e(this,d,"f")))},c=function(){e(this,o,"f").setContent(W({projectId:this.projectId,flowId:this.tenantNameDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({tenantName:it(this.state)})})),e(this,d,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},f=function(){this.tenantNameDriver=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-name-edit"]')}),{logger:this.logger}),this.tenantNameDriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()}))},g})),gt=o((e=>class extends(r(y,g,Q,dt,vt,ut,ft,mt,ct,lt)(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)}))}})),pt=r((e=>class extends(gt(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.2.19"}}}))}}))(HTMLElement);customElements.define("descope-tenant-profile-widget",pt);export{pt as default};
|
|
5
|
+
import{__awaiter as t,__classPrivateFieldGet as e,__classPrivateFieldSet as i}from"tslib";import{createTemplate as s,kebabCase as n,createSingletonMixin as o,compose as r,withMemCache as a}from"@descope/sdk-helpers";import{projectIdMixin as d,observeAttributesMixin as l,loggerMixin as h,baseUrlMixin as c,cookieConfigMixin as u,createStateManagementMixin as f,initLifecycleMixin as m,modalMixin as v,themeMixin as g,staticResourcesMixin as p,createValidateAttributesMixin as w,descopeUiMixin as b,initElementMixin as S,debuggerMixin as y}from"@descope/sdk-mixins";import{FlowDriver as k,LinkDriver as C,UserAttributeDriver as R}from"@descope/sdk-component-drivers";import{createAsyncThunk as I}from"@reduxjs/toolkit";import"@descope/core-js-sdk";import x from"@descope/web-js-sdk";import{createSelector as U}from"reselect";import"@descope/web-component";const W=(t={})=>{const e=s("<descope-wc></descope-wc>");return Object.entries(t).forEach((([t,i])=>{e.content.querySelector("descope-wc").setAttribute(n(t),i)})),e};function E(t){return new URLSearchParams(window.location.search).get(t)}const O=t=>(...e)=>i=>{i.addCase(t.pending,((t,i)=>{e.forEach((({onPending:e})=>{null==e||e(t,i)}))})),i.addCase(t.fulfilled,((t,i)=>{e.forEach((({onFulfilled:e})=>{null==e||e(t,i)}))})),i.addCase(t.rejected,((t,i)=>{e.forEach((({onRejected:e})=>{null==e||e(t,i)}))}))},D=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}}),j=I("users/me",((t,{extra:{api:e}})=>e.user.me())),T=O(j)({onFulfilled:(t,e)=>{t.me.data=e.payload}},D((t=>t.me))),M={action:j,reducer:T},A=I("tenant/details",((t,{extra:{api:e}})=>e.tenant.details())),N=O(A)({onFulfilled:(t,e)=>{t.tenant.data=e.payload}},D((t=>t.tenant))),F={action:A,reducer:N},L=I("tenant/adminLinkSso",((t,{extra:{api:e}})=>e.tenant.adminLinkSso())),q={action:L,reducer:O(L)({onFulfilled:(t,e)=>{var i;t.tenantAdminLinkSSO.data=(null===(i=e.payload)||void 0===i?void 0:i.adminSSOConfigurationLink)||""}},D((t=>t.tenantAdminLinkSSO)))},P={me:{loading:!1,error:null,data:{}},tenant:{loading:!1,error:null,data:{}},tenantAdminLinkSSO:{loading:!1,error:null,data:""}},$={me:"/v1/auth/me"},B={details:"/v1/mgmt/tenant",adminLinkSso:"/v1/mgmt/tenant/adminlinks/sso/authenticated"},J=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)})),H=()=>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})}))})),z=()=>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})}))})),X=()=>t(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({adminSSOConfigurationLink:"_blank"})}))})),Y=({httpClient:e,tenantId:i,mock:s})=>{const n=encodeURIComponent(i||""),o=`?tenant=${n}&id=${n}`;return{details:()=>t(void 0,void 0,void 0,(function*(){if(s)return z();if(!i)throw new Error("tenantId is not defined");const t=`${B.details}${o}`,n=yield e.get(t);yield J(n);return yield n.json()})),adminLinkSso:()=>t(void 0,void 0,void 0,(function*(){if(s)return X();if(!i)throw new Error("tenantId is not defined");const t=yield e.post(`${B.adminLinkSso}?tenant=${n}`,{tenantId:n},{headers:{"Content-Type":"application/json"}});yield J(t);return yield t.json()}))}},_=({httpClient:e,mock:i})=>({me:()=>t(void 0,void 0,void 0,(function*(){if(i)return H();const t=yield e.get($.me);return yield J(t),t.json()}))}),G=o((s=>{var n,o,a,f;const m=r(d,l,h,c,u)(s);return f=class extends m{constructor(){super(...arguments),n.add(this),o.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get tenantId(){return this.getAttribute("tenant")}get mock(){return this.getAttribute("mock")}get api(){return e(this,o,"f")||e(this,n,"m",a).call(this),e(this,o,"f")}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this),this.observeAttributes(["project-id","base-url","tenant","mock"],(()=>{e(this,o,"f")&&e(this,n,"m",a).call(this)}))}))}},o=new WeakMap,n=new WeakSet,a=function(){this.logger.debug("creating an sdk instance"),i(this,o,((t,e,i,s)=>{const n=x(Object.assign(Object.assign({},t),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"tenant-profile-widget","x-descope-widget-id":s,"x-descope-widget-version":"0.2.20"}}));return{user:_({httpClient:n.httpClient,mock:i}),tenant:Y({httpClient:n.httpClient,tenantId:e,mock:i})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},this.tenantId,"true"===this.mock,this.widgetId),"f")},f})),V=o((t=>{const e=r(f({name:"widget",initialState:P,reducers:{},extraReducers:t=>{M.reducer(t),F.reducer(t),q.reducer(t)},asyncActions:{getMe:M.action,getTenant:F.action,getTenantAdminLinkSSO:q.action}}),m,h,G)(t);return class extends e{constructor(...t){super(...t),this.state=P,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),K="widget-flow",Q=o((i=>{var s,n,o;return o=class extends(r(m,v,V,u,h,g)(i)){constructor(){super(...arguments),s.add(this)}init(){const i=Object.create(null,{init:{get:()=>super.init}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.init)||void 0===t?void 0:t.call(this);const o=E(K);o&&(!function(t){if(window.history.replaceState&&E(t)){const e=new URL(window.location.href),i=new URLSearchParams(e.search);i.delete(t),e.search=i.toString(),window.history.replaceState({},"",e.toString())}}(K),e(this,s,"m",n).call(this,o))}))}},s=new WeakSet,n=function(t){const e=this.createModal({"data-id":"redirect-flow"});e.setContent(W({projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme}));new k((()=>{var t;return null===(t=e.ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}).onSuccess((()=>{e.close(),this.actions.getMe(),this.actions.getTenant(),this.actions.getTenantAdminLinkSSO()})),e.afterClose=()=>{e.remove()},e.open()},o})),Z=t=>t.tenant.data,tt=t=>t.tenantAdminLinkSSO.data,et=U(Z,(t=>t.customAttributes||{})),it=U(Z,(t=>t.name||"")),st=U(Z,(t=>t.selfProvisioningDomains||[])),nt=U(Z,(t=>t.enforceSSOExclusions||[])),ot=U(Z,(t=>t.enforceSSO||!1)),rt=o((t=>class extends(r(g,l)(t)){syncFlowTheme(t){t.theme=this.theme,this.observeAttributes(["theme"],(()=>{t.theme=this.theme}))}})),at=o((e=>{const i=r(p,w({"widget-id":w.missingAttrValidator}))(e);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(e){return t(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`tenant-profile-widget/${this.widgetId}/${e}`,"text")).body}))}}}));const dt=o((i=>{var n,o,a;return a=class extends(r(h,m,b,S,at,V)(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(),this.actions.getTenantAdminLinkSSO()])}catch(t){}const s=this.state.me.error||(t=>t.tenant.error)(this.state)||(t=>t.tenantAdminLinkSSO.error)(this.state);if(s){this.contentRootElement.innerHTML="";const t="object"==typeof s&&null!==s&&"message"in s?s.message:String(s)||"An error occurred";this.contentRootElement.append(function({mainMessage:t="An error occurred"}){const e=document.createElement("div");e.setAttribute("data-id","widget-error"),e.style.display="flex",e.style.flexDirection="column",e.style.alignItems="center",e.style.justifyContent="center",e.style.padding="72px 36px",e.style.background="#fff",e.style.borderRadius="12px",e.style.boxShadow="0 2px 8px rgba(0,0,0,0.03)",e.style.margin="32px auto",e.style.maxWidth="400px";const i=document.createElement("div");i.innerHTML='\n <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">\n <circle cx="20" cy="20" r="18" stroke="#FF3B3B" stroke-width="3" fill="#fff"/>\n <text x="20" y="27" text-anchor="middle" font-size="24" font-family="Arial, sans-serif" fill="#FF3B3B">!</text>\n </svg>\n ',i.style.marginBottom="12px",e.appendChild(i);const s=document.createElement("div");return s.textContent=t,s.style.fontWeight="bold",s.style.fontSize="20px",s.style.color="#222",s.style.textAlign="center",s.style.marginTop="8px",e.appendChild(s),e}({mainMessage:t}))}else yield e(this,n,"m",o).call(this),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},n=new WeakSet,o=function(){return t(this,void 0,void 0,(function*(){const t=s(yield this.fetchWidgetPage("root.html"));yield this.loadDescopeUiComponents(t),this.contentRootElement.append(t.content.cloneNode(!0))}))},a})),lt=o((i=>{var s,n,o,d;return d=class extends(r(rt,V,h,dt,u,v)(i)){constructor(){super(...arguments),s.add(this),o.set(this,a((t=>{this.tenantAdminLinkSSODriver.href=t})))}onWidgetRootReady(){const i=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return t(this,void 0,void 0,(function*(){var t;yield null===(t=i.onWidgetRootReady)||void 0===t?void 0:t.call(this),e(this,s,"m",n).call(this),e(this,o,"f").call(this,tt(this.state)),this.subscribe(e(this,o,"f").bind(this),tt)}))}},o=new WeakMap,s=new WeakSet,n=function(){this.tenantAdminLinkSSODriver=new C((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-link[data-id="tenant-admin-link-sso"]')}),{logger:this.logger})},d}));var ht;!function(t){t.TEXT="text",t.NUMBER="number",t.BOOLEAN="boolean",t.SINGLE_SELECT="singleSelect",t.ARRAY="array",t.DATE="date"}(ht||(ht={}));const ct=o((i=>{var s,n,o,d,l,c,f,m,g,p,w;return w=class extends(r(rt,V,h,dt,u,v)(i)){constructor(){super(...arguments),s.add(this),n.set(this,{}),o.set(this,{}),d.set(this,{}),l.set(this,{}),m.set(this,a((t=>{var i;const n=null===(i=this.shadowRoot)||void 0===i?void 0:i.querySelectorAll('descope-user-attribute[data-id^="customAttributes."]');Array.from(n).forEach((i=>{const n=i.getAttribute("data-id").replace("customAttributes.",""),o=i.getAttribute("data-type")||ht.TEXT,r=t[n],a=new R(i,{logger:this.logger});a.value=((t,e)=>t===ht.DATE&&e?new Date(e).toLocaleString():t===ht.BOOLEAN&&void 0!==e?e?"True":"False":(e||"").toString())(o,r),e(this,s,"m",g).call(this,i,n,a,o,n,r),e(this,s,"m",p).call(this,i,n,a)}))})))}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,m,"f").call(this,et(this.state)),this.subscribe(e(this,m,"f").bind(this),et)}))}},n=new WeakMap,o=new WeakMap,d=new WeakMap,l=new WeakMap,m=new WeakMap,s=new WeakSet,c=function(t,i,s,r){var a,d;const l=i===ht.ARRAY?(r||[]).join(","):r;null===(a=e(this,n,"f")[t])||void 0===a||a.setContent(W({projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({customAttributes:{[s]:l}})})),null===(d=e(this,o,"f")[t])||void 0===d||d.onSuccess((()=>{var i;null===(i=e(this,n,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},f=function(t){var i,s;null===(i=e(this,d,"f")[t])||void 0===i||i.setContent(W({projectId:this.projectId,flowId:t,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),null===(s=e(this,l,"f")[t])||void 0===s||s.onSuccess((()=>{var i;null===(i=e(this,d,"f")[t])||void 0===i||i.close(),this.actions.getTenant()}))},g=function(t,i,r,a,d,l){const h=t.getAttribute("edit-flow-id");h&&(e(this,n,"f")[h]=this.createModal({"data-id":`edit-${i}`}),e(this,o,"f")[h]=new k((()=>{var t,i;return null===(i=null===(t=e(this,n,"f")[h])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,n,"f")[h].afterClose=e(this,s,"m",c).bind(this,h),r.onEditClick((()=>{var t,i;null===(i=null===(t=e(this,n,"f"))||void 0===t?void 0:t[h])||void 0===i||i.open()})),e(this,s,"m",c).call(this,h,a,d,l),this.syncFlowTheme(e(this,o,"f")[h]))},p=function(t,i,n){const o=t.getAttribute("delete-flow-id");o&&(e(this,d,"f")[o]=this.createModal({"data-id":`delete-${i}`}),e(this,l,"f")[o]=new k((()=>{var t,i;return null===(i=null===(t=e(this,d,"f")[o])||void 0===t?void 0:t.ele)||void 0===i?void 0:i.querySelector("descope-wc")}),{logger:this.logger}),e(this,d,"f")[o].afterClose=e(this,s,"m",f).bind(this,o),n.onDeleteClick((()=>{var t,i;null===(i=null===(t=e(this,d,"f"))||void 0===t?void 0:t[o])||void 0===i||i.open()})),e(this,s,"m",f).call(this,o),this.syncFlowTheme(e(this,l,"f")[o]))},w})),ut=o((s=>{var n,o,d,l,c,f,m,g,p,w,b,S;return S=class extends(r(rt,V,h,dt,u,v)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),b.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,n,"m",w).call(this),e(this,n,"m",f).call(this),e(this,n,"m",g).call(this),e(this,b,"f").call(this,st(this.state)),this.subscribe(e(this,b,"f").bind(this),st)}))}},o=new WeakMap,d=new WeakMap,l=new WeakMap,c=new WeakMap,b=new WeakMap,n=new WeakSet,f=function(){this.tenantEmailDomainsDriver.editFlowId&&(i(this,o,this.createModal({"data-id":"edit-tenant-email-domains"}),"f"),i(this,d,new k((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").afterClose=e(this,n,"m",m).bind(this),e(this,n,"m",m).call(this),this.syncFlowTheme(e(this,d,"f")))},m=function(){e(this,o,"f").setContent(W({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({tenantEmailDomains:st(this.state)})})),e(this,d,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},g=function(){this.tenantEmailDomainsDriver.deleteFlowId&&(i(this,l,this.createModal({"data-id":"delete-tenant-email-domains"}),"f"),i(this,c,new k((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,n,"m",p).bind(this),e(this,n,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,l,"f").setContent(W({projectId:this.projectId,flowId:this.tenantEmailDomainsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e(this,c,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getTenant()}))},w=function(){this.tenantEmailDomainsDriver=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-email-domains-edit"]')}),{logger:this.logger}),this.tenantEmailDomainsDriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()})),this.tenantEmailDomainsDriver.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},S})),ft=o((s=>{var n,o,d,l,c,f,m,g,p,w,b,S;return S=class extends(r(rt,V,h,dt,u,v)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),b.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,n,"m",w).call(this),e(this,n,"m",f).call(this),e(this,n,"m",g).call(this),e(this,b,"f").call(this,nt(this.state)),this.subscribe(e(this,b,"f").bind(this),nt)}))}},o=new WeakMap,d=new WeakMap,l=new WeakMap,c=new WeakMap,b=new WeakMap,n=new WeakSet,f=function(){this.tenantSSOExclusionsDriver.editFlowId&&(i(this,o,this.createModal({"data-id":"edit-tenant-sso-exclusions"}),"f"),i(this,d,new k((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").afterClose=e(this,n,"m",m).bind(this),e(this,n,"m",m).call(this),this.syncFlowTheme(e(this,d,"f")))},m=function(){e(this,o,"f").setContent(W({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({enforceSSOExclusions:nt(this.state)})})),e(this,d,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},g=function(){this.tenantSSOExclusionsDriver.deleteFlowId&&(i(this,l,this.createModal({"data-id":"delete-tenant-sso-exclusions"}),"f"),i(this,c,new k((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,n,"m",p).bind(this),e(this,n,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,l,"f").setContent(W({projectId:this.projectId,flowId:this.tenantSSOExclusionsDriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e(this,c,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getTenant()}))},w=function(){this.tenantSSOExclusionsDriver=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-force-sso-exclusions-edit"]')}),{logger:this.logger}),this.tenantSSOExclusionsDriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()})),this.tenantSSOExclusionsDriver.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},S})),mt=o((s=>{var n,o,d,l,c,f,m,g,p,w,b,S;return S=class extends(r(rt,V,h,dt,u,v)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),d.set(this,void 0),l.set(this,void 0),c.set(this,void 0),b.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,n,"m",w).call(this),e(this,n,"m",f).call(this),e(this,n,"m",g).call(this),e(this,b,"f").call(this,ot(this.state)),this.subscribe(e(this,b,"f").bind(this),ot)}))}},o=new WeakMap,d=new WeakMap,l=new WeakMap,c=new WeakMap,b=new WeakMap,n=new WeakSet,f=function(){this.tenantEnforceSSODriver.editFlowId&&(i(this,o,this.createModal({"data-id":"edit-tenant-enforce-sso"}),"f"),i(this,d,new k((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").afterClose=e(this,n,"m",m).bind(this),e(this,n,"m",m).call(this),this.syncFlowTheme(e(this,d,"f")))},m=function(){e(this,o,"f").setContent(W({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({enforceSSO:ot(this.state)})})),e(this,d,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},g=function(){this.tenantEnforceSSODriver.deleteFlowId&&(i(this,l,this.createModal({"data-id":"delete-tenant-enforce-sso"}),"f"),i(this,c,new k((()=>{var t;return null===(t=e(this,l,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,l,"f").afterClose=e(this,n,"m",p).bind(this),e(this,n,"m",p).call(this),this.syncFlowTheme(e(this,c,"f")))},p=function(){e(this,l,"f").setContent(W({projectId:this.projectId,flowId:this.tenantEnforceSSODriver.deleteFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme})),e(this,c,"f").onSuccess((()=>{e(this,l,"f").close(),this.actions.getTenant()}))},w=function(){this.tenantEnforceSSODriver=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-enforce-sso-edit"]')}),{logger:this.logger}),this.tenantEnforceSSODriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()})),this.tenantEnforceSSODriver.onDeleteClick((()=>{var t;null===(t=e(this,l,"f"))||void 0===t||t.open()}))},S})),vt=o((s=>{var n,o,d,l,c,f,m,g;return g=class extends(r(rt,V,h,dt,u,v)(s)){constructor(){super(...arguments),n.add(this),o.set(this,void 0),d.set(this,void 0),m.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,n,"m",f).call(this),e(this,n,"m",l).call(this),e(this,m,"f").call(this,it(this.state)),this.subscribe(e(this,m,"f").bind(this),it)}))}},o=new WeakMap,d=new WeakMap,m=new WeakMap,n=new WeakSet,l=function(){this.tenantNameDriver.editFlowId&&(i(this,o,this.createModal({"data-id":"tenant-profile-set-name"}),"f"),i(this,d,new k((()=>{var t;return null===(t=e(this,o,"f").ele)||void 0===t?void 0:t.querySelector("descope-wc")}),{logger:this.logger}),"f"),e(this,o,"f").afterClose=e(this,n,"m",c).bind(this),e(this,n,"m",c).call(this),this.syncFlowTheme(e(this,d,"f")))},c=function(){e(this,o,"f").setContent(W({projectId:this.projectId,flowId:this.tenantNameDriver.editFlowId,tenant:this.tenantId,baseUrl:this.baseUrl,baseStaticUrl:this.baseStaticUrl,baseCdnUrl:this.baseCdnUrl,refreshCookieName:this.refreshCookieName,theme:this.theme,form:JSON.stringify({tenantName:it(this.state)})})),e(this,d,"f").onSuccess((()=>{e(this,o,"f").close(),this.actions.getTenant()}))},f=function(){this.tenantNameDriver=new R((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector('descope-user-attribute[data-id="tenant-name-edit"]')}),{logger:this.logger}),this.tenantNameDriver.onEditClick((()=>{var t;null===(t=e(this,o,"f"))||void 0===t||t.open()}))},g})),gt=o((e=>class extends(r(y,g,Q,dt,vt,ut,ft,mt,ct,lt)(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)}))}})),pt=r((e=>class extends(gt(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.2.20"}}}))}}))(HTMLElement);customElements.define("descope-tenant-profile-widget",pt);export{pt as default};
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ declare const TenantProfileWidget: {
|
|
|
40
40
|
"__#8@#initTenantAdminLinkSSO"(): void;
|
|
41
41
|
"__#8@#onValueUpdate": (tenantAdminLinkSSO: string) => void;
|
|
42
42
|
onWidgetRootReady: (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>);
|
|
43
|
-
"__#
|
|
43
|
+
"__#29690@#ModalDriverWrapper": {
|
|
44
44
|
new (refOrRefFn: Element | (() => HTMLElement), config: {
|
|
45
45
|
logger: {
|
|
46
46
|
error(...data: any[]): void;
|
|
@@ -50,7 +50,7 @@ declare const TenantProfileWidget: {
|
|
|
50
50
|
};
|
|
51
51
|
}): {
|
|
52
52
|
setContent(template: HTMLTemplateElement): void;
|
|
53
|
-
"__#
|
|
53
|
+
"__#29689@#private": any;
|
|
54
54
|
beforeOpen: () => void | Promise<void>;
|
|
55
55
|
afterClose: () => void;
|
|
56
56
|
nodeName: string;
|
|
@@ -58,7 +58,7 @@ declare const TenantProfileWidget: {
|
|
|
58
58
|
open(): Promise<void>;
|
|
59
59
|
reset(): void;
|
|
60
60
|
remove(): void;
|
|
61
|
-
"__#
|
|
61
|
+
"__#29687@#private": any;
|
|
62
62
|
logger: {
|
|
63
63
|
error(...data: any[]): void;
|
|
64
64
|
warn(...data: any[]): void;
|
|
@@ -70,11 +70,11 @@ declare const TenantProfileWidget: {
|
|
|
70
70
|
};
|
|
71
71
|
};
|
|
72
72
|
createModal(config?: Record<string, string>): _descope_sdk_component_drivers.ModalDriver;
|
|
73
|
-
"__#
|
|
74
|
-
"__#
|
|
73
|
+
"__#29686@#getComponentsVersion": (() => Promise<string>) & (() => Promise<string>) & (() => Promise<string>);
|
|
74
|
+
"__#29686@#descopeUi": Promise<any>;
|
|
75
75
|
readonly descopeUi: Promise<any>;
|
|
76
|
-
"__#
|
|
77
|
-
"__#
|
|
76
|
+
"__#29686@#loadDescopeUiComponent": ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>) & ((componentName: string) => Promise<any>);
|
|
77
|
+
"__#29686@#getDescopeUi": (() => Promise<any>) & (() => Promise<any>) & (() => Promise<any>);
|
|
78
78
|
loadDescopeUiComponents: ((templateOrComponentNames: HTMLTemplateElement | string[]) => Promise<any[]>) & ((templateOrComponentNames: HTMLTemplateElement | string[]) => Promise<any[]>) & ((templateOrComponentNames: HTMLTemplateElement | string[]) => Promise<any[]>);
|
|
79
79
|
readonly baseCdnUrl: string;
|
|
80
80
|
injectNpmLib: ((libName: string, version: string, filePath?: string, overrides?: string[]) => Promise<{
|
|
@@ -87,8 +87,8 @@ declare const TenantProfileWidget: {
|
|
|
87
87
|
id: string;
|
|
88
88
|
url: URL;
|
|
89
89
|
}>);
|
|
90
|
-
"__#
|
|
91
|
-
"__#
|
|
90
|
+
"__#29676@#logger": _descope_sdk_mixins.Logger;
|
|
91
|
+
"__#29676@#wrapLogger": ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger) & ((logger: Partial<_descope_sdk_mixins.Logger>) => _descope_sdk_mixins.Logger);
|
|
92
92
|
logger: _descope_sdk_mixins.Logger;
|
|
93
93
|
onLogEvent: ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: _descope_sdk_mixins.LogLevel, data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: "error" | "warn" | "info" | "debug", data: any[]) => void) & ((logLevel: _descope_sdk_mixins.LogLevel, args: any[]) => void);
|
|
94
94
|
accessKey: string;
|
|
@@ -1046,20 +1046,20 @@ declare const TenantProfileWidget: {
|
|
|
1046
1046
|
blur: (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void) & (() => void);
|
|
1047
1047
|
focus: ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void) & ((options?: FocusOptions) => void);
|
|
1048
1048
|
readonly config: Promise<_descope_sdk_mixins.Config>;
|
|
1049
|
-
"__#
|
|
1050
|
-
"__#
|
|
1051
|
-
"__#
|
|
1052
|
-
"__#
|
|
1053
|
-
"__#
|
|
1049
|
+
"__#29682@#configCacheClear": (() => void) & (() => void) & (() => void) & (() => void);
|
|
1050
|
+
"__#29682@#_configResource": Promise<_descope_sdk_mixins.Config>;
|
|
1051
|
+
"__#29682@#fetchConfig": (() => Promise<_descope_sdk_mixins.Config>) & (() => Promise<_descope_sdk_mixins.Config>) & (() => Promise<_descope_sdk_mixins.Config>) & (() => Promise<_descope_sdk_mixins.Config>);
|
|
1052
|
+
"__#29677@#isInit": boolean;
|
|
1053
|
+
"__#29681@#callbacks": Map<string, () => void> & Map<string, () => void> & Map<string, () => void> & Map<string, () => void>;
|
|
1054
1054
|
onReset: ((sectionId: string, callback: () => void | Promise<void>) => () => void) & ((sectionId: string, callback: () => void | Promise<void>) => () => void) & ((sectionId: string, callback: () => void | Promise<void>) => () => void) & ((sectionId: string, callback: () => void | Promise<void>) => () => void);
|
|
1055
1055
|
reset: ((...sectionIds: string[]) => Promise<void>) & ((...sectionIds: string[]) => Promise<void>) & ((...sectionIds: string[]) => Promise<void>) & ((...sectionIds: string[]) => Promise<void>);
|
|
1056
|
-
"__#
|
|
1057
|
-
"__#
|
|
1056
|
+
"__#29679@#handleError": ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string | null) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void) & ((attrName: string, newValue: string) => void);
|
|
1057
|
+
"__#29678@#observeMappings": {} & {} & {};
|
|
1058
1058
|
observeAttribute: ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string | null) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any) & ((attrName: string, onAttrChange: (attrName: string, value: string) => void) => () => any);
|
|
1059
1059
|
observeAttributes: ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string | null) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void) & ((attrs: string[], cb: (attrName: string, value: string) => void) => () => void);
|
|
1060
|
-
"__#
|
|
1061
|
-
"__#
|
|
1062
|
-
"__#
|
|
1060
|
+
"__#29680@#lastBaseUrl"?: string;
|
|
1061
|
+
"__#29680@#workingBaseUrl"?: string;
|
|
1062
|
+
"__#29680@#getResourceUrls": ((filename: string) => (URL & {
|
|
1063
1063
|
baseUrl: string;
|
|
1064
1064
|
}) | (URL & {
|
|
1065
1065
|
baseUrl: string;
|
|
@@ -1137,7 +1137,7 @@ declare const TenantProfileWidget: {
|
|
|
1137
1137
|
replaceSync(cssString: string): void;
|
|
1138
1138
|
readonly cssRules: CSSRuleList;
|
|
1139
1139
|
} | CSSStyleSheet);
|
|
1140
|
-
"__#
|
|
1140
|
+
"__#29683@#setNonce": (() => void) & (() => void) & (() => void) & (() => void);
|
|
1141
1141
|
readonly refreshCookieName: string;
|
|
1142
1142
|
"__#7@#initWidgetRoot": (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>) & (() => Promise<void>);
|
|
1143
1143
|
state: State;
|
|
@@ -1687,22 +1687,22 @@ declare const TenantProfileWidget: {
|
|
|
1687
1687
|
subscribe: <SelectorR = State>(cb: (state: SelectorR) => void, selector?: (state: State) => SelectorR) => redux.Unsubscribe;
|
|
1688
1688
|
fetchWidgetPage: ((filename: string) => Promise<string>) & ((filename: string) => Promise<string>) & ((filename: string) => Promise<string>) & ((filename: string) => Promise<string>) & ((filename: string) => Promise<string>) & ((filename: string) => Promise<string>) & ((filename: string) => Promise<string>);
|
|
1689
1689
|
syncFlowTheme: ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void) & ((flowDriver: _descope_sdk_component_drivers.FlowDriver) => void);
|
|
1690
|
-
"__#
|
|
1690
|
+
"__#29692@#globalStyle": _descope_sdk_mixins.InjectedStyle;
|
|
1691
1691
|
readonly theme: _descope_sdk_mixins.ThemeOptions;
|
|
1692
1692
|
readonly styleId: string;
|
|
1693
|
-
"__#
|
|
1694
|
-
"__#
|
|
1695
|
-
readonly "__#
|
|
1696
|
-
"__#
|
|
1697
|
-
"__#
|
|
1698
|
-
"__#
|
|
1693
|
+
"__#29692@#_themeResource": Promise<void | Record<string, any>>;
|
|
1694
|
+
"__#29692@#fetchTheme"(): Promise<Record<string, any>>;
|
|
1695
|
+
readonly "__#29692@#themeResource": Promise<void | Record<string, any>>;
|
|
1696
|
+
"__#29692@#loadGlobalStyle"(): Promise<void>;
|
|
1697
|
+
"__#29692@#loadComponentsStyle"(): Promise<void>;
|
|
1698
|
+
"__#29692@#getFontsConfig"(): Promise<Record<string, {
|
|
1699
1699
|
url?: string;
|
|
1700
1700
|
}>>;
|
|
1701
|
-
"__#
|
|
1702
|
-
"__#
|
|
1703
|
-
"__#
|
|
1704
|
-
"__#
|
|
1705
|
-
"__#
|
|
1701
|
+
"__#29692@#loadFonts"(): Promise<void>;
|
|
1702
|
+
"__#29692@#applyTheme"(): Promise<void>;
|
|
1703
|
+
"__#29692@#onThemeChange": () => void;
|
|
1704
|
+
"__#29692@#loadTheme"(): void;
|
|
1705
|
+
"__#29692@#toggleOsThemeChangeListener": (listen: boolean) => void;
|
|
1706
1706
|
"__#9@#editModals": Record<string, _descope_sdk_component_drivers.ModalDriver>;
|
|
1707
1707
|
"__#9@#editFlows": Record<string, _descope_sdk_component_drivers.FlowDriver>;
|
|
1708
1708
|
"__#9@#deleteModals": Record<string, _descope_sdk_component_drivers.ModalDriver>;
|
|
@@ -1753,7 +1753,7 @@ declare const TenantProfileWidget: {
|
|
|
1753
1753
|
"__#13@#initTenantName"(): void;
|
|
1754
1754
|
"__#13@#onValueUpdate": (tenantName: any) => void;
|
|
1755
1755
|
"__#6@#createFlowRedirectModal"(widgetFlow: string): void;
|
|
1756
|
-
"__#
|
|
1756
|
+
"__#29685@#debuggerEle": (HTMLElement & {
|
|
1757
1757
|
updateData: (data: {
|
|
1758
1758
|
title: string;
|
|
1759
1759
|
description?: string;
|
|
@@ -1762,11 +1762,11 @@ declare const TenantProfileWidget: {
|
|
|
1762
1762
|
description?: string;
|
|
1763
1763
|
}[]) => void;
|
|
1764
1764
|
}) | null;
|
|
1765
|
-
"__#
|
|
1766
|
-
"__#
|
|
1765
|
+
"__#29685@#disableDebugger"(): void;
|
|
1766
|
+
"__#29685@#enableDebugger"(): Promise<void>;
|
|
1767
1767
|
readonly debug: boolean;
|
|
1768
|
-
"__#
|
|
1769
|
-
"__#
|
|
1768
|
+
"__#29685@#handleDebugMode"(): void;
|
|
1769
|
+
"__#29685@#updateDebuggerMessages"(title: string, description: string): void;
|
|
1770
1770
|
};
|
|
1771
1771
|
};
|
|
1772
1772
|
|