@veloceapps/sdk 3.0.5 → 3.0.7

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 (47) hide show
  1. package/bundles/veloce-sdk-cms.umd.js +176 -38
  2. package/bundles/veloce-sdk-cms.umd.js.map +1 -1
  3. package/bundles/veloce-sdk-runtime.umd.js +11 -15
  4. package/bundles/veloce-sdk-runtime.umd.js.map +1 -1
  5. package/bundles/veloce-sdk.umd.js +205 -123
  6. package/bundles/veloce-sdk.umd.js.map +1 -1
  7. package/cms/modules/configuration/types/configuration.types.d.ts +2 -3
  8. package/cms/modules/flow-configuration/index.d.ts +2 -0
  9. package/cms/modules/flow-configuration/services/flow-configuration.service.d.ts +10 -1
  10. package/cms/modules/flow-configuration/services/flow-update.service.d.ts +13 -0
  11. package/cms/modules/flow-configuration/types/update.types.d.ts +12 -0
  12. package/cms/utils/line-item.utils.d.ts +1 -0
  13. package/esm2015/cms/modules/configuration/services/configuration-runtime.service.js +10 -11
  14. package/esm2015/cms/modules/configuration/services/configuration.service.js +4 -3
  15. package/esm2015/cms/modules/configuration/services/runtime-context.service.js +4 -5
  16. package/esm2015/cms/modules/configuration/types/configuration.types.js +1 -1
  17. package/esm2015/cms/modules/flow-configuration/flow-configuration.module.js +4 -3
  18. package/esm2015/cms/modules/flow-configuration/index.js +3 -1
  19. package/esm2015/cms/modules/flow-configuration/services/flow-configuration.service.js +31 -12
  20. package/esm2015/cms/modules/flow-configuration/services/flow-update.service.js +97 -0
  21. package/esm2015/cms/modules/flow-configuration/types/update.types.js +2 -0
  22. package/esm2015/cms/utils/line-item.utils.js +14 -4
  23. package/esm2015/runtime/components/ui-runtime-preview/runtime-preview.component.js +2 -10
  24. package/esm2015/runtime/execution/directives/vl-ramp.directive.js +1 -1
  25. package/esm2015/runtime/services/quote.service.js +10 -6
  26. package/esm2015/src/components/header/cart-overlay/cart-overlay.component.js +60 -0
  27. package/esm2015/src/components/header/cart-overlay/cart-overlay.module.js +21 -0
  28. package/esm2015/src/components/header/header.component.js +20 -11
  29. package/esm2015/src/components/header/header.module.js +6 -4
  30. package/esm2015/src/components/header/header.types.js +1 -1
  31. package/esm2015/src/flow.component.js +1 -1
  32. package/esm2015/src/pages/debug/debug.component.js +16 -11
  33. package/fesm2015/veloce-sdk-cms.js +157 -34
  34. package/fesm2015/veloce-sdk-cms.js.map +1 -1
  35. package/fesm2015/veloce-sdk-runtime.js +10 -14
  36. package/fesm2015/veloce-sdk-runtime.js.map +1 -1
  37. package/fesm2015/veloce-sdk.js +137 -63
  38. package/fesm2015/veloce-sdk.js.map +1 -1
  39. package/package.json +1 -1
  40. package/runtime/execution/directives/vl-ramp.directive.d.ts +1 -1
  41. package/runtime/services/quote.service.d.ts +4 -3
  42. package/src/components/header/cart-overlay/cart-overlay.component.d.ts +21 -0
  43. package/src/components/header/cart-overlay/cart-overlay.module.d.ts +11 -0
  44. package/src/components/header/header.component.d.ts +9 -5
  45. package/src/components/header/header.module.d.ts +3 -1
  46. package/src/components/header/header.types.d.ts +1 -0
  47. package/src/pages/debug/debug.component.d.ts +5 -2
