@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.
@@ -2465,31 +2465,52 @@ 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 id="loading-skeleton-content">
2472
+ <h1>DO I SEE THIS ?</h1>
2473
+ </div>
2474
+ `;
2475
+ console.log(
2476
+ "/////////////////////////////////TESTING//////////////////////////////"
2477
+ );
2478
2478
  const skeletonContainer = document.createElement("div");
2479
2479
  skeletonContainer.id = "loading-skeleton";
2480
2480
  skeletonContainer.innerHTML = skeletonHTML;
2481
- if (!this.shadowRoot) {
2482
- this.attachShadow({ mode: "open" });
2483
- }
2484
- if (this.shadowRoot) {
2485
- this.shadowRoot.innerHTML = skeletonHTML;
2481
+ skeletonContainer.style.width = "100%";
2482
+ const root = this.shadowRoot || this.attachShadow({ mode: "open" });
2483
+ if (root.firstChild) {
2484
+ root.insertBefore(skeletonContainer, root.firstChild);
2485
+ } else {
2486
+ root.appendChild(skeletonContainer);
2486
2487
  }
2487
- await this.renderWidget();
2488
- const loadingElement = (_a2 = this.shadowRoot) == null ? void 0 : _a2.getElementById("loading-skeleton");
2489
- if (loadingElement) {
2490
- loadingElement.remove();
2488
+ const removeSkeleton = () => {
2489
+ const el = root.getElementById("loading-skeleton");
2490
+ if (el) {
2491
+ el.remove();
2492
+ console.log("Skeleton removed successfully via event");
2493
+ }
2494
+ };
2495
+ this.addEventListener("sq:load", removeSkeleton);
2496
+ try {
2497
+ await this.renderWidget();
2498
+ console.log("Widget rendered (initialization complete)");
2499
+ setTimeout(() => {
2500
+ const el = root.getElementById("loading-skeleton");
2501
+ if (el) {
2502
+ console.warn("Removing skeleton via timeout (load event missing)");
2503
+ el.remove();
2504
+ }
2505
+ }, 5e3);
2506
+ } catch (err) {
2507
+ console.error("Critical Error in renderWidget:", err);
2508
+ removeSkeleton();
2491
2509
  }
2492
2510
  if (this.getAttribute("open") !== null) this.open();
2511
+ console.log(
2512
+ "/////////////////////////////////DO YOU SEE THIS CONSOLE LOG????//////////////////////////////"
2513
+ );
2493
2514
  }
2494
2515
  }
2495
2516
  class DeclarativePopupWidget extends DeclarativeWidget {
@@ -2519,9 +2540,7 @@ class DeclarativePopupWidget extends DeclarativeWidget {
2519
2540
  this.container = this.getAttribute("container");
2520
2541
  const skeletonHTML = `
2521
2542
  <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>
2543
+ <h1>DO I SEE THIS ?</h1>
2525
2544
  </div>
2526
2545
  `;
2527
2546
  console.log(