@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.cjs.js
CHANGED
|
@@ -1236,235 +1236,561 @@ class EmbedWidget extends Widget {
|
|
|
1236
1236
|
return isVerified && (noContainer || isComponent);
|
|
1237
1237
|
}
|
|
1238
1238
|
}
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
"
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
"
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
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 `
|
|
1337
|
+
<style>
|
|
1338
|
+
* {
|
|
1339
|
+
box-sizing: border-box;
|
|
1340
|
+
padding: 0;
|
|
1341
|
+
margin: 0;
|
|
1337
1342
|
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
const dialog = parent.querySelector(`#${this.id}`);
|
|
1346
|
-
if (!dialog) throw new Error("Could not determine container div");
|
|
1347
|
-
dialog.showModal();
|
|
1348
|
-
const frame = this._findFrame();
|
|
1349
|
-
if (!frame) throw new Error("Could not find iframe");
|
|
1350
|
-
const { contentWindow } = frame;
|
|
1351
|
-
if (!contentWindow) throw new Error("Squatch.js has an empty iframe");
|
|
1352
|
-
const frameDoc = contentWindow.document;
|
|
1353
|
-
domready(frameDoc, () => {
|
|
1354
|
-
var _a2;
|
|
1355
|
-
const _sqh = contentWindow.squatch || contentWindow.widgetIdent;
|
|
1356
|
-
(_a2 = frame.contentDocument) == null ? void 0 : _a2.dispatchEvent(new CustomEvent("sq:refresh"));
|
|
1357
|
-
if (this.context.user) {
|
|
1358
|
-
this._loadEvent(_sqh);
|
|
1359
|
-
_log$6("Popup opened");
|
|
1360
|
-
} else {
|
|
1361
|
-
this._attachLoadEventListener(frameDoc, _sqh);
|
|
1343
|
+
|
|
1344
|
+
.widget-container {
|
|
1345
|
+
background: white;
|
|
1346
|
+
width: 100%;
|
|
1347
|
+
padding: 40px;
|
|
1348
|
+
box-sizing: border-box;
|
|
1349
|
+
overflow: hidden;
|
|
1362
1350
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1351
|
+
|
|
1352
|
+
@keyframes shimmer {
|
|
1353
|
+
0% { background-position: -100% 0; }
|
|
1354
|
+
100% { background-position: 100% 0; }
|
|
1355
|
+
}
|
|
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;
|
|
1369
|
+
}
|
|
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
|
+
);
|
|
1425
1517
|
}
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
*
|
|
1430
|
-
* @param {Object} config Config details
|
|
1431
|
-
* @param {Object} config.user The user details
|
|
1432
|
-
* @param {string} config.user.id The user id
|
|
1433
|
-
* @param {string} config.user.accountId The user account id
|
|
1434
|
-
* @param {WidgetType} config.widgetType The content of the widget
|
|
1435
|
-
* @param {EngagementMedium} config.engagementMedium How to display the widget
|
|
1436
|
-
* @param {string} config.jwt the JSON Web Token (JWT) that is used to validate the data (can be disabled)
|
|
1437
|
-
* @param {HTMLElement | string | undefined} config.container Element to load the widget into
|
|
1438
|
-
* @param {string | undefined} config.trigger Trigger element for opening the popup widget
|
|
1439
|
-
*
|
|
1440
|
-
* @return {Promise<WidgetResult>} json object if true, with a Widget and user details
|
|
1441
|
-
*/
|
|
1442
|
-
async upsertUser(config) {
|
|
1443
|
-
const raw = config;
|
|
1444
|
-
const clean = validateWidgetConfig(raw);
|
|
1518
|
+
_initialiseCTA() {
|
|
1519
|
+
if (!this.trigger) return;
|
|
1520
|
+
let triggerElement;
|
|
1445
1521
|
try {
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
values: {
|
|
1456
|
-
brandingConfig: response == null ? void 0 : response.brandingConfig
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
}),
|
|
1460
|
-
user: response.user
|
|
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();
|
|
1461
1531
|
};
|
|
1462
|
-
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
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
|
+
});
|
|
1667
|
+
}
|
|
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);
|
|
1695
|
+
const element = this.container ? this._findElement() : document.body;
|
|
1696
|
+
const parent = element.shadowRoot || element;
|
|
1697
|
+
const dialog = parent.querySelector(`#${this.id}`);
|
|
1698
|
+
if (!dialog) throw new Error("Could not determine container div");
|
|
1699
|
+
dialog.close();
|
|
1700
|
+
_log$6("Popup closed");
|
|
1701
|
+
}
|
|
1702
|
+
_clickedOutside({ target }) {
|
|
1703
|
+
}
|
|
1704
|
+
_error(rs, mode = "modal", style = "") {
|
|
1705
|
+
const _style = "body { margin: 0; } .modal { box-shadow: none; border: 0; }";
|
|
1706
|
+
return super._error(rs, mode, style || _style);
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
const _log$5 = browserExports.debug("squatch-js:widgets");
|
|
1710
|
+
class Widgets {
|
|
1711
|
+
/**
|
|
1712
|
+
* Initialize a new {@link Widgets} instance.
|
|
1713
|
+
*
|
|
1714
|
+
* @param {ConfigOptions} config Config details
|
|
1715
|
+
*
|
|
1716
|
+
* @example <caption>Browser example</caption>
|
|
1717
|
+
* var widgets = new squatch.Widgets({tenantAlias:'test_12b5bo1b25125'});
|
|
1718
|
+
*
|
|
1719
|
+
* @example <caption>Browserify/Webpack example</caption>
|
|
1720
|
+
* var Widgets = require('@saasquatch/squatch-js').Widgets;
|
|
1721
|
+
* var widgets = new Widgets({tenantAlias:'test_12b5bo1b25125'});
|
|
1722
|
+
*
|
|
1723
|
+
* @example <caption>Babel+Browserify/Webpack example</caption>
|
|
1724
|
+
* import {Widgets} from '@saasquatch/squatch-js';
|
|
1725
|
+
* let widgets = new Widgets({tenantAlias:'test_12b5bo1b25125'});
|
|
1726
|
+
*/
|
|
1727
|
+
constructor(configin) {
|
|
1728
|
+
/**
|
|
1729
|
+
* Instance of {@link WidgetApi}
|
|
1730
|
+
*/
|
|
1731
|
+
__publicField(this, "api");
|
|
1732
|
+
/**
|
|
1733
|
+
* Tenant alias of SaaSquatch tenant
|
|
1734
|
+
*/
|
|
1735
|
+
__publicField(this, "tenantAlias");
|
|
1736
|
+
/**
|
|
1737
|
+
* SaaSquatch domain for API requests
|
|
1738
|
+
* @default "https://app.referralsaasquatch.com"
|
|
1739
|
+
*/
|
|
1740
|
+
__publicField(this, "domain");
|
|
1741
|
+
/**
|
|
1742
|
+
* Hosted CDN for npm packages
|
|
1743
|
+
* @default "https://fast.ssqt.io/npm"
|
|
1744
|
+
*/
|
|
1745
|
+
__publicField(this, "npmCdn");
|
|
1746
|
+
const config = validateConfig(configin);
|
|
1747
|
+
this.tenantAlias = config.tenantAlias;
|
|
1748
|
+
this.domain = config.domain;
|
|
1749
|
+
this.npmCdn = config.npmCdn;
|
|
1750
|
+
this.api = new WidgetApi(config);
|
|
1751
|
+
}
|
|
1752
|
+
/**
|
|
1753
|
+
* This function calls the {@link WidgetApi.upsertUser} method, and it renders
|
|
1754
|
+
* the widget if it is successful. Otherwise it shows the "error" widget.
|
|
1755
|
+
*
|
|
1756
|
+
* @param {Object} config Config details
|
|
1757
|
+
* @param {Object} config.user The user details
|
|
1758
|
+
* @param {string} config.user.id The user id
|
|
1759
|
+
* @param {string} config.user.accountId The user account id
|
|
1760
|
+
* @param {WidgetType} config.widgetType The content of the widget
|
|
1761
|
+
* @param {EngagementMedium} config.engagementMedium How to display the widget
|
|
1762
|
+
* @param {string} config.jwt the JSON Web Token (JWT) that is used to validate the data (can be disabled)
|
|
1763
|
+
* @param {HTMLElement | string | undefined} config.container Element to load the widget into
|
|
1764
|
+
* @param {string | undefined} config.trigger Trigger element for opening the popup widget
|
|
1765
|
+
*
|
|
1766
|
+
* @return {Promise<WidgetResult>} json object if true, with a Widget and user details
|
|
1767
|
+
*/
|
|
1768
|
+
async upsertUser(config) {
|
|
1769
|
+
const raw = config;
|
|
1770
|
+
const clean = validateWidgetConfig(raw);
|
|
1771
|
+
try {
|
|
1772
|
+
const response = await this.api.upsertUser(clean);
|
|
1773
|
+
return {
|
|
1774
|
+
widget: this._renderWidget(response, clean, {
|
|
1775
|
+
type: "upsert",
|
|
1776
|
+
user: clean.user,
|
|
1777
|
+
engagementMedium: config.engagementMedium,
|
|
1778
|
+
container: config.container,
|
|
1779
|
+
trigger: config.trigger,
|
|
1780
|
+
widgetConfig: {
|
|
1781
|
+
values: {
|
|
1782
|
+
brandingConfig: response == null ? void 0 : response.brandingConfig
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
}),
|
|
1786
|
+
user: response.user
|
|
1787
|
+
};
|
|
1788
|
+
} catch (err) {
|
|
1789
|
+
_log$5(err);
|
|
1790
|
+
if (err.apiErrorCode) {
|
|
1791
|
+
this._renderErrorWidget(err, config.engagementMedium);
|
|
1792
|
+
}
|
|
1793
|
+
throw new Error(err);
|
|
1468
1794
|
}
|
|
1469
1795
|
}
|
|
1470
1796
|
/**
|
|
@@ -1859,264 +2185,6 @@ function _getAutoConfig() {
|
|
|
1859
2185
|
}
|
|
1860
2186
|
};
|
|
1861
2187
|
}
|
|
1862
|
-
const getSkeleton = ({
|
|
1863
|
-
type = "verified-access",
|
|
1864
|
-
height = "500px",
|
|
1865
|
-
skeletonBackgroundColor = "#e0e0e0",
|
|
1866
|
-
skeletonShimmerColor = "#f5f5f5"
|
|
1867
|
-
}) => {
|
|
1868
|
-
const referrerHTML = `
|
|
1869
|
-
<div class="hero-section">
|
|
1870
|
-
<div class="hero-content">
|
|
1871
|
-
<div class="skeleton sk-title-lg"></div>
|
|
1872
|
-
<div class="skeleton sk-text"></div>
|
|
1873
|
-
<div class="skeleton sk-text sk-text-short"></div>
|
|
1874
|
-
</div>
|
|
1875
|
-
<div class="skeleton hero-image"></div>
|
|
1876
|
-
</div>
|
|
1877
|
-
|
|
1878
|
-
<div class="share-section">
|
|
1879
|
-
<div class="skeleton sk-label"></div>
|
|
1880
|
-
<div class="skeleton sk-input"></div>
|
|
1881
|
-
<div class="social-buttons">
|
|
1882
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1883
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1884
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1885
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1886
|
-
</div>
|
|
1887
|
-
</div>
|
|
1888
|
-
|
|
1889
|
-
<div class="skeleton sk-title-md" style="margin-top: 0; width: 30%; margin-left: auto; margin-right: auto"></div>
|
|
1890
|
-
<div class="skeleton sk-text" style="width: 60%; margin-left: auto; margin-right: auto"></div>
|
|
1891
|
-
|
|
1892
|
-
<div class="stats-section">
|
|
1893
|
-
<div class="stat-card">
|
|
1894
|
-
<div class="skeleton sk-stat-num"></div>
|
|
1895
|
-
<div class="skeleton sk-stat-label"></div>
|
|
1896
|
-
</div>
|
|
1897
|
-
<div class="stat-card stat-divider">
|
|
1898
|
-
<div class="skeleton sk-stat-num"></div>
|
|
1899
|
-
<div class="skeleton sk-stat-label"></div>
|
|
1900
|
-
</div>
|
|
1901
|
-
</div>
|
|
1902
|
-
|
|
1903
|
-
<div class="skeleton sk-title-md"></div>
|
|
1904
|
-
|
|
1905
|
-
<div class="table-header">
|
|
1906
|
-
<div class="skeleton sk-th col-user"></div>
|
|
1907
|
-
<div class="skeleton sk-th col-status"></div>
|
|
1908
|
-
<div class="skeleton sk-th col-reward"></div>
|
|
1909
|
-
<div class="skeleton sk-th col-date"></div>
|
|
1910
|
-
</div>
|
|
1911
|
-
|
|
1912
|
-
<div class="table-row">
|
|
1913
|
-
<div class="col-user"><div class="skeleton sk-text" style="width: 70%; margin: 0"></div></div>
|
|
1914
|
-
<div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
|
|
1915
|
-
<div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
|
|
1916
|
-
<div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
|
|
1917
|
-
</div>
|
|
1918
|
-
|
|
1919
|
-
<div class="table-row">
|
|
1920
|
-
<div class="col-user"><div class="skeleton sk-text" style="width: 60%; margin: 0"></div></div>
|
|
1921
|
-
<div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
|
|
1922
|
-
<div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
|
|
1923
|
-
<div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
|
|
1924
|
-
</div>
|
|
1925
|
-
|
|
1926
|
-
<div class="table-row">
|
|
1927
|
-
<div class="col-user"><div class="skeleton sk-text" style="width: 75%; margin: 0"></div></div>
|
|
1928
|
-
<div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
|
|
1929
|
-
<div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
|
|
1930
|
-
<div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
|
|
1931
|
-
</div>
|
|
1932
|
-
|
|
1933
|
-
<div class="pagination">
|
|
1934
|
-
<div class="skeleton sk-btn-page"></div>
|
|
1935
|
-
<div class="skeleton sk-btn-page"></div>
|
|
1936
|
-
</div>
|
|
1937
|
-
`;
|
|
1938
|
-
const instantAccessHTML = `
|
|
1939
|
-
<div class="hero-section instant-access-layout">
|
|
1940
|
-
<div class="skeleton hero-image ia-image"></div>
|
|
1941
|
-
|
|
1942
|
-
<div class="hero-content ia-content">
|
|
1943
|
-
<div class="skeleton sk-title-lg ia-center"></div>
|
|
1944
|
-
<div class="skeleton sk-text ia-center"></div>
|
|
1945
|
-
|
|
1946
|
-
<div class="skeleton sk-btn-action"></div>
|
|
1947
|
-
|
|
1948
|
-
<div class="skeleton sk-label"></div>
|
|
1949
|
-
<div class="input-group">
|
|
1950
|
-
<div class="skeleton sk-input"></div>
|
|
1951
|
-
<div class="skeleton sk-btn-copy"></div>
|
|
1952
|
-
</div>
|
|
1953
|
-
|
|
1954
|
-
<div class="skeleton sk-text-short ia-center" style="margin-top: 20px; width: 30%"></div>
|
|
1955
|
-
<div class="skeleton sk-text-short ia-center" style="width: 20%"></div>
|
|
1956
|
-
</div>
|
|
1957
|
-
</div>
|
|
1958
|
-
`;
|
|
1959
|
-
return `
|
|
1960
|
-
<style>
|
|
1961
|
-
* {
|
|
1962
|
-
box-sizing: border-box;
|
|
1963
|
-
padding: 0;
|
|
1964
|
-
margin: 0;
|
|
1965
|
-
}
|
|
1966
|
-
|
|
1967
|
-
.widget-container {
|
|
1968
|
-
background: white;
|
|
1969
|
-
width: 100%;
|
|
1970
|
-
padding: 40px;
|
|
1971
|
-
box-sizing: border-box;
|
|
1972
|
-
overflow: hidden;
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
@keyframes shimmer {
|
|
1976
|
-
0% { background-position: -100% 0; }
|
|
1977
|
-
100% { background-position: 100% 0; }
|
|
1978
|
-
}
|
|
1979
|
-
|
|
1980
|
-
.skeleton {
|
|
1981
|
-
background: ${skeletonBackgroundColor};
|
|
1982
|
-
background: linear-gradient(
|
|
1983
|
-
90deg,
|
|
1984
|
-
${skeletonBackgroundColor} 25%,
|
|
1985
|
-
${skeletonShimmerColor} 50%,
|
|
1986
|
-
${skeletonBackgroundColor} 75%
|
|
1987
|
-
);
|
|
1988
|
-
background-size: 200% 100%;
|
|
1989
|
-
animation: shimmer 1.5s infinite linear;
|
|
1990
|
-
border-radius: 6px;
|
|
1991
|
-
margin-bottom: 12px;
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
/* Typography Skeletons */
|
|
1995
|
-
.sk-title-lg { height: 36px; width: 80%; margin-bottom: 16px; }
|
|
1996
|
-
.sk-title-md { height: 28px; width: 30%; margin-bottom: 20px; margin-top: 40px; }
|
|
1997
|
-
.sk-text { height: 16px; width: 90%; margin-bottom: 8px; }
|
|
1998
|
-
.sk-text-short { width: 40%; }
|
|
1999
|
-
.sk-label { height: 14px; width: 25%; margin-bottom: 10px; }
|
|
2000
|
-
|
|
2001
|
-
/* Layouts */
|
|
2002
|
-
.hero-section {
|
|
2003
|
-
display: flex;
|
|
2004
|
-
gap: 40px;
|
|
2005
|
-
margin-bottom: 40px;
|
|
2006
|
-
padding-bottom: 40px;
|
|
2007
|
-
flex-direction: row;
|
|
2008
|
-
height: 100%;
|
|
2009
|
-
/* Removed border-bottom */
|
|
2010
|
-
}
|
|
2011
|
-
|
|
2012
|
-
.hero-content {
|
|
2013
|
-
flex: 1;
|
|
2014
|
-
display: flex;
|
|
2015
|
-
flex-direction: column;
|
|
2016
|
-
justify-content: center;
|
|
2017
|
-
}
|
|
2018
|
-
|
|
2019
|
-
.hero-image {
|
|
2020
|
-
flex: 1;
|
|
2021
|
-
height: 300px;
|
|
2022
|
-
border-radius: 12px;
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
/* -- Specific Instant Access Overrides -- */
|
|
2026
|
-
.instant-access-layout {
|
|
2027
|
-
margin-bottom: 0;
|
|
2028
|
-
padding-bottom: 0;
|
|
2029
|
-
align-items: center;
|
|
2030
|
-
}
|
|
2031
|
-
.ia-image {
|
|
2032
|
-
height: 400px;
|
|
2033
|
-
}
|
|
2034
|
-
.ia-center {
|
|
2035
|
-
margin-left: auto;
|
|
2036
|
-
margin-right: auto;
|
|
2037
|
-
}
|
|
2038
|
-
.ia-content {
|
|
2039
|
-
align-items: center;
|
|
2040
|
-
text-align: center;
|
|
2041
|
-
}
|
|
2042
|
-
.sk-btn-action {
|
|
2043
|
-
height: 45px;
|
|
2044
|
-
width: 140px;
|
|
2045
|
-
border-radius: 6px;
|
|
2046
|
-
margin: 24px auto;
|
|
2047
|
-
}
|
|
2048
|
-
.input-group {
|
|
2049
|
-
display: flex;
|
|
2050
|
-
gap: 10px;
|
|
2051
|
-
width: 100%;
|
|
2052
|
-
max-width: 400px;
|
|
2053
|
-
}
|
|
2054
|
-
.sk-btn-copy {
|
|
2055
|
-
height: 50px;
|
|
2056
|
-
width: 120px;
|
|
2057
|
-
border-radius: 8px;
|
|
2058
|
-
}
|
|
2059
|
-
/* ------------------------------------- */
|
|
2060
|
-
|
|
2061
|
-
.share-section { margin-bottom: 40px; }
|
|
2062
|
-
.sk-input { height: 50px; width: 100%; border-radius: 8px; margin-bottom: 16px; }
|
|
2063
|
-
|
|
2064
|
-
.social-buttons { display: flex; gap: 12px; }
|
|
2065
|
-
.sk-btn-social { flex: 1; height: 50px; border-radius: 8px; }
|
|
2066
|
-
|
|
2067
|
-
.stats-section {
|
|
2068
|
-
display: flex;
|
|
2069
|
-
gap: 24px;
|
|
2070
|
-
margin-bottom: 40px;
|
|
2071
|
-
padding: 30px 0;
|
|
2072
|
-
/* Removed border-top and border-bottom */
|
|
2073
|
-
}
|
|
2074
|
-
.stat-card { flex: 1; display: flex; flex-direction: column; align-items: center; }
|
|
2075
|
-
.stat-divider { padding-left: 24px; }
|
|
2076
|
-
.sk-stat-num { height: 48px; width: 120px; margin-bottom: 8px; }
|
|
2077
|
-
.sk-stat-label { height: 18px; width: 80px; }
|
|
2078
|
-
|
|
2079
|
-
/* Table Styles */
|
|
2080
|
-
.table-header { display: flex; gap: 16px; margin-bottom: 16px; }
|
|
2081
|
-
.sk-th { height: 16px; }
|
|
2082
|
-
.table-row {
|
|
2083
|
-
display: flex;
|
|
2084
|
-
align-items: center;
|
|
2085
|
-
gap: 16px;
|
|
2086
|
-
padding: 16px 0;
|
|
2087
|
-
/* Removed border-bottom */
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
.col-user { flex: 2; }
|
|
2091
|
-
.col-status { flex: 1; }
|
|
2092
|
-
.col-reward { flex: 2; }
|
|
2093
|
-
.col-date { flex: 1; }
|
|
2094
|
-
|
|
2095
|
-
.sk-badge { height: 28px; width: 90px; border-radius: 14px; }
|
|
2096
|
-
.sk-reward-block { height: 36px; width: 100%; border-radius: 6px; }
|
|
2097
|
-
|
|
2098
|
-
.pagination { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
|
|
2099
|
-
.sk-btn-page { height: 36px; width: 64px; border-radius: 6px; margin-bottom: 0; }
|
|
2100
|
-
|
|
2101
|
-
@media (max-width: 768px) {
|
|
2102
|
-
body { padding: 20px; }
|
|
2103
|
-
.widget-container { padding: 24px; }
|
|
2104
|
-
|
|
2105
|
-
.hero-section { flex-direction: column-reverse; gap: 24px; }
|
|
2106
|
-
.instant-access-layout { flex-direction: column; }
|
|
2107
|
-
|
|
2108
|
-
.hero-image { height: 220px; width: 100%; }
|
|
2109
|
-
.sk-title-lg { width: 100%; }
|
|
2110
|
-
|
|
2111
|
-
.col-date { display: none; }
|
|
2112
|
-
}
|
|
2113
|
-
</style>
|
|
2114
|
-
|
|
2115
|
-
<div class="widget-container">
|
|
2116
|
-
${type === "verified-access" ? referrerHTML : instantAccessHTML}
|
|
2117
|
-
</div>
|
|
2118
|
-
`;
|
|
2119
|
-
};
|
|
2120
2188
|
const _log$2 = browserExports.debug("squatch-js:decodeUserJwt");
|
|
2121
2189
|
function decodeUserJwt(tokenStr) {
|
|
2122
2190
|
var _a2;
|