@@ -1,8 +1,10 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common'), require('@veloce/core'), require('@angular/cdk/drag-drop'), require('@angular/forms'), require('lodash'), require('@veloce/components'), require('@veloce/sdk/runtime'), require('rxjs/operators'), require('@veloce/api'), require('primeng/api'), require('primeng/dynamicdialog'), require('@babel/standalone')) :
3
- typeof define === 'function' && define.amd ? define('@veloce/sdk/cms', ['exports', '@angular/core', 'rxjs', '@angular/common', '@veloce/core', '@angular/cdk/drag-drop', '@angular/forms', 'lodash', '@veloce/components', '@veloce/sdk/runtime', 'rxjs/operators', '@veloce/api', 'primeng/api', 'primeng/dynamicdialog', '@babel/standalone'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloce = global.veloce || {}, global.veloce.sdk = global.veloce.sdk || {}, global.veloce.sdk.cms = {}), global.ng.core, global.rxjs, global.ng.common, global["@veloce/core"], global.ng.cdk.dragDrop, global.ng.forms, global.lodash, global["@veloce/components"], global.veloce.sdk.runtime, global.rxjs.operators, global["@veloce/api"], global["primeng/api"], global["primeng/dynamicdialog"], global["@babel/standalone"]));
5
- })(this, (function (exports, i0, rxjs, i8, core, dragDrop, angularForms, lodash, i6, i2, rxjsOperators, i1, i3, i5, standalone) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('@angular/common'), require('@veloce/core'), require('@angular/cdk/drag-drop'), require('@angular/forms'), require('lodash'), require('@veloce/components'), require('@veloce/sdk/runtime'), require('rxjs/operators'), require('@veloce/api'), require('primeng/api'), require('primeng/dynamicdialog'), require('@babel/standalone'), require('moment')) :
3
+ typeof define === 'function' && define.amd ? define('@veloce/sdk/cms', ['exports', '@angular/core', 'rxjs', '@angular/common', '@veloce/core', '@angular/cdk/drag-drop', '@angular/forms', 'lodash', '@veloce/components', '@veloce/sdk/runtime', 'rxjs/operators', '@veloce/api', 'primeng/api', 'primeng/dynamicdialog', '@babel/standalone', 'moment'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.veloce = global.veloce || {}, global.veloce.sdk = global.veloce.sdk || {}, global.veloce.sdk.cms = {}), global.ng.core, global.rxjs, global.ng.common, global["@veloce/core"], global.ng.cdk.dragDrop, global.ng.forms, global.lodash, global["@veloce/components"], global.veloce.sdk.runtime, global.rxjs.operators, global["@veloce/api"], global["primeng/api"], global["primeng/dynamicdialog"], global["@babel/standalone"], global.moment));
5
+ })(this, (function (exports, i0, rxjs, i8, core, dragDrop, angularForms, lodash, i6, i2, rxjsOperators, i1, i3, i5, standalone, moment) { 'use strict';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
6
8
 
7
9
  function _interopNamespace(e) {
8
10
  if (e && e.__esModule) return e;
@@ -33,6 +35,7 @@
33
35
  var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
34
36
  var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
35
37
  var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
38
+ var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
36
39
 
37
40
  /*! *****************************************************************************
38
41
  Copyright (c) Microsoft Corporation.
@@ -878,7 +881,18 @@
878
881
  return blocks;
879
882
  };
880
883
  var findLineItem = function (id, lineItems) {
881
- return core.EntityUtil.findByFieldHierarchically('id', id, lineItems, 'lineItems');
884
+ return findLineItemWithComparator(lineItems, function (li) { return li.id === id; });
885
+ };
886
+ var findLineItemWithComparator = function (lineItems, comparator) {
887
+ var currentLevel = lineItems;
888
+ while (currentLevel.length) {
889
+ var found = currentLevel.find(comparator);
890
+ if (found) {
891
+ return found;
892
+ }
893
+ currentLevel = lodash.flatten(currentLevel.map(function (parent) { return parent.lineItems; }));
894
+ }
895
+ return;
882
896
  };
883
897
  var insertLineItem = function (lineItem, parentId, toInsert) {
884
898
  var insertData = lineItem.id === parentId ? [toInsert] : [];
@@ -1023,10 +1037,10 @@
1023
1037
  RuntimeContextService.prototype.getRuntimeContext = function (productId, offeringId) {
1024
1038
  var _this = this;
1025
1039
  return this.configurationApiService.getRuntimeDataByProductId(productId, offeringId).pipe(rxjsOperators.map(function (runtimeData) {
1026
- var _a, _b, _c, _d;
1040
+ var _a, _b, _c;
1027
1041
  var uiDefinition = _this.getUIDefinition(runtimeData);
1028
1042
  var runtimeModel = core.RuntimeModel.create(runtimeData.types, runtimeData.products);
1029
- var _e = (_a = Array.from(runtimeModel.components.values()).find(function (c) { return c.productId === productId; })) !== null && _a !== void 0 ? _a : {}, productName = _e.productName, properties = _e.properties;
1043
+ var _d = (_a = Array.from(runtimeModel.components.values()).find(function (c) { return c.productId === productId; })) !== null && _a !== void 0 ? _a : {}, productName = _d.productName, properties = _d.properties;
1030
1044
  return {
1031
1045
  modelId: runtimeData.modelId,
1032
1046
  uiDefinition: uiDefinition,
@@ -1035,10 +1049,9 @@
1035
1049
  productId: productId,
1036
1050
  productType: (properties === null || properties === void 0 ? void 0 : properties.displayName) || productName,
1037
1051
  offeringId: offeringId,
1038
- priceListId: (_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.priceList,
1039
1052
  properties: {
1040
- PricingEnabled: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.pricingEnabled,
1041
- PriceListId: (_d = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _d === void 0 ? void 0 : _d.priceList,
1053
+ PricingEnabled: ((_b = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _b === void 0 ? void 0 : _b.pricingEnabled) ? 'true' : 'false',
1054
+ PriceListId: (_c = uiDefinition === null || uiDefinition === void 0 ? void 0 : uiDefinition.properties) === null || _c === void 0 ? void 0 : _c.priceList,
1042
1055
  },
1043
1056
  };
1044
1057
  }));
@@ -1094,8 +1107,8 @@
1094
1107
  return rxjs.combineLatest([
1095
1108
  this.apiService.getRuntimeDataByModelId(modelId),
1096
1109
  this.contextService.create('TestId', core.ConfigurationContextMode.TEST),
1097
- ]).pipe(rxjsOperators.first(), rxjsOperators.tap(function (_d) {
1098
- var _e = __read(_d, 2), runtimeData = _e[0], configurationContext = _e[1];
1110
+ ]).pipe(rxjsOperators.first(), rxjsOperators.tap(function (_e) {
1111
+ var _f = __read(_e, 2), runtimeData = _f[0], context = _f[1];
1099
1112
  var _a;
1100
1113
  _this._runtimeContext = {
1101
1114
  modelId: modelId,
@@ -1103,8 +1116,7 @@
1103
1116
  runtimeMode: i2.RuntimeMode.TEST,
1104
1117
  };
1105
1118
  _this.contextService.update({
1106
- priceListId: _this.uiDefinitionProperties.priceList,
1107
- properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = _this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), configurationContext.properties), { ModelId: modelId, RuntimeMode: core.ConfigurationContextMode.TEST, PricingEnabled: String(_this.uiDefinitionProperties.pricingEnabled), StartDate: new Date().toISOString().substring(0, 10), PriceListId: _this.uiDefinitionProperties.priceList }), uiDefinitionExternals),
1119
+ properties: Object.assign(Object.assign(Object.assign(Object.assign({}, (_a = _this.runtimeContext) === null || _a === void 0 ? void 0 : _a.properties), context.properties), { ModelId: modelId, RuntimeMode: core.ConfigurationContextMode.TEST, PricingEnabled: _this.uiDefinitionProperties.pricingEnabled ? 'true' : 'false', StartDate: new Date().toISOString().substring(0, 10), PriceListId: _this.uiDefinitionProperties.priceList }), uiDefinitionExternals),
1108
1120
  });
1109
1121
  _this._isInitialized = true;
1110
1122
  }));
@@ -1112,20 +1124,20 @@
1112
1124
  ConfigurationRuntimeService.prototype.init = function (props) {
1113
1125
  var _this = this;
1114
1126
  this._assets = props.assets;
1115
- var configurationContext = this.contextService.resolve();
1116
- if (!configurationContext) {
1127
+ var context = this.contextService.resolve();
1128
+ if (!context) {
1117
1129
  return rxjs.of();
1118
1130
  }
1119
1131
  return this.runtimeContextService.getRuntimeContext(props.productId, props.offeringId).pipe(rxjsOperators.tap(function (runtimeContext) {
1120
- var _a, _b, _c;
1132
+ var _a, _b, _c, _d;
1121
1133
  _this.uiDefinitionProperties = (_b = (_a = runtimeContext.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) !== null && _b !== void 0 ? _b : {};
1122
- var mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign({}, runtimeContext.properties), configurationContext.properties) });
1134
+ var PriceListId = ((_c = context.properties) !== null && _c !== void 0 ? _c : {}).PriceListId;
1135
+ var mergeContext = Object.assign(Object.assign({}, runtimeContext), { properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), context.properties), { PricingEnabled: PriceListId ? 'true' : 'false' }) });
1123
1136
  _this.id15to18('AccountId', mergeContext.properties);
1124
1137
  _this._runtimeContext = mergeContext;
1125
- if (configurationContext.properties && ((_c = runtimeContext.properties) === null || _c === void 0 ? void 0 : _c.StartDate)) {
1138
+ if (context.properties && ((_d = _this._runtimeContext.properties) === null || _d === void 0 ? void 0 : _d.StartDate)) {
1126
1139
  _this.contextService.update({
1127
- priceListId: _this.uiDefinitionProperties.priceList,
1128
- properties: Object.assign(Object.assign(Object.assign({}, runtimeContext.properties), configurationContext.properties), { PricingEnabled: String(_this.uiDefinitionProperties.pricingEnabled), PriceListId: _this.uiDefinitionProperties.priceList }),
1140
+ properties: Object.assign(Object.assign({}, _this._runtimeContext.properties), context.properties),
1129
1141
  });
1130
1142
  }
1131
1143
  _this._isInitialized = true;
@@ -1244,7 +1256,7 @@
1244
1256
  });
1245
1257
  ConfigurationService.prototype.configure = function () {
1246
1258
  var _this = this;
1247
- var _a, _b, _c, _d;
1259
+ var _a, _b, _c, _d, _e;
1248
1260
  var runtimeContext = this.getRuntimeContext();
1249
1261
  var runtimeModel = this.getRuntimeModel();
1250
1262
  if (!runtimeContext || !runtimeModel) {
@@ -1255,11 +1267,12 @@
1255
1267
  var configurationRequest = this.createRequest(lineItem);
1256
1268
  configurationRequest.lineItems = this.states.currentState || [];
1257
1269
  configurationRequest.asset = this.states.asset;
1258
- var pricingEnabled = uiDefinitionProperties.pricingEnabled;
1270
+ var mainPricingEnabled = (_e = runtimeContext.properties) === null || _e === void 0 ? void 0 : _e.PricingEnabled;
1271
+ var pricingEnabled = mainPricingEnabled ? mainPricingEnabled === 'true' : uiDefinitionProperties.pricingEnabled;
1259
1272
  return this.configurationApiService
1260
1273
  .configureLineItem({ configurationRequest: configurationRequest, runtimeModel: runtimeModel, pricingEnabled: pricingEnabled })
1261
- .pipe(rxjsOperators.map(function (_e) {
1262
- var lineItem = _e.lineItem, context = _e.context, charges = _e.charges, deletedLineItems = _e.deletedLineItems;
1274
+ .pipe(rxjsOperators.map(function (_f) {
1275
+ var lineItem = _f.lineItem, context = _f.context, charges = _f.charges, deletedLineItems = _f.deletedLineItems;
1263
1276
  if (context) {
1264
1277
  _this.contextService.update({ properties: context.properties });
1265
1278
  }
@@ -1764,14 +1777,120 @@
1764
1777
  DEFAULT: [],
1765
1778
  };
1766
1779
 
1780
+ var FlowUpdateService = /** @class */ (function () {
1781
+ function FlowUpdateService() {
1782
+ }
1783
+ FlowUpdateService.prototype.update = function (rootLineItem, params) {
1784
+ switch (params.attributeType) {
1785
+ case 'QTY':
1786
+ return this.updateQty(rootLineItem, params);
1787
+ case 'START_DATE':
1788
+ return this.updateStartDate(rootLineItem, params);
1789
+ case 'END_DATE':
1790
+ return this.updateEndDate(rootLineItem, params);
1791
+ case 'PRICE_ADJUSTMENT':
1792
+ return this.updatePriceAdjustment(rootLineItem, params);
1793
+ default:
1794
+ return rootLineItem;
1795
+ }
1796
+ };
1797
+ FlowUpdateService.prototype.delete = function (lineItems, id) {
1798
+ var filtered = lineItems.filter(function (lineItem) { return lineItem.id !== id; });
1799
+ return filtered.map(function (lineItem) { return new LineItemWorker(lineItem).remove(id).li; });
1800
+ };
1801
+ FlowUpdateService.prototype.updateQty = function (rootLineItem, params) {
1802
+ // change quantity allowed only for lineItem
1803
+ if (params.dataType !== 'LINEITEM') {
1804
+ return rootLineItem;
1805
+ }
1806
+ var lineItem = findLineItem(params.id, [rootLineItem]);
1807
+ if (!lineItem) {
1808
+ return rootLineItem;
1809
+ }
1810
+ if (lineItem.id !== rootLineItem.id) {
1811
+ throw new Error('Quantity can be changed only for root product');
1812
+ }
1813
+ var updated = new LineItemWorker(rootLineItem).replace(Object.assign(Object.assign({}, lineItem), { qty: params.newValue }));
1814
+ return updated.li;
1815
+ };
1816
+ FlowUpdateService.prototype.updateStartDate = function (rootLineItem, params) {
1817
+ var lineItem = findLineItem(params.id, [rootLineItem]);
1818
+ if (!lineItem) {
1819
+ return rootLineItem;
1820
+ }
1821
+ var updated = new LineItemWorker(rootLineItem).replace(Object.assign(Object.assign({}, lineItem), { effectiveDate: moment__default["default"](params.newValue).format('YYYY-MM-DD') }));
1822
+ return updated.li;
1823
+ };
1824
+ FlowUpdateService.prototype.updateEndDate = function (rootLineItem, params) {
1825
+ var lineItem = findLineItem(params.id, [rootLineItem]);
1826
+ if (!lineItem) {
1827
+ return rootLineItem;
1828
+ }
1829
+ var updated = new LineItemWorker(rootLineItem).replace(Object.assign(Object.assign({}, lineItem), { endDate: moment__default["default"](params.newValue).format('YYYY-MM-DD') }));
1830
+ return updated.li;
1831
+ };
1832
+ FlowUpdateService.prototype.updatePriceAdjustment = function (rootLineItem, params) {
1833
+ var comparator = params.dataType === 'LINEITEM'
1834
+ ? function (li) { return li.id === params.id; }
1835
+ : params.dataType === 'CHARGE'
1836
+ ? function (li) { return li.chargeItems.some(function (_a) {
1837
+ var id = _a.id;
1838
+ return id === params.id;
1839
+ }); }
1840
+ : params.dataType === 'GROUP_CHARGE'
1841
+ ? function (li) { return li.chargeGroupItems.some(function (_a) {
1842
+ var id = _a.id;
1843
+ return id === params.id;
1844
+ }); }
1845
+ : undefined;
1846
+ if (!comparator) {
1847
+ return rootLineItem;
1848
+ }
1849
+ var lineItem = findLineItemWithComparator([rootLineItem], comparator);
1850
+ if (!lineItem) {
1851
+ return rootLineItem;
1852
+ }
1853
+ var updated;
1854
+ if (params.dataType === 'LINEITEM') {
1855
+ updated = Object.assign(Object.assign({}, lineItem), { chargeItems: lineItem.chargeItems.map(function (chargeItem, index) {
1856
+ return index === 0 ? Object.assign(Object.assign({}, chargeItem), { priceAdjustment: params.newValue }) : chargeItem;
1857
+ }) });
1858
+ }
1859
+ else if (params.dataType === 'CHARGE') {
1860
+ updated = Object.assign(Object.assign({}, lineItem), { chargeItems: lineItem.chargeItems.map(function (chargeItem) {
1861
+ return chargeItem.id === params.id ? Object.assign(Object.assign({}, chargeItem), { priceAdjustment: params.newValue }) : chargeItem;
1862
+ }) });
1863
+ }
1864
+ else if (params.dataType === 'GROUP_CHARGE') {
1865
+ updated = Object.assign(Object.assign({}, lineItem), { chargeGroupItems: lineItem.chargeGroupItems.map(function (chargeGroupItem) {
1866
+ return chargeGroupItem.id === params.id
1867
+ ? Object.assign(Object.assign({}, chargeGroupItem), { priceAdjustment: params.newValue }) : chargeGroupItem;
1868
+ }) });
1869
+ }
1870
+ var updatedRootLineItem = updated ? new LineItemWorker(rootLineItem).replace(updated).li : rootLineItem;
1871
+ return updatedRootLineItem;
1872
+ };
1873
+ return FlowUpdateService;
1874
+ }());
1875
+ FlowUpdateService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowUpdateService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1876
+ FlowUpdateService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowUpdateService });
1877
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowUpdateService, decorators: [{
1878
+ type: i0.Injectable
1879
+ }] });
1880
+
1767
1881
  var FlowConfigurationService = /** @class */ (function () {
1768
- function FlowConfigurationService(priceApiService, contextService, messageService) {
1882
+ function FlowConfigurationService(priceApiService, contextService, messageService, updateService) {
1769
1883
  this.priceApiService = priceApiService;
1770
1884
  this.contextService = contextService;
1771
1885
  this.messageService = messageService;
1886
+ this.updateService = updateService;
1772
1887
  this.lineItems = new rxjs.BehaviorSubject([]);
1773
1888
  this.charges = new rxjs.BehaviorSubject({});
1774
1889
  }
1890
+ FlowConfigurationService.prototype.reset = function () {
1891
+ this.lineItems.next([]);
1892
+ this.charges.next({});
1893
+ };
1775
1894
  FlowConfigurationService.prototype.calculate$ = function (currentState) {
1776
1895
  var _this = this;
1777
1896
  var context = this.contextService.resolve();
@@ -1781,17 +1900,25 @@
1781
1900
  if (context) {
1782
1901
  _this.contextService.update({ properties: context.properties });
1783
1902
  }
1784
- }), rxjs.catchError(function (error) {
1785
- console.error(error);
1786
- _this.messageService.add({ severity: 'error', summary: error });
1787
- // bounce back if configuration call has failed
1788
- _this.lineItems.next(_this.lineItems.value.slice());
1789
- return rxjs.throwError(function () { return error; });
1790
- }));
1903
+ }), rxjs.catchError(function (error) { return _this.handleError(error); }));
1791
1904
  };
