@roomle/embedding-lib 4.24.0-alpha.2 → 4.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/docs/api/classes/{exposed_analytics_callbacks.ExposedAnalyticsCallbacks.md → exposed_analytics_callbacks.exposedanalyticscallbacks.md} +9 -11
  2. package/docs/api/classes/exposed_api.exposedapi.md +191 -0
  3. package/docs/api/classes/exposed_callbacks.exposedcallbacks.md +145 -0
  4. package/docs/api/classes/roomle_configurator_api.default.md +42 -78
  5. package/docs/api/enums/types.ui_button.md +145 -0
  6. package/docs/api/interfaces/exposed_callbacks.labels.md +28 -0
  7. package/docs/api/interfaces/exposed_callbacks.price.md +28 -0
  8. package/docs/api/interfaces/roomle_configurator_api.roomleembeddingapikeys.md +50 -0
  9. package/docs/api/interfaces/types.configuratorsettings.md +118 -0
  10. package/docs/api/interfaces/types.embeddingskin.md +55 -0
  11. package/docs/api/interfaces/types.uiinitdata.md +957 -0
  12. package/docs/api/interfaces/{types.VariantsMap.md → types.variantsmap.md} +1 -1
  13. package/docs/api/modules/exposed_analytics_callbacks.md +1 -1
  14. package/docs/api/modules/exposed_api.md +1 -1
  15. package/docs/api/modules/exposed_callbacks.md +3 -3
  16. package/docs/api/modules/roomle_configurator_api.md +7 -13
  17. package/docs/api/modules/types.md +5 -5
  18. package/docs/index.md +3 -3
  19. package/docs/md/web/ui/EMBEDDING-CHANGELOG.md +6 -1
  20. package/package.json +1 -1
  21. package/roomle-configurator-api.cjs.js +1 -1
  22. package/roomle-configurator-api.cjs.min.js +1 -1
  23. package/roomle-configurator-api.es.js +1 -1
  24. package/roomle-configurator-api.es.min.js +1 -1
  25. package/roomle-configurator-api.js +1 -1
  26. package/docs/api/.nojekyll +0 -1
  27. package/docs/api/classes/exposed_api.ExposedApi.md +0 -227
  28. package/docs/api/classes/exposed_callbacks.ExposedCallbacks.md +0 -171
  29. package/docs/api/enums/types.UI_BUTTON.md +0 -175
  30. package/docs/api/interfaces/exposed_callbacks.Labels.md +0 -32
  31. package/docs/api/interfaces/exposed_callbacks.Price.md +0 -32
  32. package/docs/api/interfaces/roomle_configurator_api.RoomleEmbeddingApiKeys.md +0 -58
  33. package/docs/api/interfaces/types.ConfiguratorSettings.md +0 -150
  34. package/docs/api/interfaces/types.EmbeddingSkin.md +0 -65
  35. package/docs/api/interfaces/types.UiInitData.md +0 -1183
@@ -6,4 +6,4 @@
6
6
 
7
7
  ## Indexable
8
8
 
9
- ▪ [key: `string`]: `RapiId`
9
+ ▪ [key: *string*]: RapiId
@@ -6,4 +6,4 @@
6
6
 
7
7
  ### Classes
8
8
 
9
- - [ExposedAnalyticsCallbacks](../classes/exposed_analytics_callbacks.ExposedAnalyticsCallbacks.md)
9
+ - [ExposedAnalyticsCallbacks](../classes/exposed_analytics_callbacks.exposedanalyticscallbacks.md)
@@ -6,4 +6,4 @@
6
6
 
7
7
  ### Classes
8
8
 
9
- - [ExposedApi](../classes/exposed_api.ExposedApi.md)
9
+ - [ExposedApi](../classes/exposed_api.exposedapi.md)
@@ -6,9 +6,9 @@
6
6
 
7
7
  ### Classes
8
8
 
9
- - [ExposedCallbacks](../classes/exposed_callbacks.ExposedCallbacks.md)
9
+ - [ExposedCallbacks](../classes/exposed_callbacks.exposedcallbacks.md)
10
10
 
11
11
  ### Interfaces
12
12
 
13
- - [Labels](../interfaces/exposed_callbacks.Labels.md)
14
- - [Price](../interfaces/exposed_callbacks.Price.md)
13
+ - [Labels](../interfaces/exposed_callbacks.labels.md)
14
+ - [Price](../interfaces/exposed_callbacks.price.md)
@@ -10,7 +10,7 @@
10
10
 
11
11
  ### Interfaces
12
12
 
13
- - [RoomleEmbeddingApiKeys](../interfaces/roomle_configurator_api.RoomleEmbeddingApiKeys.md)
13
+ - [RoomleEmbeddingApiKeys](../interfaces/roomle_configurator_api.roomleembeddingapikeys.md)
14
14
 
15
15
  ### Type aliases
16
16
 
@@ -22,28 +22,22 @@
22
22
 
23
23
  ### RoomleConfiguratorApi
24
24
 
25
- Ƭ **RoomleConfiguratorApi**: [`default`](../classes/roomle_configurator_api.default.md)<`RoomleConfigurator`, `ConfiguratorUiCallbacks`\>
25
+ Ƭ **RoomleConfiguratorApi**: [*default*](../classes/roomle_configurator_api.default.md)<RoomleConfigurator, ConfiguratorUiCallbacks\>
26
26
 
