@roomle/embedding-lib 8.2.0-alpha.6 → 8.2.0-alpha.8
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/docs/md/web/embedding/CHANGELOG.md +6 -10
- package/package.json +1 -1
- package/roomle-embedding-lib.js +40 -43
- package/roomle-embedding-lib.min.js +36 -39
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
## 8.2.0-alpha.
|
|
1
|
+
## 8.2.0-alpha.8 (2026-10-20)
|
|
2
2
|
|
|
3
|
-
* Merge
|
|
4
|
-
* Merge pull request #
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* feat(core): upgrade to version 3.1.0-alpha.7 ([f359fb5](https://github.com/roomle-dev/roomle-ui/commit/f359fb5))
|
|
9
|
-
* fix(planner): deselect on ESC in 2D while wall drawing mode is enabled ([0749782](https://github.com/roomle-dev/roomle-ui/commit/0749782))
|
|
10
|
-
* fix(planner): deselect on ESC keydown so closing a dimension input keeps the selection ([d912cc4](https://github.com/roomle-dev/roomle-ui/commit/d912cc4))
|
|
11
|
-
* test(planner): keep selection when keys are released on tab visibility change ([85ccf08](https://github.com/roomle-dev/roomle-ui/commit/85ccf08))
|
|
3
|
+
* Merge pull request #3131 from roomle-dev/chore/rapi-v2-fallback ([a2d87cc](https://github.com/roomle-dev/roomle-ui/commit/a2d87cc)), closes [#3131](https://github.com/roomle-dev/roomle-ui/issues/3131)
|
|
4
|
+
* Merge pull request #3135 from roomle-dev/hotfix/rapi-v2-fallback-release ([620b91f](https://github.com/roomle-dev/roomle-ui/commit/620b91f)), closes [#3135](https://github.com/roomle-dev/roomle-ui/issues/3135)
|
|
5
|
+
* fix(rapi): release temporary RAPI v2 fallback ([c37a192](https://github.com/roomle-dev/roomle-ui/commit/c37a192)), closes [#3131](https://github.com/roomle-dev/roomle-ui/issues/3131)
|
|
6
|
+
* test(e2e): restore v2 RAPI mocks for v3 paths ([8bd1087](https://github.com/roomle-dev/roomle-ui/commit/8bd1087))
|
|
7
|
+
* chore: temporarily route all RAPI requests to v2 via RAPI_V3_ENABLED flag ([3b891a2](https://github.com/roomle-dev/roomle-ui/commit/3b891a2))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "8.2.0-alpha.
|
|
3
|
+
"version": "8.2.0-alpha.8",
|
|
4
4
|
"description": "This is a small library which can be used to communicate with the Roomle Configurator. ES modules only (browser-compatible).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./roomle-embedding-lib.js",
|
package/roomle-embedding-lib.js
CHANGED
|
@@ -225,14 +225,11 @@ var t = class {
|
|
|
225
225
|
resolve: e,
|
|
226
226
|
reject: t
|
|
227
227
|
};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
let n = T(t) ? "v3" : "v2";
|
|
234
|
-
return e.replace(w, "/" + n) + t;
|
|
235
|
-
}, D = {
|
|
228
|
+
};
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region packages/common/src/utils/rapi-version.ts
|
|
231
|
+
(/* @__PURE__ */ "/items./items/{id}./items/{id}/renderings./items/{id}/conversions./items/{id}/3d-exports./items/{id}/perspectiveImage./items/{id}/perspectiveImageHD./items/{id}/topImage./items/{id}/tags./items/{id}/tagConnections./items/{id}/additionalContents./items/{id}/assetProcessings./items/{id}/3dAssets/{format}./items/{id}/3dAssets/{format}/{dummyFileName}./configurations./configurations/{id}./configurations/{id}/shares./configurations/{id}/renderings./configurations/{id}/3d-exports./configurations/{id}/3dAssets/{format}./configurations/{id}/3dAssets/{format}/{dummyFileName}./auth/signin./auth/signout./auth/reset./auth/reset/confirm./auth/change/pwd./auth/context./assets/analyze./version".split(".")).map((e) => RegExp("^" + e.replace(/\{[^}]+\}/g, "[^/]+") + "/?$"));
|
|
232
|
+
var C = /\/v[23]\/?$/, w = (e, t) => C.test(e) ? e.replace(C, "/v2") + t : e + t, T = {
|
|
236
233
|
SDK: "extended",
|
|
237
234
|
CONFIGURATOR_SDK: "configurator",
|
|
238
235
|
CALLBACKS: "callbacks",
|
|
@@ -240,22 +237,22 @@ var t = class {
|
|
|
240
237
|
ANALYTICS: "analytics",
|
|
241
238
|
GLOBAL: "global",
|
|
242
239
|
RAPI: "rapi"
|
|
243
|
-
},
|
|
240
|
+
}, E = ".", D = T.SDK + "." + T.CALLBACKS, O = {
|
|
244
241
|
REQUEST_BOOT: "requestBoot",
|
|
245
242
|
SETUP: "setup",
|
|
246
243
|
WEBSITE_READY: "websiteReady"
|
|
247
|
-
},
|
|
244
|
+
}, k = {
|
|
248
245
|
GET_METHODS: "getMethods",
|
|
249
246
|
RETURN_METHODS: "returnMethods",
|
|
250
247
|
REGISTER_CUSTOM_VIEW: "registerCustomView",
|
|
251
248
|
REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
|
|
252
|
-
},
|
|
249
|
+
}, A = ["constructor", "callbacks"], j = (e) => e[0] !== "_" && !A.includes(e), M = (e, t, n = !1) => {
|
|
253
250
|
if (!e) return [];
|
|
254
|
-
let r = Object.getOwnPropertyNames(e), i = n ?
|
|
255
|
-
return r.filter(
|
|
256
|
-
},
|
|
251
|
+
let r = Object.getOwnPropertyNames(e), i = n ? T.CALLBACKS + "." : "";
|
|
252
|
+
return r.filter(j).map((e) => t + "." + i + e);
|
|
253
|
+
}, N = async (e, t) => {
|
|
257
254
|
if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
|
|
258
|
-
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i =
|
|
255
|
+
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = w(n, "/configurators/" + e), a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
|
|
259
256
|
method: "GET",
|
|
260
257
|
headers: new Headers({
|
|
261
258
|
apiKey: "roomle_portal_v2",
|
|
@@ -270,7 +267,7 @@ var t = class {
|
|
|
270
267
|
cache: "default"
|
|
271
268
|
}), { configurator: s } = await (await fetch(o)).json();
|
|
272
269
|
return s;
|
|
273
|
-
},
|
|
270
|
+
}, P = "data-rml-interaction-container", F = (e, t, n) => {
|
|
274
271
|
let r = null;
|
|
275
272
|
Object.defineProperty(e, t, {
|
|
276
273
|
get() {
|
|
@@ -280,16 +277,16 @@ var t = class {
|
|
|
280
277
|
e?.mute ? r = e.value : (console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"), console.warn("{ mute: true, value: () => void }"), r = e);
|
|
281
278
|
}
|
|
282
279
|
});
|
|
283
|
-
},
|
|
284
|
-
e && setTimeout(() => e.style.setProperty(
|
|
285
|
-
},
|
|
280
|
+
}, I = () => window.innerHeight * .01 + "px", L = (e) => {
|
|
281
|
+
e && setTimeout(() => e.style.setProperty(B, I()), 0);
|
|
282
|
+
}, R = "rml-styles", z = 450, B = "--rml-full-height", V = {
|
|
286
283
|
CONTAINER: "rml-container",
|
|
287
284
|
FILL: "rml-fill",
|
|
288
285
|
POSITION: "rml-pos",
|
|
289
286
|
TRANSITION: "rml-transition",
|
|
290
287
|
ANDROID_HEIGHT: "rml-android-height",
|
|
291
288
|
OVERFLOW_HIDDEN: "rml-overflow-hidden"
|
|
292
|
-
},
|
|
289
|
+
}, H = /* @__PURE__ */ new Map(), U = class extends x {
|
|
293
290
|
static createPlanner(e, t, n, r = []) {
|
|
294
291
|
return this._create(e, t, n, r);
|
|
295
292
|
}
|
|
@@ -298,10 +295,10 @@ var t = class {
|
|
|
298
295
|
r.viewName = e;
|
|
299
296
|
let { resolve: i, promise: a } = S(), { resolve: o, promise: s } = S(), c = new t("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
|
|
300
297
|
switch (e) {
|
|
301
|
-
case
|
|
298
|
+
case k.REGISTER_CUSTOM_VIEW_DONE:
|
|
302
299
|
i();
|
|
303
300
|
break;
|
|
304
|
-
case
|
|
301
|
+
case k.RETURN_METHODS:
|
|
305
302
|
r.handleSetup(t[0]), o();
|
|
306
303
|
break;
|
|
307
304
|
default: if (r.isSetupDone) return r.executeMessage({
|
|
@@ -312,7 +309,7 @@ var t = class {
|
|
|
312
309
|
});
|
|
313
310
|
r.setMessageHandler(c);
|
|
314
311
|
let l = [e];
|
|
315
|
-
return c.sendMessage(
|
|
312
|
+
return c.sendMessage(k.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(k.GET_METHODS, l), await s, r.setupPlugins(n, document.body, "custom-view"), await Promise.allSettled(r.pluginsLoaded), r;
|
|
316
313
|
}
|
|
317
314
|
static createConfigurator(e, t, n, r = []) {
|
|
318
315
|
return this._create(e, t, n, r);
|
|
@@ -328,7 +325,7 @@ var t = class {
|
|
|
328
325
|
try {
|
|
329
326
|
let a = d(n), s = m();
|
|
330
327
|
v(s);
|
|
331
|
-
let c = await
|
|
328
|
+
let c = await N(e, o(s, a));
|
|
332
329
|
n = y(c, a);
|
|
333
330
|
let l = new this(c, t, n, r, i);
|
|
334
331
|
return await Promise.allSettled(l.pluginsLoaded), l;
|
|
@@ -344,51 +341,51 @@ var t = class {
|
|
|
344
341
|
_iframe;
|
|
345
342
|
constructor(e, n, r, i, a) {
|
|
346
343
|
if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
|
|
347
|
-
if (
|
|
348
|
-
if (!document.getElementById(
|
|
344
|
+
if (H.has(n)) throw Error("There is already an instance on this DOM element");
|
|
345
|
+
if (!document.getElementById(R)) {
|
|
349
346
|
let e = r.zIndex || 9999999, t = document.createElement("style");
|
|
350
|
-
t.type = "text/css", t.id =
|
|
351
|
-
let n = "transition:all ease-in-out " +
|
|
347
|
+
t.type = "text/css", t.id = R;
|
|
348
|
+
let n = "transition:all ease-in-out " + z + "ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e += t + n, "") + n, a = I();
|
|
352
349
|
t.innerHTML = `
|
|
353
|
-
.${
|
|
354
|
-
.${
|
|
355
|
-
.${
|
|
356
|
-
.${
|
|
357
|
-
.${
|
|
358
|
-
.${
|
|
350
|
+
.${V.CONTAINER}{${B}:${a};}
|
|
351
|
+
.${V.POSITION}{position:fixed;top:0;left:0;z-index:${e};opacity:0}
|
|
352
|
+
.${V.TRANSITION}{${i}}
|
|
353
|
+
.${V.FILL}{width:100%;height:100%;opacity:1}
|
|
354
|
+
.${V.ANDROID_HEIGHT}{height:calc(var(${B},1vh)*100)}
|
|
355
|
+
.${V.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
359
356
|
`, document.head.appendChild(t);
|
|
360
357
|
}
|
|
361
358
|
this._executeMessage = this._executeMessage.bind(this);
|
|
362
359
|
let o = new t("website", window, null, this._executeMessage);
|
|
363
360
|
this.setMessageHandler(o), this._onResize = this._onResize.bind(this), b() && window.addEventListener("resize", this._onResize), this._container = n, this._initData = r, this._configuratorSettings = e;
|
|
364
361
|
let s = this._createIframe();
|
|
365
|
-
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe),
|
|
362
|
+
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe), H.set(n, !0);
|
|
366
363
|
}
|
|
367
364
|
teardown() {
|
|
368
|
-
this._container &&
|
|
365
|
+
this._container && H.delete(this._container);
|
|
369
366
|
let e = this._container.querySelector("iframe");
|
|
370
367
|
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
371
368
|
}
|
|
372
369
|
_createIframe() {
|
|
373
370
|
let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
|
|
374
|
-
return this._initData.useLocalRoomle && (t = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (t = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (t = this._initData.overrideServerUrl), e.src = t, e.classList.add(
|
|
371
|
+
return this._initData.useLocalRoomle && (t = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (t = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (t = this._initData.overrideServerUrl), e.src = t, e.classList.add(V.CONTAINER), e.classList.add(V.FILL), e;
|
|
375
372
|
}
|
|
376
373
|
_onResize() {
|
|
377
|
-
|
|
374
|
+
L(this._iframe);
|
|
378
375
|
}
|
|
379
376
|
_onUseFullPage() {
|
|
380
|
-
this._iframe.classList.add(
|
|
377
|
+
this._iframe.classList.add(V.POSITION), document.documentElement.classList.add(V.OVERFLOW_HIDDEN), window.document.body.classList.add(V.OVERFLOW_HIDDEN), b() && (L(this._iframe), this._iframe.classList.add(V.ANDROID_HEIGHT));
|
|
381
378
|
}
|
|
382
379
|
_onBackToWebsite() {
|
|
383
|
-
this._iframe.classList.remove(
|
|
380
|
+
this._iframe.classList.remove(V.POSITION), this._iframe.classList.remove(V.ANDROID_HEIGHT), document.documentElement.classList.remove(V.OVERFLOW_HIDDEN), window.document.body.classList.remove(V.OVERFLOW_HIDDEN);
|
|
384
381
|
}
|
|
385
382
|
_executeMessage({ message: e, args: t }, n) {
|
|
386
|
-
if (n.source && n.source === this._iframe?.contentWindow) return e ===
|
|
383
|
+
if (n.source && n.source === this._iframe?.contentWindow) return e === O.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(n.source), Promise.resolve({ result: this._initData })) : (console.error("MessageHandler not set"), Promise.resolve({ error: "MessageHandler not set" })) : e === O.SETUP ? (this.handleSetup(t[0]), F(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), F(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
|
|
387
384
|
if (!this._messageHandler) {
|
|
388
385
|
console.error("MessageHandler not set");
|
|
389
386
|
return;
|
|
390
387
|
}
|
|
391
|
-
this._messageHandler.sendMessage(
|
|
388
|
+
this._messageHandler.sendMessage(O.WEBSITE_READY);
|
|
392
389
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({
|
|
393
390
|
message: e,
|
|
394
391
|
args: t
|
|
@@ -396,4 +393,4 @@ var t = class {
|
|
|
396
393
|
}
|
|
397
394
|
};
|
|
398
395
|
//#endregion
|
|
399
|
-
export {
|
|
396
|
+
export { O as HANDSHAKE_MESSAGES, P as INTERACTION_CONTAINER_SELECTOR, T as NAMESPACE, E as NAMESPACE_SEPARATOR, D as SDK_CALLBACK, k as WELL_KNOWN_MESSAGES, U as default, N as getConfiguratorSettings, M as getMethodNames, j as isExposable };
|
|
@@ -206,7 +206,9 @@ var t = class {
|
|
|
206
206
|
resolve: e,
|
|
207
207
|
reject: t
|
|
208
208
|
};
|
|
209
|
-
}
|
|
209
|
+
};
|
|
210
|
+
(/* @__PURE__ */ "/items./items/{id}./items/{id}/renderings./items/{id}/conversions./items/{id}/3d-exports./items/{id}/perspectiveImage./items/{id}/perspectiveImageHD./items/{id}/topImage./items/{id}/tags./items/{id}/tagConnections./items/{id}/additionalContents./items/{id}/assetProcessings./items/{id}/3dAssets/{format}./items/{id}/3dAssets/{format}/{dummyFileName}./configurations./configurations/{id}./configurations/{id}/shares./configurations/{id}/renderings./configurations/{id}/3d-exports./configurations/{id}/3dAssets/{format}./configurations/{id}/3dAssets/{format}/{dummyFileName}./auth/signin./auth/signout./auth/reset./auth/reset/confirm./auth/change/pwd./auth/context./assets/analyze./version".split(".")).map((e) => RegExp("^" + e.replace(/\{[^}]+\}/g, "[^/]+") + "/?$"));
|
|
211
|
+
var h = /\/v[23]\/?$/, g = {
|
|
210
212
|
SDK: "extended",
|
|
211
213
|
CONFIGURATOR_SDK: "configurator",
|
|
212
214
|
CALLBACKS: "callbacks",
|
|
@@ -214,29 +216,24 @@ var t = class {
|
|
|
214
216
|
ANALYTICS: "analytics",
|
|
215
217
|
GLOBAL: "global",
|
|
216
218
|
RAPI: "rapi"
|
|
217
|
-
},
|
|
219
|
+
}, _ = ".", v = g.SDK + "." + g.CALLBACKS, y = {
|
|
218
220
|
REQUEST_BOOT: "requestBoot",
|
|
219
221
|
SETUP: "setup",
|
|
220
222
|
WEBSITE_READY: "websiteReady"
|
|
221
|
-
},
|
|
223
|
+
}, b = {
|
|
222
224
|
GET_METHODS: "getMethods",
|
|
223
225
|
RETURN_METHODS: "returnMethods",
|
|
224
226
|
REGISTER_CUSTOM_VIEW: "registerCustomView",
|
|
225
227
|
REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
|
|
226
|
-
},
|
|
228
|
+
}, x = ["constructor", "callbacks"], S = (e) => e[0] !== "_" && !x.includes(e), C = (e, t, n = !1) => {
|
|
227
229
|
if (!e) return [];
|
|
228
|
-
let r = Object.getOwnPropertyNames(e), i = n ?
|
|
229
|
-
return r.filter(
|
|
230
|
-
},
|
|
230
|
+
let r = Object.getOwnPropertyNames(e), i = n ? g.CALLBACKS + "." : "";
|
|
231
|
+
return r.filter(S).map((e) => t + "." + i + e);
|
|
232
|
+
}, w = async (e, t) => {
|
|
231
233
|
if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
|
|
232
|
-
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = (
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
let t = e.split("?")[0];
|
|
236
|
-
return h.some((e) => e.test(t));
|
|
237
|
-
})(t) ? "v3" : "v2";
|
|
238
|
-
return e.replace(g, "/" + n) + t;
|
|
239
|
-
})(n, "/configurators/" + e), a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
|
|
234
|
+
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = (a = n, o = "/configurators/" + e, h.test(a) ? a.replace(h, "/v2") + o : a + o);
|
|
235
|
+
var a, o;
|
|
236
|
+
let s = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), c = new Request(i, {
|
|
240
237
|
method: "GET",
|
|
241
238
|
headers: new Headers({
|
|
242
239
|
apiKey: "roomle_portal_v2",
|
|
@@ -244,14 +241,14 @@ var t = class {
|
|
|
244
241
|
locale: "en",
|
|
245
242
|
language: "en",
|
|
246
243
|
device: 1,
|
|
247
|
-
token:
|
|
244
|
+
token: s,
|
|
248
245
|
platform: "web"
|
|
249
246
|
}),
|
|
250
247
|
mode: "cors",
|
|
251
248
|
cache: "default"
|
|
252
|
-
}), { configurator:
|
|
253
|
-
return
|
|
254
|
-
},
|
|
249
|
+
}), { configurator: l } = await (await fetch(c)).json();
|
|
250
|
+
return l;
|
|
251
|
+
}, T = "data-rml-interaction-container", E = (e, t, n) => {
|
|
255
252
|
let r = null;
|
|
256
253
|
Object.defineProperty(e, t, {
|
|
257
254
|
get: () => r || n,
|
|
@@ -259,9 +256,9 @@ var t = class {
|
|
|
259
256
|
r = e?.mute ? e.value : e;
|
|
260
257
|
}
|
|
261
258
|
});
|
|
262
|
-
},
|
|
263
|
-
e && setTimeout(() => e.style.setProperty(
|
|
264
|
-
},
|
|
259
|
+
}, D = () => .01 * window.innerHeight + "px", O = (e) => {
|
|
260
|
+
e && setTimeout(() => e.style.setProperty(A, D()), 0);
|
|
261
|
+
}, k = "rml-styles", A = "--rml-full-height", j = "rml-container", M = "rml-fill", N = "rml-pos", P = "rml-android-height", F = "rml-overflow-hidden", I = /* @__PURE__ */ new Map(), L = class extends p {
|
|
265
262
|
static createPlanner(e, t, n, r = []) {
|
|
266
263
|
return this._create(e, t, n, r);
|
|
267
264
|
}
|
|
@@ -270,10 +267,10 @@ var t = class {
|
|
|
270
267
|
r.viewName = e;
|
|
271
268
|
let { resolve: i, promise: a } = m(), { resolve: o, promise: s } = m(), c = new t("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
|
|
272
269
|
switch (e) {
|
|
273
|
-
case
|
|
270
|
+
case b.REGISTER_CUSTOM_VIEW_DONE:
|
|
274
271
|
i();
|
|
275
272
|
break;
|
|
276
|
-
case
|
|
273
|
+
case b.RETURN_METHODS:
|
|
277
274
|
r.handleSetup(t[0]), o();
|
|
278
275
|
break;
|
|
279
276
|
default: if (r.isSetupDone) return r.executeMessage({
|
|
@@ -284,7 +281,7 @@ var t = class {
|
|
|
284
281
|
});
|
|
285
282
|
r.setMessageHandler(c);
|
|
286
283
|
let l = [e];
|
|
287
|
-
return c.sendMessage(
|
|
284
|
+
return c.sendMessage(b.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(b.GET_METHODS, l), await s, r.setupPlugins(n, document.body, "custom-view"), await Promise.allSettled(r.pluginsLoaded), r;
|
|
288
285
|
}
|
|
289
286
|
static createConfigurator(e, t, n, r = []) {
|
|
290
287
|
return this._create(e, t, n, r);
|
|
@@ -300,7 +297,7 @@ var t = class {
|
|
|
300
297
|
try {
|
|
301
298
|
let s = ((e) => (l(e), e?.customApiUrl && (e.customApiUrl = decodeURIComponent(e.customApiUrl)), e.shareUrl && (e.deeplink = e.shareUrl.replace("<CONF_ID>", "#CONFIGURATIONID#")), e))(n), c = u();
|
|
302
299
|
d(c);
|
|
303
|
-
let f = await
|
|
300
|
+
let f = await w(e, r(c, s));
|
|
304
301
|
n = ((e, t) => {
|
|
305
302
|
let n = o(t), i = u();
|
|
306
303
|
d(i);
|
|
@@ -326,44 +323,44 @@ var t = class {
|
|
|
326
323
|
_iframe;
|
|
327
324
|
constructor(e, n, r, i, a) {
|
|
328
325
|
if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
|
|
329
|
-
if (
|
|
330
|
-
if (!document.getElementById(
|
|
326
|
+
if (I.has(n)) throw Error("There is already an instance on this DOM element");
|
|
327
|
+
if (!document.getElementById(k)) {
|
|
331
328
|
let e = r.zIndex || 9999999, t = document.createElement("style");
|
|
332
|
-
t.type = "text/css", t.id =
|
|
329
|
+
t.type = "text/css", t.id = k;
|
|
333
330
|
let n = "transition:all ease-in-out 450ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e + (t + n), "") + n;
|
|
334
|
-
t.innerHTML = `\n .${
|
|
331
|
+
t.innerHTML = `\n .${j}{${A}:${D()};}\n .${N}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${M}{width:100%;height:100%;opacity:1}\n .${P}{height:calc(var(${A},1vh)*100)}\n .${F}{overflow:hidden}\n `, document.head.appendChild(t);
|
|
335
332
|
}
|
|
336
333
|
this._executeMessage = this._executeMessage.bind(this);
|
|
337
334
|
let o = new t("website", window, null, this._executeMessage);
|
|
338
335
|
this.setMessageHandler(o), this._onResize = this._onResize.bind(this), f() && window.addEventListener("resize", this._onResize), this._container = n, this._initData = r, this._configuratorSettings = e;
|
|
339
336
|
let s = this._createIframe();
|
|
340
|
-
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe),
|
|
337
|
+
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe), I.set(n, !0);
|
|
341
338
|
}
|
|
342
339
|
teardown() {
|
|
343
|
-
this._container &&
|
|
340
|
+
this._container && I.delete(this._container);
|
|
344
341
|
let e = this._container.querySelector("iframe");
|
|
345
342
|
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
346
343
|
}
|
|
347
344
|
_createIframe() {
|
|
348
345
|
let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
|
|
349
|
-
return this._initData.useLocalRoomle && (t = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (t = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (t = this._initData.overrideServerUrl), e.src = t, e.classList.add(
|
|
346
|
+
return this._initData.useLocalRoomle && (t = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (t = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (t = this._initData.overrideServerUrl), e.src = t, e.classList.add(j), e.classList.add(M), e;
|
|
350
347
|
}
|
|
351
348
|
_onResize() {
|
|
352
|
-
|
|
349
|
+
O(this._iframe);
|
|
353
350
|
}
|
|
354
351
|
_onUseFullPage() {
|
|
355
|
-
this._iframe.classList.add(
|
|
352
|
+
this._iframe.classList.add(N), document.documentElement.classList.add(F), window.document.body.classList.add(F), f() && (O(this._iframe), this._iframe.classList.add(P));
|
|
356
353
|
}
|
|
357
354
|
_onBackToWebsite() {
|
|
358
|
-
this._iframe.classList.remove(
|
|
355
|
+
this._iframe.classList.remove(N), this._iframe.classList.remove(P), document.documentElement.classList.remove(F), window.document.body.classList.remove(F);
|
|
359
356
|
}
|
|
360
357
|
_executeMessage({ message: e, args: t }, n) {
|
|
361
|
-
if (n.source && n.source === this._iframe?.contentWindow) return e ===
|
|
362
|
-
this._messageHandler && this._messageHandler.sendMessage(
|
|
358
|
+
if (n.source && n.source === this._iframe?.contentWindow) return e === y.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(n.source), Promise.resolve({ result: this._initData })) : Promise.resolve({ error: "MessageHandler not set" }) : e === y.SETUP ? (this.handleSetup(t[0]), E(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), E(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
|
|
359
|
+
this._messageHandler && this._messageHandler.sendMessage(y.WEBSITE_READY);
|
|
363
360
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({
|
|
364
361
|
message: e,
|
|
365
362
|
args: t
|
|
366
363
|
});
|
|
367
364
|
}
|
|
368
365
|
};
|
|
369
|
-
export {
|
|
366
|
+
export { y as HANDSHAKE_MESSAGES, T as INTERACTION_CONTAINER_SELECTOR, g as NAMESPACE, _ as NAMESPACE_SEPARATOR, v as SDK_CALLBACK, b as WELL_KNOWN_MESSAGES, L as default, w as getConfiguratorSettings, C as getMethodNames, S as isExposable };
|