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