ng-easycommerce 0.0.654 → 0.0.656-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.
Files changed (34) hide show
  1. package/README.md +6 -0
  2. package/bundles/ng-easycommerce.umd.js +90 -27
  3. package/bundles/ng-easycommerce.umd.js.map +1 -1
  4. package/bundles/ng-easycommerce.umd.min.js +1 -1
  5. package/bundles/ng-easycommerce.umd.min.js.map +1 -1
  6. package/esm2015/lib/core.consts.js +2 -1
  7. package/esm2015/lib/ec-component/auth-ec/select-channel-ec/select-channel-ec.component.js +8 -1
  8. package/esm2015/lib/ec-component/cart-ec/cart-ec.component.js +5 -4
  9. package/esm2015/lib/ec-component/header-ec/header-ec.component.js +1 -1
  10. package/esm2015/lib/ec-component/product-detail-ec/product-detail-ec.component.js +27 -2
  11. package/esm2015/lib/ec-component/product-ec/product-ec.component.js +1 -2
  12. package/esm2015/lib/ec-component/sidebar-ec/sidebar-ec.component.js +5 -4
  13. package/esm2015/lib/ec-component/widgets-ec/paypal-express-ec/paypal-express-ec.component.js +1 -3
  14. package/esm2015/lib/services/cart.service.js +27 -12
  15. package/esm5/lib/core.consts.js +2 -1
  16. package/esm5/lib/ec-component/auth-ec/select-channel-ec/select-channel-ec.component.js +8 -1
  17. package/esm5/lib/ec-component/cart-ec/cart-ec.component.js +5 -4
  18. package/esm5/lib/ec-component/header-ec/header-ec.component.js +1 -1
  19. package/esm5/lib/ec-component/product-detail-ec/product-detail-ec.component.js +45 -2
  20. package/esm5/lib/ec-component/product-ec/product-ec.component.js +1 -2
  21. package/esm5/lib/ec-component/sidebar-ec/sidebar-ec.component.js +5 -4
  22. package/esm5/lib/ec-component/widgets-ec/paypal-express-ec/paypal-express-ec.component.js +1 -3
  23. package/esm5/lib/services/cart.service.js +27 -12
  24. package/fesm2015/ng-easycommerce.js +67 -22
  25. package/fesm2015/ng-easycommerce.js.map +1 -1
  26. package/fesm5/ng-easycommerce.js +91 -28
  27. package/fesm5/ng-easycommerce.js.map +1 -1
  28. package/lib/core.consts.d.ts +1 -0
  29. package/lib/ec-component/auth-ec/select-channel-ec/select-channel-ec.component.d.ts +1 -0
  30. package/lib/ec-component/header-ec/header-ec.component.d.ts +1 -1
  31. package/lib/ec-component/product-detail-ec/product-detail-ec.component.d.ts +2 -0
  32. package/lib/services/cart.service.d.ts +2 -2
  33. package/ng-easycommerce.metadata.json +1 -1
  34. package/package.json +1 -1
package/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ # version 0.0.656-beta.1
2
+ - Modal selector de canal, se soluciona al recargar accedia y al logear sin seleccionar canal salia header.
3
+ # version 0.0.655-beta.1
4
+ - Soporte para agregar, editar y borrar notas en ítems del carrito:
5
+ - `product-detail-ec`: prellenar textarea con nota existente al volver a la ficha.
6
+ - `cart-ec`: mantener nota al actualizar cantidades.
1
7
  # version 0.0.654
2
8
  - funcion para excluir paises en el formulario en el proceso del checkout
3
9
  # version 0.0.653
@@ -217,6 +217,7 @@
217
217
  this.LOCALE = 'LOCALE';
218
218
  this.CHANNEL = 'CHANNEL';
219
219
  this.searchValue = '';
220
+ this.channelSelected = '';
220
221
  this.channelConfigSubject = new rxjs.ReplaySubject();
