@saasquatch/squatch-js 2.8.2-32 → 2.8.2-33

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.
@@ -1236,462 +1236,148 @@ class EmbedWidget extends Widget {
1236
1236
  return isVerified && (noContainer || isComponent);
1237
1237
  }
1238
1238
  }
1239
- const getSkeleton = ({
1240
- type = "verified-access",
1241
- height = "500px",
1242
- skeletonBackgroundColor = "#e0e0e0",
1243
- skeletonShimmerColor = "#f5f5f5"
1244
- }) => {
1245
- const referrerHTML = `
1246
- <div class="hero-section">
1247
- <div class="hero-content">
1248
- <div class="skeleton sk-title-lg"></div>
1249
- <div class="skeleton sk-text"></div>
1250
- <div class="skeleton sk-text sk-text-short"></div>
1251
- </div>
1252
- <div class="skeleton hero-image"></div>
1253
- </div>
1254
-
1255
- <div class="share-section">
1256
- <div class="skeleton sk-label"></div>
1257
- <div class="skeleton sk-input"></div>
1258
- <div class="social-buttons">
1259
- <div class="skeleton sk-btn-social"></div>
1260
- <div class="skeleton sk-btn-social"></div>
1261
- <div class="skeleton sk-btn-social"></div>
1262
- <div class="skeleton sk-btn-social"></div>
1263
- </div>
1264
- </div>
1265
-
1266
- <div class="skeleton sk-title-md" style="margin-top: 0; width: 30%; margin-left: auto; margin-right: auto"></div>
1267
- <div class="skeleton sk-text" style="width: 60%; margin-left: auto; margin-right: auto"></div>
1268
-
1269
- <div class="stats-section">
1270
- <div class="stat-card">
1271
- <div class="skeleton sk-stat-num"></div>
1272
- <div class="skeleton sk-stat-label"></div>
1273
- </div>
1274
- <div class="stat-card stat-divider">
1275
- <div class="skeleton sk-stat-num"></div>
1276
- <div class="skeleton sk-stat-label"></div>
1277
- </div>
1278
- </div>
1279
-
1280
- <div class="skeleton sk-title-md"></div>
1281
-
1282
- <div class="table-header">
1283
- <div class="skeleton sk-th col-user"></div>
1284
- <div class="skeleton sk-th col-status"></div>
1285
- <div class="skeleton sk-th col-reward"></div>
1286
- <div class="skeleton sk-th col-date"></div>
1287
- </div>
1288
-
1289
- <div class="table-row">
1290
- <div class="col-user"><div class="skeleton sk-text" style="width: 70%; margin: 0"></div></div>
1291
- <div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
1292
- <div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
1293
- <div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
1294
- </div>
1295
-
1296
- <div class="table-row">
1297
- <div class="col-user"><div class="skeleton sk-text" style="width: 60%; margin: 0"></div></div>
1298
- <div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
1299
- <div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
1300
- <div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
1301
- </div>
1302
-
1303
- <div class="table-row">
1304
- <div class="col-user"><div class="skeleton sk-text" style="width: 75%; margin: 0"></div></div>
1305
- <div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
1306
- <div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
1307
- <div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
1308
- </div>
1309
-
1310
- <div class="pagination">
1311
- <div class="skeleton sk-btn-page"></div>
1312
- <div class="skeleton sk-btn-page"></div>
1313
- </div>
1314
- `;
1315
- const instantAccessHTML = `
1316
- <div class="hero-section instant-access-layout">
1317
- <div class="skeleton hero-image ia-image"></div>
1318
-
1319
- <div class="hero-content ia-content">
1320
- <div class="skeleton sk-title-lg ia-center"></div>
1321
- <div class="skeleton sk-text ia-center"></div>
1322
-
1323
- <div class="skeleton sk-btn-action"></div>
1324
-
1325
- <div class="skeleton sk-label"></div>
1326
- <div class="input-group">
1327
- <div class="skeleton sk-input"></div>
1328
- <div class="skeleton sk-btn-copy"></div>
1329
- </div>
1330
-
1331
- <div class="skeleton sk-text-short ia-center" style="margin-top: 20px; width: 30%"></div>
1332
- <div class="skeleton sk-text-short ia-center" style="width: 20%"></div>
1333
- </div>
1334
- </div>
1335
- `;
1336
- return `
1239
+ const _log$6 = browserExports.debug("squatch-js:POPUPwidget");
1240
+ let popupId = 0;
1241
+ class PopupWidget extends Widget {
1242
+ constructor(params, trigger = ".squatchpop") {
1243
+ super(params);
1244
+ __publicField(this, "trigger");
1245
+ __publicField(this, "id");
1246
+ __publicField(this, "show", this.open);
1247
+ __publicField(this, "hide", this.close);
1248
+ this.trigger = trigger;
1249
+ if (this.container) {
1250
+ this.id = "squatchModal";
1251
+ } else {
1252
+ this.id = popupId === 0 ? `squatchModal` : `squatchModal__${popupId}`;
1253
+ popupId = popupId + 1;
1254
+ }
1255
+ document.head.insertAdjacentHTML(
1256
+ "beforeend",
1257
+ `<style>#${this.id}::-webkit-scrollbar { display: none; }</style>`
1258
+ );
1259
+ }
1260
+ _initialiseCTA() {
1261
+ if (!this.trigger) return;
1262
+ let triggerElement;
1263
+ try {
1264
+ triggerElement = document.querySelector(this.trigger) || document.querySelector(".impactpop");
1265
+ if (this.trigger && !triggerElement)
1266
+ _log$6("No element found with trigger selector", this.trigger);
1267
+ } catch {
1268
+ _log$6("Not a valid selector", this.trigger);
1269
+ }
1270
+ if (triggerElement) {
1271
+ triggerElement.onclick = () => {
1272
+ this.open();
1273
+ };
1274
+ }
1275
+ }
1276
+ _createPopupDialog() {
1277
+ var _a2, _b, _c;
1278
+ const dialog = document.createElement("dialog");
1279
+ const brandingConfig = (_b = (_a2 = this.context.widgetConfig) == null ? void 0 : _a2.values) == null ? void 0 : _b.brandingConfig;
1280
+ const sizes = (_c = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _c.popupWidgets;
1281
+ const minWidth = (sizes == null ? void 0 : sizes.minWidth) ? formatWidth(sizes.minWidth) : "auto";
1282
+ const maxWidth = (sizes == null ? void 0 : sizes.maxWidth) ? formatWidth(sizes.maxWidth) : "500px";
1283
+ dialog.id = this.id;
1284
+ dialog.setAttribute(
1285
+ "style",
1286
+ `width: 100%; min-width: ${minWidth}; max-width: ${maxWidth}; border: none; padding: 0;`
1287
+ );
1288
+ const onClick = (e) => {
1289
+ e.stopPropagation();
1290
+ if (e.target === dialog) dialog.close();
1291
+ };
1292
+ dialog.addEventListener("click", onClick);
1293
+ return dialog;
1294
+ }
1295
+ async load() {
1296
+ var _a2;
1297
+ const frame = this._createFrame();
1298
+ this._initialiseCTA();
1299
+ const element = this.container ? this._findElement() : document.body;
1300
+ const dialogParent = element.shadowRoot || element;
1301
+ const dialog = this._createPopupDialog();
1302
+ dialog.appendChild(frame);
1303
+ if (((_a2 = dialogParent.lastChild) == null ? void 0 : _a2.nodeName) === "DIALOG") {
1304
+ dialogParent.replaceChild(dialog, dialogParent.lastChild);
1305
+ } else {
1306
+ dialogParent.appendChild(dialog);
1307
+ }
1308
+ const { contentWindow } = frame;
1309
+ if (!contentWindow) {
1310
+ throw new Error("Frame needs a content window");
1311
+ }
1312
+ const frameDoc = contentWindow.document;
1313
+ frameDoc.open();
1314
+ frameDoc.write(this.content);
1315
+ frameDoc.write(
1316
+ `<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>`
1317
+ );
1318
+ frameDoc.write(`
1337
1319
  <style>
1338
- * {
1339
- box-sizing: border-box;
1340
- padding: 0;
1341
- margin: 0;
1342
- }
1343
-
1344
- .widget-container {
1345
- background: white;
1346
- width: 100%;
1347
- padding: 40px;
1348
- box-sizing: border-box;
1349
- overflow: hidden;
1350
- }
1351
-
1352
- @keyframes shimmer {
1353
- 0% { background-position: -100% 0; }
1354
- 100% { background-position: 100% 0; }
1320
+ body {
1321
+ height: 600px;
1322
+ border: 2px solid #ccc;
1323
+ background-color: #f9f9f9;
1324
+ margin: 0;
1325
+ padding: 0;
1326
+ box-sizing: border-box;
1355
1327
  }
1356
-
1357
- .skeleton {
1358
- background: ${skeletonBackgroundColor};
1359
- background: linear-gradient(
1360
- 90deg,
1361
- ${skeletonBackgroundColor} 25%,
1362
- ${skeletonShimmerColor} 50%,
1363
- ${skeletonBackgroundColor} 75%
1364
- );
1365
- background-size: 200% 100%;
1366
- animation: shimmer 1.5s infinite linear;
1367
- border-radius: 6px;
1368
- margin-bottom: 12px;
1328
+ </style>
1329
+ `);
1330
+ frameDoc.close();
1331
+ _log$6("Popup template loaded into iframe");
1332
+ await this._setupResizeHandler(frame);
1333
+ }
1334
+ async _setupResizeHandler(frame) {
1335
+ const { contentWindow } = frame;
1336
+ if (!contentWindow) {
1337
+ throw new Error("Frame needs a content window");
1338
+ }
1339
+ const frameDoc = contentWindow.document;
1340
+ domready(frameDoc, async () => {
1341
+ frameDoc.body.style.overflowY = "hidden";
1342
+ frame.height = `${frameDoc.body.offsetHeight}px`;
1343
+ const ro = new contentWindow["ResizeObserver"]((entries) => {
1344
+ for (const entry of entries) {
1345
+ const { top, bottom } = entry.contentRect;
1346
+ const computedHeight = bottom + top;
1347
+ frame.height = computedHeight + "";
1348
+ entry.target.style = ``;
1349
+ }
1350
+ });
1351
+ ro.observe(await this._findInnerContainer(frame));
1352
+ });
1353
+ }
1354
+ open() {
1355
+ const element = this.container ? this._findElement() : document.body;
1356
+ const parent = element.shadowRoot || element;
1357
+ const dialog = parent.querySelector(`#${this.id}`);
1358
+ if (!dialog) throw new Error("Could not determine container div");
1359
+ dialog.showModal();
1360
+ const frame = this._findFrame();
1361
+ if (!frame) throw new Error("Could not find iframe");
1362
+ const { contentWindow } = frame;
1363
+ if (!contentWindow) throw new Error("Squatch.js has an empty iframe");
1364
+ const frameDoc = contentWindow.document;
1365
+ domready(frameDoc, () => {
1366
+ var _a2;
1367
+ const _sqh = contentWindow.squatch || contentWindow.widgetIdent;
1368
+ (_a2 = frame.contentDocument) == null ? void 0 : _a2.dispatchEvent(new CustomEvent("sq:refresh"));
1369
+ if (this.context.user) {
1370
+ this._loadEvent(_sqh);
1371
+ _log$6("Popup opened");
1372
+ } else {
1373
+ this._attachLoadEventListener(frameDoc, _sqh);
1369
1374
  }
1370
-
1371
- /* Typography Skeletons */
1372
- .sk-title-lg { height: 36px; width: 80%; margin-bottom: 16px; }
1373
- .sk-title-md { height: 28px; width: 30%; margin-bottom: 20px; margin-top: 40px; }
1374
- .sk-text { height: 16px; width: 90%; margin-bottom: 8px; }
1375
- .sk-text-short { width: 40%; }
1376
- .sk-label { height: 14px; width: 25%; margin-bottom: 10px; }
1377
-
1378
- /* Layouts */
1379
- .hero-section {
1380
- display: flex;
1381
- gap: 40px;
1382
- margin-bottom: 40px;
1383
- padding-bottom: 40px;
1384
- flex-direction: row;
1385
- height: 100%;
1386
- /* Removed border-bottom */
1387
- }
1388
-
1389
- .hero-content {
1390
- flex: 1;
1391
- display: flex;
1392
- flex-direction: column;
1393
- justify-content: center;
1394
- }
1395
-
1396
- .hero-image {
1397
- flex: 1;
1398
- height: 300px;
1399
- border-radius: 12px;
1400
- }
1401
-
1402
- /* -- Specific Instant Access Overrides -- */
1403
- .instant-access-layout {
1404
- margin-bottom: 0;
1405
- padding-bottom: 0;
1406
- align-items: center;
1407
- }
1408
- .ia-image {
1409
- height: 400px;
1410
- }
1411
- .ia-center {
1412
- margin-left: auto;
1413
- margin-right: auto;
1414
- }
1415
- .ia-content {
1416
- align-items: center;
1417
- text-align: center;
1418
- }
1419
- .sk-btn-action {
1420
- height: 45px;
1421
- width: 140px;
1422
- border-radius: 6px;
1423
- margin: 24px auto;
1424
- }
1425
- .input-group {
1426
- display: flex;
1427
- gap: 10px;
1428
- width: 100%;
1429
- max-width: 400px;
1430
- }
1431
- .sk-btn-copy {
1432
- height: 50px;
1433
- width: 120px;
1434
- border-radius: 8px;
1435
- }
1436
- /* ------------------------------------- */
1437
-
1438
- .share-section { margin-bottom: 40px; }
1439
- .sk-input { height: 50px; width: 100%; border-radius: 8px; margin-bottom: 16px; }
1440
-
1441
- .social-buttons { display: flex; gap: 12px; }
1442
- .sk-btn-social { flex: 1; height: 50px; border-radius: 8px; }
1443
-
1444
- .stats-section {
1445
- display: flex;
1446
- gap: 24px;
1447
- margin-bottom: 40px;
1448
- padding: 30px 0;
1449
- /* Removed border-top and border-bottom */
1450
- }
1451
- .stat-card { flex: 1; display: flex; flex-direction: column; align-items: center; }
1452
- .stat-divider { padding-left: 24px; }
1453
- .sk-stat-num { height: 48px; width: 120px; margin-bottom: 8px; }
1454
- .sk-stat-label { height: 18px; width: 80px; }
1455
-
1456
- /* Table Styles */
1457
- .table-header { display: flex; gap: 16px; margin-bottom: 16px; }
1458
- .sk-th { height: 16px; }
1459
- .table-row {
1460
- display: flex;
1461
- align-items: center;
1462
- gap: 16px;
1463
- padding: 16px 0;
1464
- /* Removed border-bottom */
1465
- }
1466
-
1467
- .col-user { flex: 2; }
1468
- .col-status { flex: 1; }
1469
- .col-reward { flex: 2; }
1470
- .col-date { flex: 1; }
1471
-
1472
- .sk-badge { height: 28px; width: 90px; border-radius: 14px; }
1473
- .sk-reward-block { height: 36px; width: 100%; border-radius: 6px; }
1474
-
1475
- .pagination { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
1476
- .sk-btn-page { height: 36px; width: 64px; border-radius: 6px; margin-bottom: 0; }
1477
-
1478
- @media (max-width: 768px) {
1479
- body { padding: 20px; }
1480
- .widget-container { padding: 24px; }
1481
-
1482
- .hero-section { flex-direction: column-reverse; gap: 24px; }
1483
- .instant-access-layout { flex-direction: column; }
1484
-
1485
- .hero-image { height: 220px; width: 100%; }
1486
- .sk-title-lg { width: 100%; }
1487
-
1488
- .col-date { display: none; }
1489
- }
1490
- </style>
1491
-
1492
- <div class="widget-container">
1493
- ${type === "verified-access" ? referrerHTML : instantAccessHTML}
1494
- </div>
1495
- `;
1496
- };
1497
- const _log$6 = browserExports.debug("squatch-js:POPUPwidget");
1498
- let popupId = 0;
1499
- class PopupWidget extends Widget {
1500
- constructor(params, trigger = ".squatchpop") {
1501
- super(params);
1502
- __publicField(this, "trigger");
1503
- __publicField(this, "id");
1504
- __publicField(this, "show", this.open);
1505
- __publicField(this, "hide", this.close);
1506
- this.trigger = trigger;
1507
- if (this.container) {
1508
- this.id = "squatchModal";
1509
- } else {
1510
- this.id = popupId === 0 ? `squatchModal` : `squatchModal__${popupId}`;
1511
- popupId = popupId + 1;
1512
- }
1513
- document.head.insertAdjacentHTML(
1514
- "beforeend",
1515
- `<style>#${this.id}::-webkit-scrollbar { display: none; }</style>`
1516
- );
1517
- }
1518
- _initialiseCTA() {
1519
- if (!this.trigger) return;
1520
- let triggerElement;
1521
- try {
1522
- triggerElement = document.querySelector(this.trigger) || document.querySelector(".impactpop");
1523
- if (this.trigger && !triggerElement)
1524
- _log$6("No element found with trigger selector", this.trigger);
1525
- } catch {
1526
- _log$6("Not a valid selector", this.trigger);
1527
- }
1528
- if (triggerElement) {
1529
- triggerElement.onclick = () => {
1530
- this.open();
1531
- };
1532
- }
1533
- }
1534
- _createPopupDialog() {
1535
- var _a2, _b, _c;
1536
- const dialog = document.createElement("dialog");
1537
- const brandingConfig = (_b = (_a2 = this.context.widgetConfig) == null ? void 0 : _a2.values) == null ? void 0 : _b.brandingConfig;
1538
- const sizes = (_c = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _c.popupWidgets;
1539
- const minWidth = (sizes == null ? void 0 : sizes.minWidth) ? formatWidth(sizes.minWidth) : "auto";
1540
- const maxWidth = (sizes == null ? void 0 : sizes.maxWidth) ? formatWidth(sizes.maxWidth) : "500px";
1541
- dialog.id = this.id;
1542
- dialog.setAttribute(
1543
- "style",
1544
- `width: 100%; min-width: ${minWidth}; max-width: ${maxWidth}; border: none; padding: 0;`
1545
- );
1546
- const onClick = (e) => {
1547
- e.stopPropagation();
1548
- if (e.target === dialog) dialog.close();
1549
- };
1550
- dialog.addEventListener("click", onClick);
1551
- return dialog;
1552
- }
1553
- /*
1554
- async load() {
1555
- const frame = this._createFrame();
1556
- this._initialiseCTA();
1557
-
1558
- const element = this.container ? this._findElement() : document.body;
1559
-
1560
- const dialogParent = element.shadowRoot || element;
1561
- const dialog = this._createPopupDialog();
1562
- dialog.appendChild(frame);
1563
-
1564
- const skeletonHTML = getSkeleton({
1565
- height: "100%",
1566
- type: "verified-access",
1567
- });
1568
-
1569
- const skeletonContainer = document.createElement("div");
1570
- skeletonContainer.id = "loading-skeleton";
1571
- skeletonContainer.innerHTML = skeletonHTML;
1572
-
1573
- if (dialogParent.lastChild?.nodeName === "DIALOG") {
1574
- // Was reloaded
1575
- dialogParent.replaceChild(dialog, dialogParent.lastChild);
1576
- } else {
1577
- // First time rendering
1578
- dialogParent.appendChild(dialog);
1579
- }
1580
-
1581
- const { contentWindow } = frame;
1582
- if (!contentWindow) {
1583
- throw new Error("Frame needs a content window");
1584
- }
1585
-
1586
- const frameDoc = contentWindow.document;
1587
- frameDoc.open();
1588
- frameDoc.write(this.content);
1589
- frameDoc.write(
1590
- `<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>`
1591
- );
1592
- frameDoc.close();
1593
- _log("Popup template loaded into iframe");
1594
- await this._setupResizeHandler(frame);
1595
- }
1596
- */
1597
- async load() {
1598
- var _a2;
1599
- const frame = this._createFrame();
1600
- this._initialiseCTA();
1601
- const element = this.container ? this._findElement() : document.body;
1602
- const dialogParent = element.shadowRoot || element;
1603
- const dialog = this._createPopupDialog();
1604
- const skeletonHTML = getSkeleton({
1605
- height: "100%",
1606
- type: "verified-access"
1607
- });
1608
- const skeletonContainer = document.createElement("div");
1609
- skeletonContainer.id = "loading-skeleton";
1610
- skeletonContainer.innerHTML = skeletonHTML;
1611
- skeletonContainer.style.width = "100%";
1612
- frame.style.display = "none";
1613
- dialog.appendChild(skeletonContainer);
1614
- dialog.appendChild(frame);
1615
- if (((_a2 = dialogParent.lastChild) == null ? void 0 : _a2.nodeName) === "DIALOG") {
1616
- dialogParent.replaceChild(dialog, dialogParent.lastChild);
1617
- } else {
1618
- dialogParent.appendChild(dialog);
1619
- }
1620
- const removeSkeleton = () => {
1621
- const skel = dialog.querySelector("#loading-skeleton");
1622
- if (skel) {
1623
- skel.remove();
1624
- }
1625
- frame.style.display = "block";
1626
- };
1627
- frame.addEventListener("sq:load", removeSkeleton);
1628
- frame.addEventListener("load", removeSkeleton);
1629
- const safetyTimer = setTimeout(() => {
1630
- removeSkeleton();
1631
- }, 5e3);
1632
- const { contentWindow } = frame;
1633
- if (!contentWindow) {
1634
- throw new Error("Frame needs a content window");
1635
- }
1636
- const frameDoc = contentWindow.document;
1637
- frameDoc.open();
1638
- frameDoc.write(this.content);
1639
- frameDoc.write(
1640
- `<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>`
1641
- );
1642
- frameDoc.close();
1643
- _log$6("Popup template loaded into iframe");
1644
- await this._setupResizeHandler(frame);
1645
- clearTimeout(safetyTimer);
1646
- removeSkeleton();
1647
- }
1648
- async _setupResizeHandler(frame) {
1649
- const { contentWindow } = frame;
1650
- if (!contentWindow) {
1651
- throw new Error("Frame needs a content window");
1652
- }
1653
- const frameDoc = contentWindow.document;
1654
- domready(frameDoc, async () => {
1655
- frameDoc.body.style.overflowY = "hidden";
1656
- frame.height = `${frameDoc.body.offsetHeight}px`;
1657
- const ro = new contentWindow["ResizeObserver"]((entries) => {
1658
- for (const entry of entries) {
1659
- const { top, bottom } = entry.contentRect;
1660
- const computedHeight = bottom + top;
1661
- frame.height = computedHeight + "";
1662
- entry.target.style = ``;
1663
- }
1664
- });
1665
- ro.observe(await this._findInnerContainer(frame));
1666
1375
  });
1667
1376
  }
1668
- open() {
1669
- const element = this.container ? this._findElement() : document.body;
1670
- const parent = element.shadowRoot || element;
1671
- const dialog = parent.querySelector(`#${this.id}`);
1672
- if (!dialog) throw new Error("Could not determine container div");
1673
- dialog.showModal();
1674
- const frame = this._findFrame();
1675
- if (!frame) throw new Error("Could not find iframe");
1676
- const { contentWindow } = frame;
1677
- if (!contentWindow) throw new Error("Squatch.js has an empty iframe");
1678
- const frameDoc = contentWindow.document;
1679
- domready(frameDoc, () => {
1680
- var _a2;
1681
- const _sqh = contentWindow.squatch || contentWindow.widgetIdent;
1682
- (_a2 = frame.contentDocument) == null ? void 0 : _a2.dispatchEvent(new CustomEvent("sq:refresh"));
1683
- if (this.context.user) {
1684
- this._loadEvent(_sqh);
1685
- _log$6("Popup opened");
1686
- } else {
1687
- this._attachLoadEventListener(frameDoc, _sqh);
1688
- }
1689
- });
1690
- }
1691
- close() {
1692
- const frame = this._findFrame();
1693
- if (frame == null ? void 0 : frame.contentDocument)
1694
- this._detachLoadEventListener(frame.contentDocument);
1377
+ close() {
1378
+ const frame = this._findFrame();
1379
+ if (frame == null ? void 0 : frame.contentDocument)
1380
+ this._detachLoadEventListener(frame.contentDocument);
1695
1381
  const element = this.container ? this._findElement() : document.body;
1696
1382
  const parent = element.shadowRoot || element;
1697
1383
  const dialog = parent.querySelector(`#${this.id}`);
@@ -2185,6 +1871,264 @@ function _getAutoConfig() {
2185
1871
  }
2186
1872
  };
2187
1873
  }
1874
+ const getSkeleton = ({
1875
+ type = "verified-access",
1876
+ height = "500px",
1877
+ skeletonBackgroundColor = "#e0e0e0",
1878
+ skeletonShimmerColor = "#f5f5f5"
1879
+ }) => {
1880
+ const referrerHTML = `
1881
+ <div class="hero-section">
1882
+ <div class="hero-content">
1883
+ <div class="skeleton sk-title-lg"></div>
1884
+ <div class="skeleton sk-text"></div>
1885
+ <div class="skeleton sk-text sk-text-short"></div>
1886
+ </div>
1887
+ <div class="skeleton hero-image"></div>
1888
+ </div>
1889
+
1890
+ <div class="share-section">
1891
+ <div class="skeleton sk-label"></div>
1892
+ <div class="skeleton sk-input"></div>
1893
+ <div class="social-buttons">
1894
+ <div class="skeleton sk-btn-social"></div>
1895
+ <div class="skeleton sk-btn-social"></div>
1896
+ <div class="skeleton sk-btn-social"></div>
1897
+ <div class="skeleton sk-btn-social"></div>
1898
+ </div>
1899
+ </div>
1900
+
1901
+ <div class="skeleton sk-title-md" style="margin-top: 0; width: 30%; margin-left: auto; margin-right: auto"></div>
1902
+ <div class="skeleton sk-text" style="width: 60%; margin-left: auto; margin-right: auto"></div>
1903
+
1904
+ <div class="stats-section">
1905
+ <div class="stat-card">
1906
+ <div class="skeleton sk-stat-num"></div>
1907
+ <div class="skeleton sk-stat-label"></div>
1908
+ </div>
1909
+ <div class="stat-card stat-divider">
1910
+ <div class="skeleton sk-stat-num"></div>
1911
+ <div class="skeleton sk-stat-label"></div>
1912
+ </div>
1913
+ </div>
1914
+
1915
+ <div class="skeleton sk-title-md"></div>
1916
+
1917
+ <div class="table-header">
1918
+ <div class="skeleton sk-th col-user"></div>
1919
+ <div class="skeleton sk-th col-status"></div>
1920
+ <div class="skeleton sk-th col-reward"></div>
1921
+ <div class="skeleton sk-th col-date"></div>
1922
+ </div>
1923
+
1924
+ <div class="table-row">
1925
+ <div class="col-user"><div class="skeleton sk-text" style="width: 70%; margin: 0"></div></div>
1926
+ <div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
1927
+ <div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
1928
+ <div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
1929
+ </div>
1930
+
1931
+ <div class="table-row">
1932
+ <div class="col-user"><div class="skeleton sk-text" style="width: 60%; margin: 0"></div></div>
1933
+ <div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
1934
+ <div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
1935
+ <div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
1936
+ </div>
1937
+
1938
+ <div class="table-row">
1939
+ <div class="col-user"><div class="skeleton sk-text" style="width: 75%; margin: 0"></div></div>
1940
+ <div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
1941
+ <div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
1942
+ <div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
1943
+ </div>
1944
+
1945
+ <div class="pagination">
1946
+ <div class="skeleton sk-btn-page"></div>
1947
+ <div class="skeleton sk-btn-page"></div>
1948
+ </div>
1949
+ `;
1950
+ const instantAccessHTML = `
1951
+ <div class="hero-section instant-access-layout">
1952
+ <div class="skeleton hero-image ia-image"></div>
1953
+
1954
+ <div class="hero-content ia-content">
1955
+ <div class="skeleton sk-title-lg ia-center"></div>
1956
+ <div class="skeleton sk-text ia-center"></div>
1957
+
1958
+ <div class="skeleton sk-btn-action"></div>
1959
+
1960
+ <div class="skeleton sk-label"></div>
1961
+ <div class="input-group">
1962
+ <div class="skeleton sk-input"></div>
1963
+ <div class="skeleton sk-btn-copy"></div>
1964
+ </div>
1965
+
1966
+ <div class="skeleton sk-text-short ia-center" style="margin-top: 20px; width: 30%"></div>
1967
+ <div class="skeleton sk-text-short ia-center" style="width: 20%"></div>
1968
+ </div>
1969
+ </div>
1970
+ `;
1971
+ return `
1972
+ <style>
1973
+ * {
1974
+ box-sizing: border-box;
1975
+ padding: 0;
1976
+ margin: 0;
1977
+ }
1978
+
1979
+ .widget-container {
1980
+ background: white;
1981
+ width: 100%;
1982
+ padding: 40px;
1983
+ box-sizing: border-box;
1984
+ overflow: hidden;
1985
+ }
1986
+
1987
+ @keyframes shimmer {
1988
+ 0% { background-position: -100% 0; }
1989
+ 100% { background-position: 100% 0; }
1990
+ }
1991
+
1992
+ .skeleton {
1993
+ background: ${skeletonBackgroundColor};
1994
+ background: linear-gradient(
1995
+ 90deg,
1996
+ ${skeletonBackgroundColor} 25%,
1997
+ ${skeletonShimmerColor} 50%,
1998
+ ${skeletonBackgroundColor} 75%
1999
+ );
2000
+ background-size: 200% 100%;
2001
+ animation: shimmer 1.5s infinite linear;
2002
+ border-radius: 6px;
2003
+ margin-bottom: 12px;
2004
+ }
2005
+
2006
+ /* Typography Skeletons */
2007
+ .sk-title-lg { height: 36px; width: 80%; margin-bottom: 16px; }
2008
+ .sk-title-md { height: 28px; width: 30%; margin-bottom: 20px; margin-top: 40px; }
2009
+ .sk-text { height: 16px; width: 90%; margin-bottom: 8px; }
2010
+ .sk-text-short { width: 40%; }
2011
+ .sk-label { height: 14px; width: 25%; margin-bottom: 10px; }
2012
+
2013
+ /* Layouts */
2014
+ .hero-section {
2015
+ display: flex;
2016
+ gap: 40px;
2017
+ margin-bottom: 40px;
2018
+ padding-bottom: 40px;
2019
+ flex-direction: row;
2020
+ height: 100%;
2021
+ /* Removed border-bottom */
2022
+ }
2023
+
2024
+ .hero-content {
2025
+ flex: 1;
2026
+ display: flex;
2027
+ flex-direction: column;
2028
+ justify-content: center;
2029
+ }
2030
+
2031
+ .hero-image {
2032
+ flex: 1;
2033
+ height: 300px;
2034
+ border-radius: 12px;
2035
+ }
2036
+
2037
+ /* -- Specific Instant Access Overrides -- */
2038
+ .instant-access-layout {
2039
+ margin-bottom: 0;
2040
+ padding-bottom: 0;
2041
+ align-items: center;
2042
+ }
2043
+ .ia-image {
2044
+ height: 400px;
2045
+ }
2046
+ .ia-center {
2047
+ margin-left: auto;
2048
+ margin-right: auto;
2049
+ }
2050
+ .ia-content {
2051
+ align-items: center;
2052
+ text-align: center;
2053
+ }
2054
+ .sk-btn-action {
2055
+ height: 45px;
2056
+ width: 140px;
2057
+ border-radius: 6px;
2058
+ margin: 24px auto;
2059
+ }
2060
+ .input-group {
2061
+ display: flex;
2062
+ gap: 10px;
2063
+ width: 100%;
2064
+ max-width: 400px;
2065
+ }
2066
+ .sk-btn-copy {
2067
+ height: 50px;
2068
+ width: 120px;
2069
+ border-radius: 8px;
2070
+ }
2071
+ /* ------------------------------------- */
2072
+
2073
+ .share-section { margin-bottom: 40px; }
2074
+ .sk-input { height: 50px; width: 100%; border-radius: 8px; margin-bottom: 16px; }
2075
+
2076
+ .social-buttons { display: flex; gap: 12px; }
2077
+ .sk-btn-social { flex: 1; height: 50px; border-radius: 8px; }
2078
+
2079
+ .stats-section {
2080
+ display: flex;
2081
+ gap: 24px;
2082
+ margin-bottom: 40px;
2083
+ padding: 30px 0;
2084
+ /* Removed border-top and border-bottom */
2085
+ }
2086
+ .stat-card { flex: 1; display: flex; flex-direction: column; align-items: center; }
2087
+ .stat-divider { padding-left: 24px; }
2088
+ .sk-stat-num { height: 48px; width: 120px; margin-bottom: 8px; }
2089
+ .sk-stat-label { height: 18px; width: 80px; }
2090
+
2091
+ /* Table Styles */
2092
+ .table-header { display: flex; gap: 16px; margin-bottom: 16px; }
2093
+ .sk-th { height: 16px; }
2094
+ .table-row {
2095
+ display: flex;
2096
+ align-items: center;
2097
+ gap: 16px;
2098
+ padding: 16px 0;
2099
+ /* Removed border-bottom */
2100
+ }
2101
+
2102
+ .col-user { flex: 2; }
2103
+ .col-status { flex: 1; }
2104
+ .col-reward { flex: 2; }
2105
+ .col-date { flex: 1; }
2106
+
2107
+ .sk-badge { height: 28px; width: 90px; border-radius: 14px; }
2108
+ .sk-reward-block { height: 36px; width: 100%; border-radius: 6px; }
2109
+
2110
+ .pagination { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
2111
+ .sk-btn-page { height: 36px; width: 64px; border-radius: 6px; margin-bottom: 0; }
2112
+
2113
+ @media (max-width: 768px) {
2114
+ body { padding: 20px; }
2115
+ .widget-container { padding: 24px; }
2116
+
2117
+ .hero-section { flex-direction: column-reverse; gap: 24px; }
2118
+ .instant-access-layout { flex-direction: column; }
2119
+
2120
+ .hero-image { height: 220px; width: 100%; }
2121
+ .sk-title-lg { width: 100%; }
2122
+
2123
+ .col-date { display: none; }
2124
+ }
2125
+ </style>
2126
+
2127
+ <div class="widget-container">
2128
+ ${type === "verified-access" ? referrerHTML : instantAccessHTML}
2129
+ </div>
2130
+ `;
2131
+ };
2188
2132
  const _log$2 = browserExports.debug("squatch-js:decodeUserJwt");
2189
2133
  function decodeUserJwt(tokenStr) {
2190
2134
  var _a2;