@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,1035 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { Injectable, NgModule } from '@angular/core';
|
3
|
+
import { UUID, ConfigurationContext, ConfigurationContextMode, RuntimeModel, SalesforceIdUtils, ConfigurationMode, ChargeGroupUtils } from '@veloceapps/core';
|
4
|
+
import { BehaviorSubject, map as map$1, distinctUntilChanged, catchError, of, tap as tap$1, zip, noop, combineLatest, throwError, shareReplay as shareReplay$1, switchMap as switchMap$1 } from 'rxjs';
|
5
|
+
import { filter, tap, map, switchMap, skip, take, shareReplay, first, catchError as catchError$1, finalize } from 'rxjs/operators';
|
6
|
+
import * as i1 from '@veloceapps/api';
|
7
|
+
import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
|
8
|
+
import { merge, flatten, sortBy, cloneDeep } from 'lodash';
|
9
|
+
import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
|
10
|
+
import * as i4 from 'primeng/api';
|
11
|
+
import * as i5 from 'primeng/dynamicdialog';
|
12
|
+
import moment from 'moment';
|
13
|
+
|
14
|
+
const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
|
15
|
+
var _a, _b, _c;
|
16
|
+
const id = UUID.UUID();
|
17
|
+
const lineItem = Object.assign({ id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b.displayName) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (context.offeringId
|
18
|
+
? { offeringId: context.offeringId, offeringInstanceId: context.offeringInstanceId || id }
|
19
|
+
: {}));
|
20
|
+
return lineItem;
|
21
|
+
};
|
22
|
+
|
23
|
+
var RuntimeMode;
|
24
|
+
(function (RuntimeMode) {
|
25
|
+
RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
|
26
|
+
RuntimeMode[RuntimeMode["PROD"] = 1] = "PROD";
|
27
|
+
})(RuntimeMode || (RuntimeMode = {}));
|
28
|
+
var RuntimeOperation;
|
29
|
+
(function (RuntimeOperation) {
|
30
|
+
RuntimeOperation["INIT"] = "INIT";
|
31
|
+
RuntimeOperation["UPDATE"] = "UPDATE";
|
32
|
+
})(RuntimeOperation || (RuntimeOperation = {}));
|
33
|
+
var RuntimeStep;
|
34
|
+
(function (RuntimeStep) {
|
35
|
+
RuntimeStep["START"] = "START";
|
36
|
+
RuntimeStep["UPDATE"] = "UPDATE";
|
37
|
+
})(RuntimeStep || (RuntimeStep = {}));
|
38
|
+
|
39
|
+
class ContextService {
|
40
|
+
constructor(contextApiService) {
|
41
|
+
this.contextApiService = contextApiService;
|
42
|
+
this.context = new BehaviorSubject(null);
|
43
|
+
}
|
44
|
+
get isInitialized() {
|
45
|
+
return Boolean(this.context.value);
|
46
|
+
}
|
47
|
+
resolve() {
|
48
|
+
if (!this.context.value) {
|
49
|
+
throw new Error('Context is not initialized yet!');
|
50
|
+
}
|
51
|
+
return Object.assign({}, this.context.value);
|
52
|
+
}
|
53
|
+
resolve$() {
|
54
|
+
return this.context.pipe(filter((ctx) => Boolean(ctx)));
|
55
|
+
}
|
56
|
+
create(headerId, mode) {
|
57
|
+
return this.contextApiService.getContext(headerId, mode).pipe(tap(context => this.context.next(merge(new ConfigurationContext(headerId, mode), context))), map(() => this.resolve()));
|
58
|
+
}
|
59
|
+
update(partialContext) {
|
60
|
+
const originalContext = this.resolve();
|
61
|
+
const updatedContext = Object.assign(Object.assign(Object.assign({}, originalContext), partialContext), { properties: Object.assign(Object.assign({}, originalContext.properties), partialContext.properties) });
|
62
|
+
this.context.next(updatedContext);
|
63
|
+
return updatedContext;
|
64
|
+
}
|
65
|
+
set(context) {
|
66
|
+
const originalContext = this.resolve();
|
67
|
+
const updatedContext = Object.assign(Object.assign({}, originalContext), context);
|
68
|
+
this.context.next(updatedContext);
|
69
|
+
return updatedContext;
|
70
|
+
}
|
71
|
+
delete() {
|
72
|
+
this.context.next(null);
|
73
|
+
}
|
74
|
+
}
|
75
|
+
ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
76
|
+
ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ContextService, providedIn: 'root' });
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ContextService, decorators: [{
|
78
|
+
type: Injectable,
|
79
|
+
args: [{ providedIn: 'root' }]
|
80
|
+
}], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
|
81
|
+
|
82
|
+
class ProductImagesService {
|
83
|
+
constructor(productApiService) {
|
84
|
+
this.productApiService = productApiService;
|
85
|
+
this.imagesMap$ = new BehaviorSubject({});
|
86
|
+
}
|
87
|
+
getImageUrl$(productId) {
|
88
|
+
if (this.imagesMap$.value[productId] == null) {
|
89
|
+
this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: '' }));
|
90
|
+
this.fetchProductImage(productId);
|
91
|
+
}
|
92
|
+
return this.imagesMap$.pipe(map$1(imagesMap => imagesMap[productId]), distinctUntilChanged());
|
93
|
+
}
|
94
|
+
fetchProductImage(productId) {
|
95
|
+
this.productApiService
|
96
|
+
.fetchImage$(productId)
|
97
|
+
.pipe(map$1(file => URL.createObjectURL(file)), catchError(() => of('')), tap$1(url => this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: url }))))
|
98
|
+
.subscribe();
|
99
|
+
}
|
100
|
+
}
|
101
|
+
ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
102
|
+
ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductImagesService, providedIn: 'root' });
|
103
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ProductImagesService, decorators: [{
|
104
|
+
type: Injectable,
|
105
|
+
args: [{ providedIn: 'root' }]
|
106
|
+
}], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
|
107
|
+
|
108
|
+
class QuoteDraftService {
|
109
|
+
constructor(context, quoteApiService, priceApiService) {
|
110
|
+
this.context = context;
|
111
|
+
this.quoteApiService = quoteApiService;
|
112
|
+
this.priceApiService = priceApiService;
|
113
|
+
this.quoteSubj$ = new BehaviorSubject(null);
|
114
|
+
this.resetSubj$ = new BehaviorSubject(true);
|
115
|
+
this.isInitializedSubj$ = new BehaviorSubject(false);
|
116
|
+
this.initialCurrentState = [];
|
117
|
+
this.allPriceLists = [];
|
118
|
+
this.assetPriceLists = [];
|
119
|
+
this.hasUnsavedChanges = false;
|
120
|
+
this.reset$ = this.resetSubj$.asObservable();
|
121
|
+
this.activePriceList$ = this.context.resolve$().pipe(map(ctx => this.allPriceLists.find(priceList => priceList.id === ctx.properties.PriceListId)), map(priceList => priceList !== null && priceList !== void 0 ? priceList : null));
|
122
|
+
this.isInitializedSubj$
|
123
|
+
.pipe(filter(isInitialized => isInitialized), switchMap(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
|
124
|
+
.subscribe();
|
125
|
+
}
|
126
|
+
get isInitialized() {
|
127
|
+
return this.isInitializedSubj$.getValue();
|
128
|
+
}
|
129
|
+
set isInitialized(value) {
|
130
|
+
if (this.isInitialized !== value) {
|
131
|
+
this.isInitializedSubj$.next(value);
|
132
|
+
}
|
133
|
+
}
|
134
|
+
get hasAssets$() {
|
135
|
+
return this.quoteSubj$.pipe(map(() => this.hasAssets));
|
136
|
+
}
|
137
|
+
get hasAssets() {
|
138
|
+
const quoteDraft = this.quoteSubj$.value;
|
139
|
+
return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
|
140
|
+
}
|
141
|
+
reset() {
|
142
|
+
this.resetSubj$.next(true);
|
143
|
+
this.quoteSubj$.next(null);
|
144
|
+
this.initialCurrentState = [];
|
145
|
+
}
|
146
|
+
init(quoteId, params) {
|
147
|
+
return zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(tap(([quote, allPriceLists]) => {
|
148
|
+
this.allPriceLists = allPriceLists;
|
149
|
+
this.quoteSubj$.next(quote);
|
150
|
+
this.initialCurrentState = quote.currentState;
|
151
|
+
this.context.update(quote.context);
|
152
|
+
this.populateActivePriceLists$();
|
153
|
+
}), map(() => noop()), take(1));
|
154
|
+
}
|
155
|
+
setCurrentLineItemState(lineItems) {
|
156
|
+
const quoteDraft = this.quoteSubj$.value;
|
157
|
+
if (!quoteDraft) {
|
158
|
+
return;
|
159
|
+
}
|
160
|
+
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
|
161
|
+
}
|
162
|
+
updateQuoteDraft(update) {
|
163
|
+
const quoteDraft = this.quoteSubj$.value;
|
164
|
+
if (!quoteDraft) {
|
165
|
+
return;
|
166
|
+
}
|
167
|
+
if (update.context) {
|
168
|
+
this.context.set(update.context);
|
169
|
+
}
|
170
|
+
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
|
171
|
+
}
|
172
|
+
updateByPriceSummary(priceSummary) {
|
173
|
+
const quoteDraft = this.quoteSubj$.value;
|
174
|
+
if (!quoteDraft) {
|
175
|
+
return;
|
176
|
+
}
|
177
|
+
const updatedCurrentState = this.currentState.map(lineItem => {
|
178
|
+
const updated = priceSummary.lineItems.find(li => li.id === lineItem.id);
|
179
|
+
return updated !== null && updated !== void 0 ? updated : lineItem;
|
180
|
+
});
|
181
|
+
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
|
182
|
+
}
|
183
|
+
get quoteDraft$() {
|
184
|
+
return combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(map(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
|
185
|
+
}
|
186
|
+
get quoteDraft() {
|
187
|
+
const quote = this.quoteSubj$.value;
|
188
|
+
if (!quote) {
|
189
|
+
return null;
|
190
|
+
}
|
191
|
+
return Object.assign(Object.assign({}, quote), { context: this.context.resolve() });
|
192
|
+
}
|
193
|
+
get quoteDraftForActivePriceList() {
|
194
|
+
const quoteDraft = this.quoteDraft;
|
195
|
+
if (!quoteDraft) {
|
196
|
+
return null;
|
197
|
+
}
|
198
|
+
return Object.assign(Object.assign({}, quoteDraft), { initialState: this.filterByActivePriceList(quoteDraft.initialState), currentState: this.filterByActivePriceList(quoteDraft.currentState) });
|
199
|
+
}
|
200
|
+
get currentState$() {
|
201
|
+
return this.quoteDraft$.pipe(map(quote => quote.currentState));
|
202
|
+
}
|
203
|
+
get currentState() {
|
204
|
+
var _a, _b;
|
205
|
+
return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
206
|
+
}
|
207
|
+
/**
|
208
|
+
* Stream of activeCurrentState
|
209
|
+
*/
|
210
|
+
get activeCurrentState$() {
|
211
|
+
return this.quoteDraft$.pipe(map(() => this.activeCurrentState));
|
212
|
+
}
|
213
|
+
/**
|
214
|
+
* activeCurrentState is currentState passed through additional filters
|
215
|
+
*/
|
216
|
+
get activeCurrentState() {
|
217
|
+
var _a, _b;
|
218
|
+
let currentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
219
|
+
currentState = this.filterByActivePriceList(currentState);
|
220
|
+
return currentState;
|
221
|
+
}
|
222
|
+
/**
|
223
|
+
* Stream of activeInitialState
|
224
|
+
*/
|
225
|
+
get activeInitialState$() {
|
226
|
+
return this.quoteDraft$.pipe(map(() => this.activeInitialState));
|
227
|
+
}
|
228
|
+
/**
|
229
|
+
* activeInitialState is initialState passed through additional filters
|
230
|
+
*/
|
231
|
+
get activeInitialState() {
|
232
|
+
var _a, _b;
|
233
|
+
const ctx = this.context.resolve();
|
234
|
+
let initialState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState) !== null && _b !== void 0 ? _b : [];
|
235
|
+
if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
|
236
|
+
initialState = this.filterByActivePriceList(initialState);
|
237
|
+
}
|
238
|
+
return initialState;
|
239
|
+
}
|
240
|
+
get isStandalone() {
|
241
|
+
return this.context.resolve().properties.standalone === 'true';
|
242
|
+
}
|
243
|
+
get isStandalone$() {
|
244
|
+
return this.context.resolve$().pipe(map(() => this.isStandalone));
|
245
|
+
}
|
246
|
+
getInitialCurrentState() {
|
247
|
+
return this.initialCurrentState;
|
248
|
+
}
|
249
|
+
isEditMode$() {
|
250
|
+
return this.context.resolve$().pipe(map(() => this.isEditMode()));
|
251
|
+
}
|
252
|
+
isEditMode() {
|
253
|
+
const context = this.context.resolve();
|
254
|
+
if (context.mode === ConfigurationContextMode.ACCOUNT) {
|
255
|
+
return true;
|
256
|
+
}
|
257
|
+
if (context.mode === ConfigurationContextMode.QUOTE) {
|
258
|
+
return context.properties.Status === 'Draft';
|
259
|
+
}
|
260
|
+
return false;
|
261
|
+
}
|
262
|
+
updateActivePriceList(priceListId) {
|
263
|
+
this.context.update({ properties: { PriceListId: priceListId } });
|
264
|
+
}
|
265
|
+
populateActivePriceLists$() {
|
266
|
+
const ctx = this.context.resolve();
|
267
|
+
const quoteDraft = this.quoteDraft;
|
268
|
+
if (!quoteDraft) {
|
269
|
+
return;
|
270
|
+
}
|
271
|
+
// In ACCOUNT mode populate price lists from related assets
|
272
|
+
if (ctx.mode === ConfigurationContextMode.ACCOUNT) {
|
273
|
+
// Populate list of price lists
|
274
|
+
this.assetPriceLists = quoteDraft.currentState
|
275
|
+
.map(({ priceListId }) => priceListId)
|
276
|
+
.reduce((trunk, priceListId) => {
|
277
|
+
var _a, _b;
|
278
|
+
if (!priceListId || trunk.some(item => item.id === priceListId)) {
|
279
|
+
return trunk;
|
280
|
+
}
|
281
|
+
return [
|
282
|
+
...trunk,
|
283
|
+
{ id: priceListId, name: (_b = (_a = this.allPriceLists.find(item => item.id === priceListId)) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
|
284
|
+
];
|
285
|
+
}, []);
|
286
|
+
}
|
287
|
+
}
|
288
|
+
filterByActivePriceList(lineItems) {
|
289
|
+
const ctx = this.context.resolve();
|
290
|
+
return lineItems.filter(li => !li.priceListId || li.priceListId === ctx.properties.PriceListId);
|
291
|
+
}
|
292
|
+
markAsUpdated(quote) {
|
293
|
+
if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === ConfigurationContextMode.ACCOUNT) {
|
294
|
+
this.hasUnsavedChanges = !!quote && !quote.currentState.every(li => li.actionCode === 'EXIST');
|
295
|
+
}
|
296
|
+
else {
|
297
|
+
this.hasUnsavedChanges = true;
|
298
|
+
}
|
299
|
+
}
|
300
|
+
}
|
301
|
+
QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.QuoteApiService }, { token: i1.PriceApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
302
|
+
QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteDraftService, providedIn: 'root' });
|
303
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: QuoteDraftService, decorators: [{
|
304
|
+
type: Injectable,
|
305
|
+
args: [{ providedIn: 'root' }]
|
306
|
+
}], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }]; } });
|
307
|
+
|
308
|
+
class RuntimeContextService {
|
309
|
+
constructor(configurationApiService) {
|
310
|
+
this.configurationApiService = configurationApiService;
|
311
|
+
}
|
312
|
+
getRuntimeContext(productId, offeringId) {
|
313
|
+
return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(map(runtimeData => {
|
314
|
+
var _a, _b, _c;
|
315
|
+
const uiDefinition = this.getUIDefinition(runtimeData);
|
316
|
+
const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
|
317
|
+
const { productName, properties } = (_a = Array.from(runtimeModel.components.values()).find(c => c.productId === productId)) !== null && _a !== void 0 ? _a : {};
|
318
|
+
return {
|
319
|
+
modelId: runtimeData.modelId,
|
320
|
+
uiDefinition: uiDefinition,
|
321
|
+
runtimeModel: runtimeModel,
|
322
|
+
runtimeMode: RuntimeMode.PROD,
|
323
|
+
productId: productId,
|
324
|
+
productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
|
325
|
+
offeringId: offeringId,
|
326
|
+
properties: {
|
327
|
+
PricingEnabled: ((_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.pricingEnabled) ? 'true' : 'false',
|
328
|
+
PriceListId: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.priceList,
|
329
|
+
},
|
330
|
+
};
|
331
|
+
}));
|
332
|
+
}
|
333
|
+
getUIDefinition(runtimeData) {
|
334
|
+
var _a;
|
335
|
+
let rawUiDefinitions;
|
336
|
+
try {
|
337
|
+
rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
|
338
|
+
}
|
339
|
+
catch (e) {
|
340
|
+
return;
|
341
|
+
}
|
342
|
+
const uiDefinitions = rawUiDefinitions.filter(uiDef => uiDef.version);
|
343
|
+
const uiDefinition = (_a = uiDefinitions.find(uiDef => uiDef.primary)) !== null && _a !== void 0 ? _a : uiDefinitions[0];
|
344
|
+
return uiDefinition;
|
345
|
+
}
|
346
|
+
}
|
347
|
+
RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
348
|
+
RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService });
|
349
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: RuntimeContextService, decorators: [{
|
350
|
+
type: Injectable
|
351
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }]; } });
|
352
|
+
|
353
|
+
class ConfigurationRuntimeService {
|
354
|
+
constructor(apiService, contextService, runtimeContextService) {
|
355
|
+
this.apiService = apiService;
|
356
|
+
this.contextService = contextService;
|
357
|
+
this.runtimeContextService = runtimeContextService;
|
358
|
+
this._isInitialized = false;
|
359
|
+
this.uiDefinitionProperties = {};
|
360
|
+
}
|
361
|
+
reset() {
|
362
|
+
this._isInitialized = false;
|
363
|
+
this._runtimeContext = undefined;
|
364
|
+
this._assets = undefined;
|
365
|
+
this.initializationProps = undefined;
|
366
|
+
this.uiDefinitionProperties = {};
|
367
|
+
}
|
368
|
+
initTestMode(modelId, uiDefinition) {
|
369
|
+
var _a, _b;
|
370
|
+
this.uiDefinitionProperties = (_a = uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
|
371
|
+
const uiDefinitionExternals = (_b = uiDefinition.externals) !== null && _b !== void 0 ? _b : {};
|
372
|
+
return combineLatest([
|
373
|
+
this.apiService.getRuntimeDataByModelId(modelId),
|
374
|
+
this.contextService.create('TestId', ConfigurationContextMode.TEST),
|
375
|
+
]).pipe(first(), tap(([runtimeData, context]) => {
|
376
|
+
var _a;
|
377
|
+
this._runtimeContext = {
|
378
|
+
modelId: modelId,
|
379
|
+
runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
|
380
|
+
runtimeMode: RuntimeMode.TEST,
|
381
|
+
};
|
382
|
+
this.contextService.update({
|
383
|
+
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: modelId, RuntimeMode: ConfigurationContextMode.TEST, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: this.uiDefinitionProperties.priceList, standalone: 'true' }), uiDefinitionExternals),
|
384
|
+
});
|
385
|
+
this._isInitialized = true;
|
386
|
+
}));
|
387
|
+
}
|
388
|
+
init(props) {
|
389
|
+
this.initializationProps = props;
|
390
|
+
this._assets = props.assets;
|
391
|
+
const context = this.contextService.resolve();
|
392
|
+
return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(tap(runtimeContext => {
|
393
|
+
var _a, _b, _c, _d;
|
394
|
+
this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
|
395
|
+
const { PriceListId } = (_c = context.properties) !== null && _c !== void 0 ? _c : {};
|
396
|
+
const mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
|
397
|
+
this.id15to18('AccountId', mergeContext.properties);
|
398
|
+
this._runtimeContext = mergeContext;
|
399
|
+
if (context.properties && ((_d = this._runtimeContext.properties) === null || _d === void 0 ? void 0 : _d.StartDate)) {
|
400
|
+
this.contextService.update({
|
401
|
+
properties: Object.assign(Object.assign({}, this._runtimeContext.properties), context.properties),
|
402
|
+
});
|
403
|
+
}
|
404
|
+
this._isInitialized = true;
|
405
|
+
}));
|
406
|
+
}
|
407
|
+
id15to18(propertyName, source) {
|
408
|
+
if (!source) {
|
409
|
+
return;
|
410
|
+
}
|
411
|
+
const value = source[propertyName];
|
412
|
+
if (typeof value === 'string' && value.length === 15) {
|
413
|
+
source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
|
414
|
+
}
|
415
|
+
}
|
416
|
+
getAsset(lineItem) {
|
417
|
+
return this._assets && this._assets.find(a => a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId);
|
418
|
+
}
|
419
|
+
get isInitialized() {
|
420
|
+
return this._isInitialized;
|
421
|
+
}
|
422
|
+
get runtimeModel() {
|
423
|
+
var _a;
|
424
|
+
return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
|
425
|
+
}
|
426
|
+
get runtimeContext() {
|
427
|
+
return this._runtimeContext;
|
428
|
+
}
|
429
|
+
}
|
430
|
+
ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0.ɵɵFactoryTarget.Injectable });
|
431
|
+
ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationRuntimeService });
|
432
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
|
433
|
+
type: Injectable
|
434
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
|
435
|
+
|
436
|
+
const findLineItem = (id, lineItems) => {
|
437
|
+
return findLineItemWithComparator(lineItems, (li) => li.id === id);
|
438
|
+
};
|
439
|
+
const findLineItemWithComparator = (lineItems, comparator) => {
|
440
|
+
let currentLevel = lineItems;
|
441
|
+
while (currentLevel.length) {
|
442
|
+
const found = currentLevel.find(comparator);
|
443
|
+
if (found) {
|
444
|
+
return found;
|
445
|
+
}
|
446
|
+
currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
|
447
|
+
}
|
448
|
+
return;
|
449
|
+
};
|
450
|
+
const insertLineItem = (lineItem, parentId, toInsert) => {
|
451
|
+
const insertData = lineItem.id === parentId ? [toInsert] : [];
|
452
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: [
|
453
|
+
...insertData,
|
454
|
+
...lineItem.lineItems.map(li => {
|
455
|
+
return insertLineItem(li, parentId, toInsert);
|
456
|
+
}),
|
457
|
+
] });
|
458
|
+
};
|
459
|
+
const removeLineItem = (lineItem, idToRemove) => {
|
460
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems
|
461
|
+
.map(li => {
|
462
|
+
if (li.id === idToRemove) {
|
463
|
+
return;
|
464
|
+
}
|
465
|
+
else if (li.lineItems.length) {
|
466
|
+
return removeLineItem(li, idToRemove);
|
467
|
+
}
|
468
|
+
return li;
|
469
|
+
})
|
470
|
+
.filter(r => !!r) });
|
471
|
+
};
|
472
|
+
const replaceLineItem = (lineItem, replaceTo) => {
|
473
|
+
if (lineItem.id === replaceTo.id) {
|
474
|
+
return Object.assign({}, replaceTo);
|
475
|
+
}
|
476
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => {
|
477
|
+
if (li.id === replaceTo.id) {
|
478
|
+
return replaceTo;
|
479
|
+
}
|
480
|
+
else if (li.lineItems.length) {
|
481
|
+
return replaceLineItem(li, replaceTo);
|
482
|
+
}
|
483
|
+
return li;
|
484
|
+
}) });
|
485
|
+
};
|
486
|
+
const mapAttributes = (attributes) => {
|
487
|
+
return attributes.reduce((acc, { name, value }) => (Object.assign(Object.assign({}, acc), { [name]: value })), {});
|
488
|
+
};
|
489
|
+
const getAttributes = (attributes, names = []) => {
|
490
|
+
const filtered = attributes.filter(({ name }) => names.includes(name));
|
491
|
+
return sortBy(filtered, [({ name }) => names.indexOf(name)]);
|
492
|
+
};
|
493
|
+
const upsertAttributes = (originalAttributes, attributesToUpsert) => {
|
494
|
+
return attributesToUpsert.reduce((acc, { name, value }) => {
|
495
|
+
const [origAttr] = getAttributes(acc, [name]);
|
496
|
+
return [
|
497
|
+
...acc.filter(attr => attr.name !== name),
|
498
|
+
Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name })), { cfgStatus: 'User', value }),
|
499
|
+
];
|
500
|
+
}, originalAttributes);
|
501
|
+
};
|
502
|
+
const patchAttributes = (rootLineItem, id, attrs) => {
|
503
|
+
const lineItem = findLineItem(id, [rootLineItem]);
|
504
|
+
if (!lineItem) {
|
505
|
+
return rootLineItem;
|
506
|
+
}
|
507
|
+
const attributes = upsertAttributes(lineItem.attributes, attrs);
|
508
|
+
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }));
|
509
|
+
};
|
510
|
+
const getAttributeValue = (attributes, name) => { var _a; return (_a = attributes.find(attr => attr.name === name)) === null || _a === void 0 ? void 0 : _a.value; };
|
511
|
+
const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
|
512
|
+
return {
|
513
|
+
id: UUID.UUID(),
|
514
|
+
port,
|
515
|
+
type,
|
516
|
+
actionCode: 'ADD',
|
517
|
+
cfgStatus: 'New',
|
518
|
+
attributes: attributes.map(({ name, value }) => ({ cfgStatus: 'User', name, value })),
|
519
|
+
lineItems,
|
520
|
+
parentId,
|
521
|
+
qty: 1,
|
522
|
+
};
|
523
|
+
};
|
524
|
+
const getRecommendedPrices = (portDomain, type) => {
|
525
|
+
var _a, _b;
|
526
|
+
const domainType = portDomain.domainTypes.find(({ name }) => name === type);
|
527
|
+
const [net, list] = (_b = (_a = domainType === null || domainType === void 0 ? void 0 : domainType.recommendedPrices) === null || _a === void 0 ? void 0 : _a.filter(({ chargeMethod }) => chargeMethod === 'ONE_TIME').reduce((acc, rp) => {
|
528
|
+
const [netPrice, listPrice] = acc;
|
529
|
+
return [netPrice + rp.netPrice, listPrice + rp.listPrice];
|
530
|
+
}, [0, 0])) !== null && _b !== void 0 ? _b : [0, 0];
|
531
|
+
return { net, list };
|
532
|
+
};
|
533
|
+
|
534
|
+
var lineItem_utils = /*#__PURE__*/Object.freeze({
|
535
|
+
__proto__: null,
|
536
|
+
findLineItem: findLineItem,
|
537
|
+
findLineItemWithComparator: findLineItemWithComparator,
|
538
|
+
insertLineItem: insertLineItem,
|
539
|
+
removeLineItem: removeLineItem,
|
540
|
+
replaceLineItem: replaceLineItem,
|
541
|
+
mapAttributes: mapAttributes,
|
542
|
+
getAttributes: getAttributes,
|
543
|
+
upsertAttributes: upsertAttributes,
|
544
|
+
patchAttributes: patchAttributes,
|
545
|
+
getAttributeValue: getAttributeValue,
|
546
|
+
generateLineItem: generateLineItem,
|
547
|
+
getRecommendedPrices: getRecommendedPrices
|
548
|
+
});
|
549
|
+
|
550
|
+
class LineItemWorker {
|
551
|
+
constructor(src) {
|
552
|
+
this.li = Object.assign({}, src);
|
553
|
+
}
|
554
|
+
insert(parentId, toInsert) {
|
555
|
+
return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
|
556
|
+
}
|
557
|
+
remove(id) {
|
558
|
+
return new LineItemWorker(removeLineItem(this.li, id));
|
559
|
+
}
|
560
|
+
replace(toReplace) {
|
561
|
+
return new LineItemWorker(replaceLineItem(this.li, toReplace));
|
562
|
+
}
|
563
|
+
patchAttribute(attrs, id) {
|
564
|
+
return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
|
565
|
+
}
|
566
|
+
}
|
567
|
+
|
568
|
+
class ConfigurationService {
|
569
|
+
constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService) {
|
570
|
+
this.quoteDraftService = quoteDraftService;
|
571
|
+
this.runtimeService = runtimeService;
|
572
|
+
this.contextService = contextService;
|
573
|
+
this.configurationApiService = configurationApiService;
|
574
|
+
this.messageService = messageService;
|
575
|
+
this.dialogService = dialogService;
|
576
|
+
this.mode = ConfigurationMode.SEARCH;
|
577
|
+
this.states = {};
|
578
|
+
this.lineItem = new BehaviorSubject(undefined);
|
579
|
+
this.charges = new BehaviorSubject({});
|
580
|
+
this.pricePlans = new BehaviorSubject({});
|
581
|
+
this.hasUnsavedChanges = false;
|
582
|
+
}
|
583
|
+
reset() {
|
584
|
+
this.hasUnsavedChanges = false;
|
585
|
+
this.runtimeService.reset();
|
586
|
+
this.states = {};
|
587
|
+
this.lineItem.next(undefined);
|
588
|
+
this.charges.next({});
|
589
|
+
this.pricePlans.next({});
|
590
|
+
}
|
591
|
+
patch$(lineItem) {
|
592
|
+
if (!this.lineItem.value) {
|
593
|
+
return throwError(() => new Error(`Source LineItem not found`));
|
594
|
+
}
|
595
|
+
this.states.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem).li;
|
596
|
+
this.states.asset = this.states.configurableRamp
|
597
|
+
? this.runtimeService.getAsset(this.states.configurableRamp)
|
598
|
+
: undefined;
|
599
|
+
return this.configure().pipe(catchError$1(error => {
|
600
|
+
console.error(error);
|
601
|
+
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
602
|
+
this.messageService.add({ severity: 'error', summary: error });
|
603
|
+
}
|
604
|
+
// bounce back if configuration call has failed
|
605
|
+
this.lineItem.next(this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined);
|
606
|
+
return throwError(() => error);
|
607
|
+
}), tap(() => {
|
608
|
+
if (!this.hasUnsavedChanges) {
|
609
|
+
this.hasUnsavedChanges = true;
|
610
|
+
}
|
611
|
+
}));
|
612
|
+
}
|
613
|
+
patch(lineItem) {
|
614
|
+
this.patch$(lineItem).subscribe();
|
615
|
+
}
|
616
|
+
updateCurrentStates(update) {
|
617
|
+
this.states = Object.assign(Object.assign({}, this.states), update);
|
618
|
+
}
|
619
|
+
get() {
|
620
|
+
return this.lineItem.asObservable().pipe(shareReplay$1());
|
621
|
+
}
|
622
|
+
getSnapshot() {
|
623
|
+
return this.lineItem.value ? Object.assign({}, this.lineItem.value) : undefined;
|
624
|
+
}
|
625
|
+
getRuntimeModel() {
|
626
|
+
return this.runtimeService.runtimeModel;
|
627
|
+
}
|
628
|
+
getRuntimeContext() {
|
629
|
+
return this.runtimeService.runtimeContext;
|
630
|
+
}
|
631
|
+
get contextSnapshot() {
|
632
|
+
return this.contextService.resolve();
|
633
|
+
}
|
634
|
+
get context$() {
|
635
|
+
return this.contextService.resolve$();
|
636
|
+
}
|
637
|
+
get charges$() {
|
638
|
+
return this.charges.asObservable();
|
639
|
+
}
|
640
|
+
get chargesSnapshot() {
|
641
|
+
return this.charges.value;
|
642
|
+
}
|
643
|
+
get pricePlans$() {
|
644
|
+
return this.pricePlans.asObservable();
|
645
|
+
}
|
646
|
+
get pricePlansSnapshot() {
|
647
|
+
return this.pricePlans.value;
|
648
|
+
}
|
649
|
+
configure() {
|
650
|
+
var _a, _b, _c, _d, _e, _f;
|
651
|
+
const runtimeContext = this.getRuntimeContext();
|
652
|
+
const runtimeModel = this.getRuntimeModel();
|
653
|
+
if (!runtimeContext || !runtimeModel) {
|
654
|
+
return throwError(() => new Error('Runtime context/model not initialized'));
|
655
|
+
}
|
656
|
+
const uiDefinitionProperties = Object.assign(Object.assign({}, ((_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {})), ((_c = this.runtimeService.uiDefinitionProperties) !== null && _c !== void 0 ? _c : {}));
|
657
|
+
const qty = (_d = this.runtimeService.initializationProps) === null || _d === void 0 ? void 0 : _d.defaultQty;
|
658
|
+
const lineItem = (_e = this.states.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
|
659
|
+
const configurationRequest = this.createRequest(lineItem);
|
660
|
+
const mainPricingEnabled = (_f = runtimeContext.properties) === null || _f === void 0 ? void 0 : _f.PricingEnabled;
|
661
|
+
const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
|
662
|
+
return this.configurationApiService
|
663
|
+
.configureLineItem({ configurationRequest, runtimeModel, pricingEnabled })
|
664
|
+
.pipe(map(({ lineItem, context, charges, pricePlans, deletedLineItems }) => {
|
665
|
+
this.contextService.update(context !== null && context !== void 0 ? context : {});
|
666
|
+
this.charges.next(charges !== null && charges !== void 0 ? charges : {});
|
667
|
+
this.pricePlans.next(pricePlans !== null && pricePlans !== void 0 ? pricePlans : {});
|
668
|
+
if (deletedLineItems === null || deletedLineItems === void 0 ? void 0 : deletedLineItems.length) {
|
669
|
+
this.showInactiveProductsConfirmation();
|
670
|
+
}
|
671
|
+
return lineItem;
|
672
|
+
}))
|
673
|
+
.pipe(tap(lineItem => lineItem && this.lineItem.next(lineItem)), catchError$1(error => throwError(() => { var _a; return new Error(((_a = error.error) === null || _a === void 0 ? void 0 : _a.message) || error.message || JSON.stringify(error)); })));
|
674
|
+
}
|
675
|
+
configureExternal$(productId, qty) {
|
676
|
+
this.updateCurrentStates({
|
677
|
+
currentState: this.quoteDraftService.currentState,
|
678
|
+
});
|
679
|
+
return this.runtimeService.init({ productId, defaultQty: qty }).pipe(switchMap(() => this.configure()), first(), catchError$1(error => {
|
680
|
+
this.messageService.add({ severity: ToastType.error, summary: error });
|
681
|
+
throw error;
|
682
|
+
}), finalize(() => this.reset()));
|
683
|
+
}
|
684
|
+
createRequest(lineItem) {
|
685
|
+
return {
|
686
|
+
lineItem,
|
687
|
+
mode: this.mode,
|
688
|
+
step: !this.lineItem.value ? RuntimeStep.START : RuntimeStep.UPDATE,
|
689
|
+
attributeDomainMode: 'ALL',
|
690
|
+
context: this.contextService.resolve(),
|
691
|
+
lineItems: this.states.currentState || [],
|
692
|
+
asset: this.states.asset,
|
693
|
+
};
|
694
|
+
}
|
695
|
+
showInactiveProductsConfirmation() {
|
696
|
+
this.dialogService
|
697
|
+
.open(ConfirmationComponent, {
|
698
|
+
dismissableMask: false,
|
699
|
+
closeOnEscape: false,
|
700
|
+
closable: false,
|
701
|
+
showHeader: true,
|
702
|
+
header: `Inactive Products in Quote`,
|
703
|
+
width: '440px',
|
704
|
+
data: {
|
705
|
+
confirmationConfig: {
|
706
|
+
title: ' ',
|
707
|
+
description: 'This quote contains inactive products. Do you want to remove them?',
|
708
|
+
submitBtn: 'Remove products',
|
709
|
+
cancelBtn: 'Back to Quote',
|
710
|
+
},
|
711
|
+
},
|
712
|
+
})
|
713
|
+
.onClose.subscribe(result => {
|
714
|
+
if (!result) {
|
715
|
+
const context = this.contextService.resolve();
|
716
|
+
window['VELO_BACK_FN'].apply(null, [context.headerId]);
|
717
|
+
}
|
718
|
+
});
|
719
|
+
}
|
720
|
+
}
|
721
|
+
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i4.MessageService }, { token: i5.DialogService }], target: i0.ɵɵFactoryTarget.Injectable });
|
722
|
+
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService });
|
723
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationService, decorators: [{
|
724
|
+
type: Injectable
|
725
|
+
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i4.MessageService }, { type: i5.DialogService }]; } });
|
726
|
+
|
727
|
+
class FlowUpdateService {
|
728
|
+
update(rootLineItems, updates) {
|
729
|
+
let remainingUpdates = [...updates];
|
730
|
+
let currentLevel = rootLineItems;
|
731
|
+
while (currentLevel.length && remainingUpdates.length) {
|
732
|
+
currentLevel.forEach(li => {
|
733
|
+
const unhandledUpdates = [];
|
734
|
+
remainingUpdates.forEach(update => {
|
735
|
+
let updated = false;
|
736
|
+
switch (update.dataType) {
|
737
|
+
case 'LINEITEM':
|
738
|
+
updated = this.applyLineItemUpdate(li, update);
|
739
|
+
break;
|
740
|
+
case 'CHARGE':
|
741
|
+
updated = this.applyChargeUpdate(li, update);
|
742
|
+
break;
|
743
|
+
case 'GROUP_CHARGE':
|
744
|
+
updated = this.applyChargeGroupUpdate(li, update);
|
745
|
+
break;
|
746
|
+
default:
|
747
|
+
// Unknown dataType. Do not try to handle it anymore
|
748
|
+
updated = true;
|
749
|
+
}
|
750
|
+
if (!updated) {
|
751
|
+
unhandledUpdates.push(update);
|
752
|
+
}
|
753
|
+
});
|
754
|
+
remainingUpdates = unhandledUpdates;
|
755
|
+
});
|
756
|
+
currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
|
757
|
+
}
|
758
|
+
}
|
759
|
+
delete(lineItems, id) {
|
760
|
+
const idsToRemove = [id];
|
761
|
+
const topLevelLineItem = lineItems.find(li => li.id === id);
|
762
|
+
if (topLevelLineItem) {
|
763
|
+
// find term-related line items (which are only top level)
|
764
|
+
// expired term line items won't be deleted
|
765
|
+
let foundTermLineItem = topLevelLineItem;
|
766
|
+
while (foundTermLineItem) {
|
767
|
+
foundTermLineItem = lineItems.find(li => foundTermLineItem && li.rampInstanceId === foundTermLineItem.id);
|
768
|
+
if (foundTermLineItem) {
|
769
|
+
idsToRemove.push(foundTermLineItem.id);
|
770
|
+
}
|
771
|
+
}
|
772
|
+
}
|
773
|
+
const filtered = lineItems.filter(lineItem => !idsToRemove.includes(lineItem.id));
|
774
|
+
return filtered.map(lineItem => new LineItemWorker(lineItem).remove(id).li);
|
775
|
+
}
|
776
|
+
applyLineItemUpdate(lineItem, update) {
|
777
|
+
if (lineItem.id !== update.id) {
|
778
|
+
return false;
|
779
|
+
}
|
780
|
+
switch (update.attributeType) {
|
781
|
+
case 'QTY':
|
782
|
+
lineItem.qty = update.newValue;
|
783
|
+
break;
|
784
|
+
case 'EFFECTIVE_START_DATE':
|
785
|
+
lineItem.properties.StartDate = moment(update.newValue).format('YYYY-MM-DD');
|
786
|
+
break;
|
787
|
+
case 'END_DATE':
|
788
|
+
lineItem.properties.EndDate = moment(update.newValue).format('YYYY-MM-DD');
|
789
|
+
break;
|
790
|
+
case 'PRICE_ADJUSTMENT':
|
791
|
+
{
|
792
|
+
const [charge] = lineItem.chargeItems;
|
793
|
+
if (charge) {
|
794
|
+
charge.priceAdjustment = update.newValue;
|
795
|
+
}
|
796
|
+
}
|
797
|
+
break;
|
798
|
+
case 'LIST_PRICE_ADJUSTMENT':
|
799
|
+
{
|
800
|
+
const [charge] = lineItem.chargeItems;
|
801
|
+
if (charge) {
|
802
|
+
charge.listPriceAdjustment = update.newValue;
|
803
|
+
}
|
804
|
+
}
|
805
|
+
break;
|
806
|
+
default:
|
807
|
+
throw new Error(`Not suppored AttributeType for LineItem update: ${update.attributeType}`);
|
808
|
+
}
|
809
|
+
return true;
|
810
|
+
}
|
811
|
+
applyChargeUpdate(lineItem, update) {
|
812
|
+
const foundCharge = lineItem.chargeItems.find(({ id }) => id === update.id);
|
813
|
+
if (!foundCharge) {
|
814
|
+
return false;
|
815
|
+
}
|
816
|
+
if (update.attributeType === 'PRICE_ADJUSTMENT') {
|
817
|
+
foundCharge.priceAdjustment = update.newValue;
|
818
|
+
}
|
819
|
+
else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
|
820
|
+
foundCharge.listPriceAdjustment = update.newValue;
|
821
|
+
}
|
822
|
+
else {
|
823
|
+
throw new Error(`Not suppored AttributeType for Charge Item update: ${update.attributeType}`);
|
824
|
+
}
|
825
|
+
return true;
|
826
|
+
}
|
827
|
+
applyChargeGroupUpdate(lineItem, update) {
|
828
|
+
const foundChargeGroup = ChargeGroupUtils.findChargeGroupById(update.id, lineItem);
|
829
|
+
if (!foundChargeGroup) {
|
830
|
+
return false;
|
831
|
+
}
|
832
|
+
if (update.attributeType === 'PRICE_ADJUSTMENT') {
|
833
|
+
foundChargeGroup.priceAdjustment = update.newValue;
|
834
|
+
}
|
835
|
+
else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
|
836
|
+
foundChargeGroup.listPriceAdjustment = update.newValue;
|
837
|
+
}
|
838
|
+
else {
|
839
|
+
throw new Error(`Not suppored AttributeType for Charge Group Item update: ${update.attributeType}`);
|
840
|
+
}
|
841
|
+
return true;
|
842
|
+
}
|
843
|
+
}
|
844
|
+
FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
845
|
+
FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowUpdateService });
|
846
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowUpdateService, decorators: [{
|
847
|
+
type: Injectable
|
848
|
+
}] });
|
849
|
+
|
850
|
+
class FlowConfigurationService {
|
851
|
+
constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
|
852
|
+
this.proceduresApiService = proceduresApiService;
|
853
|
+
this.contextService = contextService;
|
854
|
+
this.quoteDraftService = quoteDraftService;
|
855
|
+
this.updateService = updateService;
|
856
|
+
this.configurationService = configurationService;
|
857
|
+
}
|
858
|
+
calculate$(quoteDraft) {
|
859
|
+
return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
|
860
|
+
// sort the result current state based on the quote draft initial state
|
861
|
+
const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
|
862
|
+
result.currentState = result.currentState
|
863
|
+
.slice()
|
864
|
+
.sort((a, b) => initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId));
|
865
|
+
this.quoteDraftService.updateQuoteDraft(result);
|
866
|
+
}), map$1(noop));
|
867
|
+
}
|
868
|
+
calculate(quoteDraft) {
|
869
|
+
this.calculate$(quoteDraft).subscribe();
|
870
|
+
}
|
871
|
+
update$(updates) {
|
872
|
+
const quoteDraft = this.quoteDraftService.quoteDraft;
|
873
|
+
if (!quoteDraft) {
|
874
|
+
return of(null);
|
875
|
+
}
|
876
|
+
return of([]).pipe(map$1(() => {
|
877
|
+
const updatedState = cloneDeep(quoteDraft.currentState);
|
878
|
+
this.updateService.update(updatedState, updates);
|
879
|
+
return updatedState;
|
880
|
+
}), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
881
|
+
}
|
882
|
+
update(updates) {
|
883
|
+
this.update$(updates).subscribe();
|
884
|
+
}
|
885
|
+
revert$(lineItemId) {
|
886
|
+
const quoteDraft = this.quoteDraftService.quoteDraft;
|
887
|
+
const initialCurrentState = this.quoteDraftService.getInitialCurrentState();
|
888
|
+
const currentState = this.quoteDraftService.activeCurrentState;
|
889
|
+
const currentLineItemIndex = currentState.findIndex(({ id }) => id === lineItemId);
|
890
|
+
const currentLineItem = currentState[currentLineItemIndex];
|
891
|
+
const initialLineItem = initialCurrentState.find(({ integrationId }) => integrationId === (currentLineItem === null || currentLineItem === void 0 ? void 0 : currentLineItem.integrationId));
|
892
|
+
if (!quoteDraft || !currentLineItem || !initialLineItem) {
|
893
|
+
return of(null);
|
894
|
+
}
|
895
|
+
const updatedState = cloneDeep(currentState);
|
896
|
+
updatedState.splice(currentLineItemIndex, 1, initialLineItem);
|
897
|
+
return of([]).pipe(tap$1(() => {
|
898
|
+
this.quoteDraftService.setCurrentLineItemState(updatedState);
|
899
|
+
}), switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
900
|
+
}
|
901
|
+
revert(lineItemId) {
|
902
|
+
this.revert$(lineItemId).subscribe();
|
903
|
+
}
|
904
|
+
delete$(ids) {
|
905
|
+
const quoteDraft = this.quoteDraftService.quoteDraft;
|
906
|
+
const currentState = this.quoteDraftService.currentState;
|
907
|
+
if (!quoteDraft) {
|
908
|
+
return of(null);
|
909
|
+
}
|
910
|
+
return of([]).pipe(map$1(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
911
|
+
}
|
912
|
+
delete(ids) {
|
913
|
+
this.delete$(ids).subscribe();
|
914
|
+
}
|
915
|
+
addTerm$(term) {
|
916
|
+
const quoteDraft = this.quoteDraftService.quoteDraft;
|
917
|
+
if (!quoteDraft) {
|
918
|
+
return of(null);
|
919
|
+
}
|
920
|
+
const updatedState = [...quoteDraft.currentState, term];
|
921
|
+
return of([]).pipe(switchMap$1(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
922
|
+
}
|
923
|
+
addToCart$(productId, qty) {
|
924
|
+
const quoteDraft = this.quoteDraftService.quoteDraft;
|
925
|
+
if (!quoteDraft) {
|
926
|
+
return of(null);
|
927
|
+
}
|
928
|
+
return this.configurationService.configureExternal$(productId, qty).pipe(map$1(lineItem => [...quoteDraft.currentState, lineItem]), switchMap$1(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
929
|
+
}
|
930
|
+
get() {
|
931
|
+
return this.quoteDraftService.quoteDraft$.pipe(map$1(() => this.quoteDraftService.activeCurrentState), shareReplay$1());
|
932
|
+
}
|
933
|
+
getSnapshot() {
|
934
|
+
var _a, _b;
|
935
|
+
return (_b = (_a = this.quoteDraftService) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
|
936
|
+
}
|
937
|
+
get charges$() {
|
938
|
+
return this.quoteDraftService.quoteDraft$.pipe(map$1(({ charges }) => charges));
|
939
|
+
}
|
940
|
+
get pricePlans$() {
|
941
|
+
return this.quoteDraftService.quoteDraft$.pipe(map$1(({ pricePlans }) => pricePlans));
|
942
|
+
}
|
943
|
+
get chargesSnapshot() {
|
944
|
+
var _a, _b;
|
945
|
+
return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.charges) !== null && _b !== void 0 ? _b : {};
|
946
|
+
}
|
947
|
+
get pricePlansSnapshot() {
|
948
|
+
var _a, _b;
|
949
|
+
return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.pricePlans) !== null && _b !== void 0 ? _b : {};
|
950
|
+
}
|
951
|
+
get contextSnapshot() {
|
952
|
+
return this.contextService.resolve();
|
953
|
+
}
|
954
|
+
get context$() {
|
955
|
+
return this.contextService.resolve$();
|
956
|
+
}
|
957
|
+
handleErrorAndBounceBack() {
|
958
|
+
return (source$) => {
|
959
|
+
return source$.pipe(catchError(error => {
|
960
|
+
console.error(error);
|
961
|
+
// bounce back if configuration call has failed
|
962
|
+
const quoteDraft = this.quoteDraftService.quoteDraft;
|
963
|
+
if (quoteDraft) {
|
964
|
+
this.quoteDraftService.updateQuoteDraft(quoteDraft);
|
965
|
+
}
|
966
|
+
return throwError(() => error);
|
967
|
+
}));
|
968
|
+
};
|
969
|
+
}
|
970
|
+
}
|
971
|
+
FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
972
|
+
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationService });
|
973
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationService, decorators: [{
|
974
|
+
type: Injectable
|
975
|
+
}], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
|
976
|
+
|
977
|
+
class FlowConfigurationModule {
|
978
|
+
}
|
979
|
+
FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
980
|
+
FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule });
|
981
|
+
FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, PriceApiService], imports: [[]] });
|
982
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: FlowConfigurationModule, decorators: [{
|
983
|
+
type: NgModule,
|
984
|
+
args: [{
|
985
|
+
imports: [],
|
986
|
+
providers: [FlowConfigurationService, FlowUpdateService, PriceApiService],
|
987
|
+
}]
|
988
|
+
}] });
|
989
|
+
|
990
|
+
class ConfigurationModule {
|
991
|
+
}
|
992
|
+
ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
993
|
+
ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
|
994
|
+
ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, providers: [
|
995
|
+
ContextApiService,
|
996
|
+
ProductModelApiService,
|
997
|
+
ConfigurationApiService,
|
998
|
+
ConfigurationRuntimeService,
|
999
|
+
RuntimeContextService,
|
1000
|
+
ConfigurationService,
|
1001
|
+
], imports: [[ConfirmationDialogModule]] });
|
1002
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: ConfigurationModule, decorators: [{
|
1003
|
+
type: NgModule,
|
1004
|
+
args: [{
|
1005
|
+
imports: [ConfirmationDialogModule],
|
1006
|
+
providers: [
|
1007
|
+
ContextApiService,
|
1008
|
+
ProductModelApiService,
|
1009
|
+
ConfigurationApiService,
|
1010
|
+
ConfigurationRuntimeService,
|
1011
|
+
RuntimeContextService,
|
1012
|
+
ConfigurationService,
|
1013
|
+
],
|
1014
|
+
}]
|
1015
|
+
}] });
|
1016
|
+
|
1017
|
+
class SdkCoreModule {
|
1018
|
+
}
|
1019
|
+
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1020
|
+
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
1021
|
+
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService], imports: [[ConfigurationModule, FlowConfigurationModule]] });
|
1022
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0, type: SdkCoreModule, decorators: [{
|
1023
|
+
type: NgModule,
|
1024
|
+
args: [{
|
1025
|
+
imports: [ConfigurationModule, FlowConfigurationModule],
|
1026
|
+
providers: [ContextService, QuoteDraftService, ProductImagesService],
|
1027
|
+
}]
|
1028
|
+
}] });
|
1029
|
+
|
1030
|
+
/**
|
1031
|
+
* Generated bundle index. Do not edit.
|
1032
|
+
*/
|
1033
|
+
|
1034
|
+
export { ConfigurationRuntimeService, ConfigurationService, ContextService, FlowConfigurationModule, FlowConfigurationService, FlowUpdateService, LineItemWorker, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeStep, SdkCoreModule, findLineItem, findLineItemWithComparator, generateLineItem, getAttributeValue, getAttributes, getDefaultLineItem, getRecommendedPrices, insertLineItem, lineItem_utils as lineItemUtils, mapAttributes, patchAttributes, removeLineItem, replaceLineItem, upsertAttributes };
|
1035
|
+
//# sourceMappingURL=veloceapps-sdk-core.js.map
|