dash-button-web 0.0.6 → 0.0.8

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.
Files changed (30) hide show
  1. package/dist/cjs/dash-button.cjs.entry.js +38 -47
  2. package/dist/cjs/dash-button.cjs.entry.js.map +1 -1
  3. package/dist/cjs/{index-991e75df.js → index-065225eb.js} +5 -1
  4. package/dist/{esm/index-8310c457.js.map → cjs/index-065225eb.js.map} +1 -1
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/web-compnont.cjs.js +2 -2
  7. package/dist/collection/components/my-component/dash-button.css +40 -0
  8. package/dist/collection/components/my-component/dash-button.js +74 -47
  9. package/dist/collection/components/my-component/dash-button.js.map +1 -1
  10. package/dist/components/dash-button.js +41 -47
  11. package/dist/components/dash-button.js.map +1 -1
  12. package/dist/esm/dash-button.entry.js +38 -47
  13. package/dist/esm/dash-button.entry.js.map +1 -1
  14. package/dist/esm/{index-8310c457.js → index-2b1034cf.js} +5 -1
  15. package/dist/esm/index-2b1034cf.js.map +1 -0
  16. package/dist/esm/loader.js +3 -3
  17. package/dist/esm/web-compnont.js +3 -3
  18. package/dist/types/components/my-component/dash-button.d.ts +4 -1
  19. package/dist/types/components.d.ts +4 -0
  20. package/dist/web-compnont/{p-392f1e3f.entry.js → p-099f7d20.entry.js} +3 -3
  21. package/dist/web-compnont/p-099f7d20.entry.js.map +1 -0
  22. package/dist/web-compnont/p-bdb5725e.js +3 -0
  23. package/dist/web-compnont/p-bdb5725e.js.map +1 -0
  24. package/dist/web-compnont/web-compnont.esm.js +1 -1
  25. package/dist/web-compnont/web-compnont.esm.js.map +1 -1
  26. package/package.json +1 -1
  27. package/dist/cjs/index-991e75df.js.map +0 -1
  28. package/dist/web-compnont/p-392f1e3f.entry.js.map +0 -1
  29. package/dist/web-compnont/p-4bd42d49.js +0 -3
  30. package/dist/web-compnont/p-4bd42d49.js.map +0 -1
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-991e75df.js');
5
+ const index = require('./index-065225eb.js');
6
6
 
7
7
  const defineCustomElements = (win, options) => {
8
8
  if (typeof window === 'undefined') return undefined;
9
- return index.bootstrapLazy([["dash-button.cjs",[[1,"dash-button",{"showPostLoginText":[4,"show-post-login-text"],"silentCheckSso":[4,"silent-check-sso"],"redirectUri":[1,"redirect-uri"],"authMethod":[1,"auth-method"],"keycloakUri":[1,"keycloak-uri"],"realm":[1],"clientId":[1,"client-id"],"appId":[1,"app-id"],"portalUrl":[1,"portal-url"],"marketplaceUrl":[1,"marketplace-url"],"showUnauthorizedModal":[4,"show-unauthorized-modal"],"keycloak":[32],"isAuth":[32],"givenName":[32],"silentCheckSsoRedirectUri":[32],"appList":[32]}]]]], options);
9
+ return index.bootstrapLazy([["dash-button.cjs",[[1,"dash-button",{"showPostLoginText":[4,"show-post-login-text"],"silentCheckSso":[4,"silent-check-sso"],"redirectUri":[1,"redirect-uri"],"authMethod":[1,"auth-method"],"keycloakUri":[1,"keycloak-uri"],"realm":[1],"clientId":[1,"client-id"],"appId":[1,"app-id"],"portalUrl":[1,"portal-url"],"marketplaceUrl":[1,"marketplace-url"],"plmUrl":[1,"plm-url"],"showUnauthorizedModal":[4,"show-unauthorized-modal"],"postTextDelayDuration":[2,"post-text-delay-duration"],"keycloak":[32],"isAuth":[32],"givenName":[32],"silentCheckSsoRedirectUri":[32],"appList":[32],"showPostLoginLoadingSpinner":[32]}]]]], options);
10
10
  };
11
11
 
12
12
  exports.setNonce = index.setNonce;
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-991e75df.js');
5
+ const index = require('./index-065225eb.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Browser v4.12.0 | MIT Licensed | https://stenciljs.com
@@ -17,7 +17,7 @@ const patchBrowser = () => {
17
17
  };
18
18
 
19
19
  patchBrowser().then(options => {
20
- return index.bootstrapLazy([["dash-button.cjs",[[1,"dash-button",{"showPostLoginText":[4,"show-post-login-text"],"silentCheckSso":[4,"silent-check-sso"],"redirectUri":[1,"redirect-uri"],"authMethod":[1,"auth-method"],"keycloakUri":[1,"keycloak-uri"],"realm":[1],"clientId":[1,"client-id"],"appId":[1,"app-id"],"portalUrl":[1,"portal-url"],"marketplaceUrl":[1,"marketplace-url"],"showUnauthorizedModal":[4,"show-unauthorized-modal"],"keycloak":[32],"isAuth":[32],"givenName":[32],"silentCheckSsoRedirectUri":[32],"appList":[32]}]]]], options);
20
+ return index.bootstrapLazy([["dash-button.cjs",[[1,"dash-button",{"showPostLoginText":[4,"show-post-login-text"],"silentCheckSso":[4,"silent-check-sso"],"redirectUri":[1,"redirect-uri"],"authMethod":[1,"auth-method"],"keycloakUri":[1,"keycloak-uri"],"realm":[1],"clientId":[1,"client-id"],"appId":[1,"app-id"],"portalUrl":[1,"portal-url"],"marketplaceUrl":[1,"marketplace-url"],"plmUrl":[1,"plm-url"],"showUnauthorizedModal":[4,"show-unauthorized-modal"],"postTextDelayDuration":[2,"post-text-delay-duration"],"keycloak":[32],"isAuth":[32],"givenName":[32],"silentCheckSsoRedirectUri":[32],"appList":[32],"showPostLoginLoadingSpinner":[32]}]]]], options);
21
21
  });
22
22
 
23
23
  exports.setNonce = index.setNonce;
@@ -227,4 +227,44 @@
227
227
  to {
228
228
  stroke-dashoffset: 113px;
229
229
  }
230
+ }
231
+
232
+ .lds-ring {
233
+ color: #fff
234
+ }
235
+ .lds-ring {
236
+ display: flex;
237
+ justify-content: center;
238
+ align-items: center;
239
+ margin: auto;
240
+ position: relative;
241
+ }
242
+ .lds-ring div {
243
+ box-sizing: border-box;
244
+ display: block;
245
+ position: absolute;
246
+ width: 30px;
247
+ height: 30px;
248
+ margin: 3px;
249
+ border: 3px solid currentColor;
250
+ border-radius: 50%;
251
+ animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
252
+ border-color: currentColor transparent transparent transparent;
253
+ }
254
+ .lds-ring div:nth-child(1) {
255
+ animation-delay: -0.45s;
256
+ }
257
+ .lds-ring div:nth-child(2) {
258
+ animation-delay: -0.3s;
259
+ }
260
+ .lds-ring div:nth-child(3) {
261
+ animation-delay: -0.15s;
262
+ }
263
+ @keyframes lds-ring {
264
+ 0% {
265
+ transform: rotate(0deg);
266
+ }
267
+ 100% {
268
+ transform: rotate(360deg);
269
+ }
230
270
  }
