@roomle/embedding-lib 4.33.0 → 4.34.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 (41) hide show
  1. package/docs/api/classes/exposed_analytics_callbacks.ExposedAnalyticsCallbacks.md +1 -1
  2. package/docs/api/classes/exposed_api.ExposedApi.md +11 -11
  3. package/docs/api/classes/exposed_callbacks.ExposedCallbacks.md +7 -7
  4. package/docs/api/classes/roomle_configurator_api.default.md +9 -9
  5. package/docs/api/enums/types.UI_BUTTON.md +51 -18
  6. package/docs/api/interfaces/exposed_callbacks.Labels.md +2 -2
  7. package/docs/api/interfaces/exposed_callbacks.Price.md +2 -2
  8. package/docs/api/interfaces/roomle_configurator_api.RoomleEmbeddingApiKeys.md +4 -4
  9. package/docs/api/interfaces/types.ConfiguratorSettings.md +5 -5
  10. package/docs/api/interfaces/types.EmbeddingSkin.md +5 -5
  11. package/docs/api/interfaces/types.UiInitData.md +36 -71
  12. package/docs/api/modules/roomle_configurator_api.md +3 -3
  13. package/docs/md/web/ui/EMBEDDING-CHANGELOG.md +31 -24
  14. package/package.json +2 -2
  15. package/roomle-configurator-api.cjs.js +33 -76
  16. package/roomle-configurator-api.cjs.min.js +1 -1
  17. package/roomle-configurator-api.es.js +33 -76
  18. package/roomle-configurator-api.es.min.js +1 -1
  19. package/roomle-configurator-api.js +33 -76
  20. package/types/index.d.ts +305 -245
  21. package/types/src/common/store/index.d.ts +11 -4
  22. package/types/src/common/utils/helper.d.ts +0 -20
  23. package/types/src/common/utils/merge.d.ts +16 -0
  24. package/types/src/common/utils/share.d.ts +1 -0
  25. package/types/src/common/utils/variants.d.ts +3 -0
  26. package/types/src/configurator/components/collection-view/-utils/types.d.ts +3 -3
  27. package/types/src/configurator/components/grid-view/-utils/GridViewHelper.d.ts +3 -3
  28. package/types/src/configurator/embedding/roomle-configurator-api.d.ts +6 -6
  29. package/types/src/configurator/embedding/types.d.ts +6 -1
  30. package/types/src/configurator/store/ui-state.d.ts +14 -6
  31. package/types/src/planner/business-logic/pre-defined-rooms.d.ts +2 -0
  32. package/types/src/planner/business-logic/rooms.d.ts +12 -0
  33. package/types/src/planner/store/planner-core-data.d.ts +21 -0
  34. package/types/src/planner/store/planner-ui-state.d.ts +11 -4
  35. package/types/src/planner/utils/product-list.d.ts +10 -0
  36. package/types/tests/integration/common/components/IconButton.spec.d.ts +1 -0
  37. package/types/tests/integration/common/components/ProductButtons.spec.d.ts +1 -0
  38. package/types/tests/integration/planner/components/CatalogTrigger.spec.d.ts +1 -0
  39. package/types/tests/integration/planner/components/ProductListButton.spec.d.ts +1 -0
  40. package/types/tests/integration/planner/components/SampleRooms.spec.d.ts +1 -0
  41. package/types/tests/integration/planner/components/overlays/product-list/ProductListEntry.spec.d.ts +1 -0
