@roomle/embedding-lib 5.13.0-alpha.1 → 5.13.0-alpha.3
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/md/web/embedding/CHANGELOG.md +4 -22
- package/package.json +2 -2
- package/packages/common/src/utils/init-data.d.ts +1 -0
- package/packages/embedding-lib/src/connector.d.ts +1 -1
- package/packages/embedding-lib/src/embedding-lib.d.ts +1 -1
- package/roomle-embedding-lib.es.js +8 -7
- package/roomle-embedding-lib.es.min.js +1 -1
- package/roomle-embedding-lib.umd.js +1 -1
- package/roomle-embedding-lib.umd.min.js +2 -2
- package/src/common/components/collection-view/-utils/collection-view-dynamic-components.d.ts +86 -965
- package/src/common/components/overlays/PartList.vue.d.ts +3 -4
- package/src/common/components/overlays/part-list/partlist-setup.d.ts +3 -4
- package/src/common/composables/use-configurator-api.d.ts +2 -2
- package/src/common/composables/use-core-instances.d.ts +2 -2
- package/src/common/composables/use-event-emitter-listener.d.ts +2 -0
- package/src/common/composables/use-open-close-anim.d.ts +9 -0
- package/src/common/composables/use-static-item-parameters.d.ts +2 -2
- package/src/common/utils/helper.d.ts +6 -7
- package/src/common/utils/parameters.d.ts +2 -2
- package/src/common/utils/types.d.ts +9 -1
- package/src/common/utils/ui-actions.d.ts +2 -3
- package/src/configurator/business-logic/roomle-sdk-wrapper.d.ts +3 -4
- package/src/configurator/business-logic/sdk-connector-configurator.d.ts +3 -4
- package/src/configurator/business-logic/sdk-connector.d.ts +7 -8
- package/src/configurator/components/grid-view/-utils/ExpandedView.vue.d.ts +2 -2
- package/src/configurator/components/grid-view/-utils/GridViewHelper.d.ts +2 -2
- package/src/configurator/components/grid-view/GridView.vue.d.ts +25 -319
- package/src/configurator/components/parameters/types/MaterialParameter.vue.d.ts +27 -320
- package/src/configurator/components/parameters/types/ProductVariant.vue.d.ts +27 -320
- package/src/configurator/components/parameters/types/ThumbnailsParameter.vue.d.ts +27 -320
- package/src/configurator/embedding/exposed-api.d.ts +2 -4
- package/src/configurator/embedding/exposed-callbacks.d.ts +2 -1
- package/src/configurator/embedding/helper.d.ts +4 -3
- package/src/configurator/embedding/types.d.ts +5 -0
- package/src/planner/business-logic/sdk-connector-planner.d.ts +5 -5
- package/src/planner/components/ObjectList.vue.d.ts +4 -2
- package/src/planner/components/measurements/MeasurementDisplayComponent.vue.d.ts +4 -0
- package/src/planner/components/measurements/ShowWallAtticMeasurements.vue.d.ts +8 -0
- package/src/planner/components/measurements/utils/AtticLabel.vue.d.ts +24 -0
- package/src/planner/components/measurements/utils/AtticLine.vue.d.ts +26 -0
- package/src/planner/components/overlays/ProductList.vue.d.ts +2 -2
- package/src/planner/components/overlays/ProductSettings.vue.d.ts +3 -4
- package/src/planner/components/overlays/product-list/ProductListEntry.vue.d.ts +2 -2
- package/src/planner/components/overlays/product-list/ProductListType.vue.d.ts +2 -2
- package/src/planner/components/overlays/product-settings/ProductPositions.vue.d.ts +3 -3
- package/src/planner/components/overlays/product-settings/ProductRotation.vue.d.ts +3 -3
- package/src/planner/components/overlays/product-settings/ProductSettingsInfos.vue.d.ts +3 -3
- package/src/planner/components/overlays/product-settings/ProductSize.vue.d.ts +3 -3
- package/src/planner/components/overlays/product-settings/ProductXYZChanger.vue.d.ts +3 -3
- package/src/planner/components/overlays/rooms/ConstructionVariants.vue.d.ts +28 -321
- package/src/planner/components/overlays/rooms/DoorParametersSetting.vue.d.ts +33 -326
- package/src/planner/components/overlays/rooms/ElementLengthScaling.vue.d.ts +2 -2
- package/src/planner/components/overlays/rooms/FloorColor.vue.d.ts +2 -2
- package/src/planner/components/overlays/rooms/RoomGeneralSettings.vue.d.ts +2 -2
- package/src/planner/components/overlays/rooms/RoomsList.vue.d.ts +2 -2
- package/src/planner/components/overlays/rooms/SlopingRoof.vue.d.ts +2 -2
- package/src/planner/components/overlays/rooms/SlopingRoofDirection.vue.d.ts +2 -2
- package/src/planner/components/overlays/rooms/WallGeneralSettings.vue.d.ts +2 -2
- package/src/planner/components/overlays/rooms/WindowParametersSetting.vue.d.ts +3 -4
- package/src/planner/components/utils/AssureConfiguratorHandlers.vue.d.ts +1 -1
- package/src/planner/components/utils/AssureSdkHandlers.vue.d.ts +1 -1
- package/src/planner/utils/planner-sidebar.d.ts +2 -2
|
@@ -1,30 +1,12 @@
|
|
|
1
|
-
## [5.13.0-alpha.
|
|
1
|
+
## [5.13.0-alpha.3](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.13.0-alpha.2...embedding-lib-v5.13.0-alpha.3) (2025-03-19)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Features
|
|
5
5
|
|
|
6
|
-
*
|
|
7
|
-
* **SDK:** upgrade to version 2.
|
|
8
|
-
* **SDK:** upgrade to version 2.96.0-alpha.10 ([#1542](https://github.com/roomle-dev/roomle-ui/issues/1542)) ([41076e3](https://github.com/roomle-dev/roomle-ui/commit/41076e3d378d2ccd376422f012257448a0a51ba4))
|
|
9
|
-
* **SDK:** upgrade to version 2.96.0-alpha.2 ([#1526](https://github.com/roomle-dev/roomle-ui/issues/1526)) ([b8a5b26](https://github.com/roomle-dev/roomle-ui/commit/b8a5b26426deed868a8bc85d1dc04a861715387e))
|
|
10
|
-
* **SDK:** upgrade to version 2.96.0-alpha.3 ([#1529](https://github.com/roomle-dev/roomle-ui/issues/1529)) ([89bb09a](https://github.com/roomle-dev/roomle-ui/commit/89bb09a5c2f13e383d7f07ef12e60edc85c12fca))
|
|
11
|
-
* **SDK:** upgrade to version 2.96.0-alpha.4 ([#1531](https://github.com/roomle-dev/roomle-ui/issues/1531)) ([13ef8b3](https://github.com/roomle-dev/roomle-ui/commit/13ef8b3196755091d15c4debad03a95d950f49a4))
|
|
12
|
-
* **SDK:** upgrade to version 2.96.0-alpha.5 ([#1533](https://github.com/roomle-dev/roomle-ui/issues/1533)) ([c19e5d9](https://github.com/roomle-dev/roomle-ui/commit/c19e5d944e8fcb12a0c626752c38ec204487e9fb))
|
|
13
|
-
* **SDK:** upgrade to version 2.96.0-alpha.6 ([#1535](https://github.com/roomle-dev/roomle-ui/issues/1535)) ([eabf798](https://github.com/roomle-dev/roomle-ui/commit/eabf7981515fff4f6dad3709bc31cf435137d238))
|
|
14
|
-
* **SDK:** upgrade to version 2.96.0-alpha.7 ([#1536](https://github.com/roomle-dev/roomle-ui/issues/1536)) ([cf50e3a](https://github.com/roomle-dev/roomle-ui/commit/cf50e3abad14310547a674c579b6953697f7ca0a))
|
|
15
|
-
* **SDK:** upgrade to version 2.96.0-alpha.8 ([#1540](https://github.com/roomle-dev/roomle-ui/issues/1540)) ([98998b6](https://github.com/roomle-dev/roomle-ui/commit/98998b638400ab7af0acaf3faee4f51fbdf3b192))
|
|
16
|
-
* **SDK:** upgrade to version 2.96.0-alpha.9 ([#1541](https://github.com/roomle-dev/roomle-ui/issues/1541)) ([a03765b](https://github.com/roomle-dev/roomle-ui/commit/a03765b8760b507b20c350e0ccf4942b59b70d43))
|
|
17
|
-
* wall side icon and explainer ([9768983](https://github.com/roomle-dev/roomle-ui/commit/9768983a3d79e5d2e856b949f5743db9644f2247))
|
|
6
|
+
* make catalog handle external objects ([489f0e0](https://github.com/roomle-dev/roomle-ui/commit/489f0e08553f80b7365b77f18342357fcecdc6de))
|
|
7
|
+
* **SDK:** upgrade to version 2.96.0-alpha.19 ([#1552](https://github.com/roomle-dev/roomle-ui/issues/1552)) ([ecd3361](https://github.com/roomle-dev/roomle-ui/commit/ecd3361cd978f48e72c33836751f6276b5a09998))
|
|
18
8
|
|
|
19
9
|
|
|
20
10
|
### Bug Fixes
|
|
21
11
|
|
|
22
|
-
*
|
|
23
|
-
* **planner:** call startConfiguring only once ([92c6655](https://github.com/roomle-dev/roomle-ui/commit/92c6655ff4de901ddfd83bea23804034b07b071c))
|
|
24
|
-
* failing tests ([ed1649c](https://github.com/roomle-dev/roomle-ui/commit/ed1649cbb46bc1937caeb182cfd5f30b0feb4091))
|
|
25
|
-
* failing tests ([2e0ff31](https://github.com/roomle-dev/roomle-ui/commit/2e0ff31248f2a4ea32e6e62b232c00132be8acc4))
|
|
26
|
-
* positions tutorial correctly if custom view is active ([e0c249f](https://github.com/roomle-dev/roomle-ui/commit/e0c249fa5bfda6f05223c0baa056aa62bc6725d5))
|
|
27
|
-
* prevent default drag cursor (not-allowed) on windows ([3c33cef](https://github.com/roomle-dev/roomle-ui/commit/3c33cefc8e6c2c674be4e99dd7ab825e651d4992))
|
|
28
|
-
* reverse the order of collectionView icon and text ([deaec0d](https://github.com/roomle-dev/roomle-ui/commit/deaec0dbf3fd6003e0b6326719925a7f8d50db44))
|
|
29
|
-
* tests ([edd4cea](https://github.com/roomle-dev/roomle-ui/commit/edd4cea03e2cd9490223cdaed130f2e23cc66a6f))
|
|
30
|
-
* **code-review:** tried to fix the following problem that came up during code-review: ([79d0c5d](https://github.com/roomle-dev/roomle-ui/commit/79d0c5da9ad112b1894f5da8ccc3c5b0557fb994)), closes [/github.com/roomle-dev/roomle-ui/pull/1518/files#r1984799244](https://github.com/roomle-dev//github.com/roomle-dev/roomle-ui/pull/1518/files/issues/r1984799244)
|
|
12
|
+
* type errors ([da36d23](https://github.com/roomle-dev/roomle-ui/commit/da36d232745491c07da000714f2bb61e6a4e38bb))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "5.13.0-alpha.
|
|
3
|
+
"version": "5.13.0-alpha.3",
|
|
4
4
|
"description": "This is a small library which can be used to communicate with the Roomle Configurator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./roomle-embedding-lib.umd.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"npm": "8.3.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@roomle/web-sdk": "2.96.0-alpha.
|
|
32
|
+
"@roomle/web-sdk": "2.96.0-alpha.19"
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|
|
@@ -23,7 +23,7 @@ export declare class Connector<SdkType, SdkCallbacks> implements RoomleEmbedding
|
|
|
23
23
|
pluginsLoaded: Array<Promise<void>>;
|
|
24
24
|
ui: ExposedApi;
|
|
25
25
|
extended: SdkType;
|
|
26
|
-
configurator: RoomleConfigurator
|
|
26
|
+
configurator: RoomleConfigurator<readonly []>;
|
|
27
27
|
analytics: {
|
|
28
28
|
callbacks: ExposedAnalyticsCallbacks;
|
|
29
29
|
};
|
|
@@ -24,7 +24,7 @@ export type RoomleViewerApi = RoomleEmbeddingApi<RoomleGLBViewer, ConfiguratorUi
|
|
|
24
24
|
export type RoomlePlannerApi = RoomleEmbeddingApi<RoomlePlanner, ConfiguratorUiCallbacks>;
|
|
25
25
|
export default class RoomleEmbeddingApi<SdkType, SdkCallbacks> extends Connector<SdkType, SdkCallbacks> {
|
|
26
26
|
static createPlanner(configuratorId: string, container: HTMLElement, initData: UiInitData, plugins?: PluginDefinitions): Promise<RoomlePlannerApi>;
|
|
27
|
-
static connect(customView: PossibleCustomViews, plugins?: PluginDefinitions): Promise<Connector<RoomleConfigurator
|
|
27
|
+
static connect(customView: PossibleCustomViews, plugins?: PluginDefinitions): Promise<Connector<RoomleConfigurator<readonly []>, ConfiguratorUiCallbacks>>;
|
|
28
28
|
/**
|
|
29
29
|
* Method to create a new instance of a Roomle Configurator
|
|
30
30
|
* @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
|
|
@@ -206,7 +206,8 @@ const z = {
|
|
|
206
206
|
saveToIdb: !0,
|
|
207
207
|
featureFlags: {
|
|
208
208
|
mocAr: !0,
|
|
209
|
-
wallAutoHeight: !1
|
|
209
|
+
wallAutoHeight: !1,
|
|
210
|
+
openCloseAnimation: !1
|
|
210
211
|
},
|
|
211
212
|
rotationSnapDegrees: 10,
|
|
212
213
|
interactionsCollapsed: !1
|
|
@@ -238,7 +239,7 @@ const z = {
|
|
|
238
239
|
}, X = "<CONF_ID>", Z = "#CONFIGURATIONID#", j = (e) => {
|
|
239
240
|
e.featureFlags || (e.featureFlags = {}), typeof e.featureFlags.realPartList != "boolean" && (e.featureFlags.realPartList = !0), typeof e.featureFlags.globalCallbacks != "boolean" && (e.featureFlags.globalCallbacks = !0), typeof e.featureFlags.mocAr != "boolean" && (e.featureFlags.mocAr = !1);
|
|
240
241
|
}, M = () => /(android)/i.test(navigator.userAgent);
|
|
241
|
-
class
|
|
242
|
+
class A {
|
|
242
243
|
constructor() {
|
|
243
244
|
c(this, "_messageHandler", null);
|
|
244
245
|
c(this, "isSetupDone", !1);
|
|
@@ -334,7 +335,7 @@ class y {
|
|
|
334
335
|
);
|
|
335
336
|
}
|
|
336
337
|
}
|
|
337
|
-
const
|
|
338
|
+
const y = () => {
|
|
338
339
|
let e, t;
|
|
339
340
|
return { promise: new Promise((o, r) => {
|
|
340
341
|
e = o, t = r;
|
|
@@ -364,7 +365,7 @@ const A = () => {
|
|
|
364
365
|
ANDROID_HEIGHT: "rml-android-height",
|
|
365
366
|
OVERFLOW_HIDDEN: "rml-overflow-hidden"
|
|
366
367
|
}, w = /* @__PURE__ */ new Map();
|
|
367
|
-
class te extends
|
|
368
|
+
class te extends A {
|
|
368
369
|
constructor(s, o, r, n, a) {
|
|
369
370
|
super();
|
|
370
371
|
c(this, "_waitForIframe");
|
|
@@ -382,7 +383,7 @@ class te extends y {
|
|
|
382
383
|
const g = r.zIndex || 9999999, h = document.createElement("style");
|
|
383
384
|
h.type = "text/css", h.id = b;
|
|
384
385
|
const m = "transition:all ease-in-out " + ee + "ms;", f = ["-webkit-", "-o-"].reduce(
|
|
385
|
-
(
|
|
386
|
+
(C, D) => C += D + m,
|
|
386
387
|
""
|
|
387
388
|
) + m, P = H();
|
|
388
389
|
h.innerHTML = `
|
|
@@ -414,9 +415,9 @@ class te extends y {
|
|
|
414
415
|
);
|
|
415
416
|
}
|
|
416
417
|
static async connect(s, o = []) {
|
|
417
|
-
const r = new
|
|
418
|
+
const r = new A();
|
|
418
419
|
r.viewName = s;
|
|
419
|
-
const { resolve: n, promise: a } =
|
|
420
|
+
const { resolve: n, promise: a } = y(), { resolve: i, promise: l } = y(), d = ({
|
|
420
421
|
message: m,
|
|
421
422
|
args: f
|
|
422
423
|
}) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var H=Object.defineProperty,U=(s,e,t)=>e in s?H(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,c=(s,e,t)=>U(s,typeof e!="symbol"?e+"":e,t);class I{constructor(e,t,r,i){c(this,"_side"),c(this,"_incomingMessageBus",null),c(this,"_outgoingMessageBus",null),c(this,"_execMessage",null),this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=r,this._execMessage=i,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((r,i)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return r(void 0);const o=new MessageChannel;o.port1.onmessage=n=>{if(!n||!n.data)return o.port1.close(),o.port2.close(),i(new Error(this._side+" received message but response can not be interpreted"));let l;try{l=JSON.parse(n.data)}catch(u){return o.port1.close(),o.port2.close(),this._prepareError(u),i(u)}l.error?i(l.error):l.result!==void 0?r(l.result):r(void 0),o.port1.close(),o.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return i(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return i(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[o.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const r=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const i=this._execMessage(r,e);if(i===void 0)return;i.then((o={})=>{let a,n;typeof o=="object"&&o!==null&&(a=o.error,n=o.result),a?t.postMessage(JSON.stringify({error:a})):n!==void 0?t.postMessage(JSON.stringify({result:n})):t.postMessage(JSON.stringify({result:o}))},o=>{t.postMessage(JSON.stringify({error:this._prepareError(o)}))})}catch(r){t.postMessage(JSON.stringify({error:this._prepareError(r)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const p=".",f={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},_={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},B=async(s,e)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",r=e.overrideTenant||9,i=t+"/configurators/"+s,o="roomle_portal_v2",a="03-"+window.btoa(new Date().toISOString()+";anonymous;"+o),n=()=>{const d={apiKey:o,currentTenant:r,locale:"en",language:"en",device:1,token:a,platform:"web"};return new Headers(d)},l=new Request(i,{method:"GET",headers:n(),mode:"cors",cache:"default"}),u=await fetch(l),{configurator:h}=await u.json();return h},F=()=>{try{return window.self!==window.top}catch{return!0}},C=["127.0.0.1","localhost","0.0.0.0"],k=()=>{const s=F();let e=window.location.href;if(s){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},x=s=>!!(C.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),y=["language","browserLanguage","userLanguage","systemLanguage"],W=(s=null)=>{const e=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=y.length;t<r;t++){const i=e[y[t]];if(i)return i.substr(0,2)}return"en"},V=(s,e)=>{const t=JSON.parse(JSON.stringify(s));return w(t,e)},w=(s,e)=>{for(const t in e)try{e[t].constructor===Object?s[t]=w(s[t],e[t]):s[t]=e[t]}catch{s[t]=e[t]}return s};var T=(s=>(s.BOTTOM_BAR="bottom_bar",s.PARTLIST_BOUNDS="partlist_bounds",s.INTERACTION_NOTES="interaction_notes",s))(T||{}),G={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const J={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[T.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},$="(idle)",j=s=>(E(s),s!=null&&s.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(Y,Q)),s),E=s=>{if(!s)return;const e=Object.keys(s);for(const t of e){const r=s[t];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&E(r),Array.isArray(r))for(const i of r)E(i);(r==="true"||r==="false")&&(s[t]=r==="true")}},z=(s,e)=>{e.configuratorId=s.id;const t=s.settings||{};return!e.overrideTenant&&s.tenant&&(e.overrideTenant=s.tenant),V(t,e)},q=()=>{const s={...J};s.locale||(s.locale=W()),s.id===$&&delete s.id;const e=k();return e&&x(e)&&(s.configuratorId="demoConfigurator"),s.customApiUrl=G.VITE_RAPI_URL,s.emails=!1,s},Y="<CONF_ID>",Q="#CONFIGURATIONID#",K=s=>{s.featureFlags||(s.featureFlags={}),typeof s.featureFlags.realPartList!="boolean"&&(s.featureFlags.realPartList=!0),typeof s.featureFlags.globalCallbacks!="boolean"&&(s.featureFlags.globalCallbacks=!0),typeof s.featureFlags.mocAr!="boolean"&&(s.featureFlags.mocAr=!1)},M=()=>/(android)/i.test(navigator.userAgent);class v{constructor(){c(this,"_messageHandler",null),c(this,"isSetupDone",!1),c(this,"viewName","main"),c(this,"plugins",{}),c(this,"pluginsLoaded",[]),c(this,"ui",{callbacks:null}),c(this,"extended",{callbacks:null}),c(this,"configurator",{callbacks:null}),c(this,"analytics",{callbacks:{}}),c(this,"global",{callbacks:{}})}setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:r}=e;t.forEach(i=>{const o=i.split(p),a=o[0],n=o[1];this[a]||(this[a]={}),this[a][n]=function(){if(!this._messageHandler){console.error("MessageHandler not set");return}return this._messageHandler.sendMessage(i,[...arguments])}.bind(this)}),r.forEach(i=>{const o=i.split(p),a=o[0],n=o[1],l=o[2];this[a]||(this[a]={}),this[a][n]||(this[a][n]={}),this[a][n][l]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const r=e.split(p),i=r[0],o=r[1],a=r.length===3?r[2]:null;if(a&&this[i][o][a]){const n=this[i][o][a](...t);return n instanceof Promise?n.then(l=>({result:l})):n!==void 0?Promise.resolve({result:n}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,r="website"){for(const i of e)typeof i=="string"&&i==="dragIn"?this.pluginsLoaded.push(new Promise((o,a)=>{try{import("./drag-in-w_TrusdP.mjs").then(n=>n.l).then(({DragIn:n})=>{const l=new n(this.ui,t,r,this.viewName);l.init().then(()=>{this.plugins.dragIn=l,o()},a)})}catch(n){a(n)}})):i.name&&i.loader&&this.pluginsLoaded.push(new Promise((o,a)=>{try{i.loader().then(n=>{const l=new n(this.ui,t,r,this.viewName);l.init().then(()=>{this.plugins[i.name]=l,o()},a)})}catch(n){a(n)}}))}}const S=()=>{let s,e;return{promise:new Promise((t,r)=>{s=t,e=r}),resolve:s,reject:e}},N=(s,e,t)=>{let r=null;Object.defineProperty(s,e,{get(){return r||t},set(i){i!=null&&i.mute?r=i.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 }"),r=i)}})},R=()=>window.innerHeight*.01+"px",D=s=>{s&&setTimeout(()=>s.style.setProperty(O,R()),0)},L="rml-styles",X=450,O="--rml-full-height",g={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},b=new Map;class Z extends v{constructor(e,t,r,i,o){if(super(),c(this,"_waitForIframe"),c(this,"_container"),c(this,"_configuratorSettings"),c(this,"_initData",{}),c(this,"_iframe"),!e||typeof e.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(b.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(L)){const l=r.zIndex||9999999,u=document.createElement("style");u.type="text/css",u.id=L;const h="transition:all ease-in-out "+X+"ms;",d=["-webkit-","-o-"].reduce((P
|
|
1
|
+
var H=Object.defineProperty,U=(s,e,t)=>e in s?H(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,c=(s,e,t)=>U(s,typeof e!="symbol"?e+"":e,t);class I{constructor(e,t,r,i){c(this,"_side"),c(this,"_incomingMessageBus",null),c(this,"_outgoingMessageBus",null),c(this,"_execMessage",null),this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=r,this._execMessage=i,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((r,i)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return r(void 0);const o=new MessageChannel;o.port1.onmessage=n=>{if(!n||!n.data)return o.port1.close(),o.port2.close(),i(new Error(this._side+" received message but response can not be interpreted"));let l;try{l=JSON.parse(n.data)}catch(u){return o.port1.close(),o.port2.close(),this._prepareError(u),i(u)}l.error?i(l.error):l.result!==void 0?r(l.result):r(void 0),o.port1.close(),o.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return i(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return i(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[o.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const r=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const i=this._execMessage(r,e);if(i===void 0)return;i.then((o={})=>{let a,n;typeof o=="object"&&o!==null&&(a=o.error,n=o.result),a?t.postMessage(JSON.stringify({error:a})):n!==void 0?t.postMessage(JSON.stringify({result:n})):t.postMessage(JSON.stringify({result:o}))},o=>{t.postMessage(JSON.stringify({error:this._prepareError(o)}))})}catch(r){t.postMessage(JSON.stringify({error:this._prepareError(r)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const p=".",f={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},_={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},B=async(s,e)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",r=e.overrideTenant||9,i=t+"/configurators/"+s,o="roomle_portal_v2",a="03-"+window.btoa(new Date().toISOString()+";anonymous;"+o),n=()=>{const d={apiKey:o,currentTenant:r,locale:"en",language:"en",device:1,token:a,platform:"web"};return new Headers(d)},l=new Request(i,{method:"GET",headers:n(),mode:"cors",cache:"default"}),u=await fetch(l),{configurator:h}=await u.json();return h},F=()=>{try{return window.self!==window.top}catch{return!0}},C=["127.0.0.1","localhost","0.0.0.0"],k=()=>{const s=F();let e=window.location.href;if(s){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},x=s=>!!(C.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),y=["language","browserLanguage","userLanguage","systemLanguage"],W=(s=null)=>{const e=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=y.length;t<r;t++){const i=e[y[t]];if(i)return i.substr(0,2)}return"en"},V=(s,e)=>{const t=JSON.parse(JSON.stringify(s));return w(t,e)},w=(s,e)=>{for(const t in e)try{e[t].constructor===Object?s[t]=w(s[t],e[t]):s[t]=e[t]}catch{s[t]=e[t]}return s};var T=(s=>(s.BOTTOM_BAR="bottom_bar",s.PARTLIST_BOUNDS="partlist_bounds",s.INTERACTION_NOTES="interaction_notes",s))(T||{}),G={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const J={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[T.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},$="(idle)",j=s=>(E(s),s!=null&&s.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(Y,Q)),s),E=s=>{if(!s)return;const e=Object.keys(s);for(const t of e){const r=s[t];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&E(r),Array.isArray(r))for(const i of r)E(i);(r==="true"||r==="false")&&(s[t]=r==="true")}},z=(s,e)=>{e.configuratorId=s.id;const t=s.settings||{};return!e.overrideTenant&&s.tenant&&(e.overrideTenant=s.tenant),V(t,e)},q=()=>{const s={...J};s.locale||(s.locale=W()),s.id===$&&delete s.id;const e=k();return e&&x(e)&&(s.configuratorId="demoConfigurator"),s.customApiUrl=G.VITE_RAPI_URL,s.emails=!1,s},Y="<CONF_ID>",Q="#CONFIGURATIONID#",K=s=>{s.featureFlags||(s.featureFlags={}),typeof s.featureFlags.realPartList!="boolean"&&(s.featureFlags.realPartList=!0),typeof s.featureFlags.globalCallbacks!="boolean"&&(s.featureFlags.globalCallbacks=!0),typeof s.featureFlags.mocAr!="boolean"&&(s.featureFlags.mocAr=!1)},M=()=>/(android)/i.test(navigator.userAgent);class v{constructor(){c(this,"_messageHandler",null),c(this,"isSetupDone",!1),c(this,"viewName","main"),c(this,"plugins",{}),c(this,"pluginsLoaded",[]),c(this,"ui",{callbacks:null}),c(this,"extended",{callbacks:null}),c(this,"configurator",{callbacks:null}),c(this,"analytics",{callbacks:{}}),c(this,"global",{callbacks:{}})}setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:r}=e;t.forEach(i=>{const o=i.split(p),a=o[0],n=o[1];this[a]||(this[a]={}),this[a][n]=function(){if(!this._messageHandler){console.error("MessageHandler not set");return}return this._messageHandler.sendMessage(i,[...arguments])}.bind(this)}),r.forEach(i=>{const o=i.split(p),a=o[0],n=o[1],l=o[2];this[a]||(this[a]={}),this[a][n]||(this[a][n]={}),this[a][n][l]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const r=e.split(p),i=r[0],o=r[1],a=r.length===3?r[2]:null;if(a&&this[i][o][a]){const n=this[i][o][a](...t);return n instanceof Promise?n.then(l=>({result:l})):n!==void 0?Promise.resolve({result:n}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,r="website"){for(const i of e)typeof i=="string"&&i==="dragIn"?this.pluginsLoaded.push(new Promise((o,a)=>{try{import("./drag-in-w_TrusdP.mjs").then(n=>n.l).then(({DragIn:n})=>{const l=new n(this.ui,t,r,this.viewName);l.init().then(()=>{this.plugins.dragIn=l,o()},a)})}catch(n){a(n)}})):i.name&&i.loader&&this.pluginsLoaded.push(new Promise((o,a)=>{try{i.loader().then(n=>{const l=new n(this.ui,t,r,this.viewName);l.init().then(()=>{this.plugins[i.name]=l,o()},a)})}catch(n){a(n)}}))}}const S=()=>{let s,e;return{promise:new Promise((t,r)=>{s=t,e=r}),resolve:s,reject:e}},N=(s,e,t)=>{let r=null;Object.defineProperty(s,e,{get(){return r||t},set(i){i!=null&&i.mute?r=i.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 }"),r=i)}})},R=()=>window.innerHeight*.01+"px",D=s=>{s&&setTimeout(()=>s.style.setProperty(O,R()),0)},L="rml-styles",X=450,O="--rml-full-height",g={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},b=new Map;class Z extends v{constructor(e,t,r,i,o){if(super(),c(this,"_waitForIframe"),c(this,"_container"),c(this,"_configuratorSettings"),c(this,"_initData",{}),c(this,"_iframe"),!e||typeof e.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(b.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(L)){const l=r.zIndex||9999999,u=document.createElement("style");u.type="text/css",u.id=L;const h="transition:all ease-in-out "+X+"ms;",d=["-webkit-","-o-"].reduce((A,P)=>A+=P+h,"")+h,m=R();u.innerHTML=`
|
|
2
2
|
.${g.CONTAINER}{${O}:${m};}
|
|
3
3
|
.${g.POSITION}{position:fixed;top:0;left:0;z-index:${l};opacity:0}
|
|
4
4
|
.${g.TRANSITION}{${d}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(_,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(_=typeof globalThis<"u"?globalThis:_||self,_["roomle-embedding-lib"]=_["roomle-embedding-lib"]||{},_["roomle-embedding-lib"].umd=_["roomle-embedding-lib"].umd||{},_["roomle-embedding-lib"].umd.js=p())})(this,function(){"use strict";var te=Object.defineProperty;var ee=(_,p,E)=>p in _?te(_,p,{enumerable:!0,configurable:!0,writable:!0,value:E}):_[p]=E;var c=(_,p,E)=>ee(_,typeof p!="symbol"?p+"":p,E);class _{constructor(e,t,s,n){c(this,"_side");c(this,"_incomingMessageBus",null);c(this,"_outgoingMessageBus",null);c(this,"_execMessage",null);this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=a=>{if(!a||!a.data)return i.port1.close(),i.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let l;try{l=JSON.parse(a.data)}catch(d){return i.port1.close(),i.port2.close(),this._prepareError(d),n(d)}l.error?n(l.error):l.result!==void 0?s(l.result):s(void 0),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:e,args:t})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(o,"*",[i.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const n=this._execMessage(s,e);if(n===void 0)return;n.then((i={})=>{let o,a;typeof i=="object"&&i!==null&&(o=i.error,a=i.result),o?t.postMessage(JSON.stringify({error:o})):a!==void 0?t.postMessage(JSON.stringify({result:a})):t.postMessage(JSON.stringify({result:i}))},i=>{t.postMessage(JSON.stringify({error:this._prepareError(i)}))})}catch(s){t.postMessage(JSON.stringify({error:this._prepareError(s)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const p=".",E={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},w={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},pt=async(r,e)=>{if(typeof r!="string")throw new Error('Configurator ID is not a string type: "'+typeof r+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",s=e.overrideTenant||9,n=t+"/configurators/"+r,i="roomle_portal_v2",o="03-"+window.btoa(new Date().toISOString()+";anonymous;"+i),a=()=>{const u={apiKey:i,currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"};return new Headers(u)},l=new Request(n,{method:"GET",headers:a(),mode:"cors",cache:"default"}),d=await fetch(l),{configurator:h}=await d.json();return h},yt=()=>{try{return window.self!==window.top}catch{return!0}},Et=["127.0.0.1","localhost","0.0.0.0"],Dt=()=>{const r=yt();let e=window.location.href;if(r){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},Tt=r=>!!(Et.includes(r)||r.endsWith("roomle.com")||r.endsWith("gitlab.io")||r.endsWith("gitlab.com")),k=["language","browserLanguage","userLanguage","systemLanguage"],St=(r=null)=>{const e=window.navigator;if(r)return r.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,s=k.length;t<s;t++){const n=e[k[t]];if(n)return n.substr(0,2)}return"en"},It=(r,e)=>{const t=JSON.parse(JSON.stringify(r));return C(t,e)},C=(r,e)=>{for(const t in e)try{e[t].constructor===Object?r[t]=C(r[t],e[t]):r[t]=e[t]}catch{r[t]=e[t]}return r};var z=(r=>(r.BOTTOM_BAR="bottom_bar",r.PARTLIST_BOUNDS="partlist_bounds",r.INTERACTION_NOTES="interaction_notes",r))(z||{}),wt={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const At={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[z.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},bt="(idle)",Ot=r=>(L(r),r!=null&&r.customApiUrl&&(r.customApiUrl=decodeURIComponent(r.customApiUrl)),r.shareUrl&&(r.deeplink=r.shareUrl.replace(Mt,Ct)),r),L=r=>{if(!r)return;const e=Object.keys(r);for(const t of e){const s=r[t];if(!Array.isArray(s)&&typeof s=="object"&&s!==null&&L(s),Array.isArray(s))for(const n of s)L(n);(s==="true"||s==="false")&&(r[t]=s==="true")}},vt=(r,e)=>{e.configuratorId=r.id;const t=r.settings||{};return!e.overrideTenant&&r.tenant&&(e.overrideTenant=r.tenant),It(t,e)},Rt=()=>{const r={...At};r.locale||(r.locale=St()),r.id===bt&&delete r.id;const e=Dt();return e&&Tt(e)&&(r.configuratorId="demoConfigurator"),r.customApiUrl=wt.VITE_RAPI_URL,r.emails=!1,r},Mt="<CONF_ID>",Ct="#CONFIGURATIONID#",Lt=r=>{r.featureFlags||(r.featureFlags={}),typeof r.featureFlags.realPartList!="boolean"&&(r.featureFlags.realPartList=!0),typeof r.featureFlags.globalCallbacks!="boolean"&&(r.featureFlags.globalCallbacks=!0),typeof r.featureFlags.mocAr!="boolean"&&(r.featureFlags.mocAr=!1)},V=()=>/(android)/i.test(navigator.userAgent);class q{constructor(){c(this,"_messageHandler",null);c(this,"isSetupDone",!1);c(this,"viewName","main");c(this,"plugins",{});c(this,"pluginsLoaded",[]);c(this,"ui",{callbacks:null});c(this,"extended",{callbacks:null});c(this,"configurator",{callbacks:null});c(this,"analytics",{callbacks:{}});c(this,"global",{callbacks:{}})}setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(n=>{const i=n.split(p),o=i[0],a=i[1];this[o]||(this[o]={}),this[o][a]=(function(){if(!this._messageHandler){console.error("MessageHandler not set");return}return this._messageHandler.sendMessage(n,[...arguments])}).bind(this)}),s.forEach(n=>{const i=n.split(p),o=i[0],a=i[1],l=i[2];this[o]||(this[o]={}),this[o][a]||(this[o][a]={}),this[o][a][l]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split(p),n=s[0],i=s[1],o=s.length===3?s[2]:null;if(o&&this[n][i][o]){const a=this[n][i][o](...t);return a instanceof Promise?a.then(l=>({result:l})):a!==void 0?Promise.resolve({result:a}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const n of e)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((i,o)=>{try{Promise.resolve().then(()=>Pt).then(({DragIn:a})=>{const l=new a(this.ui,t,s,this.viewName);l.init().then(()=>{this.plugins.dragIn=l,i()},o)})}catch(a){o(a)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((i,o)=>{try{n.loader().then(a=>{const l=new a(this.ui,t,s,this.viewName);l.init().then(()=>{this.plugins[n.name]=l,i()},o)})}catch(a){o(a)}}))}}const K=()=>{let r,e;return{promise:new Promise((s,n)=>{r=s,e=n}),resolve:r,reject:e}},J=(r,e,t)=>{let s=null;Object.defineProperty(r,e,{get(){return s||t},set(n){n!=null&&n.mute?s=n.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=n)}})},j=()=>window.innerHeight*.01+"px",Q=r=>{r&&setTimeout(()=>r.style.setProperty(N,j()),0)},Z="rml-styles",Nt=450,N="--rml-full-height",m={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},x=new Map;class xt extends q{constructor(t,s,n,i,o){super();c(this,"_waitForIframe");c(this,"_container");c(this,"_configuratorSettings");c(this,"_initData",{});c(this,"_iframe");if(!t||typeof t.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(x.has(s))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(Z)){const h=n.zIndex||9999999,u=document.createElement("style");u.type="text/css",u.id=Z;const g="transition:all ease-in-out "+Nt+"ms;",f=["-webkit-","-o-"].reduce((D,y)=>D+=y+g,"")+g,S=j();u.innerHTML=`
|
|
1
|
+
(function(_,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(_=typeof globalThis<"u"?globalThis:_||self,_["roomle-embedding-lib"]=_["roomle-embedding-lib"]||{},_["roomle-embedding-lib"].umd=_["roomle-embedding-lib"].umd||{},_["roomle-embedding-lib"].umd.js=p())})(this,function(){"use strict";var te=Object.defineProperty;var ee=(_,p,E)=>p in _?te(_,p,{enumerable:!0,configurable:!0,writable:!0,value:E}):_[p]=E;var c=(_,p,E)=>ee(_,typeof p!="symbol"?p+"":p,E);class _{constructor(e,t,s,n){c(this,"_side");c(this,"_incomingMessageBus",null);c(this,"_outgoingMessageBus",null);c(this,"_execMessage",null);this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((s,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const i=new MessageChannel;i.port1.onmessage=a=>{if(!a||!a.data)return i.port1.close(),i.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let l;try{l=JSON.parse(a.data)}catch(d){return i.port1.close(),i.port2.close(),this._prepareError(d),n(d)}l.error?n(l.error):l.result!==void 0?s(l.result):s(void 0),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:e,args:t})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(o,"*",[i.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const s=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const n=this._execMessage(s,e);if(n===void 0)return;n.then((i={})=>{let o,a;typeof i=="object"&&i!==null&&(o=i.error,a=i.result),o?t.postMessage(JSON.stringify({error:o})):a!==void 0?t.postMessage(JSON.stringify({result:a})):t.postMessage(JSON.stringify({result:i}))},i=>{t.postMessage(JSON.stringify({error:this._prepareError(i)}))})}catch(s){t.postMessage(JSON.stringify({error:this._prepareError(s)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const p=".",E={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},w={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},pt=async(r,e)=>{if(typeof r!="string")throw new Error('Configurator ID is not a string type: "'+typeof r+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",s=e.overrideTenant||9,n=t+"/configurators/"+r,i="roomle_portal_v2",o="03-"+window.btoa(new Date().toISOString()+";anonymous;"+i),a=()=>{const u={apiKey:i,currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"};return new Headers(u)},l=new Request(n,{method:"GET",headers:a(),mode:"cors",cache:"default"}),d=await fetch(l),{configurator:h}=await d.json();return h},yt=()=>{try{return window.self!==window.top}catch{return!0}},Et=["127.0.0.1","localhost","0.0.0.0"],Dt=()=>{const r=yt();let e=window.location.href;if(r){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},Tt=r=>!!(Et.includes(r)||r.endsWith("roomle.com")||r.endsWith("gitlab.io")||r.endsWith("gitlab.com")),k=["language","browserLanguage","userLanguage","systemLanguage"],St=(r=null)=>{const e=window.navigator;if(r)return r.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,s=k.length;t<s;t++){const n=e[k[t]];if(n)return n.substr(0,2)}return"en"},It=(r,e)=>{const t=JSON.parse(JSON.stringify(r));return C(t,e)},C=(r,e)=>{for(const t in e)try{e[t].constructor===Object?r[t]=C(r[t],e[t]):r[t]=e[t]}catch{r[t]=e[t]}return r};var z=(r=>(r.BOTTOM_BAR="bottom_bar",r.PARTLIST_BOUNDS="partlist_bounds",r.INTERACTION_NOTES="interaction_notes",r))(z||{}),wt={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const At={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[z.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},bt="(idle)",Ot=r=>(L(r),r!=null&&r.customApiUrl&&(r.customApiUrl=decodeURIComponent(r.customApiUrl)),r.shareUrl&&(r.deeplink=r.shareUrl.replace(Mt,Ct)),r),L=r=>{if(!r)return;const e=Object.keys(r);for(const t of e){const s=r[t];if(!Array.isArray(s)&&typeof s=="object"&&s!==null&&L(s),Array.isArray(s))for(const n of s)L(n);(s==="true"||s==="false")&&(r[t]=s==="true")}},vt=(r,e)=>{e.configuratorId=r.id;const t=r.settings||{};return!e.overrideTenant&&r.tenant&&(e.overrideTenant=r.tenant),It(t,e)},Rt=()=>{const r={...At};r.locale||(r.locale=St()),r.id===bt&&delete r.id;const e=Dt();return e&&Tt(e)&&(r.configuratorId="demoConfigurator"),r.customApiUrl=wt.VITE_RAPI_URL,r.emails=!1,r},Mt="<CONF_ID>",Ct="#CONFIGURATIONID#",Lt=r=>{r.featureFlags||(r.featureFlags={}),typeof r.featureFlags.realPartList!="boolean"&&(r.featureFlags.realPartList=!0),typeof r.featureFlags.globalCallbacks!="boolean"&&(r.featureFlags.globalCallbacks=!0),typeof r.featureFlags.mocAr!="boolean"&&(r.featureFlags.mocAr=!1)},V=()=>/(android)/i.test(navigator.userAgent);class q{constructor(){c(this,"_messageHandler",null);c(this,"isSetupDone",!1);c(this,"viewName","main");c(this,"plugins",{});c(this,"pluginsLoaded",[]);c(this,"ui",{callbacks:null});c(this,"extended",{callbacks:null});c(this,"configurator",{callbacks:null});c(this,"analytics",{callbacks:{}});c(this,"global",{callbacks:{}})}setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(n=>{const i=n.split(p),o=i[0],a=i[1];this[o]||(this[o]={}),this[o][a]=(function(){if(!this._messageHandler){console.error("MessageHandler not set");return}return this._messageHandler.sendMessage(n,[...arguments])}).bind(this)}),s.forEach(n=>{const i=n.split(p),o=i[0],a=i[1],l=i[2];this[o]||(this[o]={}),this[o][a]||(this[o][a]={}),this[o][a][l]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split(p),n=s[0],i=s[1],o=s.length===3?s[2]:null;if(o&&this[n][i][o]){const a=this[n][i][o](...t);return a instanceof Promise?a.then(l=>({result:l})):a!==void 0?Promise.resolve({result:a}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const n of e)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((i,o)=>{try{Promise.resolve().then(()=>Pt).then(({DragIn:a})=>{const l=new a(this.ui,t,s,this.viewName);l.init().then(()=>{this.plugins.dragIn=l,i()},o)})}catch(a){o(a)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((i,o)=>{try{n.loader().then(a=>{const l=new a(this.ui,t,s,this.viewName);l.init().then(()=>{this.plugins[n.name]=l,i()},o)})}catch(a){o(a)}}))}}const K=()=>{let r,e;return{promise:new Promise((s,n)=>{r=s,e=n}),resolve:r,reject:e}},J=(r,e,t)=>{let s=null;Object.defineProperty(r,e,{get(){return s||t},set(n){n!=null&&n.mute?s=n.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=n)}})},j=()=>window.innerHeight*.01+"px",Q=r=>{r&&setTimeout(()=>r.style.setProperty(N,j()),0)},Z="rml-styles",Nt=450,N="--rml-full-height",m={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},x=new Map;class xt extends q{constructor(t,s,n,i,o){super();c(this,"_waitForIframe");c(this,"_container");c(this,"_configuratorSettings");c(this,"_initData",{});c(this,"_iframe");if(!t||typeof t.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(x.has(s))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(Z)){const h=n.zIndex||9999999,u=document.createElement("style");u.type="text/css",u.id=Z;const g="transition:all ease-in-out "+Nt+"ms;",f=["-webkit-","-o-"].reduce((D,y)=>D+=y+g,"")+g,S=j();u.innerHTML=`
|
|
2
2
|
.${m.CONTAINER}{${N}:${S};}
|
|
3
3
|
.${m.POSITION}{position:fixed;top:0;left:0;z-index:${h};opacity:0}
|
|
4
4
|
.${m.TRANSITION}{${f}}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
(function(p,D){typeof exports=="object"&&typeof module<"u"?module.exports=D():typeof define=="function"&&define.amd?define(D):(p=typeof globalThis<"u"?globalThis:p||self,p["roomle-embedding-lib"]=p["roomle-embedding-lib"]||{},p["roomle-embedding-lib"].umd=p["roomle-embedding-lib"].umd||{},p["roomle-embedding-lib"].umd.min=p["roomle-embedding-lib"].umd.min||{},p["roomle-embedding-lib"].umd.min.js=D())})(this,function(){"use strict";var p=Object.defineProperty,D=(i,t,e)=>t in i?p(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,h=(i,t,e)=>D(i,typeof t!="symbol"?t+"":t,e);class ${constructor(t,e,s,n){h(this,"_side"),h(this,"_incomingMessageBus",null),h(this,"_outgoingMessageBus",null),h(this,"_execMessage",null),this._side=t,this._incomingMessageBus=e,this._outgoingMessageBus=s,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(t){this._outgoingMessageBus=t}setMessageExecution(t){this._execMessage=t}sendMessage(t,e=[]){return new Promise((s,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const r=new MessageChannel;r.port1.onmessage=a=>{if(!a||!a.data)return r.port1.close(),r.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let c;try{c=JSON.parse(a.data)}catch(l){return r.port1.close(),r.port2.close(),this._prepareError(l),n(l)}c.error?n(c.error):c.result!==void 0?s(c.result):s(void 0),r.port1.close(),r.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(o,"*",[r.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const s=JSON.parse(t.data);if(!this._execMessage)return e.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const n=this._execMessage(s,t);if(n===void 0)return;n.then((r={})=>{let o,a;typeof r=="object"&&r!==null&&(o=r.error,a=r.result),o?e.postMessage(JSON.stringify({error:o})):a!==void 0?e.postMessage(JSON.stringify({result:a})):e.postMessage(JSON.stringify({result:r}))},r=>{e.postMessage(JSON.stringify({error:this._prepareError(r)}))})}catch(s){e.postMessage(JSON.stringify({error:this._prepareError(s)}))}}_prepareError(t){if(typeof t=="string"){const e=this._side+": "+t;return console.error(e),e}return t.message=this._side+": "+t.message,console.error(t),t.message}}const C=".",
|
|
1
|
+
(function(p,D){typeof exports=="object"&&typeof module<"u"?module.exports=D():typeof define=="function"&&define.amd?define(D):(p=typeof globalThis<"u"?globalThis:p||self,p["roomle-embedding-lib"]=p["roomle-embedding-lib"]||{},p["roomle-embedding-lib"].umd=p["roomle-embedding-lib"].umd||{},p["roomle-embedding-lib"].umd.min=p["roomle-embedding-lib"].umd.min||{},p["roomle-embedding-lib"].umd.min.js=D())})(this,function(){"use strict";var p=Object.defineProperty,D=(i,t,e)=>t in i?p(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,h=(i,t,e)=>D(i,typeof t!="symbol"?t+"":t,e);class ${constructor(t,e,s,n){h(this,"_side"),h(this,"_incomingMessageBus",null),h(this,"_outgoingMessageBus",null),h(this,"_execMessage",null),this._side=t,this._incomingMessageBus=e,this._outgoingMessageBus=s,this._execMessage=n,this._incomingMessageBus&&this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(t){this._outgoingMessageBus=t}setMessageExecution(t){this._execMessage=t}sendMessage(t,e=[]){return new Promise((s,n)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const r=new MessageChannel;r.port1.onmessage=a=>{if(!a||!a.data)return r.port1.close(),r.port2.close(),n(new Error(this._side+" received message but response can not be interpreted"));let c;try{c=JSON.parse(a.data)}catch(l){return r.port1.close(),r.port2.close(),this._prepareError(l),n(l)}c.error?n(c.error):c.result!==void 0?s(c.result):s(void 0),r.port1.close(),r.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch{return n(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return n(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(o,"*",[r.port2])})}_handleMessage(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const s=JSON.parse(t.data);if(!this._execMessage)return e.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(s.args)||(s.args=[s.args]);const n=this._execMessage(s,t);if(n===void 0)return;n.then((r={})=>{let o,a;typeof r=="object"&&r!==null&&(o=r.error,a=r.result),o?e.postMessage(JSON.stringify({error:o})):a!==void 0?e.postMessage(JSON.stringify({result:a})):e.postMessage(JSON.stringify({result:r}))},r=>{e.postMessage(JSON.stringify({error:this._prepareError(r)}))})}catch(s){e.postMessage(JSON.stringify({error:this._prepareError(s)}))}}_prepareError(t){if(typeof t=="string"){const e=this._side+": "+t;return console.error(e),e}return t.message=this._side+": "+t.message,console.error(t),t.message}}const C=".",A={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},E={GET_METHODS:"getMethods",RETURN_METHODS:"returnMethods",REGISTER_CUSTOM_VIEW:"registerCustomView",REGISTER_CUSTOM_VIEW_DONE:"registerCustomViewDone"},yt=async(i,t)=>{if(typeof i!="string")throw new Error('Configurator ID is not a string type: "'+typeof i+'"');const e=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",s=t.overrideTenant||9,n=e+"/configurators/"+i,r="roomle_portal_v2",o="03-"+window.btoa(new Date().toISOString()+";anonymous;"+r),a=()=>{const u={apiKey:r,currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"};return new Headers(u)},c=new Request(n,{method:"GET",headers:a(),mode:"cors",cache:"default"}),l=await fetch(c),{configurator:d}=await l.json();return d},vt=()=>{try{return window.self!==window.top}catch{return!0}},Dt=["127.0.0.1","localhost","0.0.0.0"],bt=()=>{const i=vt();let t=window.location.href;if(i){if(!document.referrer)return null;t=document.referrer}const{hostname:e}=new URL(t);return e},wt=i=>!!(Dt.includes(i)||i.endsWith("roomle.com")||i.endsWith("gitlab.io")||i.endsWith("gitlab.com")),j=["language","browserLanguage","userLanguage","systemLanguage"],Et=(i=null)=>{const t=window.navigator;if(i)return i.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,s=j.length;e<s;e++){const n=t[j[e]];if(n)return n.substr(0,2)}return"en"},Tt=(i,t)=>{const e=JSON.parse(JSON.stringify(i));return N(e,t)},N=(i,t)=>{for(const e in t)try{t[e].constructor===Object?i[e]=N(i[e],t[e]):i[e]=t[e]}catch{i[e]=t[e]}return i};var z=(i=>(i.BOTTOM_BAR="bottom_bar",i.PARTLIST_BOUNDS="partlist_bounds",i.INTERACTION_NOTES="interaction_notes",i))(z||{}),It={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};const St={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[z.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},Ot="(idle)",xt=i=>(L(i),i!=null&&i.customApiUrl&&(i.customApiUrl=decodeURIComponent(i.customApiUrl)),i.shareUrl&&(i.deeplink=i.shareUrl.replace(At,Nt)),i),L=i=>{if(!i)return;const t=Object.keys(i);for(const e of t){const s=i[e];if(!Array.isArray(s)&&typeof s=="object"&&s!==null&&L(s),Array.isArray(s))for(const n of s)L(n);(s==="true"||s==="false")&&(i[e]=s==="true")}},Mt=(i,t)=>{t.configuratorId=i.id;const e=i.settings||{};return!t.overrideTenant&&i.tenant&&(t.overrideTenant=i.tenant),Tt(e,t)},Ct=()=>{const i={...St};i.locale||(i.locale=Et()),i.id===Ot&&delete i.id;const t=bt();return t&&wt(t)&&(i.configuratorId="demoConfigurator"),i.customApiUrl=It.VITE_RAPI_URL,i.emails=!1,i},At="<CONF_ID>",Nt="#CONFIGURATIONID#",Lt=i=>{i.featureFlags||(i.featureFlags={}),typeof i.featureFlags.realPartList!="boolean"&&(i.featureFlags.realPartList=!0),typeof i.featureFlags.globalCallbacks!="boolean"&&(i.featureFlags.globalCallbacks=!0),typeof i.featureFlags.mocAr!="boolean"&&(i.featureFlags.mocAr=!1)},V=()=>/(android)/i.test(navigator.userAgent);class q{constructor(){h(this,"_messageHandler",null),h(this,"isSetupDone",!1),h(this,"viewName","main"),h(this,"plugins",{}),h(this,"pluginsLoaded",[]),h(this,"ui",{callbacks:null}),h(this,"extended",{callbacks:null}),h(this,"configurator",{callbacks:null}),h(this,"analytics",{callbacks:{}}),h(this,"global",{callbacks:{}})}setMessageHandler(t){this._messageHandler=t}handleSetup(t){const{methods:e,callbacks:s}=t;e.forEach(n=>{const r=n.split(C),o=r[0],a=r[1];this[o]||(this[o]={}),this[o][a]=function(){if(!this._messageHandler){console.error("MessageHandler not set");return}return this._messageHandler.sendMessage(n,[...arguments])}.bind(this)}),s.forEach(n=>{const r=n.split(C),o=r[0],a=r[1],c=r[2];this[o]||(this[o]={}),this[o][a]||(this[o][a]={}),this[o][a][c]=()=>{}}),this.isSetupDone=!0}executeMessage({message:t,args:e}){const s=t.split(C),n=s[0],r=s[1],o=s.length===3?s[2]:null;if(o&&this[n][r][o]){const a=this[n][r][o](...e);return a instanceof Promise?a.then(c=>({result:c})):a!==void 0?Promise.resolve({result:a}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}setupPlugins(t,e,s="website"){for(const n of t)typeof n=="string"&&n==="dragIn"?this.pluginsLoaded.push(new Promise((r,o)=>{try{Promise.resolve().then(()=>Ut).then(({DragIn:a})=>{const c=new a(this.ui,e,s,this.viewName);c.init().then(()=>{this.plugins.dragIn=c,r()},o)})}catch(a){o(a)}})):n.name&&n.loader&&this.pluginsLoaded.push(new Promise((r,o)=>{try{n.loader().then(a=>{const c=new a(this.ui,e,s,this.viewName);c.init().then(()=>{this.plugins[n.name]=c,r()},o)})}catch(a){o(a)}}))}}const J=()=>{let i,t;return{promise:new Promise((e,s)=>{i=e,t=s}),resolve:i,reject:t}},K=(i,t,e)=>{let s=null;Object.defineProperty(i,t,{get(){return s||e},set(n){n!=null&&n.mute?s=n.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=n)}})},Q=()=>window.innerHeight*.01+"px",Z=i=>{i&&setTimeout(()=>i.style.setProperty(R,Q()),0)},tt="rml-styles",Rt=450,R="--rml-full-height",m={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},P=new Map;class Pt extends q{constructor(t,e,s,n,r){if(super(),h(this,"_waitForIframe"),h(this,"_container"),h(this,"_configuratorSettings"),h(this,"_initData",{}),h(this,"_iframe"),!t||typeof t.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(P.has(e))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(tt)){const c=s.zIndex||9999999,l=document.createElement("style");l.type="text/css",l.id=tt;const d="transition:all ease-in-out "+Rt+"ms;",u=["-webkit-","-o-"].reduce((_,y)=>_+=y+d,"")+d,g=Q();l.innerHTML=`
|
|
2
2
|
.${m.CONTAINER}{${R}:${g};}
|
|
3
3
|
.${m.POSITION}{position:fixed;top:0;left:0;z-index:${c};opacity:0}
|
|
4
4
|
.${m.TRANSITION}{${u}}
|
|
5
5
|
.${m.FILL}{width:100%;height:100%;opacity:1}
|
|
6
6
|
.${m.ANDROID_HEIGHT}{height:calc(var(${R},1vh)*100)}
|
|
7
7
|
.${m.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
8
|
-
`,document.head.appendChild(l)}this._executeMessage=this._executeMessage.bind(this);const o=new $("website",window,null,this._executeMessage);this.setMessageHandler(o),this._onResize=this._onResize.bind(this),V()&&window.addEventListener("resize",this._onResize),this._container=e,this._initData=s,this._configuratorSettings=t;const a=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=r,this._container.appendChild(a),this._iframe=a,this.setupPlugins(n,this._iframe),P.set(e,!0)}static createPlanner(t,e,s,n=[]){return this._create(t,e,s,n)}static async connect(t,e=[]){const s=new q;s.viewName=t;const{resolve:n,promise:r}=J(),{resolve:o,promise:a}=J(),c=({message:u,args:g})=>{switch(u){case E.REGISTER_CUSTOM_VIEW_DONE:n();break;case E.RETURN_METHODS:s.handleSetup(g[0]),o();break;default:if(s.isSetupDone)return s.executeMessage({message:u,args:g})}},l=new $("custom-view-"+t,window,window.parent,c);s.setMessageHandler(l);const d=[t];return l.sendMessage(E.REGISTER_CUSTOM_VIEW,d),await r,l.sendMessage(E.GET_METHODS,d),await a,s.setupPlugins(e,document.body,"custom-view"),await Promise.allSettled(s.pluginsLoaded),s}static createConfigurator(t,e,s,n=[]){return this._create(t,e,s,n)}static create(t,e,s,n){return this._create(t,e,s,n)}static createViewer(t,e,s,n=[]){return this._create(t,e,s,n)}static async _create(t,e,s,n){return new Promise(async(r,o)=>{try{const a=
|
|
8
|
+
`,document.head.appendChild(l)}this._executeMessage=this._executeMessage.bind(this);const o=new $("website",window,null,this._executeMessage);this.setMessageHandler(o),this._onResize=this._onResize.bind(this),V()&&window.addEventListener("resize",this._onResize),this._container=e,this._initData=s,this._configuratorSettings=t;const a=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=r,this._container.appendChild(a),this._iframe=a,this.setupPlugins(n,this._iframe),P.set(e,!0)}static createPlanner(t,e,s,n=[]){return this._create(t,e,s,n)}static async connect(t,e=[]){const s=new q;s.viewName=t;const{resolve:n,promise:r}=J(),{resolve:o,promise:a}=J(),c=({message:u,args:g})=>{switch(u){case E.REGISTER_CUSTOM_VIEW_DONE:n();break;case E.RETURN_METHODS:s.handleSetup(g[0]),o();break;default:if(s.isSetupDone)return s.executeMessage({message:u,args:g})}},l=new $("custom-view-"+t,window,window.parent,c);s.setMessageHandler(l);const d=[t];return l.sendMessage(E.REGISTER_CUSTOM_VIEW,d),await r,l.sendMessage(E.GET_METHODS,d),await a,s.setupPlugins(e,document.body,"custom-view"),await Promise.allSettled(s.pluginsLoaded),s}static createConfigurator(t,e,s,n=[]){return this._create(t,e,s,n)}static create(t,e,s,n){return this._create(t,e,s,n)}static createViewer(t,e,s,n=[]){return this._create(t,e,s,n)}static async _create(t,e,s,n){return new Promise(async(r,o)=>{try{const a=N(Ct(),xt(s));Lt(a);const c=await yt(t,a);s=Mt(c,a);const l=new this(c,e,s,n,r);return await Promise.allSettled(l.pluginsLoaded),l}catch(a){return o(a)}})}teardown(){this._container&&P.delete(this._container);const t=this._container.querySelector("iframe");t&&this._container.removeChild(t),window.removeEventListener("resize",this._onResize)}_createIframe(){var t;const e=document.createElement("iframe");let s=((t=this._configuratorSettings)==null?void 0:t.url)||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(s=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(s=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(s=this._initData.overrideServerUrl),e.src=s,e.classList.add(m.CONTAINER),e.classList.add(m.FILL),e}_onResize(){Z(this._iframe)}_onUseFullPage(){this._iframe.classList.add(m.POSITION),document.documentElement.classList.add(m.OVERFLOW_HIDDEN),window.document.body.classList.add(m.OVERFLOW_HIDDEN),V()&&(Z(this._iframe),this._iframe.classList.add(m.ANDROID_HEIGHT))}_onBackToWebsite(){this._iframe.classList.remove(m.POSITION),this._iframe.classList.remove(m.ANDROID_HEIGHT),document.documentElement.classList.remove(m.OVERFLOW_HIDDEN),window.document.body.classList.remove(m.OVERFLOW_HIDDEN)}_executeMessage({message:t,args:e},s){var n;if(s.source&&s.source===((n=this._iframe)==null?void 0:n.contentWindow))return t===A.REQUEST_BOOT?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):(console.error("MessageHandler not set"),Promise.resolve({error:"MessageHandler not set"})):t===A.SETUP?(this.handleSetup(e[0]),K(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),K(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{if(!this._messageHandler){console.error("MessageHandler not set");return}this._messageHandler.sendMessage(A.WEBSITE_READY)},0),Promise.resolve({result:null})):this.executeMessage({message:t,args:e})}}class Ft{constructor(t,e,s,n){h(this,"_mainDomElement"),h(this,"_instance"),h(this,"_mode","website"),h(this,"_viewName","main"),this._instance=t,this._mainDomElement=e,this._mode=s,this._viewName=n}async init(){return Promise.resolve()}}const T="rml-drag-in-styles",I="rml-drag-in-drag-element",S="rml-drag-in-overlay",O="rml-drag-in-drag-ghost",et="rml-drag-in-fade-in",st="rml-drag-in-fade-out",F={DISPLAY_NONE:"rml-display-none"},it=.5,nt="250ms",rt="forwards",ot=`@keyframes ${et} {from{opacity: 0;}to {opacity: ${it};}}`,at=`@keyframes ${st} {from{opacity: ${it};}to {opacity: 0;}}`,lt=`${et} ${nt} ${rt}`,ht=`${st} ${nt} ${rt}`,x="https://res.cloudinary.com/roomle/image/upload/v1729679975/fallback_afpyqr.jpg",B=112,U=112;class Bt extends Ft{constructor(t,e,s,n){super(t,e,s,n),h(this,"options",{}),h(this,"_customDragSignal",new AbortController),this._mainDomElement=e,this._injectStyles(),this._initializeDragGhost()}_injectStyles(){if(!document.getElementById(T)){const t=document.createElement("style");t.type="text/css",t.id=T,t.innerHTML=`
|
|
9
9
|
.${F.DISPLAY_NONE}{display:none}
|
|
10
10
|
.${S}{position:absolute;top:0;left:0;width:100%;height:100%;z-index:999;}
|
|
11
11
|
.${O}{position:absolute;top:0;left:0;width:1px;height:1px;z-index:999;pointer-events:none;background-color:transparent;}
|