@roomle/embedding-lib 6.7.0-alpha.4 → 6.7.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.
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-DIjstF9k.mjs";
1
+ import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-B42WpY_e.mjs";
2
2
  import "./embedding-plugins.js";
3
3
  //#region packages/common/src/utils/drag.ts
4
4
  var o = (e, t, n = 0, r = 0) => {
@@ -1,4 +1,4 @@
1
- import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-BT6p3GQN.mjs";
1
+ import { a as e, c as t, i as n, m as r, o as i, s as a } from "./drag-in-DXVxlotA.mjs";
2
2
  import "./embedding-plugins.min.js";
3
3
  var o = (e, t, n = 0, r = 0) => {
4
4
  let i = t.x + t.width + n, a = t.x - n, o = t.y + t.height + r, s = t.y - r, { x: c, y: l } = e;
@@ -35,7 +35,7 @@ var t = "rml-drag-in-styles", n = "rml-drag-in-drag-element", r = "rml-drag-in-o
35
35
  }
36
36
  async init() {
37
37
  if (await super.init(), this._mode === "website") try {
38
- let { DragInFromWebsiteStrategy: e } = await import("./from-website-Cj545oPw.mjs");
38
+ let { DragInFromWebsiteStrategy: e } = await import("./from-website-il2_I_s5.mjs");
39
39
  this._strategy = new e(this._instance, this._mainDomElement, {
40
40
  settings: this.options,
41
41
  mode: "website"
@@ -44,7 +44,7 @@ var t = "rml-drag-in-styles", n = "rml-drag-in-drag-element", r = "rml-drag-in-o
44
44
  throw console.error("Could not load Dragin strategy \"FromWebsite\""), e;
45
45
  }
46
46
  else if (this._mode === "custom-view") try {
47
- let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-CsPmMf8D.mjs");
47
+ let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-DgMx7_5-.mjs");
48
48
  this._strategy = new e(this._instance, this._mainDomElement, this.options, this._viewName);
49
49
  } catch (e) {
50
50
  throw console.error("Could not load Dragin strategy \"FromCustomView\""), e;
@@ -28,7 +28,7 @@ var t = "rml-drag-in-styles", n = "rml-drag-in-drag-element", r = "rml-drag-in-o
28
28
  }
29
29
  async init() {
30
30
  if (await super.init(), this._mode === "website") try {
31
- let { DragInFromWebsiteStrategy: e } = await import("./from-website-e9mLgLyV.mjs");
31
+ let { DragInFromWebsiteStrategy: e } = await import("./from-website-BVznMwIE.mjs");
32
32
  this._strategy = new e(this._instance, this._mainDomElement, {
33
33
  settings: this.options,
34
34
  mode: "website"
@@ -39,7 +39,7 @@ var t = "rml-drag-in-styles", n = "rml-drag-in-drag-element", r = "rml-drag-in-o
39
39
  else {
40
40
  if (this._mode !== "custom-view") throw Error("Unsupported mode");
41
41
  try {
42
- let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-BeT4KXut.mjs");
42
+ let { DragInFromCustomViewStrategy: e } = await import("./from-custom-view-CNctfhuo.mjs");
43
43
  this._strategy = new e(this._instance, this._mainDomElement, this.options, this._viewName);
44
44
  } catch (e) {
45
45
  throw e;
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-DIjstF9k.mjs";
1
+ import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-B42WpY_e.mjs";
2
2
  export { l as DragIn, a as RML_DRAG_GHOST_FADE_IN, e as RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS, s as RML_DRAG_GHOST_FADE_OUT, c as RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS, t as RML_DRAG_IN_DRAG_ELEMENT_ID, u as RML_DRAG_IN_FALLBACK_GHOST_HEIGHT, n as RML_DRAG_IN_FALLBACK_GHOST_URL, r as RML_DRAG_IN_FALLBACK_GHOST_WIDTH, o as RML_DRAG_IN_STYLES_ID, i as TARGET_OPACITY };
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-BT6p3GQN.mjs";
1
+ import { a as e, c as t, d as n, f as r, h as i, i as a, m as o, o as s, s as c, t as l, u } from "./drag-in-DXVxlotA.mjs";
2
2
  export { l as DragIn, a as RML_DRAG_GHOST_FADE_IN, e as RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS, s as RML_DRAG_GHOST_FADE_OUT, c as RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS, t as RML_DRAG_IN_DRAG_ELEMENT_ID, u as RML_DRAG_IN_FALLBACK_GHOST_HEIGHT, n as RML_DRAG_IN_FALLBACK_GHOST_URL, r as RML_DRAG_IN_FALLBACK_GHOST_WIDTH, o as RML_DRAG_IN_STYLES_ID, i as TARGET_OPACITY };
@@ -1,6 +1,6 @@
1
1
  import { a as e, n as t, o as n } from "./utils-DfC2ZLUc.mjs";
2
- import { d as r } from "./drag-in-BT6p3GQN.mjs";
3
- import { t as i } from "./drag-ghost-B_-3-gs5.mjs";
2
+ import { d as r } from "./drag-in-DXVxlotA.mjs";
3
+ import { t as i } from "./drag-ghost-DbEzikW5.mjs";
4
4
  var a = (e, t = 0) => n(e) ? {
5
5
  clientX: e.touches[t].clientX,
6
6
  clientY: e.touches[t].clientY
@@ -1,6 +1,6 @@
1
1
  import { a as e, n as t, o as n } from "./utils-BnWKaFPc.mjs";
2
- import { d as r } from "./drag-in-DIjstF9k.mjs";
3
- import { t as i } from "./drag-ghost-BYii9QJZ.mjs";
2
+ import { d as r } from "./drag-in-B42WpY_e.mjs";
3
+ import { t as i } from "./drag-ghost-BFAJCWau.mjs";
4
4
  var a = (e, t = 0) => n(e) ? {
5
5
  clientX: e.touches[t].clientX,
6
6
  clientY: e.touches[t].clientY
@@ -1,6 +1,6 @@
1
1
  import { i as e, n as t, o as n, r } from "./utils-DfC2ZLUc.mjs";
2
- import { l as i, p as a, r as o } from "./drag-in-BT6p3GQN.mjs";
3
- import { t as s } from "./drag-ghost-B_-3-gs5.mjs";
2
+ import { l as i, p as a, r as o } from "./drag-in-DXVxlotA.mjs";
3
+ import { t as s } from "./drag-ghost-DbEzikW5.mjs";
4
4
  var c = class {
5
5
  _options = {};
6
6
  _instance;
@@ -72,8 +72,8 @@ var c = class {
72
72
  };
73
73
  if (f && this._pendingDragIn) {
74
74
  let e = p();
75
- e && !this._hasEnteredIframe ? (this._dragInObjectCalled || (this._dragInObjectCalled = !0, this._instance.dragInObject(this._pendingDragIn.id, s, c, this._pendingDragIn.type)), this._hasEnteredIframe = !0) : !e && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1);
76
- } else !f && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1);
75
+ e && !this._hasEnteredIframe ? (this._dragInObjectCalled || (this._dragInObjectCalled = !0, this._instance.dragInObject(this._pendingDragIn.id, s, c, this._pendingDragIn.type)), this._hasEnteredIframe = !0) : !e && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1, this._dragInObjectCalled = !1);
76
+ } else !f && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1, this._dragInObjectCalled = !1);
77
77
  let m = s, h = c;
78
78
  if (n(r)) {
79
79
  let e = this._options.settings?.fingerSize || 0;
@@ -1,6 +1,6 @@
1
1
  import { i as e, n as t, o as n, r } from "./utils-BnWKaFPc.mjs";
2
- import { l as i, p as a, r as o } from "./drag-in-DIjstF9k.mjs";
3
- import { t as s } from "./drag-ghost-BYii9QJZ.mjs";
2
+ import { l as i, p as a, r as o } from "./drag-in-B42WpY_e.mjs";
3
+ import { t as s } from "./drag-ghost-BFAJCWau.mjs";
4
4
  //#region packages/embedding-lib/src/plugins/strategy/from-website.ts
5
5
  var c = class {
6
6
  _options = {};
@@ -76,8 +76,8 @@ var c = class {
76
76
  };
77
77
  if (f && this._pendingDragIn) {
78
78
  let e = p();
79
- e && !this._hasEnteredIframe ? (this._dragInObjectCalled || (this._dragInObjectCalled = !0, this._instance.dragInObject(this._pendingDragIn.id, s, c, this._pendingDragIn.type)), this._hasEnteredIframe = !0) : !e && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1);
80
- } else !f && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1);
79
+ e && !this._hasEnteredIframe ? (this._dragInObjectCalled || (this._dragInObjectCalled = !0, this._instance.dragInObject(this._pendingDragIn.id, s, c, this._pendingDragIn.type)), this._hasEnteredIframe = !0) : !e && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1, this._dragInObjectCalled = !1);
80
+ } else !f && this._hasEnteredIframe && (this._instance.cancelDragIn(), this._hasEnteredIframe = !1, this._dragInObjectCalled = !1);
81
81
  let m = s, h = c;
82
82
  if (n(r)) {
83
83
  let e = this._options.settings?.fingerSize || 0;
package/hi.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { t as e } from "./browser-C_Dfiou7.mjs";
2
2
  import { t } from "./utils-BnWKaFPc.mjs";
3
- //#endregion
4
- //#region packages/embedding-lib/src/homag-intelligence/hi-requests.ts
5
- var n = async (e, t, n, r = { property: "default" }) => {
3
+ var n = (e, t) => t === e.libraryId ? e : {
4
+ ...e,
5
+ libraryId: t
6
+ }, r = async (e, t, n, r = { property: "default" }) => {
6
7
  let i = n.serverOptions ?? {}, a = { headers: {
7
8
  "Content-Type": t === "json" ? "application/json" : "text/plain",
8
9
  "Access-Control-Allow-Origin": "*"
@@ -15,22 +16,22 @@ var n = async (e, t, n, r = { property: "default" }) => {
15
16
  } catch (e) {
16
17
  throw console.warn(`Failed to fetch data from ${r.property}`), console.error(e), e;
17
18
  }
18
- }, r = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": new Set(["Furniture_Smith"]) }, i = (e, t) => {
19
- r[e] || (r[e] = /* @__PURE__ */ new Set()), r[e].add(t);
20
- }, a = (e, t) => {
21
- r[e]?.delete(t), r[e]?.size === 0 && delete r[e];
19
+ }, i = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": new Set(["Furniture_Smith"]) }, a = (e, t) => {
20
+ i[e] || (i[e] = /* @__PURE__ */ new Set()), i[e].add(t);
22
21
  }, o = (e, t) => {
23
- let { libraryId: n, serverOptions: i } = e;
24
- return i?.subscriptionId && r[i.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
25
- }, s = async (e) => await (await n(o(e, "articles"), "json", e, { property: "articles" })).json(), c = async (e) => await (await n(o(e, "masterData"), "json", e, { property: "masterData" })).json(), l = async (e) => {
26
- let t = await (await n(o(e, "calc.js"), "text", e, { property: "calc.js" })).text();
22
+ i[e]?.delete(t), i[e]?.size === 0 && delete i[e];
23
+ }, s = (e, t) => {
24
+ let { libraryId: n, serverOptions: r } = e;
25
+ return r?.subscriptionId && i[r.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
26
+ }, c = async (e) => await (await r(s(e, "articles"), "json", e, { property: "articles" })).json(), l = async (e) => await (await r(s(e, "masterData"), "json", e, { property: "masterData" })).json(), u = async (e) => {
27
+ let t = await (await r(s(e, "calc.js"), "text", e, { property: "calc.js" })).text();
27
28
  if (!t) throw Error("Script load error");
28
29
  return t;
29
- }, u = (e) => ({
30
- onLoadJavascript: (t) => l(e),
31
- onLoadArticleCatalog: (t) => s(e),
32
- onLoadMasterData: (t) => c(e)
33
- }), d = async (e, t, n, r = {}) => {
30
+ }, d = (e) => ({
31
+ onLoadJavascript: (t) => u(n(e, t)),
32
+ onLoadArticleCatalog: (t) => c(n(e, t)),
33
+ onLoadMasterData: (t) => l(n(e, t))
34
+ }), f = async (e, t, n, r = {}) => {
34
35
  let { baseUrl: i, om: a } = e.serverOptions ?? {}, o = encodeURIComponent(a?.endpointUrl || ""), s = encodeURIComponent(a?.subscriptionId || ""), c = a?.key || "";
35
36
  return await (await fetch((i ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(n)}&subscriptionId=${s}&apiKey=${c}&baseUrl=${o}`, {
36
37
  method: "POST",
@@ -40,7 +41,7 @@ var n = async (e, t, n, r = { property: "default" }) => {
40
41
  ...r
41
42
  }
42
43
  })).json();
43
- }, f = async (e, t, n = {}) => {
44
+ }, p = async (e, t, n = {}) => {
44
45
  let { baseUrl: r, om: i } = e.serverOptions ?? {}, a = encodeURIComponent(i?.endpointUrl || ""), o = encodeURIComponent(i?.subscriptionId || ""), s = i?.key || "";
45
46
  return await (await fetch((r ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(t)}&subscriptionId=${o}&apiKey=${s}&baseUrl=${a}`, {
46
47
  method: "GET",
@@ -49,25 +50,25 @@ var n = async (e, t, n, r = { property: "default" }) => {
49
50
  ...n
50
51
  }
51
52
  })).json();
52
- }, p = (t, n) => {
53
+ }, m = (t, n) => {
53
54
  t.serverOptions ||= {}, !t.serverOptions.language && n?.locale && (t.serverOptions.language = n.locale), t.serverOptions.language || (t.serverOptions.language = e(null, !0));
54
- }, m = null, h = async (e, n = {}) => {
55
- m && window.removeEventListener("message", m);
56
- let r = typeof e == "string" ? { libraryId: e } : e;
57
- n.onLoadJavascript === void 0 && (n.onLoadJavascript = (e) => l(r)), n.onLoadArticleCatalog === void 0 && (n.onLoadArticleCatalog = (e) => s(r)), n.onLoadMasterData === void 0 && (n.onLoadMasterData = (e) => c(r));
58
- let { expose: i } = await import("./comlink-BipJ8Ikr.mjs").then((e) => e.t);
59
- m = (e) => {
55
+ }, h = null, g = async (e, r = {}) => {
56
+ h && window.removeEventListener("message", h);
57
+ let i = typeof e == "string" ? { libraryId: e } : e;
58
+ r.onLoadJavascript === void 0 && (r.onLoadJavascript = (e) => u(n(i, e))), r.onLoadArticleCatalog === void 0 && (r.onLoadArticleCatalog = (e) => c(n(i, e))), r.onLoadMasterData === void 0 && (r.onLoadMasterData = (e) => l(n(i, e)));
59
+ let { expose: a } = await import("./comlink-BipJ8Ikr.mjs").then((e) => e.t);
60
+ h = (e) => {
60
61
  if (e.data.type === "connect_hi" && e.data.port) {
61
- let a = e.data.port;
62
- p(r, e.data.globalInitData || {}), a.start?.(), i(t(n), a);
62
+ let n = e.data.port;
63
+ m(i, e.data.globalInitData || {}), n.start?.(), a(t(r), n);
63
64
  }
64
- }, window.addEventListener("message", m);
65
- }, g = () => {
66
- m &&= (window.removeEventListener("message", m), null);
67
- }, _ = {
65
+ }, window.addEventListener("message", h);
66
+ }, _ = () => {
67
+ h &&= (window.removeEventListener("message", h), null);
68
+ }, v = {
68
69
  HIDE: "hide",
69
70
  SHOW_ATTRIBUTES: "attributes",
70
71
  SHOW_ARTICLES: "articles"
71
72
  };
72
73
  //#endregion
73
- export { _ as HI_PANEL_ACTION, g as cleanupHi, u as createHiLibraryCallbacks, s as libLoadArticleCatalog, l as libLoadCalcScript, c as libLoadMasterData, f as omGetRequest, d as omPostRequest, i as registerLegacyUrlFormat, h as setupHi, a as unregisterLegacyUrlFormat };
74
+ export { v as HI_PANEL_ACTION, _ as cleanupHi, d as createHiLibraryCallbacks, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, g as setupHi, o as unregisterLegacyUrlFormat };
package/hi.min.js CHANGED
@@ -1,6 +1,9 @@
1
1
  import { t as e } from "./browser-DRgK3Fk8.mjs";
2
2
  import { t } from "./utils-DfC2ZLUc.mjs";
3
- var n = async (e, t, n, r = { property: "default" }) => {
3
+ var n = (e, t) => t === e.libraryId ? e : {
4
+ ...e,
5
+ libraryId: t
6
+ }, r = async (e, t, n, r = { property: "default" }) => {
4
7
  let i = n.serverOptions ?? {}, a = { headers: {
5
8
  "Content-Type": t === "json" ? "application/json" : "text/plain",
6
9
  "Access-Control-Allow-Origin": "*"
@@ -14,22 +17,22 @@ var n = async (e, t, n, r = { property: "default" }) => {
14
17
  } catch (e) {
15
18
  throw e;
16
19
  }
17
- }, r = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": new Set(["Furniture_Smith"]) }, i = (e, t) => {
18
- r[e] || (r[e] = /* @__PURE__ */ new Set()), r[e].add(t);
19
- }, a = (e, t) => {
20
- r[e]?.delete(t), r[e]?.size === 0 && delete r[e];
20
+ }, i = { "e2fe8b3d-da31-4a20-92ab-ab6e3839300e": new Set(["Furniture_Smith"]) }, a = (e, t) => {
21
+ i[e] || (i[e] = /* @__PURE__ */ new Set()), i[e].add(t);
21
22
  }, o = (e, t) => {
22
- let { libraryId: n, serverOptions: i } = e;
23
- return i?.subscriptionId && r[i.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
24
- }, s = async (e) => await (await n(o(e, "articles"), "json", e, { property: "articles" })).json(), c = async (e) => await (await n(o(e, "masterData"), "json", e, { property: "masterData" })).json(), l = async (e) => {
25
- let t = await (await n(o(e, "calc.js"), "text", e, { property: "calc.js" })).text();
23
+ i[e]?.delete(t), i[e]?.size === 0 && delete i[e];
24
+ }, s = (e, t) => {
25
+ let { libraryId: n, serverOptions: r } = e;
26
+ return r?.subscriptionId && i[r.subscriptionId]?.has(n) ? `api/pos/${t}?libraryId=${n}` : `api/pos/libraries/${n}/${t}`;
27
+ }, c = async (e) => await (await r(s(e, "articles"), "json", e, { property: "articles" })).json(), l = async (e) => await (await r(s(e, "masterData"), "json", e, { property: "masterData" })).json(), u = async (e) => {
28
+ let t = await (await r(s(e, "calc.js"), "text", e, { property: "calc.js" })).text();
26
29
  if (!t) throw Error("Script load error");
27
30
  return t;
28
- }, u = (e) => ({
29
- onLoadJavascript: (t) => l(e),
30
- onLoadArticleCatalog: (t) => s(e),
31
- onLoadMasterData: (t) => c(e)
32
- }), d = async (e, t, n, r = {}) => {
31
+ }, d = (e) => ({
32
+ onLoadJavascript: (t) => u(n(e, t)),
33
+ onLoadArticleCatalog: (t) => c(n(e, t)),
34
+ onLoadMasterData: (t) => l(n(e, t))
35
+ }), f = async (e, t, n, r = {}) => {
33
36
  let { baseUrl: i, om: a } = e.serverOptions ?? {}, o = encodeURIComponent(a?.endpointUrl || ""), s = encodeURIComponent(a?.subscriptionId || ""), c = a?.key || "";
34
37
  return await (await fetch((i ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(n)}&subscriptionId=${s}&apiKey=${c}&baseUrl=${o}`, {
35
38
  method: "POST",
@@ -39,7 +42,7 @@ var n = async (e, t, n, r = { property: "default" }) => {
39
42
  ...r
40
43
  }
41
44
  })).json();
42
- }, f = async (e, t, n = {}) => {
45
+ }, p = async (e, t, n = {}) => {
43
46
  let { baseUrl: r, om: i } = e.serverOptions ?? {}, a = encodeURIComponent(i?.endpointUrl || ""), o = encodeURIComponent(i?.subscriptionId || ""), s = i?.key || "";
44
47
  return await (await fetch((r ?? "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=") + `${encodeURIComponent(t)}&subscriptionId=${o}&apiKey=${s}&baseUrl=${a}`, {
45
48
  method: "GET",
@@ -48,24 +51,24 @@ var n = async (e, t, n, r = { property: "default" }) => {
48
51
  ...n
49
52
  }
50
53
  })).json();
51
- }, p = null, m = async (n, r = {}) => {
52
- p && window.removeEventListener("message", p);
53
- let i = typeof n == "string" ? { libraryId: n } : n;
54
- r.onLoadJavascript === void 0 && (r.onLoadJavascript = (e) => l(i)), r.onLoadArticleCatalog === void 0 && (r.onLoadArticleCatalog = (e) => s(i)), r.onLoadMasterData === void 0 && (r.onLoadMasterData = (e) => c(i));
55
- let { expose: a } = await import("./comlink-Dds_bpug.mjs").then((e) => e.t);
56
- p = (n) => {
54
+ }, m = null, h = async (r, i = {}) => {
55
+ m && window.removeEventListener("message", m);
56
+ let a = typeof r == "string" ? { libraryId: r } : r;
57
+ i.onLoadJavascript === void 0 && (i.onLoadJavascript = (e) => u(n(a, e))), i.onLoadArticleCatalog === void 0 && (i.onLoadArticleCatalog = (e) => c(n(a, e))), i.onLoadMasterData === void 0 && (i.onLoadMasterData = (e) => l(n(a, e)));
58
+ let { expose: o } = await import("./comlink-Dds_bpug.mjs").then((e) => e.t);
59
+ m = (n) => {
57
60
  if (n.data.type === "connect_hi" && n.data.port) {
58
- let o = n.data.port;
61
+ let r = n.data.port;
59
62
  ((t, n) => {
60
63
  t.serverOptions ||= {}, !t.serverOptions.language && n?.locale && (t.serverOptions.language = n.locale), t.serverOptions.language || (t.serverOptions.language = e(null, !0));
61
- })(i, n.data.globalInitData || {}), o.start?.(), a(t(r), o);
64
+ })(a, n.data.globalInitData || {}), r.start?.(), o(t(i), r);
62
65
  }
63
- }, window.addEventListener("message", p);
64
- }, h = () => {
65
- p &&= (window.removeEventListener("message", p), null);
66
- }, g = {
66
+ }, window.addEventListener("message", m);
67
+ }, g = () => {
68
+ m &&= (window.removeEventListener("message", m), null);
69
+ }, _ = {
67
70
  HIDE: "hide",
68
71
  SHOW_ATTRIBUTES: "attributes",
69
72
  SHOW_ARTICLES: "articles"
70
73
  };
71
- export { g as HI_PANEL_ACTION, h as cleanupHi, u as createHiLibraryCallbacks, s as libLoadArticleCatalog, l as libLoadCalcScript, c as libLoadMasterData, f as omGetRequest, d as omPostRequest, i as registerLegacyUrlFormat, m as setupHi, a as unregisterLegacyUrlFormat };
74
+ export { _ as HI_PANEL_ACTION, g as cleanupHi, d as createHiLibraryCallbacks, c as libLoadArticleCatalog, u as libLoadCalcScript, l as libLoadMasterData, p as omGetRequest, f as omPostRequest, a as registerLegacyUrlFormat, h as setupHi, o as unregisterLegacyUrlFormat };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@roomle/embedding-lib",
3
- "version": "6.7.0-alpha.4",
3
+ "version": "6.7.0",
4
4
  "description": "This is a small library which can be used to communicate with the Roomle Configurator. ES modules only (browser-compatible).",
5
5
  "type": "module",
6
6
  "main": "./roomle-embedding-lib.js",
@@ -1 +1,8 @@
1
+ import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
1
2
  export declare const HOMAG_INTELLIGENCE_ENDPOINT = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=";
3
+ /**
4
+ * Returns `hiInitData` unchanged when its `libraryId` already matches the
5
+ * requested one (avoiding an unnecessary allocation), otherwise returns a
6
+ * shallow copy with the `libraryId` overridden.
7
+ */
8
+ export declare const withLibraryId: (hiInitData: HomagIntelligenceInitData, libraryId: string) => HomagIntelligenceInitData;
@@ -2,10 +2,10 @@ import { RapiId } from '../../../../web-sdk/packages';
2
2
  import { OnBeforeUpdateDragGhost } from '../../embedding-plugins';
3
3
  export interface DragInStrategy {
4
4
  isDragging: boolean;
5
- dragStart(id: RapiId, event: DragEvent | TouchEvent | MouseEvent, type: string): void;
5
+ dragStart(id: RapiId, event: DragEvent | TouchEvent | MouseEvent, type?: string): void | Promise<void>;
6
6
  dragUpdate(event: DragEvent | TouchEvent | MouseEvent): void;
7
7
  dragEnd(): void;
8
- touchStart(id: RapiId, event: TouchEvent, type: string): void;
8
+ touchStart(id: RapiId, event: TouchEvent, type?: string): void;
9
9
  touchMove(event: TouchEvent): void;
10
10
  touchEnd(): void;
11
11
  beforeUpdateGhost(handler: OnBeforeUpdateDragGhost): void;
@@ -138,15 +138,20 @@ var r = class {
138
138
  let e = d(f);
139
139
  e.locale ||= t(null, !0), e.id === "(idle)" && delete e.id;
140
140
  let n = o();
141
- return n && s(n) && (e.configuratorId = "demoConfigurator"), e.customApiUrl = "https://rubens.alpha.roomle.com/api/v2", e.emails = !1, e;
141
+ return n && s(n) && (e.configuratorId = "demoConfigurator"), e.customApiUrl = void 0, e.emails = !1, e;
142
142
  }, g = "<CONF_ID>", _ = "#CONFIGURATIONID#", v = (e) => {
143
+ let t = e.featureFlags;
144
+ if (!t || typeof t != "object" || Array.isArray(t)) return;
145
+ let n = t;
146
+ "enableTwoLevelCatalog" in n && typeof n.enableTwoLevelCatalog == "boolean" && (e.enableTwoLevelCatalog === !1 || e.enableTwoLevelCatalog === void 0) && (e.enableTwoLevelCatalog = n.enableTwoLevelCatalog);
147
+ }, y = (e) => {
143
148
  e.featureFlags ||= {}, typeof e.featureFlags.realPartList != "boolean" && (e.featureFlags.realPartList = !0), typeof e.featureFlags.globalCallbacks != "boolean" && (e.featureFlags.globalCallbacks = !0), typeof e.featureFlags.mocAr != "boolean" && (e.featureFlags.mocAr = !1);
144
- }, y = (e, t) => {
149
+ }, b = (e, t) => {
145
150
  let n = d(t), r = h();
146
- v(r);
151
+ y(r);
147
152
  let i = c(c(r, e.settings || {}), n);
148
- return i.configuratorId = e.id, !i.overrideTenant && e.tenant && (i.overrideTenant = e.tenant), i;
149
- }, b = () => /(android)/i.test(navigator.userAgent), x = class {
153
+ return i.configuratorId = e.id, !i.overrideTenant && e.tenant && (i.overrideTenant = e.tenant), v(i), i;
154
+ }, x = () => /(android)/i.test(navigator.userAgent), S = class {
150
155
  _messageHandler = null;
151
156
  isSetupDone = !1;
152
157
  viewName = "main";
@@ -188,7 +193,7 @@ var r = class {
188
193
  setupPlugins(e, t, n = "website") {
189
194
  for (let r of e) typeof r == "string" && r === "dragIn" ? this.pluginsLoaded.push(new Promise((e, r) => {
190
195
  try {
191
- import("./drag-in-DIjstF9k.mjs").then((e) => e.n).then(({ DragIn: i }) => {
196
+ import("./drag-in-B42WpY_e.mjs").then((e) => e.n).then(({ DragIn: i }) => {
192
197
  let a = new i(this.ui, t, n, this.viewName);
193
198
  a.init().then(() => {
194
199
  this.plugins.dragIn = a, e();
@@ -210,7 +215,7 @@ var r = class {
210
215
  }
211
216
  }));
212
217
  }
213
- }, S = () => {
218
+ }, C = () => {
214
219
  let e, t;
215
220
  return {
216
221
  promise: new Promise((n, r) => {
@@ -219,7 +224,7 @@ var r = class {
219
224
  resolve: e,
220
225
  reject: t
221
226
  };
222
- }, C = {
227
+ }, w = {
223
228
  SDK: "extended",
224
229
  CONFIGURATOR_SDK: "configurator",
225
230
  CALLBACKS: "callbacks",
@@ -227,20 +232,20 @@ var r = class {
227
232
  ANALYTICS: "analytics",
228
233
  GLOBAL: "global",
229
234
  RAPI: "rapi"
230
- }, w = ".", T = C.SDK + "." + C.CALLBACKS, E = {
235
+ }, T = ".", E = w.SDK + "." + w.CALLBACKS, D = {
231
236
  REQUEST_BOOT: "requestBoot",
232
237
  SETUP: "setup",
233
238
  WEBSITE_READY: "websiteReady"
234
- }, D = {
239
+ }, O = {
235
240
  GET_METHODS: "getMethods",
236
241
  RETURN_METHODS: "returnMethods",
237
242
  REGISTER_CUSTOM_VIEW: "registerCustomView",
238
243
  REGISTER_CUSTOM_VIEW_DONE: "registerCustomViewDone"
239
- }, O = ["constructor", "callbacks"], k = (e) => e[0] !== "_" && !O.includes(e), A = (e, t, n = !1) => {
244
+ }, k = ["constructor", "callbacks"], A = (e) => e[0] !== "_" && !k.includes(e), j = (e, t, n = !1) => {
240
245
  if (!e) return [];
241
- let r = Object.getOwnPropertyNames(e), i = n ? C.CALLBACKS + "." : "";
242
- return r.filter(k).map((e) => t + "." + i + e);
243
- }, j = async (e, t) => {
246
+ let r = Object.getOwnPropertyNames(e), i = n ? w.CALLBACKS + "." : "";
247
+ return r.filter(A).map((e) => t + "." + i + e);
248
+ }, M = async (e, t) => {
244
249
  if (typeof e != "string") throw Error("Configurator ID is not a string type: \"" + typeof e + "\"");
245
250
  let n = t.customApiUrl ? t.customApiUrl : "https://api.roomle.com/v2", r = t.overrideTenant || 9, i = n + "/configurators/" + e, a = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;roomle_portal_v2"), o = new Request(i, {
246
251
  method: "GET",
@@ -257,7 +262,7 @@ var r = class {
257
262
  cache: "default"
258
263
  }), { configurator: s } = await (await fetch(o)).json();
259
264
  return s;
260
- }, M = "data-rml-interaction-container", N = (e, t, n) => {
265
+ }, N = "data-rml-interaction-container", P = (e, t, n) => {
261
266
  let r = null;
262
267
  Object.defineProperty(e, t, {
263
268
  get() {
@@ -267,28 +272,28 @@ var r = class {
267
272
  e?.mute ? r = e.value : (console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"), console.warn("{ mute: true, value: () => void }"), r = e);
268
273
  }
269
274
  });
270
- }, P = () => window.innerHeight * .01 + "px", F = (e) => {
271
- e && setTimeout(() => e.style.setProperty(R, P()), 0);
272
- }, I = "rml-styles", L = 450, R = "--rml-full-height", z = {
275
+ }, F = () => window.innerHeight * .01 + "px", I = (e) => {
276
+ e && setTimeout(() => e.style.setProperty(z, F()), 0);
277
+ }, L = "rml-styles", R = 450, z = "--rml-full-height", B = {
273
278
  CONTAINER: "rml-container",
274
279
  FILL: "rml-fill",
275
280
  POSITION: "rml-pos",
276
281
  TRANSITION: "rml-transition",
277
282
  ANDROID_HEIGHT: "rml-android-height",
278
283
  OVERFLOW_HIDDEN: "rml-overflow-hidden"
279
- }, B = /* @__PURE__ */ new Map(), V = class extends x {
284
+ }, V = /* @__PURE__ */ new Map(), H = class extends S {
280
285
  static createPlanner(e, t, n, r = []) {
281
286
  return this._create(e, t, n, r);
282
287
  }
283
288
  static async connect(e, t = []) {
284
- let n = new x();
289
+ let n = new S();
285
290
  n.viewName = e;
286
- let { resolve: i, promise: a } = S(), { resolve: o, promise: s } = S(), c = new r("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
291
+ let { resolve: i, promise: a } = C(), { resolve: o, promise: s } = C(), c = new r("custom-view-" + e, window, window.parent, ({ message: e, args: t }) => {
287
292
  switch (e) {
288
- case D.REGISTER_CUSTOM_VIEW_DONE:
293
+ case O.REGISTER_CUSTOM_VIEW_DONE:
289
294
  i();
290
295
  break;
291
- case D.RETURN_METHODS:
296
+ case O.RETURN_METHODS:
292
297
  n.handleSetup(t[0]), o();
293
298
  break;
294
299
  default: if (n.isSetupDone) return n.executeMessage({
@@ -299,7 +304,7 @@ var r = class {
299
304
  });
300
305
  n.setMessageHandler(c);
301
306
  let l = [e];
302
- return c.sendMessage(D.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(D.GET_METHODS, l), await s, n.setupPlugins(t, document.body, "custom-view"), await Promise.allSettled(n.pluginsLoaded), n;
307
+ return c.sendMessage(O.REGISTER_CUSTOM_VIEW, l), await a, c.sendMessage(O.GET_METHODS, l), await s, n.setupPlugins(t, document.body, "custom-view"), await Promise.allSettled(n.pluginsLoaded), n;
303
308
  }
304
309
  static createConfigurator(e, t, n, r = []) {
305
310
  return this._create(e, t, n, r);
@@ -323,9 +328,9 @@ var r = class {
323
328
  return new Promise(async (i, a) => {
324
329
  try {
325
330
  let a = p(n), o = h();
326
- v(o);
327
- let s = await j(e, c(o, a));
328
- n = y(s, a);
331
+ y(o);
332
+ let s = await M(e, c(o, a));
333
+ n = b(s, a);
329
334
  let l = new this(s, t, n, r, i);
330
335
  return await Promise.allSettled(l.pluginsLoaded), l;
331
336
  } catch (e) {
@@ -340,51 +345,51 @@ var r = class {
340
345
  _iframe;
341
346
  constructor(e, t, n, i, a) {
342
347
  if (super(), !e || typeof e.id != "string") throw Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");
343
- if (B.has(t)) throw Error("There is already an instance on this DOM element");
344
- if (!document.getElementById(I)) {
348
+ if (V.has(t)) throw Error("There is already an instance on this DOM element");
349
+ if (!document.getElementById(L)) {
345
350
  let e = n.zIndex || 9999999, t = document.createElement("style");
346
- t.type = "text/css", t.id = I;
347
- let r = "transition:all ease-in-out " + L + "ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e += t + r, "") + r, a = P();
351
+ t.type = "text/css", t.id = L;
352
+ let r = "transition:all ease-in-out " + R + "ms;", i = ["-webkit-", "-o-"].reduce((e, t) => e += t + r, "") + r, a = F();
348
353
  t.innerHTML = `
349
- .${z.CONTAINER}{${R}:${a};}
350
- .${z.POSITION}{position:fixed;top:0;left:0;z-index:${e};opacity:0}
351
- .${z.TRANSITION}{${i}}
352
- .${z.FILL}{width:100%;height:100%;opacity:1}
353
- .${z.ANDROID_HEIGHT}{height:calc(var(${R},1vh)*100)}
354
- .${z.OVERFLOW_HIDDEN}{overflow:hidden}
354
+ .${B.CONTAINER}{${z}:${a};}
355
+ .${B.POSITION}{position:fixed;top:0;left:0;z-index:${e};opacity:0}
356
+ .${B.TRANSITION}{${i}}
357
+ .${B.FILL}{width:100%;height:100%;opacity:1}
358
+ .${B.ANDROID_HEIGHT}{height:calc(var(${z},1vh)*100)}
359
+ .${B.OVERFLOW_HIDDEN}{overflow:hidden}
355
360
  `, document.head.appendChild(t);
356
361
  }
357
362
  this._executeMessage = this._executeMessage.bind(this);
358
363
  let o = new r("website", window, null, this._executeMessage);
359
- this.setMessageHandler(o), this._onResize = this._onResize.bind(this), b() && window.addEventListener("resize", this._onResize), this._container = t, this._initData = n, this._configuratorSettings = e;
364
+ this.setMessageHandler(o), this._onResize = this._onResize.bind(this), x() && window.addEventListener("resize", this._onResize), this._container = t, this._initData = n, this._configuratorSettings = e;
360
365
  let s = this._createIframe();
361
- this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe), B.set(t, !0);
366
+ this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = a, this._container.appendChild(s), this._iframe = s, this.setupPlugins(i, this._iframe), V.set(t, !0);
362
367
  }
363
368
  teardown() {
364
- this._container && B.delete(this._container);
369
+ this._container && V.delete(this._container);
365
370
  let e = this._container.querySelector("iframe");
366
371
  e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
367
372
  }
368
373
  _createIframe() {
369
374
  let e = document.createElement("iframe"), t = this._configuratorSettings?.url || "https://www.roomle.com/t/cp/";
370
- return this._initData.useLocalRoomle && (t = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (t = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (t = this._initData.overrideServerUrl), e.src = t, e.classList.add(z.CONTAINER), e.classList.add(z.FILL), e;
375
+ return this._initData.useLocalRoomle && (t = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (t = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (t = this._initData.overrideServerUrl), e.src = t, e.classList.add(B.CONTAINER), e.classList.add(B.FILL), e;
371
376
  }
372
377
  _onResize() {
373
- F(this._iframe);
378
+ I(this._iframe);
374
379
  }
375
380
  _onUseFullPage() {
376
- this._iframe.classList.add(z.POSITION), document.documentElement.classList.add(z.OVERFLOW_HIDDEN), window.document.body.classList.add(z.OVERFLOW_HIDDEN), b() && (F(this._iframe), this._iframe.classList.add(z.ANDROID_HEIGHT));
381
+ this._iframe.classList.add(B.POSITION), document.documentElement.classList.add(B.OVERFLOW_HIDDEN), window.document.body.classList.add(B.OVERFLOW_HIDDEN), x() && (I(this._iframe), this._iframe.classList.add(B.ANDROID_HEIGHT));
377
382
  }
378
383
  _onBackToWebsite() {
379
- this._iframe.classList.remove(z.POSITION), this._iframe.classList.remove(z.ANDROID_HEIGHT), document.documentElement.classList.remove(z.OVERFLOW_HIDDEN), window.document.body.classList.remove(z.OVERFLOW_HIDDEN);
384
+ this._iframe.classList.remove(B.POSITION), this._iframe.classList.remove(B.ANDROID_HEIGHT), document.documentElement.classList.remove(B.OVERFLOW_HIDDEN), window.document.body.classList.remove(B.OVERFLOW_HIDDEN);
380
385
  }
381
386
  _executeMessage({ message: e, args: t }, n) {
382
- if (n.source && n.source === this._iframe?.contentWindow) return e === E.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(n.source), Promise.resolve({ result: this._initData })) : (console.error("MessageHandler not set"), Promise.resolve({ error: "MessageHandler not set" })) : e === E.SETUP ? (this.handleSetup(t[0]), N(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), N(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
387
+ if (n.source && n.source === this._iframe?.contentWindow) return e === D.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(n.source), Promise.resolve({ result: this._initData })) : (console.error("MessageHandler not set"), Promise.resolve({ error: "MessageHandler not set" })) : e === D.SETUP ? (this.handleSetup(t[0]), P(this.ui.callbacks, "onUseFullPage", this._onUseFullPage), P(this.ui.callbacks, "onBackToWebsite", this._onBackToWebsite), this._waitForIframe(this), setTimeout(() => {
383
388
  if (!this._messageHandler) {
384
389
  console.error("MessageHandler not set");
385
390
  return;
386
391
  }
387
- this._messageHandler.sendMessage(E.WEBSITE_READY);
392
+ this._messageHandler.sendMessage(D.WEBSITE_READY);
388
393
  }, 0), Promise.resolve({ result: null })) : this.executeMessage({
389
394
  message: e,
390
395
  args: t
@@ -392,4 +397,4 @@ var r = class {
392
397
  }
393
398
  };
394
399
  //#endregion
395
- export { E as HANDSHAKE_MESSAGES, M as INTERACTION_CONTAINER_SELECTOR, C as NAMESPACE, w as NAMESPACE_SEPARATOR, T as SDK_CALLBACK, D as WELL_KNOWN_MESSAGES, V as default, j as getConfiguratorSettings, A as getMethodNames, k as isExposable };
400
+ export { D as HANDSHAKE_MESSAGES, N as INTERACTION_CONTAINER_SELECTOR, w as NAMESPACE, T as NAMESPACE_SEPARATOR, E as SDK_CALLBACK, O as WELL_KNOWN_MESSAGES, H as default, M as getConfiguratorSettings, j as getMethodNames, A as isExposable };
@@ -133,7 +133,7 @@ var r = class {
133
133
  return n && ((e) => {
134
134
  let t = /* @__PURE__ */ new RegExp(/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/);
135
135
  return !!(i.includes(e) || t.test(e) || e.endsWith("roomle.com") || e.endsWith("gitlab.io") || e.endsWith("gitlab.com"));
136
- })(n) && (e.configuratorId = "demoConfigurator"), e.customApiUrl = "https://rubens.alpha.roomle.com/api/v2", e.emails = !1, e;
136
+ })(n) && (e.configuratorId = "demoConfigurator"), e.customApiUrl = void 0, e.emails = !1, e;
137
137
  }, f = (e) => {
138
138
  e.featureFlags ||= {}, typeof e.featureFlags.realPartList != "boolean" && (e.featureFlags.realPartList = !0), typeof e.featureFlags.globalCallbacks != "boolean" && (e.featureFlags.globalCallbacks = !0), typeof e.featureFlags.mocAr != "boolean" && (e.featureFlags.mocAr = !1);
139
139
  }, p = () => /(android)/i.test(navigator.userAgent), m = class {
@@ -174,7 +174,7 @@ var r = class {
174
174
  setupPlugins(e, t, n = "website") {
175
175
  for (let r of e) typeof r == "string" && r === "dragIn" ? this.pluginsLoaded.push(new Promise((e, r) => {
176
176
  try {
177
- import("./drag-in-BT6p3GQN.mjs").then((e) => e.n).then(({ DragIn: i }) => {
177
+ import("./drag-in-DXVxlotA.mjs").then((e) => e.n).then(({ DragIn: i }) => {
178
178
  let a = new i(this.ui, t, n, this.viewName);
179
179
  a.init().then(() => {
180
180
  this.plugins.dragIn = a, e();
@@ -306,7 +306,12 @@ var r = class {
306
306
  let n = c(t), r = d();
307
307
  f(r);
308
308
  let i = a(a(r, e.settings || {}), n);
309
- return i.configuratorId = e.id, !i.overrideTenant && e.tenant && (i.overrideTenant = e.tenant), i;
309
+ return i.configuratorId = e.id, !i.overrideTenant && e.tenant && (i.overrideTenant = e.tenant), ((e) => {
310
+ let t = e.featureFlags;
311
+ if (!t || typeof t != "object" || Array.isArray(t)) return;
312
+ let n = t;
313
+ !("enableTwoLevelCatalog" in n) || typeof n.enableTwoLevelCatalog != "boolean" || !1 !== e.enableTwoLevelCatalog && e.enableTwoLevelCatalog !== void 0 || (e.enableTwoLevelCatalog = n.enableTwoLevelCatalog);
314
+ })(i), i;
310
315
  })(l, o);
311
316
  let p = new this(l, t, n, r, i);
312
317
  return await Promise.allSettled(p.pluginsLoaded), p;