27
- #### Defined in
28
-
29
- [src/configurator/embedding/roomle-configurator-api.ts:69](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/roomle-configurator-api.ts#L69)
27
+ Defined in: src/configurator/embedding/roomle-configurator-api.ts:69
30
28
 
31
29
  ___
32
30
 
33
31
  ### RoomlePlannerApi
34
32
 
35
- Ƭ **RoomlePlannerApi**: [`default`](../classes/roomle_configurator_api.default.md)<`RoomlePlanner`, `ConfiguratorUiCallbacks`\>
36
-
37
- #### Defined in
33
+ Ƭ **RoomlePlannerApi**: [*default*](../classes/roomle_configurator_api.default.md)<RoomlePlanner, ConfiguratorUiCallbacks\>
38
34
 
39
- [src/configurator/embedding/roomle-configurator-api.ts:71](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/roomle-configurator-api.ts#L71)
35
+ Defined in: src/configurator/embedding/roomle-configurator-api.ts:71
40
36
 
41
37
  ___
42
38
 
43
39
  ### RoomleViewerApi
44
40
 
45
- Ƭ **RoomleViewerApi**: [`default`](../classes/roomle_configurator_api.default.md)<`RoomleGLBViewer`, `ConfiguratorUiCallbacks`\>
46
-
47
- #### Defined in
41
+ Ƭ **RoomleViewerApi**: [*default*](../classes/roomle_configurator_api.default.md)<RoomleGLBViewer, ConfiguratorUiCallbacks\>
48
42
 
49
- [src/configurator/embedding/roomle-configurator-api.ts:70](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/roomle-configurator-api.ts#L70)
43
+ Defined in: src/configurator/embedding/roomle-configurator-api.ts:70
@@ -6,11 +6,11 @@
6
6
 
7
7
  ### Enumerations
8
8
 
9
- - [UI\_BUTTON](../enums/types.UI_BUTTON.md)
9
+ - [UI\_BUTTON](../enums/types.ui_button.md)
10
10
 
11
11
  ### Interfaces
12
12
 
13
- - [ConfiguratorSettings](../interfaces/types.ConfiguratorSettings.md)
14
- - [EmbeddingSkin](../interfaces/types.EmbeddingSkin.md)
15
- - [UiInitData](../interfaces/types.UiInitData.md)
16
- - [VariantsMap](../interfaces/types.VariantsMap.md)
13
+ - [ConfiguratorSettings](../interfaces/types.configuratorsettings.md)
14
+ - [EmbeddingSkin](../interfaces/types.embeddingskin.md)
15
+ - [UiInitData](../interfaces/types.uiinitdata.md)
16
+ - [VariantsMap](../interfaces/types.variantsmap.md)
package/docs/index.md CHANGED
@@ -206,9 +206,9 @@ Here you will find some recipes for how you could implement certain use cases. T
206
206
 
207
207
  ### Instantiation
208
208
 
209
- We provide now two convenient ways to load a product into the configurator. Either you instantiate the Roomle Configurator without a product and use `loadObject` later or you pass in an ID as init-option. Both ways have their pros and cons. Let's review them quickly.
209
+ We provide now two convenient ways to load a product into the configurator. Either you instantiate the Roomle Configurator without a product and use `loadObject` later or you pass in the `Roomle unique product ID` as init-option. Both ways have their pros and cons. Let's review them quickly.
210
210
 
211
- When you have a detail-page of a product in your webshop or website it makes sense to pass the ID as init-option (because you know which product your customer wants to see). This makes it possible that everything is loaded in parallel, the code of the configurator, and the content of your product. This speeds up the loading process. On the other hand, it makes no sense if you load some product when you do not know which product your customer wants to see in the configurator. This could be the case if the Roomle Configurator is opened on a list-view page where several products are listed. Here it makes sense to only instantiate the configurator. This only loads the code of the configurator. When the user then selects a product you can use the `loadObject` method to load this specific product.
211
+ When you have a detail-page of a product in your webshop or website it makes sense to pass the `Roomle unique product ID` as init-option (because you know which product your customer wants to see). This makes it possible that everything is loaded in parallel, the code of the configurator, and the content of your product. This speeds up the loading process. On the other hand, it makes no sense if you load some product when you do not know which product your customer wants to see in the configurator. This could be the case if the Roomle Configurator is opened on a list-view page where several products are listed. Here it makes sense to only instantiate the configurator. This only loads the code of the configurator. When the user then selects a product you can use the `loadObject` method to load this specific product.
212
212
 
213
213
  ```JavaScript
214
214
  const objectToLoadId = 'usm:frame:BB3BB3E7951BC15109B1FF86D78C95DE3FB46E9F78714C46FFA2DE91866A2C2B';
@@ -778,7 +778,7 @@ const options = {
778
778
  };
779
779
  ```
780
780
 
781
- To see which labels exist you can take a look at the [API documentation](./api/interfaces/types.uiinitdata.html#translations)
781
+ To see which labels exist you can take a look at the [API documentation](./api/interfaces/types.UiInitData.html#translations).
782
782
 
783
783
  You can test and play around with those settings in this CodeSandbox:
784
784
  [![Edit intelligent-merkle-s589m](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/intelligent-merkle-s589m?fontsize=14&hidenavigation=1&theme=dark)
@@ -1,6 +1,11 @@
1
- ## [4.24.0-alpha.2](https://gitlab.com/roomle/web/roomle-ui/compare/embedding-v4.24.0-alpha.1...embedding-v4.24.0-alpha.2) (2021-11-05)
1
+ ## [4.24.0](https://gitlab.com/roomle/web/roomle-ui/compare/embedding-v4.23.0...embedding-v4.24.0) (2021-11-23)
2
2
 
3
3
 
4
4
  ### Features
5
5
 
6
+ * upgrade SDK to version 2.19.0 ([34c7760](https://gitlab.com/roomle/web/roomle-ui/commit/34c7760ec4877beef0e6645f9e12e466de185f08))
7
+ * upgrade SDK to version 2.19.0-alpha.1 ([f9e573f](https://gitlab.com/roomle/web/roomle-ui/commit/f9e573f08bb9718c1597ad4bc53198f87117e63f))
6
8
  * upgrade SDK to version 2.19.0-alpha.2 ([71936ac](https://gitlab.com/roomle/web/roomle-ui/commit/71936ac4aa9ecf09966f563df96e2d9b35ddb54c))
9
+ * upgrade SDK to version 2.19.0-alpha.3 ([c4942f2](https://gitlab.com/roomle/web/roomle-ui/commit/c4942f2e13316c0c4d179199227c9a75c1b8673e))
10
+ * upgrade SDK to version 2.19.0-alpha.4 ([16da2cb](https://gitlab.com/roomle/web/roomle-ui/commit/16da2cb8d691fadeba8d3dfe7a39e57b5d9f25eb))
11
+ * upgrade SDK to version 2.19.0-alpha.5 ([f8732a7](https://gitlab.com/roomle/web/roomle-ui/commit/f8732a7d9cb4a0e39d593bfea7a04d14fc9b52c2))
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@roomle/embedding-lib","version":"4.24.0-alpha.2","main":"roomle-configurator-api.es.min.js","types":"types/index.d.ts","author":"Roomle Development","dependencies":{"@roomle/web-sdk":"2.19.0-alpha.2"},"devDependencies":{"@semantic-release/changelog":"^5.0.1","@semantic-release/exec":"^5.0.0","conventional-changelog-conventionalcommits":"^4.2.3","semantic-release":"^17.0.7"},"scripts":{"release":"semantic-release"},"description":"This is a small library which can be used to communicate with the Roomle Configurator","repository":{"type":"git","url":"git+https://github.com/roomle-build/npm-packages.git"},"publishConfig":{"access":"public"},"license":"MIT"}
1
+ {"name":"@roomle/embedding-lib","version":"4.24.0","main":"roomle-configurator-api.es.min.js","types":"types/index.d.ts","author":"Roomle Development","dependencies":{"@roomle/web-sdk":"2.19.0"},"devDependencies":{"@semantic-release/changelog":"^5.0.1","@semantic-release/exec":"^5.0.0","conventional-changelog-conventionalcommits":"^4.2.3","semantic-release":"^17.0.7"},"scripts":{"release":"semantic-release"},"description":"This is a small library which can be used to communicate with the Roomle Configurator","repository":{"type":"git","url":"git+https://github.com/roomle-build/npm-packages.git"},"publishConfig":{"access":"public"},"license":"MIT"}
@@ -307,7 +307,7 @@ const getFallbackInitData = () => {
307
307
  if (hostname && isDemoHostname(hostname)) {
308
308
  fallbackInitData.configuratorId = 'demoConfigurator';
309
309
  }
310
- fallbackInitData.customApiUrl = 'https://alpha.roomle.com/api/v2';
310
+ fallbackInitData.customApiUrl = 'https://www.roomle.com/api/v2';
311
311
  fallbackInitData.emails = false;
312
312
  return fallbackInitData;
313
313
  };
@@ -1 +1 @@
1
- "use strict";class t{constructor(t,e,r,s){this.t=null,this.s=null,this.i=t,this.o=e,this.t=r,this.s=s,this.o.addEventListener("message",this.l.bind(this))}setOutgoingMessageBus(t){this.t=t}setMessageExecution(t){this.s=t}sendMessage(t,e=[]){return new Promise((r,s)=>{const i=new MessageChannel;i.port1.onmessage=t=>{if(!t||!t.data)return i.port1.close(),i.port2.close(),s(new Error(this.i+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return i.port1.close(),i.port2.close(),this.h(t),s(t)}e.error?s(e.error):void 0!==e.result?r(e.result):r(),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch(t){return s(new Error(this.i+": can not create command because it is not JSON.stringify able"))}if(!this.t)return s(new Error(this.i+": outgoing bus not set yet"));this.t.postMessage(o,"*",[i.port2])})}l(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const r=JSON.parse(t.data);if(!this.s)return e.postMessage(JSON.stringify({error:this.i+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const s=this.s(r,t);if(void 0===s)return;s.then((t={})=>{let r=void 0,s=void 0;"object"==typeof t&&null!==t&&(r=t.error,s=t.result),r?e.postMessage(JSON.stringify({error:r})):void 0!==s?e.postMessage(JSON.stringify({result:s})):e.postMessage(JSON.stringify({result:t}))},t=>{e.postMessage(JSON.stringify({error:this.h(t)}))})}catch(t){e.postMessage(JSON.stringify({error:this.h(t)}))}}h(t){if("string"==typeof t){const e=this.i+": "+t;return console.error(e),e}return t.message=this.i+": "+t.message,console.error(t),t.message}}const e=(t,r)=>{for(const s in r)try{r[s].constructor===Object?t[s]=e(t[s],r[s]):t[s]=r[s]}catch(e){t[s]=r[s]}return t},r=["127.0.0.1","localhost","0.0.0.0"],s=["language","browserLanguage","userLanguage","systemLanguage"],i=t=>{if(!t)return;const e=Object.keys(t);for(const r of e){const e=t[r];if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return i(e);if(Array.isArray(e)){for(const t of e)i(t);return}"true"!==e&&"false"!==e||(t[r]="true"===e)}},o=()=>/(android)/i.test(navigator.userAgent),n=(t,e,r)=>{let s=null;Object.defineProperty(t,e,{get:()=>s||r,set(t){(null==t?void 0:t.mute)?s=t.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),s=t)}})},l=()=>.01*window.innerHeight+"px",a=t=>{t&&setTimeout(()=>t.style.setProperty(h,l()),0)},h="--rml-full-height",c=new Map;module.exports=class{constructor(e,r,s,i){if(this.ui={callbacks:null},this.extended={callbacks:null},this.analytics={callbacks:{}},this.global={callbacks:{}},this.u={},!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(r))throw new Error("There is already an instance on this DOM element");if(!document.getElementById("rml-styles")){const t=s.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id="rml-styles";const r="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((t,e)=>t+(e+r),"")+r,o=l();e.innerHTML=`\n .rml-container{${h}:${o};}\n .rml-pos{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${i}}\n .rml-fill{width:100%;height:100%;opacity:1}\n .rml-android-height{height:calc(var(${h},1vh)*100)}\n .rml-overflow-hidden{overflow:hidden}\n `,document.head.appendChild(e)}this.m=this.m.bind(this),o()&&window.addEventListener("resize",this.m),this.g=r,this.u=s,this.p=e;const n=this.v();this.O=this.O.bind(this),this.N=this.N.bind(this),this.P=this.P.bind(this),this._=new t("website",window,null,this.N),this.J=i,this.g.appendChild(n),this.S=n,c.set(r,!0)}static createPlanner(t,e,r){return this.k(t,e,r)}static createConfigurator(t,e,r){return this.k(t,e,r)}static create(t,e,r){return this.k(t,e,r)}static createViewer(t,e,r){return this.k(t,e,r)}static k(t,o,n){return new Promise(async(l,a)=>{try{const a=e((()=>{const t={};t.locale||(t.locale=((t=null)=>{const e=window.navigator;if(t)return t.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=s.length;t<r;t++){const r=e[s[t]];if(r)return r.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const e=(()=>{const t=(()=>{try{return window.self!==window.top}catch(t){return!0}})();let e=window.location.href;if(t){if(!document.referrer)return null;e=document.referrer}const{hostname:r}=new URL(e);return r})();return e&&(t=>!!r.includes(t)||!!t.endsWith("roomle.com")||!(!t.endsWith("gitlab.io")&&!t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl="https://alpha.roomle.com/api/v2",t.emails=!1,t})(),(t=>(i(t),(null==t?void 0:t.customApiUrl)&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(n));a.featureFlags||(a.featureFlags={}),"boolean"!=typeof a.featureFlags.realPartList&&(a.featureFlags.realPartList=!0),"boolean"!=typeof a.featureFlags.globalCallbacks&&(a.featureFlags.globalCallbacks=!0);const h=await(async(t,e)=>{if("string"!=typeof t)throw new Error('Configurator ID is not a string type: "'+typeof t+'"');const r=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",s=e.overrideTenant||9,i=r+"/configurators/"+t,o="03-"+window.btoa((new Date).toISOString()+";anonymous;roomle_portal_v2"),n=new Request(i,{method:"GET",headers:new Headers({apiKey:"roomle_portal_v2",currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(n),{configurator:a}=await l.json();return a})(t,a);return n=((t,r)=>{r.configuratorId=t.id;const s=t.settings||{};return!r.overrideTenant&&t.tenant&&(r.overrideTenant=t.tenant),((t,r)=>{const s=JSON.parse(JSON.stringify(t));return e(s,r)})(s,r)})(h,a),new this(h,o,n,l)}catch(t){return a(t)}})}teardown(){this.g&&c.delete(this.g);const t=this.g.querySelector("iframe");t&&this.g.removeChild(t),window.removeEventListener("resize",this.m)}v(){var t;const e=document.createElement("iframe");let r=(null===(t=this.p)||void 0===t?void 0:t.url)||"https://www.roomle.com/t/cp/";return this.u.useLocalRoomle&&(r=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(r=location.href.replace("embedding.html","index.html")),this.u.overrideServerUrl&&(r=this.u.overrideServerUrl),e.src=r,e.classList.add("rml-container"),e.classList.add("rml-fill"),e}m(){a(this.S)}O(){this.S.classList.add("rml-pos"),document.documentElement.classList.add("rml-overflow-hidden"),window.document.body.classList.add("rml-overflow-hidden"),o()&&(a(this.S),this.S.classList.add("rml-android-height"))}P(){this.S.classList.remove("rml-pos"),this.S.classList.remove("rml-android-height"),document.documentElement.classList.remove("rml-overflow-hidden"),window.document.body.classList.remove("rml-overflow-hidden")}N({message:t,args:e},r){var s;if(!r.source)return;if(r.source!==(null===(s=this.S)||void 0===s?void 0:s.contentWindow))return;if("requestBoot"===t)return this._.setOutgoingMessageBus(r.source),Promise.resolve({result:this.u});if("setup"===t){const{methods:t,callbacks:r}=e[0];return t.forEach(t=>{const e=t.split("."),r=e[0],s=e[1];this[r]||(this[r]={}),this[r][s]=function(){return this._.sendMessage(t,[...arguments])}.bind(this)}),r.forEach(t=>{const e=t.split("."),r=e[0],s=e[1],i=e[2];this[r]||(this[r]={}),this[r][s]||(this[r][s]={}),this[r][s][i]=()=>{}}),n(this.ui.callbacks,"onUseFullPage",this.O),n(this.ui.callbacks,"onBackToWebsite",this.P),this.J(this),setTimeout(()=>this._.sendMessage("websiteReady"),0),Promise.resolve({result:null})}const i=t.split("."),o=i[0],l=i[1],a=3===i.length?i[2]:null;if(a&&this[o][l][a]){const t=this[o][l][a](...e);return t instanceof Promise?t.then(t=>({result:t})):void 0!==t?Promise.resolve({result:t}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}};
1
+ "use strict";class t{constructor(t,e,r,s){this.t=null,this.s=null,this.i=t,this.o=e,this.t=r,this.s=s,this.o.addEventListener("message",this.l.bind(this))}setOutgoingMessageBus(t){this.t=t}setMessageExecution(t){this.s=t}sendMessage(t,e=[]){return new Promise((r,s)=>{const i=new MessageChannel;i.port1.onmessage=t=>{if(!t||!t.data)return i.port1.close(),i.port2.close(),s(new Error(this.i+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return i.port1.close(),i.port2.close(),this.h(t),s(t)}e.error?s(e.error):void 0!==e.result?r(e.result):r(),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch(t){return s(new Error(this.i+": can not create command because it is not JSON.stringify able"))}if(!this.t)return s(new Error(this.i+": outgoing bus not set yet"));this.t.postMessage(o,"*",[i.port2])})}l(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const r=JSON.parse(t.data);if(!this.s)return e.postMessage(JSON.stringify({error:this.i+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const s=this.s(r,t);if(void 0===s)return;s.then((t={})=>{let r=void 0,s=void 0;"object"==typeof t&&null!==t&&(r=t.error,s=t.result),r?e.postMessage(JSON.stringify({error:r})):void 0!==s?e.postMessage(JSON.stringify({result:s})):e.postMessage(JSON.stringify({result:t}))},t=>{e.postMessage(JSON.stringify({error:this.h(t)}))})}catch(t){e.postMessage(JSON.stringify({error:this.h(t)}))}}h(t){if("string"==typeof t){const e=this.i+": "+t;return console.error(e),e}return t.message=this.i+": "+t.message,console.error(t),t.message}}const e=(t,r)=>{for(const s in r)try{r[s].constructor===Object?t[s]=e(t[s],r[s]):t[s]=r[s]}catch(e){t[s]=r[s]}return t},r=["127.0.0.1","localhost","0.0.0.0"],s=["language","browserLanguage","userLanguage","systemLanguage"],i=t=>{if(!t)return;const e=Object.keys(t);for(const r of e){const e=t[r];if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return i(e);if(Array.isArray(e)){for(const t of e)i(t);return}"true"!==e&&"false"!==e||(t[r]="true"===e)}},o=()=>/(android)/i.test(navigator.userAgent),n=(t,e,r)=>{let s=null;Object.defineProperty(t,e,{get:()=>s||r,set(t){(null==t?void 0:t.mute)?s=t.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),s=t)}})},l=()=>.01*window.innerHeight+"px",a=t=>{t&&setTimeout(()=>t.style.setProperty(h,l()),0)},h="--rml-full-height",c=new Map;module.exports=class{constructor(e,r,s,i){if(this.ui={callbacks:null},this.extended={callbacks:null},this.analytics={callbacks:{}},this.global={callbacks:{}},this.u={},!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(r))throw new Error("There is already an instance on this DOM element");if(!document.getElementById("rml-styles")){const t=s.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id="rml-styles";const r="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((t,e)=>t+(e+r),"")+r,o=l();e.innerHTML=`\n .rml-container{${h}:${o};}\n .rml-pos{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${i}}\n .rml-fill{width:100%;height:100%;opacity:1}\n .rml-android-height{height:calc(var(${h},1vh)*100)}\n .rml-overflow-hidden{overflow:hidden}\n `,document.head.appendChild(e)}this.m=this.m.bind(this),o()&&window.addEventListener("resize",this.m),this.g=r,this.u=s,this.p=e;const n=this.v();this.O=this.O.bind(this),this.N=this.N.bind(this),this.P=this.P.bind(this),this._=new t("website",window,null,this.N),this.J=i,this.g.appendChild(n),this.S=n,c.set(r,!0)}static createPlanner(t,e,r){return this.k(t,e,r)}static createConfigurator(t,e,r){return this.k(t,e,r)}static create(t,e,r){return this.k(t,e,r)}static createViewer(t,e,r){return this.k(t,e,r)}static k(t,o,n){return new Promise(async(l,a)=>{try{const a=e((()=>{const t={};t.locale||(t.locale=((t=null)=>{const e=window.navigator;if(t)return t.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=s.length;t<r;t++){const r=e[s[t]];if(r)return r.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const e=(()=>{const t=(()=>{try{return window.self!==window.top}catch(t){return!0}})();let e=window.location.href;if(t){if(!document.referrer)return null;e=document.referrer}const{hostname:r}=new URL(e);return r})();return e&&(t=>!!r.includes(t)||!!t.endsWith("roomle.com")||!(!t.endsWith("gitlab.io")&&!t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl="https://www.roomle.com/api/v2",t.emails=!1,t})(),(t=>(i(t),(null==t?void 0:t.customApiUrl)&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(n));a.featureFlags||(a.featureFlags={}),"boolean"!=typeof a.featureFlags.realPartList&&(a.featureFlags.realPartList=!0),"boolean"!=typeof a.featureFlags.globalCallbacks&&(a.featureFlags.globalCallbacks=!0);const h=await(async(t,e)=>{if("string"!=typeof t)throw new Error('Configurator ID is not a string type: "'+typeof t+'"');const r=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",s=e.overrideTenant||9,i=r+"/configurators/"+t,o="03-"+window.btoa((new Date).toISOString()+";anonymous;roomle_portal_v2"),n=new Request(i,{method:"GET",headers:new Headers({apiKey:"roomle_portal_v2",currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(n),{configurator:a}=await l.json();return a})(t,a);return n=((t,r)=>{r.configuratorId=t.id;const s=t.settings||{};return!r.overrideTenant&&t.tenant&&(r.overrideTenant=t.tenant),((t,r)=>{const s=JSON.parse(JSON.stringify(t));return e(s,r)})(s,r)})(h,a),new this(h,o,n,l)}catch(t){return a(t)}})}teardown(){this.g&&c.delete(this.g);const t=this.g.querySelector("iframe");t&&this.g.removeChild(t),window.removeEventListener("resize",this.m)}v(){var t;const e=document.createElement("iframe");let r=(null===(t=this.p)||void 0===t?void 0:t.url)||"https://www.roomle.com/t/cp/";return this.u.useLocalRoomle&&(r=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(r=location.href.replace("embedding.html","index.html")),this.u.overrideServerUrl&&(r=this.u.overrideServerUrl),e.src=r,e.classList.add("rml-container"),e.classList.add("rml-fill"),e}m(){a(this.S)}O(){this.S.classList.add("rml-pos"),document.documentElement.classList.add("rml-overflow-hidden"),window.document.body.classList.add("rml-overflow-hidden"),o()&&(a(this.S),this.S.classList.add("rml-android-height"))}P(){this.S.classList.remove("rml-pos"),this.S.classList.remove("rml-android-height"),document.documentElement.classList.remove("rml-overflow-hidden"),window.document.body.classList.remove("rml-overflow-hidden")}N({message:t,args:e},r){var s;if(!r.source)return;if(r.source!==(null===(s=this.S)||void 0===s?void 0:s.contentWindow))return;if("requestBoot"===t)return this._.setOutgoingMessageBus(r.source),Promise.resolve({result:this.u});if("setup"===t){const{methods:t,callbacks:r}=e[0];return t.forEach(t=>{const e=t.split("."),r=e[0],s=e[1];this[r]||(this[r]={}),this[r][s]=function(){return this._.sendMessage(t,[...arguments])}.bind(this)}),r.forEach(t=>{const e=t.split("."),r=e[0],s=e[1],i=e[2];this[r]||(this[r]={}),this[r][s]||(this[r][s]={}),this[r][s][i]=()=>{}}),n(this.ui.callbacks,"onUseFullPage",this.O),n(this.ui.callbacks,"onBackToWebsite",this.P),this.J(this),setTimeout(()=>this._.sendMessage("websiteReady"),0),Promise.resolve({result:null})}const i=t.split("."),o=i[0],l=i[1],a=3===i.length?i[2]:null;if(a&&this[o][l][a]){const t=this[o][l][a](...e);return t instanceof Promise?t.then(t=>({result:t})):void 0!==t?Promise.resolve({result:t}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}};
@@ -305,7 +305,7 @@ const getFallbackInitData = () => {
305
305
  if (hostname && isDemoHostname(hostname)) {
306
306
  fallbackInitData.configuratorId = 'demoConfigurator';
307
307
  }
308
- fallbackInitData.customApiUrl = 'https://alpha.roomle.com/api/v2';
308
+ fallbackInitData.customApiUrl = 'https://www.roomle.com/api/v2';
309
309
  fallbackInitData.emails = false;
310
310
  return fallbackInitData;
311
311
  };
@@ -1 +1 @@
1
- class t{constructor(t,e,r,s){this.t=null,this.s=null,this.i=t,this.o=e,this.t=r,this.s=s,this.o.addEventListener("message",this.l.bind(this))}setOutgoingMessageBus(t){this.t=t}setMessageExecution(t){this.s=t}sendMessage(t,e=[]){return new Promise((r,s)=>{const i=new MessageChannel;i.port1.onmessage=t=>{if(!t||!t.data)return i.port1.close(),i.port2.close(),s(new Error(this.i+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return i.port1.close(),i.port2.close(),this.h(t),s(t)}e.error?s(e.error):void 0!==e.result?r(e.result):r(),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch(t){return s(new Error(this.i+": can not create command because it is not JSON.stringify able"))}if(!this.t)return s(new Error(this.i+": outgoing bus not set yet"));this.t.postMessage(o,"*",[i.port2])})}l(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const r=JSON.parse(t.data);if(!this.s)return e.postMessage(JSON.stringify({error:this.i+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const s=this.s(r,t);if(void 0===s)return;s.then((t={})=>{let r=void 0,s=void 0;"object"==typeof t&&null!==t&&(r=t.error,s=t.result),r?e.postMessage(JSON.stringify({error:r})):void 0!==s?e.postMessage(JSON.stringify({result:s})):e.postMessage(JSON.stringify({result:t}))},t=>{e.postMessage(JSON.stringify({error:this.h(t)}))})}catch(t){e.postMessage(JSON.stringify({error:this.h(t)}))}}h(t){if("string"==typeof t){const e=this.i+": "+t;return console.error(e),e}return t.message=this.i+": "+t.message,console.error(t),t.message}}const e=(t,r)=>{for(const s in r)try{r[s].constructor===Object?t[s]=e(t[s],r[s]):t[s]=r[s]}catch(e){t[s]=r[s]}return t},r=["127.0.0.1","localhost","0.0.0.0"],s=["language","browserLanguage","userLanguage","systemLanguage"],i=t=>{if(!t)return;const e=Object.keys(t);for(const r of e){const e=t[r];if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return i(e);if(Array.isArray(e)){for(const t of e)i(t);return}"true"!==e&&"false"!==e||(t[r]="true"===e)}},o=()=>/(android)/i.test(navigator.userAgent),n=(t,e,r)=>{let s=null;Object.defineProperty(t,e,{get:()=>s||r,set(t){(null==t?void 0:t.mute)?s=t.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),s=t)}})},a=()=>.01*window.innerHeight+"px",l=t=>{t&&setTimeout(()=>t.style.setProperty(h,a()),0)},h="--rml-full-height",c=new Map;class u{constructor(e,r,s,i){if(this.ui={callbacks:null},this.extended={callbacks:null},this.analytics={callbacks:{}},this.global={callbacks:{}},this.u={},!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(r))throw new Error("There is already an instance on this DOM element");if(!document.getElementById("rml-styles")){const t=s.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id="rml-styles";const r="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((t,e)=>t+(e+r),"")+r,o=a();e.innerHTML=`\n .rml-container{${h}:${o};}\n .rml-pos{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${i}}\n .rml-fill{width:100%;height:100%;opacity:1}\n .rml-android-height{height:calc(var(${h},1vh)*100)}\n .rml-overflow-hidden{overflow:hidden}\n `,document.head.appendChild(e)}this.m=this.m.bind(this),o()&&window.addEventListener("resize",this.m),this.g=r,this.u=s,this.p=e;const n=this.v();this.O=this.O.bind(this),this.N=this.N.bind(this),this.P=this.P.bind(this),this._=new t("website",window,null,this.N),this.J=i,this.g.appendChild(n),this.S=n,c.set(r,!0)}static createPlanner(t,e,r){return this.k(t,e,r)}static createConfigurator(t,e,r){return this.k(t,e,r)}static create(t,e,r){return this.k(t,e,r)}static createViewer(t,e,r){return this.k(t,e,r)}static k(t,o,n){return new Promise(async(a,l)=>{try{const l=e((()=>{const t={};t.locale||(t.locale=((t=null)=>{const e=window.navigator;if(t)return t.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=s.length;t<r;t++){const r=e[s[t]];if(r)return r.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const e=(()=>{const t=(()=>{try{return window.self!==window.top}catch(t){return!0}})();let e=window.location.href;if(t){if(!document.referrer)return null;e=document.referrer}const{hostname:r}=new URL(e);return r})();return e&&(t=>!!r.includes(t)||!!t.endsWith("roomle.com")||!(!t.endsWith("gitlab.io")&&!t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl="https://alpha.roomle.com/api/v2",t.emails=!1,t})(),(t=>(i(t),(null==t?void 0:t.customApiUrl)&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(n));l.featureFlags||(l.featureFlags={}),"boolean"!=typeof l.featureFlags.realPartList&&(l.featureFlags.realPartList=!0),"boolean"!=typeof l.featureFlags.globalCallbacks&&(l.featureFlags.globalCallbacks=!0);const h=await(async(t,e)=>{if("string"!=typeof t)throw new Error('Configurator ID is not a string type: "'+typeof t+'"');const r=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",s=e.overrideTenant||9,i=r+"/configurators/"+t,o="03-"+window.btoa((new Date).toISOString()+";anonymous;roomle_portal_v2"),n=new Request(i,{method:"GET",headers:new Headers({apiKey:"roomle_portal_v2",currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"}),mode:"cors",cache:"default"}),a=await fetch(n),{configurator:l}=await a.json();return l})(t,l);return n=((t,r)=>{r.configuratorId=t.id;const s=t.settings||{};return!r.overrideTenant&&t.tenant&&(r.overrideTenant=t.tenant),((t,r)=>{const s=JSON.parse(JSON.stringify(t));return e(s,r)})(s,r)})(h,l),new this(h,o,n,a)}catch(t){return l(t)}})}teardown(){this.g&&c.delete(this.g);const t=this.g.querySelector("iframe");t&&this.g.removeChild(t),window.removeEventListener("resize",this.m)}v(){var t;const e=document.createElement("iframe");let r=(null===(t=this.p)||void 0===t?void 0:t.url)||"https://www.roomle.com/t/cp/";return this.u.useLocalRoomle&&(r=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(r=location.href.replace("embedding.html","index.html")),this.u.overrideServerUrl&&(r=this.u.overrideServerUrl),e.src=r,e.classList.add("rml-container"),e.classList.add("rml-fill"),e}m(){l(this.S)}O(){this.S.classList.add("rml-pos"),document.documentElement.classList.add("rml-overflow-hidden"),window.document.body.classList.add("rml-overflow-hidden"),o()&&(l(this.S),this.S.classList.add("rml-android-height"))}P(){this.S.classList.remove("rml-pos"),this.S.classList.remove("rml-android-height"),document.documentElement.classList.remove("rml-overflow-hidden"),window.document.body.classList.remove("rml-overflow-hidden")}N({message:t,args:e},r){var s;if(!r.source)return;if(r.source!==(null===(s=this.S)||void 0===s?void 0:s.contentWindow))return;if("requestBoot"===t)return this._.setOutgoingMessageBus(r.source),Promise.resolve({result:this.u});if("setup"===t){const{methods:t,callbacks:r}=e[0];return t.forEach(t=>{const e=t.split("."),r=e[0],s=e[1];this[r]||(this[r]={}),this[r][s]=function(){return this._.sendMessage(t,[...arguments])}.bind(this)}),r.forEach(t=>{const e=t.split("."),r=e[0],s=e[1],i=e[2];this[r]||(this[r]={}),this[r][s]||(this[r][s]={}),this[r][s][i]=()=>{}}),n(this.ui.callbacks,"onUseFullPage",this.O),n(this.ui.callbacks,"onBackToWebsite",this.P),this.J(this),setTimeout(()=>this._.sendMessage("websiteReady"),0),Promise.resolve({result:null})}const i=t.split("."),o=i[0],a=i[1],l=3===i.length?i[2]:null;if(l&&this[o][a][l]){const t=this[o][a][l](...e);return t instanceof Promise?t.then(t=>({result:t})):void 0!==t?Promise.resolve({result:t}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}}export{u as default};
1
+ class t{constructor(t,e,r,s){this.t=null,this.s=null,this.i=t,this.o=e,this.t=r,this.s=s,this.o.addEventListener("message",this.l.bind(this))}setOutgoingMessageBus(t){this.t=t}setMessageExecution(t){this.s=t}sendMessage(t,e=[]){return new Promise((r,s)=>{const i=new MessageChannel;i.port1.onmessage=t=>{if(!t||!t.data)return i.port1.close(),i.port2.close(),s(new Error(this.i+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return i.port1.close(),i.port2.close(),this.h(t),s(t)}e.error?s(e.error):void 0!==e.result?r(e.result):r(),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch(t){return s(new Error(this.i+": can not create command because it is not JSON.stringify able"))}if(!this.t)return s(new Error(this.i+": outgoing bus not set yet"));this.t.postMessage(o,"*",[i.port2])})}l(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const r=JSON.parse(t.data);if(!this.s)return e.postMessage(JSON.stringify({error:this.i+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const s=this.s(r,t);if(void 0===s)return;s.then((t={})=>{let r=void 0,s=void 0;"object"==typeof t&&null!==t&&(r=t.error,s=t.result),r?e.postMessage(JSON.stringify({error:r})):void 0!==s?e.postMessage(JSON.stringify({result:s})):e.postMessage(JSON.stringify({result:t}))},t=>{e.postMessage(JSON.stringify({error:this.h(t)}))})}catch(t){e.postMessage(JSON.stringify({error:this.h(t)}))}}h(t){if("string"==typeof t){const e=this.i+": "+t;return console.error(e),e}return t.message=this.i+": "+t.message,console.error(t),t.message}}const e=(t,r)=>{for(const s in r)try{r[s].constructor===Object?t[s]=e(t[s],r[s]):t[s]=r[s]}catch(e){t[s]=r[s]}return t},r=["127.0.0.1","localhost","0.0.0.0"],s=["language","browserLanguage","userLanguage","systemLanguage"],i=t=>{if(!t)return;const e=Object.keys(t);for(const r of e){const e=t[r];if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return i(e);if(Array.isArray(e)){for(const t of e)i(t);return}"true"!==e&&"false"!==e||(t[r]="true"===e)}},o=()=>/(android)/i.test(navigator.userAgent),n=(t,e,r)=>{let s=null;Object.defineProperty(t,e,{get:()=>s||r,set(t){(null==t?void 0:t.mute)?s=t.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),s=t)}})},a=()=>.01*window.innerHeight+"px",l=t=>{t&&setTimeout(()=>t.style.setProperty(h,a()),0)},h="--rml-full-height",c=new Map;class u{constructor(e,r,s,i){if(this.ui={callbacks:null},this.extended={callbacks:null},this.analytics={callbacks:{}},this.global={callbacks:{}},this.u={},!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(r))throw new Error("There is already an instance on this DOM element");if(!document.getElementById("rml-styles")){const t=s.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id="rml-styles";const r="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((t,e)=>t+(e+r),"")+r,o=a();e.innerHTML=`\n .rml-container{${h}:${o};}\n .rml-pos{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${i}}\n .rml-fill{width:100%;height:100%;opacity:1}\n .rml-android-height{height:calc(var(${h},1vh)*100)}\n .rml-overflow-hidden{overflow:hidden}\n `,document.head.appendChild(e)}this.m=this.m.bind(this),o()&&window.addEventListener("resize",this.m),this.g=r,this.u=s,this.p=e;const n=this.v();this.O=this.O.bind(this),this.N=this.N.bind(this),this.P=this.P.bind(this),this._=new t("website",window,null,this.N),this.J=i,this.g.appendChild(n),this.S=n,c.set(r,!0)}static createPlanner(t,e,r){return this.k(t,e,r)}static createConfigurator(t,e,r){return this.k(t,e,r)}static create(t,e,r){return this.k(t,e,r)}static createViewer(t,e,r){return this.k(t,e,r)}static k(t,o,n){return new Promise(async(a,l)=>{try{const l=e((()=>{const t={};t.locale||(t.locale=((t=null)=>{const e=window.navigator;if(t)return t.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=s.length;t<r;t++){const r=e[s[t]];if(r)return r.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const e=(()=>{const t=(()=>{try{return window.self!==window.top}catch(t){return!0}})();let e=window.location.href;if(t){if(!document.referrer)return null;e=document.referrer}const{hostname:r}=new URL(e);return r})();return e&&(t=>!!r.includes(t)||!!t.endsWith("roomle.com")||!(!t.endsWith("gitlab.io")&&!t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl="https://www.roomle.com/api/v2",t.emails=!1,t})(),(t=>(i(t),(null==t?void 0:t.customApiUrl)&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(n));l.featureFlags||(l.featureFlags={}),"boolean"!=typeof l.featureFlags.realPartList&&(l.featureFlags.realPartList=!0),"boolean"!=typeof l.featureFlags.globalCallbacks&&(l.featureFlags.globalCallbacks=!0);const h=await(async(t,e)=>{if("string"!=typeof t)throw new Error('Configurator ID is not a string type: "'+typeof t+'"');const r=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",s=e.overrideTenant||9,i=r+"/configurators/"+t,o="03-"+window.btoa((new Date).toISOString()+";anonymous;roomle_portal_v2"),n=new Request(i,{method:"GET",headers:new Headers({apiKey:"roomle_portal_v2",currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"}),mode:"cors",cache:"default"}),a=await fetch(n),{configurator:l}=await a.json();return l})(t,l);return n=((t,r)=>{r.configuratorId=t.id;const s=t.settings||{};return!r.overrideTenant&&t.tenant&&(r.overrideTenant=t.tenant),((t,r)=>{const s=JSON.parse(JSON.stringify(t));return e(s,r)})(s,r)})(h,l),new this(h,o,n,a)}catch(t){return l(t)}})}teardown(){this.g&&c.delete(this.g);const t=this.g.querySelector("iframe");t&&this.g.removeChild(t),window.removeEventListener("resize",this.m)}v(){var t;const e=document.createElement("iframe");let r=(null===(t=this.p)||void 0===t?void 0:t.url)||"https://www.roomle.com/t/cp/";return this.u.useLocalRoomle&&(r=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(r=location.href.replace("embedding.html","index.html")),this.u.overrideServerUrl&&(r=this.u.overrideServerUrl),e.src=r,e.classList.add("rml-container"),e.classList.add("rml-fill"),e}m(){l(this.S)}O(){this.S.classList.add("rml-pos"),document.documentElement.classList.add("rml-overflow-hidden"),window.document.body.classList.add("rml-overflow-hidden"),o()&&(l(this.S),this.S.classList.add("rml-android-height"))}P(){this.S.classList.remove("rml-pos"),this.S.classList.remove("rml-android-height"),document.documentElement.classList.remove("rml-overflow-hidden"),window.document.body.classList.remove("rml-overflow-hidden")}N({message:t,args:e},r){var s;if(!r.source)return;if(r.source!==(null===(s=this.S)||void 0===s?void 0:s.contentWindow))return;if("requestBoot"===t)return this._.setOutgoingMessageBus(r.source),Promise.resolve({result:this.u});if("setup"===t){const{methods:t,callbacks:r}=e[0];return t.forEach(t=>{const e=t.split("."),r=e[0],s=e[1];this[r]||(this[r]={}),this[r][s]=function(){return this._.sendMessage(t,[...arguments])}.bind(this)}),r.forEach(t=>{const e=t.split("."),r=e[0],s=e[1],i=e[2];this[r]||(this[r]={}),this[r][s]||(this[r][s]={}),this[r][s][i]=()=>{}}),n(this.ui.callbacks,"onUseFullPage",this.O),n(this.ui.callbacks,"onBackToWebsite",this.P),this.J(this),setTimeout(()=>this._.sendMessage("websiteReady"),0),Promise.resolve({result:null})}const i=t.split("."),o=i[0],a=i[1],l=3===i.length?i[2]:null;if(l&&this[o][a][l]){const t=this[o][a][l](...e);return t instanceof Promise?t.then(t=>({result:t})):void 0!==t?Promise.resolve({result:t}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}}export{u as default};
@@ -305,7 +305,7 @@ const getFallbackInitData = () => {
305
305
  if (hostname && isDemoHostname(hostname)) {
306
306
  fallbackInitData.configuratorId = 'demoConfigurator';
307
307
  }
308
- fallbackInitData.customApiUrl = 'https://alpha.roomle.com/api/v2';
308
+ fallbackInitData.customApiUrl = 'https://www.roomle.com/api/v2';
309
309
  fallbackInitData.emails = false;
310
310
  return fallbackInitData;
311
311
  };
@@ -1 +0,0 @@
1
- TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.
@@ -1,227 +0,0 @@
1
- [Embedding API Reference](../README.md) / [Modules](../modules.md) / [exposed-api](../modules/exposed_api.md) / ExposedApi
2
-
3
- # Class: ExposedApi
4
-
5
- [exposed-api](../modules/exposed_api.md).ExposedApi
6
-
7
- ## Table of contents
8
-
9
- ### Constructors
10
-
11
- - [constructor](exposed_api.ExposedApi.md#constructor)
12
-
13
- ### Accessors
14
-
15
- - [callbacks](exposed_api.ExposedApi.md#callbacks)
16
-
17
- ### Methods
18
-
19
- - [giveGaConsent](exposed_api.ExposedApi.md#givegaconsent)
20
- - [loadConfigurationString](exposed_api.ExposedApi.md#loadconfigurationstring)
21
- - [loadObject](exposed_api.ExposedApi.md#loadobject)
22
- - [pauseConfiguring](exposed_api.ExposedApi.md#pauseconfiguring)
23
- - [setPrice](exposed_api.ExposedApi.md#setprice)
24
- - [startConfiguring](exposed_api.ExposedApi.md#startconfiguring)
25
- - [triggerRequestPlan](exposed_api.ExposedApi.md#triggerrequestplan)
26
- - [triggerRequestProduct](exposed_api.ExposedApi.md#triggerrequestproduct)
27
-
28
- ## Constructors
29
-
30
- ### constructor
31
-
32
- • **new ExposedApi**(`sdkConnector`, `messageHandler`, `sdk`, `exposedCallbacks`, `store`, `analytics`, `globalCallback`)
33
-
34
- #### Parameters
35
-
36
- | Name | Type |
37
- | :------ | :------ |
38
- | `sdkConnector` | `SdkConnector` |
39
- | `messageHandler` | null \| `MessageHandler` |
40
- | `sdk` | `default` \| `default` \| `default` |
41
- | `exposedCallbacks` | [`ExposedCallbacks`](exposed_callbacks.ExposedCallbacks.md) |
42
- | `store` | `Store`<`StoreState`\> |
43
- | `analytics` | `Analytics` |
44
- | `globalCallback` | `GlobalCallback` |
45
-
46
- #### Defined in
47
-
48
- [src/configurator/embedding/exposed-api.ts:29](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/exposed-api.ts#L29)
49
-
50
- ## Accessors
51
-
52
- ### callbacks
53
-
54
- • `get` **callbacks**(): [`ExposedCallbacks`](exposed_callbacks.ExposedCallbacks.md)
55
-
56
- #### Returns
57
-
58
- [`ExposedCallbacks`](exposed_callbacks.ExposedCallbacks.md)
59
-
60
- #### Defined in
61
-
62
- [src/configurator/embedding/exposed-api.ts:117](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/exposed-api.ts#L117)
63
-
64
- ## Methods
65
-
66
- ### giveGaConsent
67
-
68
- ▸ **giveGaConsent**(): `void`
69
-
70
- call this method if consent of Google Analytics is given later and not already in init-data on boot
71
-
72
- #### Returns
73
-
74
- `void`
75
-
76
- #### Defined in
77
-
78
- [src/configurator/embedding/exposed-api.ts:205](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/exposed-api.ts#L205)
79
-
80
- ___
81
-
82
- ### loadConfigurationString
83
-
84
- ▸ **loadConfigurationString**(`configurationString`): `Promise`<`Nullable`<`LoadResponse`\>\>
85
-
86
- call this method to load the configuration string you want into the 3d Scene
87
-
88
- #### Parameters
89
-
90
- | Name | Type | Description |
91
- | :------ | :------ | :------ |
92
- | `configurationString` | `string` | string of the configuration, starts with `{` and ends with `}` |
93
-
94
- #### Returns
95
-
96
- `Promise`<`Nullable`<`LoadResponse`\>\>
97
-
98
- #### Defined in
99
-
100
- [src/configurator/embedding/exposed-api.ts:136](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/exposed-api.ts#L136)
101
-
102
- ___
103
-
104
- ### loadObject
105
-
106
- ▸ **loadObject**(`id`): `Promise`<`Nullable`<`LoadResponse`\>\>
107
-
108
- call this method to load the object you want into the 3d Scene
109
-
110
- #### Parameters
111
-
112
- | Name | Type | Description |
113
- | :------ | :------ | :------ |
114
- | `id` | `string` | database ID of the object you want to load |
115
-
116
- #### Returns
117
-
118
- `Promise`<`Nullable`<`LoadResponse`\>\>
119
-
120
- #### Defined in
121
-
122
- [src/configurator/embedding/exposed-api.ts:125](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/exposed-api.ts#L125)
123
-
124
- ___
125
-
126
- ### pauseConfiguring
127
-
128
- ▸ **pauseConfiguring**(): `void`
129
-
130
- This method can be used to pause configuration
131
- If the configurator was called in view-only mode
132
- this method triggers the onBackToWebsite callback.
133
- To know when the view-only mode is activated see the
134
- description of the startConfiguring method
135
-
136
- #### Returns
137
-
138
- `void`
139
-
140
- #### Defined in
141
-
142
- [src/configurator/embedding/exposed-api.ts:173](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/exposed-api.ts#L173)
143
-
144
- ___
145
-
146
- ### setPrice
147
-
148
- ▸ **setPrice**(`currencySymbol`, `price`): `void`
149
-
150
- set the price for the UI to show
151
- most likely needed when implementing your own price service
152
-
153
- #### Parameters
154
-
155
- | Name | Type |
156
- | :------ | :------ |
157
- | `currencySymbol` | `string` |
158
- | `price` | `number` |
159
-
160
- #### Returns
161
-
162
- `void`
163
-
164
- #### Defined in
165
-
166
- [src/configurator/embedding/exposed-api.ts:150](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/exposed-api.ts#L150)
167
-
168
- ___
169
-
170
- ### startConfiguring
171
-
172
- ▸ **startConfiguring**(): `void`
173
-
174
- This method can be used to start configuration when
175
- 3d scene is only initialized as viewer first, the
176
- configurator is automatically instantiated as viewer
177
- if the container where the configurator is placed is
178
- smaller than 1024px (this breakpoint could change in future)
179
- so do not rely on this exact pixel setting
180
-
181
- #### Returns
182
-
183
- `void`
184
-
185
- #### Defined in
186
-
187
- [src/configurator/embedding/exposed-api.ts:162](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/exposed-api.ts#L162)
188
-
189
- ___
190
-
191
- ### triggerRequestPlan
192
-
193
- ▸ **triggerRequestPlan**(): `Promise`<`void`\>
194
-
195
- call this method to trigger the onRequestPlan event from
196
- outside of the iframe. When this method is called the same
197
- process is kicked off as if the user would have clicked on
198
- request plan. Therefore you can just use the same callback
199
- to react on the response
200
-
201
- #### Returns
202
-
203
- `Promise`<`void`\>
204
-
205
- #### Defined in
206
-
207
- [src/configurator/embedding/exposed-api.ts:198](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/exposed-api.ts#L198)
208
-
209
- ___
210
-
211
- ### triggerRequestProduct
212
-
213
- ▸ **triggerRequestProduct**(): `Promise`<`void`\>
214
-
215
- call this method to trigger the onRequestProduct event from
216
- outside of the iframe. When this method is called the same
217
- process is kicked off as if the user would have clicked on
218
- request product. Therefore you can just use the same callback
219
- to react on the response
220
-
221
- #### Returns
222
-
223
- `Promise`<`void`\>
224
-
225
- #### Defined in
226
-
227
- [src/configurator/embedding/exposed-api.ts:187](https://gitlab.com/roomle/web/roomle-ui/-/blob/fb7c6a6b/src/configurator/embedding/exposed-api.ts#L187)