@descope/applications-portal-widget 0.7.5 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /**
3
- * @descope/applications-portal-widget v0.7.5
3
+ * @descope/applications-portal-widget v0.7.6
4
4
  */
5
- import{createSingletonMixin as t,compose as e,createTemplate as i}from"@descope/sdk-helpers";import{__awaiter as o,__classPrivateFieldGet as s,__classPrivateFieldSet as n}from"tslib";import{projectIdMixin as d,observeAttributesMixin as r,loggerMixin as l,cookieConfigMixin as a,baseUrlMixin as p,createStateManagementMixin as c,initLifecycleMixin as u,staticResourcesMixin as g,createValidateAttributesMixin as h,descopeUiMixin as v,initElementMixin as m,debuggerMixin as f,themeMixin as y}from"@descope/sdk-mixins";import{AppsListDriver as w}from"@descope/sdk-component-drivers";import{createSelector as b}from"reselect";import{createAsyncThunk as S}from"@reduxjs/toolkit";import A from"@descope/web-js-sdk";var k;!function(t){t.oidc="oidc",t.saml="saml",t.wsfed="wsfed",t.custom="custom"}(k||(k={}));const x=t=>t.ssoAppsList.data,R=b(x,(t=>{var e;return null===(e=null==t?void 0:t.filter)||void 0===e?void 0:e.call(t,(t=>t.appType===k.saml))})),I=b(x,(t=>{var e;return null===(e=null==t?void 0:t.filter)||void 0===e?void 0:e.call(t,(t=>{var e;return t.appType===k.oidc&&(null===(e=t.oidcSettings)||void 0===e?void 0:e.customIdpInitiatedLoginPageUrl)}))})),j=b(x,(t=>{var e;return null===(e=null==t?void 0:t.filter)||void 0===e?void 0:e.call(t,(t=>{var e;return t.appType===k.wsfed&&(null===(e=t.wsfedSettings)||void 0===e?void 0:e.idpInitiatedUrl)}))})),T=b(x,(t=>{var e;return null===(e=null==t?void 0:t.filter)||void 0===e?void 0:e.call(t,(t=>t.appType===k.custom))})),U=t=>{var e,i,o,s;switch(t.appType){case k.saml:return null===(e=t.samlSettings)||void 0===e?void 0:e.idpInitiatedUrl;case k.oidc:return null===(i=t.oidcSettings)||void 0===i?void 0:i.customIdpInitiatedLoginPageUrl;case k.wsfed:return null===(o=t.wsfedSettings)||void 0===o?void 0:o.idpInitiatedUrl;case k.custom:return null===(s=t.customSettings)||void 0===s?void 0:s.loginPageUrl;default:return}},W=b(R,I,j,T,((t,e,i,o)=>[...t,...e,...i,...o].map((t=>({name:t.name,icon:t.logo,url:U(t)}))))),P=S("ssoApps/load",((t,{extra:{api:e}})=>e.ssoApps.load())),C=(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)}))}))})(P)({onFulfilled:(t,e)=>{var i;t.ssoAppsList.data=null===(i=e.payload)||void 0===i?void 0:i.apps}},(L=t=>t.ssoAppsList,{onFulfilled:t=>{L(t).loading=!1},onPending:t=>{L(t).loading=!0,L(t).error=null},onRejected:(t,e)=>{L(t).loading=!1,L(t).error=e.error}}));var L;const O={action:P,reducer:C},E={ssoAppsList:{data:[],loading:!1,error:null}},$={load:"/v1/mgmt/sso/idp/apps/load"},M=()=>o(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({apps:[{id:"ssoapp1",name:"App 1",description:"This is the first SAML app",enabled:!0,appType:k.saml,logo:"logo1",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp2",name:"App 2",description:"This is the first OIDC app",enabled:!0,appType:k.oidc,logo:"logo2"},{id:"ssoapp3",name:"App 3",description:"This is the second SAML app",enabled:!0,appType:k.saml,logo:"logo3",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp4",name:"App 4",description:"This is a WS-Fed app",enabled:!0,appType:k.wsfed,logo:"logo4",wsfedSettings:{idpInitiatedUrl:"http://localhost/wsfed/idp-initiated",realm:"urn:mock:realm",replyUrl:"http://localhost/reply",loginPageUrl:"http://localhost/login"}}]})}))})),F=({httpClient:t,mock:e})=>({load:()=>o(void 0,void 0,void 0,(function*(){if(e)return M();const i=yield t.get($.load);return yield(t=>o(void 0,void 0,void 0,(function*(){const e=yield t.text(),i=JSON.parse(e);if(!t.ok){const e=`${i.errorDescription}${i.errorMessage?`: ${i.errorMessage}`:""}`;throw Error(e||`${t.status} ${t.statusText}`)}t.json=()=>Promise.resolve(i),t.text=()=>Promise.resolve(e)})))(i),i.json()}))}),N=t((t=>{var i,c,u,g;const h=e(d,r,l,a,p)(t);return g=class extends h{constructor(){super(...arguments),i.add(this),c.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return s(this,c,"f")||s(this,i,"m",u).call(this),s(this,c,"f")}init(){const t=Object.create(null,{init:{get:()=>super.init}});return o(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this),this.observeAttributes(["project-id","base-url"],(()=>{s(this,c,"f")&&s(this,i,"m",u).call(this)}))}))}},c=new WeakMap,i=new WeakSet,u=function(){this.logger.debug("creating an sdk instance"),n(this,c,((t,e,i)=>{const o=A(Object.assign(Object.assign({},t),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"applications-portal-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.7.5"}}));return{ssoApps:F({httpClient:o.httpClient,mock:e})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},g})),D=t((t=>{const i=e(c({name:"widget",initialState:E,reducers:{},extraReducers:t=>{O.reducer(t)},asyncActions:{loadSSOApps:O.action}}),u,l,N)(t);return class extends i{constructor(...t){super(...t),this.state=E,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),H=t((t=>{const i=e(g,h({"widget-id":h.missingAttrValidator}))(t);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(t){return o(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`applications-portal-widget/${this.widgetId}/${t}`,"text")).body}))}}})),q=t((t=>{var n,d,r,a;return a=class extends(e(l,u,v,m,H,D)(t)){constructor(){super(...arguments),n.add(this)}onWidgetRootReady(){return o(this,void 0,void 0,(function*(){}))}init(){const t=Object.create(null,{init:{get:()=>super.init}});return o(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this);const[i]=yield Promise.all([s(this,n,"m",d).call(this),this.actions.loadSSOApps()]);s(this,n,"m",r).call(this,i),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},n=new WeakSet,d=function(){return o(this,void 0,void 0,(function*(){const t=i(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(t),t}))},r=function(t){this.contentRootElement.append(t.content.cloneNode(!0))},a})),J=t((t=>{var i,n,d;return d=class extends(e(D,l,q)(t)){constructor(){super(...arguments),i.add(this)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return o(this,void 0,void 0,(function*(){var e;yield null===(e=t.onWidgetRootReady)||void 0===e?void 0:e.call(this),s(this,i,"m",n).call(this,W(this.state))}))}},i=new WeakSet,n=function(t){this.appsList=new w((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-apps-list")}),{logger:this.logger}),this.appsList.data=t},d})),V=t((t=>class extends(e(f,y,J)(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return o(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this)}))}})),z=e((t=>class extends(V(t)){}))(HTMLElement);customElements.define("descope-applications-portal-widget",z);export{z as default};
5
+ import{createSingletonMixin as t,compose as e,createTemplate as i}from"@descope/sdk-helpers";import{__awaiter as o,__classPrivateFieldGet as s,__classPrivateFieldSet as n}from"tslib";import{projectIdMixin as d,observeAttributesMixin as r,loggerMixin as l,cookieConfigMixin as a,baseUrlMixin as p,createStateManagementMixin as c,initLifecycleMixin as u,staticResourcesMixin as g,createValidateAttributesMixin as h,descopeUiMixin as v,initElementMixin as m,debuggerMixin as f,themeMixin as y}from"@descope/sdk-mixins";import{AppsListDriver as w}from"@descope/sdk-component-drivers";import{createSelector as b}from"reselect";import{createAsyncThunk as S}from"@reduxjs/toolkit";import A from"@descope/web-js-sdk";var k;!function(t){t.oidc="oidc",t.saml="saml",t.wsfed="wsfed",t.custom="custom"}(k||(k={}));const x=t=>t.ssoAppsList.data,R=b(x,(t=>{var e;return null===(e=null==t?void 0:t.filter)||void 0===e?void 0:e.call(t,(t=>t.appType===k.saml))})),I=b(x,(t=>{var e;return null===(e=null==t?void 0:t.filter)||void 0===e?void 0:e.call(t,(t=>{var e;return t.appType===k.oidc&&(null===(e=t.oidcSettings)||void 0===e?void 0:e.customIdpInitiatedLoginPageUrl)}))})),j=b(x,(t=>{var e;return null===(e=null==t?void 0:t.filter)||void 0===e?void 0:e.call(t,(t=>{var e;return t.appType===k.wsfed&&(null===(e=t.wsfedSettings)||void 0===e?void 0:e.idpInitiatedUrl)}))})),T=b(x,(t=>{var e;return null===(e=null==t?void 0:t.filter)||void 0===e?void 0:e.call(t,(t=>t.appType===k.custom))})),U=t=>{var e,i,o,s;switch(t.appType){case k.saml:return null===(e=t.samlSettings)||void 0===e?void 0:e.idpInitiatedUrl;case k.oidc:return null===(i=t.oidcSettings)||void 0===i?void 0:i.customIdpInitiatedLoginPageUrl;case k.wsfed:return null===(o=t.wsfedSettings)||void 0===o?void 0:o.idpInitiatedUrl;case k.custom:return null===(s=t.customSettings)||void 0===s?void 0:s.loginPageUrl;default:return}},W=b(R,I,j,T,((t,e,i,o)=>[...t,...e,...i,...o].map((t=>({name:t.name,icon:t.logo,url:U(t)}))))),P=S("ssoApps/load",((t,{extra:{api:e}})=>e.ssoApps.load())),C=(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)}))}))})(P)({onFulfilled:(t,e)=>{var i;t.ssoAppsList.data=null===(i=e.payload)||void 0===i?void 0:i.apps}},(L=t=>t.ssoAppsList,{onFulfilled:t=>{L(t).loading=!1},onPending:t=>{L(t).loading=!0,L(t).error=null},onRejected:(t,e)=>{L(t).loading=!1,L(t).error=e.error}}));var L;const O={action:P,reducer:C},E={ssoAppsList:{data:[],loading:!1,error:null}},$={load:"/v1/mgmt/sso/idp/apps/load"},M=()=>o(void 0,void 0,void 0,(function*(){return new Promise((t=>{t({apps:[{id:"ssoapp1",name:"App 1",description:"This is the first SAML app",enabled:!0,appType:k.saml,logo:"logo1",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp2",name:"App 2",description:"This is the first OIDC app",enabled:!0,appType:k.oidc,logo:"logo2"},{id:"ssoapp3",name:"App 3",description:"This is the second SAML app",enabled:!0,appType:k.saml,logo:"logo3",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp4",name:"App 4",description:"This is a WS-Fed app",enabled:!0,appType:k.wsfed,logo:"logo4",wsfedSettings:{idpInitiatedUrl:"http://localhost/wsfed/idp-initiated",realm:"urn:mock:realm",replyUrl:"http://localhost/reply",loginPageUrl:"http://localhost/login"}}]})}))})),F=({httpClient:t,mock:e})=>({load:()=>o(void 0,void 0,void 0,(function*(){if(e)return M();const i=yield t.get($.load);return yield(t=>o(void 0,void 0,void 0,(function*(){const e=yield t.text(),i=JSON.parse(e);if(!t.ok){const e=`${i.errorDescription}${i.errorMessage?`: ${i.errorMessage}`:""}`;throw Error(e||`${t.status} ${t.statusText}`)}t.json=()=>Promise.resolve(i),t.text=()=>Promise.resolve(e)})))(i),i.json()}))}),N=t((t=>{var i,c,u,g;const h=e(d,r,l,a,p)(t);return g=class extends h{constructor(){super(...arguments),i.add(this),c.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return s(this,c,"f")||s(this,i,"m",u).call(this),s(this,c,"f")}init(){const t=Object.create(null,{init:{get:()=>super.init}});return o(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this),this.observeAttributes(["project-id","base-url"],(()=>{s(this,c,"f")&&s(this,i,"m",u).call(this)}))}))}},c=new WeakMap,i=new WeakSet,u=function(){this.logger.debug("creating an sdk instance"),n(this,c,((t,e,i)=>{const o=A(Object.assign(Object.assign({},t),{persistTokens:!0,baseHeaders:{"x-descope-widget-type":"applications-portal-widget","x-descope-widget-id":i,"x-descope-widget-version":"0.7.6"}}));return{ssoApps:F({httpClient:o.httpClient,mock:e})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},g})),D=t((t=>{const i=e(c({name:"widget",initialState:E,reducers:{},extraReducers:t=>{O.reducer(t)},asyncActions:{loadSSOApps:O.action}}),u,l,N)(t);return class extends i{constructor(...t){super(...t),this.state=E,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),H=t((t=>{const i=e(g,h({"widget-id":h.missingAttrValidator}))(t);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(t){return o(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`applications-portal-widget/${this.widgetId}/${t}`,"text")).body}))}}})),q=t((t=>{var n,d,r,a;return a=class extends(e(l,u,v,m,H,D)(t)){constructor(){super(...arguments),n.add(this)}onWidgetRootReady(){return o(this,void 0,void 0,(function*(){}))}init(){const t=Object.create(null,{init:{get:()=>super.init}});return o(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this);const[i]=yield Promise.all([s(this,n,"m",d).call(this),this.actions.loadSSOApps()]);s(this,n,"m",r).call(this,i),yield this.onWidgetRootReady(),this.dispatchEvent(new CustomEvent("ready"))}))}},n=new WeakSet,d=function(){return o(this,void 0,void 0,(function*(){const t=i(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(t),t}))},r=function(t){this.contentRootElement.append(t.content.cloneNode(!0))},a})),J=t((t=>{var i,n,d;return d=class extends(e(D,l,q)(t)){constructor(){super(...arguments),i.add(this)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return o(this,void 0,void 0,(function*(){var e;yield null===(e=t.onWidgetRootReady)||void 0===e?void 0:e.call(this),s(this,i,"m",n).call(this,W(this.state))}))}},i=new WeakSet,n=function(t){this.appsList=new w((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-apps-list")}),{logger:this.logger}),this.appsList.data=t},d})),V=t((t=>class extends(e(f,y,J)(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return o(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this)}))}})),z=e((t=>class extends(V(t)){}))(HTMLElement);customElements.define("descope-applications-portal-widget",z);export{z as default};
6
6
  //# sourceMappingURL=index.js.map