@veloceapps/sdk 8.0.0-132 → 8.0.0-134
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/components/preview/preview.component.d.ts +2 -2
- package/cms/vendor-map.d.ts +2 -2
- package/core/modules/configuration/configuration.module.d.ts +2 -1
- package/core/modules/configuration/index.d.ts +1 -1
- package/core/modules/configuration/services/configuration-state.service.d.ts +48 -0
- package/core/modules/configuration/services/configuration.service.d.ts +2 -1
- package/core/modules/flow-configuration/flow-configuration.module.d.ts +2 -1
- package/core/services/flow-info.service.d.ts +1 -0
- package/core/services/flow-state-configuration.service.d.ts +5 -6
- package/esm2020/cms/components/preview/preview.component.mjs +4 -4
- package/esm2020/cms/vendor-map.mjs +3 -3
- package/esm2020/core/core.module.mjs +16 -2
- package/esm2020/core/modules/configuration/configuration.module.mjs +7 -23
- package/esm2020/core/modules/configuration/helpers.mjs +1 -1
- package/esm2020/core/modules/configuration/index.mjs +2 -2
- package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +267 -0
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +21 -15
- package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +6 -6
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +3 -4
- package/esm2020/core/services/context.service.mjs +3 -4
- package/esm2020/core/services/flow-info.service.mjs +6 -4
- package/esm2020/core/services/flow-state-configuration.service.mjs +27 -26
- package/esm2020/core/services/flow-state.service.mjs +15 -7
- package/esm2020/core/services/integration.state.mjs +3 -4
- package/esm2020/core/services/metric-calculation/metric-calculation.service.mjs +3 -4
- package/esm2020/core/services/product-images.service.mjs +3 -4
- package/esm2020/core/services/quote-draft.service.mjs +3 -4
- package/esm2020/core/services/runtime-settings.service.mjs +4 -5
- package/esm2020/src/guards/context.guard.mjs +1 -2
- package/esm2020/src/pages/product/product.component.mjs +21 -8
- package/esm2020/src/pages/remote/remote.component.mjs +4 -4
- package/esm2020/src/services/flow-router.service.mjs +30 -13
- package/esm2020/src/services/flow.service.mjs +48 -27
- package/fesm2015/veloceapps-sdk-cms.mjs +4 -4
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +292 -152
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +94 -45
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +4 -4
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +281 -151
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +93 -44
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/src/pages/product/product.component.d.ts +6 -4
- package/src/pages/remote/remote.component.d.ts +2 -2
- package/src/services/flow-router.service.d.ts +4 -2
- package/src/services/flow.service.d.ts +7 -3
- package/core/modules/configuration/services/configuration.state.d.ts +0 -30
- package/esm2020/core/modules/configuration/services/configuration.state.mjs +0 -142
|
@@ -4,7 +4,7 @@ import { UUID, ConfigurationContextMode, ConfigurationContext, UITemplateType, i
|
|
|
4
4
|
import { BehaviorSubject, switchMap, map as map$1, tap as tap$1, noop, catchError, throwError, of, forkJoin, Subject, filter as filter$1, zip, combineLatest, shareReplay as shareReplay$1, finalize, takeUntil, take as take$1, distinctUntilChanged } from 'rxjs';
|
|
5
5
|
import { map, filter, tap, switchMap as switchMap$1, skip, take, shareReplay, catchError as catchError$1, finalize as finalize$1, first } from 'rxjs/operators';
|
|
6
6
|
import * as i1 from '@veloceapps/api';
|
|
7
|
-
import {
|
|
7
|
+
import { ApiModule } from '@veloceapps/api';
|
|
8
8
|
import { merge, isEmpty, flatten, sortBy, map as map$2, omit, isEqual, cloneDeep, assign, uniqBy, transform, uniq } from 'lodash';
|
|
9
9
|
import * as i6 from '@veloceapps/components';
|
|
10
10
|
import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
|
|
@@ -154,10 +154,9 @@ class ContextService {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
ContextService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, deps: [{ token: i1.ContextApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
157
|
-
ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService
|
|
157
|
+
ContextService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService });
|
|
158
158
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ContextService, decorators: [{
|
|
159
|
-
type: Injectable
|
|
160
|
-
args: [{ providedIn: 'root' }]
|
|
159
|
+
type: Injectable
|
|
161
160
|
}], ctorParameters: function () { return [{ type: i1.ContextApiService }]; } });
|
|
162
161
|
|
|
163
162
|
class FlowInfoService {
|
|
@@ -167,6 +166,10 @@ class FlowInfoService {
|
|
|
167
166
|
set flow(value) {
|
|
168
167
|
this.flowSubj$.next(value);
|
|
169
168
|
}
|
|
169
|
+
get isLegacy() {
|
|
170
|
+
var _a;
|
|
171
|
+
return !!this.flow && ((_a = this.flow) === null || _a === void 0 ? void 0 : _a.properties.stateful) == null;
|
|
172
|
+
}
|
|
170
173
|
constructor(flowsApiService, templatesApiService, customizationService) {
|
|
171
174
|
this.flowsApiService = flowsApiService;
|
|
172
175
|
this.templatesApiService = templatesApiService;
|
|
@@ -236,10 +239,9 @@ class FlowInfoService {
|
|
|
236
239
|
}
|
|
237
240
|
}
|
|
238
241
|
FlowInfoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, deps: [{ token: i1.FlowsApiService }, { token: i1.UITemplatesApiService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
239
|
-
FlowInfoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService
|
|
242
|
+
FlowInfoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService });
|
|
240
243
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, decorators: [{
|
|
241
|
-
type: Injectable
|
|
242
|
-
args: [{ providedIn: 'root' }]
|
|
244
|
+
type: Injectable
|
|
243
245
|
}], ctorParameters: function () {
|
|
244
246
|
return [{ type: i1.FlowsApiService }, { type: i1.UITemplatesApiService }, { type: undefined, decorators: [{
|
|
245
247
|
type: Optional
|
|
@@ -493,10 +495,9 @@ class IntegrationState {
|
|
|
493
495
|
}
|
|
494
496
|
}
|
|
495
497
|
IntegrationState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IntegrationState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
496
|
-
IntegrationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IntegrationState
|
|
498
|
+
IntegrationState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IntegrationState });
|
|
497
499
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: IntegrationState, decorators: [{
|
|
498
|
-
type: Injectable
|
|
499
|
-
args: [{ providedIn: 'root' }]
|
|
500
|
+
type: Injectable
|
|
500
501
|
}] });
|
|
501
502
|
|
|
502
503
|
class QuoteDraftService {
|
|
@@ -724,10 +725,9 @@ class QuoteDraftService {
|
|
|
724
725
|
}
|
|
725
726
|
}
|
|
726
727
|
QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.QuoteApiService }, { token: i1.PriceApiService }, { token: IntegrationState }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
727
|
-
QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService
|
|
728
|
+
QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService });
|
|
728
729
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, decorators: [{
|
|
729
|
-
type: Injectable
|
|
730
|
-
args: [{ providedIn: 'root' }]
|
|
730
|
+
type: Injectable
|
|
731
731
|
}], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }, { type: IntegrationState }]; } });
|
|
732
732
|
|
|
733
733
|
class FlowStateService {
|
|
@@ -1006,8 +1006,7 @@ class FlowStateService {
|
|
|
1006
1006
|
initStateless$() {
|
|
1007
1007
|
var _a;
|
|
1008
1008
|
const { headerId } = this.contextService.resolve();
|
|
1009
|
-
|
|
1010
|
-
return stateInit$.pipe(tap$1(() => this.quoteDraftService.finalizeInit()), map$1(noop));
|
|
1009
|
+
return this.quoteDraftService.init(headerId, (_a = this.flowInfoService.params) !== null && _a !== void 0 ? _a : {}).pipe(switchMap(() => this.executeRequest$(this.getDefaultExecutionRequestDTO())), switchMap(() => this.calculate$()), tap$1(() => this.quoteDraftService.finalizeInit()), map$1(noop));
|
|
1011
1010
|
}
|
|
1012
1011
|
calculate$() {
|
|
1013
1012
|
var _a;
|
|
@@ -1145,7 +1144,7 @@ class FlowStateService {
|
|
|
1145
1144
|
return `${scope}/${selectorName}/${inputDataHash}`;
|
|
1146
1145
|
}
|
|
1147
1146
|
getDefaultExecutionRequestDTO() {
|
|
1148
|
-
var _a;
|
|
1147
|
+
var _a, _b, _c;
|
|
1149
1148
|
const request = {
|
|
1150
1149
|
actions: [],
|
|
1151
1150
|
selectors: {},
|
|
@@ -1155,18 +1154,27 @@ class FlowStateService {
|
|
|
1155
1154
|
}
|
|
1156
1155
|
const ownerId = this.getOwnerIdByScope(UITemplateType.FLOW_ENGINE);
|
|
1157
1156
|
(_a = request.actions) === null || _a === void 0 ? void 0 : _a.push({
|
|
1158
|
-
apiName: '
|
|
1157
|
+
apiName: 'UPDATE_PRICE_LIST',
|
|
1158
|
+
ownerId,
|
|
1159
|
+
inputData: {},
|
|
1160
|
+
});
|
|
1161
|
+
(_b = request.actions) === null || _b === void 0 ? void 0 : _b.push({
|
|
1162
|
+
apiName: 'UPDATE_ASSET_IDS',
|
|
1159
1163
|
ownerId,
|
|
1160
1164
|
inputData: {},
|
|
1161
1165
|
});
|
|
1166
|
+
(_c = request.actions) === null || _c === void 0 ? void 0 : _c.push({
|
|
1167
|
+
apiName: 'UPDATE_CONTEXT_PROPERTIES',
|
|
1168
|
+
ownerId,
|
|
1169
|
+
inputData: this.contextService.resolve().properties,
|
|
1170
|
+
});
|
|
1162
1171
|
return request;
|
|
1163
1172
|
}
|
|
1164
1173
|
}
|
|
1165
1174
|
FlowStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, deps: [{ token: ContextService }, { token: QuoteDraftService }, { token: FlowInfoService }, { token: FlowConfigurationService }, { token: i1.ConfigurationProcessorsApiService }, { token: i1.FlowStateApiService }, { token: i1.QuoteApiService }, { token: i6.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1166
|
-
FlowStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService
|
|
1175
|
+
FlowStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService });
|
|
1167
1176
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, decorators: [{
|
|
1168
|
-
type: Injectable
|
|
1169
|
-
args: [{ providedIn: 'root' }]
|
|
1177
|
+
type: Injectable
|
|
1170
1178
|
}], ctorParameters: function () {
|
|
1171
1179
|
return [{ type: ContextService }, { type: QuoteDraftService }, { type: FlowInfoService }, { type: FlowConfigurationService }, { type: i1.ConfigurationProcessorsApiService }, { type: i1.FlowStateApiService }, { type: i1.QuoteApiService }, { type: i6.ToastService }, { type: undefined, decorators: [{
|
|
1172
1180
|
type: Optional
|
|
@@ -1407,10 +1415,9 @@ class RuntimeSettingsService {
|
|
|
1407
1415
|
}
|
|
1408
1416
|
}
|
|
1409
1417
|
RuntimeSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, deps: [{ token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1410
|
-
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService
|
|
1418
|
+
RuntimeSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService });
|
|
1411
1419
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: RuntimeSettingsService, decorators: [{
|
|
1412
|
-
type: Injectable
|
|
1413
|
-
args: [{ providedIn: 'root' }]
|
|
1420
|
+
type: Injectable
|
|
1414
1421
|
}], ctorParameters: function () { return [{ type: i1.ConfigurationSettingsApiService }]; } });
|
|
1415
1422
|
|
|
1416
1423
|
class ConfigurationService {
|
|
@@ -1562,11 +1569,28 @@ class ConfigurationService {
|
|
|
1562
1569
|
throw error;
|
|
1563
1570
|
}));
|
|
1564
1571
|
}
|
|
1565
|
-
generateRequest() {
|
|
1566
|
-
var _a
|
|
1572
|
+
generateRequest(lightMode = true) {
|
|
1573
|
+
var _a;
|
|
1574
|
+
const lineItem = this.generateLineItem();
|
|
1575
|
+
let request = {
|
|
1576
|
+
lineItem,
|
|
1577
|
+
mode: this.mode,
|
|
1578
|
+
step: !this.lineItem.value ? RuntimeStep.START : RuntimeStep.UPDATE,
|
|
1579
|
+
attributeDomainMode: 'ALL',
|
|
1580
|
+
context: this.contextService.resolve(),
|
|
1581
|
+
lineItems: ((_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) || [],
|
|
1582
|
+
asset: this.getAsset(),
|
|
1583
|
+
};
|
|
1584
|
+
if (lightMode) {
|
|
1585
|
+
request = ConfigurationTranslatorUtils.lightenConfigurationRequest(request);
|
|
1586
|
+
}
|
|
1587
|
+
return request;
|
|
1588
|
+
}
|
|
1589
|
+
generateLineItem() {
|
|
1590
|
+
var _a;
|
|
1567
1591
|
const runtimeContext = this.getRuntimeContext();
|
|
1568
1592
|
const uiDefinitionProperties = this.getUIDefinitionProperties();
|
|
1569
|
-
let lineItem = this.configurableRamp;
|
|
1593
|
+
let lineItem = cloneDeep(this.configurableRamp);
|
|
1570
1594
|
if (!lineItem) {
|
|
1571
1595
|
const { initializationProps } = (_a = this.runtimeService) !== null && _a !== void 0 ? _a : {};
|
|
1572
1596
|
lineItem = getDefaultLineItem(runtimeContext, uiDefinitionProperties, initializationProps === null || initializationProps === void 0 ? void 0 : initializationProps.defaultQty);
|
|
@@ -1576,17 +1600,7 @@ class ConfigurationService {
|
|
|
1576
1600
|
lineItem = new LineItemWorker(lineItem).patchAttribute(attributes).li;
|
|
1577
1601
|
}
|
|
1578
1602
|
}
|
|
1579
|
-
|
|
1580
|
-
lineItem,
|
|
1581
|
-
mode: this.mode,
|
|
1582
|
-
step: !this.lineItem.value ? RuntimeStep.START : RuntimeStep.UPDATE,
|
|
1583
|
-
attributeDomainMode: 'ALL',
|
|
1584
|
-
context: this.contextService.resolve(),
|
|
1585
|
-
lineItems: ((_b = this.quoteDraftService.quoteDraft) === null || _b === void 0 ? void 0 : _b.currentState) || [],
|
|
1586
|
-
asset: this.getAsset(),
|
|
1587
|
-
};
|
|
1588
|
-
request = ConfigurationTranslatorUtils.lightenConfigurationRequest(request);
|
|
1589
|
-
return request;
|
|
1603
|
+
return lineItem;
|
|
1590
1604
|
}
|
|
1591
1605
|
getUIDefinitionProperties() {
|
|
1592
1606
|
var _a, _b, _c;
|
|
@@ -1769,32 +1783,30 @@ class FlowConfigurationService {
|
|
|
1769
1783
|
}
|
|
1770
1784
|
}
|
|
1771
1785
|
FlowConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, deps: [{ token: i1.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1772
|
-
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService
|
|
1786
|
+
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService });
|
|
1773
1787
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
|
|
1774
|
-
type: Injectable
|
|
1775
|
-
args: [{ providedIn: 'root' }]
|
|
1788
|
+
type: Injectable
|
|
1776
1789
|
}], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
|
|
1777
1790
|
|
|
1778
1791
|
class FlowConfigurationModule {
|
|
1779
1792
|
}
|
|
1780
1793
|
FlowConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1781
|
-
FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule });
|
|
1782
|
-
FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService,
|
|
1794
|
+
FlowConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, imports: [ApiModule] });
|
|
1795
|
+
FlowConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService], imports: [ApiModule] });
|
|
1783
1796
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationModule, decorators: [{
|
|
1784
1797
|
type: NgModule,
|
|
1785
1798
|
args: [{
|
|
1786
|
-
imports: [],
|
|
1787
|
-
providers: [FlowConfigurationService, FlowUpdateService
|
|
1799
|
+
imports: [ApiModule],
|
|
1800
|
+
providers: [FlowConfigurationService, FlowUpdateService],
|
|
1788
1801
|
}]
|
|
1789
1802
|
}] });
|
|
1790
1803
|
|
|
1791
1804
|
class FlowStateConfigurationService {
|
|
1792
|
-
constructor(
|
|
1793
|
-
this.flowStateService = flowStateService;
|
|
1805
|
+
constructor(flowInfoService, flowConfigurationService, flowStateApiService, flowStateService) {
|
|
1794
1806
|
this.flowInfoService = flowInfoService;
|
|
1795
|
-
this.configurationService = configurationService;
|
|
1796
1807
|
this.flowConfigurationService = flowConfigurationService;
|
|
1797
1808
|
this.flowStateApiService = flowStateApiService;
|
|
1809
|
+
this.flowStateService = flowStateService;
|
|
1798
1810
|
this.configurationStateId$ = new BehaviorSubject(null);
|
|
1799
1811
|
}
|
|
1800
1812
|
get configurationStateId() {
|
|
@@ -1802,31 +1814,34 @@ class FlowStateConfigurationService {
|
|
|
1802
1814
|
}
|
|
1803
1815
|
addToCart$(props) {
|
|
1804
1816
|
var _a;
|
|
1817
|
+
let request$;
|
|
1805
1818
|
const stateful = (_a = this.flowInfoService.flow) === null || _a === void 0 ? void 0 : _a.properties.stateful;
|
|
1806
1819
|
if (stateful) {
|
|
1807
1820
|
const stateId = this.flowStateService.stateId;
|
|
1808
1821
|
if (!stateId) {
|
|
1809
|
-
|
|
1822
|
+
request$ = of();
|
|
1823
|
+
}
|
|
1824
|
+
else {
|
|
1825
|
+
const lineItem = generateConfigurationLineItem(props, props.qty);
|
|
1826
|
+
request$ = this.flowStateApiService.newConfiguration(stateId, { lineItem }).pipe(tap$1(r => this.configurationStateId$.next(r.stateId)), switchMap(() => {
|
|
1827
|
+
if (!this.configurationStateId) {
|
|
1828
|
+
return of();
|
|
1829
|
+
}
|
|
1830
|
+
return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(tap$1(() => this.configurationStateId$.next(null)), map$1(noop));
|
|
1831
|
+
}));
|
|
1810
1832
|
}
|
|
1811
|
-
const lineItem = generateConfigurationLineItem(props, props.qty);
|
|
1812
|
-
return this.flowStateApiService.newConfiguration(stateId, { lineItem }).pipe(tap$1(r => this.configurationStateId$.next(r.stateId)), switchMap(() => {
|
|
1813
|
-
if (!this.configurationStateId) {
|
|
1814
|
-
return of();
|
|
1815
|
-
}
|
|
1816
|
-
return this.flowStateApiService.saveConfiguration(stateId, this.configurationStateId).pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), tap$1(() => this.configurationStateId$.next(null)), map$1(noop));
|
|
1817
|
-
}));
|
|
1818
1833
|
}
|
|
1819
1834
|
else {
|
|
1820
|
-
|
|
1835
|
+
request$ = this.flowConfigurationService.addToCart$(props).pipe(map$1(noop));
|
|
1821
1836
|
}
|
|
1837
|
+
return request$.pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), map$1(noop));
|
|
1822
1838
|
}
|
|
1823
1839
|
}
|
|
1824
|
-
FlowStateConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, deps: [{ token:
|
|
1825
|
-
FlowStateConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService
|
|
1840
|
+
FlowStateConfigurationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, deps: [{ token: FlowInfoService }, { token: FlowConfigurationService }, { token: i1.FlowStateApiService }, { token: FlowStateService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1841
|
+
FlowStateConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService });
|
|
1826
1842
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateConfigurationService, decorators: [{
|
|
1827
|
-
type: Injectable
|
|
1828
|
-
|
|
1829
|
-
}], ctorParameters: function () { return [{ type: FlowStateService }, { type: FlowInfoService }, { type: ConfigurationService }, { type: FlowConfigurationService }, { type: i1.FlowStateApiService }]; } });
|
|
1843
|
+
type: Injectable
|
|
1844
|
+
}], ctorParameters: function () { return [{ type: FlowInfoService }, { type: FlowConfigurationService }, { type: i1.FlowStateApiService }, { type: FlowStateService }]; } });
|
|
1830
1845
|
|
|
1831
1846
|
function calculateMetricByMethod(lineItems, metric, method) {
|
|
1832
1847
|
const items = getLineItemsByMethod(lineItems, method);
|
|
@@ -1939,10 +1954,9 @@ class MetricsCalculationService {
|
|
|
1939
1954
|
}
|
|
1940
1955
|
}
|
|
1941
1956
|
MetricsCalculationService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService, deps: [{ token: QuoteDraftService }, { token: FlowConfigurationService }, { token: i1.ConfigurationSettingsApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1942
|
-
MetricsCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService
|
|
1957
|
+
MetricsCalculationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService });
|
|
1943
1958
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: MetricsCalculationService, decorators: [{
|
|
1944
|
-
type: Injectable
|
|
1945
|
-
args: [{ providedIn: 'root' }]
|
|
1959
|
+
type: Injectable
|
|
1946
1960
|
}], ctorParameters: function () { return [{ type: QuoteDraftService }, { type: FlowConfigurationService }, { type: i1.ConfigurationSettingsApiService }]; } });
|
|
1947
1961
|
|
|
1948
1962
|
class ProductImagesService {
|
|
@@ -1965,10 +1979,9 @@ class ProductImagesService {
|
|
|
1965
1979
|
}
|
|
1966
1980
|
}
|
|
1967
1981
|
ProductImagesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, deps: [{ token: i1.ProductApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1968
|
-
ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService
|
|
1982
|
+
ProductImagesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService });
|
|
1969
1983
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductImagesService, decorators: [{
|
|
1970
|
-
type: Injectable
|
|
1971
|
-
args: [{ providedIn: 'root' }]
|
|
1984
|
+
type: Injectable
|
|
1972
1985
|
}], ctorParameters: function () { return [{ type: i1.ProductApiService }]; } });
|
|
1973
1986
|
|
|
1974
1987
|
class RuntimeContextService {
|
|
@@ -2096,60 +2109,191 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2096
2109
|
type: Injectable
|
|
2097
2110
|
}], ctorParameters: function () { return [{ type: i1.ConfigurationApiService }, { type: ContextService }, { type: RuntimeContextService }]; } });
|
|
2098
2111
|
|
|
2099
|
-
class
|
|
2100
|
-
constructor(
|
|
2101
|
-
this.
|
|
2102
|
-
this.runtimeService = runtimeService;
|
|
2112
|
+
class ConfigurationStateService {
|
|
2113
|
+
constructor(configurationRuntimeService, configurationService, quoteDraftService, toastService, flowStateService, flowInfoService, flowConfigurationService, flowStateApiService, quoteApiService) {
|
|
2114
|
+
this.configurationRuntimeService = configurationRuntimeService;
|
|
2103
2115
|
this.configurationService = configurationService;
|
|
2116
|
+
this.quoteDraftService = quoteDraftService;
|
|
2104
2117
|
this.toastService = toastService;
|
|
2105
|
-
this.
|
|
2106
|
-
this.
|
|
2118
|
+
this.flowStateService = flowStateService;
|
|
2119
|
+
this.flowInfoService = flowInfoService;
|
|
2120
|
+
this.flowConfigurationService = flowConfigurationService;
|
|
2121
|
+
this.flowStateApiService = flowStateApiService;
|
|
2122
|
+
this.quoteApiService = quoteApiService;
|
|
2123
|
+
this.NOT_INITIALIZED = Symbol();
|
|
2107
2124
|
this.stateId = null;
|
|
2125
|
+
this.ownerId = '';
|
|
2126
|
+
this.subscriptions = {};
|
|
2127
|
+
this.isInitialized$ = new BehaviorSubject(false);
|
|
2108
2128
|
}
|
|
2109
2129
|
init$() {
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
actions: actions === null || actions === void 0 ? void 0 : actions.map(action => ({ name: action.apiName, script: action.script })),
|
|
2119
|
-
selectors: selectors === null || selectors === void 0 ? void 0 : selectors.map(selector => ({ name: selector.apiName, script: selector.script })),
|
|
2120
|
-
});
|
|
2121
|
-
}), tap$1(stateId => (this.stateId = stateId || null)), map$1(() => undefined));
|
|
2130
|
+
let request$;
|
|
2131
|
+
if (this.flowStateService.stateId && this.isStatefulConfiguration) {
|
|
2132
|
+
request$ = this.initStateful$();
|
|
2133
|
+
}
|
|
2134
|
+
else {
|
|
2135
|
+
request$ = this.initStateless$();
|
|
2136
|
+
}
|
|
2137
|
+
return request$.pipe(finalize(() => this.isInitialized$.next(true)));
|
|
2122
2138
|
}
|
|
2123
2139
|
cleanup() {
|
|
2124
2140
|
this.stateId = null;
|
|
2125
2141
|
this.configurationService.reset();
|
|
2126
|
-
this.stateSubj$.next({});
|
|
2127
2142
|
}
|
|
2128
|
-
execute$(req) {
|
|
2143
|
+
execute$(req, forceSubscriptions) {
|
|
2144
|
+
var _a;
|
|
2145
|
+
const fullRequest = cloneDeep(req);
|
|
2146
|
+
if (((_a = fullRequest.actions) === null || _a === void 0 ? void 0 : _a.length) || forceSubscriptions) {
|
|
2147
|
+
for (const subscription of Object.values(this.subscriptions)) {
|
|
2148
|
+
fullRequest.selectors = assign(fullRequest.selectors, subscription.request.selectors);
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
let execution$;
|
|
2129
2152
|
if (this.isStatefulConfiguration) {
|
|
2130
|
-
|
|
2153
|
+
execution$ = this.executeStateful$(fullRequest);
|
|
2131
2154
|
}
|
|
2132
2155
|
else {
|
|
2133
|
-
|
|
2156
|
+
execution$ = this.executeStateless$(fullRequest);
|
|
2134
2157
|
}
|
|
2158
|
+
return execution$.pipe(tap$1(result => this.handleSelectorsResponse(result.selectors)));
|
|
2135
2159
|
}
|
|
2136
|
-
|
|
2137
|
-
|
|
2160
|
+
handleSelectorsResponse(selectors) {
|
|
2161
|
+
Object.entries(selectors).forEach(([requestId, selectorResult]) => {
|
|
2162
|
+
var _a;
|
|
2163
|
+
if (!selectorResult.success) {
|
|
2164
|
+
this.toastService.add({ severity: ToastType.error, summary: selectorResult.errorMessage });
|
|
2165
|
+
}
|
|
2166
|
+
const subscription$ = (_a = this.subscriptions[requestId]) === null || _a === void 0 ? void 0 : _a.data$;
|
|
2167
|
+
if (subscription$) {
|
|
2168
|
+
subscription$.next(selectorResult);
|
|
2169
|
+
}
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2172
|
+
dispatch$(actionName, inputData = {}) {
|
|
2173
|
+
return this.execute$({ actions: [{ apiName: actionName, inputData, ownerId: this.ownerId }] });
|
|
2138
2174
|
}
|
|
2139
|
-
select$(selectorName, inputData) {
|
|
2175
|
+
select$(selectorName, inputData = {}) {
|
|
2140
2176
|
const requestId = UUID.UUID();
|
|
2141
2177
|
return this.execute$({
|
|
2142
2178
|
selectors: {
|
|
2143
2179
|
[requestId]: {
|
|
2144
|
-
|
|
2180
|
+
apiName: selectorName,
|
|
2145
2181
|
inputData,
|
|
2182
|
+
ownerId: this.ownerId,
|
|
2146
2183
|
},
|
|
2147
2184
|
},
|
|
2148
|
-
}).pipe(map$1(
|
|
2185
|
+
}).pipe(map$1(response => response.selectors[requestId]));
|
|
2186
|
+
}
|
|
2187
|
+
subscribe$(selectorName, inputData = {}, options) {
|
|
2188
|
+
const requestId = UUID.UUID();
|
|
2189
|
+
if (!this.subscriptions[requestId]) {
|
|
2190
|
+
const request = {
|
|
2191
|
+
selectors: {
|
|
2192
|
+
[requestId]: {
|
|
2193
|
+
apiName: selectorName,
|
|
2194
|
+
inputData,
|
|
2195
|
+
ownerId: this.ownerId,
|
|
2196
|
+
},
|
|
2197
|
+
},
|
|
2198
|
+
};
|
|
2199
|
+
this.subscriptions[requestId] = {
|
|
2200
|
+
request,
|
|
2201
|
+
data$: new BehaviorSubject(this.NOT_INITIALIZED),
|
|
2202
|
+
};
|
|
2203
|
+
if (!(options === null || options === void 0 ? void 0 : options.cold)) {
|
|
2204
|
+
this.execute$(request).subscribe();
|
|
2205
|
+
}
|
|
2206
|
+
}
|
|
2207
|
+
return this.subscriptions[requestId].data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map$1(data => data), finalize(() => {
|
|
2208
|
+
if (!this.subscriptions[requestId].data$.observed) {
|
|
2209
|
+
delete this.subscriptions[requestId];
|
|
2210
|
+
}
|
|
2211
|
+
}));
|
|
2212
|
+
}
|
|
2213
|
+
saveConfiguration(quoteId, flow) {
|
|
2214
|
+
var _a, _b;
|
|
2215
|
+
if (this.isStatefulConfiguration) {
|
|
2216
|
+
return this.flowStateApiService
|
|
2217
|
+
.saveConfiguration((_a = this.flowStateService.stateId) !== null && _a !== void 0 ? _a : '', (_b = this.stateId) !== null && _b !== void 0 ? _b : '')
|
|
2218
|
+
.pipe(switchMap(r => this.flowStateService.executeRequest$({}, true).pipe(map$1(() => r))));
|
|
2219
|
+
}
|
|
2220
|
+
else {
|
|
2221
|
+
if (!flow) {
|
|
2222
|
+
if (!quoteId) {
|
|
2223
|
+
return of({ quoteId: '' });
|
|
2224
|
+
}
|
|
2225
|
+
const rootLineItem = this.configurationService.getSnapshot();
|
|
2226
|
+
const currentState = rootLineItem ? [rootLineItem] : [];
|
|
2227
|
+
return this.quoteApiService
|
|
2228
|
+
.getQuoteDraft(quoteId)
|
|
2229
|
+
.pipe(switchMap(quoteDraft => this.quoteApiService.upsertQuote(Object.assign(Object.assign({}, quoteDraft), { currentState }))));
|
|
2230
|
+
}
|
|
2231
|
+
else {
|
|
2232
|
+
const quoteDraft = this.quoteDraftService.quoteDraft;
|
|
2233
|
+
const lineItem = this.configurationService.getSnapshot();
|
|
2234
|
+
if (!quoteDraft || !lineItem) {
|
|
2235
|
+
return of({ quoteId: '' });
|
|
2236
|
+
}
|
|
2237
|
+
const isNewLineItem = quoteDraft.currentState.every(li => li.id !== lineItem.id);
|
|
2238
|
+
let updatedState;
|
|
2239
|
+
if (isNewLineItem) {
|
|
2240
|
+
updatedState = [...quoteDraft.currentState, lineItem];
|
|
2241
|
+
}
|
|
2242
|
+
else {
|
|
2243
|
+
updatedState = quoteDraft.currentState.map(li => (li.id === lineItem.id ? lineItem : li));
|
|
2244
|
+
}
|
|
2245
|
+
return this.flowConfigurationService
|
|
2246
|
+
.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))
|
|
2247
|
+
.pipe(map$1(() => ({ quoteId: '' })));
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
cancelConfiguration() {
|
|
2252
|
+
var _a, _b;
|
|
2253
|
+
if (!this.isInitialized$.value) {
|
|
2254
|
+
return of(undefined);
|
|
2255
|
+
}
|
|
2256
|
+
this.isInitialized$.next(false);
|
|
2257
|
+
if (!this.isInitialized$.value || !this.isStatefulConfiguration) {
|
|
2258
|
+
return of(undefined);
|
|
2259
|
+
}
|
|
2260
|
+
return this.flowStateApiService.cancelConfiguration((_a = this.flowStateService.stateId) !== null && _a !== void 0 ? _a : '', (_b = this.stateId) !== null && _b !== void 0 ? _b : '');
|
|
2149
2261
|
}
|
|
2150
2262
|
get isStatefulConfiguration() {
|
|
2151
|
-
var _a;
|
|
2152
|
-
return (_a = this.
|
|
2263
|
+
var _a, _b;
|
|
2264
|
+
return (_b = (_a = this.flowInfoService.flow) === null || _a === void 0 ? void 0 : _a.properties.stateful) !== null && _b !== void 0 ? _b : false;
|
|
2265
|
+
}
|
|
2266
|
+
initStateful$() {
|
|
2267
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
2268
|
+
this.ownerId = (_c = (_b = (_a = this.configurationRuntimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : '';
|
|
2269
|
+
const lineItemId = (_e = (_d = this.configurationRuntimeService.runtimeContext) === null || _d === void 0 ? void 0 : _d.properties) === null || _e === void 0 ? void 0 : _e.lineItemId;
|
|
2270
|
+
if (!this.flowStateService.stateId) {
|
|
2271
|
+
return of(undefined);
|
|
2272
|
+
}
|
|
2273
|
+
const container = (_f = this.configurationRuntimeService.runtimeContext) === null || _f === void 0 ? void 0 : _f.uiDefinitionContainer;
|
|
2274
|
+
const lineItem = this.configurationService.generateLineItem();
|
|
2275
|
+
let request$;
|
|
2276
|
+
if (!lineItemId) {
|
|
2277
|
+
request$ = this.flowStateApiService.newConfiguration(this.flowStateService.stateId, {
|
|
2278
|
+
lineItem,
|
|
2279
|
+
actionsOverride: (_g = container === null || container === void 0 ? void 0 : container.actions) === null || _g === void 0 ? void 0 : _g.map(processor => (Object.assign(Object.assign({}, processor), { ownerId: this.ownerId }))),
|
|
2280
|
+
selectorsOverride: (_h = container === null || container === void 0 ? void 0 : container.selectors) === null || _h === void 0 ? void 0 : _h.map(processor => (Object.assign(Object.assign({}, processor), { ownerId: this.ownerId }))),
|
|
2281
|
+
});
|
|
2282
|
+
}
|
|
2283
|
+
else {
|
|
2284
|
+
request$ = this.flowStateApiService.startConfiguration(this.flowStateService.stateId, {
|
|
2285
|
+
lineItemId,
|
|
2286
|
+
actionsOverride: (_j = container === null || container === void 0 ? void 0 : container.actions) === null || _j === void 0 ? void 0 : _j.map(processor => (Object.assign(Object.assign({}, processor), { ownerId: this.ownerId }))),
|
|
2287
|
+
selectorsOverride: (_k = container === null || container === void 0 ? void 0 : container.selectors) === null || _k === void 0 ? void 0 : _k.map(processor => (Object.assign(Object.assign({}, processor), { ownerId: this.ownerId }))),
|
|
2288
|
+
});
|
|
2289
|
+
}
|
|
2290
|
+
return request$.pipe(map$1(r => {
|
|
2291
|
+
this.stateId = r.stateId;
|
|
2292
|
+
return undefined;
|
|
2293
|
+
}));
|
|
2294
|
+
}
|
|
2295
|
+
initStateless$() {
|
|
2296
|
+
return this.configurationService.configure().pipe(map$1(() => undefined));
|
|
2153
2297
|
}
|
|
2154
2298
|
executeStateless$(request) {
|
|
2155
2299
|
return of(undefined).pipe(switchMap(() => {
|
|
@@ -2165,51 +2309,49 @@ class ConfigurationState {
|
|
|
2165
2309
|
configurationRequest = (_a = this.executeActionScript(configurationRequest, action)) !== null && _a !== void 0 ? _a : configurationRequest;
|
|
2166
2310
|
});
|
|
2167
2311
|
return this.configurationService.configureRequest$(configurationRequest);
|
|
2168
|
-
}),
|
|
2169
|
-
|
|
2170
|
-
return;
|
|
2171
|
-
}
|
|
2312
|
+
}), map$1(() => {
|
|
2313
|
+
var _a;
|
|
2172
2314
|
// Run selectors and apply them to the state
|
|
2173
|
-
const finalConfigurationRequest = this.configurationService.generateRequest();
|
|
2174
|
-
const selectorsResult = EntityUtil.entries(request.selectors).reduce((
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2315
|
+
const finalConfigurationRequest = this.configurationService.generateRequest(false);
|
|
2316
|
+
const selectorsResult = EntityUtil.entries((_a = request.selectors) !== null && _a !== void 0 ? _a : {}).reduce((result, [key, selector]) => {
|
|
2317
|
+
try {
|
|
2318
|
+
result.selectors[key] = {
|
|
2319
|
+
success: true,
|
|
2320
|
+
result: this.executeSelectorScript(finalConfigurationRequest, selector),
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
catch (e) {
|
|
2324
|
+
result.selectors[key] = {
|
|
2325
|
+
success: false,
|
|
2326
|
+
errorMessage: String(e),
|
|
2327
|
+
};
|
|
2328
|
+
}
|
|
2329
|
+
return result;
|
|
2330
|
+
}, { stateId: '', selectors: {} });
|
|
2331
|
+
return selectorsResult;
|
|
2332
|
+
}));
|
|
2180
2333
|
}
|
|
2181
2334
|
executeStateful$(request) {
|
|
2182
|
-
if (!this.stateId) {
|
|
2183
|
-
return of(
|
|
2335
|
+
if (!this.flowStateService.stateId || !this.stateId) {
|
|
2336
|
+
return of();
|
|
2184
2337
|
}
|
|
2185
|
-
return this.
|
|
2338
|
+
return this.flowStateApiService.executeConfiguration(this.flowStateService.stateId, this.stateId, request).pipe(tap$1(response => {
|
|
2186
2339
|
this.stateId = response.stateId;
|
|
2187
|
-
|
|
2188
|
-
EntityUtil.entries(response.selectors).forEach(([key, value]) => {
|
|
2189
|
-
if (!value.success) {
|
|
2190
|
-
if (!this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
|
2191
|
-
this.toastService.add({ summary: value.errorMessage, severity: ToastType.error });
|
|
2192
|
-
}
|
|
2193
|
-
return;
|
|
2194
|
-
}
|
|
2195
|
-
updatedState[key] = value.result;
|
|
2196
|
-
});
|
|
2197
|
-
this.stateSubj$.next(updatedState);
|
|
2198
|
-
}), map$1(() => undefined));
|
|
2340
|
+
}));
|
|
2199
2341
|
}
|
|
2200
2342
|
executeActionScript(request, processor) {
|
|
2201
2343
|
var _a, _b, _c;
|
|
2202
|
-
const { actions } = (_b = (_a = this.
|
|
2203
|
-
const script = (_c = actions === null || actions === void 0 ? void 0 : actions.find(action => action.apiName === processor.
|
|
2344
|
+
const { actions } = (_b = (_a = this.configurationRuntimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
|
|
2345
|
+
const script = (_c = actions === null || actions === void 0 ? void 0 : actions.find(action => action.apiName === processor.apiName)) === null || _c === void 0 ? void 0 : _c.script;
|
|
2204
2346
|
if (!script) {
|
|
2205
|
-
return
|
|
2347
|
+
return request;
|
|
2206
2348
|
}
|
|
2207
2349
|
return this.executeProcessorScript(request, script, processor.inputData);
|
|
2208
2350
|
}
|
|
2209
2351
|
executeSelectorScript(request, processor) {
|
|
2210
2352
|
var _a, _b, _c;
|
|
2211
|
-
const { selectors } = (_b = (_a = this.
|
|
2212
|
-
const script = (_c = selectors === null || selectors === void 0 ? void 0 : selectors.find(selector => selector.apiName === processor.
|
|
2353
|
+
const { selectors } = (_b = (_a = this.configurationRuntimeService.runtimeContext) === null || _a === void 0 ? void 0 : _a.uiDefinitionContainer) !== null && _b !== void 0 ? _b : {};
|
|
2354
|
+
const script = (_c = selectors === null || selectors === void 0 ? void 0 : selectors.find(selector => selector.apiName === processor.apiName)) === null || _c === void 0 ? void 0 : _c.script;
|
|
2213
2355
|
if (!script) {
|
|
2214
2356
|
return null;
|
|
2215
2357
|
}
|
|
@@ -2222,38 +2364,22 @@ class ConfigurationState {
|
|
|
2222
2364
|
});
|
|
2223
2365
|
}
|
|
2224
2366
|
}
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
|
2367
|
+
ConfigurationStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService, deps: [{ token: ConfigurationRuntimeService }, { token: ConfigurationService }, { token: QuoteDraftService }, { token: i6.ToastService }, { token: FlowStateService }, { token: FlowInfoService }, { token: FlowConfigurationService }, { token: i1.FlowStateApiService }, { token: i1.QuoteApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2368
|
+
ConfigurationStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService });
|
|
2369
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationStateService, decorators: [{
|
|
2228
2370
|
type: Injectable
|
|
2229
|
-
}], ctorParameters: function () { return [{ type:
|
|
2371
|
+
}], ctorParameters: function () { return [{ type: ConfigurationRuntimeService }, { type: ConfigurationService }, { type: QuoteDraftService }, { type: i6.ToastService }, { type: FlowStateService }, { type: FlowInfoService }, { type: FlowConfigurationService }, { type: i1.FlowStateApiService }, { type: i1.QuoteApiService }]; } });
|
|
2230
2372
|
|
|
2231
2373
|
class ConfigurationModule {
|
|
2232
2374
|
}
|
|
2233
2375
|
ConfigurationModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2234
|
-
ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule] });
|
|
2235
|
-
ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, providers: [
|
|
2236
|
-
ContextApiService,
|
|
2237
|
-
ProductModelApiService,
|
|
2238
|
-
ConfigurationApiService,
|
|
2239
|
-
ConfigurationRuntimeService,
|
|
2240
|
-
RuntimeContextService,
|
|
2241
|
-
ConfigurationService,
|
|
2242
|
-
ConfigurationState,
|
|
2243
|
-
], imports: [ConfirmationDialogModule] });
|
|
2376
|
+
ConfigurationModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, imports: [ConfirmationDialogModule, ApiModule] });
|
|
2377
|
+
ConfigurationModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, providers: [ConfigurationRuntimeService, RuntimeContextService, ConfigurationService, ConfigurationStateService], imports: [ConfirmationDialogModule, ApiModule] });
|
|
2244
2378
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationModule, decorators: [{
|
|
2245
2379
|
type: NgModule,
|
|
2246
2380
|
args: [{
|
|
2247
|
-
imports: [ConfirmationDialogModule],
|
|
2248
|
-
providers: [
|
|
2249
|
-
ContextApiService,
|
|
2250
|
-
ProductModelApiService,
|
|
2251
|
-
ConfigurationApiService,
|
|
2252
|
-
ConfigurationRuntimeService,
|
|
2253
|
-
RuntimeContextService,
|
|
2254
|
-
ConfigurationService,
|
|
2255
|
-
ConfigurationState,
|
|
2256
|
-
],
|
|
2381
|
+
imports: [ConfirmationDialogModule, ApiModule],
|
|
2382
|
+
providers: [ConfigurationRuntimeService, RuntimeContextService, ConfigurationService, ConfigurationStateService],
|
|
2257
2383
|
}]
|
|
2258
2384
|
}] });
|
|
2259
2385
|
|
|
@@ -2270,8 +2396,15 @@ class SdkCoreModule {
|
|
|
2270
2396
|
SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2271
2397
|
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
|
2272
2398
|
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, providers: [
|
|
2399
|
+
ContextService,
|
|
2400
|
+
FlowInfoService,
|
|
2401
|
+
QuoteDraftService,
|
|
2402
|
+
ProductImagesService,
|
|
2273
2403
|
IntegrationState,
|
|
2274
2404
|
FlowStateService,
|
|
2405
|
+
FlowStateConfigurationService,
|
|
2406
|
+
MetricsCalculationService,
|
|
2407
|
+
RuntimeSettingsService,
|
|
2275
2408
|
{
|
|
2276
2409
|
provide: FORMATTING_SETTINGS_TOKEN,
|
|
2277
2410
|
useExisting: RuntimeSettingsService,
|
|
@@ -2282,8 +2415,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2282
2415
|
args: [{
|
|
2283
2416
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
|
2284
2417
|
providers: [
|
|
2418
|
+
ContextService,
|
|
2419
|
+
FlowInfoService,
|
|
2420
|
+
QuoteDraftService,
|
|
2421
|
+
ProductImagesService,
|
|
2285
2422
|
IntegrationState,
|
|
2286
2423
|
FlowStateService,
|
|
2424
|
+
FlowStateConfigurationService,
|
|
2425
|
+
MetricsCalculationService,
|
|
2426
|
+
RuntimeSettingsService,
|
|
2287
2427
|
{
|
|
2288
2428
|
provide: FORMATTING_SETTINGS_TOKEN,
|
|
2289
2429
|
useExisting: RuntimeSettingsService,
|
|
@@ -2468,5 +2608,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2468
2608
|
* Generated bundle index. Do not edit.
|
|
2469
2609
|
*/
|
|
2470
2610
|
|
|
2471
|
-
export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService,
|
|
2611
|
+
export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationStateService, ContextService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FLOW_CUSTOMIZATION, FORMATTING_SETTINGS_TOKEN, FlowConfigurationModule, FlowConfigurationService, FlowInfoService, FlowStateConfigurationService, FlowStateService, FlowUpdateService, IntegrationState, LineItemWorker, MetricsCalculationService, NumberPipe, PricePipe, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeSettingsService, RuntimeStep, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, filterOutTechnicalAttributes, findLineItem, findLineItemWithComparator, generateConfigurationLineItem, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getGuidedSellingConfigurationRequest, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, isTechnicalAttribute, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
|
2472
2612
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|