@veloceapps/sdk 6.0.0-77 → 6.0.0-79
Sign up to get free protection for your applications and to get access to all the features.
- package/bundles/veloceapps-sdk-core.umd.js +8 -8
- package/bundles/veloceapps-sdk-core.umd.js.map +1 -1
- package/core/modules/flow-configuration/services/flow-update.service.d.ts +3 -2
- package/esm2015/core/modules/flow-configuration/services/flow-configuration.service.js +2 -2
- package/esm2015/core/modules/flow-configuration/services/flow-update.service.js +6 -6
- package/fesm2015/veloceapps-sdk-core.js +6 -6
- package/fesm2015/veloceapps-sdk-core.js.map +1 -1
- package/package.json +1 -1
@@ -1301,7 +1301,7 @@
|
|
1301
1301
|
var FlowUpdateService = /** @class */ (function () {
|
1302
1302
|
function FlowUpdateService() {
|
1303
1303
|
}
|
1304
|
-
FlowUpdateService.prototype.update = function (rootLineItems, updates) {
|
1304
|
+
FlowUpdateService.prototype.update = function (rootLineItems, updates, charges) {
|
1305
1305
|
var _this = this;
|
1306
1306
|
var remainingUpdates = __spreadArray([], __read(updates));
|
1307
1307
|
var currentLevel = rootLineItems;
|
@@ -1312,7 +1312,7 @@
|
|
1312
1312
|
var updated = false;
|
1313
1313
|
switch (update.dataType) {
|
1314
1314
|
case 'LINEITEM':
|
1315
|
-
updated = _this.applyLineItemUpdate(li, update);
|
1315
|
+
updated = _this.applyLineItemUpdate(li, update, charges);
|
1316
1316
|
break;
|
1317
1317
|
case 'CHARGE':
|
1318
1318
|
updated = _this.applyChargeUpdate(li, update);
|
@@ -1350,7 +1350,7 @@
|
|
1350
1350
|
var filtered = lineItems.filter(function (lineItem) { return !idsToRemove.includes(lineItem.id); });
|
1351
1351
|
return filtered.map(function (lineItem) { return new LineItemWorker(lineItem).remove(id).li; });
|
1352
1352
|
};
|
1353
|
-
FlowUpdateService.prototype.applyLineItemUpdate = function (lineItem, update) {
|
1353
|
+
FlowUpdateService.prototype.applyLineItemUpdate = function (lineItem, update, charges) {
|
1354
1354
|
if (lineItem.id !== update.id) {
|
1355
1355
|
return false;
|
1356
1356
|
}
|
@@ -1366,7 +1366,7 @@
|
|
1366
1366
|
break;
|
1367
1367
|
case 'PRICE_ADJUSTMENT':
|
1368
1368
|
{
|
1369
|
-
var
|
1369
|
+
var charge = lineItem.chargeItems.find(function (charge) { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
1370
1370
|
if (charge) {
|
1371
1371
|
charge.priceAdjustment = update.newValue;
|
1372
1372
|
}
|
@@ -1374,7 +1374,7 @@
|
|
1374
1374
|
break;
|
1375
1375
|
case 'LIST_PRICE_ADJUSTMENT':
|
1376
1376
|
{
|
1377
|
-
var
|
1377
|
+
var charge = lineItem.chargeItems.find(function (charge) { var _a; return (_a = (charges || {})[charge.chargeId]) === null || _a === void 0 ? void 0 : _a.main; });
|
1378
1378
|
if (charge) {
|
1379
1379
|
charge.listPriceAdjustment = update.newValue;
|
1380
1380
|
}
|
@@ -1386,8 +1386,8 @@
|
|
1386
1386
|
return true;
|
1387
1387
|
};
|
1388
1388
|
FlowUpdateService.prototype.applyChargeUpdate = function (lineItem, update) {
|
1389
|
-
var foundCharge = lineItem.chargeItems.find(function (
|
1390
|
-
var id =
|
1389
|
+
var foundCharge = lineItem.chargeItems.find(function (_b) {
|
1390
|
+
var id = _b.id;
|
1391
1391
|
return id === update.id;
|
1392
1392
|
});
|
1393
1393
|
if (!foundCharge) {
|
@@ -1458,7 +1458,7 @@
|
|
1458
1458
|
}
|
1459
1459
|
return rxjs.of([]).pipe(rxjs.map(function () {
|
1460
1460
|
var updatedState = lodash.cloneDeep(quoteDraft.currentState);
|
1461
|
-
_this.updateService.update(updatedState, updates);
|
1461
|
+
_this.updateService.update(updatedState, updates, quoteDraft.charges);
|
1462
1462
|
return updatedState;
|
1463
1463
|
}), rxjs.switchMap(function (updatedState) { return _this.calculate$(Object.assign(Object.assign({}, quoteDraft), { currentState: updatedState })); }), rxjs.map(function () { return _this.quoteDraftService.quoteDraft; }), this.handleErrorAndBounceBack());
|
1464
1464
|
};
|