@roomle/embedding-lib 4.33.0 → 4.36.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.
- package/docs/api/classes/exposed_analytics_callbacks.ExposedAnalyticsCallbacks.md +1 -1
- package/docs/api/classes/exposed_api.ExposedApi.md +11 -11
- 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 +62 -18
- 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 +37 -71
- package/docs/api/modules/roomle_configurator_api.md +3 -3
- package/docs/md/web/ui/EMBEDDING-CHANGELOG.md +12 -24
- package/package.json +2 -2
- package/roomle-configurator-api.cjs.js +33 -76
- package/roomle-configurator-api.cjs.min.js +1 -1
- package/roomle-configurator-api.es.js +33 -76
- package/roomle-configurator-api.es.min.js +1 -1
- package/roomle-configurator-api.js +33 -76
- package/types/index.d.ts +368 -280
- package/types/src/common/business-logic/event-bus.d.ts +5 -0
- package/types/src/{configurator → common}/components/collection-view/-utils/types.d.ts +3 -3
- package/types/src/common/store/collection-view-state.d.ts +3 -2
- package/types/src/common/store/index.d.ts +16 -5
- package/types/src/common/utils/helper.d.ts +0 -20
- package/types/src/common/utils/merge.d.ts +16 -0
- package/types/src/common/utils/parameters.d.ts +2 -2
- package/types/src/common/utils/share.d.ts +1 -0
- package/types/src/common/utils/touch-drag.d.ts +8 -9
- package/types/src/common/utils/types.d.ts +2 -0
- package/types/src/common/utils/variants.d.ts +3 -0
- package/types/src/configurator/components/grid-view/-utils/GridViewHelper.d.ts +3 -3
- package/types/src/configurator/embedding/roomle-configurator-api.d.ts +6 -6
- package/types/src/configurator/embedding/types.d.ts +8 -1
- package/types/src/configurator/store/ui-state.d.ts +14 -6
- package/types/src/planner/business-logic/pre-defined-rooms.d.ts +2 -0
- package/types/src/planner/business-logic/rooms.d.ts +12 -0
- package/types/src/planner/store/planner-core-data.d.ts +21 -0
- package/types/src/planner/store/planner-ui-state.d.ts +22 -7
- package/types/src/planner/utils/planner-sidebar.d.ts +21 -0
- package/types/tests/helpers/data/items.d.ts +90 -0
- package/types/tests/helpers/data/plan.d.ts +224 -0
- package/types/tests/helpers/mocks/store.d.ts +2 -1
- package/types/tests/integration/{configurator/components/overlays/part-list/PartListPrint.spec.d.ts → common/components/BottomButtons.spec.d.ts} +0 -0
- package/types/tests/integration/{configurator/components/overlays/part-list/PartListRow.spec.d.ts → common/components/IconButton.spec.d.ts} +0 -0
- package/types/tests/integration/common/components/part-list/part-list/PartListPrint.spec.d.ts +1 -0
- package/types/tests/integration/common/components/part-list/part-list/PartListRow.spec.d.ts +1 -0
- package/types/tests/integration/configurator/components/overlays/PartList.spec.d.ts +1 -0
- package/types/tests/integration/planner/components/CatalogTrigger.spec.d.ts +1 -0
- package/types/tests/integration/planner/components/ProductListButton.spec.d.ts +1 -0
- package/types/tests/integration/planner/components/SampleRooms.spec.d.ts +1 -0
- package/types/tests/integration/planner/components/SelectionPreview.spec.d.ts +1 -0
- package/types/tests/integration/planner/components/overlays/product-list/ProductListEntry.spec.d.ts +1 -0
- package/types/tests/unit/common/business-logic/event-bus.spec.d.ts +1 -0
|
@@ -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
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
-
|
|
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
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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, {
|