1792
1905
  FlowConfigurationService.prototype.calculate = function (currentState) {
1793
1906
  this.calculate$(currentState).subscribe();
1794
1907
  };
1908
+ FlowConfigurationService.prototype.update$ = function (params) {
1909
+ var _this = this;
1910
+ return rxjs.of([]).pipe(rxjs.map(function () { return _this.lineItems.value.map(function (li) { return _this.updateService.update(li, params); }); }), rxjs.catchError(function (error) { return _this.handleError(error); }), rxjs.switchMap(function (currentState) { return _this.calculate$(currentState); }));
1911
+ };
1912
+ FlowConfigurationService.prototype.update = function (params) {
1913
+ this.update$(params).subscribe();
1914
+ };
1915
+ FlowConfigurationService.prototype.delete$ = function (id) {
1916
+ var _this = this;
1917
+ return rxjs.of([]).pipe(rxjs.map(function () { return _this.updateService.delete(_this.lineItems.value, id); }), rxjs.catchError(function (error) { return _this.handleError(error); }), rxjs.switchMap(function (currentState) { return _this.calculate$(currentState); }));
1918
+ };
1919
+ FlowConfigurationService.prototype.delete = function (id) {
1920
+ this.delete$(id).subscribe();
1921
+ };
1795
1922
  FlowConfigurationService.prototype.get = function () {
1796
1923
  return this.lineItems.asObservable().pipe(rxjs.shareReplay());
1797
1924
  };
