@veloceapps/sdk 3.1.18 → 3.1.20

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.
Files changed (35) hide show
  1. package/bundles/veloce-sdk-core.umd.js +193 -71
  2. package/bundles/veloce-sdk-core.umd.js.map +1 -1
  3. package/bundles/veloce-sdk-runtime.umd.js +5 -6
  4. package/bundles/veloce-sdk-runtime.umd.js.map +1 -1
  5. package/bundles/veloce-sdk.umd.js +52 -38
  6. package/bundles/veloce-sdk.umd.js.map +1 -1
  7. package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +11 -17
  8. package/core/services/quote-draft.service.d.ts +31 -7
  9. package/esm2015/core/modules/configuration/services/configuration.service.js +6 -7
  10. package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +43 -49
  11. package/esm2015/core/services/quote-draft.service.js +118 -21
  12. package/esm2015/runtime/components/ui-runtime/runtime.component.js +2 -2
  13. package/esm2015/runtime/execution/directives/section-script.directive.js +2 -2
  14. package/esm2015/runtime/services/cart.service.js +2 -3
  15. package/esm2015/runtime/services/section.service.js +1 -1
  16. package/esm2015/src/components/header/header.component.js +23 -19
  17. package/esm2015/src/components/header/header.types.js +1 -1
  18. package/esm2015/src/pages/legacy-product/legacy-product.component.js +4 -4
  19. package/esm2015/src/pages/product/product.component.js +8 -5
  20. package/esm2015/src/resolvers/flow.resolver.js +8 -4
  21. package/esm2015/src/resolvers/quote.resolver.js +4 -11
  22. package/esm2015/src/services/flow.service.js +6 -5
  23. package/fesm2015/veloce-sdk-core.js +160 -69
  24. package/fesm2015/veloce-sdk-core.js.map +1 -1
  25. package/fesm2015/veloce-sdk-runtime.js +3 -4
  26. package/fesm2015/veloce-sdk-runtime.js.map +1 -1
  27. package/fesm2015/veloce-sdk.js +44 -39
  28. package/fesm2015/veloce-sdk.js.map +1 -1
  29. package/package.json +1 -1
  30. package/runtime/services/cart.service.d.ts +1 -1
  31. package/src/components/header/header.component.d.ts +5 -2
  32. package/src/components/header/header.types.d.ts +0 -1
  33. package/src/pages/product/product.component.d.ts +1 -0
  34. package/src/resolvers/flow.resolver.d.ts +3 -1
  35. package/src/resolvers/quote.resolver.d.ts +0 -1
@@ -450,16 +450,20 @@
450
450
  }], ctorParameters: function () { return [{ type: i1__namespace.ProductApiService }]; } });
451
451
 
