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