@roomle/embedding-lib 6.2.0 → 6.3.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.
|
@@ -1,77 +1,29 @@
|
|
|
1
|
-
## 6.
|
|
1
|
+
## 6.3.0-alpha.2 (2026-02-12)
|
|
2
2
|
|
|
3
|
-
*
|
|
4
|
-
* Merge branch 'master' into
|
|
5
|
-
* Merge branch 'master' into feat/
|
|
6
|
-
* Merge branch 'master' into
|
|
7
|
-
* Merge branch 'master' into fix/
|
|
8
|
-
* Merge branch 'master' into fix/
|
|
9
|
-
* Merge branch 'master' into
|
|
10
|
-
* Merge
|
|
11
|
-
* Merge
|
|
12
|
-
* Merge
|
|
13
|
-
* Merge
|
|
14
|
-
* Merge
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* Merge pull request #2233 from roomle-dev/chore/add-copilot-instructions ([f13ec07](https://github.com/roomle-dev/roomle-ui/commit/f13ec07)), closes [#2233](https://github.com/roomle-dev/roomle-ui/issues/2233)
|
|
31
|
-
* Merge pull request #2234 from roomle-dev/feat/hi-object-property-update ([d76e4a6](https://github.com/roomle-dev/roomle-ui/commit/d76e4a6)), closes [#2234](https://github.com/roomle-dev/roomle-ui/issues/2234)
|
|
32
|
-
* Merge pull request #2235 from roomle-dev/upgraded-by-ci/core-2.70.0-alpha.37 ([9d25fd1](https://github.com/roomle-dev/roomle-ui/commit/9d25fd1)), closes [#2235](https://github.com/roomle-dev/roomle-ui/issues/2235)
|
|
33
|
-
* Merge pull request #2237 from roomle-dev/upgraded-by-ci/core-2.70.0-alpha.4 ([a0f119b](https://github.com/roomle-dev/roomle-ui/commit/a0f119b)), closes [#2237](https://github.com/roomle-dev/roomle-ui/issues/2237)
|
|
34
|
-
* feat: core api - component runtime id ([d1aa468](https://github.com/roomle-dev/roomle-ui/commit/d1aa468))
|
|
35
|
-
* feat: core api - partsConfigurationRuntimeId ([679e974](https://github.com/roomle-dev/roomle-ui/commit/679e974))
|
|
36
|
-
* feat: hi api - updateExternalObjectProperty ([457031e](https://github.com/roomle-dev/roomle-ui/commit/457031e))
|
|
37
|
-
* feat: highlight and select product ([31cbd2a](https://github.com/roomle-dev/roomle-ui/commit/31cbd2a))
|
|
38
|
-
* feat: highlight external objects ([1b782bd](https://github.com/roomle-dev/roomle-ui/commit/1b782bd))
|
|
39
|
-
* feat: highlightProduct and selectProduct ([2fec769](https://github.com/roomle-dev/roomle-ui/commit/2fec769))
|
|
40
|
-
* feat: Refinement of Raster positioning ([2fb333f](https://github.com/roomle-dev/roomle-ui/commit/2fb333f))
|
|
41
|
-
* feat(core): upgrade to version 2.69.0-alpha.7 ([c8f373a](https://github.com/roomle-dev/roomle-ui/commit/c8f373a))
|
|
42
|
-
* feat(core): upgrade to version 2.69.0-alpha.8 ([9d0b30f](https://github.com/roomle-dev/roomle-ui/commit/9d0b30f))
|
|
43
|
-
* feat(core): upgrade to version 2.70.0-alpha.1 ([aae596c](https://github.com/roomle-dev/roomle-ui/commit/aae596c))
|
|
44
|
-
* feat(core): upgrade to version 2.70.0-alpha.3 ([38bc83b](https://github.com/roomle-dev/roomle-ui/commit/38bc83b))
|
|
45
|
-
* feat(core): upgrade to version 2.70.0-alpha.4 ([dbb7792](https://github.com/roomle-dev/roomle-ui/commit/dbb7792))
|
|
46
|
-
* chore: add bugfix quality guide for AI agents ([b1af88c](https://github.com/roomle-dev/roomle-ui/commit/b1af88c))
|
|
47
|
-
* chore: add copilot-instructions.md pointing to AGENTS.md ([fabeb74](https://github.com/roomle-dev/roomle-ui/commit/fabeb74))
|
|
48
|
-
* chore: copilot review suggestions ([c9b65ed](https://github.com/roomle-dev/roomle-ui/commit/c9b65ed))
|
|
49
|
-
* chore: dispose geometry before assigning a new one ([5d3012e](https://github.com/roomle-dev/roomle-ui/commit/5d3012e))
|
|
50
|
-
* chore: lint ([b2fd8a6](https://github.com/roomle-dev/roomle-ui/commit/b2fd8a6))
|
|
51
|
-
* chore: pass in store to composable product-price ([2ed60df](https://github.com/roomle-dev/roomle-ui/commit/2ed60df))
|
|
52
|
-
* chore: pass store into sidebar-layer-router composable ([24cffc3](https://github.com/roomle-dev/roomle-ui/commit/24cffc3))
|
|
53
|
-
* chore: remove lint issue ([d2d1c18](https://github.com/roomle-dev/roomle-ui/commit/d2d1c18))
|
|
54
|
-
* chore: remove unneeded comment line ([506e995](https://github.com/roomle-dev/roomle-ui/commit/506e995))
|
|
55
|
-
* docs: add commit verification guidelines to agent documentation ([53a1b2e](https://github.com/roomle-dev/roomle-ui/commit/53a1b2e))
|
|
56
|
-
* docs: add git diff --staged and fix git restore --source in post-pr context ([579f68c](https://github.com/roomle-dev/roomle-ui/commit/579f68c))
|
|
57
|
-
* docs: add guidance for partial unrelated changes within files ([1127ce6](https://github.com/roomle-dev/roomle-ui/commit/1127ce6))
|
|
58
|
-
* docs: add guidance to report out-of-scope findings to the user ([9292b92](https://github.com/roomle-dev/roomle-ui/commit/9292b92))
|
|
59
|
-
* docs: address copilot review feedback ([3ec8dc1](https://github.com/roomle-dev/roomle-ui/commit/3ec8dc1))
|
|
60
|
-
* docs: fix git restore in post-push context and align lists across files ([1cbd03f](https://github.com/roomle-dev/roomle-ui/commit/1cbd03f))
|
|
61
|
-
* docs: improve git rm vs restore guidance and fix categorization ([82d9175](https://github.com/roomle-dev/roomle-ui/commit/82d9175))
|
|
62
|
-
* docs: replace dangerous git rm with safer git rm --cached ([fd3a641](https://github.com/roomle-dev/roomle-ui/commit/fd3a641))
|
|
63
|
-
* fix: allow for more zoomout distance ([b764c06](https://github.com/roomle-dev/roomle-ui/commit/b764c06))
|
|
64
|
-
* fix: explicit font-size for room confirm button - RML-15928 ([daa1350](https://github.com/roomle-dev/roomle-ui/commit/daa1350))
|
|
65
|
-
* fix: external object bom label ([c9f213f](https://github.com/roomle-dev/roomle-ui/commit/c9f213f))
|
|
66
|
-
* fix(configurator): only use component bounding box for raycasting ([b4fcbc4](https://github.com/roomle-dev/roomle-ui/commit/b4fcbc4))
|
|
67
|
-
* fix: planElementId validation for highlighting ([23a0bc8](https://github.com/roomle-dev/roomle-ui/commit/23a0bc8))
|
|
68
|
-
* fix: select external object ([e96095a](https://github.com/roomle-dev/roomle-ui/commit/e96095a))
|
|
69
|
-
* fix: show exit fullscreen mode in smaller window sizes ([8fb0ba0](https://github.com/roomle-dev/roomle-ui/commit/8fb0ba0))
|
|
70
|
-
* fix: show fullscreen exit button not showing ([d1b327d](https://github.com/roomle-dev/roomle-ui/commit/d1b327d))
|
|
71
|
-
* fix: undo change ([ff46ce6](https://github.com/roomle-dev/roomle-ui/commit/ff46ce6))
|
|
72
|
-
* test: adjust test to use bounding box instead of child ([1bbfc7c](https://github.com/roomle-dev/roomle-ui/commit/1bbfc7c))
|
|
73
|
-
* test: update dragging test screenshot ([328235d](https://github.com/roomle-dev/roomle-ui/commit/328235d))
|
|
74
|
-
* test: update playwright test ([46eaed2](https://github.com/roomle-dev/roomle-ui/commit/46eaed2))
|
|
75
|
-
* test: update playwright tests ([7a3b970](https://github.com/roomle-dev/roomle-ui/commit/7a3b970))
|
|
76
|
-
* refactor: allow for more zoomout distance of the camera ([ecdf2e5](https://github.com/roomle-dev/roomle-ui/commit/ecdf2e5))
|
|
77
|
-
* refactor: highlight and select product ([db4ad63](https://github.com/roomle-dev/roomle-ui/commit/db4ad63))
|
|
3
|
+
* Apply suggestion from @Copilot ([390b011](https://github.com/roomle-dev/roomle-ui/commit/390b011))
|
|
4
|
+
* Merge branch 'master' into chore/hi-examples ([1f06634](https://github.com/roomle-dev/roomle-ui/commit/1f06634))
|
|
5
|
+
* Merge branch 'master' into feat/hi-change-property ([4047ae0](https://github.com/roomle-dev/roomle-ui/commit/4047ae0))
|
|
6
|
+
* Merge branch 'master' into feat/hi-change-property ([62b4d6f](https://github.com/roomle-dev/roomle-ui/commit/62b4d6f))
|
|
7
|
+
* Merge branch 'master' into fix/migration-cleanup-findings ([01aafa6](https://github.com/roomle-dev/roomle-ui/commit/01aafa6))
|
|
8
|
+
* Merge branch 'master' into fix/migration-cleanup-findings ([d088258](https://github.com/roomle-dev/roomle-ui/commit/d088258))
|
|
9
|
+
* Merge branch 'master' into refactor/batch2-composition-api-migration ([e18967a](https://github.com/roomle-dev/roomle-ui/commit/e18967a))
|
|
10
|
+
* Merge pull request #2238 from roomle-dev/chore/hi-examples ([1640ee1](https://github.com/roomle-dev/roomle-ui/commit/1640ee1)), closes [#2238](https://github.com/roomle-dev/roomle-ui/issues/2238)
|
|
11
|
+
* Merge pull request #2239 from roomle-dev/feat/hi-change-property ([7e22780](https://github.com/roomle-dev/roomle-ui/commit/7e22780)), closes [#2239](https://github.com/roomle-dev/roomle-ui/issues/2239)
|
|
12
|
+
* Merge pull request #2247 from roomle-dev/fix/migration-cleanup-findings ([ef6e3b6](https://github.com/roomle-dev/roomle-ui/commit/ef6e3b6)), closes [#2247](https://github.com/roomle-dev/roomle-ui/issues/2247)
|
|
13
|
+
* Merge pull request #2248 from roomle-dev/refactor/batch2-composition-api-migration ([1ac6f70](https://github.com/roomle-dev/roomle-ui/commit/1ac6f70)), closes [#2248](https://github.com/roomle-dev/roomle-ui/issues/2248)
|
|
14
|
+
* Merge pull request #2249 from roomle-dev/chore/migration-cleanup-dead-code ([881a633](https://github.com/roomle-dev/roomle-ui/commit/881a633)), closes [#2249](https://github.com/roomle-dev/roomle-ui/issues/2249)
|
|
15
|
+
* fix: address pr review - use script-local variables in templates ([94dcd85](https://github.com/roomle-dev/roomle-ui/commit/94dcd85))
|
|
16
|
+
* fix: address pre-existing issues found during options api migration ([53ee9ec](https://github.com/roomle-dev/roomle-ui/commit/53ee9ec))
|
|
17
|
+
* fix(ProductRangeControl): clear longPressTimer on component unmount ([97f79ad](https://github.com/roomle-dev/roomle-ui/commit/97f79ad))
|
|
18
|
+
* fix: correct ElementLengthScaling to use 1/2 matching downstream consumers ([0ab4a17](https://github.com/roomle-dev/roomle-ui/commit/0ab4a17))
|
|
19
|
+
* fix: correct RoomlePlanner generic type mismatches across planner components ([78553e5](https://github.com/roomle-dev/roomle-ui/commit/78553e5))
|
|
20
|
+
* fix: HI api - restrict which properties are allowed to be updated ([f92b03d](https://github.com/roomle-dev/roomle-ui/commit/f92b03d))
|
|
21
|
+
* fix: re-type Vuex store with StoreState, use localized unref for selectionElement ([3585ddd](https://github.com/roomle-dev/roomle-ui/commit/3585ddd))
|
|
22
|
+
* fix: remove duplicated console error ([d57c88d](https://github.com/roomle-dev/roomle-ui/commit/d57c88d))
|
|
23
|
+
* fix: replace $store global property with useStore() composable across all script setup components ([be2accf](https://github.com/roomle-dev/roomle-ui/commit/be2accf))
|
|
24
|
+
* chore: hi examples localisation ([1f1886e](https://github.com/roomle-dev/roomle-ui/commit/1f1886e))
|
|
25
|
+
* chore: remove dead code discovered during composition API migration ([3e9caac](https://github.com/roomle-dev/roomle-ui/commit/3e9caac))
|
|
26
|
+
* test: adapt tests for composition api migration ([1089c8c](https://github.com/roomle-dev/roomle-ui/commit/1089c8c))
|
|
27
|
+
* refactor: migrate 12 low-risk components to composition api ([1dd5a00](https://github.com/roomle-dev/roomle-ui/commit/1dd5a00))
|
|
28
|
+
* refactor: migrate 4 medium-risk components to composition api ([2e76a2a](https://github.com/roomle-dev/roomle-ui/commit/2e76a2a))
|
|
29
|
+
* feat: glue-logic CHANGEABLE_PROPERTIES ([93ac12f](https://github.com/roomle-dev/roomle-ui/commit/93ac12f))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.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",
|
package/roomle-embedding-lib.js
CHANGED
|
@@ -192,7 +192,7 @@ const G = (s) => JSON.parse(JSON.stringify(s)), J = {
|
|
|
192
192
|
const s = G(J);
|
|
193
193
|
s.locale || (s.locale = P(null, !0)), s.id === V && delete s.id;
|
|
194
194
|
const e = U();
|
|
195
|
-
return e && k(e) && (s.configuratorId = "demoConfigurator"), s.customApiUrl =
|
|
195
|
+
return e && k(e) && (s.configuratorId = "demoConfigurator"), s.customApiUrl = "https://rubens.alpha.roomle.com/api/v2", s.emails = !1, s;
|
|
196
196
|
}, Y = "<CONF_ID>", q = "#CONFIGURATIONID#", Q = (s) => {
|
|
197
197
|
s.featureFlags || (s.featureFlags = {}), typeof s.featureFlags.realPartList != "boolean" && (s.featureFlags.realPartList = !0), typeof s.featureFlags.globalCallbacks != "boolean" && (s.featureFlags.globalCallbacks = !0), typeof s.featureFlags.mocAr != "boolean" && (s.featureFlags.mocAr = !1);
|
|
198
198
|
}, M = () => /(android)/i.test(navigator.userAgent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{expose as e}from"./comlink-CmT64Qi3.mjs";import{g as t}from"./browser-BhHw2H1M.mjs";import{c as s}from"./utils-BqTPLNLs.mjs";class r{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=e=>{if(!e||!e.data)return i.port1.close(),i.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return i.port1.close(),i.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),i.port1.close(),i.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[i.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&("string"==typeof e.data||"connect_hi"!==e.data.type)&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const i=["127.0.0.1","localhost","0.0.0.0"],a=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=a(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var n=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(n||{});const o={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[n.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1,localExport3d:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},l=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&l(t),Array.isArray(t))for(const e of t)l(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},c=()=>/(android)/i.test(navigator.userAgent);class u{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split(h),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split(h),s=t[0],r=t[1],i=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][i]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split(h),r=s[0],i=s[1],a=3===s.length?s[2]:null;if(a&&this[r][i][a]){const e=this[r][i][a](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./embedding-plugins-Dzhuj1By.mjs").then(e=>e.l).then(({DragIn:i})=>{const a=new i(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,i)=>{try{r.loader().then(a=>{const n=new a(this.ui,t,s,this.viewName);n.init().then(()=>{this.plugins[r.name]=n,e()},i)})}catch(e){i(e)}}))}}const d=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},g={SDK:"extended",CONFIGURATOR_SDK:"configurator",CALLBACKS:"callbacks",UI:"ui",ANALYTICS:"analytics",GLOBAL:"global",RAPI:"rapi"},h=".",m=g.SDK+h+g.CALLBACKS,p={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},_={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},f=["constructor","callbacks"],w=e=>"_"!==e[0]&&!f.includes(e),E=(e,t,s=!1)=>{if(!e)return[];const r=Object.getOwnPropertyNames(e),i=s?g.CALLBACKS+h:"";return r.filter(w).map(e=>t+h+i+e)},S=async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,i=s+"/configurators/"+e,a="roomle_portal_v2",n="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(i,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:n,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c},M="data-rml-interaction-container",b=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},y=()=>.01*window.innerHeight+"px",T=e=>{e&&setTimeout(()=>e.style.setProperty(v,y()),0)},O="rml-styles",v="--rml-full-height",A="rml-container",N="rml-fill",R="rml-pos",I="rml-android-height",L="rml-overflow-hidden",C=new Map;class P extends u{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(e,t=[]){const s=new u;s.viewName=e;const{resolve:i,promise:a}=d(),{resolve:n,promise:o}=d(),l=new r("custom-view-"+e,window,window.parent,({message:e,args:t})=>{switch(e){case _.REGISTER_CUSTOM_VIEW_DONE:i();break;case _.RETURN_METHODS:s.handleSetup(t[0]),n();break;default:if(s.isSetupDone)return s.executeMessage({message:e,args:t})}});s.setMessageHandler(l);const c=[e];return l.sendMessage(_.REGISTER_CUSTOM_VIEW,c),await a,l.sendMessage(_.GET_METHODS,c),await o,s.setupPlugins(t,document.body,"custom-view"),await Promise.allSettled(s.pluginsLoaded),s}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static hiMessageHandler=null;static setupHi(t){this.hiMessageHandler&&window.removeEventListener("message",this.hiMessageHandler),this.hiMessageHandler=r=>{if("connect_hi"===r.data.type&&r.data.port){const i=r.data.port;i.start?.(),e(s(t),i)}},window.addEventListener("message",this.hiMessageHandler)}static async _create(e,s,r,n){return new Promise(async(c,u)=>{try{const u=a((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(o);e.locale||(e.locale=t(null,!0)),"(idle)"===e.id&&delete e.id;const s=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return s&&(e=>{const t=new RegExp(/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/);return!!(i.includes(e)||t.test(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com"))})(s)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(l(d=r),d?.customApiUrl&&(d.customApiUrl=decodeURIComponent(d.customApiUrl)),d.shareUrl&&(d.deeplink=d.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),d));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(u);const g=await S(e,u);r=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return a(s,t)})(s,t)})(g,u);const h=new this(g,s,r,n,c);return await Promise.allSettled(h.pluginsLoaded),h}catch(e){return u(e)}var d})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(e,t,s,i,a){if(super(),!e||"string"!=typeof e.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(C.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(O)){const e=s.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=O;const r="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((e,t)=>e+(t+r),"")+r,a=y();t.innerHTML=`\n .${A}{${v}:${a};}\n .${R}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${N}{width:100%;height:100%;opacity:1}\n .${I}{height:calc(var(${v},1vh)*100)}\n .${L}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const n=new r("website",window,null,this._executeMessage);this.setMessageHandler(n),this._onResize=this._onResize.bind(this),c()&&window.addEventListener("resize",this._onResize),this._container=t,this._initData=s,this._configuratorSettings=e;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(i,this._iframe),C.set(t,!0)}teardown(){this._container&&C.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";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(A),e.classList.add(N),e}_onResize(){T(this._iframe)}_onUseFullPage(){this._iframe.classList.add(R),document.documentElement.classList.add(L),window.document.body.classList.add(L),c()&&(T(this._iframe),this._iframe.classList.add(I))}_onBackToWebsite(){this._iframe.classList.remove(R),this._iframe.classList.remove(I),document.documentElement.classList.remove(L),window.document.body.classList.remove(L)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return e===p.REQUEST_BOOT?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):e===p.SETUP?(this.handleSetup(t[0]),b(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),b(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage(p.WEBSITE_READY)},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{p as HANDSHAKE_MESSAGES,M as INTERACTION_CONTAINER_SELECTOR,g as NAMESPACE,h as NAMESPACE_SEPARATOR,m as SDK_CALLBACK,_ as WELL_KNOWN_MESSAGES,P as default,S as getConfiguratorSettings,E as getMethodNames,w as isExposable};
|
|
1
|
+
import{expose as e}from"./comlink-CmT64Qi3.mjs";import{g as t}from"./browser-BhHw2H1M.mjs";import{c as s}from"./utils-BqTPLNLs.mjs";class r{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=e=>{if(!e||!e.data)return i.port1.close(),i.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return i.port1.close(),i.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),i.port1.close(),i.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[i.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&("string"==typeof e.data||"connect_hi"!==e.data.type)&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const i=["127.0.0.1","localhost","0.0.0.0"],a=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=a(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var n=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(n||{});const o={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[n.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1,webGpu:!1,localExport3d:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},l=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&l(t),Array.isArray(t))for(const e of t)l(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},c=()=>/(android)/i.test(navigator.userAgent);class u{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split(h),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split(h),s=t[0],r=t[1],i=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][i]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split(h),r=s[0],i=s[1],a=3===s.length?s[2]:null;if(a&&this[r][i][a]){const e=this[r][i][a](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./embedding-plugins-Dzhuj1By.mjs").then(e=>e.l).then(({DragIn:i})=>{const a=new i(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,i)=>{try{r.loader().then(a=>{const n=new a(this.ui,t,s,this.viewName);n.init().then(()=>{this.plugins[r.name]=n,e()},i)})}catch(e){i(e)}}))}}const d=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},g={SDK:"extended",CONFIGURATOR_SDK:"configurator",CALLBACKS:"callbacks",UI:"ui",ANALYTICS:"analytics",GLOBAL:"global",RAPI:"rapi"},h=".",m=g.SDK+h+g.CALLBACKS,p={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},_={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},f=["constructor","callbacks"],w=e=>"_"!==e[0]&&!f.includes(e),E=(e,t,s=!1)=>{if(!e)return[];const r=Object.getOwnPropertyNames(e),i=s?g.CALLBACKS+h:"";return r.filter(w).map(e=>t+h+i+e)},S=async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,i=s+"/configurators/"+e,a="roomle_portal_v2",n="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(i,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:n,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c},M="data-rml-interaction-container",b=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},y=()=>.01*window.innerHeight+"px",T=e=>{e&&setTimeout(()=>e.style.setProperty(v,y()),0)},O="rml-styles",v="--rml-full-height",A="rml-container",N="rml-fill",R="rml-pos",I="rml-android-height",L="rml-overflow-hidden",C=new Map;class P extends u{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(e,t=[]){const s=new u;s.viewName=e;const{resolve:i,promise:a}=d(),{resolve:n,promise:o}=d(),l=new r("custom-view-"+e,window,window.parent,({message:e,args:t})=>{switch(e){case _.REGISTER_CUSTOM_VIEW_DONE:i();break;case _.RETURN_METHODS:s.handleSetup(t[0]),n();break;default:if(s.isSetupDone)return s.executeMessage({message:e,args:t})}});s.setMessageHandler(l);const c=[e];return l.sendMessage(_.REGISTER_CUSTOM_VIEW,c),await a,l.sendMessage(_.GET_METHODS,c),await o,s.setupPlugins(t,document.body,"custom-view"),await Promise.allSettled(s.pluginsLoaded),s}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static hiMessageHandler=null;static setupHi(t){this.hiMessageHandler&&window.removeEventListener("message",this.hiMessageHandler),this.hiMessageHandler=r=>{if("connect_hi"===r.data.type&&r.data.port){const i=r.data.port;i.start?.(),e(s(t),i)}},window.addEventListener("message",this.hiMessageHandler)}static async _create(e,s,r,n){return new Promise(async(c,u)=>{try{const u=a((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(o);e.locale||(e.locale=t(null,!0)),"(idle)"===e.id&&delete e.id;const s=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return s&&(e=>{const t=new RegExp(/^(10\.|172\.(1[6-9]|2\d|3[01])\.|192\.168\.)/);return!!(i.includes(e)||t.test(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com"))})(s)&&(e.configuratorId="demoConfigurator"),e.customApiUrl="https://rubens.alpha.roomle.com/api/v2",e.emails=!1,e})(),(l(d=r),d?.customApiUrl&&(d.customApiUrl=decodeURIComponent(d.customApiUrl)),d.shareUrl&&(d.deeplink=d.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),d));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(u);const g=await S(e,u);r=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return a(s,t)})(s,t)})(g,u);const h=new this(g,s,r,n,c);return await Promise.allSettled(h.pluginsLoaded),h}catch(e){return u(e)}var d})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(e,t,s,i,a){if(super(),!e||"string"!=typeof e.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(C.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(O)){const e=s.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=O;const r="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((e,t)=>e+(t+r),"")+r,a=y();t.innerHTML=`\n .${A}{${v}:${a};}\n .${R}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${i}}\n .${N}{width:100%;height:100%;opacity:1}\n .${I}{height:calc(var(${v},1vh)*100)}\n .${L}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const n=new r("website",window,null,this._executeMessage);this.setMessageHandler(n),this._onResize=this._onResize.bind(this),c()&&window.addEventListener("resize",this._onResize),this._container=t,this._initData=s,this._configuratorSettings=e;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(i,this._iframe),C.set(t,!0)}teardown(){this._container&&C.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";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(A),e.classList.add(N),e}_onResize(){T(this._iframe)}_onUseFullPage(){this._iframe.classList.add(R),document.documentElement.classList.add(L),window.document.body.classList.add(L),c()&&(T(this._iframe),this._iframe.classList.add(I))}_onBackToWebsite(){this._iframe.classList.remove(R),this._iframe.classList.remove(I),document.documentElement.classList.remove(L),window.document.body.classList.remove(L)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return e===p.REQUEST_BOOT?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):e===p.SETUP?(this.handleSetup(t[0]),b(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),b(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage(p.WEBSITE_READY)},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{p as HANDSHAKE_MESSAGES,M as INTERACTION_CONTAINER_SELECTOR,g as NAMESPACE,h as NAMESPACE_SEPARATOR,m as SDK_CALLBACK,_ as WELL_KNOWN_MESSAGES,P as default,S as getConfiguratorSettings,E as getMethodNames,w as isExposable};
|