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

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.
@@ -2463,31 +2463,52 @@ class DeclarativeEmbedWidget extends DeclarativeWidget {
2463
2463
  }
2464
2464
  }
2465
2465
  async connectedCallback() {
2466
- var _a2;
2467
2466
  this.loaded = true;
2468
2467
  this.container = this.getAttribute("container");
2469
2468
  const skeletonHTML = `
2470
- <div>
2471
- <h1>Dynamic Content</h1>
2472
- <p>This content was dynamically added to the widget before it loaded.</p>
2473
- <p>This content comes from the embeded widget class</p>
2474
- </div>
2475
- `;
2469
+ <div id="loading-skeleton-content">
2470
+ <h1>DO I SEE THIS ?</h1>
2471
+ </div>
2472
+ `;
2473
+ console.log(
2474
+ "/////////////////////////////////TESTING//////////////////////////////"
2475
+ );
2476
2476
  const skeletonContainer = document.createElement("div");
2477
2477
  skeletonContainer.id = "loading-skeleton";
2478
2478
  skeletonContainer.innerHTML = skeletonHTML;
2479
- if (!this.shadowRoot) {
2480
- this.attachShadow({ mode: "open" });
2481
- }
2482
- if (this.shadowRoot) {
2483
- this.shadowRoot.innerHTML = skeletonHTML;
2479
+ skeletonContainer.style.width = "100%";
2480
+ const root = this.shadowRoot || this.attachShadow({ mode: "open" });
2481
+ if (root.firstChild) {
2482
+ root.insertBefore(skeletonContainer, root.firstChild);
2483
+ } else {
2484
+ root.appendChild(skeletonContainer);
2484
2485
  }
2485
- await this.renderWidget();
2486
- const loadingElement = (_a2 = this.shadowRoot) == null ? void 0 : _a2.getElementById("loading-skeleton");
2487
- if (loadingElement) {
2488
- loadingElement.remove();
2486
+ const removeSkeleton = () => {
2487
+ const el = root.getElementById("loading-skeleton");
2488
+ if (el) {
2489
+ el.remove();
2490
+ console.log("Skeleton removed successfully via event");
2491
+ }
2492
+ };
2493
+ this.addEventListener("sq:load", removeSkeleton);
2494
+ try {
2495
+ await this.renderWidget();
2496
+ console.log("Widget rendered (initialization complete)");
2497
+ setTimeout(() => {
2498
+ const el = root.getElementById("loading-skeleton");
2499
+ if (el) {
2500
+ console.warn("Removing skeleton via timeout (load event missing)");
2501
+ el.remove();
2502
+ }
2503
+ }, 5e3);
2504
+ } catch (err) {
2505
+ console.error("Critical Error in renderWidget:", err);
2506
+ removeSkeleton();
2489
2507
  }
2490
2508
  if (this.getAttribute("open") !== null) this.open();
2509
+ console.log(
2510
+ "/////////////////////////////////DO YOU SEE THIS CONSOLE LOG????//////////////////////////////"
2511
+ );
2491
2512
  }
2492
2513
  }
2493
2514
  class DeclarativePopupWidget extends DeclarativeWidget {
@@ -2517,9 +2538,7 @@ class DeclarativePopupWidget extends DeclarativeWidget {
2517
2538
  this.container = this.getAttribute("container");
2518
2539
  const skeletonHTML = `
2519
2540
  <div id="loading-skeleton-content">
2520
- <h1>Dynamic Content</h1>
2521
- <p>This content was dynamically added to the widget before it loaded.</p>
2522
- <p>This content comes from the embedded widget class</p>
2541
+ <h1>DO I SEE THIS ?</h1>
2523
2542
  </div>
2524
2543
  `;
2525
2544
  console.log(