@roomle/embedding-lib 4.33.0-alpha.2 → 4.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/api/classes/exposed_analytics_callbacks.ExposedAnalyticsCallbacks.md +1 -1
- package/docs/api/classes/exposed_api.ExposedApi.md +11 -11
- package/docs/api/classes/exposed_callbacks.ExposedCallbacks.md +7 -7
- package/docs/api/classes/roomle_configurator_api.default.md +9 -9
- package/docs/api/enums/types.UI_BUTTON.md +51 -18
- package/docs/api/interfaces/exposed_callbacks.Labels.md +2 -2
- package/docs/api/interfaces/exposed_callbacks.Price.md +2 -2
- package/docs/api/interfaces/roomle_configurator_api.RoomleEmbeddingApiKeys.md +4 -4
- package/docs/api/interfaces/types.ConfiguratorSettings.md +5 -5
- package/docs/api/interfaces/types.EmbeddingSkin.md +5 -5
- package/docs/api/interfaces/types.UiInitData.md +36 -71
- package/docs/api/modules/roomle_configurator_api.md +3 -3
- package/docs/examples/00_init.html +2 -2
- package/docs/examples/01_small_screen.html +1 -1
- package/docs/examples/02_resize_callback.html +1 -1
- package/docs/examples/03_instant_start.html +1 -1
- package/docs/examples/04_price.html +1 -1
- package/docs/examples/05_analytics.html +1 -1
- package/docs/examples/06_skinning.html +1 -1
- package/docs/examples/07_request_product.html +1 -1
- package/docs/examples/08_variants.html +1 -1
- package/docs/examples/09_different_products.html +1 -1
- package/docs/examples/10_landing_page.html +1 -1
- package/docs/examples/11_light_settings.html +1 -1
- package/docs/examples/12_email.html +1 -1
- package/docs/examples/13_parameters.html +1 -1
- package/docs/examples/14_ga_consent.html +1 -1
- package/docs/index.md +18 -18
- package/docs/md/web/ui/EMBEDDING-CHANGELOG.md +31 -12
- package/docs/migration-guides/v2-to-v3.md +3 -3
- package/package.json +2 -2
- package/roomle-configurator-api.cjs.js +33 -76
- package/roomle-configurator-api.cjs.min.js +1 -1
- package/roomle-configurator-api.es.js +33 -76
- package/roomle-configurator-api.es.min.js +1 -1
- package/roomle-configurator-api.js +33 -76
- package/types/index.d.ts +305 -245
- package/types/src/common/store/index.d.ts +11 -4
- package/types/src/common/utils/helper.d.ts +0 -20
- package/types/src/common/utils/merge.d.ts +16 -0
- package/types/src/common/utils/share.d.ts +1 -0
- package/types/src/common/utils/variants.d.ts +3 -0
- package/types/src/configurator/components/collection-view/-utils/types.d.ts +3 -3
- package/types/src/configurator/components/grid-view/-utils/GridViewHelper.d.ts +3 -3
- package/types/src/configurator/embedding/roomle-configurator-api.d.ts +6 -6
- package/types/src/configurator/embedding/types.d.ts +6 -1
- package/types/src/configurator/store/ui-state.d.ts +14 -6
- package/types/src/planner/business-logic/pre-defined-rooms.d.ts +2 -0
- package/types/src/planner/business-logic/rooms.d.ts +12 -0
- package/types/src/planner/store/planner-core-data.d.ts +21 -0
- package/types/src/planner/store/planner-ui-state.d.ts +11 -4
- package/types/src/planner/utils/product-list.d.ts +10 -0
- package/types/tests/helpers/mocks/localize.d.ts +1 -1
- package/types/tests/integration/common/components/IconButton.spec.d.ts +1 -0
- package/types/tests/integration/common/components/ProductButtons.spec.d.ts +1 -0
- package/types/tests/integration/configurator/components/utils/InteractionContainer.spec.d.ts +1 -0
- package/types/tests/integration/planner/components/CatalogTrigger.spec.d.ts +1 -0
- package/types/tests/integration/planner/components/ProductListButton.spec.d.ts +1 -0
- package/types/tests/integration/planner/components/SampleRooms.spec.d.ts +1 -0
- package/types/tests/integration/planner/components/overlays/product-list/ProductListEntry.spec.d.ts +1 -0
package/docs/index.md
CHANGED
|
@@ -62,7 +62,7 @@ This section shows a simple quick start. We always recommend using a package man
|
|
|
62
62
|
const options = {
|
|
63
63
|
id: 'usm:frame',
|
|
64
64
|
};
|
|
65
|
-
const configurator = await RoomleConfiguratorApi.
|
|
65
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
66
66
|
'demoConfigurator',
|
|
67
67
|
document.getElementById('configurator-container'),
|
|
68
68
|
options,
|
|
@@ -172,7 +172,7 @@ If you just want to start the configurator and do not want to bother about the s
|
|
|
172
172
|
id: 'usm:frame',
|
|
173
173
|
};
|
|
174
174
|
button.addEventListener('click', async () => {
|
|
175
|
-
const configurator = await RoomleConfiguratorApi.
|
|
175
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
176
176
|
'demoConfigurator',
|
|
177
177
|
document.getElementById('configurator-container'),
|
|
178
178
|
options,
|
|
@@ -212,10 +212,10 @@ When you have a detail-page of a product in your webshop or website it makes sen
|
|
|
212
212
|
|
|
213
213
|
```JavaScript
|
|
214
214
|
const objectToLoadId = 'usm:frame:BB3BB3E7951BC15109B1FF86D78C95DE3FB46E9F78714C46FFA2DE91866A2C2B';
|
|
215
|
-
const configurator1 = await RoomleConfiguratorApi.
|
|
215
|
+
const configurator1 = await RoomleConfiguratorApi.createConfigurator(configuratorId, domElement1, {id: objectToLoadId, ...overrideServerOptions});
|
|
216
216
|
// instantiate the second configurator, because you can now :-) and wait with the load of the object
|
|
217
217
|
// until the user clicks on a specific product
|
|
218
|
-
const configurator2 = await RoomleConfiguratorApi.
|
|
218
|
+
const configurator2 = await RoomleConfiguratorApi.createConfigurator(configuratorId, domElement2, overrideServerOptions);
|
|
219
219
|
// load the object into the second configurator when the user clicks on a specific button
|
|
220
220
|
document.getElementById('button-to-load-product-x').addEventListener('click', () => {
|
|
221
221
|
configurator2.ui.loadObject(objectToLoadId);
|
|
@@ -289,7 +289,7 @@ Furthermore it is also sometimes challenging for certain webshop systems to add
|
|
|
289
289
|
If you do not have a webshop or a price database it could make sense to use the Roomle Price Service. The first step to use the Roomle Price Service is to enable the service. Therefore please speak with your customer success manager. If everything is in place you only need to provide the correct init options. Here is an example:
|
|
290
290
|
|
|
291
291
|
```JavaScript
|
|
292
|
-
const configurator = await RoomleConfiguratorApi.
|
|
292
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
293
293
|
'demoConfigurator',
|
|
294
294
|
document.getElementById('configurator-container'),
|
|
295
295
|
{...options, usePriceService: true},
|
|
@@ -307,7 +307,7 @@ If you see the error message `prices are empty` on the Chrome Dev Tools console
|
|
|
307
307
|
Currently we pass out certain events to the embedding webshop those events are based on Goolge Tag Manager. You can find all the information about [gtag.js](https://developers.google.com/analytics/devguides/collection/gtagjs) on the Google website.
|
|
308
308
|
|
|
309
309
|
```JavaScript
|
|
310
|
-
const configurator = await RoomleConfiguratorApi.
|
|
310
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
311
311
|
"demoConfigurator",
|
|
312
312
|
document.getElementById("configurator-container"),
|
|
313
313
|
options
|
|
@@ -346,7 +346,7 @@ The Roomle Configurator will determine which color to apply "on" primary and "ca
|
|
|
346
346
|
The Roomle Configurator will decide between "black" or "white" for the "on" colors. If this does not suit your needs you can define your own "on" colors. If you want to rely on the Roomle selection for the "on" colors please only specify valid CSS RGB hex values, e.g.: #fff000 or #f30. Things like rgba(0,0,0,0.7) won't work and you have to specify the "on" colors yourself (the full example can be found in the file <a target="_blank" rel="noopener noreferrer" href="./examples/06_skinning.html">06_skinning.html</a>):
|
|
347
347
|
|
|
348
348
|
```JavaScript
|
|
349
|
-
const configurator = await RoomleConfiguratorApi.
|
|
349
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
350
350
|
'demoConfigurator',
|
|
351
351
|
document.getElementById('configurator-container'),
|
|
352
352
|
{
|
|
@@ -414,7 +414,7 @@ configurator.ui.callbacks.onButtonClicked = (name) => {
|
|
|
414
414
|
In some situations, there is a need to hide certain buttons. For example, you want to hide the part list button because the part list contains info you do not want to show to everybody. To do this you need to pass in the correct init options:
|
|
415
415
|
|
|
416
416
|
```JavaScript
|
|
417
|
-
const configurator = await RoomleConfiguratorApi.
|
|
417
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
418
418
|
'demoConfigurator',
|
|
419
419
|
document.getElementById('configurator-container'),
|
|
420
420
|
{...options, buttons: {partlist: false}},
|
|
@@ -428,7 +428,7 @@ The key of the `buttons` hash in the options are defined by the UI_BUTTON enum w
|
|
|
428
428
|
To be notified when the user clicks on the checkout-call-to-action button in our iframe you need to define the `onRequestProduct` callback.
|
|
429
429
|
|
|
430
430
|
```JavaScript
|
|
431
|
-
const configurator = await RoomleConfiguratorApi.
|
|
431
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
432
432
|
'demoConfigurator',
|
|
433
433
|
document.getElementById('configurator-container'),
|
|
434
434
|
options,
|
|
@@ -440,7 +440,7 @@ configurator.ui.callbacks.onRequestProduct = (configurationId, image, partlist,
|
|
|
440
440
|
Of course there are situations where you want to trigger this action from outside. Therefore we provide the method `triggerRequestProduct`. When you call this method the same process starts as if the user would have clicked on the checkout-call-to-action button. This means that you only need to subscribe to the `onRequestProduct` callback to handle those situations.
|
|
441
441
|
|
|
442
442
|
```JavaScript
|
|
443
|
-
const configurator = await RoomleConfiguratorApi.
|
|
443
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
444
444
|
'demoConfigurator',
|
|
445
445
|
document.getElementById('configurator-container'),
|
|
446
446
|
options,
|
|
@@ -485,7 +485,7 @@ Now everytime a configuration which is based on the root component `usm:frame` t
|
|
|
485
485
|
This behaviour is needed that the configurator only shows relevant variants which have something in common with the initial loaded configuration.
|
|
486
486
|
|
|
487
487
|
```JavaScript
|
|
488
|
-
const configurator = await RoomleConfiguratorApi.
|
|
488
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
489
489
|
'demoConfigurator',
|
|
490
490
|
document.getElementById('configurator-container'), {
|
|
491
491
|
...options,
|
|
@@ -619,7 +619,7 @@ There are two different parameters to set the localization of the Roomle Configu
|
|
|
619
619
|
Let's have a look on the following code:
|
|
620
620
|
|
|
621
621
|
```JavaScript
|
|
622
|
-
const configurator = await RoomleConfiguratorApi.
|
|
622
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
623
623
|
'demoConfigurator',
|
|
624
624
|
document.getElementById('configurator-container'),
|
|
625
625
|
{...options, locale: 'de', overrideCountry: 'at', usePriceService: true },
|
|
@@ -659,7 +659,7 @@ We try to provide a default light setting which works with the majority of produ
|
|
|
659
659
|
To use a special light setting you only need to provide the `ls` parameter in the options. In code this looks like:
|
|
660
660
|
|
|
661
661
|
```JavaScript
|
|
662
|
-
const configurator = await RoomleConfiguratorApi.
|
|
662
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
663
663
|
'demoConfigurator',
|
|
664
664
|
document.getElementById('configurator-container'),
|
|
665
665
|
{...options, ls: 'sofa' },
|
|
@@ -675,7 +675,7 @@ To send a saved configuration to the e-mail address of the user you need to the
|
|
|
675
675
|
**Important**: please also make sure that the deeplink is also set in the database of Roomle and linked to the `configuratorId` you are using. If this is not done, the link in the e-mail won't be replaced. If you encounter any problems, please contact your Roomle Contact Person.
|
|
676
676
|
|
|
677
677
|
```JavaScript
|
|
678
|
-
const configurator = await RoomleConfiguratorApi.
|
|
678
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
679
679
|
'demoConfigurator',
|
|
680
680
|
document.getElementById('configurator-container'),
|
|
681
681
|
{...options,
|
|
@@ -700,7 +700,7 @@ interface PartList {
|
|
|
700
700
|
For things like calculating a price etc most of the time the fullList is needed but for UI purposes it often make sense to group parts together so that the user understands better what she/he configured. To display the part list grouped just add the following option to the init parameters: `groupPartList: true`, for example like:
|
|
701
701
|
|
|
702
702
|
```JavaScript
|
|
703
|
-
const configurator = await RoomleConfiguratorApi.
|
|
703
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
704
704
|
'demoConfigurator',
|
|
705
705
|
document.getElementById('configurator-container'),
|
|
706
706
|
{
|
|
@@ -720,7 +720,7 @@ If you want to change the share url to a link to your webshop please make sure t
|
|
|
720
720
|
**Important**: please also make sure that the deeplink is also set in the database of Roomle and linked to the `configuratorId` you are using. If this is not done, the link in the e-mail won't be replaced. If you encounter any problems, please contact your Roomle Contact Person.
|
|
721
721
|
|
|
722
722
|
```JavaScript
|
|
723
|
-
const configurator = await RoomleConfiguratorApi.
|
|
723
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
724
724
|
'demoConfigurator',
|
|
725
725
|
document.getElementById('configurator-container'),
|
|
726
726
|
{...options,
|
|
@@ -742,7 +742,7 @@ The Roomle Rubens uses Google Analytics to improve UX and performance based on t
|
|
|
742
742
|
First you need to initialize Roomle Rubens without the Google Analytics consent. Therefore you need to do the following:
|
|
743
743
|
|
|
744
744
|
```JavaScript
|
|
745
|
-
const configurator = await RoomleConfiguratorApi.
|
|
745
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
746
746
|
'demoConfigurator',
|
|
747
747
|
document.getElementById('configurator-container'),
|
|
748
748
|
{...options, gaConsent: false }
|
|
@@ -807,7 +807,7 @@ If you are using the SDK you can use [preparePerspectiveImage](../api/classes/ro
|
|
|
807
807
|
In case you are using the `EmbeddingLib`, you can use those calls on the `extended` object of the interface. For example:
|
|
808
808
|
|
|
809
809
|
```JavaScript
|
|
810
|
-
const configurator = await RoomleConfiguratorApi.
|
|
810
|
+
const configurator = await RoomleConfiguratorApi.createConfigurator(
|
|
811
811
|
'demoConfigurator',
|
|
812
812
|
document.getElementById('configurator-container'),
|
|
813
813
|
{...options}
|
|
@@ -1,20 +1,39 @@
|
|
|
1
|
-
## [4.
|
|
1
|
+
## [4.34.0](https://gitlab.com/roomle/web/roomle-ui/compare/embedding-v4.33.0...embedding-v4.34.0) (2022-05-10)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### Features
|
|
5
5
|
|
|
6
|
-
* add
|
|
7
|
-
*
|
|
8
|
-
* implement
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
6
|
+
* add first idea on how to add a room ([26aa788](https://gitlab.com/roomle/web/roomle-ui/commit/26aa78845bc6e751cc8057fc63db6e9d18d576a6))
|
|
7
|
+
* implement 2d view button ([487e8d8](https://gitlab.com/roomle/web/roomle-ui/commit/487e8d87d634544f0b6ad6d15b19716ce8ad7987))
|
|
8
|
+
* implement part list and product list feature ([9919dad](https://gitlab.com/roomle/web/roomle-ui/commit/9919dada3f8ef389ac726a632bda09dffbde7122))
|
|
9
|
+
* implement product list and part list with bounds create a helper file for it ([349c58c](https://gitlab.com/roomle/web/roomle-ui/commit/349c58ce45ee7a8bfb80957c4f86b969a1a273a7))
|
|
10
|
+
* MoC: create predefined rooms ([2e5757e](https://gitlab.com/roomle/web/roomle-ui/commit/2e5757eb412cbb8d08fb889bc660bcd48d577131))
|
|
11
|
+
* MoC: switch to 2D scene ([faf273a](https://gitlab.com/roomle/web/roomle-ui/commit/faf273ac6e25d8fc0e517b2d2209bc427efee5d7))
|
|
12
|
+
* refactor addons and catalog trigger button and implement generic icon button for it ([1e86efd](https://gitlab.com/roomle/web/roomle-ui/commit/1e86efd6434e7238beaa9906af627d5cffc27938))
|
|
13
|
+
* reset scroll if change from product list to part list ([005b982](https://gitlab.com/roomle/web/roomle-ui/commit/005b982acdbe6ca72901beefeafb9dd1a4b2539d))
|
|
14
|
+
* **SDK:** upgrade to version 2.31.0 ([2938571](https://gitlab.com/roomle/web/roomle-ui/commit/29385711dc9bc3f3438e5fe5984aebb8a7044d47))
|
|
15
|
+
* **SDK:** upgrade to version 2.31.0-alpha.1 ([50a566e](https://gitlab.com/roomle/web/roomle-ui/commit/50a566e620560f7c7b1cb213265b3be3984778d1))
|
|
16
|
+
* **SDK:** upgrade to version 2.31.0-alpha.2 ([638cf4b](https://gitlab.com/roomle/web/roomle-ui/commit/638cf4b91650f35fbfff4f5b9ecee5caf2a3af5d))
|
|
17
|
+
* **SDK:** upgrade to version 2.31.0-alpha.3 ([e198e51](https://gitlab.com/roomle/web/roomle-ui/commit/e198e513ed99d203f3eeabb0a218033d27a12aca))
|
|
18
|
+
* **SDK:** upgrade to version 2.31.0-alpha.4 ([52ad6a1](https://gitlab.com/roomle/web/roomle-ui/commit/52ad6a1687f3af6c4e18020a2ff5834f76d44d26))
|
|
12
19
|
|
|
13
20
|
|
|
14
21
|
### Bug Fixes
|
|
15
22
|
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
23
|
+
* also use text filter if "all groups" option is selected ([0f0db02](https://gitlab.com/roomle/web/roomle-ui/commit/0f0db0245810d8cf8b03ce0873019f958cda65ad))
|
|
24
|
+
* changed computed so that Vue.js recognizes if the values change ([2bb4164](https://gitlab.com/roomle/web/roomle-ui/commit/2bb4164be443e84ce45fb6b0dd59ccec018ce74f))
|
|
25
|
+
* create new array to prevent problems with reactivity caveat for more see: ([a7e4c86](https://gitlab.com/roomle/web/roomle-ui/commit/a7e4c86a7ae88d50695918218548a052fe2d7825))
|
|
26
|
+
* do not expand interactions on mobile if catalog trigger is clicked ([10b1531](https://gitlab.com/roomle/web/roomle-ui/commit/10b153145b93d533b92fa815ea28239aaf716738))
|
|
27
|
+
* do not import scss in embedding lib ([fcca831](https://gitlab.com/roomle/web/roomle-ui/commit/fcca831b993df263d6991b47b646761823ffb9c0))
|
|
28
|
+
* do not open interactions for rooms on mobile ([a0fd3da](https://gitlab.com/roomle/web/roomle-ui/commit/a0fd3da8fb92b4e9009b17bdc223b9df29e37d73))
|
|
29
|
+
* does not show catalog trigger button on mobile and collapse interaction menu on deselect partlist toggle on mobile ([257a6c7](https://gitlab.com/roomle/web/roomle-ui/commit/257a6c785fd111837d76c798f02ab58773484f8e))
|
|
30
|
+
* eslint warnings ([a42a64e](https://gitlab.com/roomle/web/roomle-ui/commit/a42a64e653196616b66b29c04705ae70e07fb4e3))
|
|
31
|
+
* failing test ([5a28afc](https://gitlab.com/roomle/web/roomle-ui/commit/5a28afc99be963e01363887a6667e93497eaa337))
|
|
32
|
+
* import SampleRooms component so it can be used in template ([e01a62c](https://gitlab.com/roomle/web/roomle-ui/commit/e01a62c24db204422b6e905f26733b29fa5c751c))
|
|
33
|
+
* move changes from addon-trigger to separate components ([5f578a4](https://gitlab.com/roomle/web/roomle-ui/commit/5f578a483d53ab5c7ffec3677c6d945295844ad6))
|
|
34
|
+
* only close part list not both part list and product list ([66bbefb](https://gitlab.com/roomle/web/roomle-ui/commit/66bbefb40168ed9056ef092184c5882390dafc05))
|
|
35
|
+
* show catalog trigger only if there is any catalog to show ([aaff214](https://gitlab.com/roomle/web/roomle-ui/commit/aaff214c3b3a211a811f482243aaf8e94b0e6e07))
|
|
36
|
+
* show fullscreen on init and expand sidebar if view has changed from mobile to desktop ([4562b68](https://gitlab.com/roomle/web/roomle-ui/commit/4562b685490cd13200935a44da48db04873a5512))
|
|
37
|
+
* show only one overlay in sidebar ([bb8c8e6](https://gitlab.com/roomle/web/roomle-ui/commit/bb8c8e619a6809c63da59e3d4270de13d0ec2e78))
|
|
38
|
+
* top bar selected action refactoring rightly ([ecb00f5](https://gitlab.com/roomle/web/roomle-ui/commit/ecb00f5682068c35e88193fdf205ad81bc071900))
|
|
39
|
+
* use correct generic type ([c00751b](https://gitlab.com/roomle/web/roomle-ui/commit/c00751b58e0547e79d87ecc018ee60c455c2fa40))
|
|
@@ -48,7 +48,7 @@ await RoomleConfigurator.init(/* for details about the create method see the old
|
|
|
48
48
|
|
|
49
49
|
```javascript
|
|
50
50
|
const calculatePrice = (parts) => /* your price calculation, same code as with the old version */
|
|
51
|
-
const instance = await RoomleConfiguratorApi.
|
|
51
|
+
const instance = await RoomleConfiguratorApi.createConfigurator(/* for details about the create method see the new docu */);
|
|
52
52
|
instance.ui.callbacks.onPartListUpdate = calculatePrice;
|
|
53
53
|
```
|
|
54
54
|
|
|
@@ -100,10 +100,10 @@ const overrideServerOptions = {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
// instantiate the first configurator and directly load the product
|
|
103
|
-
const configurator1 = await RoomleConfiguratorApi.
|
|
103
|
+
const configurator1 = await RoomleConfiguratorApi.createConfigurator(configuratorId, domElement1, {id: objectToLoadId, ...overrideServerOptions});
|
|
104
104
|
// instantiate the second configurator, because you can now :-) and wait with the load of the object
|
|
105
105
|
// until the user clicks on a specific product
|
|
106
|
-
const configurator2 = await RoomleConfiguratorApi.
|
|
106
|
+
const configurator2 = await RoomleConfiguratorApi.createConfigurator(configuratorId, domElement2, overrideServerOptions);
|
|
107
107
|
// load the object into the second configurator when the user clicks on a specific button
|
|
108
108
|
document.getElementById('button-to-load-product-x').addEventListener('click', () => {
|
|
109
109
|
configurator2.ui.loadObject(objectToLoadId);
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.34.0",
|
|
4
4
|
"main": "roomle-configurator-api.es.min.js",
|
|
5
5
|
"types": "types/index.d.ts",
|
|
6
6
|
"author": "Roomle Development",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@roomle/web-sdk": "2.
|
|
8
|
+
"@roomle/web-sdk": "2.31.0"
|
|
9
9
|
},
|
|
10
10
|
"devDependencies": {
|
|
11
11
|
"@semantic-release/changelog": "^5.0.1",
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('@/common/styles/Global.module.scss');
|
|
4
|
-
|
|
5
3
|
class MessageHandler {
|
|
6
4
|
constructor(side, incomingMessageBus, outgoingMessageBus, messageExecution) {
|
|
7
5
|
this._outgoingMessageBus = null;
|
|
@@ -164,50 +162,36 @@ const isInIframe = () => {
|
|
|
164
162
|
}
|
|
165
163
|
};
|
|
166
164
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
(
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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 = {}));
|
|
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
|
+
};
|
|
211
195
|
|
|
212
196
|
/**
|
|
213
197
|
* Recursively merge properties of two objects.
|
|
@@ -245,36 +229,6 @@ const deepMerge = (obj1, obj2) => {
|
|
|
245
229
|
}
|
|
246
230
|
}
|
|
247
231
|
return obj1;
|
|
248
|
-
};
|
|
249
|
-
const NAMES_FOR_LOCALHOST = [
|
|
250
|
-
'127.0.0.1',
|
|
251
|
-
'localhost',
|
|
252
|
-
'0.0.0.0',
|
|
253
|
-
];
|
|
254
|
-
const getHostname = () => {
|
|
255
|
-
const isIframe = isInIframe();
|
|
256
|
-
let url = window.location.href;
|
|
257
|
-
if (isIframe) {
|
|
258
|
-
if (!document.referrer) {
|
|
259
|
-
return null;
|
|
260
|
-
}
|
|
261
|
-
url = document.referrer;
|
|
262
|
-
}
|
|
263
|
-
const { hostname } = new URL(url);
|
|
264
|
-
return hostname;
|
|
265
|
-
};
|
|
266
|
-
const isDemoHostname = (hostname) => {
|
|
267
|
-
if (NAMES_FOR_LOCALHOST.includes(hostname)) {
|
|
268
|
-
return true;
|
|
269
|
-
}
|
|
270
|
-
if (hostname.endsWith('roomle.com')) {
|
|
271
|
-
return true;
|
|
272
|
-
}
|
|
273
|
-
// exception for CI builds
|
|
274
|
-
if (hostname.endsWith('gitlab.io') || hostname.endsWith('gitlab.com')) {
|
|
275
|
-
return true;
|
|
276
|
-
}
|
|
277
|
-
return false;
|
|
278
232
|
};
|
|
279
233
|
|
|
280
234
|
const BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN = ['language', 'browserLanguage', 'userLanguage', 'systemLanguage'];
|
|
@@ -361,6 +315,9 @@ const getFallbackInitData = () => {
|
|
|
361
315
|
const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';
|
|
362
316
|
const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';
|
|
363
317
|
|
|
318
|
+
// see why: so#/58065241/10800831
|
|
319
|
+
const isAndroid = () => /(android)/i.test(navigator.userAgent);
|
|
320
|
+
|
|
364
321
|
const setDefaultBehaviour = (object, callbackName, defaultBehaviour) => {
|
|
365
322
|
let customBehaviour = null;
|
|
366
323
|
Object.defineProperty(object, callbackName, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
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')}};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import '@/common/styles/Global.module.scss';
|
|
2
|
-
|
|
3
1
|
class MessageHandler {
|
|
4
2
|
constructor(side, incomingMessageBus, outgoingMessageBus, messageExecution) {
|
|
5
3
|
this._outgoingMessageBus = null;
|
|
@@ -162,50 +160,36 @@ const isInIframe = () => {
|
|
|
162
160
|
}
|
|
163
161
|
};
|
|
164
162
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
})(GA_ACTION_TYPE || (GA_ACTION_TYPE = {}));
|
|
196
|
-
var CUSTOM_ACTION_TYPE;
|
|
197
|
-
(function (CUSTOM_ACTION_TYPE) {
|
|
198
|
-
CUSTOM_ACTION_TYPE["TRACK_TIMING"] = "track_timing";
|
|
199
|
-
})(CUSTOM_ACTION_TYPE || (CUSTOM_ACTION_TYPE = {}));
|
|
200
|
-
var GA_CATEGORY;
|
|
201
|
-
(function (GA_CATEGORY) {
|
|
202
|
-
GA_CATEGORY["ERROR"] = "Error";
|
|
203
|
-
GA_CATEGORY["NAVIGATION_TIMING"] = "Navigation Timing";
|
|
204
|
-
GA_CATEGORY["TIMING"] = "Timing";
|
|
205
|
-
GA_CATEGORY["INTERACTION"] = "Interaction";
|
|
206
|
-
GA_CATEGORY["TRACKING"] = "Tracking";
|
|
207
|
-
GA_CATEGORY["DEPRECATION"] = "Deprecation";
|
|
208
|
-
})(GA_CATEGORY || (GA_CATEGORY = {}));
|
|
163
|
+
const NAMES_FOR_LOCALHOST = [
|
|
164
|
+
'127.0.0.1',
|
|
165
|
+
'localhost',
|
|
166
|
+
'0.0.0.0',
|
|
167
|
+
];
|
|
168
|
+
const getHostname = () => {
|
|
169
|
+
const isIframe = isInIframe();
|
|
170
|
+
let url = window.location.href;
|
|
171
|
+
if (isIframe) {
|
|
172
|
+
if (!document.referrer) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
url = document.referrer;
|
|
176
|
+
}
|
|
177
|
+
const { hostname } = new URL(url);
|
|
178
|
+
return hostname;
|
|
179
|
+
};
|
|
180
|
+
const isDemoHostname = (hostname) => {
|
|
181
|
+
if (NAMES_FOR_LOCALHOST.includes(hostname)) {
|
|
182
|
+
return true;
|
|
183
|
+
}
|
|
184
|
+
if (hostname.endsWith('roomle.com')) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
// exception for CI builds
|
|
188
|
+
if (hostname.endsWith('gitlab.io') || hostname.endsWith('gitlab.com')) {
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
return false;
|
|
192
|
+
};
|
|
209
193
|
|
|
210
194
|
/**
|
|
211
195
|
* Recursively merge properties of two objects.
|
|
@@ -243,36 +227,6 @@ const deepMerge = (obj1, obj2) => {
|
|
|
243
227
|
}
|
|
244
228
|
}
|
|
245
229
|
return obj1;
|
|
246
|
-
};
|
|
247
|
-
const NAMES_FOR_LOCALHOST = [
|
|
248
|
-
'127.0.0.1',
|
|
249
|
-
'localhost',
|
|
250
|
-
'0.0.0.0',
|
|
251
|
-
];
|
|
252
|
-
const getHostname = () => {
|
|
253
|
-
const isIframe = isInIframe();
|
|
254
|
-
let url = window.location.href;
|
|
255
|
-
if (isIframe) {
|
|
256
|
-
if (!document.referrer) {
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
url = document.referrer;
|
|
260
|
-
}
|
|
261
|
-
const { hostname } = new URL(url);
|
|
262
|
-
return hostname;
|
|
263
|
-
};
|
|
264
|
-
const isDemoHostname = (hostname) => {
|
|
265
|
-
if (NAMES_FOR_LOCALHOST.includes(hostname)) {
|
|
266
|
-
return true;
|
|
267
|
-
}
|
|
268
|
-
if (hostname.endsWith('roomle.com')) {
|
|
269
|
-
return true;
|
|
270
|
-
}
|
|
271
|
-
// exception for CI builds
|
|
272
|
-
if (hostname.endsWith('gitlab.io') || hostname.endsWith('gitlab.com')) {
|
|
273
|
-
return true;
|
|
274
|
-
}
|
|
275
|
-
return false;
|
|
276
230
|
};
|
|
277
231
|
|
|
278
232
|
const BROWSER_LANGUAGE_PROPERTY_KEYS_KNOWN = ['language', 'browserLanguage', 'userLanguage', 'systemLanguage'];
|
|
@@ -359,6 +313,9 @@ const getFallbackInitData = () => {
|
|
|
359
313
|
const LEGACY_SHARE_PLACEHOLDER = '<CONF_ID>';
|
|
360
314
|
const SHARE_PLACEHOLDER = '#CONFIGURATIONID#';
|
|
361
315
|
|
|
316
|
+
// see why: so#/58065241/10800831
|
|
317
|
+
const isAndroid = () => /(android)/i.test(navigator.userAgent);
|
|
318
|
+
|
|
362
319
|
const setDefaultBehaviour = (object, callbackName, defaultBehaviour) => {
|
|
363
320
|
let customBehaviour = null;
|
|
364
321
|
Object.defineProperty(object, callbackName, {
|