@roomle/embedding-lib 8.2.0-alpha.2 → 8.2.0-alpha.3
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 +15 -31
- package/package.json +1 -1
- package/roomle-embedding-lib.js +44 -37
- package/roomle-embedding-lib.min.js +37 -30
|
@@ -1,32 +1,16 @@
|
|
|
1
|
-
## 8.2.0-alpha.
|
|
1
|
+
## 8.2.0-alpha.3 (2026-10-08)
|
|
2
2
|
|
|
3
|
-
* Merge branch 'master' into
|
|
4
|
-
* Merge
|
|
5
|
-
* Merge
|
|
6
|
-
* Merge
|
|
7
|
-
* Merge
|
|
8
|
-
* Merge
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* Merge pull request #3090 from roomle-dev/fix/resolve-duplicate-docking-vector-names-RML-18054 ([93bb768](https://github.com/roomle-dev/roomle-ui/commit/93bb768)), closes [#3090](https://github.com/roomle-dev/roomle-ui/issues/3090)
|
|
18
|
-
* Merge pull request #3091 from roomle-dev/fix/firefox-dragging-in-hi ([2fbd6c7](https://github.com/roomle-dev/roomle-ui/commit/2fbd6c7)), closes [#3091](https://github.com/roomle-dev/roomle-ui/issues/3091)
|
|
19
|
-
* fix: address the review of the row edit commands ([65b13c5](https://github.com/roomle-dev/roomle-ui/commit/65b13c5))
|
|
20
|
-
* fix: dock hi roots at the outermost of several docking vectors with one name ([5d00e65](https://github.com/roomle-dev/roomle-ui/commit/5d00e65))
|
|
21
|
-
* fix: drop the docking to a deleted root module ([20d95fa](https://github.com/roomle-dev/roomle-ui/commit/20d95fa))
|
|
22
|
-
* fix: element dragin not working on firefox ([af91650](https://github.com/roomle-dev/roomle-ui/commit/af91650))
|
|
23
|
-
* fix(planner): hide only the configuration components cut by the camera ([928d107](https://github.com/roomle-dev/roomle-ui/commit/928d107))
|
|
24
|
-
* fix(planner): keep camera-cut visibility off the render loop's allocation path ([4bbf5ce](https://github.com/roomle-dev/roomle-ui/commit/4bbf5ce))
|
|
25
|
-
* test: cover the resolution of duplicate back docking vectors ([1ebf183](https://github.com/roomle-dev/roomle-ui/commit/1ebf183))
|
|
26
|
-
* feat: add the obstacles section to the plan context ([c8f61d0](https://github.com/roomle-dev/roomle-ui/commit/c8f61d0))
|
|
27
|
-
* feat: enable initialFloorMaterial for planner in sky mode ([6611345](https://github.com/roomle-dev/roomle-ui/commit/6611345))
|
|
28
|
-
* feat: insert, remove and swap root modules of a group ([ff972b3](https://github.com/roomle-dev/roomle-ui/commit/ff972b3))
|
|
29
|
-
* feat: read the obstacle map of the plan ([c6d274f](https://github.com/roomle-dev/roomle-ui/commit/c6d274f))
|
|
30
|
-
* feat(core): upgrade to version 3.1.0-alpha.4 ([d2b46b2](https://github.com/roomle-dev/roomle-ui/commit/d2b46b2))
|
|
31
|
-
* feat: use setAnimationLoop instead of requestAnimationFrame and add inspector textures + add flag to ([b47e110](https://github.com/roomle-dev/roomle-ui/commit/b47e110))
|
|
32
|
-
* refactor: share the rearranged load of swapRootModule ([385a642](https://github.com/roomle-dev/roomle-ui/commit/385a642))
|
|
3
|
+
* Merge branch 'master' into fix/rapi-v3-per-endpoint-RML-17813 ([a222f8a](https://github.com/roomle-dev/roomle-ui/commit/a222f8a))
|
|
4
|
+
* Merge pull request #3094 from roomle-dev/fix/collapsed-view-not-keeping-icon-sizes ([5a0251f](https://github.com/roomle-dev/roomle-ui/commit/5a0251f)), closes [#3094](https://github.com/roomle-dev/roomle-ui/issues/3094)
|
|
5
|
+
* Merge pull request #3095 from roomle-dev/fix/rapi-v3-per-endpoint-RML-17813 ([cb52906](https://github.com/roomle-dev/roomle-ui/commit/cb52906)), closes [#3095](https://github.com/roomle-dev/roomle-ui/issues/3095)
|
|
6
|
+
* Merge pull request #3098 from roomle-dev/upgraded-by-ci/core-3.1.0-alpha.5 ([ca068de](https://github.com/roomle-dev/roomle-ui/commit/ca068de)), closes [#3098](https://github.com/roomle-dev/roomle-ui/issues/3098)
|
|
7
|
+
* Merge pull request #3100 from roomle-dev/fix/interior-lights-shader-fix ([f86b483](https://github.com/roomle-dev/roomle-ui/commit/f86b483)), closes [#3100](https://github.com/roomle-dev/roomle-ui/issues/3100)
|
|
8
|
+
* Merge pull request #3103 from roomle-dev/fix/embedding-lib-size-limit-RML-17813 ([92c9539](https://github.com/roomle-dev/roomle-ui/commit/92c9539)), closes [#3103](https://github.com/roomle-dev/roomle-ui/issues/3103)
|
|
9
|
+
* fix: address review comments on PR #3095 ([f679cf3](https://github.com/roomle-dev/roomle-ui/commit/f679cf3)), closes [#3095](https://github.com/roomle-dev/roomle-ui/issues/3095)
|
|
10
|
+
* fix(rapi): default to v2 and switch to v3 only for endpoints RAPI v3 serves ([5b352b7](https://github.com/roomle-dev/roomle-ui/commit/5b352b7))
|
|
11
|
+
* fix: preserve icon size on grid view collapse ([0269eac](https://github.com/roomle-dev/roomle-ui/commit/0269eac))
|
|
12
|
+
* fix(embedding): raise embedding lib file size limit to 16 kb ([0f8fd5e](https://github.com/roomle-dev/roomle-ui/commit/0f8fd5e))
|
|
13
|
+
* fix: remove a corner article of an hi group by turning one leg ([41bbb0c](https://github.com/roomle-dev/roomle-ui/commit/41bbb0c))
|
|
14
|
+
* fix(rapi): resolve configurator url version and proxy both RAPI versions in sdk dev server ([b262ce1](https://github.com/roomle-dev/roomle-ui/commit/b262ce1))
|
|
15
|
+
* chore: remove old lighting shader patch ([0f7694f](https://github.com/roomle-dev/roomle-ui/commit/0f7694f))
|
|
16
|
+
* feat(core): upgrade to version 3.1.0-alpha.5 ([3d1fcc4](https://github.com/roomle-dev/roomle-ui/commit/3d1fcc4))
|
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.3",
|
|
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
|
@@ -138,7 +138,7 @@ var t = class {
|
|
|
138
138
|
let t = l(u);
|
|
139
139
|
t.locale ||= e(null, !0), t.id === "(idle)" && delete t.id;
|
|
140
140
|
let n = i();
|
|
141
|
-
return n && a(n) && (t.configuratorId = "demoConfigurator"), t.customApiUrl = "https://rubens.alpha.roomle.com/api/
|
|
141
|
+
return n && a(n) && (t.configuratorId = "demoConfigurator"), t.customApiUrl = "https://rubens.alpha.roomle.com/api/v2", t.emails = !1, t;
|
|
142
142
|
}, h = "<CONF_ID>", g = "#CONFIGURATIONID#", _ = (e) => {
|
|
143
143
|
let t = e.featureFlags;
|
|
144
144
|
if (!t || typeof t != "object" || Array.isArray(t)) return;
|
|
@@ -224,7 +224,14 @@ var t = class {
|
|
|
224
224
|
resolve: e,
|
|
225
225
|
reject: t
|
|
226
226
|
};
|
|
227
|
-
}, C = {
|
|
227
|
+
}, C = (/* @__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, "[^/]+") + "/?$")), w = /\/v[23]\/?$/, T = (e) => {
|
|
228
|
+
let t = e.split("?")[0];
|
|
229
|
+
return C.some((e) => e.test(t));
|
|
230
|
+
}, E = (e, t) => {
|
|
231
|
+
if (!w.test(e)) return e + t;
|
|
232
|
+
let n = T(t) ? "v3" : "v2";
|
|
233
|
+
return e.replace(w, "/" + n) + t;
|
|
234
|
+
}, D = {
|
|
228
235
|
SDK: "extended",
|
|
229
236
|
CONFIGURATOR_SDK: "configurator",
|
|
230
237
|
CALLBACKS: "callbacks",
|
|
@@ -232,22 +239,22 @@ var t = class {
|
|
|
232
239
|
ANALYTICS: "analytics",
|
|
233
240
|
GLOBAL: "global",
|
|
234
241
|
RAPI: "rapi"
|
|
235
|
-
},
|
|
242
|
+
}, O = ".", k = D.SDK + "." + D.CALLBACKS, A = {
|
|
236
243
|
REQUEST_BOOT: "requestBoot",
|
|
237
244
|
SETUP: "setup",
|
|
238
245
|
WEBSITE_READY: "websiteReady"
|
|
239
|
-
},
|
|
246
|
+
}, j = {
|
|
240
247
|
GET_METHODS: "getMethods",
|
|
241
248
|
RETURN_METHODS: "returnMethods",
|
|
242
249
|
REGISTER_CUSTOM_VIEW: "registerCustomView",
|
|
243
250
|
REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
|
|
244
|
-
},
|
|
251
|
+
}, M = ["constructor", "callbacks"], N = (e) => e[0] !== "_" && !M.includes(e), P = (e, t, n = !1) => {
|
|
245
252
|
if (!e) return [];
|
|
246
|
-
let r = Object.getOwnPropertyNames(e), i = n ?
|
|
247
|
-
return r.filter(
|
|
248
|
-
},
|
|
253
|
+
let r = Object.getOwnPropertyNames(e), i = n ? D.CALLBACKS + "." : "";
|
|
254
|
+
return r.filter(N).map((e) => t + "." + i + e);
|
|
255
|
+
}, F = async (e, t) => {
|
|
249
256
|
if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
|
|
250
|
-
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/
|
|
257
|
+
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = E(n, "/configurators/" + e), a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
|
|
251
258
|
method: "GET",
|
|
252
259
|
headers: new Headers({
|
|
253
260
|
apiKey: "roomle_portal_v2",
|
|
@@ -262,7 +269,7 @@ var t = class {
|
|
|
262
269
|
cache: "default"
|
|
263
270
|
}), { configurator: s } = await (await fetch(o)).json();
|
|
264
271
|
return s;
|
|
265
|
-
},
|
|
272
|
+
}, I = "data-rml-interaction-container", L = (e, t, n) => {
|
|
266
273
|
let r = null;
|
|
267
274
|
Object.defineProperty(e, t, {
|
|
268
275
|
get() {
|
|
@@ -272,16 +279,16 @@ var t = class {
|
|
|
272
279
|
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);
|
|
273
280
|
}
|
|
274
281
|
});
|
|
275
|
-
},
|
|
276
|
-
e && setTimeout(() => e.style.setProperty(
|
|
277
|
-
},
|
|
282
|
+
}, R = () => window.innerHeight * .01 + "px", z = (e) => {
|
|
283
|
+
e && setTimeout(() => e.style.setProperty(H, R()), 0);
|
|
284
|
+
}, B = "rml-styles", V = 450, H = "--rml-full-height", U = {
|
|
278
285
|
CONTAINER: "rml-container",
|
|
279
286
|
FILL: "rml-fill",
|
|
280
287
|
POSITION: "rml-pos",
|
|
281
288
|
TRANSITION: "rml-transition",
|
|
282
289
|
ANDROID_HEIGHT: "rml-android-height",
|
|
283
290
|
OVERFLOW_HIDDEN: "rml-overflow-hidden"
|
|
284
|
-
},
|
|
291
|
+
}, W = /* @__PURE__ */ new Map(), G = class extends x {
|
|
285
292
|
static createPlanner(e, t, n, r = []) {
|
|
286
293
|
return this._create(e, t, n, r);
|
|
287
294
|
}
|
|
@@ -290,10 +297,10 @@ var t = class {
|
|
|
290
297
|
r.viewName = e;
|
|
291
298
|
let { resolve: i, promise: a } = S(), { resolve: o, promise: s } = S(), c = new t("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
|
|
292
299
|
switch (e) {
|
|
293
|
-
case
|
|
300
|
+
case j.REGISTER_CUSTOM_VIEW_DONE:
|
|
294
301
|
i();
|
|
295
302
|
break;
|
|
296
|
-
case
|
|
303
|
+
case j.RETURN_METHODS:
|
|
297
304
|
r.handleSetup(t[0]), o();
|
|
298
305
|
break;
|
|
299
306
|
default: if (r.isSetupDone) return r.executeMessage({
|
|
@@ -304,7 +311,7 @@ var t = class {
|
|
|
304
311
|
});
|
|
305
312
|
r.setMessageHandler(c);
|
|
306
313
|
let l = [e];
|
|
307
|
-
return c.sendMessage(
|
|
314
|
+
return c.sendMessage(j.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(j.GET_METHODS, l), await s, r.setupPlugins(n, document.body, "custom-view"), await Promise.allSettled(r.pluginsLoaded), r;
|
|
308
315
|
}
|
|
309
316
|
static createConfigurator(e, t, n, r = []) {
|
|
310
317
|
return this._create(e, t, n, r);
|
|
@@ -320,7 +327,7 @@ var t = class {
|
|
|
320
327
|
try {
|
|
321
328
|
let a = d(n), s = m();
|
|
322
329
|
v(s);
|
|
323
|
-
let c = await
|
|
330
|
+
let c = await F(e, o(s, a));
|
|
324
331
|
n = y(c, a);
|
|
325
332
|
let l = new this(c, t, n, r, i);
|
|
326
333
|
return await Promise.allSettled(l.pluginsLoaded), l;
|
|
@@ -336,51 +343,51 @@ var t = class {
|
|
|
336
343
|
_iframe;
|
|
337
344
|
constructor(e, n, r, i, a) {
|
|
338
345
|
if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
|
|
339
|
-
if (
|
|
340
|
-
if (!document.getElementById(
|
|
346
|
+
if (W.has(n)) throw Error("There is already an instance on this DOM element");
|
|
347
|
+
if (!document.getElementById(B)) {
|
|
341
348
|
let e = r.zIndex || 9999999, t = document.createElement("style");
|
|
342
|
-
t.type = "text/css", t.id =
|
|
343
|
-
let n = "transition:all ease-in-out " +
|
|
349
|
+
t.type = "text/css", t.id = B;
|
|
350
|
+
let n = "transition:all ease-in-out " + V + "ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e += t + n, "") + n, a = R();
|
|
344
351
|
t.innerHTML = `
|
|
345
|
-
.${
|
|
346
|
-
.${
|
|
347
|
-
.${
|
|
348
|
-
.${
|
|
349
|
-
.${
|
|
350
|
-
.${
|
|
352
|
+
.${U.CONTAINER}{${H}:${a};}
|
|
353
|
+
.${U.POSITION}{position:fixed;top:0;left:0;z-index:${e};opacity:0}
|
|
354
|
+
.${U.TRANSITION}{${i}}
|
|
355
|
+
.${U.FILL}{width:100%;height:100%;opacity:1}
|
|
356
|
+
.${U.ANDROID_HEIGHT}{height:calc(var(${H},1vh)*100)}
|
|
357
|
+
.${U.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
351
358
|
`, document.head.appendChild(t);
|
|
352
359
|
}
|
|
353
360
|
this._executeMessage = this._executeMessage.bind(this);
|
|
354
361
|
let o = new t("website", window, null, this._executeMessage);
|
|
355
362
|
this.setMessageHandler(o), this._onResize = this._onResize.bind(this), b() && window.addEventListener("resize", this._onResize), this._container = n, this._initData = r, this._configuratorSettings = e;
|
|
356
363
|
let s = this._createIframe();
|
|
357
|
-
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),
|
|
364
|
+
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), W.set(n, !0);
|
|
358
365
|
}
|
|
359
366
|
teardown() {
|
|
360
|
-
this._container &&
|
|
367
|
+
this._container && W.delete(this._container);
|
|
361
368
|
let e = this._container.querySelector("iframe");
|
|
362
369
|
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
363
370
|
}
|
|
364
371
|
_createIframe() {
|
|
365
372
|
let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
|
|
366
|
-
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(
|
|
373
|
+
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(U.CONTAINER), e.classList.add(U.FILL), e;
|
|
367
374
|
}
|
|
368
375
|
_onResize() {
|
|
369
|
-
|
|
376
|
+
z(this._iframe);
|
|
370
377
|
}
|
|
371
378
|
_onUseFullPage() {
|
|
372
|
-
this._iframe.classList.add(
|
|
379
|
+
this._iframe.classList.add(U.POSITION), document.documentElement.classList.add(U.OVERFLOW_HIDDEN), window.document.body.classList.add(U.OVERFLOW_HIDDEN), b() && (z(this._iframe), this._iframe.classList.add(U.ANDROID_HEIGHT));
|
|
373
380
|
}
|
|
374
381
|
_onBackToWebsite() {
|
|
375
|
-
this._iframe.classList.remove(
|
|
382
|
+
this._iframe.classList.remove(U.POSITION), this._iframe.classList.remove(U.ANDROID_HEIGHT), document.documentElement.classList.remove(U.OVERFLOW_HIDDEN), window.document.body.classList.remove(U.OVERFLOW_HIDDEN);
|
|
376
383
|
}
|
|
377
384
|
_executeMessage({ message: e, args: t }, n) {
|
|
378
|
-
if (n.source && n.source === this._iframe?.contentWindow) return e ===
|
|
385
|
+
if (n.source && n.source === this._iframe?.contentWindow) return e === A.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 === A.SETUP ? (this.handleSetup(t[0]), L(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), L(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
|
|
379
386
|
if (!this._messageHandler) {
|
|
380
387
|
console.error("MessageHandler not set");
|
|
381
388
|
return;
|
|
382
389
|
}
|
|
383
|
-
this._messageHandler.sendMessage(
|
|
390
|
+
this._messageHandler.sendMessage(A.WEBSITE_READY);
|
|
384
391
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({
|
|
385
392
|
message: e,
|
|
386
393
|
args: t
|
|
@@ -388,4 +395,4 @@ var t = class {
|
|
|
388
395
|
}
|
|
389
396
|
};
|
|
390
397
|
//#endregion
|
|
391
|
-
export {
|
|
398
|
+
export { A as HANDSHAKE_MESSAGES, I as INTERACTION_CONTAINER_SELECTOR, D as NAMESPACE, O as NAMESPACE_SEPARATOR, k as SDK_CALLBACK, j as WELL_KNOWN_MESSAGES, G as default, F as getConfiguratorSettings, P as getMethodNames, N as isExposable };
|
|
@@ -133,7 +133,7 @@ var t = class {
|
|
|
133
133
|
return r && ((e) => {
|
|
134
134
|
let t = /* @__PURE__ */ new RegExp(/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/);
|
|
135
135
|
return !!(n.includes(e) || t.test(e) || e.endsWith("roomle.com") || e.endsWith("gitlab.io") || e.endsWith("gitlab.com"));
|
|
136
|
-
})(r) && (t.configuratorId = "demoConfigurator"), t.customApiUrl = "https://rubens.alpha.roomle.com/api/
|
|
136
|
+
})(r) && (t.configuratorId = "demoConfigurator"), t.customApiUrl = "https://rubens.alpha.roomle.com/api/v2", t.emails = !1, t;
|
|
137
137
|
}, d = (e) => {
|
|
138
138
|
e.featureFlags ||= {}, typeof e.featureFlags.realPartList != "boolean" && (e.featureFlags.realPartList = !0), typeof e.featureFlags.globalCallbacks != "boolean" && (e.featureFlags.globalCallbacks = !0), typeof e.featureFlags.mocAr != "boolean" && (e.featureFlags.mocAr = !1);
|
|
139
139
|
}, f = () => /(android)/i.test(navigator.userAgent), p = class {
|
|
@@ -205,7 +205,7 @@ var t = class {
|
|
|
205
205
|
resolve: e,
|
|
206
206
|
reject: t
|
|
207
207
|
};
|
|
208
|
-
}, h = {
|
|
208
|
+
}, h = (/* @__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, "[^/]+") + "/?$")), g = /\/v[23]\/?$/, _ = {
|
|
209
209
|
SDK: "extended",
|
|
210
210
|
CONFIGURATOR_SDK: "configurator",
|
|
211
211
|
CALLBACKS: "callbacks",
|
|
@@ -213,22 +213,29 @@ var t = class {
|
|
|
213
213
|
ANALYTICS: "analytics",
|
|
214
214
|
GLOBAL: "global",
|
|
215
215
|
RAPI: "rapi"
|
|
216
|
-
},
|
|
216
|
+
}, v = ".", y = _.SDK + "." + _.CALLBACKS, b = {
|
|
217
217
|
REQUEST_BOOT: "requestBoot",
|
|
218
218
|
SETUP: "setup",
|
|
219
219
|
WEBSITE_READY: "websiteReady"
|
|
220
|
-
},
|
|
220
|
+
}, x = {
|
|
221
221
|
GET_METHODS: "getMethods",
|
|
222
222
|
RETURN_METHODS: "returnMethods",
|
|
223
223
|
REGISTER_CUSTOM_VIEW: "registerCustomView",
|
|
224
224
|
REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
|
|
225
|
-
},
|
|
225
|
+
}, S = ["constructor", "callbacks"], C = (e) => e[0] !== "_" && !S.includes(e), w = (e, t, n = !1) => {
|
|
226
226
|
if (!e) return [];
|
|
227
|
-
let r = Object.getOwnPropertyNames(e), i = n ?
|
|
228
|
-
return r.filter(
|
|
229
|
-
},
|
|
227
|
+
let r = Object.getOwnPropertyNames(e), i = n ? _.CALLBACKS + "." : "";
|
|
228
|
+
return r.filter(C).map((e) => t + "." + i + e);
|
|
229
|
+
}, T = async (e, t) => {
|
|
230
230
|
if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
|
|
231
|
-
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/
|
|
231
|
+
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = ((e, t) => {
|
|
232
|
+
if (!g.test(e)) return e + t;
|
|
233
|
+
let n = ((e) => {
|
|
234
|
+
let t = e.split("?")[0];
|
|
235
|
+
return h.some((e) => e.test(t));
|
|
236
|
+
})(t) ? "v3" : "v2";
|
|
237
|
+
return e.replace(g, "/" + n) + t;
|
|
238
|
+
})(n, "/configurators/" + e), a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
|
|
232
239
|
method: "GET",
|
|
233
240
|
headers: new Headers({
|
|
234
241
|
apiKey: "roomle_portal_v2",
|
|
@@ -243,7 +250,7 @@ var t = class {
|
|
|
243
250
|
cache: "default"
|
|
244
251
|
}), { configurator: s } = await (await fetch(o)).json();
|
|
245
252
|
return s;
|
|
246
|
-
},
|
|
253
|
+
}, E = "data-rml-interaction-container", D = (e, t, n) => {
|
|
247
254
|
let r = null;
|
|
248
255
|
Object.defineProperty(e, t, {
|
|
249
256
|
get: () => r || n,
|
|
@@ -251,9 +258,9 @@ var t = class {
|
|
|
251
258
|
r = e?.mute ? e.value : e;
|
|
252
259
|
}
|
|
253
260
|
});
|
|
254
|
-
},
|
|
255
|
-
e && setTimeout(() => e.style.setProperty(
|
|
256
|
-
},
|
|
261
|
+
}, O = () => .01 * window.innerHeight + "px", k = (e) => {
|
|
262
|
+
e && setTimeout(() => e.style.setProperty(j, O()), 0);
|
|
263
|
+
}, A = "rml-styles", j = "--rml-full-height", M = "rml-container", N = "rml-fill", P = "rml-pos", F = "rml-android-height", I = "rml-overflow-hidden", L = /* @__PURE__ */ new Map(), R = class extends p {
|
|
257
264
|
static createPlanner(e, t, n, r = []) {
|
|
258
265
|
return this._create(e, t, n, r);
|
|
259
266
|
}
|
|
@@ -262,10 +269,10 @@ var t = class {
|
|
|
262
269
|
r.viewName = e;
|
|
263
270
|
let { resolve: i, promise: a } = m(), { resolve: o, promise: s } = m(), c = new t("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
|
|
264
271
|
switch (e) {
|
|
265
|
-
case
|
|
272
|
+
case x.REGISTER_CUSTOM_VIEW_DONE:
|
|
266
273
|
i();
|
|
267
274
|
break;
|
|
268
|
-
case
|
|
275
|
+
case x.RETURN_METHODS:
|
|
269
276
|
r.handleSetup(t[0]), o();
|
|
270
277
|
break;
|
|
271
278
|
default: if (r.isSetupDone) return r.executeMessage({
|
|
@@ -276,7 +283,7 @@ var t = class {
|
|
|
276
283
|
});
|
|
277
284
|
r.setMessageHandler(c);
|
|
278
285
|
let l = [e];
|
|
279
|
-
return c.sendMessage(
|
|
286
|
+
return c.sendMessage(x.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(x.GET_METHODS, l), await s, r.setupPlugins(n, document.body, "custom-view"), await Promise.allSettled(r.pluginsLoaded), r;
|
|
280
287
|
}
|
|
281
288
|
static createConfigurator(e, t, n, r = []) {
|
|
282
289
|
return this._create(e, t, n, r);
|
|
@@ -292,7 +299,7 @@ var t = class {
|
|
|
292
299
|
try {
|
|
293
300
|
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();
|
|
294
301
|
d(c);
|
|
295
|
-
let f = await
|
|
302
|
+
let f = await T(e, r(c, s));
|
|
296
303
|
n = ((e, t) => {
|
|
297
304
|
let n = o(t), i = u();
|
|
298
305
|
d(i);
|
|
@@ -318,44 +325,44 @@ var t = class {
|
|
|
318
325
|
_iframe;
|
|
319
326
|
constructor(e, n, r, i, a) {
|
|
320
327
|
if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
|
|
321
|
-
if (
|
|
322
|
-
if (!document.getElementById(
|
|
328
|
+
if (L.has(n)) throw Error("There is already an instance on this DOM element");
|
|
329
|
+
if (!document.getElementById(A)) {
|
|
323
330
|
let e = r.zIndex || 9999999, t = document.createElement("style");
|
|
324
|
-
t.type = "text/css", t.id =
|
|
331
|
+
t.type = "text/css", t.id = A;
|
|
325
332
|
let n = "transition:all ease-in-out 450ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e + (t + n), "") + n;
|
|
326
|
-
t.innerHTML = `\n .${
|
|
333
|
+
t.innerHTML = `\n .${M}{${j}:${O()};}\n .${P}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${N}{width:100%;height:100%;opacity:1}\n .${F}{height:calc(var(${j},1vh)*100)}\n .${I}{overflow:hidden}\n `, document.head.appendChild(t);
|
|
327
334
|
}
|
|
328
335
|
this._executeMessage = this._executeMessage.bind(this);
|
|
329
336
|
let o = new t("website", window, null, this._executeMessage);
|
|
330
337
|
this.setMessageHandler(o), this._onResize = this._onResize.bind(this), f() && window.addEventListener("resize", this._onResize), this._container = n, this._initData = r, this._configuratorSettings = e;
|
|
331
338
|
let s = this._createIframe();
|
|
332
|
-
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),
|
|
339
|
+
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), L.set(n, !0);
|
|
333
340
|
}
|
|
334
341
|
teardown() {
|
|
335
|
-
this._container &&
|
|
342
|
+
this._container && L.delete(this._container);
|
|
336
343
|
let e = this._container.querySelector("iframe");
|
|
337
344
|
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
338
345
|
}
|
|
339
346
|
_createIframe() {
|
|
340
347
|
let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
|
|
341
|
-
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(
|
|
348
|
+
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(M), e.classList.add(N), e;
|
|
342
349
|
}
|
|
343
350
|
_onResize() {
|
|
344
|
-
|
|
351
|
+
k(this._iframe);
|
|
345
352
|
}
|
|
346
353
|
_onUseFullPage() {
|
|
347
|
-
this._iframe.classList.add(
|
|
354
|
+
this._iframe.classList.add(P), document.documentElement.classList.add(I), window.document.body.classList.add(I), f() && (k(this._iframe), this._iframe.classList.add(F));
|
|
348
355
|
}
|
|
349
356
|
_onBackToWebsite() {
|
|
350
|
-
this._iframe.classList.remove(
|
|
357
|
+
this._iframe.classList.remove(P), this._iframe.classList.remove(F), document.documentElement.classList.remove(I), window.document.body.classList.remove(I);
|
|
351
358
|
}
|
|
352
359
|
_executeMessage({ message: e, args: t }, n) {
|
|
353
|
-
if (n.source && n.source === this._iframe?.contentWindow) return e ===
|
|
354
|
-
this._messageHandler && this._messageHandler.sendMessage(
|
|
360
|
+
if (n.source && n.source === this._iframe?.contentWindow) return e === b.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(n.source), Promise.resolve({ result: this._initData })) : Promise.resolve({ error: "MessageHandler not set" }) : e === b.SETUP ? (this.handleSetup(t[0]), D(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), D(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
|
|
361
|
+
this._messageHandler && this._messageHandler.sendMessage(b.WEBSITE_READY);
|
|
355
362
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({
|
|
356
363
|
message: e,
|
|
357
364
|
args: t
|
|
358
365
|
});
|
|
359
366
|
}
|
|
360
367
|
};
|
|
361
|
-
export {
|
|
368
|
+
export { b as HANDSHAKE_MESSAGES, E as INTERACTION_CONTAINER_SELECTOR, _ as NAMESPACE, v as NAMESPACE_SEPARATOR, y as SDK_CALLBACK, x as WELL_KNOWN_MESSAGES, R as default, T as getConfiguratorSettings, w as getMethodNames, C as isExposable };
|