@roomle/embedding-lib 4.43.0 → 5.0.1-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.
- package/.releaserc.json +4 -7
- package/README.md +5 -6
- package/docs/md/web/embedding/CHANGELOG.md +8 -0
- package/{types/src/configurator/embedding/roomle-configurator-api.d.ts → index.d.ts} +26 -18
- package/package.json +27 -13
- package/roomle-embedding-lib.es.js +431 -0
- package/roomle-embedding-lib.es.min.js +8 -0
- package/roomle-embedding-lib.umd.js +8 -0
- package/roomle-embedding-lib.umd.min.js +8 -0
- package/docs/__sidebar__.json +0 -14
- package/docs/api/.nojekyll +0 -1
- package/docs/api/README.md +0 -9
- package/docs/api/classes/exposed_analytics_callbacks.ExposedAnalyticsCallbacks.md +0 -47
- package/docs/api/classes/exposed_api.ExposedApi.md +0 -255
- package/docs/api/classes/exposed_callbacks.ExposedCallbacks.md +0 -195
- package/docs/api/classes/roomle_configurator_api.default.md +0 -211
- package/docs/api/enums/types.UI_BUTTON.md +0 -263
- package/docs/api/interfaces/exposed_callbacks.Labels.md +0 -32
- package/docs/api/interfaces/exposed_callbacks.Price.md +0 -32
- package/docs/api/interfaces/roomle_configurator_api.RoomleEmbeddingApiKeys.md +0 -58
- package/docs/api/interfaces/types.ConfiguratorSettings.md +0 -150
- package/docs/api/interfaces/types.EmbeddingSkin.md +0 -65
- package/docs/api/interfaces/types.UiInitData.md +0 -1199
- package/docs/api/interfaces/types.VariantsMap.md +0 -9
- package/docs/api/modules/exposed_analytics_callbacks.md +0 -9
- package/docs/api/modules/exposed_api.md +0 -9
- package/docs/api/modules/exposed_callbacks.md +0 -14
- package/docs/api/modules/roomle_configurator_api.md +0 -49
- package/docs/api/modules/types.md +0 -16
- package/docs/api/modules.md +0 -13
- package/docs/examples/00_init.html +0 -38
- package/docs/examples/01_small_screen.html +0 -37
- package/docs/examples/02_resize_callback.html +0 -46
- package/docs/examples/03_instant_start.html +0 -38
- package/docs/examples/04_price.html +0 -48
- package/docs/examples/05_analytics.html +0 -38
- package/docs/examples/06_skinning.html +0 -39
- package/docs/examples/07_request_product.html +0 -41
- package/docs/examples/08_variants.html +0 -36
- package/docs/examples/09_different_products.html +0 -63
- package/docs/examples/10_landing_page.html +0 -38
- package/docs/examples/11_light_settings.html +0 -126
- package/docs/examples/12_email.html +0 -36
- package/docs/examples/13_parameters.html +0 -67
- package/docs/examples/14_ga_consent.html +0 -39
- package/docs/examples/roomle-configurator-api.es.min.js +0 -586
- package/docs/hsp.md +0 -61
- package/docs/images/parts.png +0 -0
- package/docs/images/usm-frames.png +0 -0
- package/docs/integration.md +0 -1101
- package/docs/md/web/ui/EMBEDDING-CHANGELOG.md +0 -63
- package/docs/migration-guides/v2-to-v3.md +0 -135
- package/docs/moc/index.md +0 -86
- package/docs/simple.md +0 -25
- package/roomle-configurator-api.cjs.js +0 -585
- package/roomle-configurator-api.cjs.min.js +0 -1
- package/roomle-configurator-api.es.js +0 -583
- package/roomle-configurator-api.es.min.js +0 -1
- package/roomle-configurator-api.js +0 -583
- package/types/index.d.ts +0 -1500
- package/types/src/common/business-logic/connector.d.ts +0 -8
- package/types/src/common/business-logic/event-bus.d.ts +0 -5
- package/types/src/common/components/collection-view/-utils/types.d.ts +0 -10
- package/types/src/common/plugins/analytics.d.ts +0 -11
- package/types/src/common/plugins/localize.d.ts +0 -8
- package/types/src/common/store/collection-view-state.d.ts +0 -40
- package/types/src/common/store/common-ui-state.d.ts +0 -16
- package/types/src/common/store/index.d.ts +0 -111
- package/types/src/common/translations/local-translation-source.d.ts +0 -8
- package/types/src/common/utils/access-restriction.d.ts +0 -7
- package/types/src/common/utils/ar-service.d.ts +0 -14
- package/types/src/common/utils/bezier.d.ts +0 -2
- package/types/src/common/utils/browser.d.ts +0 -3
- package/types/src/common/utils/color.d.ts +0 -2
- package/types/src/common/utils/compatibility.d.ts +0 -3
- package/types/src/common/utils/dom.d.ts +0 -15
- package/types/src/common/utils/font-size-detector.d.ts +0 -1
- package/types/src/common/utils/google-analytics.d.ts +0 -67
- package/types/src/common/utils/helper.d.ts +0 -43
- package/types/src/common/utils/iframe.d.ts +0 -3
- package/types/src/common/utils/init-data.d.ts +0 -34
- package/types/src/common/utils/merge.d.ts +0 -16
- package/types/src/common/utils/parameters.d.ts +0 -18
- package/types/src/common/utils/performance.d.ts +0 -2
- package/types/src/common/utils/plan.d.ts +0 -1
- package/types/src/common/utils/script-loader.d.ts +0 -5
- package/types/src/common/utils/share.d.ts +0 -1
- package/types/src/common/utils/touch-drag.d.ts +0 -24
- package/types/src/common/utils/types.d.ts +0 -19
- package/types/src/common/utils/user-agent.d.ts +0 -6
- package/types/src/common/utils/variants.d.ts +0 -3
- package/types/src/configurator/ar/main.d.ts +0 -1
- package/types/src/configurator/business-logic/roomle-sdk-wrapper.d.ts +0 -27
- package/types/src/configurator/business-logic/sdk-connector-configurator.d.ts +0 -29
- package/types/src/configurator/business-logic/sdk-connector.d.ts +0 -119
- package/types/src/configurator/business-logic/ui-callback.d.ts +0 -5
- package/types/src/configurator/components/-utils/overlays.d.ts +0 -43
- package/types/src/configurator/components/grid-view/-utils/GridViewHelper.d.ts +0 -16
- package/types/src/configurator/components/utils/-utils/SceneOffsetResizer.d.ts +0 -23
- package/types/src/configurator/embedding/example/main.d.ts +0 -1
- package/types/src/configurator/embedding/exposed-analytics-callbacks.d.ts +0 -10
- package/types/src/configurator/embedding/exposed-api.d.ts +0 -90
- package/types/src/configurator/embedding/exposed-callbacks.d.ts +0 -46
- package/types/src/configurator/embedding/helper.d.ts +0 -8
- package/types/src/configurator/embedding/message-handler.d.ts +0 -31
- package/types/src/configurator/embedding/types.d.ts +0 -159
- package/types/src/configurator/embedding/utils.d.ts +0 -15
- package/types/src/configurator/plugins/embedding-callbacks-plugin.d.ts +0 -4
- package/types/src/configurator/plugins/libs-plugin.d.ts +0 -11
- package/types/src/configurator/plugins/sdk-connector-plugin.d.ts +0 -14
- package/types/src/configurator/store/core-data.d.ts +0 -34
- package/types/src/configurator/store/core-state.d.ts +0 -26
- package/types/src/configurator/store/ui-state.d.ts +0 -118
- package/types/src/main.d.ts +0 -14
- package/types/src/planner/business-logic/general-room-parameters.d.ts +0 -17
- package/types/src/planner/business-logic/pre-defined-rooms.d.ts +0 -2
- package/types/src/planner/business-logic/rooms.d.ts +0 -37
- package/types/src/planner/business-logic/sdk-connector-planner.d.ts +0 -28
- package/types/src/planner/store/planner-core-data.d.ts +0 -21
- package/types/src/planner/store/planner-ui-state.d.ts +0 -61
- package/types/src/planner/utils/interaction.d.ts +0 -3
- package/types/src/planner/utils/planner-sidebar.d.ts +0 -19
- package/types/src/viewer/business-logic/sdk-connector-viewer.d.ts +0 -18
- package/types/tests/helpers/data/base-64-images.d.ts +0 -1
- package/types/tests/helpers/data/configurator.d.ts +0 -7
- package/types/tests/helpers/data/items.d.ts +0 -208
- package/types/tests/helpers/data/materials.d.ts +0 -32
- package/types/tests/helpers/data/parameter-groups.d.ts +0 -242
- package/types/tests/helpers/data/parameters.d.ts +0 -399
- package/types/tests/helpers/data/part-list.d.ts +0 -126
- package/types/tests/helpers/data/plan.d.ts +0 -224
- package/types/tests/helpers/data/planObject.d.ts +0 -134
- package/types/tests/helpers/data/possible-children-tags.d.ts +0 -208
- package/types/tests/helpers/data/variants.d.ts +0 -60
- package/types/tests/helpers/dom.d.ts +0 -1
- package/types/tests/helpers/mocks/analytics.d.ts +0 -7
- package/types/tests/helpers/mocks/data/biohort-parameter.d.ts +0 -32
- package/types/tests/helpers/mocks/data/koinor-formia.d.ts +0 -289
- package/types/tests/helpers/mocks/embedding-callbacks.d.ts +0 -4
- package/types/tests/helpers/mocks/icon.d.ts +0 -3
- package/types/tests/helpers/mocks/localize.d.ts +0 -8
- package/types/tests/helpers/mocks/message.d.ts +0 -11
- package/types/tests/helpers/mocks/parameters.d.ts +0 -47
- package/types/tests/helpers/mocks/possible-children.d.ts +0 -596
- package/types/tests/helpers/mocks/roomle-sdk-wrapper.d.ts +0 -177
- package/types/tests/helpers/mocks/sdk-connector-configurator.d.ts +0 -13
- package/types/tests/helpers/mocks/sdk-connector-planner.d.ts +0 -13
- package/types/tests/helpers/mocks/sdk-connector.d.ts +0 -35
- package/types/tests/helpers/mocks/store.d.ts +0 -11
- package/types/tests/helpers/mocks/tag.d.ts +0 -148
- package/types/tests/helpers/utils.d.ts +0 -13
- package/types/tests/integration/common/components/ActionButtons.spec.d.ts +0 -1
- package/types/tests/integration/common/components/BottomBar.spec.d.ts +0 -1
- package/types/tests/integration/common/components/BottomButtons.spec.d.ts +0 -1
- package/types/tests/integration/common/components/IconButton.spec.d.ts +0 -1
- package/types/tests/integration/common/components/SelectionButtons.spec.d.ts +0 -1
- package/types/tests/integration/common/components/part-list/part-list/PartListPrint.spec.d.ts +0 -1
- package/types/tests/integration/common/components/part-list/part-list/PartListRow.spec.d.ts +0 -1
- package/types/tests/integration/configurator/App.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/ARButton.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/ConfiguratorMain.spec.d.ts +0 -9
- package/types/tests/integration/configurator/components/CookieBanner.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/Overlays.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/TopBar.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/ViewerMain.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/addons/AddonsTrigger.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/addons/PossibleChildren.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/collection-view/-utils/TabbedNav.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/collection-view/CollectionView.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/grid-view/-utils/CollapsedView.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/grid-view/-utils/ExpandedView.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/grid-view/-utils/GridViewElement.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/grid-view/-utils/GridViewHelper.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/grid-view/GridView.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/overlays/Export3D.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/overlays/NoDocking.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/overlays/PartList.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/overlays/SaveDraft.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/overlays/VariantWarning.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/overlays/ar/OpenARView.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/parameters/BackParameterGroupButton.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/parameters/NextParameterGroupButton.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/parameters/ParameterGroupButton.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/parameters/ParameterGroups.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/parameters/types/MaterialParameter.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/parameters/types/OptionsParameter.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/parameters/types/OptionsParameterValue.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/parameters/types/ProductVariant.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/parameters/types/RangeParameter.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/parameters/types/ThumbnailsParameter.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/utils/BackToWebsite.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/utils/CheckBox.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/utils/FullscreenContainer.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/utils/GdprEmailInput.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/utils/HeightToggle.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/utils/ImageWithFallback.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/utils/InteractionContainer.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/utils/PopUp.spec.d.ts +0 -1
- package/types/tests/integration/configurator/components/utils/ScrollHint.spec.d.ts +0 -1
- package/types/tests/integration/helper.spec.d.ts +0 -1
- package/types/tests/integration/planner/components/CatalogTrigger.spec.d.ts +0 -1
- package/types/tests/integration/planner/components/PlannerMain.spec.d.ts +0 -1
- package/types/tests/integration/planner/components/PlannerSidebar.spec.d.ts +0 -1
- package/types/tests/integration/planner/components/ProductListButton.spec.d.ts +0 -1
- package/types/tests/integration/planner/components/SampleRooms.spec.d.ts +0 -1
- package/types/tests/integration/planner/components/overlays/product-list/ProductListEntry.spec.d.ts +0 -1
- package/types/tests/integration/planner/components/overlays/rooms/RoomGeneralSettings.spec.d.ts +0 -1
- package/types/tests/integration/planner/components/overlays/rooms/RoomRangeParameter.spec.d.ts +0 -1
- package/types/tests/integration/planner/components/utils/sidebar-nav/SidebarNav.spec.d.ts +0 -1
- package/types/tests/unit/common/business-logic/event-bus.spec.d.ts +0 -1
- package/types/tests/unit/common/helper.spec.d.ts +0 -1
- package/types/tests/unit/common/translations/local-translation-source.spec.d.ts +0 -1
- package/types/tests/unit/common/utils/ar-service.spec.d.ts +0 -1
- package/types/tests/unit/common/utils/bezier.spec.d.ts +0 -1
- package/types/tests/unit/common/utils/color.spec.d.ts +0 -1
- package/types/tests/unit/common/utils/dom.spec.d.ts +0 -1
- package/types/tests/unit/common/utils/helper.spec.d.ts +0 -1
- package/types/tests/unit/common/utils/init-data.spec.d.ts +0 -1
- package/types/tests/unit/common/utils/parameters.spec.d.ts +0 -1
- package/types/tests/unit/common/utils/touch-drag.spec.d.ts +0 -1
- package/types/tests/unit/configurator/business-logic/sdk-connector-configurator.spec.d.ts +0 -1
- package/types/tests/unit/configurator/business-logic/sdk-connector.spec.d.ts +0 -1
- package/types/tests/unit/configurator/components/utils/-utils/ConfiguratorResizer.spec.d.ts +0 -1
- package/types/tests/unit/configurator/components/utils/WordWrap.spec.d.ts +0 -1
- package/types/tests/unit/configurator/embedding/exposed-api.spec.d.ts +0 -1
- package/types/tests/unit/configurator/embedding/utils.spec.d.ts +0 -1
- package/types/tests/unit/configurator/store/index.spec.d.ts +0 -1
- package/types/tests/unit/planner/business-logic/sdk-connector-planner.spec.d.ts +0 -1
package/.releaserc.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"tagFormat": "embedding-v${version}",
|
|
2
|
+
"tagFormat": "embedding-lib-v${version}",
|
|
3
3
|
"repositoryUrl": "git@github.com:roomle-dev/roomle-ui.git",
|
|
4
4
|
"branches": [
|
|
5
5
|
{
|
|
6
|
-
"name": "
|
|
6
|
+
"name": "cd/test",
|
|
7
7
|
"channel": "debug",
|
|
8
8
|
"prerelease": "debug"
|
|
9
9
|
},
|
|
@@ -40,17 +40,14 @@
|
|
|
40
40
|
{
|
|
41
41
|
"preset": "conventionalcommits",
|
|
42
42
|
"writerOpts": {
|
|
43
|
-
"commitsSort": [
|
|
44
|
-
"subject",
|
|
45
|
-
"scope"
|
|
46
|
-
]
|
|
43
|
+
"commitsSort": ["subject", "scope"]
|
|
47
44
|
}
|
|
48
45
|
}
|
|
49
46
|
],
|
|
50
47
|
[
|
|
51
48
|
"@semantic-release/changelog",
|
|
52
49
|
{
|
|
53
|
-
"changelogFile": "docs/md/web/
|
|
50
|
+
"changelogFile": "docs/md/web/embedding/CHANGELOG.md"
|
|
54
51
|
}
|
|
55
52
|
],
|
|
56
53
|
[
|
package/README.md
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
# Roomle Rubens
|
|
1
|
+
# Roomle Rubens Embedding Lib
|
|
2
2
|
|
|
3
|
-
The official npm package to embed
|
|
3
|
+
The official npm package to embed [Roomle](https://www.roomle.com/en) Rubens in your website.
|
|
4
4
|
|
|
5
|
-
For release notes, see the [CHANGELOG](https://docs.roomle.com/
|
|
5
|
+
For release notes, see the [CHANGELOG](https://docs.roomle.com/rubens/changelogs/changelog).
|
|
6
6
|
|
|
7
7
|
## Getting started
|
|
8
|
-
You can find an extensive guide on how to get started on [docs.roomle.com](https://docs.roomle.com/web/embedding/).
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
Use our [API documentation](https://docs.roomle.com/web/embedding/api/classes/roomle_configurator_api.default.html) to get further information on how to use the classes provided by the Rubens Configuratior Embedding.
|
|
9
|
+
You can find an extensive guide on how to get started on [docs.roomle.com](https://docs.roomle.com/rubens/rubens-products/rubens-3d-viewer-and-ar/getting-started).
|
|
12
10
|
|
|
13
11
|
## Bugs & Issues
|
|
12
|
+
|
|
14
13
|
If you encounter issues please report them using our [Servicedesk](https://roomle.atlassian.net/servicedesk/customer/portals).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## [5.0.1-debug.1](https://github.com/roomle-dev/roomle-ui/compare/embedding-lib-v5.0.0...embedding-lib-v5.0.1-debug.1) (2024-08-05)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* remove syntax error ([34a7cda](https://github.com/roomle-dev/roomle-ui/commit/34a7cda3a4be80d2260ff6e4990f2b42be4fd2ad))
|
|
7
|
+
* some stuff ([b4c0152](https://github.com/roomle-dev/roomle-ui/commit/b4c015270ebdf61971a8108dc5637c7b54847c88))
|
|
8
|
+
* use correct credentials ([6898e84](https://github.com/roomle-dev/roomle-ui/commit/6898e845733d6086562a78a3c5619ea8954011ed))
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
global: any;
|
|
14
|
-
}
|
|
15
|
-
export declare type RoomleConfiguratorApi = RoomleEmbeddingApi<RoomleConfigurator, ConfiguratorUiCallbacks>;
|
|
16
|
-
export declare type RoomleViewerApi = RoomleEmbeddingApi<RoomleGLBViewer, ConfiguratorUiCallbacks>;
|
|
17
|
-
export declare type RoomlePlannerApi = RoomleEmbeddingApi<RoomlePlanner, ConfiguratorUiCallbacks>;
|
|
18
|
-
export default class RoomleEmbeddingApi<SdkType, SdkCallbacks> implements RoomleEmbeddingApiKeys {
|
|
1
|
+
import { default as default_2 } from '@roomle/web-sdk/lib/definitions/planner-core/src/roomle-planner';
|
|
2
|
+
import { default as default_3 } from '@roomle/web-sdk/lib/definitions/configurator-core/src/services/configurator-ui-callback';
|
|
3
|
+
import { default as default_4 } from '@roomle/web-sdk/lib/definitions/configurator-core/src/roomle-configurator';
|
|
4
|
+
import { default as default_5 } from '@roomle/web-sdk/lib/definitions/glb-viewer-core/src/roomle-glb-viewer';
|
|
5
|
+
import { ExposedAnalyticsCallbacks } from '../../../src/configurator/embedding/exposed-analytics-callbacks';
|
|
6
|
+
import { ExposedApi } from '../../../src/configurator/embedding/exposed-api';
|
|
7
|
+
import { GlobalCallback } from '@roomle/web-sdk/lib/definitions/common-core/src/services/global-callback';
|
|
8
|
+
import { UiInitData } from '../../../src/configurator/embedding/types';
|
|
9
|
+
|
|
10
|
+
declare type RoomleConfiguratorApi = RoomleEmbeddingApi<default_4, default_3>;
|
|
11
|
+
|
|
12
|
+
declare class RoomleEmbeddingApi<SdkType, SdkCallbacks> implements RoomleEmbeddingApiKeys {
|
|
19
13
|
static createPlanner(configuratorId: string, container: HTMLElement, initData: UiInitData): Promise<RoomlePlannerApi>;
|
|
20
14
|
/**
|
|
21
15
|
* Method to create a new instance of a Roomle Configurator
|
|
@@ -62,3 +56,17 @@ export default class RoomleEmbeddingApi<SdkType, SdkCallbacks> implements Roomle
|
|
|
62
56
|
private _onBackToWebsite;
|
|
63
57
|
private _executeMessage;
|
|
64
58
|
}
|
|
59
|
+
export default RoomleEmbeddingApi;
|
|
60
|
+
|
|
61
|
+
declare interface RoomleEmbeddingApiKeys {
|
|
62
|
+
extended: any;
|
|
63
|
+
ui: any;
|
|
64
|
+
analytics: any;
|
|
65
|
+
global: any;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
declare type RoomlePlannerApi = RoomleEmbeddingApi<default_2, default_3>;
|
|
69
|
+
|
|
70
|
+
declare type RoomleViewerApi = RoomleEmbeddingApi<default_5, default_3>;
|
|
71
|
+
|
|
72
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roomle/embedding-lib",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
3
|
+
"version": "5.0.1-debug.1",
|
|
4
|
+
"description": "This is a small library which can be used to communicate with the Roomle Configurator",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./roomle-embedding-lib.umd.js",
|
|
7
|
+
"module": "./roomle-embedding-lib.es.js",
|
|
8
|
+
"browser": "./roomle-embedding-lib.es.js",
|
|
9
|
+
"types": "./index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"./"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./roomle-embedding-lib.es.js",
|
|
16
|
+
"require": "./roomle-embedding-lib.umd.js",
|
|
17
|
+
"types": "./index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./min": {
|
|
20
|
+
"import": "./roomle-embedding-lib.es.min.js",
|
|
21
|
+
"require": "./roomle-embedding-lib.umd.min.js"
|
|
22
|
+
}
|
|
15
23
|
},
|
|
16
24
|
"scripts": {
|
|
17
25
|
"release": "semantic-release"
|
|
18
26
|
},
|
|
19
|
-
"
|
|
27
|
+
"volta": {
|
|
28
|
+
"node": "18.18.0",
|
|
29
|
+
"npm": "8.3.1"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@roomle/web-sdk": "2.83.0-alpha.2"
|
|
33
|
+
},
|
|
20
34
|
"repository": {
|
|
21
35
|
"type": "git",
|
|
22
36
|
"url": "git+https://github.com/roomle-build/npm-packages.git"
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var v = (t, e, s) => e in t ? M(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
|
+
var u = (t, e, s) => v(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
class P {
|
|
5
|
+
constructor(e, s, r, o) {
|
|
6
|
+
u(this, "_side");
|
|
7
|
+
// for better debugging (who handles message? iframe or website?)
|
|
8
|
+
u(this, "_incomingMessageBus");
|
|
9
|
+
u(this, "_outgoingMessageBus", null);
|
|
10
|
+
u(this, "_execMessage", null);
|
|
11
|
+
this._side = e, this._incomingMessageBus = s, this._outgoingMessageBus = r, this._execMessage = o, this._incomingMessageBus.addEventListener(
|
|
12
|
+
"message",
|
|
13
|
+
this._handleMessage.bind(this)
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
setOutgoingMessageBus(e) {
|
|
17
|
+
this._outgoingMessageBus = e;
|
|
18
|
+
}
|
|
19
|
+
setMessageExecution(e) {
|
|
20
|
+
this._execMessage = e;
|
|
21
|
+
}
|
|
22
|
+
sendMessage(e, s = []) {
|
|
23
|
+
return new Promise((r, o) => {
|
|
24
|
+
const n = new MessageChannel();
|
|
25
|
+
n.port1.onmessage = (a) => {
|
|
26
|
+
if (!a || !a.data)
|
|
27
|
+
return n.port1.close(), n.port2.close(), o(
|
|
28
|
+
new Error(
|
|
29
|
+
this._side + " received message but response can not be interpreted"
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
let l;
|
|
33
|
+
try {
|
|
34
|
+
l = JSON.parse(a.data);
|
|
35
|
+
} catch (d) {
|
|
36
|
+
return n.port1.close(), n.port2.close(), this._prepareError(d), o(d);
|
|
37
|
+
}
|
|
38
|
+
l.error ? o(l.error) : l.result !== void 0 ? r(l.result) : r(void 0), n.port1.close(), n.port2.close();
|
|
39
|
+
};
|
|
40
|
+
let i = "";
|
|
41
|
+
try {
|
|
42
|
+
i = JSON.stringify({ message: e, args: s });
|
|
43
|
+
} catch {
|
|
44
|
+
return o(
|
|
45
|
+
new Error(
|
|
46
|
+
this._side + ": can not create command because it is not JSON.stringify able"
|
|
47
|
+
)
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
if (!this._outgoingMessageBus)
|
|
51
|
+
return o(new Error(this._side + ": outgoing bus not set yet"));
|
|
52
|
+
this._outgoingMessageBus.postMessage(i, "*", [
|
|
53
|
+
n.port2
|
|
54
|
+
]);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
_handleMessage(e) {
|
|
58
|
+
const s = e.ports && Array.isArray(e.ports) && e.ports.length > 0 ? e.ports[0] : null;
|
|
59
|
+
if (e.data && s)
|
|
60
|
+
try {
|
|
61
|
+
const r = JSON.parse(e.data);
|
|
62
|
+
if (!this._execMessage)
|
|
63
|
+
return s.postMessage(
|
|
64
|
+
JSON.stringify({
|
|
65
|
+
error: this._side + " is not ready to handle messages"
|
|
66
|
+
})
|
|
67
|
+
);
|
|
68
|
+
Array.isArray(r.args) || (r.args = [r.args]);
|
|
69
|
+
const o = this._execMessage(r, e);
|
|
70
|
+
if (o === void 0)
|
|
71
|
+
return;
|
|
72
|
+
o.then(
|
|
73
|
+
(n = {}) => {
|
|
74
|
+
let i, a;
|
|
75
|
+
typeof n == "object" && n !== null && (i = n.error, a = n.result), i ? s.postMessage(
|
|
76
|
+
JSON.stringify({ error: i })
|
|
77
|
+
) : a !== void 0 ? s.postMessage(
|
|
78
|
+
JSON.stringify({ result: a })
|
|
79
|
+
) : s.postMessage(
|
|
80
|
+
JSON.stringify({ result: n })
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
(n) => {
|
|
84
|
+
s.postMessage(
|
|
85
|
+
JSON.stringify({
|
|
86
|
+
error: this._prepareError(n)
|
|
87
|
+
})
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
} catch (r) {
|
|
92
|
+
s.postMessage(
|
|
93
|
+
JSON.stringify({
|
|
94
|
+
error: this._prepareError(r)
|
|
95
|
+
})
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
_prepareError(e) {
|
|
100
|
+
if (typeof e == "string") {
|
|
101
|
+
const s = this._side + ": " + e;
|
|
102
|
+
return console.error(s), s;
|
|
103
|
+
}
|
|
104
|
+
return e.message = this._side + ": " + e.message, console.error(e), e.message;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const p = ".", E = {
|
|
108
|
+
REQUEST_BOOT: "requestBoot",
|
|
109
|
+
SETUP: "setup",
|
|
110
|
+
WEBSITE_READY: "websiteReady"
|
|
111
|
+
}, H = async (t, e) => {
|
|
112
|
+
if (typeof t != "string")
|
|
113
|
+
throw new Error(
|
|
114
|
+
'Configurator ID is not a string type: "' + typeof t + '"'
|
|
115
|
+
);
|
|
116
|
+
const s = e.customApiUrl ? e.customApiUrl : "https://api.roomle.com/v2", r = e.overrideTenant || 9, o = s + "/configurators/" + t, n = "roomle_portal_v2", i = "03-" + window.btoa((/* @__PURE__ */ new Date()).toISOString() + ";anonymous;" + n), a = () => {
|
|
117
|
+
const h = {
|
|
118
|
+
apiKey: n,
|
|
119
|
+
currentTenant: r,
|
|
120
|
+
locale: "en",
|
|
121
|
+
language: "en",
|
|
122
|
+
device: 1,
|
|
123
|
+
token: i,
|
|
124
|
+
platform: "web"
|
|
125
|
+
};
|
|
126
|
+
return new Headers(h);
|
|
127
|
+
}, l = new Request(o, {
|
|
128
|
+
method: "GET",
|
|
129
|
+
headers: a(),
|
|
130
|
+
mode: "cors",
|
|
131
|
+
cache: "default"
|
|
132
|
+
}), d = await fetch(l), { configurator: m } = await d.json();
|
|
133
|
+
return m;
|
|
134
|
+
}, F = () => {
|
|
135
|
+
try {
|
|
136
|
+
return window.self !== window.top;
|
|
137
|
+
} catch {
|
|
138
|
+
return !0;
|
|
139
|
+
}
|
|
140
|
+
}, D = ["127.0.0.1", "localhost", "0.0.0.0"], C = () => {
|
|
141
|
+
const t = F();
|
|
142
|
+
let e = window.location.href;
|
|
143
|
+
if (t) {
|
|
144
|
+
if (!document.referrer)
|
|
145
|
+
return null;
|
|
146
|
+
e = document.referrer;
|
|
147
|
+
}
|
|
148
|
+
const { hostname: s } = new URL(e);
|
|
149
|
+
return s;
|
|
150
|
+
}, B = (t) => !!(D.includes(t) || t.endsWith("roomle.com") || t.endsWith("gitlab.io") || t.endsWith("gitlab.com")), I = [
|
|
151
|
+
"language",
|
|
152
|
+
"browserLanguage",
|
|
153
|
+
"userLanguage",
|
|
154
|
+
"systemLanguage"
|
|
155
|
+
], k = (t = null) => {
|
|
156
|
+
const e = window.navigator;
|
|
157
|
+
if (t)
|
|
158
|
+
return t.substr(0, 2);
|
|
159
|
+
if (Array.isArray(e.languages) && e.languages.length > 0)
|
|
160
|
+
return e.languages[0].substr(0, 2);
|
|
161
|
+
for (let s = 0, r = I.length; s < r; s++) {
|
|
162
|
+
const o = e[I[s]];
|
|
163
|
+
if (o)
|
|
164
|
+
return o.substr(0, 2);
|
|
165
|
+
}
|
|
166
|
+
return "en";
|
|
167
|
+
}, U = (t, e) => {
|
|
168
|
+
const s = JSON.parse(JSON.stringify(t));
|
|
169
|
+
return A(s, e);
|
|
170
|
+
}, A = (t, e) => {
|
|
171
|
+
for (const s in e)
|
|
172
|
+
try {
|
|
173
|
+
e[s].constructor === Object ? t[s] = A(t[s], e[s]) : t[s] = e[s];
|
|
174
|
+
} catch {
|
|
175
|
+
t[s] = e[s];
|
|
176
|
+
}
|
|
177
|
+
return t;
|
|
178
|
+
}, x = {
|
|
179
|
+
mobileLandscape: !0,
|
|
180
|
+
floorMaterialRootTag: "materials_root",
|
|
181
|
+
buttons: {
|
|
182
|
+
renderimage: !0,
|
|
183
|
+
requestproduct: !0,
|
|
184
|
+
requestplan: !0,
|
|
185
|
+
load_product: !0,
|
|
186
|
+
partlist_print: !0
|
|
187
|
+
},
|
|
188
|
+
helpcenter: {
|
|
189
|
+
roomdesigner: !0,
|
|
190
|
+
configurator: !1,
|
|
191
|
+
disable: !1
|
|
192
|
+
},
|
|
193
|
+
firstPersonView: !0,
|
|
194
|
+
saveToIdb: !0,
|
|
195
|
+
featureFlags: {
|
|
196
|
+
mocAr: !0
|
|
197
|
+
}
|
|
198
|
+
}, W = "(idle)", G = (t) => (O(t), t != null && t.customApiUrl && (t.customApiUrl = decodeURIComponent(t.customApiUrl)), t.shareUrl && (t.deeplink = t.shareUrl.replace(
|
|
199
|
+
z,
|
|
200
|
+
V
|
|
201
|
+
)), t), O = (t) => {
|
|
202
|
+
if (!t)
|
|
203
|
+
return;
|
|
204
|
+
const e = Object.keys(t);
|
|
205
|
+
for (const s of e) {
|
|
206
|
+
const r = t[s];
|
|
207
|
+
if (!Array.isArray(r) && typeof r == "object" && r !== null && O(r), Array.isArray(r))
|
|
208
|
+
for (const o of r)
|
|
209
|
+
O(o);
|
|
210
|
+
(r === "true" || r === "false") && (t[s] = r === "true");
|
|
211
|
+
}
|
|
212
|
+
}, J = (t, e) => {
|
|
213
|
+
e.configuratorId = t.id;
|
|
214
|
+
const s = t.settings || {};
|
|
215
|
+
return !e.overrideTenant && t.tenant && (e.overrideTenant = t.tenant), U(s, e);
|
|
216
|
+
}, $ = () => {
|
|
217
|
+
const t = {
|
|
218
|
+
...x
|
|
219
|
+
};
|
|
220
|
+
t.locale || (t.locale = k()), t.id === W && delete t.id;
|
|
221
|
+
const e = C();
|
|
222
|
+
return e && B(e) && (t.configuratorId = "demoConfigurator"), t.customApiUrl = "https://www.roomle.com/api/v2", t.emails = !1, t;
|
|
223
|
+
}, z = "<CONF_ID>", V = "#CONFIGURATIONID#", b = () => /(android)/i.test(navigator.userAgent), R = (t, e, s) => {
|
|
224
|
+
let r = null;
|
|
225
|
+
Object.defineProperty(t, e, {
|
|
226
|
+
get() {
|
|
227
|
+
return r || s;
|
|
228
|
+
},
|
|
229
|
+
set(o) {
|
|
230
|
+
o != null && o.mute ? r = o.value : (console.warn(
|
|
231
|
+
"You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"
|
|
232
|
+
), console.warn("{ mute: true, value: () => void }"), r = o);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
}, N = () => window.innerHeight * 0.01 + "px", T = (t) => {
|
|
236
|
+
t && setTimeout(
|
|
237
|
+
() => t.style.setProperty(y, N()),
|
|
238
|
+
0
|
|
239
|
+
);
|
|
240
|
+
}, L = "rml-styles", Y = 450, y = "--rml-full-height", c = {
|
|
241
|
+
CONTAINER: "rml-container",
|
|
242
|
+
FILL: "rml-fill",
|
|
243
|
+
POSITION: "rml-pos",
|
|
244
|
+
TRANSITION: "rml-transition",
|
|
245
|
+
ANDROID_HEIGHT: "rml-android-height",
|
|
246
|
+
OVERFLOW_HIDDEN: "rml-overflow-hidden"
|
|
247
|
+
}, w = /* @__PURE__ */ new Map();
|
|
248
|
+
class K {
|
|
249
|
+
constructor(e, s, r, o) {
|
|
250
|
+
u(this, "ui", {
|
|
251
|
+
callbacks: null
|
|
252
|
+
});
|
|
253
|
+
u(this, "extended", {
|
|
254
|
+
callbacks: null
|
|
255
|
+
});
|
|
256
|
+
u(this, "analytics", {
|
|
257
|
+
callbacks: {}
|
|
258
|
+
});
|
|
259
|
+
u(this, "global", {
|
|
260
|
+
callbacks: {}
|
|
261
|
+
});
|
|
262
|
+
u(this, "_waitForIframe");
|
|
263
|
+
u(this, "_container");
|
|
264
|
+
u(this, "_messageHandler");
|
|
265
|
+
u(this, "_configuratorSettings");
|
|
266
|
+
u(this, "_initData", {});
|
|
267
|
+
u(this, "_iframe");
|
|
268
|
+
if (!e || typeof e.id != "string")
|
|
269
|
+
throw new Error(
|
|
270
|
+
"Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person"
|
|
271
|
+
);
|
|
272
|
+
if (w.has(s))
|
|
273
|
+
throw new Error("There is already an instance on this DOM element");
|
|
274
|
+
if (!!!document.getElementById(L)) {
|
|
275
|
+
const a = r.zIndex || 9999999, l = document.createElement("style");
|
|
276
|
+
l.type = "text/css", l.id = L;
|
|
277
|
+
const d = "transition:all ease-in-out " + Y + "ms;", m = ["-webkit-", "-o-"].reduce(
|
|
278
|
+
(f, g) => f += g + d,
|
|
279
|
+
""
|
|
280
|
+
) + d, h = N();
|
|
281
|
+
l.innerHTML = `
|
|
282
|
+
.${c.CONTAINER}{${y}:${h};}
|
|
283
|
+
.${c.POSITION}{position:fixed;top:0;left:0;z-index:${a};opacity:0}
|
|
284
|
+
.${c.TRANSITION}{${m}}
|
|
285
|
+
.${c.FILL}{width:100%;height:100%;opacity:1}
|
|
286
|
+
.${c.ANDROID_HEIGHT}{height:calc(var(${y},1vh)*100)}
|
|
287
|
+
.${c.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
288
|
+
`, document.head.appendChild(l);
|
|
289
|
+
}
|
|
290
|
+
this._onResize = this._onResize.bind(this), b() && window.addEventListener("resize", this._onResize), this._container = s, this._initData = r, this._configuratorSettings = e;
|
|
291
|
+
const i = this._createIframe();
|
|
292
|
+
this._onUseFullPage = this._onUseFullPage.bind(this), this._executeMessage = this._executeMessage.bind(this), this._onBackToWebsite = this._onBackToWebsite.bind(this), this._messageHandler = new P(
|
|
293
|
+
"website",
|
|
294
|
+
window,
|
|
295
|
+
null,
|
|
296
|
+
this._executeMessage
|
|
297
|
+
), this._waitForIframe = o, this._container.appendChild(i), this._iframe = i, w.set(s, !0);
|
|
298
|
+
}
|
|
299
|
+
static createPlanner(e, s, r) {
|
|
300
|
+
return this._create(
|
|
301
|
+
e,
|
|
302
|
+
s,
|
|
303
|
+
r
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Method to create a new instance of a Roomle Configurator
|
|
308
|
+
* @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
|
|
309
|
+
* @param container DOM container in which the configurator should be placed
|
|
310
|
+
* @param initData settings with which the configurator should be started
|
|
311
|
+
*/
|
|
312
|
+
static createConfigurator(e, s, r) {
|
|
313
|
+
return this._create(
|
|
314
|
+
e,
|
|
315
|
+
s,
|
|
316
|
+
r
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Method to create a new instance of a Roomle Configurator
|
|
321
|
+
* @deprecated please use "createConfigurator"
|
|
322
|
+
* @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
|
|
323
|
+
* @param container DOM container in which the configurator should be placed
|
|
324
|
+
* @param initData settings with which the configurator should be started
|
|
325
|
+
*/
|
|
326
|
+
static create(e, s, r) {
|
|
327
|
+
return this._create(
|
|
328
|
+
e,
|
|
329
|
+
s,
|
|
330
|
+
r
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Method to create a new instance of a Roomle Viewer
|
|
335
|
+
* @param configuratorId the id which identifies your configurator, you will get this ID from your Roomle Contact Person
|
|
336
|
+
* @param container DOM container in which the configurator should be placed
|
|
337
|
+
* @param initData settings with which the configurator should be started
|
|
338
|
+
*/
|
|
339
|
+
static createViewer(e, s, r) {
|
|
340
|
+
return this._create(
|
|
341
|
+
e,
|
|
342
|
+
s,
|
|
343
|
+
r
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
static _create(e, s, r) {
|
|
347
|
+
return new Promise(async (o, n) => {
|
|
348
|
+
try {
|
|
349
|
+
const i = A(
|
|
350
|
+
$(),
|
|
351
|
+
G(r)
|
|
352
|
+
);
|
|
353
|
+
i.featureFlags || (i.featureFlags = {}), typeof i.featureFlags.realPartList != "boolean" && (i.featureFlags.realPartList = !0), typeof i.featureFlags.globalCallbacks != "boolean" && (i.featureFlags.globalCallbacks = !0), typeof i.featureFlags.mocAr != "boolean" && (i.featureFlags.mocAr = !1);
|
|
354
|
+
const a = await H(
|
|
355
|
+
e,
|
|
356
|
+
i
|
|
357
|
+
);
|
|
358
|
+
return r = J(a, i), new this(
|
|
359
|
+
a,
|
|
360
|
+
s,
|
|
361
|
+
r,
|
|
362
|
+
o
|
|
363
|
+
);
|
|
364
|
+
} catch (i) {
|
|
365
|
+
return n(i);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
teardown() {
|
|
370
|
+
this._container && w.delete(this._container);
|
|
371
|
+
const e = this._container.querySelector("iframe");
|
|
372
|
+
e && this._container.removeChild(e), window.removeEventListener("resize", this._onResize);
|
|
373
|
+
}
|
|
374
|
+
_createIframe() {
|
|
375
|
+
var r;
|
|
376
|
+
const e = document.createElement("iframe");
|
|
377
|
+
let s = ((r = this._configuratorSettings) == null ? void 0 : r.url) || "https://www.roomle.com/t/cp/";
|
|
378
|
+
return this._initData.useLocalRoomle && (s = location.href.replace("embedding.html", "")), location.href.includes("roomle.gitlab.io") && (s = location.href.replace("embedding.html", "index.html")), this._initData.overrideServerUrl && (s = this._initData.overrideServerUrl), e.src = s, e.classList.add(c.CONTAINER), e.classList.add(c.FILL), e;
|
|
379
|
+
}
|
|
380
|
+
_onResize() {
|
|
381
|
+
T(this._iframe);
|
|
382
|
+
}
|
|
383
|
+
_onUseFullPage() {
|
|
384
|
+
this._iframe.classList.add(c.POSITION), document.documentElement.classList.add(c.OVERFLOW_HIDDEN), window.document.body.classList.add(c.OVERFLOW_HIDDEN), b() && (T(this._iframe), this._iframe.classList.add(c.ANDROID_HEIGHT));
|
|
385
|
+
}
|
|
386
|
+
_onBackToWebsite() {
|
|
387
|
+
this._iframe.classList.remove(c.POSITION), this._iframe.classList.remove(c.ANDROID_HEIGHT), document.documentElement.classList.remove(c.OVERFLOW_HIDDEN), window.document.body.classList.remove(c.OVERFLOW_HIDDEN);
|
|
388
|
+
}
|
|
389
|
+
_executeMessage({ message: e, args: s }, r) {
|
|
390
|
+
var l;
|
|
391
|
+
if (!r.source || r.source !== ((l = this._iframe) == null ? void 0 : l.contentWindow))
|
|
392
|
+
return;
|
|
393
|
+
if (e === E.REQUEST_BOOT)
|
|
394
|
+
return this._messageHandler.setOutgoingMessageBus(r.source), Promise.resolve({ result: this._initData });
|
|
395
|
+
if (e === E.SETUP) {
|
|
396
|
+
const { methods: d, callbacks: m } = s[0];
|
|
397
|
+
return d.forEach((h) => {
|
|
398
|
+
const f = h.split(p), g = f[0], _ = f[1];
|
|
399
|
+
this[g] || (this[g] = {}), this[g][_] = (function() {
|
|
400
|
+
return this._messageHandler.sendMessage(h, [...arguments]);
|
|
401
|
+
}).bind(this);
|
|
402
|
+
}), m.forEach((h) => {
|
|
403
|
+
const f = h.split(p), g = f[0], _ = f[1], S = f[2];
|
|
404
|
+
this[g] || (this[g] = {}), this[g][_] || (this[g][_] = {}), this[g][_][S] = () => {
|
|
405
|
+
};
|
|
406
|
+
}), R(
|
|
407
|
+
this.ui.callbacks,
|
|
408
|
+
"onUseFullPage",
|
|
409
|
+
this._onUseFullPage
|
|
410
|
+
), R(
|
|
411
|
+
this.ui.callbacks,
|
|
412
|
+
"onBackToWebsite",
|
|
413
|
+
this._onBackToWebsite
|
|
414
|
+
), this._waitForIframe(this), setTimeout(
|
|
415
|
+
() => this._messageHandler.sendMessage(E.WEBSITE_READY),
|
|
416
|
+
0
|
|
417
|
+
), Promise.resolve({ result: null });
|
|
418
|
+
}
|
|
419
|
+
const o = e.split(p), n = o[0], i = o[1], a = o.length === 3 ? o[2] : null;
|
|
420
|
+
if (a && this[n][i][a]) {
|
|
421
|
+
const d = this[n][i][a](
|
|
422
|
+
...s
|
|
423
|
+
);
|
|
424
|
+
return d instanceof Promise ? d.then((m) => ({ result: m })) : d !== void 0 ? Promise.resolve({ result: d }) : Promise.resolve({ result: null });
|
|
425
|
+
}
|
|
426
|
+
return Promise.reject('Message "' + e + '" is unkown');
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
export {
|
|
430
|
+
K as default
|
|
431
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var R=Object.defineProperty,A=(s,e,t)=>e in s?R(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,u=(s,e,t)=>A(s,typeof e!="symbol"?e+"":e,t);class S{constructor(e,t,r,i){u(this,"_side"),u(this,"_incomingMessageBus"),u(this,"_outgoingMessageBus",null),u(this,"_execMessage",null),this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=r,this._execMessage=i,this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((r,i)=>{const o=new MessageChannel;o.port1.onmessage=n=>{if(!n||!n.data)return o.port1.close(),o.port2.close(),i(new Error(this._side+" received message but response can not be interpreted"));let c;try{c=JSON.parse(n.data)}catch(h){return o.port1.close(),o.port2.close(),this._prepareError(h),i(h)}c.error?i(c.error):c.result!==void 0?r(c.result):r(void 0),o.port1.close(),o.port2.close()};let a="";try{a=JSON.stringify({message:e,args:t})}catch{return i(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return i(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(a,"*",[o.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const r=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const i=this._execMessage(r,e);if(i===void 0)return;i.then((o={})=>{let a,n;typeof o=="object"&&o!==null&&(a=o.error,n=o.result),a?t.postMessage(JSON.stringify({error:a})):n!==void 0?t.postMessage(JSON.stringify({result:n})):t.postMessage(JSON.stringify({result:o}))},o=>{t.postMessage(JSON.stringify({error:this._prepareError(o)}))})}catch(r){t.postMessage(JSON.stringify({error:this._prepareError(r)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const p=".",w={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},F=async(s,e)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",r=e.overrideTenant||9,i=t+"/configurators/"+s,o="roomle_portal_v2",a="03-"+window.btoa(new Date().toISOString()+";anonymous;"+o),n=()=>{const g={apiKey:o,currentTenant:r,locale:"en",language:"en",device:1,token:a,platform:"web"};return new Headers(g)},c=new Request(i,{method:"GET",headers:n(),mode:"cors",cache:"default"}),h=await fetch(c),{configurator:f}=await h.json();return f},P=()=>{try{return window.self!==window.top}catch{return!0}},H=["127.0.0.1","localhost","0.0.0.0"],U=()=>{const s=P();let e=window.location.href;if(s){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},B=s=>!!(H.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),I=["language","browserLanguage","userLanguage","systemLanguage"],k=(s=null)=>{const e=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=I.length;t<r;t++){const i=e[I[t]];if(i)return i.substr(0,2)}return"en"},x=(s,e)=>{const t=JSON.parse(JSON.stringify(s));return b(t,e)},b=(s,e)=>{for(const t in e)try{e[t].constructor===Object?s[t]=b(s[t],e[t]):s[t]=e[t]}catch{s[t]=e[t]}return s},W={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0}},C="(idle)",J=s=>(y(s),s!=null&&s.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(j,V)),s),y=s=>{if(!s)return;const e=Object.keys(s);for(const t of e){const r=s[t];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&y(r),Array.isArray(r))for(const i of r)y(i);(r==="true"||r==="false")&&(s[t]=r==="true")}},$=(s,e)=>{e.configuratorId=s.id;const t=s.settings||{};return!e.overrideTenant&&s.tenant&&(e.overrideTenant=s.tenant),x(t,e)},z=()=>{const s={...W};s.locale||(s.locale=k()),s.id===C&&delete s.id;const e=U();return e&&B(e)&&(s.configuratorId="demoConfigurator"),s.customApiUrl="https://www.roomle.com/api/v2",s.emails=!1,s},j="<CONF_ID>",V="#CONFIGURATIONID#",v=()=>/(android)/i.test(navigator.userAgent),T=(s,e,t)=>{let r=null;Object.defineProperty(s,e,{get(){return r||t},set(i){i!=null&&i.mute?r=i.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),r=i)}})},N=()=>window.innerHeight*.01+"px",M=s=>{s&&setTimeout(()=>s.style.setProperty(O,N()),0)},D="rml-styles",G=450,O="--rml-full-height",l={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},E=new Map;class q{constructor(e,t,r,i){if(u(this,"ui",{callbacks:null}),u(this,"extended",{callbacks:null}),u(this,"analytics",{callbacks:{}}),u(this,"global",{callbacks:{}}),u(this,"_waitForIframe"),u(this,"_container"),u(this,"_messageHandler"),u(this,"_configuratorSettings"),u(this,"_initData",{}),u(this,"_iframe"),!e||typeof e.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(E.has(t))throw new Error("There is already an instance on this DOM element");if(!document.getElementById(D)){const a=r.zIndex||9999999,n=document.createElement("style");n.type="text/css",n.id=D;const c="transition:all ease-in-out "+G+"ms;",h=["-webkit-","-o-"].reduce((g,m)=>g+=m+c,"")+c,f=N();n.innerHTML=`
|
|
2
|
+
.${l.CONTAINER}{${O}:${f};}
|
|
3
|
+
.${l.POSITION}{position:fixed;top:0;left:0;z-index:${a};opacity:0}
|
|
4
|
+
.${l.TRANSITION}{${h}}
|
|
5
|
+
.${l.FILL}{width:100%;height:100%;opacity:1}
|
|
6
|
+
.${l.ANDROID_HEIGHT}{height:calc(var(${O},1vh)*100)}
|
|
7
|
+
.${l.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
8
|
+
`,document.head.appendChild(n)}this._onResize=this._onResize.bind(this),v()&&window.addEventListener("resize",this._onResize),this._container=t,this._initData=r,this._configuratorSettings=e;const o=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._executeMessage=this._executeMessage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._messageHandler=new S("website",window,null,this._executeMessage),this._waitForIframe=i,this._container.appendChild(o),this._iframe=o,E.set(t,!0)}static createPlanner(e,t,r){return this._create(e,t,r)}static createConfigurator(e,t,r){return this._create(e,t,r)}static create(e,t,r){return this._create(e,t,r)}static createViewer(e,t,r){return this._create(e,t,r)}static _create(e,t,r){return new Promise(async(i,o)=>{try{const a=b(z(),J(r));a.featureFlags||(a.featureFlags={}),typeof a.featureFlags.realPartList!="boolean"&&(a.featureFlags.realPartList=!0),typeof a.featureFlags.globalCallbacks!="boolean"&&(a.featureFlags.globalCallbacks=!0),typeof a.featureFlags.mocAr!="boolean"&&(a.featureFlags.mocAr=!1);const n=await F(e,a);return r=$(n,a),new this(n,t,r,i)}catch(a){return o(a)}})}teardown(){this._container&&E.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){var e;const t=document.createElement("iframe");let r=((e=this._configuratorSettings)==null?void 0:e.url)||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(r=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(r=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(r=this._initData.overrideServerUrl),t.src=r,t.classList.add(l.CONTAINER),t.classList.add(l.FILL),t}_onResize(){M(this._iframe)}_onUseFullPage(){this._iframe.classList.add(l.POSITION),document.documentElement.classList.add(l.OVERFLOW_HIDDEN),window.document.body.classList.add(l.OVERFLOW_HIDDEN),v()&&(M(this._iframe),this._iframe.classList.add(l.ANDROID_HEIGHT))}_onBackToWebsite(){this._iframe.classList.remove(l.POSITION),this._iframe.classList.remove(l.ANDROID_HEIGHT),document.documentElement.classList.remove(l.OVERFLOW_HIDDEN),window.document.body.classList.remove(l.OVERFLOW_HIDDEN)}_executeMessage({message:e,args:t},r){var i;if(!r.source||r.source!==((i=this._iframe)==null?void 0:i.contentWindow))return;if(e===w.REQUEST_BOOT)return this._messageHandler.setOutgoingMessageBus(r.source),Promise.resolve({result:this._initData});if(e===w.SETUP){const{methods:h,callbacks:f}=t[0];return h.forEach(g=>{const m=g.split(p),d=m[0],_=m[1];this[d]||(this[d]={}),this[d][_]=function(){return this._messageHandler.sendMessage(g,[...arguments])}.bind(this)}),f.forEach(g=>{const m=g.split(p),d=m[0],_=m[1],L=m[2];this[d]||(this[d]={}),this[d][_]||(this[d][_]={}),this[d][_][L]=()=>{}}),T(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),T(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>this._messageHandler.sendMessage(w.WEBSITE_READY),0),Promise.resolve({result:null})}const o=e.split(p),a=o[0],n=o[1],c=o.length===3?o[2]:null;if(c&&this[a][n][c]){const h=this[a][n][c](...t);return h instanceof Promise?h.then(f=>({result:f})):h!==void 0?Promise.resolve({result:h}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}}export{q as default};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
(function(l,u){typeof exports=="object"&&typeof module<"u"?module.exports=u():typeof define=="function"&&define.amd?define(u):(l=typeof globalThis<"u"?globalThis:l||self,l["roomle-embedding-lib"]=l["roomle-embedding-lib"]||{},l["roomle-embedding-lib"].umd=l["roomle-embedding-lib"].umd||{},l["roomle-embedding-lib"].umd.js=u())})(this,function(){"use strict";var Y=Object.defineProperty;var q=(l,u,m)=>u in l?Y(l,u,{enumerable:!0,configurable:!0,writable:!0,value:m}):l[u]=m;var f=(l,u,m)=>q(l,typeof u!="symbol"?u+"":u,m);class l{constructor(e,t,r,o){f(this,"_side");f(this,"_incomingMessageBus");f(this,"_outgoingMessageBus",null);f(this,"_execMessage",null);this._side=e,this._incomingMessageBus=t,this._outgoingMessageBus=r,this._execMessage=o,this._incomingMessageBus.addEventListener("message",this._handleMessage.bind(this))}setOutgoingMessageBus(e){this._outgoingMessageBus=e}setMessageExecution(e){this._execMessage=e}sendMessage(e,t=[]){return new Promise((r,o)=>{const n=new MessageChannel;n.port1.onmessage=a=>{if(!a||!a.data)return n.port1.close(),n.port2.close(),o(new Error(this._side+" received message but response can not be interpreted"));let d;try{d=JSON.parse(a.data)}catch(g){return n.port1.close(),n.port2.close(),this._prepareError(g),o(g)}d.error?o(d.error):d.result!==void 0?r(d.result):r(void 0),n.port1.close(),n.port2.close()};let i="";try{i=JSON.stringify({message:e,args:t})}catch{return o(new Error(this._side+": can not create command because it is not JSON.stringify able"))}if(!this._outgoingMessageBus)return o(new Error(this._side+": outgoing bus not set yet"));this._outgoingMessageBus.postMessage(i,"*",[n.port2])})}_handleMessage(e){const t=e.ports&&Array.isArray(e.ports)&&e.ports.length>0?e.ports[0]:null;if(e.data&&t)try{const r=JSON.parse(e.data);if(!this._execMessage)return t.postMessage(JSON.stringify({error:this._side+" is not ready to handle messages"}));Array.isArray(r.args)||(r.args=[r.args]);const o=this._execMessage(r,e);if(o===void 0)return;o.then((n={})=>{let i,a;typeof n=="object"&&n!==null&&(i=n.error,a=n.result),i?t.postMessage(JSON.stringify({error:i})):a!==void 0?t.postMessage(JSON.stringify({result:a})):t.postMessage(JSON.stringify({result:n}))},n=>{t.postMessage(JSON.stringify({error:this._prepareError(n)}))})}catch(r){t.postMessage(JSON.stringify({error:this._prepareError(r)}))}}_prepareError(e){if(typeof e=="string"){const t=this._side+": "+e;return console.error(t),t}return e.message=this._side+": "+e.message,console.error(e),e.message}}const u=".",m={REQUEST_BOOT:"requestBoot",SETUP:"setup",WEBSITE_READY:"websiteReady"},M=async(s,e)=>{if(typeof s!="string")throw new Error('Configurator ID is not a string type: "'+typeof s+'"');const t=e.customApiUrl?e.customApiUrl:"https://api.roomle.com/v2",r=e.overrideTenant||9,o=t+"/configurators/"+s,n="roomle_portal_v2",i="03-"+window.btoa(new Date().toISOString()+";anonymous;"+n),a=()=>{const _={apiKey:n,currentTenant:r,locale:"en",language:"en",device:1,token:i,platform:"web"};return new Headers(_)},d=new Request(o,{method:"GET",headers:a(),mode:"cors",cache:"default"}),g=await fetch(d),{configurator:E}=await g.json();return E},v=()=>{try{return window.self!==window.top}catch{return!0}},P=["127.0.0.1","localhost","0.0.0.0"],H=()=>{const s=v();let e=window.location.href;if(s){if(!document.referrer)return null;e=document.referrer}const{hostname:t}=new URL(e);return t},F=s=>!!(P.includes(s)||s.endsWith("roomle.com")||s.endsWith("gitlab.io")||s.endsWith("gitlab.com")),b=["language","browserLanguage","userLanguage","systemLanguage"],D=(s=null)=>{const e=window.navigator;if(s)return s.substr(0,2);if(Array.isArray(e.languages)&&e.languages.length>0)return e.languages[0].substr(0,2);for(let t=0,r=b.length;t<r;t++){const o=e[b[t]];if(o)return o.substr(0,2)}return"en"},C=(s,e)=>{const t=JSON.parse(JSON.stringify(s));return y(t,e)},y=(s,e)=>{for(const t in e)try{e[t].constructor===Object?s[t]=y(s[t],e[t]):s[t]=e[t]}catch{s[t]=e[t]}return s},B={mobileLandscape:!0,floorMaterialRootTag:"materials_root",buttons:{renderimage:!0,requestproduct:!0,requestplan:!0,load_product:!0,partlist_print:!0},helpcenter:{roomdesigner:!0,configurator:!1,disable:!1},firstPersonView:!0,saveToIdb:!0,featureFlags:{mocAr:!0}},k="(idle)",U=s=>(O(s),s!=null&&s.customApiUrl&&(s.customApiUrl=decodeURIComponent(s.customApiUrl)),s.shareUrl&&(s.deeplink=s.shareUrl.replace(G,J)),s),O=s=>{if(!s)return;const e=Object.keys(s);for(const t of e){const r=s[t];if(!Array.isArray(r)&&typeof r=="object"&&r!==null&&O(r),Array.isArray(r))for(const o of r)O(o);(r==="true"||r==="false")&&(s[t]=r==="true")}},x=(s,e)=>{e.configuratorId=s.id;const t=s.settings||{};return!e.overrideTenant&&s.tenant&&(e.overrideTenant=s.tenant),C(t,e)},W=()=>{const s={...B};s.locale||(s.locale=D()),s.id===k&&delete s.id;const e=H();return e&&F(e)&&(s.configuratorId="demoConfigurator"),s.customApiUrl="https://www.roomle.com/api/v2",s.emails=!1,s},G="<CONF_ID>",J="#CONFIGURATIONID#",T=()=>/(android)/i.test(navigator.userAgent),R=(s,e,t)=>{let r=null;Object.defineProperty(s,e,{get(){return r||t},set(o){o!=null&&o.mute?r=o.value:(console.warn("You override Roomle defined behaviour. To disalbe this warning pass in an object with the following properties"),console.warn("{ mute: true, value: () => void }"),r=o)}})},L=()=>window.innerHeight*.01+"px",N=s=>{s&&setTimeout(()=>s.style.setProperty(A,L()),0)},S="rml-styles",$=450,A="--rml-full-height",c={CONTAINER:"rml-container",FILL:"rml-fill",POSITION:"rml-pos",TRANSITION:"rml-transition",ANDROID_HEIGHT:"rml-android-height",OVERFLOW_HIDDEN:"rml-overflow-hidden"},I=new Map;class z{constructor(e,t,r,o){f(this,"ui",{callbacks:null});f(this,"extended",{callbacks:null});f(this,"analytics",{callbacks:{}});f(this,"global",{callbacks:{}});f(this,"_waitForIframe");f(this,"_container");f(this,"_messageHandler");f(this,"_configuratorSettings");f(this,"_initData",{});f(this,"_iframe");if(!e||typeof e.id!="string")throw new Error("Please provide a correct configuratorId, you get the correct ID from your Roomle Contact Person");if(I.has(t))throw new Error("There is already an instance on this DOM element");if(!!!document.getElementById(S)){const a=r.zIndex||9999999,d=document.createElement("style");d.type="text/css",d.id=S;const g="transition:all ease-in-out "+$+"ms;",E=["-webkit-","-o-"].reduce((p,h)=>p+=h+g,"")+g,_=L();d.innerHTML=`
|
|
2
|
+
.${c.CONTAINER}{${A}:${_};}
|
|
3
|
+
.${c.POSITION}{position:fixed;top:0;left:0;z-index:${a};opacity:0}
|
|
4
|
+
.${c.TRANSITION}{${E}}
|
|
5
|
+
.${c.FILL}{width:100%;height:100%;opacity:1}
|
|
6
|
+
.${c.ANDROID_HEIGHT}{height:calc(var(${A},1vh)*100)}
|
|
7
|
+
.${c.OVERFLOW_HIDDEN}{overflow:hidden}
|
|
8
|
+
`,document.head.appendChild(d)}this._onResize=this._onResize.bind(this),T()&&window.addEventListener("resize",this._onResize),this._container=t,this._initData=r,this._configuratorSettings=e;const i=this._createIframe();this._onUseFullPage=this._onUseFullPage.bind(this),this._executeMessage=this._executeMessage.bind(this),this._onBackToWebsite=this._onBackToWebsite.bind(this),this._messageHandler=new l("website",window,null,this._executeMessage),this._waitForIframe=o,this._container.appendChild(i),this._iframe=i,I.set(t,!0)}static createPlanner(e,t,r){return this._create(e,t,r)}static createConfigurator(e,t,r){return this._create(e,t,r)}static create(e,t,r){return this._create(e,t,r)}static createViewer(e,t,r){return this._create(e,t,r)}static _create(e,t,r){return new Promise(async(o,n)=>{try{const i=y(W(),U(r));i.featureFlags||(i.featureFlags={}),typeof i.featureFlags.realPartList!="boolean"&&(i.featureFlags.realPartList=!0),typeof i.featureFlags.globalCallbacks!="boolean"&&(i.featureFlags.globalCallbacks=!0),typeof i.featureFlags.mocAr!="boolean"&&(i.featureFlags.mocAr=!1);const a=await M(e,i);return r=x(a,i),new this(a,t,r,o)}catch(i){return n(i)}})}teardown(){this._container&&I.delete(this._container);const e=this._container.querySelector("iframe");e&&this._container.removeChild(e),window.removeEventListener("resize",this._onResize)}_createIframe(){var r;const e=document.createElement("iframe");let t=((r=this._configuratorSettings)==null?void 0:r.url)||"https://www.roomle.com/t/cp/";return this._initData.useLocalRoomle&&(t=location.href.replace("embedding.html","")),location.href.includes("roomle.gitlab.io")&&(t=location.href.replace("embedding.html","index.html")),this._initData.overrideServerUrl&&(t=this._initData.overrideServerUrl),e.src=t,e.classList.add(c.CONTAINER),e.classList.add(c.FILL),e}_onResize(){N(this._iframe)}_onUseFullPage(){this._iframe.classList.add(c.POSITION),document.documentElement.classList.add(c.OVERFLOW_HIDDEN),window.document.body.classList.add(c.OVERFLOW_HIDDEN),T()&&(N(this._iframe),this._iframe.classList.add(c.ANDROID_HEIGHT))}_onBackToWebsite(){this._iframe.classList.remove(c.POSITION),this._iframe.classList.remove(c.ANDROID_HEIGHT),document.documentElement.classList.remove(c.OVERFLOW_HIDDEN),window.document.body.classList.remove(c.OVERFLOW_HIDDEN)}_executeMessage({message:e,args:t},r){var d;if(!r.source||r.source!==((d=this._iframe)==null?void 0:d.contentWindow))return;if(e===m.REQUEST_BOOT)return this._messageHandler.setOutgoingMessageBus(r.source),Promise.resolve({result:this._initData});if(e===m.SETUP){const{methods:g,callbacks:E}=t[0];return g.forEach(_=>{const p=_.split(u),h=p[0],w=p[1];this[h]||(this[h]={}),this[h][w]=(function(){return this._messageHandler.sendMessage(_,[...arguments])}).bind(this)}),E.forEach(_=>{const p=_.split(u),h=p[0],w=p[1],V=p[2];this[h]||(this[h]={}),this[h][w]||(this[h][w]={}),this[h][w][V]=()=>{}}),R(this.ui.callbacks,"onUseFullPage",this._onUseFullPage),R(this.ui.callbacks,"onBackToWebsite",this._onBackToWebsite),this._waitForIframe(this),setTimeout(()=>this._messageHandler.sendMessage(m.WEBSITE_READY),0),Promise.resolve({result:null})}const o=e.split(u),n=o[0],i=o[1],a=o.length===3?o[2]:null;if(a&&this[n][i][a]){const g=this[n][i][a](...t);return g instanceof Promise?g.then(E=>({result:E})):g!==void 0?Promise.resolve({result:g}):Promise.resolve({result:null})}return Promise.reject('Message "'+e+'" is unkown')}}return z});
|