@descope/applications-portal-widget
Advanced tools
Comparing version 0.1.3 to 0.1.4
/** | ||
* @descope/applications-portal-widget v0.1.3 | ||
* @descope/applications-portal-widget v0.1.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 d,observeAttributesMixin as r,loggerMixin as a,baseUrlMixin as l,createStateManagementMixin as c,initLifecycleMixin as p,staticResourcesMixin as u,createValidateAttributesMixin as h,descopeUiMixin as g,initElementMixin as v,debuggerMixin as m,themeMixin as f}from"@descope/sdk-mixins";import{AppsListDriver as y}from"@descope/sdk-component-drivers";import{createSelector as b}from"reselect";import{createAsyncThunk as w}from"@reduxjs/toolkit";import A from"@descope/web-js-sdk";var x;!function(t){t.oidc="oidc",t.saml="saml"}(x||(x={}));const R=b((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))})),k=b(R,(t=>t.map((t=>({name:t.name,icon:t.logo,url:t.samlSettings.idpInitiatedUrl}))))),S=w("ssoApps/load",((t,{extra:{api:e}})=>e.ssoApps.load())),j=(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)}))}))})(S)({onFulfilled:(t,e)=>{var i;t.ssoAppsList.data=null===(i=e.payload)||void 0===i?void 0:i.apps}},(W=t=>t.ssoAppsList,{onFulfilled:t=>{W(t).loading=!1},onPending:t=>{W(t).loading=!0,W(t).error=null},onRejected:(t,e)=>{W(t).loading=!1,W(t).error=e.error}}));var W;const I={action:S,reducer:j},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:""}}]})}))})),C=({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()}))}),P=t((t=>{var i,c,p,u;const h=e(d,r,a,l)(t);return u=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 o(this,c,"f")||o(this,i,"m",p).call(this),o(this,c,"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,c,"f")&&o(this,i,"m",p).call(this)}))}))}},c=new WeakMap,i=new WeakSet,p=function(){this.logger.debug("creating an sdk instance"),n(this,c,((t,e,i)=>{const s=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.1.3"}}));return{ssoApps:C({httpClient:s.httpClient,mock:e})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},u})),E=t((t=>{const i=e(c({name:"widget",initialState:O,reducers:{},extraReducers:t=>{I.reducer(t)},asyncActions:{loadSSOApps:I.action}}),p,a,P)(t);return class extends i{constructor(...t){super(...t),this.state=O,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),$=t((t=>{const i=e(u,h({"widget-id":h.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}))}}})),M=t((t=>{var n,d,r,l;return l=class extends(e(a,p,g,v,$,E)(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",d).call(this),this.actions.loadSSOApps()]);o(this,n,"m",r).call(this,i),this.onWidgetRootReady()}))}},n=new WeakSet,d=function(){return s(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))},l})),U=t((t=>{var i,n,d;return d=class extends(e(E,a,M)(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,k(this.state))}))}},i=new WeakSet,n=function(t){this.appsList=new y((()=>{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})),D=t((t=>class extends(e(m,f,U)(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 d,observeAttributesMixin as r,loggerMixin as a,baseUrlMixin as l,createStateManagementMixin as c,initLifecycleMixin as p,staticResourcesMixin as u,createValidateAttributesMixin as h,descopeUiMixin as g,initElementMixin as v,debuggerMixin as m,themeMixin as f}from"@descope/sdk-mixins";import{AppsListDriver as y}from"@descope/sdk-component-drivers";import{createSelector as b}from"reselect";import{createAsyncThunk as w}from"@reduxjs/toolkit";import A from"@descope/web-js-sdk";var x;!function(t){t.oidc="oidc",t.saml="saml"}(x||(x={}));const R=b((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))})),k=b(R,(t=>t.map((t=>({name:t.name,icon:t.logo,url:t.samlSettings.idpInitiatedUrl}))))),S=w("ssoApps/load",((t,{extra:{api:e}})=>e.ssoApps.load())),j=(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)}))}))})(S)({onFulfilled:(t,e)=>{var i;t.ssoAppsList.data=null===(i=e.payload)||void 0===i?void 0:i.apps}},(W=t=>t.ssoAppsList,{onFulfilled:t=>{W(t).loading=!1},onPending:t=>{W(t).loading=!0,W(t).error=null},onRejected:(t,e)=>{W(t).loading=!1,W(t).error=e.error}}));var W;const I={action:S,reducer:j},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:""}}]})}))})),C=({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()}))}),P=t((t=>{var i,c,p,u;const h=e(d,r,a,l)(t);return u=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 o(this,c,"f")||o(this,i,"m",p).call(this),o(this,c,"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,c,"f")&&o(this,i,"m",p).call(this)}))}))}},c=new WeakMap,i=new WeakSet,p=function(){this.logger.debug("creating an sdk instance"),n(this,c,((t,e,i)=>{const s=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.1.4"}}));return{ssoApps:C({httpClient:s.httpClient,mock:e})}})({projectId:this.projectId,baseUrl:this.baseUrl},"true"===this.mock,this.widgetId),"f")},u})),E=t((t=>{const i=e(c({name:"widget",initialState:O,reducers:{},extraReducers:t=>{I.reducer(t)},asyncActions:{loadSSOApps:I.action}}),p,a,P)(t);return class extends i{constructor(...t){super(...t),this.state=O,this.subscribe((t=>{this.logger.debug("State update:",t),this.state=t}))}}})),$=t((t=>{const i=e(u,h({"widget-id":h.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}))}}})),M=t((t=>{var n,d,r,l;return l=class extends(e(a,p,g,v,$,E)(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",d).call(this),this.actions.loadSSOApps()]);o(this,n,"m",r).call(this,i),this.onWidgetRootReady()}))}},n=new WeakSet,d=function(){return s(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))},l})),U=t((t=>{var i,n,d;return d=class extends(e(E,a,M)(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,k(this.state))}))}},i=new WeakSet,n=function(t){this.appsList=new y((()=>{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})),D=t((t=>class extends(e(m,f,U)(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.1.3", | ||
"version": "0.1.4", | ||
"author": "Descope Team <info@descope.com>", | ||
@@ -79,3 +79,3 @@ "homepage": "https://github.com/descope/descope-js", | ||
"immer": "^10.0.3", | ||
"@descope/web-js-sdk": "1.19.1", | ||
"@descope/web-js-sdk": "1.19.2", | ||
"@descope/sdk-helpers": "0.1.60", | ||
@@ -82,0 +82,0 @@ "@descope/sdk-mixins": "0.3.2", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1198884
+ Added@descope/core-js-sdk@2.29.1(transitive)
+ Added@descope/web-js-sdk@1.19.2(transitive)
- Removed@descope/core-js-sdk@2.29.0(transitive)
- Removed@descope/web-js-sdk@1.19.1(transitive)
Updated@descope/web-js-sdk@1.19.2