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

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
@@ -892,6 +892,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
892
892
  if ((options == null ? void 0 : options.maxWidth) || (options == null ? void 0 : options.minWidth)) {
893
893
  frame.style.width = "100%";
894
894
  }
895
+ if (options == null ? void 0 : options.initialHeight) {
896
+ frame.height = options.initialHeight;
897
+ }
895
898
  return frame;
896
899
  }
897
900
  _findFrame() {
@@ -1115,21 +1118,31 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1115
1118
  if (container) this.container = container;
1116
1119
  }
1117
1120
  async load() {
1118
- var _a2, _b, _c, _d, _e;
1121
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
1119
1122
  const brandingConfig = (_b = (_a2 = this.context.widgetConfig) == null ? void 0 : _a2.values) == null ? void 0 : _b.brandingConfig;
1120
- const sizes = (_c = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _c.embeddedWidgets;
1123
+ const initialHeight = (_e = (_d = (_c = this.context.widgetConfig) == null ? void 0 : _c.values) == null ? void 0 : _d.brandingConfig) == null ? void 0 : _e.loadingHeight;
1124
+ const sizes = (_f = brandingConfig == null ? void 0 : brandingConfig.widgetSize) == null ? void 0 : _f.embeddedWidgets;
1121
1125
  const maxWidth = (sizes == null ? void 0 : sizes.maxWidth) ? formatWidth(sizes.maxWidth) : "";
1122
1126
  const minWidth = (sizes == null ? void 0 : sizes.minWidth) ? formatWidth(sizes.minWidth) : "";
1123
- const frame = this._createFrame({ minWidth, maxWidth });
1127
+ console.log({
1128
+ brandingConfig,
1129
+ initialHeight,
1130
+ widgetConfig: this.context.widgetConfig
1131
+ });
1132
+ const frame = this._createFrame({
1133
+ minWidth,
1134
+ maxWidth,
1135
+ initialHeight
1136
+ });
1124
1137
  const element = this._findElement();
1125
- if ((_d = this.context) == null ? void 0 : _d.container) {
1138
+ if ((_g = this.context) == null ? void 0 : _g.container) {
1126
1139
  element.style.visibility = "hidden";
1127
1140
  element.style.height = "0";
1128
1141
  element.style["overflow-y"] = "hidden";
1129
1142
  }
1130
1143
  if (this.container) {
1131
1144
  if (element.shadowRoot) {
1132
- if (((_e = element.shadowRoot.lastChild) == null ? void 0 : _e.nodeName) === "IFRAME") {
1145
+ if (((_h = element.shadowRoot.lastChild) == null ? void 0 : _h.nodeName) === "IFRAME") {
1133
1146
  element.shadowRoot.replaceChild(frame, element.shadowRoot.lastChild);
1134
1147
  } else {
1135
1148
  element.shadowRoot.appendChild(frame);
@@ -1148,19 +1161,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1148
1161
  }
1149
1162
  const frameDoc = contentWindow.document;
1150
1163
  frameDoc.open();
1164
+ console.log({ content: this.content });
1151
1165
  frameDoc.write(`
1152
1166
  <script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>
1153
- <style>
1154
- 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 {
1155
- visibility: hidden;
1156
- }
1157
- </style>
1158
1167
  ${this.content}
1168
+ <style data-styles>
1169
+ html:not(.hydrated) { visibility:hidden; }
1170
+ </style>
1159
1171
  `);
1160
1172
  frameDoc.close();
1161
1173
  domready(frameDoc, async () => {
1162
1174
  const _sqh = contentWindow.squatch || contentWindow.widgetIdent;
1163
- frame.height = frameDoc.body.scrollHeight;
1175
+ frame.height = initialHeight || frameDoc.body.scrollHeight;
1164
1176
  console.log({ height: frameDoc.body.scrollHeight });
1165
1177
  const ro = new contentWindow["ResizeObserver"]((entries) => {
1166
1178
  for (const entry of entries) {