@@ -1826,13 +1953,20 @@
1826
1953
  enumerable: false,
1827
1954
  configurable: true
1828
1955
  });
1956
+ FlowConfigurationService.prototype.handleError = function (error) {
1957
+ console.error(error);
1958
+ this.messageService.add({ severity: 'error', summary: error });
1959
+ // bounce back if configuration call has failed
1960
+ this.lineItems.next(this.lineItems.value.slice());
1961
+ return rxjs.throwError(function () { return error; });
1962
+ };
1829
1963
  return FlowConfigurationService;
1830
1964
  }());
1831
- FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, deps: [{ token: i1__namespace.PriceApiService }, { token: i2__namespace.ContextService }, { token: i3__namespace.MessageService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1965
+ FlowConfigurationService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, deps: [{ token: i1__namespace.PriceApiService }, { token: i2__namespace.ContextService }, { token: i3__namespace.MessageService }, { token: FlowUpdateService }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
1832
1966
  FlowConfigurationService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService });
1833
1967
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationService, decorators: [{
1834
1968
  type: i0.Injectable
1835
- }], ctorParameters: function () { return [{ type: i1__namespace.PriceApiService }, { type: i2__namespace.ContextService }, { type: i3__namespace.MessageService }]; } });
1969
+ }], ctorParameters: function () { return [{ type: i1__namespace.PriceApiService }, { type: i2__namespace.ContextService }, { type: i3__namespace.MessageService }, { type: FlowUpdateService }]; } });
1836
1970
 
