ng-easycommerce 0.0.653 → 0.0.655-beta.1
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 +6 -0
- package/bundles/ng-easycommerce.umd.js +96 -30
- 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/core.consts.js +6 -1
- package/esm2015/lib/ec-component/cart-ec/cart-ec.component.js +5 -4
- package/esm2015/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +10 -4
- package/esm2015/lib/ec-component/product-detail-ec/product-detail-ec.component.js +27 -2
- package/esm2015/lib/ec-component/product-ec/product-ec.component.js +1 -2
- package/esm2015/lib/ec-component/sidebar-ec/sidebar-ec.component.js +5 -4
- package/esm2015/lib/ec-component/widgets-ec/paypal-express-ec/paypal-express-ec.component.js +1 -3
- package/esm2015/lib/services/cart.service.js +27 -12
- package/esm5/lib/core.consts.js +6 -1
- package/esm5/lib/ec-component/cart-ec/cart-ec.component.js +5 -4
- package/esm5/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +10 -4
- package/esm5/lib/ec-component/product-detail-ec/product-detail-ec.component.js +45 -2
- package/esm5/lib/ec-component/product-ec/product-ec.component.js +1 -2
- package/esm5/lib/ec-component/sidebar-ec/sidebar-ec.component.js +5 -4
- package/esm5/lib/ec-component/widgets-ec/paypal-express-ec/paypal-express-ec.component.js +1 -3
- package/esm5/lib/services/cart.service.js +27 -12
- package/fesm2015/ng-easycommerce.js +73 -25
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +97 -31
- package/fesm5/ng-easycommerce.js.map +1 -1
- package/lib/core.consts.d.ts +5 -0
- package/lib/ec-component/product-detail-ec/product-detail-ec.component.d.ts +2 -0
- package/lib/services/cart.service.d.ts +2 -2
- package/ng-easycommerce.metadata.json +1 -1
- package/package.json +1 -1
package/fesm5/ng-easycommerce.js
CHANGED
|
@@ -7,7 +7,7 @@ import { InfiniteScrollModule } from 'ngx-infinite-scroll';
|
|
|
7
7
|
import { ToastrService, ToastrModule } from 'ngx-toastr';
|
|
8
8
|
import { ReplaySubject, of, BehaviorSubject, forkJoin, combineLatest, Observable, throwError } from 'rxjs';
|
|
9
9
|
import 'rxjs/add/operator/map';
|
|
10
|
-
import { take, map, catchError, filter, mapTo, finalize, skipWhile, concatMap } from 'rxjs/operators';
|
|
10
|
+
import { take, map, catchError, filter, mapTo, finalize, startWith, skipWhile, concatMap } from 'rxjs/operators';
|
|
11
11
|
import 'rxjs/add/operator/catch';
|
|
12
12
|
import 'rxjs/add/observable/of';
|
|
13
13
|
import * as moment from 'moment';
|
|
@@ -513,6 +513,11 @@ var Constants = /** @class */ (function () {
|
|
|
513
513
|
* @example ['AR','ES','GB']
|
|
514
514
|
*/
|
|
515
515
|
this.countries = [];
|
|
516
|
+
/**
|
|
517
|
+
* @description contiene un arreglo de string cuyo contenido son los codigos de los paises a excluir.
|
|
518
|
+
* @example ['GB']
|
|
519
|
+
*/
|
|
520
|
+
this.excludedCountries = [];
|
|
516
521
|
/**
|
|
517
522
|
*
|
|
518
523
|
* @param countries debe contener los codigos de los paises que se quiere mostrar
|
|
@@ -4758,12 +4763,22 @@ var CartService = /** @class */ (function () {
|
|
|
4758
4763
|
_this.updateLocalCart();
|
|
4759
4764
|
_this.requestInProcess.next(false);
|
|
4760
4765
|
};
|
|
4761
|
-
this.updateCartItemQuantity = function (variant_id, quantity) {
|
|
4762
|
-
var
|
|
4766
|
+
this.updateCartItemQuantity = function (variant_id, quantity, comments) {
|
|
4767
|
+
var normalizedComments = comments !== undefined ? ((comments !== null && comments !== void 0 ? comments : '')).trim() : undefined;
|
|
4768
|
+
var newItems = _this.items.map(function (it) {
|
|
4769
|
+
if (it.variant_id !== variant_id)
|
|
4770
|
+
return it;
|
|
4771
|
+
var updated = __assign$a(__assign$a({}, it), { quantity: Number(quantity) });
|
|
4772
|
+
if (normalizedComments !== undefined) {
|
|
4773
|
+
updated.comments = normalizedComments;
|
|
4774
|
+
}
|
|
4775
|
+
return updated;
|
|
4776
|
+
});
|
|
4777
|
+
_this.items = newItems;
|
|
4763
4778
|
_this.cartItemsSubject.next(_this.items);
|
|
4764
4779
|
_this.requestInProcess.next(false);
|
|
4765
4780
|
_this.updateLocalCart();
|
|
4766
|
-
_this.toastrService.show('product-updated', { quantity:
|
|
4781
|
+
_this.toastrService.show('product-updated', { quantity: quantity });
|
|
4767
4782
|
};
|
|
4768
4783
|
this.appendToCart = function (cart) {
|
|
4769
4784
|
_this.updateCartObj(cart);
|
|
@@ -4785,11 +4800,11 @@ var CartService = /** @class */ (function () {
|
|
|
4785
4800
|
// this.googleAnalytics.removeFromCart(product);
|
|
4786
4801
|
_this.analyticsService.callEvent('remove_from_cart', __assign$a(__assign$a({}, product), { currency: _this.consts.currency.code }));
|
|
4787
4802
|
};
|
|
4788
|
-
this.addIfAllreadyExists = function (product, variant_id, quantityAdd) {
|
|
4803
|
+
this.addIfAllreadyExists = function (product, variant_id, quantityAdd, comments) {
|
|
4789
4804
|
if (quantityAdd === void 0) { quantityAdd = 1; }
|
|
4790
4805
|
return _this.items.find(function (item, index) {
|
|
4791
4806
|
if (item.product.id == product.id && item.variant_id == variant_id) {
|
|
4792
|
-
_this.updateItemQuantity(item, _this.findItem(product.id).quantity + quantityAdd);
|
|
4807
|
+
_this.updateItemQuantity(item, _this.findItem(product.id).quantity + quantityAdd, comments);
|
|
4793
4808
|
return true;
|
|
4794
4809
|
}
|
|
4795
4810
|
return false;
|
|
@@ -4843,7 +4858,7 @@ var CartService = /** @class */ (function () {
|
|
|
4843
4858
|
return;
|
|
4844
4859
|
}
|
|
4845
4860
|
_this.requestInProcess.next(true);
|
|
4846
|
-
var added = _this.addIfAllreadyExists(product, variant_id, quantity);
|
|
4861
|
+
var added = _this.addIfAllreadyExists(product, variant_id, quantity, comments);
|
|
4847
4862
|
if (!added) {
|
|
4848
4863
|
var payload = {
|
|
4849
4864
|
productCode: product.id,
|
|
@@ -4883,7 +4898,7 @@ var CartService = /** @class */ (function () {
|
|
|
4883
4898
|
!added && _this.connection.post(_this.addItemApi(), { productCode: product.id, quantity: quantity, variantCode: variant_id, id: id || '', order_item_id: order_item_id || '', lot_quantity: lot_quantity || '', unit_price: unit_price || '', unit_total: unit_total || '', ajustement_total: ajustement_total || '', total_lot: total_lot || '', lot_status: lot_status || '', date_request: date_request || '', notes: notes || '', shipping_address_id: shipping_address_id || '', shipping_address_name: shipping_address_name || '', action: action || 'newlot' })
|
|
4884
4899
|
.subscribe(function (res) { return _this.appendToCart(res); }, function (err) { return _this.handleError(err); });
|
|
4885
4900
|
};
|
|
4886
|
-
this.addToCartPromise = function (product, quantity, variant_id) { return __awaiter$5(_this, void 0, void 0, function () {
|
|
4901
|
+
this.addToCartPromise = function (product, quantity, variant_id, comments) { return __awaiter$5(_this, void 0, void 0, function () {
|
|
4887
4902
|
var added, result;
|
|
4888
4903
|
return __generator$5(this, function (_a) {
|
|
4889
4904
|
switch (_a.label) {
|
|
@@ -4893,7 +4908,7 @@ var CartService = /** @class */ (function () {
|
|
|
4893
4908
|
return [2 /*return*/];
|
|
4894
4909
|
}
|
|
4895
4910
|
this.requestInProcess.next(true);
|
|
4896
|
-
added = this.addIfAllreadyExists(product, variant_id, quantity);
|
|
4911
|
+
added = this.addIfAllreadyExists(product, variant_id, quantity, comments);
|
|
4897
4912
|
if (!!added) return [3 /*break*/, 2];
|
|
4898
4913
|
return [4 /*yield*/, (this.connection.post(this.addItemApi(), { productCode: product.id, quantity: quantity, variantCode: variant_id }).toPromise())];
|
|
4899
4914
|
case 1:
|
|
@@ -4939,13 +4954,18 @@ var CartService = /** @class */ (function () {
|
|
|
4939
4954
|
items = items.filter(function (itemParam) { return !_this.items.find(function (item) { return itemParam.variantCode == item.variant_id; }); });
|
|
4940
4955
|
return __spread$3(items, paramsMerge);
|
|
4941
4956
|
};
|
|
4942
|
-
this.updateItemQuantity = function (item, quantity) {
|
|
4957
|
+
this.updateItemQuantity = function (item, quantity, comments) {
|
|
4943
4958
|
if (_this.validateQuantity(item, quantity) && (_this.validatePriceAndCredits(item, quantity))) {
|
|
4944
4959
|
_this.requestInProcess.next(true);
|
|
4960
|
+
var payload = { quantity: Number(quantity) };
|
|
4961
|
+
if (comments !== undefined) {
|
|
4962
|
+
var cleaned = ((comments !== null && comments !== void 0 ? comments : '')).trim();
|
|
4963
|
+
payload.comments = cleaned;
|
|
4964
|
+
}
|
|
4945
4965
|
_this.connection
|
|
4946
|
-
.put(_this.updateItemQuantityApi(_this.findItemByIdVariant(item.variant_id)),
|
|
4966
|
+
.put(_this.updateItemQuantityApi(_this.findItemByIdVariant(item.variant_id)), payload)
|
|
4947
4967
|
.pipe(finalize(function () { return _this.requestInProcess.next(false); }))
|
|
4948
|
-
.subscribe(function (res) { return _this.updateCartObj(res) && _this.updateCartItemQuantity(item.variant_id, Number(quantity)); }, function (err) { return _this.handleError(err); });
|
|
4968
|
+
.subscribe(function (res) { return _this.updateCartObj(res) && _this.updateCartItemQuantity(item.variant_id, Number(quantity), comments); }, function (err) { return _this.handleError(err); });
|
|
4949
4969
|
}
|
|
4950
4970
|
};
|
|
4951
4971
|
this.validateQuantity = function (item, quantity) {
|
|
@@ -7592,7 +7612,7 @@ var CartEcComponent = /** @class */ (function (_super) {
|
|
|
7592
7612
|
};
|
|
7593
7613
|
CartEcComponent.prototype.actualizarCantidad = function (item, cantidad, stock, id) {
|
|
7594
7614
|
var _this = this;
|
|
7595
|
-
var _a;
|
|
7615
|
+
var _a, _b, _c;
|
|
7596
7616
|
if (this.cartLoading) {
|
|
7597
7617
|
return;
|
|
7598
7618
|
}
|
|
@@ -7612,10 +7632,11 @@ var CartEcComponent = /** @class */ (function (_super) {
|
|
|
7612
7632
|
newQuantity = Math.round(newQuantity / step) * step;
|
|
7613
7633
|
}
|
|
7614
7634
|
}
|
|
7635
|
+
var keepSameComment = (_c = (_b = item) === null || _b === void 0 ? void 0 : _b.comments, (_c !== null && _c !== void 0 ? _c : undefined));
|
|
7615
7636
|
if (id) {
|
|
7616
7637
|
this.isDisabled = true; // Actualiza la propiedad vinculada a `[disabled]`
|
|
7617
7638
|
if (newQuantity > 0 && newQuantity <= stock) {
|
|
7618
|
-
this.cartService.updateItemQuantity(item, newQuantity);
|
|
7639
|
+
this.cartService.updateItemQuantity(item, newQuantity, keepSameComment);
|
|
7619
7640
|
}
|
|
7620
7641
|
else {
|
|
7621
7642
|
this.toastrService.show('out-of-stock-actually');
|
|
@@ -7626,7 +7647,7 @@ var CartEcComponent = /** @class */ (function (_super) {
|
|
|
7626
7647
|
}
|
|
7627
7648
|
else {
|
|
7628
7649
|
if (newQuantity > 0 && newQuantity <= stock) {
|
|
7629
|
-
this.cartService.updateItemQuantity(item, newQuantity);
|
|
7650
|
+
this.cartService.updateItemQuantity(item, newQuantity, keepSameComment);
|
|
7630
7651
|
}
|
|
7631
7652
|
else {
|
|
7632
7653
|
this.toastrService.show('out-of-stock-actually');
|
|
@@ -8191,18 +8212,24 @@ var DataFormEcComponent = /** @class */ (function (_super) {
|
|
|
8191
8212
|
* @returns un arreglo de countries.
|
|
8192
8213
|
*/
|
|
8193
8214
|
_this.filterCountryByCode = function (countries) {
|
|
8215
|
+
// 1. Si hay países EXCLUIDOS, quítalos siempre
|
|
8216
|
+
var filtered = countries;
|
|
8217
|
+
if (_this.consts.excludedCountries && _this.consts.excludedCountries.length > 0) {
|
|
8218
|
+
filtered = filtered.filter(function (elem) { return !_this.consts.excludedCountries.includes(elem.code); });
|
|
8219
|
+
}
|
|
8220
|
+
// 2. Si hay países INCLUIDOS, aplica el filtro de inclusión
|
|
8194
8221
|
if (_this.consts.getCountries().length > 0) {
|
|
8195
|
-
var countriesFiltered =
|
|
8222
|
+
var countriesFiltered = filtered.filter(function (elem) { return _this.consts.getCountries().includes(elem.code); });
|
|
8196
8223
|
if (countriesFiltered.length > 0) {
|
|
8197
8224
|
return countriesFiltered;
|
|
8198
8225
|
}
|
|
8199
8226
|
else {
|
|
8200
8227
|
console.error('El/los codigo/s ingresado/s no coinciden con los provistos desde el backend');
|
|
8201
|
-
return
|
|
8228
|
+
return filtered;
|
|
8202
8229
|
}
|
|
8203
8230
|
}
|
|
8204
8231
|
else {
|
|
8205
|
-
return
|
|
8232
|
+
return filtered;
|
|
8206
8233
|
}
|
|
8207
8234
|
};
|
|
8208
8235
|
_this.showFormFacturacion = function () {
|
|
@@ -11195,6 +11222,22 @@ var __decorate$14 = (this && this.__decorate) || function (decorators, target, k
|
|
|
11195
11222
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11196
11223
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11197
11224
|
};
|
|
11225
|
+
var __read$7 = (this && this.__read) || function (o, n) {
|
|
11226
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
11227
|
+
if (!m) return o;
|
|
11228
|
+
var i = m.call(o), r, ar = [], e;
|
|
11229
|
+
try {
|
|
11230
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
11231
|
+
}
|
|
11232
|
+
catch (error) { e = { error: error }; }
|
|
11233
|
+
finally {
|
|
11234
|
+
try {
|
|
11235
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
11236
|
+
}
|
|
11237
|
+
finally { if (e) throw e.error; }
|
|
11238
|
+
}
|
|
11239
|
+
return ar;
|
|
11240
|
+
};
|
|
11198
11241
|
var ProductDetailEcComponent = /** @class */ (function (_super) {
|
|
11199
11242
|
__extends$w(ProductDetailEcComponent, _super);
|
|
11200
11243
|
function ProductDetailEcComponent(productService, consts, activedRoute, cartService, optionsService, productsService, analyticsService, router, toastrService, meta, injector) {
|
|
@@ -11223,7 +11266,8 @@ var ProductDetailEcComponent = /** @class */ (function (_super) {
|
|
|
11223
11266
|
_this.enableFieldNotesInArticleFile = false;
|
|
11224
11267
|
_this.addToCart = function () {
|
|
11225
11268
|
var _a;
|
|
11226
|
-
|
|
11269
|
+
var note = ((_a = _this.comments) === null || _a === void 0 ? void 0 : _a.trim()) || null;
|
|
11270
|
+
_this.quantity > 0 && _this.productService.addToCart(_this.quantity, undefined, note);
|
|
11227
11271
|
};
|
|
11228
11272
|
_this.addAllProductosToCart = function () {
|
|
11229
11273
|
var _a, _b;
|
|
@@ -11347,7 +11391,31 @@ var ProductDetailEcComponent = /** @class */ (function (_super) {
|
|
|
11347
11391
|
return cadena.replace(expresionRegular, '');
|
|
11348
11392
|
};
|
|
11349
11393
|
ProductDetailEcComponent.prototype.ngOnInit = function () {
|
|
11394
|
+
var _this = this;
|
|
11350
11395
|
this.ecOnInit();
|
|
11396
|
+
// Prellenar comentarios cuando:
|
|
11397
|
+
// - cargue el producto
|
|
11398
|
+
// - cambie la variante seleccionada (asociatedData$)
|
|
11399
|
+
// - cambien los ítems del carrito
|
|
11400
|
+
this.prefillSub = combineLatest([
|
|
11401
|
+
this.productService.product$.pipe(filter(function (p) { return !!p && !!p.id; })),
|
|
11402
|
+
this.productService.asociatedData$.pipe(startWith(null)),
|
|
11403
|
+
this.cartService.cartItems.pipe(startWith([])),
|
|
11404
|
+
]).subscribe(function (_a) {
|
|
11405
|
+
var _b = __read$7(_a, 3), product = _b[0], data = _b[1], items = _b[2];
|
|
11406
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
11407
|
+
var variantId = (_k = (_f = (_d = (_c = data) === null || _c === void 0 ? void 0 : _c.variantCode, (_d !== null && _d !== void 0 ? _d : (_e = data) === null || _e === void 0 ? void 0 : _e.variant_id)), (_f !== null && _f !== void 0 ? _f : (_j = (_h = (_g = product) === null || _g === void 0 ? void 0 : _g.variants) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.code)), (_k !== null && _k !== void 0 ? _k : null));
|
|
11408
|
+
var match = (_l = items) === null || _l === void 0 ? void 0 : _l.find(function (it) {
|
|
11409
|
+
var _a, _b, _c, _d;
|
|
11410
|
+
return ((_b = (_a = it) === null || _a === void 0 ? void 0 : _a.product) === null || _b === void 0 ? void 0 : _b.id) === ((_c = product) === null || _c === void 0 ? void 0 : _c.id) &&
|
|
11411
|
+
(variantId ? ((_d = it) === null || _d === void 0 ? void 0 : _d.variant_id) === variantId : true);
|
|
11412
|
+
});
|
|
11413
|
+
_this.comments = (_o = (_m = match) === null || _m === void 0 ? void 0 : _m.comments, (_o !== null && _o !== void 0 ? _o : ''));
|
|
11414
|
+
});
|
|
11415
|
+
};
|
|
11416
|
+
ProductDetailEcComponent.prototype.ngOnDestroy = function () {
|
|
11417
|
+
var _a;
|
|
11418
|
+
(_a = this.prefillSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
11351
11419
|
};
|
|
11352
11420
|
ProductDetailEcComponent.prototype.scroll = function () {
|
|
11353
11421
|
var el = this.contact.nativeElement;
|
|
@@ -11496,7 +11564,6 @@ var ProductEcComponent = /** @class */ (function (_super) {
|
|
|
11496
11564
|
ProductEcComponent.prototype.ngOnChanges = function () {
|
|
11497
11565
|
};
|
|
11498
11566
|
ProductEcComponent.prototype.selectItem = function (product) {
|
|
11499
|
-
console.log('entro');
|
|
11500
11567
|
this.analyticsService.callEvent('select_item', product);
|
|
11501
11568
|
};
|
|
11502
11569
|
ProductEcComponent.ctorParameters = function () { return [
|
|
@@ -12767,7 +12834,7 @@ var __decorate$1g = (this && this.__decorate) || function (decorators, target, k
|
|
|
12767
12834
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
12768
12835
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12769
12836
|
};
|
|
12770
|
-
var __read$
|
|
12837
|
+
var __read$8 = (this && this.__read) || function (o, n) {
|
|
12771
12838
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
12772
12839
|
if (!m) return o;
|
|
12773
12840
|
var i = m.call(o), r, ar = [], e;
|
|
@@ -12811,7 +12878,7 @@ var RedsysCatchEcComponent = /** @class */ (function (_super) {
|
|
|
12811
12878
|
var _this = this;
|
|
12812
12879
|
var state;
|
|
12813
12880
|
combineLatest([this.activedRoute.params, this.activedRoute.queryParams]).subscribe(function (_a) {
|
|
12814
|
-
var _b = __read$
|
|
12881
|
+
var _b = __read$8(_a, 2), queryRouter = _b[0], queryParams = _b[1];
|
|
12815
12882
|
state = queryRouter.state;
|
|
12816
12883
|
state && state == 'statuspayment' && (state = queryParams.status);
|
|
12817
12884
|
console.log('PARAMETROS STATE -> ', state);
|
|
@@ -15434,12 +15501,10 @@ var PaypalExpressEcComponent = /** @class */ (function (_super) {
|
|
|
15434
15501
|
_this.loading = false;
|
|
15435
15502
|
}
|
|
15436
15503
|
else {
|
|
15437
|
-
/* console.log('Entro al else'); */
|
|
15438
15504
|
_this.renderPayPal();
|
|
15439
15505
|
}
|
|
15440
15506
|
}
|
|
15441
15507
|
catch (error) {
|
|
15442
|
-
/* console.log('Entro al catch'); */
|
|
15443
15508
|
_this.renderPayPal();
|
|
15444
15509
|
}
|
|
15445
15510
|
}, 1000);
|
|
@@ -16112,7 +16177,7 @@ var __decorate$1D = (this && this.__decorate) || function (decorators, target, k
|
|
|
16112
16177
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
16113
16178
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16114
16179
|
};
|
|
16115
|
-
var __read$
|
|
16180
|
+
var __read$9 = (this && this.__read) || function (o, n) {
|
|
16116
16181
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
16117
16182
|
if (!m) return o;
|
|
16118
16183
|
var i = m.call(o), r, ar = [], e;
|
|
@@ -16144,7 +16209,7 @@ var CartLoadEcComponent = /** @class */ (function (_super) {
|
|
|
16144
16209
|
var _this = this;
|
|
16145
16210
|
var token;
|
|
16146
16211
|
combineLatest([this.activedRoute.params, this.activedRoute.queryParams]).subscribe(function (_a) {
|
|
16147
|
-
var _b = __read$
|
|
16212
|
+
var _b = __read$9(_a, 2), queryRouter = _b[0], queryParams = _b[1];
|
|
16148
16213
|
token = queryRouter.token;
|
|
16149
16214
|
console.log('PARAMETROS token -> ', token);
|
|
16150
16215
|
_this.cartService.loadCartByToken(token).then(function (res) {
|
|
@@ -19290,7 +19355,7 @@ var SidebarEcComponent = /** @class */ (function () {
|
|
|
19290
19355
|
});
|
|
19291
19356
|
};
|
|
19292
19357
|
SidebarEcComponent.prototype.actualizarCantidad = function (item, cantidad, stock, id) {
|
|
19293
|
-
var _a;
|
|
19358
|
+
var _a, _b, _c;
|
|
19294
19359
|
if (this.cartLoading) {
|
|
19295
19360
|
return;
|
|
19296
19361
|
}
|
|
@@ -19310,13 +19375,14 @@ var SidebarEcComponent = /** @class */ (function () {
|
|
|
19310
19375
|
newQuantity = Math.round(newQuantity / step) * step;
|
|
19311
19376
|
}
|
|
19312
19377
|
}
|
|
19378
|
+
var keepSameComment = (_c = (_b = item) === null || _b === void 0 ? void 0 : _b.comments, (_c !== null && _c !== void 0 ? _c : undefined));
|
|
19313
19379
|
if (id) {
|
|
19314
19380
|
var elem_1 = document.getElementById(id);
|
|
19315
19381
|
if (elem_1) {
|
|
19316
19382
|
elem_1.disabled = true;
|
|
19317
19383
|
}
|
|
19318
19384
|
if (newQuantity > 0 && newQuantity <= stock) {
|
|
19319
|
-
this.cartService.updateItemQuantity(item, newQuantity);
|
|
19385
|
+
this.cartService.updateItemQuantity(item, newQuantity, keepSameComment);
|
|
19320
19386
|
}
|
|
19321
19387
|
else {
|
|
19322
19388
|
this.toastrService.show('out-of-stock-actually');
|
|
@@ -19329,7 +19395,7 @@ var SidebarEcComponent = /** @class */ (function () {
|
|
|
19329
19395
|
}
|
|
19330
19396
|
else {
|
|
19331
19397
|
if (newQuantity > 0 && newQuantity <= stock) {
|
|
19332
|
-
this.cartService.updateItemQuantity(item, newQuantity);
|
|
19398
|
+
this.cartService.updateItemQuantity(item, newQuantity, keepSameComment);
|
|
19333
19399
|
}
|
|
19334
19400
|
}
|
|
19335
19401
|
};
|
|
@@ -20128,7 +20194,7 @@ var __decorate$27 = (this && this.__decorate) || function (decorators, target, k
|
|
|
20128
20194
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
20129
20195
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
20130
20196
|
};
|
|
20131
|
-
var __read$
|
|
20197
|
+
var __read$a = (this && this.__read) || function (o, n) {
|
|
20132
20198
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
20133
20199
|
if (!m) return o;
|
|
20134
20200
|
var i = m.call(o), r, ar = [], e;
|
|
@@ -20194,7 +20260,7 @@ var ecCurrencySymbolPipe = /** @class */ (function () {
|
|
|
20194
20260
|
var forceShow = mode === 'alwaysShowDecimals';
|
|
20195
20261
|
var forceHide = mode === 'alwaysHideDecimals';
|
|
20196
20262
|
var showDecimals = forceShow ? true : forceHide ? false : !withoutDecimalGlobal;
|
|
20197
|
-
var _b = __read$
|
|
20263
|
+
var _b = __read$a((value || '').split(','), 2), ent = _b[0], _c = _b[1], dec = _c === void 0 ? '00' : _c;
|
|
20198
20264
|
if (showDecimals) {
|
|
20199
20265
|
if (dec.length > 2)
|
|
20200
20266
|
dec = dec.slice(0, 2);
|