@veloceapps/sdk 3.0.11 → 3.0.12
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/veloce-sdk-cms.umd.js +31 -19
- package/bundles/veloce-sdk-cms.umd.js.map +1 -1
- package/bundles/veloce-sdk.umd.js +63 -27
- package/bundles/veloce-sdk.umd.js.map +1 -1
- package/cms/modules/flow-configuration/services/flow-configuration.service.d.ts +2 -4
- package/esm2015/cms/modules/flow-configuration/services/flow-configuration.service.js +17 -19
- package/esm2015/cms/modules/flow-configuration/services/flow-update.service.js +15 -2
- package/esm2015/src/components/header/cart-overlay/cart-overlay.component.js +31 -26
- package/esm2015/src/components/header/header.component.js +34 -3
- package/esm2015/src/components/header/header.types.js +1 -1
- package/fesm2015/veloce-sdk-cms.js +31 -20
- package/fesm2015/veloce-sdk-cms.js.map +1 -1
- package/fesm2015/veloce-sdk.js +63 -27
- package/fesm2015/veloce-sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/components/header/cart-overlay/cart-overlay.component.d.ts +11 -9
- package/src/components/header/header.component.d.ts +3 -2
- package/src/components/header/header.types.d.ts +9 -0
|
@@ -1809,7 +1809,20 @@
|
|
|
1809
1809
|
}
|
|
1810
1810
|
};
|
|
1811
1811
|
FlowUpdateService.prototype.delete = function (lineItems, id) {
|
|
1812
|
-
var
|
|
1812
|
+
var idsToRemove = [id];
|
|
1813
|
+
var topLevelLineItem = lineItems.find(function (li) { return li.id === id; });
|
|
1814
|
+
if (topLevelLineItem) {
|
|
1815
|
+
// find term-related line items (which are only top level)
|
|
1816
|
+
// expired term line items won't be deleted
|
|
1817
|
+
var foundTermLineItem_1 = topLevelLineItem;
|
|
1818
|
+
while (foundTermLineItem_1) {
|
|
1819
|
+
foundTermLineItem_1 = lineItems.find(function (li) { return foundTermLineItem_1 && li.rampInstanceId === foundTermLineItem_1.id; });
|
|
1820
|
+
if (foundTermLineItem_1) {
|
|
1821
|
+
idsToRemove.push(foundTermLineItem_1.id);
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
var filtered = lineItems.filter(function (lineItem) { return !idsToRemove.includes(lineItem.id); });
|
|
1813
1826
|
return filtered.map(function (lineItem) { return new LineItemWorker(lineItem).remove(id).li; });
|
|
1814
1827
|
};
|
|
1815
1828
|
FlowUpdateService.prototype.updateQty = function (rootLineItem, params) {
|
|
@@ -1914,30 +1927,24 @@
|
|
|
1914
1927
|
if (context) {
|
|
1915
1928
|
_this.contextService.update({ properties: context.properties });
|
|
1916
1929
|
}
|
|
1917
|
-
}),
|
|
1930
|
+
}), this.handleError());
|
|
1918
1931
|
};
|
|
1919
1932
|
FlowConfigurationService.prototype.calculate = function (currentState) {
|
|
1920
1933
|
this.calculate$(currentState).subscribe();
|
|
1921
1934
|
};
|
|
1922
1935
|
FlowConfigurationService.prototype.update$ = function (params) {
|
|
1923
1936
|
var _this = this;
|
|
1924
|
-
return rxjs.of([]).pipe(rxjs.map(function () { return _this.lineItems.value.map(function (li) { return _this.updateService.update(li, params); }); }),
|
|
1937
|
+
return rxjs.of([]).pipe(rxjs.map(function () { return _this.lineItems.value.map(function (li) { return _this.updateService.update(li, params); }); }), this.handleError(), rxjs.switchMap(function (currentState) { return _this.calculate$(currentState); }));
|
|
1925
1938
|
};
|
|
1926
1939
|
FlowConfigurationService.prototype.update = function (params) {
|
|
1927
1940
|
this.update$(params).subscribe();
|
|
1928
1941
|
};
|
|
1929
|
-
FlowConfigurationService.prototype.delete$ = function (
|
|
1942
|
+
FlowConfigurationService.prototype.delete$ = function (ids) {
|
|
1930
1943
|
var _this = this;
|
|
1931
|
-
return rxjs.of([]).pipe(rxjs.map(function () { return _this.updateService.delete(
|
|
1932
|
-
};
|
|
1933
|
-
FlowConfigurationService.prototype.deleteAll$ = function () {
|
|
1934
|
-
return this.calculate$([]);
|
|
1944
|
+
return rxjs.of([]).pipe(rxjs.map(function () { return ids.reduce(function (result, id) { return _this.updateService.delete(result, id); }, _this.lineItems.value); }), this.handleError(), rxjs.switchMap(function (currentState) { return _this.calculate$(currentState); }));
|
|
1935
1945
|
};
|
|
1936
|
-
FlowConfigurationService.prototype.delete = function (
|
|
1937
|
-
this.delete$(
|
|
1938
|
-
};
|
|
1939
|
-
FlowConfigurationService.prototype.deleteAll = function () {
|
|
1940
|
-
this.deleteAll$().subscribe();
|
|
1946
|
+
FlowConfigurationService.prototype.delete = function (ids) {
|
|
1947
|
+
this.delete$(ids).subscribe();
|
|
1941
1948
|
};
|
|
1942
1949
|
FlowConfigurationService.prototype.get = function () {
|
|
1943
1950
|
return this.lineItems.asObservable().pipe(rxjs.shareReplay());
|
|
@@ -1973,12 +1980,17 @@
|
|
|
1973
1980
|
enumerable: false,
|
|
1974
1981
|
configurable: true
|
|
1975
1982
|
});
|
|
1976
|
-
FlowConfigurationService.prototype.handleError = function (
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1983
|
+
FlowConfigurationService.prototype.handleError = function () {
|
|
1984
|
+
var _this = this;
|
|
1985
|
+
return function (source$) {
|
|
1986
|
+
return source$.pipe(rxjs.catchError(function (error) {
|
|
1987
|
+
console.error(error);
|
|
1988
|
+
_this.messageService.add({ severity: 'error', summary: error });
|
|
1989
|
+
// bounce back if configuration call has failed
|
|
1990
|
+
_this.lineItems.next(_this.lineItems.value.slice());
|
|
1991
|
+
return rxjs.throwError(function () { return error; });
|
|
1992
|
+
}));
|
|
1993
|
+
};
|
|
1982
1994
|
};
|
|
1983
1995
|
return FlowConfigurationService;
|
|
1984
1996
|
}());
|