@veloceapps/sdk 11.0.0-88 → 11.0.0-89

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.
@@ -398,18 +398,22 @@ class ConfigurationService {
398
398
  }
399
399
  init$() {
400
400
  const { state } = this.salesTransactionService;
401
- const { productId, transactionItemId } = this.flowInfoService.context;
401
+ const { standalone } = this.flowInfoService.flow.properties;
402
+ const { productId, transactionItemId, newProductQty } = this.flowInfoService.context;
402
403
  if (!state || !productId) {
403
404
  return of(undefined);
404
405
  }
405
406
  const salesTransactionItems = state?.salesTransaction.salesTransactionItems ?? [];
406
407
  let isRootGenerated = false;
407
408
  let transactionItem = salesTransactionItems.find(item => item.id === transactionItemId);
408
- if (!transactionItem) {
409
+ if (!transactionItem && standalone) {
409
410
  transactionItem = salesTransactionItems.find(item => item.productId === productId);
410
411
  }
411
412
  if (!transactionItem) {
412
413
  transactionItem = generateTransactionItem(productId);
414
+ if (typeof newProductQty === 'number' && newProductQty > 0) {
415
+ transactionItem.qty = newProductQty;
416
+ }
413
417
  isRootGenerated = true;
414
418
  }
415
419
  const configurationState = {
@@ -1409,7 +1413,7 @@ class ConfigurationStateService {
1409
1413
  transactionContext: state,
1410
1414
  flowId: this.flowInfoService.flow.id,
1411
1415
  };
1412
- return this.salesTransactionApiService.save(request).pipe(map(id => ({ id })));
1416
+ return this.salesTransactionApiService.save(request).pipe(switchMap(r => this.flowStateService.executeRequest$({}, true).pipe(map(() => r))), map(id => ({ id })));
1413
1417
  }
1414
1418
  const transactionContext = this.salesTransactionService.state;
1415
1419
  const configurationRoot = this.configurationService.root;
@@ -1432,7 +1436,7 @@ class ConfigurationStateService {
1432
1436
  salesTransactionItems,
1433
1437
  },
1434
1438
  };
1435
- return this.flowConfigurationService.calculate$(newState).pipe(map(() => ({ id: '' })));
1439
+ return this.flowConfigurationService.calculate$(newState).pipe(switchMap(() => this.flowStateService.executeRequest$({}, true)), map(() => ({ id: '' })));
1436
1440
  }
1437
1441
  cancelConfiguration() {
1438
1442
  if (!this.isInitialized$.value) {