@saasquatch/squatch-js 2.8.2-24 → 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.
@@ -1879,10 +1879,7 @@ const getSkeleton = ({
1879
1879
  .widget-container {
1880
1880
  background: white;
1881
1881
  width: 100%;
1882
- max-width: 900px;
1883
1882
  padding: 40px;
1884
- border-radius: 12px;
1885
- box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
1886
1883
  box-sizing: border-box;
1887
1884
  }
1888
1885
 
@@ -2222,7 +2219,7 @@ function decodeUserJwt(tokenStr) {
2222
2219
  }
2223
2220
  const _log$1 = debug("squatch-js:DeclarativeWidget");
2224
2221
  class DeclarativeWidget extends HTMLElement {
2225
- constructor() {
2222
+ constructor(res) {
2226
2223
  super();
2227
2224
  /**
2228
2225
  * Configuration overrides
@@ -2269,6 +2266,7 @@ class DeclarativeWidget extends HTMLElement {
2269
2266
  */
2270
2267
  __publicField(this, "container");
2271
2268
  __publicField(this, "element");
2269
+ __publicField(this, "widgetConfig");
2272
2270
  /**
2273
2271
  * Flag for if the component has been loaded or not
2274
2272
  * @hidden
@@ -2332,6 +2330,7 @@ class DeclarativeWidget extends HTMLElement {
2332
2330
  this.config = getConfig();
2333
2331
  this.token = getToken();
2334
2332
  this.tenant = window.squatchTenant;
2333
+ this.widgetConfig = res.widgetConfig;
2335
2334
  this.container = this;
2336
2335
  }
2337
2336
  _setupApis(config) {
@@ -2422,8 +2421,8 @@ class DeclarativeWidget extends HTMLElement {
2422
2421
  }
2423
2422
  }
2424
2423
  class DeclarativeEmbedWidget extends DeclarativeWidget {
2425
- constructor() {
2426
- super();
2424
+ constructor(res) {
2425
+ super(res);
2427
2426
  this.type = "EMBED";
2428
2427
  this.loaded = false;
2429
2428
  }
@@ -2442,6 +2441,8 @@ class DeclarativeEmbedWidget extends DeclarativeWidget {
2442
2441
  async connectedCallback() {
2443
2442
  this.loaded = true;
2444
2443
  this.container = this.getAttribute("container");
2444
+ const brandingConfig = this.widgetConfig.values.brandingConfig;
2445
+ console.log("THIS IS THE BRANDING CONFIG", brandingConfig);
2445
2446
  const skeletonHTML = getSkeleton({ height: "100%" });
2446
2447
  const skeletonContainer = document.createElement("div");
2447
2448
  skeletonContainer.id = "loading-skeleton";
@@ -2458,8 +2459,8 @@ class DeclarativeEmbedWidget extends DeclarativeWidget {
2458
2459
  }
2459
2460
  }
2460
2461
  class DeclarativePopupWidget extends DeclarativeWidget {
2461
- constructor() {
2462
- super();
2462
+ constructor(res) {
2463
+ super(res);
2463
2464
  this.type = "POPUP";
2464
2465
  this.loaded = false;
2465
2466
  this.addEventListener("click", (e) => {
@@ -2480,26 +2481,17 @@ class DeclarativePopupWidget extends DeclarativeWidget {
2480
2481
  }
2481
2482
  }
2482
2483
  async connectedCallback() {
2483
- var _a2;
2484
2484
  this.loaded = true;
2485
2485
  this.container = this.getAttribute("container");
2486
- const skeletonHTML = `
2487
- <div>
2488
- <h1>Dynamic Content</h1>
2489
- <p>This content was dynamically added to the widget before it loaded.</p>
2490
- </div>
2491
- `;
2486
+ const skeletonHTML = getSkeleton({ height: "100%" });
2492
2487
  const skeletonContainer = document.createElement("div");
2493
2488
  skeletonContainer.id = "loading-skeleton";
2494
2489
  skeletonContainer.innerHTML = skeletonHTML;
2495
- if (!this.shadowRoot) {
2496
- this.attachShadow({ mode: "open" });
2497
- }
2498
- if (this.shadowRoot) {
2499
- this.shadowRoot.innerHTML = skeletonHTML;
2500
- }
2490
+ const root = this.shadowRoot || this.attachShadow({ mode: "open" });
2491
+ root.innerHTML = "";
2492
+ root.appendChild(skeletonContainer);
2501
2493
  await this.renderWidget();
2502
- const loadingElement = (_a2 = this.shadowRoot) == null ? void 0 : _a2.getElementById("loading-skeleton");
2494
+ const loadingElement = root.getElementById("loading-skeleton");
2503
2495
  if (loadingElement) {
2504
2496
  loadingElement.remove();
2505
2497
  }