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

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