@roomle/embedding-lib 5.25.0-alpha.3 → 5.25.0-alpha.5
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/drag-in-DTA1FCDc.mjs +1 -0
- package/drag-in-DuufO5eB.mjs +138 -0
- package/from-custom-view-BdnViEhf.mjs +163 -0
- package/from-custom-view-DIYHP31u.mjs +1 -0
- package/from-website-CcDHgCCy.mjs +1 -0
- package/from-website-CktA6Icy.mjs +201 -0
- package/package.json +1 -1
- package/packages/web-sdk/packages/common-core/src/static-files/environment-maps.d.ts +6 -4
- package/packages/web-sdk/packages/common-core/src/static-files/libs.d.ts +3 -1
- package/packages/web-sdk/packages/common-core/src/static-files/light-settings.d.ts +8 -6
- package/packages/web-sdk/packages/common-core/src/static-files/luts.d.ts +11 -9
- package/packages/web-sdk/packages/common-core/src/static-files/roomle-core.d.ts +8 -6
- package/packages/web-sdk/packages/common-core/src/webgl/renderer/pass/gbuffer-render-pass.d.ts +1 -1
- package/packages/web-sdk/packages/configurator-core/src/roomle-configurator.d.ts +13 -0
- package/packages/web-sdk/packages/configurator-core/src/static-files/fonts.d.ts +4 -2
- package/packages/web-sdk/packages/configurator-core/src/static-files/geometries.d.ts +3 -1
- package/packages/web-sdk/packages/configurator-core/src/static-files/settings.d.ts +3 -1
- package/packages/web-sdk/packages/configurator-core/src/static-files/textures.d.ts +3 -1
- package/packages/web-sdk/packages/configurator-core/src/utils/animation/animation-value-map.d.ts +1 -0
- package/packages/web-sdk/packages/configurator-core/src/utils/component-dimensioning-helper.d.ts +3 -3
- package/packages/web-sdk/packages/configurator-core/src/utils/dimensioning-helper.d.ts +1 -0
- package/packages/web-sdk/packages/configurator-core/src/webgl/configurator-scene-manager.d.ts +4 -0
- package/packages/web-sdk/packages/workers/src/static-files/workers.d.ts +4 -2
- package/roomle-embedding-lib.es.js +306 -316
- package/roomle-embedding-lib.es.min.js +1 -1
- package/roomle-embedding-lib.umd.js +17 -17
- package/roomle-embedding-lib.umd.min.js +1 -1
- package/touch-drag-B5zCf87J.mjs +1 -0
- package/touch-drag-DXJTOrk5.mjs +146 -0
- package/drag-in-CqBNfbIX.mjs +0 -142
- package/drag-in-ltdVSMsI.mjs +0 -1
- package/from-custom-view-Bg3_d6Sp.mjs +0 -1
- package/from-custom-view-V503ai3X.mjs +0 -167
- package/from-website-BAX9bdN9.mjs +0 -210
- package/from-website-DsBWpkdv.mjs +0 -1
- package/packages/web-sdk/packages/vite-plugins/vite-plugin-auto-workers.d.ts +0 -8
- package/packages/web-sdk/packages/vite-plugins/vite-plugin-bundle-sw.d.ts +0 -10
- package/touch-drag-BEct6jbW.mjs +0 -1
- package/touch-drag-DNDPwZ-_.mjs +0 -149
|
@@ -1,192 +1,187 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
c(this, "_outgoingMessageBus", null);
|
|
10
|
-
c(this, "_execMessage", null);
|
|
11
|
-
this._side = t, this._incomingMessageBus = s, this._outgoingMessageBus = o, this._execMessage = r, this._incomingMessageBus && this._incomingMessageBus.addEventListener(
|
|
1
|
+
class S {
|
|
2
|
+
_side;
|
|
3
|
+
// for better debugging (who handles message? iframe or website?)
|
|
4
|
+
_incomingMessageBus = null;
|
|
5
|
+
_outgoingMessageBus = null;
|
|
6
|
+
_execMessage = null;
|
|
7
|
+
constructor(e, t, r, n) {
|
|
8
|
+
this._side = e, this._incomingMessageBus = t, this._outgoingMessageBus = r, this._execMessage = n, this._incomingMessageBus && this._incomingMessageBus.addEventListener(
|
|
12
9
|
"message",
|
|
13
10
|
this._handleMessage.bind(this)
|
|
14
11
|
);
|
|
15
12
|
}
|
|
16
|
-
setOutgoingMessageBus(
|
|
17
|
-
this._outgoingMessageBus =
|
|
13
|
+
setOutgoingMessageBus(e) {
|
|
14
|
+
this._outgoingMessageBus = e;
|
|
18
15
|
}
|
|
19
|
-
setMessageExecution(
|
|
20
|
-
this._execMessage =
|
|
16
|
+
setMessageExecution(e) {
|
|
17
|
+
this._execMessage = e;
|
|
21
18
|
}
|
|
22
|
-
sendMessage(
|
|
23
|
-
return new Promise((
|
|
19
|
+
sendMessage(e, t = []) {
|
|
20
|
+
return new Promise((r, n) => {
|
|
24
21
|
if (this._incomingMessageBus === this._outgoingMessageBus)
|
|
25
|
-
return
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
if (!
|
|
29
|
-
return
|
|
22
|
+
return r(void 0);
|
|
23
|
+
const i = new MessageChannel();
|
|
24
|
+
i.port1.onmessage = (o) => {
|
|
25
|
+
if (!o || !o.data)
|
|
26
|
+
return i.port1.close(), i.port2.close(), n(
|
|
30
27
|
new Error(
|
|
31
28
|
this._side + " received message but response can not be interpreted"
|
|
32
29
|
)
|
|
33
30
|
);
|
|
34
31
|
let l;
|
|
35
32
|
try {
|
|
36
|
-
l = JSON.parse(
|
|
37
|
-
} catch (
|
|
38
|
-
return
|
|
33
|
+
l = JSON.parse(o.data);
|
|
34
|
+
} catch (u) {
|
|
35
|
+
return i.port1.close(), i.port2.close(), this._prepareError(u), n(u);
|
|
39
36
|
}
|
|
40
|
-
l.error ?
|
|
37
|
+
l.error ? n(l.error) : l.result !== void 0 ? r(l.result) : r(void 0), i.port1.close(), i.port2.close();
|
|
41
38
|
};
|
|
42
39
|
let a = "";
|
|
43
40
|
try {
|
|
44
|
-
a = JSON.stringify({ message:
|
|
41
|
+
a = JSON.stringify({ message: e, args: t });
|
|
45
42
|
} catch {
|
|
46
|
-
return
|
|
43
|
+
return n(
|
|
47
44
|
new Error(
|
|
48
45
|
this._side + ": can not create command because it is not JSON.stringify able"
|
|
49
46
|
)
|
|
50
47
|
);
|
|
51
48
|
}
|
|
52
49
|
if (!this._outgoingMessageBus)
|
|
53
|
-
return
|
|
50
|
+
return n(new Error(this._side + ": outgoing bus not set yet"));
|
|
54
51
|
this._outgoingMessageBus.postMessage(a, "*", [
|
|
55
|
-
|
|
52
|
+
i.port2
|
|
56
53
|
]);
|
|
57
54
|
});
|
|
58
55
|
}
|
|
59
|
-
_handleMessage(
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
56
|
+
_handleMessage(e) {
|
|
57
|
+
const t = e.ports && Array.isArray(e.ports) && e.ports.length > 0 ? e.ports[0] : null;
|
|
58
|
+
if (e.data && t)
|
|
62
59
|
try {
|
|
63
|
-
const
|
|
60
|
+
const r = JSON.parse(e.data);
|
|
64
61
|
if (!this._execMessage)
|
|
65
|
-
return
|
|
62
|
+
return t.postMessage(
|
|
66
63
|
JSON.stringify({
|
|
67
64
|
error: this._side + " is not ready to handle messages"
|
|
68
65
|
})
|
|
69
66
|
);
|
|
70
|
-
Array.isArray(
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
67
|
+
Array.isArray(r.args) || (r.args = [r.args]);
|
|
68
|
+
const n = this._execMessage(r, e);
|
|
69
|
+
if (n === void 0)
|
|
73
70
|
return;
|
|
74
|
-
|
|
75
|
-
(
|
|
76
|
-
let a,
|
|
77
|
-
typeof
|
|
71
|
+
n.then(
|
|
72
|
+
(i = {}) => {
|
|
73
|
+
let a, o;
|
|
74
|
+
typeof i == "object" && i !== null && (a = i.error, o = i.result), a ? t.postMessage(
|
|
78
75
|
JSON.stringify({ error: a })
|
|
79
|
-
) :
|
|
76
|
+
) : o !== void 0 ? t.postMessage(
|
|
77
|
+
JSON.stringify({ result: o })
|
|
78
|
+
) : t.postMessage(
|
|
80
79
|
JSON.stringify({ result: i })
|
|
81
|
-
) : s.postMessage(
|
|
82
|
-
JSON.stringify({ result: n })
|
|
83
80
|
);
|
|
84
81
|
},
|
|
85
|
-
(
|
|
86
|
-
|
|
82
|
+
(i) => {
|
|
83
|
+
t.postMessage(
|
|
87
84
|
JSON.stringify({
|
|
88
|
-
error: this._prepareError(
|
|
85
|
+
error: this._prepareError(i)
|
|
89
86
|
})
|
|
90
87
|
);
|
|
91
88
|
}
|
|
92
89
|
);
|
|
93
|
-
} catch (
|
|
94
|
-
|
|
90
|
+
} catch (r) {
|
|
91
|
+
t.postMessage(
|
|
95
92
|
JSON.stringify({
|
|
96
|
-
error: this._prepareError(
|
|
93
|
+
error: this._prepareError(r)
|
|
97
94
|
})
|
|
98
95
|
);
|
|
99
96
|
}
|
|
100
97
|
}
|
|
101
|
-
_prepareError(
|
|
102
|
-
if (typeof
|
|
103
|
-
const
|
|
104
|
-
return console.error(
|
|
98
|
+
_prepareError(e) {
|
|
99
|
+
if (typeof e == "string") {
|
|
100
|
+
const t = this._side + ": " + e;
|
|
101
|
+
return console.error(t), t;
|
|
105
102
|
}
|
|
106
|
-
return
|
|
103
|
+
return e.message = this._side + ": " + e.message, console.error(e), e.message;
|
|
107
104
|
}
|
|
108
105
|
}
|
|
109
|
-
const
|
|
106
|
+
const f = ".", _ = {
|
|
110
107
|
REQUEST_BOOT: "requestBoot",
|
|
111
108
|
SETUP: "setup",
|
|
112
109
|
WEBSITE_READY: "websiteReady"
|
|
113
|
-
},
|
|
110
|
+
}, m = {
|
|
114
111
|
GET_METHODS: "getMethods",
|
|
115
112
|
RETURN_METHODS: "returnMethods",
|
|
116
113
|
REGISTER_CUSTOM_VIEW: "registerCustomView",
|
|
117
114
|
REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
|
|
118
|
-
},
|
|
119
|
-
if (typeof
|
|
115
|
+
}, C = async (s, e) => {
|
|
116
|
+
if (typeof s != "string")
|
|
120
117
|
throw new Error(
|
|
121
|
-
'Configurator ID is not a string type: "' + typeof
|
|
118
|
+
'Configurator ID is not a string type: "' + typeof s + '"'
|
|
122
119
|
);
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
apiKey:
|
|
126
|
-
currentTenant:
|
|
120
|
+
const t = e.customApiUrl ? e.customApiUrl : "https://api.roomle.com/v2", r = e.overrideTenant || 9, n = t + "/configurators/" + s, i = "roomle_portal_v2", a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;" + i), o = () => {
|
|
121
|
+
const g = {
|
|
122
|
+
apiKey: i,
|
|
123
|
+
currentTenant: r,
|
|
127
124
|
locale: "en",
|
|
128
125
|
language: "en",
|
|
129
126
|
device: 1,
|
|
130
127
|
token: a,
|
|
131
128
|
platform: "web"
|
|
132
129
|
};
|
|
133
|
-
return new Headers(
|
|
134
|
-
}, l = new Request(
|
|
130
|
+
return new Headers(g);
|
|
131
|
+
}, l = new Request(n, {
|
|
135
132
|
method: "GET",
|
|
136
|
-
headers:
|
|
133
|
+
headers: o(),
|
|
137
134
|
mode: "cors",
|
|
138
135
|
cache: "default"
|
|
139
|
-
}),
|
|
140
|
-
return
|
|
141
|
-
},
|
|
136
|
+
}), u = await fetch(l), { configurator: d } = await u.json();
|
|
137
|
+
return d;
|
|
138
|
+
}, D = () => {
|
|
142
139
|
try {
|
|
143
140
|
return window.self !== window.top;
|
|
144
141
|
} catch {
|
|
145
142
|
return !0;
|
|
146
143
|
}
|
|
147
|
-
},
|
|
148
|
-
const
|
|
149
|
-
let
|
|
150
|
-
if (
|
|
144
|
+
}, F = ["127.0.0.1", "localhost", "0.0.0.0"], B = () => {
|
|
145
|
+
const s = D();
|
|
146
|
+
let e = window.location.href;
|
|
147
|
+
if (s) {
|
|
151
148
|
if (!document.referrer)
|
|
152
149
|
return null;
|
|
153
|
-
|
|
150
|
+
e = document.referrer;
|
|
154
151
|
}
|
|
155
|
-
const { hostname:
|
|
156
|
-
return
|
|
157
|
-
},
|
|
152
|
+
const { hostname: t } = new URL(e);
|
|
153
|
+
return t;
|
|
154
|
+
}, U = (s) => !!(F.includes(s) || s.endsWith("roomle.com") || s.endsWith("gitlab.io") || s.endsWith("gitlab.com")), T = [
|
|
158
155
|
"language",
|
|
159
156
|
"browserLanguage",
|
|
160
157
|
"userLanguage",
|
|
161
158
|
"systemLanguage"
|
|
162
|
-
],
|
|
163
|
-
const
|
|
164
|
-
if (
|
|
165
|
-
return
|
|
166
|
-
if (Array.isArray(
|
|
167
|
-
return
|
|
168
|
-
for (let
|
|
169
|
-
const
|
|
170
|
-
if (
|
|
171
|
-
return
|
|
159
|
+
], W = (s = null) => {
|
|
160
|
+
const e = window.navigator;
|
|
161
|
+
if (s)
|
|
162
|
+
return s.substr(0, 2);
|
|
163
|
+
if (Array.isArray(e.languages) && e.languages.length > 0)
|
|
164
|
+
return e.languages[0].substr(0, 2);
|
|
165
|
+
for (let t = 0, r = T.length; t < r; t++) {
|
|
166
|
+
const n = e[T[t]];
|
|
167
|
+
if (n)
|
|
168
|
+
return n.substr(0, 2);
|
|
172
169
|
}
|
|
173
170
|
return "en";
|
|
174
|
-
},
|
|
175
|
-
const
|
|
176
|
-
return
|
|
177
|
-
},
|
|
178
|
-
for (const
|
|
171
|
+
}, x = (s, e) => {
|
|
172
|
+
const t = JSON.parse(JSON.stringify(s));
|
|
173
|
+
return O(t, e);
|
|
174
|
+
}, O = (s, e) => {
|
|
175
|
+
for (const t in e)
|
|
179
176
|
try {
|
|
180
|
-
t
|
|
177
|
+
e[t].constructor === Object ? s[t] = O(s[t], e[t]) : s[t] = e[t];
|
|
181
178
|
} catch {
|
|
182
|
-
|
|
179
|
+
s[t] = e[t];
|
|
183
180
|
}
|
|
184
|
-
return
|
|
181
|
+
return s;
|
|
185
182
|
};
|
|
186
|
-
var
|
|
187
|
-
const
|
|
188
|
-
var z = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 };
|
|
189
|
-
const Y = {
|
|
183
|
+
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 || {});
|
|
184
|
+
const k = (s) => JSON.parse(JSON.stringify(s)), G = {
|
|
190
185
|
mobileLandscape: !0,
|
|
191
186
|
floorMaterialRootTag: "materials_root",
|
|
192
187
|
buttons: {
|
|
@@ -197,7 +192,7 @@ const Y = {
|
|
|
197
192
|
partlist_print: !0
|
|
198
193
|
},
|
|
199
194
|
elements: {
|
|
200
|
-
[
|
|
195
|
+
[b.INTERACTION_NOTES]: !0
|
|
201
196
|
},
|
|
202
197
|
helpcenter: {
|
|
203
198
|
roomdesigner: !0,
|
|
@@ -213,241 +208,199 @@ const Y = {
|
|
|
213
208
|
},
|
|
214
209
|
rotationSnapDegrees: 10,
|
|
215
210
|
interactionsCollapsed: !1
|
|
216
|
-
},
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
)),
|
|
220
|
-
if (!
|
|
211
|
+
}, J = "(idle)", V = (s) => (E(s), s?.customApiUrl && (s.customApiUrl = decodeURIComponent(s.customApiUrl)), s.shareUrl && (s.deeplink = s.shareUrl.replace(
|
|
212
|
+
Y,
|
|
213
|
+
q
|
|
214
|
+
)), s), E = (s) => {
|
|
215
|
+
if (!s)
|
|
221
216
|
return;
|
|
222
|
-
const
|
|
223
|
-
for (const
|
|
224
|
-
const
|
|
225
|
-
if (!Array.isArray(
|
|
226
|
-
for (const
|
|
227
|
-
|
|
228
|
-
(
|
|
217
|
+
const e = Object.keys(s);
|
|
218
|
+
for (const t of e) {
|
|
219
|
+
const r = s[t];
|
|
220
|
+
if (!Array.isArray(r) && typeof r == "object" && r !== null && E(r), Array.isArray(r))
|
|
221
|
+
for (const n of r)
|
|
222
|
+
E(n);
|
|
223
|
+
(r === "true" || r === "false") && (s[t] = r === "true");
|
|
229
224
|
}
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
return !
|
|
234
|
-
},
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
const
|
|
238
|
-
return
|
|
239
|
-
},
|
|
240
|
-
|
|
225
|
+
}, $ = (s, e) => {
|
|
226
|
+
e.configuratorId = s.id;
|
|
227
|
+
const t = s.settings || {};
|
|
228
|
+
return !e.overrideTenant && s.tenant && (e.overrideTenant = s.tenant), x(t, e);
|
|
229
|
+
}, z = () => {
|
|
230
|
+
const s = k(G);
|
|
231
|
+
s.locale || (s.locale = W()), s.id === J && delete s.id;
|
|
232
|
+
const e = B();
|
|
233
|
+
return e && U(e) && (s.configuratorId = "demoConfigurator"), s.customApiUrl = void 0, s.emails = !1, s;
|
|
234
|
+
}, Y = "<CONF_ID>", q = "#CONFIGURATIONID#", K = (s) => {
|
|
235
|
+
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);
|
|
241
236
|
}, y = () => /(android)/i.test(navigator.userAgent);
|
|
242
|
-
class
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
setMessageHandler(t) {
|
|
269
|
-
this._messageHandler = t;
|
|
237
|
+
class A {
|
|
238
|
+
_messageHandler = null;
|
|
239
|
+
isSetupDone = !1;
|
|
240
|
+
viewName = "main";
|
|
241
|
+
plugins = {};
|
|
242
|
+
pluginsLoaded = [];
|
|
243
|
+
ui = {
|
|
244
|
+
callbacks: null
|
|
245
|
+
};
|
|
246
|
+
extended = {
|
|
247
|
+
callbacks: null
|
|
248
|
+
};
|
|
249
|
+
configurator = {
|
|
250
|
+
callbacks: null
|
|
251
|
+
};
|
|
252
|
+
analytics = {
|
|
253
|
+
callbacks: {}
|
|
254
|
+
};
|
|
255
|
+
rapi = {
|
|
256
|
+
callbacks: {}
|
|
257
|
+
};
|
|
258
|
+
global = {
|
|
259
|
+
callbacks: {}
|
|
260
|
+
};
|
|
261
|
+
setMessageHandler(e) {
|
|
262
|
+
this._messageHandler = e;
|
|
270
263
|
}
|
|
271
|
-
handleSetup(
|
|
272
|
-
const { methods:
|
|
273
|
-
|
|
274
|
-
const
|
|
275
|
-
this[a] || (this[a] = {}), this[a][
|
|
264
|
+
handleSetup(e) {
|
|
265
|
+
const { methods: t, callbacks: r } = e;
|
|
266
|
+
t.forEach((n) => {
|
|
267
|
+
const i = n.split(f), a = i[0], o = i[1];
|
|
268
|
+
this[a] || (this[a] = {}), this[a][o] = (function() {
|
|
276
269
|
if (!this._messageHandler) {
|
|
277
270
|
console.error("MessageHandler not set");
|
|
278
271
|
return;
|
|
279
272
|
}
|
|
280
|
-
return this._messageHandler.sendMessage(
|
|
273
|
+
return this._messageHandler.sendMessage(n, [...arguments]);
|
|
281
274
|
}).bind(this);
|
|
282
|
-
}),
|
|
283
|
-
const
|
|
284
|
-
this[a] || (this[a] = {}), this[a][
|
|
275
|
+
}), r.forEach((n) => {
|
|
276
|
+
const i = n.split(f), a = i[0], o = i[1], l = i[2];
|
|
277
|
+
this[a] || (this[a] = {}), this[a][o] || (this[a][o] = {}), this[a][o][l] = () => {
|
|
285
278
|
};
|
|
286
279
|
}), this.isSetupDone = !0;
|
|
287
280
|
}
|
|
288
|
-
executeMessage({ message:
|
|
289
|
-
const
|
|
290
|
-
if (a && this[
|
|
291
|
-
const
|
|
292
|
-
...
|
|
281
|
+
executeMessage({ message: e, args: t }) {
|
|
282
|
+
const r = e.split(f), n = r[0], i = r[1], a = r.length === 3 ? r[2] : null;
|
|
283
|
+
if (a && this[n][i][a]) {
|
|
284
|
+
const o = this[n][i][a](
|
|
285
|
+
...t
|
|
293
286
|
);
|
|
294
|
-
return
|
|
287
|
+
return o instanceof Promise ? o.then((l) => ({ result: l })) : o !== void 0 ? Promise.resolve({ result: o }) : Promise.resolve({ result: null });
|
|
295
288
|
}
|
|
296
|
-
return Promise.reject('Message "' +
|
|
289
|
+
return Promise.reject('Message "' + e + '" is unkown');
|
|
297
290
|
}
|
|
298
|
-
setupPlugins(
|
|
299
|
-
for (const
|
|
300
|
-
typeof
|
|
301
|
-
new Promise((
|
|
291
|
+
setupPlugins(e, t, r = "website") {
|
|
292
|
+
for (const n of e)
|
|
293
|
+
typeof n == "string" && n === "dragIn" ? this.pluginsLoaded.push(
|
|
294
|
+
new Promise((i, a) => {
|
|
302
295
|
try {
|
|
303
|
-
import("./drag-in-
|
|
304
|
-
({ DragIn:
|
|
305
|
-
const l = new
|
|
296
|
+
import("./drag-in-DuufO5eB.mjs").then((o) => o.l).then(
|
|
297
|
+
({ DragIn: o }) => {
|
|
298
|
+
const l = new o(
|
|
306
299
|
this.ui,
|
|
307
|
-
|
|
308
|
-
|
|
300
|
+
t,
|
|
301
|
+
r,
|
|
309
302
|
this.viewName
|
|
310
303
|
);
|
|
311
304
|
l.init().then(() => {
|
|
312
|
-
this.plugins.dragIn = l,
|
|
305
|
+
this.plugins.dragIn = l, i();
|
|
313
306
|
}, a);
|
|
314
307
|
}
|
|
315
308
|
);
|
|
316
|
-
} catch (
|
|
317
|
-
a(
|
|
309
|
+
} catch (o) {
|
|
310
|
+
a(o);
|
|
318
311
|
}
|
|
319
312
|
})
|
|
320
|
-
) :
|
|
321
|
-
new Promise((
|
|
313
|
+
) : n.name && n.loader && this.pluginsLoaded.push(
|
|
314
|
+
new Promise((i, a) => {
|
|
322
315
|
try {
|
|
323
|
-
|
|
324
|
-
const l = new
|
|
316
|
+
n.loader().then((o) => {
|
|
317
|
+
const l = new o(
|
|
325
318
|
this.ui,
|
|
326
|
-
|
|
327
|
-
|
|
319
|
+
t,
|
|
320
|
+
r,
|
|
328
321
|
this.viewName
|
|
329
322
|
);
|
|
330
323
|
l.init().then(() => {
|
|
331
|
-
this.plugins[
|
|
324
|
+
this.plugins[n.name] = l, i();
|
|
332
325
|
}, a);
|
|
333
326
|
});
|
|
334
|
-
} catch (
|
|
335
|
-
a(
|
|
327
|
+
} catch (o) {
|
|
328
|
+
a(o);
|
|
336
329
|
}
|
|
337
330
|
})
|
|
338
331
|
);
|
|
339
332
|
}
|
|
340
333
|
}
|
|
341
|
-
const
|
|
342
|
-
let
|
|
343
|
-
return { promise: new Promise((
|
|
344
|
-
|
|
345
|
-
}), resolve:
|
|
346
|
-
},
|
|
347
|
-
let
|
|
348
|
-
Object.defineProperty(
|
|
334
|
+
const M = () => {
|
|
335
|
+
let s, e;
|
|
336
|
+
return { promise: new Promise((r, n) => {
|
|
337
|
+
s = r, e = n;
|
|
338
|
+
}), resolve: s, reject: e };
|
|
339
|
+
}, R = (s, e, t) => {
|
|
340
|
+
let r = null;
|
|
341
|
+
Object.defineProperty(s, e, {
|
|
349
342
|
get() {
|
|
350
|
-
return
|
|
343
|
+
return r || t;
|
|
351
344
|
},
|
|
352
|
-
set(
|
|
353
|
-
|
|
345
|
+
set(n) {
|
|
346
|
+
n?.mute ? r = n.value : (console.warn(
|
|
354
347
|
"You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"
|
|
355
|
-
), console.warn("{ mute: true, value: () => void }"),
|
|
348
|
+
), console.warn("{ mute: true, value: () => void }"), r = n);
|
|
356
349
|
}
|
|
357
350
|
});
|
|
358
|
-
},
|
|
359
|
-
|
|
360
|
-
() =>
|
|
351
|
+
}, L = () => window.innerHeight * 0.01 + "px", I = (s) => {
|
|
352
|
+
s && setTimeout(
|
|
353
|
+
() => s.style.setProperty(w, L()),
|
|
361
354
|
0
|
|
362
355
|
);
|
|
363
|
-
},
|
|
356
|
+
}, N = "rml-styles", Q = 450, w = "--rml-full-height", c = {
|
|
364
357
|
CONTAINER: "rml-container",
|
|
365
358
|
FILL: "rml-fill",
|
|
366
359
|
POSITION: "rml-pos",
|
|
367
360
|
TRANSITION: "rml-transition",
|
|
368
361
|
ANDROID_HEIGHT: "rml-android-height",
|
|
369
362
|
OVERFLOW_HIDDEN: "rml-overflow-hidden"
|
|
370
|
-
},
|
|
371
|
-
class
|
|
372
|
-
|
|
373
|
-
super();
|
|
374
|
-
c(this, "_waitForIframe");
|
|
375
|
-
c(this, "_container");
|
|
376
|
-
c(this, "_configuratorSettings");
|
|
377
|
-
c(this, "_initData", {});
|
|
378
|
-
c(this, "_iframe");
|
|
379
|
-
if (!s || typeof s.id != "string")
|
|
380
|
-
throw new Error(
|
|
381
|
-
"Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person"
|
|
382
|
-
);
|
|
383
|
-
if (w.has(o))
|
|
384
|
-
throw new Error("There is already an instance on this DOM element");
|
|
385
|
-
if (!!!document.getElementById(b)) {
|
|
386
|
-
const g = r.zIndex || 9999999, h = document.createElement("style");
|
|
387
|
-
h.type = "text/css", h.id = b;
|
|
388
|
-
const m = "transition:all ease-in-out " + se + "ms;", f = ["-webkit-", "-o-"].reduce(
|
|
389
|
-
(C, D) => C += D + m,
|
|
390
|
-
""
|
|
391
|
-
) + m, P = H();
|
|
392
|
-
h.innerHTML = `
|
|
393
|
-
.${u.CONTAINER}{${S}:${P};}
|
|
394
|
-
.${u.POSITION}{position:fixed;top:0;left:0;z-index:${g};opacity:0}
|
|
395
|
-
.${u.TRANSITION}{${f}}
|
|
396
|
-
.${u.FILL}{width:100%;height:100%;opacity:1}
|
|
397
|
-
.${u.ANDROID_HEIGHT}{height:calc(var(${S},1vh)*100)}
|
|
398
|
-
.${u.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
399
|
-
`, document.head.appendChild(h);
|
|
400
|
-
}
|
|
401
|
-
this._executeMessage = this._executeMessage.bind(this);
|
|
402
|
-
const l = new T(
|
|
403
|
-
"website",
|
|
404
|
-
window,
|
|
405
|
-
null,
|
|
406
|
-
this._executeMessage
|
|
407
|
-
);
|
|
408
|
-
this.setMessageHandler(l), this._onResize = this._onResize.bind(this), y() && window.addEventListener("resize", this._onResize), this._container = o, this._initData = r, this._configuratorSettings = s;
|
|
409
|
-
const d = this._createIframe();
|
|
410
|
-
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(d), this._iframe = d, this.setupPlugins(n, this._iframe), w.set(o, !0);
|
|
411
|
-
}
|
|
412
|
-
static createPlanner(s, o, r, n = []) {
|
|
363
|
+
}, p = /* @__PURE__ */ new Map();
|
|
364
|
+
class X extends A {
|
|
365
|
+
static createPlanner(e, t, r, n = []) {
|
|
413
366
|
return this._create(
|
|
414
|
-
|
|
415
|
-
|
|
367
|
+
e,
|
|
368
|
+
t,
|
|
416
369
|
r,
|
|
417
370
|
n
|
|
418
371
|
);
|
|
419
372
|
}
|
|
420
|
-
static async connect(
|
|
421
|
-
const r = new
|
|
422
|
-
r.viewName =
|
|
423
|
-
const { resolve: n, promise:
|
|
424
|
-
message:
|
|
425
|
-
args:
|
|
373
|
+
static async connect(e, t = []) {
|
|
374
|
+
const r = new A();
|
|
375
|
+
r.viewName = e;
|
|
376
|
+
const { resolve: n, promise: i } = M(), { resolve: a, promise: o } = M(), l = ({
|
|
377
|
+
message: g,
|
|
378
|
+
args: h
|
|
426
379
|
}) => {
|
|
427
|
-
switch (
|
|
428
|
-
case
|
|
380
|
+
switch (g) {
|
|
381
|
+
case m.REGISTER_CUSTOM_VIEW_DONE:
|
|
429
382
|
n();
|
|
430
383
|
break;
|
|
431
|
-
case
|
|
432
|
-
r.handleSetup(
|
|
384
|
+
case m.RETURN_METHODS:
|
|
385
|
+
r.handleSetup(h[0]), a();
|
|
433
386
|
break;
|
|
434
387
|
default:
|
|
435
388
|
if (r.isSetupDone)
|
|
436
|
-
return r.executeMessage({ message:
|
|
389
|
+
return r.executeMessage({ message: g, args: h });
|
|
437
390
|
}
|
|
438
|
-
},
|
|
439
|
-
"custom-view-" +
|
|
391
|
+
}, u = new S(
|
|
392
|
+
"custom-view-" + e,
|
|
440
393
|
window,
|
|
441
394
|
window.parent,
|
|
442
|
-
|
|
395
|
+
l
|
|
443
396
|
);
|
|
444
|
-
r.setMessageHandler(
|
|
445
|
-
const
|
|
446
|
-
return
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
), await
|
|
450
|
-
|
|
397
|
+
r.setMessageHandler(u);
|
|
398
|
+
const d = [e];
|
|
399
|
+
return u.sendMessage(
|
|
400
|
+
m.REGISTER_CUSTOM_VIEW,
|
|
401
|
+
d
|
|
402
|
+
), await i, u.sendMessage(m.GET_METHODS, d), await o, r.setupPlugins(
|
|
403
|
+
t,
|
|
451
404
|
document.body,
|
|
452
405
|
"custom-view"
|
|
453
406
|
), await Promise.allSettled(r.pluginsLoaded), r;
|
|
@@ -458,10 +411,10 @@ class re extends M {
|
|
|
458
411
|
* @param container DOM container in which the configurator should be placed
|
|
459
412
|
* @param initData settings with which the configurator should be started
|
|
460
413
|
*/
|
|
461
|
-
static createConfigurator(
|
|
414
|
+
static createConfigurator(e, t, r, n = []) {
|
|
462
415
|
return this._create(
|
|
463
|
-
|
|
464
|
-
|
|
416
|
+
e,
|
|
417
|
+
t,
|
|
465
418
|
r,
|
|
466
419
|
n
|
|
467
420
|
);
|
|
@@ -473,10 +426,10 @@ class re extends M {
|
|
|
473
426
|
* @param container DOM container in which the configurator should be placed
|
|
474
427
|
* @param initData settings with which the configurator should be started
|
|
475
428
|
*/
|
|
476
|
-
static create(
|
|
429
|
+
static create(e, t, r, n) {
|
|
477
430
|
return this._create(
|
|
478
|
-
|
|
479
|
-
|
|
431
|
+
e,
|
|
432
|
+
t,
|
|
480
433
|
r,
|
|
481
434
|
n
|
|
482
435
|
);
|
|
@@ -487,68 +440,105 @@ class re extends M {
|
|
|
487
440
|
* @param container DOM container in which the configurator should be placed
|
|
488
441
|
* @param initData settings with which the configurator should be started
|
|
489
442
|
*/
|
|
490
|
-
static createViewer(
|
|
443
|
+
static createViewer(e, t, r, n = []) {
|
|
491
444
|
return this._create(
|
|
492
|
-
|
|
493
|
-
|
|
445
|
+
e,
|
|
446
|
+
t,
|
|
494
447
|
r,
|
|
495
448
|
n
|
|
496
449
|
);
|
|
497
450
|
}
|
|
498
|
-
static async _create(
|
|
499
|
-
return new Promise(async (
|
|
451
|
+
static async _create(e, t, r, n) {
|
|
452
|
+
return new Promise(async (i, a) => {
|
|
500
453
|
try {
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
|
|
454
|
+
const o = O(
|
|
455
|
+
z(),
|
|
456
|
+
V(r)
|
|
504
457
|
);
|
|
505
|
-
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
|
|
458
|
+
K(o);
|
|
459
|
+
const l = await C(
|
|
460
|
+
e,
|
|
461
|
+
o
|
|
509
462
|
);
|
|
510
|
-
r =
|
|
511
|
-
const
|
|
512
|
-
|
|
513
|
-
|
|
463
|
+
r = $(l, o);
|
|
464
|
+
const u = new this(
|
|
465
|
+
l,
|
|
466
|
+
t,
|
|
514
467
|
r,
|
|
515
468
|
n,
|
|
516
|
-
|
|
469
|
+
i
|
|
517
470
|
);
|
|
518
|
-
return await Promise.allSettled(
|
|
519
|
-
} catch (
|
|
520
|
-
return
|
|
471
|
+
return await Promise.allSettled(u.pluginsLoaded), u;
|
|
472
|
+
} catch (o) {
|
|
473
|
+
return a(o);
|
|
521
474
|
}
|
|
522
475
|
});
|
|
523
476
|
}
|
|
477
|
+
_waitForIframe;
|
|
478
|
+
_container;
|
|
479
|
+
_configuratorSettings;
|
|
480
|
+
_initData = {};
|
|
481
|
+
_iframe;
|
|
482
|
+
constructor(e, t, r, n, i) {
|
|
483
|
+
if (super(), !e || typeof e.id != "string")
|
|
484
|
+
throw new Error(
|
|
485
|
+
"Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person"
|
|
486
|
+
);
|
|
487
|
+
if (p.has(t))
|
|
488
|
+
throw new Error("There is already an instance on this DOM element");
|
|
489
|
+
if (!!!document.getElementById(N)) {
|
|
490
|
+
const u = r.zIndex || 9999999, d = document.createElement("style");
|
|
491
|
+
d.type = "text/css", d.id = N;
|
|
492
|
+
const g = "transition:all ease-in-out " + Q + "ms;", h = ["-webkit-", "-o-"].reduce(
|
|
493
|
+
(H, P) => H += P + g,
|
|
494
|
+
""
|
|
495
|
+
) + g, v = L();
|
|
496
|
+
d.innerHTML = `
|
|
497
|
+
.${c.CONTAINER}{${w}:${v};}
|
|
498
|
+
.${c.POSITION}{position:fixed;top:0;left:0;z-index:${u};opacity:0}
|
|
499
|
+
.${c.TRANSITION}{${h}}
|
|
500
|
+
.${c.FILL}{width:100%;height:100%;opacity:1}
|
|
501
|
+
.${c.ANDROID_HEIGHT}{height:calc(var(${w},1vh)*100)}
|
|
502
|
+
.${c.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
503
|
+
`, document.head.appendChild(d);
|
|
504
|
+
}
|
|
505
|
+
this._executeMessage = this._executeMessage.bind(this);
|
|
506
|
+
const o = new S(
|
|
507
|
+
"website",
|
|
508
|
+
window,
|
|
509
|
+
null,
|
|
510
|
+
this._executeMessage
|
|
511
|
+
);
|
|
512
|
+
this.setMessageHandler(o), this._onResize = this._onResize.bind(this), y() && window.addEventListener("resize", this._onResize), this._container = t, this._initData = r, this._configuratorSettings = e;
|
|
513
|
+
const l = this._createIframe();
|
|
514
|
+
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = i, this._container.appendChild(l), this._iframe = l, this.setupPlugins(n, this._iframe), p.set(t, !0);
|
|
515
|
+
}
|
|
524
516
|
teardown() {
|
|
525
|
-
this._container &&
|
|
526
|
-
const
|
|
527
|
-
|
|
517
|
+
this._container && p.delete(this._container);
|
|
518
|
+
const e = this._container.querySelector("iframe");
|
|
519
|
+
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
528
520
|
}
|
|
529
521
|
_createIframe() {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
return this._initData.useLocalRoomle && (o = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (o = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (o = this._initData.overrideServerUrl), s.src = o, s.classList.add(u.CONTAINER), s.classList.add(u.FILL), s;
|
|
522
|
+
const e = document.createElement("iframe");
|
|
523
|
+
let t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
|
|
524
|
+
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;
|
|
534
525
|
}
|
|
535
526
|
_onResize() {
|
|
536
|
-
|
|
527
|
+
I(this._iframe);
|
|
537
528
|
}
|
|
538
529
|
_onUseFullPage() {
|
|
539
|
-
this._iframe.classList.add(
|
|
530
|
+
this._iframe.classList.add(c.POSITION), document.documentElement.classList.add(c.OVERFLOW_HIDDEN), window.document.body.classList.add(c.OVERFLOW_HIDDEN), y() && (I(this._iframe), this._iframe.classList.add(c.ANDROID_HEIGHT));
|
|
540
531
|
}
|
|
541
532
|
_onBackToWebsite() {
|
|
542
|
-
this._iframe.classList.remove(
|
|
533
|
+
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);
|
|
543
534
|
}
|
|
544
|
-
_executeMessage({ message:
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
return s === E.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" })) : s === E.SETUP ? (this.handleSetup(o[0]), N(
|
|
535
|
+
_executeMessage({ message: e, args: t }, r) {
|
|
536
|
+
if (r.source && r.source === this._iframe?.contentWindow)
|
|
537
|
+
return e === _.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 === _.SETUP ? (this.handleSetup(t[0]), R(
|
|
548
538
|
this.ui.callbacks,
|
|
549
539
|
"onUseFullPage",
|
|
550
540
|
this._onUseFullPage
|
|
551
|
-
),
|
|
541
|
+
), R(
|
|
552
542
|
this.ui.callbacks,
|
|
553
543
|
"onBackToWebsite",
|
|
554
544
|
this._onBackToWebsite
|
|
@@ -557,10 +547,10 @@ class re extends M {
|
|
|
557
547
|
console.error("MessageHandler not set");
|
|
558
548
|
return;
|
|
559
549
|
}
|
|
560
|
-
this._messageHandler.sendMessage(
|
|
561
|
-
}, 0), Promise.resolve({ result: null })) : this.executeMessage({ message:
|
|
550
|
+
this._messageHandler.sendMessage(_.WEBSITE_READY);
|
|
551
|
+
}, 0), Promise.resolve({ result: null })) : this.executeMessage({ message: e, args: t });
|
|
562
552
|
}
|
|
563
553
|
}
|
|
564
554
|
export {
|
|
565
|
-
|
|
555
|
+
X as default
|
|
566
556
|
};
|