@roomle/embedding-lib 4.24.0 → 4.25.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/api/.nojekyll +1 -0
- package/docs/api/README.md +1 -1
- package/docs/api/classes/{exposed_analytics_callbacks.exposedanalyticscallbacks.md → exposed_analytics_callbacks.ExposedAnalyticsCallbacks.md} +11 -9
- package/docs/api/classes/exposed_api.ExposedApi.md +255 -0
- package/docs/api/classes/exposed_callbacks.ExposedCallbacks.md +171 -0
- package/docs/api/classes/roomle_configurator_api.default.md +78 -42
- package/docs/api/enums/types.UI_BUTTON.md +208 -0
- package/docs/api/interfaces/exposed_callbacks.Labels.md +32 -0
- package/docs/api/interfaces/exposed_callbacks.Price.md +32 -0
- package/docs/api/interfaces/roomle_configurator_api.RoomleEmbeddingApiKeys.md +58 -0
- package/docs/api/interfaces/types.ConfiguratorSettings.md +150 -0
- package/docs/api/interfaces/types.EmbeddingSkin.md +65 -0
- package/docs/api/interfaces/types.UiInitData.md +1204 -0
- package/docs/api/interfaces/{types.variantsmap.md → types.VariantsMap.md} +1 -1
- package/docs/api/modules/exposed_analytics_callbacks.md +1 -1
- package/docs/api/modules/exposed_api.md +1 -1
- package/docs/api/modules/exposed_callbacks.md +3 -3
- package/docs/api/modules/roomle_configurator_api.md +13 -7
- package/docs/api/modules/types.md +5 -5
- package/docs/index.md +31 -0
- package/docs/md/web/ui/EMBEDDING-CHANGELOG.md +67 -7
- package/package.json +28 -1
- package/roomle-configurator-api.cjs.js +47 -3
- package/roomle-configurator-api.cjs.min.js +1 -1
- package/roomle-configurator-api.es.js +47 -3
- package/roomle-configurator-api.es.min.js +1 -1
- package/roomle-configurator-api.js +47 -3
- package/types/index.d.ts +190 -129
- package/types/src/common/store/collection-view-state.d.ts +2 -2
- package/types/src/common/store/index.d.ts +6 -0
- package/types/src/common/utils/helper.d.ts +3 -0
- package/types/src/common/utils/types.d.ts +3 -2
- package/types/src/configurator/business-logic/sdk-connector.d.ts +1 -0
- package/types/src/configurator/components/-utils/overlays.d.ts +8 -8
- package/types/src/configurator/components/grid-view/-utils/GridViewHelper.d.ts +3 -0
- package/types/src/configurator/embedding/exposed-api.d.ts +10 -0
- package/types/src/configurator/embedding/types.d.ts +7 -1
- package/types/src/configurator/store/ui-state.d.ts +19 -3
- package/types/tests/helpers/data/variants.d.ts +60 -0
- package/types/tests/helpers/mocks/sdk-connector-planner.d.ts +13 -0
- package/types/tests/helpers/mocks/sdk-connector.d.ts +5 -0
- package/types/tests/integration/configurator/components/{overlays/PartList.spec.d.ts → parameters/types/ProductVariant.spec.d.ts} +0 -0
- package/types/tests/integration/planner/components/BottomBar.spec.d.ts +1 -0
- package/docs/api/classes/exposed_api.exposedapi.md +0 -191
- package/docs/api/classes/exposed_callbacks.exposedcallbacks.md +0 -145
- package/docs/api/enums/types.ui_button.md +0 -145
- package/docs/api/interfaces/exposed_callbacks.labels.md +0 -28
- package/docs/api/interfaces/exposed_callbacks.price.md +0 -28
- package/docs/api/interfaces/roomle_configurator_api.roomleembeddingapikeys.md +0 -50
- package/docs/api/interfaces/types.configuratorsettings.md +0 -118
- package/docs/api/interfaces/types.embeddingskin.md +0 -55
- package/docs/api/interfaces/types.uiinitdata.md +0 -957
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
### Classes
|
|
8
8
|
|
|
9
|
-
- [ExposedCallbacks](../classes/exposed_callbacks.
|
|
9
|
+
- [ExposedCallbacks](../classes/exposed_callbacks.ExposedCallbacks.md)
|
|
10
10
|
|
|
11
11
|
### Interfaces
|
|
12
12
|
|
|
13
|
-
- [Labels](../interfaces/exposed_callbacks.
|
|
14
|
-
- [Price](../interfaces/exposed_callbacks.
|
|
13
|
+
- [Labels](../interfaces/exposed_callbacks.Labels.md)
|
|
14
|
+
- [Price](../interfaces/exposed_callbacks.Price.md)
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
### Interfaces
|
|
12
12
|
|
|
13
|
-
- [RoomleEmbeddingApiKeys](../interfaces/roomle_configurator_api.
|
|
13
|
+
- [RoomleEmbeddingApiKeys](../interfaces/roomle_configurator_api.RoomleEmbeddingApiKeys.md)
|
|
14
14
|
|
|
15
15
|
### Type aliases
|
|
16
16
|
|
|
@@ -22,22 +22,28 @@
|
|
|
22
22
|
|
|
23
23
|
### RoomleConfiguratorApi
|
|
24
24
|
|
|
25
|
-
Ƭ **RoomleConfiguratorApi**: [
|
|
25
|
+
Ƭ **RoomleConfiguratorApi**: [`default`](../classes/roomle_configurator_api.default.md)<`RoomleConfigurator`, `ConfiguratorUiCallbacks`\>
|
|
26
26
|
|
|
27
|
-
Defined in
|
|
27
|
+
#### Defined in
|
|
28
|
+
|
|
29
|
+
[src/configurator/embedding/roomle-configurator-api.ts:69](https://gitlab.com/roomle/web/roomle-ui/-/blob/353723c4/src/configurator/embedding/roomle-configurator-api.ts#L69)
|
|
28
30
|
|
|
29
31
|
___
|
|
30
32
|
|
|
31
33
|
### RoomlePlannerApi
|
|
32
34
|
|
|
33
|
-
Ƭ **RoomlePlannerApi**: [
|
|
35
|
+
Ƭ **RoomlePlannerApi**: [`default`](../classes/roomle_configurator_api.default.md)<`RoomlePlanner`, `ConfiguratorUiCallbacks`\>
|
|
36
|
+
|
|
37
|
+
#### Defined in
|
|
34
38
|
|
|
35
|
-
|
|
39
|
+
[src/configurator/embedding/roomle-configurator-api.ts:71](https://gitlab.com/roomle/web/roomle-ui/-/blob/353723c4/src/configurator/embedding/roomle-configurator-api.ts#L71)
|
|
36
40
|
|
|
37
41
|
___
|
|
38
42
|
|
|
39
43
|
### RoomleViewerApi
|
|
40
44
|
|
|
41
|
-
Ƭ **RoomleViewerApi**: [
|
|
45
|
+
Ƭ **RoomleViewerApi**: [`default`](../classes/roomle_configurator_api.default.md)<`RoomleGLBViewer`, `ConfiguratorUiCallbacks`\>
|
|
46
|
+
|
|
47
|
+
#### Defined in
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
[src/configurator/embedding/roomle-configurator-api.ts:70](https://gitlab.com/roomle/web/roomle-ui/-/blob/353723c4/src/configurator/embedding/roomle-configurator-api.ts#L70)
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
|
|
7
7
|
### Enumerations
|
|
8
8
|
|
|
9
|
-
- [UI\_BUTTON](../enums/types.
|
|
9
|
+
- [UI\_BUTTON](../enums/types.UI_BUTTON.md)
|
|
10
10
|
|
|
11
11
|
### Interfaces
|
|
12
12
|
|
|
13
|
-
- [ConfiguratorSettings](../interfaces/types.
|
|
14
|
-
- [EmbeddingSkin](../interfaces/types.
|
|
15
|
-
- [UiInitData](../interfaces/types.
|
|
16
|
-
- [VariantsMap](../interfaces/types.
|
|
13
|
+
- [ConfiguratorSettings](../interfaces/types.ConfiguratorSettings.md)
|
|
14
|
+
- [EmbeddingSkin](../interfaces/types.EmbeddingSkin.md)
|
|
15
|
+
- [UiInitData](../interfaces/types.UiInitData.md)
|
|
16
|
+
- [VariantsMap](../interfaces/types.VariantsMap.md)
|
package/docs/index.md
CHANGED
|
@@ -384,6 +384,8 @@ export enum UI_BUTTON {
|
|
|
384
384
|
PAUSECONFIGURE = 'pauseconfigure',
|
|
385
385
|
EXPORT_3D = 'export3d',
|
|
386
386
|
ROTATE = 'rotate',
|
|
387
|
+
UNDO = 'undo',
|
|
388
|
+
REDO = 'redo'
|
|
387
389
|
}
|
|
388
390
|
```
|
|
389
391
|
|
|
@@ -783,10 +785,39 @@ To see which labels exist you can take a look at the [API documentation](./api/i
|
|
|
783
785
|
You can test and play around with those settings in this CodeSandbox:
|
|
784
786
|
[](https://codesandbox.io/s/intelligent-merkle-s589m?fontsize=14&hidenavigation=1&theme=dark)
|
|
785
787
|
|
|
788
|
+
### Implementing a custom share pop up
|
|
789
|
+
|
|
790
|
+
If you want to fully customize the share experience of your users you can do this by implementing your own pop-up. Therefore you need to apply the knowledge you already have from the section ["React on button clicks"](#react-on-button-clicks). In that specific case you need to wait for the click on the button `savedraft`. Since you want to implement your own share logic you just need to return `true` to indicate that you want to disable the default behavior. Now the event "click savedraft" is your hook to execute your own logic. This can vary widely depending on what you want to do but a very basic idea and gist is implemented inside the following CodeSandbox:
|
|
791
|
+
|
|
792
|
+
[](https://codesandbox.io/s/custom-share-functionality-gou3u?file=/index.js?fontsize=14&hidenavigation=1&theme=dark)
|
|
793
|
+
|
|
786
794
|
### Customize/change the UI
|
|
787
795
|
|
|
788
796
|
Learn more about UI elements and how to change them in the configurator tutorial about [UI Customization](../guides/tutorial/configurator/08_UI_customization.html).
|
|
789
797
|
|
|
798
|
+
### Image of current configuration/product
|
|
799
|
+
|
|
800
|
+
There are two ways to get an image/render of the current configuration shown in the Rubens configurator:
|
|
801
|
+
|
|
802
|
+
- 3D / Perspective Image
|
|
803
|
+
- 2D / Top Image
|
|
804
|
+
|
|
805
|
+
If you are using the SDK you can use [preparePerspectiveImage](./api/classes/roomleconfigurator.html#prepareperspectiveimage) or [prepareTopImage](./api/classes/roomleconfigurator.html#preparetopimage) directly on the `RoomleConfigurator` instance.
|
|
806
|
+
|
|
807
|
+
In case you are using the `EmbeddingLib`, you can use those calls on the `extended` object of the interface. For example:
|
|
808
|
+
|
|
809
|
+
```JavaScript
|
|
810
|
+
const configurator = await RoomleConfiguratorApi.create(
|
|
811
|
+
'demoConfigurator',
|
|
812
|
+
document.getElementById('configurator-container'),
|
|
813
|
+
{...options}
|
|
814
|
+
);
|
|
815
|
+
const base64Image = await configurator.extended.preparePerspectiveImage({
|
|
816
|
+
showDimensions: true
|
|
817
|
+
});
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
|
|
790
821
|
<!---
|
|
791
822
|
### Multiple objects
|
|
792
823
|
|
|
@@ -1,11 +1,71 @@
|
|
|
1
|
-
## [4.
|
|
1
|
+
## [4.25.0-alpha.1](https://gitlab.com/roomle/web/roomle-ui/compare/embedding-v4.24.1-alpha.2...embedding-v4.25.0-alpha.1) (2022-04-06)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Features
|
|
5
5
|
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* add gap between boolean buttons, because of style reasons ([62ef422](https://gitlab.com/roomle/web/roomle-ui/commit/62ef42288187872fbfa1273f5381cd359dc08c35))
|
|
7
|
+
* add insertObject API to add items to the MOC scene ([213d465](https://gitlab.com/roomle/web/roomle-ui/commit/213d4659523d8660ca99da5b41b772a1307d6a04))
|
|
8
|
+
* add possibility to disable and overwrite undo and redo button ([e06e55c](https://gitlab.com/roomle/web/roomle-ui/commit/e06e55c06db2bfef09cdf41c9367c9e4e05bae76))
|
|
9
|
+
* add snapping button to MOC ([b18ec7e](https://gitlab.com/roomle/web/roomle-ui/commit/b18ec7e1e9d58f0a9c5b11fe20f3bd9b5fba7885))
|
|
10
|
+
* add tests for checking if id gets set properly in store and if callback function sets store to null again ([3bcbdfb](https://gitlab.com/roomle/web/roomle-ui/commit/3bcbdfb8d3d51279f2a103e1a126dea937da7cc0))
|
|
11
|
+
* add undo redo functionality to buttons in planner ([b44c342](https://gitlab.com/roomle/web/roomle-ui/commit/b44c342d44034468cf43feeb3a310e68f6ca0beb))
|
|
12
|
+
* add undo/redo button in topbar, add callback function and save it to the store ([497a91c](https://gitlab.com/roomle/web/roomle-ui/commit/497a91c22d7d908135453dab0d676fbc21bd3c18))
|
|
13
|
+
* do not show warning if we didn't change anything ([8388a31](https://gitlab.com/roomle/web/roomle-ui/commit/8388a31ba238a4e3f391a286e5d9355a97d30e77))
|
|
14
|
+
* enable selection of multiple categories for materials ([8ba5739](https://gitlab.com/roomle/web/roomle-ui/commit/8ba5739efa0a1511a99ad7d524da1de2c43bab17))
|
|
15
|
+
* highlight parts in the scene when hovering over them in the partlist ([275985c](https://gitlab.com/roomle/web/roomle-ui/commit/275985cb36d15c7ed9141a027bcff9b975c9a388))
|
|
16
|
+
* only show price header in part list if a price is available ([226cdbf](https://gitlab.com/roomle/web/roomle-ui/commit/226cdbfdab06cd424f32f434ebb8491fe493df66))
|
|
17
|
+
* only show variant warning if necessary ([3cdf3aa](https://gitlab.com/roomle/web/roomle-ui/commit/3cdf3aab0027f11b6e54f0b0f094ba051e3bd6d8))
|
|
18
|
+
* show parameters when changing groups or addons ([3dd4809](https://gitlab.com/roomle/web/roomle-ui/commit/3dd4809ea4b9d1098be1240e652792e2e88bc843))
|
|
19
|
+
* update to newest SDK version 2.24.0-alpha.1 ([4ecc431](https://gitlab.com/roomle/web/roomle-ui/commit/4ecc43199849854df35fd19b933f9c07112ba9fe))
|
|
20
|
+
* upgrade SDK to 2.20.0-alpha.1 ([4d3914d](https://gitlab.com/roomle/web/roomle-ui/commit/4d3914dc8493ed6b2c77c75baf7a2224ef89935d))
|
|
21
|
+
* upgrade SDK to version 2.20.0 ([07bd456](https://gitlab.com/roomle/web/roomle-ui/commit/07bd45669613da41d9d72c436b93c224e11eb93a))
|
|
22
|
+
* upgrade SDK to version 2.20.0-alpha.3 ([b29f317](https://gitlab.com/roomle/web/roomle-ui/commit/b29f3171a6521479665742fae79ef285bbb5acd5))
|
|
23
|
+
* upgrade SDK to version 2.20.0-alpha.4 ([e3db2b7](https://gitlab.com/roomle/web/roomle-ui/commit/e3db2b74748c23c079259bb69c1597eb780cbb64))
|
|
24
|
+
* upgrade SDK to version 2.21.0-alpha.1 ([24c7202](https://gitlab.com/roomle/web/roomle-ui/commit/24c7202cd676421b4166b50468eddc1920063caa))
|
|
25
|
+
* upgrade SDK to version 2.22.0 ([a25ed2a](https://gitlab.com/roomle/web/roomle-ui/commit/a25ed2a0aa33f794a71c9a431dd02680420e7e38))
|
|
26
|
+
* upgrade SDK to version 2.22.0-alpha.1 ([d746132](https://gitlab.com/roomle/web/roomle-ui/commit/d746132d00156854749c9e0ea0678c3f6463abec))
|
|
27
|
+
* upgrade SDK to version 2.22.0-alpha.2 ([393ea48](https://gitlab.com/roomle/web/roomle-ui/commit/393ea485386c2cc2556ef8b56e648fc826972903))
|
|
28
|
+
* upgrade SDK to version 2.22.0-alpha.3 ([7e1f511](https://gitlab.com/roomle/web/roomle-ui/commit/7e1f5111790a5b0ad7fda3f9a0d8a814a9b84173))
|
|
29
|
+
* upgrade SDK to version 2.22.0-alpha.4 ([f0f7450](https://gitlab.com/roomle/web/roomle-ui/commit/f0f7450e97b6c9214102f8c08d0a74f5c88bb1b7))
|
|
30
|
+
* upgrade SDK to version 2.23.0 ([c12b566](https://gitlab.com/roomle/web/roomle-ui/commit/c12b56610067f103d5a81763979b66c0ed4030d2))
|
|
31
|
+
* upgrade SDK to version 2.23.0-alpha.1 ([8be7069](https://gitlab.com/roomle/web/roomle-ui/commit/8be70698546aff1498d34f389f9ec17f0c955029))
|
|
32
|
+
* upgrade SDK to version 2.24.0-alpha.1 ([d9b36f8](https://gitlab.com/roomle/web/roomle-ui/commit/d9b36f862c23d6ecd5cf76e0871d70091184ec6d))
|
|
33
|
+
* upgrade SDK to version 2.24.0-alpha.2 ([fac1868](https://gitlab.com/roomle/web/roomle-ui/commit/fac18686fbdfc3087b3ef4612b862c769fbdfc41))
|
|
34
|
+
* upgrade SDK to version 2.28.0-alpha.2 ([b87ec4a](https://gitlab.com/roomle/web/roomle-ui/commit/b87ec4a9cb579f0f913e9d15aa2e55aba61b71c2))
|
|
35
|
+
* upgrade SDK to version 2.28.0-alpha.3 ([65cb89b](https://gitlab.com/roomle/web/roomle-ui/commit/65cb89b96da9ea0cca095034e5fde2a92545da0c))
|
|
36
|
+
* upgrade SDK to version 2.29.0-alpha.1 ([c44c6bd](https://gitlab.com/roomle/web/roomle-ui/commit/c44c6bdd98348e1b844deb27b56dfc0ce0a6a613))
|
|
37
|
+
* **SDK:** upgrade to version 2.21.0 ([b16a2e3](https://gitlab.com/roomle/web/roomle-ui/commit/b16a2e3336677c520192a7cb4e99372bab830c50))
|
|
38
|
+
* **SDK:** upgrade to version 2.24.0 ([a239abd](https://gitlab.com/roomle/web/roomle-ui/commit/a239abdda583a92c7873e11f53b000ec5985e2e0))
|
|
39
|
+
* **SDK:** upgrade to version 2.25.0 ([8a4e033](https://gitlab.com/roomle/web/roomle-ui/commit/8a4e0339d668cb38500604e51c4070a37441f6d4))
|
|
40
|
+
* **SDK:** upgrade to version 2.26.0 ([708f644](https://gitlab.com/roomle/web/roomle-ui/commit/708f644f912e3b5b63aad1845470036bf815eca5))
|
|
41
|
+
* **SDK:** upgrade to version 2.27.0 ([49e703a](https://gitlab.com/roomle/web/roomle-ui/commit/49e703ac28aac0abf0fdfa0bb135902330e9221c))
|
|
42
|
+
* **SDK:** upgrade to version 2.27.0-alpha.2 ([202a9a3](https://gitlab.com/roomle/web/roomle-ui/commit/202a9a3b4f01aad618164a81c17031e1f9800b50))
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
### Bug Fixes
|
|
46
|
+
|
|
47
|
+
* always set id when loading plan xml ([f672b68](https://gitlab.com/roomle/web/roomle-ui/commit/f672b68c5ff856fbf4c4a3a233d513d59a13eb90))
|
|
48
|
+
* autocomplete of email input at save draft ([d0c72b6](https://gitlab.com/roomle/web/roomle-ui/commit/d0c72b6dee313e3cd8275dfcdf3f3f8f01a54278))
|
|
49
|
+
* autocomplete of email input with right line spacing at save draft ([0ea5900](https://gitlab.com/roomle/web/roomle-ui/commit/0ea5900b88cbb80e75db7f6eb380403abcdaa744))
|
|
50
|
+
* change wrong visibility in Safari parts list ([5be3493](https://gitlab.com/roomle/web/roomle-ui/commit/5be3493a8f816aa90262bd74112f86dc186557f1))
|
|
51
|
+
* check if undo or redo button fuctionalitiy are overwritten ([5b65415](https://gitlab.com/roomle/web/roomle-ui/commit/5b65415b07846d6e52075edfd66c9a1c76c1ad41))
|
|
52
|
+
* disable savedraft and requestPlan button in planner ([cd66284](https://gitlab.com/roomle/web/roomle-ui/commit/cd66284a6adcb2c1bea4965b069f7babc06c52d7))
|
|
53
|
+
* disable undo and redo button completely by initData ([4420916](https://gitlab.com/roomle/web/roomle-ui/commit/44209162cc11c865f018d615da9b796cd8bf018f))
|
|
54
|
+
* don't disable undo/redo button fully to prevent jumping buttons ([c459504](https://gitlab.com/roomle/web/roomle-ui/commit/c459504d13ab2ef343e7bfb1e5d24823c5a39448))
|
|
55
|
+
* error message bug, added rightly in loco ([a530ef6](https://gitlab.com/roomle/web/roomle-ui/commit/a530ef6930126a4738b8449fb35bcd2c881668f1))
|
|
56
|
+
* eslint warnings ([2b187a0](https://gitlab.com/roomle/web/roomle-ui/commit/2b187a0d62fb851e9305ab0d4cc5c2a318bd3543))
|
|
57
|
+
* failing tests ([2b2aa0d](https://gitlab.com/roomle/web/roomle-ui/commit/2b2aa0d7f9a72258582fa7b03b90f5493fc7fe03))
|
|
58
|
+
* fix failing tests ([d6cfa77](https://gitlab.com/roomle/web/roomle-ui/commit/d6cfa7731ed52ab2793be0c4e5351042beb9647b))
|
|
59
|
+
* make generic error pop unclickable ([5b9fb6e](https://gitlab.com/roomle/web/roomle-ui/commit/5b9fb6e3b08446c242d12c869ee301ee314dd5f6))
|
|
60
|
+
* only reset last selected variant if some changes happened ([58a15c0](https://gitlab.com/roomle/web/roomle-ui/commit/58a15c0dcf10adf4b802405e7ab2e09f49f747e7))
|
|
61
|
+
* pass correct object in tests so that the test does not break ([c8d8c2d](https://gitlab.com/roomle/web/roomle-ui/commit/c8d8c2dcda2ab185f6ba211ccf7d6e4fa3ea4cfa))
|
|
62
|
+
* scroll to the top of sidebar if parameter group got changed ([84619ae](https://gitlab.com/roomle/web/roomle-ui/commit/84619aedf2ba5b1af3fa1e40a43cb8ce04b30b37))
|
|
63
|
+
* send AR user actions when opened with a QR code ([b855cb2](https://gitlab.com/roomle/web/roomle-ui/commit/b855cb2f49a21fc81f9b1281f888cead305d5ba6))
|
|
64
|
+
* send save draft user action when sharing a configuration ([2c25fbf](https://gitlab.com/roomle/web/roomle-ui/commit/2c25fbffd5a2361c0ea23a2885a3353568ceab59))
|
|
65
|
+
* send user action save draft when not using emails ([98545f3](https://gitlab.com/roomle/web/roomle-ui/commit/98545f3c40485ef32c594acd19dfe157473c6609))
|
|
66
|
+
* set correct mail type for save configuration ([0531717](https://gitlab.com/roomle/web/roomle-ui/commit/05317177d3bfa122cb0955f2da0b9916cd0c02e6))
|
|
67
|
+
* show error message if configurable or static item breaks when loading ([68f01b3](https://gitlab.com/roomle/web/roomle-ui/commit/68f01b31c5ad5b824237fefc2835b65e6b07021f))
|
|
68
|
+
* upgrade SDK to version 2.28.0 ([35d549f](https://gitlab.com/roomle/web/roomle-ui/commit/35d549ffd3e7d22ae98bdbbae47ebbd364c33ed2))
|
|
69
|
+
* use promise so that mock is "really" async ([ce83dd0](https://gitlab.com/roomle/web/roomle-ui/commit/ce83dd0a4608331aee98ba7c375c656f50743c48))
|
|
70
|
+
* use volta to pin node version which works on all machines ([170d7e2](https://gitlab.com/roomle/web/roomle-ui/commit/170d7e2380b8266ab09b9a0bd2250c9097c9227a))
|
|
71
|
+
* wrap email input in form for fix autocomplete bug in firefox, preventDefault because firefox only want one onClick action ([629b618](https://gitlab.com/roomle/web/roomle-ui/commit/629b618152c3d11a0b0abb7e485e273566330b6a))
|
package/package.json
CHANGED
|
@@ -1 +1,28 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@roomle/embedding-lib",
|
|
3
|
+
"version": "4.25.0-alpha.1",
|
|
4
|
+
"main": "roomle-configurator-api.es.min.js",
|
|
5
|
+
"types": "types/index.d.ts",
|
|
6
|
+
"author": "Roomle Development",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@roomle/web-sdk": "2.29.0-alpha.1"
|
|
9
|
+
},
|
|
10
|
+
"devDependencies": {
|
|
11
|
+
"@semantic-release/changelog": "^5.0.1",
|
|
12
|
+
"@semantic-release/exec": "^5.0.0",
|
|
13
|
+
"conventional-changelog-conventionalcommits": "^4.2.3",
|
|
14
|
+
"semantic-release": "^17.0.7"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"release": "semantic-release"
|
|
18
|
+
},
|
|
19
|
+
"description": "This is a small library which can be used to communicate with the Roomle Configurator",
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/roomle-build/npm-packages.git"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"license": "MIT"
|
|
28
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
require('@/common/styles/Global.module.scss');
|
|
4
|
+
|
|
3
5
|
class MessageHandler {
|
|
4
6
|
constructor(side, incomingMessageBus, outgoingMessageBus, messageExecution) {
|
|
5
7
|
this._outgoingMessageBus = null;
|
|
@@ -162,6 +164,51 @@ const isInIframe = () => {
|
|
|
162
164
|
}
|
|
163
165
|
};
|
|
164
166
|
|
|
167
|
+
// see why: so#/58065241/10800831
|
|
168
|
+
const isAndroid = () => /(android)/i.test(navigator.userAgent);
|
|
169
|
+
|
|
170
|
+
/* TO DOs in Google Analytics Admin UI
|
|
171
|
+
|
|
172
|
+
To track the Hit ID, Hit Time, and Hit Type and custom dimensions, first create them in Google Analytics
|
|
173
|
+
and set their scope to "Hit"
|
|
174
|
+
|
|
175
|
+
Once you've created the custom metrics in Google Analytics
|
|
176
|
+
(and set their scope to "Hit" and their formatting type to "Integer")
|
|
177
|
+
this setup is ready to go. You need to do this in every GA property
|
|
178
|
+
|
|
179
|
+
For more details see: https://philipwalton.com/articles/the-google-analytics-setup-i-use-on-every-site-i-build/
|
|
180
|
+
|
|
181
|
+
*/
|
|
182
|
+
// Probably we could add const enums here
|
|
183
|
+
// but we need to investigate: https://roomle.atlassian.net/browse/CONF-238
|
|
184
|
+
var GA_CUSTOM;
|
|
185
|
+
(function (GA_CUSTOM) {
|
|
186
|
+
GA_CUSTOM["DIMENSION"] = "dimension";
|
|
187
|
+
GA_CUSTOM["METRIC"] = "metric";
|
|
188
|
+
})(GA_CUSTOM || (GA_CUSTOM = {}));
|
|
189
|
+
var GA_HIT_TYPE;
|
|
190
|
+
(function (GA_HIT_TYPE) {
|
|
191
|
+
GA_HIT_TYPE["EVENT"] = "event";
|
|
192
|
+
})(GA_HIT_TYPE || (GA_HIT_TYPE = {}));
|
|
193
|
+
var GA_ACTION_TYPE;
|
|
194
|
+
(function (GA_ACTION_TYPE) {
|
|
195
|
+
GA_ACTION_TYPE["EXCEPTION"] = "exception";
|
|
196
|
+
GA_ACTION_TYPE["TIMING"] = "timing_complete";
|
|
197
|
+
})(GA_ACTION_TYPE || (GA_ACTION_TYPE = {}));
|
|
198
|
+
var CUSTOM_ACTION_TYPE;
|
|
199
|
+
(function (CUSTOM_ACTION_TYPE) {
|
|
200
|
+
CUSTOM_ACTION_TYPE["TRACK_TIMING"] = "track_timing";
|
|
201
|
+
})(CUSTOM_ACTION_TYPE || (CUSTOM_ACTION_TYPE = {}));
|
|
202
|
+
var GA_CATEGORY;
|
|
203
|
+
(function (GA_CATEGORY) {
|
|
204
|
+
GA_CATEGORY["ERROR"] = "Error";
|
|
205
|
+
GA_CATEGORY["NAVIGATION_TIMING"] = "Navigation Timing";
|
|
206
|
+
GA_CATEGORY["TIMING"] = "Timing";
|
|
207
|
+
GA_CATEGORY["INTERACTION"] = "Interaction";
|
|
208
|
+
GA_CATEGORY["TRACKING"] = "Tracking";
|
|
209
|
+
GA_CATEGORY["DEPRECATION"] = "Deprecation";
|
|
210
|
+
})(GA_CATEGORY || (GA_CATEGORY = {}));
|
|
211
|
+
|
|
165
212
|
/**
|
|
166
213
|
* Recursively merge properties of two objects.
|
|
167
214
|
* If a property exists in both it, property of obj2 is used.
|
|
@@ -314,9 +361,6 @@ const getFallbackInitData = () => {
|
|
|
314
361
|
const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';
|
|
315
362
|
const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';
|
|
316
363
|
|
|
317
|
-
// see why: so#/58065241/10800831
|
|
318
|
-
const isAndroid = () => /(android)/i.test(navigator.userAgent);
|
|
319
|
-
|
|
320
364
|
const setDefaultBehaviour = (object, callbackName, defaultBehaviour) => {
|
|
321
365
|
let customBehaviour = null;
|
|
322
366
|
Object.defineProperty(object, callbackName, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";class t{constructor(t,e,r,
|
|
1
|
+
"use strict";require("@/common/styles/Global.module.scss");class t{constructor(t,e,r,i){this.t=null,this.i=null,this.o=t,this.s=e,this.t=r,this.i=i,this.s.addEventListener("message",this.l.bind(this))}setOutgoingMessageBus(t){this.t=t}setMessageExecution(t){this.i=t}sendMessage(t,e=[]){return new Promise((r,i)=>{const o=new MessageChannel;o.port1.onmessage=t=>{if(!t||!t.data)return o.port1.close(),o.port2.close(),i(new Error(this.o+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return o.port1.close(),o.port2.close(),this.h(t),i(t)}e.error?i(e.error):void 0!==e.result?r(e.result):r(),o.port1.close(),o.port2.close()};let s="";try{s=JSON.stringify({message:t,args:e})}catch(t){return i(new Error(this.o+": can not create command because it is not JSON.stringify able"))}if(!this.t)return i(new Error(this.o+": outgoing bus not set yet"));this.t.postMessage(s,"*",[o.port2])})}l(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const r=JSON.parse(t.data);if(!this.i)return e.postMessage(JSON.stringify({error:this.o+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const i=this.i(r,t);if(void 0===i)return;i.then((t={})=>{let r=void 0,i=void 0;"object"==typeof t&&null!==t&&(r=t.error,i=t.result),r?e.postMessage(JSON.stringify({error:r})):void 0!==i?e.postMessage(JSON.stringify({result:i})):e.postMessage(JSON.stringify({result:t}))},t=>{e.postMessage(JSON.stringify({error:this.h(t)}))})}catch(t){e.postMessage(JSON.stringify({error:this.h(t)}))}}h(t){if("string"==typeof t){const e=this.o+": "+t;return console.error(e),e}return t.message=this.o+": "+t.message,console.error(t),t.message}}const e=()=>/(android)/i.test(navigator.userAgent);var r,i,o,s,n;!function(t){t.DIMENSION="dimension",t.METRIC="metric"}(r||(r={})),function(t){t.EVENT="event"}(i||(i={})),function(t){t.EXCEPTION="exception",t.TIMING="timing_complete"}(o||(o={})),function(t){t.TRACK_TIMING="track_timing"}(s||(s={})),function(t){t.ERROR="Error",t.NAVIGATION_TIMING="Navigation Timing",t.TIMING="Timing",t.INTERACTION="Interaction",t.TRACKING="Tracking",t.DEPRECATION="Deprecation"}(n||(n={}));const a=(t,e)=>{for(const r in e)try{e[r].constructor===Object?t[r]=a(t[r],e[r]):t[r]=e[r]}catch(i){t[r]=e[r]}return t},l=["127.0.0.1","localhost","0.0.0.0"],c=["language","browserLanguage","userLanguage","systemLanguage"],h=t=>{if(!t)return;const e=Object.keys(t);for(const r of e){const e=t[r];if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return h(e);if(Array.isArray(e)){for(const t of e)h(t);return}"true"!==e&&"false"!==e||(t[r]="true"===e)}},u=(t,e,r)=>{let i=null;Object.defineProperty(t,e,{get:()=>i||r,set(t){(null==t?void 0:t.mute)?i=t.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),i=t)}})},d=()=>.01*window.innerHeight+"px",m=t=>{t&&setTimeout(()=>t.style.setProperty(f,d()),0)},f="--rml-full-height",w=new Map;module.exports=class{constructor(r,i,o,s){if(this.ui={callbacks:null},this.extended={callbacks:null},this.analytics={callbacks:{}},this.global={callbacks:{}},this.u={},!r||"string"!=typeof r.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(w.has(i))throw new Error("There is already an instance on this DOM element");if(!document.getElementById("rml-styles")){const t=o.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id="rml-styles";const r="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((t,e)=>t+(e+r),"")+r,s=d();e.innerHTML=`\n .rml-container{${f}:${s};}\n .rml-pos{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${i}}\n .rml-fill{width:100%;height:100%;opacity:1}\n .rml-android-height{height:calc(var(${f},1vh)*100)}\n .rml-overflow-hidden{overflow:hidden}\n `,document.head.appendChild(e)}this.m=this.m.bind(this),e()&&window.addEventListener("resize",this.m),this.g=i,this.u=o,this.p=r;const n=this.v();this.O=this.O.bind(this),this.N=this.N.bind(this),this._=this._.bind(this),this.P=new t("website",window,null,this.N),this.k=s,this.g.appendChild(n),this.J=n,w.set(i,!0)}static createPlanner(t,e,r){return this.S(t,e,r)}static createConfigurator(t,e,r){return this.S(t,e,r)}static create(t,e,r){return this.S(t,e,r)}static createViewer(t,e,r){return this.S(t,e,r)}static S(t,e,r){return new Promise(async(i,o)=>{try{const o=a((()=>{const t={};t.locale||(t.locale=((t=null)=>{const e=window.navigator;if(t)return t.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=c.length;t<r;t++){const r=e[c[t]];if(r)return r.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const e=(()=>{const t=(()=>{try{return window.self!==window.top}catch(t){return!0}})();let e=window.location.href;if(t){if(!document.referrer)return null;e=document.referrer}const{hostname:r}=new URL(e);return r})();return e&&(t=>!!l.includes(t)||!!t.endsWith("roomle.com")||!(!t.endsWith("gitlab.io")&&!t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl="https://www.roomle.com/api/v2",t.emails=!1,t})(),(t=>(h(t),(null==t?void 0:t.customApiUrl)&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(r));o.featureFlags||(o.featureFlags={}),"boolean"!=typeof o.featureFlags.realPartList&&(o.featureFlags.realPartList=!0),"boolean"!=typeof o.featureFlags.globalCallbacks&&(o.featureFlags.globalCallbacks=!0);const s=await(async(t,e)=>{if("string"!=typeof t)throw new Error('Configurator ID is not a string type: "'+typeof t+'"');const r=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",i=e.overrideTenant||9,o=r+"/configurators/"+t,s="03-"+window.btoa((new Date).toISOString()+";anonymous;roomle_portal_v2"),n=new Request(o,{method:"GET",headers:new Headers({apiKey:"roomle_portal_v2",currentTenant:i,locale:"en",language:"en",device:1,token:s,platform:"web"}),mode:"cors",cache:"default"}),a=await fetch(n),{configurator:l}=await a.json();return l})(t,o);return r=((t,e)=>{e.configuratorId=t.id;const r=t.settings||{};return!e.overrideTenant&&t.tenant&&(e.overrideTenant=t.tenant),((t,e)=>{const r=JSON.parse(JSON.stringify(t));return a(r,e)})(r,e)})(s,o),new this(s,e,r,i)}catch(t){return o(t)}})}teardown(){this.g&&w.delete(this.g);const t=this.g.querySelector("iframe");t&&this.g.removeChild(t),window.removeEventListener("resize",this.m)}v(){var t;const e=document.createElement("iframe");let r=(null===(t=this.p)||void 0===t?void 0:t.url)||"https://www.roomle.com/t/cp/";return this.u.useLocalRoomle&&(r=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(r=location.href.replace("embedding.html","index.html")),this.u.overrideServerUrl&&(r=this.u.overrideServerUrl),e.src=r,e.classList.add("rml-container"),e.classList.add("rml-fill"),e}m(){m(this.J)}O(){this.J.classList.add("rml-pos"),document.documentElement.classList.add("rml-overflow-hidden"),window.document.body.classList.add("rml-overflow-hidden"),e()&&(m(this.J),this.J.classList.add("rml-android-height"))}_(){this.J.classList.remove("rml-pos"),this.J.classList.remove("rml-android-height"),document.documentElement.classList.remove("rml-overflow-hidden"),window.document.body.classList.remove("rml-overflow-hidden")}N({message:t,args:e},r){var i;if(!r.source)return;if(r.source!==(null===(i=this.J)||void 0===i?void 0:i.contentWindow))return;if("requestBoot"===t)return this.P.setOutgoingMessageBus(r.source),Promise.resolve({result:this.u});if("setup"===t){const{methods:t,callbacks:r}=e[0];return t.forEach(t=>{const e=t.split("."),r=e[0],i=e[1];this[r]||(this[r]={}),this[r][i]=function(){return this.P.sendMessage(t,[...arguments])}.bind(this)}),r.forEach(t=>{const e=t.split("."),r=e[0],i=e[1],o=e[2];this[r]||(this[r]={}),this[r][i]||(this[r][i]={}),this[r][i][o]=()=>{}}),u(this.ui.callbacks,"onUseFullPage",this.O),u(this.ui.callbacks,"onBackToWebsite",this._),this.k(this),setTimeout(()=>this.P.sendMessage("websiteReady"),0),Promise.resolve({result:null})}const o=t.split("."),s=o[0],n=o[1],a=3===o.length?o[2]:null;if(a&&this[s][n][a]){const t=this[s][n][a](...e);return t instanceof Promise?t.then(t=>({result:t})):void 0!==t?Promise.resolve({result:t}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import '@/common/styles/Global.module.scss';
|
|
2
|
+
|
|
1
3
|
class MessageHandler {
|
|
2
4
|
constructor(side, incomingMessageBus, outgoingMessageBus, messageExecution) {
|
|
3
5
|
this._outgoingMessageBus = null;
|
|
@@ -160,6 +162,51 @@ const isInIframe = () => {
|
|
|
160
162
|
}
|
|
161
163
|
};
|
|
162
164
|
|
|
165
|
+
// see why: so#/58065241/10800831
|
|
166
|
+
const isAndroid = () => /(android)/i.test(navigator.userAgent);
|
|
167
|
+
|
|
168
|
+
/* TO DOs in Google Analytics Admin UI
|
|
169
|
+
|
|
170
|
+
To track the Hit ID, Hit Time, and Hit Type and custom dimensions, first create them in Google Analytics
|
|
171
|
+
and set their scope to "Hit"
|
|
172
|
+
|
|
173
|
+
Once you've created the custom metrics in Google Analytics
|
|
174
|
+
(and set their scope to "Hit" and their formatting type to "Integer")
|
|
175
|
+
this setup is ready to go. You need to do this in every GA property
|
|
176
|
+
|
|
177
|
+
For more details see: https://philipwalton.com/articles/the-google-analytics-setup-i-use-on-every-site-i-build/
|
|
178
|
+
|
|
179
|
+
*/
|
|
180
|
+
// Probably we could add const enums here
|
|
181
|
+
// but we need to investigate: https://roomle.atlassian.net/browse/CONF-238
|
|
182
|
+
var GA_CUSTOM;
|
|
183
|
+
(function (GA_CUSTOM) {
|
|
184
|
+
GA_CUSTOM["DIMENSION"] = "dimension";
|
|
185
|
+
GA_CUSTOM["METRIC"] = "metric";
|
|
186
|
+
})(GA_CUSTOM || (GA_CUSTOM = {}));
|
|
187
|
+
var GA_HIT_TYPE;
|
|
188
|
+
(function (GA_HIT_TYPE) {
|
|
189
|
+
GA_HIT_TYPE["EVENT"] = "event";
|
|
190
|
+
})(GA_HIT_TYPE || (GA_HIT_TYPE = {}));
|
|
191
|
+
var GA_ACTION_TYPE;
|
|
192
|
+
(function (GA_ACTION_TYPE) {
|
|
193
|
+
GA_ACTION_TYPE["EXCEPTION"] = "exception";
|
|
194
|
+
GA_ACTION_TYPE["TIMING"] = "timing_complete";
|
|
195
|
+
})(GA_ACTION_TYPE || (GA_ACTION_TYPE = {}));
|
|
196
|
+
var CUSTOM_ACTION_TYPE;
|
|
197
|
+
(function (CUSTOM_ACTION_TYPE) {
|
|
198
|
+
CUSTOM_ACTION_TYPE["TRACK_TIMING"] = "track_timing";
|
|
199
|
+
})(CUSTOM_ACTION_TYPE || (CUSTOM_ACTION_TYPE = {}));
|
|
200
|
+
var GA_CATEGORY;
|
|
201
|
+
(function (GA_CATEGORY) {
|
|
202
|
+
GA_CATEGORY["ERROR"] = "Error";
|
|
203
|
+
GA_CATEGORY["NAVIGATION_TIMING"] = "Navigation Timing";
|
|
204
|
+
GA_CATEGORY["TIMING"] = "Timing";
|
|
205
|
+
GA_CATEGORY["INTERACTION"] = "Interaction";
|
|
206
|
+
GA_CATEGORY["TRACKING"] = "Tracking";
|
|
207
|
+
GA_CATEGORY["DEPRECATION"] = "Deprecation";
|
|
208
|
+
})(GA_CATEGORY || (GA_CATEGORY = {}));
|
|
209
|
+
|
|
163
210
|
/**
|
|
164
211
|
* Recursively merge properties of two objects.
|
|
165
212
|
* If a property exists in both it, property of obj2 is used.
|
|
@@ -312,9 +359,6 @@ const getFallbackInitData = () => {
|
|
|
312
359
|
const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';
|
|
313
360
|
const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';
|
|
314
361
|
|
|
315
|
-
// see why: so#/58065241/10800831
|
|
316
|
-
const isAndroid = () => /(android)/i.test(navigator.userAgent);
|
|
317
|
-
|
|
318
362
|
const setDefaultBehaviour = (object, callbackName, defaultBehaviour) => {
|
|
319
363
|
let customBehaviour = null;
|
|
320
364
|
Object.defineProperty(object, callbackName, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
class t{constructor(t,e,r,
|
|
1
|
+
import"@/common/styles/Global.module.scss";class t{constructor(t,e,r,i){this.t=null,this.i=null,this.o=t,this.s=e,this.t=r,this.i=i,this.s.addEventListener("message",this.l.bind(this))}setOutgoingMessageBus(t){this.t=t}setMessageExecution(t){this.i=t}sendMessage(t,e=[]){return new Promise((r,i)=>{const o=new MessageChannel;o.port1.onmessage=t=>{if(!t||!t.data)return o.port1.close(),o.port2.close(),i(new Error(this.o+" received message but response can not be interpreted"));let e;try{e=JSON.parse(t.data)}catch(t){return o.port1.close(),o.port2.close(),this.h(t),i(t)}e.error?i(e.error):void 0!==e.result?r(e.result):r(),o.port1.close(),o.port2.close()};let s="";try{s=JSON.stringify({message:t,args:e})}catch(t){return i(new Error(this.o+": can not create command because it is not JSON.stringify able"))}if(!this.t)return i(new Error(this.o+": outgoing bus not set yet"));this.t.postMessage(s,"*",[o.port2])})}l(t){const e=t.ports&&Array.isArray(t.ports)&&t.ports.length>0?t.ports[0]:null;if(t.data&&e)try{const r=JSON.parse(t.data);if(!this.i)return e.postMessage(JSON.stringify({error:this.o+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const i=this.i(r,t);if(void 0===i)return;i.then((t={})=>{let r=void 0,i=void 0;"object"==typeof t&&null!==t&&(r=t.error,i=t.result),r?e.postMessage(JSON.stringify({error:r})):void 0!==i?e.postMessage(JSON.stringify({result:i})):e.postMessage(JSON.stringify({result:t}))},t=>{e.postMessage(JSON.stringify({error:this.h(t)}))})}catch(t){e.postMessage(JSON.stringify({error:this.h(t)}))}}h(t){if("string"==typeof t){const e=this.o+": "+t;return console.error(e),e}return t.message=this.o+": "+t.message,console.error(t),t.message}}const e=()=>/(android)/i.test(navigator.userAgent);var r,i,o,s,n;!function(t){t.DIMENSION="dimension",t.METRIC="metric"}(r||(r={})),function(t){t.EVENT="event"}(i||(i={})),function(t){t.EXCEPTION="exception",t.TIMING="timing_complete"}(o||(o={})),function(t){t.TRACK_TIMING="track_timing"}(s||(s={})),function(t){t.ERROR="Error",t.NAVIGATION_TIMING="Navigation Timing",t.TIMING="Timing",t.INTERACTION="Interaction",t.TRACKING="Tracking",t.DEPRECATION="Deprecation"}(n||(n={}));const a=(t,e)=>{for(const r in e)try{e[r].constructor===Object?t[r]=a(t[r],e[r]):t[r]=e[r]}catch(i){t[r]=e[r]}return t},l=["127.0.0.1","localhost","0.0.0.0"],c=["language","browserLanguage","userLanguage","systemLanguage"],h=t=>{if(!t)return;const e=Object.keys(t);for(const r of e){const e=t[r];if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return h(e);if(Array.isArray(e)){for(const t of e)h(t);return}"true"!==e&&"false"!==e||(t[r]="true"===e)}},u=(t,e,r)=>{let i=null;Object.defineProperty(t,e,{get:()=>i||r,set(t){(null==t?void 0:t.mute)?i=t.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),i=t)}})},d=()=>.01*window.innerHeight+"px",m=t=>{t&&setTimeout(()=>t.style.setProperty(f,d()),0)},f="--rml-full-height",w=new Map;class g{constructor(r,i,o,s){if(this.ui={callbacks:null},this.extended={callbacks:null},this.analytics={callbacks:{}},this.global={callbacks:{}},this.u={},!r||"string"!=typeof r.id)throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(w.has(i))throw new Error("There is already an instance on this DOM element");if(!document.getElementById("rml-styles")){const t=o.zIndex||9999999,e=document.createElement("style");e.type="text/css",e.id="rml-styles";const r="transition:all ease-in-out 450ms;",i=["-webkit-","-o-"].reduce((t,e)=>t+(e+r),"")+r,s=d();e.innerHTML=`\n .rml-container{${f}:${s};}\n .rml-pos{position:fixed;top:0;left:0;z-index:${t};opacity:0}\n .rml-transition{${i}}\n .rml-fill{width:100%;height:100%;opacity:1}\n .rml-android-height{height:calc(var(${f},1vh)*100)}\n .rml-overflow-hidden{overflow:hidden}\n `,document.head.appendChild(e)}this.m=this.m.bind(this),e()&&window.addEventListener("resize",this.m),this.g=i,this.u=o,this.p=r;const n=this.v();this.O=this.O.bind(this),this.N=this.N.bind(this),this._=this._.bind(this),this.P=new t("website",window,null,this.N),this.k=s,this.g.appendChild(n),this.J=n,w.set(i,!0)}static createPlanner(t,e,r){return this.S(t,e,r)}static createConfigurator(t,e,r){return this.S(t,e,r)}static create(t,e,r){return this.S(t,e,r)}static createViewer(t,e,r){return this.S(t,e,r)}static S(t,e,r){return new Promise(async(i,o)=>{try{const o=a((()=>{const t={};t.locale||(t.locale=((t=null)=>{const e=window.navigator;if(t)return t.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=c.length;t<r;t++){const r=e[c[t]];if(r)return r.substr(0,2)}return"en"})()),"(idle)"===t.id&&delete t.id;const e=(()=>{const t=(()=>{try{return window.self!==window.top}catch(t){return!0}})();let e=window.location.href;if(t){if(!document.referrer)return null;e=document.referrer}const{hostname:r}=new URL(e);return r})();return e&&(t=>!!l.includes(t)||!!t.endsWith("roomle.com")||!(!t.endsWith("gitlab.io")&&!t.endsWith("gitlab.com")))(e)&&(t.configuratorId="demoConfigurator"),t.customApiUrl="https://www.roomle.com/api/v2",t.emails=!1,t})(),(t=>(h(t),(null==t?void 0:t.customApiUrl)&&(t.customApiUrl=decodeURIComponent(t.customApiUrl)),t.shareUrl&&(t.deeplink=t.shareUrl.replace("<CONF_ID>","#CONFIGURATIONID#")),t))(r));o.featureFlags||(o.featureFlags={}),"boolean"!=typeof o.featureFlags.realPartList&&(o.featureFlags.realPartList=!0),"boolean"!=typeof o.featureFlags.globalCallbacks&&(o.featureFlags.globalCallbacks=!0);const s=await(async(t,e)=>{if("string"!=typeof t)throw new Error('Configurator ID is not a string type: "'+typeof t+'"');const r=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",i=e.overrideTenant||9,o=r+"/configurators/"+t,s="03-"+window.btoa((new Date).toISOString()+";anonymous;roomle_portal_v2"),n=new Request(o,{method:"GET",headers:new Headers({apiKey:"roomle_portal_v2",currentTenant:i,locale:"en",language:"en",device:1,token:s,platform:"web"}),mode:"cors",cache:"default"}),a=await fetch(n),{configurator:l}=await a.json();return l})(t,o);return r=((t,e)=>{e.configuratorId=t.id;const r=t.settings||{};return!e.overrideTenant&&t.tenant&&(e.overrideTenant=t.tenant),((t,e)=>{const r=JSON.parse(JSON.stringify(t));return a(r,e)})(r,e)})(s,o),new this(s,e,r,i)}catch(t){return o(t)}})}teardown(){this.g&&w.delete(this.g);const t=this.g.querySelector("iframe");t&&this.g.removeChild(t),window.removeEventListener("resize",this.m)}v(){var t;const e=document.createElement("iframe");let r=(null===(t=this.p)||void 0===t?void 0:t.url)||"https://www.roomle.com/t/cp/";return this.u.useLocalRoomle&&(r=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(r=location.href.replace("embedding.html","index.html")),this.u.overrideServerUrl&&(r=this.u.overrideServerUrl),e.src=r,e.classList.add("rml-container"),e.classList.add("rml-fill"),e}m(){m(this.J)}O(){this.J.classList.add("rml-pos"),document.documentElement.classList.add("rml-overflow-hidden"),window.document.body.classList.add("rml-overflow-hidden"),e()&&(m(this.J),this.J.classList.add("rml-android-height"))}_(){this.J.classList.remove("rml-pos"),this.J.classList.remove("rml-android-height"),document.documentElement.classList.remove("rml-overflow-hidden"),window.document.body.classList.remove("rml-overflow-hidden")}N({message:t,args:e},r){var i;if(!r.source)return;if(r.source!==(null===(i=this.J)||void 0===i?void 0:i.contentWindow))return;if("requestBoot"===t)return this.P.setOutgoingMessageBus(r.source),Promise.resolve({result:this.u});if("setup"===t){const{methods:t,callbacks:r}=e[0];return t.forEach(t=>{const e=t.split("."),r=e[0],i=e[1];this[r]||(this[r]={}),this[r][i]=function(){return this.P.sendMessage(t,[...arguments])}.bind(this)}),r.forEach(t=>{const e=t.split("."),r=e[0],i=e[1],o=e[2];this[r]||(this[r]={}),this[r][i]||(this[r][i]={}),this[r][i][o]=()=>{}}),u(this.ui.callbacks,"onUseFullPage",this.O),u(this.ui.callbacks,"onBackToWebsite",this._),this.k(this),setTimeout(()=>this.P.sendMessage("websiteReady"),0),Promise.resolve({result:null})}const o=t.split("."),s=o[0],n=o[1],a=3===o.length?o[2]:null;if(a&&this[s][n][a]){const t=this[s][n][a](...e);return t instanceof Promise?t.then(t=>({result:t})):void 0!==t?Promise.resolve({result:t}):Promise.resolve({result:null})}return Promise.reject('Message "'+t+'" is unkown')}}export{g as default};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import '@/common/styles/Global.module.scss';
|
|
2
|
+
|
|
1
3
|
class MessageHandler {
|
|
2
4
|
constructor(side, incomingMessageBus, outgoingMessageBus, messageExecution) {
|
|
3
5
|
this._outgoingMessageBus = null;
|
|
@@ -160,6 +162,51 @@ const isInIframe = () => {
|
|
|
160
162
|
}
|
|
161
163
|
};
|
|
162
164
|
|
|
165
|
+
// see why: so#/58065241/10800831
|
|
166
|
+
const isAndroid = () => /(android)/i.test(navigator.userAgent);
|
|
167
|
+
|
|
168
|
+
/* TO DOs in Google Analytics Admin UI
|
|
169
|
+
|
|
170
|
+
To track the Hit ID, Hit Time, and Hit Type and custom dimensions, first create them in Google Analytics
|
|
171
|
+
and set their scope to "Hit"
|
|
172
|
+
|
|
173
|
+
Once you've created the custom metrics in Google Analytics
|
|
174
|
+
(and set their scope to "Hit" and their formatting type to "Integer")
|
|
175
|
+
this setup is ready to go. You need to do this in every GA property
|
|
176
|
+
|
|
177
|
+
For more details see: https://philipwalton.com/articles/the-google-analytics-setup-i-use-on-every-site-i-build/
|
|
178
|
+
|
|
179
|
+
*/
|
|
180
|
+
// Probably we could add const enums here
|
|
181
|
+
// but we need to investigate: https://roomle.atlassian.net/browse/CONF-238
|
|
182
|
+
var GA_CUSTOM;
|
|
183
|
+
(function (GA_CUSTOM) {
|
|
184
|
+
GA_CUSTOM["DIMENSION"] = "dimension";
|
|
185
|
+
GA_CUSTOM["METRIC"] = "metric";
|
|
186
|
+
})(GA_CUSTOM || (GA_CUSTOM = {}));
|
|
187
|
+
var GA_HIT_TYPE;
|
|
188
|
+
(function (GA_HIT_TYPE) {
|
|
189
|
+
GA_HIT_TYPE["EVENT"] = "event";
|
|
190
|
+
})(GA_HIT_TYPE || (GA_HIT_TYPE = {}));
|
|
191
|
+
var GA_ACTION_TYPE;
|
|
192
|
+
(function (GA_ACTION_TYPE) {
|
|
193
|
+
GA_ACTION_TYPE["EXCEPTION"] = "exception";
|
|
194
|
+
GA_ACTION_TYPE["TIMING"] = "timing_complete";
|
|
195
|
+
})(GA_ACTION_TYPE || (GA_ACTION_TYPE = {}));
|
|
196
|
+
var CUSTOM_ACTION_TYPE;
|
|
197
|
+
(function (CUSTOM_ACTION_TYPE) {
|
|
198
|
+
CUSTOM_ACTION_TYPE["TRACK_TIMING"] = "track_timing";
|
|
199
|
+
})(CUSTOM_ACTION_TYPE || (CUSTOM_ACTION_TYPE = {}));
|
|
200
|
+
var GA_CATEGORY;
|
|
201
|
+
(function (GA_CATEGORY) {
|
|
202
|
+
GA_CATEGORY["ERROR"] = "Error";
|
|
203
|
+
GA_CATEGORY["NAVIGATION_TIMING"] = "Navigation Timing";
|
|
204
|
+
GA_CATEGORY["TIMING"] = "Timing";
|
|
205
|
+
GA_CATEGORY["INTERACTION"] = "Interaction";
|
|
206
|
+
GA_CATEGORY["TRACKING"] = "Tracking";
|
|
207
|
+
GA_CATEGORY["DEPRECATION"] = "Deprecation";
|
|
208
|
+
})(GA_CATEGORY || (GA_CATEGORY = {}));
|
|
209
|
+
|
|
163
210
|
/**
|
|
164
211
|
* Recursively merge properties of two objects.
|
|
165
212
|
* If a property exists in both it, property of obj2 is used.
|
|
@@ -312,9 +359,6 @@ const getFallbackInitData = () => {
|
|
|
312
359
|
const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';
|
|
313
360
|
const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';
|
|
314
361
|
|
|
315
|
-
// see why: so#/58065241/10800831
|
|
316
|
-
const isAndroid = () => /(android)/i.test(navigator.userAgent);
|
|
317
|
-
|
|
318
362
|
const setDefaultBehaviour = (object, callbackName, defaultBehaviour) => {
|
|
319
363
|
let customBehaviour = null;
|
|
320
364
|
Object.defineProperty(object, callbackName, {
|