@veloceapps/sdk 7.0.0-8 → 7.0.1-0
Sign up to get free protection for your applications and to get access to all the features.
- package/cms/README.md +45 -0
- package/cms/cms.actions.d.ts +10 -0
- package/cms/components/element-children/element-children.component.d.ts +1 -1
- package/cms/components/element-drop-handle/element-drop-handle.component.d.ts +1 -1
- package/cms/components/element-renderer/element-renderer.component.d.ts +1 -1
- package/cms/components/plugin.component.d.ts +2 -2
- package/cms/components/preview/preview.component.d.ts +4 -3
- package/cms/directives/custom-template.directive.d.ts +1 -1
- package/cms/modules/federated/federated-host.directive.d.ts +8 -0
- package/cms/modules/federated/federated.component.d.ts +5 -7
- package/cms/modules/federated/federated.module.d.ts +4 -3
- package/cms/modules/federated/federated.types.d.ts +1 -5
- package/cms/modules/migrations/types/migrations.types.d.ts +1 -1
- package/cms/plugins/configuration.plugin.d.ts +1 -1
- package/cms/plugins/io.plugin.d.ts +1 -1
- package/cms/plugins/region.plugin.d.ts +1 -1
- package/cms/plugins/script.plugin.d.ts +1 -1
- package/cms/services/templates.service.d.ts +1 -1
- package/cms/types/common.types.d.ts +2 -2
- package/cms/types/elements.types.d.ts +1 -1
- package/cms/types/integration.types.d.ts +1 -1
- package/cms/types/layouts.types.d.ts +1 -1
- package/cms/utils/element.utils.d.ts +2 -2
- package/cms/vendor-map.d.ts +2 -1
- package/core/README.md +5 -0
- package/core/modules/flow-configuration/types/update.types.d.ts +2 -2
- package/core/services/metric-calculation/metric-calculation.types.d.ts +1 -1
- package/core/types/ui-definition.types.d.ts +2 -2
- package/esm2020/cms/cms.actions.mjs +56 -0
- package/esm2020/cms/components/element-children/element-children.component.mjs +35 -0
- package/esm2020/cms/components/element-children/element-children.module.mjs +20 -0
- package/esm2020/cms/components/element-drop-handle/element-drop-handle.component.mjs +28 -0
- package/esm2020/cms/components/element-drop-handle/element-drop-handle.module.mjs +19 -0
- package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +160 -0
- package/{esm2015/cms/components/element-renderer/element-renderer.module.js → esm2020/cms/components/element-renderer/element-renderer.module.mjs} +5 -5
- package/esm2020/cms/components/element.component.mjs +45 -0
- package/esm2020/cms/components/plugin.component.mjs +17 -0
- package/esm2020/cms/components/preview/preview.component.mjs +103 -0
- package/esm2020/cms/components/preview/preview.module.mjs +24 -0
- package/esm2020/cms/directives/custom-template.directive.mjs +26 -0
- package/esm2020/cms/engine/models/entity.mjs +17 -0
- package/esm2020/cms/launcher.module.mjs +24 -0
- package/esm2020/cms/modules/federated/federated-host.directive.mjs +16 -0
- package/esm2020/cms/modules/federated/federated.component.mjs +64 -0
- package/esm2020/cms/modules/federated/federated.module.mjs +20 -0
- package/esm2020/cms/modules/federated/federated.types.mjs +2 -0
- package/esm2020/cms/modules/migrations/migrations.mjs +15 -0
- package/{esm2015/cms/modules/migrations/migrations.module.js → esm2020/cms/modules/migrations/migrations.module.mjs} +5 -5
- package/esm2020/cms/modules/migrations/services/migrations.service.mjs +43 -0
- package/{esm2015/cms/modules/runtime/runtime.module.js → esm2020/cms/modules/runtime/runtime.module.mjs} +6 -6
- package/esm2020/cms/modules/runtime/services/compilation.service.mjs +83 -0
- package/esm2020/cms/modules/runtime/services/runtime-editor.service.mjs +28 -0
- package/esm2020/cms/modules/runtime/services/runtime.service.mjs +74 -0
- package/esm2020/cms/plugins/configuration.plugin.mjs +105 -0
- package/esm2020/cms/plugins/io.plugin.mjs +36 -0
- package/esm2020/cms/plugins/region.plugin.mjs +58 -0
- package/esm2020/cms/plugins/script.plugin.mjs +65 -0
- package/{esm2015/cms/services/element-context.service.js → esm2020/cms/services/element-context.service.mjs} +4 -4
- package/esm2020/cms/services/integration.state.mjs +40 -0
- package/esm2020/cms/services/io-provider.service.mjs +50 -0
- package/esm2020/cms/services/resources.service.mjs +49 -0
- package/{esm2015/cms/services/templates.service.js → esm2020/cms/services/templates.service.mjs} +4 -4
- package/esm2020/cms/utils/element.utils.mjs +160 -0
- package/esm2020/cms/utils/elements-resolver.mjs +189 -0
- package/esm2020/cms/utils/path.utils.mjs +53 -0
- package/esm2020/cms/utils/ui-definition.utils.mjs +87 -0
- package/esm2020/cms/vendor-map.mjs +67 -0
- package/esm2020/core/core.module.mjs +18 -0
- package/{esm2015/core/modules/configuration/configuration.module.js → esm2020/core/modules/configuration/configuration.module.mjs} +6 -6
- package/esm2020/core/modules/configuration/helpers.mjs +18 -0
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +106 -0
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +183 -0
- package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +50 -0
- package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +18 -0
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +150 -0
- package/esm2020/core/modules/flow-configuration/services/flow-update.service.mjs +129 -0
- package/esm2020/core/services/context.service.mjs +64 -0
- package/esm2020/core/services/metric-calculation/metric-calculation.service.mjs +85 -0
- package/esm2020/core/services/product-images.service.mjs +31 -0
- package/esm2020/core/services/quote-draft.service.mjs +232 -0
- package/esm2020/core/utils/line-item.utils.mjs +161 -0
- package/esm2020/core/utils/line-item.worker.mjs +19 -0
- package/esm2020/runtime/components/component-preview/component-preview.component.mjs +125 -0
- package/esm2020/runtime/components/section-renderer/section-renderer.component.mjs +67 -0
- package/esm2020/runtime/components/ui-runtime/runtime.component.mjs +440 -0
- package/esm2020/runtime/components/ui-runtime-preview/runtime-preview.component.mjs +108 -0
- package/esm2020/runtime/execution/components/children-placeholder/children-placeholder.component.mjs +60 -0
- package/esm2020/runtime/execution/components/context-provider/context-provider.component.mjs +39 -0
- package/esm2020/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.mjs +67 -0
- package/esm2020/runtime/execution/components/federated/federated.component.mjs +74 -0
- package/esm2020/runtime/execution/components/velo-attribute/velo-attribute.component.mjs +60 -0
- package/esm2020/runtime/execution/components/velo-multiselect/velo-multiselect.component.mjs +130 -0
- package/esm2020/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.mjs +72 -0
- package/esm2020/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.mjs +97 -0
- package/esm2020/runtime/execution/components/velo-port-radio/velo-port-radio.component.mjs +142 -0
- package/esm2020/runtime/execution/components/velo-type/velo-type.component.mjs +119 -0
- package/esm2020/runtime/execution/directives/section-script.directive.mjs +247 -0
- package/esm2020/runtime/execution/directives/sf-query.directive.mjs +35 -0
- package/esm2020/runtime/execution/directives/velo-attribute.directive.mjs +88 -0
- package/esm2020/runtime/execution/directives/velo-port.directive.mjs +376 -0
- package/esm2020/runtime/execution/directives/vl-approval.directive.mjs +23 -0
- package/esm2020/runtime/execution/directives/vl-document-attachments.directive.mjs +36 -0
- package/esm2020/runtime/execution/directives/vl-document-templates.directive.mjs +60 -0
- package/esm2020/runtime/execution/directives/vl-quote.directive.mjs +42 -0
- package/esm2020/runtime/execution/directives/vl-ramp.directive.mjs +55 -0
- package/esm2020/runtime/execution/runtime-execution.module.mjs +133 -0
- package/esm2020/runtime/execution/utils/federated.util.mjs +32 -0
- package/esm2020/runtime/runtime.module.mjs +74 -0
- package/esm2020/runtime/services/cart.service.mjs +29 -0
- package/{esm2015/runtime/services/collapsible-state.service.js → esm2020/runtime/services/collapsible-state.service.mjs} +4 -4
- package/esm2020/runtime/services/configuration.service.mjs +119 -0
- package/{esm2015/runtime/services/current-state.service.js → esm2020/runtime/services/current-state.service.mjs} +4 -4
- package/{esm2015/runtime/services/form-scope.service.js → esm2020/runtime/services/form-scope.service.mjs} +4 -4
- package/esm2020/runtime/services/product-model-cache.service.mjs +31 -0
- package/esm2020/runtime/services/runtime-context.service.mjs +57 -0
- package/esm2020/runtime/services/runtime-form.service.mjs +219 -0
- package/esm2020/runtime/services/runtime.service.mjs +115 -0
- package/{esm2015/runtime/services/section-helper.service.js → esm2020/runtime/services/section-helper.service.mjs} +4 -4
- package/{esm2015/runtime/services/section-scope.service.js → esm2020/runtime/services/section-scope.service.mjs} +4 -4
- package/{esm2015/runtime/services/section-store.service.js → esm2020/runtime/services/section-store.service.mjs} +4 -4
- package/esm2020/runtime/services/section.service.mjs +117 -0
- package/esm2020/runtime/types/script-registry.types.mjs +51 -0
- package/esm2020/runtime/utils/line-item.util.mjs +270 -0
- package/esm2020/src/components/dialog/dialog.component.mjs +36 -0
- package/esm2020/src/components/dialog/dialog.module.mjs +19 -0
- package/esm2020/src/components/doc-gen/doc-gen.component.mjs +107 -0
- package/esm2020/src/components/doc-gen/doc-gen.module.mjs +19 -0
- package/esm2020/src/components/header/cart-overlay/cart-preview.component.mjs +120 -0
- package/{esm2015/src/components/header/cart-overlay/cart-preview.module.js → esm2020/src/components/header/cart-overlay/cart-preview.module.mjs} +11 -13
- package/esm2020/src/components/header/header.component.mjs +333 -0
- package/{esm2015/src/components/header/header.module.js → esm2020/src/components/header/header.module.mjs} +12 -14
- package/esm2020/src/components/header/metrics/metrics.component.mjs +227 -0
- package/{esm2015/src/components/header/metrics/metrics.module.js → esm2020/src/components/header/metrics/metrics.module.mjs} +17 -19
- package/{esm2015/src/flow-routing.module.js → esm2020/src/flow-routing.module.mjs} +12 -14
- package/esm2020/src/flow.component.mjs +45 -0
- package/esm2020/src/flow.module.mjs +58 -0
- package/esm2020/src/guards/context.guard.mjs +93 -0
- package/esm2020/src/guards/product-unload.guard.mjs +46 -0
- package/esm2020/src/guards/root.guard.mjs +42 -0
- package/esm2020/src/pages/assets/assets.component.mjs +111 -0
- package/esm2020/src/pages/assets/assets.module.mjs +20 -0
- package/esm2020/src/pages/catalog/catalog.component.mjs +111 -0
- package/esm2020/src/pages/catalog/catalog.module.mjs +20 -0
- package/esm2020/src/pages/debug/debug.component.mjs +62 -0
- package/{esm2015/src/pages/debug/debug.module.js → esm2020/src/pages/debug/debug.module.mjs} +12 -14
- package/esm2020/src/pages/empty-account/empty-account.component.mjs +12 -0
- package/esm2020/src/pages/empty-account/empty-account.module.mjs +20 -0
- package/esm2020/src/pages/legacy-product/legacy-product.component.mjs +137 -0
- package/esm2020/src/pages/legacy-product/legacy-product.module.mjs +19 -0
- package/esm2020/src/pages/product/product.component.mjs +94 -0
- package/esm2020/src/pages/product/product.module.mjs +20 -0
- package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +25 -0
- package/esm2020/src/pages/record-not-found/record-not-found.module.mjs +20 -0
- package/esm2020/src/pages/remote/remote.component.mjs +342 -0
- package/esm2020/src/pages/remote/remote.module.mjs +20 -0
- package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +111 -0
- package/esm2020/src/pages/shopping-cart/shopping-cart.module.mjs +20 -0
- package/esm2020/src/resolvers/flow.resolver.mjs +70 -0
- package/esm2020/src/resolvers/quote.resolver.mjs +90 -0
- package/esm2020/src/services/doc-gen.service.mjs +33 -0
- package/esm2020/src/services/flow-dialog.service.mjs +126 -0
- package/esm2020/src/services/flow-router.service.mjs +144 -0
- package/esm2020/src/services/flow.service.mjs +86 -0
- package/esm2020/src/utils/flow.utils.mjs +21 -0
- package/fesm2015/{veloceapps-sdk-cms.js → veloceapps-sdk-cms.mjs} +178 -207
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -0
- package/fesm2015/{veloceapps-sdk-core.js → veloceapps-sdk-core.mjs} +76 -76
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -0
- package/fesm2015/{veloceapps-sdk-runtime.js → veloceapps-sdk-runtime.mjs} +242 -370
- package/fesm2015/veloceapps-sdk-runtime.mjs.map +1 -0
- package/fesm2015/veloceapps-sdk.mjs +2877 -0
- package/fesm2015/veloceapps-sdk.mjs.map +1 -0
- package/fesm2020/veloceapps-sdk-cms.mjs +2036 -0
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -0
- package/fesm2020/veloceapps-sdk-core.mjs +1289 -0
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -0
- package/fesm2020/veloceapps-sdk-runtime.mjs +3764 -0
- package/fesm2020/veloceapps-sdk-runtime.mjs.map +1 -0
- package/fesm2020/veloceapps-sdk.mjs +2857 -0
- package/fesm2020/veloceapps-sdk.mjs.map +1 -0
- package/package.json +59 -33
- package/runtime/README.md +5 -0
- package/runtime/components/component-preview/component-preview.component.d.ts +2 -2
- package/runtime/components/section-renderer/section-renderer.component.d.ts +1 -1
- package/runtime/components/ui-runtime/runtime.component.d.ts +1 -1
- package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +1 -1
- package/runtime/execution/components/children-placeholder/children-placeholder.component.d.ts +2 -2
- package/runtime/execution/components/context-provider/context-provider.component.d.ts +1 -1
- package/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.d.ts +1 -1
- package/runtime/execution/components/federated/federated.component.d.ts +1 -1
- package/runtime/execution/components/velo-attribute/velo-attribute.component.d.ts +1 -1
- package/runtime/execution/components/velo-multiselect/velo-multiselect.component.d.ts +1 -1
- package/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.d.ts +1 -1
- package/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.d.ts +1 -1
- package/runtime/execution/components/velo-port-radio/velo-port-radio.component.d.ts +1 -1
- package/runtime/execution/components/velo-type/velo-type.component.d.ts +1 -1
- package/runtime/execution/directives/section-script.directive.d.ts +1 -1
- package/runtime/execution/directives/sf-query.directive.d.ts +1 -1
- package/runtime/execution/directives/velo-attribute.directive.d.ts +1 -1
- package/runtime/execution/directives/velo-port.directive.d.ts +6 -6
- package/runtime/execution/directives/vl-approval.directive.d.ts +1 -1
- package/runtime/execution/directives/vl-document-attachments.directive.d.ts +1 -1
- package/runtime/execution/directives/vl-document-templates.directive.d.ts +1 -1
- package/runtime/execution/directives/vl-quote.directive.d.ts +1 -1
- package/runtime/execution/directives/vl-ramp.directive.d.ts +1 -1
- package/runtime/execution/runtime-execution.module.d.ts +3 -5
- package/runtime/execution/utils/federated.util.d.ts +1 -1
- package/runtime/runtime.module.d.ts +3 -5
- package/runtime/services/section.service.d.ts +1 -1
- package/src/components/dialog/dialog.component.d.ts +1 -1
- package/src/components/doc-gen/doc-gen.component.d.ts +1 -1
- package/src/components/header/cart-overlay/cart-preview.component.d.ts +2 -2
- package/src/components/header/header.component.d.ts +1 -1
- package/src/components/header/metrics/metrics.component.d.ts +1 -1
- package/src/flow.component.d.ts +1 -1
- package/src/pages/assets/assets.component.d.ts +1 -1
- package/src/pages/catalog/catalog.component.d.ts +1 -1
- package/src/pages/debug/debug.component.d.ts +5 -3
- package/src/pages/empty-account/empty-account.component.d.ts +1 -1
- package/src/pages/legacy-product/legacy-product.component.d.ts +1 -1
- package/src/pages/legacy-product/legacy-product.module.d.ts +1 -2
- package/src/pages/product/product.component.d.ts +1 -1
- package/src/pages/record-not-found/record-not-found.component.d.ts +1 -1
- package/src/pages/remote/remote.component.d.ts +1 -1
- package/src/pages/shopping-cart/shopping-cart.component.d.ts +1 -1
- package/bundles/veloceapps-sdk-cms.umd.js +0 -2531
- package/bundles/veloceapps-sdk-cms.umd.js.map +0 -1
- package/bundles/veloceapps-sdk-core.umd.js +0 -1916
- package/bundles/veloceapps-sdk-core.umd.js.map +0 -1
- package/bundles/veloceapps-sdk-runtime.umd.js +0 -4415
- package/bundles/veloceapps-sdk-runtime.umd.js.map +0 -1
- package/bundles/veloceapps-sdk.umd.js +0 -3583
- package/bundles/veloceapps-sdk.umd.js.map +0 -1
- package/cms/modules/federated/federated.utils.d.ts +0 -1
- package/cms/package.json +0 -10
- package/cms/veloceapps-sdk-cms.d.ts +0 -5
- package/core/package.json +0 -10
- package/core/veloceapps-sdk-core.d.ts +0 -5
- package/esm2015/cms/cms.actions.js +0 -42
- package/esm2015/cms/components/element-children/element-children.component.js +0 -39
- package/esm2015/cms/components/element-children/element-children.module.js +0 -20
- package/esm2015/cms/components/element-drop-handle/element-drop-handle.component.js +0 -32
- package/esm2015/cms/components/element-drop-handle/element-drop-handle.module.js +0 -19
- package/esm2015/cms/components/element-renderer/element-renderer.component.js +0 -169
- package/esm2015/cms/components/element.component.js +0 -44
- package/esm2015/cms/components/plugin.component.js +0 -16
- package/esm2015/cms/components/preview/preview.component.js +0 -93
- package/esm2015/cms/components/preview/preview.module.js +0 -24
- package/esm2015/cms/directives/custom-template.directive.js +0 -25
- package/esm2015/cms/engine/models/entity.js +0 -18
- package/esm2015/cms/launcher.module.js +0 -24
- package/esm2015/cms/modules/federated/federated.component.js +0 -82
- package/esm2015/cms/modules/federated/federated.module.js +0 -19
- package/esm2015/cms/modules/federated/federated.types.js +0 -2
- package/esm2015/cms/modules/federated/federated.utils.js +0 -37
- package/esm2015/cms/modules/migrations/migrations.js +0 -11
- package/esm2015/cms/modules/migrations/services/migrations.service.js +0 -43
- package/esm2015/cms/modules/runtime/services/compilation.service.js +0 -84
- package/esm2015/cms/modules/runtime/services/runtime-editor.service.js +0 -27
- package/esm2015/cms/modules/runtime/services/runtime.service.js +0 -74
- package/esm2015/cms/plugins/configuration.plugin.js +0 -106
- package/esm2015/cms/plugins/io.plugin.js +0 -37
- package/esm2015/cms/plugins/region.plugin.js +0 -58
- package/esm2015/cms/plugins/script.plugin.js +0 -66
- package/esm2015/cms/services/integration.state.js +0 -40
- package/esm2015/cms/services/io-provider.service.js +0 -51
- package/esm2015/cms/services/resources.service.js +0 -50
- package/esm2015/cms/utils/element.utils.js +0 -157
- package/esm2015/cms/utils/elements-resolver.js +0 -163
- package/esm2015/cms/utils/path.utils.js +0 -56
- package/esm2015/cms/utils/ui-definition.utils.js +0 -82
- package/esm2015/cms/vendor-map.js +0 -51
- package/esm2015/core/core.module.js +0 -18
- package/esm2015/core/modules/configuration/helpers.js +0 -10
- package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +0 -87
- package/esm2015/core/modules/configuration/services/configuration.service.js +0 -177
- package/esm2015/core/modules/configuration/services/runtime-context.service.js +0 -51
- package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +0 -18
- package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +0 -150
- package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +0 -129
- package/esm2015/core/services/context.service.js +0 -53
- package/esm2015/core/services/metric-calculation/metric-calculation.service.js +0 -83
- package/esm2015/core/services/product-images.service.js +0 -30
- package/esm2015/core/services/quote-draft.service.js +0 -217
- package/esm2015/core/utils/line-item.utils.js +0 -143
- package/esm2015/core/utils/line-item.worker.js +0 -19
- package/esm2015/runtime/components/component-preview/component-preview.component.js +0 -125
- package/esm2015/runtime/components/section-renderer/section-renderer.component.js +0 -71
- package/esm2015/runtime/components/ui-runtime/runtime.component.js +0 -429
- package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +0 -109
- package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +0 -68
- package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +0 -36
- package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +0 -72
- package/esm2015/runtime/execution/components/federated/federated.component.js +0 -81
- package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +0 -65
- package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +0 -136
- package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +0 -80
- package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +0 -101
- package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +0 -150
- package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +0 -121
- package/esm2015/runtime/execution/directives/section-script.directive.js +0 -242
- package/esm2015/runtime/execution/directives/sf-query.directive.js +0 -34
- package/esm2015/runtime/execution/directives/velo-attribute.directive.js +0 -86
- package/esm2015/runtime/execution/directives/velo-port.directive.js +0 -373
- package/esm2015/runtime/execution/directives/vl-approval.directive.js +0 -22
- package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +0 -35
- package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +0 -59
- package/esm2015/runtime/execution/directives/vl-quote.directive.js +0 -41
- package/esm2015/runtime/execution/directives/vl-ramp.directive.js +0 -51
- package/esm2015/runtime/execution/runtime-execution.module.js +0 -163
- package/esm2015/runtime/execution/utils/federated.util.js +0 -37
- package/esm2015/runtime/runtime.module.js +0 -104
- package/esm2015/runtime/services/cart.service.js +0 -27
- package/esm2015/runtime/services/configuration.service.js +0 -101
- package/esm2015/runtime/services/product-model-cache.service.js +0 -30
- package/esm2015/runtime/services/runtime-context.service.js +0 -56
- package/esm2015/runtime/services/runtime-form.service.js +0 -224
- package/esm2015/runtime/services/runtime.service.js +0 -108
- package/esm2015/runtime/services/section.service.js +0 -124
- package/esm2015/runtime/types/script-registry.types.js +0 -51
- package/esm2015/runtime/utils/line-item.util.js +0 -273
- package/esm2015/src/components/dialog/dialog.component.js +0 -40
- package/esm2015/src/components/dialog/dialog.module.js +0 -19
- package/esm2015/src/components/doc-gen/doc-gen.component.js +0 -109
- package/esm2015/src/components/doc-gen/doc-gen.module.js +0 -19
- package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +0 -122
- package/esm2015/src/components/header/header.component.js +0 -336
- package/esm2015/src/components/header/metrics/metrics.component.js +0 -232
- package/esm2015/src/flow.component.js +0 -45
- package/esm2015/src/flow.module.js +0 -60
- package/esm2015/src/guards/context.guard.js +0 -84
- package/esm2015/src/guards/product-unload.guard.js +0 -43
- package/esm2015/src/guards/root.guard.js +0 -41
- package/esm2015/src/pages/assets/assets.component.js +0 -117
- package/esm2015/src/pages/assets/assets.module.js +0 -20
- package/esm2015/src/pages/catalog/catalog.component.js +0 -117
- package/esm2015/src/pages/catalog/catalog.module.js +0 -20
- package/esm2015/src/pages/debug/debug.component.js +0 -61
- package/esm2015/src/pages/empty-account/empty-account.component.js +0 -17
- package/esm2015/src/pages/empty-account/empty-account.module.js +0 -20
- package/esm2015/src/pages/legacy-product/legacy-product.component.js +0 -132
- package/esm2015/src/pages/legacy-product/legacy-product.module.js +0 -21
- package/esm2015/src/pages/product/product.component.js +0 -101
- package/esm2015/src/pages/product/product.module.js +0 -20
- package/esm2015/src/pages/record-not-found/record-not-found.component.js +0 -29
- package/esm2015/src/pages/record-not-found/record-not-found.module.js +0 -20
- package/esm2015/src/pages/remote/remote.component.js +0 -350
- package/esm2015/src/pages/remote/remote.module.js +0 -20
- package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +0 -117
- package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +0 -20
- package/esm2015/src/resolvers/flow.resolver.js +0 -62
- package/esm2015/src/resolvers/quote.resolver.js +0 -88
- package/esm2015/src/services/doc-gen.service.js +0 -33
- package/esm2015/src/services/flow-dialog.service.js +0 -124
- package/esm2015/src/services/flow-router.service.js +0 -144
- package/esm2015/src/services/flow.service.js +0 -84
- package/esm2015/src/utils/flow.utils.js +0 -22
- package/fesm2015/veloceapps-sdk-cms.js.map +0 -1
- package/fesm2015/veloceapps-sdk-core.js.map +0 -1
- package/fesm2015/veloceapps-sdk-runtime.js.map +0 -1
- package/fesm2015/veloceapps-sdk.js +0 -2953
- package/fesm2015/veloceapps-sdk.js.map +0 -1
- package/runtime/package.json +0 -10
- package/runtime/veloceapps-sdk-runtime.d.ts +0 -5
- package/veloceapps-sdk.d.ts +0 -5
- /package/{esm2015/cms/cms.default.js → esm2020/cms/cms.default.mjs} +0 -0
- /package/{esm2015/cms/cms.elements.js → esm2020/cms/cms.elements.mjs} +0 -0
- /package/{esm2015/cms/cms.layouts.js → esm2020/cms/cms.layouts.mjs} +0 -0
- /package/{esm2015/cms/components/index.js → esm2020/cms/components/index.mjs} +0 -0
- /package/{esm2015/cms/components/preview/index.js → esm2020/cms/components/preview/index.mjs} +0 -0
- /package/{esm2015/cms/components/preview/preview.types.js → esm2020/cms/components/preview/preview.types.mjs} +0 -0
- /package/{esm2015/cms/decorators/element.decorator.js → esm2020/cms/decorators/element.decorator.mjs} +0 -0
- /package/{esm2015/cms/decorators/index.js → esm2020/cms/decorators/index.mjs} +0 -0
- /package/{esm2015/cms/engine/models/plugin.js → esm2020/cms/engine/models/plugin.mjs} +0 -0
- /package/{esm2015/cms/index.js → esm2020/cms/index.mjs} +0 -0
- /package/{esm2015/cms/injection-tokens.js → esm2020/cms/injection-tokens.mjs} +0 -0
- /package/{esm2015/cms/modules/federated/default-options.js → esm2020/cms/modules/federated/default-options.mjs} +0 -0
- /package/{esm2015/cms/modules/federated/export.js → esm2020/cms/modules/federated/export.mjs} +0 -0
- /package/{esm2015/cms/modules/migrations/index.js → esm2020/cms/modules/migrations/index.mjs} +0 -0
- /package/{esm2015/cms/modules/migrations/types/migrations.types.js → esm2020/cms/modules/migrations/types/migrations.types.mjs} +0 -0
- /package/{esm2015/cms/modules/runtime/index.js → esm2020/cms/modules/runtime/index.mjs} +0 -0
- /package/{esm2015/cms/modules/runtime/tokens.js → esm2020/cms/modules/runtime/tokens.mjs} +0 -0
- /package/{esm2015/cms/modules/runtime/types/compilation.types.js → esm2020/cms/modules/runtime/types/compilation.types.mjs} +0 -0
- /package/{esm2015/cms/modules/runtime/types/runtime.actions.js → esm2020/cms/modules/runtime/types/runtime.actions.mjs} +0 -0
- /package/{esm2015/cms/services/index.js → esm2020/cms/services/index.mjs} +0 -0
- /package/{esm2015/cms/types/common.types.js → esm2020/cms/types/common.types.mjs} +0 -0
- /package/{esm2015/cms/types/configuration.types.js → esm2020/cms/types/configuration.types.mjs} +0 -0
- /package/{esm2015/cms/types/elements.types.js → esm2020/cms/types/elements.types.mjs} +0 -0
- /package/{esm2015/cms/types/index.js → esm2020/cms/types/index.mjs} +0 -0
- /package/{esm2015/cms/types/integration.types.js → esm2020/cms/types/integration.types.mjs} +0 -0
- /package/{esm2015/cms/types/layouts.types.js → esm2020/cms/types/layouts.types.mjs} +0 -0
- /package/{esm2015/cms/types/path.types.js → esm2020/cms/types/path.types.mjs} +0 -0
- /package/{esm2015/cms/utils/index.js → esm2020/cms/utils/index.mjs} +0 -0
- /package/{esm2015/cms/veloceapps-sdk-cms.js → esm2020/cms/veloceapps-sdk-cms.mjs} +0 -0
- /package/{esm2015/core/index.js → esm2020/core/index.mjs} +0 -0
- /package/{esm2015/core/modules/configuration/index.js → esm2020/core/modules/configuration/index.mjs} +0 -0
- /package/{esm2015/core/modules/configuration/types/configuration-runtime.types.js → esm2020/core/modules/configuration/types/configuration-runtime.types.mjs} +0 -0
- /package/{esm2015/core/modules/flow-configuration/index.js → esm2020/core/modules/flow-configuration/index.mjs} +0 -0
- /package/{esm2015/core/modules/flow-configuration/types/update.types.js → esm2020/core/modules/flow-configuration/types/update.types.mjs} +0 -0
- /package/{esm2015/core/modules/index.js → esm2020/core/modules/index.mjs} +0 -0
- /package/{esm2015/core/services/index.js → esm2020/core/services/index.mjs} +0 -0
- /package/{esm2015/core/services/metric-calculation/metric-calculation.types.js → esm2020/core/services/metric-calculation/metric-calculation.types.mjs} +0 -0
- /package/{esm2015/core/services/metric-calculation/metric-calculation.utils.js → esm2020/core/services/metric-calculation/metric-calculation.utils.mjs} +0 -0
- /package/{esm2015/core/types/index.js → esm2020/core/types/index.mjs} +0 -0
- /package/{esm2015/core/types/runtime.types.js → esm2020/core/types/runtime.types.mjs} +0 -0
- /package/{esm2015/core/types/ui-definition.types.js → esm2020/core/types/ui-definition.types.mjs} +0 -0
- /package/{esm2015/core/utils/index.js → esm2020/core/utils/index.mjs} +0 -0
- /package/{esm2015/core/utils/ui-definition.utils.js → esm2020/core/utils/ui-definition.utils.mjs} +0 -0
- /package/{esm2015/core/veloceapps-sdk-core.js → esm2020/core/veloceapps-sdk-core.mjs} +0 -0
- /package/{esm2015/index.js → esm2020/index.mjs} +0 -0
- /package/{esm2015/runtime/components/index.js → esm2020/runtime/components/index.mjs} +0 -0
- /package/{esm2015/runtime/index.js → esm2020/runtime/index.mjs} +0 -0
- /package/{esm2015/runtime/services/index.js → esm2020/runtime/services/index.mjs} +0 -0
- /package/{esm2015/runtime/types/bound-data.types.js → esm2020/runtime/types/bound-data.types.mjs} +0 -0
- /package/{esm2015/runtime/types/index.js → esm2020/runtime/types/index.mjs} +0 -0
- /package/{esm2015/runtime/types/quote-states.types.js → esm2020/runtime/types/quote-states.types.mjs} +0 -0
- /package/{esm2015/runtime/types/runtime.types.js → esm2020/runtime/types/runtime.types.mjs} +0 -0
- /package/{esm2015/runtime/utils/section.utils.js → esm2020/runtime/utils/section.utils.mjs} +0 -0
- /package/{esm2015/runtime/utils/sections-binder.helper.js → esm2020/runtime/utils/sections-binder.helper.mjs} +0 -0
- /package/{esm2015/runtime/veloceapps-sdk-runtime.js → esm2020/runtime/veloceapps-sdk-runtime.mjs} +0 -0
- /package/{esm2015/src/components/dialog/dialog.types.js → esm2020/src/components/dialog/dialog.types.mjs} +0 -0
- /package/{esm2015/src/components/header/header.types.js → esm2020/src/components/header/header.types.mjs} +0 -0
- /package/{esm2015/src/components/header/metrics/index.js → esm2020/src/components/header/metrics/index.mjs} +0 -0
- /package/{esm2015/src/components/header/metrics/metrics.definitions.js → esm2020/src/components/header/metrics/metrics.definitions.mjs} +0 -0
- /package/{esm2015/src/constants.js → esm2020/src/constants.mjs} +0 -0
- /package/{esm2015/src/guards/index.js → esm2020/src/guards/index.mjs} +0 -0
- /package/{esm2015/src/index.js → esm2020/src/index.mjs} +0 -0
- /package/{esm2015/src/pages/remote/remote.types.js → esm2020/src/pages/remote/remote.types.mjs} +0 -0
- /package/{esm2015/src/services/index.js → esm2020/src/services/index.mjs} +0 -0
- /package/{esm2015/src/types/context-route.types.js → esm2020/src/types/context-route.types.mjs} +0 -0
- /package/{esm2015/src/types/flow-customization.types.js → esm2020/src/types/flow-customization.types.mjs} +0 -0
- /package/{esm2015/src/types/index.js → esm2020/src/types/index.mjs} +0 -0
- /package/{esm2015/src/types/metrics.types.js → esm2020/src/types/metrics.types.mjs} +0 -0
- /package/{esm2015/src/types/route.types.js → esm2020/src/types/route.types.mjs} +0 -0
- /package/{esm2015/src/utils/index.js → esm2020/src/utils/index.mjs} +0 -0
- /package/{esm2015/veloceapps-sdk.js → esm2020/veloceapps-sdk.mjs} +0 -0
@@ -0,0 +1,2036 @@
|
|
1
|
+
import { __decorate, __param, __metadata } from 'tslib';
|
2
|
+
import * as i0 from '@angular/core';
|
3
|
+
import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Injector, Injectable, ViewContainerRef, SkipSelf, ViewChild, Input, ViewEncapsulation, NgModule, Directive, ElementRef, createNgModule } from '@angular/core';
|
4
|
+
import * as rxjs from 'rxjs';
|
5
|
+
import { BehaviorSubject, Subject, of, map, tap, switchMap, startWith, distinctUntilChanged, filter, ReplaySubject, noop, take, Observable, takeUntil, forkJoin, catchError, combineLatest, from } from 'rxjs';
|
6
|
+
import * as i2 from '@veloceapps/sdk/core';
|
7
|
+
import { ConfigurationService, LineItemWorker, generateLineItem, getAttributeValue, QuoteDraftService, FlowConfigurationService, ProductImagesService, ContextService, lineItemUtils, SdkCoreModule, UI_DEFINITION_VERSION } from '@veloceapps/sdk/core';
|
8
|
+
import * as i3 from 'primeng/api';
|
9
|
+
import { applyPatch } from 'rfc6902';
|
10
|
+
import * as lodash from 'lodash';
|
11
|
+
import { compact, isArray, pull, merge, omit, flatten, set, kebabCase, cloneDeep } from 'lodash';
|
12
|
+
import * as i5 from '@angular/common';
|
13
|
+
import { CommonModule, DOCUMENT } from '@angular/common';
|
14
|
+
import * as i1 from '@veloceapps/components';
|
15
|
+
import { LetDirectiveModule, LoaderModule, ToastService, ToastType } from '@veloceapps/components';
|
16
|
+
import { UUID, isDefined, Operator, Predicate, parseJsonSafely, CoreModule } from '@veloceapps/core';
|
17
|
+
import * as i2$1 from 'ngx-drag-drop';
|
18
|
+
import { DndModule } from 'ngx-drag-drop';
|
19
|
+
import { SalesforceApiService, QuoteApiService, DocumentTemplatesApiService, DocumentAttachmentApiService, RampApiService, CatalogApiService, DeltaApiService, PicklistsApiService, PriceApiService, ShoppingCartSettingsApiService, ConfigurationSettingsApiService, GuidedSellingApiService, ApiModule } from '@veloceapps/api';
|
20
|
+
import { DialogService } from 'primeng/dynamicdialog';
|
21
|
+
import { DragDropModule } from '@angular/cdk/drag-drop';
|
22
|
+
import { ScrollingModule } from '@angular/cdk/scrolling';
|
23
|
+
import * as angularForms from '@angular/forms';
|
24
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
25
|
+
import { transform } from '@babel/standalone';
|
26
|
+
import * as rxjsOperators from 'rxjs/operators';
|
27
|
+
import { loadRemoteModule } from '@angular-architects/module-federation';
|
28
|
+
|
29
|
+
var FlowAction;
|
30
|
+
(function (FlowAction) {
|
31
|
+
FlowAction["FLOW_CONFIGURE_PRODUCT"] = "FLOW_CONFIGURE_PRODUCT";
|
32
|
+
FlowAction["FLOW_NAVIGATE_BACK"] = "FLOW_NAVIGATE_BACK";
|
33
|
+
FlowAction["FLOW_NAVIGATE_TO_CATALOG"] = "FLOW_NAVIGATE_TO_CATALOG";
|
34
|
+
FlowAction["FLOW_APPLY_PRODUCT_CONFIGURATION"] = "FLOW_APPLY_PRODUCT_CONFIGURATION";
|
35
|
+
FlowAction["FLOW_OPEN_DOC_GEN"] = "FLOW_OPEN_DOC_GEN";
|
36
|
+
FlowAction["FLOW_CLOSE_DOC_GEN"] = "FLOW_CLOSE_DOC_GEN";
|
37
|
+
FlowAction["FLOW_SWITCH_OBJECT"] = "FLOW_SWITCH_OBJECT";
|
38
|
+
FlowAction["REMOTE_APPLY"] = "REMOTE_APPLY";
|
39
|
+
FlowAction["REMOTE_CANCEL"] = "REMOTE_CANCEL";
|
40
|
+
})(FlowAction || (FlowAction = {}));
|
41
|
+
const ConfigureProductAction = ({ lineItemId, productId, }) => ({
|
42
|
+
type: FlowAction.FLOW_CONFIGURE_PRODUCT,
|
43
|
+
payload: { lineItemId, productId },
|
44
|
+
});
|
45
|
+
const NavigateBackAction = () => ({
|
46
|
+
type: FlowAction.FLOW_NAVIGATE_BACK,
|
47
|
+
});
|
48
|
+
const NavigateToCatalogAction = () => ({
|
49
|
+
type: FlowAction.FLOW_NAVIGATE_TO_CATALOG,
|
50
|
+
});
|
51
|
+
const ApplyProductConfigurationAction = () => ({
|
52
|
+
type: FlowAction.FLOW_APPLY_PRODUCT_CONFIGURATION,
|
53
|
+
});
|
54
|
+
const OpenDocGenAction = () => ({
|
55
|
+
type: FlowAction.FLOW_OPEN_DOC_GEN,
|
56
|
+
});
|
57
|
+
const CloseDocGenAction = () => ({
|
58
|
+
type: FlowAction.FLOW_CLOSE_DOC_GEN,
|
59
|
+
});
|
60
|
+
const RemoteApplyAction = () => ({
|
61
|
+
type: FlowAction.REMOTE_APPLY,
|
62
|
+
});
|
63
|
+
const RemoteCancelAction = () => ({
|
64
|
+
type: FlowAction.REMOTE_CANCEL,
|
65
|
+
});
|
66
|
+
const SwitchObjectAction = (payload) => ({
|
67
|
+
type: FlowAction.FLOW_SWITCH_OBJECT,
|
68
|
+
payload,
|
69
|
+
});
|
70
|
+
var CmsAction;
|
71
|
+
(function (CmsAction) {
|
72
|
+
CmsAction.GO_TO_PAGE = '[CMS]_GO_TO_PAGE';
|
73
|
+
/**
|
74
|
+
* Navigate UI definition to a specific page
|
75
|
+
*
|
76
|
+
* @param pageName name of the page
|
77
|
+
* @returns void
|
78
|
+
*/
|
79
|
+
CmsAction.GoToPage = (pageName) => ({
|
80
|
+
type: CmsAction.GO_TO_PAGE,
|
81
|
+
payload: { pageName },
|
82
|
+
});
|
83
|
+
})(CmsAction || (CmsAction = {}));
|
84
|
+
|
85
|
+
var cmsActions = /*#__PURE__*/Object.freeze({
|
86
|
+
__proto__: null,
|
87
|
+
ApplyProductConfigurationAction: ApplyProductConfigurationAction,
|
88
|
+
CloseDocGenAction: CloseDocGenAction,
|
89
|
+
get CmsAction () { return CmsAction; },
|
90
|
+
ConfigureProductAction: ConfigureProductAction,
|
91
|
+
get FlowAction () { return FlowAction; },
|
92
|
+
NavigateBackAction: NavigateBackAction,
|
93
|
+
NavigateToCatalogAction: NavigateToCatalogAction,
|
94
|
+
OpenDocGenAction: OpenDocGenAction,
|
95
|
+
RemoteApplyAction: RemoteApplyAction,
|
96
|
+
RemoteCancelAction: RemoteCancelAction,
|
97
|
+
SwitchObjectAction: SwitchObjectAction
|
98
|
+
});
|
99
|
+
|
100
|
+
const DEFAULT_PLUGINS_TOKEN = new InjectionToken('DEFAULT_PLUGINS_TOKEN');
|
101
|
+
const UI_DEFINITION_METADATA = new InjectionToken('UI_DEFINITION_METADATA_TOKEN');
|
102
|
+
const ELEMENT_METADATA = new InjectionToken('ELEMENT_METADATA_TOKEN');
|
103
|
+
const SHARED_ELEMENT_METADATA = new InjectionToken('SHARED_ELEMENT_METADATA_TOKEN');
|
104
|
+
const ELEMENT_CONFIG = new InjectionToken('ELEMENT_CONFIG_TOKEN');
|
105
|
+
const VENDOR_MAP = new InjectionToken('VENDOR_MAP');
|
106
|
+
|
107
|
+
var cmsInjectionTokens = /*#__PURE__*/Object.freeze({
|
108
|
+
__proto__: null,
|
109
|
+
DEFAULT_PLUGINS_TOKEN: DEFAULT_PLUGINS_TOKEN,
|
110
|
+
ELEMENT_CONFIG: ELEMENT_CONFIG,
|
111
|
+
ELEMENT_METADATA: ELEMENT_METADATA,
|
112
|
+
SHARED_ELEMENT_METADATA: SHARED_ELEMENT_METADATA,
|
113
|
+
UI_DEFINITION_METADATA: UI_DEFINITION_METADATA,
|
114
|
+
VENDOR_MAP: VENDOR_MAP
|
115
|
+
});
|
116
|
+
|
117
|
+
class Entity {
|
118
|
+
constructor(injector) {
|
119
|
+
this.injector = injector;
|
120
|
+
this.plugins = [];
|
121
|
+
this.config = this.injector.get(ELEMENT_CONFIG);
|
122
|
+
this.defaultPlugins = this.injector.get(DEFAULT_PLUGINS_TOKEN);
|
123
|
+
}
|
124
|
+
initPlugins() {
|
125
|
+
this.defaultPlugins.forEach(plugin => this.registerPlugin(new plugin(this)));
|
126
|
+
this.config.plugins?.forEach(plugin => this.registerPlugin(new plugin(this)));
|
127
|
+
}
|
128
|
+
registerPlugin(plugin) {
|
129
|
+
this.plugins.push(plugin);
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
let ElementComponent = class ElementComponent extends Entity {
|
134
|
+
constructor(injector) {
|
135
|
+
super(injector);
|
136
|
+
this.injector = injector;
|
137
|
+
this.model$ = new BehaviorSubject(undefined);
|
138
|
+
super.initPlugins();
|
139
|
+
}
|
140
|
+
ngOnChanges(changes) {
|
141
|
+
this.plugins.forEach(plugin => plugin.ngOnChanges?.(changes));
|
142
|
+
}
|
143
|
+
ngOnInit() {
|
144
|
+
this.plugins.forEach(plugin => plugin.ngOnInit?.());
|
145
|
+
}
|
146
|
+
ngDoCheck() {
|
147
|
+
this.plugins.forEach(plugin => plugin.ngDoCheck?.());
|
148
|
+
}
|
149
|
+
ngAfterContentInit() {
|
150
|
+
this.plugins.forEach(plugin => plugin.ngAfterContentInit?.());
|
151
|
+
}
|
152
|
+
ngAfterViewInit() {
|
153
|
+
this.plugins.forEach(plugin => plugin.ngAfterViewInit?.());
|
154
|
+
}
|
155
|
+
ngAfterViewChecked() {
|
156
|
+
this.plugins.forEach(plugin => plugin.ngAfterViewChecked?.());
|
157
|
+
}
|
158
|
+
ngOnDestroy() {
|
159
|
+
this.plugins.forEach(plugin => plugin.ngOnDestroy?.());
|
160
|
+
}
|
161
|
+
};
|
162
|
+
ElementComponent = __decorate([
|
163
|
+
Component({
|
164
|
+
template: '',
|
165
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
166
|
+
jit: true,
|
167
|
+
}),
|
168
|
+
__param(0, Inject(Injector)),
|
169
|
+
__metadata("design:paramtypes", [Injector])
|
170
|
+
], ElementComponent);
|
171
|
+
|
172
|
+
function getElementUniqueName(collection, name, comparator) {
|
173
|
+
let result = '';
|
174
|
+
let index = 0;
|
175
|
+
while (!result) {
|
176
|
+
const candidate = name + (index ? ` (${index})` : '');
|
177
|
+
const exists = collection.some(comparator(candidate));
|
178
|
+
if (!exists) {
|
179
|
+
result = candidate;
|
180
|
+
}
|
181
|
+
else {
|
182
|
+
index++;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
return result;
|
186
|
+
}
|
187
|
+
const insertElementAt = (source, target, parentPath, index) => {
|
188
|
+
const result = [...source];
|
189
|
+
const name = getElementUniqueName(result, target.name, (name) => (el) => el.name === name);
|
190
|
+
const path = parentPath ? `${parentPath}/${name}` : name;
|
191
|
+
result.splice(index, 0, { ...target, path, name });
|
192
|
+
return result;
|
193
|
+
};
|
194
|
+
const insertElement = (source, target, path, index) => {
|
195
|
+
if (!path) {
|
196
|
+
return insertElementAt(source, target, '', index);
|
197
|
+
}
|
198
|
+
return source.map(element => {
|
199
|
+
if (element.path === path) {
|
200
|
+
return { ...element, children: insertElementAt(element.children, target, element.path, index) };
|
201
|
+
}
|
202
|
+
else if (element.path?.startsWith(path)) {
|
203
|
+
return {
|
204
|
+
...element,
|
205
|
+
children: insertElement(element.children, target, path, index),
|
206
|
+
};
|
207
|
+
}
|
208
|
+
else {
|
209
|
+
return element;
|
210
|
+
}
|
211
|
+
});
|
212
|
+
};
|
213
|
+
const removeElement = (source, path) => {
|
214
|
+
return source.reduce((trunk, element) => {
|
215
|
+
if (path === element.path) {
|
216
|
+
return trunk;
|
217
|
+
}
|
218
|
+
if (element.path) {
|
219
|
+
if (path.startsWith(element.path)) {
|
220
|
+
trunk.push({
|
221
|
+
...element,
|
222
|
+
children: removeElement(element.children, path),
|
223
|
+
});
|
224
|
+
}
|
225
|
+
else {
|
226
|
+
trunk.push(element);
|
227
|
+
}
|
228
|
+
}
|
229
|
+
return trunk;
|
230
|
+
}, []);
|
231
|
+
};
|
232
|
+
const findElementByPath = (source, path) => {
|
233
|
+
for (const el of source) {
|
234
|
+
if (el.path === path) {
|
235
|
+
return el;
|
236
|
+
}
|
237
|
+
if (el.path && path.startsWith(el.path)) {
|
238
|
+
const found = findElementByPath(el.children, path);
|
239
|
+
if (found) {
|
240
|
+
return found;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
}
|
244
|
+
return;
|
245
|
+
};
|
246
|
+
const findElementByModule = (elements, module, elementName) => {
|
247
|
+
for (const el of elements) {
|
248
|
+
if (el.module === module && el.name === elementName) {
|
249
|
+
return el;
|
250
|
+
}
|
251
|
+
const child = findElementByModule(el.children, module, elementName);
|
252
|
+
if (child) {
|
253
|
+
return child;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
return;
|
257
|
+
};
|
258
|
+
|
259
|
+
const CMS_COMPILATION_SERVICE = new InjectionToken('VENDOR_MAP');
|
260
|
+
|
261
|
+
class RuntimeService {
|
262
|
+
constructor(injector) {
|
263
|
+
this.injector = injector;
|
264
|
+
this.modules = [];
|
265
|
+
this.componentFactories = {};
|
266
|
+
this.applicationTree = [];
|
267
|
+
this.isInitialized$ = new BehaviorSubject(false);
|
268
|
+
this.updated$ = new Subject();
|
269
|
+
this.compilationService = this.injector.get(CMS_COMPILATION_SERVICE);
|
270
|
+
}
|
271
|
+
initialize$(uiDefinition, config) {
|
272
|
+
this.config = config;
|
273
|
+
if (!uiDefinition) {
|
274
|
+
return of([]);
|
275
|
+
}
|
276
|
+
return this.compilationService.compileUIDefinition$(uiDefinition).pipe(map(result => {
|
277
|
+
this.applicationTree = result.elements;
|
278
|
+
this.addComponentFactories(result.module.componentFactories);
|
279
|
+
return result.elements;
|
280
|
+
}), tap(() => this.isInitialized$.next(true)));
|
281
|
+
}
|
282
|
+
applyPatch$(patch) {
|
283
|
+
let observable$ = of(undefined);
|
284
|
+
patch.forEach(operation => {
|
285
|
+
switch (operation.op) {
|
286
|
+
case 'add': {
|
287
|
+
observable$ = observable$.pipe(switchMap(() => this.addElement$(operation)));
|
288
|
+
break;
|
289
|
+
}
|
290
|
+
case 'remove': {
|
291
|
+
observable$ = observable$.pipe(map(() => this.deleteElement(operation)));
|
292
|
+
break;
|
293
|
+
}
|
294
|
+
default:
|
295
|
+
observable$ = of();
|
296
|
+
}
|
297
|
+
});
|
298
|
+
return observable$.pipe(tap(() => this.updated$.next()));
|
299
|
+
}
|
300
|
+
getCompiledElement$(path) {
|
301
|
+
return this.updated$.pipe(startWith(undefined), map(() => findElementByPath(this.applicationTree, path)), distinctUntilChanged());
|
302
|
+
}
|
303
|
+
clear() {
|
304
|
+
this.compilationService.clearModuleCache(this.modules);
|
305
|
+
this.modules = [];
|
306
|
+
this.applicationTree = [];
|
307
|
+
this.componentFactories = {};
|
308
|
+
this.isInitialized$.next(false);
|
309
|
+
}
|
310
|
+
addElement$(operation) {
|
311
|
+
return this.compilationService.compileElement$(operation.value).pipe(map(result => {
|
312
|
+
this.addComponentFactories(result.module.componentFactories);
|
313
|
+
applyPatch(this.applicationTree, [{ ...operation, value: result.elements[0] }]);
|
314
|
+
}));
|
315
|
+
}
|
316
|
+
deleteElement(operation) {
|
317
|
+
applyPatch(this.applicationTree, [operation]);
|
318
|
+
}
|
319
|
+
addComponentFactories(list) {
|
320
|
+
list.forEach(item => (this.componentFactories[item.componentType.path] = item));
|
321
|
+
}
|
322
|
+
}
|
323
|
+
RuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeService, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Injectable });
|
324
|
+
RuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeService });
|
325
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeService, decorators: [{
|
326
|
+
type: Injectable
|
327
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; } });
|
328
|
+
|
329
|
+
const InitAction = { type: 'INIT' };
|
330
|
+
const ClearAction = { type: 'CLEAR' };
|
331
|
+
class IntegrationState {
|
332
|
+
constructor() {
|
333
|
+
this.stateSubj$ = new BehaviorSubject({});
|
334
|
+
this.action$ = new BehaviorSubject(InitAction);
|
335
|
+
}
|
336
|
+
get state$() {
|
337
|
+
return this.stateSubj$.asObservable();
|
338
|
+
}
|
339
|
+
get state() {
|
340
|
+
return this.stateSubj$.getValue();
|
341
|
+
}
|
342
|
+
patchState(update) {
|
343
|
+
this.stateSubj$.next({ ...this.stateSubj$.getValue(), ...update });
|
344
|
+
}
|
345
|
+
dispatch(action) {
|
346
|
+
this.action$.next(action);
|
347
|
+
}
|
348
|
+
listen$(actionType) {
|
349
|
+
return this.action$.pipe(filter(action => action.type === actionType), map(action => action.payload));
|
350
|
+
}
|
351
|
+
listenAll$() {
|
352
|
+
return this.action$.asObservable();
|
353
|
+
}
|
354
|
+
clear() {
|
355
|
+
this.stateSubj$.next({});
|
356
|
+
this.action$.next(ClearAction);
|
357
|
+
}
|
358
|
+
}
|
359
|
+
IntegrationState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IntegrationState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
360
|
+
IntegrationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IntegrationState, providedIn: 'root' });
|
361
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IntegrationState, decorators: [{
|
362
|
+
type: Injectable,
|
363
|
+
args: [{ providedIn: 'root' }]
|
364
|
+
}] });
|
365
|
+
|
366
|
+
class ResourcesService {
|
367
|
+
constructor() {
|
368
|
+
this.scripts = new Map();
|
369
|
+
this.loaded$ = new ReplaySubject();
|
370
|
+
}
|
371
|
+
loadScript(url) {
|
372
|
+
const loaded = this.scripts.get(url);
|
373
|
+
if (loaded === true) {
|
374
|
+
return of(noop());
|
375
|
+
}
|
376
|
+
if (loaded == null) {
|
377
|
+
this.scripts.set(url, false);
|
378
|
+
const script = document.createElement('script');
|
379
|
+
script.src = url;
|
380
|
+
script.onload = () => {
|
381
|
+
this.scripts.set(url, true);
|
382
|
+
this.loaded$.next();
|
383
|
+
};
|
384
|
+
document.body.appendChild(script);
|
385
|
+
}
|
386
|
+
return this.loaded$.pipe(filter(() => this.scripts.get(url) === true), take(1));
|
387
|
+
}
|
388
|
+
loadStyles(url) {
|
389
|
+
const previewEl = document.querySelector('vl-cms-preview');
|
390
|
+
const rootEl = previewEl?.shadowRoot ?? previewEl ?? document.body;
|
391
|
+
return new Observable(subscriber => {
|
392
|
+
const link = document.createElement('link');
|
393
|
+
link.rel = 'stylesheet';
|
394
|
+
link.type = 'text/css';
|
395
|
+
link.href = url;
|
396
|
+
link.media = 'all';
|
397
|
+
link.onload = () => {
|
398
|
+
subscriber.next();
|
399
|
+
subscriber.complete();
|
400
|
+
};
|
401
|
+
rootEl.appendChild(link);
|
402
|
+
});
|
403
|
+
}
|
404
|
+
}
|
405
|
+
ResourcesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ResourcesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
406
|
+
ResourcesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ResourcesService, providedIn: 'root' });
|
407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ResourcesService, decorators: [{
|
408
|
+
type: Injectable,
|
409
|
+
args: [{ providedIn: 'root' }]
|
410
|
+
}] });
|
411
|
+
|
412
|
+
class TemplatesService {
|
413
|
+
constructor() {
|
414
|
+
this.templates = {};
|
415
|
+
}
|
416
|
+
register(name, templateRef) {
|
417
|
+
this.ensureStorage(name);
|
418
|
+
this.templates[name].next(templateRef);
|
419
|
+
}
|
420
|
+
get(name) {
|
421
|
+
this.ensureStorage(name);
|
422
|
+
return this.templates[name].value;
|
423
|
+
}
|
424
|
+
get$(name) {
|
425
|
+
this.ensureStorage(name);
|
426
|
+
return this.templates[name].asObservable();
|
427
|
+
}
|
428
|
+
ensureStorage(name) {
|
429
|
+
if (!this.templates[name]) {
|
430
|
+
this.templates[name] = new BehaviorSubject(undefined);
|
431
|
+
}
|
432
|
+
}
|
433
|
+
}
|
434
|
+
TemplatesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: TemplatesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
435
|
+
TemplatesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: TemplatesService });
|
436
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: TemplatesService, decorators: [{
|
437
|
+
type: Injectable
|
438
|
+
}] });
|
439
|
+
|
440
|
+
const parseBoundPath = (path) => {
|
441
|
+
const regexp = new RegExp(`(?:\\/)(?:\\w+)(?:\\/)(?:ports|attributes)(?:\\/)(?:\\w+)|(?:\\/)(?:\\w+)`, 'g');
|
442
|
+
const blocks = path.match(regexp)?.map(match => {
|
443
|
+
const [type, property, name] = compact(match.split('/'));
|
444
|
+
return { type, property, name };
|
445
|
+
}) ?? [];
|
446
|
+
return blocks;
|
447
|
+
};
|
448
|
+
const parsePath = (path) => {
|
449
|
+
const segments = path.split('/');
|
450
|
+
let module;
|
451
|
+
let variable;
|
452
|
+
if (segments[0]?.startsWith('@')) {
|
453
|
+
module = segments.shift()?.substring(1);
|
454
|
+
}
|
455
|
+
if (segments[segments.length - 1]?.[0] === ':') {
|
456
|
+
variable = segments.pop()?.substring(1);
|
457
|
+
}
|
458
|
+
const isAbsolute = !segments[0];
|
459
|
+
const nonEmptySegments = segments.filter(Boolean);
|
460
|
+
if (!isAbsolute && nonEmptySegments[0] === '.') {
|
461
|
+
nonEmptySegments.shift();
|
462
|
+
}
|
463
|
+
return {
|
464
|
+
isAbsolute,
|
465
|
+
segments: nonEmptySegments,
|
466
|
+
module,
|
467
|
+
variable,
|
468
|
+
};
|
469
|
+
};
|
470
|
+
const getAbsolutePath = (elements, subject, path) => {
|
471
|
+
if (path.module) {
|
472
|
+
return findElementByModule(elements, path.module, path.segments[0])?.path;
|
473
|
+
}
|
474
|
+
const subjectSegments = subject.path?.split('/') ?? [];
|
475
|
+
const segments = [...path.segments];
|
476
|
+
if (path.isAbsolute) {
|
477
|
+
return segments.join('/');
|
478
|
+
}
|
479
|
+
while (segments.length) {
|
480
|
+
const segment = segments.shift();
|
481
|
+
if (segment === '..') {
|
482
|
+
subjectSegments.pop();
|
483
|
+
}
|
484
|
+
else if (segment) {
|
485
|
+
subjectSegments.push(segment);
|
486
|
+
}
|
487
|
+
}
|
488
|
+
return subjectSegments.join('/');
|
489
|
+
};
|
490
|
+
|
491
|
+
class IOProviderService {
|
492
|
+
constructor(runtimeService) {
|
493
|
+
this.runtimeService = runtimeService;
|
494
|
+
this.inputs = {};
|
495
|
+
}
|
496
|
+
connect(el, name, target) {
|
497
|
+
return this.resolveTarget(el, name, target)?.asObservable();
|
498
|
+
}
|
499
|
+
provide(el, name, target) {
|
500
|
+
return this.resolveTarget(el, name, target);
|
501
|
+
}
|
502
|
+
resolveTarget(el, name, target) {
|
503
|
+
const isHost = !target;
|
504
|
+
if (isHost) {
|
505
|
+
return this.createSubjectSafe(el.path ?? '', name);
|
506
|
+
}
|
507
|
+
const elPath = parsePath(target);
|
508
|
+
const pathIsValue = elPath.segments.length === 1 && elPath.segments[0].startsWith('"') && elPath.segments[0].endsWith('"');
|
509
|
+
const finalName = elPath.variable ?? name;
|
510
|
+
const value = pathIsValue ? new BehaviorSubject(elPath.segments[0].slice(1, -1)) : undefined;
|
511
|
+
const absolutePath = !pathIsValue ? getAbsolutePath(this.runtimeService.applicationTree, el, elPath) : el.path;
|
512
|
+
return this.createSubjectSafe(absolutePath ?? '', finalName, value);
|
513
|
+
}
|
514
|
+
createSubjectSafe(path, name, subject) {
|
515
|
+
if (!this.inputs[path]) {
|
516
|
+
this.inputs[path] = {};
|
517
|
+
}
|
518
|
+
const subjectAlreadyExists = Boolean(this.inputs[path][name]);
|
519
|
+
if (!this.inputs[path][name]) {
|
520
|
+
this.inputs[path][name] = subject ?? new BehaviorSubject(undefined);
|
521
|
+
}
|
522
|
+
if (subject && subjectAlreadyExists) {
|
523
|
+
// push delayed value to workaround 'changed after it was checked' issue
|
524
|
+
setTimeout(() => this.inputs[path][name].next(subject.value));
|
525
|
+
}
|
526
|
+
return this.inputs[path][name];
|
527
|
+
}
|
528
|
+
}
|
529
|
+
IOProviderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IOProviderService, deps: [{ token: RuntimeService }], target: i0.ɵɵFactoryTarget.Injectable });
|
530
|
+
IOProviderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IOProviderService });
|
531
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IOProviderService, decorators: [{
|
532
|
+
type: Injectable
|
533
|
+
}], ctorParameters: function () { return [{ type: RuntimeService }]; } });
|
534
|
+
|
535
|
+
class ElementContextService {
|
536
|
+
}
|
537
|
+
ElementContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
538
|
+
ElementContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementContextService });
|
539
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementContextService, decorators: [{
|
540
|
+
type: Injectable
|
541
|
+
}] });
|
542
|
+
|
543
|
+
class ElementRendererComponent {
|
544
|
+
constructor(parentInjector, runtimeService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
|
545
|
+
this.parentInjector = parentInjector;
|
546
|
+
this.runtimeService = runtimeService;
|
547
|
+
this.elementContext = elementContext;
|
548
|
+
this.ioProviderService = ioProviderService;
|
549
|
+
this.configurationService = configurationService;
|
550
|
+
this.elementRef = elementRef;
|
551
|
+
this.cdr = cdr;
|
552
|
+
this.refs = {};
|
553
|
+
this.destroy$ = new Subject();
|
554
|
+
}
|
555
|
+
ngOnInit() {
|
556
|
+
this.elementContext.metadata = this.meta;
|
557
|
+
this.factory = this.meta.path ? this.runtimeService.componentFactories[this.meta.path] : undefined;
|
558
|
+
this.createComponents();
|
559
|
+
}
|
560
|
+
ngOnDestroy() {
|
561
|
+
this.destroyComponents();
|
562
|
+
this.destroy$.next();
|
563
|
+
this.destroy$.complete();
|
564
|
+
}
|
565
|
+
createComponents() {
|
566
|
+
const modelMeta = this.meta.model;
|
567
|
+
if (!modelMeta) {
|
568
|
+
this.refs[UUID.UUID()] = this.createComponent();
|
569
|
+
return;
|
570
|
+
}
|
571
|
+
if (modelMeta.lineItem) {
|
572
|
+
this.createFromLineItem(modelMeta.lineItem);
|
573
|
+
}
|
574
|
+
else if (modelMeta.path) {
|
575
|
+
this.createFromPath(modelMeta.path);
|
576
|
+
}
|
577
|
+
}
|
578
|
+
createFromPath(path) {
|
579
|
+
const array$ = this.ioProviderService.connect(this.meta, 'children$', path);
|
580
|
+
array$?.pipe(takeUntil(this.destroy$)).subscribe(children => {
|
581
|
+
if (!isArray(children)) {
|
582
|
+
return;
|
583
|
+
}
|
584
|
+
this.processChildren(children);
|
585
|
+
});
|
586
|
+
}
|
587
|
+
getModelComponent() {
|
588
|
+
let component = null;
|
589
|
+
let injector = this.parentInjector;
|
590
|
+
while (!component) {
|
591
|
+
const parentComp = injector.get(ElementRendererComponent, null);
|
592
|
+
if (parentComp?.meta.model) {
|
593
|
+
component = parentComp;
|
594
|
+
break;
|
595
|
+
}
|
596
|
+
if (parentComp) {
|
597
|
+
injector = parentComp.parentInjector;
|
598
|
+
}
|
599
|
+
else {
|
600
|
+
break;
|
601
|
+
}
|
602
|
+
}
|
603
|
+
return component;
|
604
|
+
}
|
605
|
+
createFromLineItem(path) {
|
606
|
+
const parentComp = this.getModelComponent();
|
607
|
+
const parentPath = parentComp?.meta.model?.lineItem;
|
608
|
+
const pathBlocks = parseBoundPath(path).reverse();
|
609
|
+
const { property, name } = pathBlocks[1] ?? {};
|
610
|
+
const finalPath = pathBlocks[0];
|
611
|
+
const children$ = this.getParentLineItem$(parentComp).pipe(map(model => {
|
612
|
+
if (!model) {
|
613
|
+
return [];
|
614
|
+
}
|
615
|
+
if (property === 'ports' && !finalPath.property && parentPath !== path) {
|
616
|
+
return model.lineItems.filter(({ port }) => port === name) ?? [];
|
617
|
+
}
|
618
|
+
return [model];
|
619
|
+
}));
|
620
|
+
children$.pipe(takeUntil(this.destroy$)).subscribe(children => {
|
621
|
+
this.processChildren(children);
|
622
|
+
});
|
623
|
+
}
|
624
|
+
processChildren(children) {
|
625
|
+
const refs = children.reduce((acc, data, index) => {
|
626
|
+
const key = String(data?.id ?? UUID.UUID());
|
627
|
+
const existingRef = this.refs[key];
|
628
|
+
const ref = existingRef ?? this.createComponent(data, index);
|
629
|
+
if (existingRef) {
|
630
|
+
this.updateComponent(existingRef, data, index);
|
631
|
+
}
|
632
|
+
return ref ? { ...acc, [key]: ref } : acc;
|
633
|
+
}, {});
|
634
|
+
const existingKeys = Object.keys(this.refs);
|
635
|
+
const newKeys = Object.keys(refs);
|
636
|
+
pull(existingKeys, ...newKeys).forEach(key => {
|
637
|
+
this.destroyComponent(key);
|
638
|
+
});
|
639
|
+
this.refs = refs;
|
640
|
+
this.cdr.detectChanges();
|
641
|
+
}
|
642
|
+
getParentLineItem$(parentComp) {
|
643
|
+
const parentRefs = Object.values(parentComp?.refs ?? {});
|
644
|
+
const parentRef = parentRefs.find(ref => ref?.location.nativeElement?.contains(this.elementRef.nativeElement));
|
645
|
+
const parentModel$ = parentRef?.instance.model$;
|
646
|
+
return parentModel$ ?? this.configurationService.get();
|
647
|
+
}
|
648
|
+
createComponent(data, index) {
|
649
|
+
if (!this.factory) {
|
650
|
+
return;
|
651
|
+
}
|
652
|
+
const componentRef = this.el?.createComponent(this.factory, index);
|
653
|
+
if (componentRef) {
|
654
|
+
componentRef.location.nativeElement.setAttribute('name', this.meta.name);
|
655
|
+
componentRef.location.nativeElement.setAttribute('path', this.meta.path);
|
656
|
+
componentRef.instance?.model$.next(data);
|
657
|
+
}
|
658
|
+
return componentRef;
|
659
|
+
}
|
660
|
+
updateComponent(ref, data, index) {
|
661
|
+
ref.instance.model$.next(data);
|
662
|
+
if (this.el && this.el.indexOf(ref.hostView) !== index) {
|
663
|
+
this.el.move(ref.hostView, index);
|
664
|
+
}
|
665
|
+
}
|
666
|
+
destroyComponent(key) {
|
667
|
+
this.refs[key]?.destroy();
|
668
|
+
delete this.refs[key];
|
669
|
+
}
|
670
|
+
destroyComponents() {
|
671
|
+
Object.values(this.refs).forEach(ref => ref?.destroy());
|
672
|
+
this.refs = {};
|
673
|
+
}
|
674
|
+
}
|
675
|
+
ElementRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementRendererComponent, deps: [{ token: i0.Injector, skipSelf: true }, { token: RuntimeService }, { token: ElementContextService }, { token: IOProviderService }, { token: i2.ConfigurationService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
676
|
+
ElementRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: { meta: "meta" }, providers: [ElementContextService], viewQueries: [{ propertyName: "el", first: true, predicate: ["el"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-template #el></ng-template>\n", styles: [":host{display:contents}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
677
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementRendererComponent, decorators: [{
|
678
|
+
type: Component,
|
679
|
+
args: [{ selector: 'vl-cms-element-renderer', changeDetection: ChangeDetectionStrategy.OnPush, providers: [ElementContextService], template: "<ng-template #el></ng-template>\n", styles: [":host{display:contents}\n"] }]
|
680
|
+
}], ctorParameters: function () { return [{ type: i0.Injector, decorators: [{
|
681
|
+
type: SkipSelf
|
682
|
+
}] }, { type: RuntimeService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2.ConfigurationService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { el: [{
|
683
|
+
type: ViewChild,
|
684
|
+
args: ['el', { read: ViewContainerRef, static: true }]
|
685
|
+
}], meta: [{
|
686
|
+
type: Input
|
687
|
+
}] } });
|
688
|
+
|
689
|
+
class PreviewComponent {
|
690
|
+
constructor(runtimeService, configurationService, messageService, configurationRuntimeService, integrationState, cdr) {
|
691
|
+
this.runtimeService = runtimeService;
|
692
|
+
this.configurationService = configurationService;
|
693
|
+
this.messageService = messageService;
|
694
|
+
this.configurationRuntimeService = configurationRuntimeService;
|
695
|
+
this.integrationState = integrationState;
|
696
|
+
this.cdr = cdr;
|
697
|
+
this.state$ = new BehaviorSubject({ loading: true, failure: false });
|
698
|
+
this.destroy$ = new Subject();
|
699
|
+
this.runtimeService.updated$.pipe(takeUntil(this.destroy$)).subscribe(() => this.cdr.detectChanges());
|
700
|
+
this.elements$ = this.state$.pipe(switchMap(({ loading, failure }) => {
|
701
|
+
if (loading || failure) {
|
702
|
+
return of([]);
|
703
|
+
}
|
704
|
+
const elements = this.runtimeService.applicationTree;
|
705
|
+
// If UI definition contains pages, return page by SelectedPageName
|
706
|
+
if (this.uiDefinition?.pages?.length) {
|
707
|
+
return this.integrationState.listen$(CmsAction.GO_TO_PAGE).pipe(map(({ pageName }) => pageName), startWith(elements[0].name), distinctUntilChanged(), map(pageName => {
|
708
|
+
const page = elements.find(el => el.name === pageName);
|
709
|
+
return page ? [page] : elements.slice(0, 1);
|
710
|
+
}));
|
711
|
+
}
|
712
|
+
return of(elements);
|
713
|
+
}));
|
714
|
+
}
|
715
|
+
ngOnInit() {
|
716
|
+
if (this.config?.clearStateOnInit) {
|
717
|
+
this.integrationState.clear();
|
718
|
+
}
|
719
|
+
this.startPreview();
|
720
|
+
}
|
721
|
+
ngOnDestroy() {
|
722
|
+
this.destroy$.next();
|
723
|
+
this.destroy$.complete();
|
724
|
+
this.configurationService.reset();
|
725
|
+
this.runtimeService.clear();
|
726
|
+
}
|
727
|
+
trackBy(_, el) {
|
728
|
+
return el.path;
|
729
|
+
}
|
730
|
+
initializeConfiguration$() {
|
731
|
+
const isAlreadyInitialized = this.configurationRuntimeService.isInitialized;
|
732
|
+
if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
|
733
|
+
return of({});
|
734
|
+
}
|
735
|
+
if (!this.modelId) {
|
736
|
+
console.warn(`No modelId is given for uiDefinition with '${this.uiDefinition.type}' type`);
|
737
|
+
return of({});
|
738
|
+
}
|
739
|
+
// If still not initialized - init configuration in Test mode
|
740
|
+
return this.configurationRuntimeService
|
741
|
+
.initTestMode(this.modelId, this.uiDefinition)
|
742
|
+
.pipe(switchMap(() => this.configurationService.configure()));
|
743
|
+
}
|
744
|
+
startPreview() {
|
745
|
+
if (!this.uiDefinition) {
|
746
|
+
return;
|
747
|
+
}
|
748
|
+
forkJoin([this.runtimeService.initialize$(this.uiDefinition, this.config), this.initializeConfiguration$()])
|
749
|
+
.pipe(tap(() => {
|
750
|
+
this.state$.next({ loading: false, failure: false });
|
751
|
+
}), catchError(error => {
|
752
|
+
console.error(error);
|
753
|
+
if (!this.uiDefinition?.properties?.suppressToastMessages) {
|
754
|
+
this.messageService.add({ severity: 'error', summary: error });
|
755
|
+
}
|
756
|
+
this.state$.next({ loading: false, failure: true });
|
757
|
+
return of();
|
758
|
+
}), takeUntil(this.destroy$))
|
759
|
+
.subscribe();
|
760
|
+
}
|
761
|
+
}
|
762
|
+
PreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PreviewComponent, deps: [{ token: RuntimeService }, { token: i2.ConfigurationService }, { token: i3.MessageService }, { token: i2.ConfigurationRuntimeService }, { token: IntegrationState }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
763
|
+
PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition", config: "config" }, providers: [IOProviderService, TemplatesService], ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer\n *ngFor=\"let el of elements$ | async; trackBy: trackBy\"\n [meta]=\"el\"\n ></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "component", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
|
764
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PreviewComponent, decorators: [{
|
765
|
+
type: Component,
|
766
|
+
args: [{ selector: 'vl-cms-preview', changeDetection: ChangeDetectionStrategy.OnPush, providers: [IOProviderService, TemplatesService], encapsulation: ViewEncapsulation.ShadowDom, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer\n *ngFor=\"let el of elements$ | async; trackBy: trackBy\"\n [meta]=\"el\"\n ></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"] }]
|
767
|
+
}], ctorParameters: function () { return [{ type: RuntimeService }, { type: i2.ConfigurationService }, { type: i3.MessageService }, { type: i2.ConfigurationRuntimeService }, { type: IntegrationState }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { modelId: [{
|
768
|
+
type: Input
|
769
|
+
}], uiDefinition: [{
|
770
|
+
type: Input
|
771
|
+
}], config: [{
|
772
|
+
type: Input
|
773
|
+
}] } });
|
774
|
+
|
775
|
+
class RuntimeEditorService {
|
776
|
+
constructor(runtimeService) {
|
777
|
+
this.runtimeService = runtimeService;
|
778
|
+
this.editorModeSubj$ = new BehaviorSubject(false);
|
779
|
+
this.dragMode$ = new BehaviorSubject(false);
|
780
|
+
this.elementDropped$ = new ReplaySubject();
|
781
|
+
this.elementDeleted$ = new ReplaySubject();
|
782
|
+
this.editorMode$ = this.editorModeSubj$.asObservable();
|
783
|
+
this.runtimeService.isInitialized$.subscribe(() => this.editorModeSubj$.next(Boolean(this.runtimeService.config?.uiBuilderMode)));
|
784
|
+
}
|
785
|
+
applyPatch$(patch) {
|
786
|
+
return this.runtimeService.applyPatch$(patch);
|
787
|
+
}
|
788
|
+
toggleEditorMode() {
|
789
|
+
this.editorModeSubj$.next(!this.editorModeSubj$.value);
|
790
|
+
}
|
791
|
+
}
|
792
|
+
RuntimeEditorService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeEditorService, deps: [{ token: RuntimeService }], target: i0.ɵɵFactoryTarget.Injectable });
|
793
|
+
RuntimeEditorService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeEditorService });
|
794
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeEditorService, decorators: [{
|
795
|
+
type: Injectable
|
796
|
+
}], ctorParameters: function () { return [{ type: RuntimeService }]; } });
|
797
|
+
|
798
|
+
class ElementDropHandleComponent {
|
799
|
+
constructor(runtimeService) {
|
800
|
+
this.runtimeService = runtimeService;
|
801
|
+
}
|
802
|
+
handleDrop(e) {
|
803
|
+
this.runtimeService.elementDropped$.next({
|
804
|
+
element: e.data,
|
805
|
+
index: this.index,
|
806
|
+
path: this.parentPath,
|
807
|
+
});
|
808
|
+
}
|
809
|
+
}
|
810
|
+
ElementDropHandleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementDropHandleComponent, deps: [{ token: RuntimeEditorService }], target: i0.ɵɵFactoryTarget.Component });
|
811
|
+
ElementDropHandleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: ElementDropHandleComponent, selector: "vl-element-drop-handle", inputs: { index: "index", parentPath: "parentPath" }, ngImport: i0, template: "<div class=\"container\" dndDropzone (dndDrop)=\"handleDrop($event)\">\n <div class=\"handle\"></div>\n</div>\n", styles: [":host{width:0;position:relative}.container{width:40px;height:100%;position:absolute;transform:translate(-50%);display:flex;justify-content:center;align-items:center}.handle{display:none;background:red;height:calc(100% - 10px);width:2px;pointer-events:none}.container.dndDragover .handle{display:block}\n"], dependencies: [{ kind: "directive", type: i2$1.DndDropzoneDirective, selector: "[dndDropzone]", inputs: ["dndDropzone", "dndEffectAllowed", "dndAllowExternal", "dndHorizontal", "dndDragoverClass", "dndDropzoneDisabledClass", "dndDisableIf", "dndDisableDropIf"], outputs: ["dndDragover", "dndDrop"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
812
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementDropHandleComponent, decorators: [{
|
813
|
+
type: Component,
|
814
|
+
args: [{ selector: 'vl-element-drop-handle', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"container\" dndDropzone (dndDrop)=\"handleDrop($event)\">\n <div class=\"handle\"></div>\n</div>\n", styles: [":host{width:0;position:relative}.container{width:40px;height:100%;position:absolute;transform:translate(-50%);display:flex;justify-content:center;align-items:center}.handle{display:none;background:red;height:calc(100% - 10px);width:2px;pointer-events:none}.container.dndDragover .handle{display:block}\n"] }]
|
815
|
+
}], ctorParameters: function () { return [{ type: RuntimeEditorService }]; }, propDecorators: { index: [{
|
816
|
+
type: Input
|
817
|
+
}], parentPath: [{
|
818
|
+
type: Input
|
819
|
+
}] } });
|
820
|
+
|
821
|
+
class ElementDropHandleModule {
|
822
|
+
}
|
823
|
+
ElementDropHandleModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementDropHandleModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
824
|
+
ElementDropHandleModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: ElementDropHandleModule, declarations: [ElementDropHandleComponent], imports: [CommonModule, DndModule], exports: [ElementDropHandleComponent] });
|
825
|
+
ElementDropHandleModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementDropHandleModule, imports: [CommonModule, DndModule] });
|
826
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementDropHandleModule, decorators: [{
|
827
|
+
type: NgModule,
|
828
|
+
args: [{
|
829
|
+
declarations: [ElementDropHandleComponent],
|
830
|
+
imports: [CommonModule, DndModule],
|
831
|
+
exports: [ElementDropHandleComponent],
|
832
|
+
}]
|
833
|
+
}] });
|
834
|
+
|
835
|
+
class ElementRendererModule {
|
836
|
+
}
|
837
|
+
ElementRendererModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementRendererModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
838
|
+
ElementRendererModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
|
839
|
+
ElementRendererModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementRendererModule });
|
840
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementRendererModule, decorators: [{
|
841
|
+
type: NgModule,
|
842
|
+
args: [{
|
843
|
+
declarations: [ElementRendererComponent],
|
844
|
+
exports: [ElementRendererComponent],
|
845
|
+
}]
|
846
|
+
}] });
|
847
|
+
|
848
|
+
class ElementChildrenComponent {
|
849
|
+
constructor(elementContext, runtimeService, runtimeEditorService, cdr) {
|
850
|
+
this.elementContext = elementContext;
|
851
|
+
this.runtimeService = runtimeService;
|
852
|
+
this.runtimeEditorService = runtimeEditorService;
|
853
|
+
this.cdr = cdr;
|
854
|
+
this.destroyed$ = new Subject();
|
855
|
+
const path = this.elementContext?.metadata?.path;
|
856
|
+
this.metadata$ = path ? this.runtimeService.getCompiledElement$(path) : of(undefined);
|
857
|
+
this.dragMode$ = combineLatest([this.runtimeEditorService.editorMode$, this.runtimeEditorService.dragMode$]).pipe(map(flags => flags.every(Boolean)));
|
858
|
+
this.runtimeService.updated$.pipe(takeUntil(this.destroyed$)).subscribe(() => this.cdr.detectChanges());
|
859
|
+
}
|
860
|
+
ngOnDestroy() {
|
861
|
+
this.destroyed$.next();
|
862
|
+
this.destroyed$.complete();
|
863
|
+
}
|
864
|
+
}
|
865
|
+
ElementChildrenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementChildrenComponent, deps: [{ token: ElementContextService }, { token: RuntimeService }, { token: RuntimeEditorService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
866
|
+
ElementChildrenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: ElementChildrenComponent, selector: "element-children", ngImport: i0, template: "<ng-container *ngIf=\"metadata$ | async as metadata\">\n <vl-element-drop-handle *ngIf=\"dragMode$ | async\" [index]=\"0\" [parentPath]=\"metadata.path\"></vl-element-drop-handle>\n <ng-container *ngFor=\"let child of metadata.children; let i = index\">\n <vl-cms-element-renderer [meta]=\"child\"></vl-cms-element-renderer>\n <vl-element-drop-handle\n *ngIf=\"dragMode$ | async\"\n [index]=\"i + 1\"\n [parentPath]=\"metadata.path\"\n ></vl-element-drop-handle>\n </ng-container>\n</ng-container>\n", styles: [":host{display:contents}\n"], dependencies: [{ kind: "component", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }, { kind: "component", type: ElementDropHandleComponent, selector: "vl-element-drop-handle", inputs: ["index", "parentPath"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
867
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementChildrenComponent, decorators: [{
|
868
|
+
type: Component,
|
869
|
+
args: [{ selector: 'element-children', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"metadata$ | async as metadata\">\n <vl-element-drop-handle *ngIf=\"dragMode$ | async\" [index]=\"0\" [parentPath]=\"metadata.path\"></vl-element-drop-handle>\n <ng-container *ngFor=\"let child of metadata.children; let i = index\">\n <vl-cms-element-renderer [meta]=\"child\"></vl-cms-element-renderer>\n <vl-element-drop-handle\n *ngIf=\"dragMode$ | async\"\n [index]=\"i + 1\"\n [parentPath]=\"metadata.path\"\n ></vl-element-drop-handle>\n </ng-container>\n</ng-container>\n", styles: [":host{display:contents}\n"] }]
|
870
|
+
}], ctorParameters: function () { return [{ type: ElementContextService }, { type: RuntimeService }, { type: RuntimeEditorService }, { type: i0.ChangeDetectorRef }]; } });
|
871
|
+
|
872
|
+
class ElementChildrenModule {
|
873
|
+
}
|
874
|
+
ElementChildrenModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementChildrenModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
875
|
+
ElementChildrenModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: ElementChildrenModule, declarations: [ElementChildrenComponent], imports: [LetDirectiveModule, ElementRendererModule, ElementDropHandleModule], exports: [ElementChildrenComponent] });
|
876
|
+
ElementChildrenModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementChildrenModule, imports: [LetDirectiveModule, ElementRendererModule, ElementDropHandleModule] });
|
877
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementChildrenModule, decorators: [{
|
878
|
+
type: NgModule,
|
879
|
+
args: [{
|
880
|
+
declarations: [ElementChildrenComponent],
|
881
|
+
imports: [LetDirectiveModule, ElementRendererModule, ElementDropHandleModule],
|
882
|
+
exports: [ElementChildrenComponent],
|
883
|
+
}]
|
884
|
+
}] });
|
885
|
+
|
886
|
+
class PreviewModule {
|
887
|
+
}
|
888
|
+
PreviewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PreviewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
889
|
+
PreviewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: PreviewModule, declarations: [PreviewComponent], imports: [CommonModule, LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule], exports: [PreviewComponent] });
|
890
|
+
PreviewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PreviewModule, providers: [IntegrationState], imports: [CommonModule, LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule] });
|
891
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PreviewModule, decorators: [{
|
892
|
+
type: NgModule,
|
893
|
+
args: [{
|
894
|
+
declarations: [PreviewComponent],
|
895
|
+
imports: [CommonModule, LoaderModule, ElementRendererModule, ElementChildrenModule, ElementDropHandleModule],
|
896
|
+
providers: [IntegrationState],
|
897
|
+
exports: [PreviewComponent],
|
898
|
+
}]
|
899
|
+
}] });
|
900
|
+
|
901
|
+
function ElementDefinition(definition) {
|
902
|
+
return function (constructor) {
|
903
|
+
return constructor;
|
904
|
+
};
|
905
|
+
}
|
906
|
+
|
907
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
908
|
+
class CustomTemplateDirective {
|
909
|
+
constructor(templateRef, templatesService) {
|
910
|
+
this.templateRef = templateRef;
|
911
|
+
this.templatesService = templatesService;
|
912
|
+
}
|
913
|
+
ngAfterViewInit() {
|
914
|
+
if (!this.customTemplate) {
|
915
|
+
return;
|
916
|
+
}
|
917
|
+
this.templatesService.register(this.customTemplate, this.templateRef);
|
918
|
+
}
|
919
|
+
}
|
920
|
+
CustomTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CustomTemplateDirective, deps: [{ token: i0.TemplateRef }, { token: TemplatesService }], target: i0.ɵɵFactoryTarget.Directive });
|
921
|
+
CustomTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0 });
|
922
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CustomTemplateDirective, decorators: [{
|
923
|
+
type: Directive,
|
924
|
+
args: [{ selector: '[customTemplate]' }]
|
925
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
|
926
|
+
type: Input
|
927
|
+
}] } });
|
928
|
+
|
929
|
+
class IOPlugin {
|
930
|
+
constructor(host) {
|
931
|
+
this.host = host;
|
932
|
+
const elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
933
|
+
const inputProvider = this.host.injector.get(IOProviderService);
|
934
|
+
const inputs = Object.entries(elementMetadata.inputs ?? {});
|
935
|
+
const outputs = Object.entries(elementMetadata.outputs ?? {});
|
936
|
+
inputs.forEach(([key, path]) => {
|
937
|
+
if (path && typeof path !== 'string') {
|
938
|
+
console.error(`The value of '${key}' input should be a string`);
|
939
|
+
}
|
940
|
+
if (elementMetadata.outputs?.[key] !== undefined) {
|
941
|
+
console.warn(`'${key}' appears both in inputs and outputs. To prevent inconsistent behavior please keep them unique `);
|
942
|
+
}
|
943
|
+
this.host[key] = inputProvider.connect(elementMetadata, key, path);
|
944
|
+
});
|
945
|
+
outputs.forEach(([key, path]) => {
|
946
|
+
if (path && typeof path !== 'string') {
|
947
|
+
console.error(`The value of '${key}' output should be a string`);
|
948
|
+
}
|
949
|
+
this.host[key] = inputProvider.provide(elementMetadata, key, path);
|
950
|
+
});
|
951
|
+
}
|
952
|
+
}
|
953
|
+
IOPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IOPlugin, deps: [{ token: ElementComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
954
|
+
IOPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: IOPlugin, ngImport: i0 });
|
955
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: IOPlugin, decorators: [{
|
956
|
+
type: Directive
|
957
|
+
}], ctorParameters: function () { return [{ type: ElementComponent }]; } });
|
958
|
+
|
959
|
+
class RegionPlugin {
|
960
|
+
constructor(host) {
|
961
|
+
this.host = host;
|
962
|
+
this.destroy$ = new Subject();
|
963
|
+
this.metadata = this.host.injector.get(ELEMENT_METADATA);
|
964
|
+
this.document = this.host.injector.get(DOCUMENT);
|
965
|
+
this.el = this.host.injector.get(ElementRef);
|
966
|
+
const runtimeEditorService = this.host.injector.get(RuntimeEditorService);
|
967
|
+
runtimeEditorService.editorMode$
|
968
|
+
.pipe(tap(editMode => {
|
969
|
+
this.el.nativeElement.style.outline = editMode ? 'solid 1px #dce5ef' : '';
|
970
|
+
if (editMode && !this.metadata.children.length) {
|
971
|
+
this.addRegionName();
|
972
|
+
}
|
973
|
+
else {
|
974
|
+
this.regionNameEl?.remove();
|
975
|
+
}
|
976
|
+
}), takeUntil(this.destroy$))
|
977
|
+
.subscribe();
|
978
|
+
}
|
979
|
+
ngOnDestroy() {
|
980
|
+
this.destroy$.next();
|
981
|
+
this.destroy$.complete();
|
982
|
+
}
|
983
|
+
addRegionName() {
|
984
|
+
if (this.regionNameEl) {
|
985
|
+
this.regionNameEl.remove();
|
986
|
+
}
|
987
|
+
this.regionNameEl = this.document.createElement('div');
|
988
|
+
this.regionNameEl.innerHTML = this.metadata.name;
|
989
|
+
merge(this.regionNameEl.style, {
|
990
|
+
width: '100%',
|
991
|
+
height: '100%',
|
992
|
+
display: 'flex',
|
993
|
+
justifyContent: 'center',
|
994
|
+
alignItems: 'center',
|
995
|
+
color: '#AEB5BD',
|
996
|
+
pointerEvents: 'none',
|
997
|
+
userSelect: 'none',
|
998
|
+
});
|
999
|
+
this.el.nativeElement.append(this.regionNameEl);
|
1000
|
+
}
|
1001
|
+
}
|
1002
|
+
RegionPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RegionPlugin, deps: [{ token: ElementComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
1003
|
+
RegionPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: RegionPlugin, ngImport: i0 });
|
1004
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RegionPlugin, decorators: [{
|
1005
|
+
type: Directive
|
1006
|
+
}], ctorParameters: function () { return [{ type: ElementComponent }]; } });
|
1007
|
+
|
1008
|
+
class ScriptPlugin {
|
1009
|
+
constructor(host) {
|
1010
|
+
this.host = host;
|
1011
|
+
this.normalizeImports = (script, elementPath) => {
|
1012
|
+
const regexp = new RegExp(`import([ \\n\\t]*(?:[^ \\n\\t\\{\\}]+[ \\n\\t]*,?)?(?:[ \\n\\t]*\\{(?:[ \\n\\t]*[^ \\n\\t"'\\{\\}]+[ \\n\\t]*,?)+\\})?[ \\n\\t]*)from[ \\n\\t]*(['"])([^'"\\n]+)(?:['"]);`, 'g');
|
1013
|
+
const result = script.replace(regexp, (match, g1, g2, src) => {
|
1014
|
+
const imports = g1
|
1015
|
+
.trim()
|
1016
|
+
.slice(1, -1)
|
1017
|
+
.split(',')
|
1018
|
+
.map(item => item.trim());
|
1019
|
+
imports.forEach(item => {
|
1020
|
+
if (!this.vendorMap[src]?.[item]) {
|
1021
|
+
throw new Error(`Failed to import ${item} from '${src}' in ${elementPath}/script.ts`);
|
1022
|
+
}
|
1023
|
+
});
|
1024
|
+
return `const ${g1} = vendor['${src}'];`;
|
1025
|
+
});
|
1026
|
+
return result;
|
1027
|
+
};
|
1028
|
+
this.document = this.host.injector.get(DOCUMENT);
|
1029
|
+
this.vendorMap = this.host.injector.get(VENDOR_MAP);
|
1030
|
+
const elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
1031
|
+
const sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
|
1032
|
+
this.addScript(sharedElementMetadata);
|
1033
|
+
this.addScript(elementMetadata);
|
1034
|
+
}
|
1035
|
+
addScript(metadata) {
|
1036
|
+
if (!metadata?.script) {
|
1037
|
+
return;
|
1038
|
+
}
|
1039
|
+
const id = btoa(UUID.UUID());
|
1040
|
+
const script = this.document.createElement('script');
|
1041
|
+
script.type = `text/javascript`;
|
1042
|
+
let scriptContent = this.normalizeImports(metadata.script, metadata.path ?? metadata.name);
|
1043
|
+
const classMatch = /export class (\S+)/.exec(scriptContent);
|
1044
|
+
const className = classMatch?.[1];
|
1045
|
+
if (!classMatch || !className) {
|
1046
|
+
console.error("Script doesn't have exported class");
|
1047
|
+
return;
|
1048
|
+
}
|
1049
|
+
scriptContent = scriptContent.replace(classMatch[0], `class ${className}`);
|
1050
|
+
script.text = `var ${id} = function(vendor) {${scriptContent}
|
1051
|
+
return ${className}; };`;
|
1052
|
+
this.document.body.appendChild(script);
|
1053
|
+
const ScriptClass = window[id](this.vendorMap);
|
1054
|
+
if (ScriptClass instanceof Object) {
|
1055
|
+
this.host.registerPlugin(new ScriptClass(this.host));
|
1056
|
+
}
|
1057
|
+
this.document.body.removeChild(script);
|
1058
|
+
}
|
1059
|
+
}
|
1060
|
+
ScriptPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ScriptPlugin, deps: [{ token: ElementComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
1061
|
+
ScriptPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: ScriptPlugin, ngImport: i0 });
|
1062
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ScriptPlugin, decorators: [{
|
1063
|
+
type: Directive
|
1064
|
+
}], ctorParameters: function () { return [{ type: ElementComponent }]; } });
|
1065
|
+
|
1066
|
+
/*
|
1067
|
+
* ScriptPlugin must always be the last plugin in the list to make sure user code is running after all pre-initializers.
|
1068
|
+
*/
|
1069
|
+
const CONFIG = {
|
1070
|
+
CUSTOM: {
|
1071
|
+
component: ElementComponent,
|
1072
|
+
plugins: [IOPlugin, ScriptPlugin],
|
1073
|
+
},
|
1074
|
+
CONTAINER: {
|
1075
|
+
component: ElementComponent,
|
1076
|
+
defaultTemplate: '<element-children></element-children>',
|
1077
|
+
plugins: [ScriptPlugin],
|
1078
|
+
},
|
1079
|
+
SERVICE: {
|
1080
|
+
component: ElementComponent,
|
1081
|
+
plugins: [IOPlugin, ScriptPlugin],
|
1082
|
+
suppressTemplate: true,
|
1083
|
+
suppressStyles: true,
|
1084
|
+
},
|
1085
|
+
REFERENCE: {
|
1086
|
+
component: ElementComponent,
|
1087
|
+
plugins: [IOPlugin, ScriptPlugin],
|
1088
|
+
suppressTemplate: true,
|
1089
|
+
},
|
1090
|
+
PAGE: {
|
1091
|
+
component: ElementComponent,
|
1092
|
+
defaultTemplate: '<element-children></element-children>',
|
1093
|
+
plugins: [IOPlugin, ScriptPlugin],
|
1094
|
+
},
|
1095
|
+
REGION: {
|
1096
|
+
component: ElementComponent,
|
1097
|
+
defaultTemplate: '<element-children></element-children>',
|
1098
|
+
plugins: [IOPlugin, ScriptPlugin, RegionPlugin],
|
1099
|
+
},
|
1100
|
+
};
|
1101
|
+
|
1102
|
+
const EXPORTED_CLASS_REGEX = /export class (\S+)/;
|
1103
|
+
const METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|\r\n|.)*export class/g;
|
1104
|
+
class UiBuildError extends Error {
|
1105
|
+
constructor(message, affectedMetadata) {
|
1106
|
+
super(message);
|
1107
|
+
this.name = this.constructor.name;
|
1108
|
+
this.affectedMetadata = affectedMetadata;
|
1109
|
+
}
|
1110
|
+
}
|
1111
|
+
const elementToMetadata = (el, parentPath) => {
|
1112
|
+
const script = el.script && window.atob(el.script);
|
1113
|
+
const template = el.template && window.atob(el.template);
|
1114
|
+
const styles = el.styles && window.atob(el.styles);
|
1115
|
+
const exportedClassName = script && (EXPORTED_CLASS_REGEX.exec(script) ?? [])[1];
|
1116
|
+
if (!exportedClassName) {
|
1117
|
+
throw new Error("Script doesn't have exported class");
|
1118
|
+
}
|
1119
|
+
const elementMetadata = extractElementMetadata(script || '');
|
1120
|
+
const path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
|
1121
|
+
return {
|
1122
|
+
...elementMetadata,
|
1123
|
+
path,
|
1124
|
+
script: script?.replace(METADATA_DECORATOR_REGEX, 'export class'),
|
1125
|
+
template,
|
1126
|
+
styles,
|
1127
|
+
children: el.children.map(child => elementToMetadata(child, path)),
|
1128
|
+
};
|
1129
|
+
};
|
1130
|
+
const metadataToElement = (metadata, recursive = true) => {
|
1131
|
+
const cleanMetadata = omit(metadata, [
|
1132
|
+
'path',
|
1133
|
+
'template',
|
1134
|
+
'styles',
|
1135
|
+
'script',
|
1136
|
+
'metadata',
|
1137
|
+
]);
|
1138
|
+
const elMetadata = {
|
1139
|
+
...cleanMetadata,
|
1140
|
+
children: metadata.children.map(({ name }) => name),
|
1141
|
+
};
|
1142
|
+
const normalizedElMetadata = normalizeElementMetadata(elMetadata);
|
1143
|
+
if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
|
1144
|
+
throw new UiBuildError(`'${metadata.name}' component script is missing an exported class`, metadata);
|
1145
|
+
}
|
1146
|
+
const script = metadata.script &&
|
1147
|
+
window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, `@ElementDefinition(${stringifyElementMetadata(normalizedElMetadata)})\nexport class Script`));
|
1148
|
+
const template = metadata.template && window.btoa(metadata.template);
|
1149
|
+
const styles = metadata.styles && window.btoa(metadata.styles);
|
1150
|
+
return {
|
1151
|
+
script,
|
1152
|
+
template,
|
1153
|
+
styles,
|
1154
|
+
children: recursive ? metadata.children.map(meta => metadataToElement(meta)) : [],
|
1155
|
+
};
|
1156
|
+
};
|
1157
|
+
const normalizeElementMetadata = (elementMetadata) => {
|
1158
|
+
const metadata = { ...elementMetadata };
|
1159
|
+
// model
|
1160
|
+
const { lineItem, path } = metadata.model ?? {};
|
1161
|
+
const model = lineItem ? { lineItem } : path ? { path } : undefined;
|
1162
|
+
if (model) {
|
1163
|
+
metadata.model = model;
|
1164
|
+
}
|
1165
|
+
else {
|
1166
|
+
delete metadata.model;
|
1167
|
+
}
|
1168
|
+
// module
|
1169
|
+
if (!metadata.module) {
|
1170
|
+
delete metadata.module;
|
1171
|
+
}
|
1172
|
+
// reference
|
1173
|
+
if (!metadata.reference) {
|
1174
|
+
delete metadata.reference;
|
1175
|
+
}
|
1176
|
+
// inputs
|
1177
|
+
const inputs = Object.entries(metadata.inputs ?? {}).reduce((acc, [key, value]) => {
|
1178
|
+
return { ...acc, [key]: value || null };
|
1179
|
+
}, {});
|
1180
|
+
if (inputs && Object.keys(inputs).length > 0) {
|
1181
|
+
metadata.inputs = inputs;
|
1182
|
+
}
|
1183
|
+
else {
|
1184
|
+
delete metadata.inputs;
|
1185
|
+
}
|
1186
|
+
// outputs
|
1187
|
+
const outputs = Object.entries(metadata.outputs ?? {}).reduce((acc, [key, value]) => {
|
1188
|
+
return { ...acc, [key]: value || null };
|
1189
|
+
}, {});
|
1190
|
+
if (outputs && Object.keys(outputs).length > 0) {
|
1191
|
+
metadata.outputs = outputs;
|
1192
|
+
}
|
1193
|
+
else {
|
1194
|
+
delete metadata.outputs;
|
1195
|
+
}
|
1196
|
+
// children
|
1197
|
+
if (!metadata.children?.length) {
|
1198
|
+
delete metadata.children;
|
1199
|
+
}
|
1200
|
+
// isShared
|
1201
|
+
if (!metadata.isShared) {
|
1202
|
+
delete metadata.isShared;
|
1203
|
+
}
|
1204
|
+
// configuredStyles
|
1205
|
+
if (!metadata.configuredStyles) {
|
1206
|
+
delete metadata.configuredStyles;
|
1207
|
+
}
|
1208
|
+
return metadata;
|
1209
|
+
};
|
1210
|
+
const extractElementMetadata = (script) => {
|
1211
|
+
const metadataString = (METADATA_DECORATOR_REGEX.exec(script) ?? [])[1];
|
1212
|
+
// need to reset regex last index to prevent null result for next execution
|
1213
|
+
METADATA_DECORATOR_REGEX.lastIndex = 0;
|
1214
|
+
return new Function(`return ${metadataString}`)();
|
1215
|
+
};
|
1216
|
+
const extendElementMetadata = (script, extend) => {
|
1217
|
+
const metadataString = (METADATA_DECORATOR_REGEX.exec(script) ?? [])[1];
|
1218
|
+
// need to reset regex last index to prevent null result for next execution
|
1219
|
+
METADATA_DECORATOR_REGEX.lastIndex = 0;
|
1220
|
+
if (!metadataString) {
|
1221
|
+
return script;
|
1222
|
+
}
|
1223
|
+
const updated = { ...new Function(`return ${metadataString}`)(), ...extend };
|
1224
|
+
return script.replace(metadataString, stringifyElementMetadata(updated));
|
1225
|
+
};
|
1226
|
+
const getElementConfig = (type) => {
|
1227
|
+
return CONFIG[type];
|
1228
|
+
};
|
1229
|
+
const doesElementSupportIO = (type) => {
|
1230
|
+
return getElementConfig(type).plugins?.includes(IOPlugin) ?? false;
|
1231
|
+
};
|
1232
|
+
function stringifyElementMetadata(elementMetadata) {
|
1233
|
+
const cleaned = JSON.stringify(elementMetadata, null, 2);
|
1234
|
+
return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
|
1235
|
+
return match.replace(/"/g, '');
|
1236
|
+
});
|
1237
|
+
}
|
1238
|
+
const isValidScript = (script) => {
|
1239
|
+
if (!script) {
|
1240
|
+
return false;
|
1241
|
+
}
|
1242
|
+
const exportedClassName = script && (EXPORTED_CLASS_REGEX.exec(script) ?? [])[1];
|
1243
|
+
if (!exportedClassName) {
|
1244
|
+
return false;
|
1245
|
+
}
|
1246
|
+
const meta = extractElementMetadata(script);
|
1247
|
+
if (!meta.name || !meta.type) {
|
1248
|
+
return false;
|
1249
|
+
}
|
1250
|
+
return true;
|
1251
|
+
};
|
1252
|
+
function flattenElements(elements) {
|
1253
|
+
return flatten(elements.map(el => [el, ...flattenElements(el.children)]));
|
1254
|
+
}
|
1255
|
+
function isSharedElement(el) {
|
1256
|
+
return Boolean(el.isShared) && el.type !== 'REFERENCE';
|
1257
|
+
}
|
1258
|
+
|
1259
|
+
class ConfigurationPlugin {
|
1260
|
+
constructor(host) {
|
1261
|
+
this.host = host;
|
1262
|
+
this.destroy$ = new Subject();
|
1263
|
+
this.elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
1264
|
+
this.configurationService = this.host.injector.get(ConfigurationService);
|
1265
|
+
if (this.elementMetadata.model?.lineItem) {
|
1266
|
+
this.host.model$.pipe(takeUntil(this.destroy$)).subscribe(model => (this.modelSnapshot = model));
|
1267
|
+
const pathBlocks = parseBoundPath(this.elementMetadata.model?.lineItem);
|
1268
|
+
const { type, property, name } = pathBlocks.reverse()[0];
|
1269
|
+
this.host.boundName = name ?? type;
|
1270
|
+
this.register(type, property, name);
|
1271
|
+
}
|
1272
|
+
}
|
1273
|
+
ngOnDestroy() {
|
1274
|
+
this.destroy$.next();
|
1275
|
+
this.destroy$.complete();
|
1276
|
+
}
|
1277
|
+
register(type, property, name) {
|
1278
|
+
if (!type) {
|
1279
|
+
return;
|
1280
|
+
}
|
1281
|
+
if (!property) {
|
1282
|
+
this.registerType();
|
1283
|
+
}
|
1284
|
+
else if (property === 'ports' && name) {
|
1285
|
+
this.registerPort(name);
|
1286
|
+
}
|
1287
|
+
else if (property === 'attributes' && name) {
|
1288
|
+
this.registerAttribute(name);
|
1289
|
+
}
|
1290
|
+
}
|
1291
|
+
registerType() {
|
1292
|
+
const remove = () => {
|
1293
|
+
const rootLineItem = this.configurationService.getSnapshot();
|
1294
|
+
if (!rootLineItem || !this.modelSnapshot) {
|
1295
|
+
return;
|
1296
|
+
}
|
1297
|
+
this.configurationService.patch(new LineItemWorker(rootLineItem).remove(this.modelSnapshot.id).li);
|
1298
|
+
};
|
1299
|
+
const updateQty = (qty) => {
|
1300
|
+
const rootLineItem = this.configurationService.getSnapshot();
|
1301
|
+
if (!rootLineItem || !this.modelSnapshot) {
|
1302
|
+
return;
|
1303
|
+
}
|
1304
|
+
this.configurationService.patch(new LineItemWorker(rootLineItem).replace({ ...this.modelSnapshot, qty }).li);
|
1305
|
+
};
|
1306
|
+
this.typeHost.remove = remove;
|
1307
|
+
this.typeHost.updateQty = updateQty;
|
1308
|
+
}
|
1309
|
+
registerPort(name) {
|
1310
|
+
const model$ = this.host.model$;
|
1311
|
+
const portItems$ = model$.pipe(map(model => model?.lineItems.filter(li => li.port === this.host.boundName) ?? []));
|
1312
|
+
const portDomain$ = model$.pipe(map(model => model?.portDomains[this.host.boundName]));
|
1313
|
+
const add = (type, attributes = []) => {
|
1314
|
+
if (!this.modelSnapshot) {
|
1315
|
+
return;
|
1316
|
+
}
|
1317
|
+
const portDomain = this.modelSnapshot.portDomains[name];
|
1318
|
+
if (!portDomain) {
|
1319
|
+
return;
|
1320
|
+
}
|
1321
|
+
const generated = generateLineItem(portDomain.name, type, this.modelSnapshot.id, attributes);
|
1322
|
+
this.configurationService.patch(new LineItemWorker(this.modelSnapshot).insert(this.modelSnapshot.id, generated).li);
|
1323
|
+
};
|
1324
|
+
this.portHost.portItems$ = portItems$;
|
1325
|
+
this.portHost.portDomain$ = portDomain$;
|
1326
|
+
this.portHost.addPortItem = add;
|
1327
|
+
}
|
1328
|
+
registerAttribute(name) {
|
1329
|
+
if (!this.host.model$) {
|
1330
|
+
return;
|
1331
|
+
}
|
1332
|
+
const value$ = this.host.model$.pipe(map(model => getAttributeValue(model?.attributes ?? [], name)));
|
1333
|
+
const patch = (value) => {
|
1334
|
+
if (!this.modelSnapshot) {
|
1335
|
+
return;
|
1336
|
+
}
|
1337
|
+
this.configurationService.patch(new LineItemWorker(this.modelSnapshot).patchAttribute([{ name, value }]).li);
|
1338
|
+
};
|
1339
|
+
this.attributeHost.value$ = value$;
|
1340
|
+
this.attributeHost.patch = patch;
|
1341
|
+
}
|
1342
|
+
get attributeHost() {
|
1343
|
+
return this.host;
|
1344
|
+
}
|
1345
|
+
get typeHost() {
|
1346
|
+
return this.host;
|
1347
|
+
}
|
1348
|
+
get portHost() {
|
1349
|
+
return this.host;
|
1350
|
+
}
|
1351
|
+
}
|
1352
|
+
ConfigurationPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationPlugin, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
1353
|
+
ConfigurationPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: ConfigurationPlugin, ngImport: i0 });
|
1354
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ConfigurationPlugin, decorators: [{
|
1355
|
+
type: Directive
|
1356
|
+
}], ctorParameters: function () { return [{ type: undefined }]; } });
|
1357
|
+
|
1358
|
+
const DEFAULT_PLUGINS = {
|
1359
|
+
CONFIGURATION: [ConfigurationPlugin],
|
1360
|
+
DEFAULT: [],
|
1361
|
+
};
|
1362
|
+
|
1363
|
+
const LAYOUT = {
|
1364
|
+
LAYOUT_1: {
|
1365
|
+
styles: `
|
1366
|
+
/* start of LAYOUT_1 styles */
|
1367
|
+
:host {
|
1368
|
+
height: 100%;
|
1369
|
+
display: grid;
|
1370
|
+
grid:
|
1371
|
+
"header" auto
|
1372
|
+
"main" 1fr
|
1373
|
+
"footer" auto
|
1374
|
+
/ 1fr;
|
1375
|
+
gap: 10px;
|
1376
|
+
padding: 10px;
|
1377
|
+
}
|
1378
|
+
|
1379
|
+
:host ::ng-deep element-children > vl-cms-element-renderer {
|
1380
|
+
&:nth-child(1) > vl-element {
|
1381
|
+
min-height: 80px;
|
1382
|
+
grid-area: header;
|
1383
|
+
}
|
1384
|
+
|
1385
|
+
&:nth-child(2) > vl-element {
|
1386
|
+
grid-area: main;
|
1387
|
+
}
|
1388
|
+
|
1389
|
+
&:nth-child(3) > vl-element {
|
1390
|
+
min-height: 80px;
|
1391
|
+
grid-area: footer;
|
1392
|
+
}
|
1393
|
+
}
|
1394
|
+
/* end of LAYOUT_1 styles */
|
1395
|
+
`,
|
1396
|
+
},
|
1397
|
+
LAYOUT_2: {
|
1398
|
+
styles: `
|
1399
|
+
/* start of LAYOUT_2 styles */
|
1400
|
+
:host {
|
1401
|
+
height: 100%;
|
1402
|
+
display: grid;
|
1403
|
+
grid:
|
1404
|
+
"header header" auto
|
1405
|
+
"left right" 1fr
|
1406
|
+
"footer footer" auto
|
1407
|
+
/ 1fr 1fr;
|
1408
|
+
gap: 10px;
|
1409
|
+
padding: 10px;
|
1410
|
+
}
|
1411
|
+
|
1412
|
+
:host ::ng-deep element-children > vl-cms-element-renderer {
|
1413
|
+
&:nth-child(1) > vl-element {
|
1414
|
+
min-height: 80px;
|
1415
|
+
grid-area: header;
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
&:nth-child(2) > vl-element {
|
1419
|
+
grid-area: left;
|
1420
|
+
}
|
1421
|
+
|
1422
|
+
&:nth-child(3) > vl-element {
|
1423
|
+
grid-area: right;
|
1424
|
+
}
|
1425
|
+
|
1426
|
+
&:nth-child(4) > vl-element {
|
1427
|
+
min-height: 80px;
|
1428
|
+
grid-area: footer;
|
1429
|
+
}
|
1430
|
+
}
|
1431
|
+
/* end of LAYOUT_2 styles */
|
1432
|
+
`,
|
1433
|
+
},
|
1434
|
+
LAYOUT_3: {
|
1435
|
+
styles: `
|
1436
|
+
/* start of LAYOUT_3 styles */
|
1437
|
+
:host {
|
1438
|
+
height: 100%;
|
1439
|
+
display: grid;
|
1440
|
+
grid:
|
1441
|
+
"main" 1fr
|
1442
|
+
"footer" auto
|
1443
|
+
/ 1fr;
|
1444
|
+
gap: 10px;
|
1445
|
+
padding: 10px;
|
1446
|
+
}
|
1447
|
+
|
1448
|
+
:host ::ng-deep element-children > vl-cms-element-renderer {
|
1449
|
+
&:nth-child(1) > vl-element {
|
1450
|
+
grid-area: main;
|
1451
|
+
}
|
1452
|
+
|
1453
|
+
&:nth-child(2) > vl-element {
|
1454
|
+
min-height: 80px;
|
1455
|
+
grid-area: footer;
|
1456
|
+
}
|
1457
|
+
}
|
1458
|
+
/* end of LAYOUT_3 styles */
|
1459
|
+
`,
|
1460
|
+
},
|
1461
|
+
LAYOUT_4: {
|
1462
|
+
styles: `
|
1463
|
+
/* start of LAYOUT_4 styles */
|
1464
|
+
:host {
|
1465
|
+
height: 100%;
|
1466
|
+
display: grid;
|
1467
|
+
grid:
|
1468
|
+
"left right" 1fr
|
1469
|
+
"footer footer" auto
|
1470
|
+
/ auto auto;
|
1471
|
+
gap: 10px;
|
1472
|
+
padding: 10px;
|
1473
|
+
}
|
1474
|
+
|
1475
|
+
:host ::ng-deep element-children > vl-cms-element-renderer {
|
1476
|
+
&:nth-child(1) > vl-element {
|
1477
|
+
grid-area: left;
|
1478
|
+
}
|
1479
|
+
|
1480
|
+
&:nth-child(2) > vl-element {
|
1481
|
+
grid-area: right;
|
1482
|
+
}
|
1483
|
+
|
1484
|
+
&:nth-child(3) > vl-element {
|
1485
|
+
min-height: 80px;
|
1486
|
+
grid-area: footer;
|
1487
|
+
}
|
1488
|
+
}
|
1489
|
+
/* end of LAYOUT_4 styles */
|
1490
|
+
`,
|
1491
|
+
},
|
1492
|
+
LAYOUT_5: {
|
1493
|
+
styles: `
|
1494
|
+
/* start of LAYOUT_5 styles */
|
1495
|
+
:host {
|
1496
|
+
height: 100%;
|
1497
|
+
display: grid;
|
1498
|
+
grid:
|
1499
|
+
"header" auto
|
1500
|
+
"main" 1fr
|
1501
|
+
/ 1fr;
|
1502
|
+
gap: 10px;
|
1503
|
+
padding: 10px;
|
1504
|
+
}
|
1505
|
+
|
1506
|
+
:host ::ng-deep element-children > vl-cms-element-renderer {
|
1507
|
+
&:nth-child(1) > vl-element {
|
1508
|
+
min-height: 80px;
|
1509
|
+
grid-area: header;
|
1510
|
+
}
|
1511
|
+
|
1512
|
+
&:nth-child(2) > vl-element {
|
1513
|
+
grid-area: main;
|
1514
|
+
}
|
1515
|
+
}
|
1516
|
+
/* end of LAYOUT_5 styles */
|
1517
|
+
`,
|
1518
|
+
},
|
1519
|
+
LAYOUT_6: {
|
1520
|
+
styles: `
|
1521
|
+
/* start of LAYOUT_6 styles */
|
1522
|
+
:host {
|
1523
|
+
height: 100%;
|
1524
|
+
display: grid;
|
1525
|
+
grid:
|
1526
|
+
"main" 1fr
|
1527
|
+
/ 1fr;
|
1528
|
+
gap: 10px;
|
1529
|
+
padding: 10px;
|
1530
|
+
}
|
1531
|
+
|
1532
|
+
:host ::ng-deep element-children > vl-cms-element-renderer {
|
1533
|
+
&:nth-child(1) > vl-element {
|
1534
|
+
grid-area: main;
|
1535
|
+
}
|
1536
|
+
}
|
1537
|
+
/* end of LAYOUT_6 styles */
|
1538
|
+
`,
|
1539
|
+
},
|
1540
|
+
};
|
1541
|
+
|
1542
|
+
const VELOCE_LIBS = {
|
1543
|
+
'@veloceapps/core': {
|
1544
|
+
isDefined,
|
1545
|
+
Operator,
|
1546
|
+
Predicate,
|
1547
|
+
parseJsonSafely,
|
1548
|
+
},
|
1549
|
+
'@veloceapps/components': {
|
1550
|
+
ToastService,
|
1551
|
+
},
|
1552
|
+
'@veloceapps/api': {
|
1553
|
+
SalesforceApiService,
|
1554
|
+
QuoteApiService,
|
1555
|
+
DocumentTemplatesApiService,
|
1556
|
+
DocumentAttachmentApiService,
|
1557
|
+
RampApiService,
|
1558
|
+
CatalogApiService,
|
1559
|
+
DeltaApiService,
|
1560
|
+
PicklistsApiService,
|
1561
|
+
PriceApiService,
|
1562
|
+
ShoppingCartSettingsApiService,
|
1563
|
+
ConfigurationSettingsApiService,
|
1564
|
+
GuidedSellingApiService,
|
1565
|
+
},
|
1566
|
+
'@veloceapps/sdk/core': {
|
1567
|
+
ConfigurationService,
|
1568
|
+
QuoteDraftService,
|
1569
|
+
FlowConfigurationService,
|
1570
|
+
LineItemWorker,
|
1571
|
+
ProductImagesService,
|
1572
|
+
ContextService,
|
1573
|
+
...lineItemUtils,
|
1574
|
+
},
|
1575
|
+
'@veloceapps/sdk/cms': {
|
1576
|
+
...cmsInjectionTokens,
|
1577
|
+
...cmsActions,
|
1578
|
+
TemplatesService,
|
1579
|
+
IntegrationState,
|
1580
|
+
ResourcesService,
|
1581
|
+
},
|
1582
|
+
};
|
1583
|
+
const VELOCE_LIBS_BACKWARDS_COMPATIBLE = Object.entries(VELOCE_LIBS).reduce((trunk, [key, value]) => ({ ...trunk, [key.replace('@veloceapps/', '@veloce/')]: value }), {});
|
1584
|
+
const vendorMap = {
|
1585
|
+
...VELOCE_LIBS,
|
1586
|
+
// TODO: remove when projects/demos are migrated to @veloceapps organization libraries
|
1587
|
+
...VELOCE_LIBS_BACKWARDS_COMPATIBLE,
|
1588
|
+
'@angular/core': i0,
|
1589
|
+
'@angular/forms': angularForms,
|
1590
|
+
rxjs: rxjs,
|
1591
|
+
'rxjs/operators': rxjsOperators,
|
1592
|
+
lodash: lodash,
|
1593
|
+
};
|
1594
|
+
|
1595
|
+
class ElementsResolver {
|
1596
|
+
constructor(uiDef, elements, sharedElements = []) {
|
1597
|
+
this.uiDef = uiDef;
|
1598
|
+
this.renderableElements = [];
|
1599
|
+
this.sharedElements = [];
|
1600
|
+
const transpiledElements = this.transpileScripts(elements);
|
1601
|
+
const transpiledSharedElements = this.transpileScripts(sharedElements);
|
1602
|
+
this.sharedElements = this.flattenElements(transpiledElements)
|
1603
|
+
.filter(el => this.isSharedElement(el))
|
1604
|
+
.concat(transpiledSharedElements);
|
1605
|
+
this.elements = transpiledElements.map(el => this.processElementMetadata(el)).filter(isDefined);
|
1606
|
+
this.renderableElements = this.getRenderableElements(this.elements);
|
1607
|
+
}
|
1608
|
+
addElement(element) {
|
1609
|
+
if (element.isShared) {
|
1610
|
+
return;
|
1611
|
+
}
|
1612
|
+
const transpiledElements = this.transpileScripts([element]);
|
1613
|
+
this.elements = transpiledElements.map(el => this.processElementMetadata(el)).filter(isDefined);
|
1614
|
+
this.renderableElements = this.getRenderableElements(this.elements);
|
1615
|
+
}
|
1616
|
+
getNgComponents() {
|
1617
|
+
return this.renderableElements.map(el => this.resolveElement(el)).filter(isDefined);
|
1618
|
+
}
|
1619
|
+
transpile(el) {
|
1620
|
+
if (!el.script) {
|
1621
|
+
return;
|
1622
|
+
}
|
1623
|
+
const transformed = transform(el.script, {
|
1624
|
+
filename: el.name + '.ts',
|
1625
|
+
presets: ['typescript'],
|
1626
|
+
sourceMaps: 'inline',
|
1627
|
+
});
|
1628
|
+
return transformed.code ?? undefined;
|
1629
|
+
}
|
1630
|
+
transpileScripts(elements) {
|
1631
|
+
return elements.map(el => ({
|
1632
|
+
...el,
|
1633
|
+
script: this.transpile(el),
|
1634
|
+
children: this.transpileScripts(el.children),
|
1635
|
+
}));
|
1636
|
+
}
|
1637
|
+
flattenElements(elements) {
|
1638
|
+
return flatten(elements.map(el => [el, ...this.flattenElements(el.children)]));
|
1639
|
+
}
|
1640
|
+
isSharedElement(el) {
|
1641
|
+
return Boolean(el.isShared) && el.type !== 'REFERENCE';
|
1642
|
+
}
|
1643
|
+
getRenderableElements(elements) {
|
1644
|
+
const renderable = [];
|
1645
|
+
for (const el of elements) {
|
1646
|
+
if (!this.isSharedElement(el)) {
|
1647
|
+
const children = el.children.filter(child => !this.isSharedElement(child));
|
1648
|
+
const renderableChildren = this.getRenderableElements(children);
|
1649
|
+
renderable.push({ ...el, children }, ...renderableChildren);
|
1650
|
+
}
|
1651
|
+
}
|
1652
|
+
return renderable;
|
1653
|
+
}
|
1654
|
+
getSharedElement(element) {
|
1655
|
+
if (!element.reference) {
|
1656
|
+
return;
|
1657
|
+
}
|
1658
|
+
return this.sharedElements.find(el => element.reference === el.name);
|
1659
|
+
}
|
1660
|
+
resolveElementTemplate(element) {
|
1661
|
+
const config = CONFIG[element.type];
|
1662
|
+
const template = !config.suppressTemplate ? element.template : '';
|
1663
|
+
return template || config.defaultTemplate || '';
|
1664
|
+
}
|
1665
|
+
resolveElementStyles(element) {
|
1666
|
+
const config = CONFIG[element.type];
|
1667
|
+
let styles = !config.suppressStyles ? element.styles ?? '' : '';
|
1668
|
+
const layout = element.layout && LAYOUT[element.layout];
|
1669
|
+
if (layout?.styles) {
|
1670
|
+
styles += layout.styles;
|
1671
|
+
}
|
1672
|
+
return styles;
|
1673
|
+
}
|
1674
|
+
processElementMetadata(sourceElement) {
|
1675
|
+
let finalElement;
|
1676
|
+
if (sourceElement.type === 'REFERENCE') {
|
1677
|
+
const sharedElement = this.getSharedElement(sourceElement);
|
1678
|
+
if (!sharedElement) {
|
1679
|
+
console.warn(`Shared element "${sourceElement.reference}" not found`);
|
1680
|
+
return;
|
1681
|
+
}
|
1682
|
+
finalElement = {
|
1683
|
+
...sourceElement,
|
1684
|
+
children: this.getSharedChildren(sharedElement.children, sourceElement.path),
|
1685
|
+
type: sharedElement.type,
|
1686
|
+
template: sharedElement.template,
|
1687
|
+
styles: (sharedElement.styles ?? '') + '\n' + (sourceElement.styles ?? ''),
|
1688
|
+
inputs: {
|
1689
|
+
...sharedElement.inputs,
|
1690
|
+
...sourceElement.inputs,
|
1691
|
+
},
|
1692
|
+
outputs: {
|
1693
|
+
...sharedElement.outputs,
|
1694
|
+
...sourceElement.outputs,
|
1695
|
+
},
|
1696
|
+
};
|
1697
|
+
}
|
1698
|
+
else {
|
1699
|
+
finalElement = sourceElement;
|
1700
|
+
delete sourceElement.reference;
|
1701
|
+
}
|
1702
|
+
finalElement.template = this.resolveElementTemplate(finalElement);
|
1703
|
+
finalElement.styles = this.resolveElementStyles(finalElement);
|
1704
|
+
return {
|
1705
|
+
...finalElement,
|
1706
|
+
children: finalElement.children.map(child => this.processElementMetadata(child)).filter(isDefined),
|
1707
|
+
};
|
1708
|
+
}
|
1709
|
+
getSharedChildren(children, parentPath) {
|
1710
|
+
return children.map(c => {
|
1711
|
+
if (!c.path) {
|
1712
|
+
return c;
|
1713
|
+
}
|
1714
|
+
const [elName] = c.path.split('/').reverse();
|
1715
|
+
const path = parentPath + '/' + elName;
|
1716
|
+
return {
|
1717
|
+
...c,
|
1718
|
+
path,
|
1719
|
+
children: this.getSharedChildren(c.children, path),
|
1720
|
+
};
|
1721
|
+
});
|
1722
|
+
}
|
1723
|
+
resolveElement(element) {
|
1724
|
+
const config = CONFIG[element.type];
|
1725
|
+
const defaultPlugins = DEFAULT_PLUGINS[this.uiDef.type] ?? [];
|
1726
|
+
if (!config) {
|
1727
|
+
console.warn(`Unknown element type "${element.type}"`);
|
1728
|
+
return;
|
1729
|
+
}
|
1730
|
+
const styles = this.getElementStyles(element);
|
1731
|
+
const component = {
|
1732
|
+
selector: 'vl-element',
|
1733
|
+
template: element.template,
|
1734
|
+
...(styles ? { styles: [styles] } : {}),
|
1735
|
+
providers: [
|
1736
|
+
{ provide: DEFAULT_PLUGINS_TOKEN, useValue: defaultPlugins },
|
1737
|
+
{ provide: UI_DEFINITION_METADATA, useValue: this.uiDef },
|
1738
|
+
{ provide: ELEMENT_METADATA, useValue: element },
|
1739
|
+
{ provide: SHARED_ELEMENT_METADATA, useValue: this.getSharedElement(element) },
|
1740
|
+
{ provide: ELEMENT_CONFIG, useValue: config },
|
1741
|
+
{ provide: VENDOR_MAP, useValue: vendorMap },
|
1742
|
+
],
|
1743
|
+
};
|
1744
|
+
const cmp = Component(component)(class C extends config.component {
|
1745
|
+
});
|
1746
|
+
set(cmp, 'path', element.path);
|
1747
|
+
return cmp;
|
1748
|
+
}
|
1749
|
+
getElementStyles(element) {
|
1750
|
+
let result = '';
|
1751
|
+
const configuredStyles = this.convertInlineStylesToCSS(element.configuredStyles);
|
1752
|
+
if (configuredStyles) {
|
1753
|
+
// order is important: styles written by user in CSS code should has higher priority
|
1754
|
+
result += configuredStyles;
|
1755
|
+
}
|
1756
|
+
if (element.styles) {
|
1757
|
+
result += element.styles;
|
1758
|
+
}
|
1759
|
+
return result || undefined;
|
1760
|
+
}
|
1761
|
+
convertInlineStylesToCSS(styles) {
|
1762
|
+
if (!styles) {
|
1763
|
+
return '';
|
1764
|
+
}
|
1765
|
+
const entries = Object.entries(styles);
|
1766
|
+
let result = ':host {\n';
|
1767
|
+
entries.forEach(([style, value]) => {
|
1768
|
+
result += ` ${kebabCase(style)}:${value};\n`;
|
1769
|
+
});
|
1770
|
+
result += '}\n';
|
1771
|
+
return result;
|
1772
|
+
}
|
1773
|
+
}
|
1774
|
+
|
1775
|
+
class FederatedHostDirective {
|
1776
|
+
constructor(viewContainerRef) {
|
1777
|
+
this.viewContainerRef = viewContainerRef;
|
1778
|
+
}
|
1779
|
+
}
|
1780
|
+
FederatedHostDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FederatedHostDirective, deps: [{ token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Directive });
|
1781
|
+
FederatedHostDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.8", type: FederatedHostDirective, selector: "[vlFederatedHost]", ngImport: i0 });
|
1782
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FederatedHostDirective, decorators: [{
|
1783
|
+
type: Directive,
|
1784
|
+
args: [{
|
1785
|
+
selector: '[vlFederatedHost]',
|
1786
|
+
}]
|
1787
|
+
}], ctorParameters: function () { return [{ type: i0.ViewContainerRef }]; } });
|
1788
|
+
|
1789
|
+
const defaultOptions = {
|
1790
|
+
suppressLoading: false,
|
1791
|
+
loadingLabel: 'LOADING',
|
1792
|
+
};
|
1793
|
+
|
1794
|
+
class FederatedComponent {
|
1795
|
+
constructor(injector) {
|
1796
|
+
this.injector = injector;
|
1797
|
+
this.isLoading$ = new BehaviorSubject(false);
|
1798
|
+
// configs
|
1799
|
+
this.suppressLoading = defaultOptions.suppressLoading;
|
1800
|
+
this.loadingLabel = defaultOptions.loadingLabel;
|
1801
|
+
}
|
1802
|
+
ngOnChanges(changes) {
|
1803
|
+
if (changes['data'] && this.instance) {
|
1804
|
+
this.instance.data = this.data;
|
1805
|
+
}
|
1806
|
+
if (changes['options']) {
|
1807
|
+
this.suppressLoading = this.options?.suppressLoading ?? defaultOptions.suppressLoading;
|
1808
|
+
this.loadingLabel = this.options?.loadingLabel ?? defaultOptions.loadingLabel;
|
1809
|
+
}
|
1810
|
+
}
|
1811
|
+
ngOnInit() {
|
1812
|
+
this.isLoading$.next(true);
|
1813
|
+
}
|
1814
|
+
ngAfterViewInit() {
|
1815
|
+
const remoteEntry = this.options?.remoteEntry ?? this.remoteEntry;
|
1816
|
+
const exposedModule = this.options?.exposedModule ?? this.exposedModule;
|
1817
|
+
if (!remoteEntry || !exposedModule) {
|
1818
|
+
return;
|
1819
|
+
}
|
1820
|
+
loadRemoteModule({ type: 'module', remoteEntry, exposedModule }).then(federated => {
|
1821
|
+
const moduleRef = createNgModule(federated[exposedModule], this.injector);
|
1822
|
+
const componentRef = this.host.viewContainerRef.createComponent(federated[exposedModule].rootComponent, { ngModuleRef: moduleRef });
|
1823
|
+
componentRef.instance.data = this.data;
|
1824
|
+
this.options?.onReady?.();
|
1825
|
+
this.isLoading$.next(false);
|
1826
|
+
});
|
1827
|
+
}
|
1828
|
+
}
|
1829
|
+
FederatedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FederatedComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
|
1830
|
+
FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "host", first: true, predicate: FederatedHostDirective, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-template vlFederatedHost></ng-template>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "directive", type: FederatedHostDirective, selector: "[vlFederatedHost]" }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1831
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FederatedComponent, decorators: [{
|
1832
|
+
type: Component,
|
1833
|
+
args: [{ selector: 'veloce-host-federated', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vlFederatedHost></ng-template>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"] }]
|
1834
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }]; }, propDecorators: { host: [{
|
1835
|
+
type: ViewChild,
|
1836
|
+
args: [FederatedHostDirective, { static: true }]
|
1837
|
+
}], remoteEntry: [{
|
1838
|
+
type: Input
|
1839
|
+
}], remoteName: [{
|
1840
|
+
type: Input
|
1841
|
+
}], exposedModule: [{
|
1842
|
+
type: Input
|
1843
|
+
}], data: [{
|
1844
|
+
type: Input
|
1845
|
+
}], options: [{
|
1846
|
+
type: Input
|
1847
|
+
}] } });
|
1848
|
+
|
1849
|
+
class FederatedModule {
|
1850
|
+
}
|
1851
|
+
FederatedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FederatedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1852
|
+
FederatedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: FederatedModule, declarations: [FederatedComponent, FederatedHostDirective], imports: [CommonModule, LoaderModule], exports: [FederatedComponent] });
|
1853
|
+
FederatedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FederatedModule, imports: [CommonModule, LoaderModule] });
|
1854
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FederatedModule, decorators: [{
|
1855
|
+
type: NgModule,
|
1856
|
+
args: [{
|
1857
|
+
declarations: [FederatedComponent, FederatedHostDirective],
|
1858
|
+
imports: [CommonModule, LoaderModule],
|
1859
|
+
exports: [FederatedComponent],
|
1860
|
+
}]
|
1861
|
+
}] });
|
1862
|
+
|
1863
|
+
class CompilationService {
|
1864
|
+
constructor(compiler) {
|
1865
|
+
this.compiler = compiler;
|
1866
|
+
}
|
1867
|
+
compileUIDefinition$(uiDefinition) {
|
1868
|
+
return of([]).pipe(switchMap(() => {
|
1869
|
+
const { children, pages, components, ...uiDefinitionMeta } = uiDefinition;
|
1870
|
+
this.uiDefinitionMeta = uiDefinitionMeta;
|
1871
|
+
const elements = [...(children ?? []), ...(pages ?? [])];
|
1872
|
+
const sharedElements = components ?? [];
|
1873
|
+
const metadata = elements.map(element => elementToMetadata(element));
|
1874
|
+
const sharedMetadata = sharedElements.map(element => elementToMetadata(element));
|
1875
|
+
this.elementsResolver = new ElementsResolver(uiDefinition, metadata, sharedMetadata);
|
1876
|
+
const module = this.getModule(this.elementsResolver.getNgComponents());
|
1877
|
+
return combineLatest([
|
1878
|
+
from(this.compiler.compileModuleAndAllComponentsAsync(module)),
|
1879
|
+
of(this.elementsResolver),
|
1880
|
+
]);
|
1881
|
+
}), map(([module, elementsResolver]) => ({ module, elements: elementsResolver.elements })));
|
1882
|
+
}
|
1883
|
+
compileElement$(element) {
|
1884
|
+
if (!this.uiDefinitionMeta) {
|
1885
|
+
throw 'No UI Definition context';
|
1886
|
+
}
|
1887
|
+
return of(this.uiDefinitionMeta).pipe(switchMap(uiDefinition => {
|
1888
|
+
const elementsResolver = this.elementsResolver ?? new ElementsResolver(uiDefinition, []);
|
1889
|
+
elementsResolver.addElement(element);
|
1890
|
+
const module = this.getModule(elementsResolver.getNgComponents());
|
1891
|
+
return combineLatest([from(this.compiler.compileModuleAndAllComponentsAsync(module)), of(elementsResolver)]);
|
1892
|
+
}), map(([module, elementsResolver]) => ({ module, elements: elementsResolver.elements })));
|
1893
|
+
}
|
1894
|
+
clearModuleCache(modules) {
|
1895
|
+
modules.forEach(module => this.compiler.clearCacheFor(module));
|
1896
|
+
this.uiDefinitionMeta = undefined;
|
1897
|
+
}
|
1898
|
+
getModule(components) {
|
1899
|
+
const staticComponents = [
|
1900
|
+
ElementChildrenComponent,
|
1901
|
+
ElementRendererComponent,
|
1902
|
+
ElementDropHandleComponent,
|
1903
|
+
CustomTemplateDirective,
|
1904
|
+
];
|
1905
|
+
let DynamicModule = class DynamicModule {
|
1906
|
+
};
|
1907
|
+
DynamicModule = __decorate([
|
1908
|
+
NgModule({
|
1909
|
+
imports: [
|
1910
|
+
CommonModule,
|
1911
|
+
FormsModule,
|
1912
|
+
ReactiveFormsModule,
|
1913
|
+
FederatedModule,
|
1914
|
+
DragDropModule,
|
1915
|
+
DndModule,
|
1916
|
+
ScrollingModule,
|
1917
|
+
],
|
1918
|
+
declarations: [...staticComponents, ...components],
|
1919
|
+
jit: true,
|
1920
|
+
})
|
1921
|
+
], DynamicModule);
|
1922
|
+
return DynamicModule;
|
1923
|
+
}
|
1924
|
+
}
|
1925
|
+
CompilationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CompilationService, deps: [{ token: i0.Compiler }], target: i0.ɵɵFactoryTarget.Injectable });
|
1926
|
+
CompilationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CompilationService });
|
1927
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: CompilationService, decorators: [{
|
1928
|
+
type: Injectable
|
1929
|
+
}], ctorParameters: function () { return [{ type: i0.Compiler }]; } });
|
1930
|
+
|
1931
|
+
class RuntimeModule {
|
1932
|
+
}
|
1933
|
+
RuntimeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1934
|
+
RuntimeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: RuntimeModule, imports: [CommonModule, CoreModule] });
|
1935
|
+
RuntimeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeModule, providers: [
|
1936
|
+
DialogService,
|
1937
|
+
RuntimeService,
|
1938
|
+
RuntimeEditorService,
|
1939
|
+
{ provide: CMS_COMPILATION_SERVICE, useClass: CompilationService },
|
1940
|
+
], imports: [CommonModule, CoreModule] });
|
1941
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: RuntimeModule, decorators: [{
|
1942
|
+
type: NgModule,
|
1943
|
+
args: [{
|
1944
|
+
imports: [CommonModule, CoreModule],
|
1945
|
+
providers: [
|
1946
|
+
DialogService,
|
1947
|
+
RuntimeService,
|
1948
|
+
RuntimeEditorService,
|
1949
|
+
{ provide: CMS_COMPILATION_SERVICE, useClass: CompilationService },
|
1950
|
+
],
|
1951
|
+
}]
|
1952
|
+
}] });
|
1953
|
+
|
1954
|
+
class LauncherModule {
|
1955
|
+
}
|
1956
|
+
LauncherModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: LauncherModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1957
|
+
LauncherModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: LauncherModule, imports: [CommonModule, CoreModule, ApiModule, SdkCoreModule, RuntimeModule, PreviewModule], exports: [PreviewModule] });
|
1958
|
+
LauncherModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: LauncherModule, providers: [IntegrationState, DialogService, ResourcesService], imports: [CommonModule, CoreModule, ApiModule, SdkCoreModule, RuntimeModule, PreviewModule, PreviewModule] });
|
1959
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: LauncherModule, decorators: [{
|
1960
|
+
type: NgModule,
|
1961
|
+
args: [{
|
1962
|
+
imports: [CommonModule, CoreModule, ApiModule, SdkCoreModule, RuntimeModule, PreviewModule],
|
1963
|
+
providers: [IntegrationState, DialogService, ResourcesService],
|
1964
|
+
exports: [PreviewModule],
|
1965
|
+
}]
|
1966
|
+
}] });
|
1967
|
+
|
1968
|
+
const migrations = {
|
1969
|
+
2: () => {
|
1970
|
+
throw 'Migration from Legacy UI definition is not possible';
|
1971
|
+
},
|
1972
|
+
3: uiDef => {
|
1973
|
+
const children = uiDef.children ?? [];
|
1974
|
+
return {
|
1975
|
+
...uiDef,
|
1976
|
+
children: undefined,
|
1977
|
+
pages: children,
|
1978
|
+
version: 3,
|
1979
|
+
};
|
1980
|
+
},
|
1981
|
+
};
|
1982
|
+
|
1983
|
+
class MigrationsService {
|
1984
|
+
constructor(toastService) {
|
1985
|
+
this.toastService = toastService;
|
1986
|
+
}
|
1987
|
+
migrateUIDefinition(uiDef) {
|
1988
|
+
const currentVersion = uiDef.version;
|
1989
|
+
const targetVersion = UI_DEFINITION_VERSION;
|
1990
|
+
const migrateVersions = Object.keys(migrations)
|
1991
|
+
.reduce((acc, version) => {
|
1992
|
+
const v = Number(version);
|
1993
|
+
if (v > currentVersion && v <= targetVersion) {
|
1994
|
+
acc.push(v);
|
1995
|
+
}
|
1996
|
+
return acc;
|
1997
|
+
}, [])
|
1998
|
+
.sort();
|
1999
|
+
try {
|
2000
|
+
let result = cloneDeep(uiDef);
|
2001
|
+
for (const version of migrateVersions) {
|
2002
|
+
result = migrations[version](result);
|
2003
|
+
}
|
2004
|
+
return result;
|
2005
|
+
}
|
2006
|
+
catch (e) {
|
2007
|
+
this.toastService.add({ summary: String(e), severity: ToastType.error });
|
2008
|
+
return;
|
2009
|
+
}
|
2010
|
+
}
|
2011
|
+
}
|
2012
|
+
MigrationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MigrationsService, deps: [{ token: i1.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2013
|
+
MigrationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MigrationsService, providedIn: 'root' });
|
2014
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MigrationsService, decorators: [{
|
2015
|
+
type: Injectable,
|
2016
|
+
args: [{ providedIn: 'root' }]
|
2017
|
+
}], ctorParameters: function () { return [{ type: i1.ToastService }]; } });
|
2018
|
+
|
2019
|
+
class MigrationsModule {
|
2020
|
+
}
|
2021
|
+
MigrationsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MigrationsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
2022
|
+
MigrationsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.8", ngImport: i0, type: MigrationsModule });
|
2023
|
+
MigrationsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MigrationsModule, providers: [MigrationsService] });
|
2024
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MigrationsModule, decorators: [{
|
2025
|
+
type: NgModule,
|
2026
|
+
args: [{
|
2027
|
+
providers: [MigrationsService],
|
2028
|
+
}]
|
2029
|
+
}] });
|
2030
|
+
|
2031
|
+
/**
|
2032
|
+
* Generated bundle index. Do not edit.
|
2033
|
+
*/
|
2034
|
+
|
2035
|
+
export { ApplyProductConfigurationAction, CloseDocGenAction, CmsAction, ConfigureProductAction, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, ElementsResolver, FlowAction, IntegrationState, LauncherModule, MigrationsModule, MigrationsService, NavigateBackAction, NavigateToCatalogAction, OpenDocGenAction, PreviewComponent, PreviewModule, RemoteApplyAction, RemoteCancelAction, ResourcesService, RuntimeEditorService, RuntimeModule, SHARED_ELEMENT_METADATA, SwitchObjectAction, TemplatesService, UI_DEFINITION_METADATA, UiBuildError, VENDOR_MAP, doesElementSupportIO, elementToMetadata, extendElementMetadata, extractElementMetadata, findElementByModule, findElementByPath, flattenElements, getAbsolutePath, getElementConfig, getElementUniqueName, insertElement, isSharedElement, isValidScript, metadataToElement, normalizeElementMetadata, parseBoundPath, parsePath, removeElement, stringifyElementMetadata };
|
2036
|
+
//# sourceMappingURL=veloceapps-sdk-cms.mjs.map
|