@veloceapps/sdk 11.0.0-71 → 11.0.0-72
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 +5 -6
- package/cms/components/preview/preview.types.d.ts +0 -4
- package/core/modules/configuration/services/configuration.service.d.ts +1 -1
- package/esm2020/cms/components/preview/preview.component.mjs +18 -27
- package/esm2020/cms/components/preview/preview.types.mjs +1 -1
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +14 -9
- package/fesm2015/veloceapps-sdk-cms.mjs +22 -32
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +15 -10
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +21 -30
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +15 -10
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/package.json +1 -1
@@ -8,7 +8,7 @@ import { ToastType, ConfirmationDialogModule } from '@veloceapps/components';
|
|
8
8
|
import { tap, BehaviorSubject, map, filter, switchMap, of, forkJoin, throwError, noop, Subject, catchError, combineLatest, finalize, buffer, debounceTime, share, take, distinctUntilChanged, shareReplay, takeUntil, first } from 'rxjs';
|
9
9
|
import * as i1 from '@veloceapps/api/v2';
|
10
10
|
import { flatten, omit, uniqBy, cloneDeep, assign, isEqual } from 'lodash';
|
11
|
-
import { filter as filter$1, map as map$1,
|
11
|
+
import { filter as filter$1, map as map$1, tap as tap$1, catchError as catchError$1, finalize as finalize$1 } from 'rxjs/operators';
|
12
12
|
import * as i2 from 'primeng/api';
|
13
13
|
import { NgControl } from '@angular/forms';
|
14
14
|
import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
|
@@ -1116,22 +1116,27 @@ class ConfigurationService {
|
|
1116
1116
|
this.previousConfigurationStateSubj$.next(null);
|
1117
1117
|
}
|
1118
1118
|
init$() {
|
1119
|
-
var _a
|
1119
|
+
var _a;
|
1120
1120
|
const { state } = this.salesTransactionService;
|
1121
1121
|
const { productId, transactionItemId } = this.flowInfoService.context;
|
1122
|
-
if (!state) {
|
1122
|
+
if (!state || !productId) {
|
1123
1123
|
return of(undefined);
|
1124
1124
|
}
|
1125
1125
|
const salesTransactionItems = (_a = state === null || state === void 0 ? void 0 : state.salesTransaction.salesTransactionItems) !== null && _a !== void 0 ? _a : [];
|
1126
|
+
let isRootGenerated = false;
|
1126
1127
|
let transactionItem = salesTransactionItems.find(item => item.id === transactionItemId);
|
1127
|
-
if (!transactionItem
|
1128
|
-
transactionItem =
|
1129
|
-
|
1128
|
+
if (!transactionItem) {
|
1129
|
+
transactionItem = salesTransactionItems.find(item => item.productId === productId);
|
1130
|
+
}
|
1131
|
+
if (!transactionItem) {
|
1132
|
+
transactionItem = generateTransactionItem(productId);
|
1133
|
+
isRootGenerated = true;
|
1130
1134
|
}
|
1131
1135
|
const configurationState = Object.assign(Object.assign({}, state), { salesTransaction: Object.assign(Object.assign({}, state.salesTransaction), { salesTransactionItems: transactionItem ? [transactionItem] : [] }) });
|
1132
|
-
this.
|
1133
|
-
|
1134
|
-
|
1136
|
+
return (isRootGenerated ? this.configureRequest$(configurationState) : of(configurationState)).pipe(tap$1(configurationState => {
|
1137
|
+
this.configurationStateSubj$.next(configurationState);
|
1138
|
+
this.previousConfigurationStateSubj$.next(configurationState);
|
1139
|
+
}), map$1(noop));
|
1135
1140
|
}
|
1136
1141
|
patch$(transactionItem) {
|
1137
1142
|
const { state, root } = this;
|
@@ -1167,7 +1172,7 @@ class ConfigurationService {
|
|
1167
1172
|
return this.orchestrationsApiService.apply$(request).pipe(tap$1(result => {
|
1168
1173
|
this.configurationStateSubj$.next(result);
|
1169
1174
|
this.previousConfigurationStateSubj$.next(cloneDeep(result));
|
1170
|
-
}),
|
1175
|
+
}), catchError$1(error => throwError(() => {
|
1171
1176
|
const resetState = this.previousConfigurationStateSubj$.getValue();
|
1172
1177
|
if (resetState) {
|
1173
1178
|
this.previousConfigurationStateSubj$.next(cloneDeep(resetState));
|