@saasquatch/squatch-js 2.8.2-0 → 2.8.2-2

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/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.8.1] - 2025-11-17
11
+
12
+ ### Fixed
13
+
14
+ - Prevent overriding of API domain with auto popups
15
+
10
16
  ## [2.8.0] - 2025-10-22
11
17
 
12
18
  ### Added
@@ -387,7 +393,8 @@ No release notes.
387
393
 
388
394
  No release notes.
389
395
 
390
- [unreleased]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.8.0...HEAD
396
+ [unreleased]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.8.1...HEAD
397
+ [2.8.1]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.7.0...@saasquatch%2Fsquatch-js@2.8.1
391
398
  [2.8.0]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.7.0...@saasquatch%2Fsquatch-js@2.8.0
392
399
  [2.7.0]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.6.3...@saasquatch%2Fsquatch-js@2.7.0
393
400
  [2.6.3]: https://github.com/saasquatch/squatch-js/compare/@saasquatch%2Fsquatch-js@2.6.2...@saasquatch%2Fsquatch-js@2.6.3
package/README.md CHANGED
@@ -197,19 +197,11 @@ squatch.api().upsertUser({...});
197
197
  ### `squatch-popup`
198
198
 
199
199
  ```html
200
- <squatch-embed
201
- widget="WIDGET_TYPE"
202
- [
203
- open
204
- |
205
- container="#selector"
206
- |
207
- locale="en_US"
208
- ]
209
- >
200
+ <squatch-popup
201
+ widget="WIDGET_TYPE" [ open | container="#selector" | locale="en_US" ]>
210
202
  <!-- Clicking a child of squatch-popup opens the popup -->
211
203
  <button>Click me to open</button>
212
- </squatch-embed>
204
+ </squatch-popup>
213
205
  ```
214
206
 
215
207
  - `widget: string`: Specifies the SaaSquatch `widgetType` identifier of the desired widget
@@ -702,6 +702,7 @@ class WidgetApi {
702
702
  const raw = params;
703
703
  const clean = validatePasswordlessConfig(raw);
704
704
  const { widgetType, engagementMedium = "POPUP", jwt, user } = clean;
705
+ console.log({ params });
705
706
  const tenantAlias = encodeURIComponent(this.tenantAlias);
706
707
  const accountId = (user == null ? void 0 : user.accountId) ? encodeURIComponent(user.accountId) : null;
707
708
  const userId = (user == null ? void 0 : user.id) ? encodeURIComponent(user.id) : null;
@@ -890,6 +891,9 @@ class Widget {
890
891
  if ((options == null ? void 0 : options.maxWidth) || (options == null ? void 0 : options.minWidth)) {
891
892
  frame.style.width = "100%";
892
893
  }
894
+ if (options == null ? void 0 : options.initialHeight) {
895
+ frame.height = options.initialHeight;
896
+ }
893
897
  return frame;
894
898
  }
895
899
  _findFrame() {
@@ -1104,6 +1108,351 @@ function delay(duration) {
1104
1108
  setTimeout(resolve, duration);
1105
1109
  });
1106
1110
  }
