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