1837
1971
  var FlowConfigurationModule = /** @class */ (function () {
1838
1972
  function FlowConfigurationModule() {
@@ -1841,11 +1975,11 @@
1841
1975
  }());
1842
1976
  FlowConfigurationModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1843
1977
  FlowConfigurationModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule });
1844
- FlowConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule, providers: [FlowConfigurationService, i2.ContextService, i1.PriceApiService] });
1978
+ FlowConfigurationModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule, providers: [FlowConfigurationService, FlowUpdateService, i2.ContextService, i1.PriceApiService] });
1845
1979
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.15", ngImport: i0__namespace, type: FlowConfigurationModule, decorators: [{
1846
1980
  type: i0.NgModule,
1847
1981
  args: [{
1848
- providers: [FlowConfigurationService, i2.ContextService, i1.PriceApiService],
1982
+ providers: [FlowConfigurationService, FlowUpdateService, i2.ContextService, i1.PriceApiService],
1849
1983
  }]
1850
1984
  }] });
1851
1985
 
@@ -1855,7 +1989,8 @@
1855
1989
  ConfigurationRuntimeService: ConfigurationRuntimeService,
1856
1990
  ConfigurationService: ConfigurationService,
1857
1991
  FlowConfigurationModule: FlowConfigurationModule,
