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