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