221
222
  this.channelConfig$ = this.channelConfigSubject.asObservable();
222
223
  this.channelConfigAPI = function (channel) { return '/shop-api/' + channel + 'channel'; };
@@ -4749,12 +4750,22 @@
4749
4750
  _this.updateLocalCart();
4750
4751
  _this.requestInProcess.next(false);
4751
4752
  };
4752
- this.updateCartItemQuantity = function (variant_id, quantity) {
4753
- var newQuantity = _this.items.find(function (item) { return item.variant_id == variant_id; }).quantity = quantity;
4753
+ this.updateCartItemQuantity = function (variant_id, quantity, comments) {
4754
+ var normalizedComments = comments !== undefined ? ((comments !== null && comments !== void 0 ? comments : '')).trim() : undefined;
4755
+ var newItems = _this.items.map(function (it) {
4756
+ if (it.variant_id !== variant_id)
4757
+ return it;
4758
+ var updated = __assign$a(__assign$a({}, it), { quantity: Number(quantity) });
4759
+ if (normalizedComments !== undefined) {
4760
+ updated.comments = normalizedComments;
4761
+ }
4762
+ return updated;
4763
+ });
4764
+ _this.items = newItems;
4754
4765
  _this.cartItemsSubject.next(_this.items);
4755
4766
  _this.requestInProcess.next(false);
4756
4767
  _this.updateLocalCart();
4757
- _this.toastrService.show('product-updated', { quantity: newQuantity });
4768
+ _this.toastrService.show('product-updated', { quantity: quantity });
4758
4769
  };
4759
4770
  this.appendToCart = function (cart) {
4760
4771
  _this.updateCartObj(cart);
@@ -4776,11 +4787,11 @@
4776
4787
  // this.googleAnalytics.removeFromCart(product);
4777
4788
  _this.analyticsService.callEvent('remove_from_cart', __assign$a(__assign$a({}, product), { currency: _this.consts.currency.code }));
4778
4789
  };
4779
- this.addIfAllreadyExists = function (product, variant_id, quantityAdd) {
4790
+ this.addIfAllreadyExists = function (product, variant_id, quantityAdd, comments) {
4780
4791
  if (quantityAdd === void 0) { quantityAdd = 1; }
4781
4792
  return _this.items.find(function (item, index) {
4782
4793
  if (item.product.id == product.id && item.variant_id == variant_id) {
4783
- _this.updateItemQuantity(item, _this.findItem(product.id).quantity + quantityAdd);
4794
+ _this.updateItemQuantity(item, _this.findItem(product.id).quantity + quantityAdd, comments);
4784
4795
  return true;
4785
4796
  }
4786
4797
  return false;
@@ -4834,7 +4845,7 @@
4834
4845
  return;
4835
4846
  }
4836
4847
  _this.requestInProcess.next(true);
4837
- var added = _this.addIfAllreadyExists(product, variant_id, quantity);
4848
+ var added = _this.addIfAllreadyExists(product, variant_id, quantity, comments);
4838
4849
  if (!added) {
4839
4850
  var payload = {
4840
4851
  productCode: product.id,
@@ -4874,7 +4885,7 @@
4874
4885
  !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' })
4875
4886
  .subscribe(function (res) { return _this.appendToCart(res); }, function (err) { return _this.handleError(err); });
4876
4887
  };
4877
- this.addToCartPromise = function (product, quantity, variant_id) { return __awaiter$5(_this, void 0, void 0, function () {
4888
+ this.addToCartPromise = function (product, quantity, variant_id, comments) { return __awaiter$5(_this, void 0, void 0, function () {
4878
4889
  var added, result;
4879
4890
  return __generator$5(this, function (_a) {
4880
4891
  switch (_a.label) {
@@ -4884,7 +4895,7 @@
4884
4895
  return [2 /*return*/];
4885
4896
  }
4886
4897
  this.requestInProcess.next(true);
4887
- added = this.addIfAllreadyExists(product, variant_id, quantity);
4898
+ added = this.addIfAllreadyExists(product, variant_id, quantity, comments);
4888
4899
  if (!!added) return [3 /*break*/, 2];
4889
4900
  return [4 /*yield*/, (this.connection.post(this.addItemApi(), { productCode: product.id, quantity: quantity, variantCode: variant_id }).toPromise())];
4890
4901
  case 1:
@@ -4930,13 +4941,18 @@
4930
4941
  items = items.filter(function (itemParam) { return !_this.items.find(function (item) { return itemParam.variantCode == item.variant_id; }); });
4931
4942
  return __spread$3(items, paramsMerge);
4932
4943
  };
4933
- this.updateItemQuantity = function (item, quantity) {
4944
+ this.updateItemQuantity = function (item, quantity, comments) {
4934
4945
  if (_this.validateQuantity(item, quantity) && (_this.validatePriceAndCredits(item, quantity))) {
4935
4946
  _this.requestInProcess.next(true);
4947
+ var payload = { quantity: Number(quantity) };
4948
+ if (comments !== undefined) {
4949
+ var cleaned = ((comments !== null && comments !== void 0 ? comments : '')).trim();
4950
+ payload.comments = cleaned;
4951
+ }
4936
4952
  _this.connection
4937
- .put(_this.updateItemQuantityApi(_this.findItemByIdVariant(item.variant_id)), { 'quantity': Number(quantity) })
4953
+ .put(_this.updateItemQuantityApi(_this.findItemByIdVariant(item.variant_id)), payload)
4938
4954
  .pipe(operators.finalize(function () { return _this.requestInProcess.next(false); }))
4939
- .subscribe(function (res) { return _this.updateCartObj(res) && _this.updateCartItemQuantity(item.variant_id, Number(quantity)); }, function (err) { return _this.handleError(err); });
4955
+ .subscribe(function (res) { return _this.updateCartObj(res) && _this.updateCartItemQuantity(item.variant_id, Number(quantity), comments); }, function (err) { return _this.handleError(err); });
4940
4956
  }
4941
4957
  };
4942
4958
  this.validateQuantity = function (item, quantity) {
@@ -7583,7 +7599,7 @@
7583
7599
  };
7584
7600
  CartEcComponent.prototype.actualizarCantidad = function (item, cantidad, stock, id) {
7585
7601
  var _this = this;
7586
- var _a;
7602
+ var _a, _b, _c;
7587
7603
  if (this.cartLoading) {
7588
7604
  return;
7589
7605
  }
@@ -7603,10 +7619,11 @@
7603
7619
  newQuantity = Math.round(newQuantity / step) * step;
7604
7620
  }
7605
7621
  }
7622
+ var keepSameComment = (_c = (_b = item) === null || _b === void 0 ? void 0 : _b.comments, (_c !== null && _c !== void 0 ? _c : undefined));
7606
7623
  if (id) {
7607
7624
  this.isDisabled = true; // Actualiza la propiedad vinculada a `[disabled]`
7608
7625
  if (newQuantity > 0 && newQuantity <= stock) {
7609
- this.cartService.updateItemQuantity(item, newQuantity);
7626
+ this.cartService.updateItemQuantity(item, newQuantity, keepSameComment);
7610
7627
  }
7611
7628
  else {
7612
7629
  this.toastrService.show('out-of-stock-actually');
@@ -7617,7 +7634,7 @@
7617
7634
  }
7618
7635
  else {
7619
7636
  if (newQuantity > 0 && newQuantity <= stock) {
7620
- this.cartService.updateItemQuantity(item, newQuantity);
7637
+ this.cartService.updateItemQuantity(item, newQuantity, keepSameComment);
7621
7638
  }
7622
7639
  else {
7623
7640
  this.toastrService.show('out-of-stock-actually');
@@ -11192,6 +11209,22 @@
11192
11209
  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;
11193
11210
  return c > 3 && r && Object.defineProperty(target, key, r), r;
11194
11211
  };
11212
+ var __read$7 = (this && this.__read) || function (o, n) {
11213
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
11214
+ if (!m) return o;
11215
+ var i = m.call(o), r, ar = [], e;
11216
+ try {
11217
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
11218
+ }
11219
+ catch (error) { e = { error: error }; }
11220
+ finally {
11221
+ try {
11222
+ if (r && !r.done && (m = i["return"])) m.call(i);
11223
+ }
11224
+ finally { if (e) throw e.error; }
11225
+ }
11226
+ return ar;
11227
+ };
11195
11228
  var ProductDetailEcComponent = /** @class */ (function (_super) {
11196
11229
  __extends$w(ProductDetailEcComponent, _super);
11197
11230
  function ProductDetailEcComponent(productService, consts, activedRoute, cartService, optionsService, productsService, analyticsService, router, toastrService, meta, injector) {
@@ -11220,7 +11253,8 @@
11220
11253
  _this.enableFieldNotesInArticleFile = false;
11221
11254
  _this.addToCart = function () {
11222
11255
  var _a;
11223
- _this.quantity > 0 && _this.productService.addToCart(_this.quantity, undefined, ((_a = _this.comments) === null || _a === void 0 ? void 0 : _a.trim()) || null);
11256
+ var note = ((_a = _this.comments) === null || _a === void 0 ? void 0 : _a.trim()) || null;
11257
+ _this.quantity > 0 && _this.productService.addToCart(_this.quantity, undefined, note);
11224
11258
  };
11225
11259
  _this.addAllProductosToCart = function () {
11226
11260
  var _a, _b;
@@ -11344,7 +11378,31 @@
11344
11378
  return cadena.replace(expresionRegular, '');
11345
11379
  };
11346
11380
  ProductDetailEcComponent.prototype.ngOnInit = function () {
11381
+ var _this = this;
11347
11382
  this.ecOnInit();
11383
+ // Prellenar comentarios cuando:
11384
+ // - cargue el producto
11385
+ // - cambie la variante seleccionada (asociatedData$)
11386
+ // - cambien los ítems del carrito
11387
+ this.prefillSub = rxjs.combineLatest([
11388
+ this.productService.product$.pipe(operators.filter(function (p) { return !!p && !!p.id; })),
11389
+ this.productService.asociatedData$.pipe(operators.startWith(null)),
11390
+ this.cartService.cartItems.pipe(operators.startWith([])),
11391
+ ]).subscribe(function (_a) {
11392
+ var _b = __read$7(_a, 3), product = _b[0], data = _b[1], items = _b[2];
11393
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
11394
+ 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));
11395
+ var match = (_l = items) === null || _l === void 0 ? void 0 : _l.find(function (it) {
11396
+ var _a, _b, _c, _d;
11397
+ 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) &&
11398
+ (variantId ? ((_d = it) === null || _d === void 0 ? void 0 : _d.variant_id) === variantId : true);
11399
+ });
11400
+ _this.comments = (_o = (_m = match) === null || _m === void 0 ? void 0 : _m.comments, (_o !== null && _o !== void 0 ? _o : ''));
11401
+ });
11402
+ };
11403
+ ProductDetailEcComponent.prototype.ngOnDestroy = function () {
11404
+ var _a;
11405
+ (_a = this.prefillSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
11348
11406
  };
11349
11407
  ProductDetailEcComponent.prototype.scroll = function () {
11350
11408
  var el = this.contact.nativeElement;
@@ -11493,7 +11551,6 @@
11493
11551
  ProductEcComponent.prototype.ngOnChanges = function () {
11494
11552
  };
11495
11553
  ProductEcComponent.prototype.selectItem = function (product) {
11496
- console.log('entro');
11497
11554
  this.analyticsService.callEvent('select_item', product);
11498
11555
  };
11499
11556
  ProductEcComponent.ctorParameters = function () { return [
@@ -12764,7 +12821,7 @@
12764
12821
  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;
12765
12822
  return c > 3 && r && Object.defineProperty(target, key, r), r;
12766
12823
  };
12767
- var __read$7 = (this && this.__read) || function (o, n) {
12824
+ var __read$8 = (this && this.__read) || function (o, n) {
12768
12825
  var m = typeof Symbol === "function" && o[Symbol.iterator];
12769
12826
  if (!m) return o;
12770
12827
  var i = m.call(o), r, ar = [], e;
@@ -12808,7 +12865,7 @@
12808
12865
  var _this = this;
12809
12866
  var state;
12810
12867
  rxjs.combineLatest([this.activedRoute.params, this.activedRoute.queryParams]).subscribe(function (_a) {
12811
- var _b = __read$7(_a, 2), queryRouter = _b[0], queryParams = _b[1];
12868
+ var _b = __read$8(_a, 2), queryRouter = _b[0], queryParams = _b[1];
12812
12869
  state = queryRouter.state;
12813
12870
  state && state == 'statuspayment' && (state = queryParams.status);
12814
12871
  console.log('PARAMETROS STATE -> ', state);
@@ -15431,12 +15488,10 @@
15431
15488
  _this.loading = false;
15432
15489
  }
15433
15490
  else {
15434
- /* console.log('Entro al else'); */
15435
15491
  _this.renderPayPal();
15436
15492
  }
15437
15493
  }
15438
15494
  catch (error) {
15439
- /* console.log('Entro al catch'); */
15440
15495
  _this.renderPayPal();
15441
15496
  }
15442
15497
  }, 1000);
@@ -16025,6 +16080,9 @@
16025
16080
  _this.modalService = modalService;
16026
16081
  _this.router = router;
16027
16082
  _this.channels = [];
16083
+ _this.unloadHandler = function () {
16084
+ _this.authService.logout();
16085
+ };
16028
16086
  _this.navigateByUrl = function () {
16029
16087
  _this.router.navigateByUrl('');
16030
16088
  };
@@ -16038,7 +16096,9 @@
16038
16096
  _this.bsModalRef = _this.modalService.show(_this.template, { class: 'modal modal-dialog-centered ', keyboard: false, backdrop: 'static', animated: true });
16039
16097
  _this.subsModal = _this.modalService.onHide.subscribe(function (onClose) {
16040
16098
  _this.bsModalRef = null;
16099
+ window.removeEventListener('unload', _this.unloadHandler);
16041
16100
  });
16101
+ window.addEventListener('unload', _this.unloadHandler);
16042
16102
  }
16043
16103
  };
16044
16104
  _this.setSelect = function (chanelSelect) {
@@ -16052,6 +16112,7 @@
16052
16112
  if (_this.channels.find(function (chanel) { return chanel.selected; })) {
16053
16113
  _this.authService.channelAccess(_this.channels.find(function (chanel) { return chanel.selected; }));
16054
16114
  _this.bsModalRef.hide();
16115
+ window.removeEventListener('unload', _this.unloadHandler);
16055
16116
  }
16056
16117
  };
16057
16118
  return _this;
@@ -16070,6 +16131,7 @@
16070
16131
  var _a, _b;
16071
16132
  (_a = this.subs) === null || _a === void 0 ? void 0 : _a.unsubscribe();
16072
16133
  (_b = this.subsModal) === null || _b === void 0 ? void 0 : _b.unsubscribe();
16134
+ window.removeEventListener('unload', this.unloadHandler);
16073
16135
  };
16074
16136
  SelectChannelEcComponent.ctorParameters = function () { return [
16075
16137
  { type: AuthService },
@@ -16109,7 +16171,7 @@
16109
16171
  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;
16110
16172
  return c > 3 && r && Object.defineProperty(target, key, r), r;
16111
16173
  };
16112
- var __read$8 = (this && this.__read) || function (o, n) {
16174
+ var __read$9 = (this && this.__read) || function (o, n) {
16113
16175
  var m = typeof Symbol === "function" && o[Symbol.iterator];
16114
16176
  if (!m) return o;
16115
16177
  var i = m.call(o), r, ar = [], e;
@@ -16141,7 +16203,7 @@
16141
16203
  var _this = this;
16142
16204
  var token;
16143
16205
  rxjs.combineLatest([this.activedRoute.params, this.activedRoute.queryParams]).subscribe(function (_a) {
16144
- var _b = __read$8(_a, 2), queryRouter = _b[0], queryParams = _b[1];
16206
+ var _b = __read$9(_a, 2), queryRouter = _b[0], queryParams = _b[1];
16145
16207
  token = queryRouter.token;
16146
16208
  console.log('PARAMETROS token -> ', token);
16147
16209
  _this.cartService.loadCartByToken(token).then(function (res) {
@@ -19287,7 +19349,7 @@
19287
19349
  });
19288
19350
  };
19289
19351
  SidebarEcComponent.prototype.actualizarCantidad = function (item, cantidad, stock, id) {
19290
- var _a;
19352
+ var _a, _b, _c;
19291
19353
  if (this.cartLoading) {
19292
19354
  return;
19293
19355
  }
@@ -19307,13 +19369,14 @@
19307
19369
  newQuantity = Math.round(newQuantity / step) * step;
19308
19370
  }
19309
19371
  }
19372
+ var keepSameComment = (_c = (_b = item) === null || _b === void 0 ? void 0 : _b.comments, (_c !== null && _c !== void 0 ? _c : undefined));
19310
19373
  if (id) {
19311
19374
  var elem_1 = document.getElementById(id);
19312
19375
  if (elem_1) {
19313
19376
  elem_1.disabled = true;
19314
19377
  }
19315
19378
  if (newQuantity > 0 && newQuantity <= stock) {
19316
- this.cartService.updateItemQuantity(item, newQuantity);
19379
+ this.cartService.updateItemQuantity(item, newQuantity, keepSameComment);
19317
19380
  }
19318
19381
  else {
19319
19382
  this.toastrService.show('out-of-stock-actually');
@@ -19326,7 +19389,7 @@
19326
19389
  }
19327
19390
  else {
19328
19391
  if (newQuantity > 0 && newQuantity <= stock) {
19329
- this.cartService.updateItemQuantity(item, newQuantity);
19392
+ this.cartService.updateItemQuantity(item, newQuantity, keepSameComment);
19330
19393
  }
19331
19394
  }
19332
19395
  };
@@ -20125,7 +20188,7 @@
20125
20188
  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;
20126
20189
  return c > 3 && r && Object.defineProperty(target, key, r), r;
20127
20190
  };
20128
- var __read$9 = (this && this.__read) || function (o, n) {
20191
+ var __read$a = (this && this.__read) || function (o, n) {
20129
20192
  var m = typeof Symbol === "function" && o[Symbol.iterator];
20130
20193
  if (!m) return o;
20131
20194
  var i = m.call(o), r, ar = [], e;
@@ -20191,7 +20254,7 @@
20191
20254
  var forceShow = mode === 'alwaysShowDecimals';
20192
20255
  var forceHide = mode === 'alwaysHideDecimals';
20193
20256
  var showDecimals = forceShow ? true : forceHide ? false : !withoutDecimalGlobal;
20194
- var _b = __read$9((value || '').split(','), 2), ent = _b[0], _c = _b[1], dec = _c === void 0 ? '00' : _c;
20257
+ var _b = __read$a((value || '').split(','), 2), ent = _b[0], _c = _b[1], dec = _c === void 0 ? '00' : _c;
20195
20258
  if (showDecimals) {
20196
20259
  if (dec.length > 2)
20197
20260
  dec = dec.slice(0, 2);