@descope/applications-portal-widget
Advanced tools
Comparing version 0.3.3 to 0.3.4
/** | ||
* @descope/applications-portal-widget v0.3.3 | ||
* @descope/applications-portal-widget v0.3.4 | ||
*/ | ||
import{createSingletonMixin as t,compose as e,createTemplate as i}from"@descope/sdk-helpers";import{__awaiter as s,__classPrivateFieldGet as o,__classPrivateFieldSet as n}from"tslib";import{projectIdMixin as r,observeAttributesMixin as d,loggerMixin as a,cookieConfigMixin as l,baseUrlMixin as c,createStateManagementMixin as p,initLifecycleMixin as u,staticResourcesMixin as h,createValidateAttributesMixin as g,descopeUiMixin as v,initElementMixin as m,debuggerMixin as f,themeMixin as y}from"@descope/sdk-mixins";import{AppsListDriver as b}from"@descope/sdk-component-drivers";import{createSelector as w}from"reselect";import{createAsyncThunk as A}from"@reduxjs/toolkit";import k from"@descope/web-js-sdk";var x;!function(t){t.oidc="oidc",t.saml="saml"}(x||(x={}));const R=w((t=>t.ssoAppsList.data),(t=>{var e;return null===(e=null==t?void 0:t.filter)||void 0===e?void 0:e.call(t,(t=>t.appType===x.saml))})),S=w(R,(t=>t.map((t=>({name:t.name,icon:t.logo,url:t.samlSettings.idpInitiatedUrl}))))),j=A("ssoApps/load",((t,{extra:{api:e}})=>e.ssoApps.load())),W=(t=>(...e)=>i=>{i.addCase(t.pending,((t,i)=>{e.forEach((({onPending:e})=>{null==e||e(t,i)}))})),i.addCase(t.fulfilled,((t,i)=>{e.forEach((({onFulfilled:e})=>{null==e||e(t,i)}))})),i.addCase(t.rejected,((t,i)=>{e.forEach((({onRejected:e})=>{null==e||e(t,i)}))}))})(j)({onFulfilled:(t,e)=>{var i;t.ssoAppsList.data=null===(i=e.payload)||void 0===i?void 0:i.apps}},(C=t=>t.ssoAppsList,{onFulfilled:t=>{C(t).loading=!1},onPending:t=>{C(t).loading=!0,C(t).error=null},onRejected:(t,e)=>{C(t).loading=!1,C(t).error=e.error}}));var C;const I={action:j,reducer:W},O={ssoAppsList:{data:[],loading:!1,error:null}},T={load:"/v1/mgmt/sso/idp/apps/load"},L=()=>s(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:x.saml,logo:"logo1",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp2",name:"App 2",description:"This is the first OIDC app",enabled:!0,appType:x.oidc,logo:"logo2"},{id:"ssoapp3",name:"App 3",description:"This is the second SAML app",enabled:!0,appType:x.saml,logo:"logo3",samlSettings:{idpInitiatedUrl:""}}]})}))})),P=({httpClient:t,mock:e})=>({load:()=>s(void 0,void 0,void 0,(function*(){if(e)return L();const i=yield t.get(T.load);return yield(t=>s(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()}))}),E=t((t=>{var i,p,u,h;const g=e(r,d,a,l,c)(t);return h=class extends g{constructor(){super(...arguments),i.add(this),p.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return o(this,p,"f")||o(this,i,"m",u).call(this),o(this,p,"f")}init(){const t=Object.create(null,{init:{get:()=>super.init}});return s(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"],(()=>{o(this,p,"f")&&o(this,i,"m",u).call(this)}))}))}},p=new WeakMap,i=new WeakSet,u=function(){this.logger.debug("creating an sdk instance"),n(this,p,((t,e,i)=>{const s=k(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.3.3"}}));return{ssoApps:P({httpClient:s.httpClient,mock:e})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},h})),$=t((t=>{const i=e(p({name:"widget",initialState:O,reducers:{},extraReducers:t=>{I.reducer(t)},asyncActions:{loadSSOApps:I.action}}),u,a,E)(t);return class extends i{constructor(...t){super(...t),this.state=O,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),M=t((t=>{const i=e(h,g({"widget-id":g.missingAttrValidator}))(t);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(t){return s(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`applications-portal-widget/${this.widgetId}/${t}`,"text")).body}))}}})),U=t((t=>{var n,r,d,l;return l=class extends(e(a,u,v,m,M,$)(t)){constructor(){super(...arguments),n.add(this)}onWidgetRootReady(){return s(this,void 0,void 0,(function*(){}))}init(){const t=Object.create(null,{init:{get:()=>super.init}});return s(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([o(this,n,"m",r).call(this),this.actions.loadSSOApps()]);o(this,n,"m",d).call(this,i),this.onWidgetRootReady()}))}},n=new WeakSet,r=function(){return s(this,void 0,void 0,(function*(){const t=i(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(t),t}))},d=function(t){this.contentRootElement.append(t.content.cloneNode(!0))},l})),N=t((t=>{var i,n,r;return r=class extends(e($,a,U)(t)){constructor(){super(...arguments),i.add(this)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return s(this,void 0,void 0,(function*(){var e;yield null===(e=t.onWidgetRootReady)||void 0===e?void 0:e.call(this),o(this,i,"m",n).call(this,S(this.state))}))}},i=new WeakSet,n=function(t){this.appsList=new b((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-apps-list")}),{logger:this.logger}),this.appsList.data=t},r})),D=t((t=>class extends(e(f,y,N)(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return s(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this)}))}})),F=e((t=>class extends(D(t)){}))(HTMLElement);customElements.define("descope-applications-portal-widget",F);export{F as default}; | ||
import{createSingletonMixin as t,compose as e,createTemplate as i}from"@descope/sdk-helpers";import{__awaiter as s,__classPrivateFieldGet as o,__classPrivateFieldSet as n}from"tslib";import{projectIdMixin as r,observeAttributesMixin as d,loggerMixin as a,cookieConfigMixin as l,baseUrlMixin as c,createStateManagementMixin as p,initLifecycleMixin as u,staticResourcesMixin as h,createValidateAttributesMixin as g,descopeUiMixin as v,initElementMixin as m,debuggerMixin as f,themeMixin as y}from"@descope/sdk-mixins";import{AppsListDriver as b}from"@descope/sdk-component-drivers";import{createSelector as w}from"reselect";import{createAsyncThunk as A}from"@reduxjs/toolkit";import k from"@descope/web-js-sdk";var x;!function(t){t.oidc="oidc",t.saml="saml"}(x||(x={}));const R=w((t=>t.ssoAppsList.data),(t=>{var e;return null===(e=null==t?void 0:t.filter)||void 0===e?void 0:e.call(t,(t=>t.appType===x.saml))})),S=w(R,(t=>t.map((t=>({name:t.name,icon:t.logo,url:t.samlSettings.idpInitiatedUrl}))))),j=A("ssoApps/load",((t,{extra:{api:e}})=>e.ssoApps.load())),W=(t=>(...e)=>i=>{i.addCase(t.pending,((t,i)=>{e.forEach((({onPending:e})=>{null==e||e(t,i)}))})),i.addCase(t.fulfilled,((t,i)=>{e.forEach((({onFulfilled:e})=>{null==e||e(t,i)}))})),i.addCase(t.rejected,((t,i)=>{e.forEach((({onRejected:e})=>{null==e||e(t,i)}))}))})(j)({onFulfilled:(t,e)=>{var i;t.ssoAppsList.data=null===(i=e.payload)||void 0===i?void 0:i.apps}},(C=t=>t.ssoAppsList,{onFulfilled:t=>{C(t).loading=!1},onPending:t=>{C(t).loading=!0,C(t).error=null},onRejected:(t,e)=>{C(t).loading=!1,C(t).error=e.error}}));var C;const I={action:j,reducer:W},O={ssoAppsList:{data:[],loading:!1,error:null}},T={load:"/v1/mgmt/sso/idp/apps/load"},L=()=>s(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:x.saml,logo:"logo1",samlSettings:{idpInitiatedUrl:""}},{id:"ssoapp2",name:"App 2",description:"This is the first OIDC app",enabled:!0,appType:x.oidc,logo:"logo2"},{id:"ssoapp3",name:"App 3",description:"This is the second SAML app",enabled:!0,appType:x.saml,logo:"logo3",samlSettings:{idpInitiatedUrl:""}}]})}))})),P=({httpClient:t,mock:e})=>({load:()=>s(void 0,void 0,void 0,(function*(){if(e)return L();const i=yield t.get(T.load);return yield(t=>s(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()}))}),E=t((t=>{var i,p,u,h;const g=e(r,d,a,l,c)(t);return h=class extends g{constructor(){super(...arguments),i.add(this),p.set(this,void 0)}get widgetId(){return this.getAttribute("widget-id")}get mock(){return this.getAttribute("mock")}get api(){return o(this,p,"f")||o(this,i,"m",u).call(this),o(this,p,"f")}init(){const t=Object.create(null,{init:{get:()=>super.init}});return s(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"],(()=>{o(this,p,"f")&&o(this,i,"m",u).call(this)}))}))}},p=new WeakMap,i=new WeakSet,u=function(){this.logger.debug("creating an sdk instance"),n(this,p,((t,e,i)=>{const s=k(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.3.4"}}));return{ssoApps:P({httpClient:s.httpClient,mock:e})}})({projectId:this.projectId,baseUrl:this.baseUrl,refreshCookieName:this.refreshCookieName},"true"===this.mock,this.widgetId),"f")},h})),$=t((t=>{const i=e(p({name:"widget",initialState:O,reducers:{},extraReducers:t=>{I.reducer(t)},asyncActions:{loadSSOApps:I.action}}),u,a,E)(t);return class extends i{constructor(...t){super(...t),this.state=O,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),M=t((t=>{const i=e(h,g({"widget-id":g.missingAttrValidator}))(t);return class extends i{get widgetId(){return this.getAttribute("widget-id")}fetchWidgetPage(t){return s(this,void 0,void 0,(function*(){return(yield this.fetchStaticResource(`applications-portal-widget/${this.widgetId}/${t}`,"text")).body}))}}})),U=t((t=>{var n,r,d,l;return l=class extends(e(a,u,v,m,M,$)(t)){constructor(){super(...arguments),n.add(this)}onWidgetRootReady(){return s(this,void 0,void 0,(function*(){}))}init(){const t=Object.create(null,{init:{get:()=>super.init}});return s(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([o(this,n,"m",r).call(this),this.actions.loadSSOApps()]);o(this,n,"m",d).call(this,i),this.onWidgetRootReady()}))}},n=new WeakSet,r=function(){return s(this,void 0,void 0,(function*(){const t=i(yield this.fetchWidgetPage("root.html"));return yield this.loadDescopeUiComponents(t),t}))},d=function(t){this.contentRootElement.append(t.content.cloneNode(!0))},l})),N=t((t=>{var i,n,r;return r=class extends(e($,a,U)(t)){constructor(){super(...arguments),i.add(this)}onWidgetRootReady(){const t=Object.create(null,{onWidgetRootReady:{get:()=>super.onWidgetRootReady}});return s(this,void 0,void 0,(function*(){var e;yield null===(e=t.onWidgetRootReady)||void 0===e?void 0:e.call(this),o(this,i,"m",n).call(this,S(this.state))}))}},i=new WeakSet,n=function(t){this.appsList=new b((()=>{var t;return null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector("descope-apps-list")}),{logger:this.logger}),this.appsList.data=t},r})),D=t((t=>class extends(e(f,y,N)(t)){init(){const t=Object.create(null,{init:{get:()=>super.init}});return s(this,void 0,void 0,(function*(){var e;yield null===(e=t.init)||void 0===e?void 0:e.call(this)}))}})),F=e((t=>class extends(D(t)){}))(HTMLElement);customElements.define("descope-applications-portal-widget",F);export{F as default}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@descope/applications-portal-widget", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"author": "Descope Team <info@descope.com>", | ||
@@ -79,6 +79,6 @@ "homepage": "https://github.com/descope/descope-js", | ||
"immer": "^10.0.3", | ||
"@descope/web-js-sdk": "1.26.1", | ||
"@descope/web-js-sdk": "1.26.2", | ||
"@descope/sdk-helpers": "0.2.0", | ||
"@descope/sdk-component-drivers": "0.2.51", | ||
"@descope/sdk-mixins": "0.11.1" | ||
"@descope/sdk-mixins": "0.11.1", | ||
"@descope/sdk-component-drivers": "0.2.51" | ||
}, | ||
@@ -85,0 +85,0 @@ "overrides": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1252474
+ Added@descope/core-js-sdk@2.38.0(transitive)
+ Added@descope/web-js-sdk@1.26.2(transitive)
- Removed@descope/core-js-sdk@2.37.0(transitive)
- Removed@descope/web-js-sdk@1.26.1(transitive)
Updated@descope/web-js-sdk@1.26.2