ng-easycommerce 0.0.588 → 0.0.589
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/README.md +4 -0
- package/assets/ec-i18n/ct.json +3 -1
- package/assets/ec-i18n/en.json +2 -0
- package/assets/ec-i18n/es.json +3 -1
- package/assets/ec-i18n/fr.json +3 -1
- package/assets/ec-i18n/gl.json +3 -1
- package/assets/ec-i18n/pr.json +3 -1
- package/bundles/ng-easycommerce.umd.js +73 -5
- package/bundles/ng-easycommerce.umd.js.map +1 -1
- package/bundles/ng-easycommerce.umd.min.js +1 -1
- package/bundles/ng-easycommerce.umd.min.js.map +1 -1
- package/esm2015/lib/ec-component/filters-ec/filters-ec.component.js +58 -1
- package/esm2015/lib/services/cart.service.js +15 -5
- package/esm2015/lib/services/products/product-detail.service.js +3 -2
- package/esm5/lib/ec-component/filters-ec/filters-ec.component.js +58 -1
- package/esm5/lib/services/cart.service.js +15 -5
- package/esm5/lib/services/products/product-detail.service.js +3 -2
- package/fesm2015/ng-easycommerce.js +73 -5
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +73 -5
- package/fesm5/ng-easycommerce.js.map +1 -1
- package/lib/ec-component/filters-ec/filters-ec.component.d.ts +11 -0
- package/ng-easycommerce.metadata.json +1 -1
- package/package.json +1 -1
package/fesm5/ng-easycommerce.js
CHANGED
|
@@ -5086,16 +5086,26 @@ var CartService = /** @class */ (function () {
|
|
|
5086
5086
|
};
|
|
5087
5087
|
this.requestInProcess.next(true);
|
|
5088
5088
|
this.connection.post(this.addAllItemsApi(), params)
|
|
5089
|
-
.toPromise()
|
|
5090
|
-
|
|
5091
|
-
|
|
5089
|
+
.toPromise()
|
|
5090
|
+
.then(function (res) {
|
|
5091
|
+
var _a, _b;
|
|
5092
|
+
if (res.status === 'failure') {
|
|
5093
|
+
var errorMessage = ((_a = res.error) === null || _a === void 0 ? void 0 : _a.toLowerCase().replace(/\s+/g, '_')) || 'unknown_error';
|
|
5094
|
+
_this.toastrService.show(errorMessage);
|
|
5095
|
+
return;
|
|
5096
|
+
}
|
|
5097
|
+
if ((_b = res) === null || _b === void 0 ? void 0 : _b.cart) {
|
|
5098
|
+
_this.updateCartObj(res.cart);
|
|
5099
|
+
_this.updateCartItems(_this.transformItems(res.cart.items));
|
|
5100
|
+
}
|
|
5092
5101
|
if (res.cart_response.status === 'success') {
|
|
5093
5102
|
_this.toastrService.show('products-added');
|
|
5094
5103
|
_this.router.navigate(['/cart']);
|
|
5095
5104
|
}
|
|
5096
5105
|
}, function (err) {
|
|
5097
5106
|
_this.handleError(err);
|
|
5098
|
-
})
|
|
5107
|
+
})
|
|
5108
|
+
.catch(function (err) {
|
|
5099
5109
|
_this.handleError(err);
|
|
5100
5110
|
});
|
|
5101
5111
|
};
|
|
@@ -9268,6 +9278,10 @@ var FiltersEcComponent = /** @class */ (function (_super) {
|
|
|
9268
9278
|
// : this.document.getElementById(accordion_id).classList.remove('show');
|
|
9269
9279
|
return true;
|
|
9270
9280
|
};
|
|
9281
|
+
_this.scrollUp = function () {
|
|
9282
|
+
window.scroll(0, 0);
|
|
9283
|
+
return true;
|
|
9284
|
+
};
|
|
9271
9285
|
_this.ecOnConstruct();
|
|
9272
9286
|
return _this;
|
|
9273
9287
|
}
|
|
@@ -9309,6 +9323,59 @@ var FiltersEcComponent = /** @class */ (function (_super) {
|
|
|
9309
9323
|
});
|
|
9310
9324
|
});
|
|
9311
9325
|
};
|
|
9326
|
+
/**
|
|
9327
|
+
* Redondea al múltiplo de 'step' respetando el redondeo entero:
|
|
9328
|
+
* - Mínimo: redondea hacia abajo.
|
|
9329
|
+
* - Máximo: redondea hacia arriba.
|
|
9330
|
+
*/
|
|
9331
|
+
FiltersEcComponent.prototype.roundToNearest = function (value, step, type, filter) {
|
|
9332
|
+
var rounded = Math.round(value / step) * step;
|
|
9333
|
+
if (type === 'max' && rounded < filter.maxPrice) {
|
|
9334
|
+
rounded = Math.ceil(value / step) * step;
|
|
9335
|
+
}
|
|
9336
|
+
if (type === 'min' && rounded > filter.minPrice) {
|
|
9337
|
+
rounded = Math.floor(value / step) * step;
|
|
9338
|
+
}
|
|
9339
|
+
return rounded;
|
|
9340
|
+
};
|
|
9341
|
+
/**
|
|
9342
|
+
* Actualiza los valores del filtro permitiendo que un input empuje al otro.
|
|
9343
|
+
*/
|
|
9344
|
+
FiltersEcComponent.prototype.updateFilterPrices = function (type, value, filter, priceGap) {
|
|
9345
|
+
var _a, _b, _c;
|
|
9346
|
+
var globalMin = (_a = filter.minPrice, (_a !== null && _a !== void 0 ? _a : 0));
|
|
9347
|
+
var globalMax = filter.maxPrice;
|
|
9348
|
+
var currentMin = (_b = filter.currentMinPrice, (_b !== null && _b !== void 0 ? _b : globalMin));
|
|
9349
|
+
var currentMax = (_c = filter.currentMaxPrice, (_c !== null && _c !== void 0 ? _c : globalMax));
|
|
9350
|
+
if (type === 'min') {
|
|
9351
|
+
var newMin = Math.min(Math.max(value, globalMin), globalMax);
|
|
9352
|
+
if (newMin + priceGap > currentMax) {
|
|
9353
|
+
var newMaxCandidate = newMin + priceGap;
|
|
9354
|
+
if (newMaxCandidate <= globalMax) {
|
|
9355
|
+
currentMax = newMaxCandidate;
|
|
9356
|
+
}
|
|
9357
|
+
else {
|
|
9358
|
+
newMin = globalMax - priceGap;
|
|
9359
|
+
}
|
|
9360
|
+
}
|
|
9361
|
+
filter.currentMinPrice = newMin;
|
|
9362
|
+
filter.currentMaxPrice = currentMax;
|
|
9363
|
+
}
|
|
9364
|
+
else if (type === 'max') {
|
|
9365
|
+
var newMax = Math.max(Math.min(value, globalMax), globalMin);
|
|
9366
|
+
if (newMax - priceGap < currentMin) {
|
|
9367
|
+
var newMinCandidate = newMax - priceGap;
|
|
9368
|
+
if (newMinCandidate >= globalMin) {
|
|
9369
|
+
currentMin = newMinCandidate;
|
|
9370
|
+
}
|
|
9371
|
+
else {
|
|
9372
|
+
newMax = globalMin + priceGap;
|
|
9373
|
+
}
|
|
9374
|
+
}
|
|
9375
|
+
filter.currentMaxPrice = newMax;
|
|
9376
|
+
filter.currentMinPrice = currentMin;
|
|
9377
|
+
}
|
|
9378
|
+
};
|
|
9312
9379
|
FiltersEcComponent.ctorParameters = function () { return [
|
|
9313
9380
|
{ type: Constants },
|
|
9314
9381
|
{ type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
@@ -10535,7 +10602,8 @@ var ProductDetailService = /** @class */ (function () {
|
|
|
10535
10602
|
return;
|
|
10536
10603
|
if (!this.validateQuantity(quantity))
|
|
10537
10604
|
return;
|
|
10538
|
-
|
|
10605
|
+
var priceToValidate = product_selected.saleprice ? product_selected.saleprice * quantity : product_selected.price * quantity;
|
|
10606
|
+
if (!this.validatePriceAndCredits(priceToValidate))
|
|
10539
10607
|
return;
|
|
10540
10608
|
this.cartService.addToCart(this.makeAffordableProduct(product_selected), quantity, variant.code);
|
|
10541
10609
|
};
|