@veloceapps/sdk 11.0.0-70 → 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
@@ -6,10 +6,10 @@ import { ApiModule } from '@veloceapps/api';
|
|
6
6
|
import * as i6 from '@veloceapps/components';
|
7
7
|
import { ToastType, ConfirmationDialogModule } from '@veloceapps/components';
|
8
8
|
import * as i1 from '@veloceapps/api/v2';
|
9
|
-
import { tap, BehaviorSubject, map, filter, switchMap, of, forkJoin,
|
9
|
+
import { tap, BehaviorSubject, map, filter, switchMap, of, forkJoin, noop, throwError, Subject, catchError as catchError$1, combineLatest, finalize as finalize$1, buffer, debounceTime, share, take, distinctUntilChanged, shareReplay, takeUntil, first } from 'rxjs';
|
10
10
|
import { uniqBy, flatten, omit, cloneDeep, assign, isEqual } from 'lodash';
|
11
11
|
import * as i2 from 'primeng/api';
|
12
|
-
import { filter as filter$1, map as map$1,
|
12
|
+
import { filter as filter$1, map as map$1, tap as tap$1, catchError, finalize } from 'rxjs/operators';
|
13
13
|
import { NgControl } from '@angular/forms';
|
14
14
|
import 'primeng/calendar';
|
15
15
|
import { DATE_PIPE_DEFAULT_OPTIONS, formatDate } from '@angular/common';
|
@@ -399,14 +399,18 @@ class ConfigurationService {
|
|
399
399
|
init$() {
|
400
400
|
const { state } = this.salesTransactionService;
|
401
401
|
const { productId, transactionItemId } = this.flowInfoService.context;
|
402
|
-
if (!state) {
|
402
|
+
if (!state || !productId) {
|
403
403
|
return of(undefined);
|
404
404
|
}
|
405
405
|
const salesTransactionItems = state?.salesTransaction.salesTransactionItems ?? [];
|
406
|
+
let isRootGenerated = false;
|
406
407
|
let transactionItem = salesTransactionItems.find(item => item.id === transactionItemId);
|
407
|
-
if (!transactionItem
|
408
|
-
transactionItem =
|
409
|
-
|
408
|
+
if (!transactionItem) {
|
409
|
+
transactionItem = salesTransactionItems.find(item => item.productId === productId);
|
410
|
+
}
|
411
|
+
if (!transactionItem) {
|
412
|
+
transactionItem = generateTransactionItem(productId);
|
413
|
+
isRootGenerated = true;
|
410
414
|
}
|
411
415
|
const configurationState = {
|
412
416
|
...state,
|
@@ -415,9 +419,10 @@ class ConfigurationService {
|
|
415
419
|
salesTransactionItems: transactionItem ? [transactionItem] : [],
|
416
420
|
},
|
417
421
|
};
|
418
|
-
this.
|
419
|
-
|
420
|
-
|
422
|
+
return (isRootGenerated ? this.configureRequest$(configurationState) : of(configurationState)).pipe(tap$1(configurationState => {
|
423
|
+
this.configurationStateSubj$.next(configurationState);
|
424
|
+
this.previousConfigurationStateSubj$.next(configurationState);
|
425
|
+
}), map$1(noop));
|
421
426
|
}
|
422
427
|
patch$(transactionItem) {
|
423
428
|
const { state, root } = this;
|
@@ -459,7 +464,7 @@ class ConfigurationService {
|
|
459
464
|
return this.orchestrationsApiService.apply$(request).pipe(tap$1(result => {
|
460
465
|
this.configurationStateSubj$.next(result);
|
461
466
|
this.previousConfigurationStateSubj$.next(cloneDeep(result));
|
462
|
-
}),
|
467
|
+
}), catchError(error => throwError(() => {
|
463
468
|
const resetState = this.previousConfigurationStateSubj$.getValue();
|
464
469
|
if (resetState) {
|
465
470
|
this.previousConfigurationStateSubj$.next(cloneDeep(resetState));
|