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