@roomle/embedding-lib 4.44.0 → 5.1.0-debug.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (234) hide show
  1. package/.releaserc.json +4 -7
  2. package/README.md +5 -6
  3. package/docs/md/web/embedding/CHANGELOG.md +6 -0
  4. package/drag-in-C2fEQF9W.mjs +7 -0
  5. package/drag-in-CAakt8yw.mjs +250 -0
  6. package/index.d.ts +102 -0
  7. package/package.json +27 -13
  8. package/roomle-embedding-lib.es.js +453 -0
  9. package/roomle-embedding-lib.es.min.js +8 -0
  10. package/roomle-embedding-lib.umd.js +14 -0
  11. package/roomle-embedding-lib.umd.min.js +14 -0
  12. package/docs/__sidebar__.json +0 -14
  13. package/docs/api/.nojekyll +0 -1
  14. package/docs/api/README.md +0 -9
  15. package/docs/api/classes/exposed_analytics_callbacks.ExposedAnalyticsCallbacks.md +0 -47
  16. package/docs/api/classes/exposed_api.ExposedApi.md +0 -255
  17. package/docs/api/classes/exposed_callbacks.ExposedCallbacks.md +0 -195
  18. package/docs/api/classes/roomle_configurator_api.default.md +0 -211
  19. package/docs/api/enums/types.UI_BUTTON.md +0 -263
  20. package/docs/api/interfaces/exposed_callbacks.Labels.md +0 -32
  21. package/docs/api/interfaces/exposed_callbacks.Price.md +0 -32
  22. package/docs/api/interfaces/roomle_configurator_api.RoomleEmbeddingApiKeys.md +0 -58
  23. package/docs/api/interfaces/types.ConfiguratorSettings.md +0 -150
  24. package/docs/api/interfaces/types.EmbeddingSkin.md +0 -65
  25. package/docs/api/interfaces/types.UiInitData.md +0 -1199
  26. package/docs/api/interfaces/types.VariantsMap.md +0 -9
  27. package/docs/api/modules/exposed_analytics_callbacks.md +0 -9
  28. package/docs/api/modules/exposed_api.md +0 -9
  29. package/docs/api/modules/exposed_callbacks.md +0 -14
  30. package/docs/api/modules/roomle_configurator_api.md +0 -49
  31. package/docs/api/modules/types.md +0 -16
  32. package/docs/api/modules.md +0 -13
  33. package/docs/examples/00_init.html +0 -38
  34. package/docs/examples/01_small_screen.html +0 -37
  35. package/docs/examples/02_resize_callback.html +0 -46
  36. package/docs/examples/03_instant_start.html +0 -38
  37. package/docs/examples/04_price.html +0 -48
  38. package/docs/examples/05_analytics.html +0 -38
  39. package/docs/examples/06_skinning.html +0 -39
  40. package/docs/examples/07_request_product.html +0 -41
  41. package/docs/examples/08_variants.html +0 -36
  42. package/docs/examples/09_different_products.html +0 -63
  43. package/docs/examples/10_landing_page.html +0 -38
  44. package/docs/examples/11_light_settings.html +0 -126
  45. package/docs/examples/12_email.html +0 -36
  46. package/docs/examples/13_parameters.html +0 -67
  47. package/docs/examples/14_ga_consent.html +0 -39
  48. package/docs/examples/roomle-configurator-api.es.min.js +0 -586
  49. package/docs/hsp.md +0 -61
  50. package/docs/images/parts.png +0 -0
  51. package/docs/images/usm-frames.png +0 -0
  52. package/docs/integration.md +0 -1101
  53. package/docs/md/web/ui/EMBEDDING-CHANGELOG.md +0 -17
  54. package/docs/migration-guides/v2-to-v3.md +0 -135
  55. package/docs/moc/index.md +0 -86
  56. package/docs/simple.md +0 -25
  57. package/roomle-configurator-api.cjs.js +0 -585
  58. package/roomle-configurator-api.cjs.min.js +0 -1
  59. package/roomle-configurator-api.es.js +0 -583
  60. package/roomle-configurator-api.es.min.js +0 -1
  61. package/roomle-configurator-api.js +0 -583
  62. package/types/index.d.ts +0 -1504
  63. package/types/src/common/business-logic/connector.d.ts +0 -8
  64. package/types/src/common/business-logic/event-bus.d.ts +0 -5
  65. package/types/src/common/components/collection-view/-utils/types.d.ts +0 -10
  66. package/types/src/common/plugins/analytics.d.ts +0 -11
  67. package/types/src/common/plugins/localize.d.ts +0 -8
  68. package/types/src/common/store/collection-view-state.d.ts +0 -40
  69. package/types/src/common/store/common-ui-state.d.ts +0 -16
  70. package/types/src/common/store/index.d.ts +0 -111
  71. package/types/src/common/translations/local-translation-source.d.ts +0 -8
  72. package/types/src/common/utils/access-restriction.d.ts +0 -7
  73. package/types/src/common/utils/ar-service.d.ts +0 -14
  74. package/types/src/common/utils/bezier.d.ts +0 -2
  75. package/types/src/common/utils/browser.d.ts +0 -3
  76. package/types/src/common/utils/color.d.ts +0 -2
  77. package/types/src/common/utils/compatibility.d.ts +0 -3
  78. package/types/src/common/utils/dom.d.ts +0 -15
  79. package/types/src/common/utils/font-size-detector.d.ts +0 -1
  80. package/types/src/common/utils/google-analytics.d.ts +0 -67
  81. package/types/src/common/utils/helper.d.ts +0 -43
  82. package/types/src/common/utils/iframe.d.ts +0 -3
  83. package/types/src/common/utils/init-data.d.ts +0 -34
  84. package/types/src/common/utils/merge.d.ts +0 -16
  85. package/types/src/common/utils/parameters.d.ts +0 -18
  86. package/types/src/common/utils/performance.d.ts +0 -2
  87. package/types/src/common/utils/plan.d.ts +0 -1
  88. package/types/src/common/utils/script-loader.d.ts +0 -5
  89. package/types/src/common/utils/share.d.ts +0 -1
  90. package/types/src/common/utils/touch-drag.d.ts +0 -24
  91. package/types/src/common/utils/types.d.ts +0 -19
  92. package/types/src/common/utils/user-agent.d.ts +0 -6
  93. package/types/src/common/utils/variants.d.ts +0 -3
  94. package/types/src/configurator/ar/main.d.ts +0 -1
  95. package/types/src/configurator/business-logic/roomle-sdk-wrapper.d.ts +0 -27
  96. package/types/src/configurator/business-logic/sdk-connector-configurator.d.ts +0 -29
  97. package/types/src/configurator/business-logic/sdk-connector.d.ts +0 -119
  98. package/types/src/configurator/business-logic/ui-callback.d.ts +0 -5
  99. package/types/src/configurator/components/-utils/overlays.d.ts +0 -43
  100. package/types/src/configurator/components/grid-view/-utils/GridViewHelper.d.ts +0 -16
  101. package/types/src/configurator/components/utils/-utils/SceneOffsetResizer.d.ts +0 -23
  102. package/types/src/configurator/embedding/example/main.d.ts +0 -1
  103. package/types/src/configurator/embedding/exposed-analytics-callbacks.d.ts +0 -10
  104. package/types/src/configurator/embedding/exposed-api.d.ts +0 -90
  105. package/types/src/configurator/embedding/exposed-callbacks.d.ts +0 -46
  106. package/types/src/configurator/embedding/helper.d.ts +0 -8
  107. package/types/src/configurator/embedding/message-handler.d.ts +0 -31
  108. package/types/src/configurator/embedding/roomle-configurator-api.d.ts +0 -64
  109. package/types/src/configurator/embedding/types.d.ts +0 -159
  110. package/types/src/configurator/embedding/utils.d.ts +0 -15
  111. package/types/src/configurator/plugins/embedding-callbacks-plugin.d.ts +0 -4
  112. package/types/src/configurator/plugins/libs-plugin.d.ts +0 -11
  113. package/types/src/configurator/plugins/sdk-connector-plugin.d.ts +0 -14
  114. package/types/src/configurator/store/core-data.d.ts +0 -34
  115. package/types/src/configurator/store/core-state.d.ts +0 -26
  116. package/types/src/configurator/store/ui-state.d.ts +0 -118
  117. package/types/src/main.d.ts +0 -14
  118. package/types/src/planner/business-logic/general-room-parameters.d.ts +0 -17
  119. package/types/src/planner/business-logic/pre-defined-rooms.d.ts +0 -2
  120. package/types/src/planner/business-logic/rooms.d.ts +0 -37
  121. package/types/src/planner/business-logic/sdk-connector-planner.d.ts +0 -28
  122. package/types/src/planner/store/planner-core-data.d.ts +0 -21
  123. package/types/src/planner/store/planner-ui-state.d.ts +0 -65
  124. package/types/src/planner/utils/interaction.d.ts +0 -3
  125. package/types/src/planner/utils/planner-sidebar.d.ts +0 -19
  126. package/types/src/viewer/business-logic/sdk-connector-viewer.d.ts +0 -18
  127. package/types/tests/helpers/data/base-64-images.d.ts +0 -1
  128. package/types/tests/helpers/data/configurator.d.ts +0 -7
  129. package/types/tests/helpers/data/items.d.ts +0 -208
  130. package/types/tests/helpers/data/materials.d.ts +0 -32
  131. package/types/tests/helpers/data/parameter-groups.d.ts +0 -242
  132. package/types/tests/helpers/data/parameters.d.ts +0 -399
  133. package/types/tests/helpers/data/part-list.d.ts +0 -126
  134. package/types/tests/helpers/data/plan.d.ts +0 -224
  135. package/types/tests/helpers/data/planObject.d.ts +0 -134
  136. package/types/tests/helpers/data/possible-children-tags.d.ts +0 -208
  137. package/types/tests/helpers/data/variants.d.ts +0 -60
  138. package/types/tests/helpers/data/wall-dimensions.d.ts +0 -41
  139. package/types/tests/helpers/dom.d.ts +0 -1
  140. package/types/tests/helpers/mocks/analytics.d.ts +0 -7
  141. package/types/tests/helpers/mocks/data/biohort-parameter.d.ts +0 -32
  142. package/types/tests/helpers/mocks/data/koinor-formia.d.ts +0 -289
  143. package/types/tests/helpers/mocks/embedding-callbacks.d.ts +0 -4
  144. package/types/tests/helpers/mocks/icon.d.ts +0 -3
  145. package/types/tests/helpers/mocks/localize.d.ts +0 -8
  146. package/types/tests/helpers/mocks/message.d.ts +0 -11
  147. package/types/tests/helpers/mocks/parameters.d.ts +0 -47
  148. package/types/tests/helpers/mocks/possible-children.d.ts +0 -596
  149. package/types/tests/helpers/mocks/roomle-sdk-wrapper.d.ts +0 -177
  150. package/types/tests/helpers/mocks/sdk-connector-configurator.d.ts +0 -13
  151. package/types/tests/helpers/mocks/sdk-connector-planner.d.ts +0 -13
  152. package/types/tests/helpers/mocks/sdk-connector.d.ts +0 -35
  153. package/types/tests/helpers/mocks/store.d.ts +0 -11
  154. package/types/tests/helpers/mocks/tag.d.ts +0 -148
  155. package/types/tests/helpers/utils.d.ts +0 -13
  156. package/types/tests/integration/common/components/ActionButtons.spec.d.ts +0 -1
  157. package/types/tests/integration/common/components/BottomBar.spec.d.ts +0 -1
  158. package/types/tests/integration/common/components/BottomButtons.spec.d.ts +0 -1
  159. package/types/tests/integration/common/components/IconButton.spec.d.ts +0 -1
  160. package/types/tests/integration/common/components/SelectionButtons.spec.d.ts +0 -1
  161. package/types/tests/integration/common/components/part-list/part-list/PartListPrint.spec.d.ts +0 -1
  162. package/types/tests/integration/common/components/part-list/part-list/PartListRow.spec.d.ts +0 -1
  163. package/types/tests/integration/configurator/App.spec.d.ts +0 -1
  164. package/types/tests/integration/configurator/components/ARButton.spec.d.ts +0 -1
  165. package/types/tests/integration/configurator/components/ConfiguratorMain.spec.d.ts +0 -9
  166. package/types/tests/integration/configurator/components/CookieBanner.spec.d.ts +0 -1
  167. package/types/tests/integration/configurator/components/Overlays.spec.d.ts +0 -1
  168. package/types/tests/integration/configurator/components/TopBar.spec.d.ts +0 -1
  169. package/types/tests/integration/configurator/components/ViewerMain.spec.d.ts +0 -1
  170. package/types/tests/integration/configurator/components/addons/AddonsTrigger.spec.d.ts +0 -1
  171. package/types/tests/integration/configurator/components/addons/PossibleChildren.spec.d.ts +0 -1
  172. package/types/tests/integration/configurator/components/collection-view/-utils/TabbedNav.spec.d.ts +0 -1
  173. package/types/tests/integration/configurator/components/collection-view/CollectionView.spec.d.ts +0 -1
  174. package/types/tests/integration/configurator/components/grid-view/-utils/CollapsedView.spec.d.ts +0 -1
  175. package/types/tests/integration/configurator/components/grid-view/-utils/ExpandedView.spec.d.ts +0 -1
  176. package/types/tests/integration/configurator/components/grid-view/-utils/GridViewElement.spec.d.ts +0 -1
  177. package/types/tests/integration/configurator/components/grid-view/-utils/GridViewHelper.spec.d.ts +0 -1
  178. package/types/tests/integration/configurator/components/grid-view/GridView.spec.d.ts +0 -1
  179. package/types/tests/integration/configurator/components/overlays/Export3D.spec.d.ts +0 -1
  180. package/types/tests/integration/configurator/components/overlays/NoDocking.spec.d.ts +0 -1
  181. package/types/tests/integration/configurator/components/overlays/PartList.spec.d.ts +0 -1
  182. package/types/tests/integration/configurator/components/overlays/SaveDraft.spec.d.ts +0 -1
  183. package/types/tests/integration/configurator/components/overlays/VariantWarning.spec.d.ts +0 -1
  184. package/types/tests/integration/configurator/components/overlays/ar/OpenARView.spec.d.ts +0 -1
  185. package/types/tests/integration/configurator/components/parameters/BackParameterGroupButton.spec.d.ts +0 -1
  186. package/types/tests/integration/configurator/components/parameters/NextParameterGroupButton.spec.d.ts +0 -1
  187. package/types/tests/integration/configurator/components/parameters/ParameterGroupButton.spec.d.ts +0 -1
  188. package/types/tests/integration/configurator/components/parameters/ParameterGroups.spec.d.ts +0 -1
  189. package/types/tests/integration/configurator/components/parameters/types/MaterialParameter.spec.d.ts +0 -1
  190. package/types/tests/integration/configurator/components/parameters/types/OptionsParameter.spec.d.ts +0 -1
  191. package/types/tests/integration/configurator/components/parameters/types/OptionsParameterValue.spec.d.ts +0 -1
  192. package/types/tests/integration/configurator/components/parameters/types/ProductVariant.spec.d.ts +0 -1
  193. package/types/tests/integration/configurator/components/parameters/types/RangeParameter.spec.d.ts +0 -1
  194. package/types/tests/integration/configurator/components/parameters/types/ThumbnailsParameter.spec.d.ts +0 -1
  195. package/types/tests/integration/configurator/components/utils/BackToWebsite.spec.d.ts +0 -1
  196. package/types/tests/integration/configurator/components/utils/CheckBox.spec.d.ts +0 -1
  197. package/types/tests/integration/configurator/components/utils/FullscreenContainer.spec.d.ts +0 -1
  198. package/types/tests/integration/configurator/components/utils/GdprEmailInput.spec.d.ts +0 -1
  199. package/types/tests/integration/configurator/components/utils/HeightToggle.spec.d.ts +0 -1
  200. package/types/tests/integration/configurator/components/utils/ImageWithFallback.spec.d.ts +0 -1
  201. package/types/tests/integration/configurator/components/utils/InteractionContainer.spec.d.ts +0 -1
  202. package/types/tests/integration/configurator/components/utils/PopUp.spec.d.ts +0 -1
  203. package/types/tests/integration/configurator/components/utils/ScrollHint.spec.d.ts +0 -1
  204. package/types/tests/integration/helper.spec.d.ts +0 -1
  205. package/types/tests/integration/planner/components/CatalogTrigger.spec.d.ts +0 -1
  206. package/types/tests/integration/planner/components/PlannerMain.spec.d.ts +0 -1
  207. package/types/tests/integration/planner/components/PlannerSidebar.spec.d.ts +0 -1
  208. package/types/tests/integration/planner/components/ProductListButton.spec.d.ts +0 -1
  209. package/types/tests/integration/planner/components/SampleRooms.spec.d.ts +0 -1
  210. package/types/tests/integration/planner/components/ShowWallMeasurements.spec.d.ts +0 -1
  211. package/types/tests/integration/planner/components/overlays/product-list/ProductListEntry.spec.d.ts +0 -1
  212. package/types/tests/integration/planner/components/overlays/rooms/RoomGeneralSettings.spec.d.ts +0 -1
  213. package/types/tests/integration/planner/components/overlays/rooms/RoomRangeParameter.spec.d.ts +0 -1
  214. package/types/tests/integration/planner/components/utils/InteractionHeader.spec.d.ts +0 -1
  215. package/types/tests/integration/planner/components/utils/sidebar-nav/SidebarNav.spec.d.ts +0 -1
  216. package/types/tests/unit/common/business-logic/event-bus.spec.d.ts +0 -1
  217. package/types/tests/unit/common/helper.spec.d.ts +0 -1
  218. package/types/tests/unit/common/translations/local-translation-source.spec.d.ts +0 -1
  219. package/types/tests/unit/common/utils/ar-service.spec.d.ts +0 -1
  220. package/types/tests/unit/common/utils/bezier.spec.d.ts +0 -1
  221. package/types/tests/unit/common/utils/color.spec.d.ts +0 -1
  222. package/types/tests/unit/common/utils/dom.spec.d.ts +0 -1
  223. package/types/tests/unit/common/utils/helper.spec.d.ts +0 -1
  224. package/types/tests/unit/common/utils/init-data.spec.d.ts +0 -1
  225. package/types/tests/unit/common/utils/parameters.spec.d.ts +0 -1
  226. package/types/tests/unit/common/utils/touch-drag.spec.d.ts +0 -1
  227. package/types/tests/unit/configurator/business-logic/sdk-connector-configurator.spec.d.ts +0 -1
  228. package/types/tests/unit/configurator/business-logic/sdk-connector.spec.d.ts +0 -1
  229. package/types/tests/unit/configurator/components/utils/-utils/ConfiguratorResizer.spec.d.ts +0 -1
  230. package/types/tests/unit/configurator/components/utils/WordWrap.spec.d.ts +0 -1
  231. package/types/tests/unit/configurator/embedding/exposed-api.spec.d.ts +0 -1
  232. package/types/tests/unit/configurator/embedding/utils.spec.d.ts +0 -1
  233. package/types/tests/unit/configurator/store/index.spec.d.ts +0 -1
  234. package/types/tests/unit/planner/business-logic/sdk-connector-planner.spec.d.ts +0 -1
