@roomle/embedding-lib 9.0.0-alpha.9 → 9.1.0-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/THIRD-PARTY-NOTICES.txt +764 -0
- package/{browser-BxG7yIaK.mjs → browser-D6As4Zxr.mjs} +1 -0
- package/{browser-CW9o-dtT.mjs → browser-zrjtYpL8.mjs} +1 -0
- package/coerce-CqJod_GZ.mjs +8 -0
- package/coerce-CsI42_k0.mjs +6 -0
- package/{comlink-B5lV2OWp.mjs → comlink-Cmiqa2s0.mjs} +1 -0
- package/{comlink-B2Kj_5Ge.mjs → comlink-Dc3LZUoi.mjs} +1 -0
- package/configurator.d.ts +2 -0
- package/configurator.js +29 -0
- package/configurator.min.js +27 -0
- package/dist-5jYYtT4q.mjs +8216 -0
- package/dist-B9yy8ym8.mjs +5512 -0
- package/dist-BV-32IEX.mjs +8128 -0
- package/dist-Bb2L1Zel.mjs +6045 -0
- package/dist-Bo3WzRdf.mjs +6223 -0
- package/dist-Bt1FopV4.mjs +7594 -0
- package/dist-C5fKJXpB.mjs +5598 -0
- package/dist-COgAdYY1.mjs +7554 -0
- package/dist-CXemOs84.mjs +849 -0
- package/dist-CqP0aX0A.mjs +866 -0
- package/dist-CqpDM10w.mjs +1179 -0
- package/dist-D0kh4WfT.mjs +7721 -0
- package/dist-D5HdKuwj.mjs +1221 -0
- package/dist-DJtonrDM.mjs +16906 -0
- package/dist-GTk8ppiK.mjs +8380 -0
- package/dist-XEy6Tk_Y.mjs +17341 -0
- package/docs/md/web/embedding/CHANGELOG.md +285 -4
- package/{drag-ghost-CDFtC1pd.mjs → drag-ghost-D7FnWbO4.mjs} +2 -1
- package/{drag-ghost-BxqPJdhq.mjs → drag-ghost-yXe7c8jA.mjs} +2 -1
- package/{drag-in-ClPpCYyi.mjs → drag-in-BiEe2Lgv.mjs} +15 -20
- package/{drag-in-CV1E-DO6.mjs → drag-in-t7T6Pqwc.mjs} +10 -15
- package/embedding-plugins.js +2 -1
- package/embedding-plugins.min.js +2 -1
- package/experimental-evaluation-BgWFolud.mjs +1074 -0
- package/experimental-evaluation-D56MbtjO.mjs +970 -0
- package/{from-custom-view-Sx6P6iDI.mjs → from-custom-view-CTBapIc6.mjs} +31 -30
- package/{from-custom-view-Q9A-J7qV.mjs → from-custom-view-xbjgsLll.mjs} +32 -31
- package/{from-website-DZJy_l42.mjs → from-website-DUPMQPl6.mjs} +24 -23
- package/{from-website-BmCO2xli.mjs → from-website-JwG7Ic_U.mjs} +24 -23
- package/hi.js +249 -150
- package/hi.min.js +211 -134
- package/mcp-tools-CJ7j_FI2.mjs +151 -0
- package/mcp-tools-D__M74CZ.mjs +153 -0
- package/package.json +12 -1
- package/packages/embedding-lib/src/configurator-agent/configurator-mcp-tools.d.ts +4 -0
- package/packages/embedding-lib/src/configurator-agent/configurator-planning-assistant.d.ts +13 -0
- package/packages/embedding-lib/src/configurator.d.ts +3 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-mcp-tools.d.ts +4 -61
- package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +9 -32
- package/packages/embedding-lib/src/homag-intelligence/hi-planning-usage.d.ts +54 -0
- package/packages/embedding-lib/src/planning-assistant/chat-model.d.ts +1 -0
- package/packages/embedding-lib/src/planning-assistant/mcp-tools.d.ts +2 -0
- package/packages/web-sdk/packages/assistant.d.ts +3 -0
- package/packages/web-sdk/packages/common-core/src/agent-tools/mcp-tool-types.d.ts +30 -0
- package/packages/web-sdk/packages/common-core/src/planning-assistant/chat-model.d.ts +8 -0
- package/packages/web-sdk/packages/common-core/src/planning-assistant/mcp-tools.d.ts +52 -0
- package/packages/web-sdk/packages/common-core/src/planning-assistant/types.d.ts +35 -0
- package/roomle-embedding-lib.js +43 -45
- package/roomle-embedding-lib.min.js +39 -41
- package/sbom.cdx.json +405 -0
- package/{utils-wJ80awOA.mjs → utils-CAAGdgk8.mjs} +1 -0
- package/{utils-DxJ3PcKe.mjs → utils-WeolMfC5.mjs} +1 -0
package/roomle-embedding-lib.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
|
|
2
|
+
import { t as e } from "./browser-zrjtYpL8.mjs";
|
|
2
3
|
//#region packages/common/src/utils/message-handler.ts
|
|
3
4
|
var t = class {
|
|
4
5
|
_side;
|
|
@@ -203,7 +204,7 @@ var t = class {
|
|
|
203
204
|
setupPlugins(e, t, n = "website") {
|
|
204
205
|
for (let r of e) typeof r == "string" && r === "dragIn" ? this.pluginsLoaded.push(new Promise((e, r) => {
|
|
205
206
|
try {
|
|
206
|
-
import("./drag-in-
|
|
207
|
+
import("./drag-in-BiEe2Lgv.mjs").then((e) => e.n).then(({ DragIn: i }) => {
|
|
207
208
|
let a = new i(this.ui, t, n, this.viewName);
|
|
208
209
|
a.init().then(() => {
|
|
209
210
|
this.plugins.dragIn = a, e();
|
|
@@ -234,14 +235,11 @@ var t = class {
|
|
|
234
235
|
resolve: e,
|
|
235
236
|
reject: t
|
|
236
237
|
};
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
let n = E(t) ? "v3" : "v2";
|
|
243
|
-
return e.replace(T, "/" + n) + t;
|
|
244
|
-
}, O = {
|
|
238
|
+
};
|
|
239
|
+
//#endregion
|
|
240
|
+
//#region packages/common/src/utils/rapi-version.ts
|
|
241
|
+
(/* @__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, "[^/]+") + "/?$"));
|
|
242
|
+
var w = /\/v[23]\/?$/, T = (e, t) => w.test(e) ? e.replace(w, "/v2") + t : e + t, E = {
|
|
245
243
|
SDK: "extended",
|
|
246
244
|
CONFIGURATOR_SDK: "configurator",
|
|
247
245
|
CALLBACKS: "callbacks",
|
|
@@ -249,22 +247,22 @@ var t = class {
|
|
|
249
247
|
ANALYTICS: "analytics",
|
|
250
248
|
GLOBAL: "global",
|
|
251
249
|
RAPI: "rapi"
|
|
252
|
-
},
|
|
250
|
+
}, D = ".", O = E.SDK + "." + E.CALLBACKS, k = {
|
|
253
251
|
REQUEST_BOOT: "requestBoot",
|
|
254
252
|
SETUP: "setup",
|
|
255
253
|
WEBSITE_READY: "websiteReady"
|
|
256
|
-
},
|
|
254
|
+
}, A = {
|
|
257
255
|
GET_METHODS: "getMethods",
|
|
258
256
|
RETURN_METHODS: "returnMethods",
|
|
259
257
|
REGISTER_CUSTOM_VIEW: "registerCustomView",
|
|
260
258
|
REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
|
|
261
|
-
},
|
|
259
|
+
}, j = ["constructor", "callbacks"], M = (e) => e[0] !== "_" && !j.includes(e), N = (e, t, n = !1) => {
|
|
262
260
|
if (!e) return [];
|
|
263
|
-
let r = Object.getOwnPropertyNames(e), i = n ?
|
|
264
|
-
return r.filter(
|
|
265
|
-
},
|
|
261
|
+
let r = Object.getOwnPropertyNames(e), i = n ? E.CALLBACKS + "." : "";
|
|
262
|
+
return r.filter(M).map((e) => t + "." + i + e);
|
|
263
|
+
}, P = async (e, t) => {
|
|
266
264
|
if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
|
|
267
|
-
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i =
|
|
265
|
+
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = T(n, "/configurators/" + e), a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
|
|
268
266
|
method: "GET",
|
|
269
267
|
headers: new Headers({
|
|
270
268
|
apiKey: "roomle_portal_v2",
|
|
@@ -279,7 +277,7 @@ var t = class {
|
|
|
279
277
|
cache: "default"
|
|
280
278
|
}), { configurator: s } = await (await fetch(o)).json();
|
|
281
279
|
return s;
|
|
282
|
-
},
|
|
280
|
+
}, F = "data-rml-interaction-container", I = (e, t, n) => {
|
|
283
281
|
let r = null;
|
|
284
282
|
Object.defineProperty(e, t, {
|
|
285
283
|
get() {
|
|
@@ -289,16 +287,16 @@ var t = class {
|
|
|
289
287
|
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);
|
|
290
288
|
}
|
|
291
289
|
});
|
|
292
|
-
},
|
|
293
|
-
e && setTimeout(() => e.style.setProperty(
|
|
294
|
-
},
|
|
290
|
+
}, L = () => window.innerHeight * .01 + "px", R = (e) => {
|
|
291
|
+
e && setTimeout(() => e.style.setProperty(V, L()), 0);
|
|
292
|
+
}, z = "rml-styles", B = 450, V = "--rml-full-height", H = {
|
|
295
293
|
CONTAINER: "rml-container",
|
|
296
294
|
FILL: "rml-fill",
|
|
297
295
|
POSITION: "rml-pos",
|
|
298
296
|
TRANSITION: "rml-transition",
|
|
299
297
|
ANDROID_HEIGHT: "rml-android-height",
|
|
300
298
|
OVERFLOW_HIDDEN: "rml-overflow-hidden"
|
|
301
|
-
},
|
|
299
|
+
}, U = /* @__PURE__ */ new Map(), W = class extends S {
|
|
302
300
|
static createPlanner(e, t, n, r = []) {
|
|
303
301
|
return this._create(e, t, n, r);
|
|
304
302
|
}
|
|
@@ -307,10 +305,10 @@ var t = class {
|
|
|
307
305
|
r.viewName = e;
|
|
308
306
|
let { resolve: i, promise: a } = C(), { resolve: o, promise: s } = C(), c = new t("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
|
|
309
307
|
switch (e) {
|
|
310
|
-
case
|
|
308
|
+
case A.REGISTER_CUSTOM_VIEW_DONE:
|
|
311
309
|
i();
|
|
312
310
|
break;
|
|
313
|
-
case
|
|
311
|
+
case A.RETURN_METHODS:
|
|
314
312
|
r.handleSetup(t[0]), o();
|
|
315
313
|
break;
|
|
316
314
|
default: if (r.isSetupDone) return r.executeMessage({
|
|
@@ -321,7 +319,7 @@ var t = class {
|
|
|
321
319
|
});
|
|
322
320
|
r.setMessageHandler(c);
|
|
323
321
|
let l = [e];
|
|
324
|
-
return c.sendMessage(
|
|
322
|
+
return c.sendMessage(A.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(A.GET_METHODS, l), await s, r.setupPlugins(n, document.body, "custom-view"), await Promise.allSettled(r.pluginsLoaded), r;
|
|
325
323
|
}
|
|
326
324
|
static createConfigurator(e, t, n, r = []) {
|
|
327
325
|
return this._create(e, t, n, r);
|
|
@@ -337,7 +335,7 @@ var t = class {
|
|
|
337
335
|
try {
|
|
338
336
|
let a = f(n), s = h();
|
|
339
337
|
y(s);
|
|
340
|
-
let c = await
|
|
338
|
+
let c = await P(e, o(s, a));
|
|
341
339
|
n = b(c, a);
|
|
342
340
|
let l = new this(c, t, n, r, i);
|
|
343
341
|
return await Promise.allSettled(l.pluginsLoaded), l;
|
|
@@ -353,51 +351,51 @@ var t = class {
|
|
|
353
351
|
_iframe;
|
|
354
352
|
constructor(e, n, r, i, a) {
|
|
355
353
|
if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
|
|
356
|
-
if (
|
|
357
|
-
if (!document.getElementById(
|
|
354
|
+
if (U.has(n)) throw Error("There is already an instance on this DOM element");
|
|
355
|
+
if (!document.getElementById(z)) {
|
|
358
356
|
let e = r.zIndex || 9999999, t = document.createElement("style");
|
|
359
|
-
t.type = "text/css", t.id =
|
|
360
|
-
let n = "transition:all ease-in-out " +
|
|
357
|
+
t.type = "text/css", t.id = z;
|
|
358
|
+
let n = "transition:all ease-in-out " + B + "ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e += t + n, "") + n, a = L();
|
|
361
359
|
t.innerHTML = `
|
|
362
|
-
.${
|
|
363
|
-
.${
|
|
364
|
-
.${
|
|
365
|
-
.${
|
|
366
|
-
.${
|
|
367
|
-
.${
|
|
360
|
+
.${H.CONTAINER}{${V}:${a};}
|
|
361
|
+
.${H.POSITION}{position:fixed;top:0;left:0;z-index:${e};opacity:0}
|
|
362
|
+
.${H.TRANSITION}{${i}}
|
|
363
|
+
.${H.FILL}{width:100%;height:100%;opacity:1}
|
|
364
|
+
.${H.ANDROID_HEIGHT}{height:calc(var(${V},1vh)*100)}
|
|
365
|
+
.${H.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
368
366
|
`, document.head.appendChild(t);
|
|
369
367
|
}
|
|
370
368
|
this._executeMessage = this._executeMessage.bind(this);
|
|
371
369
|
let o = new t("website", window, null, this._executeMessage);
|
|
372
370
|
this.setMessageHandler(o), this._onResize = this._onResize.bind(this), x() && window.addEventListener("resize", this._onResize), this._container = n, this._initData = r, this._configuratorSettings = e;
|
|
373
371
|
let s = this._createIframe();
|
|
374
|
-
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),
|
|
372
|
+
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), U.set(n, !0);
|
|
375
373
|
}
|
|
376
374
|
teardown() {
|
|
377
|
-
this._container &&
|
|
375
|
+
this._container && U.delete(this._container);
|
|
378
376
|
let e = this._container.querySelector("iframe");
|
|
379
377
|
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
380
378
|
}
|
|
381
379
|
_createIframe() {
|
|
382
380
|
let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
|
|
383
|
-
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.allow = "microphone", e.classList.add(
|
|
381
|
+
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.allow = "microphone", e.classList.add(H.CONTAINER), e.classList.add(H.FILL), e;
|
|
384
382
|
}
|
|
385
383
|
_onResize() {
|
|
386
|
-
|
|
384
|
+
R(this._iframe);
|
|
387
385
|
}
|
|
388
386
|
_onUseFullPage() {
|
|
389
|
-
this._iframe.classList.add(
|
|
387
|
+
this._iframe.classList.add(H.POSITION), document.documentElement.classList.add(H.OVERFLOW_HIDDEN), window.document.body.classList.add(H.OVERFLOW_HIDDEN), x() && (R(this._iframe), this._iframe.classList.add(H.ANDROID_HEIGHT));
|
|
390
388
|
}
|
|
391
389
|
_onBackToWebsite() {
|
|
392
|
-
this._iframe.classList.remove(
|
|
390
|
+
this._iframe.classList.remove(H.POSITION), this._iframe.classList.remove(H.ANDROID_HEIGHT), document.documentElement.classList.remove(H.OVERFLOW_HIDDEN), window.document.body.classList.remove(H.OVERFLOW_HIDDEN);
|
|
393
391
|
}
|
|
394
392
|
_executeMessage({ message: e, args: t }, n) {
|
|
395
|
-
if (n.source && n.source === this._iframe?.contentWindow) return e ===
|
|
393
|
+
if (n.source && n.source === this._iframe?.contentWindow) return e === k.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 === k.SETUP ? (this.handleSetup(t[0]), I(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), I(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
|
|
396
394
|
if (!this._messageHandler) {
|
|
397
395
|
console.error("MessageHandler not set");
|
|
398
396
|
return;
|
|
399
397
|
}
|
|
400
|
-
this._messageHandler.sendMessage(
|
|
398
|
+
this._messageHandler.sendMessage(k.WEBSITE_READY);
|
|
401
399
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({
|
|
402
400
|
message: e,
|
|
403
401
|
args: t
|
|
@@ -405,4 +403,4 @@ var t = class {
|
|
|
405
403
|
}
|
|
406
404
|
};
|
|
407
405
|
//#endregion
|
|
408
|
-
export {
|
|
406
|
+
export { k as HANDSHAKE_MESSAGES, F as INTERACTION_CONTAINER_SELECTOR, E as NAMESPACE, D as NAMESPACE_SEPARATOR, O as SDK_CALLBACK, A as WELL_KNOWN_MESSAGES, W as default, P as getConfiguratorSettings, N as getMethodNames, M as isExposable };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Third-party licenses: THIRD-PARTY-NOTICES.txt and sbom.cdx.json in the root of this package */
|
|
2
|
+
import { t as e } from "./browser-D6As4Zxr.mjs";
|
|
2
3
|
var t = class {
|
|
3
4
|
_side;
|
|
4
5
|
_incomingMessageBus = null;
|
|
@@ -184,7 +185,7 @@ var t = class {
|
|
|
184
185
|
setupPlugins(e, t, n = "website") {
|
|
185
186
|
for (let r of e) typeof r == "string" && r === "dragIn" ? this.pluginsLoaded.push(new Promise((e, r) => {
|
|
186
187
|
try {
|
|
187
|
-
import("./drag-in-
|
|
188
|
+
import("./drag-in-t7T6Pqwc.mjs").then((e) => e.n).then(({ DragIn: i }) => {
|
|
188
189
|
let a = new i(this.ui, t, n, this.viewName);
|
|
189
190
|
a.init().then(() => {
|
|
190
191
|
this.plugins.dragIn = a, e();
|
|
@@ -215,7 +216,9 @@ var t = class {
|
|
|
215
216
|
resolve: e,
|
|
216
217
|
reject: t
|
|
217
218
|
};
|
|
218
|
-
}
|
|
219
|
+
};
|
|
220
|
+
(/* @__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, "[^/]+") + "/?$"));
|
|
221
|
+
var h = /\/v[23]\/?$/, g = {
|
|
219
222
|
SDK: "extended",
|
|
220
223
|
CONFIGURATOR_SDK: "configurator",
|
|
221
224
|
CALLBACKS: "callbacks",
|
|
@@ -223,29 +226,24 @@ var t = class {
|
|
|
223
226
|
ANALYTICS: "analytics",
|
|
224
227
|
GLOBAL: "global",
|
|
225
228
|
RAPI: "rapi"
|
|
226
|
-
},
|
|
229
|
+
}, _ = ".", v = g.SDK + "." + g.CALLBACKS, y = {
|
|
227
230
|
REQUEST_BOOT: "requestBoot",
|
|
228
231
|
SETUP: "setup",
|
|
229
232
|
WEBSITE_READY: "websiteReady"
|
|
230
|
-
},
|
|
233
|
+
}, b = {
|
|
231
234
|
GET_METHODS: "getMethods",
|
|
232
235
|
RETURN_METHODS: "returnMethods",
|
|
233
236
|
REGISTER_CUSTOM_VIEW: "registerCustomView",
|
|
234
237
|
REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
|
|
235
|
-
},
|
|
238
|
+
}, x = ["constructor", "callbacks"], S = (e) => e[0] !== "_" && !x.includes(e), C = (e, t, n = !1) => {
|
|
236
239
|
if (!e) return [];
|
|
237
|
-
let r = Object.getOwnPropertyNames(e), i = n ?
|
|
238
|
-
return r.filter(
|
|
239
|
-
},
|
|
240
|
+
let r = Object.getOwnPropertyNames(e), i = n ? g.CALLBACKS + "." : "";
|
|
241
|
+
return r.filter(S).map((e) => t + "." + i + e);
|
|
242
|
+
}, w = async (e, t) => {
|
|
240
243
|
if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
|
|
241
|
-
let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = (
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
let t = e.split("?")[0];
|
|
245
|
-
return h.some((e) => e.test(t));
|
|
246
|
-
})(t) ? "v3" : "v2";
|
|
247
|
-
return e.replace(g, "/" + n) + t;
|
|
248
|
-
})(n, "/configurators/" + e), a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
|
|
244
|
+
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);
|
|
245
|
+
var a, o;
|
|
246
|
+
let s = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), c = new Request(i, {
|
|
249
247
|
method: "GET",
|
|
250
248
|
headers: new Headers({
|
|
251
249
|
apiKey: "roomle_portal_v2",
|
|
@@ -253,14 +251,14 @@ var t = class {
|
|
|
253
251
|
locale: "en",
|
|
254
252
|
language: "en",
|
|
255
253
|
device: 1,
|
|
256
|
-
token:
|
|
254
|
+
token: s,
|
|
257
255
|
platform: "web"
|
|
258
256
|
}),
|
|
259
257
|
mode: "cors",
|
|
260
258
|
cache: "default"
|
|
261
|
-
}), { configurator:
|
|
262
|
-
return
|
|
263
|
-
},
|
|
259
|
+
}), { configurator: l } = await (await fetch(c)).json();
|
|
260
|
+
return l;
|
|
261
|
+
}, T = "data-rml-interaction-container", E = (e, t, n) => {
|
|
264
262
|
let r = null;
|
|
265
263
|
Object.defineProperty(e, t, {
|
|
266
264
|
get: () => r || n,
|
|
@@ -268,9 +266,9 @@ var t = class {
|
|
|
268
266
|
r = e?.mute ? e.value : e;
|
|
269
267
|
}
|
|
270
268
|
});
|
|
271
|
-
},
|
|
272
|
-
e && setTimeout(() => e.style.setProperty(
|
|
273
|
-
},
|
|
269
|
+
}, D = () => .01 * window.innerHeight + "px", O = (e) => {
|
|
270
|
+
e && setTimeout(() => e.style.setProperty(A, D()), 0);
|
|
271
|
+
}, 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 {
|
|
274
272
|
static createPlanner(e, t, n, r = []) {
|
|
275
273
|
return this._create(e, t, n, r);
|
|
276
274
|
}
|
|
@@ -279,10 +277,10 @@ var t = class {
|
|
|
279
277
|
r.viewName = e;
|
|
280
278
|
let { resolve: i, promise: a } = m(), { resolve: o, promise: s } = m(), c = new t("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
|
|
281
279
|
switch (e) {
|
|
282
|
-
case
|
|
280
|
+
case b.REGISTER_CUSTOM_VIEW_DONE:
|
|
283
281
|
i();
|
|
284
282
|
break;
|
|
285
|
-
case
|
|
283
|
+
case b.RETURN_METHODS:
|
|
286
284
|
r.handleSetup(t[0]), o();
|
|
287
285
|
break;
|
|
288
286
|
default: if (r.isSetupDone) return r.executeMessage({
|
|
@@ -293,7 +291,7 @@ var t = class {
|
|
|
293
291
|
});
|
|
294
292
|
r.setMessageHandler(c);
|
|
295
293
|
let l = [e];
|
|
296
|
-
return c.sendMessage(
|
|
294
|
+
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;
|
|
297
295
|
}
|
|
298
296
|
static createConfigurator(e, t, n, r = []) {
|
|
299
297
|
return this._create(e, t, n, r);
|
|
@@ -309,7 +307,7 @@ var t = class {
|
|
|
309
307
|
try {
|
|
310
308
|
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();
|
|
311
309
|
d(c);
|
|
312
|
-
let f = await
|
|
310
|
+
let f = await w(e, r(c, s));
|
|
313
311
|
n = ((e, t) => {
|
|
314
312
|
let n = o(t), i = u();
|
|
315
313
|
d(i);
|
|
@@ -335,44 +333,44 @@ var t = class {
|
|
|
335
333
|
_iframe;
|
|
336
334
|
constructor(e, n, r, i, a) {
|
|
337
335
|
if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
|
|
338
|
-
if (
|
|
339
|
-
if (!document.getElementById(
|
|
336
|
+
if (I.has(n)) throw Error("There is already an instance on this DOM element");
|
|
337
|
+
if (!document.getElementById(k)) {
|
|
340
338
|
let e = r.zIndex || 9999999, t = document.createElement("style");
|
|
341
|
-
t.type = "text/css", t.id =
|
|
339
|
+
t.type = "text/css", t.id = k;
|
|
342
340
|
let n = "transition:all ease-in-out 450ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e + (t + n), "") + n;
|
|
343
|
-
t.innerHTML = `\n .${
|
|
341
|
+
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);
|
|
344
342
|
}
|
|
345
343
|
this._executeMessage = this._executeMessage.bind(this);
|
|
346
344
|
let o = new t("website", window, null, this._executeMessage);
|
|
347
345
|
this.setMessageHandler(o), this._onResize = this._onResize.bind(this), f() && window.addEventListener("resize", this._onResize), this._container = n, this._initData = r, this._configuratorSettings = e;
|
|
348
346
|
let s = this._createIframe();
|
|
349
|
-
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),
|
|
347
|
+
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);
|
|
350
348
|
}
|
|
351
349
|
teardown() {
|
|
352
|
-
this._container &&
|
|
350
|
+
this._container && I.delete(this._container);
|
|
353
351
|
let e = this._container.querySelector("iframe");
|
|
354
352
|
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
355
353
|
}
|
|
356
354
|
_createIframe() {
|
|
357
355
|
let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
|
|
358
|
-
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.allow = "microphone", e.classList.add(
|
|
356
|
+
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.allow = "microphone", e.classList.add(j), e.classList.add(M), e;
|
|
359
357
|
}
|
|
360
358
|
_onResize() {
|
|
361
|
-
|
|
359
|
+
O(this._iframe);
|
|
362
360
|
}
|
|
363
361
|
_onUseFullPage() {
|
|
364
|
-
this._iframe.classList.add(
|
|
362
|
+
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));
|
|
365
363
|
}
|
|
366
364
|
_onBackToWebsite() {
|
|
367
|
-
this._iframe.classList.remove(
|
|
365
|
+
this._iframe.classList.remove(N), this._iframe.classList.remove(P), document.documentElement.classList.remove(F), window.document.body.classList.remove(F);
|
|
368
366
|
}
|
|
369
367
|
_executeMessage({ message: e, args: t }, n) {
|
|
370
|
-
if (n.source && n.source === this._iframe?.contentWindow) return e ===
|
|
371
|
-
this._messageHandler && this._messageHandler.sendMessage(
|
|
368
|
+
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(() => {
|
|
369
|
+
this._messageHandler && this._messageHandler.sendMessage(y.WEBSITE_READY);
|
|
372
370
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({
|
|
373
371
|
message: e,
|
|
374
372
|
args: t
|
|
375
373
|
});
|
|
376
374
|
}
|
|
377
375
|
};
|
|
378
|
-
export {
|
|
376
|
+
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 };
|