@saasquatch/squatch-js 2.8.2-13 → 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.
package/dist/squatch.js CHANGED
@@ -2470,49 +2470,22 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2470
2470
  this.loaded = true;
2471
2471
  this.container = this.getAttribute("container");
2472
2472
  const skeletonHTML = `
2473
- <div id="loading-skeleton-content">
2474
- <h1>DO I SEE THIS ?</h1>
2473
+ <div>
2474
+ <h1>Do I see this text ????</h1>
2475
2475
  </div>
2476
2476
  `;
2477
- console.log(
2478
- "/////////////////////////////////TESTING//////////////////////////////"
2479
- );
2480
2477
  const skeletonContainer = document.createElement("div");
2481
2478
  skeletonContainer.id = "loading-skeleton";
2482
2479
  skeletonContainer.innerHTML = skeletonHTML;
2483
- skeletonContainer.style.width = "100%";
2484
2480
  const root = this.shadowRoot || this.attachShadow({ mode: "open" });
2485
- if (root.firstChild) {
2486
- root.insertBefore(skeletonContainer, root.firstChild);
2487
- } else {
2488
- root.appendChild(skeletonContainer);
2489
- }
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();
2481
+ root.innerHTML = "";
2482
+ root.appendChild(skeletonContainer);
2483
+ await this.renderWidget();
2484
+ const loadingElement = root.getElementById("loading-skeleton");
2485
+ if (loadingElement) {
2486
+ loadingElement.remove();
2511
2487
  }
2512
2488
  if (this.getAttribute("open") !== null) this.open();
2513
- console.log(
2514
- "/////////////////////////////////DO YOU SEE THIS CONSOLE LOG????//////////////////////////////"
2515
- );
2516
2489
  }
2517
2490
  }
2518
2491
  class DeclarativePopupWidget extends DeclarativeWidget {
@@ -2538,52 +2511,30 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2538
2511
  }
2539
2512
  }
2540
2513
  async connectedCallback() {
2514
+ var _a2;
2541
2515
  this.loaded = true;
2542
2516
  this.container = this.getAttribute("container");
2543
2517
  const skeletonHTML = `
2544
- <div id="loading-skeleton-content">
2545
- <h1>DO I SEE THIS ?</h1>
2546
- </div>
2547
- `;
2548
- console.log(
2549
- "/////////////////////////////////TESTING//////////////////////////////"
2550
- );
2518
+ <div>
2519
+ <h1>Dynamic Content</h1>
2520
+ <p>This content was dynamically added to the widget before it loaded.</p>
2521
+ </div>
2522
+ `;
2551
2523
  const skeletonContainer = document.createElement("div");
2552
2524
  skeletonContainer.id = "loading-skeleton";
2553
2525
  skeletonContainer.innerHTML = skeletonHTML;
2554
- skeletonContainer.style.width = "100%";
2555
- const root = this.shadowRoot || this.attachShadow({ mode: "open" });
2556
- if (root.firstChild) {
2557
- root.insertBefore(skeletonContainer, root.firstChild);
2558
- } else {
2559
- root.appendChild(skeletonContainer);
2526
+ if (!this.shadowRoot) {
2527
+ this.attachShadow({ mode: "open" });
2560
2528
  }
2561
- const removeSkeleton = () => {
2562
- const el = root.getElementById("loading-skeleton");
2563
- if (el) {
2564
- el.remove();
2565
- console.log("Skeleton removed successfully via event");
2566
- }
2567
- };
2568
- this.addEventListener("sq:load", removeSkeleton);
2569
- try {
2570
- await this.renderWidget();
2571
- console.log("Widget rendered (initialization complete)");
2572
- setTimeout(() => {
2573
- const el = root.getElementById("loading-skeleton");
2574
- if (el) {
2575
- console.warn("Removing skeleton via timeout (load event missing)");
2576
- el.remove();
2577
- }
2578
- }, 5e3);
2579
- } catch (err) {
2580
- console.error("Critical Error in renderWidget:", err);
2581
- removeSkeleton();
2529
+ if (this.shadowRoot) {
2530
+ this.shadowRoot.innerHTML = skeletonHTML;
2531
+ }
2532
+ await this.renderWidget();
2533
+ const loadingElement = (_a2 = this.shadowRoot) == null ? void 0 : _a2.getElementById("loading-skeleton");
2534
+ if (loadingElement) {
2535
+ loadingElement.remove();
2582
2536
  }
2583
2537
  if (this.getAttribute("open") !== null) this.open();
2584
- console.log(
2585
- "/////////////////////////////////DO YOU SEE THIS CONSOLE LOG????//////////////////////////////"
2586
- );
2587
2538
  }
2588
2539
  }
2589
2540
  class SquatchEmbed extends DeclarativeEmbedWidget {