@veloceapps/sdk 11.0.0-5 → 11.0.0-51
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/cms/cms.actions.d.ts +92 -29
- package/cms/components/element-renderer/element-renderer.component.d.ts +3 -10
- package/cms/services/element-context.service.d.ts +0 -1
- package/cms/types/common.types.d.ts +2 -0
- package/cms/types/index.d.ts +0 -1
- package/cms/utils/path.utils.d.ts +1 -2
- package/cms/vendor-map.d.ts +17 -40
- package/core/index.d.ts +1 -1
- package/core/modules/configuration/index.d.ts +3 -4
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +8 -19
- package/core/modules/configuration/services/configuration-state.service.d.ts +8 -8
- package/core/modules/configuration/services/configuration.service.d.ts +23 -47
- package/core/modules/configuration/services/test-mode-configuration.service.d.ts +22 -0
- package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -5
- package/core/modules/configuration/types/configuration.types.d.ts +3 -0
- package/core/modules/configuration/types/index.d.ts +2 -0
- package/core/modules/flow-configuration/index.d.ts +0 -3
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +11 -40
- package/core/operators/filter-successful-execute.operator.d.ts +3 -0
- package/core/operators/index.d.ts +1 -0
- package/core/services/catalog-products.service.d.ts +11 -0
- package/core/services/flow-info.service.d.ts +28 -12
- package/core/services/flow-state-configuration.service.d.ts +2 -8
- package/core/services/flow-state.service.d.ts +13 -22
- package/core/services/index.d.ts +3 -3
- package/core/services/integration.state.d.ts +1 -1
- package/core/services/product-images.service.d.ts +3 -3
- package/core/services/runtime-settings.service.d.ts +1 -1
- package/core/services/sales-transaction.service.d.ts +29 -0
- package/core/types/flow-customization.types.d.ts +2 -2
- package/core/types/flow-state.types.d.ts +2 -2
- package/core/types/index.d.ts +0 -1
- package/core/utils/index.d.ts +2 -2
- package/core/utils/transaction-item.utils.d.ts +7 -0
- package/core/utils/transaction-item.worker.d.ts +8 -0
- package/esm2020/cms/cms.actions.mjs +93 -71
- package/esm2020/cms/cms.default.mjs +2 -3
- package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +7 -64
- package/esm2020/cms/components/preview/preview.component.mjs +3 -3
- package/esm2020/cms/services/element-context.service.mjs +1 -1
- package/esm2020/cms/types/common.types.mjs +1 -1
- package/esm2020/cms/types/index.mjs +1 -2
- package/esm2020/cms/utils/element.utils.mjs +3 -3
- package/esm2020/cms/utils/elements-resolver.mjs +16 -5
- package/esm2020/cms/utils/path.utils.mjs +1 -10
- package/esm2020/cms/vendor-map.mjs +17 -18
- package/esm2020/core/core.module.mjs +7 -7
- package/esm2020/core/index.mjs +2 -2
- package/esm2020/core/modules/configuration/configuration.module.mjs +14 -4
- package/esm2020/core/modules/configuration/index.mjs +4 -5
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +16 -101
- package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +61 -77
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +97 -223
- package/esm2020/core/modules/configuration/services/test-mode-configuration.service.mjs +62 -0
- package/esm2020/core/modules/configuration/types/configuration-runtime.types.mjs +1 -1
- package/esm2020/core/modules/configuration/types/configuration.types.mjs +1 -1
- package/esm2020/core/modules/configuration/types/index.mjs +3 -0
- package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +3 -4
- package/esm2020/core/modules/flow-configuration/index.mjs +1 -4
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +34 -127
- package/esm2020/core/operators/filter-successful-execute.operator.mjs +5 -0
- package/esm2020/core/operators/index.mjs +2 -0
- package/esm2020/core/services/catalog-products.service.mjs +25 -0
- package/esm2020/core/services/flow-info.service.mjs +102 -31
- package/esm2020/core/services/flow-state-configuration.service.mjs +10 -25
- package/esm2020/core/services/flow-state.service.mjs +60 -172
- package/esm2020/core/services/index.mjs +4 -4
- package/esm2020/core/services/integration.state.mjs +2 -2
- package/esm2020/core/services/product-images.service.mjs +8 -8
- package/esm2020/core/services/runtime-settings.service.mjs +3 -3
- package/esm2020/core/services/sales-transaction.service.mjs +65 -0
- package/esm2020/core/types/flow-customization.types.mjs +1 -1
- package/esm2020/core/types/flow-state.types.mjs +1 -1
- package/esm2020/core/types/index.mjs +1 -2
- package/esm2020/core/utils/index.mjs +3 -3
- package/esm2020/core/utils/transaction-item.utils.mjs +60 -0
- package/esm2020/core/utils/transaction-item.worker.mjs +16 -0
- package/esm2020/src/components/flow-header/flow-header.component.mjs +8 -12
- package/esm2020/src/components/guided-selling/guided-selling.component.mjs +8 -12
- package/esm2020/src/flow-routing.module.mjs +12 -41
- package/esm2020/src/flow.component.mjs +5 -5
- package/esm2020/src/guards/flow.guard.mjs +13 -14
- package/esm2020/src/guards/product-unload.guard.mjs +7 -9
- package/esm2020/src/index.mjs +1 -3
- package/esm2020/src/pages/assets/assets.component.mjs +8 -9
- package/esm2020/src/pages/catalog/catalog.component.mjs +8 -9
- package/esm2020/src/pages/debug/debug.component.mjs +14 -23
- package/esm2020/src/pages/product/product.component.mjs +12 -89
- package/esm2020/src/pages/product/product.module.mjs +5 -5
- package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +5 -6
- package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +8 -9
- package/esm2020/src/resolvers/flow.resolver.mjs +10 -18
- package/esm2020/src/resolvers/pcm-model.resolver.mjs +12 -0
- package/esm2020/src/resolvers/sales-transaction.resolver.mjs +64 -0
- package/esm2020/src/resolvers/ui-definition.resolver.mjs +42 -0
- package/esm2020/src/services/flow-dialog.service.mjs +8 -8
- package/esm2020/src/services/flow-router.service.mjs +16 -33
- package/esm2020/src/services/flow.service.mjs +13 -54
- package/esm2020/src/types/index.mjs +2 -3
- package/esm2020/src/types/route.types.mjs +1 -1
- package/fesm2015/veloceapps-sdk-cms.mjs +138 -275
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +800 -1643
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +188 -801
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +134 -267
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +859 -1738
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +188 -795
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/flow-header/flow-header.component.d.ts +3 -3
- package/src/components/guided-selling/guided-selling.component.d.ts +3 -3
- package/src/flow-routing.module.d.ts +1 -2
- package/src/flow.component.d.ts +2 -2
- package/src/guards/product-unload.guard.d.ts +5 -6
- package/src/index.d.ts +0 -2
- package/src/pages/assets/assets.component.d.ts +3 -3
- package/src/pages/catalog/catalog.component.d.ts +3 -3
- package/src/pages/debug/debug.component.d.ts +2 -5
- package/src/pages/product/product.component.d.ts +5 -14
- package/src/pages/product/product.module.d.ts +1 -1
- package/src/pages/record-not-found/record-not-found.component.d.ts +2 -3
- package/src/pages/shopping-cart/shopping-cart.component.d.ts +3 -3
- package/src/resolvers/flow.resolver.d.ts +5 -6
- package/src/resolvers/pcm-model.resolver.d.ts +3 -0
- package/src/resolvers/sales-transaction.resolver.d.ts +18 -0
- package/src/resolvers/ui-definition.resolver.d.ts +3 -0
- package/src/services/flow-dialog.service.d.ts +5 -4
- package/src/services/flow-router.service.d.ts +4 -6
- package/src/services/flow.service.d.ts +2 -7
- package/src/types/index.d.ts +1 -2
- package/src/types/route.types.d.ts +0 -5
- package/cms/plugins/configuration.plugin.d.ts +0 -23
- package/cms/types/configuration.types.d.ts +0 -21
- package/core/modules/configuration/helpers.d.ts +0 -6
- package/core/modules/configuration/services/runtime-context.service.d.ts +0 -12
- package/core/modules/flow-configuration/services/flow-update.service.d.ts +0 -13
- package/core/modules/flow-configuration/types/update.types.d.ts +0 -12
- package/core/services/context.service.d.ts +0 -23
- package/core/services/quote-draft.service.d.ts +0 -50
- package/core/types/runtime.types.d.ts +0 -30
- package/core/utils/line-item.utils.d.ts +0 -25
- package/core/utils/line-item.worker.d.ts +0 -9
- package/esm2020/cms/plugins/configuration.plugin.mjs +0 -109
- package/esm2020/cms/types/configuration.types.mjs +0 -2
- package/esm2020/core/modules/configuration/helpers.mjs +0 -73
- package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +0 -45
- package/esm2020/core/modules/flow-configuration/services/flow-update.service.mjs +0 -138
- package/esm2020/core/modules/flow-configuration/types/update.types.mjs +0 -2
- package/esm2020/core/services/context.service.mjs +0 -91
- package/esm2020/core/services/quote-draft.service.mjs +0 -192
- package/esm2020/core/types/runtime.types.mjs +0 -16
- package/esm2020/core/utils/line-item.utils.mjs +0 -187
- package/esm2020/core/utils/line-item.worker.mjs +0 -19
- package/esm2020/src/guards/context.guard.mjs +0 -91
- package/esm2020/src/guards/index.mjs +0 -2
- package/esm2020/src/pages/remote/remote.component.mjs +0 -342
- package/esm2020/src/pages/remote/remote.module.mjs +0 -20
- package/esm2020/src/pages/remote/remote.types.mjs +0 -2
- package/esm2020/src/resolvers/quote.resolver.mjs +0 -82
- package/esm2020/src/types/context-route.types.mjs +0 -2
- package/esm2020/src/types/metrics.types.mjs +0 -2
- package/esm2020/src/utils/flow.utils.mjs +0 -25
- package/esm2020/src/utils/index.mjs +0 -2
- package/src/guards/context.guard.d.ts +0 -19
- package/src/guards/index.d.ts +0 -1
- package/src/pages/remote/remote.component.d.ts +0 -46
- package/src/pages/remote/remote.module.d.ts +0 -10
- package/src/pages/remote/remote.types.d.ts +0 -4
- package/src/resolvers/quote.resolver.d.ts +0 -19
- package/src/types/context-route.types.d.ts +0 -5
- package/src/types/metrics.types.d.ts +0 -5
- package/src/utils/flow.utils.d.ts +0 -8
- package/src/utils/index.d.ts +0 -1
@@ -1,219 +1,334 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import
|
5
|
-
import { map, filter, tap, switchMap as switchMap$1, skip, take, shareReplay, catchError as catchError$1, finalize as finalize$1, first } from 'rxjs/operators';
|
6
|
-
import * as i1 from '@veloceapps/api';
|
2
|
+
import { Injectable, InjectionToken, Optional, Inject, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
|
3
|
+
import { isDefined, UUID, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMALS_COUNT, getSupportedDateFormats, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, DEFAULT_ACTION_CODE_LABELS, parseJsonSafely, UITemplateType, SalesforceIdUtils, ConfigurationProcessorTypes, EntityUtil, extractErrorDetails, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
|
4
|
+
import * as i3 from '@veloceapps/api';
|
7
5
|
import { ApiModule } from '@veloceapps/api';
|
8
|
-
import { merge, isEqual, cloneDeep, assign, flatten, entries, sortBy, map as map$2, omit, uniqBy, transform } from 'lodash';
|
9
6
|
import * as i6 from '@veloceapps/components';
|
10
|
-
import { ToastType,
|
11
|
-
import
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import
|
7
|
+
import { ToastType, ConfirmationDialogModule } from '@veloceapps/components';
|
8
|
+
import { tap, BehaviorSubject, map, filter, switchMap, of, forkJoin, throwError, noop, Subject, catchError, combineLatest, finalize, buffer, debounceTime, share, take, distinctUntilChanged, shareReplay, takeUntil, first } from 'rxjs';
|
9
|
+
import * as i1 from '@veloceapps/api/v2';
|
10
|
+
import { flatten, omit, uniqBy, cloneDeep, assign, isEqual } from 'lodash';
|
11
|
+
import { filter as filter$1, map as map$1, catchError as catchError$1, tap as tap$1, finalize as finalize$1 } from 'rxjs/operators';
|
12
|
+
import * as i2 from 'primeng/api';
|
15
13
|
import { NgControl } from '@angular/forms';
|
16
14
|
import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
|
17
15
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
class ConfigurationRuntimeService {
|
17
|
+
constructor(pcmApiService) {
|
18
|
+
this.pcmApiService = pcmApiService;
|
19
|
+
this.uiDefinitionContainer = null;
|
20
|
+
}
|
21
|
+
get uiDefinitionProps() {
|
22
|
+
var _a, _b;
|
23
|
+
return (_b = (_a = this.uiDefinitionContainer) === null || _a === void 0 ? void 0 : _a.source.properties) !== null && _b !== void 0 ? _b : {};
|
24
|
+
}
|
25
|
+
reset() {
|
26
|
+
this.uiDefinitionContainer = null;
|
27
|
+
this.initializationProps = undefined;
|
28
|
+
this.pcmModel = undefined;
|
29
|
+
}
|
30
|
+
init$(props) {
|
31
|
+
this.initializationProps = props;
|
32
|
+
return this.pcmApiService.fetchPCMByProductId(props.productId).pipe(tap(pcmModel => (this.pcmModel = pcmModel)));
|
33
|
+
}
|
34
|
+
}
|
35
|
+
ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, deps: [{ token: i1.PCMApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
36
|
+
ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService });
|
37
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
|
38
|
+
type: Injectable
|
39
|
+
}], ctorParameters: function () { return [{ type: i1.PCMApiService }]; } });
|
40
|
+
|
41
|
+
const findTransactionItem = (id, items) => {
|
42
|
+
return findTransactionItemWithComparator(items, (ti) => ti.id === id);
|
26
43
|
};
|
27
|
-
const
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
44
|
+
const findTransactionItemWithComparator = (items, comparator) => {
|
45
|
+
let currentLevel = items;
|
46
|
+
while (currentLevel.length) {
|
47
|
+
const found = currentLevel.find(comparator);
|
48
|
+
if (found) {
|
49
|
+
return found;
|
50
|
+
}
|
51
|
+
currentLevel = flatten(currentLevel.map(parent => parent.children));
|
52
|
+
}
|
53
|
+
return;
|
54
|
+
};
|
55
|
+
const insertTransactionItem = (item, parentId, toInsert) => {
|
56
|
+
const insertData = item.id === parentId ? [toInsert] : [];
|
57
|
+
return Object.assign(Object.assign({}, item), { children: [
|
58
|
+
...insertData,
|
59
|
+
...item.children.map(ti => {
|
60
|
+
return insertTransactionItem(ti, parentId, toInsert);
|
61
|
+
}),
|
62
|
+
] });
|
63
|
+
};
|
64
|
+
const removeTransactionItem = (item, idToRemove) => {
|
65
|
+
return Object.assign(Object.assign({}, item), { children: item.children
|
66
|
+
.map(ti => {
|
67
|
+
if (ti.id === idToRemove) {
|
68
|
+
return;
|
69
|
+
}
|
70
|
+
else if (ti.children.length) {
|
71
|
+
return removeTransactionItem(ti, idToRemove);
|
72
|
+
}
|
73
|
+
return ti;
|
74
|
+
})
|
75
|
+
.filter(isDefined) });
|
76
|
+
};
|
77
|
+
const replaceTransactionItem = (item, replaceTo) => {
|
78
|
+
if (item.id === replaceTo.id) {
|
79
|
+
return Object.assign({}, replaceTo);
|
80
|
+
}
|
81
|
+
return Object.assign(Object.assign({}, item), { children: item.children.map(ti => replaceTransactionItem(ti, replaceTo)) });
|
50
82
|
};
|
51
|
-
const
|
52
|
-
var _a, _b, _c;
|
53
|
-
const id = UUID.UUID();
|
54
|
-
const attributes = Object.entries((_a = props.attributesMap) !== null && _a !== void 0 ? _a : {}).map(([name, value]) => ({
|
55
|
-
name,
|
56
|
-
value,
|
57
|
-
cfgStatus: 'User',
|
58
|
-
}));
|
59
|
-
const lineItems = [];
|
83
|
+
const generateTransactionItem = (productId) => {
|
60
84
|
return {
|
61
|
-
id,
|
62
|
-
|
63
|
-
cfgStatus: 'Default',
|
64
|
-
actionCode: 'ADD',
|
65
|
-
qty,
|
66
|
-
attributes,
|
67
|
-
lineItems,
|
68
|
-
productName: props.product.name,
|
69
|
-
productId: (_c = props.product.id) !== null && _c !== void 0 ? _c : '',
|
85
|
+
id: UUID.UUID(),
|
86
|
+
productId,
|
70
87
|
};
|
71
88
|
};
|
72
89
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
var RuntimeMode;
|
78
|
-
(function (RuntimeMode) {
|
79
|
-
RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
|
80
|
-
RuntimeMode[RuntimeMode["PROD"] = 1] = "PROD";
|
81
|
-
})(RuntimeMode || (RuntimeMode = {}));
|
82
|
-
var RuntimeOperation;
|
83
|
-
(function (RuntimeOperation) {
|
84
|
-
RuntimeOperation["INIT"] = "INIT";
|
85
|
-
RuntimeOperation["UPDATE"] = "UPDATE";
|
86
|
-
})(RuntimeOperation || (RuntimeOperation = {}));
|
87
|
-
var RuntimeStep;
|
88
|
-
(function (RuntimeStep) {
|
89
|
-
RuntimeStep["START"] = "START";
|
90
|
-
RuntimeStep["UPDATE"] = "UPDATE";
|
91
|
-
})(RuntimeStep || (RuntimeStep = {}));
|
92
|
-
|
93
|
-
const UI_DEFINITION_VERSION = 3;
|
94
|
-
|
95
|
-
class ContextService {
|
96
|
-
constructor(contextApiService) {
|
97
|
-
this.contextApiService = contextApiService;
|
98
|
-
this.context = new BehaviorSubject(null);
|
90
|
+
class TransactionItemWorker {
|
91
|
+
constructor(src) {
|
92
|
+
this.ti = Object.assign({}, src);
|
99
93
|
}
|
100
|
-
|
101
|
-
return
|
94
|
+
insert(parentId, toInsert) {
|
95
|
+
return new TransactionItemWorker(insertTransactionItem(this.ti, parentId, toInsert));
|
102
96
|
}
|
103
|
-
|
104
|
-
return this.
|
97
|
+
remove(id) {
|
98
|
+
return new TransactionItemWorker(removeTransactionItem(this.ti, id));
|
105
99
|
}
|
106
|
-
|
107
|
-
return this.
|
100
|
+
replace(toReplace) {
|
101
|
+
return new TransactionItemWorker(replaceTransactionItem(this.ti, toReplace));
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
function extractMetadata(uiDefinition) {
|
106
|
+
return omit(uiDefinition, [
|
107
|
+
'children',
|
108
|
+
'pages',
|
109
|
+
'components',
|
110
|
+
]);
|
111
|
+
}
|
112
|
+
|
113
|
+
const FLOW_CUSTOMIZATION = new InjectionToken('FLOW_CUSTOMIZATION');
|
114
|
+
|
115
|
+
class RuntimeSettingsService {
|
116
|
+
constructor(configurationSettingsApiService) {
|
117
|
+
this.configurationSettingsApiService = configurationSettingsApiService;
|
118
|
+
this.configurationSettings$ = new BehaviorSubject({});
|
119
|
+
this.currencySettings$ = new BehaviorSubject({
|
120
|
+
iso: DEFAULT_CURRENCY_ISO_CODE,
|
121
|
+
symbol: DEFAULT_CURRENCY_SYMBOL,
|
122
|
+
});
|
123
|
+
this.shoppingCartSettings$ = new BehaviorSubject([]);
|
124
|
+
this.getCurrencySymbol = (locale, currency) => {
|
125
|
+
return (0)
|
126
|
+
.toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
|
127
|
+
.replace(/\d/g, '')
|
128
|
+
.trim();
|
129
|
+
};
|
108
130
|
}
|
109
|
-
|
110
|
-
return this.
|
131
|
+
create() {
|
132
|
+
return this.configurationSettingsApiService.fetchSettings().pipe(map(settings => this.parseConfigurationSettings(settings)), tap(configurationSettings => {
|
133
|
+
var _a;
|
134
|
+
this.configurationSettings$.next(configurationSettings);
|
135
|
+
this.addShoppingCartSettings((_a = configurationSettings['shopping-cart']) !== null && _a !== void 0 ? _a : []);
|
136
|
+
this.formattingSettings = this.getFormattingSettings();
|
137
|
+
}), map(() => undefined));
|
111
138
|
}
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
139
|
+
initCurrency(iso) {
|
140
|
+
if (iso) {
|
141
|
+
const symbol = this.getCurrencySymbol('en-US', iso);
|
142
|
+
this.currencySettings$.next({ iso, symbol });
|
143
|
+
if (this.formattingSettings) {
|
144
|
+
this.formattingSettings.currencySymbol = symbol;
|
145
|
+
}
|
119
146
|
}
|
120
|
-
return false;
|
121
147
|
}
|
122
|
-
|
123
|
-
|
124
|
-
|
148
|
+
getFormattingSettings() {
|
149
|
+
var _a, _b;
|
150
|
+
if (this.formattingSettings) {
|
151
|
+
return this.formattingSettings;
|
125
152
|
}
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
153
|
+
const shoppingCartSettings = (_a = this.getConfigurationSettings()['shopping-cart']) === null || _a === void 0 ? void 0 : _a.reduce((acc, setting) => {
|
154
|
+
return Object.assign(Object.assign({}, acc), { [setting.id]: setting.properties });
|
155
|
+
}, {});
|
156
|
+
const currencySettings = this.getCurrencySettings();
|
157
|
+
const dateFormat = (validateDateFormat((_b = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT) !== null && _b !== void 0 ? _b : '') && (shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT)) ||
|
158
|
+
DEFAULT_DATE_FORMAT;
|
159
|
+
const decimalSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DECIMAL_SEPARATOR;
|
160
|
+
const thousandsSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.THOUSANDS_SEPARATOR;
|
161
|
+
// the number of decimal places can be 0
|
162
|
+
const priceScale = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE;
|
163
|
+
const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
|
164
|
+
? Number(priceScale)
|
165
|
+
: DEFAULT_DECIMALS_COUNT;
|
166
|
+
const actionCodeSettings = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.STATUS_LABEL;
|
167
|
+
return {
|
168
|
+
currencySymbol: currencySettings.symbol,
|
169
|
+
dateFormats: getSupportedDateFormats(dateFormat),
|
170
|
+
decimalsCount,
|
171
|
+
decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
|
172
|
+
? decimalSeparator
|
173
|
+
: DEFAULT_DECIMAL_SEPARATOR,
|
174
|
+
// thousands separator can be a blank value, so it can also be null
|
175
|
+
thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
|
176
|
+
? thousandsSeparator || ''
|
177
|
+
: DEFAULT_THOUSANDS_SEPARATOR,
|
178
|
+
actionCodeLabels: (actionCodeSettings === null || actionCodeSettings === void 0 ? void 0 : actionCodeSettings.length)
|
179
|
+
? actionCodeSettings.reduce((result, setting) => (Object.assign(Object.assign({}, result), { [setting.status_label]: setting.custom_label })), {})
|
180
|
+
: DEFAULT_ACTION_CODE_LABELS,
|
181
|
+
};
|
130
182
|
}
|
131
|
-
|
132
|
-
return this.
|
183
|
+
getConfigurationSettings() {
|
184
|
+
return this.configurationSettings$.value;
|
133
185
|
}
|
134
|
-
|
135
|
-
return this.
|
136
|
-
return this.update({
|
137
|
-
properties: Object.assign(Object.assign({}, context.properties), { RuntimeMode: ConfigurationContextMode.TEST, StartDate: new Date().toISOString().substring(0, 10), standalone: 'true' }),
|
138
|
-
});
|
139
|
-
}));
|
186
|
+
getShoppingCartSettings() {
|
187
|
+
return this.shoppingCartSettings$.value;
|
140
188
|
}
|
141
|
-
|
142
|
-
|
143
|
-
const updatedContext = Object.assign(Object.assign(Object.assign({}, originalContext), partialContext), { properties: Object.assign(Object.assign({}, originalContext.properties), partialContext.properties) });
|
144
|
-
this.context.next(updatedContext);
|
145
|
-
return updatedContext;
|
189
|
+
getCurrencySettings() {
|
190
|
+
return this.currencySettings$.value;
|
146
191
|
}
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
192
|
+
parseConfigurationSettings(settings) {
|
193
|
+
return settings.reduce((acc, setting) => {
|
194
|
+
switch (setting.key) {
|
195
|
+
case 'shopping-cart':
|
196
|
+
acc['shopping-cart'] = parseJsonSafely(setting.value, []);
|
197
|
+
break;
|
198
|
+
case 'navigation':
|
199
|
+
acc.navigation = parseJsonSafely(setting.value, {});
|
200
|
+
break;
|
201
|
+
case 'flows':
|
202
|
+
acc.flows = parseJsonSafely(setting.value, []);
|
203
|
+
break;
|
204
|
+
default:
|
205
|
+
acc[setting.key] = setting.value;
|
206
|
+
}
|
207
|
+
return acc;
|
208
|
+
}, {});
|
152
209
|
}
|
153
|
-
|
154
|
-
|
210
|
+
addShoppingCartSettings(settings) {
|
211
|
+
// uniqBy removes items with the biggest index
|
212
|
+
const newSettings = uniqBy([...settings, ...this.shoppingCartSettings$.value], 'id');
|
213
|
+
this.shoppingCartSettings$.next(newSettings);
|
155
214
|
}
|
156
215
|
}
|
157
|
-
|
158
|
-
|
159
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
216
|
+
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
217
|
+
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService });
|
218
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, decorators: [{
|
160
219
|
type: Injectable
|
161
|
-
}], ctorParameters: function () { return [{ type: i1.
|
220
|
+
}], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
|
162
221
|
|
163
222
|
class FlowInfoService {
|
164
223
|
get flow() {
|
224
|
+
if (!this.flowSubj$.value) {
|
225
|
+
throw new Error(`Flow not initialized yet`);
|
226
|
+
}
|
165
227
|
return this.flowSubj$.value;
|
166
228
|
}
|
167
|
-
|
168
|
-
this.flowSubj$.
|
229
|
+
get isFlowInitialized() {
|
230
|
+
return Boolean(this.flowSubj$.value);
|
169
231
|
}
|
170
|
-
get
|
171
|
-
|
172
|
-
|
232
|
+
get context() {
|
233
|
+
if (!this.contextSubj$.value) {
|
234
|
+
throw new Error('Context is not initialized yet!');
|
235
|
+
}
|
236
|
+
return Object.assign({}, this.contextSubj$.value);
|
237
|
+
}
|
238
|
+
get context$() {
|
239
|
+
return this.contextSubj$.asObservable().pipe(filter(isDefined));
|
240
|
+
}
|
241
|
+
get templates() {
|
242
|
+
return this.templatesSubj$.value;
|
243
|
+
}
|
244
|
+
get isFlowEngineInitialized$() {
|
245
|
+
return this.templates$.pipe(map(v => Boolean(v.FLOW_ENGINE)));
|
173
246
|
}
|
174
247
|
get isStateful() {
|
175
248
|
var _a;
|
176
249
|
return !!((_a = this.flow) === null || _a === void 0 ? void 0 : _a.properties.stateful);
|
177
250
|
}
|
178
|
-
constructor(
|
179
|
-
this.
|
180
|
-
this.
|
251
|
+
constructor(runtimeSettingsService, templatesAdminApiService, customizationService) {
|
252
|
+
this.runtimeSettingsService = runtimeSettingsService;
|
253
|
+
this.templatesAdminApiService = templatesAdminApiService;
|
181
254
|
this.customizationService = customizationService;
|
182
|
-
this.templates = {};
|
183
255
|
this.defaultTemplates = {
|
184
256
|
flowEngine: 'Flow Engine',
|
185
257
|
};
|
186
258
|
this.flowSubj$ = new BehaviorSubject(null);
|
259
|
+
this.templatesSubj$ = new BehaviorSubject({});
|
260
|
+
this.contextSubj$ = new BehaviorSubject(null);
|
187
261
|
this.flow$ = this.flowSubj$.asObservable();
|
262
|
+
this.templates$ = this.templatesSubj$.asObservable();
|
263
|
+
}
|
264
|
+
reset() {
|
265
|
+
this.flowSubj$.next(null);
|
266
|
+
this.templatesSubj$.next({});
|
267
|
+
this.contextSubj$.next(null);
|
188
268
|
}
|
189
269
|
init$(flowId, routeQueryParams) {
|
190
|
-
return this.
|
191
|
-
this.params = Object.assign(Object.assign({}, routeQueryParams), flow.properties.queryParams);
|
192
|
-
this.flowSubj$.next(flow);
|
193
|
-
}), map$1(noop), catchError(e => {
|
194
|
-
this.flowSubj$.next(null);
|
195
|
-
return throwError(() => e);
|
196
|
-
}));
|
270
|
+
return this.initFlow$(flowId, routeQueryParams).pipe(switchMap(() => this.initFlowTemplates$()));
|
197
271
|
}
|
198
|
-
|
199
|
-
this.
|
200
|
-
|
201
|
-
|
272
|
+
initTestFlow$(productId) {
|
273
|
+
this.contextSubj$.next({
|
274
|
+
mode: 'QUOTE',
|
275
|
+
headerId: '0Q0-test-quote-id',
|
276
|
+
productId,
|
277
|
+
});
|
278
|
+
this.flowSubj$.next({
|
279
|
+
id: 'preview-flow-id',
|
280
|
+
properties: {
|
281
|
+
entryPath: '/product',
|
282
|
+
queryParams: {},
|
283
|
+
transformOrchestration: '',
|
284
|
+
contextDefinition: '',
|
285
|
+
queryOrchestration: '',
|
286
|
+
saveOrchestration: '',
|
287
|
+
},
|
288
|
+
version: 2,
|
289
|
+
});
|
290
|
+
return of(undefined);
|
202
291
|
}
|
203
|
-
|
292
|
+
updateContext(update) {
|
293
|
+
this.contextSubj$.next(Object.assign(Object.assign({}, this.context), update));
|
294
|
+
}
|
295
|
+
initFlow$(flowId, routeQueryParams) {
|
296
|
+
var _a;
|
297
|
+
const flow = (_a = this.runtimeSettingsService.getConfigurationSettings()['flows']) === null || _a === void 0 ? void 0 : _a.find(({ id }) => flowId === id);
|
298
|
+
if (!flow) {
|
299
|
+
this.flowSubj$.next(null);
|
300
|
+
throw new Error(`Flow with flowId=${flowId} is not defined`);
|
301
|
+
}
|
302
|
+
const headerId = routeQueryParams['headerId'];
|
303
|
+
if (typeof headerId !== 'string') {
|
304
|
+
throw new Error(`Please provide 'headerId'`);
|
305
|
+
}
|
306
|
+
const mode = this.getFlowContextMode(headerId);
|
307
|
+
// Restrict if mode is not defined
|
308
|
+
if (mode == null) {
|
309
|
+
throw new Error('Mode is undefined');
|
310
|
+
}
|
311
|
+
this.contextSubj$.next(Object.assign(Object.assign(Object.assign({}, flow.properties.queryParams), routeQueryParams), { mode }));
|
312
|
+
this.flowSubj$.next(flow);
|
313
|
+
return of(undefined);
|
314
|
+
}
|
315
|
+
initFlowTemplates$() {
|
204
316
|
var _a, _b, _c;
|
205
317
|
return forkJoin([
|
206
|
-
this.
|
318
|
+
this.templatesAdminApiService.fetchTemplates$(),
|
207
319
|
(_c = (_b = (_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplates) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : of([]),
|
208
|
-
]).pipe(map
|
209
|
-
|
320
|
+
]).pipe(map(([templates, localTemplates]) => {
|
321
|
+
var _a, _b;
|
322
|
+
const newValue = {};
|
323
|
+
Object.entries(Object.assign(Object.assign({}, this.defaultTemplates), ((_b = (_a = this.flow) === null || _a === void 0 ? void 0 : _a.properties.templates) !== null && _b !== void 0 ? _b : {}))).forEach(([key, name]) => {
|
210
324
|
var _a;
|
211
325
|
const type = this.remapTemplateName(key);
|
212
326
|
if (type) {
|
213
|
-
|
327
|
+
newValue[type] =
|
214
328
|
(_a = localTemplates.find(template => template.name === name && template.type === type)) !== null && _a !== void 0 ? _a : templates.find(template => template.name === name && template.type === type);
|
215
329
|
}
|
216
330
|
});
|
331
|
+
this.templatesSubj$.next(newValue);
|
217
332
|
}));
|
218
333
|
}
|
219
334
|
remapTemplateName(templateType) {
|
@@ -239,13 +354,20 @@ class FlowInfoService {
|
|
239
354
|
}
|
240
355
|
return undefined;
|
241
356
|
}
|
357
|
+
getFlowContextMode(headerId) {
|
358
|
+
const objectName = SalesforceIdUtils.getSfObjectNameById(headerId);
|
359
|
+
if (!objectName) {
|
360
|
+
return;
|
361
|
+
}
|
362
|
+
return objectName.toUpperCase();
|
363
|
+
}
|
242
364
|
}
|
243
|
-
FlowInfoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, deps: [{ token:
|
365
|
+
FlowInfoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, deps: [{ token: RuntimeSettingsService }, { token: i1.UITemplatesAdminApiService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
244
366
|
FlowInfoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService });
|
245
367
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, decorators: [{
|
246
368
|
type: Injectable
|
247
369
|
}], ctorParameters: function () {
|
248
|
-
return [{ type:
|
370
|
+
return [{ type: RuntimeSettingsService }, { type: i1.UITemplatesAdminApiService }, { type: undefined, decorators: [{
|
249
371
|
type: Optional
|
250
372
|
}, {
|
251
373
|
type: Inject,
|
@@ -253,186 +375,192 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
253
375
|
}] }];
|
254
376
|
} });
|
255
377
|
|
256
|
-
class
|
378
|
+
class TestModeConfigurationService {
|
379
|
+
constructor(flowInfoService, configurationService, configurationRuntimeService, salesTransactionService) {
|
380
|
+
this.flowInfoService = flowInfoService;
|
381
|
+
this.configurationService = configurationService;
|
382
|
+
this.configurationRuntimeService = configurationRuntimeService;
|
383
|
+
this.salesTransactionService = salesTransactionService;
|
384
|
+
this.isInitialized = false;
|
385
|
+
}
|
386
|
+
initTestMode$(uiDefinitionContainer, options) {
|
387
|
+
var _a;
|
388
|
+
this.configurationRuntimeService.uiDefinitionContainer = uiDefinitionContainer;
|
389
|
+
if (this.checkInitialized(uiDefinitionContainer)) {
|
390
|
+
this.configurationRuntimeService.pcmModel = this.pcmModel;
|
391
|
+
return of(undefined);
|
392
|
+
}
|
393
|
+
this.configurationService.reset();
|
394
|
+
const { productId, quoteId } = (_a = uiDefinitionContainer.source.properties) !== null && _a !== void 0 ? _a : {};
|
395
|
+
if (!productId) {
|
396
|
+
return throwError(() => 'Unable to start the Configuration Preview: Product is missing.');
|
397
|
+
}
|
398
|
+
if (!quoteId) {
|
399
|
+
return throwError(() => `Unable to start the Configuration Preview: Quote is missing.`);
|
400
|
+
}
|
401
|
+
return this.flowInfoService.initTestFlow$(productId).pipe(switchMap(() => this.configurationRuntimeService.init$({ productId })), tap(pcmModel => (this.pcmModel = pcmModel)), switchMap(() => {
|
402
|
+
if (options === null || options === void 0 ? void 0 : options.customizationMode) {
|
403
|
+
return of(undefined);
|
404
|
+
}
|
405
|
+
return this.initConfiguration$(quoteId);
|
406
|
+
}), tap(() => (this.isInitialized = true)), map(noop));
|
407
|
+
}
|
408
|
+
initConfiguration$(quoteId) {
|
409
|
+
this.salesTransactionService.setState(this.getTestSalesTransaction(quoteId));
|
410
|
+
return this.configurationService.init$().pipe(switchMap(() => this.configurationService.state
|
411
|
+
? this.configurationService.configureRequest$(this.configurationService.state)
|
412
|
+
: of(undefined)), map(noop));
|
413
|
+
}
|
414
|
+
getTestSalesTransaction(quoteId) {
|
415
|
+
const testTransaction = {
|
416
|
+
id: quoteId,
|
417
|
+
businessObjectType: 'Quote',
|
418
|
+
salesTransactionItems: [],
|
419
|
+
};
|
420
|
+
return testTransaction;
|
421
|
+
}
|
422
|
+
checkInitialized(uiDefinitionContainer) {
|
423
|
+
var _a;
|
424
|
+
return this.isInitialized && !!((_a = uiDefinitionContainer.source.properties) === null || _a === void 0 ? void 0 : _a.persistTestState);
|
425
|
+
}
|
426
|
+
}
|
427
|
+
TestModeConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TestModeConfigurationService, deps: [{ token: FlowInfoService }, { token: ConfigurationService }, { token: ConfigurationRuntimeService }, { token: SalesTransactionService }], target: i0.ɵɵFactoryTarget.Injectable });
|
428
|
+
TestModeConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TestModeConfigurationService });
|
429
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: TestModeConfigurationService, decorators: [{
|
430
|
+
type: Injectable
|
431
|
+
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: ConfigurationService }, { type: ConfigurationRuntimeService }, { type: SalesTransactionService }]; } });
|
432
|
+
|
433
|
+
class SalesTransactionService {
|
257
434
|
get isInitialized$() {
|
258
435
|
return this.isInitializedSubj$.asObservable();
|
259
436
|
}
|
260
437
|
get isInitialized() {
|
261
438
|
return this.isInitializedSubj$.getValue();
|
262
439
|
}
|
263
|
-
set isInitialized(value) {
|
264
|
-
if (this.isInitialized !== value) {
|
265
|
-
this.isInitializedSubj$.next(value);
|
266
|
-
}
|
267
|
-
}
|
268
|
-
get hasUnsavedChanges() {
|
269
|
-
return this._hasUnsavedChanges;
|
270
|
-
}
|
271
440
|
set hasUnsavedChanges(value) {
|
272
441
|
var _a, _b;
|
273
|
-
this.
|
274
|
-
if (!this.
|
275
|
-
this.
|
442
|
+
this.hasUnsavedChangesSubj$.next(value);
|
443
|
+
if (!this.hasUnsavedChanges) {
|
444
|
+
this.initialState = (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.salesTransactionItems) !== null && _b !== void 0 ? _b : [];
|
276
445
|
}
|
277
446
|
}
|
278
|
-
get
|
279
|
-
return this.
|
280
|
-
}
|
281
|
-
get hasProducts() {
|
282
|
-
var _a;
|
283
|
-
return Boolean((_a = this.quoteSubj$.value) === null || _a === void 0 ? void 0 : _a.currentState.length);
|
447
|
+
get hasUnsavedChanges() {
|
448
|
+
return this.hasUnsavedChangesSubj$.getValue();
|
284
449
|
}
|
285
|
-
get
|
286
|
-
return this.
|
450
|
+
get state() {
|
451
|
+
return this.stateSubj$.getValue();
|
287
452
|
}
|
288
|
-
get
|
453
|
+
get hasProducts() {
|
289
454
|
var _a;
|
290
|
-
return Boolean((_a = this.
|
291
|
-
}
|
292
|
-
get assetsState() {
|
293
|
-
return this.assetsSubj$.value;
|
455
|
+
return Boolean((_a = this.state) === null || _a === void 0 ? void 0 : _a.salesTransactionItems.length);
|
294
456
|
}
|
295
|
-
constructor(
|
296
|
-
this.context = context;
|
457
|
+
constructor(flowInfoService, salesTransactionApiService) {
|
297
458
|
this.flowInfoService = flowInfoService;
|
298
|
-
this.
|
299
|
-
this.
|
300
|
-
this.quoteSubj$ = new BehaviorSubject(null);
|
301
|
-
this.assetsSubj$ = new BehaviorSubject(null);
|
302
|
-
this.resetSubj$ = new BehaviorSubject(true);
|
459
|
+
this.salesTransactionApiService = salesTransactionApiService;
|
460
|
+
this.stateSubj$ = new BehaviorSubject(null);
|
303
461
|
this.isInitializedSubj$ = new BehaviorSubject(false);
|
304
|
-
this.
|
305
|
-
this.
|
306
|
-
this.
|
307
|
-
this.
|
308
|
-
.pipe(filter(isInitialized => isInitialized), switchMap$1(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
|
309
|
-
.subscribe();
|
310
|
-
}
|
311
|
-
reset() {
|
312
|
-
this.resetSubj$.next(true);
|
313
|
-
this.quoteSubj$.next(null);
|
314
|
-
this.assetsSubj$.next(null);
|
315
|
-
this.isInitialized = false;
|
316
|
-
this.hasUnsavedChanges = false;
|
462
|
+
this.hasUnsavedChangesSubj$ = new BehaviorSubject(false);
|
463
|
+
this.initialState = [];
|
464
|
+
this.hasUnsavedChanges$ = this.hasUnsavedChangesSubj$.asObservable();
|
465
|
+
this.state$ = this.stateSubj$.asObservable().pipe(filter(isDefined));
|
317
466
|
}
|
318
467
|
init(headerId, params) {
|
319
|
-
|
320
|
-
const isAccountMode = this.context.mode === ConfigurationContextMode.ACCOUNT;
|
321
|
-
const accountId = isAccountMode ? headerId : ctx.properties.AccountId;
|
322
|
-
return zip(accountId ? this.accountApiService.getAssetsState(accountId, params) : of(null), isAccountMode
|
323
|
-
? of(QuoteDraft.emptyQuote(ConfigurationContextMode.ACCOUNT))
|
324
|
-
: this.quoteApiService.getQuoteState(headerId, params)).pipe(tap(([assets, quote]) => {
|
325
|
-
if (assets) {
|
326
|
-
this.assetsSubj$.next(assets);
|
327
|
-
}
|
328
|
-
this.quoteSubj$.next(quote);
|
329
|
-
if (assets && isAccountMode) {
|
330
|
-
this.context.update(assets.context);
|
331
|
-
}
|
332
|
-
else {
|
333
|
-
this.context.update(quote.context);
|
334
|
-
}
|
335
|
-
}), map(() => noop()), take(1));
|
468
|
+
return this.salesTransactionApiService.getState(headerId, params).pipe(tap(res => this.stateSubj$.next(res.salesTransaction)), map(res => res.salesTransaction));
|
336
469
|
}
|
337
470
|
finalizeInit() {
|
338
|
-
this.
|
471
|
+
this.isInitializedSubj$.next(true);
|
339
472
|
this.hasUnsavedChanges = false;
|
340
473
|
}
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
}
|
346
|
-
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
|
474
|
+
reset() {
|
475
|
+
this.stateSubj$.next(null);
|
476
|
+
this.isInitializedSubj$.next(false);
|
477
|
+
this.hasUnsavedChangesSubj$.next(false);
|
347
478
|
}
|
348
|
-
|
349
|
-
|
350
|
-
if (!quoteDraft) {
|
351
|
-
return;
|
352
|
-
}
|
353
|
-
if (update.context) {
|
354
|
-
this.context.set(update.context);
|
355
|
-
}
|
356
|
-
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
|
479
|
+
getInitialState() {
|
480
|
+
return this.initialState;
|
357
481
|
}
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
});
|
367
|
-
|
482
|
+
setState(state) {
|
483
|
+
this.stateSubj$.next(state);
|
484
|
+
}
|
485
|
+
}
|
486
|
+
SalesTransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionService, deps: [{ token: FlowInfoService }, { token: i1.SalesTransactionApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
487
|
+
SalesTransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionService });
|
488
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionService, decorators: [{
|
489
|
+
type: Injectable
|
490
|
+
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: i1.SalesTransactionApiService }]; } });
|
491
|
+
|
492
|
+
class FlowConfigurationService {
|
493
|
+
constructor(orchestrationsApiService, salesTransactionService) {
|
494
|
+
this.orchestrationsApiService = orchestrationsApiService;
|
495
|
+
this.salesTransactionService = salesTransactionService;
|
496
|
+
this.updatedSubj$ = new Subject();
|
497
|
+
this.updated$ = this.updatedSubj$.asObservable();
|
368
498
|
}
|
369
|
-
|
370
|
-
this.
|
499
|
+
calculate$(state) {
|
500
|
+
return this.orchestrationsApiService.apply$({ salesTransaction: state }).pipe(tap(result => this.salesTransactionService.setState(result.salesTransaction)), map(noop));
|
371
501
|
}
|
372
|
-
|
373
|
-
|
502
|
+
calculate(state) {
|
503
|
+
this.calculate$(state).subscribe();
|
374
504
|
}
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
505
|
+
revert$(transactionItemId) {
|
506
|
+
var _a;
|
507
|
+
const state = this.salesTransactionService.state;
|
508
|
+
const initialState = this.salesTransactionService.getInitialState();
|
509
|
+
const currentState = (_a = state === null || state === void 0 ? void 0 : state.salesTransactionItems) !== null && _a !== void 0 ? _a : [];
|
510
|
+
const currentItemIndex = currentState.findIndex(({ id }) => id === transactionItemId);
|
511
|
+
const currentItem = currentState[currentItemIndex];
|
512
|
+
const initialItem = initialState.find(({ integrationId }) => integrationId === (currentItem === null || currentItem === void 0 ? void 0 : currentItem.integrationId));
|
513
|
+
if (!state || !currentItem || !initialItem) {
|
514
|
+
return of(null);
|
379
515
|
}
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
516
|
+
const updatedState = cloneDeep(currentState);
|
517
|
+
updatedState.splice(currentItemIndex, 1, initialItem);
|
518
|
+
return of([]).pipe(tap(() => {
|
519
|
+
this.salesTransactionService.setState(Object.assign(Object.assign({}, state), { salesTransactionItems: updatedState }));
|
520
|
+
}), switchMap(() => this.calculate$(Object.assign(Object.assign({}, state), { salesTransactionItems: updatedState }))), map(() => this.salesTransactionService.state), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
|
384
521
|
}
|
385
|
-
|
386
|
-
|
387
|
-
return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
522
|
+
revert(transactionItemId) {
|
523
|
+
this.revert$(transactionItemId).subscribe();
|
388
524
|
}
|
389
|
-
|
390
|
-
|
391
|
-
|
525
|
+
delete$(ids) {
|
526
|
+
const state = this.salesTransactionService.state;
|
527
|
+
if (!state) {
|
528
|
+
return of(null);
|
529
|
+
}
|
530
|
+
return of([]).pipe(map(() => state.salesTransactionItems.filter(({ id }) => !ids.includes(id))), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, state), { salesTransactionItems: updatedState }))), map(() => this.salesTransactionService.state), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
|
392
531
|
}
|
393
|
-
|
394
|
-
|
532
|
+
delete(ids) {
|
533
|
+
this.delete$(ids).subscribe();
|
395
534
|
}
|
396
|
-
|
397
|
-
return
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
}
|
410
|
-
return false;
|
411
|
-
}
|
412
|
-
markAsUpdated(quote) {
|
413
|
-
if ((quote === null || quote === void 0 ? void 0 : quote.context.properties['#mode']) === ConfigurationContextMode.ACCOUNT) {
|
414
|
-
this.hasUnsavedChanges = !!quote && !quote.currentState.every(li => li.actionCode === 'EXIST');
|
415
|
-
}
|
416
|
-
else {
|
417
|
-
this.hasUnsavedChanges = !isEqual(this.initialCurrentState, quote === null || quote === void 0 ? void 0 : quote.currentState);
|
418
|
-
}
|
535
|
+
handleErrorAndBounceBack() {
|
536
|
+
return (source$) => {
|
537
|
+
return source$.pipe(catchError(error => {
|
538
|
+
console.error(error);
|
539
|
+
// bounce back if configuration call has failed
|
540
|
+
const state = this.salesTransactionService.state;
|
541
|
+
if (state) {
|
542
|
+
this.salesTransactionService.setState(state);
|
543
|
+
this.updatedSubj$.next();
|
544
|
+
}
|
545
|
+
return throwError(() => error);
|
546
|
+
}));
|
547
|
+
};
|
419
548
|
}
|
420
549
|
}
|
421
|
-
|
422
|
-
|
423
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
550
|
+
FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.OrchestrationsApiService }, { token: SalesTransactionService }], target: i0.ɵɵFactoryTarget.Injectable });
|
551
|
+
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService });
|
552
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
|
424
553
|
type: Injectable
|
425
|
-
}], ctorParameters: function () { return [{ type:
|
554
|
+
}], ctorParameters: function () { return [{ type: i1.OrchestrationsApiService }, { type: SalesTransactionService }]; } });
|
426
555
|
|
427
556
|
class FlowStateService {
|
428
|
-
constructor(
|
429
|
-
this.contextService = contextService;
|
430
|
-
this.quoteDraftService = quoteDraftService;
|
431
|
-
this.flowInfoService = flowInfoService;
|
557
|
+
constructor(flowConfiguration, flowInfoService, flowStateApiService, processorsApiService, salesTransactionApiService, salesTransactionService, toastService, customizationService) {
|
432
558
|
this.flowConfiguration = flowConfiguration;
|
433
|
-
this.
|
559
|
+
this.flowInfoService = flowInfoService;
|
434
560
|
this.flowStateApiService = flowStateApiService;
|
435
|
-
this.
|
561
|
+
this.processorsApiService = processorsApiService;
|
562
|
+
this.salesTransactionApiService = salesTransactionApiService;
|
563
|
+
this.salesTransactionService = salesTransactionService;
|
436
564
|
this.toastService = toastService;
|
437
565
|
this.customizationService = customizationService;
|
438
566
|
this.NOT_INITIALIZED = Symbol();
|
@@ -449,68 +577,22 @@ class FlowStateService {
|
|
449
577
|
this.cleanup$ = new Subject();
|
450
578
|
this.statefulExecutionRequest$ = this.initBufferedRequest$();
|
451
579
|
/*
|
452
|
-
In stateless mode watch
|
453
|
-
all subscriptions get their updates according to updated
|
580
|
+
In stateless mode watch State changes and call executeRequest so that
|
581
|
+
all subscriptions get their updates according to updated State
|
454
582
|
*/
|
455
583
|
this.isInitialized$()
|
456
|
-
.pipe(filter
|
584
|
+
.pipe(filter(Boolean), filter(() => !this.flowInfoService.flow.properties.stateful), switchMap(() => this.flowConfiguration.updated$), switchMap(() => this.executeRequest$({}, true)))
|
457
585
|
.subscribe();
|
458
|
-
this.charges$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
|
459
|
-
if (this.flowInfoService.isLegacy) {
|
460
|
-
return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.charges));
|
461
|
-
}
|
462
|
-
else {
|
463
|
-
return this.subscribe$(UITemplateType.FLOW_ENGINE, 'CHARGES', null, {
|
464
|
-
cold: true,
|
465
|
-
}).pipe(map$1(response => (response.success ? response.result : {})));
|
466
|
-
}
|
467
|
-
}), shareReplay$1(1));
|
468
|
-
this.charges$.subscribe();
|
469
|
-
this.pricePlans$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
|
470
|
-
if (this.flowInfoService.isLegacy) {
|
471
|
-
return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.pricePlans));
|
472
|
-
}
|
473
|
-
else {
|
474
|
-
return this.subscribe$(UITemplateType.FLOW_ENGINE, 'PRICE_PLANS', null, {
|
475
|
-
cold: true,
|
476
|
-
}).pipe(map$1(response => (response.success ? response.result : {})));
|
477
|
-
}
|
478
|
-
}), shareReplay$1(1));
|
479
|
-
this.pricePlans$.subscribe();
|
480
|
-
this.activeMetrics$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
|
481
|
-
if (this.flowInfoService.isLegacy) {
|
482
|
-
return this.quoteDraftService.quoteDraft$.pipe(map$1(quoteDraft => quoteDraft.activeMetrics));
|
483
|
-
}
|
484
|
-
else {
|
485
|
-
return this.subscribe$(UITemplateType.FLOW_ENGINE, 'ACTIVE_METRICS', null, {
|
486
|
-
cold: true,
|
487
|
-
}).pipe(map$1(response => (response.success ? response.result : [])));
|
488
|
-
}
|
489
|
-
}), shareReplay$1(1));
|
490
|
-
this.activeMetrics$.subscribe();
|
491
|
-
this.isPriceListLocked$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(() => {
|
492
|
-
if (this.flowInfoService.isLegacy) {
|
493
|
-
return of(false);
|
494
|
-
}
|
495
|
-
else {
|
496
|
-
return this.subscribe$(UITemplateType.FLOW_ENGINE, 'IS_PRICE_LIST_LOCKED', null, {
|
497
|
-
cold: true,
|
498
|
-
}).pipe(map$1(response => (response.success ? response.result : false)));
|
499
|
-
}
|
500
|
-
}), shareReplay$1(1));
|
501
|
-
this.isPriceListLocked$.subscribe();
|
502
586
|
}
|
503
587
|
init$() {
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
}
|
511
|
-
}));
|
588
|
+
if (this.flowInfoService.flow.properties.stateful) {
|
589
|
+
return this.initProcessors$().pipe(switchMap(() => this.initStateful$()));
|
590
|
+
}
|
591
|
+
else {
|
592
|
+
return forkJoin([this.initStateless$(), this.initProcessors$()]).pipe(map(noop));
|
593
|
+
}
|
512
594
|
}
|
513
|
-
|
595
|
+
reset() {
|
514
596
|
Object.values(this.subscriptions).forEach(({ data$ }) => data$.complete());
|
515
597
|
this.subscriptions = {};
|
516
598
|
if (this.stateId$.value) {
|
@@ -522,9 +604,9 @@ class FlowStateService {
|
|
522
604
|
this.cleanup$.next();
|
523
605
|
}
|
524
606
|
get hasUnsavedChanges() {
|
525
|
-
return this.
|
607
|
+
return this.flowInfoService.flow.properties.stateful
|
526
608
|
? Array.from(this.trackedStatefulChangesMap.values()).some(Boolean)
|
527
|
-
: this.
|
609
|
+
: this.salesTransactionService.hasUnsavedChanges;
|
528
610
|
}
|
529
611
|
get stateId() {
|
530
612
|
return this.stateId$.value;
|
@@ -533,14 +615,14 @@ class FlowStateService {
|
|
533
615
|
return this.executionInProgress$.asObservable();
|
534
616
|
}
|
535
617
|
isInitialized$() {
|
536
|
-
return combineLatest([this.stateId$, this.
|
618
|
+
return combineLatest([this.stateId$, this.salesTransactionService.isInitialized$]).pipe(map(values => values.some(Boolean)));
|
537
619
|
}
|
538
620
|
isInitialized() {
|
539
|
-
return Boolean(this.stateId$.value) || this.
|
621
|
+
return Boolean(this.stateId$.value) || this.salesTransactionService.isInitialized;
|
540
622
|
}
|
541
623
|
execute$(scope, exec) {
|
542
624
|
const request = this.execToRequest(scope, exec);
|
543
|
-
return this.executeRequest$(request).pipe(map
|
625
|
+
return this.executeRequest$(request).pipe(map(result => {
|
544
626
|
// Keep only requested results
|
545
627
|
const actualSelectors = Object.entries(result.selectors).reduce((trunk, [requestId, result]) => {
|
546
628
|
var _a;
|
@@ -557,7 +639,7 @@ class FlowStateService {
|
|
557
639
|
actions: [{ name: action, inputData }],
|
558
640
|
};
|
559
641
|
const request = this.execToRequest(scope, exec);
|
560
|
-
return this.executeRequest$(request).pipe(map
|
642
|
+
return this.executeRequest$(request).pipe(map(noop));
|
561
643
|
}
|
562
644
|
select$(scope, selectorName, inputData) {
|
563
645
|
const requestId = this.generateRequestId(scope, selectorName, inputData);
|
@@ -569,7 +651,7 @@ class FlowStateService {
|
|
569
651
|
},
|
570
652
|
},
|
571
653
|
});
|
572
|
-
return this.executeRequest$(request).pipe(map
|
654
|
+
return this.executeRequest$(request).pipe(map(response => response.selectors[requestId]));
|
573
655
|
}
|
574
656
|
subscribe$(scope, selectorName, inputData, options) {
|
575
657
|
const requestId = this.generateRequestId(scope, selectorName, inputData);
|
@@ -595,7 +677,7 @@ class FlowStateService {
|
|
595
677
|
this.executeRequest$(request).subscribe();
|
596
678
|
}
|
597
679
|
}
|
598
|
-
return subscription.data$.pipe(filter
|
680
|
+
return subscription.data$.pipe(filter(data => data != this.NOT_INITIALIZED), map(data => data), finalize(() => {
|
599
681
|
var _a;
|
600
682
|
if (!((_a = this.subscriptions[requestId]) === null || _a === void 0 ? void 0 : _a.data$.observed)) {
|
601
683
|
delete this.subscriptions[requestId];
|
@@ -603,9 +685,9 @@ class FlowStateService {
|
|
603
685
|
}));
|
604
686
|
}
|
605
687
|
save$() {
|
606
|
-
if (this.
|
688
|
+
if (this.flowInfoService.flow.properties.stateful) {
|
607
689
|
if (this.stateId$.value) {
|
608
|
-
return this.flowStateApiService.save(this.stateId$.value).pipe(tap
|
690
|
+
return this.flowStateApiService.save(this.stateId$.value).pipe(map(({ quoteId }) => ({ id: quoteId })), tap(() => {
|
609
691
|
Array.from(this.trackedStatefulChangesMap.keys()).forEach(key => {
|
610
692
|
this.trackedStatefulChangesMap.set(key, false);
|
611
693
|
});
|
@@ -613,30 +695,26 @@ class FlowStateService {
|
|
613
695
|
}
|
614
696
|
}
|
615
697
|
else {
|
616
|
-
const
|
617
|
-
if (
|
618
|
-
return this.
|
619
|
-
this.contextService.update({ properties: { VELOCE_PRISM__VersionId__c: versionId } });
|
620
|
-
}));
|
698
|
+
const state = this.salesTransactionService.state;
|
699
|
+
if (state) {
|
700
|
+
return this.salesTransactionApiService.upsert(state);
|
621
701
|
}
|
622
702
|
}
|
623
|
-
return of({
|
703
|
+
return of({ id: '' });
|
624
704
|
}
|
625
705
|
submit$() {
|
626
|
-
if (this.
|
706
|
+
if (this.flowInfoService.flow.properties.stateful) {
|
627
707
|
if (this.stateId$.value) {
|
628
|
-
return this.flowStateApiService.submit(this.stateId$.value);
|
708
|
+
return this.flowStateApiService.submit(this.stateId$.value).pipe(map(({ quoteId }) => ({ id: quoteId })));
|
629
709
|
}
|
630
710
|
}
|
631
711
|
else {
|
632
|
-
const
|
633
|
-
if (
|
634
|
-
return this.
|
635
|
-
this.contextService.update({ properties: { VELOCE_PRISM__VersionId__c: versionId } });
|
636
|
-
}));
|
712
|
+
const state = this.salesTransactionService.state;
|
713
|
+
if (state) {
|
714
|
+
return this.salesTransactionApiService.submit(state);
|
637
715
|
}
|
638
716
|
}
|
639
|
-
return of({
|
717
|
+
return of({ id: '' });
|
640
718
|
}
|
641
719
|
getFlowStore() {
|
642
720
|
return this.flowStore;
|
@@ -677,10 +755,10 @@ class FlowStateService {
|
|
677
755
|
fullRequest.selectors = assign(fullRequest.selectors, subscription.request.selectors);
|
678
756
|
}
|
679
757
|
}
|
680
|
-
const execution$ = this.
|
758
|
+
const execution$ = this.flowInfoService.flow.properties.stateful
|
681
759
|
? this.executeStateful$(fullRequest)
|
682
760
|
: this.executeStateless$(fullRequest);
|
683
|
-
return execution$.pipe(tap
|
761
|
+
return execution$.pipe(tap(result => this.handleSelectorsResponse(result.selectors)));
|
684
762
|
}
|
685
763
|
handleSelectorsResponse(selectors) {
|
686
764
|
Object.entries(selectors).forEach(([requestId, selectorResult]) => {
|
@@ -696,32 +774,21 @@ class FlowStateService {
|
|
696
774
|
});
|
697
775
|
}
|
698
776
|
initStateful$() {
|
699
|
-
var _a;
|
700
|
-
// Subscriptions
|
701
|
-
this.subscribe$(UITemplateType.FLOW_ENGINE, 'CONTEXT', null, { cold: true })
|
702
|
-
.pipe(tap$1(response => {
|
703
|
-
if (response.success) {
|
704
|
-
this.contextService.update(response.result);
|
705
|
-
}
|
706
|
-
}), takeUntil(this.cleanup$))
|
707
|
-
.subscribe();
|
708
777
|
const processorsList = flatten(Object.values(this.processors).map(ownerMap => Object.values(ownerMap !== null && ownerMap !== void 0 ? ownerMap : {})));
|
709
778
|
const processors = processorsList.length ? processorsList : undefined;
|
710
779
|
const selectors = Object.values(this.subscriptions)
|
711
780
|
.map(({ request }) => request.selectors)
|
712
781
|
.filter(isDefined)
|
713
782
|
.reduce((trunk, selectors) => (Object.assign(Object.assign({}, trunk), selectors)), {});
|
714
|
-
const request = this.getDefaultExecutionRequestDTO();
|
715
783
|
return this.flowStateApiService
|
716
784
|
.init({
|
717
|
-
quoteId: this.
|
718
|
-
params:
|
785
|
+
quoteId: this.flowInfoService.context.headerId,
|
786
|
+
params: this.flowInfoService.context,
|
719
787
|
actionsOverride: processors === null || processors === void 0 ? void 0 : processors.filter(processor => processor.type === ConfigurationProcessorTypes.ACTION),
|
720
788
|
selectorsOverride: processors === null || processors === void 0 ? void 0 : processors.filter(processor => processor.type === ConfigurationProcessorTypes.SELECTOR),
|
721
|
-
selectors:
|
722
|
-
actions: request.actions,
|
789
|
+
selectors: selectors,
|
723
790
|
})
|
724
|
-
.pipe(map
|
791
|
+
.pipe(map(({ stateId, selectors }) => {
|
725
792
|
this.handleSelectorsResponse(selectors);
|
726
793
|
this.stateId$.next(stateId);
|
727
794
|
}));
|
@@ -741,80 +808,50 @@ class FlowStateService {
|
|
741
808
|
};
|
742
809
|
this.executionInProgress$.next(true);
|
743
810
|
return this.flowStateApiService.execute(this.stateId$.value, request);
|
744
|
-
}), tap
|
811
|
+
}), tap(({ stateId }) => this.stateId$.next(stateId)), share(), tap(() => this.executionInProgress$.next(false)), catchError(e => {
|
745
812
|
this.executionInProgress$.next(false);
|
746
813
|
return throwError(() => e);
|
747
814
|
}));
|
748
815
|
}
|
749
816
|
executeStateful$(request) {
|
750
|
-
return this.executionInProgress$.pipe(filter
|
817
|
+
return this.executionInProgress$.pipe(filter(inProgress => !inProgress), take(1), switchMap(() =>
|
751
818
|
// make sure stream switches to statefulExecutionRequest$ before pushing an execution request
|
752
819
|
combineLatest([
|
753
820
|
this.statefulExecutionRequest$,
|
754
|
-
of(undefined).pipe(tap
|
755
|
-
])), map
|
821
|
+
of(undefined).pipe(tap(() => this.statefulRequestStream$.next(request))),
|
822
|
+
])), map(([response]) => response), take(1));
|
756
823
|
}
|
757
824
|
initStateless$() {
|
758
|
-
|
759
|
-
const { headerId } = this.contextService.resolve();
|
760
|
-
return this.quoteDraftService.init(headerId, (_a = this.flowInfoService.params) !== null && _a !== void 0 ? _a : {}).pipe(tap$1(() => {
|
761
|
-
const assets = this.quoteDraftService.assetsState;
|
762
|
-
if (assets) {
|
763
|
-
this.flowStore = Object.assign(Object.assign({}, this.flowStore), { assets });
|
764
|
-
}
|
765
|
-
}), switchMap(() => {
|
766
|
-
if (this.flowInfoService.isLegacy) {
|
767
|
-
return of(null);
|
768
|
-
}
|
769
|
-
return this.executeRequest$(this.getDefaultExecutionRequestDTO());
|
770
|
-
}), switchMap(() => this.calculate$()), tap$1(() => this.quoteDraftService.finalizeInit()), map$1(noop));
|
771
|
-
}
|
772
|
-
calculate$() {
|
773
|
-
var _a;
|
774
|
-
const flowState = this.quoteDraftService.quoteDraft;
|
775
|
-
if (!flowState) {
|
776
|
-
return of(undefined);
|
777
|
-
}
|
778
|
-
/*
|
779
|
-
Don't execute procedures when:
|
780
|
-
* Initializing a standalone product configuration UI, as procedure is execute in /price call
|
781
|
-
* Initializing an empty account (account with no assets)
|
782
|
-
*/
|
783
|
-
const isEmptyAccountMode = this.contextService.mode === ConfigurationContextMode.ACCOUNT &&
|
784
|
-
!this.quoteDraftService.hasProducts &&
|
785
|
-
!this.quoteDraftService.hasAssets &&
|
786
|
-
!((_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState.length);
|
787
|
-
if (this.quoteDraftService.isStandalone || isEmptyAccountMode) {
|
788
|
-
return of(undefined);
|
789
|
-
}
|
790
|
-
return this.flowConfiguration.calculate$(flowState);
|
825
|
+
return this.salesTransactionService.init(this.flowInfoService.context.headerId, this.flowInfoService.context).pipe(switchMap(state => this.flowConfiguration.calculate$(state)), tap(() => this.salesTransactionService.finalizeInit()), map(noop));
|
791
826
|
}
|
792
827
|
executeStateless$(request) {
|
793
828
|
this.executionInProgress$.next(true);
|
794
|
-
return of(undefined).pipe(tap
|
829
|
+
return of(undefined).pipe(tap(() => this.executeStatelessActions(request)), switchMap(() => {
|
795
830
|
var _a;
|
796
831
|
/*
|
797
832
|
Skip price calculation in case
|
798
833
|
1. No actions in the request
|
799
834
|
2. Initialization process execution (state not initialized yet)
|
800
835
|
*/
|
801
|
-
|
836
|
+
const { state } = this.salesTransactionService;
|
837
|
+
if (!state || !((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length) || !this.isInitialized()) {
|
802
838
|
return of(undefined);
|
803
839
|
}
|
804
840
|
else {
|
805
|
-
return this.calculate$();
|
841
|
+
return this.flowConfiguration.calculate$(state);
|
806
842
|
}
|
807
|
-
}), map
|
843
|
+
}), map(() => this.executeStatelessSelectors(request)), tap(() => this.executionInProgress$.next(false)), catchError(e => {
|
808
844
|
this.executionInProgress$.next(false);
|
809
845
|
return throwError(() => e);
|
810
846
|
}));
|
811
847
|
}
|
812
848
|
executeStatelessActions(request) {
|
813
849
|
var _a;
|
814
|
-
|
850
|
+
const state = this.salesTransactionService.state;
|
851
|
+
if (!state || !((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length)) {
|
815
852
|
return;
|
816
853
|
}
|
817
|
-
let flowState =
|
854
|
+
let flowState = state;
|
818
855
|
request.actions.forEach(action => {
|
819
856
|
var _a;
|
820
857
|
try {
|
@@ -826,14 +863,14 @@ class FlowStateService {
|
|
826
863
|
throw e;
|
827
864
|
}
|
828
865
|
});
|
829
|
-
this.
|
866
|
+
this.salesTransactionService.setState(flowState);
|
830
867
|
}
|
831
868
|
executeStatelessSelectors(request) {
|
832
869
|
var _a;
|
833
|
-
if (!this.
|
834
|
-
throw '
|
870
|
+
if (!this.salesTransactionService.state) {
|
871
|
+
throw 'State is not initialized';
|
835
872
|
}
|
836
|
-
const flowState = this.
|
873
|
+
const flowState = this.salesTransactionService.state;
|
837
874
|
return EntityUtil.entries((_a = request.selectors) !== null && _a !== void 0 ? _a : {}).reduce((result, [key, selector]) => {
|
838
875
|
try {
|
839
876
|
result.selectors[key] = {
|
@@ -848,1000 +885,104 @@ class FlowStateService {
|
|
848
885
|
errorMessage: String(e),
|
849
886
|
};
|
850
887
|
}
|
851
|
-
return result;
|
852
|
-
}, { stateId: '', selectors: {} });
|
853
|
-
}
|
854
|
-
getFlowSafe() {
|
855
|
-
if (!this.flowInfoService.flow) {
|
856
|
-
throw 'Flow is not defined';
|
857
|
-
}
|
858
|
-
return this.flowInfoService.flow;
|
859
|
-
}
|
860
|
-
initProcessors$() {
|
861
|
-
var _a;
|
862
|
-
const hasOverrides = Boolean((_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplateConfigurationProcessors);
|
863
|
-
const flow = this.getFlowSafe();
|
864
|
-
if (flow.properties.stateful && !hasOverrides) {
|
865
|
-
// Skip initialization as backend will take processors from SF
|
866
|
-
return of(undefined);
|
867
|
-
}
|
868
|
-
const owners$ = Object.values(this.flowInfoService.templates)
|
869
|
-
.map(template => {
|
870
|
-
var _a, _b, _c;
|
871
|
-
if (!template) {
|
872
|
-
return;
|
873
|
-
}
|
874
|
-
const localProcessors$ = (_c = (_b = (_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplateConfigurationProcessors) === null || _b === void 0 ? void 0 : _b.call(_a, template.name)) !== null && _c !== void 0 ? _c : of(null);
|
875
|
-
return localProcessors$.pipe(switchMap(processors => processors ? of(processors) : this.processorsApiService.fetchConfigurationProcessors$(template.id)), tap$1(processors => {
|
876
|
-
const processorsMap = processors.reduce((acc, p) => {
|
877
|
-
acc[p.apiName] = p;
|
878
|
-
return acc;
|
879
|
-
}, {});
|
880
|
-
this.processors[template.id] = processorsMap;
|
881
|
-
}));
|
882
|
-
})
|
883
|
-
.filter(isDefined);
|
884
|
-
if (!owners$.length) {
|
885
|
-
return of(undefined);
|
886
|
-
}
|
887
|
-
return forkJoin(owners$).pipe(map$1(noop));
|
888
|
-
}
|
889
|
-
executeActionScript(request, executable) {
|
890
|
-
var _a;
|
891
|
-
const configurationProcessor = (_a = this.processors[executable.ownerId]) === null || _a === void 0 ? void 0 : _a[executable.apiName];
|
892
|
-
if (!(configurationProcessor === null || configurationProcessor === void 0 ? void 0 : configurationProcessor.script)) {
|
893
|
-
const scope = this.getScopeByOwnerId(executable.ownerId);
|
894
|
-
const scopeText = scope ? ` in ${scope}` : '';
|
895
|
-
throw `ConfigurationProcessor ${executable.apiName}${scopeText} not found`;
|
896
|
-
}
|
897
|
-
return this.executeProcessorScript(request, configurationProcessor, executable.inputData);
|
898
|
-
}
|
899
|
-
executeSelectorScript(request, executable) {
|
900
|
-
var _a;
|
901
|
-
const configurationProcessor = (_a = this.processors[executable.ownerId]) === null || _a === void 0 ? void 0 : _a[executable.apiName];
|
902
|
-
if (!(configurationProcessor === null || configurationProcessor === void 0 ? void 0 : configurationProcessor.script)) {
|
903
|
-
const scope = this.getScopeByOwnerId(executable.ownerId);
|
904
|
-
const scopeText = scope ? ` in ${scope}` : '';
|
905
|
-
throw `ConfigurationProcessor ${executable.apiName}${scopeText} not found`;
|
906
|
-
}
|
907
|
-
return this.executeProcessorScript(request, configurationProcessor, executable.inputData);
|
908
|
-
}
|
909
|
-
executeProcessorScript(request, configurationProcessor, inputData) {
|
910
|
-
var _a;
|
911
|
-
const scope = this.getScopeByOwnerId((_a = configurationProcessor.ownerId) !== null && _a !== void 0 ? _a : '');
|
912
|
-
let functionToExecute = this.executedFunctions[scope + configurationProcessor.apiName];
|
913
|
-
if (!functionToExecute) {
|
914
|
-
const script = `${configurationProcessor.script}\nreturn transform;`;
|
915
|
-
const sourceMap = `\n//# sourceURL=${scope ? scope + '/' : ''}${configurationProcessor.apiName}.js`;
|
916
|
-
functionToExecute = new Function(script + sourceMap)();
|
917
|
-
this.executedFunctions[scope + configurationProcessor.apiName] = functionToExecute;
|
918
|
-
}
|
919
|
-
return functionToExecute({
|
920
|
-
request,
|
921
|
-
inputData,
|
922
|
-
flowStore: this.flowStore,
|
923
|
-
});
|
924
|
-
}
|
925
|
-
generateRequestId(scope, selectorName, inputData) {
|
926
|
-
const inputDataHash = UUID.hex(JSON.stringify(inputData) || '').slice(0, 8);
|
927
|
-
return `${scope}/${selectorName}/${inputDataHash}`;
|
928
|
-
}
|
929
|
-
getDefaultExecutionRequestDTO() {
|
930
|
-
var _a;
|
931
|
-
const request = {
|
932
|
-
actions: [],
|
933
|
-
selectors: {},
|
934
|
-
};
|
935
|
-
if (this.getFlowSafe().properties.standalone) {
|
936
|
-
return request;
|
937
|
-
}
|
938
|
-
const flowEngineTemplateId = this.getOwnerIdByScope(UITemplateType.FLOW_ENGINE);
|
939
|
-
(_a = request.actions) === null || _a === void 0 ? void 0 : _a.push({
|
940
|
-
apiName: 'UPDATE_CONTEXT_PROPERTIES',
|
941
|
-
ownerId: flowEngineTemplateId,
|
942
|
-
inputData: this.contextService.resolve().properties,
|
943
|
-
});
|
944
|
-
return request;
|
945
|
-
}
|
946
|
-
checkStatefulChanges(requestId, selectorResult) {
|
947
|
-
if (this.trackedStatefulChangesMap.has(requestId)) {
|
948
|
-
if (!this.initialStatefulData[requestId]) {
|
949
|
-
this.initialStatefulData[requestId] = selectorResult;
|
950
|
-
}
|
951
|
-
const hasChanges = !isEqual(this.initialStatefulData[requestId], selectorResult);
|
952
|
-
this.trackedStatefulChangesMap.set(requestId, hasChanges);
|
953
|
-
}
|
954
|
-
}
|
955
|
-
}
|
956
|
-
FlowStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, deps: [{ token: ContextService }, { token: QuoteDraftService }, { token: FlowInfoService }, { token: FlowConfigurationService }, { token: i1.ConfigurationProcessorsApiService }, { token: i1.FlowStateApiService }, { token: i1.QuoteApiService }, { token: i6.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
957
|
-
FlowStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService });
|
958
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, decorators: [{
|
959
|
-
type: Injectable
|
960
|
-
}], ctorParameters: function () {
|
961
|
-
return [{ type: ContextService }, { type: QuoteDraftService }, { type: FlowInfoService }, { type: FlowConfigurationService }, { type: i1.ConfigurationProcessorsApiService }, { type: i1.FlowStateApiService }, { type: i1.QuoteApiService }, { type: i6.ToastService }, { type: undefined, decorators: [{
|
962
|
-
type: Optional
|
963
|
-
}, {
|
964
|
-
type: Inject,
|
965
|
-
args: [FLOW_CUSTOMIZATION]
|
966
|
-
}] }];
|
967
|
-
} });
|
968
|
-
|
969
|
-
const findLineItem = (id, lineItems) => {
|
970
|
-
return findLineItemWithComparator(lineItems, (li) => li.id === id);
|
971
|
-
};
|
972
|
-
const findLineItemWithComparator = (lineItems, comparator) => {
|
973
|
-
let currentLevel = lineItems;
|
974
|
-
while (currentLevel.length) {
|
975
|
-
const found = currentLevel.find(comparator);
|
976
|
-
if (found) {
|
977
|
-
return found;
|
978
|
-
}
|
979
|
-
currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
|
980
|
-
}
|
981
|
-
return;
|
982
|
-
};
|
983
|
-
const insertLineItem = (lineItem, parentId, toInsert) => {
|
984
|
-
const insertData = lineItem.id === parentId ? [toInsert] : [];
|
985
|
-
return Object.assign(Object.assign({}, lineItem), { lineItems: [
|
986
|
-
...insertData,
|
987
|
-
...lineItem.lineItems.map(li => {
|
988
|
-
return insertLineItem(li, parentId, toInsert);
|
989
|
-
}),
|
990
|
-
] });
|
991
|
-
};
|
992
|
-
const removeLineItem = (lineItem, idToRemove) => {
|
993
|
-
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems
|
994
|
-
.map(li => {
|
995
|
-
if (li.id === idToRemove) {
|
996
|
-
return;
|
997
|
-
}
|
998
|
-
else if (li.lineItems.length) {
|
999
|
-
return removeLineItem(li, idToRemove);
|
1000
|
-
}
|
1001
|
-
return li;
|
1002
|
-
})
|
1003
|
-
.filter(r => !!r) });
|
1004
|
-
};
|
1005
|
-
const replaceLineItem = (lineItem, replaceTo, skipCardinalityCalculation = false) => {
|
1006
|
-
if (lineItem.id === replaceTo.id) {
|
1007
|
-
if (!skipCardinalityCalculation) {
|
1008
|
-
return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
|
1009
|
-
}
|
1010
|
-
else {
|
1011
|
-
return Object.assign({}, replaceTo);
|
1012
|
-
}
|
1013
|
-
}
|
1014
|
-
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo, skipCardinalityCalculation)) });
|
1015
|
-
};
|
1016
|
-
const collectCardinalityComputations = (portDomains) => {
|
1017
|
-
const cardinalityComputations = new Map();
|
1018
|
-
entries(portDomains).forEach(([key, portDomain]) => {
|
1019
|
-
cardinalityComputations.set(key, portDomain.properties['cardinalityComputation'] === 'true');
|
1020
|
-
});
|
1021
|
-
return cardinalityComputations;
|
1022
|
-
};
|
1023
|
-
const calculateCardinalityVariables = (lineItems, cardinalityComputations) => {
|
1024
|
-
const cardVars = new Map();
|
1025
|
-
lineItems
|
1026
|
-
.filter(({ port, type }) => !!port && !!type)
|
1027
|
-
.forEach(li => {
|
1028
|
-
var _a;
|
1029
|
-
if (cardinalityComputations.get(`${li.port}`)) {
|
1030
|
-
const cardinalityVariableName = `#CV-${li.type}@${li.port}`;
|
1031
|
-
cardVars.set(cardinalityVariableName, ((_a = cardVars.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
|
1032
|
-
}
|
1033
|
-
});
|
1034
|
-
return cardVars;
|
1035
|
-
};
|
1036
|
-
const cardinalityRegexp = new RegExp('#CV-[a-zA-Z0-9_]+@(?<portName>[a-zA-Z0-9_]+)');
|
1037
|
-
const recalculateCardinalityVariables = (original, updated) => {
|
1038
|
-
var _a, _b;
|
1039
|
-
const cardinalityComputations = collectCardinalityComputations((_b = (_a = updated.portDomains) !== null && _a !== void 0 ? _a : original.portDomains) !== null && _b !== void 0 ? _b : {});
|
1040
|
-
const cardinalityVariables = calculateCardinalityVariables(updated.lineItems, cardinalityComputations);
|
1041
|
-
const originalCardinalityVariables = calculateCardinalityVariables(original.lineItems, cardinalityComputations);
|
1042
|
-
originalCardinalityVariables.forEach((value, key) => {
|
1043
|
-
var _a;
|
1044
|
-
const execArray = cardinalityRegexp.exec(key);
|
1045
|
-
const portName = (_a = execArray === null || execArray === void 0 ? void 0 : execArray.groups) === null || _a === void 0 ? void 0 : _a['portName'];
|
1046
|
-
if (!portName || cardinalityComputations.get(portName)) {
|
1047
|
-
if (cardinalityVariables.get(key) === value) {
|
1048
|
-
// no need to update cardinality if no changes
|
1049
|
-
cardinalityVariables.delete(key);
|
1050
|
-
}
|
1051
|
-
else if (!cardinalityVariables.has(key)) {
|
1052
|
-
// remove last item from port
|
1053
|
-
cardinalityVariables.set(key, 0);
|
1054
|
-
}
|
1055
|
-
}
|
1056
|
-
});
|
1057
|
-
return Object.assign(Object.assign({}, updated), { attributes: upsertAttributes(updated.attributes, [...cardinalityVariables].map(([name, value]) => ({ name, value, cfgStatus: 'Changed' }))) });
|
1058
|
-
};
|
1059
|
-
const mapAttributes = (attributes) => {
|
1060
|
-
return attributes.reduce((acc, { name, value }) => (Object.assign(Object.assign({}, acc), { [name]: value })), {});
|
1061
|
-
};
|
1062
|
-
const getAttributes = (attributes, names = []) => {
|
1063
|
-
const filtered = attributes.filter(({ name }) => names.includes(name));
|
1064
|
-
return sortBy(filtered, [({ name }) => names.indexOf(name)]);
|
1065
|
-
};
|
1066
|
-
const upsertAttributes = (originalAttributes, attributesToUpsert) => {
|
1067
|
-
return attributesToUpsert.reduce((acc, { name, value }) => {
|
1068
|
-
const [origAttr] = getAttributes(acc, [name]);
|
1069
|
-
return [
|
1070
|
-
...acc.filter(attr => attr.name !== name),
|
1071
|
-
Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name, type: '' })), { cfgStatus: origAttr ? 'Changed' : 'User', value }),
|
1072
|
-
];
|
1073
|
-
}, originalAttributes);
|
1074
|
-
};
|
1075
|
-
const patchAttributes = (rootLineItem, id, attrs, skipCardinalityCalculation = false) => {
|
1076
|
-
const lineItem = findLineItem(id, [rootLineItem]);
|
1077
|
-
if (!lineItem) {
|
1078
|
-
return rootLineItem;
|
1079
|
-
}
|
1080
|
-
const attributes = upsertAttributes(lineItem.attributes, attrs);
|
1081
|
-
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }), skipCardinalityCalculation);
|
1082
|
-
};
|
1083
|
-
const getAttributeValue = (attributes, name) => { var _a; return (_a = attributes.find(attr => attr.name === name)) === null || _a === void 0 ? void 0 : _a.value; };
|
1084
|
-
const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
|
1085
|
-
return {
|
1086
|
-
id: UUID.UUID(),
|
1087
|
-
port,
|
1088
|
-
type,
|
1089
|
-
actionCode: 'ADD',
|
1090
|
-
cfgStatus: 'New',
|
1091
|
-
attributes: attributes.map(({ name, value }) => ({ cfgStatus: 'User', name, value })),
|
1092
|
-
lineItems,
|
1093
|
-
parentId,
|
1094
|
-
qty: 1,
|
1095
|
-
};
|
1096
|
-
};
|
1097
|
-
const getRecommendedPrices = (portDomain, type) => {
|
1098
|
-
var _a, _b;
|
1099
|
-
const domainType = portDomain.domainTypes.find(({ name }) => name === type);
|
1100
|
-
const [net, list] = (_b = (_a = domainType === null || domainType === void 0 ? void 0 : domainType.recommendedPrices) === null || _a === void 0 ? void 0 : _a.filter(({ chargeMethod }) => chargeMethod === 'ONE_TIME').reduce((acc, rp) => {
|
1101
|
-
const [netPrice, listPrice] = acc;
|
1102
|
-
return [netPrice + rp.netPrice, listPrice + rp.listPrice];
|
1103
|
-
}, [0, 0])) !== null && _b !== void 0 ? _b : [0, 0];
|
1104
|
-
return { net, list };
|
1105
|
-
};
|
1106
|
-
const getOriginParent = (lineItems, currentLineItem) => {
|
1107
|
-
let target = currentLineItem;
|
1108
|
-
while (target && target.rampInstanceId) {
|
1109
|
-
target = lineItems.find(sub => sub.id === currentLineItem.rampInstanceId);
|
1110
|
-
}
|
1111
|
-
return target;
|
1112
|
-
};
|
1113
|
-
const assetPredicateFn = (lineItem, assetId) => {
|
1114
|
-
if (!assetId) {
|
1115
|
-
return false;
|
1116
|
-
}
|
1117
|
-
return lineItem.assetId === assetId || lineItem.openOrderLineItemId === assetId;
|
1118
|
-
};
|
1119
|
-
const multiplyLineItems = (lineItem, qty, split) => {
|
1120
|
-
if (split) {
|
1121
|
-
const unifyIds = (lineItem) => (Object.assign(Object.assign({}, lineItem), { id: UUID.UUID(), lineItems: lineItem.lineItems.map(unifyIds) }));
|
1122
|
-
return map$2(new Array(qty), () => unifyIds(lineItem));
|
1123
|
-
}
|
1124
|
-
else {
|
1125
|
-
return [
|
1126
|
-
Object.assign(Object.assign({}, lineItem), { qty: qty }),
|
1127
|
-
];
|
1128
|
-
}
|
1129
|
-
};
|
1130
|
-
const isTechnicalAttribute = (name) => {
|
1131
|
-
return name.startsWith('#') || name.startsWith('$');
|
1132
|
-
};
|
1133
|
-
const filterOutTechnicalAttributes = (attributes) => {
|
1134
|
-
return attributes.filter(({ name }) => !isTechnicalAttribute(name));
|
1135
|
-
};
|
1136
|
-
|
1137
|
-
var lineItem_utils = /*#__PURE__*/Object.freeze({
|
1138
|
-
__proto__: null,
|
1139
|
-
assetPredicateFn: assetPredicateFn,
|
1140
|
-
filterOutTechnicalAttributes: filterOutTechnicalAttributes,
|
1141
|
-
findLineItem: findLineItem,
|
1142
|
-
findLineItemWithComparator: findLineItemWithComparator,
|
1143
|
-
generateLineItem: generateLineItem,
|
1144
|
-
getAttributeValue: getAttributeValue,
|
1145
|
-
getAttributes: getAttributes,
|
1146
|
-
getOriginParent: getOriginParent,
|
1147
|
-
getRecommendedPrices: getRecommendedPrices,
|
1148
|
-
insertLineItem: insertLineItem,
|
1149
|
-
isTechnicalAttribute: isTechnicalAttribute,
|
1150
|
-
mapAttributes: mapAttributes,
|
1151
|
-
multiplyLineItems: multiplyLineItems,
|
1152
|
-
patchAttributes: patchAttributes,
|
1153
|
-
recalculateCardinalityVariables: recalculateCardinalityVariables,
|
1154
|
-
removeLineItem: removeLineItem,
|
1155
|
-
replaceLineItem: replaceLineItem,
|
1156
|
-
upsertAttributes: upsertAttributes
|
1157
|
-
});
|
1158
|
-
|
1159
|
-
class LineItemWorker {
|
1160
|
-
constructor(src) {
|
1161
|
-
this.li = Object.assign({}, src);
|
1162
|
-
}
|
1163
|
-
insert(parentId, toInsert) {
|
1164
|
-
return new LineItemWorker(insertLineItem(this.li, parentId, toInsert));
|
1165
|
-
}
|
1166
|
-
remove(id) {
|
1167
|
-
return new LineItemWorker(removeLineItem(this.li, id));
|
1168
|
-
}
|
1169
|
-
replace(toReplace, skipCardinalityCalculation = false) {
|
1170
|
-
return new LineItemWorker(replaceLineItem(this.li, toReplace, skipCardinalityCalculation));
|
1171
|
-
}
|
1172
|
-
patchAttribute(attrs, id, skipCardinalityCalculation = false) {
|
1173
|
-
return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs, skipCardinalityCalculation));
|
1174
|
-
}
|
1175
|
-
}
|
1176
|
-
|
1177
|
-
function extractMetadata(uiDefinition) {
|
1178
|
-
return omit(uiDefinition, [
|
1179
|
-
'children',
|
1180
|
-
'pages',
|
1181
|
-
'components',
|
1182
|
-
]);
|
1183
|
-
}
|
1184
|
-
|
1185
|
-
class FlowUpdateService {
|
1186
|
-
update(rootLineItems, updates, charges) {
|
1187
|
-
let remainingUpdates = [...updates];
|
1188
|
-
let currentLevel = rootLineItems;
|
1189
|
-
while (currentLevel.length && remainingUpdates.length) {
|
1190
|
-
currentLevel.forEach(li => {
|
1191
|
-
const unhandledUpdates = [];
|
1192
|
-
remainingUpdates.forEach(update => {
|
1193
|
-
let updated = false;
|
1194
|
-
switch (update.dataType) {
|
1195
|
-
case 'LINEITEM':
|
1196
|
-
updated = this.applyLineItemUpdate(li, update, charges);
|
1197
|
-
break;
|
1198
|
-
case 'CHARGE':
|
1199
|
-
updated = this.applyChargeUpdate(li, update);
|
1200
|
-
break;
|
1201
|
-
case 'GROUP_CHARGE':
|
1202
|
-
updated = this.applyChargeGroupUpdate(li, update);
|
1203
|
-
break;
|
1204
|
-
default:
|
1205
|
-
// Unknown dataType. Do not try to handle it anymore
|
1206
|
-
updated = true;
|
1207
|
-
}
|
1208
|
-
if (!updated) {
|
1209
|
-
unhandledUpdates.push(update);
|
1210
|
-
}
|
1211
|
-
});
|
1212
|
-
remainingUpdates = unhandledUpdates;
|
1213
|
-
});
|
1214
|
-
currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
|
1215
|
-
}
|
1216
|
-
}
|
1217
|
-
delete(lineItems, id) {
|
1218
|
-
const idsToRemove = [id];
|
1219
|
-
const topLevelLineItem = lineItems.find(li => li.id === id);
|
1220
|
-
if (topLevelLineItem) {
|
1221
|
-
// find term-related line items (which are only top level)
|
1222
|
-
// expired term line items won't be deleted
|
1223
|
-
let foundTermLineItem = topLevelLineItem;
|
1224
|
-
while (foundTermLineItem) {
|
1225
|
-
foundTermLineItem = lineItems.find(li => foundTermLineItem && li.rampInstanceId === foundTermLineItem.id);
|
1226
|
-
if (foundTermLineItem) {
|
1227
|
-
idsToRemove.push(foundTermLineItem.id);
|
1228
|
-
}
|
1229
|
-
}
|
1230
|
-
}
|
1231
|
-
const filtered = lineItems.filter(lineItem => !idsToRemove.includes(lineItem.id));
|
1232
|
-
return filtered.map(lineItem => new LineItemWorker(lineItem).remove(id).li);
|
1233
|
-
}
|
1234
|
-
applyLineItemUpdate(lineItem, update, charges) {
|
1235
|
-
if (lineItem.id !== update.id) {
|
1236
|
-
return false;
|
1237
|
-
}
|
1238
|
-
switch (update.attributeType) {
|
1239
|
-
case 'QTY':
|
1240
|
-
lineItem.qty = update.newValue;
|
1241
|
-
break;
|
1242
|
-
case 'EFFECTIVE_START_DATE':
|
1243
|
-
lineItem.properties['StartDate'] = moment(update.newValue).format('YYYY-MM-DD');
|
1244
|
-
break;
|
1245
|
-
case 'END_DATE':
|
1246
|
-
lineItem.properties['EndDate'] = moment(update.newValue).format('YYYY-MM-DD');
|
1247
|
-
break;
|
1248
|
-
case 'PRICE_ADJUSTMENT':
|
1249
|
-
{
|
1250
|
-
const charge = lineItem.chargeItems.find(charge => { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
1251
|
-
if (charge) {
|
1252
|
-
charge.priceAdjustment = update.newValue;
|
1253
|
-
}
|
1254
|
-
}
|
1255
|
-
break;
|
1256
|
-
case 'LIST_PRICE_ADJUSTMENT':
|
1257
|
-
case 'MARGIN_ADJUSTMENT':
|
1258
|
-
{
|
1259
|
-
const charge = lineItem.chargeItems.find(charge => { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
1260
|
-
if (charge) {
|
1261
|
-
charge.listPriceAdjustment = update.newValue;
|
1262
|
-
}
|
1263
|
-
}
|
1264
|
-
break;
|
1265
|
-
case 'COST_ADJUSTMENT':
|
1266
|
-
{
|
1267
|
-
const charge = lineItem.chargeItems.find(charge => { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
1268
|
-
if (charge) {
|
1269
|
-
charge.costAdjustment = update.newValue;
|
1270
|
-
}
|
1271
|
-
}
|
1272
|
-
break;
|
1273
|
-
default:
|
1274
|
-
throw new Error(`Not suppored AttributeType for LineItem update: ${update.attributeType}`);
|
1275
|
-
}
|
1276
|
-
return true;
|
1277
|
-
}
|
1278
|
-
applyChargeUpdate(lineItem, update) {
|
1279
|
-
const foundCharge = lineItem.chargeItems.find(({ id }) => id === update.id);
|
1280
|
-
if (!foundCharge) {
|
1281
|
-
return false;
|
1282
|
-
}
|
1283
|
-
if (update.attributeType === 'PRICE_ADJUSTMENT') {
|
1284
|
-
foundCharge.priceAdjustment = update.newValue;
|
1285
|
-
}
|
1286
|
-
else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
|
1287
|
-
foundCharge.listPriceAdjustment = update.newValue;
|
1288
|
-
}
|
1289
|
-
else {
|
1290
|
-
throw new Error(`Not suppored AttributeType for Charge Item update: ${update.attributeType}`);
|
1291
|
-
}
|
1292
|
-
return true;
|
1293
|
-
}
|
1294
|
-
applyChargeGroupUpdate(lineItem, update) {
|
1295
|
-
const foundChargeGroup = ChargeGroupUtils.findChargeGroupById(update.id, lineItem);
|
1296
|
-
if (!foundChargeGroup) {
|
1297
|
-
return false;
|
1298
|
-
}
|
1299
|
-
if (update.attributeType === 'PRICE_ADJUSTMENT') {
|
1300
|
-
foundChargeGroup.priceAdjustment = update.newValue;
|
1301
|
-
}
|
1302
|
-
else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
|
1303
|
-
foundChargeGroup.listPriceAdjustment = update.newValue;
|
1304
|
-
}
|
1305
|
-
else {
|
1306
|
-
throw new Error(`Not suppored AttributeType for Charge Group Item update: ${update.attributeType}`);
|
1307
|
-
}
|
1308
|
-
return true;
|
1309
|
-
}
|
1310
|
-
}
|
1311
|
-
FlowUpdateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1312
|
-
FlowUpdateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService });
|
1313
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowUpdateService, decorators: [{
|
1314
|
-
type: Injectable
|
1315
|
-
}] });
|
1316
|
-
|
1317
|
-
class RuntimeSettingsService {
|
1318
|
-
constructor(configurationSettingsApiService) {
|
1319
|
-
this.configurationSettingsApiService = configurationSettingsApiService;
|
1320
|
-
this.configurationSettings$ = new BehaviorSubject({});
|
1321
|
-
this.currencySettings$ = new BehaviorSubject({
|
1322
|
-
iso: DEFAULT_CURRENCY_ISO_CODE,
|
1323
|
-
symbol: DEFAULT_CURRENCY_SYMBOL,
|
1324
|
-
});
|
1325
|
-
this.shoppingCartSettings$ = new BehaviorSubject([]);
|
1326
|
-
this.getCurrencySymbol = (locale, currency) => {
|
1327
|
-
return (0)
|
1328
|
-
.toLocaleString(locale, { style: 'currency', currency, minimumFractionDigits: 0, maximumFractionDigits: 0 })
|
1329
|
-
.replace(/\d/g, '')
|
1330
|
-
.trim();
|
1331
|
-
};
|
1332
|
-
}
|
1333
|
-
create() {
|
1334
|
-
return this.configurationSettingsApiService.fetchSettings().pipe(map$1(settings => this.parseConfigurationSettings(settings)), tap$1(configurationSettings => {
|
1335
|
-
var _a;
|
1336
|
-
this.configurationSettings$.next(configurationSettings);
|
1337
|
-
this.addShoppingCartSettings((_a = configurationSettings['shopping-cart']) !== null && _a !== void 0 ? _a : []);
|
1338
|
-
this.formattingSettings = this.getFormattingSettings();
|
1339
|
-
}), map$1(() => undefined));
|
1340
|
-
}
|
1341
|
-
initCurrency(iso) {
|
1342
|
-
if (iso) {
|
1343
|
-
const symbol = this.getCurrencySymbol('en-US', iso);
|
1344
|
-
this.currencySettings$.next({ iso, symbol });
|
1345
|
-
if (this.formattingSettings) {
|
1346
|
-
this.formattingSettings.currencySymbol = symbol;
|
1347
|
-
}
|
1348
|
-
}
|
1349
|
-
}
|
1350
|
-
getFormattingSettings() {
|
1351
|
-
var _a, _b;
|
1352
|
-
if (this.formattingSettings) {
|
1353
|
-
return this.formattingSettings;
|
1354
|
-
}
|
1355
|
-
const shoppingCartSettings = (_a = this.getConfigurationSettings()['shopping-cart']) === null || _a === void 0 ? void 0 : _a.reduce((acc, setting) => {
|
1356
|
-
return Object.assign(Object.assign({}, acc), { [setting.id]: setting.properties });
|
1357
|
-
}, {});
|
1358
|
-
const currencySettings = this.getCurrencySettings();
|
1359
|
-
const dateFormat = (validateDateFormat((_b = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT) !== null && _b !== void 0 ? _b : '') && (shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DATE_FORMAT)) ||
|
1360
|
-
DEFAULT_DATE_FORMAT;
|
1361
|
-
const decimalSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.DECIMAL_SEPARATOR;
|
1362
|
-
const thousandsSeparator = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.THOUSANDS_SEPARATOR;
|
1363
|
-
// the number of decimal places can be 0
|
1364
|
-
const priceScale = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.PRICE_SCALE;
|
1365
|
-
const decimalsCount = priceScale !== null && priceScale !== '' && !isNaN(Number(priceScale)) && Number(priceScale) >= 0
|
1366
|
-
? Number(priceScale)
|
1367
|
-
: DEFAULT_DECIMALS_COUNT;
|
1368
|
-
const actionCodeSettings = shoppingCartSettings === null || shoppingCartSettings === void 0 ? void 0 : shoppingCartSettings.STATUS_LABEL;
|
1369
|
-
return {
|
1370
|
-
currencySymbol: currencySettings.symbol,
|
1371
|
-
dateFormats: getSupportedDateFormats(dateFormat),
|
1372
|
-
decimalsCount,
|
1373
|
-
decimalSeparator: decimalSeparator !== undefined && ['.', ','].includes(decimalSeparator)
|
1374
|
-
? decimalSeparator
|
1375
|
-
: DEFAULT_DECIMAL_SEPARATOR,
|
1376
|
-
// thousands separator can be a blank value, so it can also be null
|
1377
|
-
thousandsSeparator: thousandsSeparator !== undefined && ['.', ',', '', null].includes(thousandsSeparator)
|
1378
|
-
? thousandsSeparator || ''
|
1379
|
-
: DEFAULT_THOUSANDS_SEPARATOR,
|
1380
|
-
actionCodeLabels: (actionCodeSettings === null || actionCodeSettings === void 0 ? void 0 : actionCodeSettings.length)
|
1381
|
-
? actionCodeSettings.reduce((result, setting) => (Object.assign(Object.assign({}, result), { [setting.status_label]: setting.custom_label })), {})
|
1382
|
-
: DEFAULT_ACTION_CODE_LABELS,
|
1383
|
-
};
|
1384
|
-
}
|
1385
|
-
getConfigurationSettings() {
|
1386
|
-
return this.configurationSettings$.value;
|
1387
|
-
}
|
1388
|
-
getShoppingCartSettings() {
|
1389
|
-
return this.shoppingCartSettings$.value;
|
1390
|
-
}
|
1391
|
-
getCurrencySettings() {
|
1392
|
-
return this.currencySettings$.value;
|
1393
|
-
}
|
1394
|
-
parseConfigurationSettings(settings) {
|
1395
|
-
return settings.reduce((acc, setting) => {
|
1396
|
-
switch (setting.key) {
|
1397
|
-
case 'shopping-cart':
|
1398
|
-
acc['shopping-cart'] = parseJsonSafely(setting.value, []);
|
1399
|
-
break;
|
1400
|
-
case 'navigation':
|
1401
|
-
acc.navigation = parseJsonSafely(setting.value, {});
|
1402
|
-
break;
|
1403
|
-
case 'flows':
|
1404
|
-
acc.flows = parseJsonSafely(setting.value, []);
|
1405
|
-
break;
|
1406
|
-
default:
|
1407
|
-
acc[setting.key] = setting.value;
|
1408
|
-
}
|
1409
|
-
return acc;
|
1410
|
-
}, {});
|
1411
|
-
}
|
1412
|
-
addShoppingCartSettings(settings) {
|
1413
|
-
// uniqBy removes items with the biggest index
|
1414
|
-
const newSettings = uniqBy([...settings, ...this.shoppingCartSettings$.value], 'id');
|
1415
|
-
this.shoppingCartSettings$.next(newSettings);
|
1416
|
-
}
|
1417
|
-
}
|
1418
|
-
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1419
|
-
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService });
|
1420
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, decorators: [{
|
1421
|
-
type: Injectable
|
1422
|
-
}], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
|
1423
|
-
|
1424
|
-
class ConfigurationService {
|
1425
|
-
constructor(quoteDraftService, runtimeService, contextService, configurationApiService, messageService, dialogService, runtimeSettings) {
|
1426
|
-
this.quoteDraftService = quoteDraftService;
|
1427
|
-
this.runtimeService = runtimeService;
|
1428
|
-
this.contextService = contextService;
|
1429
|
-
this.configurationApiService = configurationApiService;
|
1430
|
-
this.messageService = messageService;
|
1431
|
-
this.dialogService = dialogService;
|
1432
|
-
this.runtimeSettings = runtimeSettings;
|
1433
|
-
this.mode = ConfigurationMode.SEARCH;
|
1434
|
-
this.configurationState = new BehaviorSubject(null);
|
1435
|
-
this.previousConfigurationState = new BehaviorSubject(null);
|
1436
|
-
this.isLoadingSubj$ = new BehaviorSubject(false);
|
1437
|
-
this.isLoading$ = this.isLoadingSubj$.asObservable();
|
1438
|
-
this.hasUnsavedChanges = false;
|
1439
|
-
}
|
1440
|
-
reset() {
|
1441
|
-
this.hasUnsavedChanges = false;
|
1442
|
-
this.runtimeService.reset();
|
1443
|
-
this.configurableRamp = undefined;
|
1444
|
-
this.configurationState.next(null);
|
1445
|
-
this.previousConfigurationState.next(null);
|
1446
|
-
}
|
1447
|
-
patch$(lineItem, options) {
|
1448
|
-
const source = this.getSnapshot();
|
1449
|
-
if (!source) {
|
1450
|
-
return throwError(() => new Error(`Source LineItem not found`));
|
1451
|
-
}
|
1452
|
-
const skipCardinalityCalculation = (options === null || options === void 0 ? void 0 : options.skipCardinalityCalculation) || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
|
1453
|
-
this.configurableRamp = new LineItemWorker(source).replace(lineItem, skipCardinalityCalculation).li;
|
1454
|
-
return this.configure().pipe(catchError$1(error => {
|
1455
|
-
console.error(error);
|
1456
|
-
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
1457
|
-
this.messageService.add({ severity: 'error', summary: error });
|
1458
|
-
}
|
1459
|
-
// bounce back if configuration call has failed
|
1460
|
-
const prevState = this.configurationState.value;
|
1461
|
-
this.configurationState.next(prevState ? Object.assign({}, prevState) : null);
|
1462
|
-
return throwError(() => error);
|
1463
|
-
}), tap(() => {
|
1464
|
-
if (!this.hasUnsavedChanges) {
|
1465
|
-
this.hasUnsavedChanges = true;
|
1466
|
-
}
|
1467
|
-
}));
|
1468
|
-
}
|
1469
|
-
patch(lineItem, options) {
|
1470
|
-
this.patch$(lineItem, options).subscribe();
|
1471
|
-
}
|
1472
|
-
setConfigurableRamp(lineItem) {
|
1473
|
-
this.configurableRamp = lineItem;
|
1474
|
-
}
|
1475
|
-
get() {
|
1476
|
-
return this.configurationState.pipe(map(state => state === null || state === void 0 ? void 0 : state.lineItem), shareReplay$1());
|
1477
|
-
}
|
1478
|
-
getSnapshot() {
|
1479
|
-
var _a, _b;
|
1480
|
-
return ((_a = this.configurationState.value) === null || _a === void 0 ? void 0 : _a.lineItem) ? Object.assign({}, (_b = this.configurationState.value) === null || _b === void 0 ? void 0 : _b.lineItem) : undefined;
|
1481
|
-
}
|
1482
|
-
getRuntimeModel() {
|
1483
|
-
const runtimeModel = this.runtimeService.runtimeModel;
|
1484
|
-
if (!runtimeModel) {
|
1485
|
-
throw new Error('Runtime model not initialized');
|
1486
|
-
}
|
1487
|
-
return runtimeModel;
|
1488
|
-
}
|
1489
|
-
getRuntimeContext() {
|
1490
|
-
const runtimeContext = this.runtimeService.runtimeContext;
|
1491
|
-
if (!runtimeContext) {
|
1492
|
-
throw new Error('Runtime context not initialized');
|
1493
|
-
}
|
1494
|
-
return runtimeContext;
|
1495
|
-
}
|
1496
|
-
get state$() {
|
1497
|
-
return this.configurationState.asObservable();
|
1498
|
-
}
|
1499
|
-
get stateSnapshot() {
|
1500
|
-
return this.configurationState.value;
|
1501
|
-
}
|
1502
|
-
get previousStateSnapshot() {
|
1503
|
-
return this.previousConfigurationState.value;
|
1504
|
-
}
|
1505
|
-
get contextSnapshot() {
|
1506
|
-
return this.contextService.resolve();
|
1507
|
-
}
|
1508
|
-
get context$() {
|
1509
|
-
return this.contextService.resolve$();
|
1510
|
-
}
|
1511
|
-
get charges$() {
|
1512
|
-
return this.configurationState.pipe(map(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.charges) !== null && _a !== void 0 ? _a : {}; }));
|
1513
|
-
}
|
1514
|
-
get chargesSnapshot() {
|
1515
|
-
var _a, _b;
|
1516
|
-
return (_b = (_a = this.configurationState.value) === null || _a === void 0 ? void 0 : _a.charges) !== null && _b !== void 0 ? _b : {};
|
1517
|
-
}
|
1518
|
-
get pricePlans$() {
|
1519
|
-
return this.configurationState.pipe(map(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.pricePlans) !== null && _a !== void 0 ? _a : {}; }));
|
1520
|
-
}
|
1521
|
-
get pricePlansSnapshot() {
|
1522
|
-
var _a, _b;
|
1523
|
-
return (_b = (_a = this.configurationState.value) === null || _a === void 0 ? void 0 : _a.pricePlans) !== null && _b !== void 0 ? _b : {};
|
1524
|
-
}
|
1525
|
-
get procedureContext$() {
|
1526
|
-
return this.configurationState.pipe(map(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.procedureContext) !== null && _a !== void 0 ? _a : {}; }));
|
1527
|
-
}
|
1528
|
-
get procedureContextSnapshot() {
|
1529
|
-
var _a, _b;
|
1530
|
-
return (_b = (_a = this.configurationState.value) === null || _a === void 0 ? void 0 : _a.procedureContext) !== null && _b !== void 0 ? _b : {};
|
1531
|
-
}
|
1532
|
-
configure() {
|
1533
|
-
return this.configureRequest$(this.generateRequest());
|
1534
|
-
}
|
1535
|
-
configureRequest$(configurationRequest) {
|
1536
|
-
var _a;
|
1537
|
-
const runtimeContext = this.getRuntimeContext();
|
1538
|
-
const runtimeModel = this.getRuntimeModel();
|
1539
|
-
const uiDefinitionProperties = this.getUIDefinitionProperties();
|
1540
|
-
const mainPricingEnabled = (_a = runtimeContext.properties) === null || _a === void 0 ? void 0 : _a.PricingEnabled;
|
1541
|
-
const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
|
1542
|
-
const customPriceApi = this.runtimeSettings.getConfigurationSettings()['CUSTOM_PRICE_API'];
|
1543
|
-
this.isLoadingSubj$.next(true);
|
1544
|
-
const configure$ = pricingEnabled && customPriceApi
|
1545
|
-
? this.configurationApiService.customConfigurePrice({ url: customPriceApi, configurationRequest, runtimeModel })
|
1546
|
-
: this.configurationApiService.configureLineItem({
|
1547
|
-
configurationRequest,
|
1548
|
-
runtimeModel,
|
1549
|
-
pricingEnabled,
|
1550
|
-
});
|
1551
|
-
return configure$.pipe(tap(result => {
|
1552
|
-
var _a;
|
1553
|
-
this.contextService.update(result.context);
|
1554
|
-
this.configurationState.next(result);
|
1555
|
-
this.previousConfigurationState.next(cloneDeep(result));
|
1556
|
-
if ((_a = result.deletedLineItems) === null || _a === void 0 ? void 0 : _a.length) {
|
1557
|
-
this.showInactiveProductsConfirmation();
|
1558
|
-
}
|
1559
|
-
this.configurableRamp = result.lineItem;
|
1560
|
-
}), map(({ lineItem }) => lineItem), catchError$1(error => throwError(() => {
|
1561
|
-
const resetState = this.previousConfigurationState.value;
|
1562
|
-
if (resetState) {
|
1563
|
-
this.previousConfigurationState.next(cloneDeep(resetState));
|
1564
|
-
this.configurationState.next(resetState);
|
1565
|
-
}
|
1566
|
-
if (error.error) {
|
1567
|
-
return extractErrorDetails(error.error).join('. ');
|
1568
|
-
}
|
1569
|
-
return error.message || JSON.stringify(error);
|
1570
|
-
})), finalize$1(() => this.isLoadingSubj$.next(false)));
|
1571
|
-
}
|
1572
|
-
configureExternal$(props) {
|
1573
|
-
return this.runtimeService
|
1574
|
-
.init({ productId: props.productId, defaultQty: props.qty, attributesMap: props.attributesMap })
|
1575
|
-
.pipe(switchMap$1(() => this.configure()), first(), catchError$1(error => {
|
1576
|
-
this.messageService.add({ severity: ToastType.error, summary: error });
|
1577
|
-
throw error;
|
1578
|
-
}), finalize$1(() => this.reset()));
|
1579
|
-
}
|
1580
|
-
configureGuidedSelling$(data) {
|
1581
|
-
return this.configurationApiService
|
1582
|
-
.configureLineItem({
|
1583
|
-
configurationRequest: getGuidedSellingConfigurationRequest(data, this.contextService.resolve()),
|
1584
|
-
})
|
1585
|
-
.pipe(catchError$1(error => {
|
1586
|
-
if (error instanceof HttpErrorResponse) {
|
1587
|
-
this.messageService.add({ severity: ToastType.error, summary: error.error.message || error.error });
|
1588
|
-
}
|
1589
|
-
throw error;
|
1590
|
-
}));
|
1591
|
-
}
|
1592
|
-
generateRequest(lightMode = true) {
|
1593
|
-
var _a, _b;
|
1594
|
-
const lineItem = this.generateLineItem();
|
1595
|
-
let request = {
|
1596
|
-
lineItem,
|
1597
|
-
mode: this.mode,
|
1598
|
-
step: !((_a = this.configurationState.value) === null || _a === void 0 ? void 0 : _a.lineItem) ? RuntimeStep.START : RuntimeStep.UPDATE,
|
1599
|
-
attributeDomainMode: 'ALL',
|
1600
|
-
context: this.contextService.resolve(),
|
1601
|
-
lineItems: ((_b = this.quoteDraftService.quoteDraft) === null || _b === void 0 ? void 0 : _b.currentState) || [],
|
1602
|
-
asset: this.getAsset(),
|
1603
|
-
};
|
1604
|
-
if (lightMode) {
|
1605
|
-
request = ConfigurationTranslatorUtils.lightenConfigurationRequest(request);
|
1606
|
-
}
|
1607
|
-
return request;
|
1608
|
-
}
|
1609
|
-
generateLineItem() {
|
1610
|
-
var _a;
|
1611
|
-
const runtimeContext = this.getRuntimeContext();
|
1612
|
-
const uiDefinitionProperties = this.getUIDefinitionProperties();
|
1613
|
-
let lineItem = this.configurableRamp;
|
1614
|
-
if (!lineItem) {
|
1615
|
-
const { initializationProps } = (_a = this.runtimeService) !== null && _a !== void 0 ? _a : {};
|
1616
|
-
lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.defaultQty);
|
1617
|
-
// Set default attributes
|
1618
|
-
if (initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap) {
|
1619
|
-
const attributes = transform(initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap, (acc, value, name) => acc.push({ name, value }), []);
|
1620
|
-
lineItem = new LineItemWorker(lineItem).patchAttribute(attributes).li;
|
1621
|
-
}
|
1622
|
-
}
|
1623
|
-
return lineItem;
|
1624
|
-
}
|
1625
|
-
getAsset() {
|
1626
|
-
var _a, _b;
|
1627
|
-
const lineItem = this.configurableRamp;
|
1628
|
-
if (!lineItem) {
|
1629
|
-
return;
|
1630
|
-
}
|
1631
|
-
const assetId = (_a = lineItem.assetId) !== null && _a !== void 0 ? _a : lineItem.openOrderLineItemId;
|
1632
|
-
return (_b = this.quoteDraftService.assetsState) === null || _b === void 0 ? void 0 : _b.initialState.find(li => assetPredicateFn(li, assetId));
|
1633
|
-
}
|
1634
|
-
getUIDefinitionProperties() {
|
1635
|
-
var _a, _b, _c;
|
1636
|
-
return Object.assign(Object.assign({}, ((_b = (_a = this.getRuntimeContext().uiDefinitionContainer) === null || _a === void 0 ? void 0 : _a.source.properties) !== null && _b !== void 0 ? _b : {})), ((_c = this.runtimeService.uiDefinitionProperties) !== null && _c !== void 0 ? _c : {}));
|
1637
|
-
}
|
1638
|
-
showInactiveProductsConfirmation() {
|
1639
|
-
const confirmationConfig = {
|
1640
|
-
title: ' ',
|
1641
|
-
description: 'This quote contains inactive products. Do you want to remove them?',
|
1642
|
-
primaryButtonLabel: 'Remove products',
|
1643
|
-
secondaryButtonLabel: 'Back to Quote',
|
1644
|
-
};
|
1645
|
-
this.dialogService
|
1646
|
-
.open(ConfirmationComponent, {
|
1647
|
-
dismissableMask: false,
|
1648
|
-
closeOnEscape: false,
|
1649
|
-
closable: false,
|
1650
|
-
showHeader: true,
|
1651
|
-
header: `Inactive Products in Quote`,
|
1652
|
-
width: '440px',
|
1653
|
-
data: { confirmationConfig },
|
1654
|
-
})
|
1655
|
-
.onClose.subscribe(result => {
|
1656
|
-
if (!result) {
|
1657
|
-
const context = this.contextService.resolve();
|
1658
|
-
window['VELO_BACK_FN'].apply(null, [context.headerId]);
|
1659
|
-
}
|
1660
|
-
});
|
1661
|
-
}
|
1662
|
-
}
|
1663
|
-
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, deps: [{ token: QuoteDraftService }, { token: ConfigurationRuntimeService }, { token: ContextService }, { token: i1.ConfigurationApiService }, { token: i5.MessageService }, { token: i6$1.DialogService }, { token: RuntimeSettingsService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1664
|
-
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService });
|
1665
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, decorators: [{
|
1666
|
-
type: Injectable
|
1667
|
-
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: ConfigurationRuntimeService }, { type: ContextService }, { type: i1.ConfigurationApiService }, { type: i5.MessageService }, { type: i6$1.DialogService }, { type: RuntimeSettingsService }]; } });
|
1668
|
-
|
1669
|
-
class FlowConfigurationService {
|
1670
|
-
constructor(proceduresApiService, contextService, quoteDraftService, updateService, configurationService, flowInfoService) {
|
1671
|
-
this.proceduresApiService = proceduresApiService;
|
1672
|
-
this.contextService = contextService;
|
1673
|
-
this.quoteDraftService = quoteDraftService;
|
1674
|
-
this.updateService = updateService;
|
1675
|
-
this.configurationService = configurationService;
|
1676
|
-
this.flowInfoService = flowInfoService;
|
1677
|
-
this.updatedSubj$ = new Subject();
|
1678
|
-
this.updated$ = this.updatedSubj$.asObservable();
|
1679
|
-
}
|
1680
|
-
calculate$(quoteDraft) {
|
1681
|
-
return this.extendedApply$(quoteDraft).pipe(tap$1(result => {
|
1682
|
-
// sort the result current state based on the quote draft initial state
|
1683
|
-
const initialStateIds = quoteDraft.initialState.map(lineItem => lineItem.integrationId);
|
1684
|
-
result.currentState = result.currentState
|
1685
|
-
.slice()
|
1686
|
-
.sort((a, b) => initialStateIds.indexOf(a.integrationId) - initialStateIds.indexOf(b.integrationId));
|
1687
|
-
this.quoteDraftService.updateQuoteDraft(result);
|
1688
|
-
}), map$1(noop));
|
1689
|
-
}
|
1690
|
-
calculate(quoteDraft) {
|
1691
|
-
this.calculate$(quoteDraft).subscribe();
|
888
|
+
return result;
|
889
|
+
}, { stateId: '', selectors: {} });
|
1692
890
|
}
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
891
|
+
initProcessors$() {
|
892
|
+
var _a;
|
893
|
+
const hasOverrides = Boolean((_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplateConfigurationProcessors);
|
894
|
+
if (this.flowInfoService.flow.properties.stateful && !hasOverrides) {
|
895
|
+
// Skip initialization as backend will take processors from SF
|
896
|
+
return of(undefined);
|
1697
897
|
}
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
if (!
|
1715
|
-
return of(
|
898
|
+
const owners$ = Object.values(this.flowInfoService.templates)
|
899
|
+
.map(template => {
|
900
|
+
var _a, _b, _c;
|
901
|
+
if (!template) {
|
902
|
+
return;
|
903
|
+
}
|
904
|
+
const localProcessors$ = (_c = (_b = (_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplateConfigurationProcessors) === null || _b === void 0 ? void 0 : _b.call(_a, template.name)) !== null && _c !== void 0 ? _c : of(null);
|
905
|
+
return localProcessors$.pipe(switchMap(processors => processors ? of(processors) : this.processorsApiService.fetchConfigurationProcessors$(template.id)), tap(processors => {
|
906
|
+
const processorsMap = processors.reduce((acc, p) => {
|
907
|
+
acc[p.apiName] = p;
|
908
|
+
return acc;
|
909
|
+
}, {});
|
910
|
+
this.processors[template.id] = processorsMap;
|
911
|
+
}));
|
912
|
+
})
|
913
|
+
.filter(isDefined);
|
914
|
+
if (!owners$.length) {
|
915
|
+
return of(undefined);
|
1716
916
|
}
|
1717
|
-
|
1718
|
-
updatedState.splice(currentLineItemIndex, 1, initialLineItem);
|
1719
|
-
return of([]).pipe(tap$1(() => {
|
1720
|
-
this.quoteDraftService.setCurrentLineItemState(updatedState);
|
1721
|
-
}), switchMap(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
|
917
|
+
return forkJoin(owners$).pipe(map(noop));
|
1722
918
|
}
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
return of(null);
|
919
|
+
executeActionScript(request, executable) {
|
920
|
+
var _a;
|
921
|
+
const configurationProcessor = (_a = this.processors[executable.ownerId]) === null || _a === void 0 ? void 0 : _a[executable.apiName];
|
922
|
+
if (!(configurationProcessor === null || configurationProcessor === void 0 ? void 0 : configurationProcessor.script)) {
|
923
|
+
const scope = this.getScopeByOwnerId(executable.ownerId);
|
924
|
+
const scopeText = scope ? ` in ${scope}` : '';
|
925
|
+
throw `ConfigurationProcessor ${executable.apiName}${scopeText} not found`;
|
1731
926
|
}
|
1732
|
-
return
|
1733
|
-
}
|
1734
|
-
delete(ids) {
|
1735
|
-
this.delete$(ids).subscribe();
|
927
|
+
return this.executeProcessorScript(request, configurationProcessor, executable.inputData);
|
1736
928
|
}
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
929
|
+
executeSelectorScript(request, executable) {
|
930
|
+
var _a;
|
931
|
+
const configurationProcessor = (_a = this.processors[executable.ownerId]) === null || _a === void 0 ? void 0 : _a[executable.apiName];
|
932
|
+
if (!(configurationProcessor === null || configurationProcessor === void 0 ? void 0 : configurationProcessor.script)) {
|
933
|
+
const scope = this.getScopeByOwnerId(executable.ownerId);
|
934
|
+
const scopeText = scope ? ` in ${scope}` : '';
|
935
|
+
throw `ConfigurationProcessor ${executable.apiName}${scopeText} not found`;
|
1741
936
|
}
|
1742
|
-
|
1743
|
-
return of([]).pipe(switchMap(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
|
937
|
+
return this.executeProcessorScript(request, configurationProcessor, executable.inputData);
|
1744
938
|
}
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
939
|
+
executeProcessorScript(request, configurationProcessor, inputData) {
|
940
|
+
var _a;
|
941
|
+
const scope = this.getScopeByOwnerId((_a = configurationProcessor.ownerId) !== null && _a !== void 0 ? _a : '');
|
942
|
+
let functionToExecute = this.executedFunctions[scope + configurationProcessor.apiName];
|
943
|
+
if (!functionToExecute) {
|
944
|
+
const script = `${configurationProcessor.script}\nreturn transform;`;
|
945
|
+
const sourceMap = `\n//# sourceURL=${scope ? scope + '/' : ''}${configurationProcessor.apiName}.js`;
|
946
|
+
functionToExecute = new Function(script + sourceMap)();
|
947
|
+
this.executedFunctions[scope + configurationProcessor.apiName] = functionToExecute;
|
1749
948
|
}
|
1750
|
-
return
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
return [...quoteDraft.currentState, ...lineItems];
|
1756
|
-
}), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
|
1757
|
-
}
|
1758
|
-
get() {
|
1759
|
-
return this.quoteDraftService.quoteDraft$.pipe(map$1(() => this.quoteDraftService.currentState), shareReplay$1());
|
1760
|
-
}
|
1761
|
-
getSnapshot() {
|
1762
|
-
var _a, _b;
|
1763
|
-
return (_b = (_a = this.quoteDraftService) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
|
1764
|
-
}
|
1765
|
-
get charges$() {
|
1766
|
-
return this.quoteDraftService.quoteDraft$.pipe(map$1(({ charges }) => charges));
|
1767
|
-
}
|
1768
|
-
get pricePlans$() {
|
1769
|
-
return this.quoteDraftService.quoteDraft$.pipe(map$1(({ pricePlans }) => pricePlans));
|
1770
|
-
}
|
1771
|
-
get activeMetrics$() {
|
1772
|
-
return this.quoteDraftService.quoteDraft$.pipe(map$1(({ activeMetrics }) => activeMetrics));
|
1773
|
-
}
|
1774
|
-
get chargesSnapshot() {
|
1775
|
-
var _a, _b;
|
1776
|
-
return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.charges) !== null && _b !== void 0 ? _b : {};
|
1777
|
-
}
|
1778
|
-
get pricePlansSnapshot() {
|
1779
|
-
var _a, _b;
|
1780
|
-
return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.pricePlans) !== null && _b !== void 0 ? _b : {};
|
1781
|
-
}
|
1782
|
-
get activeMetricsSnapshot() {
|
1783
|
-
var _a, _b;
|
1784
|
-
return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.activeMetrics) !== null && _b !== void 0 ? _b : [];
|
1785
|
-
}
|
1786
|
-
get contextSnapshot() {
|
1787
|
-
return this.contextService.resolve();
|
1788
|
-
}
|
1789
|
-
get context$() {
|
1790
|
-
return this.contextService.resolve$();
|
949
|
+
return functionToExecute({
|
950
|
+
request,
|
951
|
+
inputData,
|
952
|
+
flowStore: this.flowStore,
|
953
|
+
});
|
1791
954
|
}
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
console.error(error);
|
1796
|
-
// bounce back if configuration call has failed
|
1797
|
-
const quoteDraft = this.quoteDraftService.quoteDraft;
|
1798
|
-
if (quoteDraft) {
|
1799
|
-
this.quoteDraftService.updateQuoteDraft(quoteDraft);
|
1800
|
-
this.updatedSubj$.next();
|
1801
|
-
}
|
1802
|
-
return throwError(() => error);
|
1803
|
-
}));
|
1804
|
-
};
|
955
|
+
generateRequestId(scope, selectorName, inputData) {
|
956
|
+
const inputDataHash = UUID.hex(JSON.stringify(inputData) || '').slice(0, 8);
|
957
|
+
return `${scope}/${selectorName}/${inputDataHash}`;
|
1805
958
|
}
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
959
|
+
checkStatefulChanges(requestId, selectorResult) {
|
960
|
+
if (this.trackedStatefulChangesMap.has(requestId)) {
|
961
|
+
if (!this.initialStatefulData[requestId]) {
|
962
|
+
this.initialStatefulData[requestId] = selectorResult;
|
963
|
+
}
|
964
|
+
const hasChanges = !isEqual(this.initialStatefulData[requestId], selectorResult);
|
965
|
+
this.trackedStatefulChangesMap.set(requestId, hasChanges);
|
1812
966
|
}
|
1813
|
-
return this.proceduresApiService.apply$(request);
|
1814
967
|
}
|
1815
968
|
}
|
1816
|
-
|
1817
|
-
|
1818
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
969
|
+
FlowStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, deps: [{ token: FlowConfigurationService }, { token: FlowInfoService }, { token: i3.FlowStateApiService }, { token: i1.ConfigurationProcessorsApiService }, { token: i1.SalesTransactionApiService }, { token: SalesTransactionService }, { token: i6.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
970
|
+
FlowStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService });
|
971
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, decorators: [{
|
1819
972
|
type: Injectable
|
1820
|
-
}], ctorParameters: function () {
|
1821
|
-
|
1822
|
-
|
1823
|
-
}
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
type: NgModule,
|
1829
|
-
args: [{
|
1830
|
-
imports: [ApiModule],
|
1831
|
-
providers: [FlowConfigurationService, FlowUpdateService],
|
1832
|
-
}]
|
1833
|
-
}] });
|
973
|
+
}], ctorParameters: function () {
|
974
|
+
return [{ type: FlowConfigurationService }, { type: FlowInfoService }, { type: i3.FlowStateApiService }, { type: i1.ConfigurationProcessorsApiService }, { type: i1.SalesTransactionApiService }, { type: SalesTransactionService }, { type: i6.ToastService }, { type: undefined, decorators: [{
|
975
|
+
type: Optional
|
976
|
+
}, {
|
977
|
+
type: Inject,
|
978
|
+
args: [FLOW_CUSTOMIZATION]
|
979
|
+
}] }];
|
980
|
+
} });
|
1834
981
|
|
1835
982
|
class FlowStateConfigurationService {
|
1836
|
-
constructor(flowInfoService,
|
983
|
+
constructor(flowInfoService, flowStateService) {
|
1837
984
|
this.flowInfoService = flowInfoService;
|
1838
|
-
this.flowConfigurationService = flowConfigurationService;
|
1839
|
-
this.flowStateApiService = flowStateApiService;
|
1840
985
|
this.flowStateService = flowStateService;
|
1841
|
-
this.configurationStateId$ = new BehaviorSubject(null);
|
1842
|
-
}
|
1843
|
-
get configurationStateId() {
|
1844
|
-
return this.configurationStateId$.value;
|
1845
986
|
}
|
1846
987
|
addToCart$(props) {
|
1847
988
|
var _a;
|
@@ -1853,26 +994,22 @@ class FlowStateConfigurationService {
|
|
1853
994
|
request$ = of();
|
1854
995
|
}
|
1855
996
|
else {
|
1856
|
-
|
1857
|
-
request$ =
|
1858
|
-
if (!this.configurationStateId) {
|
1859
|
-
return of();
|
1860
|
-
}
|
1861
|
-
return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(tap$1(() => this.configurationStateId$.next(null)), map$1(noop));
|
1862
|
-
}));
|
997
|
+
// TODO: Implement
|
998
|
+
request$ = of();
|
1863
999
|
}
|
1864
1000
|
}
|
1865
1001
|
else {
|
1866
|
-
|
1002
|
+
// TODO: Implement
|
1003
|
+
request$ = of();
|
1867
1004
|
}
|
1868
|
-
return request$.pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), map
|
1005
|
+
return request$.pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), map(noop));
|
1869
1006
|
}
|
1870
1007
|
}
|
1871
|
-
FlowStateConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, deps: [{ token: FlowInfoService }, { token:
|
1008
|
+
FlowStateConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, deps: [{ token: FlowInfoService }, { token: FlowStateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1872
1009
|
FlowStateConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService });
|
1873
1010
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, decorators: [{
|
1874
1011
|
type: Injectable
|
1875
|
-
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type:
|
1012
|
+
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: FlowStateService }]; } });
|
1876
1013
|
|
1877
1014
|
class IntegrationState {
|
1878
1015
|
constructor() {
|
@@ -1892,12 +1029,12 @@ class IntegrationState {
|
|
1892
1029
|
this.action$.next(action);
|
1893
1030
|
}
|
1894
1031
|
listen$(actionType) {
|
1895
|
-
return this.action$.pipe(filter
|
1032
|
+
return this.action$.pipe(filter(action => action.type === actionType), map(action => action.payload));
|
1896
1033
|
}
|
1897
1034
|
listenAll$() {
|
1898
1035
|
return this.action$.asObservable();
|
1899
1036
|
}
|
1900
|
-
|
1037
|
+
reset() {
|
1901
1038
|
this.stateSubj$.next({});
|
1902
1039
|
}
|
1903
1040
|
}
|
@@ -1908,8 +1045,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
1908
1045
|
}] });
|
1909
1046
|
|
1910
1047
|
class ProductImagesService {
|
1911
|
-
constructor(
|
1912
|
-
this.
|
1048
|
+
constructor(productsAdminApiService) {
|
1049
|
+
this.productsAdminApiService = productsAdminApiService;
|
1913
1050
|
this.imagesMap$ = new BehaviorSubject({});
|
1914
1051
|
}
|
1915
1052
|
getImageUrl$(productId) {
|
@@ -1917,161 +1054,172 @@ class ProductImagesService {
|
|
1917
1054
|
this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: '' }));
|
1918
1055
|
this.fetchProductImage(productId);
|
1919
1056
|
}
|
1920
|
-
return this.imagesMap$.pipe(map
|
1057
|
+
return this.imagesMap$.pipe(map(imagesMap => { var _a; return (_a = imagesMap[productId]) !== null && _a !== void 0 ? _a : null; }), distinctUntilChanged());
|
1921
1058
|
}
|
1922
1059
|
fetchProductImage(productId) {
|
1923
|
-
this.
|
1060
|
+
this.productsAdminApiService
|
1924
1061
|
.fetchImage$(productId)
|
1925
|
-
.pipe(map
|
1062
|
+
.pipe(map(file => URL.createObjectURL(file)), catchError(() => of('')), tap(url => this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: url }))))
|
1926
1063
|
.subscribe();
|
1927
1064
|
}
|
1928
1065
|
}
|
1929
|
-
ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.
|
1066
|
+
ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductsAdminApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1930
1067
|
ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService });
|
1931
1068
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, decorators: [{
|
1932
1069
|
type: Injectable
|
1933
|
-
}], ctorParameters: function () { return [{ type: i1.
|
1070
|
+
}], ctorParameters: function () { return [{ type: i1.ProductsAdminApiService }]; } });
|
1934
1071
|
|
1935
|
-
class
|
1936
|
-
constructor(
|
1937
|
-
this.
|
1938
|
-
|
1939
|
-
getRuntimeContext(productId, offeringId, defaultUIDefinitionId, requiredUIDefinitionId) {
|
1940
|
-
return this.configurationApiService
|
1941
|
-
.getRuntimeDataByProductId(productId, offeringId, defaultUIDefinitionId, requiredUIDefinitionId)
|
1942
|
-
.pipe(map(runtimeData => {
|
1943
|
-
var _a;
|
1944
|
-
const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
|
1945
|
-
const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
|
1946
|
-
const { productName, properties } = (_a = Array.from(runtimeModel.components.values()).find(c => c.productId === productId)) !== null && _a !== void 0 ? _a : {};
|
1947
|
-
const uiDefinitionProperties = uiDefinitionContainer === null || uiDefinitionContainer === void 0 ? void 0 : uiDefinitionContainer.source.properties;
|
1948
|
-
return {
|
1949
|
-
modelId: runtimeData.modelId,
|
1950
|
-
uiDefinitionContainer: uiDefinitionContainer,
|
1951
|
-
runtimeModel: runtimeModel,
|
1952
|
-
runtimeMode: RuntimeMode.PROD,
|
1953
|
-
productId: productId,
|
1954
|
-
productType: (properties === null || properties === void 0 ? void 0 : properties['displayName']) || productName,
|
1955
|
-
offeringId: offeringId,
|
1956
|
-
properties: {
|
1957
|
-
PricingEnabled: (uiDefinitionProperties === null || uiDefinitionProperties === void 0 ? void 0 : uiDefinitionProperties.pricingEnabled) ? 'true' : 'false',
|
1958
|
-
PriceListId: uiDefinitionProperties === null || uiDefinitionProperties === void 0 ? void 0 : uiDefinitionProperties.priceList,
|
1959
|
-
},
|
1960
|
-
};
|
1961
|
-
}));
|
1072
|
+
class CatalogProductsService {
|
1073
|
+
constructor() {
|
1074
|
+
this.stateSubj$ = new BehaviorSubject(null);
|
1075
|
+
this.state$ = this.stateSubj$.asObservable().pipe(filter(isDefined));
|
1962
1076
|
}
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1077
|
+
get state() {
|
1078
|
+
return this.stateSubj$.getValue();
|
1079
|
+
}
|
1080
|
+
reset() {
|
1081
|
+
this.stateSubj$.next(null);
|
1082
|
+
}
|
1083
|
+
setState(state) {
|
1084
|
+
this.stateSubj$.next(state);
|
1967
1085
|
}
|
1968
1086
|
}
|
1969
|
-
|
1970
|
-
|
1971
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
1087
|
+
CatalogProductsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogProductsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1088
|
+
CatalogProductsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogProductsService });
|
1089
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: CatalogProductsService, decorators: [{
|
1972
1090
|
type: Injectable
|
1973
|
-
}]
|
1091
|
+
}] });
|
1974
1092
|
|
1975
|
-
class
|
1976
|
-
|
1977
|
-
this.
|
1978
|
-
this.contextService = contextService;
|
1979
|
-
this.runtimeContextService = runtimeContextService;
|
1980
|
-
this._isInitialized = false;
|
1981
|
-
this.uiDefinitionProperties = {};
|
1093
|
+
class ConfigurationService {
|
1094
|
+
get state$() {
|
1095
|
+
return this.configurationStateSubj$.asObservable().pipe(filter$1(isDefined));
|
1982
1096
|
}
|
1983
|
-
|
1984
|
-
this.
|
1985
|
-
this._runtimeContext = undefined;
|
1986
|
-
this.initializationProps = undefined;
|
1987
|
-
this.uiDefinitionProperties = {};
|
1097
|
+
get state() {
|
1098
|
+
return this.configurationStateSubj$.getValue();
|
1988
1099
|
}
|
1989
|
-
|
1100
|
+
get previousState() {
|
1101
|
+
return this.previousConfigurationStateSubj$.getValue();
|
1102
|
+
}
|
1103
|
+
get root$() {
|
1104
|
+
return this.state$.pipe(map$1(state => state.salesTransactionItems[0]), filter$1(isDefined));
|
1105
|
+
}
|
1106
|
+
get root() {
|
1990
1107
|
var _a, _b;
|
1991
|
-
|
1992
|
-
const uiDefinitionExternals = (_b = uiDefinitionContainer.source.externals) !== null && _b !== void 0 ? _b : {};
|
1993
|
-
return combineLatest([
|
1994
|
-
this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId),
|
1995
|
-
this.contextService.initTestMode(),
|
1996
|
-
]).pipe(first(), map(([runtimeData, context]) => {
|
1997
|
-
var _a;
|
1998
|
-
this.contextService.update({
|
1999
|
-
properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: uiDefinitionContainer.modelId, PricingEnabled: this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', PriceListId: this.uiDefinitionProperties.priceList, offeringId: this.uiDefinitionProperties.offeringId }), uiDefinitionExternals),
|
2000
|
-
});
|
2001
|
-
this._runtimeContext = {
|
2002
|
-
modelId: uiDefinitionContainer.modelId,
|
2003
|
-
runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
|
2004
|
-
runtimeMode: RuntimeMode.TEST,
|
2005
|
-
uiDefinitionContainer,
|
2006
|
-
};
|
2007
|
-
return this._runtimeContext;
|
2008
|
-
}), tap(() => (this._isInitialized = true)));
|
1108
|
+
return (_b = (_a = this.configurationStateSubj$.getValue()) === null || _a === void 0 ? void 0 : _a.salesTransactionItems[0]) !== null && _b !== void 0 ? _b : null;
|
2009
1109
|
}
|
2010
|
-
|
2011
|
-
this.
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2018
|
-
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
2026
|
-
}
|
2027
|
-
return this._runtimeContext;
|
2028
|
-
}), tap(() => (this._isInitialized = true)));
|
1110
|
+
constructor(flowInfoService, messageService, configurationRuntimeService, salesTransactionService, orchestrationsApiService) {
|
1111
|
+
this.flowInfoService = flowInfoService;
|
1112
|
+
this.messageService = messageService;
|
1113
|
+
this.configurationRuntimeService = configurationRuntimeService;
|
1114
|
+
this.salesTransactionService = salesTransactionService;
|
1115
|
+
this.orchestrationsApiService = orchestrationsApiService;
|
1116
|
+
this.hasUnsavedChanges = false;
|
1117
|
+
this.configurationStateSubj$ = new BehaviorSubject(null);
|
1118
|
+
this.previousConfigurationStateSubj$ = new BehaviorSubject(null);
|
1119
|
+
this.isLoadingSubj$ = new BehaviorSubject(false);
|
1120
|
+
this.isLoading$ = this.isLoadingSubj$.asObservable();
|
1121
|
+
}
|
1122
|
+
reset() {
|
1123
|
+
this.hasUnsavedChanges = false;
|
1124
|
+
this.configurationStateSubj$.next(null);
|
1125
|
+
this.previousConfigurationStateSubj$.next(null);
|
2029
1126
|
}
|
2030
|
-
|
1127
|
+
init$() {
|
2031
1128
|
var _a;
|
2032
|
-
|
2033
|
-
|
1129
|
+
const { state } = this.salesTransactionService;
|
1130
|
+
const { productId, transactionItemId } = this.flowInfoService.context;
|
1131
|
+
if (!state) {
|
1132
|
+
return of(undefined);
|
2034
1133
|
}
|
2035
|
-
|
2036
|
-
|
1134
|
+
let transactionItem = state === null || state === void 0 ? void 0 : state.salesTransactionItems.find(item => item.id === transactionItemId);
|
1135
|
+
if (!transactionItem && productId) {
|
1136
|
+
transactionItem =
|
1137
|
+
(_a = state.salesTransactionItems.find(item => item.productId === productId)) !== null && _a !== void 0 ? _a : generateTransactionItem(productId);
|
1138
|
+
}
|
1139
|
+
const configurationState = Object.assign(Object.assign({}, state), { salesTransactionItems: transactionItem ? [transactionItem] : [] });
|
1140
|
+
this.configurationStateSubj$.next(configurationState);
|
1141
|
+
this.previousConfigurationStateSubj$.next(configurationState);
|
1142
|
+
return of(undefined);
|
2037
1143
|
}
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
1144
|
+
patch$(transactionItem) {
|
1145
|
+
const { state, root } = this;
|
1146
|
+
if (!state) {
|
1147
|
+
return throwError(() => new Error(`Configuration State is not initialized`));
|
2041
1148
|
}
|
2042
|
-
|
2043
|
-
|
2044
|
-
source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
|
1149
|
+
if (!root) {
|
1150
|
+
return throwError(() => new Error(`Root SalesTransactionItem not found`));
|
2045
1151
|
}
|
1152
|
+
const newRoot = new TransactionItemWorker(root).replace(transactionItem).ti;
|
1153
|
+
const newSalesTransaction = Object.assign(Object.assign({}, state), { salesTransactionItems: [newRoot] });
|
1154
|
+
return this.configureRequest$(newSalesTransaction).pipe(catchError$1(error => {
|
1155
|
+
console.error(error);
|
1156
|
+
if (!this.configurationRuntimeService.uiDefinitionProps.suppressToastMessages) {
|
1157
|
+
this.messageService.add({ severity: 'error', summary: error });
|
1158
|
+
}
|
1159
|
+
return throwError(() => error);
|
1160
|
+
}), tap$1(() => {
|
1161
|
+
if (!this.hasUnsavedChanges) {
|
1162
|
+
this.hasUnsavedChanges = true;
|
1163
|
+
}
|
1164
|
+
}), map$1(noop));
|
2046
1165
|
}
|
2047
|
-
|
2048
|
-
|
1166
|
+
patch(transactionItem) {
|
1167
|
+
this.patch$(transactionItem).subscribe();
|
2049
1168
|
}
|
2050
|
-
|
2051
|
-
|
2052
|
-
|
1169
|
+
configureRequest$(salesTransaction) {
|
1170
|
+
const request = {
|
1171
|
+
salesTransaction,
|
1172
|
+
};
|
1173
|
+
this.isLoadingSubj$.next(true);
|
1174
|
+
return this.orchestrationsApiService.apply$(request).pipe(tap$1(result => {
|
1175
|
+
const newState = result.salesTransaction;
|
1176
|
+
this.configurationStateSubj$.next(newState);
|
1177
|
+
this.previousConfigurationStateSubj$.next(cloneDeep(newState));
|
1178
|
+
}), map$1(response => response.salesTransaction), catchError$1(error => throwError(() => {
|
1179
|
+
const resetState = this.previousConfigurationStateSubj$.getValue();
|
1180
|
+
if (resetState) {
|
1181
|
+
this.previousConfigurationStateSubj$.next(cloneDeep(resetState));
|
1182
|
+
this.configurationStateSubj$.next(resetState);
|
1183
|
+
}
|
1184
|
+
if (error.error) {
|
1185
|
+
return extractErrorDetails(error.error).join('. ');
|
1186
|
+
}
|
1187
|
+
return error.message || JSON.stringify(error);
|
1188
|
+
})), finalize$1(() => this.isLoadingSubj$.next(false)));
|
1189
|
+
}
|
1190
|
+
configureExternal$(props) {
|
1191
|
+
// TODO: implement
|
1192
|
+
throw new Error('Not implemented');
|
2053
1193
|
}
|
2054
|
-
|
2055
|
-
|
1194
|
+
configureGuidedSelling$(data) {
|
1195
|
+
// TODO: implement
|
1196
|
+
throw new Error('Not implemented');
|
1197
|
+
}
|
1198
|
+
getPCMModel() {
|
1199
|
+
const pcmModel = this.configurationRuntimeService.pcmModel;
|
1200
|
+
if (!pcmModel) {
|
1201
|
+
throw new Error('PCM model not initialized');
|
1202
|
+
}
|
1203
|
+
return pcmModel;
|
2056
1204
|
}
|
2057
1205
|
}
|
2058
|
-
|
2059
|
-
|
2060
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
1206
|
+
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, deps: [{ token: FlowInfoService }, { token: i2.MessageService }, { token: ConfigurationRuntimeService }, { token: SalesTransactionService }, { token: i1.OrchestrationsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1207
|
+
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService });
|
1208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, decorators: [{
|
2061
1209
|
type: Injectable
|
2062
|
-
}], ctorParameters: function () { return [{ type:
|
1210
|
+
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: i2.MessageService }, { type: ConfigurationRuntimeService }, { type: SalesTransactionService }, { type: i1.OrchestrationsApiService }]; } });
|
2063
1211
|
|
2064
1212
|
class ConfigurationStateService {
|
2065
|
-
constructor(configurationRuntimeService, configurationService,
|
1213
|
+
constructor(configurationRuntimeService, configurationService, flowStateService, flowInfoService, flowConfigurationService, flowStateApiService, salesTransactionService, salesTransactionApiService, toastService) {
|
2066
1214
|
this.configurationRuntimeService = configurationRuntimeService;
|
2067
1215
|
this.configurationService = configurationService;
|
2068
|
-
this.quoteDraftService = quoteDraftService;
|
2069
|
-
this.toastService = toastService;
|
2070
1216
|
this.flowStateService = flowStateService;
|
2071
1217
|
this.flowInfoService = flowInfoService;
|
2072
1218
|
this.flowConfigurationService = flowConfigurationService;
|
2073
1219
|
this.flowStateApiService = flowStateApiService;
|
2074
|
-
this.
|
1220
|
+
this.salesTransactionService = salesTransactionService;
|
1221
|
+
this.salesTransactionApiService = salesTransactionApiService;
|
1222
|
+
this.toastService = toastService;
|
2075
1223
|
this.isInitialized$ = new BehaviorSubject(false);
|
2076
1224
|
this.canceledConfiguration$ = new Subject();
|
2077
1225
|
this.NOT_INITIALIZED = Symbol();
|
@@ -2095,9 +1243,9 @@ class ConfigurationStateService {
|
|
2095
1243
|
request$ = this.initStateful$();
|
2096
1244
|
}
|
2097
1245
|
else {
|
2098
|
-
request$ = this.
|
1246
|
+
request$ = this.configurationService.init$();
|
2099
1247
|
}
|
2100
|
-
return request$.pipe(
|
1248
|
+
return request$.pipe(take(1), tap(() => {
|
2101
1249
|
this.isInitialized$.next(true);
|
2102
1250
|
this.canceledConfiguration$ = new Subject();
|
2103
1251
|
}));
|
@@ -2111,10 +1259,11 @@ class ConfigurationStateService {
|
|
2111
1259
|
this.configurationStore = {};
|
2112
1260
|
this.executedFunctions = {};
|
2113
1261
|
this.configurationService.reset();
|
1262
|
+
this.configurationRuntimeService.reset();
|
2114
1263
|
}
|
2115
1264
|
execute$(exec) {
|
2116
1265
|
const request = this.execToRequest(exec);
|
2117
|
-
return this.executeRequest$(request).pipe(map
|
1266
|
+
return this.executeRequest$(request).pipe(map(result => {
|
2118
1267
|
// Keep only requested results
|
2119
1268
|
const actualSelectors = Object.entries(result.selectors).reduce((trunk, [requestId, result]) => {
|
2120
1269
|
var _a;
|
@@ -2137,7 +1286,7 @@ class ConfigurationStateService {
|
|
2137
1286
|
}
|
2138
1287
|
// prevent parallel configuration requests in stateless mode
|
2139
1288
|
if (!this.statelessExecutionRequest$) {
|
2140
|
-
this.statelessExecutionRequest$ = executionRequest$.pipe(shareReplay
|
1289
|
+
this.statelessExecutionRequest$ = executionRequest$.pipe(shareReplay(), take(1), finalize(() => (this.statelessExecutionRequest$ = null)));
|
2141
1290
|
}
|
2142
1291
|
return this.statelessExecutionRequest$;
|
2143
1292
|
}
|
@@ -2151,7 +1300,7 @@ class ConfigurationStateService {
|
|
2151
1300
|
},
|
2152
1301
|
},
|
2153
1302
|
});
|
2154
|
-
return this.executeRequest$(request).pipe(map
|
1303
|
+
return this.executeRequest$(request).pipe(map(response => response.selectors[requestId]));
|
2155
1304
|
}
|
2156
1305
|
subscribe$(selectorName, inputData = {}, options) {
|
2157
1306
|
const requestId = UUID.UUID();
|
@@ -2174,58 +1323,41 @@ class ConfigurationStateService {
|
|
2174
1323
|
this.executeRequest$(request).subscribe();
|
2175
1324
|
}
|
2176
1325
|
}
|
2177
|
-
return subscription.data$.pipe(filter
|
1326
|
+
return subscription.data$.pipe(filter(data => data != this.NOT_INITIALIZED), map(data => data), distinctUntilChanged(), finalize(() => {
|
2178
1327
|
var _a;
|
2179
1328
|
if (!((_a = this.subscriptions[requestId]) === null || _a === void 0 ? void 0 : _a.data$.observed)) {
|
2180
1329
|
delete this.subscriptions[requestId];
|
2181
1330
|
}
|
2182
1331
|
}), takeUntil(this.canceledConfiguration$));
|
2183
1332
|
}
|
2184
|
-
saveConfiguration(
|
2185
|
-
var _a, _b
|
1333
|
+
saveConfiguration() {
|
1334
|
+
var _a, _b;
|
2186
1335
|
if (this.isStatefulConfiguration) {
|
2187
|
-
return this.flowStateApiService
|
2188
|
-
|
2189
|
-
|
1336
|
+
return this.flowStateApiService.saveConfiguration((_a = this.flowStateService.stateId) !== null && _a !== void 0 ? _a : '', (_b = this.stateId) !== null && _b !== void 0 ? _b : '').pipe(switchMap(r => this.flowStateService.executeRequest$({}, true).pipe(map(() => r))), map(r => ({ id: r.quoteId })));
|
1337
|
+
}
|
1338
|
+
const state = this.salesTransactionService.state;
|
1339
|
+
if (!state) {
|
1340
|
+
return of({ id: '' });
|
1341
|
+
}
|
1342
|
+
const { standalone } = this.flowInfoService.flow.properties;
|
1343
|
+
if (standalone) {
|
1344
|
+
return this.salesTransactionApiService.upsert(state);
|
1345
|
+
}
|
1346
|
+
const salesTransaction = this.salesTransactionService.state;
|
1347
|
+
const configurationRoot = this.configurationService.root;
|
1348
|
+
if (!salesTransaction || !configurationRoot) {
|
1349
|
+
return of({ id: '' });
|
1350
|
+
}
|
1351
|
+
const isNewTransactionItem = salesTransaction.salesTransactionItems.every(li => li.id !== configurationRoot.id);
|
1352
|
+
let salesTransactionItems;
|
1353
|
+
if (isNewTransactionItem) {
|
1354
|
+
salesTransactionItems = [...salesTransaction.salesTransactionItems, configurationRoot];
|
2190
1355
|
}
|
2191
1356
|
else {
|
2192
|
-
|
2193
|
-
const quoteDraft = this.quoteDraftService.quoteDraft;
|
2194
|
-
if (!quoteDraft) {
|
2195
|
-
return of({ quoteId: '' });
|
2196
|
-
}
|
2197
|
-
const rootLineItem = this.configurationService.getSnapshot();
|
2198
|
-
const asset = this.configurationService.getAsset();
|
2199
|
-
const currentState = rootLineItem ? [rootLineItem] : [];
|
2200
|
-
const initialState = asset ? [asset] : [];
|
2201
|
-
return this.quoteApiService.upsertQuote(Object.assign(Object.assign({}, quoteDraft), { currentState, initialState }));
|
2202
|
-
}
|
2203
|
-
else {
|
2204
|
-
const quoteDraft = this.quoteDraftService.quoteDraft;
|
2205
|
-
const lineItem = this.configurationService.getSnapshot();
|
2206
|
-
if (!quoteDraft || !lineItem) {
|
2207
|
-
return of({ quoteId: '' });
|
2208
|
-
}
|
2209
|
-
const isNewLineItem = quoteDraft.currentState.every(li => li.id !== lineItem.id);
|
2210
|
-
let currentState;
|
2211
|
-
if (isNewLineItem) {
|
2212
|
-
currentState = [...quoteDraft.currentState, lineItem];
|
2213
|
-
}
|
2214
|
-
else {
|
2215
|
-
currentState = quoteDraft.currentState.map(li => (li.id === lineItem.id ? lineItem : li));
|
2216
|
-
}
|
2217
|
-
const asset = this.configurationService.getAsset();
|
2218
|
-
const initialState = [...((_d = (_c = this.quoteDraftService.quoteDraft) === null || _c === void 0 ? void 0 : _c.initialState) !== null && _d !== void 0 ? _d : [])];
|
2219
|
-
if (asset) {
|
2220
|
-
if (!initialState.some(li => li.id === asset.id)) {
|
2221
|
-
initialState.push(asset);
|
2222
|
-
}
|
2223
|
-
}
|
2224
|
-
return this.flowConfigurationService
|
2225
|
-
.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState, initialState }))
|
2226
|
-
.pipe(map$1(() => ({ quoteId: '' })));
|
2227
|
-
}
|
1357
|
+
salesTransactionItems = salesTransaction.salesTransactionItems.map(ti => ti.id === configurationRoot.id ? configurationRoot : ti);
|
2228
1358
|
}
|
1359
|
+
const newState = Object.assign(Object.assign({}, salesTransaction), { salesTransactionItems });
|
1360
|
+
return this.flowConfigurationService.calculate$(newState).pipe(map(() => ({ id: '' })));
|
2229
1361
|
}
|
2230
1362
|
cancelConfiguration() {
|
2231
1363
|
var _a, _b;
|
@@ -2246,37 +1378,33 @@ class ConfigurationStateService {
|
|
2246
1378
|
return (_b = (_a = this.flowInfoService.flow) === null || _a === void 0 ? void 0 : _a.properties.stateful) !== null && _b !== void 0 ? _b : false;
|
2247
1379
|
}
|
2248
1380
|
initStateful$() {
|
2249
|
-
var _a, _b, _c, _d, _e, _f
|
2250
|
-
this.ownerId = (
|
2251
|
-
const
|
2252
|
-
if (!this.flowStateService.stateId) {
|
1381
|
+
var _a, _b, _c, _d, _e, _f;
|
1382
|
+
this.ownerId = (_b = (_a = this.configurationRuntimeService.uiDefinitionContainer) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '';
|
1383
|
+
const { productId, transactionItemId } = this.flowInfoService.context;
|
1384
|
+
if (!productId || !this.flowStateService.stateId) {
|
2253
1385
|
return of(undefined);
|
2254
1386
|
}
|
2255
|
-
const container =
|
2256
|
-
const lineItem = this.configurationService.generateLineItem();
|
1387
|
+
const container = this.configurationRuntimeService.uiDefinitionContainer;
|
2257
1388
|
let request$;
|
2258
|
-
if (!
|
1389
|
+
if (!transactionItemId) {
|
2259
1390
|
request$ = this.flowStateApiService.newConfiguration(this.flowStateService.stateId, {
|
2260
|
-
|
2261
|
-
actionsOverride: (
|
2262
|
-
selectorsOverride: (
|
1391
|
+
transactionItem: generateTransactionItem(productId),
|
1392
|
+
actionsOverride: (_c = container === null || container === void 0 ? void 0 : container.actions) === null || _c === void 0 ? void 0 : _c.map(processor => (Object.assign(Object.assign({}, processor), { ownerId: this.ownerId }))),
|
1393
|
+
selectorsOverride: (_d = container === null || container === void 0 ? void 0 : container.selectors) === null || _d === void 0 ? void 0 : _d.map(processor => (Object.assign(Object.assign({}, processor), { ownerId: this.ownerId }))),
|
2263
1394
|
});
|
2264
1395
|
}
|
2265
1396
|
else {
|
2266
1397
|
request$ = this.flowStateApiService.startConfiguration(this.flowStateService.stateId, {
|
2267
|
-
|
2268
|
-
actionsOverride: (
|
2269
|
-
selectorsOverride: (
|
1398
|
+
transactionItemId,
|
1399
|
+
actionsOverride: (_e = container === null || container === void 0 ? void 0 : container.actions) === null || _e === void 0 ? void 0 : _e.map(processor => (Object.assign(Object.assign({}, processor), { ownerId: this.ownerId }))),
|
1400
|
+
selectorsOverride: (_f = container === null || container === void 0 ? void 0 : container.selectors) === null || _f === void 0 ? void 0 : _f.map(processor => (Object.assign(Object.assign({}, processor), { ownerId: this.ownerId }))),
|
2270
1401
|
});
|
2271
1402
|
}
|
2272
|
-
return request$.pipe(map
|
1403
|
+
return request$.pipe(map(r => {
|
2273
1404
|
this.stateId = r.stateId;
|
2274
1405
|
return undefined;
|
2275
1406
|
}));
|
2276
1407
|
}
|
2277
|
-
initStateless$() {
|
2278
|
-
return this.configurationService.configure().pipe(map$1(() => undefined));
|
2279
|
-
}
|
2280
1408
|
execToRequest(exec) {
|
2281
1409
|
var _a;
|
2282
1410
|
return {
|
@@ -2322,39 +1450,37 @@ class ConfigurationStateService {
|
|
2322
1450
|
else {
|
2323
1451
|
execution$ = this.executeStateless$(fullRequest);
|
2324
1452
|
}
|
2325
|
-
return execution$.pipe(tap
|
1453
|
+
return execution$.pipe(tap(result => this.handleSelectorsResponse(result.selectors)));
|
2326
1454
|
}
|
2327
1455
|
executeStateless$(request) {
|
2328
1456
|
this.executionInProgress$.next(true);
|
2329
|
-
return
|
1457
|
+
return this.configurationService.state$.pipe(first(), switchMap(state => {
|
2330
1458
|
var _a;
|
2331
1459
|
// Apply actions and execute configuration/price call
|
2332
1460
|
// No need to run configuration if no actions in the request
|
2333
1461
|
if (!((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length)) {
|
2334
1462
|
return of(undefined);
|
2335
1463
|
}
|
2336
|
-
let configurationRequest = this.configurationService.generateRequest(false);
|
2337
1464
|
request.actions.forEach(action => {
|
2338
1465
|
var _a;
|
2339
|
-
|
1466
|
+
state = (_a = this.executeActionScript(state, action)) !== null && _a !== void 0 ? _a : state;
|
2340
1467
|
});
|
2341
|
-
|
2342
|
-
|
2343
|
-
}), map$1(() => {
|
1468
|
+
return this.configurationService.configureRequest$(state);
|
1469
|
+
}), map(() => {
|
2344
1470
|
// Run selectors and apply them to the state
|
2345
|
-
const configurationState = this.configurationService.
|
1471
|
+
const configurationState = this.configurationService.state;
|
2346
1472
|
if (!configurationState) {
|
2347
1473
|
return { stateId: '', selectors: {} };
|
2348
1474
|
}
|
2349
1475
|
return this.runStatelessSelectors(request, configurationState);
|
2350
|
-
}), tap
|
2351
|
-
const configurationState = this.configurationService.
|
1476
|
+
}), tap(() => this.executionInProgress$.next(false)), catchError(error => {
|
1477
|
+
const configurationState = this.configurationService.previousState;
|
2352
1478
|
if (configurationState) {
|
2353
1479
|
const selectorsResult = this.runStatelessSelectors(request, configurationState);
|
2354
1480
|
this.handleSelectorsResponse(selectorsResult.selectors);
|
2355
1481
|
}
|
2356
1482
|
this.executionInProgress$.next(false);
|
2357
|
-
if (!this.configurationRuntimeService.
|
1483
|
+
if (!this.configurationRuntimeService.uiDefinitionProps.suppressToastMessages) {
|
2358
1484
|
this.toastService.add({ severity: ToastType.error, summary: String(error) });
|
2359
1485
|
}
|
2360
1486
|
return throwError(() => error);
|
@@ -2375,22 +1501,22 @@ class ConfigurationStateService {
|
|
2375
1501
|
};
|
2376
1502
|
this.executionInProgress$.next(true);
|
2377
1503
|
return this.flowStateApiService.executeConfiguration(this.flowStateService.stateId, this.stateId, request);
|
2378
|
-
}), tap
|
1504
|
+
}), tap(({ stateId }) => (this.stateId = stateId)), share(), tap(() => this.executionInProgress$.next(false)), catchError(e => {
|
2379
1505
|
this.executionInProgress$.next(false);
|
2380
1506
|
return throwError(() => e);
|
2381
1507
|
}));
|
2382
1508
|
}
|
2383
1509
|
executeStateful$(request) {
|
2384
|
-
return this.executionInProgress$.pipe(filter
|
1510
|
+
return this.executionInProgress$.pipe(filter(inProgress => !inProgress), take(1), switchMap(() =>
|
2385
1511
|
// make sure stream switches to statefulExecutionRequest$ before pushing an execution request
|
2386
1512
|
combineLatest([
|
2387
1513
|
this.statefulExecutionRequest$,
|
2388
|
-
of(undefined).pipe(tap
|
2389
|
-
])), map
|
1514
|
+
of(undefined).pipe(tap(() => this.statefulRequestStream$.next(request))),
|
1515
|
+
])), map(([response]) => response), take(1));
|
2390
1516
|
}
|
2391
1517
|
executeActionScript(request, processor) {
|
2392
|
-
var _a
|
2393
|
-
const { actions } = (
|
1518
|
+
var _a;
|
1519
|
+
const { actions } = (_a = this.configurationRuntimeService.uiDefinitionContainer) !== null && _a !== void 0 ? _a : {};
|
2394
1520
|
const configurationProcessor = actions === null || actions === void 0 ? void 0 : actions.find(action => action.apiName === processor.apiName);
|
2395
1521
|
if (!(configurationProcessor === null || configurationProcessor === void 0 ? void 0 : configurationProcessor.script)) {
|
2396
1522
|
throw `ConfigurationProcessor ${processor.apiName} not found`;
|
@@ -2398,8 +1524,8 @@ class ConfigurationStateService {
|
|
2398
1524
|
return this.executeProcessorScript(request, configurationProcessor, processor.inputData);
|
2399
1525
|
}
|
2400
1526
|
executeSelectorScript(request, processor) {
|
2401
|
-
var _a
|
2402
|
-
const { selectors } = (
|
1527
|
+
var _a;
|
1528
|
+
const { selectors } = (_a = this.configurationRuntimeService.uiDefinitionContainer) !== null && _a !== void 0 ? _a : {};
|
2403
1529
|
const configurationProcessor = selectors === null || selectors === void 0 ? void 0 : selectors.find(selector => selector.apiName === processor.apiName);
|
2404
1530
|
if (!(configurationProcessor === null || configurationProcessor === void 0 ? void 0 : configurationProcessor.script)) {
|
2405
1531
|
throw `ConfigurationProcessor ${processor.apiName} not found`;
|
@@ -2441,25 +1567,52 @@ class ConfigurationStateService {
|
|
2441
1567
|
}, { stateId: '', selectors: {} });
|
2442
1568
|
}
|
2443
1569
|
}
|
2444
|
-
ConfigurationStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService, deps: [{ token: ConfigurationRuntimeService }, { token: ConfigurationService }, { token:
|
1570
|
+
ConfigurationStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService, deps: [{ token: ConfigurationRuntimeService }, { token: ConfigurationService }, { token: FlowStateService }, { token: FlowInfoService }, { token: FlowConfigurationService }, { token: i3.FlowStateApiService }, { token: SalesTransactionService }, { token: i1.SalesTransactionApiService }, { token: i6.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
2445
1571
|
ConfigurationStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService });
|
2446
1572
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService, decorators: [{
|
2447
1573
|
type: Injectable
|
2448
|
-
}], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type:
|
1574
|
+
}], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type: FlowStateService }, { type: FlowInfoService }, { type: FlowConfigurationService }, { type: i3.FlowStateApiService }, { type: SalesTransactionService }, { type: i1.SalesTransactionApiService }, { type: i6.ToastService }]; } });
|
2449
1575
|
|
2450
1576
|
class ConfigurationModule {
|
2451
1577
|
}
|
2452
1578
|
ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
2453
1579
|
ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule, ApiModule] });
|
2454
|
-
ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, providers: [
|
1580
|
+
ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, providers: [
|
1581
|
+
ConfigurationService,
|
1582
|
+
ConfigurationStateService,
|
1583
|
+
ConfigurationRuntimeService,
|
1584
|
+
TestModeConfigurationService,
|
1585
|
+
], imports: [ConfirmationDialogModule, ApiModule] });
|
2455
1586
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, decorators: [{
|
2456
1587
|
type: NgModule,
|
2457
1588
|
args: [{
|
2458
1589
|
imports: [ConfirmationDialogModule, ApiModule],
|
2459
|
-
providers: [
|
1590
|
+
providers: [
|
1591
|
+
ConfigurationService,
|
1592
|
+
ConfigurationStateService,
|
1593
|
+
ConfigurationRuntimeService,
|
1594
|
+
TestModeConfigurationService,
|
1595
|
+
],
|
1596
|
+
}]
|
1597
|
+
}] });
|
1598
|
+
|
1599
|
+
class FlowConfigurationModule {
|
1600
|
+
}
|
1601
|
+
FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1602
|
+
FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, imports: [ApiModule] });
|
1603
|
+
FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService], imports: [ApiModule] });
|
1604
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, decorators: [{
|
1605
|
+
type: NgModule,
|
1606
|
+
args: [{
|
1607
|
+
imports: [ApiModule],
|
1608
|
+
providers: [FlowConfigurationService],
|
2460
1609
|
}]
|
2461
1610
|
}] });
|
2462
1611
|
|
1612
|
+
const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
|
1613
|
+
|
1614
|
+
const UI_DEFINITION_VERSION = 3;
|
1615
|
+
|
2463
1616
|
const DEFAULT_FORMATTING_SETTINGS = {
|
2464
1617
|
currencySymbol: DEFAULT_CURRENCY_SYMBOL,
|
2465
1618
|
decimalsCount: DEFAULT_DECIMALS_COUNT,
|
@@ -2473,14 +1626,14 @@ class SdkCoreModule {
|
|
2473
1626
|
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
2474
1627
|
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
2475
1628
|
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, providers: [
|
2476
|
-
ContextService,
|
2477
1629
|
FlowInfoService,
|
2478
|
-
QuoteDraftService,
|
2479
1630
|
ProductImagesService,
|
2480
1631
|
IntegrationState,
|
2481
1632
|
FlowStateService,
|
2482
1633
|
FlowStateConfigurationService,
|
2483
1634
|
RuntimeSettingsService,
|
1635
|
+
SalesTransactionService,
|
1636
|
+
CatalogProductsService,
|
2484
1637
|
{
|
2485
1638
|
provide: FORMATTING_SETTINGS_TOKEN,
|
2486
1639
|
useExisting: RuntimeSettingsService,
|
@@ -2491,14 +1644,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2491
1644
|
args: [{
|
2492
1645
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
2493
1646
|
providers: [
|
2494
|
-
ContextService,
|
2495
1647
|
FlowInfoService,
|
2496
|
-
QuoteDraftService,
|
2497
1648
|
ProductImagesService,
|
2498
1649
|
IntegrationState,
|
2499
1650
|
FlowStateService,
|
2500
1651
|
FlowStateConfigurationService,
|
2501
1652
|
RuntimeSettingsService,
|
1653
|
+
SalesTransactionService,
|
1654
|
+
CatalogProductsService,
|
2502
1655
|
{
|
2503
1656
|
provide: FORMATTING_SETTINGS_TOKEN,
|
2504
1657
|
useExisting: RuntimeSettingsService,
|
@@ -2556,6 +1709,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2556
1709
|
}]
|
2557
1710
|
}] });
|
2558
1711
|
|
1712
|
+
function filterSuccessfulExecute() {
|
1713
|
+
return (source) => source.pipe(filter((result) => result.success), map(r => r.result));
|
1714
|
+
}
|
1715
|
+
|
2559
1716
|
class DatePipe {
|
2560
1717
|
constructor() {
|
2561
1718
|
var _a;
|
@@ -2683,5 +1840,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2683
1840
|
* Generated bundle index. Do not edit.
|
2684
1841
|
*/
|
2685
1842
|
|
2686
|
-
export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationStateService,
|
1843
|
+
export { ActionCodePipe, CalendarDirective, CatalogProductsService, ConfigurationRuntimeService, ConfigurationService, ConfigurationStateService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FLOW_CUSTOMIZATION, FORMATTING_SETTINGS_TOKEN, FlowConfigurationService, FlowInfoService, FlowStateConfigurationService, FlowStateService, IntegrationState, NumberPipe, PricePipe, ProductImagesService, RuntimeSettingsService, SalesTransactionService, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, TestModeConfigurationService, TransactionItemWorker, UI_DEFINITION_VERSION, extractMetadata, filterSuccessfulExecute, findTransactionItem, findTransactionItemWithComparator, generateTransactionItem, insertTransactionItem, removeTransactionItem, replaceTransactionItem };
|
2687
1844
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|