@@ -1,585 +0,0 @@
1
- 'use strict';
2
-
3
- class MessageHandler {
4
- constructor(side, incomingMessageBus, outgoingMessageBus, messageExecution) {
5
- this._outgoingMessageBus = null;
6
- this._execMessage = null;
7
- this._side = side;
8
- this._incomingMessageBus = incomingMessageBus;
9
- this._outgoingMessageBus = outgoingMessageBus;
10
- this._execMessage = messageExecution;
11
- this._incomingMessageBus.addEventListener('message', this._handleMessage.bind(this));
12
- }
13
- setOutgoingMessageBus(outgoingMessageBus) {
14
- this._outgoingMessageBus = outgoingMessageBus;
15
- }
16
- setMessageExecution(fun) {
17
- this._execMessage = fun;
18
- }
19
- sendMessage(message, args = []) {
20
- return new Promise((resolve, reject) => {
21
- const messageChannel = new MessageChannel();
22
- messageChannel.port1.onmessage = (event) => {
23
- if (!event || !event.data) {
24
- messageChannel.port1.close();
25
- messageChannel.port2.close();
26
- return reject(new Error(this._side + ' received message but response can not be interpreted'));
27
- }
28
- let response;
29
- try {
30
- response = JSON.parse(event.data);
31
- }
32
- catch (e) {
33
- messageChannel.port1.close();
34
- messageChannel.port2.close();
35
- this._prepareError(e);
36
- return reject(e);
37
- }
38
- if (response.error) {
39
- reject(response.error);
40
- }
41
- else if (response.result !== undefined) {
42
- resolve(response.result);
43
- }
44
- else {
45
- resolve();
46
- }
47
- messageChannel.port1.close();
48
- messageChannel.port2.close();
49
- };
50
- let command = '';
51
- try {
52
- command = JSON.stringify({ message, args });
53
- }
54
- catch (e) {
55
- return reject(new Error(this._side + ': can not create command because it is not JSON.stringify able'));
56
- }
57
- if (!this._outgoingMessageBus) {
58
- return reject(new Error(this._side + ': outgoing bus not set yet'));
59
- }
60
- this._outgoingMessageBus.postMessage(command, '*', [messageChannel.port2]);
61
- });
62
- }
63
- _handleMessage(event) {
64
- // check if MessageEvent has a port set --> hope this clears confusion about https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API/Using_channel_messaging
65
- const receiver = (event.ports && Array.isArray(event.ports) && event.ports.length > 0) ? event.ports[0] : null;
66
- if (event.data && receiver) {
67
- try {
68
- const command = JSON.parse(event.data);
69
- if (!this._execMessage) {
70
- return receiver.postMessage(JSON.stringify({ error: this._side + ' is not ready to handle messages' }));
71
- }
72
- if (!Array.isArray(command.args)) {
73
- command.args = [command.args];
74
- }
75
- const execResult = this._execMessage(command, event);
76
- if (execResult === undefined) {
77
- return; // do nothing because execMessage did not know what to do. Probably a message from another iframe was intercepted
78
- }
79
- execResult.then((data = {}) => {
80
- // tslint:disable-next-line:no-unnecessary-initializer
81
- let error = undefined;
82
- // tslint:disable-next-line:no-unnecessary-initializer
83
- let result = undefined;
84
- if (typeof data === 'object' && data !== null) {
85
- error = data.error;
86
- result = data.result;
87
- }
88
- if (error) {
89
- receiver.postMessage(JSON.stringify({ error }));
90
- }
91
- else if (result !== undefined) {
92
- receiver.postMessage(JSON.stringify({ result }));
93
- }
94
- else {
95
- receiver.postMessage(JSON.stringify({ result: data }));
96
- }
97
- }, (error) => {
98
- receiver.postMessage(JSON.stringify({ error: this._prepareError(error) }));
99
- });
100
- }
101
- catch (error) {
102
- receiver.postMessage(JSON.stringify({ error: this._prepareError(error) }));
103
- }
104
- }
105
- }
106
- _prepareError(e) {
107
- if (typeof e === 'string') {
108
- const error = this._side + ': ' + e;
109
- console.error(error);
110
- return error;
111
- }
112
- e.message = this._side + ': ' + e.message;
113
- console.error(e);
114
- return e.message;
115
- }
116
- }
117
-
118
- const NAMESPACE_SEPARATOR = '.';
119
- const HANDSHAKE_MESSAGES = {
120
- REQUEST_BOOT: 'requestBoot',
121
- SETUP: 'setup',
122
- WEBSITE_READY: 'websiteReady',
123
- };
124
- const getConfiguratorSettings = async (configuratorId, initData) => {
125
- if (typeof configuratorId !== 'string') {
126
- throw new Error('Configurator ID is not a string type: "' + (typeof configuratorId) + '"');
127
- }
128
- const server = initData.customApiUrl ? initData.customApiUrl : 'https://api.roomle.com/v2';
129
- const currentTenant = initData.overrideTenant || 9;
130
- const url = server + '/configurators/' + configuratorId;
131
- const apiKey = 'roomle_portal_v2';
132
- const token = '03-' + window.btoa((new Date()).toISOString() + ';anonymous;' + apiKey);
133
- const createHeaders = () => {
134
- const headers = {
135
- apiKey,
136
- currentTenant,
137
- locale: 'en',
138
- language: 'en',
139
- device: 1,
140
- token,
141
- platform: 'web',
142
- };
143
- return new Headers(headers);
144
- };
145
- const request = new Request(url, {
146
- method: 'GET',
147
- headers: createHeaders(),
148
- mode: 'cors',
149
- cache: 'default',
150
- });
151
- const response = await fetch(request);
152
- const { configurator } = await response.json();
153
- return configurator;
154
- };
155
-
156
- const isInIframe = () => {
157
- try {
158
- return window.self !== window.top;
159
- }
160
- catch (e) {
161
- return true;
162
- }
163
- };
164
-
165
- const NAMES_FOR_LOCALHOST = [
166
- '127.0.0.1',
167
- 'localhost',
168
- '0.0.0.0',
169
- ];
170
- const getHostname = () => {
171
- const isIframe = isInIframe();
172
- let url = window.location.href;
173
- if (isIframe) {
174
- if (!document.referrer) {
175
- return null;
176
- }
177
- url = document.referrer;
178
- }
179
- const { hostname } = new URL(url);
180
- return hostname;
181
- };
182
- const isDemoHostname = (hostname) => {
183
- if (NAMES_FOR_LOCALHOST.includes(hostname)) {
184
- return true;
185
- }
186
- if (hostname.endsWith('roomle.com')) {
187
- return true;
188
- }
189
- // exception for CI builds
190
- if (hostname.endsWith('gitlab.io') || hostname.endsWith('gitlab.com')) {
191
- return true;
192
- }
193
- return false;
194
- };
195
-
196
- /**
197
- * Recursively merge properties of two objects.
198
- * If a property exists in both it, property of obj2 is used.
199
- * Returns a new object (copy)
200
- * @param obj1
201
- * @param obj2
202
- */
203
- const deepMergeCopy = (obj1, obj2) => {
204
- const result = JSON.parse(JSON.stringify(obj1));
205
- return deepMerge(result, obj2);
206
- };
207
- /**
208
- * Recursively merge properties of two objects.
209
- * If a property exists in both it, property of obj2 is used.
210
- * Warning: This returns obj1 and not a copy!
211
- * @param obj1
212
- * @param obj2
213
- */
214
- const deepMerge = (obj1, obj2) => {
215
- // tslint:disable-next-line
216
- for (const p in obj2) {
217
- try {
218
- // Property in destination object set; update its value.
219
- if (obj2[p].constructor === Object) {
220
- obj1[p] = deepMerge(obj1[p], obj2[p]);
221
- }
222
- else {
223
- obj1[p] = obj2[p];
224
- }
225
- }
226
- catch (e) {
227
- // Property in destination object not set; create it and set its value.
228
- obj1[p] = obj2[p];
229
- }
230
- }
231
- return obj1;
232
- };
233
-
234
- const BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN = ['language', 'browserLanguage', 'userLanguage', 'systemLanguage'];
235
- const getLanguage = (lang = null) => {
236
- const navigator = window.navigator;
237
- if (lang) {
238
- return lang.substr(0, 2);
239
- }
240
- if (Array.isArray(navigator.languages) && navigator.languages.length > 0) {
241
- return navigator.languages[0].substr(0, 2);
242
- }
243
- for (let i = 0, length = BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN.length; i < length; i++) {
244
- const language = navigator[BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN[i]];
245
- if (language) {
246
- return language.substr(0, 2);
247
- }
248
- }
249
- return 'en';
250
- };
251
-
252
- const CONFIGURATOR_IDLE = '(idle)';
253
- const castAndFixInitData = (initData) => {
254
- castInitData(initData);
255
- if (initData === null || initData === void 0 ? void 0 : initData.customApiUrl) {
256
- initData.customApiUrl = decodeURIComponent(initData.customApiUrl);
257
- }
258
- if (initData.shareUrl) {
259
- initData.deeplink = initData.shareUrl.replace(LEGACY_SHARE_PLACEHOLDER, SHARE_PLACEHOLDER);
260
- }
261
- return initData;
262
- };
263
- const castInitData = (obj) => {
264
- if (!obj) {
265
- return;
266
- }
267
- const keys = Object.keys(obj);
268
- for (const key of keys) {
269
- const value = obj[key];
270
- // need to type-check for null because typeof null evaluates to object
271
- // see here why this is like it is: https://2ality.com/2013/10/typeof-null.html
272
- if (!Array.isArray(value) && typeof value === 'object' && value !== null) {
273
- return castInitData(value);
274
- }
275
- if (Array.isArray(value)) {
276
- for (const entry of value) {
277
- castInitData(entry);
278
- }
279
- return;
280
- }
281
- if (value === 'true' || value === 'false') {
282
- obj[key] = value === 'true';
283
- }
284
- }
285
- };
286
- const mergeInitData = (configuratorSettings, currentInitData) => {
287
- currentInitData.configuratorId = configuratorSettings.id;
288
- const remoteInitData = configuratorSettings.settings || {};
289
- // This is a performance optimization so we do not need to fetch
290
- // configurator settings twice
291
- if (!currentInitData.overrideTenant && configuratorSettings.tenant) {
292
- // use as any because we send tenant id as string but SDK requires to send a number
293
- // casting to number could become a problem when we change tenant IDs to something
294
- // random instead of a integer which is incremented
295
- currentInitData.overrideTenant = configuratorSettings.tenant;
296
- }
297
- return deepMergeCopy(remoteInitData, currentInitData);
298
- };
299
- const getFallbackInitData = () => {
300
- const fallbackInitData = {};
301
- if (!fallbackInitData.locale) {
302
- fallbackInitData.locale = getLanguage();
303
- }
304
- if (fallbackInitData.id === CONFIGURATOR_IDLE) {
305
- delete fallbackInitData.id;
306
- }
307
- const hostname = getHostname();
308
- if (hostname && isDemoHostname(hostname)) {
309
- fallbackInitData.configuratorId = 'demoConfigurator';
310
- }
311
- fallbackInitData.customApiUrl = 'https://www.roomle.com/api/v2';
312
- fallbackInitData.emails = false;
313
- return fallbackInitData;
314
- };
315
- const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';
316
- const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';
317
-
318
- // see why: so#/58065241/10800831
319
- const isAndroid = () => /(android)/i.test(navigator.userAgent);
320
-
321
- const setDefaultBehaviour = (object, callbackName, defaultBehaviour) => {
322
- let customBehaviour = null;
323
- Object.defineProperty(object, callbackName, {
324
- get() {
325
- return customBehaviour || defaultBehaviour;
326
- },
327
- set(data) {
328
- if (!(data === null || data === void 0 ? void 0 : data.mute)) {
329
- console.warn('You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties');
330
- console.warn('{ mute: true, value: () => void }');
331
- customBehaviour = data;
332
- }
333
- else {
334
- customBehaviour = data.value;
335
- }
336
- },
337
- });
338
- };
339
- const calcVh = () => (window.innerHeight * 0.01) + 'px'; // needed because of URL bar in android, inspired by: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
340
- const setCustomProp = (element) => {
341
- if (!element) {
342
- return;
343
- }
344
- // Needed to wait for the next run loop otherwise data is wrong
345
- setTimeout(() => element.style.setProperty(RML_CUSTOM_PROPERTY_HEIGHT, calcVh()), 0);
346
- };
347
- const RML_STYLES_ID = 'rml-styles';
348
- const RML_ANIMATION_DELAY = 450;
349
- const RML_CUSTOM_PROPERTY_HEIGHT = '--rml-full-height';
350
- const RML_CSS_CLASSES = {
351
- CONTAINER: 'rml-container',
352
- FILL: 'rml-fill',
353
- POSITION: 'rml-pos',
354
- TRANSITION: 'rml-transition',
355
- ANDROID_HEIGHT: 'rml-android-height',
356
- OVERFLOW_HIDDEN: 'rml-overflow-hidden',
357
- };
358
- const globalSetupDone = new Map();
359
- class RoomleEmbeddingApi {
360
- constructor(settings, container, initData, waitForIframe) {
361
- this.ui = {
362
- callbacks: null,
363
- };
364
- this.extended = {
365
- callbacks: null,
366
- };
367
- this.analytics = {
368
- callbacks: {},
369
- };
370
- this.global = {
371
- callbacks: {},
372
- };
373
- this._initData = {};
374
- if (!settings || typeof settings.id !== 'string') {
375
- throw new Error('Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person');
376
- }
377
- if (globalSetupDone.has(container)) {
378
- throw new Error('There is already an instance on this DOM element');
379
- }
380
- const stylesAlreadyAdded = !!document.getElementById(RML_STYLES_ID);
381
- if (!stylesAlreadyAdded) {
382
- const zIndex = initData.zIndex || 9999999;
383
- const styles = document.createElement('style');
384
- styles.type = 'text/css';
385
- styles.id = RML_STYLES_ID;
386
- const cssTransition = 'transition:all ease-in-out ' + RML_ANIMATION_DELAY + 'ms;';
387
- const cssTransitionForAllBrowsers = ['-webkit-', '-o-'].reduce((acc, browser) => acc += browser + cssTransition, '') + cssTransition;
388
- const vh = calcVh();
389
- styles.innerHTML = `
390
- .${RML_CSS_CLASSES.CONTAINER}{${RML_CUSTOM_PROPERTY_HEIGHT}:${vh};}
391
- .${RML_CSS_CLASSES.POSITION}{position:fixed;top:0;left:0;z-index:${zIndex};opacity:0}
392
- .${RML_CSS_CLASSES.TRANSITION}{${cssTransitionForAllBrowsers}}
393
- .${RML_CSS_CLASSES.FILL}{width:100%;height:100%;opacity:1}
394
- .${RML_CSS_CLASSES.ANDROID_HEIGHT}{height:calc(var(${RML_CUSTOM_PROPERTY_HEIGHT},1vh)*100)}
395
- .${RML_CSS_CLASSES.OVERFLOW_HIDDEN}{overflow:hidden}
396
- `;
397
- document.head.appendChild(styles);
398
- }
399
- this._onResize = this._onResize.bind(this);
400
- if (isAndroid()) {
401
- window.addEventListener('resize', this._onResize);
402
- }
403
- this._container = container;
404
- this._initData = initData;
405
- this._configuratorSettings = settings;
406
- const iframe = this._createIframe();
407
- this._onUseFullPage = this._onUseFullPage.bind(this);
408
- this._executeMessage = this._executeMessage.bind(this);
409
- this._onBackToWebsite = this._onBackToWebsite.bind(this);
410
- this._messageHandler = new MessageHandler('website', window, null, this._executeMessage);
411
- this._waitForIframe = waitForIframe;
412
- this._container.appendChild(iframe);
413
- this._iframe = iframe;
414
- globalSetupDone.set(container, true);
415
- }
416
- static createPlanner(configuratorId, container, initData) {
417
- return this._create(configuratorId, container, initData);
418
- }
419
- /**
420
- * Method to create a new instance of a Roomle Configurator
421
- * @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
422
- * @param container DOM container in which the configurator should be placed
423
- * @param initData settings with which the configurator should be started
424
- */
425
- static createConfigurator(configuratorId, container, initData) {
426
- return this._create(configuratorId, container, initData);
427
- }
428
- /**
429
- * Method to create a new instance of a Roomle Configurator
430
- * @deprecated please use "createConfigurator"
431
- * @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
432
- * @param container DOM container in which the configurator should be placed
433
- * @param initData settings with which the configurator should be started
434
- */
435
- static create(configuratorId, container, initData) {
436
- return this._create(configuratorId, container, initData);
437
- }
438
- /**
439
- * Method to create a new instance of a Roomle Viewer
440
- * @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
441
- * @param container DOM container in which the configurator should be placed
442
- * @param initData settings with which the configurator should be started
443
- */
444
- static createViewer(configuratorId, container, initData) {
445
- return this._create(configuratorId, container, initData);
446
- }
447
- static _create(configuratorId, container, initData) {
448
- return new Promise(async (resolve, reject) => {
449
- try {
450
- const fallbackInitData = deepMerge(getFallbackInitData(), castAndFixInitData(initData));
451
- if (!fallbackInitData.featureFlags) {
452
- fallbackInitData.featureFlags = {};
453
- }
454
- if (typeof fallbackInitData.featureFlags.realPartList !== 'boolean') {
455
- fallbackInitData.featureFlags.realPartList = true;
456
- }
457
- if (typeof fallbackInitData.featureFlags.globalCallbacks !== 'boolean') {
458
- fallbackInitData.featureFlags.globalCallbacks = true;
459
- }
460
- const configuratorSettings = await getConfiguratorSettings(configuratorId, fallbackInitData);
461
- initData = mergeInitData(configuratorSettings, fallbackInitData);
462
- return new this(configuratorSettings, container, initData, resolve);
463
- }
464
- catch (e) {
465
- return reject(e);
466
- }
467
- });
468
- }
469
- teardown() {
470
- if (this._container) {
471
- globalSetupDone.delete(this._container);
472
- }
473
- const iframe = this._container.querySelector('iframe');
474
- if (iframe) {
475
- this._container.removeChild(iframe);
476
- }
477
- window.removeEventListener('resize', this._onResize);
478
- }
479
- _createIframe() {
480
- var _a;
481
- const iframe = document.createElement('iframe');
482
- let url = ((_a = this._configuratorSettings) === null || _a === void 0 ? void 0 : _a.url) || 'https://www.roomle.com/t/cp/';
483
- if (this._initData.useLocalRoomle) {
484
- url = location.href.replace('embedding.html', '');
485
- }
486
- if (location.href.includes('roomle.gitlab.io')) {
487
- url = location.href.replace('embedding.html', 'index.html');
488
- }
489
- if (this._initData.overrideServerUrl) {
490
- url = this._initData.overrideServerUrl;
491
- }
492
- iframe.src = url;
493
- iframe.classList.add(RML_CSS_CLASSES.CONTAINER);
494
- iframe.classList.add(RML_CSS_CLASSES.FILL);
495
- return iframe;
496
- }
497
- _onResize() {
498
- setCustomProp(this._iframe);
499
- }
500
- _onUseFullPage() {
501
- this._iframe.classList.add(RML_CSS_CLASSES.POSITION);
502
- document.documentElement.classList.add(RML_CSS_CLASSES.OVERFLOW_HIDDEN);
503
- window.document.body.classList.add(RML_CSS_CLASSES.OVERFLOW_HIDDEN);
504
- if (isAndroid()) {
505
- setCustomProp(this._iframe);
506
- this._iframe.classList.add(RML_CSS_CLASSES.ANDROID_HEIGHT);
507
- }
508
- }
509
- _onBackToWebsite() {
510
- this._iframe.classList.remove(RML_CSS_CLASSES.POSITION);
511
- this._iframe.classList.remove(RML_CSS_CLASSES.ANDROID_HEIGHT);
512
- document.documentElement.classList.remove(RML_CSS_CLASSES.OVERFLOW_HIDDEN);
513
- window.document.body.classList.remove(RML_CSS_CLASSES.OVERFLOW_HIDDEN);
514
- }
515
- _executeMessage({ message, args }, event) {
516
- var _a;
517
- if (!event.source) {
518
- // @ts-ignore
519
- return; // no source? just wait ;-)
520
- }
521
- if (event.source !== ((_a = this._iframe) === null || _a === void 0 ? void 0 : _a.contentWindow)) {
522
- // @ts-ignore
523
- return; // need to wait since response is not for the current iframe;
524
- }
525
- if (message === HANDSHAKE_MESSAGES.REQUEST_BOOT) {
526
- this._messageHandler.setOutgoingMessageBus(event.source);
527
- return Promise.resolve({ result: this._initData });
528
- }
529
- if (message === HANDSHAKE_MESSAGES.SETUP) {
530
- const { methods, callbacks } = args[0];
531
- methods.forEach((method) => {
532
- const namespaces = method.split(NAMESPACE_SEPARATOR);
533
- const object = namespaces[0];
534
- const methodName = namespaces[1];
535
- if (!this[object]) {
536
- this[object] = {};
537
- }
538
- this[object][methodName] = function () {
539
- // @todo -- this was the fix that values are passed to caller, e.g.: interface.extended.getParametersOfRootComponent
540
- // most of the things we need for a meaningful test are not available in JEST (since it runs in node). We should
541
- // write a Cypress test for it
542
- return this._messageHandler.sendMessage(method, [...arguments]);
543
- }.bind(this);
544
- });
545
- callbacks.forEach((callback) => {
546
- const namespaces = callback.split(NAMESPACE_SEPARATOR);
547
- const object = namespaces[0];
548
- const callbacksName = namespaces[1];
549
- const eventName = namespaces[2];
550
- if (!this[object]) {
551
- this[object] = {};
552
- }
553
- if (!this[object][callbacksName]) {
554
- this[object][callbacksName] = {};
555
- }
556
- // @ts-ignore
557
- this[object][callbacksName][eventName] = () => undefined;
558
- });
559
- setDefaultBehaviour(this.ui.callbacks, 'onUseFullPage', this._onUseFullPage);
560
- setDefaultBehaviour(this.ui.callbacks, 'onBackToWebsite', this._onBackToWebsite);
561
- this._waitForIframe(this);
562
- setTimeout(() => this._messageHandler.sendMessage(HANDSHAKE_MESSAGES.WEBSITE_READY), 0); // Run it after the promise is resolved so everyone can subscribe
563
- return Promise.resolve({ result: null });
564
- }
565
- const messageNamespaces = message.split(NAMESPACE_SEPARATOR);
566
- const namespace = messageNamespaces[0];
567
- const objectOfAction = messageNamespaces[1];
568
- const methodOfAction = (messageNamespaces.length === 3) ? messageNamespaces[2] : null;
569
- if (methodOfAction) {
570
- if (this[namespace][objectOfAction][methodOfAction]) {
571
- const result = this[namespace][objectOfAction][methodOfAction](...args);
572
- if (result instanceof Promise) {
573
- return result.then((data) => ({ result: data }));
574
- }
575
- else if (result !== undefined) {
576
- return Promise.resolve({ result });
577
- }
578
- return Promise.resolve({ result: null });
579
- }
580
- }
581
- return Promise.reject('Message "' + message + '" is unkown');
582
- }
583
- }
584
-
585
- module.exports = RoomleEmbeddingApi;
@@ -1 +0,0 @@
1
- "use strict";class t{constructor(t,e,r,s){this.t=null,this.s=null,this.i=t,this.o=e,this.t=r,this.s=s,this.o.addEventListener("message",this.l.bind(this))}setOutgoingMessageBus(t){this.t=t}setMessageExecution(t){this.s=t}sendMessage(t,e=[]){return new Promise((r,s)=>{const i=new MessageChannel;i.port1.onmessage=t=>{if(!t||!t.data)return i.port1.close(),i.port2.close(),s(new Error(this.i+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return i.port1.close(),i.port2.close(),this.h(t),s(t)}e.error?s(e.error):void 0!==e.result?r(e.result):r(),i.port1.close(),i.port2.close()};let o="";try{o=JSON.stringify({message:t,args:e})}catch(t){return s(new Error(this.i+": can not create command because it is not JSON.stringify able"))}if(!this.t)return s(new Error(this.i+": outgoing bus not set yet"));this.t.postMessage(o,"*",[i.port2])})}l(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const r=JSON.parse(t.data);if(!this.s)return e.postMessage(JSON.stringify({error:this.i+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const s=this.s(r,t);if(void 0===s)return;s.then((t={})=>{let r=void 0,s=void 0;"object"==typeof t&&null!==t&&(r=t.error,s=t.result),r?e.postMessage(JSON.stringify({error:r})):void 0!==s?e.postMessage(JSON.stringify({result:s})):e.postMessage(JSON.stringify({result:t}))},t=>{e.postMessage(JSON.stringify({error:this.h(t)}))})}catch(t){e.postMessage(JSON.stringify({error:this.h(t)}))}}h(t){if("string"==typeof t){const e=this.i+": "+t;return console.error(e),e}return t.message=this.i+": "+t.message,console.error(t),t.message}}const e=["127.0.0.1","localhost","0.0.0.0"],r=(t,e)=>{for(const s in e)try{e[s].constructor===Object?t[s]=r(t[s],e[s]):t[s]=e[s]}catch(r){t[s]=e[s]}return t},s=["language","browserLanguage","userLanguage","systemLanguage"],i=t=>{if(!t)return;const e=Object.keys(t);for(const r of e){const e=t[r];if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return i(e);if(Array.isArray(e)){for(const t of e)i(t);return}"true"!==e&&"false"!==e||(t[r]="true"===e)}},o=()=>/(android)/i.test(navigator.userAgent),n=(t,e,r)=>{let s=null;Object.defineProperty(t,e,{get:()=>s||r,set(t){(null==t?void 0:t.mute)?s=t.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),s=t)}})},l=()=>.01*window.innerHeight+"px",a=t=>{t&&setTimeout(()=>t.style.setProperty(h,l()),0)},h="--rml-full-height",c=new Map;module.exports=class{constructor(e,r,s,i){if(this.ui={callbacks:null},this.extended={callbacks:null},this.analytics={callbacks:{}},this.global={callbacks:{}},this.u={},!e||"string"!=typeof e.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(c.has(r))throw new Error("There is already an instance on this DOM element");if(!document.getElementById("rml-styles")){const t=s.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id="rml-styles";const r="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((t,e)=>t+(e+r),"")+r,o=l();e.innerHTML=`\n .rml-container{${h}:${o};}\n .rml-pos{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${i}}\n .rml-fill{width:100%;height:100%;opacity:1}\n .rml-android-height{height:calc(var(${h},1vh)*100)}\n .rml-overflow-hidden{overflow:hidden}\n `,document.head.appendChild(e)}this.m=this.m.bind(this),o()&&window.addEventListener("resize",this.m),this.g=r,this.u=s,this.p=e;const n=this.v();this.O=this.O.bind(this),this.N=this.N.bind(this),this.P=this.P.bind(this),this._=new t("website",window,null,this.N),this.J=i,this.g.appendChild(n),this.S=n,c.set(r,!0)}static createPlanner(t,e,r){return this.k(t,e,r)}static createConfigurator(t,e,r){return this.k(t,e,r)}static create(t,e,r){return this.k(t,e,r)}static createViewer(t,e,r){return this.k(t,e,r)}static k(t,o,n){return new Promise(async(l,a)=>{try{const a=r((()=>{const t={};t.locale||(t.locale=((t=null)=>{const e=window.navigator;if(t)return t.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=s.length;t<r;t++){const r=e[s[t]];if(r)return r.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const r=(()=>{const t=(()=>{try{return window.self!==window.top}catch(t){return!0}})();let e=window.location.href;if(t){if(!document.referrer)return null;e=document.referrer}const{hostname:r}=new URL(e);return r})();return r&&(t=>!!e.includes(t)||!!t.endsWith("roomle.com")||!(!t.endsWith("gitlab.io")&&!t.endsWith("gitlab.com")))(r)&&(t.configuratorId="demoConfigurator"),t.customApiUrl="https://www.roomle.com/api/v2",t.emails=!1,t})(),(t=>(i(t),(null==t?void 0:t.customApiUrl)&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(n));a.featureFlags||(a.featureFlags={}),"boolean"!=typeof a.featureFlags.realPartList&&(a.featureFlags.realPartList=!0),"boolean"!=typeof a.featureFlags.globalCallbacks&&(a.featureFlags.globalCallbacks=!0);const h=await(async(t,e)=>{if("string"!=typeof t)throw new Error('Configurator ID is not a string type: "'+typeof t+'"');const r=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",s=e.overrideTenant||9,i=r+"/configurators/"+t,o="03-"+window.btoa((new Date).toISOString()+";anonymous;roomle_portal_v2"),n=new Request(i,{method:"GET",headers:new Headers({apiKey:"roomle_portal_v2",currentTenant:s,locale:"en",language:"en",device:1,token:o,platform:"web"}),mode:"cors",cache:"default"}),l=await fetch(n),{configurator:a}=await l.json();return a})(t,a);return n=((t,e)=>{e.configuratorId=t.id;const s=t.settings||{};return!e.overrideTenant&&t.tenant&&(e.overrideTenant=t.tenant),((t,e)=>{const s=JSON.parse(JSON.stringify(t));return r(s,e)})(s,e)})(h,a),new this(h,o,n,l)}catch(t){return a(t)}})}teardown(){this.g&&c.delete(this.g);const t=this.g.querySelector("iframe");t&&this.g.removeChild(t),window.removeEventListener("resize",this.m)}v(){var t;const e=document.createElement("iframe");let r=(null===(t=this.p)||void 0===t?void 0:t.url)||"https://www.roomle.com/t/cp/";return this.u.useLocalRoomle&&(r=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(r=location.href.replace("embedding.html","index.html")),this.u.overrideServerUrl&&(r=this.u.overrideServerUrl),e.src=r,e.classList.add("rml-container"),e.classList.add("rml-fill"),e}m(){a(this.S)}O(){this.S.classList.add("rml-pos"),document.documentElement.classList.add("rml-overflow-hidden"),window.document.body.classList.add("rml-overflow-hidden"),o()&&(a(this.S),this.S.classList.add("rml-android-height"))}P(){this.S.classList.remove("rml-pos"),this.S.classList.remove("rml-android-height"),document.documentElement.classList.remove("rml-overflow-hidden"),window.document.body.classList.remove("rml-overflow-hidden")}N({message:t,args:e},r){var s;if(!r.source)return;if(r.source!==(null===(s=this.S)||void 0===s?void 0:s.contentWindow))return;if("requestBoot"===t)return this._.setOutgoingMessageBus(r.source),Promise.resolve({result:this.u});if("setup"===t){const{methods:t,callbacks:r}=e[0];return t.forEach(t=>{const e=t.split("."),r=e[0],s=e[1];this[r]||(this[r]={}),this[r][s]=function(){return this._.sendMessage(t,[...arguments])}.bind(this)}),r.forEach(t=>{const e=t.split("."),r=e[0],s=e[1],i=e[2];this[r]||(this[r]={}),this[r][s]||(this[r][s]={}),this[r][s][i]=()=>{}}),n(this.ui.callbacks,"onUseFullPage",this.O),n(this.ui.callbacks,"onBackToWebsite",this.P),this.J(this),setTimeout(()=>this._.sendMessage("websiteReady"),0),Promise.resolve({result:null})}const i=t.split("."),o=i[0],l=i[1],a=3===i.length?i[2]:null;if(a&&this[o][l][a]){const t=this[o][l][a](...e);return t instanceof Promise?t.then(t=>({result:t})):void 0!==t?Promise.resolve({result:t}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}};