@roomle/embedding-lib 5.30.0-alpha.1 → 5.30.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 +10 -27
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/packages/embedding-lib/src/embedding-lib.d.ts +58 -9
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/default-api-options.d.ts +0 -1
- package/packages/embedding-lib/src/examples/utils/homag-intelligence/nobilia-api-options.d.ts +0 -1
- package/packages/web-sdk/packages/common-core/src/configurator-kernel-access.d.ts +6 -4
- package/packages/web-sdk/packages/common-core/src/light/light-source.d.ts +2 -0
- package/packages/web-sdk/packages/common-core/src/rapi-access.d.ts +12 -0
- package/packages/web-sdk/packages/common-core/src/utils/shims.d.ts +4 -0
- package/packages/web-sdk/packages/common-core/src/view-model/configurator-view-model.d.ts +3 -2
- package/packages/web-sdk/packages/common-core/src/webgl/roomle-component-factory.d.ts +1 -0
- package/packages/web-sdk/packages/configurator-core/src/utils/animation/animation-helper.d.ts +15 -2
- package/packages/web-sdk/packages/configurator-core/src/utils/animation/animation-value-map.d.ts +6 -4
- package/packages/web-sdk/packages/configurator-core/src/utils/animation/object-animations.d.ts +3 -1
- package/packages/web-sdk/packages/configurator-core/src/webgl/configurator-scene-manager.d.ts +4 -2
- package/packages/web-sdk/packages/homag-intelligence/src/api.d.ts +1 -1
- package/packages/web-sdk/packages/homag-intelligence/src/debug-logging.d.ts +12 -3
- package/packages/web-sdk/packages/homag-intelligence/src/emulator.d.ts +34 -7
- package/packages/web-sdk/packages/homag-intelligence/src/hi-object-selection.d.ts +39 -0
- package/packages/web-sdk/packages/homag-intelligence/src/homag-intelligence.d.ts +6 -8
- package/packages/web-sdk/packages/planner-core/src/external-object-api.d.ts +50 -20
- package/packages/web-sdk/packages/planner-core/src/roomle-planner.d.ts +37 -7
- package/packages/web-sdk/packages/planner-core/src/services/planner-kernel-access.d.ts +3 -1
- package/packages/web-sdk/packages/planner-core/src/webgl/planner-scene-event-handler.d.ts +2 -1
- package/packages/web-sdk/packages/planner-core/src/webgl/planner-scene-manager.d.ts +4 -1
- package/packages/web-sdk/packages/typings/kernel.d.ts +9 -0
- package/packages/web-sdk/packages/typings/planner-kernel-container.d.ts +1 -0
- package/packages/web-sdk/packages/typings/planner.d.ts +2 -0
- package/roomle-embedding-lib.es.js +34 -29
- package/roomle-embedding-lib.es.min.js +1 -1
- package/roomle-embedding-lib.umd.js +7 -7
- package/roomle-embedding-lib.umd.min.js +1 -1
- package/src/common/composables/use-open-close-anim.d.ts +10 -4
- package/src/common/utils/catalog-builder.d.ts +35 -0
- package/src/common/utils/dom.d.ts +1 -1
- package/src/common/utils/root-tags.d.ts +0 -6
- package/src/configurator/business-logic/sdk-connector.d.ts +3 -0
- package/src/planner/business-logic/sdk-connector-planner.d.ts +1 -0
- package/src/planner/components/catalog/CatalogNavigation.vue.d.ts +4 -0
|
@@ -22,19 +22,17 @@ export type ExternalConfigurations = Map<string, ExternalConfiguration>;
|
|
|
22
22
|
export declare class HomagIntelligence extends RmlPlugin {
|
|
23
23
|
private _roomlePlanner;
|
|
24
24
|
private _api;
|
|
25
|
-
private _masterData;
|
|
26
25
|
private _glueLogic;
|
|
27
|
-
private _articles;
|
|
28
|
-
private _scriptLoaded;
|
|
29
|
-
private _hiLibraryLoaded;
|
|
30
26
|
private _orders;
|
|
31
27
|
constructor();
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
init(roomlePlanner: RoomlePlanner, hiOptions: HomagIntelligenceInitData, hiCallbacks: HiCallbacks): Promise<this>;
|
|
29
|
+
loadLibrary(libraryId: string): Promise<void>;
|
|
30
|
+
loadCatalog(libraryId: string, articles: any, catalogCallbacks: HiTagCatalogCallbacks): Promise<void>;
|
|
31
|
+
private _loadLibraryData;
|
|
32
|
+
_requestHiLibrary(libraryId: string, hiCallbacks: HiCallbacks): Promise<{
|
|
34
33
|
masterData: MasterData;
|
|
35
|
-
|
|
34
|
+
libraryExports: any;
|
|
36
35
|
}>;
|
|
37
|
-
init(articles: any, catalogCallbacks: HiTagCatalogCallbacks, roomlePlanner: RoomlePlanner, hiOptions: HomagIntelligenceInitData, hiCallbacks: HiCallbacks): Promise<this>;
|
|
38
36
|
private _loadMasterData;
|
|
39
37
|
private _initCalcScript;
|
|
40
38
|
getGlueLogic(): GlueLogic;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PosContour } from '../../homag-intelligence/src/model/oc-scripts-domain.model';
|
|
1
|
+
import { CheckResult, PosContour } from '../../homag-intelligence/src/model/oc-scripts-domain.model';
|
|
2
2
|
|
|
3
3
|
export interface ExternalObjectUiSliderRange {
|
|
4
4
|
min: number;
|
|
@@ -39,6 +39,12 @@ export interface ExternalObjectModuleIdMap {
|
|
|
39
39
|
originalModuleId: string;
|
|
40
40
|
newModuleId: string;
|
|
41
41
|
}
|
|
42
|
+
export declare const HI_CONTEXT_ACTION: {
|
|
43
|
+
readonly NONE: "none";
|
|
44
|
+
readonly ROOM: "room";
|
|
45
|
+
readonly ISOLATION: "isolation";
|
|
46
|
+
};
|
|
47
|
+
export type HiContextAction = typeof HI_CONTEXT_ACTION[keyof typeof HI_CONTEXT_ACTION];
|
|
42
48
|
export interface ExternalObjectAPI {
|
|
43
49
|
/**
|
|
44
50
|
* With "configureExternalObjectApi" the default representation of the objects and UI and
|
|
@@ -48,11 +54,17 @@ export interface ExternalObjectAPI {
|
|
|
48
54
|
*/
|
|
49
55
|
configureExternalObjectApi(configurationJson: string | ExternalObjectApiConfiguration): Promise<void>;
|
|
50
56
|
/**
|
|
51
|
-
* "loadExternalObjectLibrary" loads
|
|
57
|
+
* "loadExternalObjectLibrary" loads and external object library.
|
|
58
|
+
* The library data is requested via the HiCallbacks.
|
|
59
|
+
* @param libraryId The library Id.
|
|
60
|
+
*/
|
|
61
|
+
loadExternalObjectLibrary(libraryId: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* "loadExternalObjectMasterData" loads the master data of a library.
|
|
52
64
|
* If master data has already been loaded for the library, it is completely replaced by the new master data.
|
|
53
65
|
* @param libraryJson The library JSON as string or object.
|
|
54
66
|
*/
|
|
55
|
-
|
|
67
|
+
loadExternalObjectMasterData(masterDataJson: string | object): void;
|
|
56
68
|
/**
|
|
57
69
|
* "loadExternalObjectGroup" loads a group of modules and places them in the plan.
|
|
58
70
|
* If the group has already been loaded, it is completely replaced by the new group.
|
|
@@ -79,6 +91,18 @@ export interface ExternalObjectAPI {
|
|
|
79
91
|
* @param attributeValue The new value of the attribute (string or boolean).
|
|
80
92
|
*/
|
|
81
93
|
updateExternalObjectGroupAttribute(rootModuleId: string, moduleId: string, attributeId: string, attributeValue: string | boolean): void;
|
|
94
|
+
/**
|
|
95
|
+
* "getExternalObjectAttributeOptions" returns the possible selection for attributes of all loaded libraries.
|
|
96
|
+
* @param module The module for which the attribute selection should be returned.
|
|
97
|
+
* @param attributeIds The IDs of the attributes. If not specified, the options for all attributes of the module are returned.
|
|
98
|
+
*/
|
|
99
|
+
getExternalObjectAttributeOptions(moduleId: string, attributeIds?: string | string[]): Promise<Record<string, CheckResult> | undefined>;
|
|
100
|
+
/**
|
|
101
|
+
* Updates the additional info of a module.
|
|
102
|
+
* @param moduleId The root module for which the additional info should be updated.
|
|
103
|
+
* @param additionalInfo The new additional info for the module.
|
|
104
|
+
*/
|
|
105
|
+
updateExternalObjectAdditionalInfo(rootModuleId: string, additionalInfo: string): void;
|
|
82
106
|
/**
|
|
83
107
|
* "renderImagesOfExternalObjectGroups" renders images of groups of modules.
|
|
84
108
|
* @param groupJson The group JSON as string or object.
|
|
@@ -87,37 +111,43 @@ export interface ExternalObjectAPI {
|
|
|
87
111
|
[key: string]: string;
|
|
88
112
|
}>;
|
|
89
113
|
/**
|
|
90
|
-
*
|
|
91
|
-
* @param groupId The ID of the group of modules.
|
|
92
|
-
* @param wasMerged Should be set to true if the group has been merged with another group (this is required to generate correct undo/redo steps).
|
|
114
|
+
* Deprecated API that can be deleted once the new API is fully integrated into the OC.
|
|
93
115
|
*/
|
|
94
116
|
removeExternalObjectGroup(groupId: string, wasMerged: boolean): void;
|
|
95
117
|
/**
|
|
96
|
-
*
|
|
97
|
-
* If the group consists of only one root module, the group is removed.
|
|
98
|
-
* @param groupId The ID of the root module.
|
|
118
|
+
* Deprecated API that can be deleted once the new API is fully integrated into the OC.
|
|
99
119
|
*/
|
|
100
120
|
removeExternalObjectRootModule(rootModuleId: string): void;
|
|
101
121
|
/**
|
|
102
|
-
* "
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
|
|
122
|
+
* "removeExternalObject" removes a group or root module from the plan.
|
|
123
|
+
* If the removed root module is located between other root modules the remaining group is split up in multiple groups.
|
|
124
|
+
* @param groupOrRootModuleId The ID of the group or root module to be removed.
|
|
125
|
+
*/
|
|
126
|
+
removeExternalObject(groupOrRootModuleId: string): void;
|
|
127
|
+
/**
|
|
128
|
+
* Deprecated API that can be deleted once the new API is fully integrated into the OC.
|
|
106
129
|
*/
|
|
107
130
|
selectExternalObjectGroup(groupId: string): Promise<void>;
|
|
108
131
|
/**
|
|
109
|
-
*
|
|
110
|
-
* The function selects a root module within a group and always switches to planning mode.
|
|
111
|
-
* @param rootModuleId The ID of the root module.
|
|
132
|
+
* Deprecated API that can be deleted once the new API is fully integrated into the OC.
|
|
112
133
|
*/
|
|
113
134
|
selectExternalObjectRootModule(rootModuleId: string): Promise<void>;
|
|
114
135
|
/**
|
|
115
|
-
*
|
|
116
|
-
* The function selects a sub module a root module and always switches to configuration mode.
|
|
117
|
-
* @param rootModuleId The ID of the root module.
|
|
118
|
-
* @param subModuleId The ID of the sub module.
|
|
136
|
+
* Deprecated API that can be deleted once the new API is fully integrated into the OC.
|
|
119
137
|
*/
|
|
120
138
|
selectExternalObjectSubModule(rootModuleId: string, subModuleId: string): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* "selectExternalObject" changes the selected object in the scene.
|
|
141
|
+
* The function selects either a complete group of root modules or a single root module or a single sub module.
|
|
142
|
+
* If the contextAction is set the function switches to the defined context.
|
|
143
|
+
* In isolation mode and shows only the group which belongs to the selected object.
|
|
144
|
+
* If the scene is already in isolation mode and a group is selected, the group in the object in the scene is replaced by the newly selected group.
|
|
145
|
+
* If a sub module is selected, the isolation mode is always activated.
|
|
146
|
+
* @param groupOrRootModuleId The ID of the group or root module that should be selected.
|
|
147
|
+
* @param subModuleId The optional ID of the sub module that should be selected.
|
|
148
|
+
* @param contextAction The context action defines whether the selection is done in room context or isolation context or no context change is done.
|
|
149
|
+
*/
|
|
150
|
+
selectExternalObject(groupOrRootModuleId: string, subModuleId: string | null, contextAction: HiContextAction): Promise<void>;
|
|
121
151
|
/**
|
|
122
152
|
* "openOrCloseGeometryOfExternalObject" switches the geometry of the modules between closed and open representation.
|
|
123
153
|
* The function can switch the geometry of the group or the singe root module with the ID "groupIdOrRootModuleId".
|
|
@@ -21,7 +21,7 @@ import { default as PlanElementViewModel } from '../../common-core/src/view-mode
|
|
|
21
21
|
import { default as WallPlanElementViewModel } from './view-model/wall-plan-element-view-model';
|
|
22
22
|
import { default as ConfiguratorContext } from '../../common-core/src/webgl/configurator-context';
|
|
23
23
|
import { default as IdbManager } from '../../common-core/src/services/idb-manager';
|
|
24
|
-
import { ExternalObjectAPI, ExternalObjectApiConfiguration, ExternalObjectModuleIdMap, ExternalRoomInformation } from './external-object-api';
|
|
24
|
+
import { ExternalObjectAPI, ExternalObjectApiConfiguration, ExternalObjectModuleIdMap, ExternalRoomInformation, HiContextAction } from './external-object-api';
|
|
25
25
|
import { GlobalCallback } from '../../common-core/src/services/global-callback';
|
|
26
26
|
import { ExternalGroupData, ExternalObject, ExtObjId } from '../../typings/external-objects';
|
|
27
27
|
import { PluginName } from '../../configurator-core/src/utils/plugin-types';
|
|
@@ -29,10 +29,12 @@ import { Nullable } from '../../typings/helper';
|
|
|
29
29
|
import { MaybePromise } from '../../common-core/src/utils/common-utils';
|
|
30
30
|
import { HomagIntelligence } from '../../homag-intelligence/src/homag-intelligence';
|
|
31
31
|
import { RoomleLightSource } from '../../common-core/src/light/light-source';
|
|
32
|
-
import {
|
|
32
|
+
import { AnimationKeyAndValue } from '../../configurator-core/src/utils/animation/animation-value-map';
|
|
33
|
+
import { CheckResult } from '../../homag-intelligence/src/model/oc-scripts-domain.model';
|
|
33
34
|
|
|
34
35
|
export type ID_TYPE = 'rml_id' | 'tc_id' | 'rml_serialized' | 'tc_serialized';
|
|
35
36
|
export declare const EXT_OBJ_EXCEPTION = "Could not retrieve configuration for external object! Did you implement onGetConfigurationForExternalObject?";
|
|
37
|
+
export declare const OPEN_CLOSE_ANIMATION_KEY = "openClose";
|
|
36
38
|
export interface RoomlePlannerCallback {
|
|
37
39
|
switchToConfigurator: () => Promise<Configurator>;
|
|
38
40
|
switchToViewer: () => Promise<GlbViewer>;
|
|
@@ -433,26 +435,46 @@ export default class RoomlePlanner<P extends readonly PluginName[] = readonly []
|
|
|
433
435
|
disableEvents(): void;
|
|
434
436
|
downloadHomagIxExportPoC(): Promise<any>;
|
|
435
437
|
configureExternalObjectApi(configurationJson: string | ExternalObjectApiConfiguration): Promise<void>;
|
|
436
|
-
loadExternalObjectLibrary(
|
|
438
|
+
loadExternalObjectLibrary(libraryId: string): Promise<void>;
|
|
439
|
+
loadExternalObjectMasterData(masterDataJson: string | object): void;
|
|
437
440
|
loadExternalObjectGroup(groupData: ExternalGroupData, findFreeSpaceInPlan: boolean, correctArrangement?: boolean, mergedGroups?: string[], respondWithPositionInPlan?: boolean, moduleIdMap?: ExternalObjectModuleIdMap[]): Promise<void>;
|
|
438
441
|
private _loadExternalObjectGroup;
|
|
439
442
|
private _loadExternalObjectGroupInConfigurator;
|
|
440
443
|
private _loadExternalObjectGroupInPlanner;
|
|
441
444
|
private _updateExternalObjectRootModuleSelection;
|
|
442
445
|
private _loadOrUpdateExternalObjectGroup;
|
|
443
|
-
updateExternalObjectGroupAttribute(rootModuleId: string, moduleId: string, attributeId: string, attributeValue: string | boolean): void
|
|
446
|
+
updateExternalObjectGroupAttribute(rootModuleId: string, moduleId: string, attributeId: string, attributeValue: string | boolean): Promise<void>;
|
|
447
|
+
getExternalObjectAttributeOptions(moduleId: string, attributeIds?: string | string[]): Promise<Record<string, CheckResult> | undefined>;
|
|
448
|
+
updateExternalObjectAdditionalInfo(rootModuleId: string, additionalInfo: string): Promise<void>;
|
|
444
449
|
private _createSerializedGroupCollection;
|
|
445
450
|
private _getFaceTheCameraAngle;
|
|
446
451
|
renderImagesOfExternalObjectGroup(groups: object): Promise<{
|
|
447
452
|
[key: string]: string;
|
|
448
453
|
}>;
|
|
449
|
-
|
|
454
|
+
/**
|
|
455
|
+
* Deprecated API that can be deleted once the new API is fully integrated into the OC.
|
|
456
|
+
*/
|
|
457
|
+
removeExternalObjectGroup(groupId: string, _wasMerged?: boolean): void;
|
|
458
|
+
/**
|
|
459
|
+
* Deprecated API that can be deleted once the new API is fully integrated into the OC.
|
|
460
|
+
*/
|
|
450
461
|
removeExternalObjectRootModule(rootModuleId: string): void;
|
|
462
|
+
removeExternalObject(groupOrRootModuleId: string): void;
|
|
463
|
+
/**
|
|
464
|
+
* Deprecated API that can be deleted once the new API is fully integrated into the OC.
|
|
465
|
+
*/
|
|
451
466
|
selectExternalObjectGroup(groupId: string): Promise<void>;
|
|
467
|
+
/**
|
|
468
|
+
* Deprecated API that can be deleted once the new API is fully integrated into the OC.
|
|
469
|
+
*/
|
|
452
470
|
selectExternalObjectRootModule(rootModuleId: string): Promise<void>;
|
|
471
|
+
/**
|
|
472
|
+
* Deprecated API that can be deleted once the new API is fully integrated into the OC.
|
|
473
|
+
*/
|
|
453
474
|
selectExternalObjectSubModule(rootModuleId: string, subModuleId: string): Promise<void>;
|
|
475
|
+
selectExternalObject(groupOrRootModuleId: string, subModuleId: string | null, contextAction: HiContextAction): Promise<void>;
|
|
476
|
+
private _switchExternalObjectMode;
|
|
454
477
|
openOrCloseGeometryOfExternalObject(groupIdOrRootModuleId: string, _subModuleId: string | null, open: boolean, animate: boolean): void;
|
|
455
|
-
private _selectKernelComponent;
|
|
456
478
|
_selectExternalObjectGroup(groupId: string, switchToPlanner: boolean): Promise<void>;
|
|
457
479
|
_selectExternalObjectModule(rootModuleId: string, subModuleId: string | null, selectPlanObject: boolean, switchToConfigurator: boolean, selectComponent: boolean, highlightSelection: boolean): Promise<void>;
|
|
458
480
|
private _selectPlanObject;
|
|
@@ -560,5 +582,13 @@ export default class RoomlePlanner<P extends readonly PluginName[] = readonly []
|
|
|
560
582
|
getOrderManagerGroupData(planId?: string): Promise<any>;
|
|
561
583
|
getRapiAccess(): RapiAccess;
|
|
562
584
|
canElementBeDeleted(planElement: PlanElementViewModel): boolean;
|
|
563
|
-
|
|
585
|
+
getElementOpenCloseAnimation(planElement: PlanElementViewModel): AnimationKeyAndValue | null;
|
|
586
|
+
/**
|
|
587
|
+
* Sets up the Homag Intelligence module
|
|
588
|
+
* This is done by default when the planner is initialized with HI data
|
|
589
|
+
* or when loading an external object library
|
|
590
|
+
*/
|
|
591
|
+
setupHomagIntelligence(): Promise<void>;
|
|
592
|
+
private _loadHomagIntelligenceArticles;
|
|
593
|
+
sidebarHasChanged(viewName: string): void;
|
|
564
594
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KernelComponent, KernelEnum, RuntimeId, PlanObject as ConfiguratorPlanObject } from '../../../typings/kernel';
|
|
1
|
+
import { KernelAnimation, KernelComponent, KernelEnum, RuntimeId, PlanObject as ConfiguratorPlanObject } from '../../../typings/kernel';
|
|
2
2
|
import { default as PlanObjectViewModel } from '../../../common-core/src/view-model/plan-object-view-model';
|
|
3
3
|
import { KernelObject, Plan, PlanElement, PlanInteractionHandler, PlanModelViewHelper, PlanObject } from '../../../typings/planner';
|
|
4
4
|
import { RapiConfiguration, RapiItem, RapiPlanSnapshotPostData } from '../../../typings/rapi-types';
|
|
@@ -8,6 +8,7 @@ import { Position3 } from '../../../common-core/src/common-interfaces';
|
|
|
8
8
|
import { default as ConfiguratorKernelAccess } from '../../../common-core/src/configurator-kernel-access';
|
|
9
9
|
import { ExternalObjectApiConfiguration } from '../external-object-api';
|
|
10
10
|
import { ExternalObjectGroup } from '../external-object-api-callbacks';
|
|
11
|
+
import { AnimationLevelType } from '../../../configurator-core/src/utils/animation/animation-helper';
|
|
11
12
|
|
|
12
13
|
export interface PlannerKernelCallbackI {
|
|
13
14
|
handlerSwitchedPlans(fromPlan: Plan, toPlan: Plan): void;
|
|
@@ -113,4 +114,5 @@ export default class PlannerKernelAccess extends ConfiguratorKernelAccess {
|
|
|
113
114
|
dockExternalObjectComponent(parentId: number, parentDockId: number, childId: number, childDockId: number): void;
|
|
114
115
|
configureExternalObjectApi(externalObjectSettings?: ExternalObjectApiConfiguration): Promise<void>;
|
|
115
116
|
setComponentParameter(componentId: number, interactionKey: string, newValue: any): void;
|
|
117
|
+
protected _getAnimationLevelForObject(runtimeId: number, _animation: KernelAnimation): AnimationLevelType;
|
|
116
118
|
}
|
|
@@ -142,8 +142,9 @@ export default class PlannerSceneEventHandler extends SceneEventHandler<SceneEve
|
|
|
142
142
|
enableAdvancedDocking(): void;
|
|
143
143
|
disableAdvancedDocking(): void;
|
|
144
144
|
showsChildrenOfPlanObject(object: KernelObject): boolean;
|
|
145
|
-
enableShowChildrenOfPlanObject(object: KernelObject): KernelObject | null;
|
|
145
|
+
enableShowChildrenOfPlanObject(object: KernelObject, switchChildModeOffForAllOtherObjects?: boolean): KernelObject | null;
|
|
146
146
|
disableShowChildrenOfPlanObject(object: KernelObject): KernelObject | null;
|
|
147
|
+
disableShowChildrenOfAllPlanObjects(): void;
|
|
147
148
|
private _checkRaycasterSnapping;
|
|
148
149
|
enableWallDrawing(): Group;
|
|
149
150
|
cancelWallDrawing(): Group;
|
|
@@ -22,6 +22,7 @@ import { default as PlannerFpCameraBehaviour } from '../../../common-core/src/ca
|
|
|
22
22
|
import { EMSConstant } from '../../../typings/planner-kernel-container';
|
|
23
23
|
import { default as InitData } from '../../../common-core/src/utils/init-data';
|
|
24
24
|
import { RoomleLightSource } from '../../../common-core/src/light/light-source';
|
|
25
|
+
import { HomagIntelligence } from '../../../homag-intelligence/src/homag-intelligence';
|
|
25
26
|
|
|
26
27
|
export declare function isLockedElement(planElementViewModel: PlanElementViewModel, initData: InitData): boolean;
|
|
27
28
|
declare const SET_WALL_MATERIAL_TYPE: {
|
|
@@ -36,6 +37,7 @@ export default class PlannerSceneManager extends ConfiguratorSceneManager implem
|
|
|
36
37
|
private _localStorageHelper;
|
|
37
38
|
private _plannerSceneEventHandler;
|
|
38
39
|
private _roomlePlannerCallback;
|
|
40
|
+
private _homagIntelligence;
|
|
39
41
|
private _itemsLoadingStatePromises;
|
|
40
42
|
private _sky;
|
|
41
43
|
private _drawingEnabled;
|
|
@@ -53,6 +55,7 @@ export default class PlannerSceneManager extends ConfiguratorSceneManager implem
|
|
|
53
55
|
private _planElementHighlighter;
|
|
54
56
|
private _debugSpheres;
|
|
55
57
|
constructor(creator: string, offset: CanvasOffset, plannerCallback: RoomlePlannerCallback, mode: Enumify<typeof CAMERA_TYPE>);
|
|
58
|
+
setHomagIntelligence(homagIntelligence: HomagIntelligence): void;
|
|
56
59
|
get configuratorContext(): import('../../../common-core/src/webgl/configurator-context').default;
|
|
57
60
|
get hasSingleRoom(): boolean;
|
|
58
61
|
getScenePlanElementLightSources(): RoomleLightSource[];
|
|
@@ -215,7 +218,7 @@ export default class PlannerSceneManager extends ConfiguratorSceneManager implem
|
|
|
215
218
|
setMeasurementLineLength(measurementId: number, length: number, wallDirection: string): void;
|
|
216
219
|
protected setEventHandlerObject(object: Object3D): void;
|
|
217
220
|
protected _readyForRender(): void;
|
|
218
|
-
protected notifyPlannerOnComponentSelectionCancel(
|
|
221
|
+
protected notifyPlannerOnComponentSelectionCancel(isExternalObject: boolean, reason: CancelSelectionReasons): void;
|
|
219
222
|
private _externalPlanObjectSelectionChanged;
|
|
220
223
|
highlightExternalObject(planObjectComponent: KernelPlanObjectComponent): void;
|
|
221
224
|
private _selectExternalObjectModule;
|
|
@@ -283,6 +283,14 @@ export interface EmscriptenMap<K, V> {
|
|
|
283
283
|
export interface KernelComponentTypeDto {
|
|
284
284
|
value: Enumify<typeof CORE_PLAN_COMPONENT_TYPE_DTO>;
|
|
285
285
|
}
|
|
286
|
+
export interface AnimationTransformation {
|
|
287
|
+
animationMatrix: KernelMatrix4;
|
|
288
|
+
key: string;
|
|
289
|
+
}
|
|
290
|
+
export interface ComponentAnimationTransformation {
|
|
291
|
+
animations: AnimationTransformation[];
|
|
292
|
+
componentRuntimeId: number;
|
|
293
|
+
}
|
|
286
294
|
export interface KernelComponent {
|
|
287
295
|
[key: string]: any;
|
|
288
296
|
externalComponent: boolean;
|
|
@@ -313,6 +321,7 @@ export interface KernelComponent {
|
|
|
313
321
|
dimensioningAxes: DimensioningAxis[];
|
|
314
322
|
dimensionings: Dimensioning[];
|
|
315
323
|
animations: KernelAnimation[];
|
|
324
|
+
childAnimationTransformations: ComponentAnimationTransformation[];
|
|
316
325
|
}
|
|
317
326
|
export interface Dimensioning {
|
|
318
327
|
axis: string;
|
|
@@ -354,12 +354,14 @@ export interface KernelWallMaterial extends KernelObject {
|
|
|
354
354
|
catalogItemId: string;
|
|
355
355
|
materialId: string;
|
|
356
356
|
rgbValue: number;
|
|
357
|
+
useCustomColor: boolean;
|
|
357
358
|
}
|
|
358
359
|
export interface KernelFloorMaterial extends KernelObject {
|
|
359
360
|
catalogItemId: string;
|
|
360
361
|
materialId: string;
|
|
361
362
|
rgbValue: number;
|
|
362
363
|
rotation: number;
|
|
364
|
+
useCustomColor: boolean;
|
|
363
365
|
}
|
|
364
366
|
export declare const enum KernelWallType {
|
|
365
367
|
StandAloneWall = 0,
|
|
@@ -108,8 +108,8 @@ class H {
|
|
|
108
108
|
* Copyright 2019 Google LLC
|
|
109
109
|
* SPDX-License-Identifier: Apache-2.0
|
|
110
110
|
*/
|
|
111
|
-
const
|
|
112
|
-
canHandle: (e) => G(e) && e[
|
|
111
|
+
const B = Symbol("Comlink.proxy"), X = Symbol("Comlink.endpoint"), j = Symbol("Comlink.releaseProxy"), T = Symbol("Comlink.finalizer"), w = Symbol("Comlink.thrown"), G = (e) => typeof e == "object" && e !== null || typeof e == "function", Z = {
|
|
112
|
+
canHandle: (e) => G(e) && e[B],
|
|
113
113
|
serialize(e) {
|
|
114
114
|
const { port1: t, port2: s } = new MessageChannel();
|
|
115
115
|
return P(e, t), [s, [s]];
|
|
@@ -188,7 +188,7 @@ function P(e, t = globalThis, s = ["*"]) {
|
|
|
188
188
|
}
|
|
189
189
|
Promise.resolve(l).catch((u) => ({ value: u, [w]: 0 })).then((u) => {
|
|
190
190
|
const [g, d] = S(u);
|
|
191
|
-
t.postMessage(Object.assign(Object.assign({}, g), { id: o }), d), a === "RELEASE" && (t.removeEventListener("message", r), V(t),
|
|
191
|
+
t.postMessage(Object.assign(Object.assign({}, g), { id: o }), d), a === "RELEASE" && (t.removeEventListener("message", r), V(t), T in e && typeof e[T] == "function" && e[T]());
|
|
192
192
|
}).catch((u) => {
|
|
193
193
|
const [g, d] = S({
|
|
194
194
|
value: new TypeError("Unserializable return value"),
|
|
@@ -310,7 +310,7 @@ function ae(e, t) {
|
|
|
310
310
|
return $.set(e, t), e;
|
|
311
311
|
}
|
|
312
312
|
function ce(e) {
|
|
313
|
-
return Object.assign(e, { [
|
|
313
|
+
return Object.assign(e, { [B]: !0 });
|
|
314
314
|
}
|
|
315
315
|
function S(e) {
|
|
316
316
|
for (const [t, s] of z)
|
|
@@ -350,7 +350,7 @@ function p(e, t, s, r) {
|
|
|
350
350
|
function le() {
|
|
351
351
|
return new Array(4).fill(0).map(() => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(16)).join("-");
|
|
352
352
|
}
|
|
353
|
-
const
|
|
353
|
+
const A = ".", M = {
|
|
354
354
|
REQUEST_BOOT: "requestBoot",
|
|
355
355
|
SETUP: "setup",
|
|
356
356
|
WEBSITE_READY: "websiteReady"
|
|
@@ -457,8 +457,8 @@ const _e = (e) => JSON.parse(JSON.stringify(e)), Ee = {
|
|
|
457
457
|
rotationSnapDegrees: 10,
|
|
458
458
|
interactionsCollapsed: !1
|
|
459
459
|
}, we = "(idle)", ye = (e) => (I(e), e?.customApiUrl && (e.customApiUrl = decodeURIComponent(e.customApiUrl)), e.shareUrl && (e.deeplink = e.shareUrl.replace(
|
|
460
|
-
|
|
461
|
-
|
|
460
|
+
Te,
|
|
461
|
+
Ae
|
|
462
462
|
)), e), I = (e) => {
|
|
463
463
|
if (!e)
|
|
464
464
|
return;
|
|
@@ -479,10 +479,10 @@ const _e = (e) => JSON.parse(JSON.stringify(e)), Ee = {
|
|
|
479
479
|
e.locale || (e.locale = me()), e.id === we && delete e.id;
|
|
480
480
|
const t = fe();
|
|
481
481
|
return t && he(t) && (e.configuratorId = "demoConfigurator"), e.customApiUrl = void 0, e.emails = !1, e;
|
|
482
|
-
},
|
|
482
|
+
}, Te = "<CONF_ID>", Ae = "#CONFIGURATIONID#", Me = (e) => {
|
|
483
483
|
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);
|
|
484
|
-
},
|
|
485
|
-
class
|
|
484
|
+
}, D = () => /(android)/i.test(navigator.userAgent);
|
|
485
|
+
class x {
|
|
486
486
|
_messageHandler = null;
|
|
487
487
|
isSetupDone = !1;
|
|
488
488
|
viewName = "main";
|
|
@@ -512,7 +512,7 @@ class D {
|
|
|
512
512
|
handleSetup(t) {
|
|
513
513
|
const { methods: s, callbacks: r } = t;
|
|
514
514
|
s.forEach((n) => {
|
|
515
|
-
const o = n.split(
|
|
515
|
+
const o = n.split(A), a = o[0], i = o[1];
|
|
516
516
|
this[a] || (this[a] = {}), this[a][i] = (function() {
|
|
517
517
|
if (!this._messageHandler) {
|
|
518
518
|
console.error("MessageHandler not set");
|
|
@@ -521,13 +521,13 @@ class D {
|
|
|
521
521
|
return this._messageHandler.sendMessage(n, [...arguments]);
|
|
522
522
|
}).bind(this);
|
|
523
523
|
}), r.forEach((n) => {
|
|
524
|
-
const o = n.split(
|
|
524
|
+
const o = n.split(A), a = o[0], i = o[1], c = o[2];
|
|
525
525
|
this[a] || (this[a] = {}), this[a][i] || (this[a][i] = {}), this[a][i][c] = () => {
|
|
526
526
|
};
|
|
527
527
|
}), this.isSetupDone = !0;
|
|
528
528
|
}
|
|
529
529
|
executeMessage({ message: t, args: s }) {
|
|
530
|
-
const r = t.split(
|
|
530
|
+
const r = t.split(A), n = r[0], o = r[1], a = r.length === 3 ? r[2] : null;
|
|
531
531
|
if (a && this[n][o][a]) {
|
|
532
532
|
const i = this[n][o][a](
|
|
533
533
|
...s
|
|
@@ -601,14 +601,14 @@ const k = () => {
|
|
|
601
601
|
() => e.style.setProperty(N, q()),
|
|
602
602
|
0
|
|
603
603
|
);
|
|
604
|
-
},
|
|
604
|
+
}, W = "rml-styles", Re = 450, N = "--rml-full-height", f = {
|
|
605
605
|
CONTAINER: "rml-container",
|
|
606
606
|
FILL: "rml-fill",
|
|
607
607
|
POSITION: "rml-pos",
|
|
608
608
|
TRANSITION: "rml-transition",
|
|
609
609
|
ANDROID_HEIGHT: "rml-android-height",
|
|
610
610
|
OVERFLOW_HIDDEN: "rml-overflow-hidden"
|
|
611
|
-
},
|
|
611
|
+
}, R = /* @__PURE__ */ new Map(), be = (e) => {
|
|
612
612
|
const t = {
|
|
613
613
|
/**
|
|
614
614
|
* The 'get' trap is fired when a property is accessed on the proxy.
|
|
@@ -627,8 +627,12 @@ const k = () => {
|
|
|
627
627
|
}
|
|
628
628
|
};
|
|
629
629
|
return new Proxy(e, t);
|
|
630
|
+
}, Ie = {
|
|
631
|
+
HIDE: "hide",
|
|
632
|
+
SHOW_ATTRIBUTES: "attributes",
|
|
633
|
+
SHOW_ARTICLES: "articles"
|
|
630
634
|
};
|
|
631
|
-
class
|
|
635
|
+
class Ne extends x {
|
|
632
636
|
static createPlanner(t, s, r, n = []) {
|
|
633
637
|
return this._create(
|
|
634
638
|
t,
|
|
@@ -638,7 +642,7 @@ class Ie extends D {
|
|
|
638
642
|
);
|
|
639
643
|
}
|
|
640
644
|
static async connect(t, s = []) {
|
|
641
|
-
const r = new
|
|
645
|
+
const r = new x();
|
|
642
646
|
r.viewName = t;
|
|
643
647
|
const { resolve: n, promise: o } = k(), { resolve: a, promise: i } = k(), c = ({
|
|
644
648
|
message: g,
|
|
@@ -730,7 +734,7 @@ class Ie extends D {
|
|
|
730
734
|
Se(),
|
|
731
735
|
ye(r)
|
|
732
736
|
);
|
|
733
|
-
|
|
737
|
+
Me(i);
|
|
734
738
|
const c = await ue(
|
|
735
739
|
t,
|
|
736
740
|
i
|
|
@@ -759,12 +763,12 @@ class Ie extends D {
|
|
|
759
763
|
throw new Error(
|
|
760
764
|
"Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person"
|
|
761
765
|
);
|
|
762
|
-
if (
|
|
766
|
+
if (R.has(s))
|
|
763
767
|
throw new Error("There is already an instance on this DOM element");
|
|
764
|
-
if (!!!document.getElementById(
|
|
768
|
+
if (!!!document.getElementById(W)) {
|
|
765
769
|
const l = r.zIndex || 9999999, u = document.createElement("style");
|
|
766
|
-
u.type = "text/css", u.id =
|
|
767
|
-
const g = "transition:all ease-in-out " +
|
|
770
|
+
u.type = "text/css", u.id = W;
|
|
771
|
+
const g = "transition:all ease-in-out " + Re + "ms;", d = ["-webkit-", "-o-"].reduce(
|
|
768
772
|
(K, Q) => K += Q + g,
|
|
769
773
|
""
|
|
770
774
|
) + g, h = q();
|
|
@@ -784,12 +788,12 @@ class Ie extends D {
|
|
|
784
788
|
null,
|
|
785
789
|
this._executeMessage
|
|
786
790
|
);
|
|
787
|
-
this.setMessageHandler(i), this._onResize = this._onResize.bind(this),
|
|
791
|
+
this.setMessageHandler(i), this._onResize = this._onResize.bind(this), D() && window.addEventListener("resize", this._onResize), this._container = s, this._initData = r, this._configuratorSettings = t;
|
|
788
792
|
const c = this._createIframe();
|
|
789
|
-
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = o, this._container.appendChild(c), this._iframe = c, this.setupPlugins(n, this._iframe),
|
|
793
|
+
this._onUseFullPage = this._onUseFullPage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._waitForIframe = o, this._container.appendChild(c), this._iframe = c, this.setupPlugins(n, this._iframe), R.set(s, !0);
|
|
790
794
|
}
|
|
791
795
|
teardown() {
|
|
792
|
-
this._container &&
|
|
796
|
+
this._container && R.delete(this._container);
|
|
793
797
|
const t = this._container.querySelector("iframe");
|
|
794
798
|
t && this._container.removeChild(t), window.removeEventListener("resize", this._onResize);
|
|
795
799
|
}
|
|
@@ -802,14 +806,14 @@ class Ie extends D {
|
|
|
802
806
|
U(this._iframe);
|
|
803
807
|
}
|
|
804
808
|
_onUseFullPage() {
|
|
805
|
-
this._iframe.classList.add(f.POSITION), document.documentElement.classList.add(f.OVERFLOW_HIDDEN), window.document.body.classList.add(f.OVERFLOW_HIDDEN),
|
|
809
|
+
this._iframe.classList.add(f.POSITION), document.documentElement.classList.add(f.OVERFLOW_HIDDEN), window.document.body.classList.add(f.OVERFLOW_HIDDEN), D() && (U(this._iframe), this._iframe.classList.add(f.ANDROID_HEIGHT));
|
|
806
810
|
}
|
|
807
811
|
_onBackToWebsite() {
|
|
808
812
|
this._iframe.classList.remove(f.POSITION), this._iframe.classList.remove(f.ANDROID_HEIGHT), document.documentElement.classList.remove(f.OVERFLOW_HIDDEN), window.document.body.classList.remove(f.OVERFLOW_HIDDEN);
|
|
809
813
|
}
|
|
810
814
|
_executeMessage({ message: t, args: s }, r) {
|
|
811
815
|
if (r.source && r.source === this._iframe?.contentWindow)
|
|
812
|
-
return t ===
|
|
816
|
+
return t === M.REQUEST_BOOT ? this._messageHandler ? (this._messageHandler.setOutgoingMessageBus(r.source), Promise.resolve({ result: this._initData })) : (console.error("MessageHandler not set"), Promise.resolve({ error: "MessageHandler not set" })) : t === M.SETUP ? (this.handleSetup(s[0]), F(
|
|
813
817
|
this.ui.callbacks,
|
|
814
818
|
"onUseFullPage",
|
|
815
819
|
this._onUseFullPage
|
|
@@ -822,10 +826,11 @@ class Ie extends D {
|
|
|
822
826
|
console.error("MessageHandler not set");
|
|
823
827
|
return;
|
|
824
828
|
}
|
|
825
|
-
this._messageHandler.sendMessage(
|
|
829
|
+
this._messageHandler.sendMessage(M.WEBSITE_READY);
|
|
826
830
|
}, 0), Promise.resolve({ result: null })) : this.executeMessage({ message: t, args: s });
|
|
827
831
|
}
|
|
828
832
|
}
|
|
829
833
|
export {
|
|
830
|
-
Ie as
|
|
834
|
+
Ie as HI_PANEL_ACTION,
|
|
835
|
+
Ne as default
|
|
831
836
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class e{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,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,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const n=new MessageChannel;n.port1.onmessage=e=>{if(!e||!e.data)return n.port1.close(),n.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return n.port1.close(),n.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),n.port1.close(),n.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[n.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&("string"==typeof e.data||"connect_hi"!==e.data.type)&&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 r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const t=Symbol("Comlink.proxy"),s=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),i=e=>"object"==typeof e&&null!==e||"function"==typeof e,o=new Map([["proxy",{canHandle:e=>i(e)&&e[t],serialize(e){const{port1:t,port2:s}=new MessageChannel;return l(e,t),[s,[s]]},deserialize:e=>(e.start(),function(e){const t=new Map;return e.addEventListener("message",function(e){const{data:s}=e;if(!s||!s.id)return;const r=t.get(s.id);if(r)try{r(s)}finally{t.delete(s.id)}}),m(e,t,[],void 0)}(e))}],["throw",{canHandle:e=>i(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function l(e,s=globalThis,r=["*"]){s.addEventListener("message",function i(o){if(!o||!o.data)return;if(!function(e,t){for(const s of e)if(t===s||"*"===s||s instanceof RegExp&&s.test(t))return!0;return!1}(r,o.origin))return;const{id:u,type:g,path:d}=Object.assign({path:[]},o.data),h=(o.data.argumentList||[]).map(y);let m;try{const s=d.slice(0,-1).reduce((e,t)=>e[t],e),r=d.reduce((e,t)=>e[t],e);switch(g){case"GET":m=r;break;case"SET":s[d.slice(-1)[0]]=y(o.data.value),m=!0;break;case"APPLY":m=r.apply(s,h);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[t]:!0})}(new r(...h));break;case"ENDPOINT":{const{port1:t,port2:s}=new MessageChannel;l(e,s),m=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch(e=>({value:e,[a]:0})).then(t=>{const[r,a]=_(t);s.postMessage(Object.assign(Object.assign({},r),{id:u}),a),"RELEASE"===g&&(s.removeEventListener("message",i),c(s),n in e&&"function"==typeof e[n]&&e[n]())}).catch(e=>{const[t,r]=_({value:new TypeError("Unserializable return value"),[a]:0});s.postMessage(Object.assign(Object.assign({},t),{id:u}),r)})}),s.start&&s.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function g(e){return b(e,new Map,{type:"RELEASE"}).then(()=>{c(e)})}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(d.get(e)||0)-1;d.set(e,t),0===t&&g(e)});function m(e,t,n=[],a=function(){}){let i=!1;const o=new Proxy(a,{get(s,a){if(u(i),a===r)return()=>{(function(e){h&&h.unregister(e)})(o),g(e),t.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const s=b(e,t,{type:"GET",path:n.map(e=>e.toString())}).then(y);return s.then.bind(s)}return m(e,t,[...n,a])},set(s,r,a){u(i);const[o,l]=_(a);return b(e,t,{type:"SET",path:[...n,r].map(e=>e.toString()),value:o},l).then(y)},apply(r,a,o){u(i);const l=n[n.length-1];if(l===s)return b(e,t,{type:"ENDPOINT"}).then(y);if("bind"===l)return m(e,t,n.slice(0,-1));const[c,g]=f(o);return b(e,t,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:c},g).then(y)},construct(s,r){u(i);const[a,o]=f(r);return b(e,t,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:a},o).then(y)}});return function(e,t){const s=(d.get(t)||0)+1;d.set(t,s),h&&h.register(e,t,e)}(o,e),o}function p(e){return Array.prototype.concat.apply([],e)}function f(e){const t=e.map(_);return[t.map(e=>e[0]),p(t.map(e=>e[1]))]}const w=new WeakMap;function _(e){for(const[t,s]of o)if(s.canHandle(e)){const[r,n]=s.serialize(e);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:e},w.get(e)||[]]}function y(e){switch(e.type){case"HANDLER":return o.get(e.name).deserialize(e.value);case"RAW":return e.value}}function b(e,t,s,r){return new Promise(n=>{const a=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(a,n),e.start&&e.start(),e.postMessage(Object.assign({id:a},s),r)})}const v=["127.0.0.1","localhost","0.0.0.0"],M=["language","browserLanguage","userLanguage","systemLanguage"],E=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=E(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var S=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(S||{});const P={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[S.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},O=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&O(t),Array.isArray(t))for(const e of t)O(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},L=()=>/(android)/i.test(navigator.userAgent);class T{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split("."),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split("."),s=t[0],r=t[1],n=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][n]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],n=s[1],a=3===s.length?s[2]:null;if(a&&this[r][n][a]){const e=this[r][n][a](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./drag-in-BmoiEqfA.mjs").then(e=>e.l).then(({DragIn:n})=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,n)=>{try{r.loader().then(a=>{const i=new a(this.ui,t,s,this.viewName);i.init().then(()=>{this.plugins[r.name]=i,e()},n)})}catch(e){n(e)}}))}}const A=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},k=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},N=()=>.01*window.innerHeight+"px",R=e=>{e&&setTimeout(()=>e.style.setProperty(I,N()),0)},C="rml-styles",I="--rml-full-height",x="rml-container",B="rml-fill",D="rml-pos",U="rml-android-height",F="rml-overflow-hidden",H=new Map;class j extends T{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(t,s=[]){const r=new T;r.viewName=t;const{resolve:n,promise:a}=A(),{resolve:i,promise:o}=A(),l=new e("custom-view-"+t,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":n();break;case"returnMethods":r.handleSetup(t[0]),i();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(l);const c=[t];return l.sendMessage("registerCustomView",c),await a,l.sendMessage("getMethods",c),await o,r.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static setupHi(e){window.addEventListener("message",t=>{if("connect_hi"===t.data.type&&t.data.port){const s=t.data.port;s.start?.(),l(new Proxy(e,{get(e,t,s){const r=Reflect.get(e,t,s);return void 0!==r?r:(...e)=>{}}}),s)}})}static async _create(e,t,s,r){return new Promise(async(n,a)=>{try{const a=E((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(P);e.locale||(e.locale=((e=null)=>{const t=window.navigator;if(e)return e.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,s=M.length;e<s;e++){const s=t[M[e]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===e.id&&delete e.id;const t=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return t&&(e=>!!(v.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(t)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(O(i=s),i?.customApiUrl&&(i.customApiUrl=decodeURIComponent(i.customApiUrl)),i.shareUrl&&(i.deeplink=i.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),i));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(a);const o=await(async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,n=s+"/configurators/"+e,a="roomle_portal_v2",i="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(n,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:i,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(e,a);s=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return E(s,t)})(s,t)})(o,a);const l=new this(o,t,s,r,n);return await Promise.allSettled(l.pluginsLoaded),l}catch(e){return a(e)}var i})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,r,n,a){if(super(),!t||"string"!=typeof t.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(H.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(C)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=C;const s="transition:all ease-in-out 450ms;",n=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,a=N();t.innerHTML=`\n .${x}{${I}:${a};}\n .${D}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${n}}\n .${B}{width:100%;height:100%;opacity:1}\n .${U}{height:calc(var(${I},1vh)*100)}\n .${F}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const i=new e("website",window,null,this._executeMessage);this.setMessageHandler(i),this._onResize=this._onResize.bind(this),L()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=r,this._configuratorSettings=t;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(n,this._iframe),H.set(s,!0)}teardown(){this._container&&H.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(t=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(t=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(t=this._initData.overrideServerUrl),e.src=t,e.classList.add(x),e.classList.add(B),e}_onResize(){R(this._iframe)}_onUseFullPage(){this._iframe.classList.add(D),document.documentElement.classList.add(F),window.document.body.classList.add(F),L()&&(R(this._iframe),this._iframe.classList.add(U))}_onBackToWebsite(){this._iframe.classList.remove(D),this._iframe.classList.remove(U),document.documentElement.classList.remove(F),window.document.body.classList.remove(F)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===e?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===e?(this.handleSetup(t[0]),k(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),k(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{j as default};
|
|
1
|
+
class e{_side;_incomingMessageBus=null;_outgoingMessageBus=null;_execMessage=null;constructor(e,t,s,r){this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=s,this._execMessage=r,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,r)=>{if(this._incomingMessageBus===this._outgoingMessageBus)return s(void 0);const n=new MessageChannel;n.port1.onmessage=e=>{if(!e||!e.data)return n.port1.close(),n.port2.close(),r(new Error(this._side+" received message but response can not be interpreted"));let t;try{t=JSON.parse(e.data)}catch(e){return n.port1.close(),n.port2.close(),this._prepareError(e),r(e)}t.error?r(t.error):void 0!==t.result?s(t.result):s(void 0),n.port1.close(),n.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return r(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return r(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[n.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&("string"==typeof e.data||"connect_hi"!==e.data.type)&&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 r=this._execMessage(s,e);if(void 0===r)return;r.then((e={})=>{let s,r;"object"==typeof e&&null!==e&&(s=e.error,r=e.result),s?t.postMessage(JSON.stringify({error:s})):void 0!==r?t.postMessage(JSON.stringify({result:r})):t.postMessage(JSON.stringify({result:e}))},e=>{t.postMessage(JSON.stringify({error:this._prepareError(e)}))})}catch(e){t.postMessage(JSON.stringify({error:this._prepareError(e)}))}}_prepareError(e){return"string"==typeof e?this._side+": "+e:(e.message=this._side+": "+e.message,e.message)}}const t=Symbol("Comlink.proxy"),s=Symbol("Comlink.endpoint"),r=Symbol("Comlink.releaseProxy"),n=Symbol("Comlink.finalizer"),a=Symbol("Comlink.thrown"),i=e=>"object"==typeof e&&null!==e||"function"==typeof e,o=new Map([["proxy",{canHandle:e=>i(e)&&e[t],serialize(e){const{port1:t,port2:s}=new MessageChannel;return l(e,t),[s,[s]]},deserialize:e=>(e.start(),function(e){const t=new Map;return e.addEventListener("message",function(e){const{data:s}=e;if(!s||!s.id)return;const r=t.get(s.id);if(r)try{r(s)}finally{t.delete(s.id)}}),m(e,t,[],void 0)}(e))}],["throw",{canHandle:e=>i(e)&&a in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(new Error(e.value.message),e.value):e.value}}]]);function l(e,s=globalThis,r=["*"]){s.addEventListener("message",function i(o){if(!o||!o.data)return;if(!function(e,t){for(const s of e)if(t===s||"*"===s||s instanceof RegExp&&s.test(t))return!0;return!1}(r,o.origin))return;const{id:u,type:g,path:d}=Object.assign({path:[]},o.data),h=(o.data.argumentList||[]).map(y);let m;try{const s=d.slice(0,-1).reduce((e,t)=>e[t],e),r=d.reduce((e,t)=>e[t],e);switch(g){case"GET":m=r;break;case"SET":s[d.slice(-1)[0]]=y(o.data.value),m=!0;break;case"APPLY":m=r.apply(s,h);break;case"CONSTRUCT":m=function(e){return Object.assign(e,{[t]:!0})}(new r(...h));break;case"ENDPOINT":{const{port1:t,port2:s}=new MessageChannel;l(e,s),m=function(e,t){return w.set(e,t),e}(t,[t])}break;case"RELEASE":m=void 0;break;default:return}}catch(e){m={value:e,[a]:0}}Promise.resolve(m).catch(e=>({value:e,[a]:0})).then(t=>{const[r,a]=_(t);s.postMessage(Object.assign(Object.assign({},r),{id:u}),a),"RELEASE"===g&&(s.removeEventListener("message",i),c(s),n in e&&"function"==typeof e[n]&&e[n]())}).catch(e=>{const[t,r]=_({value:new TypeError("Unserializable return value"),[a]:0});s.postMessage(Object.assign(Object.assign({},t),{id:u}),r)})}),s.start&&s.start()}function c(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function u(e){if(e)throw new Error("Proxy has been released and is not useable")}function g(e){return b(e,new Map,{type:"RELEASE"}).then(()=>{c(e)})}const d=new WeakMap,h="FinalizationRegistry"in globalThis&&new FinalizationRegistry(e=>{const t=(d.get(e)||0)-1;d.set(e,t),0===t&&g(e)});function m(e,t,n=[],a=function(){}){let i=!1;const o=new Proxy(a,{get(s,a){if(u(i),a===r)return()=>{(function(e){h&&h.unregister(e)})(o),g(e),t.clear(),i=!0};if("then"===a){if(0===n.length)return{then:()=>o};const s=b(e,t,{type:"GET",path:n.map(e=>e.toString())}).then(y);return s.then.bind(s)}return m(e,t,[...n,a])},set(s,r,a){u(i);const[o,l]=_(a);return b(e,t,{type:"SET",path:[...n,r].map(e=>e.toString()),value:o},l).then(y)},apply(r,a,o){u(i);const l=n[n.length-1];if(l===s)return b(e,t,{type:"ENDPOINT"}).then(y);if("bind"===l)return m(e,t,n.slice(0,-1));const[c,g]=f(o);return b(e,t,{type:"APPLY",path:n.map(e=>e.toString()),argumentList:c},g).then(y)},construct(s,r){u(i);const[a,o]=f(r);return b(e,t,{type:"CONSTRUCT",path:n.map(e=>e.toString()),argumentList:a},o).then(y)}});return function(e,t){const s=(d.get(t)||0)+1;d.set(t,s),h&&h.register(e,t,e)}(o,e),o}function p(e){return Array.prototype.concat.apply([],e)}function f(e){const t=e.map(_);return[t.map(e=>e[0]),p(t.map(e=>e[1]))]}const w=new WeakMap;function _(e){for(const[t,s]of o)if(s.canHandle(e)){const[r,n]=s.serialize(e);return[{type:"HANDLER",name:t,value:r},n]}return[{type:"RAW",value:e},w.get(e)||[]]}function y(e){switch(e.type){case"HANDLER":return o.get(e.name).deserialize(e.value);case"RAW":return e.value}}function b(e,t,s,r){return new Promise(n=>{const a=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");t.set(a,n),e.start&&e.start(),e.postMessage(Object.assign({id:a},s),r)})}const v=["127.0.0.1","localhost","0.0.0.0"],M=["language","browserLanguage","userLanguage","systemLanguage"],E=(e,t)=>{for(const s in t)try{t[s].constructor===Object?e[s]=E(e[s],t[s]):e[s]=t[s]}catch{e[s]=t[s]}return e};var S=(e=>(e.BOTTOM_BAR="bottom_bar",e.PARTLIST_BOUNDS="partlist_bounds",e.INTERACTION_NOTES="interaction_notes",e.PARAMETER_GROUPS="parameter_groups",e))(S||{});const T={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},elements:{[S.INTERACTION_NOTES]:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0,wallAutoHeight:!1,openCloseAnimation:!0,enableTwoLevelCatalog:!1},rotationSnapDegrees:10,interactionsCollapsed:!1},O=e=>{if(!e)return;const t=Object.keys(e);for(const s of t){const t=e[s];if(!Array.isArray(t)&&"object"==typeof t&&null!==t&&O(t),Array.isArray(t))for(const e of t)O(e);("true"===t||"false"===t)&&(e[s]="true"===t)}},P=()=>/(android)/i.test(navigator.userAgent);class A{_messageHandler=null;isSetupDone=!1;viewName="main";plugins={};pluginsLoaded=[];ui={callbacks:null};extended={callbacks:null};configurator={callbacks:null};analytics={callbacks:{}};rapi={callbacks:{}};global={callbacks:{}};setMessageHandler(e){this._messageHandler=e}handleSetup(e){const{methods:t,callbacks:s}=e;t.forEach(e=>{const t=e.split("."),s=t[0],r=t[1];this[s]||(this[s]={}),this[s][r]=function(){if(this._messageHandler)return this._messageHandler.sendMessage(e,[...arguments])}.bind(this)}),s.forEach(e=>{const t=e.split("."),s=t[0],r=t[1],n=t[2];this[s]||(this[s]={}),this[s][r]||(this[s][r]={}),this[s][r][n]=()=>{}}),this.isSetupDone=!0}executeMessage({message:e,args:t}){const s=e.split("."),r=s[0],n=s[1],a=3===s.length?s[2]:null;if(a&&this[r][n][a]){const e=this[r][n][a](...t);return e instanceof Promise?e.then(e=>({result:e})):void 0!==e?Promise.resolve({result:e}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}setupPlugins(e,t,s="website"){for(const r of e)"string"==typeof r&&"dragIn"===r?this.pluginsLoaded.push(new Promise((e,r)=>{try{import("./drag-in-BmoiEqfA.mjs").then(e=>e.l).then(({DragIn:n})=>{const a=new n(this.ui,t,s,this.viewName);a.init().then(()=>{this.plugins.dragIn=a,e()},r)})}catch(e){r(e)}})):r.name&&r.loader&&this.pluginsLoaded.push(new Promise((e,n)=>{try{r.loader().then(a=>{const i=new a(this.ui,t,s,this.viewName);i.init().then(()=>{this.plugins[r.name]=i,e()},n)})}catch(e){n(e)}}))}}const L=()=>{let e,t;return{promise:new Promise((s,r)=>{e=s,t=r}),resolve:e,reject:t}},N=(e,t,s)=>{let r=null;Object.defineProperty(e,t,{get:()=>r||s,set(e){r=e?.mute?e.value:e}})},k=()=>.01*window.innerHeight+"px",R=e=>{e&&setTimeout(()=>e.style.setProperty(C,k()),0)},I="rml-styles",C="--rml-full-height",x="rml-container",H="rml-fill",B="rml-pos",D="rml-android-height",U="rml-overflow-hidden",F=new Map,j={HIDE:"hide",SHOW_ATTRIBUTES:"attributes",SHOW_ARTICLES:"articles"};class z extends A{static createPlanner(e,t,s,r=[]){return this._create(e,t,s,r)}static async connect(t,s=[]){const r=new A;r.viewName=t;const{resolve:n,promise:a}=L(),{resolve:i,promise:o}=L(),l=new e("custom-view-"+t,window,window.parent,({message:e,args:t})=>{switch(e){case"registerCustomViewDone":n();break;case"returnMethods":r.handleSetup(t[0]),i();break;default:if(r.isSetupDone)return r.executeMessage({message:e,args:t})}});r.setMessageHandler(l);const c=[t];return l.sendMessage("registerCustomView",c),await a,l.sendMessage("getMethods",c),await o,r.setupPlugins(s,document.body,"custom-view"),await Promise.allSettled(r.pluginsLoaded),r}static createConfigurator(e,t,s,r=[]){return this._create(e,t,s,r)}static create(e,t,s,r){return this._create(e,t,s,r)}static createViewer(e,t,s,r=[]){return this._create(e,t,s,r)}static setupHi(e){window.addEventListener("message",t=>{if("connect_hi"===t.data.type&&t.data.port){const s=t.data.port;s.start?.(),l(new Proxy(e,{get(e,t,s){const r=Reflect.get(e,t,s);return void 0!==r?r:(...e)=>{}}}),s)}})}static async _create(e,t,s,r){return new Promise(async(n,a)=>{try{const a=E((()=>{const e=(e=>JSON.parse(JSON.stringify(e)))(T);e.locale||(e.locale=((e=null)=>{const t=window.navigator;if(e)return e.substr(0,2);if(Array.isArray(t.languages)&&t.languages.length>0)return t.languages[0].substr(0,2);for(let e=0,s=M.length;e<s;e++){const s=t[M[e]];if(s)return s.substr(0,2)}return"en"})()),"(idle)"===e.id&&delete e.id;const t=(()=>{const e=(()=>{try{return window.self!==window.top}catch{return!0}})();let t=window.location.href;if(e){if(!document.referrer)return null;t=document.referrer}const{hostname:s}=new URL(t);return s})();return t&&(e=>!!(v.includes(e)||e.endsWith("roomle.com")||e.endsWith("gitlab.io")||e.endsWith("gitlab.com")))(t)&&(e.configuratorId="demoConfigurator"),e.customApiUrl=void 0,e.emails=!1,e})(),(O(i=s),i?.customApiUrl&&(i.customApiUrl=decodeURIComponent(i.customApiUrl)),i.shareUrl&&(i.deeplink=i.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),i));(e=>{e.featureFlags||(e.featureFlags={}),"boolean"!=typeof e.featureFlags.realPartList&&(e.featureFlags.realPartList=!0),"boolean"!=typeof e.featureFlags.globalCallbacks&&(e.featureFlags.globalCallbacks=!0),"boolean"!=typeof e.featureFlags.mocAr&&(e.featureFlags.mocAr=!1)})(a);const o=await(async(e,t)=>{if("string"!=typeof e)throw new Error('Configurator ID is not a string type: "'+typeof e+'"');const s=t.customApiUrl?t.customApiUrl:"https://api.roomle.com/v2",r=t.overrideTenant||9,n=s+"/configurators/"+e,a="roomle_portal_v2",i="03-"+window.btoa((new Date).toISOString()+";anonymous;"+a),o=new Request(n,{method:"GET",headers:new Headers({apiKey:a,currentTenant:r,locale:"en",language:"en",device:1,token:i,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(o),{configurator:c}=await l.json();return c})(e,a);s=((e,t)=>{t.configuratorId=e.id;const s=e.settings||{};return!t.overrideTenant&&e.tenant&&(t.overrideTenant=e.tenant),((e,t)=>{const s=JSON.parse(JSON.stringify(e));return E(s,t)})(s,t)})(o,a);const l=new this(o,t,s,r,n);return await Promise.allSettled(l.pluginsLoaded),l}catch(e){return a(e)}var i})}_waitForIframe;_container;_configuratorSettings;_initData={};_iframe;constructor(t,s,r,n,a){if(super(),!t||"string"!=typeof t.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(F.has(s))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(I)){const e=r.zIndex||9999999,t=document.createElement("style");t.type="text/css",t.id=I;const s="transition:all ease-in-out 450ms;",n=["-webkit-","-o-"].reduce((e,t)=>e+(t+s),"")+s,a=k();t.innerHTML=`\n .${x}{${C}:${a};}\n .${B}{position:fixed;top:0;left:0;z-index:${e};opacity:0}\n .rml-transition{${n}}\n .${H}{width:100%;height:100%;opacity:1}\n .${D}{height:calc(var(${C},1vh)*100)}\n .${U}{overflow:hidden}\n `,document.head.appendChild(t)}this._executeMessage=this._executeMessage.bind(this);const i=new e("website",window,null,this._executeMessage);this.setMessageHandler(i),this._onResize=this._onResize.bind(this),P()&&window.addEventListener("resize",this._onResize),this._container=s,this._initData=r,this._configuratorSettings=t;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._waitForIframe=a,this._container.appendChild(o),this._iframe=o,this.setupPlugins(n,this._iframe),F.set(s,!0)}teardown(){this._container&&F.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){const e=document.createElement("iframe");let t=this._configuratorSettings?.url||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(t=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(t=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(t=this._initData.overrideServerUrl),e.src=t,e.classList.add(x),e.classList.add(H),e}_onResize(){R(this._iframe)}_onUseFullPage(){this._iframe.classList.add(B),document.documentElement.classList.add(U),window.document.body.classList.add(U),P()&&(R(this._iframe),this._iframe.classList.add(D))}_onBackToWebsite(){this._iframe.classList.remove(B),this._iframe.classList.remove(D),document.documentElement.classList.remove(U),window.document.body.classList.remove(U)}_executeMessage({message:e,args:t},s){if(s.source&&s.source===this._iframe?.contentWindow)return"requestBoot"===e?this._messageHandler?(this._messageHandler.setOutgoingMessageBus(s.source),Promise.resolve({result:this._initData})):Promise.resolve({error:"MessageHandler not set"}):"setup"===e?(this.handleSetup(t[0]),N(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),N(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>{this._messageHandler&&this._messageHandler.sendMessage("websiteReady")},0),Promise.resolve({result:null})):this.executeMessage({message:e,args:t})}}export{j as HI_PANEL_ACTION,z as default};
|