1858
- FlowConfigurationService: FlowConfigurationService
1992
+ FlowConfigurationService: FlowConfigurationService,
1993
+ FlowUpdateService: FlowUpdateService
1859
1994
  });
1860
1995
 
1861
1996
  var InitAction = { type: 'INIT' };
@@ -1918,6 +2053,7 @@
1918
2053
  isValidScript: isValidScript,
1919
2054
  parseBoundPath: parseBoundPath,
1920
2055
  findLineItem: findLineItem,
2056
+ findLineItemWithComparator: findLineItemWithComparator,
1921
2057
  insertLineItem: insertLineItem,
1922
2058
  removeLineItem: removeLineItem,
1923
2059
  replaceLineItem: replaceLineItem,
@@ -2326,6 +2462,7 @@
2326
2462
  exports.ElementDefinition = ElementDefinition;
2327
2463
  exports.FlowConfigurationModule = FlowConfigurationModule;
2328
2464
  exports.FlowConfigurationService = FlowConfigurationService;
2465
+ exports.FlowUpdateService = FlowUpdateService;
2329
2466
  exports.IntegrationState = IntegrationState;
2330
2467
  exports.LauncherModule = LauncherModule;
2331
2468
  exports.LauncherService = LauncherService;
@@ -2342,6 +2479,7 @@
2342
2479
  exports.extendElementMetadata = extendElementMetadata;
2343
2480
  exports.extractElementMetadata = extractElementMetadata;
2344
2481
  exports.findLineItem = findLineItem;
2482
+ exports.findLineItemWithComparator = findLineItemWithComparator;
2345
2483
  exports.generateLineItem = generateLineItem;
2346
2484
  exports.getAttributeValue = getAttributeValue;
2347
2485
  exports.getAttributes = getAttributes;