@veloceapps/sdk 5.0.14-GOOGLE → 5.0.15-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{veloce-sdk-cms.umd.js → veloceapps-sdk-cms.umd.js} +149 -81
- package/bundles/veloceapps-sdk-cms.umd.js.map +1 -0
- package/bundles/{veloce-sdk-core.umd.js → veloceapps-sdk-core.umd.js} +765 -543
- package/bundles/veloceapps-sdk-core.umd.js.map +1 -0
- package/bundles/{veloce-sdk-runtime.umd.js → veloceapps-sdk-runtime.umd.js} +213 -146
- package/bundles/veloceapps-sdk-runtime.umd.js.map +1 -0
- package/bundles/{veloce-sdk.umd.js → veloceapps-sdk.umd.js} +225 -154
- package/bundles/veloceapps-sdk.umd.js.map +1 -0
- package/cms/cms.default.d.ts +1 -1
- package/cms/components/element-renderer/element-renderer.component.d.ts +1 -1
- package/cms/components/preview/preview.component.d.ts +1 -1
- package/cms/components/preview/preview.module.d.ts +1 -1
- package/cms/injection-tokens.d.ts +1 -1
- package/cms/launcher.module.d.ts +3 -3
- package/cms/modules/federated/federated.module.d.ts +1 -1
- package/cms/package.json +7 -7
- package/cms/services/launcher.service.d.ts +1 -1
- package/cms/types/configuration.types.d.ts +1 -1
- package/cms/utils/element.utils.d.ts +1 -1
- package/cms/utils/elements-resolver.d.ts +1 -1
- package/{core/veloce-sdk-core.d.ts → cms/veloceapps-sdk-cms.d.ts} +1 -1
- package/cms/vendor-map.d.ts +86 -82
- package/core/modules/configuration/configuration.module.d.ts +1 -1
- package/core/modules/configuration/helpers.d.ts +1 -1
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +3 -3
- package/core/modules/configuration/services/configuration.service.d.ts +4 -3
- package/core/modules/configuration/services/runtime-context.service.d.ts +1 -1
- package/core/modules/configuration/types/configuration-runtime.types.d.ts +1 -1
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +5 -4
- package/core/modules/flow-configuration/services/flow-update.service.d.ts +1 -1
- package/core/package.json +7 -7
- package/core/services/context.service.d.ts +2 -2
- package/core/services/index.d.ts +1 -0
- package/core/services/metric-calculation/metric-calculation.service.d.ts +21 -0
- package/core/services/metric-calculation/metric-calculation.types.d.ts +1 -0
- package/core/services/metric-calculation/metric-calculation.utils.d.ts +5 -0
- package/core/services/product-images.service.d.ts +1 -1
- package/core/services/quote-draft.service.d.ts +5 -3
- package/core/types/quote-states.types.d.ts +1 -1
- package/core/types/runtime.types.d.ts +1 -1
- package/core/utils/line-item.utils.d.ts +2 -1
- package/core/utils/line-item.worker.d.ts +1 -1
- package/{runtime/veloce-sdk-runtime.d.ts → core/veloceapps-sdk-core.d.ts} +1 -1
- package/esm2015/cms/cms.default.js +1 -1
- package/esm2015/cms/components/element-children/element-children.component.js +3 -3
- package/esm2015/cms/components/element-children/element-children.module.js +4 -4
- package/esm2015/cms/components/element-renderer/element-renderer.component.js +6 -6
- package/esm2015/cms/components/element-renderer/element-renderer.module.js +4 -4
- package/esm2015/cms/components/plugin.component.js +3 -3
- package/esm2015/cms/components/preview/preview.component.js +6 -6
- package/esm2015/cms/components/preview/preview.module.js +6 -6
- package/esm2015/cms/directives/custom-template.directive.js +3 -3
- package/esm2015/cms/injection-tokens.js +1 -1
- package/esm2015/cms/launcher.module.js +8 -8
- package/esm2015/cms/modules/federated/federated.component.js +4 -4
- package/esm2015/cms/modules/federated/federated.module.js +6 -6
- package/esm2015/cms/plugins/configuration.plugin.js +5 -5
- package/esm2015/cms/plugins/io.plugin.js +3 -3
- package/esm2015/cms/plugins/script.plugin.js +5 -5
- package/esm2015/cms/services/dynamic-module.service.js +3 -3
- package/esm2015/cms/services/element-context.service.js +3 -3
- package/esm2015/cms/services/integration.state.js +3 -3
- package/esm2015/cms/services/io-provider.service.js +3 -3
- package/esm2015/cms/services/launcher.service.js +6 -5
- package/esm2015/cms/services/templates.service.js +3 -3
- package/esm2015/cms/types/configuration.types.js +1 -1
- package/esm2015/cms/utils/element.utils.js +1 -1
- package/esm2015/cms/utils/elements-resolver.js +1 -1
- package/esm2015/cms/veloceapps-sdk-cms.js +5 -0
- package/esm2015/cms/vendor-map.js +9 -12
- package/esm2015/core/core.module.js +7 -7
- package/esm2015/core/modules/configuration/configuration.module.js +7 -7
- package/esm2015/core/modules/configuration/helpers.js +2 -2
- package/esm2015/core/modules/configuration/services/configuration-runtime.service.js +7 -7
- package/esm2015/core/modules/configuration/services/configuration.service.js +13 -12
- package/esm2015/core/modules/configuration/services/runtime-context.service.js +6 -6
- package/esm2015/core/modules/configuration/types/configuration-runtime.types.js +1 -1
- package/esm2015/core/modules/flow-configuration/flow-configuration.module.js +6 -6
- package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +18 -10
- package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +5 -5
- package/esm2015/core/services/context.service.js +6 -6
- package/esm2015/core/services/index.js +2 -1
- package/esm2015/core/services/metric-calculation/metric-calculation.service.js +74 -0
- package/esm2015/core/services/metric-calculation/metric-calculation.types.js +2 -0
- package/esm2015/core/services/metric-calculation/metric-calculation.utils.js +42 -0
- package/esm2015/core/services/product-images.service.js +5 -5
- package/esm2015/core/services/quote-draft.service.js +20 -10
- package/esm2015/core/types/quote-states.types.js +1 -1
- package/esm2015/core/types/runtime.types.js +1 -1
- package/esm2015/core/utils/line-item.utils.js +14 -3
- package/esm2015/core/utils/line-item.worker.js +1 -1
- package/esm2015/core/veloceapps-sdk-core.js +5 -0
- package/esm2015/runtime/components/component-preview/component-preview.component.js +7 -7
- package/esm2015/runtime/components/section-renderer/section-renderer.component.js +4 -4
- package/esm2015/runtime/components/ui-runtime/runtime.component.js +8 -8
- package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +8 -8
- package/esm2015/runtime/execution/components/children-placeholder/children-placeholder.component.js +8 -8
- package/esm2015/runtime/execution/components/context-provider/context-provider.component.js +5 -5
- package/esm2015/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.js +4 -4
- package/esm2015/runtime/execution/components/federated/federated.component.js +4 -4
- package/esm2015/runtime/execution/components/velo-attribute/velo-attribute.component.js +3 -3
- package/esm2015/runtime/execution/components/velo-multiselect/velo-multiselect.component.js +3 -3
- package/esm2015/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.js +4 -4
- package/esm2015/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.js +6 -6
- package/esm2015/runtime/execution/components/velo-port-radio/velo-port-radio.component.js +4 -4
- package/esm2015/runtime/execution/components/velo-type/velo-type.component.js +5 -5
- package/esm2015/runtime/execution/directives/section-script.directive.js +6 -6
- package/esm2015/runtime/execution/directives/sf-query.directive.js +5 -5
- package/esm2015/runtime/execution/directives/velo-attribute.directive.js +5 -5
- package/esm2015/runtime/execution/directives/velo-port.directive.js +21 -21
- package/esm2015/runtime/execution/directives/vl-approval.directive.js +5 -5
- package/esm2015/runtime/execution/directives/vl-document-attachments.directive.js +5 -5
- package/esm2015/runtime/execution/directives/vl-document-templates.directive.js +5 -5
- package/esm2015/runtime/execution/directives/vl-quote.directive.js +6 -6
- package/esm2015/runtime/execution/directives/vl-ramp.directive.js +6 -6
- package/esm2015/runtime/execution/runtime-execution.module.js +10 -10
- package/esm2015/runtime/runtime.module.js +10 -10
- package/esm2015/runtime/services/cart.service.js +6 -6
- package/esm2015/runtime/services/collapsible-state.service.js +3 -3
- package/esm2015/runtime/services/configuration.service.js +9 -9
- package/esm2015/runtime/services/current-state.service.js +4 -4
- package/esm2015/runtime/services/form-scope.service.js +3 -3
- package/esm2015/runtime/services/product-model-cache.service.js +5 -5
- package/esm2015/runtime/services/runtime-context.service.js +8 -8
- package/esm2015/runtime/services/runtime-form.service.js +5 -5
- package/esm2015/runtime/services/runtime.service.js +6 -6
- package/esm2015/runtime/services/section-helper.service.js +5 -5
- package/esm2015/runtime/services/section-scope.service.js +4 -4
- package/esm2015/runtime/services/section-store.service.js +4 -4
- package/esm2015/runtime/services/section.service.js +9 -9
- package/esm2015/runtime/types/bound-data.types.js +1 -1
- package/esm2015/runtime/types/runtime.types.js +1 -1
- package/esm2015/runtime/types/script-registry.types.js +2 -2
- package/esm2015/runtime/utils/line-item.util.js +2 -2
- package/esm2015/runtime/utils/section.utils.js +2 -2
- package/esm2015/runtime/utils/sections-binder.helper.js +2 -2
- package/esm2015/runtime/veloceapps-sdk-runtime.js +5 -0
- package/esm2015/src/components/dialog/dialog.component.js +3 -3
- package/esm2015/src/components/dialog/dialog.module.js +4 -4
- package/esm2015/src/components/doc-gen/doc-gen.component.js +11 -11
- package/esm2015/src/components/doc-gen/doc-gen.module.js +6 -6
- package/esm2015/src/components/header/cart-overlay/cart-preview.component.js +6 -6
- package/esm2015/src/components/header/cart-overlay/cart-preview.module.js +6 -6
- package/esm2015/src/components/header/header.component.js +10 -10
- package/esm2015/src/components/header/header.module.js +6 -6
- package/esm2015/src/components/header/metrics/metrics.component.js +20 -16
- package/esm2015/src/components/header/metrics/metrics.definitions.js +6 -6
- package/esm2015/src/components/header/metrics/metrics.module.js +6 -6
- package/esm2015/src/flow-routing.module.js +4 -4
- package/esm2015/src/flow.component.js +7 -7
- package/esm2015/src/flow.module.js +9 -9
- package/esm2015/src/guards/context.guard.js +6 -6
- package/esm2015/src/guards/product-unload.guard.js +5 -5
- package/esm2015/src/guards/root.guard.js +3 -3
- package/esm2015/src/pages/catalog/catalog.component.js +10 -10
- package/esm2015/src/pages/catalog/catalog.module.js +7 -7
- package/esm2015/src/pages/debug/debug.component.js +6 -6
- package/esm2015/src/pages/debug/debug.module.js +4 -4
- package/esm2015/src/pages/empty-account/empty-account.component.js +4 -4
- package/esm2015/src/pages/empty-account/empty-account.module.js +7 -7
- package/esm2015/src/pages/legacy-product/legacy-product.component.js +9 -9
- package/esm2015/src/pages/legacy-product/legacy-product.module.js +6 -6
- package/esm2015/src/pages/product/product.component.js +7 -7
- package/esm2015/src/pages/product/product.module.js +7 -7
- package/esm2015/src/pages/record-not-found/record-not-found.component.js +3 -3
- package/esm2015/src/pages/record-not-found/record-not-found.module.js +4 -4
- package/esm2015/src/pages/remote/remote.component.js +10 -10
- package/esm2015/src/pages/remote/remote.module.js +7 -7
- package/esm2015/src/pages/remote/remote.types.js +1 -1
- package/esm2015/src/pages/shopping-cart/shopping-cart.component.js +10 -10
- package/esm2015/src/pages/shopping-cart/shopping-cart.module.js +7 -7
- package/esm2015/src/resolvers/flow.resolver.js +6 -6
- package/esm2015/src/resolvers/quote.resolver.js +14 -14
- package/esm2015/src/services/doc-gen.service.js +6 -6
- package/esm2015/src/services/flow-dialog.service.js +5 -5
- package/esm2015/src/services/flow-router.service.js +6 -6
- package/esm2015/src/services/flow.service.js +7 -7
- package/esm2015/src/types/context-route.types.js +1 -1
- package/esm2015/src/types/flow-customization.types.js +1 -1
- package/esm2015/src/utils/flow.utils.js +2 -2
- package/esm2015/veloceapps-sdk.js +5 -0
- package/fesm2015/{veloce-sdk-cms.js → veloceapps-sdk-cms.js} +77 -79
- package/fesm2015/veloceapps-sdk-cms.js.map +1 -0
- package/fesm2015/{veloce-sdk-core.js → veloceapps-sdk-core.js} +420 -284
- package/fesm2015/veloceapps-sdk-core.js.map +1 -0
- package/fesm2015/{veloce-sdk-runtime.js → veloceapps-sdk-runtime.js} +148 -148
- package/fesm2015/veloceapps-sdk-runtime.js.map +1 -0
- package/fesm2015/{veloce-sdk.js → veloceapps-sdk.js} +163 -159
- package/fesm2015/veloceapps-sdk.js.map +1 -0
- package/package.json +14 -13
- package/runtime/components/component-preview/component-preview.component.d.ts +1 -1
- package/runtime/components/section-renderer/section-renderer.component.d.ts +1 -1
- package/runtime/components/ui-runtime/runtime.component.d.ts +2 -2
- package/runtime/components/ui-runtime-preview/runtime-preview.component.d.ts +3 -3
- package/runtime/execution/components/children-placeholder/children-placeholder.component.d.ts +1 -1
- package/runtime/execution/components/context-provider/context-provider.component.d.ts +2 -2
- package/runtime/execution/components/execution-section-renderer/execution-section-renderer.component.d.ts +1 -1
- package/runtime/execution/components/federated/federated.component.d.ts +1 -1
- package/runtime/execution/components/velo-port-checkbox/velo-port-checkbox.component.d.ts +1 -1
- package/runtime/execution/components/velo-port-dropdown/velo-port-dropdown.component.d.ts +1 -1
- package/runtime/execution/components/velo-port-radio/velo-port-radio.component.d.ts +1 -1
- package/runtime/execution/components/velo-type/velo-type.component.d.ts +1 -1
- package/runtime/execution/directives/section-script.directive.d.ts +1 -1
- package/runtime/execution/directives/sf-query.directive.d.ts +2 -2
- package/runtime/execution/directives/velo-attribute.directive.d.ts +1 -1
- package/runtime/execution/directives/velo-port.directive.d.ts +1 -1
- package/runtime/execution/directives/vl-approval.directive.d.ts +2 -2
- package/runtime/execution/directives/vl-document-attachments.directive.d.ts +2 -2
- package/runtime/execution/directives/vl-document-templates.directive.d.ts +2 -2
- package/runtime/execution/directives/vl-quote.directive.d.ts +2 -2
- package/runtime/execution/directives/vl-ramp.directive.d.ts +3 -3
- package/runtime/execution/runtime-execution.module.d.ts +5 -5
- package/runtime/package.json +7 -7
- package/runtime/runtime.module.d.ts +5 -5
- package/runtime/services/cart.service.d.ts +3 -3
- package/runtime/services/configuration.service.d.ts +3 -3
- package/runtime/services/current-state.service.d.ts +1 -1
- package/runtime/services/product-model-cache.service.d.ts +2 -2
- package/runtime/services/runtime-context.service.d.ts +2 -2
- package/runtime/services/runtime-form.service.d.ts +1 -1
- package/runtime/services/runtime.service.d.ts +2 -2
- package/runtime/services/section-helper.service.d.ts +1 -1
- package/runtime/services/section-scope.service.d.ts +1 -1
- package/runtime/services/section-store.service.d.ts +1 -1
- package/runtime/services/section.service.d.ts +1 -1
- package/runtime/types/bound-data.types.d.ts +1 -1
- package/runtime/types/runtime.types.d.ts +2 -2
- package/runtime/utils/line-item.util.d.ts +1 -1
- package/runtime/utils/section.utils.d.ts +1 -1
- package/runtime/utils/sections-binder.helper.d.ts +1 -1
- package/{veloce-sdk.d.ts → runtime/veloceapps-sdk-runtime.d.ts} +1 -1
- package/src/components/doc-gen/doc-gen.component.d.ts +3 -3
- package/src/components/doc-gen/doc-gen.module.d.ts +1 -1
- package/src/components/header/cart-overlay/cart-preview.component.d.ts +1 -1
- package/src/components/header/cart-overlay/cart-preview.module.d.ts +1 -1
- package/src/components/header/header.component.d.ts +4 -4
- package/src/components/header/header.module.d.ts +1 -1
- package/src/components/header/metrics/metrics.component.d.ts +5 -4
- package/src/components/header/metrics/metrics.definitions.d.ts +1 -1
- package/src/components/header/metrics/metrics.module.d.ts +1 -1
- package/src/flow.component.d.ts +2 -2
- package/src/flow.module.d.ts +4 -4
- package/src/guards/context.guard.d.ts +1 -1
- package/src/guards/product-unload.guard.d.ts +1 -1
- package/src/pages/catalog/catalog.component.d.ts +3 -3
- package/src/pages/catalog/catalog.module.d.ts +2 -2
- package/src/pages/debug/debug.component.d.ts +3 -3
- package/src/pages/empty-account/empty-account.module.d.ts +2 -2
- package/src/pages/legacy-product/legacy-product.component.d.ts +4 -4
- package/src/pages/legacy-product/legacy-product.module.d.ts +1 -1
- package/src/pages/product/product.component.d.ts +1 -1
- package/src/pages/product/product.module.d.ts +2 -2
- package/src/pages/remote/remote.component.d.ts +3 -3
- package/src/pages/remote/remote.module.d.ts +2 -2
- package/src/pages/remote/remote.types.d.ts +1 -1
- package/src/pages/shopping-cart/shopping-cart.component.d.ts +3 -3
- package/src/pages/shopping-cart/shopping-cart.module.d.ts +2 -2
- package/src/resolvers/flow.resolver.d.ts +2 -2
- package/src/resolvers/quote.resolver.d.ts +1 -1
- package/src/services/doc-gen.service.d.ts +1 -1
- package/src/services/flow-dialog.service.d.ts +1 -1
- package/src/services/flow-router.service.d.ts +1 -1
- package/src/services/flow.service.d.ts +2 -2
- package/src/types/context-route.types.d.ts +1 -1
- package/src/types/flow-customization.types.d.ts +2 -2
- package/src/utils/flow.utils.d.ts +1 -1
- package/{cms/veloce-sdk-cms.d.ts → veloceapps-sdk.d.ts} +1 -1
- package/bundles/veloce-sdk-cms.umd.js.map +0 -1
- package/bundles/veloce-sdk-core.umd.js.map +0 -1
- package/bundles/veloce-sdk-runtime.umd.js.map +0 -1
- package/bundles/veloce-sdk.umd.js.map +0 -1
- package/esm2015/cms/veloce-sdk-cms.js +0 -5
- package/esm2015/core/veloce-sdk-core.js +0 -5
- package/esm2015/runtime/veloce-sdk-runtime.js +0 -5
- package/esm2015/veloce-sdk.js +0 -5
- package/fesm2015/veloce-sdk-cms.js.map +0 -1
- package/fesm2015/veloce-sdk-core.js.map +0 -1
- package/fesm2015/veloce-sdk-runtime.js.map +0 -1
- package/fesm2015/veloce-sdk.js.map +0 -1
@@ -1,8 +1,8 @@
|
|
1
1
|
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@
|
3
|
-
typeof define === 'function' && define.amd ? define('@
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.
|
5
|
-
})(this, (function (exports, i0, core, rxjs, operators, i1, lodash, components,
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@veloceapps/core'), require('rxjs'), require('rxjs/operators'), require('@veloceapps/api'), require('lodash'), require('@veloceapps/components'), require('primeng/api'), require('primeng/dynamicdialog'), require('moment')) :
|
3
|
+
typeof define === 'function' && define.amd ? define('@veloceapps/sdk/core', ['exports', '@angular/core', '@veloceapps/core', 'rxjs', 'rxjs/operators', '@veloceapps/api', 'lodash', '@veloceapps/components', 'primeng/api', 'primeng/dynamicdialog', 'moment'], factory) :
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloceapps = global.veloceapps || {}, global.veloceapps.sdk = global.veloceapps.sdk || {}, global.veloceapps.sdk.core = {}), global.ng.core, global["@veloceapps/core"], global.rxjs, global.rxjs.operators, global["@veloceapps/api"], global.lodash, global["@veloceapps/components"], global["primeng/api"], global["primeng/dynamicdialog"], global.moment));
|
5
|
+
})(this, (function (exports, i0, core, rxjs, operators, i1, lodash, components, i5, i6, moment) { 'use strict';
|
6
6
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
8
8
|
|
@@ -26,8 +26,8 @@
|
|
26
26
|
|
27
27
|
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
28
28
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
29
|
-
var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
|
30
29
|
var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
|
30
|
+
var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
|
31
31
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
32
32
|
|
33
33
|
var getDefaultLineItem = function (context, uiDefinitionProperties, qty) {
|
@@ -40,7 +40,7 @@
|
|
40
40
|
return lineItem;
|
41
41
|
};
|
42
42
|
|
43
|
-
|
43
|
+
/******************************************************************************
|
44
44
|
Copyright (c) Microsoft Corporation.
|
45
45
|
|
46
46
|
Permission to use, copy, modify, and/or distribute this software for any
|
@@ -107,6 +107,64 @@
|
|
107
107
|
function __param(paramIndex, decorator) {
|
108
108
|
return function (target, key) { decorator(target, key, paramIndex); };
|
109
109
|
}
|
110
|
+
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
111
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function")
|
112
|
+
throw new TypeError("Function expected"); return f; }
|
113
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
114
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
115
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
116
|
+
var _, done = false;
|
117
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
118
|
+
var context = {};
|
119
|
+
for (var p in contextIn)
|
120
|
+
context[p] = p === "access" ? {} : contextIn[p];
|
121
|
+
for (var p in contextIn.access)
|
122
|
+
context.access[p] = contextIn.access[p];
|
123
|
+
context.addInitializer = function (f) { if (done)
|
124
|
+
throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
125
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
126
|
+
if (kind === "accessor") {
|
127
|
+
if (result === void 0)
|
128
|
+
continue;
|
129
|
+
if (result === null || typeof result !== "object")
|
130
|
+
throw new TypeError("Object expected");
|
131
|
+
if (_ = accept(result.get))
|
132
|
+
descriptor.get = _;
|
133
|
+
if (_ = accept(result.set))
|
134
|
+
descriptor.set = _;
|
135
|
+
if (_ = accept(result.init))
|
136
|
+
initializers.push(_);
|
137
|
+
}
|
138
|
+
else if (_ = accept(result)) {
|
139
|
+
if (kind === "field")
|
140
|
+
initializers.push(_);
|
141
|
+
else
|
142
|
+
descriptor[key] = _;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
if (target)
|
146
|
+
Object.defineProperty(target, contextIn.name, descriptor);
|
147
|
+
done = true;
|
148
|
+
}
|
149
|
+
;
|
150
|
+
function __runInitializers(thisArg, initializers, value) {
|
151
|
+
var useValue = arguments.length > 2;
|
152
|
+
for (var i = 0; i < initializers.length; i++) {
|
153
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
154
|
+
}
|
155
|
+
return useValue ? value : void 0;
|
156
|
+
}
|
157
|
+
;
|
158
|
+
function __propKey(x) {
|
159
|
+
return typeof x === "symbol" ? x : "".concat(x);
|
160
|
+
}
|
161
|
+
;
|
162
|
+
function __setFunctionName(f, name, prefix) {
|
163
|
+
if (typeof name === "symbol")
|
164
|
+
name = name.description ? "[".concat(name.description, "]") : "";
|
165
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
166
|
+
}
|
167
|
+
;
|
110
168
|
function __metadata(metadataKey, metadataValue) {
|
111
169
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
112
170
|
return Reflect.metadata(metadataKey, metadataValue);
|
@@ -138,7 +196,7 @@
|
|
138
196
|
function step(op) {
|
139
197
|
if (f)
|
140
198
|
throw new TypeError("Generator is already executing.");
|
141
|
-
while (_)
|
199
|
+
while (g && (g = 0, op[0] && (_ = 0)), _)
|
142
200
|
try {
|
143
201
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
144
202
|
return t;
|
@@ -202,7 +260,11 @@
|
|
202
260
|
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
203
261
|
if (k2 === undefined)
|
204
262
|
k2 = k;
|
205
|
-
Object.
|
263
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
264
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
265
|
+
desc = { enumerable: true, get: function () { return m[k]; } };
|
266
|
+
}
|
267
|
+
Object.defineProperty(o, k2, desc);
|
206
268
|
}) : (function (o, m, k, k2) {
|
207
269
|
if (k2 === undefined)
|
208
270
|
k2 = k;
|
@@ -302,7 +364,7 @@
|
|
302
364
|
function __asyncDelegator(o) {
|
303
365
|
var i, p;
|
304
366
|
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
305
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done:
|
367
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
306
368
|
}
|
307
369
|
function __asyncValues(o) {
|
308
370
|
if (!Symbol.asyncIterator)
|
@@ -357,6 +419,11 @@
|
|
357
419
|
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
358
420
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
359
421
|
}
|
422
|
+
function __classPrivateFieldIn(state, receiver) {
|
423
|
+
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function"))
|
424
|
+
throw new TypeError("Cannot use 'in' operator on non-object");
|
425
|
+
return typeof state === "function" ? receiver === state : state.has(receiver);
|
426
|
+
}
|
360
427
|
|
361
428
|
exports.RuntimeMode = void 0;
|
362
429
|
(function (RuntimeMode) {
|
@@ -416,611 +483,604 @@
|
|
416
483
|
};
|
417
484
|
return ContextService;
|
418
485
|
}());
|
419
|
-
ContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
420
|
-
ContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
421
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
486
|
+
ContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextService, deps: [{ token: i1__namespace.ContextApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
487
|
+
ContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextService, providedIn: 'root' });
|
488
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ContextService, decorators: [{
|
422
489
|
type: i0.Injectable,
|
423
490
|
args: [{ providedIn: 'root' }]
|
424
491
|
}], ctorParameters: function () { return [{ type: i1__namespace.ContextApiService }]; } });
|
425
492
|
|
426
|
-
var
|
427
|
-
function
|
428
|
-
this.
|
429
|
-
this.imagesMap$ = new rxjs.BehaviorSubject({});
|
493
|
+
var RuntimeContextService = /** @class */ (function () {
|
494
|
+
function RuntimeContextService(configurationApiService) {
|
495
|
+
this.configurationApiService = configurationApiService;
|
430
496
|
}
|
431
|
-
|
497
|
+
RuntimeContextService.prototype.getRuntimeContext = function (productId, offeringId) {
|
498
|
+
var _this = this;
|
499
|
+
return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(operators.map(function (runtimeData) {
|
500
|
+
var _a, _b, _c;
|
501
|
+
var uiDefinition = _this.getUIDefinition(runtimeData);
|
502
|
+
var runtimeModel = core.RuntimeModel.create(runtimeData.types, runtimeData.products);
|
503
|
+
var _d = (_a = Array.from(runtimeModel.components.values()).find(function (c) { return c.productId === productId; })) !== null && _a !== void 0 ? _a : {}, productName = _d.productName, properties = _d.properties;
|
504
|
+
return {
|
505
|
+
modelId: runtimeData.modelId,
|
506
|
+
uiDefinition: uiDefinition,
|
507
|
+
runtimeModel: runtimeModel,
|
508
|
+
runtimeMode: exports.RuntimeMode.PROD,
|
509
|
+
productId: productId,
|
510
|
+
productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
|
511
|
+
offeringId: offeringId,
|
512
|
+
properties: {
|
513
|
+
PricingEnabled: ((_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.pricingEnabled) ? 'true' : 'false',
|
514
|
+
PriceListId: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.priceList,
|
515
|
+
},
|
516
|
+
};
|
517
|
+
}));
|
518
|
+
};
|
519
|
+
RuntimeContextService.prototype.getUIDefinition = function (runtimeData) {
|
432
520
|
var _a;
|
433
|
-
|
434
|
-
|
435
|
-
|
521
|
+
var rawUiDefinitions;
|
522
|
+
try {
|
523
|
+
rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
|
436
524
|
}
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
var
|
441
|
-
|
442
|
-
|
443
|
-
.pipe(rxjs.map(function (file) { return URL.createObjectURL(file); }), rxjs.catchError(function () { return rxjs.of(''); }), rxjs.tap(function (url) {
|
444
|
-
var _a;
|
445
|
-
return _this.imagesMap$.next(Object.assign(Object.assign({}, _this.imagesMap$.value), (_a = {}, _a[productId] = url, _a)));
|
446
|
-
}))
|
447
|
-
.subscribe();
|
525
|
+
catch (e) {
|
526
|
+
return;
|
527
|
+
}
|
528
|
+
var uiDefinitions = rawUiDefinitions.filter(function (uiDef) { return uiDef.version; });
|
529
|
+
var uiDefinition = (_a = uiDefinitions.find(function (uiDef) { return uiDef.primary; })) !== null && _a !== void 0 ? _a : uiDefinitions[0];
|
530
|
+
return uiDefinition;
|
448
531
|
};
|
449
|
-
return
|
532
|
+
return RuntimeContextService;
|
450
533
|
}());
|
451
|
-
|
452
|
-
|
453
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
454
|
-
type: i0.Injectable
|
455
|
-
|
456
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.ProductApiService }]; } });
|
534
|
+
RuntimeContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeContextService, deps: [{ token: i1__namespace.ConfigurationApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
535
|
+
RuntimeContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeContextService });
|
536
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: RuntimeContextService, decorators: [{
|
537
|
+
type: i0.Injectable
|
538
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }]; } });
|
457
539
|
|
458
|
-
var
|
459
|
-
function
|
460
|
-
|
461
|
-
this.
|
462
|
-
this.
|
463
|
-
this.
|
464
|
-
this.
|
465
|
-
this.resetSubj$ = new rxjs.BehaviorSubject(true);
|
466
|
-
this.isInitializedSubj$ = new rxjs.BehaviorSubject(false);
|
467
|
-
this.initialCurrentState = [];
|
468
|
-
this.allPriceLists = [];
|
469
|
-
this.assetPriceLists = [];
|
470
|
-
this.hasUnsavedChanges = false;
|
471
|
-
this.reset$ = this.resetSubj$.asObservable();
|
472
|
-
this.activePriceList$ = this.context.resolve$().pipe(operators.map(function (ctx) { return _this.allPriceLists.find(function (priceList) { return priceList.id === ctx.properties.PriceListId; }); }), operators.map(function (priceList) { return priceList !== null && priceList !== void 0 ? priceList : null; }));
|
473
|
-
this.isInitializedSubj$
|
474
|
-
.pipe(operators.filter(function (isInitialized) { return isInitialized; }), operators.switchMap(function () { return _this.quoteSubj$.asObservable(); }), operators.skip(1), operators.tap(function (quote) { return _this.markAsUpdated(quote); }))
|
475
|
-
.subscribe();
|
540
|
+
var ConfigurationRuntimeService = /** @class */ (function () {
|
541
|
+
function ConfigurationRuntimeService(apiService, contextService, runtimeContextService) {
|
542
|
+
this.apiService = apiService;
|
543
|
+
this.contextService = contextService;
|
544
|
+
this.runtimeContextService = runtimeContextService;
|
545
|
+
this._isInitialized = false;
|
546
|
+
this.uiDefinitionProperties = {};
|
476
547
|
}
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
this.isInitializedSubj$.next(value);
|
484
|
-
}
|
485
|
-
},
|
486
|
-
enumerable: false,
|
487
|
-
configurable: true
|
488
|
-
});
|
489
|
-
Object.defineProperty(QuoteDraftService.prototype, "hasAssets$", {
|
490
|
-
get: function () {
|
491
|
-
var _this = this;
|
492
|
-
return this.quoteSubj$.pipe(operators.map(function () { return _this.hasAssets; }));
|
493
|
-
},
|
494
|
-
enumerable: false,
|
495
|
-
configurable: true
|
496
|
-
});
|
497
|
-
Object.defineProperty(QuoteDraftService.prototype, "hasAssets", {
|
498
|
-
get: function () {
|
499
|
-
var quoteDraft = this.quoteSubj$.value;
|
500
|
-
return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
|
501
|
-
},
|
502
|
-
enumerable: false,
|
503
|
-
configurable: true
|
504
|
-
});
|
505
|
-
QuoteDraftService.prototype.reset = function () {
|
506
|
-
this.resetSubj$.next(true);
|
507
|
-
this.quoteSubj$.next(null);
|
508
|
-
this.initialCurrentState = [];
|
548
|
+
ConfigurationRuntimeService.prototype.reset = function () {
|
549
|
+
this._isInitialized = false;
|
550
|
+
this._runtimeContext = undefined;
|
551
|
+
this._assets = undefined;
|
552
|
+
this.initializationProps = undefined;
|
553
|
+
this.uiDefinitionProperties = {};
|
509
554
|
};
|
510
|
-
|
555
|
+
ConfigurationRuntimeService.prototype.initTestMode = function (modelId, uiDefinition) {
|
511
556
|
var _this = this;
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
557
|
+
var _a, _b;
|
558
|
+
this.uiDefinitionProperties = (_a = uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
|
559
|
+
var uiDefinitionExternals = (_b = uiDefinition.externals) !== null && _b !== void 0 ? _b : {};
|
560
|
+
return rxjs.combineLatest([
|
561
|
+
this.apiService.getRuntimeDataByModelId(modelId),
|
562
|
+
this.contextService.create('TestId', core.ConfigurationContextMode.TEST),
|
563
|
+
]).pipe(operators.first(), operators.tap(function (_e) {
|
564
|
+
var _f = __read(_e, 2), runtimeData = _f[0], context = _f[1];
|
565
|
+
var _a;
|
566
|
+
_this._runtimeContext = {
|
567
|
+
modelId: modelId,
|
568
|
+
runtimeModel: core.RuntimeModel.create(runtimeData.types, runtimeData.products),
|
569
|
+
runtimeMode: exports.RuntimeMode.TEST,
|
570
|
+
};
|
571
|
+
_this.contextService.update({
|
572
|
+
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: core.ConfigurationContextMode.TEST, PricingEnabled: _this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: _this.uiDefinitionProperties.priceList, standalone: 'true' }), uiDefinitionExternals),
|
573
|
+
});
|
574
|
+
_this._isInitialized = true;
|
575
|
+
}));
|
520
576
|
};
|
521
|
-
|
522
|
-
var
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
this.
|
577
|
+
ConfigurationRuntimeService.prototype.init = function (props) {
|
578
|
+
var _this = this;
|
579
|
+
this.initializationProps = props;
|
580
|
+
this._assets = props.assets;
|
581
|
+
var context = this.contextService.resolve();
|
582
|
+
return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(operators.tap(function (runtimeContext) {
|
583
|
+
var _a, _b, _c, _d;
|
584
|
+
_this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
|
585
|
+
var PriceListId = ((_c = context.properties) !== null && _c !== void 0 ? _c : {}).PriceListId;
|
586
|
+
var mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
|
587
|
+
_this.id15to18('AccountId', mergeContext.properties);
|
588
|
+
_this._runtimeContext = mergeContext;
|
589
|
+
if (context.properties && ((_d = _this._runtimeContext.properties) === null || _d === void 0 ? void 0 : _d.StartDate)) {
|
590
|
+
_this.contextService.update({
|
591
|
+
properties: Object.assign(Object.assign({}, _this._runtimeContext.properties), context.properties),
|
592
|
+
});
|
593
|
+
}
|
594
|
+
_this._isInitialized = true;
|
595
|
+
}));
|
527
596
|
};
|
528
|
-
|
529
|
-
|
530
|
-
if (!quoteDraft) {
|
597
|
+
ConfigurationRuntimeService.prototype.id15to18 = function (propertyName, source) {
|
598
|
+
if (!source) {
|
531
599
|
return;
|
532
600
|
}
|
533
|
-
|
534
|
-
|
601
|
+
var value = source[propertyName];
|
602
|
+
if (typeof value === 'string' && value.length === 15) {
|
603
|
+
source[propertyName] = core.SalesforceIdUtils.generateId18FromId15(value);
|
535
604
|
}
|
536
|
-
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
|
537
605
|
};
|
538
|
-
|
539
|
-
|
540
|
-
if (!quoteDraft) {
|
541
|
-
return;
|
542
|
-
}
|
543
|
-
var updatedCurrentState = this.currentState.map(function (lineItem) {
|
544
|
-
var updated = priceSummary.lineItems.find(function (li) { return li.id === lineItem.id; });
|
545
|
-
return updated !== null && updated !== void 0 ? updated : lineItem;
|
546
|
-
});
|
547
|
-
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
|
606
|
+
ConfigurationRuntimeService.prototype.getAsset = function (lineItem) {
|
607
|
+
return this._assets && this._assets.find(function (a) { return a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId; });
|
548
608
|
};
|
549
|
-
Object.defineProperty(
|
550
|
-
get: function () {
|
551
|
-
var _this = this;
|
552
|
-
return rxjs.combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(operators.map(function () { return _this.quoteDraft; }), operators.filter(function (quote) { return Boolean(quote); }), operators.shareReplay());
|
553
|
-
},
|
554
|
-
enumerable: false,
|
555
|
-
configurable: true
|
556
|
-
});
|
557
|
-
Object.defineProperty(QuoteDraftService.prototype, "quoteDraft", {
|
558
|
-
get: function () {
|
559
|
-
var quote = this.quoteSubj$.value;
|
560
|
-
if (!quote) {
|
561
|
-
return null;
|
562
|
-
}
|
563
|
-
return Object.assign(Object.assign({}, quote), { context: this.context.resolve() });
|
564
|
-
},
|
565
|
-
enumerable: false,
|
566
|
-
configurable: true
|
567
|
-
});
|
568
|
-
Object.defineProperty(QuoteDraftService.prototype, "quoteDraftForActivePriceList", {
|
609
|
+
Object.defineProperty(ConfigurationRuntimeService.prototype, "isInitialized", {
|
569
610
|
get: function () {
|
570
|
-
|
571
|
-
if (!quoteDraft) {
|
572
|
-
return null;
|
573
|
-
}
|
574
|
-
return Object.assign(Object.assign({}, quoteDraft), { initialState: this.filterByActivePriceList(quoteDraft.initialState), currentState: this.filterByActivePriceList(quoteDraft.currentState) });
|
611
|
+
return this._isInitialized;
|
575
612
|
},
|
576
613
|
enumerable: false,
|
577
614
|
configurable: true
|
578
615
|
});
|
579
|
-
Object.defineProperty(
|
616
|
+
Object.defineProperty(ConfigurationRuntimeService.prototype, "runtimeModel", {
|
580
617
|
get: function () {
|
581
|
-
|
618
|
+
var _a;
|
619
|
+
return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
|
582
620
|
},
|
583
621
|
enumerable: false,
|
584
622
|
configurable: true
|
585
623
|
});
|
586
|
-
Object.defineProperty(
|
624
|
+
Object.defineProperty(ConfigurationRuntimeService.prototype, "runtimeContext", {
|
587
625
|
get: function () {
|
588
|
-
|
589
|
-
return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
626
|
+
return this._runtimeContext;
|
590
627
|
},
|
591
628
|
enumerable: false,
|
592
629
|
configurable: true
|
593
630
|
});
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
631
|
+
return ConfigurationRuntimeService;
|
632
|
+
}());
|
633
|
+
ConfigurationRuntimeService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationRuntimeService, deps: [{ token: i1__namespace.ConfigurationApiService }, { token: ContextService }, { token: RuntimeContextService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
634
|
+
ConfigurationRuntimeService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationRuntimeService });
|
635
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationRuntimeService, decorators: [{
|
636
|
+
type: i0.Injectable
|
637
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
|
638
|
+
|
639
|
+
var findLineItem = function (id, lineItems) {
|
640
|
+
return findLineItemWithComparator(lineItems, function (li) { return li.id === id; });
|
641
|
+
};
|
642
|
+
var findLineItemWithComparator = function (lineItems, comparator) {
|
643
|
+
var currentLevel = lineItems;
|
644
|
+
while (currentLevel.length) {
|
645
|
+
var found = currentLevel.find(comparator);
|
646
|
+
if (found) {
|
647
|
+
return found;
|
648
|
+
}
|
649
|
+
currentLevel = lodash.flatten(currentLevel.map(function (parent) { return parent.lineItems; }));
|
650
|
+
}
|
651
|
+
return;
|
652
|
+
};
|
653
|
+
var insertLineItem = function (lineItem, parentId, toInsert) {
|
654
|
+
var insertData = lineItem.id === parentId ? [toInsert] : [];
|
655
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: __spreadArray(__spreadArray([], __read(insertData)), __read(lineItem.lineItems.map(function (li) {
|
656
|
+
return insertLineItem(li, parentId, toInsert);
|
657
|
+
}))) });
|
658
|
+
};
|
659
|
+
var removeLineItem = function (lineItem, idToRemove) {
|
660
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems
|
661
|
+
.map(function (li) {
|
662
|
+
if (li.id === idToRemove) {
|
663
|
+
return;
|
664
|
+
}
|
665
|
+
else if (li.lineItems.length) {
|
666
|
+
return removeLineItem(li, idToRemove);
|
667
|
+
}
|
668
|
+
return li;
|
669
|
+
})
|
670
|
+
.filter(function (r) { return !!r; }) });
|
671
|
+
};
|
672
|
+
var replaceLineItem = function (lineItem, replaceTo) {
|
673
|
+
if (lineItem.id === replaceTo.id) {
|
674
|
+
return Object.assign({}, replaceTo);
|
675
|
+
}
|
676
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(function (li) {
|
677
|
+
if (li.id === replaceTo.id) {
|
678
|
+
return replaceTo;
|
679
|
+
}
|
680
|
+
else if (li.lineItems.length) {
|
681
|
+
return replaceLineItem(li, replaceTo);
|
682
|
+
}
|
683
|
+
return li;
|
684
|
+
}) });
|
685
|
+
};
|
686
|
+
var mapAttributes = function (attributes) {
|
687
|
+
return attributes.reduce(function (acc, _c) {
|
688
|
+
var _d;
|
689
|
+
var name = _c.name, value = _c.value;
|
690
|
+
return (Object.assign(Object.assign({}, acc), (_d = {}, _d[name] = value, _d)));
|
691
|
+
}, {});
|
692
|
+
};
|
693
|
+
var getAttributes = function (attributes, names) {
|
694
|
+
if (names === void 0) { names = []; }
|
695
|
+
var filtered = attributes.filter(function (_c) {
|
696
|
+
var name = _c.name;
|
697
|
+
return names.includes(name);
|
604
698
|
});
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
},
|
615
|
-
|
616
|
-
|
699
|
+
return lodash.sortBy(filtered, [function (_c) {
|
700
|
+
var name = _c.name;
|
701
|
+
return names.indexOf(name);
|
702
|
+
}]);
|
703
|
+
};
|
704
|
+
var upsertAttributes = function (originalAttributes, attributesToUpsert) {
|
705
|
+
return attributesToUpsert.reduce(function (acc, _c) {
|
706
|
+
var name = _c.name, value = _c.value;
|
707
|
+
var _d = __read(getAttributes(acc, [name]), 1), origAttr = _d[0];
|
708
|
+
return __spreadArray(__spreadArray([], __read(acc.filter(function (attr) { return attr.name !== name; }))), [
|
709
|
+
Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name: name })), { cfgStatus: 'User', value: value }),
|
710
|
+
]);
|
711
|
+
}, originalAttributes);
|
712
|
+
};
|
713
|
+
var patchAttributes = function (rootLineItem, id, attrs) {
|
714
|
+
var lineItem = findLineItem(id, [rootLineItem]);
|
715
|
+
if (!lineItem) {
|
716
|
+
return rootLineItem;
|
717
|
+
}
|
718
|
+
var attributes = upsertAttributes(lineItem.attributes, attrs);
|
719
|
+
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes: attributes }));
|
720
|
+
};
|
721
|
+
var getAttributeValue = function (attributes, name) { var _a; return (_a = attributes.find(function (attr) { return attr.name === name; })) === null || _a === void 0 ? void 0 : _a.value; };
|
722
|
+
var generateLineItem = function (port, type, parentId, attributes, lineItems) {
|
723
|
+
if (attributes === void 0) { attributes = []; }
|
724
|
+
if (lineItems === void 0) { lineItems = []; }
|
725
|
+
return {
|
726
|
+
id: core.UUID.UUID(),
|
727
|
+
port: port,
|
728
|
+
type: type,
|
729
|
+
actionCode: 'ADD',
|
730
|
+
cfgStatus: 'New',
|
731
|
+
attributes: attributes.map(function (_c) {
|
732
|
+
var name = _c.name, value = _c.value;
|
733
|
+
return ({ cfgStatus: 'User', name: name, value: value });
|
734
|
+
}),
|
735
|
+
lineItems: lineItems,
|
736
|
+
parentId: parentId,
|
737
|
+
qty: 1,
|
738
|
+
};
|
739
|
+
};
|
740
|
+
var getRecommendedPrices = function (portDomain, type) {
|
741
|
+
var _a, _b;
|
742
|
+
var domainType = portDomain.domainTypes.find(function (_c) {
|
743
|
+
var name = _c.name;
|
744
|
+
return name === type;
|
617
745
|
});
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
746
|
+
var _c = __read((_b = (_a = domainType === null || domainType === void 0 ? void 0 : domainType.recommendedPrices) === null || _a === void 0 ? void 0 : _a.filter(function (_c) {
|
747
|
+
var chargeMethod = _c.chargeMethod;
|
748
|
+
return chargeMethod === 'ONE_TIME';
|
749
|
+
}).reduce(function (acc, rp) {
|
750
|
+
var _c = __read(acc, 2), netPrice = _c[0], listPrice = _c[1];
|
751
|
+
return [netPrice + rp.netPrice, listPrice + rp.listPrice];
|
752
|
+
}, [0, 0])) !== null && _b !== void 0 ? _b : [0, 0], 2), net = _c[0], list = _c[1];
|
753
|
+
return { net: net, list: list };
|
754
|
+
};
|
755
|
+
var multiplyLineItems = function (lineItem, qty, split) {
|
756
|
+
if (split) {
|
757
|
+
var unifyIds_1 = function (lineItem) { return (Object.assign(Object.assign({}, lineItem), { id: core.UUID.UUID(), lineItems: lineItem.lineItems.map(unifyIds_1) })); };
|
758
|
+
return lodash.map(new Array(qty), function () { return unifyIds_1(lineItem); });
|
759
|
+
}
|
760
|
+
else {
|
761
|
+
return [
|
762
|
+
Object.assign(Object.assign({}, lineItem), { qty: qty }),
|
763
|
+
];
|
764
|
+
}
|
765
|
+
};
|
766
|
+
|
767
|
+
var lineItem_utils = /*#__PURE__*/Object.freeze({
|
768
|
+
__proto__: null,
|
769
|
+
findLineItem: findLineItem,
|
770
|
+
findLineItemWithComparator: findLineItemWithComparator,
|
771
|
+
insertLineItem: insertLineItem,
|
772
|
+
removeLineItem: removeLineItem,
|
773
|
+
replaceLineItem: replaceLineItem,
|
774
|
+
mapAttributes: mapAttributes,
|
775
|
+
getAttributes: getAttributes,
|
776
|
+
upsertAttributes: upsertAttributes,
|
777
|
+
patchAttributes: patchAttributes,
|
778
|
+
getAttributeValue: getAttributeValue,
|
779
|
+
generateLineItem: generateLineItem,
|
780
|
+
getRecommendedPrices: getRecommendedPrices,
|
781
|
+
multiplyLineItems: multiplyLineItems
|
782
|
+
});
|
783
|
+
|
784
|
+
var LineItemWorker = /** @class */ (function () {
|
785
|
+
function LineItemWorker(src) {
|
786
|
+
this.li = Object.assign({}, src);
|
787
|
+
}
|
788
|
+
LineItemWorker.prototype.insert = function (parentId, toInsert) {
|
789
|
+
return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
|
790
|
+
};
|
791
|
+
LineItemWorker.prototype.remove = function (id) {
|
792
|
+
return new LineItemWorker(removeLineItem(this.li, id));
|
793
|
+
};
|
794
|
+
LineItemWorker.prototype.replace = function (toReplace) {
|
795
|
+
return new LineItemWorker(replaceLineItem(this.li, toReplace));
|
796
|
+
};
|
797
|
+
LineItemWorker.prototype.patchAttribute = function (attrs, id) {
|
798
|
+
return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs));
|
799
|
+
};
|
800
|
+
return LineItemWorker;
|
801
|
+
}());
|
802
|
+
|
803
|
+
var QuoteDraftService = /** @class */ (function () {
|
804
|
+
function QuoteDraftService(context, quoteApiService, priceApiService) {
|
805
|
+
var _this = this;
|
806
|
+
this.context = context;
|
807
|
+
this.quoteApiService = quoteApiService;
|
808
|
+
this.priceApiService = priceApiService;
|
809
|
+
this.quoteSubj$ = new rxjs.BehaviorSubject(null);
|
810
|
+
this.resetSubj$ = new rxjs.BehaviorSubject(true);
|
811
|
+
this.isInitializedSubj$ = new rxjs.BehaviorSubject(false);
|
812
|
+
this.initialCurrentState = [];
|
813
|
+
this._hasUnsavedChanges = false;
|
814
|
+
this.allPriceLists = [];
|
815
|
+
this.assetPriceLists = [];
|
816
|
+
this.reset$ = this.resetSubj$.asObservable();
|
817
|
+
this.activePriceList$ = this.context.resolve$().pipe(operators.map(function (ctx) { return _this.allPriceLists.find(function (priceList) { return priceList.id === ctx.properties.PriceListId; }); }), operators.map(function (priceList) { return priceList !== null && priceList !== void 0 ? priceList : null; }));
|
818
|
+
this.isInitializedSubj$
|
819
|
+
.pipe(operators.filter(function (isInitialized) { return isInitialized; }), operators.switchMap(function () { return _this.quoteSubj$.asObservable(); }), operators.skip(1), operators.tap(function (quote) { return _this.markAsUpdated(quote); }))
|
820
|
+
.subscribe();
|
821
|
+
}
|
822
|
+
Object.defineProperty(QuoteDraftService.prototype, "isInitialized", {
|
622
823
|
get: function () {
|
623
|
-
|
624
|
-
|
824
|
+
return this.isInitializedSubj$.getValue();
|
825
|
+
},
|
826
|
+
set: function (value) {
|
827
|
+
if (this.isInitialized !== value) {
|
828
|
+
this.isInitializedSubj$.next(value);
|
829
|
+
}
|
625
830
|
},
|
626
831
|
enumerable: false,
|
627
832
|
configurable: true
|
628
833
|
});
|
629
|
-
Object.defineProperty(QuoteDraftService.prototype, "
|
630
|
-
/**
|
631
|
-
* activeInitialState is initialState passed through additional filters
|
632
|
-
*/
|
834
|
+
Object.defineProperty(QuoteDraftService.prototype, "hasUnsavedChanges", {
|
633
835
|
get: function () {
|
836
|
+
return this._hasUnsavedChanges;
|
837
|
+
},
|
838
|
+
set: function (value) {
|
634
839
|
var _a, _b;
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
initialState = this.filterByActivePriceList(initialState);
|
840
|
+
this._hasUnsavedChanges = value;
|
841
|
+
if (!this._hasUnsavedChanges) {
|
842
|
+
this.initialCurrentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
639
843
|
}
|
640
|
-
return initialState;
|
641
844
|
},
|
642
845
|
enumerable: false,
|
643
846
|
configurable: true
|
644
847
|
});
|
645
|
-
Object.defineProperty(QuoteDraftService.prototype, "
|
848
|
+
Object.defineProperty(QuoteDraftService.prototype, "hasAssets$", {
|
646
849
|
get: function () {
|
647
|
-
|
850
|
+
var _this = this;
|
851
|
+
return this.quoteSubj$.pipe(operators.map(function () { return _this.hasAssets; }));
|
648
852
|
},
|
649
853
|
enumerable: false,
|
650
854
|
configurable: true
|
651
855
|
});
|
652
|
-
Object.defineProperty(QuoteDraftService.prototype, "
|
856
|
+
Object.defineProperty(QuoteDraftService.prototype, "hasAssets", {
|
653
857
|
get: function () {
|
654
|
-
var
|
655
|
-
return
|
858
|
+
var quoteDraft = this.quoteSubj$.value;
|
859
|
+
return Boolean(quoteDraft && quoteDraft.currentState.length > 0);
|
656
860
|
},
|
657
861
|
enumerable: false,
|
658
862
|
configurable: true
|
659
863
|
});
|
660
|
-
QuoteDraftService.prototype.
|
661
|
-
|
864
|
+
QuoteDraftService.prototype.reset = function () {
|
865
|
+
this.resetSubj$.next(true);
|
866
|
+
this.quoteSubj$.next(null);
|
867
|
+
this.hasUnsavedChanges = false;
|
662
868
|
};
|
663
|
-
QuoteDraftService.prototype.
|
869
|
+
QuoteDraftService.prototype.init = function (quoteId, params) {
|
664
870
|
var _this = this;
|
665
|
-
return this.
|
871
|
+
return rxjs.zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(operators.tap(function (_c) {
|
872
|
+
var _d = __read(_c, 2), quote = _d[0], allPriceLists = _d[1];
|
873
|
+
_this.allPriceLists = allPriceLists;
|
874
|
+
_this.quoteSubj$.next(quote);
|
875
|
+
_this.context.update(quote.context);
|
876
|
+
_this.populateActivePriceLists$();
|
877
|
+
}), operators.map(function () { return rxjs.noop(); }), operators.take(1));
|
666
878
|
};
|
667
|
-
QuoteDraftService.prototype.
|
668
|
-
var
|
669
|
-
if (
|
670
|
-
return
|
671
|
-
}
|
672
|
-
if (context.mode === core.ConfigurationContextMode.QUOTE) {
|
673
|
-
return context.properties.Status === 'Draft';
|
879
|
+
QuoteDraftService.prototype.setCurrentLineItemState = function (lineItems) {
|
880
|
+
var quoteDraft = this.quoteSubj$.value;
|
881
|
+
if (!quoteDraft) {
|
882
|
+
return;
|
674
883
|
}
|
675
|
-
|
676
|
-
};
|
677
|
-
QuoteDraftService.prototype.updateActivePriceList = function (priceListId) {
|
678
|
-
this.context.update({ properties: { PriceListId: priceListId } });
|
884
|
+
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
|
679
885
|
};
|
680
|
-
QuoteDraftService.prototype.
|
681
|
-
var
|
682
|
-
var ctx = this.context.resolve();
|
683
|
-
var quoteDraft = this.quoteDraft;
|
886
|
+
QuoteDraftService.prototype.updateQuoteDraft = function (update) {
|
887
|
+
var quoteDraft = this.quoteSubj$.value;
|
684
888
|
if (!quoteDraft) {
|
685
889
|
return;
|
686
890
|
}
|
687
|
-
|
688
|
-
|
689
|
-
// Populate list of price lists
|
690
|
-
this.assetPriceLists = quoteDraft.currentState
|
691
|
-
.map(function (_c) {
|
692
|
-
var priceListId = _c.priceListId;
|
693
|
-
return priceListId;
|
694
|
-
})
|
695
|
-
.reduce(function (trunk, priceListId) {
|
696
|
-
var _a, _b;
|
697
|
-
if (!priceListId || trunk.some(function (item) { return item.id === priceListId; })) {
|
698
|
-
return trunk;
|
699
|
-
}
|
700
|
-
return __spreadArray(__spreadArray([], __read(trunk)), [
|
701
|
-
{ id: priceListId, name: (_b = (_a = _this.allPriceLists.find(function (item) { return item.id === priceListId; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
|
702
|
-
]);
|
703
|
-
}, []);
|
704
|
-
}
|
705
|
-
};
|
706
|
-
QuoteDraftService.prototype.filterByActivePriceList = function (lineItems) {
|
707
|
-
var ctx = this.context.resolve();
|
708
|
-
return lineItems.filter(function (li) { return !li.priceListId || li.priceListId === ctx.properties.PriceListId; });
|
709
|
-
};
|
710
|
-
QuoteDraftService.prototype.markAsUpdated = function (quote) {
|
711
|
-
if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === core.ConfigurationContextMode.ACCOUNT) {
|
712
|
-
this.hasUnsavedChanges = !!quote && !quote.currentState.every(function (li) { return li.actionCode === 'EXIST'; });
|
713
|
-
}
|
714
|
-
else {
|
715
|
-
this.hasUnsavedChanges = true;
|
891
|
+
if (update.context) {
|
892
|
+
this.context.set(update.context);
|
716
893
|
}
|
894
|
+
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
|
717
895
|
};
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
QuoteDraftService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteDraftService, providedIn: 'root' });
|
722
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteDraftService, decorators: [{
|
723
|
-
type: i0.Injectable,
|
724
|
-
args: [{ providedIn: 'root' }]
|
725
|
-
}], ctorParameters: function () { return [{ type: ContextService }, { type: i1__namespace.QuoteApiService }, { type: i1__namespace.PriceApiService }]; } });
|
726
|
-
|
727
|
-
var RuntimeContextService = /** @class */ (function () {
|
728
|
-
function RuntimeContextService(configurationApiService) {
|
729
|
-
this.configurationApiService = configurationApiService;
|
730
|
-
}
|
731
|
-
RuntimeContextService.prototype.getRuntimeContext = function (productId, offeringId) {
|
732
|
-
var _this = this;
|
733
|
-
return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(operators.map(function (runtimeData) {
|
734
|
-
var _a, _b, _c;
|
735
|
-
var uiDefinition = _this.getUIDefinition(runtimeData);
|
736
|
-
var runtimeModel = core.RuntimeModel.create(runtimeData.types, runtimeData.products);
|
737
|
-
var _d = (_a = Array.from(runtimeModel.components.values()).find(function (c) { return c.productId === productId; })) !== null && _a !== void 0 ? _a : {}, productName = _d.productName, properties = _d.properties;
|
738
|
-
return {
|
739
|
-
modelId: runtimeData.modelId,
|
740
|
-
uiDefinition: uiDefinition,
|
741
|
-
runtimeModel: runtimeModel,
|
742
|
-
runtimeMode: exports.RuntimeMode.PROD,
|
743
|
-
productId: productId,
|
744
|
-
productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
|
745
|
-
offeringId: offeringId,
|
746
|
-
properties: {
|
747
|
-
PricingEnabled: ((_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.pricingEnabled) ? 'true' : 'false',
|
748
|
-
PriceListId: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.priceList,
|
749
|
-
},
|
750
|
-
};
|
751
|
-
}));
|
752
|
-
};
|
753
|
-
RuntimeContextService.prototype.getUIDefinition = function (runtimeData) {
|
754
|
-
var _a;
|
755
|
-
var rawUiDefinitions;
|
756
|
-
try {
|
757
|
-
rawUiDefinitions = JSON.parse(runtimeData.uiDefinitionsSource);
|
758
|
-
}
|
759
|
-
catch (e) {
|
896
|
+
QuoteDraftService.prototype.updateByPriceSummary = function (priceSummary) {
|
897
|
+
var quoteDraft = this.quoteSubj$.value;
|
898
|
+
if (!quoteDraft) {
|
760
899
|
return;
|
761
900
|
}
|
762
|
-
var
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
}());
|
768
|
-
RuntimeContextService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RuntimeContextService, deps: [{ token: i1__namespace.ConfigurationApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
769
|
-
RuntimeContextService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RuntimeContextService });
|
770
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: RuntimeContextService, decorators: [{
|
771
|
-
type: i0.Injectable
|
772
|
-
}], ctorParameters: function () { return [{ type: i1__namespace.ConfigurationApiService }]; } });
|
773
|
-
|
774
|
-
var ConfigurationRuntimeService = /** @class */ (function () {
|
775
|
-
function ConfigurationRuntimeService(apiService, contextService, runtimeContextService) {
|
776
|
-
this.apiService = apiService;
|
777
|
-
this.contextService = contextService;
|
778
|
-
this.runtimeContextService = runtimeContextService;
|
779
|
-
this._isInitialized = false;
|
780
|
-
this.uiDefinitionProperties = {};
|
781
|
-
}
|
782
|
-
ConfigurationRuntimeService.prototype.reset = function () {
|
783
|
-
this._isInitialized = false;
|
784
|
-
this._runtimeContext = undefined;
|
785
|
-
this._assets = undefined;
|
786
|
-
this.initializationProps = undefined;
|
787
|
-
this.uiDefinitionProperties = {};
|
788
|
-
};
|
789
|
-
ConfigurationRuntimeService.prototype.initTestMode = function (modelId, uiDefinition) {
|
790
|
-
var _this = this;
|
791
|
-
var _a, _b;
|
792
|
-
this.uiDefinitionProperties = (_a = uiDefinition.properties) !== null && _a !== void 0 ? _a : {};
|
793
|
-
var uiDefinitionExternals = (_b = uiDefinition.externals) !== null && _b !== void 0 ? _b : {};
|
794
|
-
return rxjs.combineLatest([
|
795
|
-
this.apiService.getRuntimeDataByModelId(modelId),
|
796
|
-
this.contextService.create('TestId', core.ConfigurationContextMode.TEST),
|
797
|
-
]).pipe(operators.first(), operators.tap(function (_e) {
|
798
|
-
var _f = __read(_e, 2), runtimeData = _f[0], context = _f[1];
|
799
|
-
var _a;
|
800
|
-
_this._runtimeContext = {
|
801
|
-
modelId: modelId,
|
802
|
-
runtimeModel: core.RuntimeModel.create(runtimeData.types, runtimeData.products),
|
803
|
-
runtimeMode: exports.RuntimeMode.TEST,
|
804
|
-
};
|
805
|
-
_this.contextService.update({
|
806
|
-
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: core.ConfigurationContextMode.TEST, PricingEnabled: _this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: _this.uiDefinitionProperties.priceList, standalone: 'true' }), uiDefinitionExternals),
|
807
|
-
});
|
808
|
-
_this._isInitialized = true;
|
809
|
-
}));
|
901
|
+
var updatedCurrentState = this.currentState.map(function (lineItem) {
|
902
|
+
var updated = priceSummary.lineItems.find(function (li) { return li.id === lineItem.id; });
|
903
|
+
return updated !== null && updated !== void 0 ? updated : lineItem;
|
904
|
+
});
|
905
|
+
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
|
810
906
|
};
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
_this.contextService.update({
|
825
|
-
properties: Object.assign(Object.assign({}, _this._runtimeContext.properties), context.properties),
|
826
|
-
});
|
907
|
+
Object.defineProperty(QuoteDraftService.prototype, "quoteDraft$", {
|
908
|
+
get: function () {
|
909
|
+
var _this = this;
|
910
|
+
return rxjs.combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(operators.map(function () { return _this.quoteDraft; }), operators.filter(function (quote) { return Boolean(quote); }), operators.shareReplay());
|
911
|
+
},
|
912
|
+
enumerable: false,
|
913
|
+
configurable: true
|
914
|
+
});
|
915
|
+
Object.defineProperty(QuoteDraftService.prototype, "quoteDraft", {
|
916
|
+
get: function () {
|
917
|
+
var quote = this.quoteSubj$.value;
|
918
|
+
if (!quote) {
|
919
|
+
return null;
|
827
920
|
}
|
828
|
-
|
829
|
-
}
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
}
|
835
|
-
var value = source[propertyName];
|
836
|
-
if (typeof value === 'string' && value.length === 15) {
|
837
|
-
source[propertyName] = core.SalesforceIdUtils.generateId18FromId15(value);
|
838
|
-
}
|
839
|
-
};
|
840
|
-
ConfigurationRuntimeService.prototype.getAsset = function (lineItem) {
|
841
|
-
return this._assets && this._assets.find(function (a) { return a.id === lineItem.openOrderLineItemId || a.id === lineItem.assetId; });
|
842
|
-
};
|
843
|
-
Object.defineProperty(ConfigurationRuntimeService.prototype, "isInitialized", {
|
921
|
+
return Object.assign(Object.assign({}, quote), { context: this.context.resolve() });
|
922
|
+
},
|
923
|
+
enumerable: false,
|
924
|
+
configurable: true
|
925
|
+
});
|
926
|
+
Object.defineProperty(QuoteDraftService.prototype, "quoteDraftForActivePriceList", {
|
844
927
|
get: function () {
|
845
|
-
|
928
|
+
var quoteDraft = this.quoteDraft;
|
929
|
+
if (!quoteDraft) {
|
930
|
+
return null;
|
931
|
+
}
|
932
|
+
return Object.assign(Object.assign({}, quoteDraft), { initialState: this.filterByActivePriceList(quoteDraft.initialState), currentState: this.filterByActivePriceList(quoteDraft.currentState) });
|
846
933
|
},
|
847
934
|
enumerable: false,
|
848
935
|
configurable: true
|
849
936
|
});
|
850
|
-
Object.defineProperty(
|
937
|
+
Object.defineProperty(QuoteDraftService.prototype, "currentState$", {
|
851
938
|
get: function () {
|
852
|
-
|
853
|
-
return (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.runtimeModel;
|
939
|
+
return this.quoteDraft$.pipe(operators.map(function (quote) { return quote.currentState; }));
|
854
940
|
},
|
855
941
|
enumerable: false,
|
856
942
|
configurable: true
|
857
943
|
});
|
858
|
-
Object.defineProperty(
|
944
|
+
Object.defineProperty(QuoteDraftService.prototype, "currentState", {
|
859
945
|
get: function () {
|
860
|
-
|
946
|
+
var _a, _b;
|
947
|
+
return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
861
948
|
},
|
862
949
|
enumerable: false,
|
863
950
|
configurable: true
|
864
951
|
});
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
.map(function (
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(function (li) {
|
911
|
-
if (li.id === replaceTo.id) {
|
912
|
-
return replaceTo;
|
913
|
-
}
|
914
|
-
else if (li.lineItems.length) {
|
915
|
-
return replaceLineItem(li, replaceTo);
|
952
|
+
Object.defineProperty(QuoteDraftService.prototype, "activeCurrentState$", {
|
953
|
+
/**
|
954
|
+
* Stream of activeCurrentState
|
955
|
+
*/
|
956
|
+
get: function () {
|
957
|
+
var _this = this;
|
958
|
+
return this.quoteDraft$.pipe(operators.map(function () { return _this.activeCurrentState; }));
|
959
|
+
},
|
960
|
+
enumerable: false,
|
961
|
+
configurable: true
|
962
|
+
});
|
963
|
+
Object.defineProperty(QuoteDraftService.prototype, "activeCurrentState", {
|
964
|
+
/**
|
965
|
+
* activeCurrentState is currentState passed through additional filters
|
966
|
+
*/
|
967
|
+
get: function () {
|
968
|
+
var _a, _b;
|
969
|
+
var currentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
970
|
+
currentState = this.filterByActivePriceList(currentState);
|
971
|
+
return currentState;
|
972
|
+
},
|
973
|
+
enumerable: false,
|
974
|
+
configurable: true
|
975
|
+
});
|
976
|
+
Object.defineProperty(QuoteDraftService.prototype, "activeInitialState$", {
|
977
|
+
/**
|
978
|
+
* Stream of activeInitialState
|
979
|
+
*/
|
980
|
+
get: function () {
|
981
|
+
var _this = this;
|
982
|
+
return this.quoteDraft$.pipe(operators.map(function () { return _this.activeInitialState; }));
|
983
|
+
},
|
984
|
+
enumerable: false,
|
985
|
+
configurable: true
|
986
|
+
});
|
987
|
+
Object.defineProperty(QuoteDraftService.prototype, "activeInitialState", {
|
988
|
+
/**
|
989
|
+
* activeInitialState is initialState passed through additional filters
|
990
|
+
*/
|
991
|
+
get: function () {
|
992
|
+
var _a, _b;
|
993
|
+
var ctx = this.context.resolve();
|
994
|
+
var initialState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState) !== null && _b !== void 0 ? _b : [];
|
995
|
+
if (ctx.mode === core.ConfigurationContextMode.ACCOUNT) {
|
996
|
+
initialState = this.filterByActivePriceList(initialState);
|
916
997
|
}
|
917
|
-
return
|
918
|
-
}
|
919
|
-
|
920
|
-
|
921
|
-
return attributes.reduce(function (acc, _c) {
|
922
|
-
var _d;
|
923
|
-
var name = _c.name, value = _c.value;
|
924
|
-
return (Object.assign(Object.assign({}, acc), (_d = {}, _d[name] = value, _d)));
|
925
|
-
}, {});
|
926
|
-
};
|
927
|
-
var getAttributes = function (attributes, names) {
|
928
|
-
if (names === void 0) { names = []; }
|
929
|
-
var filtered = attributes.filter(function (_c) {
|
930
|
-
var name = _c.name;
|
931
|
-
return names.includes(name);
|
998
|
+
return initialState;
|
999
|
+
},
|
1000
|
+
enumerable: false,
|
1001
|
+
configurable: true
|
932
1002
|
});
|
933
|
-
|
934
|
-
|
935
|
-
return
|
936
|
-
}
|
937
|
-
|
938
|
-
|
939
|
-
return attributesToUpsert.reduce(function (acc, _c) {
|
940
|
-
var name = _c.name, value = _c.value;
|
941
|
-
var _d = __read(getAttributes(acc, [name]), 1), origAttr = _d[0];
|
942
|
-
return __spreadArray(__spreadArray([], __read(acc.filter(function (attr) { return attr.name !== name; }))), [
|
943
|
-
Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name: name })), { cfgStatus: 'User', value: value }),
|
944
|
-
]);
|
945
|
-
}, originalAttributes);
|
946
|
-
};
|
947
|
-
var patchAttributes = function (rootLineItem, id, attrs) {
|
948
|
-
var lineItem = findLineItem(id, [rootLineItem]);
|
949
|
-
if (!lineItem) {
|
950
|
-
return rootLineItem;
|
951
|
-
}
|
952
|
-
var attributes = upsertAttributes(lineItem.attributes, attrs);
|
953
|
-
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes: attributes }));
|
954
|
-
};
|
955
|
-
var getAttributeValue = function (attributes, name) { var _a; return (_a = attributes.find(function (attr) { return attr.name === name; })) === null || _a === void 0 ? void 0 : _a.value; };
|
956
|
-
var generateLineItem = function (port, type, parentId, attributes, lineItems) {
|
957
|
-
if (attributes === void 0) { attributes = []; }
|
958
|
-
if (lineItems === void 0) { lineItems = []; }
|
959
|
-
return {
|
960
|
-
id: core.UUID.UUID(),
|
961
|
-
port: port,
|
962
|
-
type: type,
|
963
|
-
actionCode: 'ADD',
|
964
|
-
cfgStatus: 'New',
|
965
|
-
attributes: attributes.map(function (_c) {
|
966
|
-
var name = _c.name, value = _c.value;
|
967
|
-
return ({ cfgStatus: 'User', name: name, value: value });
|
968
|
-
}),
|
969
|
-
lineItems: lineItems,
|
970
|
-
parentId: parentId,
|
971
|
-
qty: 1,
|
972
|
-
};
|
973
|
-
};
|
974
|
-
var getRecommendedPrices = function (portDomain, type) {
|
975
|
-
var _a, _b;
|
976
|
-
var domainType = portDomain.domainTypes.find(function (_c) {
|
977
|
-
var name = _c.name;
|
978
|
-
return name === type;
|
1003
|
+
Object.defineProperty(QuoteDraftService.prototype, "isStandalone", {
|
1004
|
+
get: function () {
|
1005
|
+
return this.context.resolve().properties.standalone === 'true';
|
1006
|
+
},
|
1007
|
+
enumerable: false,
|
1008
|
+
configurable: true
|
979
1009
|
});
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
var lineItem_utils = /*#__PURE__*/Object.freeze({
|
991
|
-
__proto__: null,
|
992
|
-
findLineItem: findLineItem,
|
993
|
-
findLineItemWithComparator: findLineItemWithComparator,
|
994
|
-
insertLineItem: insertLineItem,
|
995
|
-
removeLineItem: removeLineItem,
|
996
|
-
replaceLineItem: replaceLineItem,
|
997
|
-
mapAttributes: mapAttributes,
|
998
|
-
getAttributes: getAttributes,
|
999
|
-
upsertAttributes: upsertAttributes,
|
1000
|
-
patchAttributes: patchAttributes,
|
1001
|
-
getAttributeValue: getAttributeValue,
|
1002
|
-
generateLineItem: generateLineItem,
|
1003
|
-
getRecommendedPrices: getRecommendedPrices
|
1004
|
-
});
|
1005
|
-
|
1006
|
-
var LineItemWorker = /** @class */ (function () {
|
1007
|
-
function LineItemWorker(src) {
|
1008
|
-
this.li = Object.assign({}, src);
|
1009
|
-
}
|
1010
|
-
LineItemWorker.prototype.insert = function (parentId, toInsert) {
|
1011
|
-
return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
|
1010
|
+
Object.defineProperty(QuoteDraftService.prototype, "isStandalone$", {
|
1011
|
+
get: function () {
|
1012
|
+
var _this = this;
|
1013
|
+
return this.context.resolve$().pipe(operators.map(function () { return _this.isStandalone; }));
|
1014
|
+
},
|
1015
|
+
enumerable: false,
|
1016
|
+
configurable: true
|
1017
|
+
});
|
1018
|
+
QuoteDraftService.prototype.getInitialCurrentState = function () {
|
1019
|
+
return this.initialCurrentState;
|
1012
1020
|
};
|
1013
|
-
|
1014
|
-
|
1021
|
+
QuoteDraftService.prototype.isEditMode$ = function () {
|
1022
|
+
var _this = this;
|
1023
|
+
return this.context.resolve$().pipe(operators.map(function () { return _this.isEditMode(); }));
|
1015
1024
|
};
|
1016
|
-
|
1017
|
-
|
1025
|
+
QuoteDraftService.prototype.isEditMode = function () {
|
1026
|
+
var context = this.context.resolve();
|
1027
|
+
if (context.mode === core.ConfigurationContextMode.ACCOUNT) {
|
1028
|
+
return true;
|
1029
|
+
}
|
1030
|
+
if (context.mode === core.ConfigurationContextMode.QUOTE) {
|
1031
|
+
return context.properties.Status === 'Draft';
|
1032
|
+
}
|
1033
|
+
return false;
|
1018
1034
|
};
|
1019
|
-
|
1020
|
-
|
1035
|
+
QuoteDraftService.prototype.updateActivePriceList = function (priceListId) {
|
1036
|
+
this.context.update({ properties: { PriceListId: priceListId } });
|
1021
1037
|
};
|
1022
|
-
|
1038
|
+
QuoteDraftService.prototype.populateActivePriceLists$ = function () {
|
1039
|
+
var _this = this;
|
1040
|
+
var ctx = this.context.resolve();
|
1041
|
+
var quoteDraft = this.quoteDraft;
|
1042
|
+
if (!quoteDraft) {
|
1043
|
+
return;
|
1044
|
+
}
|
1045
|
+
// In ACCOUNT mode populate price lists from related assets
|
1046
|
+
if (ctx.mode === core.ConfigurationContextMode.ACCOUNT) {
|
1047
|
+
// Populate list of price lists
|
1048
|
+
this.assetPriceLists = quoteDraft.currentState
|
1049
|
+
.map(function (_c) {
|
1050
|
+
var priceListId = _c.priceListId;
|
1051
|
+
return priceListId;
|
1052
|
+
})
|
1053
|
+
.reduce(function (trunk, priceListId) {
|
1054
|
+
var _a, _b;
|
1055
|
+
if (!priceListId || trunk.some(function (item) { return item.id === priceListId; })) {
|
1056
|
+
return trunk;
|
1057
|
+
}
|
1058
|
+
return __spreadArray(__spreadArray([], __read(trunk)), [
|
1059
|
+
{ id: priceListId, name: (_b = (_a = _this.allPriceLists.find(function (item) { return item.id === priceListId; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
|
1060
|
+
]);
|
1061
|
+
}, []);
|
1062
|
+
}
|
1063
|
+
};
|
1064
|
+
QuoteDraftService.prototype.filterByActivePriceList = function (lineItems) {
|
1065
|
+
var ctx = this.context.resolve();
|
1066
|
+
return lineItems.filter(function (li) { return !li.priceListId || li.priceListId === ctx.properties.PriceListId; });
|
1067
|
+
};
|
1068
|
+
QuoteDraftService.prototype.markAsUpdated = function (quote) {
|
1069
|
+
if ((quote === null || quote === void 0 ? void 0 : quote.context.properties.mode) === core.ConfigurationContextMode.ACCOUNT) {
|
1070
|
+
this.hasUnsavedChanges = !!quote && !quote.currentState.every(function (li) { return li.actionCode === 'EXIST'; });
|
1071
|
+
}
|
1072
|
+
else {
|
1073
|
+
this.hasUnsavedChanges = !lodash.isEqual(this.initialCurrentState, quote === null || quote === void 0 ? void 0 : quote.currentState);
|
1074
|
+
}
|
1075
|
+
};
|
1076
|
+
return QuoteDraftService;
|
1023
1077
|
}());
|
1078
|
+
QuoteDraftService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1__namespace.QuoteApiService }, { token: i1__namespace.PriceApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1079
|
+
QuoteDraftService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteDraftService, providedIn: 'root' });
|
1080
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: QuoteDraftService, decorators: [{
|
1081
|
+
type: i0.Injectable,
|
1082
|
+
args: [{ providedIn: 'root' }]
|
1083
|
+
}], ctorParameters: function () { return [{ type: ContextService }, { type: i1__namespace.QuoteApiService }, { type: i1__namespace.PriceApiService }]; } });
|
1024
1084
|
|
1025
1085
|
var ConfigurationService = /** @class */ (function () {
|
1026
1086
|
function ConfigurationService(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService) {
|
@@ -1205,11 +1265,11 @@
|
|
1205
1265
|
};
|
1206
1266
|
return ConfigurationService;
|
1207
1267
|
}());
|
1208
|
-
ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
1209
|
-
ConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
1210
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1268
|
+
ConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1__namespace.ConfigurationApiService }, { token: i5__namespace.MessageService }, { token: i6__namespace.DialogService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1269
|
+
ConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationService });
|
1270
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationService, decorators: [{
|
1211
1271
|
type: i0.Injectable
|
1212
|
-
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1__namespace.ConfigurationApiService }, { type:
|
1272
|
+
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1__namespace.ConfigurationApiService }, { type: i5__namespace.MessageService }, { type: i6__namespace.DialogService }]; } });
|
1213
1273
|
|
1214
1274
|
var FlowUpdateService = /** @class */ (function () {
|
1215
1275
|
function FlowUpdateService() {
|
@@ -1335,9 +1395,9 @@
|
|
1335
1395
|
};
|
1336
1396
|
return FlowUpdateService;
|
1337
1397
|
}());
|
1338
|
-
FlowUpdateService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
1339
|
-
FlowUpdateService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
1340
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1398
|
+
FlowUpdateService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowUpdateService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1399
|
+
FlowUpdateService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowUpdateService });
|
1400
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowUpdateService, decorators: [{
|
1341
1401
|
type: i0.Injectable
|
1342
1402
|
}] });
|
1343
1403
|
|
@@ -1431,7 +1491,13 @@
|
|
1431
1491
|
if (!quoteDraft) {
|
1432
1492
|
return rxjs.of(null);
|
1433
1493
|
}
|
1434
|
-
return this.configurationService.configureExternal$(productId, qty).pipe(rxjs.map(function (lineItem) {
|
1494
|
+
return this.configurationService.configureExternal$(productId, qty).pipe(rxjs.map(function (lineItem) {
|
1495
|
+
var _a, _b;
|
1496
|
+
var model = _this.configurationService.getRuntimeModel();
|
1497
|
+
var split = (_b = (_a = model === null || model === void 0 ? void 0 : model.types.find(function (type) { return type.name === lineItem.type; })) === null || _a === void 0 ? void 0 : _a.split) !== null && _b !== void 0 ? _b : false;
|
1498
|
+
var lineItems = multiplyLineItems(lineItem, qty !== null && qty !== void 0 ? qty : 1, split);
|
1499
|
+
return __spreadArray(__spreadArray([], __read(quoteDraft.currentState)), __read(lineItems));
|
1500
|
+
}), rxjs.switchMap(function (updatedState) { return _this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState })); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack());
|
1435
1501
|
};
|
1436
1502
|
FlowConfigurationService.prototype.get = function () {
|
1437
1503
|
var _this = this;
|
@@ -1507,9 +1573,9 @@
|
|
1507
1573
|
};
|
1508
1574
|
return FlowConfigurationService;
|
1509
1575
|
}());
|
1510
|
-
FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
1511
|
-
FlowConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
1512
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1576
|
+
FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationService, deps: [{ token: i1__namespace.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1577
|
+
FlowConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationService });
|
1578
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationService, decorators: [{
|
1513
1579
|
type: i0.Injectable
|
1514
1580
|
}], ctorParameters: function () { return [{ type: i1__namespace.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
|
1515
1581
|
|
@@ -1518,10 +1584,10 @@
|
|
1518
1584
|
}
|
1519
1585
|
return FlowConfigurationModule;
|
1520
1586
|
}());
|
1521
|
-
FlowConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
1522
|
-
FlowConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
1523
|
-
FlowConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
1524
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1587
|
+
FlowConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
1588
|
+
FlowConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule });
|
1589
|
+
FlowConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, i1.PriceApiService], imports: [[]] });
|
1590
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: FlowConfigurationModule, decorators: [{
|
1525
1591
|
type: i0.NgModule,
|
1526
1592
|
args: [{
|
1527
1593
|
imports: [],
|
@@ -1534,9 +1600,9 @@
|
|
1534
1600
|
}
|
1535
1601
|
return ConfigurationModule;
|
1536
1602
|
}());
|
1537
|
-
ConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
1538
|
-
ConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
1539
|
-
ConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
1603
|
+
ConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
1604
|
+
ConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, imports: [components.ConfirmationDialogModule] });
|
1605
|
+
ConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, providers: [
|
1540
1606
|
i1.ContextApiService,
|
1541
1607
|
i1.ProductModelApiService,
|
1542
1608
|
i1.ConfigurationApiService,
|
@@ -1544,7 +1610,7 @@
|
|
1544
1610
|
RuntimeContextService,
|
1545
1611
|
ConfigurationService,
|
1546
1612
|
], imports: [[components.ConfirmationDialogModule]] });
|
1547
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1613
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ConfigurationModule, decorators: [{
|
1548
1614
|
type: i0.NgModule,
|
1549
1615
|
args: [{
|
1550
1616
|
imports: [components.ConfirmationDialogModule],
|
@@ -1559,19 +1625,173 @@
|
|
1559
1625
|
}]
|
1560
1626
|
}] });
|
1561
1627
|
|
1628
|
+
function calculateMetricByMethod(lineItems, metric, method) {
|
1629
|
+
var items = getLineItemsByMethod(lineItems, method);
|
1630
|
+
return items.reduce(function (acc, li) {
|
1631
|
+
var value = li.reduce(function (accProduct, item) { return accProduct + ((item.totalMetrics && item.totalMetrics[metric]) || 0); }, 0);
|
1632
|
+
if (method === 'avg' && li.length > 0) {
|
1633
|
+
value /= li.length;
|
1634
|
+
}
|
1635
|
+
return acc + value;
|
1636
|
+
}, 0);
|
1637
|
+
}
|
1638
|
+
function getLineItemsByMethod(lineItems, method) {
|
1639
|
+
switch (method) {
|
1640
|
+
case 'first': {
|
1641
|
+
return lineItems.filter(function (li) { return !li.rampInstanceId; }).map(function (item) { return [item]; });
|
1642
|
+
}
|
1643
|
+
case 'last': {
|
1644
|
+
var rootTermItems = lineItems.filter(function (li) { return !li.rampInstanceId; });
|
1645
|
+
var products = rootTermItems.map(function (lineItem) { return __spreadArray([
|
1646
|
+
lineItem
|
1647
|
+
], __read(lineItems.filter(function (li) { return li.rampInstanceId === lineItem.id; }))); });
|
1648
|
+
return products
|
1649
|
+
.map(function (items) { return __spreadArray([], __read(items)).sort(function (a, b) { return getDateValue(a.endDate || '') - getDateValue(b.endDate || ''); }).pop(); })
|
1650
|
+
.filter(function (li) { return Boolean(li); })
|
1651
|
+
.map(function (item) { return [item]; });
|
1652
|
+
}
|
1653
|
+
case 'avg': {
|
1654
|
+
var rootTermItems = lineItems.filter(function (li) { return !li.rampInstanceId; });
|
1655
|
+
return rootTermItems.map(function (lineItem) { return __spreadArray([lineItem], __read(lineItems.filter(function (li) { return li.rampInstanceId === lineItem.id; }))); });
|
1656
|
+
}
|
1657
|
+
case 'sum': {
|
1658
|
+
return lineItems.map(function (item) { return [item]; });
|
1659
|
+
}
|
1660
|
+
default: {
|
1661
|
+
return lineItems.map(function (item) { return [item]; });
|
1662
|
+
}
|
1663
|
+
}
|
1664
|
+
}
|
1665
|
+
function getDateValue(date) {
|
1666
|
+
return date ? new Date(date).getTime() : 0;
|
1667
|
+
}
|
1668
|
+
|
1669
|
+
var MetricsCalculationService = /** @class */ (function () {
|
1670
|
+
function MetricsCalculationService(quoteDraftService, settingsService) {
|
1671
|
+
var _this = this;
|
1672
|
+
this.quoteDraftService = quoteDraftService;
|
1673
|
+
this.settingsService = settingsService;
|
1674
|
+
this.metricsUpdated$ = new rxjs.Subject();
|
1675
|
+
this.quoteMetricsSettings = {};
|
1676
|
+
this.metricsCalculationMethodMap = {};
|
1677
|
+
this.metricsData = {};
|
1678
|
+
rxjs.combineLatest([
|
1679
|
+
this.quoteDraftService.currentState$,
|
1680
|
+
this.settingsService.fetchSetting('QUOTE_LEVEL_METRIC_CALCULATION_METHOD').pipe(rxjs.take(1)),
|
1681
|
+
]).subscribe(function (_a) {
|
1682
|
+
var _b = __read(_a, 2), lineItems = _b[0], setting = _b[1];
|
1683
|
+
var settingsData = {};
|
1684
|
+
try {
|
1685
|
+
settingsData = JSON.parse((setting === null || setting === void 0 ? void 0 : setting.value) || '{}');
|
1686
|
+
}
|
1687
|
+
catch (error) {
|
1688
|
+
settingsData = {};
|
1689
|
+
}
|
1690
|
+
_this.quoteMetricsSettings = settingsData;
|
1691
|
+
_this.updateMetrics(lineItems);
|
1692
|
+
});
|
1693
|
+
}
|
1694
|
+
Object.defineProperty(MetricsCalculationService.prototype, "onMetricsUpdate$", {
|
1695
|
+
get: function () {
|
1696
|
+
return this.metricsUpdated$.asObservable();
|
1697
|
+
},
|
1698
|
+
enumerable: false,
|
1699
|
+
configurable: true
|
1700
|
+
});
|
1701
|
+
MetricsCalculationService.prototype.getMetricValue = function (metric) {
|
1702
|
+
return this.metricsData[metric] || 0;
|
1703
|
+
};
|
1704
|
+
MetricsCalculationService.prototype.updateMetrics = function (lineItems) {
|
1705
|
+
var _this = this;
|
1706
|
+
var metricKeys = this.collectMetricKeys(lineItems).filter(function (key) { return !key.includes('Effective_'); });
|
1707
|
+
this.metricsCalculationMethodMap = this.buildMetricsCalculationMethods(metricKeys, this.metricsCalculationMethodMap);
|
1708
|
+
this.metricsData = metricKeys.reduce(function (acc, key) {
|
1709
|
+
var _a;
|
1710
|
+
return (Object.assign(Object.assign({}, acc), (_a = {}, _a[key] = _this.calculateMetric(lineItems, key), _a)));
|
1711
|
+
}, {});
|
1712
|
+
this.metricsUpdated$.next();
|
1713
|
+
};
|
1714
|
+
MetricsCalculationService.prototype.calculateMetric = function (lineItems, metric) {
|
1715
|
+
return calculateMetricByMethod(lineItems, metric, this.metricsCalculationMethodMap[metric] || 'sum');
|
1716
|
+
};
|
1717
|
+
MetricsCalculationService.prototype.buildMetricsCalculationMethods = function (metricKeys, initial) {
|
1718
|
+
var _this = this;
|
1719
|
+
return metricKeys.reduce(function (acc, name) {
|
1720
|
+
var _a, _b;
|
1721
|
+
if (acc[name]) {
|
1722
|
+
return acc;
|
1723
|
+
}
|
1724
|
+
acc = Object.assign(Object.assign({}, acc), (_a = {}, _a[name] = 'sum', _a));
|
1725
|
+
var settingKey = name.replace(/VDM_|Total_/g, '');
|
1726
|
+
if (_this.quoteMetricsSettings[settingKey]) {
|
1727
|
+
acc = Object.assign(Object.assign({}, acc), (_b = {}, _b[name] = _this.quoteMetricsSettings[settingKey], _b));
|
1728
|
+
}
|
1729
|
+
return acc;
|
1730
|
+
}, initial);
|
1731
|
+
};
|
1732
|
+
MetricsCalculationService.prototype.collectMetricKeys = function (lineItems) {
|
1733
|
+
var _this = this;
|
1734
|
+
var keys = [];
|
1735
|
+
lineItems.forEach(function (lineItem) {
|
1736
|
+
keys.push.apply(keys, __spreadArray([], __read(Object.keys(lineItem.totalMetrics || {}))));
|
1737
|
+
keys.push.apply(keys, __spreadArray([], __read(_this.collectMetricKeys(lineItem.lineItems))));
|
1738
|
+
});
|
1739
|
+
return lodash.uniq(keys);
|
1740
|
+
};
|
1741
|
+
return MetricsCalculationService;
|
1742
|
+
}());
|
1743
|
+
MetricsCalculationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: i1__namespace.ConfigurationSettingsApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1744
|
+
MetricsCalculationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MetricsCalculationService, providedIn: 'root' });
|
1745
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: MetricsCalculationService, decorators: [{
|
1746
|
+
type: i0.Injectable,
|
1747
|
+
args: [{ providedIn: 'root' }]
|
1748
|
+
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: i1__namespace.ConfigurationSettingsApiService }]; } });
|
1749
|
+
|
1750
|
+
var ProductImagesService = /** @class */ (function () {
|
1751
|
+
function ProductImagesService(productApiService) {
|
1752
|
+
this.productApiService = productApiService;
|
1753
|
+
this.imagesMap$ = new rxjs.BehaviorSubject({});
|
1754
|
+
}
|
1755
|
+
ProductImagesService.prototype.getImageUrl$ = function (productId) {
|
1756
|
+
var _a;
|
1757
|
+
if (this.imagesMap$.value[productId] == null) {
|
1758
|
+
this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), (_a = {}, _a[productId] = '', _a)));
|
1759
|
+
this.fetchProductImage(productId);
|
1760
|
+
}
|
1761
|
+
return this.imagesMap$.pipe(rxjs.map(function (imagesMap) { return imagesMap[productId]; }), rxjs.distinctUntilChanged());
|
1762
|
+
};
|
1763
|
+
ProductImagesService.prototype.fetchProductImage = function (productId) {
|
1764
|
+
var _this = this;
|
1765
|
+
this.productApiService
|
1766
|
+
.fetchImage$(productId)
|
1767
|
+
.pipe(rxjs.map(function (file) { return URL.createObjectURL(file); }), rxjs.catchError(function () { return rxjs.of(''); }), rxjs.tap(function (url) {
|
1768
|
+
var _a;
|
1769
|
+
return _this.imagesMap$.next(Object.assign(Object.assign({}, _this.imagesMap$.value), (_a = {}, _a[productId] = url, _a)));
|
1770
|
+
}))
|
1771
|
+
.subscribe();
|
1772
|
+
};
|
1773
|
+
return ProductImagesService;
|
1774
|
+
}());
|
1775
|
+
ProductImagesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductImagesService, deps: [{ token: i1__namespace.ProductApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
1776
|
+
ProductImagesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductImagesService, providedIn: 'root' });
|
1777
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ProductImagesService, decorators: [{
|
1778
|
+
type: i0.Injectable,
|
1779
|
+
args: [{ providedIn: 'root' }]
|
1780
|
+
}], ctorParameters: function () { return [{ type: i1__namespace.ProductApiService }]; } });
|
1781
|
+
|
1562
1782
|
var SdkCoreModule = /** @class */ (function () {
|
1563
1783
|
function SdkCoreModule() {
|
1564
1784
|
}
|
1565
1785
|
return SdkCoreModule;
|
1566
1786
|
}());
|
1567
|
-
SdkCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
1568
|
-
SdkCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
1569
|
-
SdkCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
1570
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
1787
|
+
SdkCoreModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
1788
|
+
SdkCoreModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
1789
|
+
SdkCoreModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService], imports: [[ConfigurationModule, FlowConfigurationModule]] });
|
1790
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: SdkCoreModule, decorators: [{
|
1571
1791
|
type: i0.NgModule,
|
1572
1792
|
args: [{
|
1573
1793
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
1574
|
-
providers: [ContextService, QuoteDraftService, ProductImagesService],
|
1794
|
+
providers: [ContextService, QuoteDraftService, ProductImagesService, MetricsCalculationService],
|
1575
1795
|
}]
|
1576
1796
|
}] });
|
1577
1797
|
|
@@ -1586,6 +1806,7 @@
|
|
1586
1806
|
exports.FlowConfigurationService = FlowConfigurationService;
|
1587
1807
|
exports.FlowUpdateService = FlowUpdateService;
|
1588
1808
|
exports.LineItemWorker = LineItemWorker;
|
1809
|
+
exports.MetricsCalculationService = MetricsCalculationService;
|
1589
1810
|
exports.ProductImagesService = ProductImagesService;
|
1590
1811
|
exports.QuoteDraftService = QuoteDraftService;
|
1591
1812
|
exports.SdkCoreModule = SdkCoreModule;
|
@@ -1599,6 +1820,7 @@
|
|
1599
1820
|
exports.insertLineItem = insertLineItem;
|
1600
1821
|
exports.lineItemUtils = lineItem_utils;
|
1601
1822
|
exports.mapAttributes = mapAttributes;
|
1823
|
+
exports.multiplyLineItems = multiplyLineItems;
|
1602
1824
|
exports.patchAttributes = patchAttributes;
|
1603
1825
|
exports.removeLineItem = removeLineItem;
|
1604
1826
|
exports.replaceLineItem = replaceLineItem;
|
@@ -1607,4 +1829,4 @@
|
|
1607
1829
|
Object.defineProperty(exports, '__esModule', { value: true });
|
1608
1830
|
|
1609
1831
|
}));
|
1610
|
-
//# sourceMappingURL=
|
1832
|
+
//# sourceMappingURL=veloceapps-sdk-core.umd.js.map
|