@veloceapps/sdk 8.0.0-188 → 8.0.0-189

Sign up to get free protection for your applications and to get access to all the features.
@@ -761,7 +761,7 @@ class FlowService {
761
761
  this.quoteDraftService.currentState.find(li => li.id === payload.lineItemId)?.productId;
762
762
  return of({ ...payload, productId });
763
763
  }
764
- return this.prepareConfiguration$(payload);
764
+ return this.prepareConfiguration$(payload.lineItemId).pipe(map(() => payload));
765
765
  }), tap(payload => {
766
766
  if (payload.productId) {
767
767
  this.flowRouterService.navigateToProductConfiguration(payload.productId, payload.lineItemId);
@@ -833,28 +833,13 @@ class FlowService {
833
833
  .pipe(map(path => path.queryParams['productId']), takeUntil(this.cleanup$))
834
834
  .subscribe(productId => this.integrationState.patchState({ productId }));
835
835
  }
836
- prepareConfiguration$(payload) {
837
- if (!payload.productId && !payload.lineItemId) {
838
- return of(payload);
839
- }
840
- // When reconfiguring asset, PriceList should be updated with priceListId of an asset
841
- const actions = [
842
- { name: 'UPDATE_PRICE_LIST', inputData: { lineItemId: payload.lineItemId } },
843
- ];
844
- const selectors = {};
845
- if (!payload.productId) {
846
- selectors['productIdResult'] = { name: 'FIND_PRODUCT_ID', inputData: { lineItemId: payload.lineItemId } };
847
- }
848
- return this.flowStateService.execute$(UITemplateType.FLOW_ENGINE, { actions, selectors }).pipe(map(({ productIdResult }) => {
849
- if (!productIdResult) {
850
- return payload;
851
- }
852
- const productId = productIdResult.success && typeof productIdResult.result === 'string' ? productIdResult.result : undefined;
853
- return {
854
- ...payload,
855
- productId,
856
- };
857
- }));
836
+ prepareConfiguration$(lineItemId) {
837
+ if (!lineItemId) {
838
+ return of(undefined);
839
+ }
840
+ return this.flowStateService.dispatch$(UITemplateType.FLOW_ENGINE, 'UPDATE_PRICE_LIST', {
841
+ lineItemId,
842
+ });
858
843
  }
859
844
  legacyApplyConfiguration() {
860
845
  const quoteDraft = this.quoteDraftService.quoteDraft;