452
452
  var QuoteDraftService = /** @class */ (function () {
453
- function QuoteDraftService(context, quoteApiService, priceApiService) {
453
+ function QuoteDraftService(context, quoteApiService, priceApiService, sfApiService) {
454
+ var _this = this;
454
455
  this.context = context;
455
456
  this.quoteApiService = quoteApiService;
456
457
  this.priceApiService = priceApiService;
458
+ this.sfApiService = sfApiService;
457
459
  this.quoteSubj$ = new rxjs.BehaviorSubject(null);
458
460
  this.resetSubj$ = new rxjs.BehaviorSubject(true);
459
- this.priceLists = [];
460
461
  this.isInitialized = false;
462
+ this.allPriceLists = [];
463
+ this.assetPriceLists = [];
461
464
  this.hasUnsavedChanges = false;
462
465
  this.reset$ = this.resetSubj$.asObservable();
466
+ this.activePriceList$ = this.context.resolve$().pipe(operators.map(function (ctx) { return _this.allPriceLists.find(function (priceList) { return priceList.id === ctx.properties.PriceListId; }); }), operators.filter(function (priceList) { return Boolean(priceList); }));
463
467
  }
464
468
  QuoteDraftService.prototype.reset = function () {
465
469
  this.resetSubj$.next(true);
@@ -467,41 +471,55 @@
467
471
  };
468
472
  QuoteDraftService.prototype.init = function (quoteId, params) {
469
473
  var _this = this;
470
- return rxjs.zip(this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists(), this.context.resolve$()).pipe(operators.tap(function (_a) {
471
- var _b = __read(_a, 3), quote = _b[0], priceLists = _b[1], context = _b[2];
474
+ return rxjs.zip(this.context.resolve$(), this.quoteApiService.getQuoteDraft(quoteId, params), this.priceApiService.getPriceLists()).pipe(operators.tap(function (_c) {
475
+ var _d = __read(_c, 3), context = _d[0], quote = _d[1], allPriceLists = _d[2];
476
+ _this.allPriceLists = allPriceLists;
472
477
  _this.quoteSubj$.next(quote);
473
- _this.priceLists = priceLists;
474
- _this.quotePriceList = priceLists.find(function (p) { return p.id === context.properties.PriceListId; });
475
478
  _this.context.update(Object.assign(Object.assign(Object.assign({}, context), quote.context), { properties: Object.assign(Object.assign({}, context.properties), quote.context.properties) }));
476
- }), operators.map(function () {
479
+ }), operators.tap(function () {
480
+ _this.populateActivePriceLists$();
477
481
  _this.isInitialized = true;
478
- }), operators.take(1));
482
+ }), operators.map(function () { return rxjs.noop(); }), operators.take(1));
479
483
  };
480
484
  QuoteDraftService.prototype.setCurrentLineItemState = function (lineItems) {
481
- var quote = this.quoteSubj$.value;
482
- if (!quote) {
485
+ var quoteDraft = this.quoteSubj$.value;
486
+ if (!quoteDraft) {
483
487
  return;
484
488
  }
485
- this.quoteSubj$.next(Object.assign(Object.assign({}, quote), { currentState: lineItems }));
489
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: lineItems }));
486
490
  this.markAsUpdated();
487
491
  };
492
+ QuoteDraftService.prototype.updateQuoteDraft = function (update) {
493
+ var quoteDraft = this.quoteSubj$.value;
494
+ if (!quoteDraft) {
495
+ return;
496
+ }
497
+ if (update.context) {
498
+ this.context.update(update.context);
499
+ }
500
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), update));
501
+ };
488
502
  QuoteDraftService.prototype.updateByPriceSummary = function (priceSummary) {
489
- var quote = this.quoteSubj$.value;
490
- if (!quote) {
503
+ var quoteDraft = this.quoteSubj$.value;
504
+ if (!quoteDraft) {
491
505
  return;
492
506
  }
493
- this.quoteSubj$.next(Object.assign(Object.assign({}, quote), { currentState: priceSummary.lineItems, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
507
+ var updatedCurrentState = this.currentState.map(function (lineItem) {
508
+ var updated = priceSummary.lineItems.find(function (li) { return li.id === lineItem.id; });
509
+ return updated !== null && updated !== void 0 ? updated : lineItem;
510
+ });
511
+ this.quoteSubj$.next(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedCurrentState, totalPrices: priceSummary.totalPrices, approvalItems: priceSummary.approvalItems }));
494
512
  this.markAsUpdated();
495
513
  };
496
- Object.defineProperty(QuoteDraftService.prototype, "quote$", {
514
+ Object.defineProperty(QuoteDraftService.prototype, "quoteDraft$", {
497
515
  get: function () {
498
516
  var _this = this;
499
- return rxjs.combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(operators.map(function () { return _this.quoteSnapshot; }), operators.filter(function (quote) { return Boolean(quote); }));
517
+ return rxjs.combineLatest([this.quoteSubj$, this.context.resolve$()]).pipe(operators.map(function () { return _this.quoteDraft; }), operators.filter(function (quote) { return Boolean(quote); }), operators.shareReplay());
500
518
  },
501
519
  enumerable: false,
502
520
  configurable: true
503
521
  });
504
- Object.defineProperty(QuoteDraftService.prototype, "quoteSnapshot", {
522
+ Object.defineProperty(QuoteDraftService.prototype, "quoteDraft", {
505
523
  get: function () {
506
524
  var quote = this.quoteSubj$.value;
507
525
  if (!quote) {
@@ -512,6 +530,75 @@
512
530
  enumerable: false,
513
531
  configurable: true
514
532
  });
533
+ Object.defineProperty(QuoteDraftService.prototype, "currentState$", {
534
+ get: function () {
535
+ return this.quoteDraft$.pipe(operators.map(function (quote) { return quote.currentState; }));
536
+ },
537
+ enumerable: false,
538
+ configurable: true
539
+ });
540
+ Object.defineProperty(QuoteDraftService.prototype, "currentState", {
541
+ get: function () {
542
+ var _a, _b;
543
+ return (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
544
+ },
545
+ enumerable: false,
546
+ configurable: true
547
+ });
548
+ Object.defineProperty(QuoteDraftService.prototype, "activeCurrentState$", {
549
+ /**
550
+ * Stream of activeCurrentState
551
+ */
552
+ get: function () {
553
+ var _this = this;
554
+ return this.quoteDraft$.pipe(operators.map(function () { return _this.activeCurrentState; }));
555
+ },
556
+ enumerable: false,
557
+ configurable: true
558
+ });
559
+ Object.defineProperty(QuoteDraftService.prototype, "activeCurrentState", {
560
+ /**
561
+ * activeCurrentState is currentState passed through additional filters
562
+ */
563
+ get: function () {
564
+ var _a, _b;
565
+ var ctx = this.context.resolve();
566
+ var currentState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
567
+ if (ctx.mode === core.ConfigurationContextMode.ACCOUNT) {
568
+ currentState = this.filterByActivePriceList(currentState);
569
+ }
570
+ return currentState;
571
+ },
572
+ enumerable: false,
573
+ configurable: true
574
+ });
575
+ Object.defineProperty(QuoteDraftService.prototype, "activeInitialState$", {
576
+ /**
577
+ * Stream of activeInitialState
578
+ */
579
+ get: function () {
580
+ var _this = this;
581
+ return this.quoteDraft$.pipe(operators.map(function () { return _this.activeInitialState; }));
582
+ },
583
+ enumerable: false,
584
+ configurable: true
585
+ });
586
+ Object.defineProperty(QuoteDraftService.prototype, "activeInitialState", {
587
+ /**
588
+ * activeInitialState is initialState passed through additional filters
589
+ */
590
+ get: function () {
591
+ var _a, _b;
592
+ var ctx = this.context.resolve();
593
+ var initialState = (_b = (_a = this.quoteDraft) === null || _a === void 0 ? void 0 : _a.initialState) !== null && _b !== void 0 ? _b : [];
594
+ if (ctx.mode === core.ConfigurationContextMode.ACCOUNT) {
595
+ initialState = this.filterByActivePriceList(initialState);
596
+ }
597
+ return initialState;
598
+ },
599
+ enumerable: false,
600
+ configurable: true
601
+ });
515
602
  Object.defineProperty(QuoteDraftService.prototype, "isStandalone", {
516
603
  get: function () {
517
604
  return this.context.resolve().properties.standalone === 'true';
@@ -533,6 +620,46 @@
533
620
  }
534
621
  return false;
535
622
  };
623
+ QuoteDraftService.prototype.updateActivePriceList = function (priceListId) {
624
+ this.context.update({ properties: { PriceListId: priceListId } });
625
+ };
626
+ QuoteDraftService.prototype.populateActivePriceLists$ = function () {
627
+ var _this = this;
628
+ var ctx = this.context.resolve();
629
+ var quoteDraft = this.quoteDraft;
630
+ if (!quoteDraft) {
631
+ return;
632
+ }
633
+ // In ACCOUNT mode populate price lists from related assets
634
+ if (ctx.mode === core.ConfigurationContextMode.ACCOUNT) {
635
+ // Populate list of price lists
636
+ this.assetPriceLists = quoteDraft.currentState
637
+ .map(function (_c) {
638
+ var priceListId = _c.priceListId;
639
+ return priceListId;
640
+ })
641
+ .reduce(function (trunk, priceListId) {
642
+ var _a, _b;
643
+ if (!priceListId || trunk.some(function (item) { return item.id === priceListId; })) {
644
+ return trunk;
645
+ }
646
+ return __spreadArray(__spreadArray([], __read(trunk)), [
647
+ { id: priceListId, name: (_b = (_a = _this.allPriceLists.find(function (item) { return item.id === priceListId; })) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '' },
648
+ ]);
649
+ }, []);
650
+ var activePriceList = this.assetPriceLists[0];
651
+ this.updateActivePriceList(activePriceList.id);
652
+ // Update PriceListId in context properties
653
+ // TODO: remove it when backend will have such logic
654
+ if (this.assetPriceLists.length) {
655
+ this.context.update({ properties: { PriceListId: activePriceList.id } });
656
+ }
657
+ }
658
+ };
659
+ QuoteDraftService.prototype.filterByActivePriceList = function (lineItems) {
660
+ var ctx = this.context.resolve();
661
+ return lineItems.filter(function (li) { return !li.priceListId || li.priceListId === ctx.properties.PriceListId; });
662
+ };
536
663
  QuoteDraftService.prototype.markAsUpdated = function () {
537
664
  if (this.isInitialized && !this.hasUnsavedChanges) {
538
665
  this.hasUnsavedChanges = true;
@@ -540,12 +667,12 @@
540
667
  };
541
668
  return QuoteDraftService;
542
669
  }());
543
- QuoteDraftService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1__namespace.QuoteApiService }, { token: i1__namespace.PriceApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
670
+ QuoteDraftService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteDraftService, deps: [{ token: ContextService }, { token: i1__namespace.QuoteApiService }, { token: i1__namespace.PriceApiService }, { token: i1__namespace.SalesforceApiService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
544
671
  QuoteDraftService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteDraftService, providedIn: 'root' });
545
672
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: QuoteDraftService, decorators: [{
546
673
  type: i0.Injectable,
547
674
  args: [{ providedIn: 'root' }]
548
- }], ctorParameters: function () { return [{ type: ContextService }, { type: i1__namespace.QuoteApiService }, { type: i1__namespace.PriceApiService }]; } });
675
+ }], ctorParameters: function () { return [{ type: ContextService }, { type: i1__namespace.QuoteApiService }, { type: i1__namespace.PriceApiService }, { type: i1__namespace.SalesforceApiService }]; } });
549
676
 
550
677
  var RuntimeContextService = /** @class */ (function () {
551
678
  function RuntimeContextService(configurationApiService, messageService) {
@@ -955,8 +1082,6 @@
955
1082
  var qty = (_d = this.runtimeService.initializationProps) === null || _d === void 0 ? void 0 : _d.defaultQty;
956
1083
  var lineItem = (_e = this.states.configurableRamp) !== null && _e !== void 0 ? _e : getDefaultLineItem(runtimeContext, uiDefinitionProperties, qty);
957
1084
  var configurationRequest = this.createRequest(lineItem);
958
- configurationRequest.lineItems = this.states.currentState || [];
959
- configurationRequest.asset = this.states.asset;
960
1085
  var mainPricingEnabled = (_f = runtimeContext.properties) === null || _f === void 0 ? void 0 : _f.PricingEnabled;
961
1086
  var pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
962
1087
  return this.configurationApiService
@@ -974,10 +1099,9 @@
974
1099
  };
975
1100
  ConfigurationService.prototype.configureExternal$ = function (productId, qty) {
976
1101
  var _this = this;
977
- // TODO: uncomment when procedure issue is fixed on backend side
978
- // this.updateCurrentStates({
979
- // currentState: this.quoteDraftService.quoteSnapshot?.currentState ?? [],
980
- // });
1102
+ this.updateCurrentStates({
1103
+ currentState: this.quoteDraftService.currentState,
1104
+ });
981
1105
  return this.runtimeService.init({ productId: productId, defaultQty: qty }).pipe(operators.switchMap(function () { return _this.configure(); }), operators.first(), operators.catchError(function (error) {
982
1106
  _this.messageService.add({ severity: components.ToastType.error, summary: error });
983
1107
  throw error;
@@ -990,6 +1114,8 @@
990
1114
  step: !this.lineItem.value ? exports.RuntimeStep.START : exports.RuntimeStep.UPDATE,
991
1115
  attributeDomainMode: 'ALL',
992
1116
  context: this.contextService.resolve(),
1117
+ lineItems: this.states.currentState || [],
1118
+ asset: this.states.asset,
993
1119
  };
994
1120
  };
995
1121
  ConfigurationService.prototype.showInactiveProductsConfirmation = function () {
@@ -1146,83 +1272,79 @@
1146
1272
  }] });
1147
1273
 
1148
1274
  var FlowConfigurationService = /** @class */ (function () {
1149
- function FlowConfigurationService(priceApiService, contextService, quoteDraftService, messageService, updateService, configurationService) {
1150
- this.priceApiService = priceApiService;
1275
+ function FlowConfigurationService(proceduresApiService, contextService, quoteDraftService, updateService, configurationService) {
1276
+ this.proceduresApiService = proceduresApiService;
1151
1277
  this.contextService = contextService;
1152
1278
  this.quoteDraftService = quoteDraftService;
1153
- this.messageService = messageService;
1154
1279
  this.updateService = updateService;
1155
1280
  this.configurationService = configurationService;
1156
- this.charges = new rxjs.BehaviorSubject({});
1157
- this.bounceBackUpdate$ = new rxjs.BehaviorSubject(true);
1158
1281
  }
1159
- FlowConfigurationService.prototype.reset = function () {
1160
- this.charges.next({});
1161
- };
1162
- FlowConfigurationService.prototype.initialize$ = function () {
1163
- var _this = this;
1164
- var _a;
1165
- (_a = this.resetSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
1166
- this.resetSubscription = this.quoteDraftService.reset$.subscribe(function () { return _this.reset(); });
1167
- return this.calculate$(this.getSnapshot()).pipe(rxjs.map(rxjs.noop));
1168
- };
1169
- FlowConfigurationService.prototype.calculate$ = function (currentState) {
1282
+ FlowConfigurationService.prototype.calculate$ = function () {
1170
1283
  var _this = this;
1171
- var context = this.contextService.resolve();
1172
- return this.priceApiService.calculate({ context: context, currentState: currentState }).pipe(rxjs.tap(function (result) {
1173
- _this.quoteDraftService.updateByPriceSummary(result);
1174
- _this.charges.next(result.charges);
1175
- if (context) {
1176
- _this.contextService.update({ properties: context.properties });
1177
- }
1178
- }), this.handleError());
1284
+ var quoteDraft = this.quoteDraftService.quoteDraft;
1285
+ if (!quoteDraft || !quoteDraft.currentState.length) {
1286
+ return rxjs.of(undefined);
1287
+ }
1288
+ return this.proceduresApiService.apply$(quoteDraft).pipe(rxjs.tap(function (result) { return _this.quoteDraftService.updateQuoteDraft(result); }), rxjs.map(rxjs.noop));
1179
1289
  };
1180
- FlowConfigurationService.prototype.calculate = function (currentState) {
1181
- this.calculate$(currentState).subscribe();
1290
+ FlowConfigurationService.prototype.calculate = function () {
1291
+ this.calculate$().subscribe();
1182
1292
  };
1183
1293
  FlowConfigurationService.prototype.update$ = function (updates) {
1184
1294
  var _this = this;
1185
- var lineItems = lodash.cloneDeep(this.getSnapshot());
1186
- return rxjs.of([]).pipe(rxjs.tap(function () { return _this.updateService.update(lineItems, updates); }), this.handleError(), rxjs.switchMap(function () { return _this.calculate$(lineItems); }));
1295
+ var currentState = this.quoteDraftService.currentState;
1296
+ return rxjs.of([]).pipe(rxjs.tap(function () {
1297
+ var updatedState = lodash.cloneDeep(currentState);
1298
+ _this.updateService.update(updatedState, updates);
1299
+ _this.quoteDraftService.setCurrentLineItemState(updatedState);
1300
+ }), rxjs.switchMap(function () { return _this.calculate$(); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack(currentState));
1187
1301
  };
1188
1302
  FlowConfigurationService.prototype.update = function (updates) {
1189
1303
  this.update$(updates).subscribe();
1190
1304
  };
1191
1305
  FlowConfigurationService.prototype.delete$ = function (ids) {
1192
1306
  var _this = this;
1193
- return rxjs.of([]).pipe(rxjs.map(function () { return ids.reduce(function (result, id) { return _this.updateService.delete(result, id); }, _this.getSnapshot()); }), this.handleError(), rxjs.switchMap(function (currentState) { return _this.calculate$(currentState); }));
1307
+ var currentState = this.quoteDraftService.currentState;
1308
+ return rxjs.of([]).pipe(rxjs.tap(function () {
1309
+ var updatedState = ids.reduce(function (result, id) { return _this.updateService.delete(result, id); }, currentState);
1310
+ _this.quoteDraftService.setCurrentLineItemState(updatedState);
1311
+ }), rxjs.switchMap(function () { return _this.calculate$(); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack(currentState));
1194
1312
  };
1195
1313
  FlowConfigurationService.prototype.delete = function (ids) {
1196
1314
  this.delete$(ids).subscribe();
1197
1315
  };
1198
- FlowConfigurationService.prototype.get = function () {
1199
- return rxjs.combineLatest([this.quoteDraftService.quote$, this.bounceBackUpdate$]).pipe(rxjs.map(function (_c) {
1200
- var _d = __read(_c, 1), quoteDraft = _d[0];
1201
- return quoteDraft.currentState;
1202
- }), rxjs.shareReplay());
1316
+ FlowConfigurationService.prototype.addTerm$ = function (term) {
1317
+ var _this = this;
1318
+ var currentState = this.quoteDraftService.currentState;
1319
+ return rxjs.of([]).pipe(rxjs.tap(function () { return _this.quoteDraftService.setCurrentLineItemState(__spreadArray(__spreadArray([], __read(currentState)), [term])); }), rxjs.switchMap(function () { return _this.calculate$(); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack(currentState));
1203
1320
  };
1204
1321
  FlowConfigurationService.prototype.addToCart$ = function (productId, qty) {
1205
1322
  var _this = this;
1206
- return this.configurationService.configureExternal$(productId, qty).pipe(rxjs.tap(function (lineItem) {
1207
- var _a, _b;
1208
- var currentState = (_b = (_a = _this.quoteDraftService.quoteSnapshot) === null || _a === void 0 ? void 0 : _a.currentState) !== null && _b !== void 0 ? _b : [];
1209
- _this.quoteDraftService.setCurrentLineItemState(__spreadArray(__spreadArray([], __read(currentState)), [lineItem]));
1210
- }), rxjs.map(rxjs.noop));
1323
+ var currentState = this.quoteDraftService.currentState;
1324
+ return this.configurationService.configureExternal$(productId, qty).pipe(rxjs.tap(function (lineItem) { return _this.quoteDraftService.setCurrentLineItemState(__spreadArray(__spreadArray([], __read(currentState)), [lineItem])); }), rxjs.switchMap(function () { return _this.calculate$(); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack(currentState));
1325
+ };
1326
+ FlowConfigurationService.prototype.get = function () {
1327
+ var _this = this;
1328
+ return this.quoteDraftService.quoteDraft$.pipe(rxjs.map(function () { return _this.quoteDraftService.activeCurrentState; }), rxjs.shareReplay());
1211
1329
  };
1212
1330
  FlowConfigurationService.prototype.getSnapshot = function () {
1213
1331
  var _a, _b;
1214
- return (_b = (_a = this.quoteDraftService.quoteSnapshot) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
1332
+ return (_b = (_a = this.quoteDraftService) === null || _a === void 0 ? void 0 : _a.currentState.slice()) !== null && _b !== void 0 ? _b : [];
1215
1333
  };
1216
1334
  Object.defineProperty(FlowConfigurationService.prototype, "charges$", {
1217
1335
  get: function () {
1218
- return this.charges.asObservable();
1336
+ return this.quoteDraftService.quoteDraft$.pipe(rxjs.map(function (_c) {
1337
+ var charges = _c.charges;
1338
+ return charges;
1339
+ }));
1219
1340
  },
1220
1341
  enumerable: false,
1221
1342
  configurable: true
1222
1343
  });
1223
1344
  Object.defineProperty(FlowConfigurationService.prototype, "chargesSnapshot", {
1224
1345
  get: function () {
1225
- return this.charges.value;
1346
+ var _a, _b;
1347
+ return (_b = (_a = this.quoteDraftService.quoteDraft) === null || _a === void 0 ? void 0 : _a.charges) !== null && _b !== void 0 ? _b : {};
1226
1348
  },
1227
1349
  enumerable: false,
1228
1350
  configurable: true
@@ -1241,24 +1363,24 @@
1241
1363
  enumerable: false,
1242
1364
  configurable: true
1243
1365
  });
1244
- FlowConfigurationService.prototype.handleError = function () {
1366
+ FlowConfigurationService.prototype.handleErrorAndBounceBack = function (stateToRestore) {
1245
1367
  var _this = this;
1246
1368
  return function (source$) {
1247
1369
  return source$.pipe(rxjs.catchError(function (error) {
1248
1370
  console.error(error);
1249
1371
  // bounce back if configuration call has failed
1250
- _this.bounceBackUpdate$.next(true);
1372
+ _this.quoteDraftService.setCurrentLineItemState(stateToRestore);
1251
1373
  return rxjs.throwError(function () { return error; });
1252
1374
  }));
1253
1375
  };
1254
1376
  };
1255
1377
  return FlowConfigurationService;
1256
1378
  }());
1257
- FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, deps: [{ token: i1__namespace.PriceApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: i2__namespace.MessageService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1379
+ FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, deps: [{ token: i1__namespace.ProceduresApiService }, { token: ContextService }, { token: QuoteDraftService }, { token: FlowUpdateService }, { token: ConfigurationService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1258
1380
  FlowConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService });
1259
1381
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, decorators: [{
1260
1382
  type: i0.Injectable
1261
- }], ctorParameters: function () { return [{ type: i1__namespace.PriceApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: i2__namespace.MessageService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
1383
+ }], ctorParameters: function () { return [{ type: i1__namespace.ProceduresApiService }, { type: ContextService }, { type: QuoteDraftService }, { type: FlowUpdateService }, { type: ConfigurationService }]; } });
1262
1384
 
1263
1385
  var FlowConfigurationModule = /** @class */ (function () {
1264
1386
  function FlowConfigurationModule() {