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