@@ -11,8 +11,10 @@ export class DashButtonComponent {
11
11
  this.clientId = "";
12
12
  this.appId = "";
13
13
  this.portalUrl = "";
14
- this.marketplaceUrl = "";
14
+ this.marketplaceUrl = "https://marketplace-zdzw.cloud.zdzw-project.com";
15
+ this.plmUrl = "https://productlicensemanager-zdzw.cloud.zdzw-project.com";
15
16
  this.showUnauthorizedModal = false;
17
+ this.postTextDelayDuration = undefined;
16
18
  this.keycloak = new Keycloak({
17
19
  url: this.keycloakUri,
18
20
  realm: this.realm,
@@ -22,13 +24,29 @@ export class DashButtonComponent {
22
24
  this.givenName = "";
23
25
  this.silentCheckSsoRedirectUri = window.location.origin + '/assets/verificar-sso.html';
24
26
  this.appList = [];
27
+ this.showPostLoginLoadingSpinner = false;
25
28
  }
26
29
  ;
27
30
  componentWillLoad() {
31
+ //
32
+ // User set post-text-delay-duration for displaying loading spinner
33
+ //
34
+ if (this.postTextDelayDuration > 0) {
35
+ // Show loading spinner
36
+ this.showPostLoginLoadingSpinner = true;
37
+ // Removing a loading spinner after the delay period ending
38
+ setTimeout(() => {
39
+ this.showPostLoginLoadingSpinner = false;
40
+ }, this.postTextDelayDuration);
41
+ }
42
+ //
43
+ // Init Keycloak
44
+ //
28
45
  this.initKeycloak().then(() => {
29
46
  // Check if the user is authenticated
30
47
  if (this.isAuth) {
31
- this.getAppList().then(res => {
48
+ const _token = JSON.parse(localStorage.getItem('keycloak')).token;
49
+ this.getAppList(_token).then(res => {
32
50
  this.appList = res;
33
51
  // If the user has set an app ID, check if they have permission to access
34
52
  if (this.appId) {
@@ -68,43 +86,6 @@ export class DashButtonComponent {
68
86
  });
69
87
  }
70
88
  });
71
- // // Get all application data associated with organization ID
72
- // const appIdList = this.appId.replace(/'/g, '').split(',');
73
- // var appListIds:Array<string> = []
74
- // if(this.appId) {
75
- // // const appList:Array<string> = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.APP_ID;
76
- // // Get app ID from marketplace (Compare product_id with app_id)
77
- // this.getAppList().then((response: Response) => response.json())
78
- // .then(response => {
79
- // // Save application data to a global array
80
- // if(this.appList.length <= 0 ) {
81
- // this.appList = response
82
- // }
83
- // // Save application IDs to a local array
84
- // appListIds.push(...this.appList.map(obj => obj['product_id']))
85
- // // Check if the user has permission to access the selected application
86
- // if(appIdList.filter(id => appListIds.includes(id)).length == 0) {
87
- // // Show modal
88
- // const appErrorModal = this.el.shadowRoot.querySelector('#appPermissionErrorModal');
89
- // appErrorModal.style.display = "block";
90
- // // If a redirect URL is provided, show the loading spinner
91
- // if (this.portalUrl) {
92
- // var countdownNumberEl = this.el.shadowRoot.getElementById('countdown-number');
93
- // var countdown = 6;
94
- // countdownNumberEl.textContent = countdown.toString();
95
- // setInterval(() => {
96
- // countdown = --countdown <= 0 ? 6 : countdown;
97
- // countdownNumberEl.textContent = countdown.toString();
98
- // // Once the countdown finishes, redirect to the provided URL
99
- // if(countdown == 1) {
100
- // // appErrorModal.style.display = "none";
101
- // window.location.replace(this.portalUrl.toString());
102
- // }
103
- // }, 1000);
104
- // }
105
- // }
106
- // })
107
- // }
108
89
  }
109
90
  async initKeycloak() {
110
91
  // Remove the initiation time permission localstorage object
@@ -122,14 +103,18 @@ export class DashButtonComponent {
122
103
  }
123
104
  });
124
105
  }
125
- async getAppList() {
106
+ async getAppList(token) {
126
107
  // const token = await JSON.parse(localStorage.getItem('keycloak')).token;
127
108
  // const response = await fetch(this.marketplaceUrl + '/api/v1/product/nameAndShortName', {
128
109
  // headers: new Headers({
129
110
  // 'Authorization': 'Bearer ' + token,
130
111
  // }),
131
112
  // })
132
- const response = await fetch(this.marketplaceUrl + '/api/v1/product/nameAndShortName');
113
+ const response = await fetch(this.plmUrl + '/api/v1/product/nameAndShortNameOrg', {
114
+ headers: new Headers({
115
+ 'Authorization': 'Bearer ' + token,
116
+ }),
117
+ });
133
118
  const jsonObj = await response.json();
134
119
  return jsonObj;
135
120
  }
@@ -150,9 +135,15 @@ export class DashButtonComponent {
150
135
  appModal.style.display = "none";
151
136
  }
152
137
  render() {
153
- return h("div", { key: '45d3cee1eb5857f688bf82eccfa5fcf31ec0e649' }, h("div", { key: '2e0fbfe2fd3e969f03d31eba64732407abc9319f' }, (() => {
138
+ return h("div", { key: '7843bbee4940a6a252e61442f8d77d467ee769c2' }, h("div", { key: 'd0940bd721a4eab5533cb7b136fabe8353cbb535' }, (() => {
154
139
  if (this.isAuth && this.showPostLoginText) {
155
- return (h("a", { href: this.redirectUri, id: "login-btn", class: "button button-link" }, h("span", { class: "button-text button-text-full-width" }, "Go to Dashboard")));
140
+ // User set post-text-delay-duration for displaying loading spinner
141
+ if (this.showPostLoginLoadingSpinner) {
142
+ return (h("a", { id: "login-btn", class: "button button-link" }, h("div", { class: "lds-ring" }, h("div", null), h("div", null), h("div", null), h("div", null))));
143
+ }
144
+ else {
145
+ return (h("a", { href: this.redirectUri, id: "login-btn", class: "button button-link" }, h("span", { class: "button-text button-text-full-width" }, "Go to Dashboard")));
146
+ }
156
147
  }
157
148
  else if (this.isAuth) {
158
149
  return (h("div", { id: "profile-btn", class: "dropdown" }, h("button", { type: "button", class: "button" }, h("span", { class: "button-profile" }, h("img", { src: "https://i.pravatar.cc/100?img=32", alt: "" })), h("span", { id: "given-name", class: "button-text" }, this.givenName), h("div", { class: "button-icon" }, h("span", { class: "gg-menu-grid-r" }))), h("div", { class: "dropdown-content" }, h("a", { onClick: this.showModal.bind(this), id: "applications-btn" }, "Applications"), h("a", { href: this.portalUrl, target: '_blank', id: "applications-btn" }, "Portal"), h("a", { href: this.marketplaceUrl, target: '_blank', id: "applications-btn" }, "Marketplace"), h("a", { onClick: this.logout.bind(this), id: "logout-btn" }, "Logout"))));
@@ -160,9 +151,9 @@ export class DashButtonComponent {
160
151
  else {
161
152
  return (h("button", { onClick: this.login.bind(this), id: "login-btn", type: "button", class: "button" }, h("span", { class: "button-text" }, "Login")));
162
153
  }
163
- })()), h("div", { key: 'fc06bdd5f74a4b79a21f1ddab5629f6a898a261a', id: "appListModal", class: "modal" }, h("div", { key: '667fa5a708f790818d2694bb5a7c811a64fbbff3', class: "modal-content" }, h("span", { key: 'ec1df58c4d4ed0a3231e9fc9457cd596ca8e048b', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("h3", { key: '2f9bae87a635e8904f5f0fe4ad8076a347370404' }, "Applications"), h("div", { key: '930a0de8699c574a7d9438ab0ac973830734327a', class: "modal-body" }, this.appList.length > 0 ? this.appList.map(app => {
154
+ })()), h("div", { key: '2c2f55d80917b2dc2b7a9279f2f76bc3a7f2e202', id: "appListModal", class: "modal" }, h("div", { key: '90d14c23cdbb1a129ba99f00518cff0a0a65baeb', class: "modal-content" }, h("span", { key: '6879c9fdc1d9a4a7075616f96ff63d95f8eaaea7', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("h3", { key: '06a0268e396c3aeda8cf90e93e3dde405743abcd' }, "Applications"), h("div", { key: '2f77c0e5d35acdb101cfe9caf2b6e26be241dae9', class: "modal-body" }, this.appList.length > 0 ? this.appList.map(app => {
164
155
  return (h("a", { class: "external-app-link", target: '_blank', href: "https://" + app.shortname + "-zdzw" + this.portalUrl.replace(/(^\w+:|^)\/\//, '').replace('.portal-frontend-zdzw', '') }, h("div", { class: "modal-app" }, h("div", null, app.name))));
165
- }) : h("div", null, h("h3", { class: "gray-text" }, "Not installed application found."), " ", h("p", { class: "gray-text" }, "Please contact administration."))))), h("div", { key: 'c01ee35c13b76484278a3a6bc38917784aa1f4d0', id: "appPermissionErrorModal", class: "modal" }, h("div", { key: 'cb330533d75233c44a520851adfee2aad581f192', class: "modal-content" }, h("img", { key: 'b8ef10fdc78a54a35ae91b6798f3eeaa13b05cf6', src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGD0lEQVR4nO2cbU8TWRTH/W5WEAmF4nNiieFFoeBjYhQUWzUWYkpbDfGFCR9CoolvQF9aWgG3kMCG8LACC1ikuCuUh7bH/M/MmW131S2ZqTDjPcmkdub2tvPj3HP/55yJR44oU6ZMmTJlyg7YOsL9pI7+shkogGFzDqMAhhVAOsiQozwwrACS8sCwfXd+tYTDCiApDwwf/FJUSzisAJKjNhFlPzYF0KQpgCZNATRpCqBJUwBNmgJo0hRAk6YAmjQF0KkAs4uLtPz8OU2HQpRqaaFkQwPFq6v5SHo8fA7XVgYGKLu0dGC/81ABLORylB4cpInLl+nt0aP7OiauXKH00BAV8vlfE2AmkaCxpiYDSKK6mqaammjx+nX6FAzS348e0VYkwgf+jXO4Nun18lj53PuLF2kjmfx1AOa3t2mmt9cAkDxxghauXaPN3l7KxmJlHRgLmKNutzHPTCTCczsa4G4mQ6nWVr7h4WPHaL6trQTc+r17NOf30/iZMzTmdtNwVRWPA2Scm/H56FMgQNlolMfDO/9ob+cxmDPl99PuxoYzAe5mMrzcxOvWAALgolFauXmTxurry45/gPvnjRsG+LW7d3lOWdKVhHggAPPb24bnvW9ooL96evjGP4dC9NvJkwaY0fPnaa6vjzLJJG19+ED5bJY/u5NOUyYep/lnz2jk3Ll/4p/Hw/B4ru5unls8Mb+z4xyAM3rMg5cIvHRXFyVqavg8oKy+elXWjooxqy9f0luXy5gTm4xAFE+cjcWcATCTSGgxr6rKWLaAF9fj1u+BAOW2tsqeL7+7S5OdnRq8mhpaf/CA5xSI8EiJiRsjI/YGWMjlDKmCDUOWrXje3NOnRIWCaXh45biqL+f59nYjHlqtE38qwPTgoLHMeLeNRo2YB8+zEp7ExK1olI+Rujo+t/b6tX0BTugZBnQebha7rcQ8K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mAJk0BNGkKoElTACsNUB39ZTFQAMMW/78xypQpU6ZMmbIjP9e+AkAlsBlIjsPOAAAAAElFTkSuQmCC" }), h("h2", { key: '64db3526910c2eff61f8f59d445ba8fd2fe0cae1', class: "green-text margin-b" }, "You don't have permission to access this application."), h("h3", { key: '845136246b4bdaa80c71cb44d9e483ed11b8727f', class: "green-text" }, "Please contact the administration."), (this.portalUrl && this.showUnauthorizedModal) ?
156
+ }) : h("div", null, h("h3", { class: "gray-text" }, "Not installed application found."), " ", h("p", { class: "gray-text" }, "Please contact administration."))))), h("div", { key: '0faa929f74523fdc8922e614c2724c9bf0e1d3c5', id: "appPermissionErrorModal", class: "modal" }, h("div", { key: 'e1781eab4a7c178fdc382398f966ee86bad972b6', class: "modal-content" }, h("img", { key: '486cd3878509f64c95c26e5e9ea75bb807e8b938', src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGD0lEQVR4nO2cbU8TWRTH/W5WEAmF4nNiieFFoeBjYhQUWzUWYkpbDfGFCR9CoolvQF9aWgG3kMCG8LACC1ikuCuUh7bH/M/MmW131S2ZqTDjPcmkdub2tvPj3HP/55yJR44oU6ZMmTJlyg7YOsL9pI7+shkogGFzDqMAhhVAOsiQozwwrACS8sCwfXd+tYTDCiApDwwf/FJUSzisAJKjNhFlPzYF0KQpgCZNATRpCqBJUwBNmgJo0hRAk6YAmjQF0KkAs4uLtPz8OU2HQpRqaaFkQwPFq6v5SHo8fA7XVgYGKLu0dGC/81ABLORylB4cpInLl+nt0aP7OiauXKH00BAV8vlfE2AmkaCxpiYDSKK6mqaammjx+nX6FAzS348e0VYkwgf+jXO4Nun18lj53PuLF2kjmfx1AOa3t2mmt9cAkDxxghauXaPN3l7KxmJlHRgLmKNutzHPTCTCczsa4G4mQ6nWVr7h4WPHaL6trQTc+r17NOf30/iZMzTmdtNwVRWPA2Scm/H56FMgQNlolMfDO/9ob+cxmDPl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B54iWAKOIaMRE7JXbS/zOMwYYhMQ9/gOLOnPxBZh8/dlhb06+Vs9B6FIi4cYmJInGgEyGIkbHgc8idkWHgHHRecVsTMU/mwuuY3tYcv3TJWW1NGJrdJY113WtkdxaJU84BqSK7rRFXdc/Dd+w5rbFeDHG8rc2IiQj2UmwQsY1iKFIxlKSg46AjARfnkGGISOZHO6JRnkNiHjzPsY92iGFZoultLNu6OtZs+3m4CCIZnxGpIjGvUsv2UAEUQ9NblrSUoNDDQP4KT+TH2/QWJT/eFgjwNaRnnGHI4x3NzRXZbQ89QBg0GsQ2Wo+SnZR1uFycYbBI3kdv2XEAiw35KqQMGkDoYaCeaDzi29jIuziuYYyVua1jANrFFECTpgCaNAXQpCmAJk0BNGkKoElTACsNUB39ZTFQAMMW/78xypQpU6ZMmbIjP9e+AkAlsBlIjsPOAAAAAElFTkSuQmCC" }), h("h2", { key: '36e08402d28c42466ec9634ed9f1ba0da06164f5', class: "green-text margin-b" }, "You don't have permission to access this application."), h("h3", { key: '2ef0a81a83ae10f1f2232c7d196ecab7ab7b4a65', class: "green-text" }, "Please contact the administration."), (this.portalUrl && this.showUnauthorizedModal) ?
166
157
  h("div", null, h("h4", { class: "gray-text" }, "You will be automatically redirected to the portal."), h("div", { id: "countdown" }, h("div", { id: "countdown-number" }), h("svg", null, h("circle", { r: "18", cx: "20", cy: "20" }))))
167
158
  : h("div", null))));
168
159
  }
@@ -357,7 +348,25 @@ export class DashButtonComponent {
357
348
  },
358
349
  "attribute": "marketplace-url",
359
350
  "reflect": false,
360
- "defaultValue": "\"\""
351
+ "defaultValue": "\"https://marketplace-zdzw.cloud.zdzw-project.com\""
352
+ },
353
+ "plmUrl": {
354
+ "type": "string",
355
+ "mutable": false,
356
+ "complexType": {
357
+ "original": "string",
358
+ "resolved": "string",
359
+ "references": {}
360
+ },
361
+ "required": false,
362
+ "optional": false,
363
+ "docs": {
364
+ "tags": [],
365
+ "text": ""
366
+ },
367
+ "attribute": "plm-url",
368
+ "reflect": false,
369
+ "defaultValue": "\"https://productlicensemanager-zdzw.cloud.zdzw-project.com\""
361
370
  },
362
371
  "showUnauthorizedModal": {
363
372
  "type": "boolean",
@@ -376,6 +385,23 @@ export class DashButtonComponent {
376
385
  "attribute": "show-unauthorized-modal",
377
386
  "reflect": false,
378
387
  "defaultValue": "false"
388
+ },
389
+ "postTextDelayDuration": {
390
+ "type": "number",
391
+ "mutable": false,
392
+ "complexType": {
393
+ "original": "number",
394
+ "resolved": "number",
395
+ "references": {}
396
+ },
397
+ "required": false,
398
+ "optional": false,
399
+ "docs": {
400
+ "tags": [],
401
+ "text": ""
402
+ },
403
+ "attribute": "post-text-delay-duration",
404
+ "reflect": false
379
405
  }
380
406
  };
381
407
  }
@@ -385,7 +411,8 @@ export class DashButtonComponent {
385
411
  "isAuth": {},
386
412
  "givenName": {},
387
413
  "silentCheckSsoRedirectUri": {},
388
- "appList": {}
414
+ "appList": {},
415
+ "showPostLoginLoadingSpinner": {}
389
416
  };
390
417
  }
391
418
  static get elementRef() { return "el"; }
@@ -1 +1 @@
1
- {"version":3,"file":"dash-button.js","sourceRoot":"","sources":["../../../src/components/my-component/dash-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,QAAQ,MAAM,aAAa,CAAC;AAQnC,MAAM,OAAO,mBAAmB;;iCAIO,KAAK;8BACR,KAAK;;0BAEV,WAAW;2BAEV,uBAAuB;qBAC7B,EAAE;wBACC,EAAE;qBAEL,EAAE;yBACE,EAAE;8BACG,EAAE;qCACM,KAAK;wBAErB,IAAI,QAAQ,CAAC;YACpC,GAAG,EAAE,IAAI,CAAC,WAAW;YACrB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC;sBAEgB,KAAK;yBACM,EAAE;yCACe,MAAM,CAAC,QAAQ,CAAC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;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h, Element } from '@stencil/core';\nimport Keycloak from \"keycloak-js\";\n\n\n@Component({\n tag: 'dash-button',\n styleUrl: 'dash-button.css',\n shadow: true,\n})\nexport class DashButtonComponent {\n\n @Element() el;\n \n @Prop() showPostLoginText: boolean = false;\n @Prop() silentCheckSso: boolean = false;\n @Prop() redirectUri: string;\n @Prop() authMethod: string = \"check-sso\";\n\n @Prop() keycloakUri: string = \"http://localhost:8080\";\n @Prop() realm: string = \"\";\n @Prop() clientId: string = \"\";\n\n @Prop() appId: string = \"\";\n @Prop() portalUrl: string = \"\";\n @Prop() marketplaceUrl: string = \"\";\n @Prop() showUnauthorizedModal: boolean = false;\n\n @State() keycloak: any = new Keycloak({\n url: this.keycloakUri,\n realm: this.realm,\n clientId: this.clientId,\n });;\n\n @State() isAuth = false;\n @State() givenName: string = \"\";\n @State() silentCheckSsoRedirectUri: string = window.location.origin + '/assets/verificar-sso.html';\n\n @State() appList = []\n\n componentWillLoad() {\n this.initKeycloak().then(() => {\n // Check if the user is authenticated\n if(this.isAuth) {\n this.getAppList().then(res => {\n this.appList = res\n\n // If the user has set an app ID, check if they have permission to access\n if(this.appId) {\n \n // Retrieve the list of buttons that are configured to set the app ID\n const appIdList = this.appId.replace(/'/g, '').split(',');\n // Remote appID list parsed from object\n const tempAppList = this.appList.map(obj => obj['shortname'])\n\n // Check if the user has permission to access the selected application\n if(appIdList.filter(id => tempAppList.includes(id)).length == 0) {\n // Update local storage app permission\n localStorage.setItem(\"ZDZW_app_permission\", JSON.stringify(false));\n\n // Show modal\n const appErrorModal = this.el.shadowRoot.querySelector('#appPermissionErrorModal');\n appErrorModal.style.display = \"block\";\n\n // If a redirect URL is provided, show the loading spinner\n if (this.portalUrl && this.showUnauthorizedModal) {\n var countdownNumberEl = this.el.shadowRoot.getElementById('countdown-number');\n var countdown = 6;\n\n countdownNumberEl.textContent = countdown.toString();\n\n setInterval(() => {\n countdown = --countdown <= 0 ? 6 : countdown;\n countdownNumberEl.textContent = countdown.toString();\n\n // Once the countdown finishes, redirect to the provided URL\n if(countdown == 1) {\n // appErrorModal.style.display = \"none\";\n window.location.replace(this.portalUrl.toString());\n }\n }, 1000);\n }\n } else {\n // The user is authenticated and has the necessary permissions\n // Update local storage app permission\n localStorage.setItem(\"ZDZW_app_permission\", JSON.stringify(true));\n }\n }\n\n })\n }\n })\n\n // // Get all application data associated with organization ID\n // const appIdList = this.appId.replace(/'/g, '').split(',');\n // var appListIds:Array<string> = []\n\n // if(this.appId) {\n // // const appList:Array<string> = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.APP_ID;\n\n // // Get app ID from marketplace (Compare product_id with app_id)\n // this.getAppList().then((response: Response) => response.json())\n // .then(response => {\n\n // // Save application data to a global array\n // if(this.appList.length <= 0 ) {\n // this.appList = response\n // }\n\n // // Save application IDs to a local array\n // appListIds.push(...this.appList.map(obj => obj['product_id']))\n\n // // Check if the user has permission to access the selected application\n // if(appIdList.filter(id => appListIds.includes(id)).length == 0) {\n\n // // Show modal\n // const appErrorModal = this.el.shadowRoot.querySelector('#appPermissionErrorModal');\n // appErrorModal.style.display = \"block\";\n\n // // If a redirect URL is provided, show the loading spinner\n // if (this.portalUrl) {\n // var countdownNumberEl = this.el.shadowRoot.getElementById('countdown-number');\n // var countdown = 6;\n\n // countdownNumberEl.textContent = countdown.toString();\n\n // setInterval(() => {\n // countdown = --countdown <= 0 ? 6 : countdown;\n // countdownNumberEl.textContent = countdown.toString();\n\n // // Once the countdown finishes, redirect to the provided URL\n // if(countdown == 1) {\n // // appErrorModal.style.display = \"none\";\n // window.location.replace(this.portalUrl.toString());\n // }\n // }, 1000);\n // }\n // }\n // })\n // }\n }\n\n async initKeycloak() {\n // Remove the initiation time permission localstorage object\n localStorage.removeItem(\"ZDZW_app_permission\");\n\n await this.keycloak.init(\n {\n onLoad: this.authMethod,\n checkLoginIframe: false,\n silentCheckSsoRedirectUri: this.silentCheckSso ? this.silentCheckSsoRedirectUri : '',\n }).then(res => {\n if(res) {\n this.isAuth = true\n localStorage.setItem(\"keycloak\", JSON.stringify(this.keycloak));\n document.cookie = \"ZDZW_cookie=\" + JSON.parse(localStorage.getItem('keycloak')).token;\n\n this.givenName = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.given_name\n } \n });\n }\n\n async getAppList() {\n // const token = await JSON.parse(localStorage.getItem('keycloak')).token;\n // const response = await fetch(this.marketplaceUrl + '/api/v1/product/nameAndShortName', {\n // headers: new Headers({\n // 'Authorization': 'Bearer ' + token,\n // }),\n // })\n\n const response = await fetch(this.marketplaceUrl + '/api/v1/product/nameAndShortName')\n const jsonObj = await response.json()\n return jsonObj\n }\n\n login() { \n this.keycloak.login() \n }\n\n logout() {\n localStorage.removeItem(\"keycloak\");\n document.cookie = \"ZDZW_cookie=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;\";\n this.keycloak.logout() \n } \n\n showModal() {\n const appModal = this.el.shadowRoot.querySelector('#appListModal');\n appModal.style.display = \"block\";\n }\n\n closeModal() {\n const appModal = this.el.shadowRoot.querySelector('#appListModal');\n appModal.style.display = \"none\";\n }\n\n render() {\n return <div>\n <div>\n {\n (() => {\n if(this.isAuth && this.showPostLoginText) {\n return (\n <a href={this.redirectUri} id=\"login-btn\" class=\"button button-link\">\n <span class=\"button-text button-text-full-width\">Go to Dashboard</span>\n </a>\n )\n } else if (this.isAuth) {\n return (\n <div id=\"profile-btn\" class=\"dropdown\">\n <button type=\"button\" class=\"button\">\n <span class=\"button-profile\">\n <img src=\"https://i.pravatar.cc/100?img=32\" alt=\"\"/>\n </span>\n <span id=\"given-name\" class=\"button-text\">{this.givenName}</span>\n <div class=\"button-icon\">\n <span class=\"gg-menu-grid-r\"></span>\n </div>\n </button>\n <div class=\"dropdown-content\">\n <a onClick={this.showModal.bind(this)} id=\"applications-btn\">Applications</a>\n <a href={this.portalUrl} target='_blank' id=\"applications-btn\">Portal</a>\n <a href={this.marketplaceUrl} target='_blank' id=\"applications-btn\">Marketplace</a>\n <a onClick={this.logout.bind(this)} id=\"logout-btn\">Logout</a>\n </div>\n </div>\n )\n } else {\n return (\n <button onClick={this.login.bind(this)} id=\"login-btn\" type=\"button\" class=\"button\">\n <span class=\"button-text\">Login</span>\n </button>\n )\n }\n })() \n } \n </div>\n \n <div id=\"appListModal\" class=\"modal\">\n \n <div class=\"modal-content\">\n <span onClick={this.closeModal.bind(this)} class=\"close\">&times;</span>\n <h3>Applications</h3>\n <div class=\"modal-body\">\n {this.appList.length > 0 ? this.appList.map( app => {\n return (\n <a class=\"external-app-link\" target='_blank' href={\"https://\" + app.shortname + \"-zdzw\"+ this.portalUrl.replace(/(^\\w+:|^)\\/\\//, '').replace('.portal-frontend-zdzw','')}>\n <div class=\"modal-app\">\n <div>{app.name}</div>\n </div>\n </a>\n );\n }) : <div><h3 class=\"gray-text\">Not installed application found.</h3> <p class=\"gray-text\">Please contact administration.</p></div>}\n </div>\n </div>\n \n </div>\n\n <div id=\"appPermissionErrorModal\" class=\"modal\">\n <div class=\"modal-content\">\n <img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGD0lEQVR4nO2cbU8TWRTH/W5WEAmF4nNiieFFoeBjYhQUWzUWYkpbDfGFCR9CoolvQF9aWgG3kMCG8LACC1ikuCuUh7bH/M/MmW131S2ZqTDjPcmkdub2tvPj3HP/55yJR44oU6ZMmTJlyg7YOsL9pI7+shkogGFzDqMAhhVAOsiQozwwrACS8sCwfXd+tYTDCiApDwwf/FJUSzisAJKjNhFlPzYF0KQpgCZNATRpCqBJUwBNmgJo0hRAk6YAmjQF0KkAs4uLtPz8OU2HQpRqaaFkQwPFq6v5SHo8fA7XVgYGKLu0dGC/81ABLORylB4cpInLl+nt0aP7OiauXKH00BAV8vlfE2AmkaCxpiYDSKK6mqaammjx+nX6FAzS348e0VYkwgf+jXO4Nun18lj53PuLF2kjmfx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soSEt/3W7tRZlNMolJylxWQEPJTGRP6lTpwz5YpSz3ryxcUE1nzcaSeieFTeArIKH3Fq8GSX9koJqc7O9C6owNL0lO5CKsZTfzS7bqTt3+LPxornxKu2Cz6Oj5IymUkTLCOB54iWAKOIaMRE7JXbS/zOMwYYhMQ9/gOLOnPxBZh8/dlhb06+Vs9B6FIi4cYmJInGgEyGIkbHgc8idkWHgHHRecVsTMU/mwuuY3tYcv3TJWW1NGJrdJY113WtkdxaJU84BqSK7rRFXdc/Dd+w5rbFeDHG8rc2IiQj2UmwQsY1iKFIxlKSg46AjARfnkGGISOZHO6JRnkNiHjzPsY92iGFZoultLNu6OtZs+3m4CCIZnxGpIjGvUsv2UAEUQ9NblrSUoNDDQP4KT+TH2/QWJT/eFgjwNaRnnGHI4x3NzRXZbQ89QBg0GsQ2Wo+SnZR1uFycYbBI3kdv2XEAiw35KqQMGkDoYaCeaDzi29jIuziuYYyVua1jANrFFECTpgCaNAXQpCmAJk0BNGkKoElTACsNUB39ZTFQAMMW/78xypQpU6ZMmbIjP9e+AkAlsBlIjsPOAAAAAElFTkSuQmCC\"/>\n <h2 class=\"green-text margin-b\">You don't have permission to access this application.</h2>\n <h3 class=\"green-text\">Please contact the administration.</h3>\n \n {(this.portalUrl && this.showUnauthorizedModal) ? \n <div>\n <h4 class=\"gray-text\">You will be automatically redirected to the portal.</h4>\n <div id=\"countdown\">\n <div id=\"countdown-number\"></div>\n <svg>\n <circle r=\"18\" cx=\"20\" cy=\"20\"></circle>\n </svg>\n </div>\n </div>\n : <div></div>\n }\n </div>\n </div>\n\n </div>;\n }\n}\n"]}
1
+ {"version":3,"file":"dash-button.js","sourceRoot":"","sources":["../../../src/components/my-component/dash-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACnE,OAAO,QAAQ,MAAM,aAAa,CAAC;AAQnC,MAAM,OAAO,m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opE,GAAE;oBAC/pE,2DAAI,KAAK,EAAC,qBAAqB,4DAA2D;oBAC1F,2DAAI,KAAK,EAAC,YAAY,yCAAwC;oBAE3D,CAAC,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC;wBAC7C;4BACE,UAAI,KAAK,EAAC,WAAW,0DAAyD;4BAC5E,WAAK,EAAE,EAAC,WAAW;gCACnB,WAAK,EAAE,EAAC,kBAAkB,GAAO;gCACjC;oCACE,cAAQ,CAAC,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,IAAI,GAAU,CACpC,CACF,CACF;wBACR,CAAC,CAAC,cAAW,CAEb,CACF,CAEF,CAAC;IACP,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h, Element } from '@stencil/core';\nimport Keycloak from \"keycloak-js\";\n\n\n@Component({\n tag: 'dash-button',\n styleUrl: 'dash-button.css',\n shadow: true,\n})\nexport class DashButtonComponent {\n\n @Element() el;\n \n @Prop() showPostLoginText: boolean = false;\n @Prop() silentCheckSso: boolean = false;\n @Prop() redirectUri: string;\n @Prop() authMethod: string = \"check-sso\";\n\n @Prop() keycloakUri: string = \"http://localhost:8080\";\n @Prop() realm: string = \"\";\n @Prop() clientId: string = \"\";\n\n @Prop() appId: string = \"\";\n @Prop() portalUrl: string = \"\";\n @Prop() marketplaceUrl: string = \"https://marketplace-zdzw.cloud.zdzw-project.com\";\n @Prop() plmUrl: string = \"https://productlicensemanager-zdzw.cloud.zdzw-project.com\";\n @Prop() showUnauthorizedModal: boolean = false;\n @Prop() postTextDelayDuration: number;\n\n @State() keycloak: any = new Keycloak({\n url: this.keycloakUri,\n realm: this.realm,\n clientId: this.clientId,\n });;\n\n @State() isAuth = false;\n @State() givenName: string = \"\";\n @State() silentCheckSsoRedirectUri: string = window.location.origin + '/assets/verificar-sso.html';\n\n @State() appList = []\n\n @State() showPostLoginLoadingSpinner = false;\n\n componentWillLoad() {\n //\n // User set post-text-delay-duration for displaying loading spinner\n //\n if(this.postTextDelayDuration > 0) {\n // Show loading spinner\n this.showPostLoginLoadingSpinner = true\n // Removing a loading spinner after the delay period ending\n setTimeout(() => {\n this.showPostLoginLoadingSpinner = false\n }, this.postTextDelayDuration);\n }\n\n //\n // Init Keycloak\n //\n this.initKeycloak().then(() => {\n // Check if the user is authenticated\n if(this.isAuth) {\n const _token = JSON.parse(localStorage.getItem('keycloak')).token\n \n this.getAppList(_token).then(res => {\n this.appList = res\n\n // If the user has set an app ID, check if they have permission to access\n if(this.appId) {\n \n // Retrieve the list of buttons that are configured to set the app ID\n const appIdList = this.appId.replace(/'/g, '').split(',');\n // Remote appID list parsed from object\n const tempAppList = this.appList.map(obj => obj['shortname'])\n\n // Check if the user has permission to access the selected application\n if(appIdList.filter(id => tempAppList.includes(id)).length == 0) {\n // Update local storage app permission\n localStorage.setItem(\"ZDZW_app_permission\", JSON.stringify(false));\n\n // Show modal\n const appErrorModal = this.el.shadowRoot.querySelector('#appPermissionErrorModal');\n appErrorModal.style.display = \"block\";\n\n // If a redirect URL is provided, show the loading spinner\n if (this.portalUrl && this.showUnauthorizedModal) {\n var countdownNumberEl = this.el.shadowRoot.getElementById('countdown-number');\n var countdown = 6;\n\n countdownNumberEl.textContent = countdown.toString();\n\n setInterval(() => {\n countdown = --countdown <= 0 ? 6 : countdown;\n countdownNumberEl.textContent = countdown.toString();\n\n // Once the countdown finishes, redirect to the provided URL\n if(countdown == 1) {\n // appErrorModal.style.display = \"none\";\n window.location.replace(this.portalUrl.toString());\n }\n }, 1000);\n }\n } else {\n // The user is authenticated and has the necessary permissions\n // Update local storage app permission\n localStorage.setItem(\"ZDZW_app_permission\", JSON.stringify(true));\n }\n }\n\n })\n }\n })\n }\n\n async initKeycloak() {\n // Remove the initiation time permission localstorage object\n localStorage.removeItem(\"ZDZW_app_permission\");\n\n await this.keycloak.init(\n {\n onLoad: this.authMethod,\n checkLoginIframe: false,\n silentCheckSsoRedirectUri: this.silentCheckSso ? this.silentCheckSsoRedirectUri : '',\n }).then(res => {\n if(res) {\n this.isAuth = true\n localStorage.setItem(\"keycloak\", JSON.stringify(this.keycloak));\n document.cookie = \"ZDZW_cookie=\" + JSON.parse(localStorage.getItem('keycloak')).token;\n\n this.givenName = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.given_name\n } \n });\n }\n\n async getAppList(token) {\n // const token = await JSON.parse(localStorage.getItem('keycloak')).token;\n // const response = await fetch(this.marketplaceUrl + '/api/v1/product/nameAndShortName', {\n // headers: new Headers({\n // 'Authorization': 'Bearer ' + token,\n // }),\n // })\n\n const response = await fetch(this.plmUrl + '/api/v1/product/nameAndShortNameOrg', {\n headers: new Headers({\n 'Authorization': 'Bearer ' + token,\n }),\n })\n const jsonObj = await response.json()\n return jsonObj\n }\n\n login() { \n this.keycloak.login() \n }\n\n logout() {\n localStorage.removeItem(\"keycloak\");\n document.cookie = \"ZDZW_cookie=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;\";\n this.keycloak.logout() \n } \n\n showModal() {\n const appModal = this.el.shadowRoot.querySelector('#appListModal');\n appModal.style.display = \"block\";\n }\n\n closeModal() {\n const appModal = this.el.shadowRoot.querySelector('#appListModal');\n appModal.style.display = \"none\";\n }\n\n render() {\n return <div>\n <div>\n {\n (() => {\n if(this.isAuth && this.showPostLoginText) {\n // User set post-text-delay-duration for displaying loading spinner\n if(this.showPostLoginLoadingSpinner) {\n return (\n <a id=\"login-btn\" class=\"button button-link\">\n <div class=\"lds-ring\"><div></div><div></div><div></div><div></div></div>\n </a>\n )\n } else {\n return (\n <a href={this.redirectUri} id=\"login-btn\" class=\"button button-link\">\n <span class=\"button-text button-text-full-width\">Go to Dashboard</span>\n </a>\n )\n }\n \n } else if (this.isAuth) {\n return (\n <div id=\"profile-btn\" class=\"dropdown\">\n <button type=\"button\" class=\"button\">\n <span class=\"button-profile\">\n <img src=\"https://i.pravatar.cc/100?img=32\" alt=\"\"/>\n </span>\n <span id=\"given-name\" class=\"button-text\">{this.givenName}</span>\n <div class=\"button-icon\">\n <span class=\"gg-menu-grid-r\"></span>\n </div>\n </button>\n <div class=\"dropdown-content\">\n <a onClick={this.showModal.bind(this)} id=\"applications-btn\">Applications</a>\n <a href={this.portalUrl} target='_blank' id=\"applications-btn\">Portal</a>\n <a href={this.marketplaceUrl} target='_blank' id=\"applications-btn\">Marketplace</a>\n <a onClick={this.logout.bind(this)} id=\"logout-btn\">Logout</a>\n </div>\n </div>\n )\n } else {\n return (\n <button onClick={this.login.bind(this)} id=\"login-btn\" type=\"button\" class=\"button\">\n <span class=\"button-text\">Login</span>\n </button>\n )\n }\n })() \n } \n </div>\n \n <div id=\"appListModal\" class=\"modal\">\n \n <div class=\"modal-content\">\n <span onClick={this.closeModal.bind(this)} class=\"close\">&times;</span>\n <h3>Applications</h3>\n <div class=\"modal-body\">\n {this.appList.length > 0 ? this.appList.map( app => {\n return (\n <a class=\"external-app-link\" target='_blank' href={\"https://\" + app.shortname + \"-zdzw\"+ this.portalUrl.replace(/(^\\w+:|^)\\/\\//, '').replace('.portal-frontend-zdzw','')}>\n <div class=\"modal-app\">\n <div>{app.name}</div>\n </div>\n </a>\n );\n }) : <div><h3 class=\"gray-text\">Not installed application found.</h3> <p class=\"gray-text\">Please contact administration.</p></div>}\n </div>\n </div>\n \n </div>\n\n <div id=\"appPermissionErrorModal\" class=\"modal\">\n <div class=\"modal-content\">\n <img src=\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtA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XrjA71devLAfwOlQiH88lhJuBhkGbxx9fZbDE4NO5LTO5+OxCB14P93dbT+AKZ9P84ZgkG8GqRjeQ9ZUAh4MYhvXxs+e5fHwRBbWra32A5j0ePjHf9H1mST+2YWFisCDba+u8vV3tbWGNuT3jY32AxjXS06QFLgZKUH9aPct7O3RVFfXf+BlHj6kZG2tBq+j47tpGs5LoYKrNpGI9v74cfsDHNazg+/dvFl4sNzmprHz2x5g8l9LWMTuzsePli7bYkMBgqVMfb39l3CqpeXbm0g8XhF439xEgkGjOmN7GTOjA4XU2Be8zs6y4MFmnzzRpJLfXypjenrsK6Qnvd4SSQGxCyFtNbxiIb1+/74mpL1e+wrp7NISp1ElqZwuZZB2WQkPZqRyevz7Eg5zCc22qVxxMUGWMRL94sTfKnjYfd+dPq15261bpcWEq1fJvuWsoSEt/3W7tRZlNMolJylxWQEPJTGRP6lTpwz5YpSz3ryxcUE1nzcaSeieFTeArIKH3Fq8GSX9koJqc7O9C6owNL0lO5CKsZTfzS7bqTt3+LPxornxKu2Cz6Oj5IymUkTLCOB54iWAKOIaMRE7JXbS/zOMwYYhMQ9/gOLOnPxBZh8/dlhb06+Vs9B6FIi4cYmJInGgEyGIkbHgc8idkWHgHHRecVsTMU/mwuuY3tYcv3TJWW1NGJrdJY113WtkdxaJU84BqSK7rRFXdc/Dd+w5rbFeDHG8rc2IiQj2UmwQsY1iKFIxlKSg46AjARfnkGGISOZHO6JRnkNiHjzPsY92iGFZoultLNu6OtZs+3m4CCIZnxGpIjGvUsv2UAEUQ9NblrSUoNDDQP4KT+TH2/QWJT/eFgjwNaRnnGHI4x3NzRXZbQ89QBg0GsQ2Wo+SnZR1uFycYbBI3kdv2XEAiw35KqQMGkDoYaCeaDzi29jIuziuYYyVua1jANrFFECTpgCaNAXQpCmAJk0BNGkKoElTACsNUB39ZTFQAMMW/78xypQpU6ZMmbIjP9e+AkAlsBlIjsPOAAAAAElFTkSuQmCC\"/>\n <h2 class=\"green-text margin-b\">You don't have permission to access this application.</h2>\n <h3 class=\"green-text\">Please contact the administration.</h3>\n \n {(this.portalUrl && this.showUnauthorizedModal) ? \n <div>\n <h4 class=\"gray-text\">You will be automatically redirected to the portal.</h4>\n <div id=\"countdown\">\n <div id=\"countdown-number\"></div>\n <svg>\n <circle r=\"18\" cx=\"20\" cy=\"20\"></circle>\n </svg>\n </div>\n </div>\n : <div></div>\n }\n </div>\n </div>\n\n </div>;\n }\n}\n"]}
@@ -2473,7 +2473,7 @@ function Keycloak (config) {
2473
2473
  }
2474
2474
  }
2475
2475
 
2476
- const dashButtonCss = ".button{display:flex;height:50px;padding:0;background:#3e7671;border:none;outline:none;border-radius:5px;overflow:hidden;font-size:16px;font-weight:500;cursor:pointer;min-width:220px;max-width:220px}.button:hover{background:#008168}.button:active{background:#3e7671}.button-text{display:block;margin:auto;padding:0 24px;color:#fff;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:80px}.button-icon{margin:auto;padding:10px}.button-profile{display:inline-flex;align-items:center;color:#fff}.button-profile img{height:50px}.button-text-full-width{width:auto!important}.button-link{text-decoration:none!important}.gg-menu-grid-r{color:#fff;box-sizing:border-box;position:relative;display:block;transform:scale(var(--ggs,1));width:16px;height:16px}.gg-menu-grid-r::before{content:\"\";display:block;box-sizing:border-box;position:absolute;width:4px;height:4px;background:currentColor;box-shadow:0 6px 0,\n 6px 6px 0,\n 12px 6px 0,\n 6px 12px 0,\n 12px 12px 0,\n 6px 0 0,\n 12px 0 0,\n 0 12px 0}.dropdown{position:relative;display:inline-block}.dropdown-content{display:none;position:absolute;right:0;background-color:#f9f9f9;min-width:180px;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);z-index:1;border-radius:5px}.dropdown-content a{color:#71797E;padding:16px 20px;text-decoration:none;display:block;cursor:pointer}.dropdown-content a:hover{background-color:#f1f1f1;color:#000;opacity:0.7}.dropdown:hover .dropdown-content{display:block}.modal{display:none;position:fixed;z-index:1;padding-top:100px;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4);text-align:center}.modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:40%}.modal-body{max-height:50vh;overflow-y:auto}.close{color:#aaaaaa;float:right;font-size:28px;font-weight:bold}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer}.modal-app{background-color:#c3e9bc;padding:15px;margin:10px;border-radius:5px}.external-app-link{text-decoration:none;color:#000}.gray-text{color:#606060}.green-text{color:#3e7671}#countdown{position:relative;margin:auto;margin-top:30px;height:40px;width:40px;text-align:center}#countdown-number{color:#2e2e2e;display:inline-block;line-height:40px}svg{position:absolute;top:0;right:0;width:40px;height:40px;transform:rotateY(-180deg) rotateZ(-90deg)}svg circle{stroke-dasharray:113px;stroke-dashoffset:0px;stroke-linecap:round;stroke-width:4px;stroke:#008168;fill:none;animation:countdown 6s linear infinite forwards}@keyframes countdown{from{stroke-dashoffset:0px}to{stroke-dashoffset:113px}}";
2476
+ const dashButtonCss = ".button{display:flex;height:50px;padding:0;background:#3e7671;border:none;outline:none;border-radius:5px;overflow:hidden;font-size:16px;font-weight:500;cursor:pointer;min-width:220px;max-width:220px}.button:hover{background:#008168}.button:active{background:#3e7671}.button-text{display:block;margin:auto;padding:0 24px;color:#fff;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;width:80px}.button-icon{margin:auto;padding:10px}.button-profile{display:inline-flex;align-items:center;color:#fff}.button-profile img{height:50px}.button-text-full-width{width:auto!important}.button-link{text-decoration:none!important}.gg-menu-grid-r{color:#fff;box-sizing:border-box;position:relative;display:block;transform:scale(var(--ggs,1));width:16px;height:16px}.gg-menu-grid-r::before{content:\"\";display:block;box-sizing:border-box;position:absolute;width:4px;height:4px;background:currentColor;box-shadow:0 6px 0,\n 6px 6px 0,\n 12px 6px 0,\n 6px 12px 0,\n 12px 12px 0,\n 6px 0 0,\n 12px 0 0,\n 0 12px 0}.dropdown{position:relative;display:inline-block}.dropdown-content{display:none;position:absolute;right:0;background-color:#f9f9f9;min-width:180px;box-shadow:0px 8px 16px 0px rgba(0,0,0,0.2);z-index:1;border-radius:5px}.dropdown-content a{color:#71797E;padding:16px 20px;text-decoration:none;display:block;cursor:pointer}.dropdown-content a:hover{background-color:#f1f1f1;color:#000;opacity:0.7}.dropdown:hover .dropdown-content{display:block}.modal{display:none;position:fixed;z-index:1;padding-top:100px;left:0;top:0;width:100%;height:100%;overflow:auto;background-color:rgb(0,0,0);background-color:rgba(0,0,0,0.4);text-align:center}.modal-content{background-color:#fefefe;margin:auto;padding:20px;border:1px solid #888;width:40%}.modal-body{max-height:50vh;overflow-y:auto}.close{color:#aaaaaa;float:right;font-size:28px;font-weight:bold}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer}.modal-app{background-color:#c3e9bc;padding:15px;margin:10px;border-radius:5px}.external-app-link{text-decoration:none;color:#000}.gray-text{color:#606060}.green-text{color:#3e7671}#countdown{position:relative;margin:auto;margin-top:30px;height:40px;width:40px;text-align:center}#countdown-number{color:#2e2e2e;display:inline-block;line-height:40px}svg{position:absolute;top:0;right:0;width:40px;height:40px;transform:rotateY(-180deg) rotateZ(-90deg)}svg circle{stroke-dasharray:113px;stroke-dashoffset:0px;stroke-linecap:round;stroke-width:4px;stroke:#008168;fill:none;animation:countdown 6s linear infinite forwards}@keyframes countdown{from{stroke-dashoffset:0px}to{stroke-dashoffset:113px}}.lds-ring{color:#fff}.lds-ring{display:flex;justify-content:center;align-items:center;margin:auto;position:relative}.lds-ring div{box-sizing:border-box;display:block;position:absolute;width:30px;height:30px;margin:3px;border:3px solid currentColor;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;border-color:currentColor transparent transparent transparent}.lds-ring div:nth-child(1){animation-delay:-0.45s}.lds-ring div:nth-child(2){animation-delay:-0.3s}.lds-ring div:nth-child(3){animation-delay:-0.15s}@keyframes lds-ring{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}";
2477
2477
  const DashButtonStyle0 = dashButtonCss;
2478
2478
 
2479
2479
  const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonComponent extends HTMLElement {
@@ -2490,8 +2490,10 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
2490
2490
  this.clientId = "";
2491
2491
  this.appId = "";
2492
2492
  this.portalUrl = "";
2493
- this.marketplaceUrl = "";
2493
+ this.marketplaceUrl = "https://marketplace-zdzw.cloud.zdzw-project.com";
2494
+ this.plmUrl = "https://productlicensemanager-zdzw.cloud.zdzw-project.com";
2494
2495
  this.showUnauthorizedModal = false;
2496
+ this.postTextDelayDuration = undefined;
2495
2497
  this.keycloak = new Keycloak({
2496
2498
  url: this.keycloakUri,
2497
2499
  realm: this.realm,
@@ -2501,13 +2503,29 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
2501
2503
  this.givenName = "";
2502
2504
  this.silentCheckSsoRedirectUri = window.location.origin + '/assets/verificar-sso.html';
2503
2505
  this.appList = [];
2506
+ this.showPostLoginLoadingSpinner = false;
2504
2507
  }
2505
2508
  ;
2506
2509
  componentWillLoad() {
2510
+ //
2511
+ // User set post-text-delay-duration for displaying loading spinner
2512
+ //
2513
+ if (this.postTextDelayDuration > 0) {
2514
+ // Show loading spinner
2515
+ this.showPostLoginLoadingSpinner = true;
2516
+ // Removing a loading spinner after the delay period ending
2517
+ setTimeout(() => {
2518
+ this.showPostLoginLoadingSpinner = false;
2519
+ }, this.postTextDelayDuration);
2520
+ }
2521
+ //
2522
+ // Init Keycloak
2523
+ //
2507
2524
  this.initKeycloak().then(() => {
2508
2525
  // Check if the user is authenticated
2509
2526
  if (this.isAuth) {
2510
- this.getAppList().then(res => {
2527
+ const _token = JSON.parse(localStorage.getItem('keycloak')).token;
2528
+ this.getAppList(_token).then(res => {
2511
2529
  this.appList = res;
2512
2530
  // If the user has set an app ID, check if they have permission to access
2513
2531
  if (this.appId) {
@@ -2547,43 +2565,6 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
2547
2565
  });
2548
2566
  }
2549
2567
  });
2550
- // // Get all application data associated with organization ID
2551
- // const appIdList = this.appId.replace(/'/g, '').split(',');
2552
- // var appListIds:Array<string> = []
2553
- // if(this.appId) {
2554
- // // const appList:Array<string> = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.APP_ID;
2555
- // // Get app ID from marketplace (Compare product_id with app_id)
2556
- // this.getAppList().then((response: Response) => response.json())
2557
- // .then(response => {
2558
- // // Save application data to a global array
2559
- // if(this.appList.length <= 0 ) {
2560
- // this.appList = response
2561
- // }
2562
- // // Save application IDs to a local array
2563
- // appListIds.push(...this.appList.map(obj => obj['product_id']))
2564
- // // Check if the user has permission to access the selected application
2565
- // if(appIdList.filter(id => appListIds.includes(id)).length == 0) {
2566
- // // Show modal
2567
- // const appErrorModal = this.el.shadowRoot.querySelector('#appPermissionErrorModal');
2568
- // appErrorModal.style.display = "block";
2569
- // // If a redirect URL is provided, show the loading spinner
2570
- // if (this.portalUrl) {
2571
- // var countdownNumberEl = this.el.shadowRoot.getElementById('countdown-number');
2572
- // var countdown = 6;
2573
- // countdownNumberEl.textContent = countdown.toString();
2574
- // setInterval(() => {
2575
- // countdown = --countdown <= 0 ? 6 : countdown;
2576
- // countdownNumberEl.textContent = countdown.toString();
2577
- // // Once the countdown finishes, redirect to the provided URL
2578
- // if(countdown == 1) {
2579
- // // appErrorModal.style.display = "none";
2580
- // window.location.replace(this.portalUrl.toString());
2581
- // }
2582
- // }, 1000);
2583
- // }
2584
- // }
2585
- // })
2586
- // }
2587
2568
  }
2588
2569
  async initKeycloak() {
2589
2570
  // Remove the initiation time permission localstorage object
@@ -2601,14 +2582,18 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
2601
2582
  }
2602
2583
  });
2603
2584
  }
2604
- async getAppList() {
2585
+ async getAppList(token) {
2605
2586
  // const token = await JSON.parse(localStorage.getItem('keycloak')).token;
2606
2587
  // const response = await fetch(this.marketplaceUrl + '/api/v1/product/nameAndShortName', {
2607
2588
  // headers: new Headers({
2608
2589
  // 'Authorization': 'Bearer ' + token,
2609
2590
  // }),
2610
2591
  // })
2611
- const response = await fetch(this.marketplaceUrl + '/api/v1/product/nameAndShortName');
2592
+ const response = await fetch(this.plmUrl + '/api/v1/product/nameAndShortNameOrg', {
2593
+ headers: new Headers({
2594
+ 'Authorization': 'Bearer ' + token,
2595
+ }),
2596
+ });
2612
2597
  const jsonObj = await response.json();
2613
2598
  return jsonObj;
2614
2599
  }
@@ -2629,9 +2614,15 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
2629
2614
  appModal.style.display = "none";
2630
2615
  }
2631
2616
  render() {
2632
- return h("div", { key: '45d3cee1eb5857f688bf82eccfa5fcf31ec0e649' }, h("div", { key: '2e0fbfe2fd3e969f03d31eba64732407abc9319f' }, (() => {
2617
+ return h("div", { key: '7843bbee4940a6a252e61442f8d77d467ee769c2' }, h("div", { key: 'd0940bd721a4eab5533cb7b136fabe8353cbb535' }, (() => {
2633
2618
  if (this.isAuth && this.showPostLoginText) {
2634
- return (h("a", { href: this.redirectUri, id: "login-btn", class: "button button-link" }, h("span", { class: "button-text button-text-full-width" }, "Go to Dashboard")));
2619
+ // User set post-text-delay-duration for displaying loading spinner
2620
+ if (this.showPostLoginLoadingSpinner) {
2621
+ return (h("a", { id: "login-btn", class: "button button-link" }, h("div", { class: "lds-ring" }, h("div", null), h("div", null), h("div", null), h("div", null))));
2622
+ }
2623
+ else {
2624
+ return (h("a", { href: this.redirectUri, id: "login-btn", class: "button button-link" }, h("span", { class: "button-text button-text-full-width" }, "Go to Dashboard")));
2625
+ }
2635
2626
  }
2636
2627
  else if (this.isAuth) {
2637
2628
  return (h("div", { id: "profile-btn", class: "dropdown" }, h("button", { type: "button", class: "button" }, h("span", { class: "button-profile" }, h("img", { src: "https://i.pravatar.cc/100?img=32", alt: "" })), h("span", { id: "given-name", class: "button-text" }, this.givenName), h("div", { class: "button-icon" }, h("span", { class: "gg-menu-grid-r" }))), h("div", { class: "dropdown-content" }, h("a", { onClick: this.showModal.bind(this), id: "applications-btn" }, "Applications"), h("a", { href: this.portalUrl, target: '_blank', id: "applications-btn" }, "Portal"), h("a", { href: this.marketplaceUrl, target: '_blank', id: "applications-btn" }, "Marketplace"), h("a", { onClick: this.logout.bind(this), id: "logout-btn" }, "Logout"))));
@@ -2639,9 +2630,9 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
2639
2630
  else {
2640
2631
  return (h("button", { onClick: this.login.bind(this), id: "login-btn", type: "button", class: "button" }, h("span", { class: "button-text" }, "Login")));
2641
2632
  }
2642
- })()), h("div", { key: 'fc06bdd5f74a4b79a21f1ddab5629f6a898a261a', id: "appListModal", class: "modal" }, h("div", { key: '667fa5a708f790818d2694bb5a7c811a64fbbff3', class: "modal-content" }, h("span", { key: 'ec1df58c4d4ed0a3231e9fc9457cd596ca8e048b', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("h3", { key: '2f9bae87a635e8904f5f0fe4ad8076a347370404' }, "Applications"), h("div", { key: '930a0de8699c574a7d9438ab0ac973830734327a', class: "modal-body" }, this.appList.length > 0 ? this.appList.map(app => {
2633
+ })()), h("div", { key: '2c2f55d80917b2dc2b7a9279f2f76bc3a7f2e202', id: "appListModal", class: "modal" }, h("div", { key: '90d14c23cdbb1a129ba99f00518cff0a0a65baeb', class: "modal-content" }, h("span", { key: '6879c9fdc1d9a4a7075616f96ff63d95f8eaaea7', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("h3", { key: '06a0268e396c3aeda8cf90e93e3dde405743abcd' }, "Applications"), h("div", { key: '2f77c0e5d35acdb101cfe9caf2b6e26be241dae9', class: "modal-body" }, this.appList.length > 0 ? this.appList.map(app => {
2643
2634
  return (h("a", { class: "external-app-link", target: '_blank', href: "https://" + app.shortname + "-zdzw" + this.portalUrl.replace(/(^\w+:|^)\/\//, '').replace('.portal-frontend-zdzw', '') }, h("div", { class: "modal-app" }, h("div", null, app.name))));
2644
- }) : h("div", null, h("h3", { class: "gray-text" }, "Not installed application found."), " ", h("p", { class: "gray-text" }, "Please contact administration."))))), h("div", { key: 'c01ee35c13b76484278a3a6bc38917784aa1f4d0', id: "appPermissionErrorModal", class: "modal" }, h("div", { key: 'cb330533d75233c44a520851adfee2aad581f192', class: "modal-content" }, h("img", { key: 'b8ef10fdc78a54a35ae91b6798f3eeaa13b05cf6', src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGD0lEQVR4nO2cbU8TWRTH/W5WEAmF4nNiieFFoeBjYhQUWzUWYkpbDfGFCR9CoolvQF9aWgG3kMCG8LACC1ikuCuUh7bH/M/MmW131S2ZqTDjPcmkdub2tvPj3HP/55yJR44oU6ZMmTJlyg7YOsL9pI7+shkogGFzDqMAhhVAOsiQozwwrACS8sCwfXd+tYTDCiApDwwf/FJUSzisAJKjNhFlPzYF0KQpgCZNATRpCqBJUwBNmgJo0hRAk6YAmjQF0KkAs4uLtPz8OU2HQpRqaaFkQwPFq6v5SHo8fA7XVgYGKLu0dGC/81ABLORylB4cpInLl+nt0aP7OiauXKH00BAV8vlfE2AmkaCxpiYDSKK6mqaammjx+nX6FAzS348e0VYkwgf+jXO4Nun18lj53PuLF2kjmfx1AOa3t2mmt9cAkDxxghauXaPN3l7KxmJlHRgLmKNutzHPTCTCczsa4G4mQ6nWVr7h4WPHaL6trQTc+r17NOf30/iZMzTmdtNwVRWPA2Scm/H56FMgQNlolMfDO/9ob+cxmDPl99PuxoYzAe5mMrzcxOvWAALgolFauXmTxurry45/gPvnjRsG+LW7d3lOWdKVhHggAPPb24bnvW9ooL96evjGP4dC9NvJkwaY0fPnaa6vjzLJJG19+ED5bJY/u5NOUyYep/lnz2jk3Ll/4p/Hw/B4ru5unls8Mb+z4xyAM3rMg5cIvHRXFyVqavg8oKy+elXWjooxqy9f0luXy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RnkNiHjzPsY92iGFZoultLNu6OtZs+3m4CCIZnxGpIjGvUsv2UAEUQ9NblrSUoNDDQP4KT+TH2/QWJT/eFgjwNaRnnGHI4x3NzRXZbQ89QBg0GsQ2Wo+SnZR1uFycYbBI3kdv2XEAiw35KqQMGkDoYaCeaDzi29jIuziuYYyVua1jANrFFECTpgCaNAXQpCmAJk0BNGkKoElTACsNUB39ZTFQAMMW/78xypQpU6ZMmbIjP9e+AkAlsBlIjsPOAAAAAElFTkSuQmCC" }), h("h2", { key: '64db3526910c2eff61f8f59d445ba8fd2fe0cae1', class: "green-text margin-b" }, "You don't have permission to access this application."), h("h3", { key: '845136246b4bdaa80c71cb44d9e483ed11b8727f', class: "green-text" }, "Please contact the administration."), (this.portalUrl && this.showUnauthorizedModal) ?
2635
+ }) : h("div", null, h("h3", { class: "gray-text" }, "Not installed application found."), " ", h("p", { class: "gray-text" }, "Please contact administration."))))), h("div", { key: '0faa929f74523fdc8922e614c2724c9bf0e1d3c5', id: "appPermissionErrorModal", class: "modal" }, h("div", { key: 'e1781eab4a7c178fdc382398f966ee86bad972b6', class: "modal-content" }, h("img", { key: '486cd3878509f64c95c26e5e9ea75bb807e8b938', src: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGD0lEQVR4nO2cbU8TWRTH/W5WEAmF4nNiieFFoeBjYhQUWzUWYkpbDfGFCR9CoolvQF9aWgG3kMCG8LACC1ikuCuUh7bH/M/MmW131S2ZqTDjPcmkdub2tvPj3HP/55yJR44oU6ZMmTJlyg7YOsL9pI7+shkogGFzDqMAhhVAOsiQozwwrACS8sCwfXd+tYTDCiApDwwf/FJUSzisAJKjNhFlPzYF0KQpgCZNATRpCqBJUwBNmgJo0hRAk6YAmjQF0KkAs4uLtPz8OU2HQpRqaaFkQwPFq6v5SHo8fA7XVgYGKLu0dGC/81ABLORylB4cpInLl+nt0aP7OiauXKH00BAV8vlfE2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2WQkPZqRyevz7Eg5zCc22qVxxMUGWMRL94sTfKnjYfd+dPq15261bpcWEq1fJvuWsoSEt/3W7tRZlNMolJylxWQEPJTGRP6lTpwz5YpSz3ryxcUE1nzcaSeieFTeArIKH3Fq8GSX9koJqc7O9C6owNL0lO5CKsZTfzS7bqTt3+LPxornxKu2Cz6Oj5IymUkTLCOB54iWAKOIaMRE7JXbS/zOMwYYhMQ9/gOLOnPxBZh8/dlhb06+Vs9B6FIi4cYmJInGgEyGIkbHgc8idkWHgHHRecVsTMU/mwuuY3tYcv3TJWW1NGJrdJY113WtkdxaJU84BqSK7rRFXdc/Dd+w5rbFeDHG8rc2IiQj2UmwQsY1iKFIxlKSg46AjARfnkGGISOZHO6JRnkNiHjzPsY92iGFZoultLNu6OtZs+3m4CCIZnxGpIjGvUsv2UAEUQ9NblrSUoNDDQP4KT+TH2/QWJT/eFgjwNaRnnGHI4x3NzRXZbQ89QBg0GsQ2Wo+SnZR1uFycYbBI3kdv2XEAiw35KqQMGkDoYaCeaDzi29jIuziuYYyVua1jANrFFECTpgCaNAXQpCmAJk0BNGkKoElTACsNUB39ZTFQAMMW/78xypQpU6ZMmbIjP9e+AkAlsBlIjsPOAAAAAElFTkSuQmCC" }), h("h2", { key: '36e08402d28c42466ec9634ed9f1ba0da06164f5', class: "green-text margin-b" }, "You don't have permission to access this application."), h("h3", { key: '2ef0a81a83ae10f1f2232c7d196ecab7ab7b4a65', class: "green-text" }, "Please contact the administration."), (this.portalUrl && this.showUnauthorizedModal) ?
2645
2636
  h("div", null, h("h4", { class: "gray-text" }, "You will be automatically redirected to the portal."), h("div", { id: "countdown" }, h("div", { id: "countdown-number" }), h("svg", null, h("circle", { r: "18", cx: "20", cy: "20" }))))
2646
2637
  : h("div", null))));
2647
2638
  }
@@ -2658,12 +2649,15 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
2658
2649
  "appId": [1, "app-id"],
2659
2650
  "portalUrl": [1, "portal-url"],
2660
2651
  "marketplaceUrl": [1, "marketplace-url"],
2652
+ "plmUrl": [1, "plm-url"],
2661
2653
  "showUnauthorizedModal": [4, "show-unauthorized-modal"],
2654
+ "postTextDelayDuration": [2, "post-text-delay-duration"],
2662
2655
  "keycloak": [32],
2663
2656
  "isAuth": [32],
2664
2657
  "givenName": [32],
2665
2658
  "silentCheckSsoRedirectUri": [32],
2666
- "appList": [32]
2659
+ "appList": [32],
2660
+ "showPostLoginLoadingSpinner": [32]
2667
2661
  }]);
2668
2662
  function defineCustomElement$1() {
2669
2663
  if (typeof customElements === "undefined") {