@roomle/embedding-lib 5.34.0-debug.4 → 6.0.0-alpha.2
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 +10 -2
- package/hi.js +22 -17
- package/hi.min.js +1 -1
- package/package.json +1 -1
- package/packages/embedding-lib/src/hi.d.ts +1 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-callbacks.d.ts +1 -1
- package/packages/embedding-lib/src/homag-intelligence/hi-setup.d.ts +1 -1
- package/packages/embedding-lib/src/roomle-embedding-lib.d.ts +1 -1
- package/roomle-embedding-lib.js +13 -12
- package/roomle-embedding-lib.min.js +1 -1
- package/packages/embedding-lib/src/types.d.ts +0 -91
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
##
|
|
1
|
+
## 6.0.0-alpha.2 (2026-01-08)
|
|
2
2
|
|
|
3
|
-
* fix
|
|
3
|
+
* Merge branch 'fix/sdk-build' of github.com:roomle-dev/roomle-ui into fix/sdk-build ([5a85fce](https://github.com/roomle-dev/roomle-ui/commit/5a85fce))
|
|
4
|
+
* Merge branch 'master' into fix/sdk-build ([c4b861e](https://github.com/roomle-dev/roomle-ui/commit/c4b861e))
|
|
5
|
+
* Merge pull request #2137 from roomle-dev/fix/flying-menu-on-new-walls ([a7aec1e](https://github.com/roomle-dev/roomle-ui/commit/a7aec1e)), closes [#2137](https://github.com/roomle-dev/roomle-ui/issues/2137)
|
|
6
|
+
* Merge pull request #2142 from roomle-dev/fix/sdk-build ([8042d68](https://github.com/roomle-dev/roomle-ui/commit/8042d68)), closes [#2142](https://github.com/roomle-dev/roomle-ui/issues/2142)
|
|
7
|
+
* chore(SDK): add embedding lib hi path ([42a1fd1](https://github.com/roomle-dev/roomle-ui/commit/42a1fd1))
|
|
8
|
+
* chore: no implicit any for callback names ([17daed3](https://github.com/roomle-dev/roomle-ui/commit/17daed3))
|
|
9
|
+
* fix(SDK): add missing module resolution to types QA ([40fdd6b](https://github.com/roomle-dev/roomle-ui/commit/40fdd6b))
|
|
10
|
+
* fix: flying menu not showing on new wealls ([18dc57c](https://github.com/roomle-dev/roomle-ui/commit/18dc57c))
|
|
11
|
+
* fix(SDK): resolution of common files ([5df3987](https://github.com/roomle-dev/roomle-ui/commit/5df3987))
|
package/hi.js
CHANGED
|
@@ -32,12 +32,12 @@ const u = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?u
|
|
|
32
32
|
"json",
|
|
33
33
|
o,
|
|
34
34
|
{ property: "articles" }
|
|
35
|
-
)).json(),
|
|
35
|
+
)).json(), I = async (o) => await (await y(
|
|
36
36
|
f(o, "masterData"),
|
|
37
37
|
"json",
|
|
38
38
|
o,
|
|
39
39
|
{ property: "masterData" }
|
|
40
|
-
)).json(),
|
|
40
|
+
)).json(), h = async (o) => {
|
|
41
41
|
let t = await (await y(
|
|
42
42
|
f(o, "calc.js"),
|
|
43
43
|
"text",
|
|
@@ -49,11 +49,11 @@ const u = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?u
|
|
|
49
49
|
if (!t)
|
|
50
50
|
throw new Error("Script load error");
|
|
51
51
|
return t;
|
|
52
|
-
},
|
|
53
|
-
onLoadJavascript: (e) =>
|
|
52
|
+
}, T = (o) => ({
|
|
53
|
+
onLoadJavascript: (e) => h(o),
|
|
54
54
|
onLoadArticleCatalog: (e) => w(o),
|
|
55
|
-
onLoadMasterData: (e) =>
|
|
56
|
-
}),
|
|
55
|
+
onLoadMasterData: (e) => I(o)
|
|
56
|
+
}), j = async (o, e, t, s = {}) => {
|
|
57
57
|
const { baseUrl: n, om: r } = o.serverOptions ?? {}, a = encodeURIComponent(r?.endpointUrl || ""), c = encodeURIComponent(r?.subscriptionId || ""), p = r?.key || "";
|
|
58
58
|
return await (await fetch(
|
|
59
59
|
(n ?? u) + `${encodeURIComponent(t)}&subscriptionId=${c}&apiKey=${p}&baseUrl=${a}`,
|
|
@@ -66,7 +66,7 @@ const u = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?u
|
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
)).json();
|
|
69
|
-
},
|
|
69
|
+
}, g = async (o, e, t = {}) => {
|
|
70
70
|
const { baseUrl: s, om: n } = o.serverOptions ?? {}, r = encodeURIComponent(n?.endpointUrl || ""), a = encodeURIComponent(n?.subscriptionId || ""), c = n?.key || "";
|
|
71
71
|
return await (await fetch(
|
|
72
72
|
(s ?? u) + `${encodeURIComponent(e)}&subscriptionId=${a}&apiKey=${c}&baseUrl=${r}`,
|
|
@@ -80,10 +80,10 @@ const u = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?u
|
|
|
80
80
|
)).json();
|
|
81
81
|
};
|
|
82
82
|
let i = null;
|
|
83
|
-
const
|
|
83
|
+
const A = async (o, e = {}) => {
|
|
84
84
|
i && window.removeEventListener("message", i);
|
|
85
85
|
const t = typeof o == "string" ? { libraryId: o } : o;
|
|
86
|
-
e.onLoadJavascript === void 0 && (e.onLoadJavascript = (n) =>
|
|
86
|
+
e.onLoadJavascript === void 0 && (e.onLoadJavascript = (n) => h(t)), e.onLoadArticleCatalog === void 0 && (e.onLoadArticleCatalog = (n) => w(t)), e.onLoadMasterData === void 0 && (e.onLoadMasterData = (n) => I(t));
|
|
87
87
|
const { expose: s } = await import("./comlink-BAiXCcU9.mjs");
|
|
88
88
|
i = (n) => {
|
|
89
89
|
if (n.data.type === "connect_hi" && n.data.port) {
|
|
@@ -91,16 +91,21 @@ const T = async (o, e = {}) => {
|
|
|
91
91
|
r.start?.(), s(b(e), r);
|
|
92
92
|
}
|
|
93
93
|
}, window.addEventListener("message", i);
|
|
94
|
-
},
|
|
94
|
+
}, E = () => {
|
|
95
95
|
i && (window.removeEventListener("message", i), i = null);
|
|
96
|
+
}, _ = {
|
|
97
|
+
HIDE: "hide",
|
|
98
|
+
SHOW_ATTRIBUTES: "attributes",
|
|
99
|
+
SHOW_ARTICLES: "articles"
|
|
96
100
|
};
|
|
97
101
|
export {
|
|
98
|
-
|
|
99
|
-
|
|
102
|
+
_ as HI_PANEL_ACTION,
|
|
103
|
+
E as cleanupHi,
|
|
104
|
+
T as createHiLibraryCallbacks,
|
|
100
105
|
w as libLoadArticleCatalog,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
h as libLoadCalcScript,
|
|
107
|
+
I as libLoadMasterData,
|
|
108
|
+
g as omGetRequest,
|
|
109
|
+
j as omPostRequest,
|
|
110
|
+
A as setupHi
|
|
106
111
|
};
|
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=",a=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}},o={"e2fe8b3d-da31-4a20-92ab-ab6e3839300e":new Set(["Furniture_Smith"])},n=(e,t)=>{const{libraryId:a,serverOptions:n}=e;return n?.subscriptionId&&o[n.subscriptionId]?.has(a)?`api/pos/${t}?libraryId=${a}`:`api/pos/libraries/${a}/${t}`},s=async e=>await(await a(n(e,"articles"),"json",e,{property:"articles"})).json(),r=async e=>await(await a(n(e,"masterData"),"json",e,{property:"masterData"})).json(),i=async e=>{let t=await(await a(n(e,"calc.js"),"text",e,{property:"calc.js"})).text();if(!t)throw new Error("Script load error");return t},c=e=>({onLoadJavascript:t=>i(e),onLoadArticleCatalog:t=>s(e),onLoadMasterData:t=>r(e)}),p=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 l=null;const m=async(t,a={})=>{l&&window.removeEventListener("message",l);const o="string"==typeof t?{libraryId:t}:t;void 0===a.onLoadJavascript&&(a.onLoadJavascript=e=>i(o)),void 0===a.onLoadArticleCatalog&&(a.onLoadArticleCatalog=e=>s(o)),void 0===a.onLoadMasterData&&(a.onLoadMasterData=e=>r(o));const{expose:n}=await import("./comlink-CmT64Qi3.mjs");l=t=>{if("connect_hi"===t.data.type&&t.data.port){const o=t.data.port;o.start?.(),n(e(a),o)}},window.addEventListener("message",l)},u=()=>{l&&(window.removeEventListener("message",l),l=null)};export{u as cleanupHi,c as createHiLibraryCallbacks,s as libLoadArticleCatalog,i as libLoadCalcScript,r as libLoadMasterData,d as omGetRequest,p as omPostRequest,m as setupHi};
|
|
1
|
+
import{c as e}from"./utils-uEcN1DUR.mjs";const t="https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=",a=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}},o={"e2fe8b3d-da31-4a20-92ab-ab6e3839300e":new Set(["Furniture_Smith"])},n=(e,t)=>{const{libraryId:a,serverOptions:n}=e;return n?.subscriptionId&&o[n.subscriptionId]?.has(a)?`api/pos/${t}?libraryId=${a}`:`api/pos/libraries/${a}/${t}`},s=async e=>await(await a(n(e,"articles"),"json",e,{property:"articles"})).json(),r=async e=>await(await a(n(e,"masterData"),"json",e,{property:"masterData"})).json(),i=async e=>{let t=await(await a(n(e,"calc.js"),"text",e,{property:"calc.js"})).text();if(!t)throw new Error("Script load error");return t},c=e=>({onLoadJavascript:t=>i(e),onLoadArticleCatalog:t=>s(e),onLoadMasterData:t=>r(e)}),p=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 l=null;const m=async(t,a={})=>{l&&window.removeEventListener("message",l);const o="string"==typeof t?{libraryId:t}:t;void 0===a.onLoadJavascript&&(a.onLoadJavascript=e=>i(o)),void 0===a.onLoadArticleCatalog&&(a.onLoadArticleCatalog=e=>s(o)),void 0===a.onLoadMasterData&&(a.onLoadMasterData=e=>r(o));const{expose:n}=await import("./comlink-CmT64Qi3.mjs");l=t=>{if("connect_hi"===t.data.type&&t.data.port){const o=t.data.port;o.start?.(),n(e(a),o)}},window.addEventListener("message",l)},u=()=>{l&&(window.removeEventListener("message",l),l=null)},y={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"};export{y as HI_PANEL_ACTION,u as cleanupHi,c as createHiLibraryCallbacks,s as libLoadArticleCatalog,i as libLoadCalcScript,r as libLoadMasterData,d as omGetRequest,p as omPostRequest,m as setupHi};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.2",
|
|
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",
|
|
@@ -14,3 +14,4 @@ export { createHiLibraryCallbacks } from './homag-intelligence/hi-callbacks';
|
|
|
14
14
|
export { libLoadArticleCatalog, libLoadMasterData, libLoadCalcScript, } from './homag-intelligence/hi-requests';
|
|
15
15
|
export { omPostRequest, omGetRequest, } from './homag-intelligence/hi-order-manager';
|
|
16
16
|
export { setupHi, cleanupHi } from './homag-intelligence/hi-setup';
|
|
17
|
+
export { HI_PANEL_ACTION, type HiPanelActionType, type HiOrderHeader, type HiOrder, type HiOrderData, type HiPriceData, type HiCallbacks, } from '../../common/src/hi/hi-types';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
|
|
2
|
-
import { HiCallbacks } from '
|
|
2
|
+
import { HiCallbacks } from '../../../common/src/hi/hi-types';
|
|
3
3
|
export declare const createHiLibraryCallbacks: (hiInitData: HomagIntelligenceInitData) => HiCallbacks;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HiCallbacks } from '
|
|
1
|
+
import { HiCallbacks } from '../../../common/src/hi/hi-types';
|
|
2
2
|
import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
|
|
3
3
|
export declare const setupHi: (libraryIdOrOptions: HomagIntelligenceInitData | string, callbacks?: Partial<HiCallbacks>) => Promise<void>;
|
|
4
4
|
export declare const cleanupHi: () => void;
|
|
@@ -3,7 +3,7 @@ import { PossibleCustomViews } from '../../../src/configurator/embedding/custom-
|
|
|
3
3
|
import { ConfiguratorUiCallbacks, RoomleConfigurator, RoomleGLBViewer, RoomlePlanner } from '../../web-sdk/packages';
|
|
4
4
|
import { DragIn } from './plugins/drag-in';
|
|
5
5
|
import { Connector, RoomleEmbeddingApiKeys } from './connector';
|
|
6
|
-
import { HiCallbacks } from '
|
|
6
|
+
import { HiCallbacks } from '../../common/src/hi/hi-types';
|
|
7
7
|
export declare const NAMESPACE: {
|
|
8
8
|
[key: string]: keyof RoomleEmbeddingApiKeys | 'callbacks';
|
|
9
9
|
};
|
package/roomle-embedding-lib.js
CHANGED
|
@@ -150,7 +150,7 @@ const F = () => {
|
|
|
150
150
|
}
|
|
151
151
|
return s;
|
|
152
152
|
};
|
|
153
|
-
var
|
|
153
|
+
var L = /* @__PURE__ */ ((s) => (s.BOTTOM_BAR = "bottom_bar", s.PARTLIST_BOUNDS = "partlist_bounds", s.INTERACTION_NOTES = "interaction_notes", s.PARAMETER_GROUPS = "parameter_groups", s))(L || {});
|
|
154
154
|
const J = (s) => JSON.parse(JSON.stringify(s)), K = {
|
|
155
155
|
mobileLandscape: !0,
|
|
156
156
|
floorMaterialRootTag: "materials_root",
|
|
@@ -162,7 +162,7 @@ const J = (s) => JSON.parse(JSON.stringify(s)), K = {
|
|
|
162
162
|
partlist_print: !0
|
|
163
163
|
},
|
|
164
164
|
elements: {
|
|
165
|
-
[
|
|
165
|
+
[L.INTERACTION_NOTES]: !0
|
|
166
166
|
},
|
|
167
167
|
helpcenter: {
|
|
168
168
|
roomdesigner: !0,
|
|
@@ -176,7 +176,8 @@ const J = (s) => JSON.parse(JSON.stringify(s)), K = {
|
|
|
176
176
|
wallAutoHeight: !1,
|
|
177
177
|
openCloseAnimation: !0,
|
|
178
178
|
enableTwoLevelCatalog: !1,
|
|
179
|
-
webGpu: !1
|
|
179
|
+
webGpu: !1,
|
|
180
|
+
localExport3d: !1
|
|
180
181
|
},
|
|
181
182
|
rotationSnapDegrees: 10,
|
|
182
183
|
interactionsCollapsed: !1
|
|
@@ -206,7 +207,7 @@ const J = (s) => JSON.parse(JSON.stringify(s)), K = {
|
|
|
206
207
|
}, q = "<CONF_ID>", Q = "#CONFIGURATIONID#", X = (s) => {
|
|
207
208
|
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);
|
|
208
209
|
}, M = () => /(android)/i.test(navigator.userAgent);
|
|
209
|
-
class
|
|
210
|
+
class y {
|
|
210
211
|
_messageHandler = null;
|
|
211
212
|
isSetupDone = !1;
|
|
212
213
|
viewName = "main";
|
|
@@ -296,7 +297,7 @@ class R {
|
|
|
296
297
|
);
|
|
297
298
|
}
|
|
298
299
|
}
|
|
299
|
-
const
|
|
300
|
+
const R = () => {
|
|
300
301
|
let s, e;
|
|
301
302
|
return { promise: new Promise((r, o) => {
|
|
302
303
|
s = r, e = o;
|
|
@@ -363,7 +364,7 @@ const y = () => {
|
|
|
363
364
|
() => s.style.setProperty(O, H()),
|
|
364
365
|
0
|
|
365
366
|
);
|
|
366
|
-
},
|
|
367
|
+
}, b = "rml-styles", se = 450, O = "--rml-full-height", c = {
|
|
367
368
|
CONTAINER: "rml-container",
|
|
368
369
|
FILL: "rml-fill",
|
|
369
370
|
POSITION: "rml-pos",
|
|
@@ -371,7 +372,7 @@ const y = () => {
|
|
|
371
372
|
ANDROID_HEIGHT: "rml-android-height",
|
|
372
373
|
OVERFLOW_HIDDEN: "rml-overflow-hidden"
|
|
373
374
|
}, _ = /* @__PURE__ */ new Map();
|
|
374
|
-
class ae extends
|
|
375
|
+
class ae extends y {
|
|
375
376
|
static createPlanner(e, t, r, o = []) {
|
|
376
377
|
return this._create(
|
|
377
378
|
e,
|
|
@@ -381,9 +382,9 @@ class ae extends R {
|
|
|
381
382
|
);
|
|
382
383
|
}
|
|
383
384
|
static async connect(e, t = []) {
|
|
384
|
-
const r = new
|
|
385
|
+
const r = new y();
|
|
385
386
|
r.viewName = e;
|
|
386
|
-
const { resolve: o, promise: n } =
|
|
387
|
+
const { resolve: o, promise: n } = R(), { resolve: a, promise: i } = R(), l = ({
|
|
387
388
|
message: g,
|
|
388
389
|
args: m
|
|
389
390
|
}) => {
|
|
@@ -462,7 +463,7 @@ class ae extends R {
|
|
|
462
463
|
static setupHi(e) {
|
|
463
464
|
console.warn(
|
|
464
465
|
`[DEPRECATED] RoomleEmbeddingApi.setupHi() is deprecated and will be removed.
|
|
465
|
-
Migration: import { setupHi } from '@roomle/embedding-lib/hi'; setupHi(callbacks);`
|
|
466
|
+
Migration: import { setupHi } from '@roomle/embedding-lib/hi'; setupHi(libraryIdOrOptions, callbacks);`
|
|
466
467
|
), this.hiMessageHandler && window.removeEventListener("message", this.hiMessageHandler), this.hiMessageHandler = (t) => {
|
|
467
468
|
if (t.data.type === "connect_hi" && t.data.port) {
|
|
468
469
|
const r = t.data.port;
|
|
@@ -508,9 +509,9 @@ Migration: import { setupHi } from '@roomle/embedding-lib/hi'; setupHi(callbacks
|
|
|
508
509
|
);
|
|
509
510
|
if (_.has(t))
|
|
510
511
|
throw new Error("There is already an instance on this DOM element");
|
|
511
|
-
if (!!!document.getElementById(
|
|
512
|
+
if (!!!document.getElementById(b)) {
|
|
512
513
|
const u = r.zIndex || 9999999, d = document.createElement("style");
|
|
513
|
-
d.type = "text/css", d.id =
|
|
514
|
+
d.type = "text/css", d.id = b;
|
|
514
515
|
const g = "transition:all ease-in-out " + se + "ms;", m = ["-webkit-", "-o-"].reduce(
|
|
515
516
|
(v, P) => v += P + g,
|
|
516
517
|
""
|
|
@@ -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)=>{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},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 g=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},d={SDK:"extended",CONFIGURATOR_SDK:"configurator",CALLBACKS:"callbacks",UI:"ui",ANALYTICS:"analytics",GLOBAL:"global",RAPI:"rapi"},h=".",m=d.SDK+h+d.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?d.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},b="data-rml-interaction-container",y=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},M=()=>.01*window.innerHeight+"px",T=e=>{e&&setTimeout(()=>e.style.setProperty(A,M()),0)},v="rml-styles",A="--rml-full-height",O="rml-container",L="rml-fill",N="rml-pos",I="rml-android-height",R="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 r=new u;r.viewName=e;const{resolve:i,promise:a}=g(),{resolve:n,promise:o}=g(),l=new s("custom-view-"+e,window,window.parent,({message:e,args:t})=>{switch(e){case _.REGISTER_CUSTOM_VIEW_DONE:i();break;case _.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(_.REGISTER_CUSTOM_VIEW,c),await a,l.sendMessage(_.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,n){return new Promise(async(c,u)=>{try{const u=a((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(o);e.locale||(e.locale=((e=null)=>{const t=window.navigator;if(e)return e.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,s=i.length;e<s;e++){const s=t[i[e]];if(s)return s.substr(0,2)}return"en"})()),"(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=>!!(r.includes(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})(),(l(g=s),g?.customApiUrl&&(g.customApiUrl=decodeURIComponent(g.customApiUrl)),g.shareUrl&&(g.deeplink=g.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),g));(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 d=await S(e,u);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 a(s,t)})(s,t)})(d,u);const h=new this(d,t,s,n,c);return await Promise.allSettled(h.pluginsLoaded),h}catch(e){return u(e)}var g})}_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(C.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(v)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=v;const s="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,a=M();t.innerHTML=`\n .${O}{${A}:${a};}\n .${N}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${L}{width:100%;height:100%;opacity:1}\n .${I}{height:calc(var(${A},1vh)*100)}\n .${R}{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),c()&&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),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(O),e.classList.add(L),e}_onResize(){T(this._iframe)}_onUseFullPage(){this._iframe.classList.add(N),document.documentElement.classList.add(R),window.document.body.classList.add(R),c()&&(T(this._iframe),this._iframe.classList.add(I))}_onBackToWebsite(){this._iframe.classList.remove(N),this._iframe.classList.remove(I),document.documentElement.classList.remove(R),window.document.body.classList.remove(R)}_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]),y(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),y(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,b as INTERACTION_CONTAINER_SELECTOR,d 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};
|
|
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)=>{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 g=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},d={SDK:"extended",CONFIGURATOR_SDK:"configurator",CALLBACKS:"callbacks",UI:"ui",ANALYTICS:"analytics",GLOBAL:"global",RAPI:"rapi"},h=".",m=d.SDK+h+d.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?d.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},b="data-rml-interaction-container",y=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},M=()=>.01*window.innerHeight+"px",T=e=>{e&&setTimeout(()=>e.style.setProperty(A,M()),0)},v="rml-styles",A="--rml-full-height",O="rml-container",L="rml-fill",N="rml-pos",I="rml-android-height",R="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 r=new u;r.viewName=e;const{resolve:i,promise:a}=g(),{resolve:n,promise:o}=g(),l=new s("custom-view-"+e,window,window.parent,({message:e,args:t})=>{switch(e){case _.REGISTER_CUSTOM_VIEW_DONE:i();break;case _.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(_.REGISTER_CUSTOM_VIEW,c),await a,l.sendMessage(_.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,n){return new Promise(async(c,u)=>{try{const u=a((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(o);e.locale||(e.locale=((e=null)=>{const t=window.navigator;if(e)return e.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,s=i.length;e<s;e++){const s=t[i[e]];if(s)return s.substr(0,2)}return"en"})()),"(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=>!!(r.includes(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})(),(l(g=s),g?.customApiUrl&&(g.customApiUrl=decodeURIComponent(g.customApiUrl)),g.shareUrl&&(g.deeplink=g.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),g));(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 d=await S(e,u);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 a(s,t)})(s,t)})(d,u);const h=new this(d,t,s,n,c);return await Promise.allSettled(h.pluginsLoaded),h}catch(e){return u(e)}var g})}_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(C.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(v)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=v;const s="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,a=M();t.innerHTML=`\n .${O}{${A}:${a};}\n .${N}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${L}{width:100%;height:100%;opacity:1}\n .${I}{height:calc(var(${A},1vh)*100)}\n .${R}{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),c()&&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),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(O),e.classList.add(L),e}_onResize(){T(this._iframe)}_onUseFullPage(){this._iframe.classList.add(N),document.documentElement.classList.add(R),window.document.body.classList.add(R),c()&&(T(this._iframe),this._iframe.classList.add(I))}_onBackToWebsite(){this._iframe.classList.remove(N),this._iframe.classList.remove(I),document.documentElement.classList.remove(R),window.document.body.classList.remove(R)}_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]),y(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),y(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,b as INTERACTION_CONTAINER_SELECTOR,d 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};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { MasterData, PosGroup, PosSaveData } from '../../web-sdk/packages';
|
|
2
|
-
export declare const HI_PANEL_ACTION: {
|
|
3
|
-
readonly HIDE: "hide";
|
|
4
|
-
readonly SHOW_ATTRIBUTES: "attributes";
|
|
5
|
-
readonly SHOW_ARTICLES: "articles";
|
|
6
|
-
};
|
|
7
|
-
export type HiPanelActionType = (typeof HI_PANEL_ACTION)[keyof typeof HI_PANEL_ACTION];
|
|
8
|
-
export interface HiCallbacks {
|
|
9
|
-
/**
|
|
10
|
-
* Requests the calculation script for the given library ID.
|
|
11
|
-
* @param libraryId the ID of the library for which the calculation script is requested
|
|
12
|
-
* @returns the calculation script as a string
|
|
13
|
-
*/
|
|
14
|
-
onLoadJavascript: (libraryId: string) => Promise<string>;
|
|
15
|
-
/**
|
|
16
|
-
* Requests the master data for the given library ID.
|
|
17
|
-
* @param libraryId the ID of the library for which the master data is requested
|
|
18
|
-
* @returns the master data as a Promise
|
|
19
|
-
*/
|
|
20
|
-
onLoadMasterData: (libraryId: string) => Promise<MasterData>;
|
|
21
|
-
/**
|
|
22
|
-
* Requests the article catalog for the given library ID.
|
|
23
|
-
* @param libraryId the ID of the library for which the article catalog is requested
|
|
24
|
-
* @returns the article catalog as a Promise
|
|
25
|
-
*/
|
|
26
|
-
onLoadArticleCatalog: (libraryId: string) => Promise<any>;
|
|
27
|
-
/**
|
|
28
|
-
* Notifies the host application that a price calculation should be performed.
|
|
29
|
-
* @param posGroups all groups in the plan
|
|
30
|
-
*/
|
|
31
|
-
onPriceCalc?: (posGroups: PosGroup[]) => Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Retrieves the current external load data which has to be used to replace the existing groups in the plan.
|
|
34
|
-
* @returns load data or null if no replacement is needed
|
|
35
|
-
*/
|
|
36
|
-
onGetSavedPosGroupData?: () => Promise<PosSaveData | null>;
|
|
37
|
-
/**
|
|
38
|
-
* "onCompletelyLoaded" is invoked when the groups in the plan are completely loaded.
|
|
39
|
-
*/
|
|
40
|
-
onPosGroupsCompletelyLoaded?: () => void;
|
|
41
|
-
/**
|
|
42
|
-
* "onPosGroupAdded" is invoked when a new group was created. (e.g. duplicate object)
|
|
43
|
-
* @param groupData The new group data JSON.
|
|
44
|
-
*/
|
|
45
|
-
onPosGroupAdded?: (posGroups: PosGroup[]) => Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* "onPosGroupChanged" is invoked when a new group was modified and recalculated. (e.g. split, merge, change, attribute)
|
|
48
|
-
*
|
|
49
|
-
* @param groupData The new group data JSON.
|
|
50
|
-
*/
|
|
51
|
-
onPosGroupChanged?: (posGroups: PosGroup[]) => Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* "onPosGroupDeleted" is invoked when a group was delete. (e.g. delete button in scene)
|
|
54
|
-
* @param groupData The ID of the group which was deleted.
|
|
55
|
-
*/
|
|
56
|
-
onPosGroupDeleted?: (posGroupIds: string[]) => Promise<void>;
|
|
57
|
-
/**
|
|
58
|
-
* "onShowHidePanel" is invoked when a the content of the side panel should be changed or hidden.
|
|
59
|
-
* @param panel The panel to show or hide.
|
|
60
|
-
* @param posGroupId Optional ID of the selected group in case of SHOW_ATTRIBUTES.
|
|
61
|
-
* @param rootModuleId Optional ID of the selected root module in case of SHOW_ATTRIBUTES.
|
|
62
|
-
* @param subModuleId Optional ID of the selected sub module in case of SHOW_ATTRIBUTES.
|
|
63
|
-
*/
|
|
64
|
-
onShowHidePanel?: (panel: HiPanelActionType, posGroupId?: string, rootModuleId?: string, subModuleId?: string) => void;
|
|
65
|
-
/**
|
|
66
|
-
* "onSelectModule" is invoked when a the selected object in the scene was changed.
|
|
67
|
-
* @param posGroupId ID of the selected group
|
|
68
|
-
* @param rootModuleId ID of the selected root module
|
|
69
|
-
* @param subModuleId Optional id of the selected sub module
|
|
70
|
-
*/
|
|
71
|
-
onSelectModule?: (posGroupId: string, rootModuleId: string, subModuleId?: string) => void;
|
|
72
|
-
/**
|
|
73
|
-
* Request the price for the given order data.
|
|
74
|
-
* @param orderData order data
|
|
75
|
-
* @returns price data
|
|
76
|
-
*/
|
|
77
|
-
onFetchPrice?: (orderData: any) => Promise<any>;
|
|
78
|
-
/**
|
|
79
|
-
* "onPlaceOrder" is invoked when the user wants to place an order.
|
|
80
|
-
* You can use this to send the order data to Order Manager or to a 3rd party service.
|
|
81
|
-
* @param orderData
|
|
82
|
-
*/
|
|
83
|
-
onPlaceOrder?: (orderData: any) => Promise<void>;
|
|
84
|
-
/**
|
|
85
|
-
* "onLogMessage" is invoked when the Homag Intelligence library wants to log a message.
|
|
86
|
-
* You can use this to log messages in your own UI.
|
|
87
|
-
* @param area
|
|
88
|
-
* @param message
|
|
89
|
-
*/
|
|
90
|
-
onLogMessage?: (area: string, message: string) => void;
|
|
91
|
-
}
|