@saasquatch/squatch-js 2.8.0-3 → 2.8.0-4

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.js CHANGED
@@ -1110,7 +1110,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1110
1110
  if (container) this.container = container;
1111
1111
  }
1112
1112
  async load() {
1113
- var _a2, _b, _c;
1113
+ var _a2, _b, _c, _d, _e;
1114
1114
  const frame = this._createFrame();
1115
1115
  const element = this._findElement();
1116
1116
  if ((_a2 = this.context) == null ? void 0 : _a2.container) {
@@ -1118,15 +1118,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1118
1118
  element.style.height = "0";
1119
1119
  element.style["overflow-y"] = "hidden";
1120
1120
  }
1121
- const brandingConfig = window.SquatchBrandingConfig;
1122
- const sizes = (_b = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _b.embeddedWidgets;
1121
+ const brandingConfig = (_c = (_b = this.context.widgetConfig) == null ? void 0 : _b.values) == null ? void 0 : _c.brandingConfig;
1122
+ const sizes = (_d = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _d.embeddedWidgets;
1123
1123
  const maxWidth = (sizes == null ? void 0 : sizes.maxWidth) ? formatWidth(sizes.maxWidth) : "100%";
1124
1124
  const minWidth = (sizes == null ? void 0 : sizes.minWidth) ? formatWidth(sizes.minWidth) : "100%";
1125
1125
  element.style.maxWidth = maxWidth;
1126
1126
  element.style.minWidth = minWidth;
1127
1127
  if (this.container) {
1128
1128
  if (element.shadowRoot) {
1129
- if (((_c = element.shadowRoot.lastChild) == null ? void 0 : _c.nodeName) === "IFRAME") {
1129
+ if (((_e = element.shadowRoot.lastChild) == null ? void 0 : _e.nodeName) === "IFRAME") {
1130
1130
  element.shadowRoot.replaceChild(frame, element.shadowRoot.lastChild);
1131
1131
  } else {
1132
1132
  element.shadowRoot.appendChild(frame);
@@ -1249,10 +1249,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1249
1249
  }
1250
1250
  }
1251
1251
  _createPopupDialog() {
1252
- var _a2;
1252
+ var _a2, _b, _c;
1253
1253
  const dialog = document.createElement("dialog");
1254
- const brandingConfig = window.SquatchBrandingConfig;
1255
- const sizes = (_a2 = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _a2.popupWidgets;
1254
+ const brandingConfig = (_b = (_a2 = this.context.widgetConfig) == null ? void 0 : _a2.values) == null ? void 0 : _b.brandingConfig;
1255
+ const sizes = (_c = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _c.popupWidgets;
1256
1256
  const minWidth = (sizes == null ? void 0 : sizes.minWidth) ? formatWidth(sizes.minWidth) : "100%";
1257
1257
  const maxWidth = (sizes == null ? void 0 : sizes.maxWidth) ? formatWidth(sizes.maxWidth) : "500px";
1258
1258
  dialog.id = this.id;
@@ -1425,7 +1425,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1425
1425
  user: clean.user,
1426
1426
  engagementMedium: config.engagementMedium,
1427
1427
  container: config.container,
1428
- trigger: config.trigger
1428
+ trigger: config.trigger,
1429
+ widgetConfig: {
1430
+ values: {
1431
+ brandingConfig: response == null ? void 0 : response.brandingConfig
1432
+ }
1433
+ }
1429
1434
  }),
1430
1435
  user: response.user
1431
1436
  };
@@ -1462,7 +1467,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1462
1467
  type: "passwordless",
1463
1468
  engagementMedium: clean.engagementMedium,
1464
1469
  container: clean.container,
1465
- trigger: clean.trigger
1470
+ trigger: clean.trigger,
1471
+ widgetConfig: {
1472
+ values: {
1473
+ brandingConfig: response == null ? void 0 : response.brandingConfig
1474
+ }
1475
+ }
1466
1476
  }),
1467
1477
  user: response.user
1468
1478
  };
@@ -1889,7 +1899,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1889
1899
  __publicField(this, "loaded");
1890
1900
  __publicField(this, "_setWidget", (res, config) => {
1891
1901
  var _a2;
1892
- console.log({ res });
1893
1902
  const params = {
1894
1903
  api: this.widgetApi,
1895
1904
  content: res.template,
@@ -1897,7 +1906,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1897
1906
  type: config.type,
1898
1907
  user: config.user,
1899
1908
  container: this.container || void 0,
1900
- engagementMedium: this.type
1909
+ engagementMedium: this.type,
1910
+ widgetConfig: res.widgetConfig
1901
1911
  },
1902
1912
  type: this.widgetType,
1903
1913
  domain: ((_a2 = this.config) == null ? void 0 : _a2.domain) || DEFAULT_DOMAIN,