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