@@ -1 +1 @@
1
- "use strict";require("@/common/styles/Global.module.scss");class t{constructor(t,e,r,i){this.t=null,this.i=null,this.o=t,this.s=e,this.t=r,this.i=i,this.s.addEventListener("message",this.l.bind(this))}setOutgoingMessageBus(t){this.t=t}setMessageExecution(t){this.i=t}sendMessage(t,e=[]){return new Promise((r,i)=>{const o=new MessageChannel;o.port1.onmessage=t=>{if(!t||!t.data)return o.port1.close(),o.port2.close(),i(new Error(this.o+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return o.port1.close(),o.port2.close(),this.h(t),i(t)}e.error?i(e.error):void 0!==e.result?r(e.result):r(),o.port1.close(),o.port2.close()};let s="";try{s=JSON.stringify({message:t,args:e})}catch(t){return i(new Error(this.o+": can not create command because it is not JSON.stringify able"))}if(!this.t)return i(new Error(this.o+": outgoing bus not set yet"));this.t.postMessage(s,"*",[o.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.i)return e.postMessage(JSON.stringify({error:this.o+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const i=this.i(r,t);if(void 0===i)return;i.then((t={})=>{let r=void 0,i=void 0;"object"==typeof t&&null!==t&&(r=t.error,i=t.result),r?e.postMessage(JSON.stringify({error:r})):void 0!==i?e.postMessage(JSON.stringify({result:i})):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.o+": "+t;return console.error(e),e}return t.message=this.o+": "+t.message,console.error(t),t.message}}const e=()=>/(android)/i.test(navigator.userAgent);var r,i,o,s,n;!function(t){t.DIMENSION="dimension",t.METRIC="metric"}(r||(r={})),function(t){t.EVENT="event"}(i||(i={})),function(t){t.EXCEPTION="exception",t.TIMING="timing_complete"}(o||(o={})),function(t){t.TRACK_TIMING="track_timing"}(s||(s={})),function(t){t.ERROR="Error",t.NAVIGATION_TIMING="Navigation Timing",t.TIMING="Timing",t.INTERACTION="Interaction",t.TRACKING="Tracking",t.DEPRECATION="Deprecation"}(n||(n={}));const a=(t,e)=>{for(const r in e)try{e[r].constructor===Object?t[r]=a(t[r],e[r]):t[r]=e[r]}catch(i){t[r]=e[r]}return t},l=["127.0.0.1","localhost","0.0.0.0"],c=["language","browserLanguage","userLanguage","systemLanguage"],h=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 h(e);if(Array.isArray(e)){for(const t of e)h(t);return}"true"!==e&&"false"!==e||(t[r]="true"===e)}},u=(t,e,r)=>{let i=null;Object.defineProperty(t,e,{get:()=>i||r,set(t){(null==t?void 0:t.mute)?i=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 }"),i=t)}})},d=()=>.01*window.innerHeight+"px",m=t=>{t&&setTimeout(()=>t.style.setProperty(f,d()),0)},f="--rml-full-height",w=new Map;module.exports=class{constructor(r,i,o,s){if(this.ui={callbacks:null},this.extended={callbacks:null},this.analytics={callbacks:{}},this.global={callbacks:{}},this.u={},!r||"string"!=typeof r.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(w.has(i))throw new Error("There is already an instance on this DOM element");if(!document.getElementById("rml-styles")){const t=o.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,s=d();e.innerHTML=`\n .rml-container{${f}:${s};}\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(${f},1vh)*100)}\n .rml-overflow-hidden{overflow:hidden}\n `,document.head.appendChild(e)}this.m=this.m.bind(this),e()&&window.addEventListener("resize",this.m),this.g=i,this.u=o,this.p=r;const n=this.v();this.O=this.O.bind(this),this.N=this.N.bind(this),this._=this._.bind(this),this.P=new t("website",window,null,this.N),this.k=s,this.g.appendChild(n),this.J=n,w.set(i,!0)}static createPlanner(t,e,r){return this.S(t,e,r)}static createConfigurator(t,e,r){return this.S(t,e,r)}static create(t,e,r){return this.S(t,e,r)}static createViewer(t,e,r){return this.S(t,e,r)}static S(t,e,r){return new Promise(async(i,o)=>{try{const o=a((()=>{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=c.length;t<r;t++){const r=e[c[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=>!!l.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=>(h(t),(null==t?void 0:t.customApiUrl)&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(r));o.featureFlags||(o.featureFlags={}),"boolean"!=typeof o.featureFlags.realPartList&&(o.featureFlags.realPartList=!0),"boolean"!=typeof o.featureFlags.globalCallbacks&&(o.featureFlags.globalCallbacks=!0);const s=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",i=e.overrideTenant||9,o=r+"/configurators/"+t,s="03-"+window.btoa((new Date).toISOString()+";anonymous;roomle_portal_v2"),n=new Request(o,{method:"GET",headers:new Headers({apiKey:"roomle_portal_v2",currentTenant:i,locale:"en",language:"en",device:1,token:s,platform:"web"}),mode:"cors",cache:"default"}),a=await fetch(n),{configurator:l}=await a.json();return l})(t,o);return r=((t,e)=>{e.configuratorId=t.id;const r=t.settings||{};return!e.overrideTenant&&t.tenant&&(e.overrideTenant=t.tenant),((t,e)=>{const r=JSON.parse(JSON.stringify(t));return a(r,e)})(r,e)})(s,o),new this(s,e,r,i)}catch(t){return o(t)}})}teardown(){this.g&&w.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(){m(this.J)}O(){this.J.classList.add("rml-pos"),document.documentElement.classList.add("rml-overflow-hidden"),window.document.body.classList.add("rml-overflow-hidden"),e()&&(m(this.J),this.J.classList.add("rml-android-height"))}_(){this.J.classList.remove("rml-pos"),this.J.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 i;if(!r.source)return;if(r.source!==(null===(i=this.J)||void 0===i?void 0:i.contentWindow))return;if("requestBoot"===t)return this.P.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],i=e[1];this[r]||(this[r]={}),this[r][i]=function(){return this.P.sendMessage(t,[...arguments])}.bind(this)}),r.forEach(t=>{const e=t.split("."),r=e[0],i=e[1],o=e[2];this[r]||(this[r]={}),this[r][i]||(this[r][i]={}),this[r][i][o]=()=>{}}),u(this.ui.callbacks,"onUseFullPage",this.O),u(this.ui.callbacks,"onBackToWebsite",this._),this.k(this),setTimeout(()=>this.P.sendMessage("websiteReady"),0),Promise.resolve({result:null})}const o=t.split("."),s=o[0],n=o[1],a=3===o.length?o[2]:null;if(a&&this[s][n][a]){const t=this[s][n][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=["127.0.0.1","localhost","0.0.0.0"],r=(t,e)=>{for(const s in e)try{e[s].constructor===Object?t[s]=r(t[s],e[s]):t[s]=e[s]}catch(r){t[s]=e[s]}return t},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=r((()=>{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 r=(()=>{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 r&&(t=>!!e.includes(t)||!!t.endsWith("roomle.com")||!(!t.endsWith("gitlab.io")&&!t.endsWith("gitlab.com")))(r)&&(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,e)=>{e.configuratorId=t.id;const s=t.settings||{};return!e.overrideTenant&&t.tenant&&(e.overrideTenant=t.tenant),((t,e)=>{const s=JSON.parse(JSON.stringify(t));return r(s,e)})(s,e)})(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,5 +1,3 @@
1
- import '@/common/styles/Global.module.scss';
2
-
3
1
  class MessageHandler {
4
2
  constructor(side, incomingMessageBus, outgoingMessageBus, messageExecution) {
5
3
  this._outgoingMessageBus = null;
@@ -162,50 +160,36 @@ const isInIframe = () => {
162
160
  }
163
161
  };
164
162
 
165
- // see why: so#/58065241/10800831
166
- const isAndroid = () => /(android)/i.test(navigator.userAgent);
167
-
168
- /* TO DOs in Google Analytics Admin UI
169
-
170
- To track the Hit ID, Hit Time, and Hit Type and custom dimensions, first create them in Google Analytics
171
- and set their scope to "Hit"
172
-
173
- Once you've created the custom metrics in Google Analytics
174
- (and set their scope to "Hit" and their formatting type to "Integer")
175
- this setup is ready to go. You need to do this in every GA property
176
-
177
- For more details see: https://philipwalton.com/articles/the-google-analytics-setup-i-use-on-every-site-i-build/
178
-
179
- */
180
- // Probably we could add const enums here
181
- // but we need to investigate: https://roomle.atlassian.net/browse/CONF-238
182
- var GA_CUSTOM;
183
- (function (GA_CUSTOM) {
184
- GA_CUSTOM["DIMENSION"] = "dimension";
185
- GA_CUSTOM["METRIC"] = "metric";
186
- })(GA_CUSTOM || (GA_CUSTOM = {}));
187
- var GA_HIT_TYPE;
188
- (function (GA_HIT_TYPE) {
189
- GA_HIT_TYPE["EVENT"] = "event";
190
- })(GA_HIT_TYPE || (GA_HIT_TYPE = {}));
191
- var GA_ACTION_TYPE;
192
- (function (GA_ACTION_TYPE) {
193
- GA_ACTION_TYPE["EXCEPTION"] = "exception";
194
- GA_ACTION_TYPE["TIMING"] = "timing_complete";
195
- })(GA_ACTION_TYPE || (GA_ACTION_TYPE = {}));
196
- var CUSTOM_ACTION_TYPE;
197
- (function (CUSTOM_ACTION_TYPE) {
198
- CUSTOM_ACTION_TYPE["TRACK_TIMING"] = "track_timing";
199
- })(CUSTOM_ACTION_TYPE || (CUSTOM_ACTION_TYPE = {}));
200
- var GA_CATEGORY;
201
- (function (GA_CATEGORY) {
202
- GA_CATEGORY["ERROR"] = "Error";
203
- GA_CATEGORY["NAVIGATION_TIMING"] = "Navigation Timing";
204
- GA_CATEGORY["TIMING"] = "Timing";
205
- GA_CATEGORY["INTERACTION"] = "Interaction";
206
- GA_CATEGORY["TRACKING"] = "Tracking";
207
- GA_CATEGORY["DEPRECATION"] = "Deprecation";
208
- })(GA_CATEGORY || (GA_CATEGORY = {}));
163
+ const NAMES_FOR_LOCALHOST = [
164
+ '127.0.0.1',
165
+ 'localhost',
166
+ '0.0.0.0',
167
+ ];
168
+ const getHostname = () => {
169
+ const isIframe = isInIframe();
170
+ let url = window.location.href;
171
+ if (isIframe) {
172
+ if (!document.referrer) {
173
+ return null;
174
+ }
175
+ url = document.referrer;
176
+ }
177
+ const { hostname } = new URL(url);
178
+ return hostname;
179
+ };
180
+ const isDemoHostname = (hostname) => {
181
+ if (NAMES_FOR_LOCALHOST.includes(hostname)) {
182
+ return true;
183
+ }
184
+ if (hostname.endsWith('roomle.com')) {
185
+ return true;
186
+ }
187
+ // exception for CI builds
188
+ if (hostname.endsWith('gitlab.io') || hostname.endsWith('gitlab.com')) {
189
+ return true;
190
+ }
191
+ return false;
192
+ };
209
193
 
210
194
  /**
211
195
  * Recursively merge properties of two objects.
@@ -243,36 +227,6 @@ const deepMerge = (obj1, obj2) => {
243
227
  }
244
228
  }
245
229
  return obj1;
246
- };
247
- const NAMES_FOR_LOCALHOST = [
248
- '127.0.0.1',
249
- 'localhost',
250
- '0.0.0.0',
251
- ];
252
- const getHostname = () => {
253
- const isIframe = isInIframe();
254
- let url = window.location.href;
255
- if (isIframe) {
256
- if (!document.referrer) {
257
- return null;
258
- }
259
- url = document.referrer;
260
- }
261
- const { hostname } = new URL(url);
262
- return hostname;
263
- };
264
- const isDemoHostname = (hostname) => {
265
- if (NAMES_FOR_LOCALHOST.includes(hostname)) {
266
- return true;
267
- }
268
- if (hostname.endsWith('roomle.com')) {
269
- return true;
270
- }
271
- // exception for CI builds
272
- if (hostname.endsWith('gitlab.io') || hostname.endsWith('gitlab.com')) {
273
- return true;
274
- }
275
- return false;
276
230
  };
277
231
 
278
232
  const BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN = ['language', 'browserLanguage', 'userLanguage', 'systemLanguage'];
@@ -359,6 +313,9 @@ const getFallbackInitData = () => {
359
313
  const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';
360
314
  const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';
361
315
 
316
+ // see why: so#/58065241/10800831
317
+ const isAndroid = () => /(android)/i.test(navigator.userAgent);
318
+
362
319
  const setDefaultBehaviour = (object, callbackName, defaultBehaviour) => {
363
320
  let customBehaviour = null;
364
321
  Object.defineProperty(object, callbackName, {
@@ -1 +1 @@
1
- import"@/common/styles/Global.module.scss";class t{constructor(t,e,r,i){this.t=null,this.i=null,this.o=t,this.s=e,this.t=r,this.i=i,this.s.addEventListener("message",this.l.bind(this))}setOutgoingMessageBus(t){this.t=t}setMessageExecution(t){this.i=t}sendMessage(t,e=[]){return new Promise((r,i)=>{const o=new MessageChannel;o.port1.onmessage=t=>{if(!t||!t.data)return o.port1.close(),o.port2.close(),i(new Error(this.o+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return o.port1.close(),o.port2.close(),this.h(t),i(t)}e.error?i(e.error):void 0!==e.result?r(e.result):r(),o.port1.close(),o.port2.close()};let s="";try{s=JSON.stringify({message:t,args:e})}catch(t){return i(new Error(this.o+": can not create command because it is not JSON.stringify able"))}if(!this.t)return i(new Error(this.o+": outgoing bus not set yet"));this.t.postMessage(s,"*",[o.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.i)return e.postMessage(JSON.stringify({error:this.o+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const i=this.i(r,t);if(void 0===i)return;i.then((t={})=>{let r=void 0,i=void 0;"object"==typeof t&&null!==t&&(r=t.error,i=t.result),r?e.postMessage(JSON.stringify({error:r})):void 0!==i?e.postMessage(JSON.stringify({result:i})):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.o+": "+t;return console.error(e),e}return t.message=this.o+": "+t.message,console.error(t),t.message}}const e=()=>/(android)/i.test(navigator.userAgent);var r,i,o,s,n;!function(t){t.DIMENSION="dimension",t.METRIC="metric"}(r||(r={})),function(t){t.EVENT="event"}(i||(i={})),function(t){t.EXCEPTION="exception",t.TIMING="timing_complete"}(o||(o={})),function(t){t.TRACK_TIMING="track_timing"}(s||(s={})),function(t){t.ERROR="Error",t.NAVIGATION_TIMING="Navigation Timing",t.TIMING="Timing",t.INTERACTION="Interaction",t.TRACKING="Tracking",t.DEPRECATION="Deprecation"}(n||(n={}));const a=(t,e)=>{for(const r in e)try{e[r].constructor===Object?t[r]=a(t[r],e[r]):t[r]=e[r]}catch(i){t[r]=e[r]}return t},l=["127.0.0.1","localhost","0.0.0.0"],c=["language","browserLanguage","userLanguage","systemLanguage"],h=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 h(e);if(Array.isArray(e)){for(const t of e)h(t);return}"true"!==e&&"false"!==e||(t[r]="true"===e)}},u=(t,e,r)=>{let i=null;Object.defineProperty(t,e,{get:()=>i||r,set(t){(null==t?void 0:t.mute)?i=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 }"),i=t)}})},d=()=>.01*window.innerHeight+"px",m=t=>{t&&setTimeout(()=>t.style.setProperty(f,d()),0)},f="--rml-full-height",w=new Map;class g{constructor(r,i,o,s){if(this.ui={callbacks:null},this.extended={callbacks:null},this.analytics={callbacks:{}},this.global={callbacks:{}},this.u={},!r||"string"!=typeof r.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(w.has(i))throw new Error("There is already an instance on this DOM element");if(!document.getElementById("rml-styles")){const t=o.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,s=d();e.innerHTML=`\n .rml-container{${f}:${s};}\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(${f},1vh)*100)}\n .rml-overflow-hidden{overflow:hidden}\n `,document.head.appendChild(e)}this.m=this.m.bind(this),e()&&window.addEventListener("resize",this.m),this.g=i,this.u=o,this.p=r;const n=this.v();this.O=this.O.bind(this),this.N=this.N.bind(this),this._=this._.bind(this),this.P=new t("website",window,null,this.N),this.k=s,this.g.appendChild(n),this.J=n,w.set(i,!0)}static createPlanner(t,e,r){return this.S(t,e,r)}static createConfigurator(t,e,r){return this.S(t,e,r)}static create(t,e,r){return this.S(t,e,r)}static createViewer(t,e,r){return this.S(t,e,r)}static S(t,e,r){return new Promise(async(i,o)=>{try{const o=a((()=>{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=c.length;t<r;t++){const r=e[c[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=>!!l.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=>(h(t),(null==t?void 0:t.customApiUrl)&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(r));o.featureFlags||(o.featureFlags={}),"boolean"!=typeof o.featureFlags.realPartList&&(o.featureFlags.realPartList=!0),"boolean"!=typeof o.featureFlags.globalCallbacks&&(o.featureFlags.globalCallbacks=!0);const s=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",i=e.overrideTenant||9,o=r+"/configurators/"+t,s="03-"+window.btoa((new Date).toISOString()+";anonymous;roomle_portal_v2"),n=new Request(o,{method:"GET",headers:new Headers({apiKey:"roomle_portal_v2",currentTenant:i,locale:"en",language:"en",device:1,token:s,platform:"web"}),mode:"cors",cache:"default"}),a=await fetch(n),{configurator:l}=await a.json();return l})(t,o);return r=((t,e)=>{e.configuratorId=t.id;const r=t.settings||{};return!e.overrideTenant&&t.tenant&&(e.overrideTenant=t.tenant),((t,e)=>{const r=JSON.parse(JSON.stringify(t));return a(r,e)})(r,e)})(s,o),new this(s,e,r,i)}catch(t){return o(t)}})}teardown(){this.g&&w.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(){m(this.J)}O(){this.J.classList.add("rml-pos"),document.documentElement.classList.add("rml-overflow-hidden"),window.document.body.classList.add("rml-overflow-hidden"),e()&&(m(this.J),this.J.classList.add("rml-android-height"))}_(){this.J.classList.remove("rml-pos"),this.J.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 i;if(!r.source)return;if(r.source!==(null===(i=this.J)||void 0===i?void 0:i.contentWindow))return;if("requestBoot"===t)return this.P.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],i=e[1];this[r]||(this[r]={}),this[r][i]=function(){return this.P.sendMessage(t,[...arguments])}.bind(this)}),r.forEach(t=>{const e=t.split("."),r=e[0],i=e[1],o=e[2];this[r]||(this[r]={}),this[r][i]||(this[r][i]={}),this[r][i][o]=()=>{}}),u(this.ui.callbacks,"onUseFullPage",this.O),u(this.ui.callbacks,"onBackToWebsite",this._),this.k(this),setTimeout(()=>this.P.sendMessage("websiteReady"),0),Promise.resolve({result:null})}const o=t.split("."),s=o[0],n=o[1],a=3===o.length?o[2]:null;if(a&&this[s][n][a]){const t=this[s][n][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')}}export{g 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=["127.0.0.1","localhost","0.0.0.0"],r=(t,e)=>{for(const s in e)try{e[s].constructor===Object?t[s]=r(t[s],e[s]):t[s]=e[s]}catch(r){t[s]=e[s]}return t},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=r((()=>{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 r=(()=>{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 r&&(t=>!!e.includes(t)||!!t.endsWith("roomle.com")||!(!t.endsWith("gitlab.io")&&!t.endsWith("gitlab.com")))(r)&&(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,e)=>{e.configuratorId=t.id;const s=t.settings||{};return!e.overrideTenant&&t.tenant&&(e.overrideTenant=t.tenant),((t,e)=>{const s=JSON.parse(JSON.stringify(t));return r(s,e)})(s,e)})(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,5 +1,3 @@
1
- import '@/common/styles/Global.module.scss';
2
-
3
1
  class MessageHandler {
4
2
  constructor(side, incomingMessageBus, outgoingMessageBus, messageExecution) {
5
3
  this._outgoingMessageBus = null;
@@ -162,50 +160,36 @@ const isInIframe = () => {
162
160
  }
163
161
  };
164
162
 
165
- // see why: so#/58065241/10800831
166
- const isAndroid = () => /(android)/i.test(navigator.userAgent);
167
-
168
- /* TO DOs in Google Analytics Admin UI
169
-
170
- To track the Hit ID, Hit Time, and Hit Type and custom dimensions, first create them in Google Analytics
171
- and set their scope to "Hit"
172
-
173
- Once you've created the custom metrics in Google Analytics
174
- (and set their scope to "Hit" and their formatting type to "Integer")
175
- this setup is ready to go. You need to do this in every GA property
176
-
177
- For more details see: https://philipwalton.com/articles/the-google-analytics-setup-i-use-on-every-site-i-build/
178
-
179
- */
180
- // Probably we could add const enums here
181
- // but we need to investigate: https://roomle.atlassian.net/browse/CONF-238
182
- var GA_CUSTOM;
183
- (function (GA_CUSTOM) {
184
- GA_CUSTOM["DIMENSION"] = "dimension";
185
- GA_CUSTOM["METRIC"] = "metric";
186
- })(GA_CUSTOM || (GA_CUSTOM = {}));
187
- var GA_HIT_TYPE;
188
- (function (GA_HIT_TYPE) {
189
- GA_HIT_TYPE["EVENT"] = "event";
190
- })(GA_HIT_TYPE || (GA_HIT_TYPE = {}));
191
- var GA_ACTION_TYPE;
192
- (function (GA_ACTION_TYPE) {
193
- GA_ACTION_TYPE["EXCEPTION"] = "exception";
194
- GA_ACTION_TYPE["TIMING"] = "timing_complete";
195
- })(GA_ACTION_TYPE || (GA_ACTION_TYPE = {}));
196
- var CUSTOM_ACTION_TYPE;
197
- (function (CUSTOM_ACTION_TYPE) {
198
- CUSTOM_ACTION_TYPE["TRACK_TIMING"] = "track_timing";
199
- })(CUSTOM_ACTION_TYPE || (CUSTOM_ACTION_TYPE = {}));
200
- var GA_CATEGORY;
201
- (function (GA_CATEGORY) {
202
- GA_CATEGORY["ERROR"] = "Error";
203
- GA_CATEGORY["NAVIGATION_TIMING"] = "Navigation Timing";
204
- GA_CATEGORY["TIMING"] = "Timing";
205
- GA_CATEGORY["INTERACTION"] = "Interaction";
206
- GA_CATEGORY["TRACKING"] = "Tracking";
207
- GA_CATEGORY["DEPRECATION"] = "Deprecation";
208
- })(GA_CATEGORY || (GA_CATEGORY = {}));
163
+ const NAMES_FOR_LOCALHOST = [
164
+ '127.0.0.1',
165
+ 'localhost',
166
+ '0.0.0.0',
167
+ ];
168
+ const getHostname = () => {
169
+ const isIframe = isInIframe();
170
+ let url = window.location.href;
171
+ if (isIframe) {
172
+ if (!document.referrer) {
173
+ return null;
174
+ }
175
+ url = document.referrer;
176
+ }
177
+ const { hostname } = new URL(url);
178
+ return hostname;
179
+ };
180
+ const isDemoHostname = (hostname) => {
181
+ if (NAMES_FOR_LOCALHOST.includes(hostname)) {
182
+ return true;
183
+ }
184
+ if (hostname.endsWith('roomle.com')) {
185
+ return true;
186
+ }
187
+ // exception for CI builds
188
+ if (hostname.endsWith('gitlab.io') || hostname.endsWith('gitlab.com')) {
189
+ return true;
190
+ }
191
+ return false;
192
+ };
209
193
 
210
194
  /**
211
195
  * Recursively merge properties of two objects.
@@ -243,36 +227,6 @@ const deepMerge = (obj1, obj2) => {
243
227
  }
244
228
  }
245
229
  return obj1;
246
- };
247
- const NAMES_FOR_LOCALHOST = [
248
- '127.0.0.1',
249
- 'localhost',
250
- '0.0.0.0',
251
- ];
252
- const getHostname = () => {
253
- const isIframe = isInIframe();
254
- let url = window.location.href;
255
- if (isIframe) {
256
- if (!document.referrer) {
257
- return null;
258
- }
259
- url = document.referrer;
260
- }
261
- const { hostname } = new URL(url);
262
- return hostname;
263
- };
264
- const isDemoHostname = (hostname) => {
265
- if (NAMES_FOR_LOCALHOST.includes(hostname)) {
266
- return true;
267
- }
268
- if (hostname.endsWith('roomle.com')) {
269
- return true;
270
- }
271
- // exception for CI builds
272
- if (hostname.endsWith('gitlab.io') || hostname.endsWith('gitlab.com')) {
273
- return true;
274
- }
275
- return false;
276
230
  };
277
231
 
278
232
  const BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN = ['language', 'browserLanguage', 'userLanguage', 'systemLanguage'];
@@ -359,6 +313,9 @@ const getFallbackInitData = () => {
359
313
  const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';
360
314
  const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';
361
315
 
316
+ // see why: so#/58065241/10800831
317
+ const isAndroid = () => /(android)/i.test(navigator.userAgent);
318
+
362
319
  const setDefaultBehaviour = (object, callbackName, defaultBehaviour) => {
363
320
  let customBehaviour = null;
364
321
  Object.defineProperty(object, callbackName, {