@roomle/embedding-lib 6.3.0 → 6.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,55 +1,28 @@
|
|
|
1
|
-
## 6.
|
|
1
|
+
## 6.4.0-alpha.1 (2026-02-12)
|
|
2
2
|
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Merge branch 'master' into
|
|
7
|
-
* Merge branch 'master' into
|
|
8
|
-
* Merge branch 'master' into
|
|
9
|
-
* Merge
|
|
10
|
-
* Merge
|
|
11
|
-
* Merge
|
|
12
|
-
* Merge
|
|
13
|
-
* Merge
|
|
14
|
-
* Merge
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* fix:
|
|
28
|
-
*
|
|
29
|
-
* fix: address second round of PR review comments ([f47d210](https://github.com/roomle-dev/roomle-ui/commit/f47d210))
|
|
30
|
-
* fix: address third round of PR review comments ([76a2a25](https://github.com/roomle-dev/roomle-ui/commit/76a2a25))
|
|
31
|
-
* fix(ProductRangeControl): clear longPressTimer on component unmount ([97f79ad](https://github.com/roomle-dev/roomle-ui/commit/97f79ad))
|
|
32
|
-
* fix: correct ElementLengthScaling to use 1/2 matching downstream consumers ([0ab4a17](https://github.com/roomle-dev/roomle-ui/commit/0ab4a17))
|
|
33
|
-
* fix: correct RoomlePlanner generic type mismatches across planner components ([78553e5](https://github.com/roomle-dev/roomle-ui/commit/78553e5))
|
|
34
|
-
* fix: HF - disable bounding box meshes for Roomle configurations ([c5d0909](https://github.com/roomle-dev/roomle-ui/commit/c5d0909))
|
|
35
|
-
* fix: HI api - restrict which properties are allowed to be updated ([f92b03d](https://github.com/roomle-dev/roomle-ui/commit/f92b03d))
|
|
36
|
-
* fix: re-type Vuex store with StoreState, use localized unref for selectionElement ([3585ddd](https://github.com/roomle-dev/roomle-ui/commit/3585ddd))
|
|
37
|
-
* fix: remove duplicated console error ([d57c88d](https://github.com/roomle-dev/roomle-ui/commit/d57c88d))
|
|
38
|
-
* fix: remove unused imports from ProductVariant.vue and PlannerMain.vue ([1a26c7e](https://github.com/roomle-dev/roomle-ui/commit/1a26c7e))
|
|
39
|
-
* fix: remove unused store import from ProductRangeControl.vue ([0f0b618](https://github.com/roomle-dev/roomle-ui/commit/0f0b618))
|
|
40
|
-
* fix: replace $store global property with useStore() composable across all script setup components ([be2accf](https://github.com/roomle-dev/roomle-ui/commit/be2accf))
|
|
41
|
-
* chore: add batching guidance for options api migrations ([557a6d0](https://github.com/roomle-dev/roomle-ui/commit/557a6d0))
|
|
42
|
-
* chore: add before/after example for options api migration ([accaa8d](https://github.com/roomle-dev/roomle-ui/commit/accaa8d))
|
|
43
|
-
* chore: add options api to composition api migration workflow ([f734ed9](https://github.com/roomle-dev/roomle-ui/commit/f734ed9))
|
|
44
|
-
* chore: add post-migration checklist, test adaptation, and issue reporting guidelines ([9888e16](https://github.com/roomle-dev/roomle-ui/commit/9888e16)), closes [#2243](https://github.com/roomle-dev/roomle-ui/issues/2243)
|
|
45
|
-
* chore: hi examples localisation ([1f1886e](https://github.com/roomle-dev/roomle-ui/commit/1f1886e))
|
|
46
|
-
* chore: merge master into migration branch ([cb1a2cc](https://github.com/roomle-dev/roomle-ui/commit/cb1a2cc))
|
|
47
|
-
* chore: migrate 38 standard components from Options API to script setup ([32a5c18](https://github.com/roomle-dev/roomle-ui/commit/32a5c18))
|
|
48
|
-
* chore: remove dead code discovered during composition API migration ([3e9caac](https://github.com/roomle-dev/roomle-ui/commit/3e9caac))
|
|
49
|
-
* test: adapt tests for composition api migration ([1089c8c](https://github.com/roomle-dev/roomle-ui/commit/1089c8c))
|
|
50
|
-
* test: update playwright tests ([2cd82c3](https://github.com/roomle-dev/roomle-ui/commit/2cd82c3))
|
|
51
|
-
* refactor: migrate 12 low-risk components to composition api ([1dd5a00](https://github.com/roomle-dev/roomle-ui/commit/1dd5a00))
|
|
52
|
-
* refactor: migrate 4 medium-risk components to composition api ([2e76a2a](https://github.com/roomle-dev/roomle-ui/commit/2e76a2a))
|
|
53
|
-
* feat: core api KernelPart ([32ff8b0](https://github.com/roomle-dev/roomle-ui/commit/32ff8b0))
|
|
54
|
-
* feat: glue-logic CHANGEABLE_PROPERTIES ([93ac12f](https://github.com/roomle-dev/roomle-ui/commit/93ac12f))
|
|
55
|
-
* feat(core): upgrade to version 2.70.0-alpha.5 ([ef8cfd5](https://github.com/roomle-dev/roomle-ui/commit/ef8cfd5))
|
|
3
|
+
* Merge branch 'master' into feat/activate-old-measurements ([1612f0a](https://github.com/roomle-dev/roomle-ui/commit/1612f0a))
|
|
4
|
+
* Merge branch 'master' into feat/activate-old-measurements ([2d72ba3](https://github.com/roomle-dev/roomle-ui/commit/2d72ba3))
|
|
5
|
+
* Merge branch 'master' into fix/hi-module-bom ([48964c1](https://github.com/roomle-dev/roomle-ui/commit/48964c1))
|
|
6
|
+
* Merge branch 'master' into fix/hi-module-bom ([84f41d5](https://github.com/roomle-dev/roomle-ui/commit/84f41d5))
|
|
7
|
+
* Merge branch 'master' into upgraded-by-ci/core-2.70.0-alpha.6 ([17482e3](https://github.com/roomle-dev/roomle-ui/commit/17482e3))
|
|
8
|
+
* Merge branch 'master' into upgraded-by-ci/core-2.70.0-alpha.7 ([d90f9bc](https://github.com/roomle-dev/roomle-ui/commit/d90f9bc))
|
|
9
|
+
* Merge pull request #2240 from roomle-dev/feat/activate-old-measurements ([532f4fc](https://github.com/roomle-dev/roomle-ui/commit/532f4fc)), closes [#2240](https://github.com/roomle-dev/roomle-ui/issues/2240)
|
|
10
|
+
* Merge pull request #2246 from roomle-dev/fix/hi-module-bom ([602093c](https://github.com/roomle-dev/roomle-ui/commit/602093c)), closes [#2246](https://github.com/roomle-dev/roomle-ui/issues/2246)
|
|
11
|
+
* Merge pull request #2250 from roomle-dev/upgraded-by-ci/core-2.70.0-alpha.6 ([b9bdbac](https://github.com/roomle-dev/roomle-ui/commit/b9bdbac)), closes [#2250](https://github.com/roomle-dev/roomle-ui/issues/2250)
|
|
12
|
+
* Merge pull request #2252 from roomle-dev/chore/migrate-planner-core-data-to-pinia ([54f82cb](https://github.com/roomle-dev/roomle-ui/commit/54f82cb)), closes [#2252](https://github.com/roomle-dev/roomle-ui/issues/2252)
|
|
13
|
+
* Merge pull request #2253 from roomle-dev/feat/activate-old-measurements-refactor ([817509e](https://github.com/roomle-dev/roomle-ui/commit/817509e)), closes [#2253](https://github.com/roomle-dev/roomle-ui/issues/2253)
|
|
14
|
+
* Merge pull request #2254 from roomle-dev/upgraded-by-ci/core-2.70.0-alpha.7 ([9bf6c8e](https://github.com/roomle-dev/roomle-ui/commit/9bf6c8e)), closes [#2254](https://github.com/roomle-dev/roomle-ui/issues/2254)
|
|
15
|
+
* feat: activate threejs measurements by using featureFlags.useHTMLMeasurementLabels=false ([74fb630](https://github.com/roomle-dev/roomle-ui/commit/74fb630))
|
|
16
|
+
* feat(core): upgrade to version 2.70.0-alpha.6 ([990d991](https://github.com/roomle-dev/roomle-ui/commit/990d991))
|
|
17
|
+
* feat(core): upgrade to version 2.70.0-alpha.7 ([9b263cd](https://github.com/roomle-dev/roomle-ui/commit/9b263cd))
|
|
18
|
+
* chore: add breaking line ([e55521d](https://github.com/roomle-dev/roomle-ui/commit/e55521d))
|
|
19
|
+
* chore: add stuff to follow-up ([ffe666d](https://github.com/roomle-dev/roomle-ui/commit/ffe666d))
|
|
20
|
+
* chore: code cleaning ([1e24a21](https://github.com/roomle-dev/roomle-ui/commit/1e24a21))
|
|
21
|
+
* chore: document pinia migration better ([df42c49](https://github.com/roomle-dev/roomle-ui/commit/df42c49))
|
|
22
|
+
* chore: fix lint errors ([d4366f7](https://github.com/roomle-dev/roomle-ui/commit/d4366f7))
|
|
23
|
+
* chore: migrate planner-core-data from vuex to pinia ([93ba784](https://github.com/roomle-dev/roomle-ui/commit/93ba784))
|
|
24
|
+
* chore: organising line parameters exporting ([a768d7e](https://github.com/roomle-dev/roomle-ui/commit/a768d7e))
|
|
25
|
+
* chore: remove unneeded file ([fde8553](https://github.com/roomle-dev/roomle-ui/commit/fde8553))
|
|
26
|
+
* refactor: introduce label rendering modes ([eeefe0a](https://github.com/roomle-dev/roomle-ui/commit/eeefe0a))
|
|
27
|
+
* fix: get bom for external objects ([f47110e](https://github.com/roomle-dev/roomle-ui/commit/f47110e))
|
|
28
|
+
* test: fix failing test and do code polishing ([7393511](https://github.com/roomle-dev/roomle-ui/commit/7393511))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0-alpha.1",
|
|
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};
|