@veloceapps/sdk 9.0.0-2 → 9.0.0-20
Sign up to get free protection for your applications and to get access to all the features.
- package/core/modules/configuration/services/configuration-state.service.d.ts +11 -4
- package/core/services/flow-state.service.d.ts +1 -1
- package/core/services/quote-draft.service.d.ts +3 -1
- package/esm2020/cms/components/preview/preview.component.mjs +3 -4
- package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +85 -49
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +8 -3
- package/esm2020/core/services/flow-info.service.mjs +1 -5
- package/esm2020/core/services/flow-state.service.mjs +12 -8
- package/esm2020/core/services/quote-draft.service.mjs +22 -11
- package/esm2020/src/flow.component.mjs +4 -1
- package/esm2020/src/services/flow.service.mjs +2 -2
- package/fesm2015/veloceapps-sdk-cms.mjs +2 -4
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +128 -71
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +4 -1
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +2 -3
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +120 -69
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +4 -1
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/src/flow.component.d.ts +3 -1
@@ -1,11 +1,11 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
2
|
import { InjectionToken, Injectable, Optional, Inject, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
|
3
|
-
import { UUID, ConfigurationContextMode, ConfigurationContext, UITemplateType, isDefined, ConfigurationProcessorTypes, EntityUtil, ChargeGroupUtils, 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, ConfigurationMode, ConfigurationTranslatorUtils, RuntimeModel, isNotLegacyUIDefinition, SalesforceIdUtils, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
|
4
|
-
import { BehaviorSubject, switchMap, map as map$1, tap as tap$1, noop, catchError, throwError,
|
3
|
+
import { UUID, ConfigurationContextMode, ConfigurationContext, UITemplateType, QuoteDraft, isDefined, ConfigurationProcessorTypes, EntityUtil, ChargeGroupUtils, 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, ConfigurationMode, extractErrorDetails, ConfigurationTranslatorUtils, RuntimeModel, isNotLegacyUIDefinition, SalesforceIdUtils, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
|
4
|
+
import { BehaviorSubject, switchMap, map as map$1, tap as tap$1, noop, catchError, throwError, forkJoin, of, zip, combineLatest, Subject, filter as filter$1, shareReplay as shareReplay$1, finalize, takeUntil, buffer, debounceTime, share, 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
7
|
import { ApiModule } from '@veloceapps/api';
|
8
|
-
import { merge,
|
8
|
+
import { merge, isEqual, cloneDeep, assign, flatten, entries, sortBy, map as map$2, omit, uniqBy, transform } from 'lodash';
|
9
9
|
import * as i6 from '@veloceapps/components';
|
10
10
|
import { ToastType, ConfirmationComponent, ConfirmationDialogModule } from '@veloceapps/components';
|
11
11
|
import moment from 'moment';
|
@@ -200,9 +200,6 @@ class FlowInfoService {
|
|
200
200
|
}
|
201
201
|
initFlowTemplates$(flow) {
|
202
202
|
var _a, _b, _c;
|
203
|
-
if (isEmpty(flow.properties.templates)) {
|
204
|
-
return of(undefined);
|
205
|
-
}
|
206
203
|
return forkJoin([
|
207
204
|
this.templatesApiService.fetchTemplates$(),
|
208
205
|
(_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([]),
|
@@ -295,8 +292,9 @@ class QuoteDraftService {
|
|
295
292
|
get assetsState() {
|
296
293
|
return this.assetsSubj$.value;
|
297
294
|
}
|
298
|
-
constructor(context, accountApiService, quoteApiService) {
|
295
|
+
constructor(context, flowInfoService, accountApiService, quoteApiService) {
|
299
296
|
this.context = context;
|
297
|
+
this.flowInfoService = flowInfoService;
|
300
298
|
this.accountApiService = accountApiService;
|
301
299
|
this.quoteApiService = quoteApiService;
|
302
300
|
this.quoteSubj$ = new BehaviorSubject(null);
|
@@ -319,13 +317,21 @@ class QuoteDraftService {
|
|
319
317
|
}
|
320
318
|
init(headerId, params) {
|
321
319
|
const ctx = this.context.resolve();
|
322
|
-
const
|
323
|
-
|
320
|
+
const isAccountMode = this.context.mode === ConfigurationContextMode.ACCOUNT;
|
321
|
+
const accountId = isAccountMode ? headerId : ctx.properties.AccountId;
|
322
|
+
return zip(accountId ? this.accountApiService.getAssetsState(accountId, params) : of(null), isAccountMode
|
323
|
+
? of(QuoteDraft.emptyQuote(ConfigurationContextMode.ACCOUNT))
|
324
|
+
: this.quoteApiService.getQuoteState(headerId, params)).pipe(tap(([assets, quote]) => {
|
324
325
|
if (assets) {
|
325
326
|
this.assetsSubj$.next(assets);
|
326
327
|
}
|
327
328
|
this.quoteSubj$.next(quote);
|
328
|
-
|
329
|
+
if (assets && isAccountMode) {
|
330
|
+
this.context.update(assets.context);
|
331
|
+
}
|
332
|
+
else {
|
333
|
+
this.context.update(quote.context);
|
334
|
+
}
|
329
335
|
}), map(() => noop()), take(1));
|
330
336
|
}
|
331
337
|
finalizeInit() {
|
@@ -381,10 +387,11 @@ class QuoteDraftService {
|
|
381
387
|
return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
|
382
388
|
}
|
383
389
|
get isStandalone() {
|
384
|
-
|
390
|
+
var _a, _b;
|
391
|
+
return (_b = (_a = this.flowInfoService.flow) === null || _a === void 0 ? void 0 : _a.properties.standalone) !== null && _b !== void 0 ? _b : false;
|
385
392
|
}
|
386
393
|
get isStandalone$() {
|
387
|
-
return this.
|
394
|
+
return this.flowInfoService.flow$.pipe(map(() => this.isStandalone));
|
388
395
|
}
|
389
396
|
getInitialCurrentState() {
|
390
397
|
return this.initialCurrentState;
|
@@ -411,11 +418,11 @@ class QuoteDraftService {
|
|
411
418
|
}
|
412
419
|
}
|
413
420
|
}
|
414
|
-
QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1.AccountApiService }, { token: i1.QuoteApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
421
|
+
QuoteDraftService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, deps: [{ token: ContextService }, { token: FlowInfoService }, { token: i1.AccountApiService }, { token: i1.QuoteApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
415
422
|
QuoteDraftService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService });
|
416
423
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: QuoteDraftService, decorators: [{
|
417
424
|
type: Injectable
|
418
|
-
}], ctorParameters: function () { return [{ type: ContextService }, { type: i1.AccountApiService }, { type: i1.QuoteApiService }]; } });
|
425
|
+
}], ctorParameters: function () { return [{ type: ContextService }, { type: FlowInfoService }, { type: i1.AccountApiService }, { type: i1.QuoteApiService }]; } });
|
419
426
|
|
420
427
|
class FlowStateService {
|
421
428
|
constructor(contextService, quoteDraftService, flowInfoService, flowConfiguration, processorsApiService, flowStateApiService, quoteApiService, toastService, customizationService) {
|
@@ -436,7 +443,7 @@ class FlowStateService {
|
|
436
443
|
this.processors = {};
|
437
444
|
this.subscriptions = {};
|
438
445
|
this.flowStore = {};
|
439
|
-
this.
|
446
|
+
this.executionInProgress$ = new BehaviorSubject(false);
|
440
447
|
this.statefulRequestStream$ = new Subject();
|
441
448
|
this.cleanup$ = new Subject();
|
442
449
|
this.statefulExecutionRequest$ = this.initBufferedRequest$();
|
@@ -522,7 +529,7 @@ class FlowStateService {
|
|
522
529
|
return this.stateId$.value;
|
523
530
|
}
|
524
531
|
get isExecutionInProgress$() {
|
525
|
-
return this.
|
532
|
+
return this.executionInProgress$.asObservable();
|
526
533
|
}
|
527
534
|
isInitialized$() {
|
528
535
|
return combineLatest([this.stateId$, this.quoteDraftService.isInitialized$]).pipe(map$1(values => values.some(Boolean)));
|
@@ -723,15 +730,15 @@ class FlowStateService {
|
|
723
730
|
.filter(isDefined)
|
724
731
|
.reduce((acc, selectorsMap) => Object.assign(acc, selectorsMap), {}),
|
725
732
|
};
|
726
|
-
this.
|
733
|
+
this.executionInProgress$.next(true);
|
727
734
|
return this.flowStateApiService.execute(this.stateId$.value, request);
|
728
|
-
}), tap$1(({ stateId }) => this.stateId$.next(stateId)), share(), tap$1(() => this.
|
729
|
-
this.
|
735
|
+
}), tap$1(({ stateId }) => this.stateId$.next(stateId)), share(), tap$1(() => this.executionInProgress$.next(false)), catchError(e => {
|
736
|
+
this.executionInProgress$.next(false);
|
730
737
|
return throwError(() => e);
|
731
738
|
}));
|
732
739
|
}
|
733
740
|
executeStateful$(request) {
|
734
|
-
return this.
|
741
|
+
return this.executionInProgress$.pipe(filter$1(inProgress => !inProgress), take$1(1), switchMap(() =>
|
735
742
|
// make sure stream switches to statefulExecutionRequest$ before pushing an execution request
|
736
743
|
combineLatest([
|
737
744
|
this.statefulExecutionRequest$,
|
@@ -774,6 +781,7 @@ class FlowStateService {
|
|
774
781
|
return this.flowConfiguration.calculate$(flowState);
|
775
782
|
}
|
776
783
|
executeStateless$(request) {
|
784
|
+
this.executionInProgress$.next(true);
|
777
785
|
return of(undefined).pipe(tap$1(() => this.executeStatelessActions(request)), switchMap(() => {
|
778
786
|
var _a;
|
779
787
|
/*
|
@@ -787,7 +795,10 @@ class FlowStateService {
|
|
787
795
|
else {
|
788
796
|
return this.calculate$();
|
789
797
|
}
|
790
|
-
}), map$1(() => this.executeStatelessSelectors(request)))
|
798
|
+
}), map$1(() => this.executeStatelessSelectors(request)), tap$1(() => this.executionInProgress$.next(false)), catchError(e => {
|
799
|
+
this.executionInProgress$.next(false);
|
800
|
+
return throwError(() => e);
|
801
|
+
}));
|
791
802
|
}
|
792
803
|
executeStatelessActions(request) {
|
793
804
|
var _a;
|
@@ -1522,7 +1533,12 @@ class ConfigurationService {
|
|
1522
1533
|
this.showInactiveProductsConfirmation();
|
1523
1534
|
}
|
1524
1535
|
this.configurableRamp = result.lineItem;
|
1525
|
-
}), map(({ lineItem }) => lineItem), catchError$1(error => throwError(() => {
|
1536
|
+
}), map(({ lineItem }) => lineItem), catchError$1(error => throwError(() => {
|
1537
|
+
if (error.error) {
|
1538
|
+
return extractErrorDetails(error.error).join('. ');
|
1539
|
+
}
|
1540
|
+
return error.message || JSON.stringify(error);
|
1541
|
+
})), finalize$1(() => this.isLoadingSubj$.next(false)));
|
1526
1542
|
}
|
1527
1543
|
configureExternal$(props) {
|
1528
1544
|
return this.runtimeService
|
@@ -2022,10 +2038,13 @@ class ConfigurationStateService {
|
|
2022
2038
|
this.ownerId = '';
|
2023
2039
|
this.subscriptions = {};
|
2024
2040
|
this.configurationStore = {};
|
2025
|
-
this.
|
2041
|
+
this.executionInProgress$ = new BehaviorSubject(false);
|
2026
2042
|
this.statefulRequestStream$ = new Subject();
|
2027
2043
|
this.statefulExecutionRequest$ = this.initBufferedRequest$();
|
2028
2044
|
}
|
2045
|
+
get isExecutionInProgress$() {
|
2046
|
+
return this.executionInProgress$.asObservable();
|
2047
|
+
}
|
2029
2048
|
init$() {
|
2030
2049
|
let request$;
|
2031
2050
|
if (this.flowStateService.stateId && this.isStatefulConfiguration) {
|
@@ -2049,70 +2068,58 @@ class ConfigurationStateService {
|
|
2049
2068
|
this.executedFunctions = {};
|
2050
2069
|
this.configurationService.reset();
|
2051
2070
|
}
|
2052
|
-
execute$(
|
2053
|
-
|
2054
|
-
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2062
|
-
|
2063
|
-
|
2064
|
-
|
2065
|
-
execution$ = this.executeStateless$(fullRequest);
|
2066
|
-
}
|
2067
|
-
return execution$.pipe(tap$1(result => this.handleSelectorsResponse(result.selectors)));
|
2068
|
-
}
|
2069
|
-
handleSelectorsResponse(selectors) {
|
2070
|
-
Object.entries(selectors).forEach(([requestId, selectorResult]) => {
|
2071
|
-
var _a;
|
2072
|
-
if (!selectorResult.success) {
|
2073
|
-
this.toastService.add({ severity: ToastType.error, summary: selectorResult.errorMessage });
|
2074
|
-
}
|
2075
|
-
const subscription$ = (_a = this.subscriptions[requestId]) === null || _a === void 0 ? void 0 : _a.data$;
|
2076
|
-
if (subscription$) {
|
2077
|
-
subscription$.next(selectorResult);
|
2078
|
-
}
|
2079
|
-
});
|
2071
|
+
execute$(exec) {
|
2072
|
+
const request = this.execToRequest(exec);
|
2073
|
+
return this.executeRequest$(request).pipe(map$1(result => {
|
2074
|
+
// Keep only requested results
|
2075
|
+
const actualSelectors = Object.entries(result.selectors).reduce((trunk, [requestId, result]) => {
|
2076
|
+
var _a;
|
2077
|
+
if ((_a = exec.selectors) === null || _a === void 0 ? void 0 : _a[requestId]) {
|
2078
|
+
trunk[requestId] = result;
|
2079
|
+
}
|
2080
|
+
return trunk;
|
2081
|
+
}, {});
|
2082
|
+
return actualSelectors;
|
2083
|
+
}));
|
2080
2084
|
}
|
2081
2085
|
dispatch$(actionName, inputData = {}) {
|
2082
|
-
|
2086
|
+
const exec = {
|
2087
|
+
actions: [{ name: actionName, inputData }],
|
2088
|
+
};
|
2089
|
+
const request = this.execToRequest(exec);
|
2090
|
+
return this.executeRequest$(request);
|
2083
2091
|
}
|
2084
2092
|
select$(selectorName, inputData = {}) {
|
2085
2093
|
const requestId = UUID.UUID();
|
2086
|
-
|
2094
|
+
const request = this.execToRequest({
|
2087
2095
|
selectors: {
|
2088
2096
|
[requestId]: {
|
2089
|
-
|
2097
|
+
name: selectorName,
|
2090
2098
|
inputData,
|
2091
|
-
ownerId: this.ownerId,
|
2092
2099
|
},
|
2093
2100
|
},
|
2094
|
-
})
|
2101
|
+
});
|
2102
|
+
return this.executeRequest$(request).pipe(map$1(response => response.selectors[requestId]));
|
2095
2103
|
}
|
2096
2104
|
subscribe$(selectorName, inputData = {}, options) {
|
2097
2105
|
const requestId = UUID.UUID();
|
2098
2106
|
let subscription = this.subscriptions[requestId];
|
2099
2107
|
if (!subscription) {
|
2100
|
-
const request = {
|
2108
|
+
const request = this.execToRequest({
|
2101
2109
|
selectors: {
|
2102
2110
|
[requestId]: {
|
2103
|
-
|
2111
|
+
name: selectorName,
|
2104
2112
|
inputData,
|
2105
|
-
ownerId: this.ownerId,
|
2106
2113
|
},
|
2107
2114
|
},
|
2108
|
-
};
|
2115
|
+
});
|
2109
2116
|
subscription = {
|
2110
2117
|
request,
|
2111
2118
|
data$: new BehaviorSubject(this.NOT_INITIALIZED),
|
2112
2119
|
};
|
2113
2120
|
this.subscriptions[requestId] = subscription;
|
2114
2121
|
if (!(options === null || options === void 0 ? void 0 : options.cold)) {
|
2115
|
-
this.
|
2122
|
+
this.executeRequest$(request).subscribe();
|
2116
2123
|
}
|
2117
2124
|
}
|
2118
2125
|
return subscription.data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map$1(data => data), distinctUntilChanged(), finalize(() => {
|
@@ -2122,8 +2129,9 @@ class ConfigurationStateService {
|
|
2122
2129
|
}
|
2123
2130
|
}), takeUntil(this.canceledConfiguration$));
|
2124
2131
|
}
|
2125
|
-
saveConfiguration(
|
2132
|
+
saveConfiguration(first, second) {
|
2126
2133
|
var _a, _b, _c, _d;
|
2134
|
+
const flow = typeof first === 'boolean' ? first : second;
|
2127
2135
|
if (this.isStatefulConfiguration) {
|
2128
2136
|
return this.flowStateApiService
|
2129
2137
|
.saveConfiguration((_a = this.flowStateService.stateId) !== null && _a !== void 0 ? _a : '', (_b = this.stateId) !== null && _b !== void 0 ? _b : '')
|
@@ -2131,16 +2139,15 @@ class ConfigurationStateService {
|
|
2131
2139
|
}
|
2132
2140
|
else {
|
2133
2141
|
if (!flow) {
|
2134
|
-
|
2142
|
+
const quoteDraft = this.quoteDraftService.quoteDraft;
|
2143
|
+
if (!quoteDraft) {
|
2135
2144
|
return of({ quoteId: '' });
|
2136
2145
|
}
|
2137
2146
|
const rootLineItem = this.configurationService.getSnapshot();
|
2138
2147
|
const asset = this.configurationService.getAsset();
|
2139
2148
|
const currentState = rootLineItem ? [rootLineItem] : [];
|
2140
2149
|
const initialState = asset ? [asset] : [];
|
2141
|
-
return this.quoteApiService
|
2142
|
-
.getQuoteState(quoteId)
|
2143
|
-
.pipe(switchMap(quoteDraft => this.quoteApiService.upsertQuote(Object.assign(Object.assign({}, quoteDraft), { currentState, initialState }))));
|
2150
|
+
return this.quoteApiService.upsertQuote(Object.assign(Object.assign({}, quoteDraft), { currentState, initialState }));
|
2144
2151
|
}
|
2145
2152
|
else {
|
2146
2153
|
const quoteDraft = this.quoteDraftService.quoteDraft;
|
@@ -2219,7 +2226,55 @@ class ConfigurationStateService {
|
|
2219
2226
|
initStateless$() {
|
2220
2227
|
return this.configurationService.configure().pipe(map$1(() => undefined));
|
2221
2228
|
}
|
2229
|
+
execToRequest(exec) {
|
2230
|
+
var _a;
|
2231
|
+
return {
|
2232
|
+
actions: (_a = exec.actions) === null || _a === void 0 ? void 0 : _a.map(action => {
|
2233
|
+
var _a;
|
2234
|
+
return ({
|
2235
|
+
apiName: action.name,
|
2236
|
+
ownerId: this.ownerId,
|
2237
|
+
inputData: (_a = action.inputData) !== null && _a !== void 0 ? _a : {},
|
2238
|
+
});
|
2239
|
+
}),
|
2240
|
+
selectors: exec.selectors &&
|
2241
|
+
Object.entries(exec.selectors).reduce((trunk, [key, selector]) => {
|
2242
|
+
var _a;
|
2243
|
+
return (Object.assign(Object.assign({}, trunk), { [key]: { apiName: selector.name, ownerId: this.ownerId, inputData: (_a = selector.inputData) !== null && _a !== void 0 ? _a : {} } }));
|
2244
|
+
}, {}),
|
2245
|
+
};
|
2246
|
+
}
|
2247
|
+
handleSelectorsResponse(selectors) {
|
2248
|
+
Object.entries(selectors).forEach(([requestId, selectorResult]) => {
|
2249
|
+
var _a;
|
2250
|
+
if (!selectorResult.success) {
|
2251
|
+
this.toastService.add({ severity: ToastType.error, summary: selectorResult.errorMessage });
|
2252
|
+
}
|
2253
|
+
const subscription$ = (_a = this.subscriptions[requestId]) === null || _a === void 0 ? void 0 : _a.data$;
|
2254
|
+
if (subscription$) {
|
2255
|
+
subscription$.next(selectorResult);
|
2256
|
+
}
|
2257
|
+
});
|
2258
|
+
}
|
2259
|
+
executeRequest$(req, forceSubscriptions) {
|
2260
|
+
var _a;
|
2261
|
+
const fullRequest = cloneDeep(req);
|
2262
|
+
if (((_a = fullRequest.actions) === null || _a === void 0 ? void 0 : _a.length) || forceSubscriptions) {
|
2263
|
+
for (const subscription of Object.values(this.subscriptions)) {
|
2264
|
+
fullRequest.selectors = assign(fullRequest.selectors, subscription.request.selectors);
|
2265
|
+
}
|
2266
|
+
}
|
2267
|
+
let execution$;
|
2268
|
+
if (this.isStatefulConfiguration) {
|
2269
|
+
execution$ = this.executeStateful$(fullRequest);
|
2270
|
+
}
|
2271
|
+
else {
|
2272
|
+
execution$ = this.executeStateless$(fullRequest);
|
2273
|
+
}
|
2274
|
+
return execution$.pipe(tap$1(result => this.handleSelectorsResponse(result.selectors)));
|
2275
|
+
}
|
2222
2276
|
executeStateless$(request) {
|
2277
|
+
this.executionInProgress$.next(true);
|
2223
2278
|
return of(undefined).pipe(switchMap(() => {
|
2224
2279
|
var _a;
|
2225
2280
|
// Apply actions and execute configuration/price call
|
@@ -2232,6 +2287,7 @@ class ConfigurationStateService {
|
|
2232
2287
|
var _a;
|
2233
2288
|
configurationRequest = (_a = this.executeActionScript(configurationRequest, action)) !== null && _a !== void 0 ? _a : configurationRequest;
|
2234
2289
|
});
|
2290
|
+
configurationRequest = ConfigurationTranslatorUtils.lightenConfigurationRequest(configurationRequest);
|
2235
2291
|
return this.configurationService.configureRequest$(configurationRequest);
|
2236
2292
|
}), map$1(() => {
|
2237
2293
|
var _a;
|
@@ -2257,7 +2313,8 @@ class ConfigurationStateService {
|
|
2257
2313
|
return result;
|
2258
2314
|
}, { stateId: '', selectors: {} });
|
2259
2315
|
return selectorsResult;
|
2260
|
-
}), catchError(error => {
|
2316
|
+
}), tap$1(() => this.executionInProgress$.next(false)), catchError(error => {
|
2317
|
+
this.executionInProgress$.next(false);
|
2261
2318
|
if (!this.configurationRuntimeService.uiDefinitionProperties.suppressToastMessages) {
|
2262
2319
|
this.toastService.add({ severity: ToastType.error, summary: String(error) });
|
2263
2320
|
}
|
@@ -2277,15 +2334,15 @@ class ConfigurationStateService {
|
|
2277
2334
|
.filter(isDefined)
|
2278
2335
|
.reduce((acc, selectorsMap) => Object.assign(acc, selectorsMap), {}),
|
2279
2336
|
};
|
2280
|
-
this.
|
2337
|
+
this.executionInProgress$.next(true);
|
2281
2338
|
return this.flowStateApiService.executeConfiguration(this.flowStateService.stateId, this.stateId, request);
|
2282
|
-
}), tap$1(({ stateId }) => (this.stateId = stateId)), share(), tap$1(() => this.
|
2283
|
-
this.
|
2339
|
+
}), tap$1(({ stateId }) => (this.stateId = stateId)), share(), tap$1(() => this.executionInProgress$.next(false)), catchError(e => {
|
2340
|
+
this.executionInProgress$.next(false);
|
2284
2341
|
return throwError(() => e);
|
2285
2342
|
}));
|
2286
2343
|
}
|
2287
2344
|
executeStateful$(request) {
|
2288
|
-
return this.
|
2345
|
+
return this.executionInProgress$.pipe(filter$1(inProgress => !inProgress), take$1(1), switchMap(() =>
|
2289
2346
|
// make sure stream switches to statefulExecutionRequest$ before pushing an execution request
|
2290
2347
|
combineLatest([
|
2291
2348
|
this.statefulExecutionRequest$,
|