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