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