@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.js
CHANGED
|
@@ -1110,351 +1110,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1110
1110
|
setTimeout(resolve, duration);
|
|
1111
1111
|
});
|
|
1112
1112
|
}
|
|
1113
|
-
const getSkeleton = ({
|
|
1114
|
-
height = "500px",
|
|
1115
|
-
skeletonBackgroundColor = "#e0e0e0",
|
|
1116
|
-
skeletonShimmerColor = "#f5f5f5",
|
|
1117
|
-
borderColor = "#ccc"
|
|
1118
|
-
}) => {
|
|
1119
|
-
return `
|
|
1120
|
-
<style>
|
|
1121
|
-
* {
|
|
1122
|
-
box-sizing: border-box;
|
|
1123
|
-
padding: 0;
|
|
1124
|
-
margin: 0;
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
.widget-container {
|
|
1128
|
-
background: white;
|
|
1129
|
-
width: 100%;
|
|
1130
|
-
max-width: 900px;
|
|
1131
|
-
padding: 40px;
|
|
1132
|
-
border-radius: 12px;
|
|
1133
|
-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
|
|
1134
|
-
box-sizing: border-box;
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
@keyframes shimmer {
|
|
1138
|
-
0% {
|
|
1139
|
-
background-position: -100% 0;
|
|
1140
|
-
}
|
|
1141
|
-
100% {
|
|
1142
|
-
background-position: 100% 0;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
.skeleton {
|
|
1147
|
-
background: ${skeletonBackgroundColor};
|
|
1148
|
-
background: linear-gradient(
|
|
1149
|
-
90deg,
|
|
1150
|
-
${skeletonBackgroundColor} 25%,
|
|
1151
|
-
${skeletonShimmerColor} 50%,
|
|
1152
|
-
${skeletonBackgroundColor} 75%
|
|
1153
|
-
);
|
|
1154
|
-
background-size: 200% 100%;
|
|
1155
|
-
animation: shimmer 1.5s infinite linear;
|
|
1156
|
-
border-radius: 6px;
|
|
1157
|
-
margin-bottom: 12px;
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
.sk-title-lg {
|
|
1161
|
-
height: 36px;
|
|
1162
|
-
width: 50%;
|
|
1163
|
-
margin-bottom: 16px;
|
|
1164
|
-
}
|
|
1165
|
-
.sk-title-md {
|
|
1166
|
-
height: 28px;
|
|
1167
|
-
width: 30%;
|
|
1168
|
-
margin-bottom: 20px;
|
|
1169
|
-
margin-top: 40px;
|
|
1170
|
-
}
|
|
1171
|
-
.sk-text {
|
|
1172
|
-
height: 16px;
|
|
1173
|
-
width: 80%;
|
|
1174
|
-
margin-bottom: 8px;
|
|
1175
|
-
}
|
|
1176
|
-
.sk-text-short {
|
|
1177
|
-
width: 40%;
|
|
1178
|
-
}
|
|
1179
|
-
.sk-label {
|
|
1180
|
-
height: 14px;
|
|
1181
|
-
width: 25%;
|
|
1182
|
-
margin-bottom: 10px;
|
|
1183
|
-
}
|
|
1184
|
-
|
|
1185
|
-
.hero-section {
|
|
1186
|
-
display: flex;
|
|
1187
|
-
gap: 40px;
|
|
1188
|
-
margin-bottom: 40px;
|
|
1189
|
-
border-bottom: 1px solid ${borderColor};
|
|
1190
|
-
padding-bottom: 40px;
|
|
1191
|
-
flex-direction: row;
|
|
1192
|
-
}
|
|
1193
|
-
.hero-content {
|
|
1194
|
-
flex: 1;
|
|
1195
|
-
display: flex;
|
|
1196
|
-
flex-direction: column;
|
|
1197
|
-
justify-content: center;
|
|
1198
|
-
}
|
|
1199
|
-
.hero-image {
|
|
1200
|
-
flex: 1;
|
|
1201
|
-
height: 300px;
|
|
1202
|
-
border-radius: 12px;
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
.share-section {
|
|
1206
|
-
margin-bottom: 40px;
|
|
1207
|
-
}
|
|
1208
|
-
.sk-input {
|
|
1209
|
-
height: 50px;
|
|
1210
|
-
width: 100%;
|
|
1211
|
-
border-radius: 8px;
|
|
1212
|
-
margin-bottom: 16px;
|
|
1213
|
-
}
|
|
1214
|
-
.social-buttons {
|
|
1215
|
-
display: flex;
|
|
1216
|
-
gap: 12px;
|
|
1217
|
-
}
|
|
1218
|
-
.sk-btn-social {
|
|
1219
|
-
flex: 1;
|
|
1220
|
-
height: 50px;
|
|
1221
|
-
border-radius: 8px;
|
|
1222
|
-
}
|
|
1223
|
-
|
|
1224
|
-
.stats-section {
|
|
1225
|
-
display: flex;
|
|
1226
|
-
gap: 24px;
|
|
1227
|
-
margin-bottom: 40px;
|
|
1228
|
-
padding: 30px 0;
|
|
1229
|
-
border-top: 1px solid ${borderColor};
|
|
1230
|
-
border-bottom: 1px solid ${borderColor};
|
|
1231
|
-
}
|
|
1232
|
-
.stat-card {
|
|
1233
|
-
flex: 1;
|
|
1234
|
-
display: flex;
|
|
1235
|
-
flex-direction: column;
|
|
1236
|
-
align-items: center;
|
|
1237
|
-
}
|
|
1238
|
-
.stat-divider {
|
|
1239
|
-
padding-left: 24px;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
|
-
.sk-stat-num {
|
|
1243
|
-
height: 48px;
|
|
1244
|
-
width: 120px;
|
|
1245
|
-
margin-bottom: 8px;
|
|
1246
|
-
}
|
|
1247
|
-
.sk-stat-label {
|
|
1248
|
-
height: 18px;
|
|
1249
|
-
width: 80px;
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
.table-header {
|
|
1253
|
-
display: flex;
|
|
1254
|
-
gap: 16px;
|
|
1255
|
-
margin-bottom: 16px;
|
|
1256
|
-
}
|
|
1257
|
-
.sk-th {
|
|
1258
|
-
height: 16px;
|
|
1259
|
-
}
|
|
1260
|
-
.table-row {
|
|
1261
|
-
display: flex;
|
|
1262
|
-
align-items: center;
|
|
1263
|
-
gap: 16px;
|
|
1264
|
-
padding: 16px 0;
|
|
1265
|
-
border-bottom: 1px solid ${borderColor};
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
|
-
.col-user {
|
|
1269
|
-
flex: 2;
|
|
1270
|
-
}
|
|
1271
|
-
.col-status {
|
|
1272
|
-
flex: 1;
|
|
1273
|
-
}
|
|
1274
|
-
.col-reward {
|
|
1275
|
-
flex: 2;
|
|
1276
|
-
}
|
|
1277
|
-
.col-date {
|
|
1278
|
-
flex: 1;
|
|
1279
|
-
}
|
|
1280
|
-
|
|
1281
|
-
.sk-badge {
|
|
1282
|
-
height: 28px;
|
|
1283
|
-
width: 90px;
|
|
1284
|
-
border-radius: 14px;
|
|
1285
|
-
}
|
|
1286
|
-
.sk-reward-block {
|
|
1287
|
-
height: 36px;
|
|
1288
|
-
width: 100%;
|
|
1289
|
-
border-radius: 6px;
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1292
|
-
.pagination {
|
|
1293
|
-
display: flex;
|
|
1294
|
-
justify-content: flex-end;
|
|
1295
|
-
gap: 8px;
|
|
1296
|
-
margin-top: 24px;
|
|
1297
|
-
}
|
|
1298
|
-
.sk-btn-page {
|
|
1299
|
-
height: 36px;
|
|
1300
|
-
width: 64px;
|
|
1301
|
-
border-radius: 6px;
|
|
1302
|
-
margin-bottom: 0;
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
@media (max-width: 768px) {
|
|
1306
|
-
body {
|
|
1307
|
-
padding: 20px;
|
|
1308
|
-
}
|
|
1309
|
-
.widget-container {
|
|
1310
|
-
padding: 24px;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
.hero-section {
|
|
1314
|
-
flex-direction: column-reverse;
|
|
1315
|
-
gap: 24px;
|
|
1316
|
-
}
|
|
1317
|
-
.hero-image {
|
|
1318
|
-
height: 220px;
|
|
1319
|
-
width: 100%;
|
|
1320
|
-
}
|
|
1321
|
-
.sk-title-lg {
|
|
1322
|
-
width: 80%;
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
.col-date {
|
|
1326
|
-
display: none;
|
|
1327
|
-
}
|
|
1328
|
-
}
|
|
1329
|
-
|
|
1330
|
-
@media (max-width: 480px) {
|
|
1331
|
-
body {
|
|
1332
|
-
padding: 10px;
|
|
1333
|
-
}
|
|
1334
|
-
.widget-container {
|
|
1335
|
-
padding: 16px;
|
|
1336
|
-
}
|
|
1337
|
-
|
|
1338
|
-
.sk-stat-num {
|
|
1339
|
-
width: 80px;
|
|
1340
|
-
height: 40px;
|
|
1341
|
-
}
|
|
1342
|
-
|
|
1343
|
-
.col-reward {
|
|
1344
|
-
display: none;
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
.col-user {
|
|
1348
|
-
flex: 3;
|
|
1349
|
-
}
|
|
1350
|
-
.col-status {
|
|
1351
|
-
flex: 2;
|
|
1352
|
-
display: flex;
|
|
1353
|
-
justify-content: flex-end;
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
</style>
|
|
1357
|
-
|
|
1358
|
-
<div class="widget-container">
|
|
1359
|
-
<div class="hero-section">
|
|
1360
|
-
<div class="hero-content">
|
|
1361
|
-
<div class="skeleton sk-title-lg"></div>
|
|
1362
|
-
<div class="skeleton sk-text"></div>
|
|
1363
|
-
<div class="skeleton sk-text sk-text-short"></div>
|
|
1364
|
-
</div>
|
|
1365
|
-
<div class="skeleton hero-image"></div>
|
|
1366
|
-
</div>
|
|
1367
|
-
|
|
1368
|
-
<div class="share-section">
|
|
1369
|
-
<div class="skeleton sk-label"></div>
|
|
1370
|
-
<div class="skeleton sk-input"></div>
|
|
1371
|
-
<div class="social-buttons">
|
|
1372
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1373
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1374
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1375
|
-
<div class="skeleton sk-btn-social"></div>
|
|
1376
|
-
</div>
|
|
1377
|
-
</div>
|
|
1378
|
-
|
|
1379
|
-
<div
|
|
1380
|
-
class="skeleton sk-title-md"
|
|
1381
|
-
style="margin-top: 0; width: 30%; margin-left: auto; margin-right: auto"
|
|
1382
|
-
></div>
|
|
1383
|
-
<div
|
|
1384
|
-
class="skeleton sk-text"
|
|
1385
|
-
style="width: 60%; margin-left: auto; margin-right: auto"
|
|
1386
|
-
></div>
|
|
1387
|
-
|
|
1388
|
-
<div class="stats-section">
|
|
1389
|
-
<div class="stat-card">
|
|
1390
|
-
<div class="skeleton sk-stat-num"></div>
|
|
1391
|
-
<div class="skeleton sk-stat-label"></div>
|
|
1392
|
-
</div>
|
|
1393
|
-
<div class="stat-card stat-divider">
|
|
1394
|
-
<div class="skeleton sk-stat-num"></div>
|
|
1395
|
-
<div class="skeleton sk-stat-label"></div>
|
|
1396
|
-
</div>
|
|
1397
|
-
</div>
|
|
1398
|
-
|
|
1399
|
-
<div class="skeleton sk-title-md"></div>
|
|
1400
|
-
|
|
1401
|
-
<div class="table-header">
|
|
1402
|
-
<div class="skeleton sk-th col-user"></div>
|
|
1403
|
-
<div class="skeleton sk-th col-status"></div>
|
|
1404
|
-
<div class="skeleton sk-th col-reward"></div>
|
|
1405
|
-
<div class="skeleton sk-th col-date"></div>
|
|
1406
|
-
</div>
|
|
1407
|
-
|
|
1408
|
-
<div class="table-row">
|
|
1409
|
-
<div class="col-user">
|
|
1410
|
-
<div class="skeleton sk-text" style="width: 70%; margin: 0"></div>
|
|
1411
|
-
</div>
|
|
1412
|
-
<div class="col-status">
|
|
1413
|
-
<div class="skeleton sk-badge" style="margin: 0"></div>
|
|
1414
|
-
</div>
|
|
1415
|
-
<div class="col-reward">
|
|
1416
|
-
<div class="skeleton sk-reward-block" style="margin: 0"></div>
|
|
1417
|
-
</div>
|
|
1418
|
-
<div class="col-date">
|
|
1419
|
-
<div class="skeleton sk-text" style="width: 80%; margin: 0"></div>
|
|
1420
|
-
</div>
|
|
1421
|
-
</div>
|
|
1422
|
-
<div class="table-row">
|
|
1423
|
-
<div class="col-user">
|
|
1424
|
-
<div class="skeleton sk-text" style="width: 60%; margin: 0"></div>
|
|
1425
|
-
</div>
|
|
1426
|
-
<div class="col-status">
|
|
1427
|
-
<div class="skeleton sk-badge" style="margin: 0"></div>
|
|
1428
|
-
</div>
|
|
1429
|
-
<div class="col-reward">
|
|
1430
|
-
<div class="skeleton sk-reward-block" style="margin: 0"></div>
|
|
1431
|
-
</div>
|
|
1432
|
-
<div class="col-date">
|
|
1433
|
-
<div class="skeleton sk-text" style="width: 80%; margin: 0"></div>
|
|
1434
|
-
</div>
|
|
1435
|
-
</div>
|
|
1436
|
-
<div class="table-row">
|
|
1437
|
-
<div class="col-user">
|
|
1438
|
-
<div class="skeleton sk-text" style="width: 75%; margin: 0"></div>
|
|
1439
|
-
</div>
|
|
1440
|
-
<div class="col-status">
|
|
1441
|
-
<div class="skeleton sk-badge" style="margin: 0"></div>
|
|
1442
|
-
</div>
|
|
1443
|
-
<div class="col-reward">
|
|
1444
|
-
<div class="skeleton sk-reward-block" style="margin: 0"></div>
|
|
1445
|
-
</div>
|
|
1446
|
-
<div class="col-date">
|
|
1447
|
-
<div class="skeleton sk-text" style="width: 80%; margin: 0"></div>
|
|
1448
|
-
</div>
|
|
1449
|
-
</div>
|
|
1450
|
-
|
|
1451
|
-
<div class="pagination">
|
|
1452
|
-
<div class="skeleton sk-btn-page"></div>
|
|
1453
|
-
<div class="skeleton sk-btn-page"></div>
|
|
1454
|
-
</div>
|
|
1455
|
-
</div>
|
|
1456
|
-
`;
|
|
1457
|
-
};
|
|
1458
1113
|
const _log$7 = browserExports.debug("squatch-js:EMBEDwidget");
|
|
1459
1114
|
class EmbedWidget extends Widget {
|
|
1460
1115
|
constructor(params, container) {
|
|
@@ -1466,60 +1121,37 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1466
1121
|
}
|
|
1467
1122
|
}
|
|
1468
1123
|
async load() {
|
|
1469
|
-
var _a2, _b, _c, _d, _e, _f, _g
|
|
1124
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
|
1470
1125
|
const brandingConfig = (_b = (_a2 = this.context.widgetConfig) == null ? void 0 : _a2.values) == null ? void 0 : _b.brandingConfig;
|
|
1471
1126
|
const initialHeight = brandingConfig == null ? void 0 : brandingConfig.loadingHeight;
|
|
1472
|
-
const
|
|
1473
|
-
const skeletonShimmerColor = (_f = (_e = brandingConfig == null ? void 0 : brandingConfig.color) == null ? void 0 : _e.loadingSkeleton) == null ? void 0 : _f.animationBackground;
|
|
1474
|
-
const borderColor = (_g = brandingConfig == null ? void 0 : brandingConfig.border) == null ? void 0 : _g.borderColor;
|
|
1475
|
-
const sizes = (_h = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _h.embeddedWidgets;
|
|
1127
|
+
const sizes = (_c = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _c.embeddedWidgets;
|
|
1476
1128
|
const maxWidth = (sizes == null ? void 0 : sizes.maxWidth) ? formatWidth(sizes.maxWidth) : "";
|
|
1477
1129
|
const minWidth = (sizes == null ? void 0 : sizes.minWidth) ? formatWidth(sizes.minWidth) : "";
|
|
1478
|
-
console.log({
|
|
1479
|
-
brandingConfig,
|
|
1480
|
-
initialHeight,
|
|
1481
|
-
widgetConfig: this.context.widgetConfig
|
|
1482
|
-
});
|
|
1483
|
-
const skeletonHTML = getSkeleton({
|
|
1484
|
-
height: initialHeight,
|
|
1485
|
-
skeletonBackgroundColor,
|
|
1486
|
-
skeletonShimmerColor,
|
|
1487
|
-
borderColor
|
|
1488
|
-
});
|
|
1489
|
-
const skeletonContainer = document.createElement("div");
|
|
1490
|
-
skeletonContainer.innerHTML = skeletonHTML;
|
|
1491
1130
|
const frame = this._createFrame({
|
|
1492
1131
|
minWidth,
|
|
1493
1132
|
maxWidth,
|
|
1494
1133
|
initialHeight
|
|
1495
1134
|
});
|
|
1496
1135
|
const element = this._findElement();
|
|
1497
|
-
|
|
1498
|
-
frame.style.display = "none";
|
|
1499
|
-
const injectContents = (target) => {
|
|
1500
|
-
target.appendChild(skeletonContainer);
|
|
1501
|
-
target.appendChild(frame);
|
|
1502
|
-
};
|
|
1503
|
-
if ((_i = this.context) == null ? void 0 : _i.container) {
|
|
1136
|
+
if ((_d = this.context) == null ? void 0 : _d.container) {
|
|
1504
1137
|
element.style.visibility = "hidden";
|
|
1505
1138
|
element.style.height = "0";
|
|
1506
1139
|
element.style["overflow-y"] = "hidden";
|
|
1507
1140
|
}
|
|
1508
1141
|
if (this.container) {
|
|
1509
1142
|
if (element.shadowRoot) {
|
|
1510
|
-
if (((
|
|
1143
|
+
if (((_e = element.shadowRoot.lastChild) == null ? void 0 : _e.nodeName) === "IFRAME") {
|
|
1511
1144
|
element.shadowRoot.replaceChild(frame, element.shadowRoot.lastChild);
|
|
1512
1145
|
} else {
|
|
1513
|
-
|
|
1146
|
+
element.shadowRoot.appendChild(frame);
|
|
1514
1147
|
}
|
|
1515
1148
|
} else if (element.firstChild) {
|
|
1516
|
-
element.
|
|
1517
|
-
injectContents(element);
|
|
1149
|
+
element.replaceChild(frame, element.firstChild);
|
|
1518
1150
|
} else {
|
|
1519
|
-
|
|
1151
|
+
element.appendChild(frame);
|
|
1520
1152
|
}
|
|
1521
1153
|
} else if (!element.firstChild || element.firstChild.nodeName === "#text") {
|
|
1522
|
-
|
|
1154
|
+
element.appendChild(frame);
|
|
1523
1155
|
}
|
|
1524
1156
|
const { contentWindow } = frame;
|
|
1525
1157
|
if (!contentWindow) {
|
|
@@ -1527,16 +1159,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1527
1159
|
}
|
|
1528
1160
|
const frameDoc = contentWindow.document;
|
|
1529
1161
|
frameDoc.open();
|
|
1530
|
-
console.log({ content: this.content, context: this.context, this: this });
|
|
1531
1162
|
const domain = this.widgetApi.domain;
|
|
1532
1163
|
frameDoc.write(`
|
|
1533
|
-
${((
|
|
1164
|
+
${((_f = brandingConfig == null ? void 0 : brandingConfig.main) == null ? void 0 : _f.brandFont) ? `
|
|
1534
1165
|
<link rel="preconnect" href="https://fast${domain === "https://staging.referralsaasquatch.com" && "-staging"}.ssqt.io">
|
|
1535
1166
|
<link rel="preconnect" href="https://fonts.gstatic.com">
|
|
1536
1167
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
1537
1168
|
<link rel="preload" href="https://fonts.googleapis.com/css2?family=${encodeURIComponent(
|
|
1538
|
-
(
|
|
1539
|
-
)}" as="style">`}
|
|
1169
|
+
(_g = brandingConfig == null ? void 0 : brandingConfig.main) == null ? void 0 : _g.brandFont
|
|
1170
|
+
)}" as="style">` : ""}
|
|
1540
1171
|
<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>
|
|
1541
1172
|
<style data-styles>
|
|
1542
1173
|
html { visibility:hidden;}
|
|
@@ -1546,10 +1177,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1546
1177
|
`);
|
|
1547
1178
|
frameDoc.close();
|
|
1548
1179
|
domready(frameDoc, async () => {
|
|
1549
|
-
if (skeletonContainer && skeletonContainer.parentNode) {
|
|
1550
|
-
skeletonContainer.parentNode.removeChild(skeletonContainer);
|
|
1551
|
-
}
|
|
1552
|
-
frame.style.display = "block";
|
|
1553
1180
|
const _sqh = contentWindow.squatch || contentWindow.widgetIdent;
|
|
1554
1181
|
frame.height = initialHeight || frameDoc.body.scrollHeight;
|
|
1555
1182
|
console.log({ height: frameDoc.body.scrollHeight });
|
|
@@ -2234,6 +1861,264 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2234
1861
|
}
|
|
2235
1862
|
};
|
|
2236
1863
|
}
|
|
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
|
+
};
|
|
2237
2122
|
const _log$2 = browserExports.debug("squatch-js:decodeUserJwt");
|
|
2238
2123
|
function decodeUserJwt(tokenStr) {
|
|
2239
2124
|
var _a2;
|
|
@@ -2372,6 +2257,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2372
2257
|
domain: (config == null ? void 0 : config.domain) || ((_b = this.config) == null ? void 0 : _b.domain) || DEFAULT_DOMAIN
|
|
2373
2258
|
});
|
|
2374
2259
|
}
|
|
2260
|
+
getWidgetType(widgetType) {
|
|
2261
|
+
if (widgetType && (widgetType.includes("websiteReferralWidget") || widgetType.includes("friendWidget"))) {
|
|
2262
|
+
return "instant-access";
|
|
2263
|
+
}
|
|
2264
|
+
return "verified-access";
|
|
2265
|
+
}
|
|
2375
2266
|
async renderPasswordlessVariant() {
|
|
2376
2267
|
this._setupApis();
|
|
2377
2268
|
_log$1("Rendering as an Instant Access widget");
|
|
@@ -2467,12 +2358,26 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2467
2358
|
}
|
|
2468
2359
|
}
|
|
2469
2360
|
async connectedCallback() {
|
|
2470
|
-
var _a2, _b;
|
|
2471
2361
|
this.loaded = true;
|
|
2472
2362
|
this.container = this.getAttribute("container");
|
|
2363
|
+
this.widgetType = this.getAttribute("widget") || void 0;
|
|
2364
|
+
console.log("widget type", this.widgetType);
|
|
2365
|
+
const skeletonWidgetType = this.getWidgetType(this.widgetType);
|
|
2366
|
+
const skeletonHTML = getSkeleton({
|
|
2367
|
+
height: "100%",
|
|
2368
|
+
type: skeletonWidgetType
|
|
2369
|
+
});
|
|
2370
|
+
const skeletonContainer = document.createElement("div");
|
|
2371
|
+
skeletonContainer.id = "loading-skeleton";
|
|
2372
|
+
skeletonContainer.innerHTML = skeletonHTML;
|
|
2373
|
+
const root = this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
2374
|
+
root.innerHTML = "";
|
|
2375
|
+
root.appendChild(skeletonContainer);
|
|
2473
2376
|
await this.renderWidget();
|
|
2474
|
-
const
|
|
2475
|
-
if (
|
|
2377
|
+
const loadingElement = root.getElementById("loading-skeleton");
|
|
2378
|
+
if (loadingElement) {
|
|
2379
|
+
loadingElement.remove();
|
|
2380
|
+
}
|
|
2476
2381
|
if (this.getAttribute("open") !== null) this.open();
|
|
2477
2382
|
}
|
|
2478
2383
|
}
|
|
@@ -2501,7 +2406,23 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
2501
2406
|
async connectedCallback() {
|
|
2502
2407
|
this.loaded = true;
|
|
2503
2408
|
this.container = this.getAttribute("container");
|
|
2409
|
+
this.widgetType = this.getAttribute("widget") || void 0;
|
|
2410
|
+
const skeletonWidgetType = this.getWidgetType(this.widgetType);
|
|
2411
|
+
const skeletonHTML = getSkeleton({
|
|
2412
|
+
height: "100%",
|
|
2413
|
+
type: skeletonWidgetType
|
|
2414
|
+
});
|
|
2415
|
+
const skeletonContainer = document.createElement("div");
|
|
2416
|
+
skeletonContainer.id = "loading-skeleton";
|
|
2417
|
+
skeletonContainer.innerHTML = skeletonHTML;
|
|
2418
|
+
const root = this.shadowRoot || this.attachShadow({ mode: "open" });
|
|
2419
|
+
root.innerHTML = "";
|
|
2420
|
+
root.appendChild(skeletonContainer);
|
|
2504
2421
|
await this.renderWidget();
|
|
2422
|
+
const loadingElement = root.getElementById("loading-skeleton");
|
|
2423
|
+
if (loadingElement) {
|
|
2424
|
+
loadingElement.remove();
|
|
2425
|
+
}
|
|
2505
2426
|
if (this.getAttribute("open") !== null) this.open();
|
|
2506
2427
|
}
|
|
2507
2428
|
}
|