@roomle/embedding-lib 6.0.0 → 6.1.0-alpha.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/browser-BhHw2H1M.mjs +1 -0
- package/browser-CUgD7zyH.mjs +21 -0
- package/docs/md/web/embedding/CHANGELOG.md +151 -571
- package/{embedding-plugins-CjNos83d.mjs → embedding-plugins-Cm7O1pKC.mjs} +2 -2
- package/{embedding-plugins-DePKqSKW.mjs → embedding-plugins-Dzhuj1By.mjs} +1 -1
- package/embedding-plugins.js +1 -1
- package/embedding-plugins.min.js +1 -1
- package/from-custom-view-5SS9UqAH.mjs +197 -0
- package/from-custom-view-CfMGS1-t.mjs +1 -0
- package/from-website-CFTjWbqp.mjs +230 -0
- package/from-website-ExTzmsnv.mjs +1 -0
- package/hi.js +52 -49
- package/hi.min.js +1 -1
- package/package.json +1 -1
- package/packages/embedding-lib/src/homag-intelligence/hi-setup.d.ts +3 -1
- package/packages/embedding-lib/src/plugins/strategy/from-custom-view.d.ts +6 -1
- package/packages/embedding-lib/src/plugins/strategy/from-website.d.ts +6 -1
- package/packages/embedding-lib/src/roomle-embedding-lib.d.ts +1 -0
- package/packages/embedding-lib/src/utils.d.ts +1 -0
- package/roomle-embedding-lib.js +123 -139
- package/roomle-embedding-lib.min.js +1 -1
- package/{touch-drag-DWISKgWm.mjs → touch-drag-CfMLD_hM.mjs} +1 -1
- package/{touch-drag-BzREygxc.mjs → touch-drag-TGCsdNqP.mjs} +1 -1
- package/utils-BqTPLNLs.mjs +1 -0
- package/utils-Dav4kGNW.mjs +150 -0
- package/from-custom-view-BAiOXktb.mjs +0 -164
- package/from-custom-view-Ch3rb-JF.mjs +0 -1
- package/from-website-B-Vh-DVX.mjs +0 -1
- package/from-website-BicmMNsE.mjs +0 -202
- package/utils-D--vltCL.mjs +0 -113
- package/utils-uEcN1DUR.mjs +0 -1
package/hi.js
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
import { c as b } from "./utils-
|
|
2
|
-
|
|
1
|
+
import { c as b } from "./utils-Dav4kGNW.mjs";
|
|
2
|
+
import { g as L } from "./browser-CUgD7zyH.mjs";
|
|
3
|
+
const m = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=", f = async (e, o, t, s = { property: "default" }) => {
|
|
3
4
|
const n = t.serverOptions ?? {}, r = {
|
|
4
5
|
headers: {
|
|
5
|
-
"Content-Type":
|
|
6
|
+
"Content-Type": o === "json" ? "application/json" : "text/plain",
|
|
6
7
|
"Access-Control-Allow-Origin": "*"
|
|
7
8
|
}
|
|
8
9
|
};
|
|
9
10
|
n.language && (r.headers["Accept-Language"] = n.language);
|
|
10
11
|
try {
|
|
11
|
-
const a = performance.now(), { baseUrl: c, subscriptionId: p, key: d, endpointUrl: l } = n,
|
|
12
|
-
(c ??
|
|
12
|
+
const a = performance.now(), { baseUrl: c, subscriptionId: p, key: d, endpointUrl: l } = n, u = await fetch(
|
|
13
|
+
(c ?? m) + encodeURIComponent(e) + `&subscriptionId=${encodeURIComponent(p || "")}` + (d ? `&apiKey=${encodeURIComponent(d)}` : "") + (l ? `&baseUrl=${encodeURIComponent(l)}` : ""),
|
|
13
14
|
r
|
|
14
|
-
),
|
|
15
|
-
if (!
|
|
15
|
+
), I = performance.now() - a;
|
|
16
|
+
if (!u.ok)
|
|
16
17
|
throw console.warn(`Failed to fetch data from ${s.property}`), new Error(
|
|
17
|
-
`Failed to fetch data from ${
|
|
18
|
+
`Failed to fetch data from ${e}: ${u.statusText}`
|
|
18
19
|
);
|
|
19
20
|
return console.info(`Success to fetch data from ${s.property}`), console.info(
|
|
20
|
-
`The data for ${s.property} was fetched in ${
|
|
21
|
-
),
|
|
21
|
+
`The data for ${s.property} was fetched in ${I} milliseconds`
|
|
22
|
+
), u;
|
|
22
23
|
} catch (a) {
|
|
23
24
|
throw console.warn(`Failed to fetch data from ${s.property}`), console.error(a), a;
|
|
24
25
|
}
|
|
25
|
-
},
|
|
26
|
+
}, h = {
|
|
26
27
|
"e2fe8b3d-da31-4a20-92ab-ab6e3839300e": /* @__PURE__ */ new Set(["Furniture_Smith"])
|
|
27
|
-
},
|
|
28
|
-
const { libraryId: t, serverOptions: s } =
|
|
29
|
-
return s?.subscriptionId &&
|
|
30
|
-
}, w = async (
|
|
31
|
-
|
|
28
|
+
}, y = (e, o) => {
|
|
29
|
+
const { libraryId: t, serverOptions: s } = e;
|
|
30
|
+
return s?.subscriptionId && h[s.subscriptionId]?.has(t) ? `api/pos/${o}?libraryId=${t}` : `api/pos/libraries/${t}/${o}`;
|
|
31
|
+
}, w = async (e) => await (await f(
|
|
32
|
+
y(e, "articles"),
|
|
32
33
|
"json",
|
|
33
|
-
|
|
34
|
+
e,
|
|
34
35
|
{ property: "articles" }
|
|
35
|
-
)).json(),
|
|
36
|
-
|
|
36
|
+
)).json(), g = async (e) => await (await f(
|
|
37
|
+
y(e, "masterData"),
|
|
37
38
|
"json",
|
|
38
|
-
|
|
39
|
+
e,
|
|
39
40
|
{ property: "masterData" }
|
|
40
|
-
)).json(),
|
|
41
|
-
let t = await (await
|
|
42
|
-
|
|
41
|
+
)).json(), C = async (e) => {
|
|
42
|
+
let t = await (await f(
|
|
43
|
+
y(e, "calc.js"),
|
|
43
44
|
"text",
|
|
44
|
-
|
|
45
|
+
e,
|
|
45
46
|
{
|
|
46
47
|
property: "calc.js"
|
|
47
48
|
}
|
|
@@ -49,27 +50,27 @@ const u = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?u
|
|
|
49
50
|
if (!t)
|
|
50
51
|
throw new Error("Script load error");
|
|
51
52
|
return t;
|
|
52
|
-
},
|
|
53
|
-
onLoadJavascript: (
|
|
54
|
-
onLoadArticleCatalog: (
|
|
55
|
-
onLoadMasterData: (
|
|
56
|
-
}),
|
|
57
|
-
const { baseUrl: n, om: r } =
|
|
53
|
+
}, j = (e) => ({
|
|
54
|
+
onLoadJavascript: (o) => C(e),
|
|
55
|
+
onLoadArticleCatalog: (o) => w(e),
|
|
56
|
+
onLoadMasterData: (o) => g(e)
|
|
57
|
+
}), A = async (e, o, t, s = {}) => {
|
|
58
|
+
const { baseUrl: n, om: r } = e.serverOptions ?? {}, a = encodeURIComponent(r?.endpointUrl || ""), c = encodeURIComponent(r?.subscriptionId || ""), p = r?.key || "";
|
|
58
59
|
return await (await fetch(
|
|
59
|
-
(n ??
|
|
60
|
+
(n ?? m) + `${encodeURIComponent(t)}&subscriptionId=${c}&apiKey=${p}&baseUrl=${a}`,
|
|
60
61
|
{
|
|
61
62
|
method: "POST",
|
|
62
|
-
body: JSON.stringify(
|
|
63
|
+
body: JSON.stringify(o),
|
|
63
64
|
headers: {
|
|
64
65
|
"Content-Type": "application/json",
|
|
65
66
|
...s
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
)).json();
|
|
69
|
-
},
|
|
70
|
-
const { baseUrl: s, om: n } =
|
|
70
|
+
}, E = async (e, o, t = {}) => {
|
|
71
|
+
const { baseUrl: s, om: n } = e.serverOptions ?? {}, r = encodeURIComponent(n?.endpointUrl || ""), a = encodeURIComponent(n?.subscriptionId || ""), c = n?.key || "";
|
|
71
72
|
return await (await fetch(
|
|
72
|
-
(s ??
|
|
73
|
+
(s ?? m) + `${encodeURIComponent(o)}&subscriptionId=${a}&apiKey=${c}&baseUrl=${r}`,
|
|
73
74
|
{
|
|
74
75
|
method: "GET",
|
|
75
76
|
headers: {
|
|
@@ -78,34 +79,36 @@ const u = "https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?u
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
)).json();
|
|
82
|
+
}, U = (e, o) => {
|
|
83
|
+
e.serverOptions || (e.serverOptions = {}), !e.serverOptions.language && o?.locale && (e.serverOptions.language = o.locale), e.serverOptions.language || (e.serverOptions.language = L(null, !0));
|
|
81
84
|
};
|
|
82
85
|
let i = null;
|
|
83
|
-
const
|
|
86
|
+
const _ = async (e, o = {}) => {
|
|
84
87
|
i && window.removeEventListener("message", i);
|
|
85
|
-
const t = typeof
|
|
86
|
-
|
|
88
|
+
const t = typeof e == "string" ? { libraryId: e } : e;
|
|
89
|
+
o.onLoadJavascript === void 0 && (o.onLoadJavascript = (n) => C(t)), o.onLoadArticleCatalog === void 0 && (o.onLoadArticleCatalog = (n) => w(t)), o.onLoadMasterData === void 0 && (o.onLoadMasterData = (n) => g(t));
|
|
87
90
|
const { expose: s } = await import("./comlink-BAiXCcU9.mjs");
|
|
88
91
|
i = (n) => {
|
|
89
92
|
if (n.data.type === "connect_hi" && n.data.port) {
|
|
90
93
|
const r = n.data.port;
|
|
91
|
-
r.start?.(), s(b(
|
|
94
|
+
U(t, n.data.globalInitData || {}), r.start?.(), s(b(o), r);
|
|
92
95
|
}
|
|
93
96
|
}, window.addEventListener("message", i);
|
|
94
|
-
},
|
|
97
|
+
}, O = () => {
|
|
95
98
|
i && (window.removeEventListener("message", i), i = null);
|
|
96
|
-
},
|
|
99
|
+
}, R = {
|
|
97
100
|
HIDE: "hide",
|
|
98
101
|
SHOW_ATTRIBUTES: "attributes",
|
|
99
102
|
SHOW_ARTICLES: "articles"
|
|
100
103
|
};
|
|
101
104
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
R as HI_PANEL_ACTION,
|
|
106
|
+
O as cleanupHi,
|
|
107
|
+
j as createHiLibraryCallbacks,
|
|
105
108
|
w as libLoadArticleCatalog,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
C as libLoadCalcScript,
|
|
110
|
+
g as libLoadMasterData,
|
|
111
|
+
E as omGetRequest,
|
|
112
|
+
A as omPostRequest,
|
|
113
|
+
_ as setupHi
|
|
111
114
|
};
|
package/hi.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./utils-
|
|
1
|
+
import{c as e}from"./utils-BqTPLNLs.mjs";import{g as a}from"./browser-BhHw2H1M.mjs";const t="https://europe-west3-rml-showcases.cloudfunctions.net/proxy_request?url=",o=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}},n={"e2fe8b3d-da31-4a20-92ab-ab6e3839300e":new Set(["Furniture_Smith"])},s=(e,a)=>{const{libraryId:t,serverOptions:o}=e;return o?.subscriptionId&&n[o.subscriptionId]?.has(t)?`api/pos/${a}?libraryId=${t}`:`api/pos/libraries/${t}/${a}`},r=async e=>await(await o(s(e,"articles"),"json",e,{property:"articles"})).json(),i=async e=>await(await o(s(e,"masterData"),"json",e,{property:"masterData"})).json(),c=async e=>{let a=await(await o(s(e,"calc.js"),"text",e,{property:"calc.js"})).text();if(!a)throw new Error("Script load error");return a},p=e=>({onLoadJavascript:a=>c(e),onLoadArticleCatalog:a=>r(e),onLoadMasterData:a=>i(e)}),l=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 u=null;const m=async(t,o={})=>{u&&window.removeEventListener("message",u);const n="string"==typeof t?{libraryId:t}:t;void 0===o.onLoadJavascript&&(o.onLoadJavascript=e=>c(n)),void 0===o.onLoadArticleCatalog&&(o.onLoadArticleCatalog=e=>r(n)),void 0===o.onLoadMasterData&&(o.onLoadMasterData=e=>i(n));const{expose:s}=await import("./comlink-CmT64Qi3.mjs");u=t=>{if("connect_hi"===t.data.type&&t.data.port){const r=t.data.port;((e,t)=>{e.serverOptions||(e.serverOptions={}),!e.serverOptions.language&&t?.locale&&(e.serverOptions.language=t.locale),e.serverOptions.language||(e.serverOptions.language=a(null,!0))})(n,t.data.globalInitData||{}),r.start?.(),s(e(o),r)}},window.addEventListener("message",u)},b=()=>{u&&(window.removeEventListener("message",u),u=null)},w={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"};export{w as HI_PANEL_ACTION,b as cleanupHi,p as createHiLibraryCallbacks,r as libLoadArticleCatalog,c as libLoadCalcScript,i as libLoadMasterData,d as omGetRequest,l as omPostRequest,m as setupHi};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.1.0-alpha.2",
|
|
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,4 +1,6 @@
|
|
|
1
1
|
import { HiCallbacks } from '../../../common/src/hi/hi-types';
|
|
2
|
-
import { HomagIntelligenceInitData } from '../../../web-sdk/packages';
|
|
2
|
+
import { HomagIntelligenceInitData, GlobalInitDataDefinition } from '../../../web-sdk/packages';
|
|
3
|
+
/** @internal Exported for testing purposes */
|
|
4
|
+
export declare const setFallbackLanguage: (hiInitData: HomagIntelligenceInitData, globalInitData: GlobalInitDataDefinition) => void;
|
|
3
5
|
export declare const setupHi: (libraryIdOrOptions: HomagIntelligenceInitData | string, callbacks?: Partial<HiCallbacks>) => Promise<void>;
|
|
4
6
|
export declare const cleanupHi: () => void;
|
|
@@ -14,9 +14,14 @@ export declare class DragInFromCustomViewStrategy implements DragInStrategy {
|
|
|
14
14
|
private _startTarget;
|
|
15
15
|
private _onBeforeUpdateDrag;
|
|
16
16
|
isDragging: boolean;
|
|
17
|
+
private _hasEnteredIframe;
|
|
18
|
+
private _pendingDragIn;
|
|
19
|
+
private _canvasBb;
|
|
20
|
+
private _overlayBb;
|
|
21
|
+
private _interactionContainerBb;
|
|
17
22
|
constructor(instance: ExposedApi, mainDomElement: HTMLIFrameElement, options: DragInSettings, viewName: PossibleCustomViewsAndMain);
|
|
18
23
|
beforeUpdateGhost(handler: OnBeforeUpdateDragGhost): void;
|
|
19
|
-
_dragStart(id: RapiId,
|
|
24
|
+
_dragStart(id: RapiId, _event: MouseEvent | TouchEvent, type?: ID_TYPE): Promise<void>;
|
|
20
25
|
_dragUpdate(event: MouseEvent | TouchEvent): void;
|
|
21
26
|
_dragEnd(): void;
|
|
22
27
|
dragStart(id: RapiId, event: MouseEvent | TouchEvent, type: ID_TYPE): void;
|
|
@@ -12,10 +12,15 @@ export declare class DragInFromWebsiteStrategy implements DragInStrategy {
|
|
|
12
12
|
private _firefoxDragPosition;
|
|
13
13
|
private _onBeforeUpdateDrag;
|
|
14
14
|
isDragging: boolean;
|
|
15
|
+
private _hasEnteredIframe;
|
|
16
|
+
private _pendingDragIn;
|
|
17
|
+
private _canvasBb;
|
|
18
|
+
private _overlayBb;
|
|
19
|
+
private _interactionContainerBb;
|
|
15
20
|
private _firefoxFallback;
|
|
16
21
|
constructor(instance: ExposedApi, mainDomElement: HTMLIFrameElement, options: DragInOptions);
|
|
17
22
|
beforeUpdateGhost(handler: OnBeforeUpdateDragGhost): void;
|
|
18
|
-
dragStart(id: RapiId, event: DragEvent | TouchEvent, type?: ID_TYPE): void
|
|
23
|
+
dragStart(id: RapiId, event: DragEvent | TouchEvent, type?: ID_TYPE): Promise<void>;
|
|
19
24
|
dragUpdate(event: DragEvent | TouchEvent): void;
|
|
20
25
|
dragEnd(): void;
|
|
21
26
|
touchStart(id: RapiId, event: TouchEvent, type?: ID_TYPE): void;
|
|
@@ -24,6 +24,7 @@ export declare const isExposable: (name: string) => boolean;
|
|
|
24
24
|
export declare const getMethodNames: (proto: any, namespace: string, isCallback?: boolean) => string[];
|
|
25
25
|
export declare const getConfiguratorSettings: (configuratorId: string, initData: UiInitData) => Promise<ConfiguratorSettings>;
|
|
26
26
|
export declare const INTERACTION_CONTAINER_SELECTOR = "data-rml-interaction-container";
|
|
27
|
+
export type { ConfiguratorSettings, UiInitData, } from '../../../src/configurator/embedding/types';
|
|
27
28
|
interface PluginMap {
|
|
28
29
|
dragIn: typeof DragIn;
|
|
29
30
|
}
|
|
@@ -16,3 +16,4 @@ export declare const extractClientXY: (event: MouseEvent | DragEvent | TouchEven
|
|
|
16
16
|
clientY: number;
|
|
17
17
|
};
|
|
18
18
|
export declare const createGracefulProxy: <T extends object>(target: Partial<T>) => T;
|
|
19
|
+
export declare const isOverVisibleCanvas: (clientX: number, clientY: number, canvasBb: Nullable<DOMRect>, overlayBb: Nullable<DOMRect>, interactionContainerBb: Nullable<DOMRect>, iframeBounds?: DOMRect) => boolean;
|