@saasquatch/squatch-js 2.8.2-25 → 2.8.2-26

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.
@@ -2219,7 +2219,7 @@ function decodeUserJwt(tokenStr) {
2219
2219
  }
2220
2220
  const _log$1 = debug("squatch-js:DeclarativeWidget");
2221
2221
  class DeclarativeWidget extends HTMLElement {
2222
- constructor() {
2222
+ constructor(res) {
2223
2223
  super();
2224
2224
  /**
2225
2225
  * Configuration overrides
@@ -2266,6 +2266,7 @@ class DeclarativeWidget extends HTMLElement {
2266
2266
  */
2267
2267
  __publicField(this, "container");
2268
2268
  __publicField(this, "element");
2269
+ __publicField(this, "widgetConfig");
2269
2270
  /**
2270
2271
  * Flag for if the component has been loaded or not
2271
2272
  * @hidden
@@ -2329,6 +2330,7 @@ class DeclarativeWidget extends HTMLElement {
2329
2330
  this.config = getConfig();
2330
2331
  this.token = getToken();
2331
2332
  this.tenant = window.squatchTenant;
2333
+ this.widgetConfig = res.widgetConfig;
2332
2334
  this.container = this;
2333
2335
  }
2334
2336
  _setupApis(config) {
@@ -2419,8 +2421,8 @@ class DeclarativeWidget extends HTMLElement {
2419
2421
  }
2420
2422
  }
2421
2423
  class DeclarativeEmbedWidget extends DeclarativeWidget {
2422
- constructor() {
2423
- super();
2424
+ constructor(res) {
2425
+ super(res);
2424
2426
  this.type = "EMBED";
2425
2427
  this.loaded = false;
2426
2428
  }
@@ -2439,6 +2441,8 @@ class DeclarativeEmbedWidget extends DeclarativeWidget {
2439
2441
  async connectedCallback() {
2440
2442
  this.loaded = true;
2441
2443
  this.container = this.getAttribute("container");
2444
+ const brandingConfig = this.widgetConfig.values.brandingConfig;
2445
+ console.log("THIS IS THE BRANDING CONFIG", brandingConfig);
2442
2446
  const skeletonHTML = getSkeleton({ height: "100%" });
2443
2447
  const skeletonContainer = document.createElement("div");
2444
2448
  skeletonContainer.id = "loading-skeleton";
@@ -2455,8 +2459,8 @@ class DeclarativeEmbedWidget extends DeclarativeWidget {
2455
2459
  }
2456
2460
  }
2457
2461
  class DeclarativePopupWidget extends DeclarativeWidget {
2458
- constructor() {
2459
- super();
2462
+ constructor(res) {
2463
+ super(res);
2460
2464
  this.type = "POPUP";
2461
2465
  this.loaded = false;
2462
2466
  this.addEventListener("click", (e) => {
@@ -2477,26 +2481,17 @@ class DeclarativePopupWidget extends DeclarativeWidget {
2477
2481
  }
2478
2482
  }
2479
2483
  async connectedCallback() {
2480
- var _a2;
2481
2484
  this.loaded = true;
2482
2485
  this.container = this.getAttribute("container");
2483
- const skeletonHTML = `
2484
- <div>
2485
- <h1>Dynamic Content</h1>
2486
- <p>This content was dynamically added to the widget before it loaded.</p>
2487
- </div>
2488
- `;
2486
+ const skeletonHTML = getSkeleton({ height: "100%" });
2489
2487
  const skeletonContainer = document.createElement("div");
2490
2488
  skeletonContainer.id = "loading-skeleton";
2491
2489
  skeletonContainer.innerHTML = skeletonHTML;
2492
- if (!this.shadowRoot) {
2493
- this.attachShadow({ mode: "open" });
2494
- }
2495
- if (this.shadowRoot) {
2496
- this.shadowRoot.innerHTML = skeletonHTML;
2497
- }
2490
+ const root = this.shadowRoot || this.attachShadow({ mode: "open" });
2491
+ root.innerHTML = "";
2492
+ root.appendChild(skeletonContainer);
2498
2493
  await this.renderWidget();
2499
- const loadingElement = (_a2 = this.shadowRoot) == null ? void 0 : _a2.getElementById("loading-skeleton");
2494
+ const loadingElement = root.getElementById("loading-skeleton");
2500
2495
  if (loadingElement) {
2501
2496
  loadingElement.remove();
2502
2497
  }