@roomle/embedding-lib 6.12.0-alpha.7 → 6.12.1-alpha.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/docs/md/web/embedding/CHANGELOG.md +3 -43
- package/package.json +1 -1
- package/roomle-embedding-lib.js +54 -54
- package/roomle-embedding-lib.min.js +45 -45
|
@@ -1,44 +1,4 @@
|
|
|
1
|
-
## 6.12.
|
|
1
|
+
## <small>6.12.1-alpha.1 (2026-07-28)</small>
|
|
2
2
|
|
|
3
|
-
* Merge
|
|
4
|
-
*
|
|
5
|
-
* Merge branch 'master' into fix/different-perspective-images-RML-17268 ([2051722](https://github.com/roomle-dev/roomle-ui/commit/2051722))
|
|
6
|
-
* Merge branch 'master' into fix/rapi-round-trip-plan-objects ([65e130f](https://github.com/roomle-dev/roomle-ui/commit/65e130f))
|
|
7
|
-
* Merge branch 'master' into fix/rapi-round-trip-plan-objects ([abd407d](https://github.com/roomle-dev/roomle-ui/commit/abd407d))
|
|
8
|
-
* Merge branch 'master' into fix/rapi-round-trip-plan-objects ([068892b](https://github.com/roomle-dev/roomle-ui/commit/068892b))
|
|
9
|
-
* Merge branch 'master' into fix/rapi-round-trip-plan-objects ([ec53235](https://github.com/roomle-dev/roomle-ui/commit/ec53235))
|
|
10
|
-
* Merge branch 'master' into upgraded-by-ci/core-2.81.0 ([1338c1f](https://github.com/roomle-dev/roomle-ui/commit/1338c1f))
|
|
11
|
-
* Merge branch 'master' into upgraded-by-ci/core-2.81.0 ([81b24bc](https://github.com/roomle-dev/roomle-ui/commit/81b24bc))
|
|
12
|
-
* Merge pull request #2819 from roomle-dev/feat/configurationForWebGpuGroundShadowReflection ([648a03b](https://github.com/roomle-dev/roomle-ui/commit/648a03b)), closes [#2819](https://github.com/roomle-dev/roomle-ui/issues/2819)
|
|
13
|
-
* Merge pull request #2821 from roomle-dev/feat/webGpuInteriorLightsShadows ([539cfb0](https://github.com/roomle-dev/roomle-ui/commit/539cfb0)), closes [#2821](https://github.com/roomle-dev/roomle-ui/issues/2821)
|
|
14
|
-
* Merge pull request #2823 from roomle-dev/chore/hide-edit-icon-for-external-object-RML-17231 ([1b3a3f4](https://github.com/roomle-dev/roomle-ui/commit/1b3a3f4)), closes [#2823](https://github.com/roomle-dev/roomle-ui/issues/2823)
|
|
15
|
-
* Merge pull request #2824 from roomle-dev/fix/different-perspective-images-RML-17268 ([549df68](https://github.com/roomle-dev/roomle-ui/commit/549df68)), closes [#2824](https://github.com/roomle-dev/roomle-ui/issues/2824)
|
|
16
|
-
* Merge pull request #2826 from roomle-dev/fix/rapi-round-trip-plan-objects ([d3765ef](https://github.com/roomle-dev/roomle-ui/commit/d3765ef)), closes [#2826](https://github.com/roomle-dev/roomle-ui/issues/2826)
|
|
17
|
-
* Merge pull request #2827 from roomle-dev/chore/removeUnnecessaryNullabilityInitdata ([b502c48](https://github.com/roomle-dev/roomle-ui/commit/b502c48)), closes [#2827](https://github.com/roomle-dev/roomle-ui/issues/2827)
|
|
18
|
-
* Merge pull request #2830 from roomle-dev/upgraded-by-ci/core-2.81.0-alpha.14 ([7228a08](https://github.com/roomle-dev/roomle-ui/commit/7228a08)), closes [#2830](https://github.com/roomle-dev/roomle-ui/issues/2830)
|
|
19
|
-
* Merge pull request #2831 from roomle-dev/upgraded-by-ci/core-2.81.0 ([8a059c1](https://github.com/roomle-dev/roomle-ui/commit/8a059c1)), closes [#2831](https://github.com/roomle-dev/roomle-ui/issues/2831)
|
|
20
|
-
* Merge pull request #2833 from roomle-dev/fix/fence-icon ([a678832](https://github.com/roomle-dev/roomle-ui/commit/a678832)), closes [#2833](https://github.com/roomle-dev/roomle-ui/issues/2833)
|
|
21
|
-
* Merge pull request #2834 from roomle-dev/fix/npm-ci-lockfile-sync ([8b8c830](https://github.com/roomle-dev/roomle-ui/commit/8b8c830)), closes [#2834](https://github.com/roomle-dev/roomle-ui/issues/2834)
|
|
22
|
-
* Merge pull request #2837 from roomle-dev/chore/build-embedding-examples-cp-internal-RML-17426 ([fbd3018](https://github.com/roomle-dev/roomle-ui/commit/fbd3018)), closes [#2837](https://github.com/roomle-dev/roomle-ui/issues/2837)
|
|
23
|
-
* Potential fix for pull request finding ([27001cd](https://github.com/roomle-dev/roomle-ui/commit/27001cd))
|
|
24
|
-
* ci: build embedding examples in cp-internal deploy workflow ([14747ee](https://github.com/roomle-dev/roomle-ui/commit/14747ee))
|
|
25
|
-
* chore: cleanup ([876de21](https://github.com/roomle-dev/roomle-ui/commit/876de21))
|
|
26
|
-
* chore: cleanup ([aa0c5f9](https://github.com/roomle-dev/roomle-ui/commit/aa0c5f9))
|
|
27
|
-
* chore: fix failing tests ([9ab9572](https://github.com/roomle-dev/roomle-ui/commit/9ab9572))
|
|
28
|
-
* chore: missing default ([4b76f0b](https://github.com/roomle-dev/roomle-ui/commit/4b76f0b))
|
|
29
|
-
* chore: remove strange promise reolves ([b2b8e67](https://github.com/roomle-dev/roomle-ui/commit/b2b8e67))
|
|
30
|
-
* chore: remove unnecessary ? from initdata fields with default value ([2f4435b](https://github.com/roomle-dev/roomle-ui/commit/2f4435b))
|
|
31
|
-
* chore: update lockfile ([77347b9](https://github.com/roomle-dev/roomle-ui/commit/77347b9))
|
|
32
|
-
* chore: wip round trip ([e5b5758](https://github.com/roomle-dev/roomle-ui/commit/e5b5758))
|
|
33
|
-
* fix: fence icon inside floor drawer ([44591b3](https://github.com/roomle-dev/roomle-ui/commit/44591b3))
|
|
34
|
-
* fix(web-sdk): generate consistent perspective images with construction elements in snapshots (RML-17 ([b9da0f8](https://github.com/roomle-dev/roomle-ui/commit/b9da0f8))
|
|
35
|
-
* fix(web-sdk): isolate object snapshot images ([d3dc9ef](https://github.com/roomle-dev/roomle-ui/commit/d3dc9ef))
|
|
36
|
-
* fix: remove pencil icon for HI catalogue ([ccfb866](https://github.com/roomle-dev/roomle-ui/commit/ccfb866))
|
|
37
|
-
* fix(web-sdk): serialize perspective image rendering in getExternalObjectSnapshot to prevent shared s ([96a9262](https://github.com/roomle-dev/roomle-ui/commit/96a9262))
|
|
38
|
-
* fix: sync package-lock.json to fix npm ci failure in CI ([2656785](https://github.com/roomle-dev/roomle-ui/commit/2656785))
|
|
39
|
-
* feat: configuration parameters for webgpu top light/shadow and ground reflection ([805d9c8](https://github.com/roomle-dev/roomle-ui/commit/805d9c8))
|
|
40
|
-
* feat: enable shadows for interior lights for webGPU ([8a08a84](https://github.com/roomle-dev/roomle-ui/commit/8a08a84))
|
|
41
|
-
* feat(core): upgrade to version 2.81.0-alpha.14 ([8bbb1e8](https://github.com/roomle-dev/roomle-ui/commit/8bbb1e8))
|
|
42
|
-
* feat(core): upgrade to version 2.81.0 ([f4d9446](https://github.com/roomle-dev/roomle-ui/commit/f4d9446))
|
|
43
|
-
* docs(hi): update external object snapshot documentation to reflect current behavior ([14ad0a0](https://github.com/roomle-dev/roomle-ui/commit/14ad0a0))
|
|
44
|
-
* test(planner): fix deprecated getPlanInteractionHandler API usage in RoomFenceSettings mock ([565633f](https://github.com/roomle-dev/roomle-ui/commit/565633f))
|
|
3
|
+
* Merge pull request #2825 from roomle-dev/fix/parseNumberInitDataAsNumber ([41f90eb](https://github.com/roomle-dev/roomle-ui/commit/41f90eb)), closes [#2825](https://github.com/roomle-dev/roomle-ui/issues/2825)
|
|
4
|
+
* fix: actually parse init data number values as numbers not strings ([ad37612](https://github.com/roomle-dev/roomle-ui/commit/ad37612))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "6.12.
|
|
3
|
+
"version": "6.12.1-alpha.1",
|
|
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
|
@@ -126,32 +126,32 @@ var r = class {
|
|
|
126
126
|
},
|
|
127
127
|
rotationSnapDegrees: 10,
|
|
128
128
|
interactionsCollapsed: !1
|
|
129
|
-
}, p = (e) => (
|
|
130
|
-
if (!e) return;
|
|
129
|
+
}, p = (e) => (h(e), e?.customApiUrl && (e.customApiUrl = decodeURIComponent(e.customApiUrl)), e.shareUrl && (e.deeplink = e.shareUrl.replace(_, v)), e), m = (e) => e.trim() !== "" && Number.isFinite(Number(e.trim())), h = (e) => {
|
|
130
|
+
if (!e || typeof e != "object") return;
|
|
131
131
|
let t = Object.keys(e);
|
|
132
132
|
for (let n of t) {
|
|
133
133
|
let t = e[n];
|
|
134
|
-
if (!Array.isArray(t) && typeof t == "object" && t &&
|
|
135
|
-
|
|
134
|
+
if (!Array.isArray(t) && typeof t == "object" && t && h(t), Array.isArray(t)) for (let e of t) h(e);
|
|
135
|
+
t === "true" || t === "false" ? e[n] = t === "true" : typeof t == "string" && m(t) && (e[n] = Number(t));
|
|
136
136
|
}
|
|
137
|
-
},
|
|
137
|
+
}, g = () => {
|
|
138
138
|
let e = d(f);
|
|
139
139
|
e.locale ||= t(null, !0), e.id === "(idle)" && delete e.id;
|
|
140
140
|
let n = o();
|
|
141
141
|
return n && s(n) && (e.configuratorId = "demoConfigurator"), e.customApiUrl = "https://rubens.alpha.roomle.com/api/v2", e.emails = !1, e;
|
|
142
|
-
},
|
|
142
|
+
}, _ = "<CONF_ID>", v = "#CONFIGURATIONID#", y = (e) => {
|
|
143
143
|
let t = e.featureFlags;
|
|
144
144
|
if (!t || typeof t != "object" || Array.isArray(t)) return;
|
|
145
145
|
let n = t;
|
|
146
146
|
"enableTwoLevelCatalog" in n && typeof n.enableTwoLevelCatalog == "boolean" && (e.enableTwoLevelCatalog === !1 || e.enableTwoLevelCatalog === void 0) && (e.enableTwoLevelCatalog = n.enableTwoLevelCatalog);
|
|
147
|
-
},
|
|
147
|
+
}, b = (e) => {
|
|
148
148
|
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);
|
|
149
|
-
},
|
|
150
|
-
let n = d(t), r =
|
|
151
|
-
|
|
149
|
+
}, x = (e, t) => {
|
|
150
|
+
let n = d(t), r = g();
|
|
151
|
+
b(r);
|
|
152
152
|
let i = c(c(r, e.settings || {}), n);
|
|
153
|
-
return i.configuratorId = e.id, !i.overrideTenant && e.tenant && (i.overrideTenant = e.tenant),
|
|
154
|
-
},
|
|
153
|
+
return i.configuratorId = e.id, !i.overrideTenant && e.tenant && (i.overrideTenant = e.tenant), y(i), i;
|
|
154
|
+
}, S = () => /(android)/i.test(navigator.userAgent), C = class {
|
|
155
155
|
_messageHandler = null;
|
|
156
156
|
isSetupDone = !1;
|
|
157
157
|
viewName = "main";
|
|
@@ -215,7 +215,7 @@ var r = class {
|
|
|
215
215
|
}
|
|
216
216
|
}));
|
|
217
217
|
}
|
|
218
|
-
},
|
|
218
|
+
}, w = () => {
|
|
219
219
|
let e, t;
|
|
220
220
|
return {
|
|
221
221
|
promise: new Promise((n, r) => {
|
|
@@ -224,7 +224,7 @@ var r = class {
|
|
|
224
224
|
resolve: e,
|
|
225
225
|
reject: t
|
|
226
226
|
};
|
|
227
|
-
},
|
|
227
|
+
}, T = {
|
|
228
228
|
SDK: "extended",
|
|
229
229
|
CONFIGURATOR_SDK: "configurator",
|
|
230
230
|
CALLBACKS: "callbacks",
|
|
@@ -232,20 +232,20 @@ var r = class {
|
|
|
232
232
|
ANALYTICS: "analytics",
|
|
233
233
|
GLOBAL: "global",
|
|
234
234
|
RAPI: "rapi"
|
|
235
|
-
},
|
|
235
|
+
}, E = ".", D = T.SDK + "." + T.CALLBACKS, O = {
|
|
236
236
|
REQUEST_BOOT: "requestBoot",
|
|
237
237
|
SETUP: "setup",
|
|
238
238
|
WEBSITE_READY: "websiteReady"
|
|
239
|
-
},
|
|
239
|
+
}, k = {
|
|
240
240
|
GET_METHODS: "getMethods",
|
|
241
241
|
RETURN_METHODS: "returnMethods",
|
|
242
242
|
REGISTER_CUSTOM_VIEW: "registerCustomView",
|
|
243
243
|
REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
|
|
244
|
-
},
|
|
244
|
+
}, A = ["constructor", "callbacks"], j = (e) => e[0] !== "_" && !A.includes(e), M = (e, t, n = !1) => {
|
|
245
245
|
if (!e) return [];
|
|
246
|
-
let r = Object.getOwnPropertyNames(e), i = n ?
|
|
247
|
-
return r.filter(
|
|
248
|
-
},
|
|
246
|
+
let r = Object.getOwnPropertyNames(e), i = n ? T.CALLBACKS + "." : "";
|
|
247
|
+
return r.filter(j).map((e) => t + "." + i + e);
|
|
248
|
+
}, N = async (e, t) => {
|
|
249
249
|
if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
|
|
250
250
|
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = n + "/configurators/" + e, a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
|
|
251
251
|
method: "GET",
|
|
@@ -262,7 +262,7 @@ var r = class {
|
|
|
262
262
|
cache: "default"
|
|
263
263
|
}), { configurator: s } = await (await fetch(o)).json();
|
|
264
264
|
return s;
|
|
265
|
-
},
|
|
265
|
+
}, P = "data-rml-interaction-container", F = (e, t, n) => {
|
|
266
266
|
let r = null;
|
|
267
267
|
Object.defineProperty(e, t, {
|
|
268
268
|
get() {
|
|
@@ -272,28 +272,28 @@ var r = class {
|
|
|
272
272
|
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
273
|
}
|
|
274
274
|
});
|
|
275
|
-
},
|
|
276
|
-
e && setTimeout(() => e.style.setProperty(
|
|
277
|
-
},
|
|
275
|
+
}, I = () => window.innerHeight * .01 + "px", L = (e) => {
|
|
276
|
+
e && setTimeout(() => e.style.setProperty(B, I()), 0);
|
|
277
|
+
}, R = "rml-styles", z = 450, B = "--rml-full-height", V = {
|
|
278
278
|
CONTAINER: "rml-container",
|
|
279
279
|
FILL: "rml-fill",
|
|
280
280
|
POSITION: "rml-pos",
|
|
281
281
|
TRANSITION: "rml-transition",
|
|
282
282
|
ANDROID_HEIGHT: "rml-android-height",
|
|
283
283
|
OVERFLOW_HIDDEN: "rml-overflow-hidden"
|
|
284
|
-
},
|
|
284
|
+
}, H = /* @__PURE__ */ new Map(), U = class extends C {
|
|
285
285
|
static createPlanner(e, t, n, r = []) {
|
|
286
286
|
return this._create(e, t, n, r);
|
|
287
287
|
}
|
|
288
288
|
static async connect(e, t = []) {
|
|
289
|
-
let n = new
|
|
289
|
+
let n = new C();
|
|
290
290
|
n.viewName = e;
|
|
291
|
-
let { resolve: i, promise: a } =
|
|
291
|
+
let { resolve: i, promise: a } = w(), { resolve: o, promise: s } = w(), c = new r("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
|
|
292
292
|
switch (e) {
|
|
293
|
-
case
|
|
293
|
+
case k.REGISTER_CUSTOM_VIEW_DONE:
|
|
294
294
|
i();
|
|
295
295
|
break;
|
|
296
|
-
case
|
|
296
|
+
case k.RETURN_METHODS:
|
|
297
297
|
n.handleSetup(t[0]), o();
|
|
298
298
|
break;
|
|
299
299
|
default: if (n.isSetupDone) return n.executeMessage({
|
|
@@ -304,7 +304,7 @@ var r = class {
|
|
|
304
304
|
});
|
|
305
305
|
n.setMessageHandler(c);
|
|
306
306
|
let l = [e];
|
|
307
|
-
return c.sendMessage(
|
|
307
|
+
return c.sendMessage(k.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(k.GET_METHODS, l), await s, n.setupPlugins(t, document.body, "custom-view"), await Promise.allSettled(n.pluginsLoaded), n;
|
|
308
308
|
}
|
|
309
309
|
static createConfigurator(e, t, n, r = []) {
|
|
310
310
|
return this._create(e, t, n, r);
|
|
@@ -327,10 +327,10 @@ var r = class {
|
|
|
327
327
|
static async _create(e, t, n, r) {
|
|
328
328
|
return new Promise(async (i, a) => {
|
|
329
329
|
try {
|
|
330
|
-
let a = p(n), o =
|
|
331
|
-
|
|
332
|
-
let s = await
|
|
333
|
-
n =
|
|
330
|
+
let a = p(n), o = g();
|
|
331
|
+
b(o);
|
|
332
|
+
let s = await N(e, c(o, a));
|
|
333
|
+
n = x(s, a);
|
|
334
334
|
let l = new this(s, t, n, r, i);
|
|
335
335
|
return await Promise.allSettled(l.pluginsLoaded), l;
|
|
336
336
|
} catch (e) {
|
|
@@ -345,51 +345,51 @@ var r = class {
|
|
|
345
345
|
_iframe;
|
|
346
346
|
constructor(e, t, n, i, a) {
|
|
347
347
|
if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
|
|
348
|
-
if (
|
|
349
|
-
if (!document.getElementById(
|
|
348
|
+
if (H.has(t)) throw Error("There is already an instance on this DOM element");
|
|
349
|
+
if (!document.getElementById(R)) {
|
|
350
350
|
let e = n.zIndex || 9999999, t = document.createElement("style");
|
|
351
|
-
t.type = "text/css", t.id =
|
|
352
|
-
let r = "transition:all ease-in-out " +
|
|
351
|
+
t.type = "text/css", t.id = R;
|
|
352
|
+
let r = "transition:all ease-in-out " + z + "ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e += t + r, "") + r, a = I();
|
|
353
353
|
t.innerHTML = `
|
|
354
|
-
.${
|
|
355
|
-
.${
|
|
356
|
-
.${
|
|
357
|
-
.${
|
|
358
|
-
.${
|
|
359
|
-
.${
|
|
354
|
+
.${V.CONTAINER}{${B}:${a};}
|
|
355
|
+
.${V.POSITION}{position:fixed;top:0;left:0;z-index:${e};opacity:0}
|
|
356
|
+
.${V.TRANSITION}{${i}}
|
|
357
|
+
.${V.FILL}{width:100%;height:100%;opacity:1}
|
|
358
|
+
.${V.ANDROID_HEIGHT}{height:calc(var(${B},1vh)*100)}
|
|
359
|
+
.${V.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
360
360
|
`, document.head.appendChild(t);
|
|
361
361
|
}
|
|
362
362
|
this._executeMessage = this._executeMessage.bind(this);
|
|
363
363
|
let o = new r("website", window, null, this._executeMessage);
|
|
364
|
-
this.setMessageHandler(o), this._onResize = this._onResize.bind(this),
|
|
364
|
+
this.setMessageHandler(o), this._onResize = this._onResize.bind(this), S() && window.addEventListener("resize", this._onResize), this._container = t, this._initData = n, this._configuratorSettings = e;
|
|
365
365
|
let s = this._createIframe();
|
|
366
|
-
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),
|
|
366
|
+
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(t, !0);
|
|
367
367
|
}
|
|
368
368
|
teardown() {
|
|
369
|
-
this._container &&
|
|
369
|
+
this._container && H.delete(this._container);
|
|
370
370
|
let e = this._container.querySelector("iframe");
|
|
371
371
|
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
372
372
|
}
|
|
373
373
|
_createIframe() {
|
|
374
374
|
let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
|
|
375
|
-
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(
|
|
375
|
+
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;
|
|
376
376
|
}
|
|
377
377
|
_onResize() {
|
|
378
|
-
|
|
378
|
+
L(this._iframe);
|
|
379
379
|
}
|
|
380
380
|
_onUseFullPage() {
|
|
381
|
-
this._iframe.classList.add(
|
|
381
|
+
this._iframe.classList.add(V.POSITION), document.documentElement.classList.add(V.OVERFLOW_HIDDEN), window.document.body.classList.add(V.OVERFLOW_HIDDEN), S() && (L(this._iframe), this._iframe.classList.add(V.ANDROID_HEIGHT));
|
|
382
382
|
}
|
|
383
383
|
_onBackToWebsite() {
|
|
384
|
-
this._iframe.classList.remove(
|
|
384
|
+
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);
|
|
385
385
|
}
|
|
386
386
|
_executeMessage({ message: e, args: t }, n) {
|
|
387
|
-
if (n.source && n.source === this._iframe?.contentWindow) return e ===
|
|
387
|
+
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(() => {
|
|
388
388
|
if (!this._messageHandler) {
|
|
389
389
|
console.error("MessageHandler not set");
|
|
390
390
|
return;
|
|
391
391
|
}
|
|
392
|
-
this._messageHandler.sendMessage(
|
|
392
|
+
this._messageHandler.sendMessage(O.WEBSITE_READY);
|
|
393
393
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({
|
|
394
394
|
message: e,
|
|
395
395
|
args: t
|
|
@@ -397,4 +397,4 @@ var r = class {
|
|
|
397
397
|
}
|
|
398
398
|
};
|
|
399
399
|
//#endregion
|
|
400
|
-
export {
|
|
400
|
+
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 };
|
|
@@ -104,15 +104,15 @@ var r = class {
|
|
|
104
104
|
},
|
|
105
105
|
rotationSnapDegrees: 10,
|
|
106
106
|
interactionsCollapsed: !1
|
|
107
|
-
}, u = (e) => {
|
|
108
|
-
if (!e) return;
|
|
107
|
+
}, u = (e) => e.trim() !== "" && Number.isFinite(Number(e.trim())), d = (e) => {
|
|
108
|
+
if (!e || typeof e != "object") return;
|
|
109
109
|
let t = Object.keys(e);
|
|
110
110
|
for (let n of t) {
|
|
111
111
|
let t = e[n];
|
|
112
|
-
if (Array.isArray(t) || typeof t != "object" || !t ||
|
|
113
|
-
t
|
|
112
|
+
if (Array.isArray(t) || typeof t != "object" || !t || d(t), Array.isArray(t)) for (let e of t) d(e);
|
|
113
|
+
t === "true" || t === "false" ? e[n] = t === "true" : typeof t == "string" && u(t) && (e[n] = Number(t));
|
|
114
114
|
}
|
|
115
|
-
},
|
|
115
|
+
}, f = () => {
|
|
116
116
|
let e = c(l);
|
|
117
117
|
e.locale ||= t(null, !0), e.id === "(idle)" && delete e.id;
|
|
118
118
|
let n = (() => {
|
|
@@ -134,9 +134,9 @@ var r = class {
|
|
|
134
134
|
let t = /* @__PURE__ */ new RegExp(/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/);
|
|
135
135
|
return !!(i.includes(e) || t.test(e) || e.endsWith("roomle.com") || e.endsWith("gitlab.io") || e.endsWith("gitlab.com"));
|
|
136
136
|
})(n) && (e.configuratorId = "demoConfigurator"), e.customApiUrl = "https://rubens.alpha.roomle.com/api/v2", e.emails = !1, e;
|
|
137
|
-
},
|
|
137
|
+
}, p = (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
|
+
}, m = () => /(android)/i.test(navigator.userAgent), h = class {
|
|
140
140
|
_messageHandler = null;
|
|
141
141
|
isSetupDone = !1;
|
|
142
142
|
viewName = "main";
|
|
@@ -196,7 +196,7 @@ var r = class {
|
|
|
196
196
|
}
|
|
197
197
|
}));
|
|
198
198
|
}
|
|
199
|
-
},
|
|
199
|
+
}, g = () => {
|
|
200
200
|
let e, t;
|
|
201
201
|
return {
|
|
202
202
|
promise: new Promise((n, r) => {
|
|
@@ -205,7 +205,7 @@ var r = class {
|
|
|
205
205
|
resolve: e,
|
|
206
206
|
reject: t
|
|
207
207
|
};
|
|
208
|
-
},
|
|
208
|
+
}, _ = {
|
|
209
209
|
SDK: "extended",
|
|
210
210
|
CONFIGURATOR_SDK: "configurator",
|
|
211
211
|
CALLBACKS: "callbacks",
|
|
@@ -213,20 +213,20 @@ var r = 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
231
|
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = n + "/configurators/" + e, a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
|
|
232
232
|
method: "GET",
|
|
@@ -243,7 +243,7 @@ var r = class {
|
|
|
243
243
|
cache: "default"
|
|
244
244
|
}), { configurator: s } = await (await fetch(o)).json();
|
|
245
245
|
return s;
|
|
246
|
-
},
|
|
246
|
+
}, E = "data-rml-interaction-container", D = (e, t, n) => {
|
|
247
247
|
let r = null;
|
|
248
248
|
Object.defineProperty(e, t, {
|
|
249
249
|
get: () => r || n,
|
|
@@ -251,21 +251,21 @@ var r = class {
|
|
|
251
251
|
r = e?.mute ? e.value : e;
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
|
-
},
|
|
255
|
-
e && setTimeout(() => e.style.setProperty(
|
|
256
|
-
},
|
|
254
|
+
}, O = () => .01 * window.innerHeight + "px", k = (e) => {
|
|
255
|
+
e && setTimeout(() => e.style.setProperty(j, O()), 0);
|
|
256
|
+
}, 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 h {
|
|
257
257
|
static createPlanner(e, t, n, r = []) {
|
|
258
258
|
return this._create(e, t, n, r);
|
|
259
259
|
}
|
|
260
260
|
static async connect(e, t = []) {
|
|
261
|
-
let n = new
|
|
261
|
+
let n = new h();
|
|
262
262
|
n.viewName = e;
|
|
263
|
-
let { resolve: i, promise: a } =
|
|
263
|
+
let { resolve: i, promise: a } = g(), { resolve: o, promise: s } = g(), c = new r("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
|
|
264
264
|
switch (e) {
|
|
265
|
-
case
|
|
265
|
+
case x.REGISTER_CUSTOM_VIEW_DONE:
|
|
266
266
|
i();
|
|
267
267
|
break;
|
|
268
|
-
case
|
|
268
|
+
case x.RETURN_METHODS:
|
|
269
269
|
n.handleSetup(t[0]), o();
|
|
270
270
|
break;
|
|
271
271
|
default: if (n.isSetupDone) return n.executeMessage({
|
|
@@ -276,7 +276,7 @@ var r = class {
|
|
|
276
276
|
});
|
|
277
277
|
n.setMessageHandler(c);
|
|
278
278
|
let l = [e];
|
|
279
|
-
return c.sendMessage(
|
|
279
|
+
return c.sendMessage(x.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(x.GET_METHODS, l), await s, n.setupPlugins(t, document.body, "custom-view"), await Promise.allSettled(n.pluginsLoaded), n;
|
|
280
280
|
}
|
|
281
281
|
static createConfigurator(e, t, n, r = []) {
|
|
282
282
|
return this._create(e, t, n, r);
|
|
@@ -299,12 +299,12 @@ var r = class {
|
|
|
299
299
|
static async _create(e, t, n, r) {
|
|
300
300
|
return new Promise(async (i, o) => {
|
|
301
301
|
try {
|
|
302
|
-
let o = ((e) => (
|
|
303
|
-
|
|
304
|
-
let l = await
|
|
302
|
+
let o = ((e) => (d(e), e?.customApiUrl && (e.customApiUrl = decodeURIComponent(e.customApiUrl)), e.shareUrl && (e.deeplink = e.shareUrl.replace("<CONF_ID>", "#CONFIGURATIONID#")), e))(n), s = f();
|
|
303
|
+
p(s);
|
|
304
|
+
let l = await T(e, a(s, o));
|
|
305
305
|
n = ((e, t) => {
|
|
306
|
-
let n = c(t), r =
|
|
307
|
-
|
|
306
|
+
let n = c(t), r = f();
|
|
307
|
+
p(r);
|
|
308
308
|
let i = a(a(r, e.settings || {}), n);
|
|
309
309
|
return i.configuratorId = e.id, !i.overrideTenant && e.tenant && (i.overrideTenant = e.tenant), ((e) => {
|
|
310
310
|
let t = e.featureFlags;
|
|
@@ -313,8 +313,8 @@ var r = class {
|
|
|
313
313
|
!("enableTwoLevelCatalog" in n) || typeof n.enableTwoLevelCatalog != "boolean" || !1 !== e.enableTwoLevelCatalog && e.enableTwoLevelCatalog !== void 0 || (e.enableTwoLevelCatalog = n.enableTwoLevelCatalog);
|
|
314
314
|
})(i), i;
|
|
315
315
|
})(l, o);
|
|
316
|
-
let
|
|
317
|
-
return await Promise.allSettled(
|
|
316
|
+
let u = new this(l, t, n, r, i);
|
|
317
|
+
return await Promise.allSettled(u.pluginsLoaded), u;
|
|
318
318
|
} catch (e) {
|
|
319
319
|
return o(e);
|
|
320
320
|
}
|
|
@@ -327,44 +327,44 @@ var r = class {
|
|
|
327
327
|
_iframe;
|
|
328
328
|
constructor(e, t, n, i, a) {
|
|
329
329
|
if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
|
|
330
|
-
if (
|
|
331
|
-
if (!document.getElementById(
|
|
330
|
+
if (L.has(t)) throw Error("There is already an instance on this DOM element");
|
|
331
|
+
if (!document.getElementById(A)) {
|
|
332
332
|
let e = n.zIndex || 9999999, t = document.createElement("style");
|
|
333
|
-
t.type = "text/css", t.id =
|
|
333
|
+
t.type = "text/css", t.id = A;
|
|
334
334
|
let r = "transition:all ease-in-out 450ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e + (t + r), "") + r;
|
|
335
|
-
t.innerHTML = `\n .${
|
|
335
|
+
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);
|
|
336
336
|
}
|
|
337
337
|
this._executeMessage = this._executeMessage.bind(this);
|
|
338
338
|
let o = new r("website", window, null, this._executeMessage);
|
|
339
|
-
this.setMessageHandler(o), this._onResize = this._onResize.bind(this),
|
|
339
|
+
this.setMessageHandler(o), this._onResize = this._onResize.bind(this), m() && window.addEventListener("resize", this._onResize), this._container = t, this._initData = n, this._configuratorSettings = e;
|
|
340
340
|
let s = this._createIframe();
|
|
341
|
-
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),
|
|
341
|
+
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(t, !0);
|
|
342
342
|
}
|
|
343
343
|
teardown() {
|
|
344
|
-
this._container &&
|
|
344
|
+
this._container && L.delete(this._container);
|
|
345
345
|
let e = this._container.querySelector("iframe");
|
|
346
346
|
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
347
347
|
}
|
|
348
348
|
_createIframe() {
|
|
349
349
|
let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
|
|
350
|
-
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(
|
|
350
|
+
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;
|
|
351
351
|
}
|
|
352
352
|
_onResize() {
|
|
353
|
-
|
|
353
|
+
k(this._iframe);
|
|
354
354
|
}
|
|
355
355
|
_onUseFullPage() {
|
|
356
|
-
this._iframe.classList.add(
|
|
356
|
+
this._iframe.classList.add(P), document.documentElement.classList.add(I), window.document.body.classList.add(I), m() && (k(this._iframe), this._iframe.classList.add(F));
|
|
357
357
|
}
|
|
358
358
|
_onBackToWebsite() {
|
|
359
|
-
this._iframe.classList.remove(
|
|
359
|
+
this._iframe.classList.remove(P), this._iframe.classList.remove(F), document.documentElement.classList.remove(I), window.document.body.classList.remove(I);
|
|
360
360
|
}
|
|
361
361
|
_executeMessage({ message: e, args: t }, n) {
|
|
362
|
-
if (n.source && n.source === this._iframe?.contentWindow) return e ===
|
|
363
|
-
this._messageHandler && this._messageHandler.sendMessage(
|
|
362
|
+
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(() => {
|
|
363
|
+
this._messageHandler && this._messageHandler.sendMessage(b.WEBSITE_READY);
|
|
364
364
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({
|
|
365
365
|
message: e,
|
|
366
366
|
args: t
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
369
|
};
|
|
370
|
-
export {
|
|
370
|
+
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 };
|