dash-button-web 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/dash-button.cjs.entry.js +35 -4
- package/dist/cjs/dash-button.cjs.entry.js.map +1 -1
- package/dist/cjs/{index-8282b36b.js → index-d91975cd.js} +37 -2
- package/dist/cjs/index-d91975cd.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/web-compnont.cjs.js +2 -2
- package/dist/collection/components/my-component/dash-button.css +51 -0
- package/dist/collection/components/my-component/dash-button.js +69 -2
- package/dist/collection/components/my-component/dash-button.js.map +1 -1
- package/dist/components/dash-button.js +36 -3
- package/dist/components/dash-button.js.map +1 -1
- package/dist/esm/dash-button.entry.js +35 -4
- package/dist/esm/dash-button.entry.js.map +1 -1
- package/dist/esm/{index-2b6c17bc.js → index-1c7e21da.js} +37 -2
- package/dist/esm/index-1c7e21da.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/web-compnont.js +3 -3
- package/dist/types/components/my-component/dash-button.d.ts +3 -0
- package/dist/types/components.d.ts +4 -0
- package/dist/web-compnont/p-aa686508.js +3 -0
- package/dist/web-compnont/p-aa686508.js.map +1 -0
- package/dist/web-compnont/{p-4356bec1.entry.js → p-ccad140c.entry.js} +3 -3
- package/dist/web-compnont/p-ccad140c.entry.js.map +1 -0
- package/dist/web-compnont/web-compnont.esm.js +1 -1
- package/dist/web-compnont/web-compnont.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/index-8282b36b.js.map +0 -1
- package/dist/esm/index-2b6c17bc.js.map +0 -1
- package/dist/web-compnont/p-35259f64.js +0 -3
- package/dist/web-compnont/p-35259f64.js.map +0 -1
- package/dist/web-compnont/p-4356bec1.entry.js.map +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-d91975cd.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"],"keycloak":[32],"isAuth":[32],"givenName":[32],"silentCheckSsoRedirectUri":[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"],"keycloak":[32],"isAuth":[32],"givenName":[32],"silentCheckSsoRedirectUri":[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-
|
|
5
|
+
const index = require('./index-d91975cd.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"],"keycloak":[32],"isAuth":[32],"givenName":[32],"silentCheckSsoRedirectUri":[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"],"keycloak":[32],"isAuth":[32],"givenName":[32],"silentCheckSsoRedirectUri":[32]}]]]], options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
exports.setNonce = index.setNonce;
|
|
@@ -166,4 +166,55 @@
|
|
|
166
166
|
padding: 15px;
|
|
167
167
|
margin: 10px;
|
|
168
168
|
border-radius: 5px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.gray-text {
|
|
172
|
+
color: #606060;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.green-text {
|
|
176
|
+
color: #3e7671;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
#countdown {
|
|
180
|
+
position: relative;
|
|
181
|
+
margin: auto;
|
|
182
|
+
margin-top: 30px;
|
|
183
|
+
height: 40px;
|
|
184
|
+
width: 40px;
|
|
185
|
+
text-align: center;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
#countdown-number {
|
|
189
|
+
color: #2e2e2e;
|
|
190
|
+
display: inline-block;
|
|
191
|
+
line-height: 40px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
svg {
|
|
195
|
+
position: absolute;
|
|
196
|
+
top: 0;
|
|
197
|
+
right: 0;
|
|
198
|
+
width: 40px;
|
|
199
|
+
height: 40px;
|
|
200
|
+
transform: rotateY(-180deg) rotateZ(-90deg);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
svg circle {
|
|
204
|
+
stroke-dasharray: 113px;
|
|
205
|
+
stroke-dashoffset: 0px;
|
|
206
|
+
stroke-linecap: round;
|
|
207
|
+
stroke-width: 4px;
|
|
208
|
+
stroke: #008168;
|
|
209
|
+
fill: none;
|
|
210
|
+
animation: countdown 6s linear infinite forwards;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
@keyframes countdown {
|
|
214
|
+
from {
|
|
215
|
+
stroke-dashoffset: 0px;
|
|
216
|
+
}
|
|
217
|
+
to {
|
|
218
|
+
stroke-dashoffset: 113px;
|
|
219
|
+
}
|
|
169
220
|
}
|
|
@@ -9,6 +9,8 @@ export class DashButtonComponent {
|
|
|
9
9
|
this.keycloakUri = "http://localhost:8080";
|
|
10
10
|
this.realm = "";
|
|
11
11
|
this.clientId = "";
|
|
12
|
+
this.appId = "";
|
|
13
|
+
this.portalUrl = "";
|
|
12
14
|
this.keycloak = new Keycloak({
|
|
13
15
|
url: this.keycloakUri,
|
|
14
16
|
realm: this.realm,
|
|
@@ -19,6 +21,33 @@ export class DashButtonComponent {
|
|
|
19
21
|
this.silentCheckSsoRedirectUri = window.location.origin + '/assets/verificar-sso.html';
|
|
20
22
|
}
|
|
21
23
|
;
|
|
24
|
+
componentDidRender() {
|
|
25
|
+
const appIdList = this.appId.replace(/'/g, '').split(',');
|
|
26
|
+
if (this.appId) {
|
|
27
|
+
const appList = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.APP_ID;
|
|
28
|
+
// Check if the user has permission to access the selected application
|
|
29
|
+
if (appIdList.filter(id => appList.includes(id)).length == 0) {
|
|
30
|
+
// Show modal
|
|
31
|
+
const appErrorModal = this.el.shadowRoot.querySelector('#appPermissionErrorModal');
|
|
32
|
+
appErrorModal.style.display = "block";
|
|
33
|
+
// If a redirect URL is provided, show the loading spinner
|
|
34
|
+
if (this.portalUrl) {
|
|
35
|
+
var countdownNumberEl = this.el.shadowRoot.getElementById('countdown-number');
|
|
36
|
+
var countdown = 6;
|
|
37
|
+
countdownNumberEl.textContent = countdown.toString();
|
|
38
|
+
setInterval(() => {
|
|
39
|
+
countdown = --countdown <= 0 ? 6 : countdown;
|
|
40
|
+
countdownNumberEl.textContent = countdown.toString();
|
|
41
|
+
// Once the countdown finishes, redirect to the provided URL
|
|
42
|
+
if (countdown == 1) {
|
|
43
|
+
// appErrorModal.style.display = "none";
|
|
44
|
+
window.location.replace(this.portalUrl.toString());
|
|
45
|
+
}
|
|
46
|
+
}, 1000);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
22
51
|
connectedCallback() {
|
|
23
52
|
this.keycloak.init({
|
|
24
53
|
onLoad: this.authMethod,
|
|
@@ -50,7 +79,7 @@ export class DashButtonComponent {
|
|
|
50
79
|
appModal.style.display = "none";
|
|
51
80
|
}
|
|
52
81
|
render() {
|
|
53
|
-
return h("div", { key: '
|
|
82
|
+
return h("div", { key: '174f38009e4cf79f3922504b3e58cae9480da12f' }, h("div", { key: '98ac40683307425d63dfa07342800fa661dd5dde' }, (() => {
|
|
54
83
|
if (this.isAuth && this.showPostLoginText) {
|
|
55
84
|
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")));
|
|
56
85
|
}
|
|
@@ -60,7 +89,9 @@ export class DashButtonComponent {
|
|
|
60
89
|
else {
|
|
61
90
|
return (h("button", { onClick: this.login.bind(this), id: "login-btn", type: "button", class: "button" }, h("span", { class: "button-text" }, "Login")));
|
|
62
91
|
}
|
|
63
|
-
})()), h("div", { key: '
|
|
92
|
+
})()), h("div", { key: 'a649dabfe9b8390f2b78144af4ee3ca3a5d338d5', id: "appListModal", class: "modal" }, h("div", { key: '23d0ca8f3e3d27e79730bee0421f56c630ae27f7', class: "modal-content" }, h("span", { key: '033f11afb71f4288102cd12b9bc597bacac8fd2e', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("h3", { key: '63a889af82d6967c35066116cf4e12468fd0df26' }, "Applications"), h("div", { key: '3ac459af6d9404b09c54783f049d92b7fe206dfd', class: "modal-app" }, "App 1"), h("div", { key: 'ff78172956914519e61512b124d47f6e5258914c', class: "modal-app" }, "App 2"))), h("div", { key: '60ecbc8a455fe3d3482691d8e4c08d93d48caad3', id: "appPermissionErrorModal", class: "modal" }, h("div", { key: 'f40c0ff8698a44ab27f866f421a937644d32db7b', class: "modal-content" }, h("img", { key: 'c89ba5ac1b5bbd66b198af671bc8d5bfe1ae574a', 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+elXWjoox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GISOZHO6JRnkNiHjzPsY92iGFZoultLNu6OtZs+3m4CCIZnxGpIjGvUsv2UAEUQ9NblrSUoNDDQP4KT+TH2/QWJT/eFgjwNaRnnGHI4x3NzRXZbQ89QBg0GsQ2Wo+SnZR1uFycYbBI3kdv2XEAiw35KqQMGkDoYaCeaDzi29jIuziuYYyVua1jANrFFECTpgCaNAXQpCmAJk0BNGkKoElTACsNUB39ZTFQAMMW/78xypQpU6ZMmbIjP9e+AkAlsBlIjsPOAAAAAElFTkSuQmCC" }), h("h2", { key: 'bacb8e6a87554c057b594ebd082736f4baf660b0', class: "green-text margin-b" }, "You don't have permission to access this application."), h("h3", { key: '21d91222652b96f17a7c9d47f49b8e27769d2900', class: "green-text" }, "Please contact the administration."), this.portalUrl ?
|
|
93
|
+
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" }))))
|
|
94
|
+
: h("div", null))));
|
|
64
95
|
}
|
|
65
96
|
static get is() { return "dash-button"; }
|
|
66
97
|
static get encapsulation() { return "shadow"; }
|
|
@@ -200,6 +231,42 @@ export class DashButtonComponent {
|
|
|
200
231
|
"attribute": "client-id",
|
|
201
232
|
"reflect": false,
|
|
202
233
|
"defaultValue": "\"\""
|
|
234
|
+
},
|
|
235
|
+
"appId": {
|
|
236
|
+
"type": "string",
|
|
237
|
+
"mutable": false,
|
|
238
|
+
"complexType": {
|
|
239
|
+
"original": "string",
|
|
240
|
+
"resolved": "string",
|
|
241
|
+
"references": {}
|
|
242
|
+
},
|
|
243
|
+
"required": false,
|
|
244
|
+
"optional": false,
|
|
245
|
+
"docs": {
|
|
246
|
+
"tags": [],
|
|
247
|
+
"text": ""
|
|
248
|
+
},
|
|
249
|
+
"attribute": "app-id",
|
|
250
|
+
"reflect": false,
|
|
251
|
+
"defaultValue": "\"\""
|
|
252
|
+
},
|
|
253
|
+
"portalUrl": {
|
|
254
|
+
"type": "string",
|
|
255
|
+
"mutable": false,
|
|
256
|
+
"complexType": {
|
|
257
|
+
"original": "string",
|
|
258
|
+
"resolved": "string",
|
|
259
|
+
"references": {}
|
|
260
|
+
},
|
|
261
|
+
"required": false,
|
|
262
|
+
"optional": false,
|
|
263
|
+
"docs": {
|
|
264
|
+
"tags": [],
|
|
265
|
+
"text": ""
|
|
266
|
+
},
|
|
267
|
+
"attribute": "portal-url",
|
|
268
|
+
"reflect": false,
|
|
269
|
+
"defaultValue": "\"\""
|
|
203
270
|
}
|
|
204
271
|
};
|
|
205
272
|
}
|
|
@@ -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;wBAEJ,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,MAAM,GAAG,4BAA4B;;IAJhG,CAAC;IAMJ,iBAAiB;QACb,IAAI,CAAC,QAAQ,CAAC,IAAI,CAChB;YACI,MAAM,EAAE,IAAI,CAAC,UAAU;YACvB,gBAAgB,EAAE,KAAK;YACvB,yBAAyB,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE;SACvF,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YACZ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UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,EAAC,OAAO,aAAe;oBACvE,4EAAqB;oBACrB,4DAAK,KAAK,EAAC,WAAW,YAAY;oBAClC,4DAAK,KAAK,EAAC,WAAW,YAAY,CAC9B,CAEF,CACF,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 @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 connectedCallback() {\n 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 }\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 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\">×</span>\n <h3>Applications</h3>\n <div class=\"modal-app\">App 1</div>\n <div class=\"modal-app\">App 2</div>\n </div>\n \n </div>\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,a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AAyD;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\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 componentDidRender() {\n const appIdList = this.appId.replace(/'/g, '').split(',');\n\n if(this.appId) {\n const appList:Array<string> = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.APP_ID;\n \n // Check if the user has permission to access the selected application\n if(appIdList.filter(id => appList.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 connectedCallback() {\n 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 }\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 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\">×</span>\n <h3>Applications</h3>\n <div class=\"modal-app\">App 1</div>\n <div class=\"modal-app\">App 2</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+jXO4Nun18lj53PuLF2kjmfx1AOa3t2mmt9cAkDxxghauXaPN3l7KxmJlHRgLmKNutzHPTCTCczsa4G4mQ6nWVr7h4WPHaL6trQTc+r17NOf30/iZMzTmdtNwVRWPA2Scm/H56FMgQ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u2Cz6Oj5IymUkTLCOB54iWAKOIaMRE7JXbS/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 ? \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%}.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}";
|
|
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%}.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}.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}}";
|
|
2477
2477
|
const DashButtonStyle0 = dashButtonCss;
|
|
2478
2478
|
|
|
2479
2479
|
const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonComponent extends HTMLElement {
|
|
@@ -2488,6 +2488,8 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
|
|
|
2488
2488
|
this.keycloakUri = "http://localhost:8080";
|
|
2489
2489
|
this.realm = "";
|
|
2490
2490
|
this.clientId = "";
|
|
2491
|
+
this.appId = "";
|
|
2492
|
+
this.portalUrl = "";
|
|
2491
2493
|
this.keycloak = new Keycloak({
|
|
2492
2494
|
url: this.keycloakUri,
|
|
2493
2495
|
realm: this.realm,
|
|
@@ -2498,6 +2500,33 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
|
|
|
2498
2500
|
this.silentCheckSsoRedirectUri = window.location.origin + '/assets/verificar-sso.html';
|
|
2499
2501
|
}
|
|
2500
2502
|
;
|
|
2503
|
+
componentDidRender() {
|
|
2504
|
+
const appIdList = this.appId.replace(/'/g, '').split(',');
|
|
2505
|
+
if (this.appId) {
|
|
2506
|
+
const appList = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.APP_ID;
|
|
2507
|
+
// Check if the user has permission to access the selected application
|
|
2508
|
+
if (appIdList.filter(id => appList.includes(id)).length == 0) {
|
|
2509
|
+
// Show modal
|
|
2510
|
+
const appErrorModal = this.el.shadowRoot.querySelector('#appPermissionErrorModal');
|
|
2511
|
+
appErrorModal.style.display = "block";
|
|
2512
|
+
// If a redirect URL is provided, show the loading spinner
|
|
2513
|
+
if (this.portalUrl) {
|
|
2514
|
+
var countdownNumberEl = this.el.shadowRoot.getElementById('countdown-number');
|
|
2515
|
+
var countdown = 6;
|
|
2516
|
+
countdownNumberEl.textContent = countdown.toString();
|
|
2517
|
+
setInterval(() => {
|
|
2518
|
+
countdown = --countdown <= 0 ? 6 : countdown;
|
|
2519
|
+
countdownNumberEl.textContent = countdown.toString();
|
|
2520
|
+
// Once the countdown finishes, redirect to the provided URL
|
|
2521
|
+
if (countdown == 1) {
|
|
2522
|
+
// appErrorModal.style.display = "none";
|
|
2523
|
+
window.location.replace(this.portalUrl.toString());
|
|
2524
|
+
}
|
|
2525
|
+
}, 1000);
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
}
|
|
2501
2530
|
connectedCallback() {
|
|
2502
2531
|
this.keycloak.init({
|
|
2503
2532
|
onLoad: this.authMethod,
|
|
@@ -2529,7 +2558,7 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
|
|
|
2529
2558
|
appModal.style.display = "none";
|
|
2530
2559
|
}
|
|
2531
2560
|
render() {
|
|
2532
|
-
return h("div", { key: '
|
|
2561
|
+
return h("div", { key: '174f38009e4cf79f3922504b3e58cae9480da12f' }, h("div", { key: '98ac40683307425d63dfa07342800fa661dd5dde' }, (() => {
|
|
2533
2562
|
if (this.isAuth && this.showPostLoginText) {
|
|
2534
2563
|
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")));
|
|
2535
2564
|
}
|
|
@@ -2539,7 +2568,9 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
|
|
|
2539
2568
|
else {
|
|
2540
2569
|
return (h("button", { onClick: this.login.bind(this), id: "login-btn", type: "button", class: "button" }, h("span", { class: "button-text" }, "Login")));
|
|
2541
2570
|
}
|
|
2542
|
-
})()), h("div", { key: '
|
|
2571
|
+
})()), h("div", { key: 'a649dabfe9b8390f2b78144af4ee3ca3a5d338d5', id: "appListModal", class: "modal" }, h("div", { key: '23d0ca8f3e3d27e79730bee0421f56c630ae27f7', class: "modal-content" }, h("span", { key: '033f11afb71f4288102cd12b9bc597bacac8fd2e', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("h3", { key: '63a889af82d6967c35066116cf4e12468fd0df26' }, "Applications"), h("div", { key: '3ac459af6d9404b09c54783f049d92b7fe206dfd', class: "modal-app" }, "App 1"), h("div", { key: 'ff78172956914519e61512b124d47f6e5258914c', class: "modal-app" }, "App 2"))), h("div", { key: '60ecbc8a455fe3d3482691d8e4c08d93d48caad3', id: "appPermissionErrorModal", class: "modal" }, h("div", { key: 'f40c0ff8698a44ab27f866f421a937644d32db7b', class: "modal-content" }, h("img", { key: 'c89ba5ac1b5bbd66b198af671bc8d5bfe1ae574a', 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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29jIuziuYYyVua1jANrFFECTpgCaNAXQpCmAJk0BNGkKoElTACsNUB39ZTFQAMMW/78xypQpU6ZMmbIjP9e+AkAlsBlIjsPOAAAAAElFTkSuQmCC" }), h("h2", { key: 'bacb8e6a87554c057b594ebd082736f4baf660b0', class: "green-text margin-b" }, "You don't have permission to access this application."), h("h3", { key: '21d91222652b96f17a7c9d47f49b8e27769d2900', class: "green-text" }, "Please contact the administration."), this.portalUrl ?
|
|
2572
|
+
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" }))))
|
|
2573
|
+
: h("div", null))));
|
|
2543
2574
|
}
|
|
2544
2575
|
get el() { return this; }
|
|
2545
2576
|
static get style() { return DashButtonStyle0; }
|
|
@@ -2551,6 +2582,8 @@ const DashButtonComponent = /*@__PURE__*/ proxyCustomElement(class DashButtonCom
|
|
|
2551
2582
|
"keycloakUri": [1, "keycloak-uri"],
|
|
2552
2583
|
"realm": [1],
|
|
2553
2584
|
"clientId": [1, "client-id"],
|
|
2585
|
+
"appId": [1, "app-id"],
|
|
2586
|
+
"portalUrl": [1, "portal-url"],
|
|
2554
2587
|
"keycloak": [32],
|
|
2555
2588
|
"isAuth": [32],
|
|
2556
2589
|
"givenName": [32],
|