@roomle/embedding-lib 5.34.0-debug.1 → 5.34.0-debug.2
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/comlink-BAiXCcU9.mjs +258 -0
- package/comlink-CmT64Qi3.mjs +1 -0
- package/docs/md/web/embedding/CHANGELOG.md +28 -332
- package/{drag-in-BEjBh6zz.mjs → embedding-plugins-CjNos83d.mjs} +15 -14
- package/embedding-plugins-DePKqSKW.mjs +1 -0
- package/embedding-plugins.d.ts +2 -0
- package/embedding-plugins.js +13 -0
- package/embedding-plugins.min.js +1 -0
- package/{from-custom-view-CobBUshK.mjs → from-custom-view-BAiOXktb.mjs} +9 -8
- package/from-custom-view-Ch3rb-JF.mjs +1 -0
- package/from-website-B-Vh-DVX.mjs +1 -0
- package/{from-website-C2cG-X9g.mjs → from-website-BicmMNsE.mjs} +11 -10
- package/hi.d.ts +2 -0
- package/hi.js +106 -0
- package/hi.min.js +1 -0
- package/package.json +19 -9
- package/packages/embedding-lib/src/connector.d.ts +1 -1
- package/packages/embedding-lib/src/embedding-plugins.d.ts +9 -0
- package/packages/embedding-lib/src/hi.d.ts +16 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-callbacks.d.ts +1 -1
- package/packages/embedding-lib/src/homag-intelligence/hi-order-manager.d.ts +3 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-requests.d.ts +1 -4
- package/packages/embedding-lib/src/homag-intelligence/hi-setup.d.ts +4 -0
- package/packages/embedding-lib/src/homag-intelligence/hi-utils.d.ts +1 -0
- package/packages/embedding-lib/src/plugins/drag-in.d.ts +1 -1
- package/packages/embedding-lib/src/plugins/strategy/from-custom-view.d.ts +1 -1
- package/packages/embedding-lib/src/plugins/strategy/from-website.d.ts +1 -1
- package/packages/embedding-lib/src/plugins/strategy/types.d.ts +1 -1
- package/packages/embedding-lib/src/{embedding-lib.d.ts → roomle-embedding-lib.d.ts} +23 -3
- package/packages/embedding-lib/src/utils.d.ts +1 -0
- package/roomle-embedding-lib.d.ts +6 -0
- package/roomle-embedding-lib.js +587 -0
- package/roomle-embedding-lib.min.js +1 -0
- package/touch-drag-BzREygxc.mjs +1 -0
- package/touch-drag-DWISKgWm.mjs +57 -0
- package/utils-D--vltCL.mjs +113 -0
- package/utils-uEcN1DUR.mjs +1 -0
- package/drag-in-BmoiEqfA.mjs +0 -1
- package/from-custom-view-fYea37BE.mjs +0 -1
- package/from-website-CDEUbvDF.mjs +0 -1
- package/index.d.ts +0 -4
- package/packages/embedding-lib/src/example.d.ts +0 -5
- package/packages/embedding-lib/src/examples/activate-deactivate-rd.d.ts +0 -7
- package/packages/embedding-lib/src/examples/api-false.d.ts +0 -7
- package/packages/embedding-lib/src/examples/configurator-only.d.ts +0 -6
- package/packages/embedding-lib/src/examples/download-partlist.d.ts +0 -6
- package/packages/embedding-lib/src/examples/drag-in.d.ts +0 -7
- package/packages/embedding-lib/src/examples/ext-catalog/ext-catalog-connection.d.ts +0 -1
- package/packages/embedding-lib/src/examples/ext-catalog.d.ts +0 -6
- package/packages/embedding-lib/src/examples/ext-selection-overlay.d.ts +0 -7
- package/packages/embedding-lib/src/examples/hi-single-object-configurator.d.ts +0 -11
- package/packages/embedding-lib/src/examples/homag-intelligence-catalog-example.d.ts +0 -11
- package/packages/embedding-lib/src/examples/homag-intelligence-catalog-load-async.d.ts +0 -13
- package/packages/embedding-lib/src/examples/homag-intelligence-example.d.ts +0 -19
- package/packages/embedding-lib/src/examples/planner-and-configurator.d.ts +0 -6
- package/packages/embedding-lib/src/examples/start-and-end-configurator.d.ts +0 -6
- package/packages/embedding-lib/src/examples/utils/api-false/helpers.d.ts +0 -2
- package/packages/embedding-lib/src/examples/utils/drag-listeners.d.ts +0 -3
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/create-catalog.d.ts +0 -3
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/default-api-options.d.ts +0 -21
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/dom-helper.d.ts +0 -12
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/drag-in.d.ts +0 -3
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/nobilia-api-options.d.ts +0 -38
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/overlay.d.ts +0 -2
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/state.d.ts +0 -20
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/utils.d.ts +0 -18
- package/packages/embedding-lib/src/examples/utils/query-params.d.ts +0 -1
- package/packages/embedding-lib/src/examples/utils/server-url.d.ts +0 -1
- package/packages/embedding-lib/src/overview.d.ts +0 -1
- package/roomle-embedding-lib.es.js +0 -833
- package/roomle-embedding-lib.es.min.js +0 -1
- package/roomle-embedding-lib.umd.js +0 -21
- package/roomle-embedding-lib.umd.min.js +0 -1
- package/touch-drag-B5zCf87J.mjs +0 -1
- package/touch-drag-DXJTOrk5.mjs +0 -146
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as t,e,a as n,i as s}from"./utils-uEcN1DUR.mjs";import{T as i}from"./touch-drag-BzREygxc.mjs";import{R as o,a,b as r,c as h,d as g,e as d,f as l,g as m,h as c,i as u,j as _,k as f}from"./embedding-plugins-DePKqSKW.mjs";const p=(t,e,n=0,s=0)=>{const i=e.x+e.width+n,o=e.x-n,a=e.y+e.height+s,r=e.y-s,{x:h,y:g}=t;return h>=o&&h<=i&&g>=r&&g<=a},D=(t,e,n,s=0,i=0)=>{if(n&&(n.hiddenIn||n.visibleIn))return n.visibleIn?p({x:t,y:e},n.visibleIn,s,i):!!n.hiddenIn&&!p({x:t,y:e},n.hiddenIn,-s,-i)};class y{_dragGhostAnimationFrameId=null;_dragGhostRemoveAnimationFrameId=null;_dragGhostElement=null;constructor(t=null){this._dragGhostElement=t}updateDragGhost(t,e,n){this._dragGhostRemoveAnimationFrameId&&(cancelAnimationFrame(this._dragGhostRemoveAnimationFrameId),this._dragGhostRemoveAnimationFrameId=null),!n.ghost?.external&&n.ghost&&(this._dragGhostAnimationFrameId||(this._dragGhostAnimationFrameId=requestAnimationFrame(()=>{(()=>{if(!document.getElementById(a)){const t=document.createElement("style");t.type="text/css",t.id=a,t.innerHTML=`\n ${r}\n ${h}\n `,document.head.appendChild(t)}})();const s={x:t,y:e};!n.ghost&&this._dragGhostElement&&(n.ghost={}),n.ghost&&!n.ghost.element&&this._dragGhostElement&&(n.ghost.element=this._dragGhostElement),(({x:t,y:e},n)=>{let s=document.getElementById(o);if(!s){if(s=document.createElement("div"),n.ghost?.element)s.appendChild(n.ghost.element);else{const t=document.createElement("img");t.src=n.ghost?.url||g,t.width=n.ghost?.width||d,t.height=n.ghost?.height||l,s.appendChild(t)}s.id=o,s.style.position="fixed",s.style.top="0",s.style.left="0",s.style.willChange="transform",s.style.transform="translate3d(0, 0, 0)",s.style.zIndex="9999",s.style.opacity="0.5",D(t,e,n.ghost||{},n.settings?.dragInOverlapX,n.settings?.dragInOverlapY)||(s.style.display="none"),s.style.pointerEvents="none",document.body.appendChild(s)}})(s,n),(({x:t,y:e},n)=>{const s=document.getElementById(o);if(!s)return;let i=n.ghost?.width,a=n.ghost?.height;typeof i>"u"&&(i=s.getBoundingClientRect().width||d),typeof a>"u"&&(a=s.getBoundingClientRect().height||l);const r=t-i/2,h=e-a/2;s.style.transform=`translate3d(${r}px, ${h}px, 0)`,n.ghost&&(D(t,e,n.ghost,n.settings?.dragInOverlapX,n.settings?.dragInOverlapY)?s.style.animation!=m&&(s.style.animation=m):s.style.animation!=c&&(s.style.animation=c))})(s,n),this._dragGhostAnimationFrameId=null})))}removeDragGhost(){this._dragGhostAnimationFrameId&&(cancelAnimationFrame(this._dragGhostAnimationFrameId),this._dragGhostAnimationFrameId=null),this._dragGhostRemoveAnimationFrameId||(this._dragGhostRemoveAnimationFrameId=requestAnimationFrame(()=>{const t=document.getElementById(o);t&&document.body.removeChild(t),this._dragGhostRemoveAnimationFrameId=null}))}}class x{_options={};_instance;_mainDomElement;_currentDrag={};_currentTouch=null;_firefoxDragPosition={x:0,y:0};_onBeforeUpdateDrag=()=>({});isDragging=!1;_firefoxFallback=t=>{if(!this._currentDrag.event)return;t.preventDefault();const e=t||window.event;this._firefoxDragPosition.x=e.pageX||0,this._firefoxDragPosition.y=e.pageY||0};constructor(t,e,n){this._instance=t,this._mainDomElement=e,this._options=n||{},this._firefoxFallback=this._firefoxFallback.bind(this),document.addEventListener("dragover",this._firefoxFallback),this._mainDomElement.parentElement?.addEventListener("dragleave",()=>{this._instance.cancelDragIn()})}beforeUpdateGhost(t){this._onBeforeUpdateDrag=t}dragStart(s,i,o="rml_id"){const a=this._mainDomElement.parentNode;if("relative"!==t(a).position)return;this._mainDomElement.style.pointerEvents="none";let r=a.querySelector("."+u);r||(r=document.createElement("div"),r.classList.add(u),a.appendChild(r)),r.classList.remove(_.DISPLAY_NONE),i.target.getAttribute("draggable");const h=a.querySelector("."+f);this._currentDrag.event=i;const g=i.target,d=g.cloneNode(!0),l=g.getBoundingClientRect();d.style.width=`${l.width}px`,d.style.height=`${l.height}px`,this._currentDrag.ghost=new y(d),this._currentDrag.offset||(this._currentDrag.offset={x:0,y:0});const{clientX:m,clientY:c}=e(i,this._firefoxDragPosition);this._currentDrag.offset.x=m-l.left,this._currentDrag.offset.y=c-l.top,i instanceof DragEvent&&i.dataTransfer&&i.dataTransfer.setDragImage&&i.dataTransfer.setDragImage(h,0,0);const{x:p,y:D}=n(a,this._currentDrag.event||i,this._firefoxDragPosition),x=Math.max(1,p),v=Math.max(1,D);this.isDragging=!0,this._instance.dragInObject(s,x,v,o)}dragUpdate(t){const i=this._mainDomElement.parentNode,{x:o,y:a}=n(i,t,this._firefoxDragPosition);if(0===o&&0===a)return;const r=Math.max(1,o),h=Math.max(1,a);if(1===r&&1===h)return;let g=r,d=h;if(s(t)){const t=this._options.settings?.fingerSize||0;g=Math.max(2,r+t),d=Math.max(2,h-t)}const{x:l,y:m,options:c}=this._onBeforeUpdateDrag(g,d,{}),u=c||{settings:{},ghost:{}};u.ghost||(u.ghost={}),u.ghost.visibleIn&&u.ghost.hiddenIn||(u.ghost.hiddenIn=this._mainDomElement.getBoundingClientRect());const _="number"==typeof l?l:g,f="number"==typeof m?m:d;if(this._currentDrag.ghost){const{clientX:n,clientY:s}=e(t,this._firefoxDragPosition);this._currentDrag.ghost.updateDragGhost(n,s,u)}this._instance.updateDrag(_,f,{})}dragEnd(){this._mainDomElement.style.pointerEvents="all";const t=this._mainDomElement.parentNode;this.isDragging=!1,this._instance.dragInObjectEnd(),this._currentDrag.ghost&&(this._currentDrag.ghost.removeDragGhost(),this._currentDrag.ghost=null),this._currentDrag={},this._firefoxDragPosition={x:0,y:0};const e=t.querySelector("."+u);e&&e.classList.add(_.DISPLAY_NONE)}touchStart(t,e,n="rml_id"){e.preventDefault();const s={};"number"==typeof this._options?.settings?.touchDragDelay&&(s.delay=this._options.settings.touchDragDelay),this._options?.settings?.touchDragEpsilon&&(s.epsilon=this._options.settings.touchDragEpsilon),this._currentTouch=new i(void 0,{onTouchDragStart:(e,s)=>{this.dragStart(t,s,n)}},s),this._currentTouch.onStart(e)}touchMove(t){this._currentTouch&&this._currentTouch.onMove(t),this._currentDrag.event&&this.dragUpdate(t)}touchEnd(){this._currentTouch&&this._currentTouch.onEnd(),this._currentTouch=null,this.dragEnd()}dispose(){document.removeEventListener("dragover",this._firefoxFallback)}releaseInput(t){}}export{x as DragInFromWebsiteStrategy};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { g as b, e as I, a as A, i as F
|
|
2
|
-
import {
|
|
1
|
+
import { g as b, e as I, a as A, i as F } from "./utils-D--vltCL.mjs";
|
|
2
|
+
import { T as M } from "./touch-drag-DWISKgWm.mjs";
|
|
3
|
+
import { R as m, a as E, b as C, c as N, d as O, e as R, f as T, g as G, h as p, i as y, j as x, k as w } from "./embedding-plugins-CjNos83d.mjs";
|
|
3
4
|
const S = (r, n, t = 0, e = 0) => {
|
|
4
5
|
const s = n.x + n.width + t, i = n.x - t, a = n.y + n.height + e, o = n.y - e, { x: h, y: g } = r;
|
|
5
6
|
return h >= i && h <= s && g >= o && g <= a;
|
|
@@ -77,7 +78,7 @@ class U {
|
|
|
77
78
|
}));
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
|
-
class
|
|
81
|
+
class $ {
|
|
81
82
|
_options = {};
|
|
82
83
|
_instance;
|
|
83
84
|
_mainDomElement;
|
|
@@ -122,16 +123,16 @@ class k {
|
|
|
122
123
|
this._currentDrag.event = t;
|
|
123
124
|
const g = t.target, c = g.cloneNode(!0), l = g.getBoundingClientRect();
|
|
124
125
|
c.style.width = `${l.width}px`, c.style.height = `${l.height}px`, this._currentDrag.ghost = new U(c), this._currentDrag.offset || (this._currentDrag.offset = { x: 0, y: 0 });
|
|
125
|
-
const { clientX: d, clientY:
|
|
126
|
+
const { clientX: d, clientY: f } = I(
|
|
126
127
|
t,
|
|
127
128
|
this._firefoxDragPosition
|
|
128
129
|
);
|
|
129
|
-
this._currentDrag.offset.x = d - l.left, this._currentDrag.offset.y =
|
|
130
|
-
const { x:
|
|
130
|
+
this._currentDrag.offset.x = d - l.left, this._currentDrag.offset.y = f - l.top, t instanceof DragEvent && t.dataTransfer && t.dataTransfer.setDragImage && t.dataTransfer.setDragImage(h, 0, 0);
|
|
131
|
+
const { x: u, y: _ } = A(
|
|
131
132
|
s,
|
|
132
133
|
this._currentDrag.event || t,
|
|
133
134
|
this._firefoxDragPosition
|
|
134
|
-
), D = Math.max(1,
|
|
135
|
+
), D = Math.max(1, u), L = Math.max(1, _);
|
|
135
136
|
this.isDragging = !0, this._instance.dragInObject(n, D, L, e);
|
|
136
137
|
}
|
|
137
138
|
dragUpdate(n) {
|
|
@@ -152,7 +153,7 @@ class k {
|
|
|
152
153
|
options: l
|
|
153
154
|
} = this._onBeforeUpdateDrag(o, h, {}), d = l || { settings: {}, ghost: {} };
|
|
154
155
|
d.ghost || (d.ghost = {}), d.ghost.visibleIn && d.ghost.hiddenIn || (d.ghost.hiddenIn = this._mainDomElement.getBoundingClientRect());
|
|
155
|
-
const
|
|
156
|
+
const f = typeof g == "number" ? g : o, u = typeof c == "number" ? c : h;
|
|
156
157
|
if (this._currentDrag.ghost) {
|
|
157
158
|
const { clientX: _, clientY: D } = I(
|
|
158
159
|
n,
|
|
@@ -160,7 +161,7 @@ class k {
|
|
|
160
161
|
);
|
|
161
162
|
this._currentDrag.ghost.updateDragGhost(_, D, d);
|
|
162
163
|
}
|
|
163
|
-
this._instance.updateDrag(
|
|
164
|
+
this._instance.updateDrag(f, u, {});
|
|
164
165
|
}
|
|
165
166
|
dragEnd() {
|
|
166
167
|
this._mainDomElement.style.pointerEvents = "all";
|
|
@@ -197,5 +198,5 @@ class k {
|
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
export {
|
|
200
|
-
|
|
201
|
+
$ as DragInFromWebsiteStrategy
|
|
201
202
|
};
|
package/hi.d.ts
ADDED
package/hi.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { c as b } from "./utils-D--vltCL.mjs";
|
|
2
|
+
const u = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=", y = async (o, e, t, s = { property: "default" }) => {
|
|
3
|
+
const n = t.serverOptions ?? {}, r = {
|
|
4
|
+
headers: {
|
|
5
|
+
"Content-Type": e === "json" ? "application/json" : "text/plain",
|
|
6
|
+
"Access-Control-Allow-Origin": "*"
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
n.language && (r.headers["Accept-Language"] = n.language);
|
|
10
|
+
try {
|
|
11
|
+
const a = performance.now(), { baseUrl: c, subscriptionId: p, key: d, endpointUrl: l } = n, m = await fetch(
|
|
12
|
+
(c ?? u) + encodeURIComponent(o) + `&subscriptionId=${encodeURIComponent(p || "")}` + (d ? `&apiKey=${encodeURIComponent(d)}` : "") + (l ? `&baseUrl=${encodeURIComponent(l)}` : ""),
|
|
13
|
+
r
|
|
14
|
+
), C = performance.now() - a;
|
|
15
|
+
if (!m.ok)
|
|
16
|
+
throw console.warn(`Failed to fetch data from ${s.property}`), new Error(
|
|
17
|
+
`Failed to fetch data from ${o}: ${m.statusText}`
|
|
18
|
+
);
|
|
19
|
+
return console.info(`Success to fetch data from ${s.property}`), console.info(
|
|
20
|
+
`The data for ${s.property} was fetched in ${C} milliseconds`
|
|
21
|
+
), m;
|
|
22
|
+
} catch (a) {
|
|
23
|
+
throw console.warn(`Failed to fetch data from ${s.property}`), console.error(a), a;
|
|
24
|
+
}
|
|
25
|
+
}, U = {
|
|
26
|
+
"e2fe8b3d-da31-4a20-92ab-ab6e3839300e": /* @__PURE__ */ new Set(["Furniture_Smith"])
|
|
27
|
+
}, f = (o, e) => {
|
|
28
|
+
const { libraryId: t, serverOptions: s } = o;
|
|
29
|
+
return s?.subscriptionId && U[s.subscriptionId]?.has(t) ? `api/pos/${e}?libraryId=${t}` : `api/pos/libraries/${t}/${e}`;
|
|
30
|
+
}, w = async (o) => await (await y(
|
|
31
|
+
f(o, "articles"),
|
|
32
|
+
"json",
|
|
33
|
+
o,
|
|
34
|
+
{ property: "articles" }
|
|
35
|
+
)).json(), h = async (o) => await (await y(
|
|
36
|
+
f(o, "masterData"),
|
|
37
|
+
"json",
|
|
38
|
+
o,
|
|
39
|
+
{ property: "masterData" }
|
|
40
|
+
)).json(), I = async (o) => {
|
|
41
|
+
let t = await (await y(
|
|
42
|
+
f(o, "calc.js"),
|
|
43
|
+
"text",
|
|
44
|
+
o,
|
|
45
|
+
{
|
|
46
|
+
property: "calc.js"
|
|
47
|
+
}
|
|
48
|
+
)).text();
|
|
49
|
+
if (!t)
|
|
50
|
+
throw new Error("Script load error");
|
|
51
|
+
return t;
|
|
52
|
+
}, j = (o) => ({
|
|
53
|
+
onLoadJavascript: (e) => I(o),
|
|
54
|
+
onLoadArticleCatalog: (e) => w(o),
|
|
55
|
+
onLoadMasterData: (e) => h(o)
|
|
56
|
+
}), g = async (o, e, t, s = {}) => {
|
|
57
|
+
const { baseUrl: n, om: r } = o.serverOptions ?? {}, a = encodeURIComponent(r?.endpointUrl || ""), c = encodeURIComponent(r?.subscriptionId || ""), p = r?.key || "";
|
|
58
|
+
return await (await fetch(
|
|
59
|
+
(n ?? u) + `${encodeURIComponent(t)}&subscriptionId=${c}&apiKey=${p}&baseUrl=${a}`,
|
|
60
|
+
{
|
|
61
|
+
method: "POST",
|
|
62
|
+
body: JSON.stringify(e),
|
|
63
|
+
headers: {
|
|
64
|
+
"Content-Type": "application/json",
|
|
65
|
+
...s
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
)).json();
|
|
69
|
+
}, v = async (o, e, t = {}) => {
|
|
70
|
+
const { baseUrl: s, om: n } = o.serverOptions ?? {}, r = encodeURIComponent(n?.endpointUrl || ""), a = encodeURIComponent(n?.subscriptionId || ""), c = n?.key || "";
|
|
71
|
+
return await (await fetch(
|
|
72
|
+
(s ?? u) + `${encodeURIComponent(e)}&subscriptionId=${a}&apiKey=${c}&baseUrl=${r}`,
|
|
73
|
+
{
|
|
74
|
+
method: "GET",
|
|
75
|
+
headers: {
|
|
76
|
+
"Content-Type": "application/json",
|
|
77
|
+
...t
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
)).json();
|
|
81
|
+
};
|
|
82
|
+
let i = null;
|
|
83
|
+
const T = async (o, e = {}) => {
|
|
84
|
+
i && window.removeEventListener("message", i);
|
|
85
|
+
const t = typeof o == "string" ? { libraryId: o } : o;
|
|
86
|
+
e.onLoadJavascript === void 0 && (e.onLoadJavascript = (n) => I(t)), e.onLoadArticleCatalog === void 0 && (e.onLoadArticleCatalog = (n) => w(t)), e.onLoadMasterData === void 0 && (e.onLoadMasterData = (n) => h(t));
|
|
87
|
+
const { expose: s } = await import("./comlink-BAiXCcU9.mjs");
|
|
88
|
+
i = (n) => {
|
|
89
|
+
if (n.data.type === "connect_hi" && n.data.port) {
|
|
90
|
+
const r = n.data.port;
|
|
91
|
+
r.start?.(), s(b(e), r);
|
|
92
|
+
}
|
|
93
|
+
}, window.addEventListener("message", i);
|
|
94
|
+
}, A = () => {
|
|
95
|
+
i && (window.removeEventListener("message", i), i = null);
|
|
96
|
+
};
|
|
97
|
+
export {
|
|
98
|
+
A as cleanupHi,
|
|
99
|
+
j as createHiLibraryCallbacks,
|
|
100
|
+
w as libLoadArticleCatalog,
|
|
101
|
+
I as libLoadCalcScript,
|
|
102
|
+
h as libLoadMasterData,
|
|
103
|
+
v as omGetRequest,
|
|
104
|
+
g as omPostRequest,
|
|
105
|
+
T as setupHi
|
|
106
|
+
};
|
package/hi.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./utils-uEcN1DUR.mjs";const t="https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=",a=async(e,a,o,n={property:"default"})=>{const s=o.serverOptions??{},r={headers:{"Content-Type":"json"===a?"application/json":"text/plain","Access-Control-Allow-Origin":"*"}};s.language&&(r.headers["Accept-Language"]=s.language);try{performance.now();const{baseUrl:a,subscriptionId:o,key:n,endpointUrl:i}=s,c=await fetch((a??t)+encodeURIComponent(e)+`&subscriptionId=${encodeURIComponent(o||"")}`+(n?`&apiKey=${encodeURIComponent(n)}`:"")+(i?`&baseUrl=${encodeURIComponent(i)}`:""),r);if(performance.now(),!c.ok)throw new Error(`Failed to fetch data from ${e}: ${c.statusText}`);return c}catch(e){throw e}},o={"e2fe8b3d-da31-4a20-92ab-ab6e3839300e":new Set(["Furniture_Smith"])},n=(e,t)=>{const{libraryId:a,serverOptions:n}=e;return n?.subscriptionId&&o[n.subscriptionId]?.has(a)?`api/pos/${t}?libraryId=${a}`:`api/pos/libraries/${a}/${t}`},s=async e=>await(await a(n(e,"articles"),"json",e,{property:"articles"})).json(),r=async e=>await(await a(n(e,"masterData"),"json",e,{property:"masterData"})).json(),i=async e=>{let t=await(await a(n(e,"calc.js"),"text",e,{property:"calc.js"})).text();if(!t)throw new Error("Script load error");return t},c=e=>({onLoadJavascript:t=>i(e),onLoadArticleCatalog:t=>s(e),onLoadMasterData:t=>r(e)}),p=async(e,a,o,n={})=>{const{baseUrl:s,om:r}=e.serverOptions??{},i=encodeURIComponent(r?.endpointUrl||""),c=encodeURIComponent(r?.subscriptionId||""),p=r?.key||"";return await(await fetch((s??t)+`${encodeURIComponent(o)}&subscriptionId=${c}&apiKey=${p}&baseUrl=${i}`,{method:"POST",body:JSON.stringify(a),headers:{"Content-Type":"application/json",...n}})).json()},d=async(e,a,o={})=>{const{baseUrl:n,om:s}=e.serverOptions??{},r=encodeURIComponent(s?.endpointUrl||""),i=encodeURIComponent(s?.subscriptionId||""),c=s?.key||"";return await(await fetch((n??t)+`${encodeURIComponent(a)}&subscriptionId=${i}&apiKey=${c}&baseUrl=${r}`,{method:"GET",headers:{"Content-Type":"application/json",...o}})).json()};let l=null;const m=async(t,a={})=>{l&&window.removeEventListener("message",l);const o="string"==typeof t?{libraryId:t}:t;void 0===a.onLoadJavascript&&(a.onLoadJavascript=e=>i(o)),void 0===a.onLoadArticleCatalog&&(a.onLoadArticleCatalog=e=>s(o)),void 0===a.onLoadMasterData&&(a.onLoadMasterData=e=>r(o));const{expose:n}=await import("./comlink-CmT64Qi3.mjs");l=t=>{if("connect_hi"===t.data.type&&t.data.port){const o=t.data.port;o.start?.(),n(e(a),o)}},window.addEventListener("message",l)},u=()=>{l&&(window.removeEventListener("message",l),l=null)};export{u as cleanupHi,c as createHiLibraryCallbacks,s as libLoadArticleCatalog,i as libLoadCalcScript,r as libLoadMasterData,d as omGetRequest,p as omPostRequest,m as setupHi};
|
package/package.json
CHANGED
|
@@ -1,24 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "5.34.0-debug.
|
|
4
|
-
"description": "This is a small library which can be used to communicate with the Roomle Configurator",
|
|
3
|
+
"version": "5.34.0-debug.2",
|
|
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
|
-
"main": "./roomle-embedding-lib.
|
|
7
|
-
"module": "./roomle-embedding-lib.es.js",
|
|
8
|
-
"browser": "./roomle-embedding-lib.es.js",
|
|
6
|
+
"main": "./roomle-embedding-lib.js",
|
|
9
7
|
"types": "./index.d.ts",
|
|
10
8
|
"files": [
|
|
11
9
|
"./"
|
|
12
10
|
],
|
|
13
11
|
"exports": {
|
|
14
12
|
".": {
|
|
15
|
-
"import": "./roomle-embedding-lib.
|
|
16
|
-
"require": "./roomle-embedding-lib.umd.js",
|
|
13
|
+
"import": "./roomle-embedding-lib.js",
|
|
17
14
|
"types": "./index.d.ts"
|
|
18
15
|
},
|
|
19
16
|
"./min": {
|
|
20
|
-
"import": "./roomle-embedding-lib.
|
|
21
|
-
|
|
17
|
+
"import": "./roomle-embedding-lib.min.js"
|
|
18
|
+
},
|
|
19
|
+
"./homag-intelligence": {
|
|
20
|
+
"import": "./hi.js",
|
|
21
|
+
"types": "./hi.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./homag-intelligence/min": {
|
|
24
|
+
"import": "./hi.min.js"
|
|
25
|
+
},
|
|
26
|
+
"./plugins": {
|
|
27
|
+
"import": "./embedding-plugins.js",
|
|
28
|
+
"types": "./embedding-plugins.d.ts"
|
|
29
|
+
},
|
|
30
|
+
"./plugins/min": {
|
|
31
|
+
"import": "./embedding-plugins.min.js"
|
|
22
32
|
}
|
|
23
33
|
},
|
|
24
34
|
"scripts": {
|
|
@@ -3,7 +3,7 @@ import { ExposedAnalyticsCallbacks } from '../../../src/configurator/embedding/e
|
|
|
3
3
|
import { ExposedApi } from '../../../src/configurator/embedding/exposed-api';
|
|
4
4
|
import { GlobalCallback, RoomleConfigurator } from '../../web-sdk/packages';
|
|
5
5
|
import { EmbeddingCommand, MessageHandler } from '../../common/src/utils/message-handler';
|
|
6
|
-
import { AvailablePlugins, PluginDefinitions } from './embedding-lib';
|
|
6
|
+
import { AvailablePlugins, PluginDefinitions } from './roomle-embedding-lib';
|
|
7
7
|
import { EmbeddingPluginMode } from './plugins/types';
|
|
8
8
|
import { PossibleCustomViewsAndMain } from '../../../src/configurator/embedding/custom-views';
|
|
9
9
|
export interface RoomleEmbeddingApiKeys {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DragInOptions } from './plugins/types';
|
|
2
|
+
export { RML_DRAG_IN_STYLES_ID, RML_DRAG_GHOST_FADE_IN_ANIMATION_CSS, RML_DRAG_GHOST_FADE_OUT_ANIMATION_CSS, RML_DRAG_IN_DRAG_ELEMENT_ID, RML_DRAG_IN_FALLBACK_GHOST_URL, RML_DRAG_IN_FALLBACK_GHOST_WIDTH, RML_DRAG_IN_FALLBACK_GHOST_HEIGHT, RML_DRAG_GHOST_FADE_IN, RML_DRAG_GHOST_FADE_OUT, } from './plugins/constants';
|
|
3
|
+
export type { DragGhostOptions, DragInOptions } from './plugins/types';
|
|
4
|
+
export type OnBeforeUpdateDragGhost = (x: number, y: number, options: DragInOptions) => {
|
|
5
|
+
x?: number;
|
|
6
|
+
y?: number;
|
|
7
|
+
options?: Partial<DragInOptions>;
|
|
8
|
+
};
|
|
9
|
+
export { DragIn } from './plugins/drag-in';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Homag Intelligence exports for roomle/embedding-lib
|
|
3
|
+
*
|
|
4
|
+
* These exports are separated into their own entry point to keep the main
|
|
5
|
+
* embedding library bundle size small. Only import from this module if you
|
|
6
|
+
* need Homag Intelligence functionality.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import { createHiLibraryCallbacks, libLoadArticleCatalog } from '@roomle/embedding-lib/homag-intelligence';
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export { createHiLibraryCallbacks } from './homag-intelligence/hi-callbacks';
|
|
14
|
+
export { libLoadArticleCatalog, libLoadMasterData, libLoadCalcScript, } from './homag-intelligence/hi-requests';
|
|
15
|
+
export { omPostRequest, omGetRequest, } from './homag-intelligence/hi-order-manager';
|
|
16
|
+
export { setupHi, cleanupHi } from './homag-intelligence/hi-setup';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { HomagIntelligenceInitData } from '../../../web-sdk/packages
|
|
1
|
+
import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
|
|
2
2
|
import { HiCallbacks } from '../types';
|
|
3
3
|
export declare const createHiLibraryCallbacks: (hiInitData: HomagIntelligenceInitData) => HiCallbacks;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
|
|
2
|
+
export declare const omPostRequest: (hiInitData: HomagIntelligenceInitData, body: any, url: string, extraHeaders?: Record<string, string>) => Promise<any>;
|
|
3
|
+
export declare const omGetRequest: (hiInitData: HomagIntelligenceInitData, url: string, extraHeaders?: Record<string, string>) => Promise<any>;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { HomagIntelligenceInitData } from '../../../web-sdk/packages
|
|
2
|
-
export declare const fetchJSONData: (url: string) => Promise<any>;
|
|
1
|
+
import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
|
|
3
2
|
export declare const libLoadArticleCatalog: (hiInitData: HomagIntelligenceInitData) => Promise<any>;
|
|
4
3
|
export declare const libLoadMasterData: (hiInitData: HomagIntelligenceInitData) => Promise<any>;
|
|
5
4
|
export declare const libLoadCalcScript: (hiInitData: HomagIntelligenceInitData) => Promise<string>;
|
|
6
|
-
export declare const omPostRequest: (hiInitData: HomagIntelligenceInitData, body: any, url: string, extraHeaders?: {}) => Promise<any>;
|
|
7
|
-
export declare const omGetRequest: (hiInitData: HomagIntelligenceInitData, url: string, extraHeaders?: {}) => Promise<any>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { HiCallbacks } from '../types';
|
|
2
|
+
import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
|
|
3
|
+
export declare const setupHi: (libraryIdOrOptions: HomagIntelligenceInitData | string, callbacks?: Partial<HiCallbacks>) => Promise<void>;
|
|
4
|
+
export declare const cleanupHi: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HOMAG_INTELLIGENCE_ENDPOINT = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=";
|
|
@@ -3,7 +3,7 @@ import { ExposedApi } from '../../../../src/configurator/embedding/exposed-api';
|
|
|
3
3
|
import { DragInSettings, EmbeddingPlugin, EmbeddingPluginMode } from './types';
|
|
4
4
|
import { PossibleCustomViewsAndMain } from '../../../../src/configurator/embedding/custom-views';
|
|
5
5
|
import { DragInStrategy } from './strategy/types';
|
|
6
|
-
import { OnBeforeUpdateDragGhost } from '
|
|
6
|
+
import { OnBeforeUpdateDragGhost } from '../embedding-plugins';
|
|
7
7
|
export declare class DragIn extends EmbeddingPlugin implements DragInStrategy {
|
|
8
8
|
options: DragInSettings;
|
|
9
9
|
private _strategy;
|
|
@@ -3,7 +3,7 @@ import { RapiId, ID_TYPE } from '../../../../web-sdk/packages';
|
|
|
3
3
|
import { ExposedApi } from '../../../../../src/configurator/embedding/exposed-api';
|
|
4
4
|
import { DragInSettings } from '../types';
|
|
5
5
|
import { PossibleCustomViewsAndMain } from '../../../../../src/configurator/embedding/custom-views';
|
|
6
|
-
import { OnBeforeUpdateDragGhost } from '
|
|
6
|
+
import { OnBeforeUpdateDragGhost } from '../../embedding-plugins';
|
|
7
7
|
export declare class DragInFromCustomViewStrategy implements DragInStrategy {
|
|
8
8
|
private _options;
|
|
9
9
|
private _instance;
|
|
@@ -2,7 +2,7 @@ import { DragInStrategy } from './types';
|
|
|
2
2
|
import { RapiId, ID_TYPE } from '../../../../web-sdk/packages';
|
|
3
3
|
import { ExposedApi } from '../../../../../src/configurator/embedding/exposed-api';
|
|
4
4
|
import { DragInOptions } from '../types';
|
|
5
|
-
import { OnBeforeUpdateDragGhost } from '
|
|
5
|
+
import { OnBeforeUpdateDragGhost } from '../../embedding-plugins';
|
|
6
6
|
export declare class DragInFromWebsiteStrategy implements DragInStrategy {
|
|
7
7
|
private _options;
|
|
8
8
|
private _instance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RapiId } from '../../../../web-sdk/packages';
|
|
2
|
-
import { OnBeforeUpdateDragGhost } from '
|
|
2
|
+
import { OnBeforeUpdateDragGhost } from '../../embedding-plugins';
|
|
3
3
|
export interface DragInStrategy {
|
|
4
4
|
isDragging: boolean;
|
|
5
5
|
dragStart(id: RapiId, event: DragEvent | TouchEvent | MouseEvent, type: string): void;
|
|
@@ -1,9 +1,29 @@
|
|
|
1
|
-
import { UiInitData } from '../../../src/configurator/embedding/types';
|
|
1
|
+
import { ConfiguratorSettings, UiInitData } from '../../../src/configurator/embedding/types';
|
|
2
2
|
import { PossibleCustomViews } from '../../../src/configurator/embedding/custom-views';
|
|
3
3
|
import { ConfiguratorUiCallbacks, RoomleConfigurator, RoomleGLBViewer, RoomlePlanner } from '../../web-sdk/packages';
|
|
4
4
|
import { DragIn } from './plugins/drag-in';
|
|
5
|
-
import { Connector } from './connector';
|
|
5
|
+
import { Connector, RoomleEmbeddingApiKeys } from './connector';
|
|
6
6
|
import { HiCallbacks } from './types';
|
|
7
|
+
export declare const NAMESPACE: {
|
|
8
|
+
[key: string]: keyof RoomleEmbeddingApiKeys | 'callbacks';
|
|
9
|
+
};
|
|
10
|
+
export declare const NAMESPACE_SEPARATOR = ".";
|
|
11
|
+
export declare const SDK_CALLBACK: string;
|
|
12
|
+
export declare const HANDSHAKE_MESSAGES: {
|
|
13
|
+
REQUEST_BOOT: string;
|
|
14
|
+
SETUP: string;
|
|
15
|
+
WEBSITE_READY: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const WELL_KNOWN_MESSAGES: {
|
|
18
|
+
GET_METHODS: string;
|
|
19
|
+
RETURN_METHODS: string;
|
|
20
|
+
REGISTER_CUSTOM_VIEW: string;
|
|
21
|
+
REGISTER_CUSTOM_VIEW_DONE: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const isExposable: (name: string) => boolean;
|
|
24
|
+
export declare const getMethodNames: (proto: any, namespace: string, isCallback?: boolean) => string[];
|
|
25
|
+
export declare const getConfiguratorSettings: (configuratorId: string, initData: UiInitData) => Promise<ConfiguratorSettings>;
|
|
26
|
+
export declare const INTERACTION_CONTAINER_SELECTOR = "data-rml-interaction-container";
|
|
7
27
|
interface PluginMap {
|
|
8
28
|
dragIn: typeof DragIn;
|
|
9
29
|
}
|
|
@@ -61,4 +81,4 @@ export default class RoomleEmbeddingApi<SdkType, SdkCallbacks> extends Connector
|
|
|
61
81
|
private _onBackToWebsite;
|
|
62
82
|
private _executeMessage;
|
|
63
83
|
}
|
|
64
|
-
export {};
|
|
84
|
+
export { type Connector } from './connector';
|