@saasquatch/squatch-js 2.8.2-15 → 2.8.2-17
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 +67 -3
- package/dist/squatch.cjs.js.map +1 -1
- package/dist/squatch.esm.js +67 -3
- package/dist/squatch.esm.js.map +1 -1
- package/dist/squatch.js +67 -3
- package/dist/squatch.js.map +1 -1
- package/dist/squatch.min.js +1 -1
- package/package.json +1 -1
package/dist/squatch.cjs.js
CHANGED
|
@@ -1118,6 +1118,72 @@ class EmbedWidget extends Widget {
|
|
|
1118
1118
|
this.container = container;
|
|
1119
1119
|
}
|
|
1120
1120
|
}
|
|
1121
|
+
//Old code for testing
|
|
1122
|
+
// async load() {
|
|
1123
|
+
// const brandingConfig = this.context.widgetConfig?.values?.brandingConfig;
|
|
1124
|
+
// const sizes = brandingConfig?.widgetSize?.embeddedWidgets;
|
|
1125
|
+
// const maxWidth = sizes?.maxWidth ? formatWidth(sizes.maxWidth) : "";
|
|
1126
|
+
// const minWidth = sizes?.minWidth ? formatWidth(sizes.minWidth) : "";
|
|
1127
|
+
// const frame = this._createFrame({ minWidth, maxWidth });
|
|
1128
|
+
// const element = this._findElement();
|
|
1129
|
+
// if (this.context?.container) {
|
|
1130
|
+
// // Custom container is used
|
|
1131
|
+
// element.style.visibility = "hidden";
|
|
1132
|
+
// element.style.height = "0";
|
|
1133
|
+
// element.style["overflow-y"] = "hidden";
|
|
1134
|
+
// }
|
|
1135
|
+
// if (this.container) {
|
|
1136
|
+
// if (element.shadowRoot) {
|
|
1137
|
+
// if (element.shadowRoot.lastChild?.nodeName === "IFRAME") {
|
|
1138
|
+
// element.shadowRoot.replaceChild(frame, element.shadowRoot.lastChild);
|
|
1139
|
+
// } else {
|
|
1140
|
+
// element.shadowRoot.appendChild(frame);
|
|
1141
|
+
// }
|
|
1142
|
+
// }
|
|
1143
|
+
// // Widget reloaded - replace existing element
|
|
1144
|
+
// else if (element.firstChild) {
|
|
1145
|
+
// element.replaceChild(frame, element.firstChild);
|
|
1146
|
+
// // Add iframe for the first time
|
|
1147
|
+
// } else {
|
|
1148
|
+
// element.appendChild(frame);
|
|
1149
|
+
// }
|
|
1150
|
+
// } else if (!element.firstChild || element.firstChild.nodeName === "#text") {
|
|
1151
|
+
// element.appendChild(frame);
|
|
1152
|
+
// }
|
|
1153
|
+
// const { contentWindow } = frame;
|
|
1154
|
+
// if (!contentWindow) {
|
|
1155
|
+
// throw new Error("Frame needs a content window");
|
|
1156
|
+
// }
|
|
1157
|
+
// const frameDoc = contentWindow.document;
|
|
1158
|
+
// frameDoc.open();
|
|
1159
|
+
// frameDoc.write(this.content);
|
|
1160
|
+
// frameDoc.write(
|
|
1161
|
+
// `<script src="${this.npmCdn}/resize-observer-polyfill@1.5.x"><\/script>`
|
|
1162
|
+
// );
|
|
1163
|
+
// frameDoc.close();
|
|
1164
|
+
// domready(frameDoc, async () => {
|
|
1165
|
+
// const _sqh = contentWindow.squatch || contentWindow.widgetIdent;
|
|
1166
|
+
// // @ts-ignore -- number will be cast to string by browsers
|
|
1167
|
+
// frame.height = frameDoc.body.scrollHeight;
|
|
1168
|
+
// // Adjust frame height when size of body changes
|
|
1169
|
+
// /* istanbul ignore next: hard to test */
|
|
1170
|
+
// const ro = new contentWindow["ResizeObserver"]((entries) => {
|
|
1171
|
+
// for (const entry of entries) {
|
|
1172
|
+
// const { height } = entry.contentRect;
|
|
1173
|
+
// // @ts-ignore -- number will be cast to string by browsers
|
|
1174
|
+
// frame.height = height;
|
|
1175
|
+
// }
|
|
1176
|
+
// });
|
|
1177
|
+
// const container = await this._findInnerContainer(frame);
|
|
1178
|
+
// ro.observe(container);
|
|
1179
|
+
// if (this._shouldFireLoadEvent()) {
|
|
1180
|
+
// this._loadEvent(_sqh);
|
|
1181
|
+
// _log("loaded");
|
|
1182
|
+
// } else if (frameDoc) {
|
|
1183
|
+
// this._attachLoadEventListener(frameDoc, _sqh);
|
|
1184
|
+
// }
|
|
1185
|
+
// });
|
|
1186
|
+
// }
|
|
1121
1187
|
async load() {
|
|
1122
1188
|
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1123
1189
|
const brandingConfig = (_b = (_a2 = this.context.widgetConfig) == null ? void 0 : _a2.values) == null ? void 0 : _b.brandingConfig;
|
|
@@ -1156,8 +1222,7 @@ class EmbedWidget extends Widget {
|
|
|
1156
1222
|
injectContents(element.shadowRoot);
|
|
1157
1223
|
}
|
|
1158
1224
|
} else if (element.firstChild) {
|
|
1159
|
-
element.
|
|
1160
|
-
injectContents(element);
|
|
1225
|
+
element.replaceChild(frame, element.firstChild);
|
|
1161
1226
|
} else {
|
|
1162
1227
|
injectContents(element);
|
|
1163
1228
|
}
|
|
@@ -1189,7 +1254,6 @@ class EmbedWidget extends Widget {
|
|
|
1189
1254
|
`);
|
|
1190
1255
|
frameDoc.close();
|
|
1191
1256
|
domready(frameDoc, async () => {
|
|
1192
|
-
frame.style.display = "block";
|
|
1193
1257
|
const _sqh = contentWindow.squatch || contentWindow.widgetIdent;
|
|
1194
1258
|
frame.height = initialHeight || frameDoc.body.scrollHeight;
|
|
1195
1259
|
console.log({ height: frameDoc.body.scrollHeight });
|