1111
+ const getSkeleton = ({
1112
+ height = "500px",
1113
+ skeletonBackgroundColor = "#e0e0e0",
1114
+ skeletonShimmerColor = "#f5f5f5",
1115
+ borderColor = "#ccc"
1116
+ }) => {
1117
+ return `
1118
+ <style>
1119
+ * {
1120
+ box-sizing: border-box;
1121
+ padding: 0;
1122
+ margin: 0;
1123
+ }
1124
+
1125
+ .widget-container {
1126
+ background: white;
1127
+ width: 100%;
1128
+ max-width: 900px;
1129
+ padding: 40px;
1130
+ border-radius: 12px;
1131
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
1132
+ box-sizing: border-box;
1133
+ }
1134
+
1135
+ @keyframes shimmer {
1136
+ 0% {
1137
+ background-position: -100% 0;
1138
+ }
1139
+ 100% {
1140
+ background-position: 100% 0;
1141
+ }
1142
+ }
1143
+
1144
+ .skeleton {
1145
+ background: ${skeletonBackgroundColor};
1146
+ background: linear-gradient(
1147
+ 90deg,
1148
+ ${skeletonBackgroundColor} 25%,
1149
+ ${skeletonShimmerColor} 50%,
1150
+ ${skeletonBackgroundColor} 75%
1151
+ );
1152
+ background-size: 200% 100%;
1153
+ animation: shimmer 1.5s infinite linear;
1154
+ border-radius: 6px;
1155
+ margin-bottom: 12px;
1156
+ }
1157
+
1158
+ .sk-title-lg {
1159
+ height: 36px;
1160
+ width: 50%;
1161
+ margin-bottom: 16px;
1162
+ }
1163
+ .sk-title-md {
1164
+ height: 28px;
1165
+ width: 30%;
1166
+ margin-bottom: 20px;
1167
+ margin-top: 40px;
1168
+ }
1169
+ .sk-text {
1170
+ height: 16px;
1171
+ width: 80%;
1172
+ margin-bottom: 8px;
1173
+ }
1174
+ .sk-text-short {
1175
+ width: 40%;
1176
+ }
1177
+ .sk-label {
1178
+ height: 14px;
1179
+ width: 25%;
1180
+ margin-bottom: 10px;
1181
+ }
1182
+
1183
+ .hero-section {
1184
+ display: flex;
1185
+ gap: 40px;
1186
+ margin-bottom: 40px;
1187
+ border-bottom: 1px solid ${borderColor};
1188
+ padding-bottom: 40px;
1189
+ flex-direction: row;
1190
+ }
1191
+ .hero-content {
1192
+ flex: 1;
1193
+ display: flex;
1194
+ flex-direction: column;
1195
+ justify-content: center;
1196
+ }
1197
+ .hero-image {
1198
+ flex: 1;
1199
+ height: 300px;
1200
+ border-radius: 12px;
1201
+ }
1202
+
1203
+ .share-section {
1204
+ margin-bottom: 40px;
1205
+ }
1206
+ .sk-input {
1207
+ height: 50px;
1208
+ width: 100%;
1209
+ border-radius: 8px;
1210
+ margin-bottom: 16px;
1211
+ }
1212
+ .social-buttons {
1213
+ display: flex;
1214
+ gap: 12px;
1215
+ }
1216
+ .sk-btn-social {
1217
+ flex: 1;
1218
+ height: 50px;
1219
+ border-radius: 8px;
1220
+ }
1221
+
1222
+ .stats-section {
1223
+ display: flex;
1224
+ gap: 24px;
1225
+ margin-bottom: 40px;
1226
+ padding: 30px 0;
1227
+ border-top: 1px solid ${borderColor};
1228
+ border-bottom: 1px solid ${borderColor};
1229
+ }
1230
+ .stat-card {
1231
+ flex: 1;
1232
+ display: flex;
1233
+ flex-direction: column;
1234
+ align-items: center;
1235
+ }
1236
+ .stat-divider {
1237
+ padding-left: 24px;
1238
+ }
1239
+
1240
+ .sk-stat-num {
1241
+ height: 48px;
1242
+ width: 120px;
1243
+ margin-bottom: 8px;
1244
+ }
1245
+ .sk-stat-label {
1246
+ height: 18px;
1247
+ width: 80px;
1248
+ }
1249
+
1250
+ .table-header {
1251
+ display: flex;
1252
+ gap: 16px;
1253
+ margin-bottom: 16px;
1254
+ }
1255
+ .sk-th {
1256
+ height: 16px;
1257
+ }
1258
+ .table-row {
1259
+ display: flex;
1260
+ align-items: center;
1261
+ gap: 16px;
1262
+ padding: 16px 0;
1263
+ border-bottom: 1px solid ${borderColor};
1264
+ }
1265
+
1266
+ .col-user {
1267
+ flex: 2;
1268
+ }
1269
+ .col-status {
1270
+ flex: 1;
1271
+ }
1272
+ .col-reward {
1273
+ flex: 2;
1274
+ }
1275
+ .col-date {
1276
+ flex: 1;
1277
+ }
1278
+
1279
+ .sk-badge {
1280
+ height: 28px;
1281
+ width: 90px;
1282
+ border-radius: 14px;
1283
+ }
1284
+ .sk-reward-block {
1285
+ height: 36px;
1286
+ width: 100%;
1287
+ border-radius: 6px;
1288
+ }
1289
+
1290
+ .pagination {
1291
+ display: flex;
1292
+ justify-content: flex-end;
1293
+ gap: 8px;
1294
+ margin-top: 24px;
1295
+ }
1296
+ .sk-btn-page {
1297
+ height: 36px;
1298
+ width: 64px;
1299
+ border-radius: 6px;
1300
+ margin-bottom: 0;
1301
+ }
1302
+
1303
+ @media (max-width: 768px) {
1304
+ body {
1305
+ padding: 20px;
1306
+ }
1307
+ .widget-container {
1308
+ padding: 24px;
1309
+ }
1310
+
1311
+ .hero-section {
1312
+ flex-direction: column-reverse;
1313
+ gap: 24px;
1314
+ }
1315
+ .hero-image {
1316
+ height: 220px;
1317
+ width: 100%;
1318
+ }
1319
+ .sk-title-lg {
1320
+ width: 80%;
1321
+ }
1322
+
1323
+ .col-date {
1324
+ display: none;
1325
+ }
1326
+ }
1327
+
1328
+ @media (max-width: 480px) {
1329
+ body {
1330
+ padding: 10px;
1331
+ }
1332
+ .widget-container {
1333
+ padding: 16px;
1334
+ }
1335
+
1336
+ .sk-stat-num {
1337
+ width: 80px;
1338
+ height: 40px;
1339
+ }
1340
+
1341
+ .col-reward {
1342
+ display: none;
1343
+ }
1344
+
1345
+ .col-user {
1346
+ flex: 3;
1347
+ }
1348
+ .col-status {
1349
+ flex: 2;
1350
+ display: flex;
1351
+ justify-content: flex-end;
1352
+ }
1353
+ }
1354
+ </style>
1355
+
1356
+ <div class="widget-container">
1357
+ <div class="hero-section">
1358
+ <div class="hero-content">
1359
+ <div class="skeleton sk-title-lg"></div>
1360
+ <div class="skeleton sk-text"></div>
1361
+ <div class="skeleton sk-text sk-text-short"></div>
1362
+ </div>
1363
+ <div class="skeleton hero-image"></div>
1364
+ </div>
1365
+
1366
+ <div class="share-section">
1367
+ <div class="skeleton sk-label"></div>
1368
+ <div class="skeleton sk-input"></div>
1369
+ <div class="social-buttons">
1370
+ <div class="skeleton sk-btn-social"></div>
1371
+ <div class="skeleton sk-btn-social"></div>
1372
+ <div class="skeleton sk-btn-social"></div>
1373
+ <div class="skeleton sk-btn-social"></div>
1374
+ </div>
1375
+ </div>
1376
+
1377
+ <div
1378
+ class="skeleton sk-title-md"
1379
+ style="margin-top: 0; width: 30%; margin-left: auto; margin-right: auto"
1380
+ ></div>
1381
+ <div
1382
+ class="skeleton sk-text"
1383
+ style="width: 60%; margin-left: auto; margin-right: auto"
1384
+ ></div>
1385
+
1386
+ <div class="stats-section">
1387
+ <div class="stat-card">
1388
+ <div class="skeleton sk-stat-num"></div>
1389
+ <div class="skeleton sk-stat-label"></div>
1390
+ </div>
1391
+ <div class="stat-card stat-divider">
1392
+ <div class="skeleton sk-stat-num"></div>
1393
+ <div class="skeleton sk-stat-label"></div>
1394
+ </div>
1395
+ </div>
1396
+
1397
+ <div class="skeleton sk-title-md"></div>
1398
+
1399
+ <div class="table-header">
1400
+ <div class="skeleton sk-th col-user"></div>
1401
+ <div class="skeleton sk-th col-status"></div>
1402
+ <div class="skeleton sk-th col-reward"></div>
1403
+ <div class="skeleton sk-th col-date"></div>
1404
+ </div>
1405
+
1406
+ <div class="table-row">
1407
+ <div class="col-user">
1408
+ <div class="skeleton sk-text" style="width: 70%; margin: 0"></div>
1409
+ </div>
1410
+ <div class="col-status">
1411
+ <div class="skeleton sk-badge" style="margin: 0"></div>
1412
+ </div>
1413
+ <div class="col-reward">
1414
+ <div class="skeleton sk-reward-block" style="margin: 0"></div>
1415
+ </div>
1416
+ <div class="col-date">
1417
+ <div class="skeleton sk-text" style="width: 80%; margin: 0"></div>
1418
+ </div>
1419
+ </div>
1420
+ <div class="table-row">
1421
+ <div class="col-user">
1422
+ <div class="skeleton sk-text" style="width: 60%; margin: 0"></div>
1423
+ </div>
1424
+ <div class="col-status">
1425
+ <div class="skeleton sk-badge" style="margin: 0"></div>
1426
+ </div>
1427
+ <div class="col-reward">
1428
+ <div class="skeleton sk-reward-block" style="margin: 0"></div>
1429
+ </div>
1430
+ <div class="col-date">
1431
+ <div class="skeleton sk-text" style="width: 80%; margin: 0"></div>
1432
+ </div>
1433
+ </div>
1434
+ <div class="table-row">
1435
+ <div class="col-user">
1436
+ <div class="skeleton sk-text" style="width: 75%; margin: 0"></div>
1437
+ </div>
1438
+ <div class="col-status">
1439
+ <div class="skeleton sk-badge" style="margin: 0"></div>
1440
+ </div>
1441
+ <div class="col-reward">
1442
+ <div class="skeleton sk-reward-block" style="margin: 0"></div>
1443
+ </div>
1444
+ <div class="col-date">
1445
+ <div class="skeleton sk-text" style="width: 80%; margin: 0"></div>
1446
+ </div>
1447
+ </div>
1448
+
1449
+ <div class="pagination">
1450
+ <div class="skeleton sk-btn-page"></div>
1451
+ <div class="skeleton sk-btn-page"></div>
1452
+ </div>
1453
+ </div>
1454
+ `;
1455
+ };
1107
1456
  const _log$7 = browserExports.debug("squatch-js:EMBEDwidget");
