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