@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.
@@ -1106,7 +1106,7 @@ class EmbedWidget extends Widget {
1106
1106
  if (container) this.container = container;
1107
1107
  }
1108
1108
  async load() {
1109
- var _a2, _b, _c;
1109
+ var _a2, _b, _c, _d, _e;
1110
1110
  const frame = this._createFrame();
1111
1111
  const element = this._findElement();
1112
1112
  if ((_a2 = this.context) == null ? void 0 : _a2.container) {
@@ -1114,15 +1114,15 @@ class EmbedWidget extends Widget {
1114
1114
  element.style.height = "0";
1115
1115
  element.style["overflow-y"] = "hidden";
1116
1116
  }
1117
- const brandingConfig = window.SquatchBrandingConfig;
1118
- const sizes = (_b = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _b.embeddedWidgets;
1117
+ const brandingConfig = (_c = (_b = this.context.widgetConfig) == null ? void 0 : _b.values) == null ? void 0 : _c.brandingConfig;
1118
+ const sizes = (_d = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _d.embeddedWidgets;
1119
1119
  const maxWidth = (sizes == null ? void 0 : sizes.maxWidth) ? formatWidth(sizes.maxWidth) : "100%";
1120
1120
  const minWidth = (sizes == null ? void 0 : sizes.minWidth) ? formatWidth(sizes.minWidth) : "100%";
1121
1121
  element.style.maxWidth = maxWidth;
1122
1122
  element.style.minWidth = minWidth;
1123
1123
  if (this.container) {
1124
1124
  if (element.shadowRoot) {
1125
- if (((_c = element.shadowRoot.lastChild) == null ? void 0 : _c.nodeName) === "IFRAME") {
1125
+ if (((_e = element.shadowRoot.lastChild) == null ? void 0 : _e.nodeName) === "IFRAME") {
1126
1126
  element.shadowRoot.replaceChild(frame, element.shadowRoot.lastChild);
1127
1127
  } else {
1128
1128
  element.shadowRoot.appendChild(frame);
@@ -1245,10 +1245,10 @@ class PopupWidget extends Widget {
1245
1245
  }
1246
1246
  }
1247
1247
  _createPopupDialog() {
1248
- var _a2;
1248
+ var _a2, _b, _c;
1249
1249
  const dialog = document.createElement("dialog");
1250
- const brandingConfig = window.SquatchBrandingConfig;
1251
- const sizes = (_a2 = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _a2.popupWidgets;
1250
+ const brandingConfig = (_b = (_a2 = this.context.widgetConfig) == null ? void 0 : _a2.values) == null ? void 0 : _b.brandingConfig;
1251
+ const sizes = (_c = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _c.popupWidgets;
1252
1252
  const minWidth = (sizes == null ? void 0 : sizes.minWidth) ? formatWidth(sizes.minWidth) : "100%";
1253
1253
  const maxWidth = (sizes == null ? void 0 : sizes.maxWidth) ? formatWidth(sizes.maxWidth) : "500px";
1254
1254
  dialog.id = this.id;
@@ -1421,7 +1421,12 @@ class Widgets {
1421
1421
  user: clean.user,
1422
1422
  engagementMedium: config.engagementMedium,
1423
1423
  container: config.container,
1424
- trigger: config.trigger
1424
+ trigger: config.trigger,
1425
+ widgetConfig: {
1426
+ values: {
1427
+ brandingConfig: response == null ? void 0 : response.brandingConfig
1428
+ }
1429
+ }
1425
1430
  }),
1426
1431
  user: response.user
1427
1432
  };
@@ -1458,7 +1463,12 @@ class Widgets {
1458
1463
  type: "passwordless",
1459
1464
  engagementMedium: clean.engagementMedium,
1460
1465
  container: clean.container,
1461
- trigger: clean.trigger
1466
+ trigger: clean.trigger,
1467
+ widgetConfig: {
1468
+ values: {
1469
+ brandingConfig: response == null ? void 0 : response.brandingConfig
1470
+ }
1471
+ }
1462
1472
  }),
1463
1473
  user: response.user
1464
1474
  };
@@ -1885,7 +1895,6 @@ class DeclarativeWidget extends HTMLElement {
1885
1895
  __publicField(this, "loaded");
1886
1896
  __publicField(this, "_setWidget", (res, config) => {
1887
1897
  var _a2;
1888
- console.log({ res });
1889
1898
  const params = {
1890
1899
  api: this.widgetApi,
1891
1900
  content: res.template,
@@ -1893,7 +1902,8 @@ class DeclarativeWidget extends HTMLElement {
1893
1902
  type: config.type,
1894
1903
  user: config.user,
1895
1904
  container: this.container || void 0,
1896
- engagementMedium: this.type
1905
+ engagementMedium: this.type,
1906
+ widgetConfig: res.widgetConfig
1897
1907
  },
1898
1908
  type: this.widgetType,
1899
1909
  domain: ((_a2 = this.config) == null ? void 0 : _a2.domain) || DEFAULT_DOMAIN,