1108
1457
  class EmbedWidget extends Widget {
1109
1458
  constructor(params, container) {
@@ -1113,32 +1462,59 @@ class EmbedWidget extends Widget {
1113
1462
  if (container) this.container = container;
1114
1463
  }
1115
1464
  async load() {
1116
- var _a2, _b, _c, _d, _e;
1465
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1117
1466
  const brandingConfig = (_b = (_a2 = this.context.widgetConfig) == null ? void 0 : _a2.values) == null ? void 0 : _b.brandingConfig;
1118
- const sizes = (_c = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _c.embeddedWidgets;
1467
+ const initialHeight = brandingConfig == null ? void 0 : brandingConfig.loadingHeight;
1468
+ const skeletonBackgroundColor = (_d = (_c = brandingConfig == null ? void 0 : brandingConfig.color) == null ? void 0 : _c.loadingSkeleton) == null ? void 0 : _d.background;
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;
1119
1472
  const maxWidth = (sizes == null ? void 0 : sizes.maxWidth) ? formatWidth(sizes.maxWidth) : "";
1120
1473
  const minWidth = (sizes == null ? void 0 : sizes.minWidth) ? formatWidth(sizes.minWidth) : "";
1121
- const frame = this._createFrame({ minWidth, maxWidth });
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
+ const frame = this._createFrame({
1488
+ minWidth,
1489
+ maxWidth,
1490
+ initialHeight
1491
+ });
1122
1492
  const element = this._findElement();
1123
- if ((_d = this.context) == null ? void 0 : _d.container) {
1493
+ frame.style.display = "none";
1494
+ const injectContents = (target) => {
1495
+ target.appendChild(skeletonContainer);
1496
+ target.appendChild(frame);
1497
+ };
1498
+ if ((_i = this.context) == null ? void 0 : _i.container) {
1124
1499
  element.style.visibility = "hidden";
1125
1500
  element.style.height = "0";
1126
1501
  element.style["overflow-y"] = "hidden";
1127
1502
  }
1128
1503
  if (this.container) {
1129
1504
  if (element.shadowRoot) {
1130
- if (((_e = element.shadowRoot.lastChild) == null ? void 0 : _e.nodeName) === "IFRAME") {
1505
+ if (((_j = element.shadowRoot.lastChild) == null ? void 0 : _j.nodeName) === "IFRAME") {
1131
1506
  element.shadowRoot.replaceChild(frame, element.shadowRoot.lastChild);
1132
1507
  } else {
1133
- element.shadowRoot.appendChild(frame);
1508
+ injectContents(element.shadowRoot);
1134
1509
  }
1135
1510
  } else if (element.firstChild) {
1136
- element.replaceChild(frame, element.firstChild);
1511
+ element.innerHTML = "";
1512
+ injectContents(element);
1137
1513
  } else {
1138
- element.appendChild(frame);
1514
+ injectContents(element);
1139
1515
  }
1140
1516
  } else if (!element.firstChild || element.firstChild.nodeName === "#text") {
1141
- element.appendChild(frame);
1517
+ injectContents(element);
1142
1518
  }
1143
1519
  const { contentWindow } = frame;
1144
1520
  if (!contentWindow) {
@@ -1146,19 +1522,31 @@ class EmbedWidget extends Widget {
1146
1522
  }
1147
1523
  const frameDoc = contentWindow.document;
1148
1524
  frameDoc.open();
1525
+ console.log({ content: this.content, context: this.context, this: this });
1526
+ const domain = this.widgetApi.domain;
1149
1527
  frameDoc.write(`
1528
+ ${((_k = brandingConfig == null ? void 0 : brandingConfig.main) == null ? void 0 : _k.brandFont) && `
1529
+ <link rel="preconnect" href="https://fast${domain === "https://staging.referralsaasquatch.com" && "-staging"}.ssqt.io">
1530
+ <link rel="preconnect" href="https://fonts.gstatic.com">
1531
+ <link rel="preconnect" href="https://fonts.googleapis.com">
1532
+ <link rel="preload" href="https://fonts.googleapis.com/css2?family=${encodeURIComponent(
1533
+ (_l = brandingConfig == null ? void 0 : brandingConfig.main) == null ? void 0 : _l.brandFont
1534
+ )}">`}
1150
1535
  <script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>
1151
- <style>
1152
- sqm-stencilbook, sqm-portal-google-registration-form, sqm-widget-verification, sqm-portal-google-login, sqm-portal-registration-form, sqm-portal-reset-password, sqm-instant-access-registration, sqm-portal-email-verification, sqm-portal-profile, sqm-portal-verify-email, sqm-qr-code, sqm-rewards-table-customer-note-column, raisins-plop-target, sqm-close-button, sqm-context-router, sqm-graphql-client-provider, sqm-header-logo, sqm-lead-checkbox-field, sqm-leaderboard-rank, sqm-logout-current-user, sqm-navigation-sidebar, sqm-navigation-sidebar-item, sqm-popup-container, sqm-portal-logout, sqm-portal-protected-route, sqm-route, sqm-tab, sqm-tabs, sqm-text-span, sqm-widget-verification-controller, sqm-email-verification, sqm-google-sign-in, sqm-lead-input-field, sqm-rewards-table-customer-note-cell, sqm-referral-codes, sqm-pagination, sqm-referral-code, sqm-scroll, sqm-form-message, sqm-code-verification, sqm-password-field, sqm-invoice-table-data-cell, sqm-invoice-table-date-cell, sqm-invoice-table-download-cell, sqm-table-cell, sqm-table-row, sqm-empty, sqm-portal-container, sqm-text, sqm-titled-section, sqm-rewards-table, sqm-rewards-table-date-column, sqm-rewards-table-reward-column, sqm-rewards-table-source-column, sqm-rewards-table-status-column, sqm-rewards-table-date-cell, sqm-rewards-table-reward-cell, sqm-rewards-table-source-cell, sqm-rewards-table-status-cell, sqm-referral-table-column, sqm-referral-table, sqm-referral-table-date-column, sqm-referral-table-rewards-column, sqm-referral-table-status-column, sqm-referral-table-user-column, sqm-referral-table-cell, sqm-referral-table-date-cell, sqm-referral-table-rewards-cell, sqm-referral-table-status-cell, sqm-referral-table-user-cell, sqm-tax-and-cash-dashboard, sqm-banking-info-form, sqm-docusign-form, sqm-indirect-tax-form, sqm-user-info-form, sqm-invoice-table, sqm-invoice-table-data-column, sqm-invoice-table-date-column, sqm-invoice-table-download-column, sqm-payout-details-card, sqm-tax-and-cash, sqm-leaderboard, sqm-reward-exchange-list, sqm-lead-form, sqm-payout-status-alert, sqm-portal-change-password, sqm-portal-register, sqm-coupon-code, sqm-edit-profile, sqm-payout-button-scroll, sqm-portal-change-marketing, sqm-portal-forgot-password, sqm-portal-login, sqm-referred-registration, sqm-big-stat, sqm-brand, sqm-brand-selector, sqm-card-feed, sqm-checkbox-field, sqm-divided-layout, sqm-dropdown-field, sqm-hero, sqm-hero-image, sqm-hook-story-container, sqm-image, sqm-input-field, sqm-lead-dropdown-field, sqm-link-button, sqm-marketing-emails-checkbox, sqm-name-fields, sqm-navigation-menu, sqm-portal-footer, sqm-portal-frame, sqm-program-explainer, sqm-program-explainer-step, sqm-program-menu, sqm-referral-card, sqm-referral-iframe, sqm-router, sqm-share-button, sqm-share-code, sqm-share-link, sqm-stat-container, sqm-task-card, sqm-timeline, sqm-timeline-entry, sqm-user-name {
1153
- visibility: hidden;
1154
- }
1536
+ <style data-styles>
1537
+ html { visibility:hidden;}
1155
1538
  </style>
1156
1539
  ${this.content}
1540
+
1157
1541
  `);
1158
1542
  frameDoc.close();
1159
1543
  domready(frameDoc, async () => {
1544
+ if (skeletonContainer && skeletonContainer.parentNode) {
1545
+ skeletonContainer.parentNode.removeChild(skeletonContainer);
1546
+ }
1547
+ frame.style.display = "block";
1160
1548
  const _sqh = contentWindow.squatch || contentWindow.widgetIdent;
1161
- frame.height = frameDoc.body.scrollHeight;
1549
+ frame.height = initialHeight || frameDoc.body.scrollHeight;
1162
1550
  console.log({ height: frameDoc.body.scrollHeight });
1163
1551
  const ro = new contentWindow["ResizeObserver"]((entries) => {
1164
1552
  for (const entry of entries) {
@@ -1795,7 +2183,8 @@ function _pushCookie() {
1795
2183
  }
1796
2184
  }
1797
2185
  const _log$3 = browserExports.debug("squatch-js");
1798
- function _getAutoConfig(configIn) {
2186
+ function _getAutoConfig() {
2187
+ var _a2;
1799
2188
  const queryString = window.location.search;
1800
2189
  const urlParams = new URLSearchParams(queryString);
1801
2190
  const refParam = urlParams.get("_saasquatchExtra") || "";
@@ -1803,6 +2192,13 @@ function _getAutoConfig(configIn) {
1803
2192
  _log$3("No _saasquatchExtra param");
1804
2193
  return;
1805
2194
  }
2195
+ const config = validateConfig({
2196
+ tenantAlias: "UNKNOWN"
2197
+ });
2198
+ if (!config.domain) {
2199
+ _log$3("domain must be provided in config to use _saasquatchExtra");
2200
+ return;
2201
+ }
1806
2202
  let raw;
1807
2203
  try {
1808
2204
  raw = JSON.parse(b64decode(refParam));
@@ -1810,8 +2206,13 @@ function _getAutoConfig(configIn) {
1810
2206
  _log$3("Unable to decode _saasquatchExtra config");
1811
2207
  return;
1812
2208
  }
1813
- const { domain, tenantAlias, widgetConfig } = convertExtraToConfig(raw);
1814
- if (!domain || !tenantAlias || !widgetConfig) {
2209
+ function normalizeDomain(domain) {
2210
+ return domain.replace(/^https?:\/\//, "");
2211
+ }
2212
+ const normalizedDomain = normalizeDomain(config.domain);
2213
+ const tenantAlias = Object.keys((raw == null ? void 0 : raw[normalizedDomain]) || {})[0];
2214
+ const widgetConfig = (_a2 = raw == null ? void 0 : raw[normalizedDomain]) == null ? void 0 : _a2[tenantAlias];
2215
+ if (!widgetConfig) {
1815
2216
  _log$3("_saasquatchExtra did not have an expected structure");
1816
2217
  return void 0;
1817
2218
  }
@@ -1823,20 +2224,11 @@ function _getAutoConfig(configIn) {
1823
2224
  ...rest
1824
2225
  },
1825
2226
  squatchConfig: {
1826
- ...configIn ? { configIn } : {},
1827
- domain,
2227
+ ...config,
1828
2228
  tenantAlias
1829
2229
  }
1830
2230
  };
1831
2231
  }
1832
- function convertExtraToConfig(obj) {
1833
- var _a2;
1834
- const _domain = Object.keys(obj || {})[0];
1835
- const tenantAlias = Object.keys((obj == null ? void 0 : obj[_domain]) || {})[0];
1836
- const widgetConfig = (_a2 = obj == null ? void 0 : obj[_domain]) == null ? void 0 : _a2[tenantAlias];
1837
- const domain = _domain ? `https://${_domain}` : void 0;
1838
- return { domain, tenantAlias, widgetConfig };
1839
- }
1840
2232
  const _log$2 = browserExports.debug("squatch-js:decodeUserJwt");
1841
2233
  function decodeUserJwt(tokenStr) {
1842
2234
  var _a2;
@@ -2149,9 +2541,9 @@ function widget(widgetConfig) {
2149
2541
  var _a2;
2150
2542
  return (_a2 = widgets()) == null ? void 0 : _a2.render(widgetConfig);
2151
2543
  }
2152
- function _auto(configIn) {
2544
+ function _auto() {
2153
2545
  var _a2;
2154
- const configs = _getAutoConfig(configIn);
2546
+ const configs = _getAutoConfig();
2155
2547
  if (configs) {
2156
2548
  const { squatchConfig, widgetConfig } = configs;
2157
2549
  init(squatchConfig);