@veloceapps/sdk 8.0.0-119 → 8.0.0-120

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.
@@ -3,7 +3,7 @@ import { Injectable, InjectionToken, Optional, Inject, NgModule, inject, Directi
3
3
  import { UUID, ConfigurationContextMode, ConfigurationContext, UITemplateType, isDefined, ConfigurationProcessorTypes, EntityUtil, 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, ChargeGroupUtils, RuntimeModel, isNotLegacyUIDefinition, SalesforceIdUtils, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
4
4
  import * as i1 from '@veloceapps/api';
5
5
  import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
6
- import { BehaviorSubject, switchMap, map as map$1, tap as tap$1, noop, catchError, throwError, of, forkJoin, Subject, filter as filter$1, zip, combineLatest, skip as skip$1, shareReplay as shareReplay$1, distinctUntilChanged, finalize, takeUntil, take as take$1 } from 'rxjs';
6
+ 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';
7
7
  import { map, filter, tap, switchMap as switchMap$1, skip, take, shareReplay, catchError as catchError$1, finalize as finalize$1, first } from 'rxjs/operators';
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';
@@ -813,7 +813,7 @@ class FlowStateService {
813
813
  all subscriptions get their updates according to updated QuoteDraft
814
814
  */
815
815
  this.isInitialized$()
816
- .pipe(filter$1(Boolean), filter$1(() => !this.getFlowSafe().properties.stateful), switchMap(() => this.quoteDraftService.quoteDraft$), skip$1(1), switchMap(() => this.executeRequest$({}, true)))
816
+ .pipe(filter$1(Boolean), filter$1(() => !this.getFlowSafe().properties.stateful), switchMap(() => this.flowConfiguration.updated$), switchMap(() => this.executeRequest$({}, true)))
817
817
  .subscribe();
818
818
  this.charges$ = this.flowInfoService.flow$.pipe(filter$1(isDefined), switchMap(flow => {
819
819
  if (!flow.properties.stateful) {
@@ -934,9 +934,7 @@ class FlowStateService {
934
934
  this.executeRequest$(request).subscribe();
935
935
  }
936
936
  }
937
- return this.subscriptions[requestId].data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), distinctUntilChanged((p, c) => {
938
- return isEqual(p, c);
939
- }), map$1(data => data), finalize(() => {
937
+ return this.subscriptions[requestId].data$.pipe(filter$1(data => data != this.NOT_INITIALIZED), map$1(data => data), finalize(() => {
940
938
  if (!this.subscriptions[requestId].data$.observed) {
941
939
  delete this.subscriptions[requestId];
942
940
  }
@@ -1669,6 +1667,8 @@ class FlowConfigurationService {
1669
1667
  this.quoteDraftService = quoteDraftService;
1670
1668
  this.updateService = updateService;
1671
1669
  this.configurationService = configurationService;
1670
+ this.updatedSubj$ = new Subject();
1671
+ this.updated$ = this.updatedSubj$.asObservable();
1672
1672
  }
1673
1673
  calculate$(quoteDraft) {
1674
1674
  return this.proceduresApiService.apply$(quoteDraft).pipe(tap$1(result => {
@@ -1692,7 +1692,7 @@ class FlowConfigurationService {
1692
1692
  const updatedState = cloneDeep(quoteDraft.currentState);
1693
1693
  this.updateService.update(updatedState, updates, quoteDraft.charges);
1694
1694
  return updatedState;
1695
- }), switchMap(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1695
+ }), switchMap(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1696
1696
  }
1697
1697
  update(updates) {
1698
1698
  this.update$(updates).subscribe();
@@ -1711,7 +1711,7 @@ class FlowConfigurationService {
1711
1711
  updatedState.splice(currentLineItemIndex, 1, initialLineItem);
1712
1712
  return of([]).pipe(tap$1(() => {
1713
1713
  this.quoteDraftService.setCurrentLineItemState(updatedState);
1714
- }), switchMap(() => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1714
+ }), switchMap(() => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1715
1715
  }
1716
1716
  revert(lineItemId) {
1717
1717
  this.revert$(lineItemId).subscribe();
@@ -1722,7 +1722,7 @@ class FlowConfigurationService {
1722
1722
  if (!quoteDraft) {
1723
1723
  return of(null);
1724
1724
  }
1725
- return of([]).pipe(map$1(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1725
+ return of([]).pipe(map$1(() => ids.reduce((result, id) => this.updateService.delete(result, id), currentState)), switchMap(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1726
1726
  }
1727
1727
  delete(ids) {
1728
1728
  this.delete$(ids).subscribe();
@@ -1733,7 +1733,7 @@ class FlowConfigurationService {
1733
1733
  return of(null);
1734
1734
  }
1735
1735
  const updatedState = [...quoteDraft.currentState, term];
1736
- return of([]).pipe(switchMap(() => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1736
+ return of([]).pipe(switchMap(() => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1737
1737
  }
1738
1738
  addToCart$(props) {
1739
1739
  const quoteDraft = this.quoteDraftService.quoteDraft;
@@ -1745,7 +1745,7 @@ class FlowConfigurationService {
1745
1745
  const split = model?.types.find(type => type.name === lineItem.type)?.split ?? false;
1746
1746
  const lineItems = multiplyLineItems(lineItem, props.qty ?? 1, split);
1747
1747
  return [...quoteDraft.currentState, ...lineItems];
1748
- }), switchMap(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), this.handleErrorAndBounceBack());
1748
+ }), switchMap(updatedState => this.calculate$({ ...quoteDraft, currentState: updatedState })), map$1(() => this.quoteDraftService.quoteDraft), tap$1(() => this.updatedSubj$.next()), this.handleErrorAndBounceBack());
1749
1749
  }
1750
1750
  get() {
1751
1751
  return this.quoteDraftService.quoteDraft$.pipe(map$1(() => this.quoteDraftService.activeCurrentState), shareReplay$1());
@@ -1785,6 +1785,7 @@ class FlowConfigurationService {
1785
1785
  const quoteDraft = this.quoteDraftService.quoteDraft;
1786
1786
  if (quoteDraft) {
1787
1787
  this.quoteDraftService.updateQuoteDraft(quoteDraft);
1788
+ this.updatedSubj$.next();
1788
1789
  }
1789
1790
  return throwError(() => error);
1790
1791
  }));
@@ -1792,9 +1793,10 @@ class FlowConfigurationService {
1792
1793
  }
1793
1794
  }
1794
1795
  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 });
1795
- FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService });
1796
+ FlowConfigurationService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, providedIn: 'root' });
1796
1797
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowConfigurationService, decorators: [{
1797
- type: Injectable
1798
+ type: Injectable,
1799
+ args: [{ providedIn: 'root' }]
1798
1800
  }], ctorParameters: function () { return [{ type: i1.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
1799
1801
 
1800
1802
  class FlowConfigurationModule {
@@ -2299,6 +2301,7 @@ SdkCoreModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
2299
2301
  SdkCoreModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, imports: [ConfigurationModule, FlowConfigurationModule] });
2300
2302
  SdkCoreModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: SdkCoreModule, providers: [
2301
2303
  IntegrationState,
2304
+ FlowStateService,
2302
2305
  {
2303
2306
  provide: FORMATTING_SETTINGS_TOKEN,
2304
2307
  useExisting: RuntimeSettingsService,
@@ -2310,6 +2313,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2310
2313
  imports: [ConfigurationModule, FlowConfigurationModule],
2311
2314
  providers: [
2312
2315
  IntegrationState,
2316
+ FlowStateService,
2313
2317
  {
2314
2318
  provide: FORMATTING_SETTINGS_TOKEN,
2315
2319
  useExisting: RuntimeSettingsService,