@roomle/embedding-lib 4.24.1-alpha.2 → 4.25.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/api/README.md +1 -1
- package/docs/api/classes/exposed_analytics_callbacks.ExposedAnalyticsCallbacks.md +1 -1
- package/docs/api/classes/exposed_api.ExposedApi.md +38 -10
- package/docs/api/classes/exposed_callbacks.ExposedCallbacks.md +7 -7
- package/docs/api/classes/roomle_configurator_api.default.md +9 -9
- package/docs/api/enums/types.UI_BUTTON.md +48 -15
- package/docs/api/interfaces/exposed_callbacks.Labels.md +2 -2
- package/docs/api/interfaces/exposed_callbacks.Price.md +2 -2
- package/docs/api/interfaces/roomle_configurator_api.RoomleEmbeddingApiKeys.md +4 -4
- package/docs/api/interfaces/types.ConfiguratorSettings.md +5 -5
- package/docs/api/interfaces/types.EmbeddingSkin.md +5 -5
- package/docs/api/interfaces/types.UiInitData.md +58 -37
- package/docs/api/modules/roomle_configurator_api.md +3 -3
- package/docs/index.md +31 -0
- package/docs/md/web/ui/EMBEDDING-CHANGELOG.md +65 -9
- package/package.json +28 -1
- package/roomle-configurator-api.cjs.js +48 -4
- package/roomle-configurator-api.cjs.min.js +1 -1
- package/roomle-configurator-api.es.js +48 -4
- package/roomle-configurator-api.es.min.js +1 -1
- package/roomle-configurator-api.js +48 -4
- package/types/index.d.ts +190 -129
- package/types/src/common/store/collection-view-state.d.ts +2 -2
- package/types/src/common/store/index.d.ts +6 -0
- package/types/src/common/utils/helper.d.ts +3 -0
- package/types/src/common/utils/types.d.ts +3 -2
- package/types/src/configurator/business-logic/sdk-connector.d.ts +1 -0
- package/types/src/configurator/components/-utils/overlays.d.ts +8 -8
- package/types/src/configurator/components/grid-view/-utils/GridViewHelper.d.ts +3 -0
- package/types/src/configurator/embedding/exposed-api.d.ts +10 -0
- package/types/src/configurator/embedding/types.d.ts +7 -1
- package/types/src/configurator/store/ui-state.d.ts +19 -3
- package/types/tests/helpers/data/variants.d.ts +60 -0
- package/types/tests/helpers/mocks/sdk-connector-planner.d.ts +13 -0
- package/types/tests/helpers/mocks/sdk-connector.d.ts +5 -0
- package/types/tests/integration/configurator/components/{overlays/PartList.spec.d.ts → parameters/types/ProductVariant.spec.d.ts} +0 -0
- package/types/tests/integration/planner/components/BottomBar.spec.d.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";class t{constructor(t,e,r,
|
|
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,3 +1,5 @@
|
|
|
1
|
+
import '@/common/styles/Global.module.scss';
|
|
2
|
+
|
|
1
3
|
class MessageHandler {
|
|
2
4
|
constructor(side, incomingMessageBus, outgoingMessageBus, messageExecution) {
|
|
3
5
|
this._outgoingMessageBus = null;
|
|
@@ -160,6 +162,51 @@ const isInIframe = () => {
|
|
|
160
162
|
}
|
|
161
163
|
};
|
|
162
164
|
|
|
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 = {}));
|
|
209
|
+
|
|
163
210
|
/**
|
|
164
211
|
* Recursively merge properties of two objects.
|
|
165
212
|
* If a property exists in both it, property of obj2 is used.
|
|
@@ -305,16 +352,13 @@ const getFallbackInitData = () => {
|
|
|
305
352
|
if (hostname && isDemoHostname(hostname)) {
|
|
306
353
|
fallbackInitData.configuratorId = 'demoConfigurator';
|
|
307
354
|
}
|
|
308
|
-
fallbackInitData.customApiUrl = 'https://
|
|
355
|
+
fallbackInitData.customApiUrl = 'https://www.roomle.com/api/v2';
|
|
309
356
|
fallbackInitData.emails = false;
|
|
310
357
|
return fallbackInitData;
|
|
311
358
|
};
|
|
312
359
|
const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';
|
|
313
360
|
const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';
|
|
314
361
|
|
|
315
|
-
// see why: so#/58065241/10800831
|
|
316
|
-
const isAndroid = () => /(android)/i.test(navigator.userAgent);
|
|
317
|
-
|
|
318
362
|
const setDefaultBehaviour = (object, callbackName, defaultBehaviour) => {
|
|
319
363
|
let customBehaviour = null;
|
|
320
364
|
Object.defineProperty(object, callbackName, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class t{constructor(t,e,r,
|
|
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,3 +1,5 @@
|
|
|
1
|
+
import '@/common/styles/Global.module.scss';
|
|
2
|
+
|
|
1
3
|
class MessageHandler {
|
|
2
4
|
constructor(side, incomingMessageBus, outgoingMessageBus, messageExecution) {
|
|
3
5
|
this._outgoingMessageBus = null;
|
|
@@ -160,6 +162,51 @@ const isInIframe = () => {
|
|
|
160
162
|
}
|
|
161
163
|
};
|
|
162
164
|
|
|
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 = {}));
|
|
209
|
+
|
|
163
210
|
/**
|
|
164
211
|
* Recursively merge properties of two objects.
|
|
165
212
|
* If a property exists in both it, property of obj2 is used.
|
|
@@ -305,16 +352,13 @@ const getFallbackInitData = () => {
|
|
|
305
352
|
if (hostname && isDemoHostname(hostname)) {
|
|
306
353
|
fallbackInitData.configuratorId = 'demoConfigurator';
|
|
307
354
|
}
|
|
308
|
-
fallbackInitData.customApiUrl = 'https://
|
|
355
|
+
fallbackInitData.customApiUrl = 'https://www.roomle.com/api/v2';
|
|
309
356
|
fallbackInitData.emails = false;
|
|
310
357
|
return fallbackInitData;
|
|
311
358
|
};
|
|
312
359
|
const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';
|
|
313
360
|
const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';
|
|
314
361
|
|
|
315
|
-
// see why: so#/58065241/10800831
|
|
316
|
-
const isAndroid = () => /(android)/i.test(navigator.userAgent);
|
|
317
|
-
|
|
318
362
|
const setDefaultBehaviour = (object, callbackName, defaultBehaviour) => {
|
|
319
363
|
let customBehaviour = null;
|
|
320
364
|
Object.defineProperty(object, callbackName, {
|