@roomle/embedding-lib 6.0.0-alpha.4 → 6.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/browser-BhHw2H1M.mjs +1 -0
- package/browser-CUgD7zyH.mjs +21 -0
- package/docs/md/web/embedding/CHANGELOG.md +75 -67
- package/hi.js +51 -48
- package/hi.min.js +1 -1
- package/package.json +1 -1
- package/packages/embedding-lib/src/homag-intelligence/hi-setup.d.ts +3 -1
- package/packages/embedding-lib/src/roomle-embedding-lib.d.ts +1 -0
- package/roomle-embedding-lib.js +121 -137
- package/roomle-embedding-lib.min.js +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=["language","browserLanguage","userLanguage","systemLanguage"],e=(n,e=!0)=>!n||n.length<2?"en":e?n.substring(0,2):n,g=(g=null,a=!1)=>{const r=window.navigator;if(g)return e(g,!a);if(Array.isArray(r.languages)&&r.languages.length>0)return e(r.languages[0],!a);for(let g=0,t=n.length;g<t;g++){const t=r[n[g]];if(t)return e(t,!a)}return"en"};export{g};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const u = [
|
|
2
|
+
"language",
|
|
3
|
+
"browserLanguage",
|
|
4
|
+
"userLanguage",
|
|
5
|
+
"systemLanguage"
|
|
6
|
+
], a = (e, n = !0) => !e || e.length < 2 ? "en" : n ? e.substring(0, 2) : e, o = (e = null, n = !1) => {
|
|
7
|
+
const r = window.navigator;
|
|
8
|
+
if (e)
|
|
9
|
+
return a(e, !n);
|
|
10
|
+
if (Array.isArray(r.languages) && r.languages.length > 0)
|
|
11
|
+
return a(r.languages[0], !n);
|
|
12
|
+
for (let t = 0, s = u.length; t < s; t++) {
|
|
13
|
+
const g = r[u[t]];
|
|
14
|
+
if (g)
|
|
15
|
+
return a(g, !n);
|
|
16
|
+
}
|
|
17
|
+
return "en";
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
o as g
|
|
21
|
+
};
|
|
@@ -1,68 +1,76 @@
|
|
|
1
|
-
## 6.
|
|
1
|
+
## 6.1.0-alpha.1 (2026-01-20)
|
|
2
2
|
|
|
3
|
-
* Apply suggestion from @Copilot ([
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Merge branch 'fix/
|
|
7
|
-
* Merge branch 'master' into feat/
|
|
8
|
-
* Merge branch 'master' into feat/
|
|
9
|
-
* Merge branch 'master' into feat/
|
|
10
|
-
* Merge branch 'master' into feat/
|
|
11
|
-
* Merge branch 'master' into feat/
|
|
12
|
-
* Merge branch 'master' into
|
|
13
|
-
* Merge branch 'master' into fix/
|
|
14
|
-
* Merge branch 'master' into fix/
|
|
15
|
-
* Merge branch 'master' into fix/
|
|
16
|
-
* Merge branch 'master' into
|
|
17
|
-
* Merge branch 'master' into
|
|
18
|
-
* Merge branch 'master' into
|
|
19
|
-
* Merge branch '
|
|
20
|
-
* Merge
|
|
21
|
-
* Merge
|
|
22
|
-
* Merge
|
|
23
|
-
* Merge
|
|
24
|
-
* Merge
|
|
25
|
-
* Merge
|
|
26
|
-
* Merge
|
|
27
|
-
* Merge
|
|
28
|
-
* Merge pull request #
|
|
29
|
-
* Merge pull request #
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* fix:
|
|
40
|
-
* fix:
|
|
41
|
-
* fix:
|
|
42
|
-
* fix:
|
|
43
|
-
* fix:
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* chore:
|
|
54
|
-
* chore:
|
|
55
|
-
* chore: do
|
|
56
|
-
* chore:
|
|
57
|
-
* chore:
|
|
58
|
-
* chore: more
|
|
59
|
-
* chore:
|
|
60
|
-
* chore:
|
|
61
|
-
* chore:
|
|
62
|
-
* chore: use
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
3
|
+
* Apply suggestion from @Copilot ([109621b](https://github.com/roomle-dev/roomle-ui/commit/109621b))
|
|
4
|
+
* Merge branch 'feat/localize-hi-calls-RML-15706' of github.com:roomle-dev/roomle-ui into feat/localiz ([63ae5a5](https://github.com/roomle-dev/roomle-ui/commit/63ae5a5))
|
|
5
|
+
* Merge branch 'feat/localize-hi-calls-RML-15706' of github.com:roomle-dev/roomle-ui into feat/localiz ([bb7e95e](https://github.com/roomle-dev/roomle-ui/commit/bb7e95e))
|
|
6
|
+
* Merge branch 'fix/distance-resetting' into fix/fov-resetting ([6722b5e](https://github.com/roomle-dev/roomle-ui/commit/6722b5e))
|
|
7
|
+
* Merge branch 'master' into feat/dont-reset-camera-on-switch-2d ([a219ae5](https://github.com/roomle-dev/roomle-ui/commit/a219ae5))
|
|
8
|
+
* Merge branch 'master' into feat/dont-reset-camera-on-switch-2d ([642b03b](https://github.com/roomle-dev/roomle-ui/commit/642b03b))
|
|
9
|
+
* Merge branch 'master' into feat/localize-hi-calls-RML-15706 ([f0add09](https://github.com/roomle-dev/roomle-ui/commit/f0add09))
|
|
10
|
+
* Merge branch 'master' into feat/localize-hi-calls-RML-15706 ([72aa339](https://github.com/roomle-dev/roomle-ui/commit/72aa339))
|
|
11
|
+
* Merge branch 'master' into feat/localize-hi-calls-RML-15706 ([b8df187](https://github.com/roomle-dev/roomle-ui/commit/b8df187))
|
|
12
|
+
* Merge branch 'master' into fix/correct-examples-url-RML-15885 ([44ff171](https://github.com/roomle-dev/roomle-ui/commit/44ff171))
|
|
13
|
+
* Merge branch 'master' into fix/correct-examples-url-RML-15885 ([393b752](https://github.com/roomle-dev/roomle-ui/commit/393b752))
|
|
14
|
+
* Merge branch 'master' into fix/fov-resetting ([c01f047](https://github.com/roomle-dev/roomle-ui/commit/c01f047))
|
|
15
|
+
* Merge branch 'master' into fix/fov-resetting ([5ea8186](https://github.com/roomle-dev/roomle-ui/commit/5ea8186))
|
|
16
|
+
* Merge branch 'master' into fix/fov-resetting ([fe106b5](https://github.com/roomle-dev/roomle-ui/commit/fe106b5))
|
|
17
|
+
* Merge branch 'master' into fix/fov-resetting ([4b40370](https://github.com/roomle-dev/roomle-ui/commit/4b40370))
|
|
18
|
+
* Merge branch 'master' into fix/fov-resetting ([c9a9183](https://github.com/roomle-dev/roomle-ui/commit/c9a9183))
|
|
19
|
+
* Merge branch 'master' into fix/fov-resetting ([69f471e](https://github.com/roomle-dev/roomle-ui/commit/69f471e))
|
|
20
|
+
* Merge branch 'master' into fix/fov-resetting ([31b5b1d](https://github.com/roomle-dev/roomle-ui/commit/31b5b1d))
|
|
21
|
+
* Merge branch 'master' into fix/fov-resetting ([767629b](https://github.com/roomle-dev/roomle-ui/commit/767629b))
|
|
22
|
+
* Merge branch 'master' into fix/multiple-component-dimensionings ([4c4483d](https://github.com/roomle-dev/roomle-ui/commit/4c4483d))
|
|
23
|
+
* Merge branch 'master' into fix/multiple-component-dimensionings ([6dfb54c](https://github.com/roomle-dev/roomle-ui/commit/6dfb54c))
|
|
24
|
+
* Merge branch 'master' into fix/multiple-component-dimensionings ([5692f47](https://github.com/roomle-dev/roomle-ui/commit/5692f47))
|
|
25
|
+
* Merge branch 'master' into fix/multiple-component-dimensionings ([28ae147](https://github.com/roomle-dev/roomle-ui/commit/28ae147))
|
|
26
|
+
* Merge branch 'master' into fix/multiple-component-dimensionings ([3263e2a](https://github.com/roomle-dev/roomle-ui/commit/3263e2a))
|
|
27
|
+
* Merge branch 'master' into hi/no-show-cancel-select ([4c93896](https://github.com/roomle-dev/roomle-ui/commit/4c93896))
|
|
28
|
+
* Merge pull request #2138 from roomle-dev/fix/fov-resetting ([910e646](https://github.com/roomle-dev/roomle-ui/commit/910e646)), closes [#2138](https://github.com/roomle-dev/roomle-ui/issues/2138)
|
|
29
|
+
* Merge pull request #2153 from roomle-dev/feat/localize-hi-calls-RML-15706 ([dac874a](https://github.com/roomle-dev/roomle-ui/commit/dac874a)), closes [#2153](https://github.com/roomle-dev/roomle-ui/issues/2153)
|
|
30
|
+
* Merge pull request #2155 from roomle-dev/upgraded-by-ci/core-2.68.0-alpha.1 ([7dff6a3](https://github.com/roomle-dev/roomle-ui/commit/7dff6a3)), closes [#2155](https://github.com/roomle-dev/roomle-ui/issues/2155)
|
|
31
|
+
* Merge pull request #2156 from roomle-dev/fix/multiple-component-dimensionings ([7008095](https://github.com/roomle-dev/roomle-ui/commit/7008095)), closes [#2156](https://github.com/roomle-dev/roomle-ui/issues/2156)
|
|
32
|
+
* Merge pull request #2158 from roomle-dev/upgraded-by-ci/core-2.68.0-alpha.2 ([589bbe3](https://github.com/roomle-dev/roomle-ui/commit/589bbe3)), closes [#2158](https://github.com/roomle-dev/roomle-ui/issues/2158)
|
|
33
|
+
* Merge pull request #2159 from roomle-dev/style/catalog-layout-fixes ([6203e76](https://github.com/roomle-dev/roomle-ui/commit/6203e76)), closes [#2159](https://github.com/roomle-dev/roomle-ui/issues/2159)
|
|
34
|
+
* Merge pull request #2160 from roomle-dev/fix/dragging-windows-in-2d ([eaa0677](https://github.com/roomle-dev/roomle-ui/commit/eaa0677)), closes [#2160](https://github.com/roomle-dev/roomle-ui/issues/2160)
|
|
35
|
+
* Merge pull request #2161 from roomle-dev/feat/dont-reset-camera-on-switch-2d ([e1e19aa](https://github.com/roomle-dev/roomle-ui/commit/e1e19aa)), closes [#2161](https://github.com/roomle-dev/roomle-ui/issues/2161)
|
|
36
|
+
* Merge pull request #2162 from roomle-dev/hi/no-show-cancel-select ([ceb4050](https://github.com/roomle-dev/roomle-ui/commit/ceb4050)), closes [#2162](https://github.com/roomle-dev/roomle-ui/issues/2162)
|
|
37
|
+
* Merge pull request #2163 from roomle-dev/fix/correct-examples-url-RML-15885 ([562e762](https://github.com/roomle-dev/roomle-ui/commit/562e762)), closes [#2163](https://github.com/roomle-dev/roomle-ui/issues/2163)
|
|
38
|
+
* Merge pull request #2165 from roomle-dev/upgraded-by-ci/core-2.68.0-alpha.3 ([cff52d3](https://github.com/roomle-dev/roomle-ui/commit/cff52d3)), closes [#2165](https://github.com/roomle-dev/roomle-ui/issues/2165)
|
|
39
|
+
* fix: deep copy so that we do not modify default values ([0d3e37d](https://github.com/roomle-dev/roomle-ui/commit/0d3e37d))
|
|
40
|
+
* fix: enable hovering of multiple dimensions ([212e8a1](https://github.com/roomle-dev/roomle-ui/commit/212e8a1))
|
|
41
|
+
* fix: lint ([3553b11](https://github.com/roomle-dev/roomle-ui/commit/3553b11))
|
|
42
|
+
* fix: make sure camera offset is reset when changing view modes ([beef350](https://github.com/roomle-dev/roomle-ui/commit/beef350))
|
|
43
|
+
* fix: make sure the camera FOV resets properly when switching back to 3D ([fa20526](https://github.com/roomle-dev/roomle-ui/commit/fa20526))
|
|
44
|
+
* fix: reenable vector zeroing for dragged in items ([71814e0](https://github.com/roomle-dev/roomle-ui/commit/71814e0))
|
|
45
|
+
* fix: use correct overrides for PR previews ([56d0fb4](https://github.com/roomle-dev/roomle-ui/commit/56d0fb4))
|
|
46
|
+
* fix: use default dimensions instead of component when enabling dimensions ([a93e27c](https://github.com/roomle-dev/roomle-ui/commit/a93e27c))
|
|
47
|
+
* fix: use tooltip teleport div to avoid zindex issues ([10bf93c](https://github.com/roomle-dev/roomle-ui/commit/10bf93c))
|
|
48
|
+
* chore: add example ([3a82223](https://github.com/roomle-dev/roomle-ui/commit/3a82223))
|
|
49
|
+
* chore: add some tests ([478c6a8](https://github.com/roomle-dev/roomle-ui/commit/478c6a8))
|
|
50
|
+
* chore: apply code review changes ([8a957c9](https://github.com/roomle-dev/roomle-ui/commit/8a957c9))
|
|
51
|
+
* chore: clean up redundant usage of `overrideServerUrl: getServerUrl()` ([45627a2](https://github.com/roomle-dev/roomle-ui/commit/45627a2))
|
|
52
|
+
* chore: code review null check for serveroptions ([a76bb47](https://github.com/roomle-dev/roomle-ui/commit/a76bb47))
|
|
53
|
+
* chore: correct example ([ee1022f](https://github.com/roomle-dev/roomle-ui/commit/ee1022f))
|
|
54
|
+
* chore(refactor): create helpers so that it is easier to run Homag Intelligence Examples ([00ed819](https://github.com/roomle-dev/roomle-ui/commit/00ed819))
|
|
55
|
+
* chore: do not show deselect parameter pill when plannerIsolationConfigurator true ([764a778](https://github.com/roomle-dev/roomle-ui/commit/764a778))
|
|
56
|
+
* chore: extract drop menu into own component, detect edges ([5f77927](https://github.com/roomle-dev/roomle-ui/commit/5f77927))
|
|
57
|
+
* chore: fix typescript problems ([5e45f5c](https://github.com/roomle-dev/roomle-ui/commit/5e45f5c))
|
|
58
|
+
* chore: more refactor ([4f65d3c](https://github.com/roomle-dev/roomle-ui/commit/4f65d3c))
|
|
59
|
+
* chore: set language also if user didn't set it ([9d27ea3](https://github.com/roomle-dev/roomle-ui/commit/9d27ea3))
|
|
60
|
+
* chore: some stuff ([df674bb](https://github.com/roomle-dev/roomle-ui/commit/df674bb))
|
|
61
|
+
* chore: update snapshots ([39997ce](https://github.com/roomle-dev/roomle-ui/commit/39997ce))
|
|
62
|
+
* chore: use floating-ui for menu positioning ([7868b82](https://github.com/roomle-dev/roomle-ui/commit/7868b82))
|
|
63
|
+
* feat(planner): only reset camera on first switch to 2d ([8887bfb](https://github.com/roomle-dev/roomle-ui/commit/8887bfb))
|
|
64
|
+
* feat(core): upgrade to version 2.68.0-alpha.1 ([f1f4fca](https://github.com/roomle-dev/roomle-ui/commit/f1f4fca))
|
|
65
|
+
* feat(core): upgrade to version 2.68.0-alpha.2 ([5d442dd](https://github.com/roomle-dev/roomle-ui/commit/5d442dd))
|
|
66
|
+
* feat(core): upgrade to version 2.68.0-alpha.3 ([a2bae74](https://github.com/roomle-dev/roomle-ui/commit/a2bae74))
|
|
67
|
+
* test: adapt test ([8bc99c0](https://github.com/roomle-dev/roomle-ui/commit/8bc99c0))
|
|
68
|
+
* test: add tests for new showDimension behaviour ([f79d706](https://github.com/roomle-dev/roomle-ui/commit/f79d706))
|
|
69
|
+
* test: adjust tests to reverted changes ([281e3db](https://github.com/roomle-dev/roomle-ui/commit/281e3db))
|
|
70
|
+
* test: check that camera is only reset on first switch to 2d ([dd0c15f](https://github.com/roomle-dev/roomle-ui/commit/dd0c15f))
|
|
71
|
+
* test: fix failing tests ([e377c43](https://github.com/roomle-dev/roomle-ui/commit/e377c43))
|
|
72
|
+
* test: the idea ([16f8ccd](https://github.com/roomle-dev/roomle-ui/commit/16f8ccd))
|
|
73
|
+
* style: make dropdown max width bigger ([67641f8](https://github.com/roomle-dev/roomle-ui/commit/67641f8))
|
|
74
|
+
* style: sharpen drop shadow on cards ([d8b710a](https://github.com/roomle-dev/roomle-ui/commit/d8b710a))
|
|
75
|
+
* refactor: resetting fov on setup ([35aa45c](https://github.com/roomle-dev/roomle-ui/commit/35aa45c))
|
|
76
|
+
* wip: do not only show dimensions for latest component ([f56dc5c](https://github.com/roomle-dev/roomle-ui/commit/f56dc5c))
|
package/hi.js
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
1
1
|
import { c as b } from "./utils-D--vltCL.mjs";
|
|
2
|
-
|
|
2
|
+
import { g as L } from "./browser-CUgD7zyH.mjs";
|
|
3
|
+
const m = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=", f = async (e, o, t, s = { property: "default" }) => {
|
|
3
4
|
const n = t.serverOptions ?? {}, r = {
|
|
4
5
|
headers: {
|
|
5
|
-
"Content-Type":
|
|
6
|
+
"Content-Type": o === "json" ? "application/json" : "text/plain",
|
|
6
7
|
"Access-Control-Allow-Origin": "*"
|
|
7
8
|
}
|
|
8
9
|
};
|
|
9
10
|
n.language && (r.headers["Accept-Language"] = n.language);
|
|
10
11
|
try {
|
|
11
|
-
const a = performance.now(), { baseUrl: c, subscriptionId: p, key: d, endpointUrl: l } = n,
|
|
12
|
-
(c ??
|
|
12
|
+
const a = performance.now(), { baseUrl: c, subscriptionId: p, key: d, endpointUrl: l } = n, u = await fetch(
|
|
13
|
+
(c ?? m) + encodeURIComponent(e) + `&subscriptionId=${encodeURIComponent(p || "")}` + (d ? `&apiKey=${encodeURIComponent(d)}` : "") + (l ? `&baseUrl=${encodeURIComponent(l)}` : ""),
|
|
13
14
|
r
|
|
14
|
-
),
|
|
15
|
-
if (!
|
|
15
|
+
), I = performance.now() - a;
|
|
16
|
+
if (!u.ok)
|
|
16
17
|
throw console.warn(`Failed to fetch data from ${s.property}`), new Error(
|
|
17
|
-
`Failed to fetch data from ${
|
|
18
|
+
`Failed to fetch data from ${e}: ${u.statusText}`
|
|
18
19
|
);
|
|
19
20
|
return console.info(`Success to fetch data from ${s.property}`), console.info(
|
|
20
|
-
`The data for ${s.property} was fetched in ${
|
|
21
|
-
),
|
|
21
|
+
`The data for ${s.property} was fetched in ${I} milliseconds`
|
|
22
|
+
), u;
|
|
22
23
|
} catch (a) {
|
|
23
24
|
throw console.warn(`Failed to fetch data from ${s.property}`), console.error(a), a;
|
|
24
25
|
}
|
|
25
|
-
},
|
|
26
|
+
}, h = {
|
|
26
27
|
"e2fe8b3d-da31-4a20-92ab-ab6e3839300e": /* @__PURE__ */ new Set(["Furniture_Smith"])
|
|
27
|
-
},
|
|
28
|
-
const { libraryId: t, serverOptions: s } =
|
|
29
|
-
return s?.subscriptionId &&
|
|
30
|
-
}, w = async (
|
|
31
|
-
|
|
28
|
+
}, y = (e, o) => {
|
|
29
|
+
const { libraryId: t, serverOptions: s } = e;
|
|
30
|
+
return s?.subscriptionId && h[s.subscriptionId]?.has(t) ? `api/pos/${o}?libraryId=${t}` : `api/pos/libraries/${t}/${o}`;
|
|
31
|
+
}, w = async (e) => await (await f(
|
|
32
|
+
y(e, "articles"),
|
|
32
33
|
"json",
|
|
33
|
-
|
|
34
|
+
e,
|
|
34
35
|
{ property: "articles" }
|
|
35
|
-
)).json(),
|
|
36
|
-
|
|
36
|
+
)).json(), g = async (e) => await (await f(
|
|
37
|
+
y(e, "masterData"),
|
|
37
38
|
"json",
|
|
38
|
-
|
|
39
|
+
e,
|
|
39
40
|
{ property: "masterData" }
|
|
40
|
-
)).json(),
|
|
41
|
-
let t = await (await
|
|
42
|
-
|
|
41
|
+
)).json(), C = async (e) => {
|
|
42
|
+
let t = await (await f(
|
|
43
|
+
y(e, "calc.js"),
|
|
43
44
|
"text",
|
|
44
|
-
|
|
45
|
+
e,
|
|
45
46
|
{
|
|
46
47
|
property: "calc.js"
|
|
47
48
|
}
|
|
@@ -49,27 +50,27 @@ const u = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?u
|
|
|
49
50
|
if (!t)
|
|
50
51
|
throw new Error("Script load error");
|
|
51
52
|
return t;
|
|
52
|
-
},
|
|
53
|
-
onLoadJavascript: (
|
|
54
|
-
onLoadArticleCatalog: (
|
|
55
|
-
onLoadMasterData: (
|
|
56
|
-
}),
|
|
57
|
-
const { baseUrl: n, om: r } =
|
|
53
|
+
}, j = (e) => ({
|
|
54
|
+
onLoadJavascript: (o) => C(e),
|
|
55
|
+
onLoadArticleCatalog: (o) => w(e),
|
|
56
|
+
onLoadMasterData: (o) => g(e)
|
|
57
|
+
}), A = async (e, o, t, s = {}) => {
|
|
58
|
+
const { baseUrl: n, om: r } = e.serverOptions ?? {}, a = encodeURIComponent(r?.endpointUrl || ""), c = encodeURIComponent(r?.subscriptionId || ""), p = r?.key || "";
|
|
58
59
|
return await (await fetch(
|
|
59
|
-
(n ??
|
|
60
|
+
(n ?? m) + `${encodeURIComponent(t)}&subscriptionId=${c}&apiKey=${p}&baseUrl=${a}`,
|
|
60
61
|
{
|
|
61
62
|
method: "POST",
|
|
62
|
-
body: JSON.stringify(
|
|
63
|
+
body: JSON.stringify(o),
|
|
63
64
|
headers: {
|
|
64
65
|
"Content-Type": "application/json",
|
|
65
66
|
...s
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
)).json();
|
|
69
|
-
},
|
|
70
|
-
const { baseUrl: s, om: n } =
|
|
70
|
+
}, E = async (e, o, t = {}) => {
|
|
71
|
+
const { baseUrl: s, om: n } = e.serverOptions ?? {}, r = encodeURIComponent(n?.endpointUrl || ""), a = encodeURIComponent(n?.subscriptionId || ""), c = n?.key || "";
|
|
71
72
|
return await (await fetch(
|
|
72
|
-
(s ??
|
|
73
|
+
(s ?? m) + `${encodeURIComponent(o)}&subscriptionId=${a}&apiKey=${c}&baseUrl=${r}`,
|
|
73
74
|
{
|
|
74
75
|
method: "GET",
|
|
75
76
|
headers: {
|
|
@@ -78,34 +79,36 @@ const u = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?u
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
)).json();
|
|
82
|
+
}, U = (e, o) => {
|
|
83
|
+
e.serverOptions || (e.serverOptions = {}), !e.serverOptions.language && o?.locale && (e.serverOptions.language = o.locale), e.serverOptions.language || (e.serverOptions.language = L(null, !0));
|
|
81
84
|
};
|
|
82
85
|
let i = null;
|
|
83
|
-
const
|
|
86
|
+
const _ = async (e, o = {}) => {
|
|
84
87
|
i && window.removeEventListener("message", i);
|
|
85
|
-
const t = typeof
|
|
86
|
-
|
|
88
|
+
const t = typeof e == "string" ? { libraryId: e } : e;
|
|
89
|
+
o.onLoadJavascript === void 0 && (o.onLoadJavascript = (n) => C(t)), o.onLoadArticleCatalog === void 0 && (o.onLoadArticleCatalog = (n) => w(t)), o.onLoadMasterData === void 0 && (o.onLoadMasterData = (n) => g(t));
|
|
87
90
|
const { expose: s } = await import("./comlink-BAiXCcU9.mjs");
|
|
88
91
|
i = (n) => {
|
|
89
92
|
if (n.data.type === "connect_hi" && n.data.port) {
|
|
90
93
|
const r = n.data.port;
|
|
91
|
-
r.start?.(), s(b(
|
|
94
|
+
U(t, n.data.globalInitData || {}), r.start?.(), s(b(o), r);
|
|
92
95
|
}
|
|
93
96
|
}, window.addEventListener("message", i);
|
|
94
|
-
},
|
|
97
|
+
}, O = () => {
|
|
95
98
|
i && (window.removeEventListener("message", i), i = null);
|
|
96
|
-
},
|
|
99
|
+
}, R = {
|
|
97
100
|
HIDE: "hide",
|
|
98
101
|
SHOW_ATTRIBUTES: "attributes",
|
|
99
102
|
SHOW_ARTICLES: "articles"
|
|
100
103
|
};
|
|
101
104
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
R as HI_PANEL_ACTION,
|
|
106
|
+
O as cleanupHi,
|
|
107
|
+
j as createHiLibraryCallbacks,
|
|
105
108
|
w as libLoadArticleCatalog,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
C as libLoadCalcScript,
|
|
110
|
+
g as libLoadMasterData,
|
|
111
|
+
E as omGetRequest,
|
|
112
|
+
A as omPostRequest,
|
|
113
|
+
_ as setupHi
|
|
111
114
|
};
|
package/hi.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./utils-uEcN1DUR.mjs";const t="https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=",
|
|
1
|
+
import{c as e}from"./utils-uEcN1DUR.mjs";import{g as a}from"./browser-BhHw2H1M.mjs";const t="https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=",o=async(e,a,o,n={property:"default"})=>{const s=o.serverOptions??{},r={headers:{"Content-Type":"json"===a?"application/json":"text/plain","Access-Control-Allow-Origin":"*"}};s.language&&(r.headers["Accept-Language"]=s.language);try{performance.now();const{baseUrl:a,subscriptionId:o,key:n,endpointUrl:i}=s,c=await fetch((a??t)+encodeURIComponent(e)+`&subscriptionId=${encodeURIComponent(o||"")}`+(n?`&apiKey=${encodeURIComponent(n)}`:"")+(i?`&baseUrl=${encodeURIComponent(i)}`:""),r);if(performance.now(),!c.ok)throw new Error(`Failed to fetch data from ${e}: ${c.statusText}`);return c}catch(e){throw e}},n={"e2fe8b3d-da31-4a20-92ab-ab6e3839300e":new Set(["Furniture_Smith"])},s=(e,a)=>{const{libraryId:t,serverOptions:o}=e;return o?.subscriptionId&&n[o.subscriptionId]?.has(t)?`api/pos/${a}?libraryId=${t}`:`api/pos/libraries/${t}/${a}`},r=async e=>await(await o(s(e,"articles"),"json",e,{property:"articles"})).json(),i=async e=>await(await o(s(e,"masterData"),"json",e,{property:"masterData"})).json(),c=async e=>{let a=await(await o(s(e,"calc.js"),"text",e,{property:"calc.js"})).text();if(!a)throw new Error("Script load error");return a},p=e=>({onLoadJavascript:a=>c(e),onLoadArticleCatalog:a=>r(e),onLoadMasterData:a=>i(e)}),l=async(e,a,o,n={})=>{const{baseUrl:s,om:r}=e.serverOptions??{},i=encodeURIComponent(r?.endpointUrl||""),c=encodeURIComponent(r?.subscriptionId||""),p=r?.key||"";return await(await fetch((s??t)+`${encodeURIComponent(o)}&subscriptionId=${c}&apiKey=${p}&baseUrl=${i}`,{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json",...n}})).json()},d=async(e,a,o={})=>{const{baseUrl:n,om:s}=e.serverOptions??{},r=encodeURIComponent(s?.endpointUrl||""),i=encodeURIComponent(s?.subscriptionId||""),c=s?.key||"";return await(await fetch((n??t)+`${encodeURIComponent(a)}&subscriptionId=${i}&apiKey=${c}&baseUrl=${r}`,{method:"GET",headers:{"Content-Type":"application/json",...o}})).json()};let u=null;const m=async(t,o={})=>{u&&window.removeEventListener("message",u);const n="string"==typeof t?{libraryId:t}:t;void 0===o.onLoadJavascript&&(o.onLoadJavascript=e=>c(n)),void 0===o.onLoadArticleCatalog&&(o.onLoadArticleCatalog=e=>r(n)),void 0===o.onLoadMasterData&&(o.onLoadMasterData=e=>i(n));const{expose:s}=await import("./comlink-CmT64Qi3.mjs");u=t=>{if("connect_hi"===t.data.type&&t.data.port){const r=t.data.port;((e,t)=>{e.serverOptions||(e.serverOptions={}),!e.serverOptions.language&&t?.locale&&(e.serverOptions.language=t.locale),e.serverOptions.language||(e.serverOptions.language=a(null,!0))})(n,t.data.globalInitData||{}),r.start?.(),s(e(o),r)}},window.addEventListener("message",u)},b=()=>{u&&(window.removeEventListener("message",u),u=null)},w={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"};export{w as HI_PANEL_ACTION,b as cleanupHi,p as createHiLibraryCallbacks,r as libLoadArticleCatalog,c as libLoadCalcScript,i as libLoadMasterData,d as omGetRequest,l as omPostRequest,m as setupHi};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.1.0-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",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { HiCallbacks } from '../../../common/src/hi/hi-types';
|
|
2
|
-
import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
|
|
2
|
+
import { HomagIntelligenceInitData, GlobalInitDataDefinition } from '../../../web-sdk/packages';
|
|
3
|
+
/** @internal Exported for testing purposes */
|
|
4
|
+
export declare const setFallbackLanguage: (hiInitData: HomagIntelligenceInitData, globalInitData: GlobalInitDataDefinition) => void;
|
|
3
5
|
export declare const setupHi: (libraryIdOrOptions: HomagIntelligenceInitData | string, callbacks?: Partial<HiCallbacks>) => Promise<void>;
|
|
4
6
|
export declare const cleanupHi: () => void;
|
|
@@ -24,6 +24,7 @@ export declare const isExposable: (name: string) => boolean;
|
|
|
24
24
|
export declare const getMethodNames: (proto: any, namespace: string, isCallback?: boolean) => string[];
|
|
25
25
|
export declare const getConfiguratorSettings: (configuratorId: string, initData: UiInitData) => Promise<ConfiguratorSettings>;
|
|
26
26
|
export declare const INTERACTION_CONTAINER_SELECTOR = "data-rml-interaction-container";
|
|
27
|
+
export type { ConfiguratorSettings, UiInitData, } from '../../../src/configurator/embedding/types';
|
|
27
28
|
interface PluginMap {
|
|
28
29
|
dragIn: typeof DragIn;
|
|
29
30
|
}
|
package/roomle-embedding-lib.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { expose as
|
|
1
|
+
import { expose as D } from "./comlink-BAiXCcU9.mjs";
|
|
2
|
+
import { g as P } from "./browser-CUgD7zyH.mjs";
|
|
2
3
|
import { c as F } from "./utils-D--vltCL.mjs";
|
|
3
|
-
class
|
|
4
|
+
class S {
|
|
4
5
|
_side;
|
|
5
6
|
// for better debugging (who handles message? iframe or website?)
|
|
6
7
|
_incomingMessageBus = null;
|
|
@@ -22,21 +23,21 @@ class T {
|
|
|
22
23
|
return new Promise((r, o) => {
|
|
23
24
|
if (this._incomingMessageBus === this._outgoingMessageBus)
|
|
24
25
|
return r(void 0);
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
if (!
|
|
28
|
-
return
|
|
26
|
+
const i = new MessageChannel();
|
|
27
|
+
i.port1.onmessage = (n) => {
|
|
28
|
+
if (!n || !n.data)
|
|
29
|
+
return i.port1.close(), i.port2.close(), o(
|
|
29
30
|
new Error(
|
|
30
31
|
this._side + " received message but response can not be interpreted"
|
|
31
32
|
)
|
|
32
33
|
);
|
|
33
34
|
let l;
|
|
34
35
|
try {
|
|
35
|
-
l = JSON.parse(
|
|
36
|
+
l = JSON.parse(n.data);
|
|
36
37
|
} catch (u) {
|
|
37
|
-
return
|
|
38
|
+
return i.port1.close(), i.port2.close(), this._prepareError(u), o(u);
|
|
38
39
|
}
|
|
39
|
-
l.error ? o(l.error) : l.result !== void 0 ? r(l.result) : r(void 0),
|
|
40
|
+
l.error ? o(l.error) : l.result !== void 0 ? r(l.result) : r(void 0), i.port1.close(), i.port2.close();
|
|
40
41
|
};
|
|
41
42
|
let a = "";
|
|
42
43
|
try {
|
|
@@ -51,7 +52,7 @@ class T {
|
|
|
51
52
|
if (!this._outgoingMessageBus)
|
|
52
53
|
return o(new Error(this._side + ": outgoing bus not set yet"));
|
|
53
54
|
this._outgoingMessageBus.postMessage(a, "*", [
|
|
54
|
-
|
|
55
|
+
i.port2
|
|
55
56
|
]);
|
|
56
57
|
});
|
|
57
58
|
}
|
|
@@ -71,20 +72,20 @@ class T {
|
|
|
71
72
|
if (o === void 0)
|
|
72
73
|
return;
|
|
73
74
|
o.then(
|
|
74
|
-
(
|
|
75
|
-
let a,
|
|
76
|
-
typeof
|
|
75
|
+
(i = {}) => {
|
|
76
|
+
let a, n;
|
|
77
|
+
typeof i == "object" && i !== null && (a = i.error, n = i.result), a ? t.postMessage(
|
|
77
78
|
JSON.stringify({ error: a })
|
|
78
|
-
) :
|
|
79
|
-
JSON.stringify({ result: i })
|
|
80
|
-
) : t.postMessage(
|
|
79
|
+
) : n !== void 0 ? t.postMessage(
|
|
81
80
|
JSON.stringify({ result: n })
|
|
81
|
+
) : t.postMessage(
|
|
82
|
+
JSON.stringify({ result: i })
|
|
82
83
|
);
|
|
83
84
|
},
|
|
84
|
-
(
|
|
85
|
+
(i) => {
|
|
85
86
|
t.postMessage(
|
|
86
87
|
JSON.stringify({
|
|
87
|
-
error: this._prepareError(
|
|
88
|
+
error: this._prepareError(i)
|
|
88
89
|
})
|
|
89
90
|
);
|
|
90
91
|
}
|
|
@@ -105,14 +106,14 @@ class T {
|
|
|
105
106
|
return e.message = this._side + ": " + e.message, console.error(e), e.message;
|
|
106
107
|
}
|
|
107
108
|
}
|
|
108
|
-
const
|
|
109
|
+
const B = () => {
|
|
109
110
|
try {
|
|
110
111
|
return window.self !== window.top;
|
|
111
112
|
} catch {
|
|
112
113
|
return !0;
|
|
113
114
|
}
|
|
114
|
-
},
|
|
115
|
-
const s =
|
|
115
|
+
}, x = ["127.0.0.1", "localhost", "0.0.0.0"], U = () => {
|
|
116
|
+
const s = B();
|
|
116
117
|
let e = window.location.href;
|
|
117
118
|
if (s) {
|
|
118
119
|
if (!document.referrer)
|
|
@@ -125,38 +126,21 @@ const x = () => {
|
|
|
125
126
|
const e = new RegExp(
|
|
126
127
|
/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/
|
|
127
128
|
);
|
|
128
|
-
return !!(
|
|
129
|
-
},
|
|
130
|
-
"language",
|
|
131
|
-
"browserLanguage",
|
|
132
|
-
"userLanguage",
|
|
133
|
-
"systemLanguage"
|
|
134
|
-
], p = (s, e = !0) => !s || s.length < 2 ? "en" : e ? s.substring(0, 2) : s, G = (s = null, e = !1) => {
|
|
135
|
-
const t = window.navigator;
|
|
136
|
-
if (s)
|
|
137
|
-
return p(s, !e);
|
|
138
|
-
if (Array.isArray(t.languages) && t.languages.length > 0)
|
|
139
|
-
return p(t.languages[0], !e);
|
|
140
|
-
for (let r = 0, o = M.length; r < o; r++) {
|
|
141
|
-
const n = t[M[r]];
|
|
142
|
-
if (n)
|
|
143
|
-
return p(n, !e);
|
|
144
|
-
}
|
|
145
|
-
return "en";
|
|
146
|
-
}, J = (s, e) => {
|
|
129
|
+
return !!(x.includes(s) || e.test(s) || s.endsWith("roomle.com") || s.endsWith("gitlab.io") || s.endsWith("gitlab.com"));
|
|
130
|
+
}, W = (s, e) => {
|
|
147
131
|
const t = JSON.parse(JSON.stringify(s));
|
|
148
|
-
return
|
|
149
|
-
},
|
|
132
|
+
return A(t, e);
|
|
133
|
+
}, A = (s, e) => {
|
|
150
134
|
for (const t in e)
|
|
151
135
|
try {
|
|
152
|
-
e[t].constructor === Object ? s[t] =
|
|
136
|
+
e[t].constructor === Object ? s[t] = A(s[t], e[t]) : s[t] = e[t];
|
|
153
137
|
} catch {
|
|
154
138
|
s[t] = e[t];
|
|
155
139
|
}
|
|
156
140
|
return s;
|
|
157
141
|
};
|
|
158
|
-
var
|
|
159
|
-
const
|
|
142
|
+
var b = /* @__PURE__ */ ((s) => (s.BOTTOM_BAR = "bottom_bar", s.PARTLIST_BOUNDS = "partlist_bounds", s.INTERACTION_NOTES = "interaction_notes", s.PARAMETER_GROUPS = "parameter_groups", s))(b || {});
|
|
143
|
+
const G = (s) => JSON.parse(JSON.stringify(s)), J = {
|
|
160
144
|
mobileLandscape: !0,
|
|
161
145
|
floorMaterialRootTag: "materials_root",
|
|
162
146
|
buttons: {
|
|
@@ -167,7 +151,7 @@ const K = (s) => JSON.parse(JSON.stringify(s)), V = {
|
|
|
167
151
|
partlist_print: !0
|
|
168
152
|
},
|
|
169
153
|
elements: {
|
|
170
|
-
[
|
|
154
|
+
[b.INTERACTION_NOTES]: !0
|
|
171
155
|
},
|
|
172
156
|
helpcenter: {
|
|
173
157
|
roomdesigner: !0,
|
|
@@ -186,33 +170,33 @@ const K = (s) => JSON.parse(JSON.stringify(s)), V = {
|
|
|
186
170
|
},
|
|
187
171
|
rotationSnapDegrees: 10,
|
|
188
172
|
interactionsCollapsed: !1
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
)), s),
|
|
173
|
+
}, V = "(idle)", K = (s) => (E(s), s?.customApiUrl && (s.customApiUrl = decodeURIComponent(s.customApiUrl)), s.shareUrl && (s.deeplink = s.shareUrl.replace(
|
|
174
|
+
Y,
|
|
175
|
+
q
|
|
176
|
+
)), s), E = (s) => {
|
|
193
177
|
if (!s)
|
|
194
178
|
return;
|
|
195
179
|
const e = Object.keys(s);
|
|
196
180
|
for (const t of e) {
|
|
197
181
|
const r = s[t];
|
|
198
|
-
if (!Array.isArray(r) && typeof r == "object" && r !== null &&
|
|
182
|
+
if (!Array.isArray(r) && typeof r == "object" && r !== null && E(r), Array.isArray(r))
|
|
199
183
|
for (const o of r)
|
|
200
|
-
|
|
184
|
+
E(o);
|
|
201
185
|
(r === "true" || r === "false") && (s[t] = r === "true");
|
|
202
186
|
}
|
|
203
|
-
},
|
|
187
|
+
}, $ = (s, e) => {
|
|
204
188
|
e.configuratorId = s.id;
|
|
205
189
|
const t = s.settings || {};
|
|
206
|
-
return !e.overrideTenant && s.tenant && (e.overrideTenant = s.tenant),
|
|
207
|
-
},
|
|
208
|
-
const s =
|
|
209
|
-
s.locale || (s.locale =
|
|
210
|
-
const e =
|
|
190
|
+
return !e.overrideTenant && s.tenant && (e.overrideTenant = s.tenant), W(t, e);
|
|
191
|
+
}, z = () => {
|
|
192
|
+
const s = G(J);
|
|
193
|
+
s.locale || (s.locale = P(null, !0)), s.id === V && delete s.id;
|
|
194
|
+
const e = U();
|
|
211
195
|
return e && k(e) && (s.configuratorId = "demoConfigurator"), s.customApiUrl = void 0, s.emails = !1, s;
|
|
212
|
-
},
|
|
196
|
+
}, Y = "<CONF_ID>", q = "#CONFIGURATIONID#", Q = (s) => {
|
|
213
197
|
s.featureFlags || (s.featureFlags = {}), typeof s.featureFlags.realPartList != "boolean" && (s.featureFlags.realPartList = !0), typeof s.featureFlags.globalCallbacks != "boolean" && (s.featureFlags.globalCallbacks = !0), typeof s.featureFlags.mocAr != "boolean" && (s.featureFlags.mocAr = !1);
|
|
214
|
-
},
|
|
215
|
-
class
|
|
198
|
+
}, M = () => /(android)/i.test(navigator.userAgent);
|
|
199
|
+
class T {
|
|
216
200
|
_messageHandler = null;
|
|
217
201
|
isSetupDone = !1;
|
|
218
202
|
viewName = "main";
|
|
@@ -242,8 +226,8 @@ class y {
|
|
|
242
226
|
handleSetup(e) {
|
|
243
227
|
const { methods: t, callbacks: r } = e;
|
|
244
228
|
t.forEach((o) => {
|
|
245
|
-
const
|
|
246
|
-
this[a] || (this[a] = {}), this[a][
|
|
229
|
+
const i = o.split(h), a = i[0], n = i[1];
|
|
230
|
+
this[a] || (this[a] = {}), this[a][n] = (function() {
|
|
247
231
|
if (!this._messageHandler) {
|
|
248
232
|
console.error("MessageHandler not set");
|
|
249
233
|
return;
|
|
@@ -251,52 +235,52 @@ class y {
|
|
|
251
235
|
return this._messageHandler.sendMessage(o, [...arguments]);
|
|
252
236
|
}).bind(this);
|
|
253
237
|
}), r.forEach((o) => {
|
|
254
|
-
const
|
|
255
|
-
this[a] || (this[a] = {}), this[a][
|
|
238
|
+
const i = o.split(h), a = i[0], n = i[1], l = i[2];
|
|
239
|
+
this[a] || (this[a] = {}), this[a][n] || (this[a][n] = {}), this[a][n][l] = () => {
|
|
256
240
|
};
|
|
257
241
|
}), this.isSetupDone = !0;
|
|
258
242
|
}
|
|
259
243
|
executeMessage({ message: e, args: t }) {
|
|
260
|
-
const r = e.split(h), o = r[0],
|
|
261
|
-
if (a && this[o][
|
|
262
|
-
const
|
|
244
|
+
const r = e.split(h), o = r[0], i = r[1], a = r.length === 3 ? r[2] : null;
|
|
245
|
+
if (a && this[o][i][a]) {
|
|
246
|
+
const n = this[o][i][a](
|
|
263
247
|
...t
|
|
264
248
|
);
|
|
265
|
-
return
|
|
249
|
+
return n instanceof Promise ? n.then((l) => ({ result: l })) : n !== void 0 ? Promise.resolve({ result: n }) : Promise.resolve({ result: null });
|
|
266
250
|
}
|
|
267
251
|
return Promise.reject('Message "' + e + '" is unkown');
|
|
268
252
|
}
|
|
269
253
|
setupPlugins(e, t, r = "website") {
|
|
270
254
|
for (const o of e)
|
|
271
255
|
typeof o == "string" && o === "dragIn" ? this.pluginsLoaded.push(
|
|
272
|
-
new Promise((
|
|
256
|
+
new Promise((i, a) => {
|
|
273
257
|
try {
|
|
274
|
-
import("./embedding-plugins-CjNos83d.mjs").then((
|
|
275
|
-
const l = new
|
|
258
|
+
import("./embedding-plugins-CjNos83d.mjs").then((n) => n.l).then(({ DragIn: n }) => {
|
|
259
|
+
const l = new n(this.ui, t, r, this.viewName);
|
|
276
260
|
l.init().then(() => {
|
|
277
|
-
this.plugins.dragIn = l,
|
|
261
|
+
this.plugins.dragIn = l, i();
|
|
278
262
|
}, a);
|
|
279
263
|
});
|
|
280
|
-
} catch (
|
|
281
|
-
a(
|
|
264
|
+
} catch (n) {
|
|
265
|
+
a(n);
|
|
282
266
|
}
|
|
283
267
|
})
|
|
284
268
|
) : o.name && o.loader && this.pluginsLoaded.push(
|
|
285
|
-
new Promise((
|
|
269
|
+
new Promise((i, a) => {
|
|
286
270
|
try {
|
|
287
|
-
o.loader().then((
|
|
288
|
-
const l = new
|
|
271
|
+
o.loader().then((n) => {
|
|
272
|
+
const l = new n(
|
|
289
273
|
this.ui,
|
|
290
274
|
t,
|
|
291
275
|
r,
|
|
292
276
|
this.viewName
|
|
293
277
|
);
|
|
294
278
|
l.init().then(() => {
|
|
295
|
-
this.plugins[o.name] = l,
|
|
279
|
+
this.plugins[o.name] = l, i();
|
|
296
280
|
}, a);
|
|
297
281
|
});
|
|
298
|
-
} catch (
|
|
299
|
-
a(
|
|
282
|
+
} catch (n) {
|
|
283
|
+
a(n);
|
|
300
284
|
}
|
|
301
285
|
})
|
|
302
286
|
);
|
|
@@ -307,7 +291,7 @@ const I = () => {
|
|
|
307
291
|
return { promise: new Promise((r, o) => {
|
|
308
292
|
s = r, e = o;
|
|
309
293
|
}), resolve: s, reject: e };
|
|
310
|
-
},
|
|
294
|
+
}, w = {
|
|
311
295
|
SDK: "extended",
|
|
312
296
|
CONFIGURATOR_SDK: "configurator",
|
|
313
297
|
CALLBACKS: "callbacks",
|
|
@@ -315,7 +299,7 @@ const I = () => {
|
|
|
315
299
|
ANALYTICS: "analytics",
|
|
316
300
|
GLOBAL: "global",
|
|
317
301
|
RAPI: "rapi"
|
|
318
|
-
}, h = ".",
|
|
302
|
+
}, h = ".", oe = w.SDK + h + w.CALLBACKS, p = {
|
|
319
303
|
REQUEST_BOOT: "requestBoot",
|
|
320
304
|
SETUP: "setup",
|
|
321
305
|
WEBSITE_READY: "websiteReady"
|
|
@@ -324,19 +308,19 @@ const I = () => {
|
|
|
324
308
|
RETURN_METHODS: "returnMethods",
|
|
325
309
|
REGISTER_CUSTOM_VIEW: "registerCustomView",
|
|
326
310
|
REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
|
|
327
|
-
},
|
|
311
|
+
}, X = ["constructor", "callbacks"], Z = (s) => s[0] !== "_" && !X.includes(s), ie = (s, e, t = !1) => {
|
|
328
312
|
if (!s)
|
|
329
313
|
return [];
|
|
330
|
-
const r = Object.getOwnPropertyNames(s), o = t ?
|
|
331
|
-
return r.filter(
|
|
332
|
-
},
|
|
314
|
+
const r = Object.getOwnPropertyNames(s), o = t ? w.CALLBACKS + h : "";
|
|
315
|
+
return r.filter(Z).map((i) => e + h + o + i);
|
|
316
|
+
}, j = async (s, e) => {
|
|
333
317
|
if (typeof s != "string")
|
|
334
318
|
throw new Error(
|
|
335
319
|
'Configurator ID is not a string type: "' + typeof s + '"'
|
|
336
320
|
);
|
|
337
|
-
const t = e.customApiUrl ? e.customApiUrl : "https://api.roomle.com/v2", r = e.overrideTenant || 9, o = t + "/configurators/" + s,
|
|
321
|
+
const t = e.customApiUrl ? e.customApiUrl : "https://api.roomle.com/v2", r = e.overrideTenant || 9, o = t + "/configurators/" + s, i = "roomle_portal_v2", a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;" + i), n = () => {
|
|
338
322
|
const g = {
|
|
339
|
-
apiKey:
|
|
323
|
+
apiKey: i,
|
|
340
324
|
currentTenant: r,
|
|
341
325
|
locale: "en",
|
|
342
326
|
language: "en",
|
|
@@ -347,12 +331,12 @@ const I = () => {
|
|
|
347
331
|
return new Headers(g);
|
|
348
332
|
}, l = new Request(o, {
|
|
349
333
|
method: "GET",
|
|
350
|
-
headers:
|
|
334
|
+
headers: n(),
|
|
351
335
|
mode: "cors",
|
|
352
336
|
cache: "default"
|
|
353
337
|
}), u = await fetch(l), { configurator: d } = await u.json();
|
|
354
338
|
return d;
|
|
355
|
-
},
|
|
339
|
+
}, ne = "data-rml-interaction-container", R = (s, e, t) => {
|
|
356
340
|
let r = null;
|
|
357
341
|
Object.defineProperty(s, e, {
|
|
358
342
|
get() {
|
|
@@ -364,20 +348,20 @@ const I = () => {
|
|
|
364
348
|
), console.warn("{ mute: true, value: () => void }"), r = o);
|
|
365
349
|
}
|
|
366
350
|
});
|
|
367
|
-
},
|
|
351
|
+
}, L = () => window.innerHeight * 0.01 + "px", y = (s) => {
|
|
368
352
|
s && setTimeout(
|
|
369
|
-
() => s.style.setProperty(
|
|
353
|
+
() => s.style.setProperty(O, L()),
|
|
370
354
|
0
|
|
371
355
|
);
|
|
372
|
-
},
|
|
356
|
+
}, N = "rml-styles", ee = 450, O = "--rml-full-height", c = {
|
|
373
357
|
CONTAINER: "rml-container",
|
|
374
358
|
FILL: "rml-fill",
|
|
375
359
|
POSITION: "rml-pos",
|
|
376
360
|
TRANSITION: "rml-transition",
|
|
377
361
|
ANDROID_HEIGHT: "rml-android-height",
|
|
378
362
|
OVERFLOW_HIDDEN: "rml-overflow-hidden"
|
|
379
|
-
},
|
|
380
|
-
class
|
|
363
|
+
}, _ = /* @__PURE__ */ new Map();
|
|
364
|
+
class ae extends T {
|
|
381
365
|
static createPlanner(e, t, r, o = []) {
|
|
382
366
|
return this._create(
|
|
383
367
|
e,
|
|
@@ -387,9 +371,9 @@ class le extends y {
|
|
|
387
371
|
);
|
|
388
372
|
}
|
|
389
373
|
static async connect(e, t = []) {
|
|
390
|
-
const r = new
|
|
374
|
+
const r = new T();
|
|
391
375
|
r.viewName = e;
|
|
392
|
-
const { resolve: o, promise:
|
|
376
|
+
const { resolve: o, promise: i } = I(), { resolve: a, promise: n } = I(), l = ({
|
|
393
377
|
message: g,
|
|
394
378
|
args: m
|
|
395
379
|
}) => {
|
|
@@ -404,7 +388,7 @@ class le extends y {
|
|
|
404
388
|
if (r.isSetupDone)
|
|
405
389
|
return r.executeMessage({ message: g, args: m });
|
|
406
390
|
}
|
|
407
|
-
}, u = new
|
|
391
|
+
}, u = new S(
|
|
408
392
|
"custom-view-" + e,
|
|
409
393
|
window,
|
|
410
394
|
window.parent,
|
|
@@ -415,7 +399,7 @@ class le extends y {
|
|
|
415
399
|
return u.sendMessage(
|
|
416
400
|
f.REGISTER_CUSTOM_VIEW,
|
|
417
401
|
d
|
|
418
|
-
), await
|
|
402
|
+
), await i, u.sendMessage(f.GET_METHODS, d), await n, r.setupPlugins(
|
|
419
403
|
t,
|
|
420
404
|
document.body,
|
|
421
405
|
"custom-view"
|
|
@@ -472,33 +456,33 @@ Migration: import { setupHi } from '@roomle/embedding-lib/hi'; setupHi(libraryId
|
|
|
472
456
|
), this.hiMessageHandler && window.removeEventListener("message", this.hiMessageHandler), this.hiMessageHandler = (t) => {
|
|
473
457
|
if (t.data.type === "connect_hi" && t.data.port) {
|
|
474
458
|
const r = t.data.port;
|
|
475
|
-
r.start?.(),
|
|
459
|
+
r.start?.(), D(F(e), r);
|
|
476
460
|
}
|
|
477
461
|
}, window.addEventListener("message", this.hiMessageHandler);
|
|
478
462
|
}
|
|
479
463
|
static async _create(e, t, r, o) {
|
|
480
|
-
return new Promise(async (
|
|
464
|
+
return new Promise(async (i, a) => {
|
|
481
465
|
try {
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
|
|
466
|
+
const n = A(
|
|
467
|
+
z(),
|
|
468
|
+
K(r)
|
|
485
469
|
);
|
|
486
|
-
|
|
487
|
-
const l = await
|
|
470
|
+
Q(n);
|
|
471
|
+
const l = await j(
|
|
488
472
|
e,
|
|
489
|
-
|
|
473
|
+
n
|
|
490
474
|
);
|
|
491
|
-
r =
|
|
475
|
+
r = $(l, n);
|
|
492
476
|
const u = new this(
|
|
493
477
|
l,
|
|
494
478
|
t,
|
|
495
479
|
r,
|
|
496
480
|
o,
|
|
497
|
-
|
|
481
|
+
i
|
|
498
482
|
);
|
|
499
483
|
return await Promise.allSettled(u.pluginsLoaded), u;
|
|
500
|
-
} catch (
|
|
501
|
-
return a(
|
|
484
|
+
} catch (n) {
|
|
485
|
+
return a(n);
|
|
502
486
|
}
|
|
503
487
|
});
|
|
504
488
|
}
|
|
@@ -507,42 +491,42 @@ Migration: import { setupHi } from '@roomle/embedding-lib/hi'; setupHi(libraryId
|
|
|
507
491
|
_configuratorSettings;
|
|
508
492
|
_initData = {};
|
|
509
493
|
_iframe;
|
|
510
|
-
constructor(e, t, r, o,
|
|
494
|
+
constructor(e, t, r, o, i) {
|
|
511
495
|
if (super(), !e || typeof e.id != "string")
|
|
512
496
|
throw new Error(
|
|
513
497
|
"Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person"
|
|
514
498
|
);
|
|
515
|
-
if (
|
|
499
|
+
if (_.has(t))
|
|
516
500
|
throw new Error("There is already an instance on this DOM element");
|
|
517
|
-
if (!!!document.getElementById(
|
|
501
|
+
if (!!!document.getElementById(N)) {
|
|
518
502
|
const u = r.zIndex || 9999999, d = document.createElement("style");
|
|
519
|
-
d.type = "text/css", d.id =
|
|
520
|
-
const g = "transition:all ease-in-out " +
|
|
521
|
-
(
|
|
503
|
+
d.type = "text/css", d.id = N;
|
|
504
|
+
const g = "transition:all ease-in-out " + ee + "ms;", m = ["-webkit-", "-o-"].reduce(
|
|
505
|
+
(C, v) => C += v + g,
|
|
522
506
|
""
|
|
523
|
-
) + g,
|
|
507
|
+
) + g, H = L();
|
|
524
508
|
d.innerHTML = `
|
|
525
|
-
.${c.CONTAINER}{${
|
|
509
|
+
.${c.CONTAINER}{${O}:${H};}
|
|
526
510
|
.${c.POSITION}{position:fixed;top:0;left:0;z-index:${u};opacity:0}
|
|
527
511
|
.${c.TRANSITION}{${m}}
|
|
528
512
|
.${c.FILL}{width:100%;height:100%;opacity:1}
|
|
529
|
-
.${c.ANDROID_HEIGHT}{height:calc(var(${
|
|
513
|
+
.${c.ANDROID_HEIGHT}{height:calc(var(${O},1vh)*100)}
|
|
530
514
|
.${c.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
531
515
|
`, document.head.appendChild(d);
|
|
532
516
|
}
|
|
533
517
|
this._executeMessage = this._executeMessage.bind(this);
|
|
534
|
-
const
|
|
518
|
+
const n = new S(
|
|
535
519
|
"website",
|
|
536
520
|
window,
|
|
537
521
|
null,
|
|
538
522
|
this._executeMessage
|
|
539
523
|
);
|
|
540
|
-
this.setMessageHandler(
|
|
524
|
+
this.setMessageHandler(n), this._onResize = this._onResize.bind(this), M() && window.addEventListener("resize", this._onResize), this._container = t, this._initData = r, this._configuratorSettings = e;
|
|
541
525
|
const l = this._createIframe();
|
|
542
|
-
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe =
|
|
526
|
+
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = i, this._container.appendChild(l), this._iframe = l, this.setupPlugins(o, this._iframe), _.set(t, !0);
|
|
543
527
|
}
|
|
544
528
|
teardown() {
|
|
545
|
-
this._container &&
|
|
529
|
+
this._container && _.delete(this._container);
|
|
546
530
|
const e = this._container.querySelector("iframe");
|
|
547
531
|
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
548
532
|
}
|
|
@@ -552,21 +536,21 @@ Migration: import { setupHi } from '@roomle/embedding-lib/hi'; setupHi(libraryId
|
|
|
552
536
|
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(c.CONTAINER), e.classList.add(c.FILL), e;
|
|
553
537
|
}
|
|
554
538
|
_onResize() {
|
|
555
|
-
|
|
539
|
+
y(this._iframe);
|
|
556
540
|
}
|
|
557
541
|
_onUseFullPage() {
|
|
558
|
-
this._iframe.classList.add(c.POSITION), document.documentElement.classList.add(c.OVERFLOW_HIDDEN), window.document.body.classList.add(c.OVERFLOW_HIDDEN),
|
|
542
|
+
this._iframe.classList.add(c.POSITION), document.documentElement.classList.add(c.OVERFLOW_HIDDEN), window.document.body.classList.add(c.OVERFLOW_HIDDEN), M() && (y(this._iframe), this._iframe.classList.add(c.ANDROID_HEIGHT));
|
|
559
543
|
}
|
|
560
544
|
_onBackToWebsite() {
|
|
561
545
|
this._iframe.classList.remove(c.POSITION), this._iframe.classList.remove(c.ANDROID_HEIGHT), document.documentElement.classList.remove(c.OVERFLOW_HIDDEN), window.document.body.classList.remove(c.OVERFLOW_HIDDEN);
|
|
562
546
|
}
|
|
563
547
|
_executeMessage({ message: e, args: t }, r) {
|
|
564
548
|
if (r.source && r.source === this._iframe?.contentWindow)
|
|
565
|
-
return e ===
|
|
549
|
+
return e === p.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(r.source), Promise.resolve({ result: this._initData })) : (console.error("MessageHandler not set"), Promise.resolve({ error: "MessageHandler not set" })) : e === p.SETUP ? (this.handleSetup(t[0]), R(
|
|
566
550
|
this.ui.callbacks,
|
|
567
551
|
"onUseFullPage",
|
|
568
552
|
this._onUseFullPage
|
|
569
|
-
),
|
|
553
|
+
), R(
|
|
570
554
|
this.ui.callbacks,
|
|
571
555
|
"onBackToWebsite",
|
|
572
556
|
this._onBackToWebsite
|
|
@@ -575,19 +559,19 @@ Migration: import { setupHi } from '@roomle/embedding-lib/hi'; setupHi(libraryId
|
|
|
575
559
|
console.error("MessageHandler not set");
|
|
576
560
|
return;
|
|
577
561
|
}
|
|
578
|
-
this._messageHandler.sendMessage(
|
|
562
|
+
this._messageHandler.sendMessage(p.WEBSITE_READY);
|
|
579
563
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({ message: e, args: t });
|
|
580
564
|
}
|
|
581
565
|
}
|
|
582
566
|
export {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
567
|
+
p as HANDSHAKE_MESSAGES,
|
|
568
|
+
ne as INTERACTION_CONTAINER_SELECTOR,
|
|
569
|
+
w as NAMESPACE,
|
|
586
570
|
h as NAMESPACE_SEPARATOR,
|
|
587
|
-
|
|
571
|
+
oe as SDK_CALLBACK,
|
|
588
572
|
f as WELL_KNOWN_MESSAGES,
|
|
589
|
-
|
|
590
|
-
|
|
573
|
+
ae as default,
|
|
574
|
+
j as getConfiguratorSettings,
|
|
591
575
|
ie as getMethodNames,
|
|
592
|
-
|
|
576
|
+
Z as isExposable
|
|
593
577
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expose as e}from"./comlink-CmT64Qi3.mjs";import{c as t}from"./utils-uEcN1DUR.mjs";class s{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=e=>{if(!e||!e.data)return i.port1.close(),i.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return i.port1.close(),i.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),i.port1.close(),i.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[i.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&("string"==typeof e.data||"connect_hi"!==e.data.type)&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const r=["127.0.0.1","localhost","0.0.0.0"],i=["language","browserLanguage","userLanguage","systemLanguage"],a=(e,t=!0)=>!e||e.length<2?"en":t?e.substring(0,2):e,n=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=n(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var o=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(o||{});const l={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[o.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1,localExport3d:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},c=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&c(t),Array.isArray(t))for(const e of t)c(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},u=()=>/(android)/i.test(navigator.userAgent);class g{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split(m),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split(m),s=t[0],r=t[1],i=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][i]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split(m),r=s[0],i=s[1],a=3===s.length?s[2]:null;if(a&&this[r][i][a]){const e=this[r][i][a](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./embedding-plugins-DePKqSKW.mjs").then(e=>e.l).then(({DragIn:i})=>{const a=new i(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,i)=>{try{r.loader().then(a=>{const n=new a(this.ui,t,s,this.viewName);n.init().then(()=>{this.plugins[r.name]=n,e()},i)})}catch(e){i(e)}}))}}const d=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},h={SDK:"extended",CONFIGURATOR_SDK:"configurator",CALLBACKS:"callbacks",UI:"ui",ANALYTICS:"analytics",GLOBAL:"global",RAPI:"rapi"},m=".",p=h.SDK+m+h.CALLBACKS,_={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},f={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},w=["constructor","callbacks"],E=e=>"_"!==e[0]&&!w.includes(e),S=(e,t,s=!1)=>{if(!e)return[];const r=Object.getOwnPropertyNames(e),i=s?h.CALLBACKS+m:"";return r.filter(E).map(e=>t+m+i+e)},y=async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,i=s+"/configurators/"+e,a="roomle_portal_v2",n="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(i,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:n,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c},M="data-rml-interaction-container",b=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},T=()=>.01*window.innerHeight+"px",v=e=>{e&&setTimeout(()=>e.style.setProperty(O,T()),0)},A="rml-styles",O="--rml-full-height",L="rml-container",N="rml-fill",R="rml-pos",I="rml-android-height",C="rml-overflow-hidden",P=new Map;class B extends g{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(e,t=[]){const r=new g;r.viewName=e;const{resolve:i,promise:a}=d(),{resolve:n,promise:o}=d(),l=new s("custom-view-"+e,window,window.parent,({message:e,args:t})=>{switch(e){case f.REGISTER_CUSTOM_VIEW_DONE:i();break;case f.RETURN_METHODS:r.handleSetup(t[0]),n();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(l);const c=[e];return l.sendMessage(f.REGISTER_CUSTOM_VIEW,c),await a,l.sendMessage(f.GET_METHODS,c),await o,r.setupPlugins(t,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static hiMessageHandler=null;static setupHi(s){this.hiMessageHandler&&window.removeEventListener("message",this.hiMessageHandler),this.hiMessageHandler=r=>{if("connect_hi"===r.data.type&&r.data.port){const i=r.data.port;i.start?.(),e(t(s),i)}},window.addEventListener("message",this.hiMessageHandler)}static async _create(e,t,s,o){return new Promise(async(u,g)=>{try{const g=n((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(l);e.locale||(e.locale=((e=null,t=!1)=>{const s=window.navigator;if(e)return a(e,!t);if(Array.isArray(s.languages)&&s.languages.length>0)return a(s.languages[0],!t);for(let e=0,r=i.length;e<r;e++){const r=s[i[e]];if(r)return a(r,!t)}return"en"})(null,!0)),"(idle)"===e.id&&delete e.id;const t=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return t&&(e=>{const t=new RegExp(/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/);return!!(r.includes(e)||t.test(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com"))})(t)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(c(d=s),d?.customApiUrl&&(d.customApiUrl=decodeURIComponent(d.customApiUrl)),d.shareUrl&&(d.deeplink=d.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),d));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(g);const h=await y(e,g);s=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return n(s,t)})(s,t)})(h,g);const m=new this(h,t,s,o,u);return await Promise.allSettled(m.pluginsLoaded),m}catch(e){return g(e)}var d})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(e,t,r,i,a){if(super(),!e||"string"!=typeof e.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(P.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(A)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=A;const s="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,a=T();t.innerHTML=`\n .${L}{${O}:${a};}\n .${R}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${N}{width:100%;height:100%;opacity:1}\n .${I}{height:calc(var(${O},1vh)*100)}\n .${C}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const n=new s("website",window,null,this._executeMessage);this.setMessageHandler(n),this._onResize=this._onResize.bind(this),u()&&window.addEventListener("resize",this._onResize),this._container=t,this._initData=r,this._configuratorSettings=e;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(i,this._iframe),P.set(t,!0)}teardown(){this._container&&P.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";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(L),e.classList.add(N),e}_onResize(){v(this._iframe)}_onUseFullPage(){this._iframe.classList.add(R),document.documentElement.classList.add(C),window.document.body.classList.add(C),u()&&(v(this._iframe),this._iframe.classList.add(I))}_onBackToWebsite(){this._iframe.classList.remove(R),this._iframe.classList.remove(I),document.documentElement.classList.remove(C),window.document.body.classList.remove(C)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return e===_.REQUEST_BOOT?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):e===_.SETUP?(this.handleSetup(t[0]),b(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),b(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage(_.WEBSITE_READY)},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{_ as HANDSHAKE_MESSAGES,M as INTERACTION_CONTAINER_SELECTOR,h as NAMESPACE,m as NAMESPACE_SEPARATOR,p as SDK_CALLBACK,f as WELL_KNOWN_MESSAGES,B as default,y as getConfiguratorSettings,S as getMethodNames,E as isExposable};
|
|
1
|
+
import{expose as e}from"./comlink-CmT64Qi3.mjs";import{g as t}from"./browser-BhHw2H1M.mjs";import{c as s}from"./utils-uEcN1DUR.mjs";class r{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=e=>{if(!e||!e.data)return i.port1.close(),i.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return i.port1.close(),i.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),i.port1.close(),i.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[i.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&("string"==typeof e.data||"connect_hi"!==e.data.type)&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const i=["127.0.0.1","localhost","0.0.0.0"],a=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=a(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var n=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(n||{});const o={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[n.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1,localExport3d:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},l=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&l(t),Array.isArray(t))for(const e of t)l(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},c=()=>/(android)/i.test(navigator.userAgent);class u{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split(h),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split(h),s=t[0],r=t[1],i=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][i]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split(h),r=s[0],i=s[1],a=3===s.length?s[2]:null;if(a&&this[r][i][a]){const e=this[r][i][a](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./embedding-plugins-DePKqSKW.mjs").then(e=>e.l).then(({DragIn:i})=>{const a=new i(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,i)=>{try{r.loader().then(a=>{const n=new a(this.ui,t,s,this.viewName);n.init().then(()=>{this.plugins[r.name]=n,e()},i)})}catch(e){i(e)}}))}}const d=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},g={SDK:"extended",CONFIGURATOR_SDK:"configurator",CALLBACKS:"callbacks",UI:"ui",ANALYTICS:"analytics",GLOBAL:"global",RAPI:"rapi"},h=".",m=g.SDK+h+g.CALLBACKS,p={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},_={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},f=["constructor","callbacks"],w=e=>"_"!==e[0]&&!f.includes(e),E=(e,t,s=!1)=>{if(!e)return[];const r=Object.getOwnPropertyNames(e),i=s?g.CALLBACKS+h:"";return r.filter(w).map(e=>t+h+i+e)},S=async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,i=s+"/configurators/"+e,a="roomle_portal_v2",n="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(i,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:n,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c},M="data-rml-interaction-container",b=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},y=()=>.01*window.innerHeight+"px",T=e=>{e&&setTimeout(()=>e.style.setProperty(v,y()),0)},O="rml-styles",v="--rml-full-height",A="rml-container",N="rml-fill",R="rml-pos",I="rml-android-height",L="rml-overflow-hidden",C=new Map;class P extends u{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(e,t=[]){const s=new u;s.viewName=e;const{resolve:i,promise:a}=d(),{resolve:n,promise:o}=d(),l=new r("custom-view-"+e,window,window.parent,({message:e,args:t})=>{switch(e){case _.REGISTER_CUSTOM_VIEW_DONE:i();break;case _.RETURN_METHODS:s.handleSetup(t[0]),n();break;default:if(s.isSetupDone)return s.executeMessage({message:e,args:t})}});s.setMessageHandler(l);const c=[e];return l.sendMessage(_.REGISTER_CUSTOM_VIEW,c),await a,l.sendMessage(_.GET_METHODS,c),await o,s.setupPlugins(t,document.body,"custom-view"),await Promise.allSettled(s.pluginsLoaded),s}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static hiMessageHandler=null;static setupHi(t){this.hiMessageHandler&&window.removeEventListener("message",this.hiMessageHandler),this.hiMessageHandler=r=>{if("connect_hi"===r.data.type&&r.data.port){const i=r.data.port;i.start?.(),e(s(t),i)}},window.addEventListener("message",this.hiMessageHandler)}static async _create(e,s,r,n){return new Promise(async(c,u)=>{try{const u=a((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(o);e.locale||(e.locale=t(null,!0)),"(idle)"===e.id&&delete e.id;const s=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return s&&(e=>{const t=new RegExp(/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/);return!!(i.includes(e)||t.test(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com"))})(s)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(l(d=r),d?.customApiUrl&&(d.customApiUrl=decodeURIComponent(d.customApiUrl)),d.shareUrl&&(d.deeplink=d.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),d));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(u);const g=await S(e,u);r=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return a(s,t)})(s,t)})(g,u);const h=new this(g,s,r,n,c);return await Promise.allSettled(h.pluginsLoaded),h}catch(e){return u(e)}var d})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(e,t,s,i,a){if(super(),!e||"string"!=typeof e.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(C.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(O)){const e=s.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=O;const r="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((e,t)=>e+(t+r),"")+r,a=y();t.innerHTML=`\n .${A}{${v}:${a};}\n .${R}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${N}{width:100%;height:100%;opacity:1}\n .${I}{height:calc(var(${v},1vh)*100)}\n .${L}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const n=new r("website",window,null,this._executeMessage);this.setMessageHandler(n),this._onResize=this._onResize.bind(this),c()&&window.addEventListener("resize",this._onResize),this._container=t,this._initData=s,this._configuratorSettings=e;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(i,this._iframe),C.set(t,!0)}teardown(){this._container&&C.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";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(A),e.classList.add(N),e}_onResize(){T(this._iframe)}_onUseFullPage(){this._iframe.classList.add(R),document.documentElement.classList.add(L),window.document.body.classList.add(L),c()&&(T(this._iframe),this._iframe.classList.add(I))}_onBackToWebsite(){this._iframe.classList.remove(R),this._iframe.classList.remove(I),document.documentElement.classList.remove(L),window.document.body.classList.remove(L)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return e===p.REQUEST_BOOT?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):e===p.SETUP?(this.handleSetup(t[0]),b(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),b(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage(p.WEBSITE_READY)},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{p as HANDSHAKE_MESSAGES,M as INTERACTION_CONTAINER_SELECTOR,g as NAMESPACE,h as NAMESPACE_SEPARATOR,m as SDK_CALLBACK,_ as WELL_KNOWN_MESSAGES,P as default,S as getConfiguratorSettings,E as getMethodNames,w as isExposable};
|