@saasquatch/squatch-js 2.8.2-3 → 2.8.2-30
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 +308 -387
- package/dist/squatch.cjs.js.map +1 -1
- package/dist/squatch.esm.js +308 -387
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +308 -387
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +1 -1
- package/dist/widgets/SkeletonTemplate.d.ts +3 -2
- package/dist/widgets/declarative/DeclarativeWidget.d.ts +1 -0
- package/package.json +1 -1
package/dist/squatch.esm.js
CHANGED
|
@@ -1106,351 +1106,6 @@ function delay(duration) {
|
|
|
1106
1106
|
setTimeout(resolve, duration);
|
|
1107
1107
|
});
|
|
1108
1108
|
}
|
|
1109
|
-
const getSkeleton = ({
|
|
1110
|
-
height = "500px",
|
|
1111
|
-
skeletonBackgroundColor = "#e0e0e0",
|
|
1112
|
-
skeletonShimmerColor = "#f5f5f5",
|
|
1113
|
-
borderColor = "#ccc"
|
|
1114
|
-
}) => {
|
|
1115
|
-
return `
|
|
1116
|
-
<style>
|
|
1117
|
-
* {
|
|
1118
|
-
box-sizing: border-box;
|
|
1119
|
-
padding: 0;
|
|
1120
|
-
margin: 0;
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
.widget-container {
|
|
1124
|
-
background: white;
|
|
1125
|
-
width: 100%;
|
|
1126
|
-
max-width: 900px;
|
|
1127
|
-
padding: 40px;
|
|
1128
|
-
border-radius: 12px;
|
|
1129
|
-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
|
|
1130
|
-
box-sizing: border-box;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
@keyframes shimmer {
|
|
1134
|
-
0% {
|
|
1135
|
-
background-position: -100% 0;
|
|
1136
|
-
}
|
|
1137
|
-
100% {
|
|
1138
|
-
background-position: 100% 0;
|
|
1139
|
-
}
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
.skeleton {
|
|
1143
|
-
background: ${skeletonBackgroundColor};
|
|
1144
|
-
background: linear-gradient(
|
|
1145
|
-
90deg,
|
|
1146
|
-
${skeletonBackgroundColor} 25%,
|
|
1147
|
-
${skeletonShimmerColor} 50%,
|
|
1148
|
-
${skeletonBackgroundColor} 75%
|
|
1149
|
-
);
|
|
1150
|
-
background-size: 200% 100%;
|
|
1151
|
-
animation: shimmer 1.5s infinite linear;
|
|
1152
|
-
border-radius: 6px;
|
|
1153
|
-
margin-bottom: 12px;
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
|
-
.sk-title-lg {
|
|
1157
|
-
height: 36px;
|
|
1158
|
-
width: 50%;
|
|
1159
|
-
margin-bottom: 16px;
|
|
1160
|
-
}
|
|
1161
|
-
.sk-title-md {
|
|
1162
|
-
height: 28px;
|
|
1163
|
-
width: 30%;
|
|
1164
|
-
margin-bottom: 20px;
|
|
1165
|
-
margin-top: 40px;
|
|
1166
|
-
}
|
|
1167
|
-
.sk-text {
|
|
1168
|
-
height: 16px;
|
|
1169
|
-
width: 80%;
|
|
1170
|
-
margin-bottom: 8px;
|
|
1171
|
-
}
|
|
1172
|
-
.sk-text-short {
|
|
1173
|
-
width: 40%;
|
|
1174
|
-
}
|
|
1175
|
-
.sk-label {
|
|
1176
|
-
height: 14px;
|
|
1177
|
-
width: 25%;
|
|
1178
|
-
margin-bottom: 10px;
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
|
-
.hero-section {
|
|
1182
|
-
display: flex;
|
|
1183
|
-
gap: 40px;
|
|
1184
|
-
margin-bottom: 40px;
|
|
1185
|
-
border-bottom: 1px solid ${borderColor};
|
|
1186
|
-
padding-bottom: 40px;
|
|
1187
|
-
flex-direction: row;
|
|
1188
|
-
}
|
|
1189
|
-
.hero-content {
|
|
1190
|
-
flex: 1;
|
|
1191
|
-
display: flex;
|
|
1192
|
-
flex-direction: column;
|
|
1193
|
-
justify-content: center;
|
|
1194
|
-
}
|
|
1195
|
-
.hero-image {
|
|
1196
|
-
flex: 1;
|
|
1197
|
-
height: 300px;
|
|
1198
|
-
border-radius: 12px;
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
.share-section {
|
|
1202
|
-
margin-bottom: 40px;
|
|
1203
|
-
}
|
|
1204
|
-
.sk-input {
|
|
1205
|
-
height: 50px;
|
|
1206
|
-
width: 100%;
|
|
1207
|
-
border-radius: 8px;
|
|
1208
|
-
margin-bottom: 16px;
|
|
1209
|
-
}
|
|
1210
|
-
.social-buttons {
|
|
1211
|
-
display: flex;
|
|
1212
|
-
gap: 12px;
|
|
1213
|
-
}
|
|
1214
|
-
.sk-btn-social {
|
|
1215
|
-
flex: 1;
|
|
1216
|
-
height: 50px;
|
|
1217
|
-
border-radius: 8px;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
.stats-section {
|
|
1221
|
-
display: flex;
|
|
1222
|
-
gap: 24px;
|
|
1223
|
-
margin-bottom: 40px;
|
|
1224
|
-
padding: 30px 0;
|
|
1225
|
-
border-top: 1px solid ${borderColor};
|
|
1226
|
-
border-bottom: 1px solid ${borderColor};
|
|
1227
|
-
}
|
|
1228
|
-
.stat-card {
|
|
1229
|
-
flex: 1;
|
|
1230
|
-
display: flex;
|
|
1231
|
-
flex-direction: column;
|
|
1232
|
-
align-items: center;
|
|
1233
|
-
}
|
|
1234
|
-
.stat-divider {
|
|
1235
|
-
padding-left: 24px;
|
|
1236
|
-
}
|
|
1237
|
-
|
|
1238
|
-
.sk-stat-num {
|
|
1239
|
-
height: 48px;
|
|
1240
|
-
width: 120px;
|
|
1241
|
-
margin-bottom: 8px;
|
|
1242
|
-
}
|
|
1243
|
-
.sk-stat-label {
|
|
1244
|
-
height: 18px;
|
|
1245
|
-
width: 80px;
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
.table-header {
|
|
1249
|
-
display: flex;
|
|
1250
|
-
gap: 16px;
|
|
1251
|
-
margin-bottom: 16px;
|
|
1252
|
-
}
|
|
1253
|
-
.sk-th {
|
|
1254
|
-
height: 16px;
|
|
1255
|
-
}
|
|
1256
|
-
.table-row {
|
|
1257
|
-
display: flex;
|
|
1258
|
-
align-items: center;
|
|
1259
|
-
gap: 16px;
|
|
1260
|
-
padding: 16px 0;
|
|
1261
|
-
border-bottom: 1px solid ${borderColor};
|
|
1262
|
-
}
|
|
1263
|
-
|
|
1264
|
-
.col-user {
|
|
1265
|
-
flex: 2;
|
|
1266
|
-
}
|
|
1267
|
-
.col-status {
|
|
1268
|
-
flex: 1;
|
|
1269
|
-
}
|
|
1270
|
-
.col-reward {
|
|
1271
|
-
flex: 2;
|
|
1272
|
-
}
|
|
1273
|
-
.col-date {
|
|
1274
|
-
flex: 1;
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
.sk-badge {
|
|
1278
|
-
height: 28px;
|
|
1279
|
-
width: 90px;
|
|
1280
|
-
border-radius: 14px;
|
|
1281
|
-
}
|
|
1282
|
-
.sk-reward-block {
|
|
1283
|
-
height: 36px;
|
|
1284
|
-
width: 100%;
|
|
1285
|
-
border-radius: 6px;
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
.pagination {
|
|
1289
|
-
display: flex;
|
|
1290
|
-
justify-content: flex-end;
|
|
1291
|
-
gap: 8px;
|
|
1292
|
-
margin-top: 24px;
|
|
1293
|
-
}
|
|
1294
|
-
.sk-btn-page {
|
|
1295
|
-
height: 36px;
|
|
1296
|
-
width: 64px;
|
|
1297
|
-
border-radius: 6px;
|
|
1298
|
-
margin-bottom: 0;
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
|
-
@media (max-width: 768px) {
|
|
1302
|
-
body {
|
|
1303
|
-
padding: 20px;
|
|
1304
|
-
}
|
|
1305
|
-
.widget-container {
|
|
1306
|
-
padding: 24px;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
.hero-section {
|
|
1310
|
-
flex-direction: column-reverse;
|
|
1311
|
-
gap: 24px;
|
|
1312
|
-
}
|
|
1313
|
-
.hero-image {
|
|
1314
|
-
height: 220px;
|
|
1315
|
-
width: 100%;
|
|
1316
|
-
}
|
|
1317
|
-
.sk-title-lg {
|
|
1318
|
-
width: 80%;
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
.col-date {
|
|
1322
|
-
display: none;
|
|
1323
|
-
}
|
|
1324
|
-
}
|
|
1325
|
-
|
|
1326
|
-
@media (max-width: 480px) {
|
|
1327
|
-
body {
|
|
1328
|
-
padding: 10px;
|
|
1329
|
-
}
|
|
1330
|
-
.widget-container {
|
|
1331
|
-
padding: 16px;
|
|
1332
|
-
}
|
|
1333
|
-
|
|
1334
|
-
.sk-stat-num {
|
|
1335
|
-
width: 80px;
|
|
1336
|
-
height: 40px;
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
.col-reward {
|
|
1340
|
-
display: none;
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
.col-user {
|
|
1344
|
-
flex: 3;
|
|
1345
|
-
}
|
|
1346
|
-
.col-status {
|
|
1347
|
-
flex: 2;
|
|
1348
|
-
display: flex;
|
|
1349
|
-
justify-content: flex-end;
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
</style>
|
|
1353
|
-
|
|
1354
|
-
<div class="widget-container">
|
|
1355
|
-
<div class="hero-section">
|
|
1356
|
-
<div class="hero-content">
|
|
1357
|
-
<div class="skeleton sk-title-lg"></div>
|
|
1358
|
-
<div class="skeleton sk-text"></div>
|
|
1359
|
-
<div class="skeleton sk-text sk-text-short"></div>
|
|
1360
|
-
</div>
|
|
1361
|
-
<div class="skeleton hero-image"></div>
|
|
1362
|
-
</div>
|
|
1363
|
-
|
|
1364
|
-
<div class="share-section">
|
|
1365
|
-
<div class="skeleton sk-label"></div>
|
|
1366
|
-
<div class="skeleton sk-input"></div>
|
|
1367
|
-
<div class="social-buttons">
|
|
1368
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1369
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1370
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1371
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1372
|
-
</div>
|
|
1373
|
-
</div>
|
|
1374
|
-
|
|
1375
|
-
<div
|
|
1376
|
-
class="skeleton sk-title-md"
|
|
1377
|
-
style="margin-top: 0; width: 30%; margin-left: auto; margin-right: auto"
|
|
1378
|
-
></div>
|
|
1379
|
-
<div
|
|
1380
|
-
class="skeleton sk-text"
|
|
1381
|
-
style="width: 60%; margin-left: auto; margin-right: auto"
|
|
1382
|
-
></div>
|
|
1383
|
-
|
|
1384
|
-
<div class="stats-section">
|
|
1385
|
-
<div class="stat-card">
|
|
1386
|
-
<div class="skeleton sk-stat-num"></div>
|
|
1387
|
-
<div class="skeleton sk-stat-label"></div>
|
|
1388
|
-
</div>
|
|
1389
|
-
<div class="stat-card stat-divider">
|
|
1390
|
-
<div class="skeleton sk-stat-num"></div>
|
|
1391
|
-
<div class="skeleton sk-stat-label"></div>
|
|
1392
|
-
</div>
|
|
1393
|
-
</div>
|
|
1394
|
-
|
|
1395
|
-
<div class="skeleton sk-title-md"></div>
|
|
1396
|
-
|
|
1397
|
-
<div class="table-header">
|
|
1398
|
-
<div class="skeleton sk-th col-user"></div>
|
|
1399
|
-
<div class="skeleton sk-th col-status"></div>
|
|
1400
|
-
<div class="skeleton sk-th col-reward"></div>
|
|
1401
|
-
<div class="skeleton sk-th col-date"></div>
|
|
1402
|
-
</div>
|
|
1403
|
-
|
|
1404
|
-
<div class="table-row">
|
|
1405
|
-
<div class="col-user">
|
|
1406
|
-
<div class="skeleton sk-text" style="width: 70%; margin: 0"></div>
|
|
1407
|
-
</div>
|
|
1408
|
-
<div class="col-status">
|
|
1409
|
-
<div class="skeleton sk-badge" style="margin: 0"></div>
|
|
1410
|
-
</div>
|
|
1411
|
-
<div class="col-reward">
|
|
1412
|
-
<div class="skeleton sk-reward-block" style="margin: 0"></div>
|
|
1413
|
-
</div>
|
|
1414
|
-
<div class="col-date">
|
|
1415
|
-
<div class="skeleton sk-text" style="width: 80%; margin: 0"></div>
|
|
1416
|
-
</div>
|
|
1417
|
-
</div>
|
|
1418
|
-
<div class="table-row">
|
|
1419
|
-
<div class="col-user">
|
|
1420
|
-
<div class="skeleton sk-text" style="width: 60%; margin: 0"></div>
|
|
1421
|
-
</div>
|
|
1422
|
-
<div class="col-status">
|
|
1423
|
-
<div class="skeleton sk-badge" style="margin: 0"></div>
|
|
1424
|
-
</div>
|
|
1425
|
-
<div class="col-reward">
|
|
1426
|
-
<div class="skeleton sk-reward-block" style="margin: 0"></div>
|
|
1427
|
-
</div>
|
|
1428
|
-
<div class="col-date">
|
|
1429
|
-
<div class="skeleton sk-text" style="width: 80%; margin: 0"></div>
|
|
1430
|
-
</div>
|
|
1431
|
-
</div>
|
|
1432
|
-
<div class="table-row">
|
|
1433
|
-
<div class="col-user">
|
|
1434
|
-
<div class="skeleton sk-text" style="width: 75%; margin: 0"></div>
|
|
1435
|
-
</div>
|
|
1436
|
-
<div class="col-status">
|
|
1437
|
-
<div class="skeleton sk-badge" style="margin: 0"></div>
|
|
1438
|
-
</div>
|
|
1439
|
-
<div class="col-reward">
|
|
1440
|
-
<div class="skeleton sk-reward-block" style="margin: 0"></div>
|
|
1441
|
-
</div>
|
|
1442
|
-
<div class="col-date">
|
|
1443
|
-
<div class="skeleton sk-text" style="width: 80%; margin: 0"></div>
|
|
1444
|
-
</div>
|
|
1445
|
-
</div>
|
|
1446
|
-
|
|
1447
|
-
<div class="pagination">
|
|
1448
|
-
<div class="skeleton sk-btn-page"></div>
|
|
1449
|
-
<div class="skeleton sk-btn-page"></div>
|
|
1450
|
-
</div>
|
|
1451
|
-
</div>
|
|
1452
|
-
`;
|
|
1453
|
-
};
|
|
1454
1109
|
const _log$7 = browserExports.debug("squatch-js:EMBEDwidget");
|
|
1455
1110
|
class EmbedWidget extends Widget {
|
|
1456
1111
|
constructor(params, container) {
|
|
@@ -1462,60 +1117,37 @@ class EmbedWidget extends Widget {
|
|
|
1462
1117
|
}
|
|
1463
1118
|
}
|
|
1464
1119
|
async load() {
|
|
1465
|
-
var _a2, _b, _c, _d, _e, _f, _g
|
|
1120
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
|
1466
1121
|
const brandingConfig = (_b = (_a2 = this.context.widgetConfig) == null ? void 0 : _a2.values) == null ? void 0 : _b.brandingConfig;
|
|
1467
1122
|
const initialHeight = brandingConfig == null ? void 0 : brandingConfig.loadingHeight;
|
|
1468
|
-
const
|
|
1469
|
-
const skeletonShimmerColor = (_f = (_e = brandingConfig == null ? void 0 : brandingConfig.color) == null ? void 0 : _e.loadingSkeleton) == null ? void 0 : _f.animationBackground;
|
|
1470
|
-
const borderColor = (_g = brandingConfig == null ? void 0 : brandingConfig.border) == null ? void 0 : _g.borderColor;
|
|
1471
|
-
const sizes = (_h = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _h.embeddedWidgets;
|
|
1123
|
+
const sizes = (_c = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _c.embeddedWidgets;
|
|
1472
1124
|
const maxWidth = (sizes == null ? void 0 : sizes.maxWidth) ? formatWidth(sizes.maxWidth) : "";
|
|
1473
1125
|
const minWidth = (sizes == null ? void 0 : sizes.minWidth) ? formatWidth(sizes.minWidth) : "";
|
|
1474
|
-
console.log({
|
|
1475
|
-
brandingConfig,
|
|
1476
|
-
initialHeight,
|
|
1477
|
-
widgetConfig: this.context.widgetConfig
|
|
1478
|
-
});
|
|
1479
|
-
const skeletonHTML = getSkeleton({
|
|
1480
|
-
height: initialHeight,
|
|
1481
|
-
skeletonBackgroundColor,
|
|
1482
|
-
skeletonShimmerColor,
|
|
1483
|
-
borderColor
|
|
1484
|
-
});
|
|
1485
|
-
const skeletonContainer = document.createElement("div");
|
|
1486
|
-
skeletonContainer.innerHTML = skeletonHTML;
|
|
1487
1126
|
const frame = this._createFrame({
|
|
1488
1127
|
minWidth,
|
|
1489
1128
|
maxWidth,
|
|
1490
1129
|
initialHeight
|
|
1491
1130
|
});
|
|
1492
1131
|
const element = this._findElement();
|
|
1493
|
-
|
|
1494
|
-
frame.style.display = "none";
|
|
1495
|
-
const injectContents = (target) => {
|
|
1496
|
-
target.appendChild(skeletonContainer);
|
|
1497
|
-
target.appendChild(frame);
|
|
1498
|
-
};
|
|
1499
|
-
if ((_i = this.context) == null ? void 0 : _i.container) {
|
|
1132
|
+
if ((_d = this.context) == null ? void 0 : _d.container) {
|
|
1500
1133
|
element.style.visibility = "hidden";
|
|
1501
1134
|
element.style.height = "0";
|
|
1502
1135
|
element.style["overflow-y"] = "hidden";
|
|
1503
1136
|
}
|
|
1504
1137
|
if (this.container) {
|
|
1505
1138
|
if (element.shadowRoot) {
|
|
1506
|
-
if (((
|
|
1139
|
+
if (((_e = element.shadowRoot.lastChild) == null ? void 0 : _e.nodeName) === "IFRAME") {
|
|
1507
1140
|
element.shadowRoot.replaceChild(frame, element.shadowRoot.lastChild);
|
|
1508
1141
|
} else {
|
|
1509
|
-
|
|
1142
|
+
element.shadowRoot.appendChild(frame);
|
|
1510
1143
|
}
|
|
1511
1144
|
} else if (element.firstChild) {
|
|
1512
|
-
element.
|
|
1513
|
-
injectContents(element);
|
|
1145
|
+
element.replaceChild(frame, element.firstChild);
|
|
1514
1146
|
} else {
|
|
1515
|
-
|
|
1147
|
+
element.appendChild(frame);
|
|
1516
1148
|
}
|
|
1517
1149
|
} else if (!element.firstChild || element.firstChild.nodeName === "#text") {
|
|
1518
|
-
|
|
1150
|
+
element.appendChild(frame);
|
|
1519
1151
|
}
|
|
1520
1152
|
const { contentWindow } = frame;
|
|
1521
1153
|
if (!contentWindow) {
|
|
@@ -1523,16 +1155,15 @@ class EmbedWidget extends Widget {
|
|
|
1523
1155
|
}
|
|
1524
1156
|
const frameDoc = contentWindow.document;
|
|
1525
1157
|
frameDoc.open();
|
|
1526
|
-
console.log({ content: this.content, context: this.context, this: this });
|
|
1527
1158
|
const domain = this.widgetApi.domain;
|
|
1528
1159
|
frameDoc.write(`
|
|
1529
|
-
${((
|
|
1160
|
+
${((_f = brandingConfig == null ? void 0 : brandingConfig.main) == null ? void 0 : _f.brandFont) ? `
|
|
1530
1161
|
<link rel="preconnect" href="https://fast${domain === "https://staging.referralsaasquatch.com" && "-staging"}.ssqt.io">
|
|
1531
1162
|
<link rel="preconnect" href="https://fonts.gstatic.com">
|
|
1532
1163
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
1533
1164
|
<link rel="preload" href="https://fonts.googleapis.com/css2?family=${encodeURIComponent(
|
|
1534
|
-
(
|
|
1535
|
-
)}" as="style">`}
|
|
1165
|
+
(_g = brandingConfig == null ? void 0 : brandingConfig.main) == null ? void 0 : _g.brandFont
|
|
1166
|
+
)}" as="style">` : ""}
|
|
1536
1167
|
<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>
|
|
1537
1168
|
<style data-styles>
|
|
1538
1169
|
html { visibility:hidden;}
|
|
@@ -1542,10 +1173,6 @@ class EmbedWidget extends Widget {
|
|
|
1542
1173
|
`);
|
|
1543
1174
|
frameDoc.close();
|
|
1544
1175
|
domready(frameDoc, async () => {
|
|
1545
|
-
if (skeletonContainer && skeletonContainer.parentNode) {
|
|
1546
|
-
skeletonContainer.parentNode.removeChild(skeletonContainer);
|
|
1547
|
-
}
|
|
1548
|
-
frame.style.display = "block";
|
|
1549
1176
|
const _sqh = contentWindow.squatch || contentWindow.widgetIdent;
|
|
1550
1177
|
frame.height = initialHeight || frameDoc.body.scrollHeight;
|
|
1551
1178
|
console.log({ height: frameDoc.body.scrollHeight });
|
|
@@ -2230,6 +1857,264 @@ function _getAutoConfig() {
|
|
|
2230
1857
|
}
|
|
2231
1858
|
};
|
|
2232
1859
|
}
|
|
1860
|
+
const getSkeleton = ({
|
|
1861
|
+
type = "verified-access",
|
|
1862
|
+
height = "500px",
|
|
1863
|
+
skeletonBackgroundColor = "#e0e0e0",
|
|
1864
|
+
skeletonShimmerColor = "#f5f5f5"
|
|
1865
|
+
}) => {
|
|
1866
|
+
const referrerHTML = `
|
|
1867
|
+
<div class="hero-section">
|
|
1868
|
+
<div class="hero-content">
|
|
1869
|
+
<div class="skeleton sk-title-lg"></div>
|
|
1870
|
+
<div class="skeleton sk-text"></div>
|
|
1871
|
+
<div class="skeleton sk-text sk-text-short"></div>
|
|
1872
|
+
</div>
|
|
1873
|
+
<div class="skeleton hero-image"></div>
|
|
1874
|
+
</div>
|
|
1875
|
+
|
|
1876
|
+
<div class="share-section">
|
|
1877
|
+
<div class="skeleton sk-label"></div>
|
|
1878
|
+
<div class="skeleton sk-input"></div>
|
|
1879
|
+
<div class="social-buttons">
|
|
1880
|
+
<div class="skeleton sk-btn-social"></div>
|
|
1881
|
+
<div class="skeleton sk-btn-social"></div>
|
|
1882
|
+
<div class="skeleton sk-btn-social"></div>
|
|
1883
|
+
<div class="skeleton sk-btn-social"></div>
|
|
1884
|
+
</div>
|
|
1885
|
+
</div>
|
|
1886
|
+
|
|
1887
|
+
<div class="skeleton sk-title-md" style="margin-top: 0; width: 30%; margin-left: auto; margin-right: auto"></div>
|
|
1888
|
+
<div class="skeleton sk-text" style="width: 60%; margin-left: auto; margin-right: auto"></div>
|
|
1889
|
+
|
|
1890
|
+
<div class="stats-section">
|
|
1891
|
+
<div class="stat-card">
|
|
1892
|
+
<div class="skeleton sk-stat-num"></div>
|
|
1893
|
+
<div class="skeleton sk-stat-label"></div>
|
|
1894
|
+
</div>
|
|
1895
|
+
<div class="stat-card stat-divider">
|
|
1896
|
+
<div class="skeleton sk-stat-num"></div>
|
|
1897
|
+
<div class="skeleton sk-stat-label"></div>
|
|
1898
|
+
</div>
|
|
1899
|
+
</div>
|
|
1900
|
+
|
|
1901
|
+
<div class="skeleton sk-title-md"></div>
|
|
1902
|
+
|
|
1903
|
+
<div class="table-header">
|
|
1904
|
+
<div class="skeleton sk-th col-user"></div>
|
|
1905
|
+
<div class="skeleton sk-th col-status"></div>
|
|
1906
|
+
<div class="skeleton sk-th col-reward"></div>
|
|
1907
|
+
<div class="skeleton sk-th col-date"></div>
|
|
1908
|
+
</div>
|
|
1909
|
+
|
|
1910
|
+
<div class="table-row">
|
|
1911
|
+
<div class="col-user"><div class="skeleton sk-text" style="width: 70%; margin: 0"></div></div>
|
|
1912
|
+
<div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
|
|
1913
|
+
<div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
|
|
1914
|
+
<div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
|
|
1915
|
+
</div>
|
|
1916
|
+
|
|
1917
|
+
<div class="table-row">
|
|
1918
|
+
<div class="col-user"><div class="skeleton sk-text" style="width: 60%; margin: 0"></div></div>
|
|
1919
|
+
<div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
|
|
1920
|
+
<div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
|
|
1921
|
+
<div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
|
|
1922
|
+
</div>
|
|
1923
|
+
|
|
1924
|
+
<div class="table-row">
|
|
1925
|
+
<div class="col-user"><div class="skeleton sk-text" style="width: 75%; margin: 0"></div></div>
|
|
1926
|
+
<div class="col-status"><div class="skeleton sk-badge" style="margin: 0"></div></div>
|
|
1927
|
+
<div class="col-reward"><div class="skeleton sk-reward-block" style="margin: 0"></div></div>
|
|
1928
|
+
<div class="col-date"><div class="skeleton sk-text" style="width: 80%; margin: 0"></div></div>
|
|
1929
|
+
</div>
|
|
1930
|
+
|
|
1931
|
+
<div class="pagination">
|
|
1932
|
+
<div class="skeleton sk-btn-page"></div>
|
|
1933
|
+
<div class="skeleton sk-btn-page"></div>
|
|
1934
|
+
</div>
|
|
1935
|
+
`;
|
|
1936
|
+
const instantAccessHTML = `
|
|
1937
|
+
<div class="hero-section instant-access-layout">
|
|
1938
|
+
<div class="skeleton hero-image ia-image"></div>
|
|
1939
|
+
|
|
1940
|
+
<div class="hero-content ia-content">
|
|
1941
|
+
<div class="skeleton sk-title-lg ia-center"></div>
|
|
1942
|
+
<div class="skeleton sk-text ia-center"></div>
|
|
1943
|
+
|
|
1944
|
+
<div class="skeleton sk-btn-action"></div>
|
|
1945
|
+
|
|
1946
|
+
<div class="skeleton sk-label"></div>
|
|
1947
|
+
<div class="input-group">
|
|
1948
|
+
<div class="skeleton sk-input"></div>
|
|
1949
|
+
<div class="skeleton sk-btn-copy"></div>
|
|
1950
|
+
</div>
|
|
1951
|
+
|
|
1952
|
+
<div class="skeleton sk-text-short ia-center" style="margin-top: 20px; width: 30%"></div>
|
|
1953
|
+
<div class="skeleton sk-text-short ia-center" style="width: 20%"></div>
|
|
1954
|
+
</div>
|
|
1955
|
+
</div>
|
|
1956
|
+
`;
|
|
1957
|
+
return `
|
|
1958
|
+
<style>
|
|
1959
|
+
* {
|
|
1960
|
+
box-sizing: border-box;
|
|
1961
|
+
padding: 0;
|
|
1962
|
+
margin: 0;
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
.widget-container {
|
|
1966
|
+
background: white;
|
|
1967
|
+
width: 100%;
|
|
1968
|
+
padding: 40px;
|
|
1969
|
+
box-sizing: border-box;
|
|
1970
|
+
overflow: hidden;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
@keyframes shimmer {
|
|
1974
|
+
0% { background-position: -100% 0; }
|
|
1975
|
+
100% { background-position: 100% 0; }
|
|
1976
|
+
}
|
|
1977
|
+
|
|
1978
|
+
.skeleton {
|
|
1979
|
+
background: ${skeletonBackgroundColor};
|
|
1980
|
+
background: linear-gradient(
|
|
1981
|
+
90deg,
|
|
1982
|
+
${skeletonBackgroundColor} 25%,
|
|
1983
|
+
${skeletonShimmerColor} 50%,
|
|
1984
|
+
${skeletonBackgroundColor} 75%
|
|
1985
|
+
);
|
|
1986
|
+
background-size: 200% 100%;
|
|
1987
|
+
animation: shimmer 1.5s infinite linear;
|
|
1988
|
+
border-radius: 6px;
|
|
1989
|
+
margin-bottom: 12px;
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
/* Typography Skeletons */
|
|
1993
|
+
.sk-title-lg { height: 36px; width: 80%; margin-bottom: 16px; }
|
|
1994
|
+
.sk-title-md { height: 28px; width: 30%; margin-bottom: 20px; margin-top: 40px; }
|
|
1995
|
+
.sk-text { height: 16px; width: 90%; margin-bottom: 8px; }
|
|
1996
|
+
.sk-text-short { width: 40%; }
|
|
1997
|
+
.sk-label { height: 14px; width: 25%; margin-bottom: 10px; }
|
|
1998
|
+
|
|
1999
|
+
/* Layouts */
|
|
2000
|
+
.hero-section {
|
|
2001
|
+
display: flex;
|
|
2002
|
+
gap: 40px;
|
|
2003
|
+
margin-bottom: 40px;
|
|
2004
|
+
padding-bottom: 40px;
|
|
2005
|
+
flex-direction: row;
|
|
2006
|
+
height: 100%;
|
|
2007
|
+
/* Removed border-bottom */
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
.hero-content {
|
|
2011
|
+
flex: 1;
|
|
2012
|
+
display: flex;
|
|
2013
|
+
flex-direction: column;
|
|
2014
|
+
justify-content: center;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
.hero-image {
|
|
2018
|
+
flex: 1;
|
|
2019
|
+
height: 300px;
|
|
2020
|
+
border-radius: 12px;
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
/* -- Specific Instant Access Overrides -- */
|
|
2024
|
+
.instant-access-layout {
|
|
2025
|
+
margin-bottom: 0;
|
|
2026
|
+
padding-bottom: 0;
|
|
2027
|
+
align-items: center;
|
|
2028
|
+
}
|
|
2029
|
+
.ia-image {
|
|
2030
|
+
height: 400px;
|
|
2031
|
+
}
|
|
2032
|
+
.ia-center {
|
|
2033
|
+
margin-left: auto;
|
|
2034
|
+
margin-right: auto;
|
|
2035
|
+
}
|
|
2036
|
+
.ia-content {
|
|
2037
|
+
align-items: center;
|
|
2038
|
+
text-align: center;
|
|
2039
|
+
}
|
|
2040
|
+
.sk-btn-action {
|
|
2041
|
+
height: 45px;
|
|
2042
|
+
width: 140px;
|
|
2043
|
+
border-radius: 6px;
|
|
2044
|
+
margin: 24px auto;
|
|
2045
|
+
}
|
|
2046
|
+
.input-group {
|
|
2047
|
+
display: flex;
|
|
2048
|
+
gap: 10px;
|
|
2049
|
+
width: 100%;
|
|
2050
|
+
max-width: 400px;
|
|
2051
|
+
}
|
|
2052
|
+
.sk-btn-copy {
|
|
2053
|
+
height: 50px;
|
|
2054
|
+
width: 120px;
|
|
2055
|
+
border-radius: 8px;
|
|
2056
|
+
}
|
|
2057
|
+
/* ------------------------------------- */
|
|
2058
|
+
|
|
2059
|
+
.share-section { margin-bottom: 40px; }
|
|
2060
|
+
.sk-input { height: 50px; width: 100%; border-radius: 8px; margin-bottom: 16px; }
|
|
2061
|
+
|
|
2062
|
+
.social-buttons { display: flex; gap: 12px; }
|
|
2063
|
+
.sk-btn-social { flex: 1; height: 50px; border-radius: 8px; }
|
|
2064
|
+
|
|
2065
|
+
.stats-section {
|
|
2066
|
+
display: flex;
|
|
2067
|
+
gap: 24px;
|
|
2068
|
+
margin-bottom: 40px;
|
|
2069
|
+
padding: 30px 0;
|
|
2070
|
+
/* Removed border-top and border-bottom */
|
|
2071
|
+
}
|
|
2072
|
+
.stat-card { flex: 1; display: flex; flex-direction: column; align-items: center; }
|
|
2073
|
+
.stat-divider { padding-left: 24px; }
|
|
2074
|
+
.sk-stat-num { height: 48px; width: 120px; margin-bottom: 8px; }
|
|
2075
|
+
.sk-stat-label { height: 18px; width: 80px; }
|
|
2076
|
+
|
|
2077
|
+
/* Table Styles */
|
|
2078
|
+
.table-header { display: flex; gap: 16px; margin-bottom: 16px; }
|
|
2079
|
+
.sk-th { height: 16px; }
|
|
2080
|
+
.table-row {
|
|
2081
|
+
display: flex;
|
|
2082
|
+
align-items: center;
|
|
2083
|
+
gap: 16px;
|
|
2084
|
+
padding: 16px 0;
|
|
2085
|
+
/* Removed border-bottom */
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
.col-user { flex: 2; }
|
|
2089
|
+
.col-status { flex: 1; }
|
|
2090
|
+
.col-reward { flex: 2; }
|
|
2091
|
+
.col-date { flex: 1; }
|
|
2092
|
+
|
|
2093
|
+
.sk-badge { height: 28px; width: 90px; border-radius: 14px; }
|
|
2094
|
+
.sk-reward-block { height: 36px; width: 100%; border-radius: 6px; }
|
|
2095
|
+
|
|
2096
|
+
.pagination { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
|
|
2097
|
+
.sk-btn-page { height: 36px; width: 64px; border-radius: 6px; margin-bottom: 0; }
|
|
2098
|
+
|
|
2099
|
+
@media (max-width: 768px) {
|
|
2100
|
+
body { padding: 20px; }
|
|
2101
|
+
.widget-container { padding: 24px; }
|
|
2102
|
+
|
|
2103
|
+
.hero-section { flex-direction: column-reverse; gap: 24px; }
|
|
2104
|
+
.instant-access-layout { flex-direction: column; }
|
|
2105
|
+
|
|
2106
|
+
.hero-image { height: 220px; width: 100%; }
|
|
2107
|
+
.sk-title-lg { width: 100%; }
|
|
2108
|
+
|
|
2109
|
+
.col-date { display: none; }
|
|
2110
|
+
}
|
|
2111
|
+
</style>
|
|
2112
|
+
|
|
2113
|
+
<div class="widget-container">
|
|
2114
|
+
${type === "verified-access" ? referrerHTML : instantAccessHTML}
|
|
2115
|
+
</div>
|
|
2116
|
+
`;
|
|
2117
|
+
};
|
|
2233
2118
|
const _log$2 = browserExports.debug("squatch-js:decodeUserJwt");
|
|
2234
2119
|
function decodeUserJwt(tokenStr) {
|
|
2235
2120
|
var _a2;
|
|
@@ -2368,6 +2253,12 @@ class DeclarativeWidget extends HTMLElement {
|
|
|
2368
2253
|
domain: (config == null ? void 0 : config.domain) || ((_b = this.config) == null ? void 0 : _b.domain) || DEFAULT_DOMAIN
|
|
2369
2254
|
});
|
|
2370
2255
|
}
|
|
2256
|
+
getWidgetType(widgetType) {
|
|
2257
|
+
if (widgetType && (widgetType.includes("websiteReferralWidget") || widgetType.includes("friendWidget"))) {
|
|
2258
|
+
return "instant-access";
|
|
2259
|
+
}
|
|
2260
|
+
return "verified-access";
|
|
2261
|
+
}
|
|
2371
2262
|
async renderPasswordlessVariant() {
|
|
2372
2263
|
this._setupApis();
|
|
2373
2264
|
_log$1("Rendering as an Instant Access widget");
|
|
@@ -2463,12 +2354,26 @@ class DeclarativeEmbedWidget extends DeclarativeWidget {
|
|
|
2463
2354
|
}
|
|
2464
2355
|
}
|
|
2465
2356
|
async connectedCallback() {
|
|
2466
|
-
var _a2, _b;
|
|
2467
2357
|
this.loaded = true;
|
|
2468
2358
|
this.container = this.getAttribute("container");
|
|
2359
|
+
this.widgetType = this.getAttribute("widget") || void 0;
|
|
2360
|
+
console.log("widget type", this.widgetType);
|
|
2361
|
+
const skeletonWidgetType = this.getWidgetType(this.widgetType);
|
|
2362
|
+
const skeletonHTML = getSkeleton({
|
|
2363
|
+
height: "100%",
|
|
2364
|
+
type: skeletonWidgetType
|
|
2365
|
+
});
|
|
2366
|
+
const skeletonContainer = document.createElement("div");
|
|
2367
|
+
skeletonContainer.id = "loading-skeleton";
|
|
2368
|
+
skeletonContainer.innerHTML = skeletonHTML;
|
|
2369
|
+
const root = this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
2370
|
+
root.innerHTML = "";
|
|
2371
|
+
root.appendChild(skeletonContainer);
|
|
2469
2372
|
await this.renderWidget();
|
|
2470
|
-
const
|
|
2471
|
-
if (
|
|
2373
|
+
const loadingElement = root.getElementById("loading-skeleton");
|
|
2374
|
+
if (loadingElement) {
|
|
2375
|
+
loadingElement.remove();
|
|
2376
|
+
}
|
|
2472
2377
|
if (this.getAttribute("open") !== null) this.open();
|
|
2473
2378
|
}
|
|
2474
2379
|
}
|
|
@@ -2497,7 +2402,23 @@ class DeclarativePopupWidget extends DeclarativeWidget {
|
|
|
2497
2402
|
async connectedCallback() {
|
|
2498
2403
|
this.loaded = true;
|
|
2499
2404
|
this.container = this.getAttribute("container");
|
|
2405
|
+
this.widgetType = this.getAttribute("widget") || void 0;
|
|
2406
|
+
const skeletonWidgetType = this.getWidgetType(this.widgetType);
|
|
2407
|
+
const skeletonHTML = getSkeleton({
|
|
2408
|
+
height: "100%",
|
|
2409
|
+
type: skeletonWidgetType
|
|
2410
|
+
});
|
|
2411
|
+
const skeletonContainer = document.createElement("div");
|
|
2412
|
+
skeletonContainer.id = "loading-skeleton";
|
|
2413
|
+
skeletonContainer.innerHTML = skeletonHTML;
|
|
2414
|
+
const root = this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
2415
|
+
root.innerHTML = "";
|
|
2416
|
+
root.appendChild(skeletonContainer);
|
|
2500
2417
|
await this.renderWidget();
|
|
2418
|
+
const loadingElement = root.getElementById("loading-skeleton");
|
|
2419
|
+
if (loadingElement) {
|
|
2420
|
+
loadingElement.remove();
|
|
2421
|
+
}
|
|
2501
2422
|
if (this.getAttribute("open") !== null) this.open();
|
|
2502
2423
|
}
|
|
2503
2424
|
}
|