@veloceapps/sdk 8.0.0-119 → 8.0.0-120
Sign up to get free protection for your applications and to get access to all the features.
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +5 -0
- package/esm2020/core/core.module.mjs +4 -2
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +13 -9
- package/esm2020/core/services/flow-state.service.mjs +5 -7
- package/fesm2015/veloceapps-sdk-core.mjs +16 -12
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +16 -12
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/package.json +1 -1
@@ -1,7 +1,7 @@
|
|
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
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, of, forkJoin, Subject, filter as filter$1, zip, combineLatest,
|
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
7
|
import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
|
@@ -753,7 +753,7 @@ class FlowStateService {
|
|
753
753
|
all subscriptions get their updates according to updated QuoteDraft
|
754
754
|
*/
|
755
755
|
this.isInitialized$()
|
756
|
-
.pipe(filter$1(Boolean), filter$1(() => !this.getFlowSafe().properties.stateful), switchMap(() => this.
|
756
|
+
.pipe(filter$1(Boolean), filter$1(() => !this.getFlowSafe().properties.stateful), switchMap(() => this.flowConfiguration.updated$), switchMap(() => this.executeRequest$({}, true)))
|
757
757
|
.subscribe();
|
758
758
|
this.charges$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(flow => {
|
759
759
|
if (!flow.properties.stateful) {
|
@@ -875,9 +875,7 @@ class FlowStateService {
|
|
875
875
|
this.executeRequest$(request).subscribe();
|
876
876
|
}
|
877
877
|
}
|
878
|
-
return this.subscriptions[requestId].data$.pipe(filter$1(data => data != this.NOT_INITIALIZED),
|
879
|
-
return isEqual(p, c);
|
880
|
-
}), map$1(data => data), finalize(() => {
|
878
|
+
return this.subscriptions[requestId].data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map$1(data => data), finalize(() => {
|
881
879
|
if (!this.subscriptions[requestId].data$.observed) {
|
882
880
|
delete this.subscriptions[requestId];
|
883
881
|
}
|
@@ -1631,6 +1629,8 @@ class FlowConfigurationService {
|
|
1631
1629
|
this.quoteDraftService = quoteDraftService;
|
1632
1630
|
this.updateService = updateService;
|
1633
1631
|
this.configurationService = configurationService;
|
1632
|
+
this.updatedSubj$ = new Subject();
|
1633
|
+
this.updated$ = this.updatedSubj$.asObservable();
|
1634
1634
|
}
|
1635
1635
|
calculate$(quoteDraft) {
|
1636
1636
|
return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
|
@@ -1654,7 +1654,7 @@ class FlowConfigurationService {
|
|
1654
1654
|
const updatedState = cloneDeep(quoteDraft.currentState);
|
1655
1655
|
this.updateService.update(updatedState, updates, quoteDraft.charges);
|
1656
1656
|
return updatedState;
|
1657
|
-
}), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
1657
|
+
}), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
|
1658
1658
|
}
|
1659
1659
|
update(updates) {
|
1660
1660
|
this.update$(updates).subscribe();
|
@@ -1673,7 +1673,7 @@ class FlowConfigurationService {
|
|
1673
1673
|
updatedState.splice(currentLineItemIndex, 1, initialLineItem);
|
1674
1674
|
return of([]).pipe(tap$1(() => {
|
1675
1675
|
this.quoteDraftService.setCurrentLineItemState(updatedState);
|
1676
|
-
}), switchMap(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
1676
|
+
}), switchMap(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
|
1677
1677
|
}
|
1678
1678
|
revert(lineItemId) {
|
1679
1679
|
this.revert$(lineItemId).subscribe();
|
@@ -1684,7 +1684,7 @@ class FlowConfigurationService {
|
|
1684
1684
|
if (!quoteDraft) {
|
1685
1685
|
return of(null);
|
1686
1686
|
}
|
1687
|
-
return of([]).pipe(map$1(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
1687
|
+
return of([]).pipe(map$1(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
|
1688
1688
|
}
|
1689
1689
|
delete(ids) {
|
1690
1690
|
this.delete$(ids).subscribe();
|
@@ -1695,7 +1695,7 @@ class FlowConfigurationService {
|
|
1695
1695
|
return of(null);
|
1696
1696
|
}
|
1697
1697
|
const updatedState = [...quoteDraft.currentState, term];
|
1698
|
-
return of([]).pipe(switchMap(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
1698
|
+
return of([]).pipe(switchMap(() => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
|
1699
1699
|
}
|
1700
1700
|
addToCart$(props) {
|
1701
1701
|
const quoteDraft = this.quoteDraftService.quoteDraft;
|
@@ -1708,7 +1708,7 @@ class FlowConfigurationService {
|
|
1708
1708
|
const split = (_b = (_a = model === null || model === void 0 ? void 0 : model.types.find(type => type.name === lineItem.type)) === null || _a === void 0 ? void 0 : _a.split) !== null && _b !== void 0 ? _b : false;
|
1709
1709
|
const lineItems = multiplyLineItems(lineItem, (_c = props.qty) !== null && _c !== void 0 ? _c : 1, split);
|
1710
1710
|
return [...quoteDraft.currentState, ...lineItems];
|
1711
|
-
}), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
|
1711
|
+
}), switchMap(updatedState => this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState }))), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
|
1712
1712
|
}
|
1713
1713
|
get() {
|
1714
1714
|
return this.quoteDraftService.quoteDraft$.pipe(map$1(() => this.quoteDraftService.activeCurrentState), shareReplay$1());
|
@@ -1752,6 +1752,7 @@ class FlowConfigurationService {
|
|
1752
1752
|
const quoteDraft = this.quoteDraftService.quoteDraft;
|
1753
1753
|
if (quoteDraft) {
|
1754
1754
|
this.quoteDraftService.updateQuoteDraft(quoteDraft);
|
1755
|
+
this.updatedSubj$.next();
|
1755
1756
|
}
|
1756
1757
|
return throwError(() => error);
|
1757
1758
|
}));
|
@@ -1759,9 +1760,10 @@ class FlowConfigurationService {
|
|
1759
1760
|
}
|
1760
1761
|
}
|
1761
1762
|
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 });
|
1762
|
-
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService });
|
1763
|
+
FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, providedIn: 'root' });
|
1763
1764
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
|
1764
|
-
type: Injectable
|
1765
|
+
type: Injectable,
|
1766
|
+
args: [{ providedIn: 'root' }]
|
1765
1767
|
}], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
|
1766
1768
|
|
1767
1769
|
class FlowConfigurationModule {
|
@@ -2260,6 +2262,7 @@ SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2260
2262
|
SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
|
2261
2263
|
SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, providers: [
|
2262
2264
|
IntegrationState,
|
2265
|
+
FlowStateService,
|
2263
2266
|
{
|
2264
2267
|
provide: FORMATTING_SETTINGS_TOKEN,
|
2265
2268
|
useExisting: RuntimeSettingsService,
|
@@ -2271,6 +2274,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2271
2274
|
imports: [ConfigurationModule, FlowConfigurationModule],
|
2272
2275
|
providers: [
|
2273
2276
|
IntegrationState,
|
2277
|
+
FlowStateService,
|
2274
2278
|
{
|
2275
2279
|
provide: FORMATTING_SETTINGS_TOKEN,
|
2276
2280
|
useExisting: RuntimeSettingsService,
|