@saasquatch/squatch-js 2.8.2-12 → 2.8.2-14

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.
@@ -2465,27 +2465,21 @@ class DeclarativeEmbedWidget extends DeclarativeWidget {
2465
2465
  }
2466
2466
  }
2467
2467
  async connectedCallback() {
2468
- var _a2;
2469
2468
  this.loaded = true;
2470
2469
  this.container = this.getAttribute("container");
2471
2470
  const skeletonHTML = `
2472
- <div>
2473
- <h1>Dynamic Content</h1>
2474
- <p>This content was dynamically added to the widget before it loaded.</p>
2475
- <p>This content comes from the embeded widget class</p>
2476
- </div>
2477
- `;
2471
+ <div>
2472
+ <h1>Do I see this text ????</h1>
2473
+ </div>
2474
+ `;
2478
2475
  const skeletonContainer = document.createElement("div");
2479
2476
  skeletonContainer.id = "loading-skeleton";
2480
2477
  skeletonContainer.innerHTML = skeletonHTML;
2481
- if (!this.shadowRoot) {
2482
- this.attachShadow({ mode: "open" });
2483
- }
2484
- if (this.shadowRoot) {
2485
- this.shadowRoot.innerHTML = skeletonHTML;
2486
- }
2478
+ const root = this.shadowRoot || this.attachShadow({ mode: "open" });
2479
+ root.innerHTML = "";
2480
+ root.appendChild(skeletonContainer);
2487
2481
  await this.renderWidget();
2488
- const loadingElement = (_a2 = this.shadowRoot) == null ? void 0 : _a2.getElementById("loading-skeleton");
2482
+ const loadingElement = root.getElementById("loading-skeleton");
2489
2483
  if (loadingElement) {
2490
2484
  loadingElement.remove();
2491
2485
  }
@@ -2515,54 +2509,30 @@ class DeclarativePopupWidget extends DeclarativeWidget {
2515
2509
  }
2516
2510
  }
2517
2511
  async connectedCallback() {
2512
+ var _a2;
2518
2513
  this.loaded = true;
2519
2514
  this.container = this.getAttribute("container");
2520
2515
  const skeletonHTML = `
2521
- <div id="loading-skeleton-content">
2522
- <h1>Dynamic Content</h1>
2523
- <p>This content was dynamically added to the widget before it loaded.</p>
2524
- <p>This content comes from the embedded widget class</p>
2525
- </div>
2526
- `;
2527
- console.log(
2528
- "/////////////////////////////////TESTING//////////////////////////////"
2529
- );
2516
+ <div>
2517
+ <h1>Dynamic Content</h1>
2518
+ <p>This content was dynamically added to the widget before it loaded.</p>
2519
+ </div>
2520
+ `;
2530
2521
  const skeletonContainer = document.createElement("div");
2531
2522
  skeletonContainer.id = "loading-skeleton";
2532
2523
  skeletonContainer.innerHTML = skeletonHTML;
2533
- skeletonContainer.style.width = "100%";
2534
- const root = this.shadowRoot || this.attachShadow({ mode: "open" });
2535
- if (root.firstChild) {
2536
- root.insertBefore(skeletonContainer, root.firstChild);
2537
- } else {
2538
- root.appendChild(skeletonContainer);
2524
+ if (!this.shadowRoot) {
2525
+ this.attachShadow({ mode: "open" });
2539
2526
  }
2540
- const removeSkeleton = () => {
2541
- const el = root.getElementById("loading-skeleton");
2542
- if (el) {
2543
- el.remove();
2544
- console.log("Skeleton removed successfully via event");
2545
- }
2546
- };
2547
- this.addEventListener("sq:load", removeSkeleton);
2548
- try {
2549
- await this.renderWidget();
2550
- console.log("Widget rendered (initialization complete)");
2551
- setTimeout(() => {
2552
- const el = root.getElementById("loading-skeleton");
2553
- if (el) {
2554
- console.warn("Removing skeleton via timeout (load event missing)");
2555
- el.remove();
2556
- }
2557
- }, 5e3);
2558
- } catch (err) {
2559
- console.error("Critical Error in renderWidget:", err);
2560
- removeSkeleton();
2527
+ if (this.shadowRoot) {
2528
+ this.shadowRoot.innerHTML = skeletonHTML;
2529
+ }
2530
+ await this.renderWidget();
2531
+ const loadingElement = (_a2 = this.shadowRoot) == null ? void 0 : _a2.getElementById("loading-skeleton");
2532
+ if (loadingElement) {
2533
+ loadingElement.remove();
2561
2534
  }
2562
2535
  if (this.getAttribute("open") !== null) this.open();
2563
- console.log(
2564
- "/////////////////////////////////DO YOU SEE THIS CONSOLE LOG????//////////////////////////////"
2565
- );
2566
2536
  }
2567
2537
  }
2568
2538
  class SquatchEmbed extends DeclarativeEmbedWidget {