@veloceapps/sdk 6.0.0-106 → 6.0.0-108
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.
- package/bundles/veloceapps-sdk-core.umd.js +29 -14
- package/bundles/veloceapps-sdk-core.umd.js.map +1 -1
- package/cms/vendor-map.d.ts +2 -2
- package/core/modules/configuration/services/configuration.service.d.ts +3 -3
- package/core/utils/line-item.utils.d.ts +2 -2
- package/core/utils/line-item.worker.d.ts +2 -2
- package/esm2015/core/modules/configuration/services/configuration.service.js +6 -5
- package/esm2015/core/utils/line-item.utils.js +14 -7
- package/esm2015/core/utils/line-item.worker.js +5 -5
- package/fesm2015/veloceapps-sdk-core.js +22 -14
- package/fesm2015/veloceapps-sdk-core.js.map +1 -1
- package/package.json +1 -1
@@ -673,15 +673,26 @@
|
|
673
673
|
})
|
674
674
|
.filter(function (r) { return !!r; }) });
|
675
675
|
};
|
676
|
-
var replaceLineItem = function (lineItem, replaceTo) {
|
676
|
+
var replaceLineItem = function (lineItem, replaceTo, skipCardinalityCalculation) {
|
677
|
+
if (skipCardinalityCalculation === void 0) { skipCardinalityCalculation = false; }
|
677
678
|
if (lineItem.id === replaceTo.id) {
|
678
|
-
|
679
|
+
if (!skipCardinalityCalculation) {
|
680
|
+
return Object.assign({}, recalculateCardinalityVariables(lineItem, replaceTo));
|
681
|
+
}
|
682
|
+
else {
|
683
|
+
return Object.assign({}, replaceTo);
|
684
|
+
}
|
679
685
|
}
|
680
|
-
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(function (li) { return replaceLineItem(li, replaceTo); }) });
|
686
|
+
return Object.assign(Object.assign({}, lineItem), { lineItems: lineItem.lineItems.map(function (li) { return replaceLineItem(li, replaceTo, skipCardinalityCalculation); }) });
|
681
687
|
};
|
682
688
|
var calculateCardinalityVariables = function (lineItems) {
|
683
689
|
var cardVars = new Map();
|
684
|
-
lineItems
|
690
|
+
lineItems
|
691
|
+
.filter(function (_c) {
|
692
|
+
var port = _c.port, type = _c.type;
|
693
|
+
return !!port && !!type;
|
694
|
+
})
|
695
|
+
.forEach(function (li) {
|
685
696
|
var _a;
|
686
697
|
var cardinalityVariableName = "#CV-" + li.type + "@" + li.port;
|
687
698
|
cardVars.set(cardinalityVariableName, ((_a = cardVars.get(cardinalityVariableName)) !== null && _a !== void 0 ? _a : 0) + li.qty);
|
@@ -733,13 +744,14 @@
|
|
733
744
|
]);
|
734
745
|
}, originalAttributes);
|
735
746
|
};
|
736
|
-
var patchAttributes = function (rootLineItem, id, attrs) {
|
747
|
+
var patchAttributes = function (rootLineItem, id, attrs, skipCardinalityCalculation) {
|
748
|
+
if (skipCardinalityCalculation === void 0) { skipCardinalityCalculation = false; }
|
737
749
|
var lineItem = findLineItem(id, [rootLineItem]);
|
738
750
|
if (!lineItem) {
|
739
751
|
return rootLineItem;
|
740
752
|
}
|
741
753
|
var attributes = upsertAttributes(lineItem.attributes, attrs);
|
742
|
-
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes: attributes }));
|
754
|
+
return replaceLineItem(rootLineItem, Object.assign(Object.assign({}, lineItem), { attributes: attributes }), skipCardinalityCalculation);
|
743
755
|
};
|
744
756
|
var getAttributeValue = function (attributes, name) { var _a; return (_a = attributes.find(function (attr) { return attr.name === name; })) === null || _a === void 0 ? void 0 : _a.value; };
|
745
757
|
var generateLineItem = function (port, type, parentId, attributes, lineItems) {
|
@@ -833,11 +845,13 @@
|
|
833
845
|
LineItemWorker.prototype.remove = function (id) {
|
834
846
|
return new LineItemWorker(removeLineItem(this.li, id));
|
835
847
|
};
|
836
|
-
LineItemWorker.prototype.replace = function (toReplace) {
|
837
|
-
|
848
|
+
LineItemWorker.prototype.replace = function (toReplace, skipCardinalityCalculation) {
|
849
|
+
if (skipCardinalityCalculation === void 0) { skipCardinalityCalculation = false; }
|
850
|
+
return new LineItemWorker(replaceLineItem(this.li, toReplace, skipCardinalityCalculation));
|
838
851
|
};
|
839
|
-
LineItemWorker.prototype.patchAttribute = function (attrs, id) {
|
840
|
-
|
852
|
+
LineItemWorker.prototype.patchAttribute = function (attrs, id, skipCardinalityCalculation) {
|
853
|
+
if (skipCardinalityCalculation === void 0) { skipCardinalityCalculation = false; }
|
854
|
+
return new LineItemWorker(patchAttributes(this.li, id !== null && id !== void 0 ? id : this.li.id, attrs, skipCardinalityCalculation));
|
841
855
|
};
|
842
856
|
return LineItemWorker;
|
843
857
|
}());
|
@@ -1146,12 +1160,13 @@
|
|
1146
1160
|
this.charges.next({});
|
1147
1161
|
this.pricePlans.next({});
|
1148
1162
|
};
|
1149
|
-
ConfigurationService.prototype.patch$ = function (lineItem) {
|
1163
|
+
ConfigurationService.prototype.patch$ = function (lineItem, options) {
|
1150
1164
|
var _this = this;
|
1151
1165
|
if (!this.lineItem.value) {
|
1152
1166
|
return rxjs.throwError(function () { return new Error("Source LineItem not found"); });
|
1153
1167
|
}
|
1154
|
-
|
1168
|
+
var skipCardinalityCalculation = (options === null || options === void 0 ? void 0 : options.skipCardinalityCalculation) || this.contextSnapshot.properties['#skipCardinalityCalculation'] === 'true';
|
1169
|
+
this.configurableRamp = new LineItemWorker(this.lineItem.value).replace(lineItem, skipCardinalityCalculation).li;
|
1155
1170
|
return this.configure().pipe(operators.catchError(function (error) {
|
1156
1171
|
console.error(error);
|
1157
1172
|
if (!_this.runtimeService.uiDefinitionProperties.suppressToastMessages) {
|
@@ -1166,8 +1181,8 @@
|
|
1166
1181
|
}
|
1167
1182
|
}));
|
1168
1183
|
};
|
1169
|
-
ConfigurationService.prototype.patch = function (lineItem) {
|
1170
|
-
this.patch$(lineItem).subscribe();
|
1184
|
+
ConfigurationService.prototype.patch = function (lineItem, options) {
|
1185
|
+
this.patch$(lineItem, options).subscribe();
|
1171
1186
|
};
|
1172
1187
|
ConfigurationService.prototype.setConfigurableRamp = function (lineItem) {
|
1173
1188
|
this.configurableRamp = lineItem;
|