@veloceapps/sdk 11.0.0-16 → 11.0.0-17
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 +98 -22
- 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 +4 -27
- package/core/index.d.ts +0 -1
- package/core/modules/configuration/index.d.ts +1 -4
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +3 -20
- package/core/modules/configuration/services/configuration-state.service.d.ts +3 -3
- package/core/modules/configuration/services/configuration.service.d.ts +23 -46
- package/core/modules/flow-configuration/index.d.ts +0 -3
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +5 -13
- package/core/services/flow-info.service.d.ts +3 -2
- package/core/services/flow-state-configuration.service.d.ts +2 -8
- package/core/services/flow-state.service.d.ts +6 -12
- package/core/services/index.d.ts +0 -1
- package/core/services/integration.state.d.ts +1 -1
- package/core/services/sales-transaction.service.d.ts +4 -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 +99 -65
- 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/path.utils.mjs +1 -10
- package/esm2020/cms/vendor-map.mjs +4 -5
- package/esm2020/core/core.module.mjs +4 -5
- package/esm2020/core/index.mjs +1 -2
- package/esm2020/core/modules/configuration/configuration.module.mjs +3 -4
- package/esm2020/core/modules/configuration/index.mjs +2 -5
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +9 -67
- package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +46 -54
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +96 -226
- 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 +15 -32
- package/esm2020/core/services/flow-info.service.mjs +9 -3
- package/esm2020/core/services/flow-state-configuration.service.mjs +10 -25
- package/esm2020/core/services/flow-state.service.mjs +25 -58
- package/esm2020/core/services/index.mjs +1 -2
- package/esm2020/core/services/integration.state.mjs +2 -2
- package/esm2020/core/services/sales-transaction.service.mjs +11 -5
- 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/flow-routing.module.mjs +8 -8
- package/esm2020/src/guards/flow.guard.mjs +5 -7
- package/esm2020/src/guards/product-unload.guard.mjs +7 -7
- package/esm2020/src/index.mjs +1 -2
- package/esm2020/src/pages/debug/debug.component.mjs +10 -15
- package/esm2020/src/pages/product/product.component.mjs +11 -14
- package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +5 -6
- package/esm2020/src/resolvers/sales-transaction.resolver.mjs +83 -0
- package/esm2020/src/resolvers/ui-definition.resolver.mjs +5 -4
- package/esm2020/src/services/flow-dialog.service.mjs +1 -1
- package/esm2020/src/services/flow-router.service.mjs +17 -24
- package/esm2020/src/services/flow.service.mjs +5 -13
- package/esm2020/src/types/index.mjs +2 -3
- package/esm2020/src/types/route.types.mjs +1 -1
- package/fesm2015/veloceapps-sdk-cms.mjs +116 -252
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +318 -1116
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +87 -120
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +112 -244
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +366 -1162
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +87 -120
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/src/guards/product-unload.guard.d.ts +3 -3
- package/src/index.d.ts +0 -1
- package/src/pages/debug/debug.component.d.ts +1 -3
- package/src/pages/product/product.component.d.ts +3 -4
- package/src/pages/record-not-found/record-not-found.component.d.ts +2 -3
- package/src/resolvers/sales-transaction.resolver.d.ts +18 -0
- package/src/services/flow-dialog.service.d.ts +2 -1
- package/src/services/flow-router.service.d.ts +5 -5
- package/src/services/flow.service.d.ts +0 -1
- 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 -7
- package/core/modules/configuration/services/runtime-context.service.d.ts +0 -12
- package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -8
- 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/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 -67
- package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +0 -45
- package/esm2020/core/modules/configuration/types/configuration-runtime.types.mjs +0 -2
- 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/quote-draft.service.mjs +0 -174
- 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/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 -14
- package/esm2020/src/utils/index.mjs +0 -2
- package/src/resolvers/quote.resolver.d.ts +0 -18
- 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 -1
- package/src/utils/index.d.ts +0 -1
|
@@ -1,419 +1,97 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { map, first, tap, filter, switchMap as switchMap$1, skip, take, shareReplay, catchError as catchError$1, finalize as finalize$1 } from 'rxjs/operators';
|
|
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';
|
|
5
4
|
import * as i1 from '@veloceapps/api';
|
|
6
5
|
import { ApiModule } from '@veloceapps/api';
|
|
7
|
-
import { HttpErrorResponse } from '@angular/common/http';
|
|
8
6
|
import * as i6 from '@veloceapps/components';
|
|
9
|
-
import { ToastType,
|
|
10
|
-
import { flatten,
|
|
11
|
-
import { BehaviorSubject, map
|
|
12
|
-
import
|
|
13
|
-
import * as i4 from '
|
|
14
|
-
import * as
|
|
15
|
-
import moment from 'moment';
|
|
7
|
+
import { ToastType, ConfirmationDialogModule } from '@veloceapps/components';
|
|
8
|
+
import { flatten, omit, uniqBy, cloneDeep, assign, isEqual } from 'lodash';
|
|
9
|
+
import { BehaviorSubject, map, tap, switchMap, of, forkJoin, filter, Subject, noop, catchError, throwError, combineLatest, finalize, buffer, debounceTime, share, take, distinctUntilChanged, shareReplay, takeUntil } from 'rxjs';
|
|
10
|
+
import { filter as filter$1, map as map$1, catchError as catchError$1, tap as tap$1, finalize as finalize$1 } from 'rxjs/operators';
|
|
11
|
+
import * as i4 from '@veloceapps/api/v2';
|
|
12
|
+
import * as i2 from 'primeng/api';
|
|
16
13
|
import { NgControl } from '@angular/forms';
|
|
17
14
|
import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
|
|
18
15
|
|
|
19
|
-
const getDefaultLineItem = (context, uiDefinitionProperties, qty = 1) => {
|
|
20
|
-
var _a, _b, _c;
|
|
21
|
-
const id = UUID.UUID();
|
|
22
|
-
const attributes = [];
|
|
23
|
-
const lineItems = [];
|
|
24
|
-
return Object.assign({ id, type: (_a = uiDefinitionProperties.rootType) !== null && _a !== void 0 ? _a : '', cfgStatus: 'Default', actionCode: 'ADD', qty,
|
|
25
|
-
attributes,
|
|
26
|
-
lineItems, productName: ((_b = context.properties) === null || _b === void 0 ? void 0 : _b['displayName']) || context.productName, productId: (_c = context.productId) !== null && _c !== void 0 ? _c : '' }, (uiDefinitionProperties.offeringId ? { offeringId: uiDefinitionProperties.offeringId } : {}));
|
|
27
|
-
};
|
|
28
|
-
const generateEmptyContext = () => {
|
|
29
|
-
return {
|
|
30
|
-
headerId: '',
|
|
31
|
-
mode: ConfigurationContextMode.TEST,
|
|
32
|
-
properties: {},
|
|
33
|
-
configurationToken: '',
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
const getGuidedSellingConfigurationRequest = (data) => {
|
|
37
|
-
return {
|
|
38
|
-
mode: 'SEARCH',
|
|
39
|
-
step: 'START',
|
|
40
|
-
attributeDomainMode: 'ALL',
|
|
41
|
-
context: generateEmptyContext(),
|
|
42
|
-
lineItem: {
|
|
43
|
-
actionCode: 'ADD',
|
|
44
|
-
cfgStatus: 'Default',
|
|
45
|
-
id: UUID.UUID(),
|
|
46
|
-
qty: 1,
|
|
47
|
-
type: data.modelType,
|
|
48
|
-
attributes: Object.entries(data.attributesMap).map(([name, value]) => ({
|
|
49
|
-
name,
|
|
50
|
-
value,
|
|
51
|
-
cfgStatus: 'User',
|
|
52
|
-
})),
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
const generateConfigurationLineItem = (props, qty = 1) => {
|
|
57
|
-
var _a, _b, _c;
|
|
58
|
-
const id = UUID.UUID();
|
|
59
|
-
const attributes = Object.entries((_a = props.attributesMap) !== null && _a !== void 0 ? _a : {}).map(([name, value]) => ({
|
|
60
|
-
name,
|
|
61
|
-
value,
|
|
62
|
-
cfgStatus: 'User',
|
|
63
|
-
}));
|
|
64
|
-
const lineItems = [];
|
|
65
|
-
return {
|
|
66
|
-
id,
|
|
67
|
-
type: (_b = props.product.typeName) !== null && _b !== void 0 ? _b : '',
|
|
68
|
-
cfgStatus: 'Default',
|
|
69
|
-
actionCode: 'ADD',
|
|
70
|
-
qty,
|
|
71
|
-
attributes,
|
|
72
|
-
lineItems,
|
|
73
|
-
productName: props.product.name,
|
|
74
|
-
productId: (_c = props.product.id) !== null && _c !== void 0 ? _c : '',
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const FLOW_CUSTOMIZATION = new InjectionToken('FLOW_CUSTOMIZATION');
|
|
79
|
-
|
|
80
|
-
const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
|
|
81
|
-
|
|
82
|
-
var RuntimeMode;
|
|
83
|
-
(function (RuntimeMode) {
|
|
84
|
-
RuntimeMode[RuntimeMode["TEST"] = 0] = "TEST";
|
|
85
|
-
RuntimeMode[RuntimeMode["PROD"] = 1] = "PROD";
|
|
86
|
-
})(RuntimeMode || (RuntimeMode = {}));
|
|
87
|
-
var RuntimeOperation;
|
|
88
|
-
(function (RuntimeOperation) {
|
|
89
|
-
RuntimeOperation["INIT"] = "INIT";
|
|
90
|
-
RuntimeOperation["UPDATE"] = "UPDATE";
|
|
91
|
-
})(RuntimeOperation || (RuntimeOperation = {}));
|
|
92
|
-
var RuntimeStep;
|
|
93
|
-
(function (RuntimeStep) {
|
|
94
|
-
RuntimeStep["START"] = "START";
|
|
95
|
-
RuntimeStep["UPDATE"] = "UPDATE";
|
|
96
|
-
})(RuntimeStep || (RuntimeStep = {}));
|
|
97
|
-
|
|
98
|
-
const UI_DEFINITION_VERSION = 3;
|
|
99
|
-
|
|
100
|
-
class RuntimeContextService {
|
|
101
|
-
constructor(configurationApiService) {
|
|
102
|
-
this.configurationApiService = configurationApiService;
|
|
103
|
-
}
|
|
104
|
-
getRuntimeContext(productId, offeringId, defaultUIDefinitionId, requiredUIDefinitionId) {
|
|
105
|
-
return this.configurationApiService
|
|
106
|
-
.getRuntimeDataByProductId(productId, offeringId, defaultUIDefinitionId, requiredUIDefinitionId)
|
|
107
|
-
.pipe(map(runtimeData => {
|
|
108
|
-
var _a;
|
|
109
|
-
const uiDefinitionContainer = this.getUIDefinitionContainer(runtimeData);
|
|
110
|
-
const runtimeModel = RuntimeModel.create(runtimeData.types, runtimeData.products);
|
|
111
|
-
const { productName, properties } = (_a = Array.from(runtimeModel.components.values()).find(c => c.productId === productId)) !== null && _a !== void 0 ? _a : {};
|
|
112
|
-
const uiDefinitionProperties = uiDefinitionContainer === null || uiDefinitionContainer === void 0 ? void 0 : uiDefinitionContainer.source.properties;
|
|
113
|
-
return {
|
|
114
|
-
modelId: runtimeData.modelId,
|
|
115
|
-
uiDefinitionContainer: uiDefinitionContainer,
|
|
116
|
-
runtimeModel: runtimeModel,
|
|
117
|
-
runtimeMode: RuntimeMode.PROD,
|
|
118
|
-
productId: productId,
|
|
119
|
-
productType: (properties === null || properties === void 0 ? void 0 : properties['displayName']) || productName,
|
|
120
|
-
offeringId: offeringId,
|
|
121
|
-
properties: {
|
|
122
|
-
PricingEnabled: (uiDefinitionProperties === null || uiDefinitionProperties === void 0 ? void 0 : uiDefinitionProperties.pricingEnabled) ? 'true' : 'false',
|
|
123
|
-
PriceListId: uiDefinitionProperties === null || uiDefinitionProperties === void 0 ? void 0 : uiDefinitionProperties.priceList,
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
}));
|
|
127
|
-
}
|
|
128
|
-
getUIDefinitionContainer(runtimeData) {
|
|
129
|
-
var _a;
|
|
130
|
-
const containers = runtimeData.uiDefinitions.filter(container => isNotLegacyUIDefinition(container.source));
|
|
131
|
-
return (_a = containers.find(container => container.source.primary)) !== null && _a !== void 0 ? _a : containers[0];
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
RuntimeContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService, deps: [{ token: i1.ConfigurationApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
135
|
-
RuntimeContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService });
|
|
136
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeContextService, decorators: [{
|
|
137
|
-
type: Injectable
|
|
138
|
-
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }]; } });
|
|
139
|
-
|
|
140
16
|
class ConfigurationRuntimeService {
|
|
141
|
-
constructor(
|
|
142
|
-
this.
|
|
143
|
-
this.runtimeContextService = runtimeContextService;
|
|
144
|
-
this._isInitialized = false;
|
|
145
|
-
this.uiDefinitionProperties = {};
|
|
146
|
-
}
|
|
147
|
-
reset() {
|
|
148
|
-
this._isInitialized = false;
|
|
149
|
-
this._runtimeContext = undefined;
|
|
150
|
-
this.initializationProps = undefined;
|
|
151
|
-
this.uiDefinitionProperties = {};
|
|
152
|
-
}
|
|
153
|
-
initTestMode(uiDefinitionContainer) {
|
|
154
|
-
var _a;
|
|
155
|
-
this.uiDefinitionProperties = (_a = uiDefinitionContainer.source.properties) !== null && _a !== void 0 ? _a : {};
|
|
156
|
-
return this.apiService.getRuntimeDataByModelId(uiDefinitionContainer.modelId).pipe(first(), map(runtimeData => {
|
|
157
|
-
this._runtimeContext = {
|
|
158
|
-
modelId: uiDefinitionContainer.modelId,
|
|
159
|
-
runtimeModel: RuntimeModel.create(runtimeData.types, runtimeData.products),
|
|
160
|
-
runtimeMode: RuntimeMode.TEST,
|
|
161
|
-
uiDefinitionContainer,
|
|
162
|
-
};
|
|
163
|
-
return this._runtimeContext;
|
|
164
|
-
}), tap(() => (this._isInitialized = true)));
|
|
165
|
-
}
|
|
166
|
-
init(props) {
|
|
167
|
-
this.initializationProps = props;
|
|
168
|
-
return this.runtimeContextService
|
|
169
|
-
.getRuntimeContext(props.productId, props.offeringId, props.defaultUIDefinitionId, props.requiredUIDefinitionId)
|
|
170
|
-
.pipe(tap(runtimeContext => {
|
|
171
|
-
var _a, _b;
|
|
172
|
-
this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinitionContainer) === null || _a === void 0 ? void 0 : _a.source.properties) !== null && _b !== void 0 ? _b : {};
|
|
173
|
-
this.id15to18('AccountId', runtimeContext.properties);
|
|
174
|
-
this._runtimeContext = runtimeContext;
|
|
175
|
-
return this._runtimeContext;
|
|
176
|
-
}), tap(() => (this._isInitialized = true)));
|
|
177
|
-
}
|
|
178
|
-
overrideUIDefinition(uiDefinitionContainer) {
|
|
179
|
-
var _a;
|
|
180
|
-
if (!this._runtimeContext) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
this._runtimeContext.uiDefinitionContainer = uiDefinitionContainer;
|
|
184
|
-
this.uiDefinitionProperties = (_a = uiDefinitionContainer.source.properties) !== null && _a !== void 0 ? _a : {};
|
|
185
|
-
}
|
|
186
|
-
id15to18(propertyName, source) {
|
|
187
|
-
if (!source) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
const value = source[propertyName];
|
|
191
|
-
if (typeof value === 'string' && value.length === 15) {
|
|
192
|
-
source[propertyName] = SalesforceIdUtils.generateId18FromId15(value);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
get isInitialized() {
|
|
196
|
-
return this._isInitialized;
|
|
17
|
+
constructor() {
|
|
18
|
+
this.uiDefinitionContainer = null;
|
|
197
19
|
}
|
|
198
|
-
get
|
|
199
|
-
var _a;
|
|
200
|
-
return (_a = this.
|
|
20
|
+
get uiDefinitionProps() {
|
|
21
|
+
var _a, _b;
|
|
22
|
+
return (_b = (_a = this.uiDefinitionContainer) === null || _a === void 0 ? void 0 : _a.source.properties) !== null && _b !== void 0 ? _b : {};
|
|
201
23
|
}
|
|
202
|
-
|
|
203
|
-
|
|
24
|
+
reset() {
|
|
25
|
+
this.uiDefinitionContainer = null;
|
|
204
26
|
}
|
|
205
27
|
}
|
|
206
|
-
ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, deps: [
|
|
28
|
+
ConfigurationRuntimeService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
207
29
|
ConfigurationRuntimeService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService });
|
|
208
30
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationRuntimeService, decorators: [{
|
|
209
31
|
type: Injectable
|
|
210
|
-
}]
|
|
32
|
+
}] });
|
|
211
33
|
|
|
212
|
-
const
|
|
213
|
-
return
|
|
34
|
+
const findTransactionItem = (id, items) => {
|
|
35
|
+
return findTransactionItemWithComparator(items, (ti) => ti.id === id);
|
|
214
36
|
};
|
|
215
|
-
const
|
|
216
|
-
let currentLevel =
|
|
37
|
+
const findTransactionItemWithComparator = (items, comparator) => {
|
|
38
|
+
let currentLevel = items;
|
|
217
39
|
while (currentLevel.length) {
|
|
218
40
|
const found = currentLevel.find(comparator);
|
|
219
41
|
if (found) {
|
|
220
42
|
return found;
|
|
221
43
|
}
|
|
222
|
-
currentLevel = flatten(currentLevel.map(parent => parent.
|
|
44
|
+
currentLevel = flatten(currentLevel.map(parent => parent.children));
|
|
223
45
|
}
|
|
224
46
|
return;
|
|
225
47
|
};
|
|
226
|
-
const
|
|
227
|
-
const insertData =
|
|
228
|
-
return Object.assign(Object.assign({},
|
|
48
|
+
const insertTransactionItem = (item, parentId, toInsert) => {
|
|
49
|
+
const insertData = item.id === parentId ? [toInsert] : [];
|
|
50
|
+
return Object.assign(Object.assign({}, item), { children: [
|
|
229
51
|
...insertData,
|
|
230
|
-
...
|
|
231
|
-
return
|
|
52
|
+
...item.children.map(ti => {
|
|
53
|
+
return insertTransactionItem(ti, parentId, toInsert);
|
|
232
54
|
}),
|
|
233
55
|
] });
|
|
234
56
|
};
|
|
235
|
-
const
|
|
236
|
-
return Object.assign(Object.assign({},
|
|
237
|
-
.map(
|
|
238
|
-
if (
|
|
57
|
+
const removeTransactionItem = (item, idToRemove) => {
|
|
58
|
+
return Object.assign(Object.assign({}, item), { children: item.children
|
|
59
|
+
.map(ti => {
|
|
60
|
+
if (ti.id === idToRemove) {
|
|
239
61
|
return;
|
|
240
62
|
}
|
|
241
|
-
else if (
|
|
242
|
-
return
|
|
63
|
+
else if (ti.children.length) {
|
|
64
|
+
return removeTransactionItem(ti, idToRemove);
|
|
243
65
|
}
|
|
244
|
-
return
|
|
66
|
+
return ti;
|
|
245
67
|
})
|
|
246
|
-
.filter(
|
|
247
|
-
};
|
|
248
|
-
const replaceLineItem = (lineItem, replaceTo, skipCardinalityCalculation = false) => {
|
|
249
|
-
if (lineItem.id === replaceTo.id) {
|
|
250
|
-
if (!skipCardinalityCalculation) {
|
|
251
|
-
return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
return Object.assign({}, replaceTo);
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(li => replaceLineItem(li, replaceTo, skipCardinalityCalculation)) });
|
|
258
|
-
};
|
|
259
|
-
const collectCardinalityComputations = (portDomains) => {
|
|
260
|
-
const cardinalityComputations = new Map();
|
|
261
|
-
entries(portDomains).forEach(([key, portDomain]) => {
|
|
262
|
-
cardinalityComputations.set(key, portDomain.properties['cardinalityComputation'] === 'true');
|
|
263
|
-
});
|
|
264
|
-
return cardinalityComputations;
|
|
265
|
-
};
|
|
266
|
-
const calculateCardinalityVariables = (lineItems, cardinalityComputations) => {
|
|
267
|
-
const cardVars = new Map();
|
|
268
|
-
lineItems
|
|
269
|
-
.filter(({ port, type }) => !!port && !!type)
|
|
270
|
-
.forEach(li => {
|
|
271
|
-
var _a;
|
|
272
|
-
if (cardinalityComputations.get(`${li.port}`)) {
|
|
273
|
-
const cardinalityVariableName = `#CV-${li.type}@${li.port}`;
|
|
274
|
-
cardVars.set(cardinalityVariableName, ((_a = cardVars.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
return cardVars;
|
|
278
|
-
};
|
|
279
|
-
const cardinalityRegexp = new RegExp('#CV-[a-zA-Z0-9_]+@(?<portName>[a-zA-Z0-9_]+)');
|
|
280
|
-
const recalculateCardinalityVariables = (original, updated) => {
|
|
281
|
-
var _a, _b;
|
|
282
|
-
const cardinalityComputations = collectCardinalityComputations((_b = (_a = updated.portDomains) !== null && _a !== void 0 ? _a : original.portDomains) !== null && _b !== void 0 ? _b : {});
|
|
283
|
-
const cardinalityVariables = calculateCardinalityVariables(updated.lineItems, cardinalityComputations);
|
|
284
|
-
const originalCardinalityVariables = calculateCardinalityVariables(original.lineItems, cardinalityComputations);
|
|
285
|
-
originalCardinalityVariables.forEach((value, key) => {
|
|
286
|
-
var _a;
|
|
287
|
-
const execArray = cardinalityRegexp.exec(key);
|
|
288
|
-
const portName = (_a = execArray === null || execArray === void 0 ? void 0 : execArray.groups) === null || _a === void 0 ? void 0 : _a['portName'];
|
|
289
|
-
if (!portName || cardinalityComputations.get(portName)) {
|
|
290
|
-
if (cardinalityVariables.get(key) === value) {
|
|
291
|
-
// no need to update cardinality if no changes
|
|
292
|
-
cardinalityVariables.delete(key);
|
|
293
|
-
}
|
|
294
|
-
else if (!cardinalityVariables.has(key)) {
|
|
295
|
-
// remove last item from port
|
|
296
|
-
cardinalityVariables.set(key, 0);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
return Object.assign(Object.assign({}, updated), { attributes: upsertAttributes(updated.attributes, [...cardinalityVariables].map(([name, value]) => ({ name, value, cfgStatus: 'Changed' }))) });
|
|
301
|
-
};
|
|
302
|
-
const mapAttributes = (attributes) => {
|
|
303
|
-
return attributes.reduce((acc, { name, value }) => (Object.assign(Object.assign({}, acc), { [name]: value })), {});
|
|
304
|
-
};
|
|
305
|
-
const getAttributes = (attributes, names = []) => {
|
|
306
|
-
const filtered = attributes.filter(({ name }) => names.includes(name));
|
|
307
|
-
return sortBy(filtered, [({ name }) => names.indexOf(name)]);
|
|
68
|
+
.filter(isDefined) });
|
|
308
69
|
};
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
return [
|
|
313
|
-
...acc.filter(attr => attr.name !== name),
|
|
314
|
-
Object.assign(Object.assign({}, (origAttr !== null && origAttr !== void 0 ? origAttr : { name, type: '' })), { cfgStatus: origAttr ? 'Changed' : 'User', value }),
|
|
315
|
-
];
|
|
316
|
-
}, originalAttributes);
|
|
317
|
-
};
|
|
318
|
-
const patchAttributes = (rootLineItem, id, attrs, skipCardinalityCalculation = false) => {
|
|
319
|
-
const lineItem = findLineItem(id, [rootLineItem]);
|
|
320
|
-
if (!lineItem) {
|
|
321
|
-
return rootLineItem;
|
|
70
|
+
const replaceTransactionItem = (item, replaceTo) => {
|
|
71
|
+
if (item.id === replaceTo.id) {
|
|
72
|
+
return Object.assign({}, replaceTo);
|
|
322
73
|
}
|
|
323
|
-
|
|
324
|
-
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes }), skipCardinalityCalculation);
|
|
74
|
+
return Object.assign(Object.assign({}, item), { children: item.children.map(ti => replaceTransactionItem(ti, replaceTo)) });
|
|
325
75
|
};
|
|
326
|
-
const
|
|
327
|
-
const generateLineItem = (port, type, parentId, attributes = [], lineItems = []) => {
|
|
76
|
+
const generateTransactionItem = (productId) => {
|
|
328
77
|
return {
|
|
329
78
|
id: UUID.UUID(),
|
|
330
|
-
|
|
331
|
-
type,
|
|
332
|
-
actionCode: 'ADD',
|
|
333
|
-
cfgStatus: 'New',
|
|
334
|
-
attributes: attributes.map(({ name, value }) => ({ cfgStatus: 'User', name, value })),
|
|
335
|
-
lineItems,
|
|
336
|
-
parentId,
|
|
337
|
-
qty: 1,
|
|
79
|
+
productId,
|
|
338
80
|
};
|
|
339
81
|
};
|
|
340
|
-
const getRecommendedPrices = (portDomain, type) => {
|
|
341
|
-
var _a, _b;
|
|
342
|
-
const domainType = portDomain.domainTypes.find(({ name }) => name === type);
|
|
343
|
-
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) => {
|
|
344
|
-
const [netPrice, listPrice] = acc;
|
|
345
|
-
return [netPrice + rp.netPrice, listPrice + rp.listPrice];
|
|
346
|
-
}, [0, 0])) !== null && _b !== void 0 ? _b : [0, 0];
|
|
347
|
-
return { net, list };
|
|
348
|
-
};
|
|
349
|
-
const getOriginParent = (lineItems, currentLineItem) => {
|
|
350
|
-
let target = currentLineItem;
|
|
351
|
-
while (target && target.rampInstanceId) {
|
|
352
|
-
target = lineItems.find(sub => sub.id === currentLineItem.rampInstanceId);
|
|
353
|
-
}
|
|
354
|
-
return target;
|
|
355
|
-
};
|
|
356
|
-
const assetPredicateFn = (lineItem, assetId) => {
|
|
357
|
-
if (!assetId) {
|
|
358
|
-
return false;
|
|
359
|
-
}
|
|
360
|
-
return lineItem.assetId === assetId || lineItem.openOrderLineItemId === assetId;
|
|
361
|
-
};
|
|
362
|
-
const multiplyLineItems = (lineItem, qty, split) => {
|
|
363
|
-
if (split) {
|
|
364
|
-
const unifyIds = (lineItem) => (Object.assign(Object.assign({}, lineItem), { id: UUID.UUID(), lineItems: lineItem.lineItems.map(unifyIds) }));
|
|
365
|
-
return map$1(new Array(qty), () => unifyIds(lineItem));
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
return [
|
|
369
|
-
Object.assign(Object.assign({}, lineItem), { qty: qty }),
|
|
370
|
-
];
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
const isTechnicalAttribute = (name) => {
|
|
374
|
-
return name.startsWith('#') || name.startsWith('$');
|
|
375
|
-
};
|
|
376
|
-
const filterOutTechnicalAttributes = (attributes) => {
|
|
377
|
-
return attributes.filter(({ name }) => !isTechnicalAttribute(name));
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
var lineItem_utils = /*#__PURE__*/Object.freeze({
|
|
381
|
-
__proto__: null,
|
|
382
|
-
assetPredicateFn: assetPredicateFn,
|
|
383
|
-
filterOutTechnicalAttributes: filterOutTechnicalAttributes,
|
|
384
|
-
findLineItem: findLineItem,
|
|
385
|
-
findLineItemWithComparator: findLineItemWithComparator,
|
|
386
|
-
generateLineItem: generateLineItem,
|
|
387
|
-
getAttributeValue: getAttributeValue,
|
|
388
|
-
getAttributes: getAttributes,
|
|
389
|
-
getOriginParent: getOriginParent,
|
|
390
|
-
getRecommendedPrices: getRecommendedPrices,
|
|
391
|
-
insertLineItem: insertLineItem,
|
|
392
|
-
isTechnicalAttribute: isTechnicalAttribute,
|
|
393
|
-
mapAttributes: mapAttributes,
|
|
394
|
-
multiplyLineItems: multiplyLineItems,
|
|
395
|
-
patchAttributes: patchAttributes,
|
|
396
|
-
recalculateCardinalityVariables: recalculateCardinalityVariables,
|
|
397
|
-
removeLineItem: removeLineItem,
|
|
398
|
-
replaceLineItem: replaceLineItem,
|
|
399
|
-
upsertAttributes: upsertAttributes
|
|
400
|
-
});
|
|
401
82
|
|
|
402
|
-
class
|
|
83
|
+
class TransactionItemWorker {
|
|
403
84
|
constructor(src) {
|
|
404
|
-
this.
|
|
85
|
+
this.ti = Object.assign({}, src);
|
|
405
86
|
}
|
|
406
87
|
insert(parentId, toInsert) {
|
|
407
|
-
return new
|
|
88
|
+
return new TransactionItemWorker(insertTransactionItem(this.ti, parentId, toInsert));
|
|
408
89
|
}
|
|
409
90
|
remove(id) {
|
|
410
|
-
return new
|
|
91
|
+
return new TransactionItemWorker(removeTransactionItem(this.ti, id));
|
|
411
92
|
}
|
|
412
|
-
replace(toReplace
|
|
413
|
-
return new
|
|
414
|
-
}
|
|
415
|
-
patchAttribute(attrs, id, skipCardinalityCalculation = false) {
|
|
416
|
-
return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs, skipCardinalityCalculation));
|
|
93
|
+
replace(toReplace) {
|
|
94
|
+
return new TransactionItemWorker(replaceTransactionItem(this.ti, toReplace));
|
|
417
95
|
}
|
|
418
96
|
}
|
|
419
97
|
|
|
@@ -425,6 +103,8 @@ function extractMetadata(uiDefinition) {
|
|
|
425
103
|
]);
|
|
426
104
|
}
|
|
427
105
|
|
|
106
|
+
const FLOW_CUSTOMIZATION = new InjectionToken('FLOW_CUSTOMIZATION');
|
|
107
|
+
|
|
428
108
|
class RuntimeSettingsService {
|
|
429
109
|
constructor(configurationSettingsApiService) {
|
|
430
110
|
this.configurationSettingsApiService = configurationSettingsApiService;
|
|
@@ -442,12 +122,12 @@ class RuntimeSettingsService {
|
|
|
442
122
|
};
|
|
443
123
|
}
|
|
444
124
|
create() {
|
|
445
|
-
return this.configurationSettingsApiService.fetchSettings().pipe(map
|
|
125
|
+
return this.configurationSettingsApiService.fetchSettings().pipe(map(settings => this.parseConfigurationSettings(settings)), tap(configurationSettings => {
|
|
446
126
|
var _a;
|
|
447
127
|
this.configurationSettings$.next(configurationSettings);
|
|
448
128
|
this.addShoppingCartSettings((_a = configurationSettings['shopping-cart']) !== null && _a !== void 0 ? _a : []);
|
|
449
129
|
this.formattingSettings = this.getFormattingSettings();
|
|
450
|
-
}), map
|
|
130
|
+
}), map(() => undefined));
|
|
451
131
|
}
|
|
452
132
|
initCurrency(iso) {
|
|
453
133
|
if (iso) {
|
|
@@ -552,7 +232,7 @@ class FlowInfoService {
|
|
|
552
232
|
return this.templatesSubj$.value;
|
|
553
233
|
}
|
|
554
234
|
get isFlowEngineInitialized$() {
|
|
555
|
-
return this.templates$.pipe(map
|
|
235
|
+
return this.templates$.pipe(map(v => Boolean(v.FLOW_ENGINE)));
|
|
556
236
|
}
|
|
557
237
|
get isStateful() {
|
|
558
238
|
var _a;
|
|
@@ -571,7 +251,7 @@ class FlowInfoService {
|
|
|
571
251
|
this.flow$ = this.flowSubj$.asObservable();
|
|
572
252
|
this.templates$ = this.templatesSubj$.asObservable();
|
|
573
253
|
}
|
|
574
|
-
|
|
254
|
+
reset() {
|
|
575
255
|
this.flowSubj$.next(null);
|
|
576
256
|
this.templatesSubj$.next({});
|
|
577
257
|
this.contextSubj$.next(null);
|
|
@@ -579,6 +259,9 @@ class FlowInfoService {
|
|
|
579
259
|
init$(flowId, routeQueryParams) {
|
|
580
260
|
return this.initFlow$(flowId, routeQueryParams).pipe(switchMap(() => this.initFlowTemplates$()));
|
|
581
261
|
}
|
|
262
|
+
updateContext(update) {
|
|
263
|
+
this.contextSubj$.next(Object.assign(Object.assign({}, this.context), update));
|
|
264
|
+
}
|
|
582
265
|
initFlow$(flowId, routeQueryParams) {
|
|
583
266
|
var _a;
|
|
584
267
|
const flow = (_a = this.runtimeSettingsService.getConfigurationSettings()['flows']) === null || _a === void 0 ? void 0 : _a.find(({ id }) => flowId === id);
|
|
@@ -604,7 +287,7 @@ class FlowInfoService {
|
|
|
604
287
|
return forkJoin([
|
|
605
288
|
this.templatesApiService.fetchTemplates$(),
|
|
606
289
|
(_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([]),
|
|
607
|
-
]).pipe(map
|
|
290
|
+
]).pipe(map(([templates, localTemplates]) => {
|
|
608
291
|
var _a, _b;
|
|
609
292
|
const newValue = {};
|
|
610
293
|
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]) => {
|
|
@@ -649,12 +332,12 @@ class FlowInfoService {
|
|
|
649
332
|
return objectName.toUpperCase();
|
|
650
333
|
}
|
|
651
334
|
}
|
|
652
|
-
FlowInfoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, deps: [{ token: RuntimeSettingsService }, { token:
|
|
335
|
+
FlowInfoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, deps: [{ token: RuntimeSettingsService }, { token: i4.UITemplatesApiService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
653
336
|
FlowInfoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService });
|
|
654
337
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, decorators: [{
|
|
655
338
|
type: Injectable
|
|
656
339
|
}], ctorParameters: function () {
|
|
657
|
-
return [{ type: RuntimeSettingsService }, { type:
|
|
340
|
+
return [{ type: RuntimeSettingsService }, { type: i4.UITemplatesApiService }, { type: undefined, decorators: [{
|
|
658
341
|
type: Optional
|
|
659
342
|
}, {
|
|
660
343
|
type: Inject,
|
|
@@ -662,353 +345,112 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
662
345
|
}] }];
|
|
663
346
|
} });
|
|
664
347
|
|
|
665
|
-
|
|
666
|
-
* @deprecated
|
|
667
|
-
*/
|
|
668
|
-
class QuoteDraftService {
|
|
348
|
+
class SalesTransactionService {
|
|
669
349
|
get isInitialized$() {
|
|
670
350
|
return this.isInitializedSubj$.asObservable();
|
|
671
351
|
}
|
|
672
352
|
get isInitialized() {
|
|
673
353
|
return this.isInitializedSubj$.getValue();
|
|
674
354
|
}
|
|
675
|
-
set isInitialized(value) {
|
|
676
|
-
if (this.isInitialized !== value) {
|
|
677
|
-
this.isInitializedSubj$.next(value);
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
get hasUnsavedChanges() {
|
|
681
|
-
return this._hasUnsavedChanges;
|
|
682
|
-
}
|
|
683
355
|
set hasUnsavedChanges(value) {
|
|
684
356
|
var _a, _b;
|
|
685
|
-
this.
|
|
686
|
-
if (!this.
|
|
687
|
-
this.
|
|
357
|
+
this.hasUnsavedChangesSubj$.next(value);
|
|
358
|
+
if (!this.hasUnsavedChanges) {
|
|
359
|
+
this.initialState = (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.salesTransactionItems) !== null && _b !== void 0 ? _b : [];
|
|
688
360
|
}
|
|
689
361
|
}
|
|
690
|
-
get
|
|
691
|
-
return this.
|
|
692
|
-
}
|
|
693
|
-
get hasProducts() {
|
|
694
|
-
var _a;
|
|
695
|
-
return Boolean((_a = this.quoteSubj$.value) === null || _a === void 0 ? void 0 : _a.currentState.length);
|
|
362
|
+
get hasUnsavedChanges() {
|
|
363
|
+
return this.hasUnsavedChangesSubj$.getValue();
|
|
696
364
|
}
|
|
697
|
-
get
|
|
698
|
-
return this.
|
|
365
|
+
get state() {
|
|
366
|
+
return this.stateSubj$.getValue();
|
|
699
367
|
}
|
|
700
368
|
get hasAssets() {
|
|
701
369
|
var _a;
|
|
702
|
-
return Boolean((_a = this.
|
|
370
|
+
return Boolean((_a = this.state) === null || _a === void 0 ? void 0 : _a.assets.length);
|
|
703
371
|
}
|
|
704
|
-
get
|
|
705
|
-
|
|
372
|
+
get hasProducts() {
|
|
373
|
+
var _a;
|
|
374
|
+
return Boolean((_a = this.state) === null || _a === void 0 ? void 0 : _a.salesTransactionItems.length);
|
|
706
375
|
}
|
|
707
|
-
constructor(flowInfoService,
|
|
376
|
+
constructor(flowInfoService, salesTransactionApiService) {
|
|
708
377
|
this.flowInfoService = flowInfoService;
|
|
709
|
-
this.
|
|
710
|
-
this.
|
|
711
|
-
this.assetsSubj$ = new BehaviorSubject(null);
|
|
712
|
-
this.resetSubj$ = new BehaviorSubject(true);
|
|
378
|
+
this.salesTransactionApiService = salesTransactionApiService;
|
|
379
|
+
this.stateSubj$ = new BehaviorSubject(null);
|
|
713
380
|
this.isInitializedSubj$ = new BehaviorSubject(false);
|
|
714
|
-
this.
|
|
715
|
-
this.
|
|
716
|
-
this.
|
|
717
|
-
this.
|
|
718
|
-
.pipe(filter(isInitialized => isInitialized), switchMap$1(() => this.quoteSubj$.asObservable()), skip(1), tap(quote => this.markAsUpdated(quote)))
|
|
719
|
-
.subscribe();
|
|
720
|
-
}
|
|
721
|
-
reset() {
|
|
722
|
-
this.resetSubj$.next(true);
|
|
723
|
-
this.quoteSubj$.next(null);
|
|
724
|
-
this.assetsSubj$.next(null);
|
|
725
|
-
this.isInitialized = false;
|
|
726
|
-
this.hasUnsavedChanges = false;
|
|
381
|
+
this.hasUnsavedChangesSubj$ = new BehaviorSubject(false);
|
|
382
|
+
this.initialState = [];
|
|
383
|
+
this.hasUnsavedChanges$ = this.hasUnsavedChangesSubj$.asObservable();
|
|
384
|
+
this.state$ = this.stateSubj$.asObservable().pipe(filter(isDefined));
|
|
727
385
|
}
|
|
728
386
|
init(headerId, params) {
|
|
729
|
-
|
|
730
|
-
const accountId = isAccountMode ? headerId : this.flowInfoService.context['accountId'];
|
|
731
|
-
return zip(accountId ? this.accountApiService.getAssetsState(accountId, params) : of(null), isAccountMode
|
|
732
|
-
? of(QuoteDraft.emptyQuote(ConfigurationContextMode.ACCOUNT))
|
|
733
|
-
: of(QuoteDraft.emptyQuote(ConfigurationContextMode.QUOTE))).pipe(tap(([assets, quote]) => {
|
|
734
|
-
if (assets) {
|
|
735
|
-
this.assetsSubj$.next(assets);
|
|
736
|
-
}
|
|
737
|
-
this.quoteSubj$.next(quote);
|
|
738
|
-
}), map(() => noop()), take(1));
|
|
387
|
+
return this.salesTransactionApiService.getState(headerId, params).pipe(tap(res => this.stateSubj$.next(res.salesTransaction)), map(res => res.salesTransaction));
|
|
739
388
|
}
|
|
740
389
|
finalizeInit() {
|
|
741
|
-
this.
|
|
390
|
+
this.isInitializedSubj$.next(true);
|
|
742
391
|
this.hasUnsavedChanges = false;
|
|
743
392
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
}
|
|
749
|
-
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
|
|
750
|
-
}
|
|
751
|
-
updateQuoteDraft(update) {
|
|
752
|
-
const quoteDraft = this.quoteSubj$.value;
|
|
753
|
-
if (!quoteDraft) {
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
|
|
757
|
-
}
|
|
758
|
-
updateByPriceSummary(priceSummary) {
|
|
759
|
-
const quoteDraft = this.quoteSubj$.value;
|
|
760
|
-
if (!quoteDraft) {
|
|
761
|
-
return;
|
|
762
|
-
}
|
|
763
|
-
const updatedCurrentState = this.currentState.map(lineItem => {
|
|
764
|
-
const updated = priceSummary.lineItems.find(li => li.id === lineItem.id);
|
|
765
|
-
return updated !== null && updated !== void 0 ? updated : lineItem;
|
|
766
|
-
});
|
|
767
|
-
this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
|
|
768
|
-
}
|
|
769
|
-
setAssetsState(assetsState) {
|
|
770
|
-
this.assetsSubj$.next(assetsState);
|
|
771
|
-
}
|
|
772
|
-
get quoteDraft$() {
|
|
773
|
-
return this.quoteSubj$.pipe(map(() => this.quoteDraft), filter((quote) => Boolean(quote)), shareReplay());
|
|
774
|
-
}
|
|
775
|
-
get quoteDraft() {
|
|
776
|
-
return this.quoteSubj$.value;
|
|
777
|
-
}
|
|
778
|
-
get currentState$() {
|
|
779
|
-
return this.quoteDraft$.pipe(map(quote => quote.currentState));
|
|
780
|
-
}
|
|
781
|
-
get currentState() {
|
|
782
|
-
var _a, _b;
|
|
783
|
-
return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
|
784
|
-
}
|
|
785
|
-
get isStandalone() {
|
|
786
|
-
var _a, _b;
|
|
787
|
-
return (_b = (_a = this.flowInfoService.flow) === null || _a === void 0 ? void 0 : _a.properties.standalone) !== null && _b !== void 0 ? _b : false;
|
|
788
|
-
}
|
|
789
|
-
get isStandalone$() {
|
|
790
|
-
return this.flowInfoService.flow$.pipe(map(() => this.isStandalone));
|
|
791
|
-
}
|
|
792
|
-
getInitialCurrentState() {
|
|
793
|
-
return this.initialCurrentState;
|
|
794
|
-
}
|
|
795
|
-
isEditMode$() {
|
|
796
|
-
return this.quoteDraft$.pipe(map(() => this.isEditMode()));
|
|
797
|
-
}
|
|
798
|
-
isEditMode() {
|
|
799
|
-
var _a;
|
|
800
|
-
const context = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.context;
|
|
801
|
-
if ((context === null || context === void 0 ? void 0 : context.mode) === ConfigurationContextMode.ACCOUNT) {
|
|
802
|
-
return true;
|
|
803
|
-
}
|
|
804
|
-
if ((context === null || context === void 0 ? void 0 : context.mode) === ConfigurationContextMode.QUOTE) {
|
|
805
|
-
return context.properties.Status === 'Draft';
|
|
806
|
-
}
|
|
807
|
-
return false;
|
|
808
|
-
}
|
|
809
|
-
markAsUpdated(quote) {
|
|
810
|
-
if ((quote === null || quote === void 0 ? void 0 : quote.context.properties['#mode']) === ConfigurationContextMode.ACCOUNT) {
|
|
811
|
-
this.hasUnsavedChanges = !!quote && !quote.currentState.every(li => li.actionCode === 'EXIST');
|
|
812
|
-
}
|
|
813
|
-
else {
|
|
814
|
-
this.hasUnsavedChanges = !isEqual(this.initialCurrentState, quote === null || quote === void 0 ? void 0 : quote.currentState);
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, deps: [{ token: FlowInfoService }, { token: i1.AccountApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
819
|
-
QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService });
|
|
820
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, decorators: [{
|
|
821
|
-
type: Injectable
|
|
822
|
-
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: i1.AccountApiService }]; } });
|
|
823
|
-
|
|
824
|
-
class FlowUpdateService {
|
|
825
|
-
update(rootLineItems, updates, charges) {
|
|
826
|
-
let remainingUpdates = [...updates];
|
|
827
|
-
let currentLevel = rootLineItems;
|
|
828
|
-
while (currentLevel.length && remainingUpdates.length) {
|
|
829
|
-
currentLevel.forEach(li => {
|
|
830
|
-
const unhandledUpdates = [];
|
|
831
|
-
remainingUpdates.forEach(update => {
|
|
832
|
-
let updated = false;
|
|
833
|
-
switch (update.dataType) {
|
|
834
|
-
case 'LINEITEM':
|
|
835
|
-
updated = this.applyLineItemUpdate(li, update, charges);
|
|
836
|
-
break;
|
|
837
|
-
case 'CHARGE':
|
|
838
|
-
updated = this.applyChargeUpdate(li, update);
|
|
839
|
-
break;
|
|
840
|
-
case 'GROUP_CHARGE':
|
|
841
|
-
updated = this.applyChargeGroupUpdate(li, update);
|
|
842
|
-
break;
|
|
843
|
-
default:
|
|
844
|
-
// Unknown dataType. Do not try to handle it anymore
|
|
845
|
-
updated = true;
|
|
846
|
-
}
|
|
847
|
-
if (!updated) {
|
|
848
|
-
unhandledUpdates.push(update);
|
|
849
|
-
}
|
|
850
|
-
});
|
|
851
|
-
remainingUpdates = unhandledUpdates;
|
|
852
|
-
});
|
|
853
|
-
currentLevel = flatten(currentLevel.map(parent => parent.lineItems));
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
delete(lineItems, id) {
|
|
857
|
-
const idsToRemove = [id];
|
|
858
|
-
const topLevelLineItem = lineItems.find(li => li.id === id);
|
|
859
|
-
if (topLevelLineItem) {
|
|
860
|
-
// find term-related line items (which are only top level)
|
|
861
|
-
// expired term line items won't be deleted
|
|
862
|
-
let foundTermLineItem = topLevelLineItem;
|
|
863
|
-
while (foundTermLineItem) {
|
|
864
|
-
foundTermLineItem = lineItems.find(li => foundTermLineItem && li.rampInstanceId === foundTermLineItem.id);
|
|
865
|
-
if (foundTermLineItem) {
|
|
866
|
-
idsToRemove.push(foundTermLineItem.id);
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
const filtered = lineItems.filter(lineItem => !idsToRemove.includes(lineItem.id));
|
|
871
|
-
return filtered.map(lineItem => new LineItemWorker(lineItem).remove(id).li);
|
|
872
|
-
}
|
|
873
|
-
applyLineItemUpdate(lineItem, update, charges) {
|
|
874
|
-
if (lineItem.id !== update.id) {
|
|
875
|
-
return false;
|
|
876
|
-
}
|
|
877
|
-
switch (update.attributeType) {
|
|
878
|
-
case 'QTY':
|
|
879
|
-
lineItem.qty = update.newValue;
|
|
880
|
-
break;
|
|
881
|
-
case 'EFFECTIVE_START_DATE':
|
|
882
|
-
lineItem.properties['StartDate'] = moment(update.newValue).format('YYYY-MM-DD');
|
|
883
|
-
break;
|
|
884
|
-
case 'END_DATE':
|
|
885
|
-
lineItem.properties['EndDate'] = moment(update.newValue).format('YYYY-MM-DD');
|
|
886
|
-
break;
|
|
887
|
-
case 'PRICE_ADJUSTMENT':
|
|
888
|
-
{
|
|
889
|
-
const charge = lineItem.chargeItems.find(charge => { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
|
890
|
-
if (charge) {
|
|
891
|
-
charge.priceAdjustment = update.newValue;
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
break;
|
|
895
|
-
case 'LIST_PRICE_ADJUSTMENT':
|
|
896
|
-
case 'MARGIN_ADJUSTMENT':
|
|
897
|
-
{
|
|
898
|
-
const charge = lineItem.chargeItems.find(charge => { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
|
899
|
-
if (charge) {
|
|
900
|
-
charge.listPriceAdjustment = update.newValue;
|
|
901
|
-
}
|
|
902
|
-
}
|
|
903
|
-
break;
|
|
904
|
-
case 'COST_ADJUSTMENT':
|
|
905
|
-
{
|
|
906
|
-
const charge = lineItem.chargeItems.find(charge => { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
|
907
|
-
if (charge) {
|
|
908
|
-
charge.costAdjustment = update.newValue;
|
|
909
|
-
}
|
|
910
|
-
}
|
|
911
|
-
break;
|
|
912
|
-
default:
|
|
913
|
-
throw new Error(`Not suppored AttributeType for LineItem update: ${update.attributeType}`);
|
|
914
|
-
}
|
|
915
|
-
return true;
|
|
393
|
+
reset() {
|
|
394
|
+
this.stateSubj$.next(null);
|
|
395
|
+
this.isInitializedSubj$.next(false);
|
|
396
|
+
this.hasUnsavedChangesSubj$.next(false);
|
|
916
397
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
if (!foundCharge) {
|
|
920
|
-
return false;
|
|
921
|
-
}
|
|
922
|
-
if (update.attributeType === 'PRICE_ADJUSTMENT') {
|
|
923
|
-
foundCharge.priceAdjustment = update.newValue;
|
|
924
|
-
}
|
|
925
|
-
else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
|
|
926
|
-
foundCharge.listPriceAdjustment = update.newValue;
|
|
927
|
-
}
|
|
928
|
-
else {
|
|
929
|
-
throw new Error(`Not suppored AttributeType for Charge Item update: ${update.attributeType}`);
|
|
930
|
-
}
|
|
931
|
-
return true;
|
|
398
|
+
getInitialState() {
|
|
399
|
+
return this.initialState;
|
|
932
400
|
}
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
if (!foundChargeGroup) {
|
|
936
|
-
return false;
|
|
937
|
-
}
|
|
938
|
-
if (update.attributeType === 'PRICE_ADJUSTMENT') {
|
|
939
|
-
foundChargeGroup.priceAdjustment = update.newValue;
|
|
940
|
-
}
|
|
941
|
-
else if (update.attributeType === 'LIST_PRICE_ADJUSTMENT') {
|
|
942
|
-
foundChargeGroup.listPriceAdjustment = update.newValue;
|
|
943
|
-
}
|
|
944
|
-
else {
|
|
945
|
-
throw new Error(`Not suppored AttributeType for Charge Group Item update: ${update.attributeType}`);
|
|
946
|
-
}
|
|
947
|
-
return true;
|
|
401
|
+
setState(state) {
|
|
402
|
+
this.stateSubj$.next(state);
|
|
948
403
|
}
|
|
949
404
|
}
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
|
405
|
+
SalesTransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionService, deps: [{ token: FlowInfoService }, { token: i4.SalesTransactionApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
406
|
+
SalesTransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionService });
|
|
407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionService, decorators: [{
|
|
953
408
|
type: Injectable
|
|
954
|
-
}] });
|
|
409
|
+
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: i4.SalesTransactionApiService }]; } });
|
|
955
410
|
|
|
956
411
|
class FlowConfigurationService {
|
|
957
|
-
constructor(proceduresApiService,
|
|
958
|
-
// private quoteDraftService: QuoteDraftService,
|
|
959
|
-
salesTransactionService, updateService, configurationService, flowInfoService) {
|
|
412
|
+
constructor(proceduresApiService, salesTransactionService) {
|
|
960
413
|
this.proceduresApiService = proceduresApiService;
|
|
961
414
|
this.salesTransactionService = salesTransactionService;
|
|
962
|
-
this.updateService = updateService;
|
|
963
|
-
this.configurationService = configurationService;
|
|
964
|
-
this.flowInfoService = flowInfoService;
|
|
965
415
|
this.updatedSubj$ = new Subject();
|
|
966
416
|
this.updated$ = this.updatedSubj$.asObservable();
|
|
967
417
|
}
|
|
968
418
|
calculate$(state) {
|
|
969
|
-
return this.proceduresApiService.apply$({ salesTransaction: state }).pipe(tap
|
|
419
|
+
return this.proceduresApiService.apply$({ salesTransaction: state }).pipe(tap(result => this.salesTransactionService.setState(result.salesTransaction)), map(noop));
|
|
970
420
|
}
|
|
971
421
|
calculate(state) {
|
|
972
422
|
this.calculate$(state).subscribe();
|
|
973
423
|
}
|
|
974
|
-
revert$(
|
|
424
|
+
revert$(transactionItemId) {
|
|
975
425
|
var _a;
|
|
976
426
|
const state = this.salesTransactionService.state;
|
|
977
|
-
const
|
|
427
|
+
const initialState = this.salesTransactionService.getInitialState();
|
|
978
428
|
const currentState = (_a = state === null || state === void 0 ? void 0 : state.salesTransactionItems) !== null && _a !== void 0 ? _a : [];
|
|
979
|
-
const
|
|
980
|
-
const
|
|
981
|
-
const
|
|
982
|
-
if (!state || !
|
|
429
|
+
const currentItemIndex = currentState.findIndex(({ id }) => id === transactionItemId);
|
|
430
|
+
const currentItem = currentState[currentItemIndex];
|
|
431
|
+
const initialItem = initialState.find(({ integrationId }) => integrationId === (currentItem === null || currentItem === void 0 ? void 0 : currentItem.integrationId));
|
|
432
|
+
if (!state || !currentItem || !initialItem) {
|
|
983
433
|
return of(null);
|
|
984
434
|
}
|
|
985
435
|
const updatedState = cloneDeep(currentState);
|
|
986
|
-
updatedState.splice(
|
|
987
|
-
return of([]).pipe(tap
|
|
436
|
+
updatedState.splice(currentItemIndex, 1, initialItem);
|
|
437
|
+
return of([]).pipe(tap(() => {
|
|
988
438
|
this.salesTransactionService.setState(Object.assign(Object.assign({}, state), { salesTransactionItems: updatedState }));
|
|
989
|
-
}), switchMap(() => this.calculate$(Object.assign(Object.assign({}, state), { salesTransactionItems: updatedState }))), map
|
|
439
|
+
}), switchMap(() => this.calculate$(Object.assign(Object.assign({}, state), { salesTransactionItems: updatedState }))), map(() => this.salesTransactionService.state), tap(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
|
|
990
440
|
}
|
|
991
|
-
revert(
|
|
992
|
-
this.revert$(
|
|
441
|
+
revert(transactionItemId) {
|
|
442
|
+
this.revert$(transactionItemId).subscribe();
|
|
993
443
|
}
|
|
994
444
|
delete$(ids) {
|
|
995
445
|
const state = this.salesTransactionService.state;
|
|
996
446
|
if (!state) {
|
|
997
447
|
return of(null);
|
|
998
448
|
}
|
|
999
|
-
return of([]).pipe(map
|
|
449
|
+
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());
|
|
1000
450
|
}
|
|
1001
451
|
delete(ids) {
|
|
1002
452
|
this.delete$(ids).subscribe();
|
|
1003
453
|
}
|
|
1004
|
-
addTerm$(term) {
|
|
1005
|
-
// TODO: implement
|
|
1006
|
-
return of(this.salesTransactionService.state);
|
|
1007
|
-
}
|
|
1008
|
-
addToCart$(props) {
|
|
1009
|
-
// TODO: implement
|
|
1010
|
-
return of(this.salesTransactionService.state);
|
|
1011
|
-
}
|
|
1012
454
|
handleErrorAndBounceBack() {
|
|
1013
455
|
return (source$) => {
|
|
1014
456
|
return source$.pipe(catchError(error => {
|
|
@@ -1024,88 +466,20 @@ class FlowConfigurationService {
|
|
|
1024
466
|
};
|
|
1025
467
|
}
|
|
1026
468
|
}
|
|
1027
|
-
FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, deps: [{ token:
|
|
469
|
+
FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i4.ProceduresApiService }, { token: SalesTransactionService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1028
470
|
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService });
|
|
1029
471
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
|
|
1030
472
|
type: Injectable
|
|
1031
|
-
}], ctorParameters: function () { return [{ type:
|
|
1032
|
-
|
|
1033
|
-
class FlowConfigurationModule {
|
|
1034
|
-
}
|
|
1035
|
-
FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1036
|
-
FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, imports: [ApiModule] });
|
|
1037
|
-
FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService], imports: [ApiModule] });
|
|
1038
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, decorators: [{
|
|
1039
|
-
type: NgModule,
|
|
1040
|
-
args: [{
|
|
1041
|
-
imports: [ApiModule],
|
|
1042
|
-
providers: [FlowConfigurationService, FlowUpdateService],
|
|
1043
|
-
}]
|
|
1044
|
-
}] });
|
|
1045
|
-
|
|
1046
|
-
class SalesTransactionService {
|
|
1047
|
-
get isInitialized$() {
|
|
1048
|
-
return this.isInitializedSubj$.asObservable();
|
|
1049
|
-
}
|
|
1050
|
-
get isInitialized() {
|
|
1051
|
-
return this.isInitializedSubj$.getValue();
|
|
1052
|
-
}
|
|
1053
|
-
set hasUnsavedChanges(value) {
|
|
1054
|
-
var _a, _b;
|
|
1055
|
-
this.hasUnsavedChangesSubj$.next(value);
|
|
1056
|
-
if (!this.hasUnsavedChanges) {
|
|
1057
|
-
this.initialCurrentState = (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.salesTransactionItems) !== null && _b !== void 0 ? _b : [];
|
|
1058
|
-
}
|
|
1059
|
-
}
|
|
1060
|
-
get hasUnsavedChanges() {
|
|
1061
|
-
return this.hasUnsavedChangesSubj$.getValue();
|
|
1062
|
-
}
|
|
1063
|
-
get state() {
|
|
1064
|
-
return this.stateSubj$.getValue();
|
|
1065
|
-
}
|
|
1066
|
-
constructor(flowInfoService, salesTransactionApiService) {
|
|
1067
|
-
this.flowInfoService = flowInfoService;
|
|
1068
|
-
this.salesTransactionApiService = salesTransactionApiService;
|
|
1069
|
-
this.stateSubj$ = new BehaviorSubject(null);
|
|
1070
|
-
this.isInitializedSubj$ = new BehaviorSubject(false);
|
|
1071
|
-
this.hasUnsavedChangesSubj$ = new BehaviorSubject(false);
|
|
1072
|
-
this.initialCurrentState = [];
|
|
1073
|
-
this.hasUnsavedChanges$ = this.hasUnsavedChangesSubj$.asObservable();
|
|
1074
|
-
this.state$ = this.stateSubj$.asObservable().pipe(filter$1(isDefined));
|
|
1075
|
-
}
|
|
1076
|
-
init(headerId, params) {
|
|
1077
|
-
return this.salesTransactionApiService.getState(headerId, params).pipe(tap$1(res => this.stateSubj$.next(res.salesTransaction)), map$2(res => res.salesTransaction));
|
|
1078
|
-
}
|
|
1079
|
-
finalizeInit() {
|
|
1080
|
-
this.isInitializedSubj$.next(true);
|
|
1081
|
-
this.hasUnsavedChanges = false;
|
|
1082
|
-
}
|
|
1083
|
-
reset() {
|
|
1084
|
-
this.stateSubj$.next(null);
|
|
1085
|
-
this.isInitializedSubj$.next(false);
|
|
1086
|
-
this.hasUnsavedChangesSubj$.next(false);
|
|
1087
|
-
}
|
|
1088
|
-
getInitialCurrentState() {
|
|
1089
|
-
return this.initialCurrentState;
|
|
1090
|
-
}
|
|
1091
|
-
setState(state) {
|
|
1092
|
-
this.stateSubj$.next(state);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
SalesTransactionService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionService, deps: [{ token: FlowInfoService }, { token: i2.SalesTransactionApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1096
|
-
SalesTransactionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionService });
|
|
1097
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SalesTransactionService, decorators: [{
|
|
1098
|
-
type: Injectable
|
|
1099
|
-
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: i2.SalesTransactionApiService }]; } });
|
|
473
|
+
}], ctorParameters: function () { return [{ type: i4.ProceduresApiService }, { type: SalesTransactionService }]; } });
|
|
1100
474
|
|
|
1101
475
|
class FlowStateService {
|
|
1102
|
-
constructor(
|
|
1103
|
-
this.salesTransactionService = salesTransactionService;
|
|
1104
|
-
this.flowInfoService = flowInfoService;
|
|
476
|
+
constructor(flowConfiguration, flowInfoService, flowStateApiService, processorsApiService, salesTransactionApiService, salesTransactionService, toastService, customizationService) {
|
|
1105
477
|
this.flowConfiguration = flowConfiguration;
|
|
1106
|
-
this.
|
|
478
|
+
this.flowInfoService = flowInfoService;
|
|
1107
479
|
this.flowStateApiService = flowStateApiService;
|
|
480
|
+
this.processorsApiService = processorsApiService;
|
|
1108
481
|
this.salesTransactionApiService = salesTransactionApiService;
|
|
482
|
+
this.salesTransactionService = salesTransactionService;
|
|
1109
483
|
this.toastService = toastService;
|
|
1110
484
|
this.customizationService = customizationService;
|
|
1111
485
|
this.NOT_INITIALIZED = Symbol();
|
|
@@ -1126,44 +500,18 @@ class FlowStateService {
|
|
|
1126
500
|
all subscriptions get their updates according to updated QuoteDraft
|
|
1127
501
|
*/
|
|
1128
502
|
this.isInitialized$()
|
|
1129
|
-
.pipe(filter
|
|
503
|
+
.pipe(filter(Boolean), filter(() => !this.flowInfoService.flow.properties.stateful), switchMap(() => this.flowConfiguration.updated$), switchMap(() => this.executeRequest$({}, true)))
|
|
1130
504
|
.subscribe();
|
|
1131
|
-
this.charges$ = this.flowInfoService.isFlowEngineInitialized$.pipe(filter$1(Boolean), switchMap(() => {
|
|
1132
|
-
return this.subscribe$(UITemplateType.FLOW_ENGINE, 'CHARGES', null, {
|
|
1133
|
-
cold: true,
|
|
1134
|
-
}).pipe(map$2(response => (response.success ? response.result : {})));
|
|
1135
|
-
}), shareReplay$1(1));
|
|
1136
|
-
this.charges$.subscribe();
|
|
1137
|
-
this.pricePlans$ = this.flowInfoService.isFlowEngineInitialized$.pipe(filter$1(Boolean), switchMap(() => {
|
|
1138
|
-
return this.subscribe$(UITemplateType.FLOW_ENGINE, 'PRICE_PLANS', null, {
|
|
1139
|
-
cold: true,
|
|
1140
|
-
}).pipe(map$2(response => (response.success ? response.result : {})));
|
|
1141
|
-
}), shareReplay$1(1));
|
|
1142
|
-
this.pricePlans$.subscribe();
|
|
1143
|
-
this.activeMetrics$ = this.flowInfoService.isFlowEngineInitialized$.pipe(filter$1(Boolean), switchMap(() => {
|
|
1144
|
-
return this.subscribe$(UITemplateType.FLOW_ENGINE, 'ACTIVE_METRICS', null, {
|
|
1145
|
-
cold: true,
|
|
1146
|
-
}).pipe(map$2(response => (response.success ? response.result : [])));
|
|
1147
|
-
}), shareReplay$1(1));
|
|
1148
|
-
this.activeMetrics$.subscribe();
|
|
1149
|
-
this.isPriceListLocked$ = this.flowInfoService.isFlowEngineInitialized$.pipe(filter$1(Boolean), switchMap(() => {
|
|
1150
|
-
return this.subscribe$(UITemplateType.FLOW_ENGINE, 'IS_PRICE_LIST_LOCKED', null, {
|
|
1151
|
-
cold: true,
|
|
1152
|
-
}).pipe(map$2(response => (response.success ? response.result : false)));
|
|
1153
|
-
}), shareReplay$1(1));
|
|
1154
|
-
this.isPriceListLocked$.subscribe();
|
|
1155
505
|
}
|
|
1156
506
|
init$() {
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
}
|
|
1164
|
-
}));
|
|
507
|
+
if (this.flowInfoService.flow.properties.stateful) {
|
|
508
|
+
return this.initProcessors$().pipe(switchMap(() => this.initStateful$()));
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
return forkJoin([this.initStateless$(), this.initProcessors$()]).pipe(map(noop));
|
|
512
|
+
}
|
|
1165
513
|
}
|
|
1166
|
-
|
|
514
|
+
reset() {
|
|
1167
515
|
Object.values(this.subscriptions).forEach(({ data$ }) => data$.complete());
|
|
1168
516
|
this.subscriptions = {};
|
|
1169
517
|
if (this.stateId$.value) {
|
|
@@ -1175,7 +523,7 @@ class FlowStateService {
|
|
|
1175
523
|
this.cleanup$.next();
|
|
1176
524
|
}
|
|
1177
525
|
get hasUnsavedChanges() {
|
|
1178
|
-
return this.
|
|
526
|
+
return this.flowInfoService.flow.properties.stateful
|
|
1179
527
|
? Array.from(this.trackedStatefulChangesMap.values()).some(Boolean)
|
|
1180
528
|
: this.salesTransactionService.hasUnsavedChanges;
|
|
1181
529
|
}
|
|
@@ -1186,14 +534,14 @@ class FlowStateService {
|
|
|
1186
534
|
return this.executionInProgress$.asObservable();
|
|
1187
535
|
}
|
|
1188
536
|
isInitialized$() {
|
|
1189
|
-
return combineLatest([this.stateId$, this.salesTransactionService.isInitialized$]).pipe(map
|
|
537
|
+
return combineLatest([this.stateId$, this.salesTransactionService.isInitialized$]).pipe(map(values => values.some(Boolean)));
|
|
1190
538
|
}
|
|
1191
539
|
isInitialized() {
|
|
1192
540
|
return Boolean(this.stateId$.value) || this.salesTransactionService.isInitialized;
|
|
1193
541
|
}
|
|
1194
542
|
execute$(scope, exec) {
|
|
1195
543
|
const request = this.execToRequest(scope, exec);
|
|
1196
|
-
return this.executeRequest$(request).pipe(map
|
|
544
|
+
return this.executeRequest$(request).pipe(map(result => {
|
|
1197
545
|
// Keep only requested results
|
|
1198
546
|
const actualSelectors = Object.entries(result.selectors).reduce((trunk, [requestId, result]) => {
|
|
1199
547
|
var _a;
|
|
@@ -1210,7 +558,7 @@ class FlowStateService {
|
|
|
1210
558
|
actions: [{ name: action, inputData }],
|
|
1211
559
|
};
|
|
1212
560
|
const request = this.execToRequest(scope, exec);
|
|
1213
|
-
return this.executeRequest$(request).pipe(map
|
|
561
|
+
return this.executeRequest$(request).pipe(map(noop));
|
|
1214
562
|
}
|
|
1215
563
|
select$(scope, selectorName, inputData) {
|
|
1216
564
|
const requestId = this.generateRequestId(scope, selectorName, inputData);
|
|
@@ -1222,7 +570,7 @@ class FlowStateService {
|
|
|
1222
570
|
},
|
|
1223
571
|
},
|
|
1224
572
|
});
|
|
1225
|
-
return this.executeRequest$(request).pipe(map
|
|
573
|
+
return this.executeRequest$(request).pipe(map(response => response.selectors[requestId]));
|
|
1226
574
|
}
|
|
1227
575
|
subscribe$(scope, selectorName, inputData, options) {
|
|
1228
576
|
const requestId = this.generateRequestId(scope, selectorName, inputData);
|
|
@@ -1248,7 +596,7 @@ class FlowStateService {
|
|
|
1248
596
|
this.executeRequest$(request).subscribe();
|
|
1249
597
|
}
|
|
1250
598
|
}
|
|
1251
|
-
return subscription.data$.pipe(filter
|
|
599
|
+
return subscription.data$.pipe(filter(data => data != this.NOT_INITIALIZED), map(data => data), finalize(() => {
|
|
1252
600
|
var _a;
|
|
1253
601
|
if (!((_a = this.subscriptions[requestId]) === null || _a === void 0 ? void 0 : _a.data$.observed)) {
|
|
1254
602
|
delete this.subscriptions[requestId];
|
|
@@ -1256,9 +604,9 @@ class FlowStateService {
|
|
|
1256
604
|
}));
|
|
1257
605
|
}
|
|
1258
606
|
save$() {
|
|
1259
|
-
if (this.
|
|
607
|
+
if (this.flowInfoService.flow.properties.stateful) {
|
|
1260
608
|
if (this.stateId$.value) {
|
|
1261
|
-
return this.flowStateApiService.save(this.stateId$.value).pipe(map
|
|
609
|
+
return this.flowStateApiService.save(this.stateId$.value).pipe(map(({ quoteId }) => ({ id: quoteId })), tap(() => {
|
|
1262
610
|
Array.from(this.trackedStatefulChangesMap.keys()).forEach(key => {
|
|
1263
611
|
this.trackedStatefulChangesMap.set(key, false);
|
|
1264
612
|
});
|
|
@@ -1274,9 +622,9 @@ class FlowStateService {
|
|
|
1274
622
|
return of({ id: '' });
|
|
1275
623
|
}
|
|
1276
624
|
submit$() {
|
|
1277
|
-
if (this.
|
|
625
|
+
if (this.flowInfoService.flow.properties.stateful) {
|
|
1278
626
|
if (this.stateId$.value) {
|
|
1279
|
-
return this.flowStateApiService.submit(this.stateId$.value).pipe(map
|
|
627
|
+
return this.flowStateApiService.submit(this.stateId$.value).pipe(map(({ quoteId }) => ({ id: quoteId })));
|
|
1280
628
|
}
|
|
1281
629
|
}
|
|
1282
630
|
else {
|
|
@@ -1326,10 +674,10 @@ class FlowStateService {
|
|
|
1326
674
|
fullRequest.selectors = assign(fullRequest.selectors, subscription.request.selectors);
|
|
1327
675
|
}
|
|
1328
676
|
}
|
|
1329
|
-
const execution$ = this.
|
|
677
|
+
const execution$ = this.flowInfoService.flow.properties.stateful
|
|
1330
678
|
? this.executeStateful$(fullRequest)
|
|
1331
679
|
: this.executeStateless$(fullRequest);
|
|
1332
|
-
return execution$.pipe(tap
|
|
680
|
+
return execution$.pipe(tap(result => this.handleSelectorsResponse(result.selectors)));
|
|
1333
681
|
}
|
|
1334
682
|
handleSelectorsResponse(selectors) {
|
|
1335
683
|
Object.entries(selectors).forEach(([requestId, selectorResult]) => {
|
|
@@ -1359,7 +707,7 @@ class FlowStateService {
|
|
|
1359
707
|
selectorsOverride: processors === null || processors === void 0 ? void 0 : processors.filter(processor => processor.type === ConfigurationProcessorTypes.SELECTOR),
|
|
1360
708
|
selectors: selectors,
|
|
1361
709
|
})
|
|
1362
|
-
.pipe(map
|
|
710
|
+
.pipe(map(({ stateId, selectors }) => {
|
|
1363
711
|
this.handleSelectorsResponse(selectors);
|
|
1364
712
|
this.stateId$.next(stateId);
|
|
1365
713
|
}));
|
|
@@ -1379,31 +727,31 @@ class FlowStateService {
|
|
|
1379
727
|
};
|
|
1380
728
|
this.executionInProgress$.next(true);
|
|
1381
729
|
return this.flowStateApiService.execute(this.stateId$.value, request);
|
|
1382
|
-
}), tap
|
|
730
|
+
}), tap(({ stateId }) => this.stateId$.next(stateId)), share(), tap(() => this.executionInProgress$.next(false)), catchError(e => {
|
|
1383
731
|
this.executionInProgress$.next(false);
|
|
1384
732
|
return throwError(() => e);
|
|
1385
733
|
}));
|
|
1386
734
|
}
|
|
1387
735
|
executeStateful$(request) {
|
|
1388
|
-
return this.executionInProgress$.pipe(filter
|
|
736
|
+
return this.executionInProgress$.pipe(filter(inProgress => !inProgress), take(1), switchMap(() =>
|
|
1389
737
|
// make sure stream switches to statefulExecutionRequest$ before pushing an execution request
|
|
1390
738
|
combineLatest([
|
|
1391
739
|
this.statefulExecutionRequest$,
|
|
1392
|
-
of(undefined).pipe(tap
|
|
1393
|
-
])), map
|
|
740
|
+
of(undefined).pipe(tap(() => this.statefulRequestStream$.next(request))),
|
|
741
|
+
])), map(([response]) => response), take(1));
|
|
1394
742
|
}
|
|
1395
743
|
initStateless$() {
|
|
1396
|
-
return this.salesTransactionService.init(this.flowInfoService.context.headerId, this.flowInfoService.context).pipe(tap
|
|
744
|
+
return this.salesTransactionService.init(this.flowInfoService.context.headerId, this.flowInfoService.context).pipe(tap(() => {
|
|
1397
745
|
var _a;
|
|
1398
746
|
const assets = (_a = this.salesTransactionService.state) === null || _a === void 0 ? void 0 : _a.assets;
|
|
1399
747
|
if (assets) {
|
|
1400
748
|
this.flowStore = Object.assign(Object.assign({}, this.flowStore), { assets });
|
|
1401
749
|
}
|
|
1402
|
-
}), switchMap(state => this.flowConfiguration.calculate$(state)), tap
|
|
750
|
+
}), switchMap(state => this.flowConfiguration.calculate$(state)), tap(() => this.salesTransactionService.finalizeInit()), map(noop));
|
|
1403
751
|
}
|
|
1404
752
|
executeStateless$(request) {
|
|
1405
753
|
this.executionInProgress$.next(true);
|
|
1406
|
-
return of(undefined).pipe(tap
|
|
754
|
+
return of(undefined).pipe(tap(() => this.executeStatelessActions(request)), switchMap(() => {
|
|
1407
755
|
var _a;
|
|
1408
756
|
/*
|
|
1409
757
|
Skip price calculation in case
|
|
@@ -1417,7 +765,7 @@ class FlowStateService {
|
|
|
1417
765
|
else {
|
|
1418
766
|
return this.flowConfiguration.calculate$(state);
|
|
1419
767
|
}
|
|
1420
|
-
}), map
|
|
768
|
+
}), map(() => this.executeStatelessSelectors(request)), tap(() => this.executionInProgress$.next(false)), catchError(e => {
|
|
1421
769
|
this.executionInProgress$.next(false);
|
|
1422
770
|
return throwError(() => e);
|
|
1423
771
|
}));
|
|
@@ -1465,17 +813,10 @@ class FlowStateService {
|
|
|
1465
813
|
return result;
|
|
1466
814
|
}, { stateId: '', selectors: {} });
|
|
1467
815
|
}
|
|
1468
|
-
getFlowSafe() {
|
|
1469
|
-
if (!this.flowInfoService.flow) {
|
|
1470
|
-
throw 'Flow is not defined';
|
|
1471
|
-
}
|
|
1472
|
-
return this.flowInfoService.flow;
|
|
1473
|
-
}
|
|
1474
816
|
initProcessors$() {
|
|
1475
817
|
var _a;
|
|
1476
818
|
const hasOverrides = Boolean((_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplateConfigurationProcessors);
|
|
1477
|
-
|
|
1478
|
-
if (flow.properties.stateful && !hasOverrides) {
|
|
819
|
+
if (this.flowInfoService.flow.properties.stateful && !hasOverrides) {
|
|
1479
820
|
// Skip initialization as backend will take processors from SF
|
|
1480
821
|
return of(undefined);
|
|
1481
822
|
}
|
|
@@ -1486,7 +827,7 @@ class FlowStateService {
|
|
|
1486
827
|
return;
|
|
1487
828
|
}
|
|
1488
829
|
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);
|
|
1489
|
-
return localProcessors$.pipe(switchMap(processors => processors ? of(processors) : this.processorsApiService.fetchConfigurationProcessors$(template.id)), tap
|
|
830
|
+
return localProcessors$.pipe(switchMap(processors => processors ? of(processors) : this.processorsApiService.fetchConfigurationProcessors$(template.id)), tap(processors => {
|
|
1490
831
|
const processorsMap = processors.reduce((acc, p) => {
|
|
1491
832
|
acc[p.apiName] = p;
|
|
1492
833
|
return acc;
|
|
@@ -1498,7 +839,7 @@ class FlowStateService {
|
|
|
1498
839
|
if (!owners$.length) {
|
|
1499
840
|
return of(undefined);
|
|
1500
841
|
}
|
|
1501
|
-
return forkJoin(owners$).pipe(map
|
|
842
|
+
return forkJoin(owners$).pipe(map(noop));
|
|
1502
843
|
}
|
|
1503
844
|
executeActionScript(request, executable) {
|
|
1504
845
|
var _a;
|
|
@@ -1550,12 +891,12 @@ class FlowStateService {
|
|
|
1550
891
|
}
|
|
1551
892
|
}
|
|
1552
893
|
}
|
|
1553
|
-
FlowStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, deps: [{ token:
|
|
894
|
+
FlowStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, deps: [{ token: FlowConfigurationService }, { token: FlowInfoService }, { token: i1.FlowStateApiService }, { token: i4.ConfigurationProcessorsApiService }, { token: i4.SalesTransactionApiService }, { token: SalesTransactionService }, { token: i6.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1554
895
|
FlowStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService });
|
|
1555
896
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, decorators: [{
|
|
1556
897
|
type: Injectable
|
|
1557
898
|
}], ctorParameters: function () {
|
|
1558
|
-
return [{ type:
|
|
899
|
+
return [{ type: FlowConfigurationService }, { type: FlowInfoService }, { type: i1.FlowStateApiService }, { type: i4.ConfigurationProcessorsApiService }, { type: i4.SalesTransactionApiService }, { type: SalesTransactionService }, { type: i6.ToastService }, { type: undefined, decorators: [{
|
|
1559
900
|
type: Optional
|
|
1560
901
|
}, {
|
|
1561
902
|
type: Inject,
|
|
@@ -1564,15 +905,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1564
905
|
} });
|
|
1565
906
|
|
|
1566
907
|
class FlowStateConfigurationService {
|
|
1567
|
-
constructor(flowInfoService,
|
|
908
|
+
constructor(flowInfoService, flowStateService) {
|
|
1568
909
|
this.flowInfoService = flowInfoService;
|
|
1569
|
-
this.flowConfigurationService = flowConfigurationService;
|
|
1570
|
-
this.flowStateApiService = flowStateApiService;
|
|
1571
910
|
this.flowStateService = flowStateService;
|
|
1572
|
-
this.configurationStateId$ = new BehaviorSubject(null);
|
|
1573
|
-
}
|
|
1574
|
-
get configurationStateId() {
|
|
1575
|
-
return this.configurationStateId$.value;
|
|
1576
911
|
}
|
|
1577
912
|
addToCart$(props) {
|
|
1578
913
|
var _a;
|
|
@@ -1584,26 +919,22 @@ class FlowStateConfigurationService {
|
|
|
1584
919
|
request$ = of();
|
|
1585
920
|
}
|
|
1586
921
|
else {
|
|
1587
|
-
|
|
1588
|
-
request$ =
|
|
1589
|
-
if (!this.configurationStateId) {
|
|
1590
|
-
return of();
|
|
1591
|
-
}
|
|
1592
|
-
return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(tap$1(() => this.configurationStateId$.next(null)), map$2(noop));
|
|
1593
|
-
}));
|
|
922
|
+
// TODO: Implement
|
|
923
|
+
request$ = of();
|
|
1594
924
|
}
|
|
1595
925
|
}
|
|
1596
926
|
else {
|
|
1597
|
-
|
|
927
|
+
// TODO: Implement
|
|
928
|
+
request$ = of();
|
|
1598
929
|
}
|
|
1599
|
-
return request$.pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), map
|
|
930
|
+
return request$.pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), map(noop));
|
|
1600
931
|
}
|
|
1601
932
|
}
|
|
1602
|
-
FlowStateConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, deps: [{ token: FlowInfoService }, { token:
|
|
933
|
+
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 });
|
|
1603
934
|
FlowStateConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService });
|
|
1604
935
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, decorators: [{
|
|
1605
936
|
type: Injectable
|
|
1606
|
-
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type:
|
|
937
|
+
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: FlowStateService }]; } });
|
|
1607
938
|
|
|
1608
939
|
class IntegrationState {
|
|
1609
940
|
constructor() {
|
|
@@ -1623,12 +954,12 @@ class IntegrationState {
|
|
|
1623
954
|
this.action$.next(action);
|
|
1624
955
|
}
|
|
1625
956
|
listen$(actionType) {
|
|
1626
|
-
return this.action$.pipe(filter
|
|
957
|
+
return this.action$.pipe(filter(action => action.type === actionType), map(action => action.payload));
|
|
1627
958
|
}
|
|
1628
959
|
listenAll$() {
|
|
1629
960
|
return this.action$.asObservable();
|
|
1630
961
|
}
|
|
1631
|
-
|
|
962
|
+
reset() {
|
|
1632
963
|
this.stateSubj$.next({});
|
|
1633
964
|
}
|
|
1634
965
|
}
|
|
@@ -1648,12 +979,12 @@ class ProductImagesService {
|
|
|
1648
979
|
this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: '' }));
|
|
1649
980
|
this.fetchProductImage(productId);
|
|
1650
981
|
}
|
|
1651
|
-
return this.imagesMap$.pipe(map
|
|
982
|
+
return this.imagesMap$.pipe(map(imagesMap => { var _a; return (_a = imagesMap[productId]) !== null && _a !== void 0 ? _a : null; }), distinctUntilChanged());
|
|
1652
983
|
}
|
|
1653
984
|
fetchProductImage(productId) {
|
|
1654
985
|
this.productApiService
|
|
1655
986
|
.fetchImage$(productId)
|
|
1656
|
-
.pipe(map
|
|
987
|
+
.pipe(map(file => URL.createObjectURL(file)), catchError(() => of('')), tap(url => this.imagesMap$.next(Object.assign(Object.assign({}, this.imagesMap$.value), { [productId]: url }))))
|
|
1657
988
|
.subscribe();
|
|
1658
989
|
}
|
|
1659
990
|
}
|
|
@@ -1664,142 +995,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
1664
995
|
}], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
|
|
1665
996
|
|
|
1666
997
|
class ConfigurationService {
|
|
1667
|
-
|
|
1668
|
-
this.
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
this.
|
|
1672
|
-
|
|
1673
|
-
|
|
998
|
+
get state$() {
|
|
999
|
+
return this.configurationStateSubj$.asObservable().pipe(filter$1(isDefined));
|
|
1000
|
+
}
|
|
1001
|
+
get state() {
|
|
1002
|
+
return this.configurationStateSubj$.getValue();
|
|
1003
|
+
}
|
|
1004
|
+
get previousState() {
|
|
1005
|
+
return this.previousConfigurationStateSubj$.getValue();
|
|
1006
|
+
}
|
|
1007
|
+
get asset() {
|
|
1008
|
+
var _a, _b;
|
|
1009
|
+
return (_b = (_a = this.state) === null || _a === void 0 ? void 0 : _a.assets[0]) !== null && _b !== void 0 ? _b : null;
|
|
1010
|
+
}
|
|
1011
|
+
get root$() {
|
|
1012
|
+
return this.state$.pipe(map$1(state => state.salesTransactionItems[0]), filter$1(isDefined));
|
|
1013
|
+
}
|
|
1014
|
+
get root() {
|
|
1015
|
+
var _a, _b;
|
|
1016
|
+
return (_b = (_a = this.configurationStateSubj$.getValue()) === null || _a === void 0 ? void 0 : _a.salesTransactionItems[0]) !== null && _b !== void 0 ? _b : null;
|
|
1017
|
+
}
|
|
1018
|
+
constructor(flowInfoService, messageService, configurationRuntimeService, salesTransactionService, proceduresApiService) {
|
|
1674
1019
|
this.flowInfoService = flowInfoService;
|
|
1675
|
-
this.
|
|
1676
|
-
this.
|
|
1677
|
-
this.
|
|
1020
|
+
this.messageService = messageService;
|
|
1021
|
+
this.configurationRuntimeService = configurationRuntimeService;
|
|
1022
|
+
this.salesTransactionService = salesTransactionService;
|
|
1023
|
+
this.proceduresApiService = proceduresApiService;
|
|
1024
|
+
this.hasUnsavedChanges = false;
|
|
1025
|
+
this.configurationStateSubj$ = new BehaviorSubject(null);
|
|
1026
|
+
this.previousConfigurationStateSubj$ = new BehaviorSubject(null);
|
|
1678
1027
|
this.isLoadingSubj$ = new BehaviorSubject(false);
|
|
1679
1028
|
this.isLoading$ = this.isLoadingSubj$.asObservable();
|
|
1680
|
-
this.hasUnsavedChanges = false;
|
|
1681
1029
|
}
|
|
1682
1030
|
reset() {
|
|
1683
1031
|
this.hasUnsavedChanges = false;
|
|
1684
|
-
this.
|
|
1685
|
-
this.
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1032
|
+
this.configurationStateSubj$.next(null);
|
|
1033
|
+
this.previousConfigurationStateSubj$.next(null);
|
|
1034
|
+
}
|
|
1035
|
+
init$() {
|
|
1036
|
+
const { state } = this.salesTransactionService;
|
|
1037
|
+
const { productId, transactionItemId } = this.flowInfoService.context;
|
|
1038
|
+
if (!state) {
|
|
1039
|
+
return of(undefined);
|
|
1040
|
+
}
|
|
1041
|
+
let transactionItem = state === null || state === void 0 ? void 0 : state.salesTransactionItems.find(item => item.id === transactionItemId);
|
|
1042
|
+
if (!transactionItem) {
|
|
1043
|
+
transactionItem = state.salesTransactionItems.find(item => item.productId === productId);
|
|
1044
|
+
}
|
|
1045
|
+
const assetItem = transactionItem ? state === null || state === void 0 ? void 0 : state.assets.find(item => item.id === (transactionItem === null || transactionItem === void 0 ? void 0 : transactionItem.assetId)) : undefined;
|
|
1046
|
+
const configurationState = Object.assign(Object.assign({}, state), { salesTransactionItems: transactionItem ? [transactionItem] : [], assets: assetItem ? [assetItem] : [] });
|
|
1047
|
+
this.configurationStateSubj$.next(configurationState);
|
|
1048
|
+
this.previousConfigurationStateSubj$.next(configurationState);
|
|
1049
|
+
return of(undefined);
|
|
1050
|
+
}
|
|
1051
|
+
patch$(transactionItem) {
|
|
1052
|
+
const { state, root } = this;
|
|
1053
|
+
if (!state) {
|
|
1054
|
+
return throwError(() => new Error(`Configuration State is not initialized`));
|
|
1055
|
+
}
|
|
1056
|
+
if (!root) {
|
|
1057
|
+
return throwError(() => new Error(`Root SalesTransactionItem not found`));
|
|
1058
|
+
}
|
|
1059
|
+
const newRoot = new TransactionItemWorker(root).replace(transactionItem).ti;
|
|
1060
|
+
const newSalesTransaction = Object.assign(Object.assign({}, state), { salesTransactionItems: [newRoot] });
|
|
1061
|
+
return this.configureRequest$(newSalesTransaction).pipe(catchError$1(error => {
|
|
1696
1062
|
console.error(error);
|
|
1697
|
-
if (!this.
|
|
1063
|
+
if (!this.configurationRuntimeService.uiDefinitionProps.suppressToastMessages) {
|
|
1698
1064
|
this.messageService.add({ severity: 'error', summary: error });
|
|
1699
1065
|
}
|
|
1700
|
-
// bounce back if configuration call has failed
|
|
1701
|
-
const prevState = this.configurationState.value;
|
|
1702
|
-
this.configurationState.next(prevState ? Object.assign({}, prevState) : null);
|
|
1703
1066
|
return throwError(() => error);
|
|
1704
|
-
}), tap(() => {
|
|
1067
|
+
}), tap$1(() => {
|
|
1705
1068
|
if (!this.hasUnsavedChanges) {
|
|
1706
1069
|
this.hasUnsavedChanges = true;
|
|
1707
1070
|
}
|
|
1708
|
-
}));
|
|
1709
|
-
}
|
|
1710
|
-
patch(lineItem) {
|
|
1711
|
-
this.patch$(lineItem).subscribe();
|
|
1712
|
-
}
|
|
1713
|
-
setConfigurableRamp(lineItem) {
|
|
1714
|
-
this.configurableRamp = lineItem;
|
|
1715
|
-
}
|
|
1716
|
-
get() {
|
|
1717
|
-
return this.configurationState.pipe(map(state => state === null || state === void 0 ? void 0 : state.lineItem), shareReplay$1());
|
|
1718
|
-
}
|
|
1719
|
-
getSnapshot() {
|
|
1720
|
-
var _a, _b;
|
|
1721
|
-
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;
|
|
1722
|
-
}
|
|
1723
|
-
getRuntimeModel() {
|
|
1724
|
-
const runtimeModel = this.runtimeService.runtimeModel;
|
|
1725
|
-
if (!runtimeModel) {
|
|
1726
|
-
throw new Error('Runtime model not initialized');
|
|
1727
|
-
}
|
|
1728
|
-
return runtimeModel;
|
|
1729
|
-
}
|
|
1730
|
-
getRuntimeContext() {
|
|
1731
|
-
const runtimeContext = this.runtimeService.runtimeContext;
|
|
1732
|
-
if (!runtimeContext) {
|
|
1733
|
-
throw new Error('Runtime context not initialized');
|
|
1734
|
-
}
|
|
1735
|
-
return runtimeContext;
|
|
1071
|
+
}), map$1(noop));
|
|
1736
1072
|
}
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
}
|
|
1740
|
-
get stateSnapshot() {
|
|
1741
|
-
return this.configurationState.value;
|
|
1742
|
-
}
|
|
1743
|
-
get previousStateSnapshot() {
|
|
1744
|
-
return this.previousConfigurationState.value;
|
|
1745
|
-
}
|
|
1746
|
-
get charges$() {
|
|
1747
|
-
return this.configurationState.pipe(map(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.charges) !== null && _a !== void 0 ? _a : {}; }));
|
|
1748
|
-
}
|
|
1749
|
-
get chargesSnapshot() {
|
|
1750
|
-
var _a, _b;
|
|
1751
|
-
return (_b = (_a = this.configurationState.value) === null || _a === void 0 ? void 0 : _a.charges) !== null && _b !== void 0 ? _b : {};
|
|
1752
|
-
}
|
|
1753
|
-
get pricePlans$() {
|
|
1754
|
-
return this.configurationState.pipe(map(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.pricePlans) !== null && _a !== void 0 ? _a : {}; }));
|
|
1755
|
-
}
|
|
1756
|
-
get pricePlansSnapshot() {
|
|
1757
|
-
var _a, _b;
|
|
1758
|
-
return (_b = (_a = this.configurationState.value) === null || _a === void 0 ? void 0 : _a.pricePlans) !== null && _b !== void 0 ? _b : {};
|
|
1759
|
-
}
|
|
1760
|
-
get procedureContext$() {
|
|
1761
|
-
return this.configurationState.pipe(map(state => { var _a; return (_a = state === null || state === void 0 ? void 0 : state.procedureContext) !== null && _a !== void 0 ? _a : {}; }));
|
|
1762
|
-
}
|
|
1763
|
-
get procedureContextSnapshot() {
|
|
1764
|
-
var _a, _b;
|
|
1765
|
-
return (_b = (_a = this.configurationState.value) === null || _a === void 0 ? void 0 : _a.procedureContext) !== null && _b !== void 0 ? _b : {};
|
|
1073
|
+
patch(transactionItem) {
|
|
1074
|
+
this.patch$(transactionItem).subscribe();
|
|
1766
1075
|
}
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
var _a;
|
|
1772
|
-
const runtimeContext = this.getRuntimeContext();
|
|
1773
|
-
const runtimeModel = this.getRuntimeModel();
|
|
1774
|
-
const uiDefinitionProperties = this.getUIDefinitionProperties();
|
|
1775
|
-
const mainPricingEnabled = (_a = runtimeContext.properties) === null || _a === void 0 ? void 0 : _a.PricingEnabled;
|
|
1776
|
-
const pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
|
|
1777
|
-
const customPriceApi = this.runtimeSettings.getConfigurationSettings()['CUSTOM_PRICE_API'];
|
|
1076
|
+
configureRequest$(salesTransaction) {
|
|
1077
|
+
const request = {
|
|
1078
|
+
salesTransaction,
|
|
1079
|
+
};
|
|
1778
1080
|
this.isLoadingSubj$.next(true);
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
: this.extendedConfigureLineItem$({
|
|
1786
|
-
configurationRequest,
|
|
1787
|
-
runtimeModel,
|
|
1788
|
-
pricingEnabled,
|
|
1789
|
-
});
|
|
1790
|
-
return configure$.pipe(tap(result => {
|
|
1791
|
-
var _a;
|
|
1792
|
-
this.configurationState.next(result);
|
|
1793
|
-
this.previousConfigurationState.next(cloneDeep(result));
|
|
1794
|
-
if ((_a = result.deletedLineItems) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1795
|
-
this.showInactiveProductsConfirmation();
|
|
1796
|
-
}
|
|
1797
|
-
this.configurableRamp = result.lineItem;
|
|
1798
|
-
}), map(({ lineItem }) => lineItem), catchError$1(error => throwError(() => {
|
|
1799
|
-
const resetState = this.previousConfigurationState.value;
|
|
1081
|
+
return this.proceduresApiService.apply$(request).pipe(tap$1(result => {
|
|
1082
|
+
const newState = result.salesTransaction;
|
|
1083
|
+
this.configurationStateSubj$.next(newState);
|
|
1084
|
+
this.previousConfigurationStateSubj$.next(cloneDeep(newState));
|
|
1085
|
+
}), map$1(response => response.salesTransaction), catchError$1(error => throwError(() => {
|
|
1086
|
+
const resetState = this.previousConfigurationStateSubj$.getValue();
|
|
1800
1087
|
if (resetState) {
|
|
1801
|
-
this.
|
|
1802
|
-
this.
|
|
1088
|
+
this.previousConfigurationStateSubj$.next(cloneDeep(resetState));
|
|
1089
|
+
this.configurationStateSubj$.next(resetState);
|
|
1803
1090
|
}
|
|
1804
1091
|
if (error.error) {
|
|
1805
1092
|
return extractErrorDetails(error.error).join('. ');
|
|
@@ -1808,123 +1095,31 @@ class ConfigurationService {
|
|
|
1808
1095
|
})), finalize$1(() => this.isLoadingSubj$.next(false)));
|
|
1809
1096
|
}
|
|
1810
1097
|
configureExternal$(props) {
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
.pipe(switchMap$1(() => this.configure()), first(), catchError$1(error => {
|
|
1814
|
-
this.messageService.add({ severity: ToastType.error, summary: error });
|
|
1815
|
-
throw error;
|
|
1816
|
-
}), finalize$1(() => this.reset()));
|
|
1098
|
+
// TODO: implement
|
|
1099
|
+
throw new Error('Not implemented');
|
|
1817
1100
|
}
|
|
1818
1101
|
configureGuidedSelling$(data) {
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
}).pipe(catchError$1(error => {
|
|
1822
|
-
if (error instanceof HttpErrorResponse) {
|
|
1823
|
-
this.messageService.add({ severity: ToastType.error, summary: error.error.message || error.error });
|
|
1824
|
-
}
|
|
1825
|
-
throw error;
|
|
1826
|
-
}));
|
|
1827
|
-
}
|
|
1828
|
-
generateRequest(lightMode = true) {
|
|
1829
|
-
var _a, _b, _c, _d;
|
|
1830
|
-
const lineItem = this.generateLineItem();
|
|
1831
|
-
let request = {
|
|
1832
|
-
lineItem,
|
|
1833
|
-
mode: this.mode,
|
|
1834
|
-
step: !((_a = this.configurationState.value) === null || _a === void 0 ? void 0 : _a.lineItem) ? RuntimeStep.START : RuntimeStep.UPDATE,
|
|
1835
|
-
attributeDomainMode: 'ALL',
|
|
1836
|
-
context: (_c = (_b = this.quoteDraftService.quoteDraft) === null || _b === void 0 ? void 0 : _b.context) !== null && _c !== void 0 ? _c : generateEmptyContext(),
|
|
1837
|
-
lineItems: ((_d = this.quoteDraftService.quoteDraft) === null || _d === void 0 ? void 0 : _d.currentState) || [],
|
|
1838
|
-
asset: this.getAsset(),
|
|
1839
|
-
};
|
|
1840
|
-
if (lightMode) {
|
|
1841
|
-
request = ConfigurationTranslatorUtils.lightenConfigurationRequest(request);
|
|
1842
|
-
}
|
|
1843
|
-
return request;
|
|
1844
|
-
}
|
|
1845
|
-
generateLineItem() {
|
|
1846
|
-
var _a;
|
|
1847
|
-
const runtimeContext = this.getRuntimeContext();
|
|
1848
|
-
const uiDefinitionProperties = this.getUIDefinitionProperties();
|
|
1849
|
-
let lineItem = this.configurableRamp;
|
|
1850
|
-
if (!lineItem) {
|
|
1851
|
-
const { initializationProps } = (_a = this.runtimeService) !== null && _a !== void 0 ? _a : {};
|
|
1852
|
-
lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.defaultQty);
|
|
1853
|
-
// Set default attributes
|
|
1854
|
-
if (initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap) {
|
|
1855
|
-
const attributes = transform(initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.attributesMap, (acc, value, name) => acc.push({ name, value }), []);
|
|
1856
|
-
lineItem = new LineItemWorker(lineItem).patchAttribute(attributes).li;
|
|
1857
|
-
}
|
|
1858
|
-
}
|
|
1859
|
-
return lineItem;
|
|
1860
|
-
}
|
|
1861
|
-
getAsset() {
|
|
1862
|
-
var _a, _b;
|
|
1863
|
-
const lineItem = this.configurableRamp;
|
|
1864
|
-
if (!lineItem) {
|
|
1865
|
-
return;
|
|
1866
|
-
}
|
|
1867
|
-
const assetId = (_a = lineItem.assetId) !== null && _a !== void 0 ? _a : lineItem.openOrderLineItemId;
|
|
1868
|
-
return (_b = this.quoteDraftService.assetsState) === null || _b === void 0 ? void 0 : _b.initialState.find(li => assetPredicateFn(li, assetId));
|
|
1869
|
-
}
|
|
1870
|
-
getUIDefinitionProperties() {
|
|
1871
|
-
var _a, _b, _c;
|
|
1872
|
-
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 : {}));
|
|
1873
|
-
}
|
|
1874
|
-
showInactiveProductsConfirmation() {
|
|
1875
|
-
const confirmationConfig = {
|
|
1876
|
-
title: ' ',
|
|
1877
|
-
description: 'This quote contains inactive products. Do you want to remove them?',
|
|
1878
|
-
primaryButtonLabel: 'Remove products',
|
|
1879
|
-
secondaryButtonLabel: 'Back to Quote',
|
|
1880
|
-
};
|
|
1881
|
-
this.dialogService
|
|
1882
|
-
.open(ConfirmationComponent, {
|
|
1883
|
-
dismissableMask: false,
|
|
1884
|
-
closeOnEscape: false,
|
|
1885
|
-
closable: false,
|
|
1886
|
-
showHeader: true,
|
|
1887
|
-
header: `Inactive Products in Quote`,
|
|
1888
|
-
width: '440px',
|
|
1889
|
-
data: { confirmationConfig },
|
|
1890
|
-
})
|
|
1891
|
-
.onClose.subscribe(result => {
|
|
1892
|
-
var _a, _b;
|
|
1893
|
-
if (!result) {
|
|
1894
|
-
const Id = (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.context.properties.Id) !== null && _b !== void 0 ? _b : '';
|
|
1895
|
-
window['VELO_BACK_FN'].apply(null, [Id]);
|
|
1896
|
-
}
|
|
1897
|
-
});
|
|
1898
|
-
}
|
|
1899
|
-
extendedConfigureLineItem$({ configurationRequest, runtimeModel, pricingEnabled, }) {
|
|
1900
|
-
return this.configurationApiService.configureLineItem({
|
|
1901
|
-
configurationRequest: configurationRequest,
|
|
1902
|
-
runtimeModel,
|
|
1903
|
-
pricingEnabled,
|
|
1904
|
-
});
|
|
1102
|
+
// TODO: implement
|
|
1103
|
+
throw new Error('Not implemented');
|
|
1905
1104
|
}
|
|
1906
1105
|
}
|
|
1907
|
-
ConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, deps: [{ token:
|
|
1106
|
+
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: i4.ProceduresApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1908
1107
|
ConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService });
|
|
1909
1108
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationService, decorators: [{
|
|
1910
1109
|
type: Injectable
|
|
1911
|
-
}], ctorParameters: function () { return [{ type:
|
|
1110
|
+
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: i2.MessageService }, { type: ConfigurationRuntimeService }, { type: SalesTransactionService }, { type: i4.ProceduresApiService }]; } });
|
|
1912
1111
|
|
|
1913
1112
|
class ConfigurationStateService {
|
|
1914
|
-
constructor(configurationRuntimeService, configurationService,
|
|
1915
|
-
// private quoteDraftService: QuoteDraftService,
|
|
1916
|
-
salesTransactionService, toastService, flowStateService, flowInfoService, flowConfigurationService, flowStateApiService,
|
|
1917
|
-
// private quoteApiService: QuoteApiService,
|
|
1918
|
-
salesTransactionApiService) {
|
|
1113
|
+
constructor(configurationRuntimeService, configurationService, flowStateService, flowInfoService, flowConfigurationService, flowStateApiService, salesTransactionService, salesTransactionApiService, toastService) {
|
|
1919
1114
|
this.configurationRuntimeService = configurationRuntimeService;
|
|
1920
1115
|
this.configurationService = configurationService;
|
|
1921
|
-
this.salesTransactionService = salesTransactionService;
|
|
1922
|
-
this.toastService = toastService;
|
|
1923
1116
|
this.flowStateService = flowStateService;
|
|
1924
1117
|
this.flowInfoService = flowInfoService;
|
|
1925
1118
|
this.flowConfigurationService = flowConfigurationService;
|
|
1926
1119
|
this.flowStateApiService = flowStateApiService;
|
|
1120
|
+
this.salesTransactionService = salesTransactionService;
|
|
1927
1121
|
this.salesTransactionApiService = salesTransactionApiService;
|
|
1122
|
+
this.toastService = toastService;
|
|
1928
1123
|
this.isInitialized$ = new BehaviorSubject(false);
|
|
1929
1124
|
this.canceledConfiguration$ = new Subject();
|
|
1930
1125
|
this.NOT_INITIALIZED = Symbol();
|
|
@@ -1948,9 +1143,9 @@ class ConfigurationStateService {
|
|
|
1948
1143
|
request$ = this.initStateful$();
|
|
1949
1144
|
}
|
|
1950
1145
|
else {
|
|
1951
|
-
request$ =
|
|
1146
|
+
request$ = this.configurationService.init$();
|
|
1952
1147
|
}
|
|
1953
|
-
return request$.pipe(take
|
|
1148
|
+
return request$.pipe(take(1), tap(() => {
|
|
1954
1149
|
this.isInitialized$.next(true);
|
|
1955
1150
|
this.canceledConfiguration$ = new Subject();
|
|
1956
1151
|
}));
|
|
@@ -1964,10 +1159,11 @@ class ConfigurationStateService {
|
|
|
1964
1159
|
this.configurationStore = {};
|
|
1965
1160
|
this.executedFunctions = {};
|
|
1966
1161
|
this.configurationService.reset();
|
|
1162
|
+
this.configurationRuntimeService.reset();
|
|
1967
1163
|
}
|
|
1968
1164
|
execute$(exec) {
|
|
1969
1165
|
const request = this.execToRequest(exec);
|
|
1970
|
-
return this.executeRequest$(request).pipe(map
|
|
1166
|
+
return this.executeRequest$(request).pipe(map(result => {
|
|
1971
1167
|
// Keep only requested results
|
|
1972
1168
|
const actualSelectors = Object.entries(result.selectors).reduce((trunk, [requestId, result]) => {
|
|
1973
1169
|
var _a;
|
|
@@ -1990,7 +1186,7 @@ class ConfigurationStateService {
|
|
|
1990
1186
|
}
|
|
1991
1187
|
// prevent parallel configuration requests in stateless mode
|
|
1992
1188
|
if (!this.statelessExecutionRequest$) {
|
|
1993
|
-
this.statelessExecutionRequest$ = executionRequest$.pipe(shareReplay
|
|
1189
|
+
this.statelessExecutionRequest$ = executionRequest$.pipe(shareReplay(), take(1), finalize(() => (this.statelessExecutionRequest$ = null)));
|
|
1994
1190
|
}
|
|
1995
1191
|
return this.statelessExecutionRequest$;
|
|
1996
1192
|
}
|
|
@@ -2004,7 +1200,7 @@ class ConfigurationStateService {
|
|
|
2004
1200
|
},
|
|
2005
1201
|
},
|
|
2006
1202
|
});
|
|
2007
|
-
return this.executeRequest$(request).pipe(map
|
|
1203
|
+
return this.executeRequest$(request).pipe(map(response => response.selectors[requestId]));
|
|
2008
1204
|
}
|
|
2009
1205
|
subscribe$(selectorName, inputData = {}, options) {
|
|
2010
1206
|
const requestId = UUID.UUID();
|
|
@@ -2027,7 +1223,7 @@ class ConfigurationStateService {
|
|
|
2027
1223
|
this.executeRequest$(request).subscribe();
|
|
2028
1224
|
}
|
|
2029
1225
|
}
|
|
2030
|
-
return subscription.data$.pipe(filter
|
|
1226
|
+
return subscription.data$.pipe(filter(data => data != this.NOT_INITIALIZED), map(data => data), distinctUntilChanged(), finalize(() => {
|
|
2031
1227
|
var _a;
|
|
2032
1228
|
if (!((_a = this.subscriptions[requestId]) === null || _a === void 0 ? void 0 : _a.data$.observed)) {
|
|
2033
1229
|
delete this.subscriptions[requestId];
|
|
@@ -2037,7 +1233,7 @@ class ConfigurationStateService {
|
|
|
2037
1233
|
saveConfiguration() {
|
|
2038
1234
|
var _a, _b;
|
|
2039
1235
|
if (this.isStatefulConfiguration) {
|
|
2040
|
-
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
|
|
1236
|
+
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 })));
|
|
2041
1237
|
}
|
|
2042
1238
|
const state = this.salesTransactionService.state;
|
|
2043
1239
|
if (!state) {
|
|
@@ -2047,27 +1243,21 @@ class ConfigurationStateService {
|
|
|
2047
1243
|
if (standalone) {
|
|
2048
1244
|
return this.salesTransactionApiService.upsert(state);
|
|
2049
1245
|
}
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
// initialState.push(asset);
|
|
2066
|
-
// }
|
|
2067
|
-
// }
|
|
2068
|
-
// TODO: adjust the logic for ShoppingCart
|
|
2069
|
-
const newState = Object.assign({}, state);
|
|
2070
|
-
return this.flowConfigurationService.calculate$(newState).pipe(map$2(() => ({ id: '' })));
|
|
1246
|
+
const salesTransaction = this.salesTransactionService.state;
|
|
1247
|
+
const configurationRoot = this.configurationService.root;
|
|
1248
|
+
if (!salesTransaction || !configurationRoot) {
|
|
1249
|
+
return of({ id: '' });
|
|
1250
|
+
}
|
|
1251
|
+
const isNewTransactionItem = salesTransaction.salesTransactionItems.every(li => li.id !== configurationRoot.id);
|
|
1252
|
+
let salesTransactionItems;
|
|
1253
|
+
if (isNewTransactionItem) {
|
|
1254
|
+
salesTransactionItems = [...salesTransaction.salesTransactionItems, configurationRoot];
|
|
1255
|
+
}
|
|
1256
|
+
else {
|
|
1257
|
+
salesTransactionItems = salesTransaction.salesTransactionItems.map(ti => ti.id === configurationRoot.id ? configurationRoot : ti);
|
|
1258
|
+
}
|
|
1259
|
+
const newState = Object.assign(Object.assign({}, salesTransaction), { salesTransactionItems });
|
|
1260
|
+
return this.flowConfigurationService.calculate$(newState).pipe(map(() => ({ id: '' })));
|
|
2071
1261
|
}
|
|
2072
1262
|
cancelConfiguration() {
|
|
2073
1263
|
var _a, _b;
|
|
@@ -2088,30 +1278,29 @@ class ConfigurationStateService {
|
|
|
2088
1278
|
return (_b = (_a = this.flowInfoService.flow) === null || _a === void 0 ? void 0 : _a.properties.stateful) !== null && _b !== void 0 ? _b : false;
|
|
2089
1279
|
}
|
|
2090
1280
|
initStateful$() {
|
|
2091
|
-
var _a, _b, _c, _d, _e, _f
|
|
2092
|
-
this.ownerId = (
|
|
2093
|
-
const
|
|
2094
|
-
if (!this.flowStateService.stateId) {
|
|
1281
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1282
|
+
this.ownerId = (_b = (_a = this.configurationRuntimeService.uiDefinitionContainer) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : '';
|
|
1283
|
+
const { productId, transactionItemId } = this.flowInfoService.context;
|
|
1284
|
+
if (!productId || !this.flowStateService.stateId) {
|
|
2095
1285
|
return of(undefined);
|
|
2096
1286
|
}
|
|
2097
|
-
const container =
|
|
2098
|
-
const lineItem = this.configurationService.generateLineItem();
|
|
1287
|
+
const container = this.configurationRuntimeService.uiDefinitionContainer;
|
|
2099
1288
|
let request$;
|
|
2100
|
-
if (!
|
|
1289
|
+
if (!transactionItemId) {
|
|
2101
1290
|
request$ = this.flowStateApiService.newConfiguration(this.flowStateService.stateId, {
|
|
2102
|
-
|
|
2103
|
-
actionsOverride: (
|
|
2104
|
-
selectorsOverride: (
|
|
1291
|
+
transactionItem: generateTransactionItem(productId),
|
|
1292
|
+
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 }))),
|
|
1293
|
+
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 }))),
|
|
2105
1294
|
});
|
|
2106
1295
|
}
|
|
2107
1296
|
else {
|
|
2108
1297
|
request$ = this.flowStateApiService.startConfiguration(this.flowStateService.stateId, {
|
|
2109
|
-
|
|
2110
|
-
actionsOverride: (
|
|
2111
|
-
selectorsOverride: (
|
|
1298
|
+
transactionItemId,
|
|
1299
|
+
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 }))),
|
|
1300
|
+
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 }))),
|
|
2112
1301
|
});
|
|
2113
1302
|
}
|
|
2114
|
-
return request$.pipe(map
|
|
1303
|
+
return request$.pipe(map(r => {
|
|
2115
1304
|
this.stateId = r.stateId;
|
|
2116
1305
|
return undefined;
|
|
2117
1306
|
}));
|
|
@@ -2161,39 +1350,37 @@ class ConfigurationStateService {
|
|
|
2161
1350
|
else {
|
|
2162
1351
|
execution$ = this.executeStateless$(fullRequest);
|
|
2163
1352
|
}
|
|
2164
|
-
return execution$.pipe(tap
|
|
1353
|
+
return execution$.pipe(tap(result => this.handleSelectorsResponse(result.selectors)));
|
|
2165
1354
|
}
|
|
2166
1355
|
executeStateless$(request) {
|
|
2167
1356
|
this.executionInProgress$.next(true);
|
|
2168
|
-
return
|
|
1357
|
+
return this.configurationService.state$.pipe(switchMap(state => {
|
|
2169
1358
|
var _a;
|
|
2170
1359
|
// Apply actions and execute configuration/price call
|
|
2171
1360
|
// No need to run configuration if no actions in the request
|
|
2172
1361
|
if (!((_a = request.actions) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
2173
1362
|
return of(undefined);
|
|
2174
1363
|
}
|
|
2175
|
-
let configurationRequest = this.configurationService.generateRequest(false);
|
|
2176
1364
|
request.actions.forEach(action => {
|
|
2177
1365
|
var _a;
|
|
2178
|
-
|
|
1366
|
+
state = (_a = this.executeActionScript(state, action)) !== null && _a !== void 0 ? _a : state;
|
|
2179
1367
|
});
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
}), map$2(() => {
|
|
1368
|
+
return this.configurationService.configureRequest$(state);
|
|
1369
|
+
}), map(() => {
|
|
2183
1370
|
// Run selectors and apply them to the state
|
|
2184
|
-
const configurationState = this.configurationService.
|
|
1371
|
+
const configurationState = this.configurationService.state;
|
|
2185
1372
|
if (!configurationState) {
|
|
2186
1373
|
return { stateId: '', selectors: {} };
|
|
2187
1374
|
}
|
|
2188
1375
|
return this.runStatelessSelectors(request, configurationState);
|
|
2189
|
-
}), tap
|
|
2190
|
-
const configurationState = this.configurationService.
|
|
1376
|
+
}), tap(() => this.executionInProgress$.next(false)), catchError(error => {
|
|
1377
|
+
const configurationState = this.configurationService.previousState;
|
|
2191
1378
|
if (configurationState) {
|
|
2192
1379
|
const selectorsResult = this.runStatelessSelectors(request, configurationState);
|
|
2193
1380
|
this.handleSelectorsResponse(selectorsResult.selectors);
|
|
2194
1381
|
}
|
|
2195
1382
|
this.executionInProgress$.next(false);
|
|
2196
|
-
if (!this.configurationRuntimeService.
|
|
1383
|
+
if (!this.configurationRuntimeService.uiDefinitionProps.suppressToastMessages) {
|
|
2197
1384
|
this.toastService.add({ severity: ToastType.error, summary: String(error) });
|
|
2198
1385
|
}
|
|
2199
1386
|
return throwError(() => error);
|
|
@@ -2214,22 +1401,22 @@ class ConfigurationStateService {
|
|
|
2214
1401
|
};
|
|
2215
1402
|
this.executionInProgress$.next(true);
|
|
2216
1403
|
return this.flowStateApiService.executeConfiguration(this.flowStateService.stateId, this.stateId, request);
|
|
2217
|
-
}), tap
|
|
1404
|
+
}), tap(({ stateId }) => (this.stateId = stateId)), share(), tap(() => this.executionInProgress$.next(false)), catchError(e => {
|
|
2218
1405
|
this.executionInProgress$.next(false);
|
|
2219
1406
|
return throwError(() => e);
|
|
2220
1407
|
}));
|
|
2221
1408
|
}
|
|
2222
1409
|
executeStateful$(request) {
|
|
2223
|
-
return this.executionInProgress$.pipe(filter
|
|
1410
|
+
return this.executionInProgress$.pipe(filter(inProgress => !inProgress), take(1), switchMap(() =>
|
|
2224
1411
|
// make sure stream switches to statefulExecutionRequest$ before pushing an execution request
|
|
2225
1412
|
combineLatest([
|
|
2226
1413
|
this.statefulExecutionRequest$,
|
|
2227
|
-
of(undefined).pipe(tap
|
|
2228
|
-
])), map
|
|
1414
|
+
of(undefined).pipe(tap(() => this.statefulRequestStream$.next(request))),
|
|
1415
|
+
])), map(([response]) => response), take(1));
|
|
2229
1416
|
}
|
|
2230
1417
|
executeActionScript(request, processor) {
|
|
2231
|
-
var _a
|
|
2232
|
-
const { actions } = (
|
|
1418
|
+
var _a;
|
|
1419
|
+
const { actions } = (_a = this.configurationRuntimeService.uiDefinitionContainer) !== null && _a !== void 0 ? _a : {};
|
|
2233
1420
|
const configurationProcessor = actions === null || actions === void 0 ? void 0 : actions.find(action => action.apiName === processor.apiName);
|
|
2234
1421
|
if (!(configurationProcessor === null || configurationProcessor === void 0 ? void 0 : configurationProcessor.script)) {
|
|
2235
1422
|
throw `ConfigurationProcessor ${processor.apiName} not found`;
|
|
@@ -2237,8 +1424,8 @@ class ConfigurationStateService {
|
|
|
2237
1424
|
return this.executeProcessorScript(request, configurationProcessor, processor.inputData);
|
|
2238
1425
|
}
|
|
2239
1426
|
executeSelectorScript(request, processor) {
|
|
2240
|
-
var _a
|
|
2241
|
-
const { selectors } = (
|
|
1427
|
+
var _a;
|
|
1428
|
+
const { selectors } = (_a = this.configurationRuntimeService.uiDefinitionContainer) !== null && _a !== void 0 ? _a : {};
|
|
2242
1429
|
const configurationProcessor = selectors === null || selectors === void 0 ? void 0 : selectors.find(selector => selector.apiName === processor.apiName);
|
|
2243
1430
|
if (!(configurationProcessor === null || configurationProcessor === void 0 ? void 0 : configurationProcessor.script)) {
|
|
2244
1431
|
throw `ConfigurationProcessor ${processor.apiName} not found`;
|
|
@@ -2280,29 +1467,42 @@ class ConfigurationStateService {
|
|
|
2280
1467
|
}, { stateId: '', selectors: {} });
|
|
2281
1468
|
}
|
|
2282
1469
|
}
|
|
2283
|
-
ConfigurationStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService, deps: [{ token: ConfigurationRuntimeService }, { token: ConfigurationService }, { token:
|
|
1470
|
+
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: i1.FlowStateApiService }, { token: SalesTransactionService }, { token: i4.SalesTransactionApiService }, { token: i6.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2284
1471
|
ConfigurationStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService });
|
|
2285
1472
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService, decorators: [{
|
|
2286
1473
|
type: Injectable
|
|
2287
|
-
}], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type:
|
|
1474
|
+
}], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type: FlowStateService }, { type: FlowInfoService }, { type: FlowConfigurationService }, { type: i1.FlowStateApiService }, { type: SalesTransactionService }, { type: i4.SalesTransactionApiService }, { type: i6.ToastService }]; } });
|
|
2288
1475
|
|
|
2289
1476
|
class ConfigurationModule {
|
|
2290
1477
|
}
|
|
2291
1478
|
ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2292
1479
|
ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule, ApiModule] });
|
|
2293
|
-
ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, providers: [
|
|
1480
|
+
ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, providers: [ConfigurationService, ConfigurationStateService, ConfigurationRuntimeService], imports: [ConfirmationDialogModule, ApiModule] });
|
|
2294
1481
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, decorators: [{
|
|
2295
1482
|
type: NgModule,
|
|
2296
1483
|
args: [{
|
|
2297
1484
|
imports: [ConfirmationDialogModule, ApiModule],
|
|
2298
|
-
providers: [
|
|
1485
|
+
providers: [ConfigurationService, ConfigurationStateService, ConfigurationRuntimeService],
|
|
1486
|
+
}]
|
|
1487
|
+
}] });
|
|
1488
|
+
|
|
1489
|
+
class FlowConfigurationModule {
|
|
1490
|
+
}
|
|
1491
|
+
FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1492
|
+
FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, imports: [ApiModule] });
|
|
1493
|
+
FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService], imports: [ApiModule] });
|
|
1494
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, decorators: [{
|
|
1495
|
+
type: NgModule,
|
|
1496
|
+
args: [{
|
|
1497
|
+
imports: [ApiModule],
|
|
1498
|
+
providers: [FlowConfigurationService],
|
|
2299
1499
|
}]
|
|
2300
1500
|
}] });
|
|
2301
1501
|
|
|
2302
1502
|
class CatalogProductsService {
|
|
2303
1503
|
constructor() {
|
|
2304
1504
|
this.stateSubj$ = new BehaviorSubject(null);
|
|
2305
|
-
this.state$ = this.stateSubj$.asObservable().pipe(filter
|
|
1505
|
+
this.state$ = this.stateSubj$.asObservable().pipe(filter(isDefined));
|
|
2306
1506
|
}
|
|
2307
1507
|
get state() {
|
|
2308
1508
|
return this.stateSubj$.getValue();
|
|
@@ -2320,6 +1520,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2320
1520
|
type: Injectable
|
|
2321
1521
|
}] });
|
|
2322
1522
|
|
|
1523
|
+
const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
|
|
1524
|
+
|
|
1525
|
+
const UI_DEFINITION_VERSION = 3;
|
|
1526
|
+
|
|
2323
1527
|
const DEFAULT_FORMATTING_SETTINGS = {
|
|
2324
1528
|
currencySymbol: DEFAULT_CURRENCY_SYMBOL,
|
|
2325
1529
|
decimalsCount: DEFAULT_DECIMALS_COUNT,
|
|
@@ -2334,7 +1538,6 @@ SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
|
2334
1538
|
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
|
2335
1539
|
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, providers: [
|
|
2336
1540
|
FlowInfoService,
|
|
2337
|
-
QuoteDraftService,
|
|
2338
1541
|
ProductImagesService,
|
|
2339
1542
|
IntegrationState,
|
|
2340
1543
|
FlowStateService,
|
|
@@ -2353,7 +1556,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2353
1556
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
|
2354
1557
|
providers: [
|
|
2355
1558
|
FlowInfoService,
|
|
2356
|
-
QuoteDraftService,
|
|
2357
1559
|
ProductImagesService,
|
|
2358
1560
|
IntegrationState,
|
|
2359
1561
|
FlowStateService,
|
|
@@ -2545,5 +1747,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2545
1747
|
* Generated bundle index. Do not edit.
|
|
2546
1748
|
*/
|
|
2547
1749
|
|
|
2548
|
-
export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationStateService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FLOW_CUSTOMIZATION, FORMATTING_SETTINGS_TOKEN,
|
|
1750
|
+
export { ActionCodePipe, CalendarDirective, 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, TransactionItemWorker, UI_DEFINITION_VERSION, extractMetadata, findTransactionItem, findTransactionItemWithComparator, generateTransactionItem, insertTransactionItem, removeTransactionItem, replaceTransactionItem };
|
|
2549
1751
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|