@veloceapps/sdk 5.0.13-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/bundles/veloceapps-sdk-cms.umd.js +1975 -0
- package/bundles/veloceapps-sdk-cms.umd.js.map +1 -0
- package/bundles/veloceapps-sdk-core.umd.js +1610 -0
- package/bundles/veloceapps-sdk-core.umd.js.map +1 -0
- package/bundles/veloceapps-sdk-runtime.umd.js +4349 -0
- package/bundles/veloceapps-sdk-runtime.umd.js.map +1 -0
- package/bundles/veloceapps-sdk.umd.js +3307 -0
- package/bundles/veloceapps-sdk.umd.js.map +1 -0
- package/cms/cms.actions.d.ts +28 -0
- package/cms/cms.default.d.ts +5 -0
- package/cms/cms.elements.d.ts +4 -0
- package/cms/components/element-children/element-children.component.d.ts +10 -0
- package/cms/components/element-children/element-children.module.d.ts +8 -0
- package/cms/components/element-renderer/element-renderer.component.d.ts +36 -0
- package/cms/components/element-renderer/element-renderer.module.d.ts +7 -0
- package/cms/components/element.component.d.ts +17 -0
- package/cms/components/index.d.ts +1 -0
- package/cms/components/plugin.component.d.ts +15 -0
- package/cms/components/preview/index.d.ts +2 -0
- package/cms/components/preview/preview.component.d.ts +34 -0
- package/cms/components/preview/preview.module.d.ts +11 -0
- package/cms/decorators/element.decorator.d.ts +2 -0
- package/cms/decorators/index.d.ts +1 -0
- package/cms/directives/custom-template.directive.d.ts +12 -0
- package/cms/engine/models/entity.d.ts +11 -0
- package/cms/engine/models/plugin.d.ts +5 -0
- package/cms/index.d.ts +11 -0
- package/cms/injection-tokens.d.ts +11 -0
- package/cms/launcher.module.d.ts +10 -0
- package/cms/modules/federated/default-options.d.ts +4 -0
- package/cms/modules/federated/export.d.ts +1 -0
- package/cms/modules/federated/federated.component.d.ts +26 -0
- package/cms/modules/federated/federated.module.d.ts +9 -0
- package/cms/modules/federated/federated.types.d.ts +30 -0
- package/cms/modules/federated/federated.utils.d.ts +1 -0
- package/cms/package.json +10 -0
- package/cms/plugins/configuration.plugin.d.ts +23 -0
- package/cms/plugins/io.plugin.d.ts +9 -0
- package/cms/plugins/script.plugin.d.ts +13 -0
- package/cms/services/dynamic-module.service.d.ts +15 -0
- package/cms/services/element-context.service.d.ts +8 -0
- package/cms/services/index.d.ts +3 -0
- package/cms/services/integration.state.d.ts +17 -0
- package/cms/services/io-provider.service.d.ts +15 -0
- package/cms/services/launcher.service.d.ts +18 -0
- package/cms/services/templates.service.d.ts +14 -0
- package/cms/types/common.types.d.ts +108 -0
- package/cms/types/compilation.types.d.ts +6 -0
- package/cms/types/configuration.types.d.ts +20 -0
- package/cms/types/elements.types.d.ts +2 -0
- package/cms/types/index.d.ts +7 -0
- package/cms/types/integration.types.d.ts +4 -0
- package/cms/types/metrics.types.d.ts +5 -0
- package/cms/types/path.types.d.ts +11 -0
- package/cms/utils/element.utils.d.ts +17 -0
- package/cms/utils/elements-resolver.d.ts +24 -0
- package/cms/utils/index.d.ts +3 -0
- package/cms/utils/path.utils.d.ts +5 -0
- package/cms/veloceapps-sdk-cms.d.ts +5 -0
- package/cms/vendor-map.d.ts +708 -0
- package/core/core.module.d.ts +8 -0
- package/core/index.d.ts +6 -0
- package/core/modules/configuration/configuration.module.d.ts +7 -0
- package/core/modules/configuration/helpers.d.ts +3 -0
- package/core/modules/configuration/index.d.ts +4 -0
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +29 -0
- package/core/modules/configuration/services/configuration.service.d.ts +45 -0
- package/core/modules/configuration/services/runtime-context.service.d.ts +12 -0
- package/core/modules/configuration/types/configuration-runtime.types.d.ts +7 -0
- package/core/modules/flow-configuration/flow-configuration.module.d.ts +6 -0
- package/core/modules/flow-configuration/index.d.ts +4 -0
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +38 -0
- package/core/modules/flow-configuration/services/flow-update.service.d.ts +12 -0
- package/core/modules/flow-configuration/types/update.types.d.ts +12 -0
- package/core/modules/index.d.ts +2 -0
- package/core/package.json +10 -0
- package/core/services/context.service.d.ts +18 -0
- package/core/services/index.d.ts +3 -0
- package/core/services/product-images.service.d.ts +12 -0
- package/core/services/quote-draft.service.d.ts +62 -0
- package/core/types/index.d.ts +3 -0
- package/core/types/quote-states.types.d.ts +6 -0
- package/core/types/runtime.types.d.ts +31 -0
- package/core/types/ui-definition.types.d.ts +26 -0
- package/core/utils/index.d.ts +2 -0
- package/core/utils/line-item.utils.d.ts +26 -0
- package/core/utils/line-item.worker.d.ts +12 -0
- package/core/veloceapps-sdk-core.d.ts +5 -0
- package/esm2015/cms/cms.actions.js +47 -0
- package/esm2015/cms/cms.default.js +6 -0
- package/esm2015/cms/cms.elements.js +29 -0
- package/esm2015/cms/components/element-children/element-children.component.js +23 -0
- package/esm2015/cms/components/element-children/element-children.module.js +18 -0
- package/esm2015/cms/components/element-renderer/element-renderer.component.js +169 -0
- package/esm2015/cms/components/element-renderer/element-renderer.module.js +16 -0
- package/esm2015/cms/components/element.component.js +44 -0
- package/esm2015/cms/components/index.js +2 -0
- package/esm2015/cms/components/plugin.component.js +16 -0
- package/esm2015/cms/components/preview/index.js +3 -0
- package/esm2015/cms/components/preview/preview.component.js +108 -0
- package/esm2015/cms/components/preview/preview.module.js +23 -0
- package/esm2015/cms/decorators/element.decorator.js +6 -0
- package/esm2015/cms/decorators/index.js +2 -0
- package/esm2015/cms/directives/custom-template.directive.js +25 -0
- package/esm2015/cms/engine/models/entity.js +18 -0
- package/esm2015/cms/engine/models/plugin.js +6 -0
- package/esm2015/cms/index.js +11 -0
- package/esm2015/cms/injection-tokens.js +8 -0
- package/esm2015/cms/launcher.module.js +23 -0
- package/esm2015/cms/modules/federated/default-options.js +5 -0
- package/esm2015/cms/modules/federated/export.js +2 -0
- package/esm2015/cms/modules/federated/federated.component.js +82 -0
- package/esm2015/cms/modules/federated/federated.module.js +19 -0
- package/esm2015/cms/modules/federated/federated.types.js +2 -0
- package/esm2015/cms/modules/federated/federated.utils.js +37 -0
- package/esm2015/cms/plugins/configuration.plugin.js +98 -0
- package/esm2015/cms/plugins/io.plugin.js +37 -0
- package/esm2015/cms/plugins/script.plugin.js +66 -0
- package/esm2015/cms/services/dynamic-module.service.js +33 -0
- package/esm2015/cms/services/element-context.service.js +10 -0
- package/esm2015/cms/services/index.js +4 -0
- package/esm2015/cms/services/integration.state.js +40 -0
- package/esm2015/cms/services/io-provider.service.js +51 -0
- package/esm2015/cms/services/launcher.service.js +57 -0
- package/esm2015/cms/services/templates.service.js +31 -0
- package/esm2015/cms/types/common.types.js +2 -0
- package/esm2015/cms/types/compilation.types.js +2 -0
- package/esm2015/cms/types/configuration.types.js +2 -0
- package/esm2015/cms/types/elements.types.js +2 -0
- package/esm2015/cms/types/index.js +8 -0
- package/esm2015/cms/types/integration.types.js +2 -0
- package/esm2015/cms/types/metrics.types.js +2 -0
- package/esm2015/cms/types/path.types.js +2 -0
- package/esm2015/cms/utils/element.utils.js +161 -0
- package/esm2015/cms/utils/elements-resolver.js +147 -0
- package/esm2015/cms/utils/index.js +4 -0
- package/esm2015/cms/utils/path.utils.js +67 -0
- package/esm2015/cms/veloceapps-sdk-cms.js +5 -0
- package/esm2015/cms/vendor-map.js +34 -0
- package/esm2015/core/core.module.js +18 -0
- package/esm2015/core/index.js +7 -0
- package/esm2015/core/modules/configuration/configuration.module.js +34 -0
- package/esm2015/core/modules/configuration/helpers.js +10 -0
- package/esm2015/core/modules/configuration/index.js +5 -0
- package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +92 -0
- package/esm2015/core/modules/configuration/services/configuration.service.js +173 -0
- package/esm2015/core/modules/configuration/services/runtime-context.service.js +51 -0
- package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +2 -0
- package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +18 -0
- package/esm2015/core/modules/flow-configuration/index.js +5 -0
- package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +135 -0
- package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +129 -0
- package/esm2015/core/modules/flow-configuration/types/update.types.js +2 -0
- package/esm2015/core/modules/index.js +3 -0
- package/esm2015/core/services/context.service.js +50 -0
- package/esm2015/core/services/index.js +4 -0
- package/esm2015/core/services/product-images.service.js +30 -0
- package/esm2015/core/services/quote-draft.service.js +207 -0
- package/esm2015/core/types/index.js +4 -0
- package/esm2015/core/types/quote-states.types.js +2 -0
- package/esm2015/core/types/runtime.types.js +16 -0
- package/esm2015/core/types/ui-definition.types.js +2 -0
- package/esm2015/core/utils/index.js +3 -0
- package/esm2015/core/utils/line-item.utils.js +100 -0
- package/esm2015/core/utils/line-item.worker.js +19 -0
- package/esm2015/core/veloceapps-sdk-core.js +5 -0
- package/esm2015/index.js +2 -0
- package/esm2015/runtime/components/component-preview/component-preview.component.js +125 -0
- package/esm2015/runtime/components/index.js +5 -0
- package/esm2015/runtime/components/section-renderer/section-renderer.component.js +71 -0
- package/esm2015/runtime/components/ui-runtime/runtime.component.js +429 -0
- package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +109 -0
- package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +68 -0
- package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +36 -0
- package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +72 -0
- package/esm2015/runtime/execution/components/federated/federated.component.js +81 -0
- package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +65 -0
- package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +136 -0
- package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +80 -0
- package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +101 -0
- package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +150 -0
- package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +121 -0
- package/esm2015/runtime/execution/directives/section-script.directive.js +242 -0
- package/esm2015/runtime/execution/directives/sf-query.directive.js +34 -0
- package/esm2015/runtime/execution/directives/velo-attribute.directive.js +86 -0
- package/esm2015/runtime/execution/directives/velo-port.directive.js +373 -0
- package/esm2015/runtime/execution/directives/vl-approval.directive.js +22 -0
- package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +35 -0
- package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +59 -0
- package/esm2015/runtime/execution/directives/vl-quote.directive.js +41 -0
- package/esm2015/runtime/execution/directives/vl-ramp.directive.js +51 -0
- package/esm2015/runtime/execution/runtime-execution.module.js +163 -0
- package/esm2015/runtime/execution/utils/federated.util.js +37 -0
- package/esm2015/runtime/index.js +5 -0
- package/esm2015/runtime/runtime.module.js +104 -0
- package/esm2015/runtime/services/cart.service.js +27 -0
- package/esm2015/runtime/services/collapsible-state.service.js +34 -0
- package/esm2015/runtime/services/configuration.service.js +102 -0
- package/esm2015/runtime/services/current-state.service.js +17 -0
- package/esm2015/runtime/services/form-scope.service.js +30 -0
- package/esm2015/runtime/services/index.js +4 -0
- package/esm2015/runtime/services/product-model-cache.service.js +30 -0
- package/esm2015/runtime/services/runtime-context.service.js +56 -0
- package/esm2015/runtime/services/runtime-form.service.js +224 -0
- package/esm2015/runtime/services/runtime.service.js +108 -0
- package/esm2015/runtime/services/section-helper.service.js +27 -0
- package/esm2015/runtime/services/section-scope.service.js +36 -0
- package/esm2015/runtime/services/section-store.service.js +22 -0
- package/esm2015/runtime/services/section.service.js +124 -0
- package/esm2015/runtime/types/bound-data.types.js +7 -0
- package/esm2015/runtime/types/index.js +2 -0
- package/esm2015/runtime/types/runtime.types.js +2 -0
- package/esm2015/runtime/types/script-registry.types.js +51 -0
- package/esm2015/runtime/utils/line-item.util.js +273 -0
- package/esm2015/runtime/utils/section.utils.js +26 -0
- package/esm2015/runtime/utils/sections-binder.helper.js +105 -0
- package/esm2015/runtime/veloceapps-sdk-runtime.js +5 -0
- package/esm2015/src/components/dialog/dialog.component.js +30 -0
- package/esm2015/src/components/dialog/dialog.module.js +19 -0
- package/esm2015/src/components/dialog/dialog.types.js +2 -0
- package/esm2015/src/components/doc-gen/doc-gen.component.js +109 -0
- package/esm2015/src/components/doc-gen/doc-gen.module.js +19 -0
- package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +122 -0
- package/esm2015/src/components/header/cart-overlay/cart-preview.module.js +46 -0
- package/esm2015/src/components/header/header.component.js +310 -0
- package/esm2015/src/components/header/header.module.js +50 -0
- package/esm2015/src/components/header/header.types.js +2 -0
- package/esm2015/src/components/header/metrics/index.js +2 -0
- package/esm2015/src/components/header/metrics/metrics.component.js +216 -0
- package/esm2015/src/components/header/metrics/metrics.definitions.js +9 -0
- package/esm2015/src/components/header/metrics/metrics.module.js +67 -0
- package/esm2015/src/constants.js +2 -0
- package/esm2015/src/flow-routing.module.js +137 -0
- package/esm2015/src/flow.component.js +45 -0
- package/esm2015/src/flow.module.js +60 -0
- package/esm2015/src/guards/context.guard.js +84 -0
- package/esm2015/src/guards/index.js +2 -0
- package/esm2015/src/guards/product-unload.guard.js +43 -0
- package/esm2015/src/guards/root.guard.js +41 -0
- package/esm2015/src/index.js +7 -0
- package/esm2015/src/pages/catalog/catalog.component.js +117 -0
- package/esm2015/src/pages/catalog/catalog.module.js +20 -0
- package/esm2015/src/pages/debug/debug.component.js +61 -0
- package/esm2015/src/pages/debug/debug.module.js +48 -0
- package/esm2015/src/pages/empty-account/empty-account.component.js +17 -0
- package/esm2015/src/pages/empty-account/empty-account.module.js +20 -0
- package/esm2015/src/pages/legacy-product/legacy-product.component.js +132 -0
- package/esm2015/src/pages/legacy-product/legacy-product.module.js +21 -0
- package/esm2015/src/pages/product/product.component.js +108 -0
- package/esm2015/src/pages/product/product.module.js +20 -0
- package/esm2015/src/pages/record-not-found/record-not-found.component.js +29 -0
- package/esm2015/src/pages/record-not-found/record-not-found.module.js +20 -0
- package/esm2015/src/pages/remote/remote.component.js +353 -0
- package/esm2015/src/pages/remote/remote.module.js +20 -0
- package/esm2015/src/pages/remote/remote.types.js +2 -0
- package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +117 -0
- package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +20 -0
- package/esm2015/src/resolvers/flow.resolver.js +62 -0
- package/esm2015/src/resolvers/quote.resolver.js +74 -0
- package/esm2015/src/services/doc-gen.service.js +33 -0
- package/esm2015/src/services/flow-dialog.service.js +123 -0
- package/esm2015/src/services/flow-router.service.js +136 -0
- package/esm2015/src/services/flow.service.js +77 -0
- package/esm2015/src/services/index.js +2 -0
- package/esm2015/src/types/context-route.types.js +2 -0
- package/esm2015/src/types/flow-customization.types.js +3 -0
- package/esm2015/src/types/index.js +3 -0
- package/esm2015/src/types/route.types.js +2 -0
- package/esm2015/src/utils/flow.utils.js +22 -0
- package/esm2015/src/utils/index.js +2 -0
- package/esm2015/veloceapps-sdk.js +5 -0
- package/fesm2015/veloceapps-sdk-cms.js +1443 -0
- package/fesm2015/veloceapps-sdk-cms.js.map +1 -0
- package/fesm2015/veloceapps-sdk-core.js +1035 -0
- package/fesm2015/veloceapps-sdk-core.js.map +1 -0
- package/fesm2015/veloceapps-sdk-runtime.js +3896 -0
- package/fesm2015/veloceapps-sdk-runtime.js.map +1 -0
- package/fesm2015/veloceapps-sdk.js +2758 -0
- package/fesm2015/veloceapps-sdk.js.map +1 -0
- package/index.d.ts +1 -0
- package/package.json +50 -0
- package/runtime/components/component-preview/component-preview.component.d.ts +27 -0
- package/runtime/components/index.d.ts +4 -0
- package/runtime/components/section-renderer/section-renderer.component.d.ts +25 -0
- package/runtime/components/ui-runtime/runtime.component.d.ts +53 -0
- package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +27 -0
- package/runtime/execution/components/children-placeholder/children-placeholder.component.d.ts +30 -0
- package/runtime/execution/components/context-provider/context-provider.component.d.ts +14 -0
- package/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.d.ts +25 -0
- package/runtime/execution/components/federated/federated.component.d.ts +36 -0
- package/runtime/execution/components/velo-attribute/velo-attribute.component.d.ts +19 -0
- package/runtime/execution/components/velo-multiselect/velo-multiselect.component.d.ts +35 -0
- package/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.d.ts +22 -0
- package/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.d.ts +22 -0
- package/runtime/execution/components/velo-port-radio/velo-port-radio.component.d.ts +28 -0
- package/runtime/execution/components/velo-type/velo-type.component.d.ts +31 -0
- package/runtime/execution/directives/section-script.directive.d.ts +59 -0
- package/runtime/execution/directives/sf-query.directive.d.ts +15 -0
- package/runtime/execution/directives/velo-attribute.directive.d.ts +26 -0
- package/runtime/execution/directives/velo-port.directive.d.ts +74 -0
- package/runtime/execution/directives/vl-approval.directive.d.ts +10 -0
- package/runtime/execution/directives/vl-document-attachments.directive.d.ts +15 -0
- package/runtime/execution/directives/vl-document-templates.directive.d.ts +33 -0
- package/runtime/execution/directives/vl-quote.directive.d.ts +14 -0
- package/runtime/execution/directives/vl-ramp.directive.d.ts +15 -0
- package/runtime/execution/runtime-execution.module.d.ts +27 -0
- package/runtime/execution/utils/federated.util.d.ts +6 -0
- package/runtime/index.d.ts +4 -0
- package/runtime/package.json +10 -0
- package/runtime/runtime.module.d.ts +18 -0
- package/runtime/services/cart.service.d.ts +15 -0
- package/runtime/services/collapsible-state.service.d.ts +15 -0
- package/runtime/services/configuration.service.d.ts +19 -0
- package/runtime/services/current-state.service.d.ts +8 -0
- package/runtime/services/form-scope.service.d.ts +20 -0
- package/runtime/services/index.d.ts +3 -0
- package/runtime/services/product-model-cache.service.d.ts +14 -0
- package/runtime/services/runtime-context.service.d.ts +16 -0
- package/runtime/services/runtime-form.service.d.ts +24 -0
- package/runtime/services/runtime.service.d.ts +43 -0
- package/runtime/services/section-helper.service.d.ts +8 -0
- package/runtime/services/section-scope.service.d.ts +14 -0
- package/runtime/services/section-store.service.d.ts +11 -0
- package/runtime/services/section.service.d.ts +30 -0
- package/runtime/types/bound-data.types.d.ts +13 -0
- package/runtime/types/index.d.ts +1 -0
- package/runtime/types/runtime.types.d.ts +19 -0
- package/runtime/types/script-registry.types.d.ts +13 -0
- package/runtime/utils/line-item.util.d.ts +34 -0
- package/runtime/utils/section.utils.d.ts +2 -0
- package/runtime/utils/sections-binder.helper.d.ts +16 -0
- package/runtime/veloceapps-sdk-runtime.d.ts +5 -0
- package/src/components/dialog/dialog.component.d.ts +13 -0
- package/src/components/dialog/dialog.module.d.ts +9 -0
- package/src/components/dialog/dialog.types.d.ts +6 -0
- package/src/components/doc-gen/doc-gen.component.d.ts +26 -0
- package/src/components/doc-gen/doc-gen.module.d.ts +9 -0
- package/src/components/header/cart-overlay/cart-preview.component.d.ts +36 -0
- package/src/components/header/cart-overlay/cart-preview.module.d.ts +14 -0
- package/src/components/header/header.component.d.ts +64 -0
- package/src/components/header/header.module.d.ts +15 -0
- package/src/components/header/header.types.d.ts +20 -0
- package/src/components/header/metrics/index.d.ts +1 -0
- package/src/components/header/metrics/metrics.component.d.ts +49 -0
- package/src/components/header/metrics/metrics.definitions.d.ts +4 -0
- package/src/components/header/metrics/metrics.module.d.ts +17 -0
- package/src/constants.d.ts +1 -0
- package/src/flow-routing.module.d.ts +13 -0
- package/src/flow.component.d.ts +23 -0
- package/src/flow.module.d.ts +16 -0
- package/src/guards/context.guard.d.ts +19 -0
- package/src/guards/index.d.ts +1 -0
- package/src/guards/product-unload.guard.d.ts +17 -0
- package/src/guards/root.guard.d.ts +15 -0
- package/src/index.d.ts +6 -0
- package/src/pages/catalog/catalog.component.d.ts +32 -0
- package/src/pages/catalog/catalog.module.d.ts +10 -0
- package/src/pages/debug/debug.component.d.ts +25 -0
- package/src/pages/debug/debug.module.d.ts +14 -0
- package/src/pages/empty-account/empty-account.component.d.ts +5 -0
- package/src/pages/empty-account/empty-account.module.d.ts +10 -0
- package/src/pages/legacy-product/legacy-product.component.d.ts +37 -0
- package/src/pages/legacy-product/legacy-product.module.d.ts +10 -0
- package/src/pages/product/product.component.d.ts +32 -0
- package/src/pages/product/product.module.d.ts +10 -0
- package/src/pages/record-not-found/record-not-found.component.d.ts +11 -0
- package/src/pages/record-not-found/record-not-found.module.d.ts +9 -0
- package/src/pages/remote/remote.component.d.ts +47 -0
- package/src/pages/remote/remote.module.d.ts +10 -0
- package/src/pages/remote/remote.types.d.ts +4 -0
- package/src/pages/shopping-cart/shopping-cart.component.d.ts +32 -0
- package/src/pages/shopping-cart/shopping-cart.module.d.ts +10 -0
- package/src/resolvers/flow.resolver.d.ts +16 -0
- package/src/resolvers/quote.resolver.d.ts +20 -0
- package/src/services/doc-gen.service.d.ts +13 -0
- package/src/services/flow-dialog.service.d.ts +26 -0
- package/src/services/flow-router.service.d.ts +36 -0
- package/src/services/flow.service.d.ts +17 -0
- package/src/services/index.d.ts +1 -0
- package/src/types/context-route.types.d.ts +5 -0
- package/src/types/flow-customization.types.d.ts +11 -0
- package/src/types/index.d.ts +2 -0
- package/src/types/route.types.d.ts +9 -0
- package/src/utils/flow.utils.d.ts +8 -0
- package/src/utils/index.d.ts +1 -0
- package/veloceapps-sdk.d.ts +5 -0
@@ -0,0 +1,1443 @@
|
|
1
|
+
import { __decorate, __param, __awaiter, __rest } from 'tslib';
|
2
|
+
import * as i0 from '@angular/core';
|
3
|
+
import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Injector, Injectable, Directive, ViewContainerRef, SkipSelf, ViewChild, Input, NgModule, ViewEncapsulation } from '@angular/core';
|
4
|
+
import * as rxjs from 'rxjs';
|
5
|
+
import { BehaviorSubject, Subject, takeUntil, map, filter, from, tap, of, switchMap, forkJoin, catchError } from 'rxjs';
|
6
|
+
import * as lodash from 'lodash';
|
7
|
+
import { compact, flatten, isArray, pull, set, kebabCase } from 'lodash';
|
8
|
+
import * as i7 from '@angular/common';
|
9
|
+
import { DOCUMENT, CommonModule } from '@angular/common';
|
10
|
+
import { UUID, CoreModule } from '@veloceapps/core';
|
11
|
+
import { DragDropModule } from '@angular/cdk/drag-drop';
|
12
|
+
import * as angularForms from '@angular/forms';
|
13
|
+
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
14
|
+
import * as i2 from '@veloceapps/sdk/core';
|
15
|
+
import { ConfigurationService, LineItemWorker, generateLineItem, getAttributeValue, QuoteDraftService, FlowConfigurationService, ProductImagesService, lineItemUtils, SdkCoreModule } from '@veloceapps/sdk/core';
|
16
|
+
import * as i1 from '@veloceapps/components';
|
17
|
+
import { LoaderModule } from '@veloceapps/components';
|
18
|
+
import { transform } from '@babel/standalone';
|
19
|
+
import { SalesforceApiService, QuoteApiService, DocumentTemplatesApiService, DocumentAttachmentApiService, RampApiService, CatalogApiService, DeltaApiService, PicklistsApiService, PriceApiService, ApiModule } from '@veloceapps/api';
|
20
|
+
import * as rxjsOperators from 'rxjs/operators';
|
21
|
+
import * as i3 from 'primeng/api';
|
22
|
+
import { DialogService } from 'primeng/dynamicdialog';
|
23
|
+
|
24
|
+
var FlowAction;
|
25
|
+
(function (FlowAction) {
|
26
|
+
FlowAction["FLOW_CONFIGURE_PRODUCT"] = "FLOW_CONFIGURE_PRODUCT";
|
27
|
+
FlowAction["FLOW_NAVIGATE_BACK"] = "FLOW_NAVIGATE_BACK";
|
28
|
+
FlowAction["FLOW_NAVIGATE_TO_CATALOG"] = "FLOW_NAVIGATE_TO_CATALOG";
|
29
|
+
FlowAction["FLOW_APPLY_PRODUCT_CONFIGURATION"] = "FLOW_APPLY_PRODUCT_CONFIGURATION";
|
30
|
+
FlowAction["FLOW_OPEN_DOC_GEN"] = "FLOW_OPEN_DOC_GEN";
|
31
|
+
FlowAction["FLOW_CLOSE_DOC_GEN"] = "FLOW_CLOSE_DOC_GEN";
|
32
|
+
FlowAction["FLOW_SWITCH_OBJECT"] = "FLOW_SWITCH_OBJECT";
|
33
|
+
FlowAction["REMOTE_APPLY"] = "REMOTE_APPLY";
|
34
|
+
FlowAction["REMOTE_CANCEL"] = "REMOTE_CANCEL";
|
35
|
+
FlowAction["SET_DEFAULT_METRICS"] = "SET_DEFAULT_METRICS";
|
36
|
+
})(FlowAction || (FlowAction = {}));
|
37
|
+
const ConfigureProductAction = ({ lineItemId, productId, }) => ({
|
38
|
+
type: FlowAction.FLOW_CONFIGURE_PRODUCT,
|
39
|
+
payload: { lineItemId, productId },
|
40
|
+
});
|
41
|
+
const NavigateBackAction = () => ({
|
42
|
+
type: FlowAction.FLOW_NAVIGATE_BACK,
|
43
|
+
});
|
44
|
+
const NavigateToCatalogAction = () => ({
|
45
|
+
type: FlowAction.FLOW_NAVIGATE_TO_CATALOG,
|
46
|
+
});
|
47
|
+
const ApplyProductConfigurationAction = () => ({
|
48
|
+
type: FlowAction.FLOW_APPLY_PRODUCT_CONFIGURATION,
|
49
|
+
});
|
50
|
+
const OpenDocGenAction = () => ({
|
51
|
+
type: FlowAction.FLOW_OPEN_DOC_GEN,
|
52
|
+
});
|
53
|
+
const CloseDocGenAction = () => ({
|
54
|
+
type: FlowAction.FLOW_CLOSE_DOC_GEN,
|
55
|
+
});
|
56
|
+
const RemoteApplyAction = () => ({
|
57
|
+
type: FlowAction.REMOTE_APPLY,
|
58
|
+
});
|
59
|
+
const RemoteCancelAction = () => ({
|
60
|
+
type: FlowAction.REMOTE_CANCEL,
|
61
|
+
});
|
62
|
+
const SwitchObjectAction = (payload) => ({
|
63
|
+
type: FlowAction.FLOW_SWITCH_OBJECT,
|
64
|
+
payload,
|
65
|
+
});
|
66
|
+
const SetDefaultMetrics = (metrics) => ({
|
67
|
+
type: FlowAction.SET_DEFAULT_METRICS,
|
68
|
+
payload: { metrics },
|
69
|
+
});
|
70
|
+
|
71
|
+
var cmsActions = /*#__PURE__*/Object.freeze({
|
72
|
+
__proto__: null,
|
73
|
+
get FlowAction () { return FlowAction; },
|
74
|
+
ConfigureProductAction: ConfigureProductAction,
|
75
|
+
NavigateBackAction: NavigateBackAction,
|
76
|
+
NavigateToCatalogAction: NavigateToCatalogAction,
|
77
|
+
ApplyProductConfigurationAction: ApplyProductConfigurationAction,
|
78
|
+
OpenDocGenAction: OpenDocGenAction,
|
79
|
+
CloseDocGenAction: CloseDocGenAction,
|
80
|
+
RemoteApplyAction: RemoteApplyAction,
|
81
|
+
RemoteCancelAction: RemoteCancelAction,
|
82
|
+
SwitchObjectAction: SwitchObjectAction,
|
83
|
+
SetDefaultMetrics: SetDefaultMetrics
|
84
|
+
});
|
85
|
+
|
86
|
+
const DEFAULT_PLUGINS_TOKEN = new InjectionToken('DEFAULT_PLUGINS_TOKEN');
|
87
|
+
const UI_DEFINITION_METADATA = new InjectionToken('UI_DEFINITION_METADATA_TOKEN');
|
88
|
+
const ELEMENT_METADATA = new InjectionToken('ELEMENT_METADATA_TOKEN');
|
89
|
+
const SHARED_ELEMENT_METADATA = new InjectionToken('SHARED_ELEMENT_METADATA_TOKEN');
|
90
|
+
const ELEMENT_CONFIG = new InjectionToken('ELEMENT_CONFIG_TOKEN');
|
91
|
+
const VENDOR_MAP = new InjectionToken('VENDOR_MAP');
|
92
|
+
|
93
|
+
var cmsInjectionTokens = /*#__PURE__*/Object.freeze({
|
94
|
+
__proto__: null,
|
95
|
+
DEFAULT_PLUGINS_TOKEN: DEFAULT_PLUGINS_TOKEN,
|
96
|
+
UI_DEFINITION_METADATA: UI_DEFINITION_METADATA,
|
97
|
+
ELEMENT_METADATA: ELEMENT_METADATA,
|
98
|
+
SHARED_ELEMENT_METADATA: SHARED_ELEMENT_METADATA,
|
99
|
+
ELEMENT_CONFIG: ELEMENT_CONFIG,
|
100
|
+
VENDOR_MAP: VENDOR_MAP
|
101
|
+
});
|
102
|
+
|
103
|
+
class Entity {
|
104
|
+
constructor(injector) {
|
105
|
+
this.injector = injector;
|
106
|
+
this.plugins = [];
|
107
|
+
this.config = this.injector.get(ELEMENT_CONFIG);
|
108
|
+
this.defaultPlugins = this.injector.get(DEFAULT_PLUGINS_TOKEN);
|
109
|
+
}
|
110
|
+
initPlugins() {
|
111
|
+
var _a;
|
112
|
+
this.defaultPlugins.forEach(plugin => this.registerPlugin(new plugin(this)));
|
113
|
+
(_a = this.config.plugins) === null || _a === void 0 ? void 0 : _a.forEach(plugin => this.registerPlugin(new plugin(this)));
|
114
|
+
}
|
115
|
+
registerPlugin(plugin) {
|
116
|
+
this.plugins.push(plugin);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
let ElementComponent = class ElementComponent extends Entity {
|
121
|
+
constructor(injector) {
|
122
|
+
super(injector);
|
123
|
+
this.injector = injector;
|
124
|
+
this.model$ = new BehaviorSubject(undefined);
|
125
|
+
super.initPlugins();
|
126
|
+
}
|
127
|
+
ngOnChanges(changes) {
|
128
|
+
this.plugins.forEach(plugin => { var _a; return (_a = plugin.ngOnChanges) === null || _a === void 0 ? void 0 : _a.call(plugin, changes); });
|
129
|
+
}
|
130
|
+
ngOnInit() {
|
131
|
+
this.plugins.forEach(plugin => { var _a; return (_a = plugin.ngOnInit) === null || _a === void 0 ? void 0 : _a.call(plugin); });
|
132
|
+
}
|
133
|
+
ngDoCheck() {
|
134
|
+
this.plugins.forEach(plugin => { var _a; return (_a = plugin.ngDoCheck) === null || _a === void 0 ? void 0 : _a.call(plugin); });
|
135
|
+
}
|
136
|
+
ngAfterContentInit() {
|
137
|
+
this.plugins.forEach(plugin => { var _a; return (_a = plugin.ngAfterContentInit) === null || _a === void 0 ? void 0 : _a.call(plugin); });
|
138
|
+
}
|
139
|
+
ngAfterViewInit() {
|
140
|
+
this.plugins.forEach(plugin => { var _a; return (_a = plugin.ngAfterViewInit) === null || _a === void 0 ? void 0 : _a.call(plugin); });
|
141
|
+
}
|
142
|
+
ngAfterViewChecked() {
|
143
|
+
this.plugins.forEach(plugin => { var _a; return (_a = plugin.ngAfterViewChecked) === null || _a === void 0 ? void 0 : _a.call(plugin); });
|
144
|
+
}
|
145
|
+
ngOnDestroy() {
|
146
|
+
this.plugins.forEach(plugin => { var _a; return (_a = plugin.ngOnDestroy) === null || _a === void 0 ? void 0 : _a.call(plugin); });
|
147
|
+
}
|
148
|
+
};
|
149
|
+
ElementComponent = __decorate([
|
150
|
+
Component({
|
151
|
+
template: '',
|
152
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
153
|
+
jit: true,
|
154
|
+
}),
|
155
|
+
__param(0, Inject(Injector))
|
156
|
+
], ElementComponent);
|
157
|
+
|
158
|
+
const parseBoundPath = (path) => {
|
159
|
+
var _a, _b;
|
160
|
+
const regexp = new RegExp(`(?:\\/)(?:\\w+)(?:\\/)(?:ports|attributes)(?:\\/)(?:\\w+)|(?:\\/)(?:\\w+)`, 'g');
|
161
|
+
const blocks = (_b = (_a = path.match(regexp)) === null || _a === void 0 ? void 0 : _a.map(match => {
|
162
|
+
const [type, property, name] = compact(match.split('/'));
|
163
|
+
return { type, property, name };
|
164
|
+
})) !== null && _b !== void 0 ? _b : [];
|
165
|
+
return blocks;
|
166
|
+
};
|
167
|
+
const parsePath = (path) => {
|
168
|
+
var _a, _b, _c, _d;
|
169
|
+
const segments = path.split('/');
|
170
|
+
let module;
|
171
|
+
let variable;
|
172
|
+
if ((_a = segments[0]) === null || _a === void 0 ? void 0 : _a.startsWith('@')) {
|
173
|
+
module = (_b = segments.shift()) === null || _b === void 0 ? void 0 : _b.substring(1);
|
174
|
+
}
|
175
|
+
if (((_c = segments[segments.length - 1]) === null || _c === void 0 ? void 0 : _c[0]) === ':') {
|
176
|
+
variable = (_d = segments.pop()) === null || _d === void 0 ? void 0 : _d.substring(1);
|
177
|
+
}
|
178
|
+
const isAbsolute = !segments[0];
|
179
|
+
const nonEmptySegments = segments.filter(Boolean);
|
180
|
+
if (!isAbsolute && nonEmptySegments[0] === '.') {
|
181
|
+
nonEmptySegments.shift();
|
182
|
+
}
|
183
|
+
return {
|
184
|
+
isAbsolute,
|
185
|
+
segments: nonEmptySegments,
|
186
|
+
module,
|
187
|
+
variable,
|
188
|
+
};
|
189
|
+
};
|
190
|
+
const findElementByModule = (elements, module, elementName) => {
|
191
|
+
for (const el of elements) {
|
192
|
+
if (el.module === module && el.name === elementName) {
|
193
|
+
return el;
|
194
|
+
}
|
195
|
+
const child = findElementByModule(el.children, module, elementName);
|
196
|
+
if (child) {
|
197
|
+
return child;
|
198
|
+
}
|
199
|
+
}
|
200
|
+
return;
|
201
|
+
};
|
202
|
+
const getAbsolutePath = (elements, subject, path) => {
|
203
|
+
var _a, _b, _c;
|
204
|
+
if (path.module) {
|
205
|
+
return (_a = findElementByModule(elements, path.module, path.segments[0])) === null || _a === void 0 ? void 0 : _a.path;
|
206
|
+
}
|
207
|
+
const subjectSegments = (_c = (_b = subject.path) === null || _b === void 0 ? void 0 : _b.split('/')) !== null && _c !== void 0 ? _c : [];
|
208
|
+
const segments = [...path.segments];
|
209
|
+
if (path.isAbsolute) {
|
210
|
+
return segments.join('/');
|
211
|
+
}
|
212
|
+
while (segments.length) {
|
213
|
+
const segment = segments.shift();
|
214
|
+
if (segment === '..') {
|
215
|
+
subjectSegments.pop();
|
216
|
+
}
|
217
|
+
else if (segment) {
|
218
|
+
subjectSegments.push(segment);
|
219
|
+
}
|
220
|
+
}
|
221
|
+
return subjectSegments.join('/');
|
222
|
+
};
|
223
|
+
|
224
|
+
class DynamicModuleService {
|
225
|
+
constructor() {
|
226
|
+
this._elementsTree = [];
|
227
|
+
this._componentFactories = [];
|
228
|
+
}
|
229
|
+
set componentFactories(data) {
|
230
|
+
this._componentFactories = data;
|
231
|
+
}
|
232
|
+
get componentFactories() {
|
233
|
+
return this._componentFactories;
|
234
|
+
}
|
235
|
+
getComponentFactory(element) {
|
236
|
+
return this.componentFactories.find(f => f.componentType.path === element.path);
|
237
|
+
}
|
238
|
+
get elementsTree() {
|
239
|
+
return this._elementsTree;
|
240
|
+
}
|
241
|
+
set elementsTree(tree) {
|
242
|
+
this._elementsTree = tree;
|
243
|
+
}
|
244
|
+
clear() {
|
245
|
+
this._elementsTree = [];
|
246
|
+
this.componentFactories = [];
|
247
|
+
}
|
248
|
+
}
|
249
|
+
DynamicModuleService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DynamicModuleService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
250
|
+
DynamicModuleService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DynamicModuleService });
|
251
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: DynamicModuleService, decorators: [{
|
252
|
+
type: Injectable
|
253
|
+
}] });
|
254
|
+
|
255
|
+
class IOProviderService {
|
256
|
+
constructor(dynamicModuleService) {
|
257
|
+
this.dynamicModuleService = dynamicModuleService;
|
258
|
+
this.inputs = {};
|
259
|
+
}
|
260
|
+
connect(el, name, target) {
|
261
|
+
var _a;
|
262
|
+
return (_a = this.resolveTarget(el, name, target)) === null || _a === void 0 ? void 0 : _a.asObservable();
|
263
|
+
}
|
264
|
+
provide(el, name, target) {
|
265
|
+
return this.resolveTarget(el, name, target);
|
266
|
+
}
|
267
|
+
resolveTarget(el, name, target) {
|
268
|
+
var _a, _b;
|
269
|
+
const isHost = !target;
|
270
|
+
if (isHost) {
|
271
|
+
return this.createSubjectSafe((_a = el.path) !== null && _a !== void 0 ? _a : '', name);
|
272
|
+
}
|
273
|
+
const elPath = parsePath(target);
|
274
|
+
const pathIsValue = elPath.segments.length === 1 && elPath.segments[0].startsWith('"') && elPath.segments[0].endsWith('"');
|
275
|
+
const finalName = (_b = elPath.variable) !== null && _b !== void 0 ? _b : name;
|
276
|
+
const value = pathIsValue ? new BehaviorSubject(elPath.segments[0].slice(1, -1)) : undefined;
|
277
|
+
const absolutePath = !pathIsValue ? getAbsolutePath(this.dynamicModuleService.elementsTree, el, elPath) : el.path;
|
278
|
+
return this.createSubjectSafe(absolutePath !== null && absolutePath !== void 0 ? absolutePath : '', finalName, value);
|
279
|
+
}
|
280
|
+
createSubjectSafe(path, name, subject) {
|
281
|
+
if (!this.inputs[path]) {
|
282
|
+
this.inputs[path] = {};
|
283
|
+
}
|
284
|
+
const subjectAlreadyExists = Boolean(this.inputs[path][name]);
|
285
|
+
if (!this.inputs[path][name]) {
|
286
|
+
this.inputs[path][name] = subject !== null && subject !== void 0 ? subject : new BehaviorSubject(undefined);
|
287
|
+
}
|
288
|
+
if (subject && subjectAlreadyExists) {
|
289
|
+
// push delayed value to workaround 'changed after it was checked' issue
|
290
|
+
setTimeout(() => this.inputs[path][name].next(subject.value));
|
291
|
+
}
|
292
|
+
return this.inputs[path][name];
|
293
|
+
}
|
294
|
+
}
|
295
|
+
IOProviderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IOProviderService, deps: [{ token: DynamicModuleService }], target: i0.ɵɵFactoryTarget.Injectable });
|
296
|
+
IOProviderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IOProviderService });
|
297
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IOProviderService, decorators: [{
|
298
|
+
type: Injectable
|
299
|
+
}], ctorParameters: function () { return [{ type: DynamicModuleService }]; } });
|
300
|
+
|
301
|
+
class TemplatesService {
|
302
|
+
constructor() {
|
303
|
+
this.templates = {};
|
304
|
+
}
|
305
|
+
register(name, templateRef) {
|
306
|
+
this.ensureStorage(name);
|
307
|
+
this.templates[name].next(templateRef);
|
308
|
+
}
|
309
|
+
get(name) {
|
310
|
+
this.ensureStorage(name);
|
311
|
+
return this.templates[name].value;
|
312
|
+
}
|
313
|
+
get$(name) {
|
314
|
+
this.ensureStorage(name);
|
315
|
+
return this.templates[name].asObservable();
|
316
|
+
}
|
317
|
+
ensureStorage(name) {
|
318
|
+
if (!this.templates[name]) {
|
319
|
+
this.templates[name] = new BehaviorSubject(undefined);
|
320
|
+
}
|
321
|
+
}
|
322
|
+
}
|
323
|
+
TemplatesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TemplatesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
324
|
+
TemplatesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TemplatesService });
|
325
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: TemplatesService, decorators: [{
|
326
|
+
type: Injectable
|
327
|
+
}] });
|
328
|
+
|
329
|
+
class IOPlugin {
|
330
|
+
constructor(host) {
|
331
|
+
var _a, _b;
|
332
|
+
this.host = host;
|
333
|
+
const elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
334
|
+
const inputProvider = this.host.injector.get(IOProviderService);
|
335
|
+
const inputs = Object.entries((_a = elementMetadata.inputs) !== null && _a !== void 0 ? _a : {});
|
336
|
+
const outputs = Object.entries((_b = elementMetadata.outputs) !== null && _b !== void 0 ? _b : {});
|
337
|
+
inputs.forEach(([key, path]) => {
|
338
|
+
var _a;
|
339
|
+
if (path && typeof path !== 'string') {
|
340
|
+
console.error(`The value of '${key}' input should be a string`);
|
341
|
+
}
|
342
|
+
if (((_a = elementMetadata.outputs) === null || _a === void 0 ? void 0 : _a[key]) !== undefined) {
|
343
|
+
console.warn(`'${key}' appears both in inputs and outputs. To prevent inconsistent behavior please keep them unique `);
|
344
|
+
}
|
345
|
+
this.host[key] = inputProvider.connect(elementMetadata, key, path);
|
346
|
+
});
|
347
|
+
outputs.forEach(([key, path]) => {
|
348
|
+
if (path && typeof path !== 'string') {
|
349
|
+
console.error(`The value of '${key}' output should be a string`);
|
350
|
+
}
|
351
|
+
this.host[key] = inputProvider.provide(elementMetadata, key, path);
|
352
|
+
});
|
353
|
+
}
|
354
|
+
}
|
355
|
+
IOPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IOPlugin, deps: [{ token: ElementComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
356
|
+
IOPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: IOPlugin, ngImport: i0 });
|
357
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IOPlugin, decorators: [{
|
358
|
+
type: Directive
|
359
|
+
}], ctorParameters: function () { return [{ type: ElementComponent }]; } });
|
360
|
+
|
361
|
+
class ScriptPlugin {
|
362
|
+
constructor(host) {
|
363
|
+
this.host = host;
|
364
|
+
this.normalizeImports = (script, elementPath) => {
|
365
|
+
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');
|
366
|
+
const result = script.replace(regexp, (match, g1, g2, src) => {
|
367
|
+
const imports = g1
|
368
|
+
.trim()
|
369
|
+
.slice(1, -1)
|
370
|
+
.split(',')
|
371
|
+
.map(item => item.trim());
|
372
|
+
imports.forEach(item => {
|
373
|
+
var _a;
|
374
|
+
if (!((_a = this.vendorMap[src]) === null || _a === void 0 ? void 0 : _a[item])) {
|
375
|
+
throw new Error(`Failed to import ${item} from '${src}' in ${elementPath}/script.ts`);
|
376
|
+
}
|
377
|
+
});
|
378
|
+
return `const ${g1} = vendor['${src}'];`;
|
379
|
+
});
|
380
|
+
return result;
|
381
|
+
};
|
382
|
+
this.document = this.host.injector.get(DOCUMENT);
|
383
|
+
this.vendorMap = this.host.injector.get(VENDOR_MAP);
|
384
|
+
const elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
385
|
+
const sharedElementMetadata = this.host.injector.get(SHARED_ELEMENT_METADATA);
|
386
|
+
this.addScript(sharedElementMetadata);
|
387
|
+
this.addScript(elementMetadata);
|
388
|
+
}
|
389
|
+
addScript(metadata) {
|
390
|
+
var _a;
|
391
|
+
if (!(metadata === null || metadata === void 0 ? void 0 : metadata.script)) {
|
392
|
+
return;
|
393
|
+
}
|
394
|
+
const id = btoa(UUID.UUID());
|
395
|
+
const script = this.document.createElement('script');
|
396
|
+
script.type = `text/javascript`;
|
397
|
+
let scriptContent = this.normalizeImports(metadata.script, (_a = metadata.path) !== null && _a !== void 0 ? _a : metadata.name);
|
398
|
+
const classMatch = /export class (\S+)/.exec(scriptContent);
|
399
|
+
const className = classMatch === null || classMatch === void 0 ? void 0 : classMatch[1];
|
400
|
+
if (!classMatch || !className) {
|
401
|
+
console.error("Script doesn't have exported class");
|
402
|
+
return;
|
403
|
+
}
|
404
|
+
scriptContent = scriptContent.replace(classMatch[0], `class ${className}`);
|
405
|
+
script.text = `var ${id} = function(vendor) {${scriptContent}
|
406
|
+
return ${className}; };`;
|
407
|
+
this.document.body.appendChild(script);
|
408
|
+
const ScriptClass = window[id](this.vendorMap);
|
409
|
+
if (ScriptClass instanceof Object) {
|
410
|
+
this.host.registerPlugin(new ScriptClass(this.host));
|
411
|
+
}
|
412
|
+
this.document.body.removeChild(script);
|
413
|
+
}
|
414
|
+
}
|
415
|
+
ScriptPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ScriptPlugin, deps: [{ token: ElementComponent }], target: i0.ɵɵFactoryTarget.Directive });
|
416
|
+
ScriptPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: ScriptPlugin, ngImport: i0 });
|
417
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ScriptPlugin, decorators: [{
|
418
|
+
type: Directive
|
419
|
+
}], ctorParameters: function () { return [{ type: ElementComponent }]; } });
|
420
|
+
|
421
|
+
/*
|
422
|
+
* ScriptPlugin must always be the last plugin in the list to make sure user code is running after all pre-initializers.
|
423
|
+
*/
|
424
|
+
const CONFIG = {
|
425
|
+
CUSTOM: {
|
426
|
+
component: ElementComponent,
|
427
|
+
plugins: [IOPlugin, ScriptPlugin],
|
428
|
+
},
|
429
|
+
CONTAINER: {
|
430
|
+
component: ElementComponent,
|
431
|
+
defaultTemplate: '<element-children></element-children>',
|
432
|
+
plugins: [ScriptPlugin],
|
433
|
+
},
|
434
|
+
SERVICE: {
|
435
|
+
component: ElementComponent,
|
436
|
+
plugins: [IOPlugin, ScriptPlugin],
|
437
|
+
suppressTemplate: true,
|
438
|
+
suppressStyles: true,
|
439
|
+
},
|
440
|
+
REFERENCE: {
|
441
|
+
component: ElementComponent,
|
442
|
+
plugins: [IOPlugin, ScriptPlugin],
|
443
|
+
suppressTemplate: true,
|
444
|
+
},
|
445
|
+
};
|
446
|
+
|
447
|
+
const EXPORTED_CLASS_REGEX = /export class (\S+)/;
|
448
|
+
const METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|\r\n|.)*export class/g;
|
449
|
+
class UiBuildError extends Error {
|
450
|
+
constructor(message, affectedMetadata) {
|
451
|
+
super(message);
|
452
|
+
this.name = this.constructor.name;
|
453
|
+
this.affectedMetadata = affectedMetadata;
|
454
|
+
}
|
455
|
+
}
|
456
|
+
const elementToMetadata = (el, parentPath) => {
|
457
|
+
var _a;
|
458
|
+
const script = el.script && window.atob(el.script);
|
459
|
+
const template = el.template && window.atob(el.template);
|
460
|
+
const styles = el.styles && window.atob(el.styles);
|
461
|
+
const exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
462
|
+
if (!exportedClassName) {
|
463
|
+
throw new Error("Script doesn't have exported class");
|
464
|
+
}
|
465
|
+
const elementMetadata = extractElementMetadata(script || '');
|
466
|
+
const path = (parentPath ? parentPath + '/' : '') + elementMetadata.name;
|
467
|
+
return Object.assign(Object.assign({}, elementMetadata), { path, script: script === null || script === void 0 ? void 0 : script.replace(METADATA_DECORATOR_REGEX, 'export class'), template,
|
468
|
+
styles, children: el.children.map(child => elementToMetadata(child, path)) });
|
469
|
+
};
|
470
|
+
const metadataToElement = (metadata, recursive = true) => {
|
471
|
+
const elMetadata = {
|
472
|
+
name: metadata.name,
|
473
|
+
isShared: metadata.isShared,
|
474
|
+
type: metadata.type,
|
475
|
+
model: metadata.model,
|
476
|
+
module: metadata.module,
|
477
|
+
reference: metadata.reference,
|
478
|
+
inputs: metadata.inputs,
|
479
|
+
outputs: metadata.outputs,
|
480
|
+
children: metadata.children.map(({ name }) => name),
|
481
|
+
configuredStyles: metadata.configuredStyles,
|
482
|
+
};
|
483
|
+
const normalizedElMetadata = normalizeElementMetadata(elMetadata);
|
484
|
+
if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
|
485
|
+
throw new UiBuildError(`'${metadata.name}' component script is missing an exported class`, metadata);
|
486
|
+
}
|
487
|
+
const script = metadata.script &&
|
488
|
+
window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, `@ElementDefinition(${stringifyElementMetadata(normalizedElMetadata)})\nexport class Script`));
|
489
|
+
const template = metadata.template && window.btoa(metadata.template);
|
490
|
+
const styles = metadata.styles && window.btoa(metadata.styles);
|
491
|
+
return {
|
492
|
+
script,
|
493
|
+
template,
|
494
|
+
styles,
|
495
|
+
children: recursive ? metadata.children.map(meta => metadataToElement(meta)) : [],
|
496
|
+
};
|
497
|
+
};
|
498
|
+
const normalizeElementMetadata = (elementMetadata) => {
|
499
|
+
var _a, _b, _c, _d;
|
500
|
+
const metadata = Object.assign({}, elementMetadata);
|
501
|
+
// model
|
502
|
+
const { lineItem, path } = (_a = metadata.model) !== null && _a !== void 0 ? _a : {};
|
503
|
+
const model = lineItem ? { lineItem } : path ? { path } : undefined;
|
504
|
+
if (model) {
|
505
|
+
metadata.model = model;
|
506
|
+
}
|
507
|
+
else {
|
508
|
+
delete metadata.model;
|
509
|
+
}
|
510
|
+
// module
|
511
|
+
if (!metadata.module) {
|
512
|
+
delete metadata.module;
|
513
|
+
}
|
514
|
+
// reference
|
515
|
+
if (!metadata.reference) {
|
516
|
+
delete metadata.reference;
|
517
|
+
}
|
518
|
+
// inputs
|
519
|
+
const inputs = Object.entries((_b = metadata.inputs) !== null && _b !== void 0 ? _b : {}).reduce((acc, [key, value]) => {
|
520
|
+
return Object.assign(Object.assign({}, acc), { [key]: value || null });
|
521
|
+
}, {});
|
522
|
+
if (inputs && Object.keys(inputs).length > 0) {
|
523
|
+
metadata.inputs = inputs;
|
524
|
+
}
|
525
|
+
else {
|
526
|
+
delete metadata.inputs;
|
527
|
+
}
|
528
|
+
// outputs
|
529
|
+
const outputs = Object.entries((_c = metadata.outputs) !== null && _c !== void 0 ? _c : {}).reduce((acc, [key, value]) => {
|
530
|
+
return Object.assign(Object.assign({}, acc), { [key]: value || null });
|
531
|
+
}, {});
|
532
|
+
if (outputs && Object.keys(outputs).length > 0) {
|
533
|
+
metadata.outputs = outputs;
|
534
|
+
}
|
535
|
+
else {
|
536
|
+
delete metadata.outputs;
|
537
|
+
}
|
538
|
+
// children
|
539
|
+
if (!((_d = metadata.children) === null || _d === void 0 ? void 0 : _d.length)) {
|
540
|
+
delete metadata.children;
|
541
|
+
}
|
542
|
+
// isShared
|
543
|
+
if (!metadata.isShared) {
|
544
|
+
delete metadata.isShared;
|
545
|
+
}
|
546
|
+
// configuredStyles
|
547
|
+
if (!metadata.configuredStyles) {
|
548
|
+
delete metadata.configuredStyles;
|
549
|
+
}
|
550
|
+
return metadata;
|
551
|
+
};
|
552
|
+
const extractElementMetadata = (script) => {
|
553
|
+
var _a;
|
554
|
+
const metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
555
|
+
// need to reset regex last index to prevent null result for next execution
|
556
|
+
METADATA_DECORATOR_REGEX.lastIndex = 0;
|
557
|
+
return new Function(`return ${metadataString}`)();
|
558
|
+
};
|
559
|
+
const extendElementMetadata = (script, extend) => {
|
560
|
+
var _a;
|
561
|
+
const metadataString = ((_a = METADATA_DECORATOR_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
562
|
+
// need to reset regex last index to prevent null result for next execution
|
563
|
+
METADATA_DECORATOR_REGEX.lastIndex = 0;
|
564
|
+
if (!metadataString) {
|
565
|
+
return script;
|
566
|
+
}
|
567
|
+
const updated = Object.assign(Object.assign({}, new Function(`return ${metadataString}`)()), extend);
|
568
|
+
return script.replace(metadataString, stringifyElementMetadata(updated));
|
569
|
+
};
|
570
|
+
const getElementConfig = (type) => {
|
571
|
+
return CONFIG[type];
|
572
|
+
};
|
573
|
+
const doesElementSupportIO = (type) => {
|
574
|
+
var _a, _b;
|
575
|
+
return (_b = (_a = getElementConfig(type).plugins) === null || _a === void 0 ? void 0 : _a.includes(IOPlugin)) !== null && _b !== void 0 ? _b : false;
|
576
|
+
};
|
577
|
+
function stringifyElementMetadata(elementMetadata) {
|
578
|
+
const cleaned = JSON.stringify(elementMetadata, null, 2);
|
579
|
+
return cleaned.replace(/^[\t ]*"[^:\n\r]+(?<!\\)":/gm, function (match) {
|
580
|
+
return match.replace(/"/g, '');
|
581
|
+
});
|
582
|
+
}
|
583
|
+
const isValidScript = (script) => {
|
584
|
+
var _a;
|
585
|
+
if (!script) {
|
586
|
+
return false;
|
587
|
+
}
|
588
|
+
const exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
|
589
|
+
if (!exportedClassName) {
|
590
|
+
return false;
|
591
|
+
}
|
592
|
+
const meta = extractElementMetadata(script);
|
593
|
+
if (!meta.name || !meta.type) {
|
594
|
+
return false;
|
595
|
+
}
|
596
|
+
return true;
|
597
|
+
};
|
598
|
+
function flattenElements(elements) {
|
599
|
+
return flatten(elements.map(el => [el, ...flattenElements(el.children)]));
|
600
|
+
}
|
601
|
+
function isSharedElement(el) {
|
602
|
+
return Boolean(el.isShared) && el.type !== 'REFERENCE';
|
603
|
+
}
|
604
|
+
|
605
|
+
class ElementContextService {
|
606
|
+
}
|
607
|
+
ElementContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementContextService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
608
|
+
ElementContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementContextService });
|
609
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementContextService, decorators: [{
|
610
|
+
type: Injectable
|
611
|
+
}] });
|
612
|
+
|
613
|
+
class ElementRendererComponent {
|
614
|
+
constructor(parentInjector, dynamicModuleService, elementContext, ioProviderService, configurationService, elementRef, cdr) {
|
615
|
+
this.parentInjector = parentInjector;
|
616
|
+
this.dynamicModuleService = dynamicModuleService;
|
617
|
+
this.elementContext = elementContext;
|
618
|
+
this.ioProviderService = ioProviderService;
|
619
|
+
this.configurationService = configurationService;
|
620
|
+
this.elementRef = elementRef;
|
621
|
+
this.cdr = cdr;
|
622
|
+
this.refs = {};
|
623
|
+
this.destroy$ = new Subject();
|
624
|
+
}
|
625
|
+
ngOnInit() {
|
626
|
+
this.elementContext.metadata = this.meta;
|
627
|
+
this.factory = this.dynamicModuleService.getComponentFactory(this.meta);
|
628
|
+
this.createComponents();
|
629
|
+
}
|
630
|
+
ngOnDestroy() {
|
631
|
+
this.destroyComponents();
|
632
|
+
this.destroy$.next();
|
633
|
+
this.destroy$.complete();
|
634
|
+
}
|
635
|
+
createComponents() {
|
636
|
+
const modelMeta = this.meta.model;
|
637
|
+
if (!modelMeta) {
|
638
|
+
this.refs[UUID.UUID()] = this.createComponent();
|
639
|
+
return;
|
640
|
+
}
|
641
|
+
if (modelMeta.lineItem) {
|
642
|
+
this.createFromLineItem(modelMeta.lineItem);
|
643
|
+
}
|
644
|
+
else if (modelMeta.path) {
|
645
|
+
this.createFromPath(modelMeta.path);
|
646
|
+
}
|
647
|
+
}
|
648
|
+
createFromPath(path) {
|
649
|
+
const array$ = this.ioProviderService.connect(this.meta, 'children$', path);
|
650
|
+
array$ === null || array$ === void 0 ? void 0 : array$.pipe(takeUntil(this.destroy$)).subscribe(children => {
|
651
|
+
if (!isArray(children)) {
|
652
|
+
return;
|
653
|
+
}
|
654
|
+
this.processChildren(children);
|
655
|
+
});
|
656
|
+
}
|
657
|
+
getModelComponent() {
|
658
|
+
let component = null;
|
659
|
+
let injector = this.parentInjector;
|
660
|
+
while (!component) {
|
661
|
+
const parentComp = injector.get(ElementRendererComponent, null);
|
662
|
+
if (parentComp === null || parentComp === void 0 ? void 0 : parentComp.meta.model) {
|
663
|
+
component = parentComp;
|
664
|
+
break;
|
665
|
+
}
|
666
|
+
if (parentComp) {
|
667
|
+
injector = parentComp.parentInjector;
|
668
|
+
}
|
669
|
+
else {
|
670
|
+
break;
|
671
|
+
}
|
672
|
+
}
|
673
|
+
return component;
|
674
|
+
}
|
675
|
+
createFromLineItem(path) {
|
676
|
+
var _a, _b;
|
677
|
+
const parentComp = this.getModelComponent();
|
678
|
+
const parentPath = (_a = parentComp === null || parentComp === void 0 ? void 0 : parentComp.meta.model) === null || _a === void 0 ? void 0 : _a.lineItem;
|
679
|
+
const pathBlocks = parseBoundPath(path).reverse();
|
680
|
+
const { property, name } = (_b = pathBlocks[1]) !== null && _b !== void 0 ? _b : {};
|
681
|
+
const finalPath = pathBlocks[0];
|
682
|
+
const children$ = this.getParentLineItem$(parentComp).pipe(map(model => {
|
683
|
+
var _a;
|
684
|
+
if (!model) {
|
685
|
+
return [];
|
686
|
+
}
|
687
|
+
if (property === 'ports' && !finalPath.property && parentPath !== path) {
|
688
|
+
return (_a = model.lineItems.filter(({ port }) => port === name)) !== null && _a !== void 0 ? _a : [];
|
689
|
+
}
|
690
|
+
return [model];
|
691
|
+
}));
|
692
|
+
children$.pipe(takeUntil(this.destroy$)).subscribe(children => {
|
693
|
+
this.processChildren(children);
|
694
|
+
});
|
695
|
+
}
|
696
|
+
processChildren(children) {
|
697
|
+
const refs = children.reduce((acc, data, index) => {
|
698
|
+
var _a;
|
699
|
+
const key = String((_a = data === null || data === void 0 ? void 0 : data.id) !== null && _a !== void 0 ? _a : UUID.UUID());
|
700
|
+
const existingRef = this.refs[key];
|
701
|
+
const ref = existingRef !== null && existingRef !== void 0 ? existingRef : this.createComponent(data, index);
|
702
|
+
if (existingRef) {
|
703
|
+
this.updateComponent(existingRef, data, index);
|
704
|
+
}
|
705
|
+
return ref ? Object.assign(Object.assign({}, acc), { [key]: ref }) : acc;
|
706
|
+
}, {});
|
707
|
+
const existingKeys = Object.keys(this.refs);
|
708
|
+
const newKeys = Object.keys(refs);
|
709
|
+
pull(existingKeys, ...newKeys).forEach(key => {
|
710
|
+
this.destroyComponent(key);
|
711
|
+
});
|
712
|
+
this.refs = refs;
|
713
|
+
this.cdr.detectChanges();
|
714
|
+
}
|
715
|
+
getParentLineItem$(parentComp) {
|
716
|
+
var _a;
|
717
|
+
const parentRefs = Object.values((_a = parentComp === null || parentComp === void 0 ? void 0 : parentComp.refs) !== null && _a !== void 0 ? _a : {});
|
718
|
+
const parentRef = parentRefs.find(ref => { var _a; return (_a = ref === null || ref === void 0 ? void 0 : ref.location.nativeElement) === null || _a === void 0 ? void 0 : _a.contains(this.elementRef.nativeElement); });
|
719
|
+
const parentModel$ = parentRef === null || parentRef === void 0 ? void 0 : parentRef.instance.model$;
|
720
|
+
return parentModel$ !== null && parentModel$ !== void 0 ? parentModel$ : this.configurationService.get();
|
721
|
+
}
|
722
|
+
createComponent(data, index) {
|
723
|
+
var _a, _b;
|
724
|
+
if (!this.factory) {
|
725
|
+
return;
|
726
|
+
}
|
727
|
+
const componentRef = (_a = this.el) === null || _a === void 0 ? void 0 : _a.createComponent(this.factory, index);
|
728
|
+
if (componentRef) {
|
729
|
+
componentRef.location.nativeElement.setAttribute('name', this.meta.name);
|
730
|
+
componentRef.location.nativeElement.setAttribute('path', this.meta.path);
|
731
|
+
(_b = componentRef.instance) === null || _b === void 0 ? void 0 : _b.model$.next(data);
|
732
|
+
}
|
733
|
+
return componentRef;
|
734
|
+
}
|
735
|
+
updateComponent(ref, data, index) {
|
736
|
+
ref.instance.model$.next(data);
|
737
|
+
if (this.el && this.el.indexOf(ref.hostView) !== index) {
|
738
|
+
this.el.move(ref.hostView, index);
|
739
|
+
}
|
740
|
+
}
|
741
|
+
destroyComponent(key) {
|
742
|
+
var _a;
|
743
|
+
(_a = this.refs[key]) === null || _a === void 0 ? void 0 : _a.destroy();
|
744
|
+
delete this.refs[key];
|
745
|
+
}
|
746
|
+
destroyComponents() {
|
747
|
+
Object.values(this.refs).forEach(ref => ref === null || ref === void 0 ? void 0 : ref.destroy());
|
748
|
+
this.refs = {};
|
749
|
+
}
|
750
|
+
}
|
751
|
+
ElementRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererComponent, deps: [{ token: i0.Injector, skipSelf: true }, { token: DynamicModuleService }, { token: ElementContextService }, { token: IOProviderService }, { token: i2.ConfigurationService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
752
|
+
ElementRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", 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 });
|
753
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererComponent, decorators: [{
|
754
|
+
type: Component,
|
755
|
+
args: [{
|
756
|
+
selector: 'vl-cms-element-renderer',
|
757
|
+
templateUrl: './element-renderer.component.html',
|
758
|
+
styleUrls: ['./element-renderer.component.scss'],
|
759
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
760
|
+
providers: [ElementContextService],
|
761
|
+
}]
|
762
|
+
}], ctorParameters: function () { return [{ type: i0.Injector, decorators: [{
|
763
|
+
type: SkipSelf
|
764
|
+
}] }, { type: DynamicModuleService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2.ConfigurationService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { el: [{
|
765
|
+
type: ViewChild,
|
766
|
+
args: ['el', { read: ViewContainerRef, static: true }]
|
767
|
+
}], meta: [{
|
768
|
+
type: Input
|
769
|
+
}] } });
|
770
|
+
|
771
|
+
class ElementChildrenComponent {
|
772
|
+
constructor(elementContext) {
|
773
|
+
this.elementContext = elementContext;
|
774
|
+
this.metadata = this.elementContext.metadata;
|
775
|
+
}
|
776
|
+
}
|
777
|
+
ElementChildrenComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenComponent, deps: [{ token: ElementContextService }], target: i0.ɵɵFactoryTarget.Component });
|
778
|
+
ElementChildrenComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: ElementChildrenComponent, selector: "element-children", ngImport: i0, template: "<ng-container *ngIf=\"metadata?.children.length\">\n <ng-container *ngFor=\"let child of metadata.children\">\n <vl-cms-element-renderer [meta]=\"child\"></vl-cms-element-renderer>\n </ng-container>\n</ng-container>\n", styles: [":host{display:contents}\n"], components: [{ type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
779
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenComponent, decorators: [{
|
780
|
+
type: Component,
|
781
|
+
args: [{
|
782
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
783
|
+
selector: 'element-children',
|
784
|
+
templateUrl: 'element-children.component.html',
|
785
|
+
styleUrls: ['./element-children.component.scss'],
|
786
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
787
|
+
}]
|
788
|
+
}], ctorParameters: function () { return [{ type: ElementContextService }]; } });
|
789
|
+
|
790
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
791
|
+
class CustomTemplateDirective {
|
792
|
+
constructor(templateRef, templatesService) {
|
793
|
+
this.templateRef = templateRef;
|
794
|
+
this.templatesService = templatesService;
|
795
|
+
}
|
796
|
+
ngAfterViewInit() {
|
797
|
+
if (!this.customTemplate) {
|
798
|
+
return;
|
799
|
+
}
|
800
|
+
this.templatesService.register(this.customTemplate, this.templateRef);
|
801
|
+
}
|
802
|
+
}
|
803
|
+
CustomTemplateDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CustomTemplateDirective, deps: [{ token: i0.TemplateRef }, { token: TemplatesService }], target: i0.ɵɵFactoryTarget.Directive });
|
804
|
+
CustomTemplateDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: CustomTemplateDirective, selector: "[customTemplate]", inputs: { customTemplate: "customTemplate" }, ngImport: i0 });
|
805
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: CustomTemplateDirective, decorators: [{
|
806
|
+
type: Directive,
|
807
|
+
args: [{ selector: '[customTemplate]' }]
|
808
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }, { type: TemplatesService }]; }, propDecorators: { customTemplate: [{
|
809
|
+
type: Input
|
810
|
+
}] } });
|
811
|
+
|
812
|
+
const defaultOptions = {
|
813
|
+
suppressLoading: false,
|
814
|
+
loadingLabel: 'LOADING',
|
815
|
+
};
|
816
|
+
|
817
|
+
const moduleMap = {};
|
818
|
+
function loadRemoteEntry(remoteEntry) {
|
819
|
+
return new Promise((resolve, reject) => {
|
820
|
+
if (moduleMap[remoteEntry]) {
|
821
|
+
resolve();
|
822
|
+
return;
|
823
|
+
}
|
824
|
+
const script = document.createElement('script');
|
825
|
+
script.src = remoteEntry;
|
826
|
+
script.onerror = reject;
|
827
|
+
script.onload = () => {
|
828
|
+
moduleMap[remoteEntry] = true;
|
829
|
+
resolve(); // window is the global namespace
|
830
|
+
};
|
831
|
+
document.body.append(script);
|
832
|
+
});
|
833
|
+
}
|
834
|
+
function lookupExposedModule(remoteName, exposedModule) {
|
835
|
+
return __awaiter(this, void 0, void 0, function* () {
|
836
|
+
// Initializes the share scope. This fills it with known provided modules from this build and all remotes
|
837
|
+
yield __webpack_init_sharing__('default');
|
838
|
+
const container = window[remoteName]; // or get the container somewhere else
|
839
|
+
// Initialize the container, it may provide shared modules
|
840
|
+
yield container.init(__webpack_share_scopes__.default);
|
841
|
+
const factory = yield container.get(exposedModule);
|
842
|
+
const Module = factory();
|
843
|
+
return Module;
|
844
|
+
});
|
845
|
+
}
|
846
|
+
function loadRemoteModule(remoteEntry, remoteName, exposedModule) {
|
847
|
+
return __awaiter(this, void 0, void 0, function* () {
|
848
|
+
yield loadRemoteEntry(remoteEntry);
|
849
|
+
return yield lookupExposedModule(remoteName, exposedModule);
|
850
|
+
});
|
851
|
+
}
|
852
|
+
|
853
|
+
class FederatedComponent {
|
854
|
+
constructor(injector, compiler, appRef, renderer) {
|
855
|
+
this.injector = injector;
|
856
|
+
this.compiler = compiler;
|
857
|
+
this.appRef = appRef;
|
858
|
+
this.renderer = renderer;
|
859
|
+
this.isLoading$ = new BehaviorSubject(false);
|
860
|
+
// configs
|
861
|
+
this.suppressLoading = defaultOptions.suppressLoading;
|
862
|
+
this.loadingLabel = defaultOptions.loadingLabel;
|
863
|
+
}
|
864
|
+
ngOnChanges(changes) {
|
865
|
+
var _a, _b, _c, _d;
|
866
|
+
if (changes.data && this.instance) {
|
867
|
+
this.instance.data = this.data;
|
868
|
+
}
|
869
|
+
if (changes.options) {
|
870
|
+
this.suppressLoading = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.suppressLoading) !== null && _b !== void 0 ? _b : defaultOptions.suppressLoading;
|
871
|
+
this.loadingLabel = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.loadingLabel) !== null && _d !== void 0 ? _d : defaultOptions.loadingLabel;
|
872
|
+
}
|
873
|
+
}
|
874
|
+
ngOnInit() {
|
875
|
+
this.isLoading$.next(true);
|
876
|
+
}
|
877
|
+
ngAfterViewInit() {
|
878
|
+
var _a, _b, _c, _d, _e, _f;
|
879
|
+
const remoteEntry = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.remoteEntry) !== null && _b !== void 0 ? _b : this.remoteEntry;
|
880
|
+
const remoteName = (_d = (_c = this.options) === null || _c === void 0 ? void 0 : _c.remoteName) !== null && _d !== void 0 ? _d : this.remoteName;
|
881
|
+
const exposedModule = (_f = (_e = this.options) === null || _e === void 0 ? void 0 : _e.exposedModule) !== null && _f !== void 0 ? _f : this.exposedModule;
|
882
|
+
if (!remoteEntry || !remoteName || !exposedModule) {
|
883
|
+
return;
|
884
|
+
}
|
885
|
+
loadRemoteModule(remoteEntry, remoteName, exposedModule).then(federated => {
|
886
|
+
this.compiler.compileModuleAsync(federated[exposedModule]).then(moduleFactory => {
|
887
|
+
var _a, _b, _c;
|
888
|
+
const rootModuleRef = moduleFactory.create(this.injector);
|
889
|
+
const rootComponentFactory = rootModuleRef.componentFactoryResolver.resolveComponentFactory(federated[exposedModule].rootComponent);
|
890
|
+
const node = document.createElement('div');
|
891
|
+
const { instance, hostView } = rootComponentFactory.create(this.injector, [], node);
|
892
|
+
this.instance = instance;
|
893
|
+
this.instance.data = this.data;
|
894
|
+
this.renderer.appendChild((_a = this.moduleHostRef) === null || _a === void 0 ? void 0 : _a.nativeElement, node);
|
895
|
+
this.appRef.attachView(hostView);
|
896
|
+
(_c = (_b = this.options) === null || _b === void 0 ? void 0 : _b.onReady) === null || _c === void 0 ? void 0 : _c.call(_b);
|
897
|
+
this.isLoading$.next(false);
|
898
|
+
});
|
899
|
+
});
|
900
|
+
}
|
901
|
+
}
|
902
|
+
FederatedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedComponent, deps: [{ token: i0.Injector }, { token: i0.Compiler }, { token: i0.ApplicationRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
|
903
|
+
FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "moduleHostRef", first: true, predicate: ["moduleHost"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div #moduleHost></div>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], components: [{ type: i1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], pipes: { "async": i7.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
904
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedComponent, decorators: [{
|
905
|
+
type: Component,
|
906
|
+
args: [{
|
907
|
+
// eslint-disable-next-line @angular-eslint/component-selector
|
908
|
+
selector: 'veloce-host-federated',
|
909
|
+
templateUrl: './federated.component.html',
|
910
|
+
styleUrls: ['./federated.component.scss'],
|
911
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
912
|
+
}]
|
913
|
+
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i0.Compiler }, { type: i0.ApplicationRef }, { type: i0.Renderer2 }]; }, propDecorators: { moduleHostRef: [{
|
914
|
+
type: ViewChild,
|
915
|
+
args: ['moduleHost', { static: false }]
|
916
|
+
}], remoteEntry: [{
|
917
|
+
type: Input
|
918
|
+
}], remoteName: [{
|
919
|
+
type: Input
|
920
|
+
}], exposedModule: [{
|
921
|
+
type: Input
|
922
|
+
}], data: [{
|
923
|
+
type: Input
|
924
|
+
}], options: [{
|
925
|
+
type: Input
|
926
|
+
}] } });
|
927
|
+
|
928
|
+
class FederatedModule {
|
929
|
+
}
|
930
|
+
FederatedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
931
|
+
FederatedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, declarations: [FederatedComponent], imports: [CommonModule, LoaderModule], exports: [FederatedComponent] });
|
932
|
+
FederatedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, imports: [[CommonModule, LoaderModule]] });
|
933
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FederatedModule, decorators: [{
|
934
|
+
type: NgModule,
|
935
|
+
args: [{
|
936
|
+
declarations: [FederatedComponent],
|
937
|
+
imports: [CommonModule, LoaderModule],
|
938
|
+
exports: [FederatedComponent],
|
939
|
+
}]
|
940
|
+
}] });
|
941
|
+
|
942
|
+
class ConfigurationPlugin {
|
943
|
+
constructor(host) {
|
944
|
+
var _a, _b;
|
945
|
+
this.host = host;
|
946
|
+
this.destroy$ = new Subject();
|
947
|
+
this.elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
948
|
+
this.configurationService = this.host.injector.get(ConfigurationService);
|
949
|
+
if ((_a = this.elementMetadata.model) === null || _a === void 0 ? void 0 : _a.lineItem) {
|
950
|
+
this.host.model$.pipe(takeUntil(this.destroy$)).subscribe(model => (this.modelSnapshot = model));
|
951
|
+
const pathBlocks = parseBoundPath((_b = this.elementMetadata.model) === null || _b === void 0 ? void 0 : _b.lineItem);
|
952
|
+
const { type, property, name } = pathBlocks.reverse()[0];
|
953
|
+
this.host.boundName = name !== null && name !== void 0 ? name : type;
|
954
|
+
this.register(type, property, name);
|
955
|
+
}
|
956
|
+
}
|
957
|
+
ngOnDestroy() {
|
958
|
+
this.destroy$.next();
|
959
|
+
this.destroy$.complete();
|
960
|
+
}
|
961
|
+
register(type, property, name) {
|
962
|
+
if (!type) {
|
963
|
+
return;
|
964
|
+
}
|
965
|
+
if (!property) {
|
966
|
+
this.registerType();
|
967
|
+
}
|
968
|
+
else if (property === 'ports' && name) {
|
969
|
+
this.registerPort(name);
|
970
|
+
}
|
971
|
+
else if (property === 'attributes' && name) {
|
972
|
+
this.registerAttribute(name);
|
973
|
+
}
|
974
|
+
}
|
975
|
+
registerType() {
|
976
|
+
const remove = () => {
|
977
|
+
const rootLineItem = this.configurationService.getSnapshot();
|
978
|
+
if (!rootLineItem || !this.modelSnapshot) {
|
979
|
+
return;
|
980
|
+
}
|
981
|
+
this.configurationService.patch(new LineItemWorker(rootLineItem).remove(this.modelSnapshot.id).li);
|
982
|
+
};
|
983
|
+
this.typeHost.remove = remove;
|
984
|
+
}
|
985
|
+
registerPort(name) {
|
986
|
+
const model$ = this.host.model$;
|
987
|
+
const portItems$ = model$.pipe(map(model => { var _a; return (_a = model === null || model === void 0 ? void 0 : model.lineItems.filter(li => li.port === this.host.boundName)) !== null && _a !== void 0 ? _a : []; }));
|
988
|
+
const portDomain$ = model$.pipe(map(model => model === null || model === void 0 ? void 0 : model.portDomains[this.host.boundName]));
|
989
|
+
const add = (type, attributes = []) => {
|
990
|
+
if (!this.modelSnapshot) {
|
991
|
+
return;
|
992
|
+
}
|
993
|
+
const portDomain = this.modelSnapshot.portDomains[name];
|
994
|
+
if (!portDomain) {
|
995
|
+
return;
|
996
|
+
}
|
997
|
+
const generated = generateLineItem(portDomain.name, type, this.modelSnapshot.id, attributes);
|
998
|
+
this.configurationService.patch(new LineItemWorker(this.modelSnapshot).insert(this.modelSnapshot.id, generated).li);
|
999
|
+
};
|
1000
|
+
this.portHost.portItems$ = portItems$;
|
1001
|
+
this.portHost.portDomain$ = portDomain$;
|
1002
|
+
this.portHost.addPortItem = add;
|
1003
|
+
}
|
1004
|
+
registerAttribute(name) {
|
1005
|
+
if (!this.host.model$) {
|
1006
|
+
return;
|
1007
|
+
}
|
1008
|
+
const value$ = this.host.model$.pipe(map(model => { var _a; return getAttributeValue((_a = model === null || model === void 0 ? void 0 : model.attributes) !== null && _a !== void 0 ? _a : [], name); }));
|
1009
|
+
const patch = (value) => {
|
1010
|
+
if (!this.modelSnapshot) {
|
1011
|
+
return;
|
1012
|
+
}
|
1013
|
+
this.configurationService.patch(new LineItemWorker(this.modelSnapshot).patchAttribute([{ name, value }]).li);
|
1014
|
+
};
|
1015
|
+
this.attributeHost.value$ = value$;
|
1016
|
+
this.attributeHost.patch = patch;
|
1017
|
+
}
|
1018
|
+
get attributeHost() {
|
1019
|
+
return this.host;
|
1020
|
+
}
|
1021
|
+
get typeHost() {
|
1022
|
+
return this.host;
|
1023
|
+
}
|
1024
|
+
get portHost() {
|
1025
|
+
return this.host;
|
1026
|
+
}
|
1027
|
+
}
|
1028
|
+
ConfigurationPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationPlugin, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
1029
|
+
ConfigurationPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.2.15", type: ConfigurationPlugin, ngImport: i0 });
|
1030
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationPlugin, decorators: [{
|
1031
|
+
type: Directive
|
1032
|
+
}], ctorParameters: function () { return [{ type: undefined }]; } });
|
1033
|
+
|
1034
|
+
const DEFAULT_PLUGINS = {
|
1035
|
+
CONFIGURATION: [ConfigurationPlugin],
|
1036
|
+
DEFAULT: [],
|
1037
|
+
};
|
1038
|
+
|
1039
|
+
const InitAction = { type: 'INIT' };
|
1040
|
+
const ClearAction = { type: 'CLEAR' };
|
1041
|
+
class IntegrationState {
|
1042
|
+
constructor() {
|
1043
|
+
this.stateSubj$ = new BehaviorSubject({});
|
1044
|
+
this.action$ = new BehaviorSubject(InitAction);
|
1045
|
+
}
|
1046
|
+
get state$() {
|
1047
|
+
return this.stateSubj$.asObservable();
|
1048
|
+
}
|
1049
|
+
get state() {
|
1050
|
+
return this.stateSubj$.getValue();
|
1051
|
+
}
|
1052
|
+
patchState(update) {
|
1053
|
+
this.stateSubj$.next(Object.assign(Object.assign({}, this.stateSubj$.getValue()), update));
|
1054
|
+
}
|
1055
|
+
dispatch(action) {
|
1056
|
+
this.action$.next(action);
|
1057
|
+
}
|
1058
|
+
listen$(actionType) {
|
1059
|
+
return this.action$.pipe(filter(action => action.type === actionType), map(action => action.payload));
|
1060
|
+
}
|
1061
|
+
listenAll$() {
|
1062
|
+
return this.action$.asObservable();
|
1063
|
+
}
|
1064
|
+
clear() {
|
1065
|
+
this.stateSubj$.next({});
|
1066
|
+
this.action$.next(ClearAction);
|
1067
|
+
}
|
1068
|
+
}
|
1069
|
+
IntegrationState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IntegrationState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1070
|
+
IntegrationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IntegrationState, providedIn: 'root' });
|
1071
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: IntegrationState, decorators: [{
|
1072
|
+
type: Injectable,
|
1073
|
+
args: [{ providedIn: 'root' }]
|
1074
|
+
}] });
|
1075
|
+
|
1076
|
+
const VELOCE_LIBS = {
|
1077
|
+
'@veloceapps/sdk/core': Object.assign({ ConfigurationService,
|
1078
|
+
QuoteDraftService,
|
1079
|
+
FlowConfigurationService,
|
1080
|
+
LineItemWorker,
|
1081
|
+
ProductImagesService }, lineItemUtils),
|
1082
|
+
'@veloceapps/sdk/cms': Object.assign(Object.assign(Object.assign({}, cmsInjectionTokens), cmsActions), { TemplatesService,
|
1083
|
+
IntegrationState }),
|
1084
|
+
'@veloceapps/api': {
|
1085
|
+
SalesforceApiService,
|
1086
|
+
QuoteApiService,
|
1087
|
+
DocumentTemplatesApiService,
|
1088
|
+
DocumentAttachmentApiService,
|
1089
|
+
RampApiService,
|
1090
|
+
CatalogApiService,
|
1091
|
+
DeltaApiService,
|
1092
|
+
PicklistsApiService,
|
1093
|
+
PriceApiService,
|
1094
|
+
},
|
1095
|
+
};
|
1096
|
+
const VELOCE_LIBS_BACKWARDS_COMPATIBLE = Object.entries(VELOCE_LIBS).reduce((trunk, [key, value]) => (Object.assign(Object.assign({}, trunk), { [key.replace('@veloceapps/', '@veloce/')]: value })), {});
|
1097
|
+
const vendorMap = Object.assign(Object.assign(Object.assign({}, VELOCE_LIBS), VELOCE_LIBS_BACKWARDS_COMPATIBLE), { '@angular/core': i0, '@angular/forms': angularForms, rxjs: rxjs, 'rxjs/operators': rxjsOperators, lodash: lodash });
|
1098
|
+
|
1099
|
+
class ElementsResolver {
|
1100
|
+
constructor(uiDef, elements) {
|
1101
|
+
this.uiDef = uiDef;
|
1102
|
+
this.renderableElements = [];
|
1103
|
+
this.sharedElements = [];
|
1104
|
+
const transpiledElements = this.transpileScripts(elements);
|
1105
|
+
this.sharedElements = this.flattenElements(transpiledElements).filter(el => this.isSharedElement(el));
|
1106
|
+
this.elements = transpiledElements.map(el => this.processElementMetadata(el)).filter(Boolean);
|
1107
|
+
this.renderableElements = this.getRenderableElements(this.elements);
|
1108
|
+
}
|
1109
|
+
getNgComponents() {
|
1110
|
+
return this.renderableElements.map(el => this.resolveElement(el)).filter(Boolean);
|
1111
|
+
}
|
1112
|
+
transpile(el) {
|
1113
|
+
var _a;
|
1114
|
+
if (!el.script) {
|
1115
|
+
return;
|
1116
|
+
}
|
1117
|
+
const transformed = transform(el.script, {
|
1118
|
+
filename: el.name + '.ts',
|
1119
|
+
presets: ['typescript'],
|
1120
|
+
sourceMaps: 'inline',
|
1121
|
+
});
|
1122
|
+
return (_a = transformed.code) !== null && _a !== void 0 ? _a : undefined;
|
1123
|
+
}
|
1124
|
+
transpileScripts(elements) {
|
1125
|
+
return elements.map(el => (Object.assign(Object.assign({}, el), { script: this.transpile(el), children: this.transpileScripts(el.children) })));
|
1126
|
+
}
|
1127
|
+
flattenElements(elements) {
|
1128
|
+
return flatten(elements.map(el => [el, ...this.flattenElements(el.children)]));
|
1129
|
+
}
|
1130
|
+
isSharedElement(el) {
|
1131
|
+
return Boolean(el.isShared) && el.type !== 'REFERENCE';
|
1132
|
+
}
|
1133
|
+
getRenderableElements(elements) {
|
1134
|
+
const renderable = [];
|
1135
|
+
for (const el of elements) {
|
1136
|
+
if (!this.isSharedElement(el)) {
|
1137
|
+
const children = el.children.filter(child => !this.isSharedElement(child));
|
1138
|
+
const renderableChildren = this.getRenderableElements(children);
|
1139
|
+
renderable.push(Object.assign(Object.assign({}, el), { children }), ...renderableChildren);
|
1140
|
+
}
|
1141
|
+
}
|
1142
|
+
return renderable;
|
1143
|
+
}
|
1144
|
+
getSharedElement(element) {
|
1145
|
+
if (!element.reference) {
|
1146
|
+
return;
|
1147
|
+
}
|
1148
|
+
return this.sharedElements.find(el => element.reference === el.name);
|
1149
|
+
}
|
1150
|
+
resolveElementTemplate(element) {
|
1151
|
+
const config = CONFIG[element.type];
|
1152
|
+
const template = !config.suppressTemplate ? element.template : '';
|
1153
|
+
return template || config.defaultTemplate || '';
|
1154
|
+
}
|
1155
|
+
resolveElementStyles(element) {
|
1156
|
+
var _a;
|
1157
|
+
const config = CONFIG[element.type];
|
1158
|
+
return !config.suppressStyles ? (_a = element.styles) !== null && _a !== void 0 ? _a : '' : '';
|
1159
|
+
}
|
1160
|
+
processElementMetadata(sourceElement) {
|
1161
|
+
var _a, _b;
|
1162
|
+
let finalElement;
|
1163
|
+
if (sourceElement.type === 'REFERENCE') {
|
1164
|
+
const sharedElement = this.getSharedElement(sourceElement);
|
1165
|
+
if (!sharedElement) {
|
1166
|
+
console.warn(`Shared element "${sourceElement.reference}" not found`);
|
1167
|
+
return;
|
1168
|
+
}
|
1169
|
+
finalElement = Object.assign(Object.assign({}, sourceElement), { children: this.getSharedChildren(sharedElement.children, sourceElement.path), type: sharedElement.type, template: sharedElement.template, styles: ((_a = sharedElement.styles) !== null && _a !== void 0 ? _a : '') + '\n' + ((_b = sourceElement.styles) !== null && _b !== void 0 ? _b : ''), inputs: Object.assign(Object.assign({}, sharedElement.inputs), sourceElement.inputs), outputs: Object.assign(Object.assign({}, sharedElement.outputs), sourceElement.outputs) });
|
1170
|
+
}
|
1171
|
+
else {
|
1172
|
+
finalElement = sourceElement;
|
1173
|
+
delete sourceElement.reference;
|
1174
|
+
}
|
1175
|
+
finalElement.template = this.resolveElementTemplate(finalElement);
|
1176
|
+
finalElement.styles = this.resolveElementStyles(finalElement);
|
1177
|
+
return Object.assign(Object.assign({}, finalElement), { children: finalElement.children
|
1178
|
+
.map(child => this.processElementMetadata(child))
|
1179
|
+
.filter(Boolean) });
|
1180
|
+
}
|
1181
|
+
getSharedChildren(children, parentPath) {
|
1182
|
+
return children.map(c => {
|
1183
|
+
if (!c.path) {
|
1184
|
+
return c;
|
1185
|
+
}
|
1186
|
+
const [elName] = c.path.split('/').reverse();
|
1187
|
+
const path = parentPath + '/' + elName;
|
1188
|
+
return Object.assign(Object.assign({}, c), { path, children: this.getSharedChildren(c.children, path) });
|
1189
|
+
});
|
1190
|
+
}
|
1191
|
+
resolveElement(element) {
|
1192
|
+
var _a;
|
1193
|
+
const config = CONFIG[element.type];
|
1194
|
+
const defaultPlugins = (_a = DEFAULT_PLUGINS[this.uiDef.type]) !== null && _a !== void 0 ? _a : [];
|
1195
|
+
if (!config) {
|
1196
|
+
console.warn(`Unknown element type "${element.type}"`);
|
1197
|
+
return;
|
1198
|
+
}
|
1199
|
+
const styles = this.getElementStyles(element);
|
1200
|
+
const component = Object.assign(Object.assign({ selector: 'vl-element', template: element.template }, (styles ? { styles: [styles] } : {})), { providers: [
|
1201
|
+
{ provide: DEFAULT_PLUGINS_TOKEN, useValue: defaultPlugins },
|
1202
|
+
{ provide: UI_DEFINITION_METADATA, useValue: this.uiDef },
|
1203
|
+
{ provide: ELEMENT_METADATA, useValue: element },
|
1204
|
+
{ provide: SHARED_ELEMENT_METADATA, useValue: this.getSharedElement(element) },
|
1205
|
+
{ provide: ELEMENT_CONFIG, useValue: config },
|
1206
|
+
{ provide: VENDOR_MAP, useValue: vendorMap },
|
1207
|
+
] });
|
1208
|
+
const cmp = Component(component)(class C extends config.component {
|
1209
|
+
});
|
1210
|
+
set(cmp, 'path', element.path);
|
1211
|
+
return cmp;
|
1212
|
+
}
|
1213
|
+
getElementStyles(element) {
|
1214
|
+
let result = '';
|
1215
|
+
const configuredStyles = this.convertInlineStylesToCSS(element.configuredStyles);
|
1216
|
+
if (configuredStyles) {
|
1217
|
+
// order is important: styles written by user in CSS code should has higher priority
|
1218
|
+
result += configuredStyles;
|
1219
|
+
}
|
1220
|
+
if (element.styles) {
|
1221
|
+
result += element.styles;
|
1222
|
+
}
|
1223
|
+
return result || undefined;
|
1224
|
+
}
|
1225
|
+
convertInlineStylesToCSS(styles) {
|
1226
|
+
if (!styles) {
|
1227
|
+
return '';
|
1228
|
+
}
|
1229
|
+
const entries = Object.entries(styles);
|
1230
|
+
let result = ':host {\n';
|
1231
|
+
entries.forEach(([style, value]) => {
|
1232
|
+
result += ` ${kebabCase(style)}:${value};\n`;
|
1233
|
+
});
|
1234
|
+
result += '}\n';
|
1235
|
+
return result;
|
1236
|
+
}
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
class LauncherService {
|
1240
|
+
constructor(compiler, dynamicModuleService) {
|
1241
|
+
this.compiler = compiler;
|
1242
|
+
this.dynamicModuleService = dynamicModuleService;
|
1243
|
+
}
|
1244
|
+
compileModule(uiDef, elements) {
|
1245
|
+
const elementsResolver = new ElementsResolver(uiDef, elements);
|
1246
|
+
this.dynamicModuleService.elementsTree = elementsResolver.elements;
|
1247
|
+
this.module = this.getModule(elementsResolver.getNgComponents());
|
1248
|
+
return from(this.compiler.compileModuleAndAllComponentsAsync(this.module)).pipe(tap(m => {
|
1249
|
+
this.dynamicModuleService.componentFactories = m.componentFactories;
|
1250
|
+
this.moduleInstance = m;
|
1251
|
+
}), map(m => ({ module: m, elements: elementsResolver.elements })));
|
1252
|
+
}
|
1253
|
+
destroy() {
|
1254
|
+
if (this.moduleInstance) {
|
1255
|
+
this.dynamicModuleService.clear();
|
1256
|
+
this.moduleInstance = undefined;
|
1257
|
+
}
|
1258
|
+
if (this.module) {
|
1259
|
+
this.compiler.clearCacheFor(this.module);
|
1260
|
+
this.module = undefined;
|
1261
|
+
}
|
1262
|
+
}
|
1263
|
+
getModule(components) {
|
1264
|
+
const staticComponents = [ElementChildrenComponent, ElementRendererComponent, CustomTemplateDirective];
|
1265
|
+
let DynamicModule = class DynamicModule {
|
1266
|
+
};
|
1267
|
+
DynamicModule = __decorate([
|
1268
|
+
NgModule({
|
1269
|
+
imports: [CommonModule, FormsModule, ReactiveFormsModule, FederatedModule, DragDropModule],
|
1270
|
+
declarations: [...staticComponents, ...components],
|
1271
|
+
jit: true,
|
1272
|
+
})
|
1273
|
+
], DynamicModule);
|
1274
|
+
return DynamicModule;
|
1275
|
+
}
|
1276
|
+
}
|
1277
|
+
LauncherService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherService, deps: [{ token: i0.Compiler }, { token: DynamicModuleService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1278
|
+
LauncherService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherService });
|
1279
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherService, decorators: [{
|
1280
|
+
type: Injectable
|
1281
|
+
}], ctorParameters: function () { return [{ type: i0.Compiler }, { type: DynamicModuleService }]; } });
|
1282
|
+
|
1283
|
+
class PreviewComponent {
|
1284
|
+
constructor(launcherService, configurationService, messageService, runtimeService, integrationState) {
|
1285
|
+
this.launcherService = launcherService;
|
1286
|
+
this.configurationService = configurationService;
|
1287
|
+
this.messageService = messageService;
|
1288
|
+
this.runtimeService = runtimeService;
|
1289
|
+
this.integrationState = integrationState;
|
1290
|
+
this.clearState = false;
|
1291
|
+
this.state$ = new BehaviorSubject({ loading: true, failure: false });
|
1292
|
+
this.elements = [];
|
1293
|
+
this.destroy$ = new Subject();
|
1294
|
+
}
|
1295
|
+
ngOnInit() {
|
1296
|
+
if (this.clearState) {
|
1297
|
+
this.integrationState.clear();
|
1298
|
+
}
|
1299
|
+
this.startPreview();
|
1300
|
+
}
|
1301
|
+
ngOnDestroy() {
|
1302
|
+
this.destroy$.next();
|
1303
|
+
this.destroy$.complete();
|
1304
|
+
this.configurationService.reset();
|
1305
|
+
}
|
1306
|
+
initializeConfiguration$() {
|
1307
|
+
const isAlreadyInitialized = this.runtimeService.isInitialized;
|
1308
|
+
if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
|
1309
|
+
return of({});
|
1310
|
+
}
|
1311
|
+
if (!this.modelId) {
|
1312
|
+
console.warn(`No modelId is given for uiDefinition with '${this.uiDefinition.type}' type`);
|
1313
|
+
return of({});
|
1314
|
+
}
|
1315
|
+
// If still not initialized - init configuration in Test mode
|
1316
|
+
return this.runtimeService
|
1317
|
+
.initTestMode(this.modelId, this.uiDefinition)
|
1318
|
+
.pipe(switchMap(() => this.configurationService.configure()));
|
1319
|
+
}
|
1320
|
+
elementToMetadataSafe(elements) {
|
1321
|
+
var _a, _b;
|
1322
|
+
try {
|
1323
|
+
return elements.map(element => elementToMetadata(element));
|
1324
|
+
}
|
1325
|
+
catch (e) {
|
1326
|
+
console.error(e);
|
1327
|
+
if (!((_b = (_a = this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
|
1328
|
+
this.messageService.add({ severity: 'error', summary: String(e) });
|
1329
|
+
}
|
1330
|
+
return [];
|
1331
|
+
}
|
1332
|
+
}
|
1333
|
+
startPreview() {
|
1334
|
+
if (!this.uiDefinition) {
|
1335
|
+
return;
|
1336
|
+
}
|
1337
|
+
const _a = this.uiDefinition, { children } = _a, uiDefinitionMeta = __rest(_a, ["children"]);
|
1338
|
+
const elements = this.elementToMetadataSafe(children);
|
1339
|
+
const compilation$ = this.launcherService.compileModule(uiDefinitionMeta, elements);
|
1340
|
+
forkJoin([compilation$, this.initializeConfiguration$()])
|
1341
|
+
.pipe(tap(([result]) => {
|
1342
|
+
this.elements = result.elements;
|
1343
|
+
this.state$.next({ loading: false, failure: false });
|
1344
|
+
}), catchError(error => {
|
1345
|
+
var _a, _b;
|
1346
|
+
console.error(error);
|
1347
|
+
if (!((_b = (_a = this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
|
1348
|
+
this.messageService.add({ severity: 'error', summary: error });
|
1349
|
+
}
|
1350
|
+
this.state$.next({ loading: false, failure: true });
|
1351
|
+
return of();
|
1352
|
+
}), takeUntil(this.destroy$))
|
1353
|
+
.subscribe();
|
1354
|
+
}
|
1355
|
+
}
|
1356
|
+
PreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewComponent, deps: [{ token: LauncherService }, { token: i2.ConfigurationService }, { token: i3.MessageService }, { token: i2.ConfigurationRuntimeService }, { token: IntegrationState }], target: i0.ɵɵFactoryTarget.Component });
|
1357
|
+
PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.15", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition", clearState: "clearState" }, 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 *ngFor=\"let el of elements\" [meta]=\"el\"></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"], components: [{ type: i1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }], directives: [{ type: i7.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i7.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], pipes: { "async": i7.AsyncPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
|
1358
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewComponent, decorators: [{
|
1359
|
+
type: Component,
|
1360
|
+
args: [{
|
1361
|
+
selector: 'vl-cms-preview',
|
1362
|
+
templateUrl: './preview.component.html',
|
1363
|
+
styleUrls: ['./preview.component.scss'],
|
1364
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
1365
|
+
providers: [IOProviderService, TemplatesService],
|
1366
|
+
// use shadow DOM to prevent UI from being affected by global styles
|
1367
|
+
encapsulation: ViewEncapsulation.ShadowDom,
|
1368
|
+
}]
|
1369
|
+
}], ctorParameters: function () { return [{ type: LauncherService }, { type: i2.ConfigurationService }, { type: i3.MessageService }, { type: i2.ConfigurationRuntimeService }, { type: IntegrationState }]; }, propDecorators: { modelId: [{
|
1370
|
+
type: Input
|
1371
|
+
}], uiDefinition: [{
|
1372
|
+
type: Input
|
1373
|
+
}], clearState: [{
|
1374
|
+
type: Input
|
1375
|
+
}] } });
|
1376
|
+
|
1377
|
+
class ElementRendererModule {
|
1378
|
+
}
|
1379
|
+
ElementRendererModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1380
|
+
ElementRendererModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererModule, declarations: [ElementRendererComponent], exports: [ElementRendererComponent] });
|
1381
|
+
ElementRendererModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererModule });
|
1382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementRendererModule, decorators: [{
|
1383
|
+
type: NgModule,
|
1384
|
+
args: [{
|
1385
|
+
declarations: [ElementRendererComponent],
|
1386
|
+
exports: [ElementRendererComponent],
|
1387
|
+
}]
|
1388
|
+
}] });
|
1389
|
+
|
1390
|
+
class ElementChildrenModule {
|
1391
|
+
}
|
1392
|
+
ElementChildrenModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1393
|
+
ElementChildrenModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenModule, declarations: [ElementChildrenComponent], imports: [ElementRendererModule], exports: [ElementChildrenComponent] });
|
1394
|
+
ElementChildrenModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenModule, imports: [[ElementRendererModule]] });
|
1395
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ElementChildrenModule, decorators: [{
|
1396
|
+
type: NgModule,
|
1397
|
+
args: [{
|
1398
|
+
declarations: [ElementChildrenComponent],
|
1399
|
+
imports: [ElementRendererModule],
|
1400
|
+
exports: [ElementChildrenComponent],
|
1401
|
+
}]
|
1402
|
+
}] });
|
1403
|
+
|
1404
|
+
class PreviewModule {
|
1405
|
+
}
|
1406
|
+
PreviewModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1407
|
+
PreviewModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewModule, declarations: [PreviewComponent], imports: [CommonModule, LoaderModule, ElementRendererModule, ElementChildrenModule], exports: [PreviewComponent] });
|
1408
|
+
PreviewModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewModule, providers: [IntegrationState], imports: [[CommonModule, LoaderModule, ElementRendererModule, ElementChildrenModule]] });
|
1409
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: PreviewModule, decorators: [{
|
1410
|
+
type: NgModule,
|
1411
|
+
args: [{
|
1412
|
+
declarations: [PreviewComponent],
|
1413
|
+
imports: [CommonModule, LoaderModule, ElementRendererModule, ElementChildrenModule],
|
1414
|
+
providers: [IntegrationState],
|
1415
|
+
exports: [PreviewComponent],
|
1416
|
+
}]
|
1417
|
+
}] });
|
1418
|
+
|
1419
|
+
function ElementDefinition(definition) {
|
1420
|
+
return function (constructor) {
|
1421
|
+
return constructor;
|
1422
|
+
};
|
1423
|
+
}
|
1424
|
+
|
1425
|
+
class LauncherModule {
|
1426
|
+
}
|
1427
|
+
LauncherModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1428
|
+
LauncherModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherModule, imports: [CommonModule, CoreModule, ApiModule, SdkCoreModule] });
|
1429
|
+
LauncherModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherModule, providers: [LauncherService, IntegrationState, DynamicModuleService, DialogService], imports: [[CommonModule, CoreModule, ApiModule, SdkCoreModule]] });
|
1430
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: LauncherModule, decorators: [{
|
1431
|
+
type: NgModule,
|
1432
|
+
args: [{
|
1433
|
+
imports: [CommonModule, CoreModule, ApiModule, SdkCoreModule],
|
1434
|
+
providers: [LauncherService, IntegrationState, DynamicModuleService, DialogService],
|
1435
|
+
}]
|
1436
|
+
}] });
|
1437
|
+
|
1438
|
+
/**
|
1439
|
+
* Generated bundle index. Do not edit.
|
1440
|
+
*/
|
1441
|
+
|
1442
|
+
export { ApplyProductConfigurationAction, CloseDocGenAction, ConfigureProductAction, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, ElementsResolver, FlowAction, IntegrationState, LauncherModule, LauncherService, NavigateBackAction, NavigateToCatalogAction, OpenDocGenAction, PreviewComponent, PreviewModule, RemoteApplyAction, RemoteCancelAction, SHARED_ELEMENT_METADATA, SetDefaultMetrics, SwitchObjectAction, TemplatesService, UI_DEFINITION_METADATA, UiBuildError, VENDOR_MAP, doesElementSupportIO, elementToMetadata, extendElementMetadata, extractElementMetadata, findElementByModule, flattenElements, getAbsolutePath, getElementConfig, isSharedElement, isValidScript, metadataToElement, normalizeElementMetadata, parseBoundPath, parsePath, stringifyElementMetadata };
|
1443
|
+
//# sourceMappingURL=veloceapps-sdk-cms.js.map
|