dash-button-web 0.0.1 → 0.0.2

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.
@@ -2482,6 +2482,7 @@ const DashButtonComponent = class {
2482
2482
  this.showPostLoginText = false;
2483
2483
  this.silentCheckSso = false;
2484
2484
  this.redirectUri = undefined;
2485
+ this.authMethod = "check-sso";
2485
2486
  this.keycloakUri = "http://localhost:8080";
2486
2487
  this.realm = "";
2487
2488
  this.clientId = "";
@@ -2497,13 +2498,14 @@ const DashButtonComponent = class {
2497
2498
  ;
2498
2499
  connectedCallback() {
2499
2500
  this.keycloak.init({
2500
- onLoad: 'check-sso',
2501
+ onLoad: this.authMethod,
2501
2502
  checkLoginIframe: false,
2502
2503
  silentCheckSsoRedirectUri: this.silentCheckSso ? this.silentCheckSsoRedirectUri : '',
2503
2504
  }).then(res => {
2504
2505
  if (res) {
2505
2506
  this.isAuth = true;
2506
2507
  localStorage.setItem("keycloak", JSON.stringify(this.keycloak));
2508
+ document.cookie = "ZDZW_cookie=" + JSON.parse(localStorage.getItem('keycloak')).token;
2507
2509
  this.givenName = JSON.parse(localStorage.getItem('keycloak')).idTokenParsed.given_name;
2508
2510
  }
2509
2511
  });
@@ -2513,6 +2515,7 @@ const DashButtonComponent = class {
2513
2515
  }
2514
2516
  logout() {
2515
2517
  localStorage.removeItem("keycloak");
2518
+ document.cookie = "ZDZW_cookie=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
2516
2519
  this.keycloak.logout();
2517
2520
  }
2518
2521
  showModal() {
@@ -2524,7 +2527,7 @@ const DashButtonComponent = class {
2524
2527
  appModal.style.display = "none";
2525
2528
  }
2526
2529
  render() {
2527
- return h("div", { key: '29a7944051bce29ea8ff3f1db8f2b44b5a157e84' }, h("div", { key: 'a44011e412f06a00bca1a6de134391cc1eb248c2' }, (() => {
2530
+ return h("div", { key: '46065686f61e27894acf13494d479f8e14ae440a' }, h("div", { key: 'fb795b6cab0e9a57ee9ddfc6a6ab69796de02d94' }, (() => {
2528
2531
  if (this.isAuth && this.showPostLoginText) {
2529
2532
  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")));
2530
2533
  }
@@ -2534,7 +2537,7 @@ const DashButtonComponent = class {
2534
2537
  else {
2535
2538
  return (h("button", { onClick: this.login.bind(this), id: "login-btn", type: "button", class: "button" }, h("span", { class: "button-text" }, "Login")));
2536
2539
  }
2537
- })()), h("div", { key: '475cbe51090c78848032e9044c9f11e460969121', id: "appListModal", class: "modal" }, h("div", { key: 'e0a2a1ffa3de0d45001f40fb46d258ade64dc933', class: "modal-content" }, h("span", { key: '5fa70d2fcac6816d9a9ee41c329bd9c787014cbb', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("h3", { key: 'de74b78ba75d815758e0d7c68474d7cdb7673ae7' }, "Applications"), h("div", { key: '1ed88b256cb82aef902f08179e24cbd0be810bd9', class: "modal-app" }, "App 1"), h("div", { key: 'e3e32a260fa06452fb38e64e4593cae1d8530c7b', class: "modal-app" }, "App 2"))));
2540
+ })()), h("div", { key: 'f64fc2082e07f576df4cff7d71453c8f18a4347e', id: "appListModal", class: "modal" }, h("div", { key: '9753fff951bd9719bb39db00cf99861dc1caeb2e', class: "modal-content" }, h("span", { key: 'f1a1ba93614473a498cf7f43d1ed1d2814a77df3', onClick: this.closeModal.bind(this), class: "close" }, "\u00D7"), h("h3", { key: '14a85f33052086fb9597a507789d145bec9cd076' }, "Applications"), h("div", { key: 'd323ba9ca8504ac36668c78c6c23c53dd695a6ac', class: "modal-app" }, "App 1"), h("div", { key: 'c1391a3b447aec37d81a723821ea28922a2cbaa4', class: "modal-app" }, "App 2"))));
2538
2541
  }
2539
2542
  get el() { return getElement(this); }
2540
2543
  };