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