ng-easycommerce 0.0.632 → 0.0.633

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 (32) hide show
  1. package/README.md +3 -0
  2. package/assets/ec-i18n/ct.json +3 -1
  3. package/assets/ec-i18n/en.json +3 -1
  4. package/assets/ec-i18n/es.json +6 -4
  5. package/assets/ec-i18n/fr.json +3 -1
  6. package/assets/ec-i18n/gl.json +3 -1
  7. package/assets/ec-i18n/pr.json +3 -1
  8. package/bundles/ng-easycommerce.umd.js +62 -41
  9. package/bundles/ng-easycommerce.umd.js.map +1 -1
  10. package/bundles/ng-easycommerce.umd.min.js +1 -1
  11. package/bundles/ng-easycommerce.umd.min.js.map +1 -1
  12. package/esm2015/lib/ec-component/auth-ec/register-form-ec/register-form-ec.component.js +3 -3
  13. package/esm2015/lib/ec-component/auth-ec/register-wholesaler-form-ec/register-wholesaler-form-ec.component.js +3 -3
  14. package/esm2015/lib/ec-component/checkout-ec/success-ec/success-ec.component.js +15 -3
  15. package/esm2015/lib/ec-component/product-detail-ec/product-detail-ec.component.js +4 -3
  16. package/esm2015/lib/services/channel-config.service.js +1 -9
  17. package/esm2015/lib/services/options.service.js +13 -20
  18. package/esm5/lib/ec-component/auth-ec/register-form-ec/register-form-ec.component.js +3 -3
  19. package/esm5/lib/ec-component/auth-ec/register-wholesaler-form-ec/register-wholesaler-form-ec.component.js +3 -3
  20. package/esm5/lib/ec-component/checkout-ec/success-ec/success-ec.component.js +15 -3
  21. package/esm5/lib/ec-component/product-detail-ec/product-detail-ec.component.js +4 -3
  22. package/esm5/lib/services/channel-config.service.js +1 -9
  23. package/esm5/lib/services/options.service.js +35 -19
  24. package/fesm2015/ng-easycommerce.js +33 -35
  25. package/fesm2015/ng-easycommerce.js.map +1 -1
  26. package/fesm5/ng-easycommerce.js +62 -41
  27. package/fesm5/ng-easycommerce.js.map +1 -1
  28. package/lib/ec-component/checkout-ec/success-ec/success-ec.component.d.ts +3 -0
  29. package/lib/services/channel-config.service.d.ts +0 -5
  30. package/lib/services/options.service.d.ts +1 -1
  31. package/ng-easycommerce.metadata.json +1 -1
  32. package/package.json +1 -1
@@ -1003,6 +1003,17 @@ var __spread = (this && this.__spread) || function () {
1003
1003
  for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));
1004
1004
  return ar;
1005
1005
  };
1006
+ var __values = (this && this.__values) || function(o) {
1007
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
1008
+ if (m) return m.call(o);
1009
+ if (o && typeof o.length === "number") return {
1010
+ next: function () {
1011
+ if (o && i >= o.length) o = void 0;
1012
+ return { value: o && o[i++], done: !o };
1013
+ }
1014
+ };
1015
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1016
+ };
1006
1017
  var OptionsService = /** @class */ (function () {
1007
1018
  function OptionsService(connection, constants) {
1008
1019
  var _this = this;
@@ -1136,26 +1147,31 @@ var OptionsService = /** @class */ (function () {
1136
1147
  });
1137
1148
  return final_result;
1138
1149
  };
1139
- this.generateBreadcrumb = function (code, elements, result) {
1140
- var element = elements.find(function (elem) { return elem.code == code; });
1141
- if (element) {
1142
- result.push(element);
1143
- }
1144
- else {
1145
- elements.some(function (elem) {
1146
- if (elem.children && elem.children.length) {
1147
- var length_1 = result.length;
1148
- var new_result = _this.generateBreadcrumb(code, elem.children, result);
1149
- if (new_result.length > length_1) {
1150
- result = new_result;
1151
- result.push(elem);
1152
- return true;
1153
- }
1150
+ this.generateBreadcrumb = function (code, elements, path) {
1151
+ var e_1, _a;
1152
+ if (path === void 0) { path = []; }
1153
+ var _b;
1154
+ try {
1155
+ for (var elements_1 = __values(elements), elements_1_1 = elements_1.next(); !elements_1_1.done; elements_1_1 = elements_1.next()) {
1156
+ var elem = elements_1_1.value;
1157
+ if (elem.code === code) {
1158
+ return __spread(path, [elem]);
1154
1159
  }
1155
- return false;
1156
- });
1160
+ if ((_b = elem.children) === null || _b === void 0 ? void 0 : _b.length) {
1161
+ var childPath = _this.generateBreadcrumb(code, elem.children, __spread(path, [elem]));
1162
+ if (childPath.length)
1163
+ return childPath;
1164
+ }
1165
+ }
1157
1166
  }
1158
- return result;
1167
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1168
+ finally {
1169
+ try {
1170
+ if (elements_1_1 && !elements_1_1.done && (_a = elements_1.return)) _a.call(elements_1);
1171
+ }
1172
+ finally { if (e_1) throw e_1.error; }
1173
+ }
1174
+ return [];
1159
1175
  };
1160
1176
  this.getAllData();
1161
1177
  // this.authService.loggedIn.subscribe(res => res && this.getAllData());
@@ -4122,14 +4138,6 @@ var ChannelConfigService = /** @class */ (function () {
4122
4138
  this.getChannels();
4123
4139
  this.getLocales();
4124
4140
  }
4125
- /**
4126
- * @description Devuelve si se deben mostrar precios con impuestos durante la navegación.
4127
- * @returns {boolean | null} true/false si está definido, null si aún no hay configuración
4128
- */
4129
- ChannelConfigService$1.prototype.getShowPricesWithTaxes = function () {
4130
- var _a, _b;
4131
- return _b = (_a = this.channel) === null || _a === void 0 ? void 0 : _a.showPriceWithTaxesWhileBrowsing, (_b !== null && _b !== void 0 ? _b : null);
4132
- };
4133
4141
  ChannelConfigService$1.ctorParameters = function () { return [
4134
4142
  { type: Constants },
4135
4143
  { type: undefined, decorators: [{ type: Inject, args: ['env',] }] },
@@ -7428,7 +7436,7 @@ var __generator$8 = (this && this.__generator) || function (thisArg, body) {
7428
7436
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7429
7437
  }
7430
7438
  };
7431
- var __values = (this && this.__values) || function(o) {
7439
+ var __values$1 = (this && this.__values) || function(o) {
7432
7440
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
7433
7441
  if (m) return m.call(o);
7434
7442
  if (o && typeof o.length === "number") return {
@@ -7768,7 +7776,7 @@ var CartEcComponent = /** @class */ (function (_super) {
7768
7776
  CartEcComponent.prototype.checkStock = function (item) {
7769
7777
  var e_1, _a;
7770
7778
  try {
7771
- for (var _b = __values(item.product.variants), _c = _b.next(); !_c.done; _c = _b.next()) {
7779
+ for (var _b = __values$1(item.product.variants), _c = _b.next(); !_c.done; _c = _b.next()) {
7772
7780
  var variant = _c.value;
7773
7781
  if (item.variant_id === variant.code) {
7774
7782
  if (variant.stock === 0) {
@@ -7799,7 +7807,7 @@ var CartEcComponent = /** @class */ (function (_super) {
7799
7807
  res.forEach(function (item) {
7800
7808
  var e_2, _a;
7801
7809
  try {
7802
- for (var _b = __values(item.product.variants), _c = _b.next(); !_c.done; _c = _b.next()) {
7810
+ for (var _b = __values$1(item.product.variants), _c = _b.next(); !_c.done; _c = _b.next()) {
7803
7811
  var variant = _c.value;
7804
7812
  if (item.variant_id === variant.code && !_this.exitUpdate) {
7805
7813
  if (variant.stock === 0) {
@@ -8704,7 +8712,7 @@ var __generator$b = (this && this.__generator) || function (thisArg, body) {
8704
8712
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
8705
8713
  }
8706
8714
  };
8707
- var __values$1 = (this && this.__values) || function(o) {
8715
+ var __values$2 = (this && this.__values) || function(o) {
8708
8716
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
8709
8717
  if (m) return m.call(o);
8710
8718
  if (o && typeof o.length === "number") return {
@@ -8849,7 +8857,7 @@ var PaymentEcComponent = /** @class */ (function (_super) {
8849
8857
  var e_1, _a;
8850
8858
  var parent = e.target.parentElement.children;
8851
8859
  try {
8852
- for (var parent_1 = __values$1(parent), parent_1_1 = parent_1.next(); !parent_1_1.done; parent_1_1 = parent_1.next()) {
8860
+ for (var parent_1 = __values$2(parent), parent_1_1 = parent_1.next(); !parent_1_1.done; parent_1_1 = parent_1.next()) {
8853
8861
  var button = parent_1_1.value;
8854
8862
  if (button.classList.contains('active')) {
8855
8863
  button.classList.remove('active');
@@ -8919,7 +8927,7 @@ var __decorate$T = (this && this.__decorate) || function (decorators, target, ke
8919
8927
  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;
8920
8928
  return c > 3 && r && Object.defineProperty(target, key, r), r;
8921
8929
  };
8922
- var __values$2 = (this && this.__values) || function(o) {
8930
+ var __values$3 = (this && this.__values) || function(o) {
8923
8931
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
8924
8932
  if (m) return m.call(o);
8925
8933
  if (o && typeof o.length === "number") return {
@@ -9008,7 +9016,7 @@ var ShipmentEcComponent = /** @class */ (function (_super) {
9008
9016
  var e_1, _a;
9009
9017
  var parent = e.target.parentElement.children;
9010
9018
  try {
9011
- for (var parent_1 = __values$2(parent), parent_1_1 = parent_1.next(); !parent_1_1.done; parent_1_1 = parent_1.next()) {
9019
+ for (var parent_1 = __values$3(parent), parent_1_1 = parent_1.next(); !parent_1_1.done; parent_1_1 = parent_1.next()) {
9012
9020
  var button = parent_1_1.value;
9013
9021
  if (button.classList.contains('active')) {
9014
9022
  button.classList.remove('active');
@@ -9076,6 +9084,8 @@ var SuccessEcComponent = /** @class */ (function (_super) {
9076
9084
  _this.orderDetails = {};
9077
9085
  _this.params = {};
9078
9086
  _this.from_mp = true;
9087
+ _this.totalAmount = null;
9088
+ _this.paymentDate = null;
9079
9089
  /**
9080
9090
  * @description Chequea si existe un bloque recibido por parametro.
9081
9091
  * @param codeBlock codigo del bloque.
@@ -9083,19 +9093,29 @@ var SuccessEcComponent = /** @class */ (function (_super) {
9083
9093
  */
9084
9094
  _this.containsBlock = function (codeBlock) { return _this.blocks.find(function (block) { return block.code == codeBlock; }); };
9085
9095
  _this.isBalanceInAccount = function (code) { return code && code.toLocaleLowerCase().includes('balance_in_account'); };
9096
+ _this.isPlaceToPay = function (code) { return code && code.toLocaleLowerCase().includes('place_to_pay'); };
9086
9097
  _this.ecOnConstruct();
9087
9098
  return _this;
9088
9099
  }
9089
9100
  SuccessEcComponent.prototype.ngOnInit = function () {
9090
9101
  var _this = this;
9091
9102
  this.checkoutService.order$.subscribe(function (res) {
9092
- var _a, _b;
9103
+ var _a, _b, _c, _d, _e, _f, _g, _h;
9093
9104
  //console.log('LO QUE LLEGA EN ORDEN', res);
9094
9105
  ((_a = res) === null || _a === void 0 ? void 0 : _a.number) ? _this.params = {
9095
9106
  external_reference: res.number,
9096
9107
  } : null;
9097
9108
  //this.payments = [{method:{code:'bank_transsfer'}}]
9098
9109
  _this.payments = ((_b = res) === null || _b === void 0 ? void 0 : _b.payments) ? res.payments : null;
9110
+ if (((_e = (_d = (_c = _this.payments) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.method) === null || _e === void 0 ? void 0 : _e.code) && _this.isPlaceToPay(_this.payments[0].method.code)) {
9111
+ _this.totalAmount = (_h = (_g = (_f = res) === null || _f === void 0 ? void 0 : _f.totals) === null || _g === void 0 ? void 0 : _g.total, (_h !== null && _h !== void 0 ? _h : null));
9112
+ var now = new Date();
9113
+ _this.paymentDate = now.toLocaleDateString('es-AR', {
9114
+ day: '2-digit',
9115
+ month: '2-digit',
9116
+ year: 'numeric',
9117
+ });
9118
+ }
9099
9119
  });
9100
9120
  this.blocksService.getBlocks('info_metodo_pago');
9101
9121
  this.blocksService.blocks.subscribe(function (res) { return _this.blocks = res; });
@@ -9112,7 +9132,7 @@ var SuccessEcComponent = /** @class */ (function (_super) {
9112
9132
  SuccessEcComponent = __decorate$U([
9113
9133
  Component({
9114
9134
  selector: 'app-order-success-ec',
9115
- template: "<div id=\"container\" class=\"flex-center generalContainer container-xl\">\n <div class=\"Main card my-2\" *ngIf=\"this.payments && this.payments[0].method.code; else loading\">\n <ng-container *ngIf=\"this.blocks && this.blocks.length > 0; else notInfoToMethod\">\n <ng-container *ngIf=\"containsBlock(this.payments[0].method.code) as bloque; else notInfoToMethod\">\n <div class=\"wrap my-4 card-body\" [id]=\"bloque.code\">\n <div class=\"row\">\n <div class=\"col-md-12 col-12\">\n <h5 [class]=\"bloque.code+'-title'\">{{ (bloque?.translations[consts.getLocale()]?.name ?\n bloque.translations[consts.getLocale()].name :\n 'thanks-for-buying') | translate\n | uppercase }}</h5>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12 col-12 text-start\">\n <app-blocks-ec [section]=\"'info_metodo_pago'\" [blockFilters]=\"this.payments[0].method.code\">\n </app-blocks-ec>\n <div class=\"d-flex flex-column details\">\n <p class=\"card-text\">{{ ('number' | translate) + ': ' + params.external_reference }}</p>\n <p class=\"card-text\">\n {{ isBalanceInAccount(payments[0].method.code) ?\n ('balance-in-account-message' | translate) :\n ((params.payment_status || 'pending') | translate) }}\n </p>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n <ng-template #notInfoToMethod>\n <ng-template #defaultMessage>\n <div class=\"wrap my-4 card-body\">\n <div class=\"row\">\n <div class=\"col-md-12 col-12\">\n <h5 class=\"card-title titpage center-block text-center\">\n {{ 'thanks-for-buying' | translate | uppercase }}\n </h5>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12 col-12 text-center py-3\">\n <h4 class=\"thanks-details\">{{ 'thanks-details' | translate }}</h4>\n <h5 class=\"number\">{{ ('number' | translate) + ': ' + params.external_reference }}</h5>\n <h5 class=\"pending\">\n {{ isBalanceInAccount(payments[0].method.code) ?\n ('balance-in-account-message' | translate) :\n ((params.payment_status || 'pending') | translate) }}\n </h5>\n <!-- <h5 *ngIf=\"!from_mp\">{{ ('will_contact' | translate) }}</h5> -->\n\n <!-- <a routerLink=\"/collection\"><button class=\"comprar\">{{ 'continue-shopping' | translate }}</button></a> -->\n </div>\n </div>\n </div>\n </ng-template>\n <ng-container [ngTemplateOutlet]=\"notInfoToMethodTemplate ? notInfoToMethodTemplate : defaultMessage\"\n [ngTemplateOutletContext]=\"{params:params}\">\n </ng-container>\n </ng-template>\n </div>\n</div>\n\n<ng-template #loading>\n <app-loading-full-ec></app-loading-full-ec>\n</ng-template>",
9135
+ template: "<div id=\"container\" class=\"flex-center generalContainer container-xl\">\n <div class=\"Main card my-2\" *ngIf=\"this.payments && this.payments[0].method.code; else loading\">\n <ng-container *ngIf=\"this.blocks && this.blocks.length > 0; else notInfoToMethod\">\n <ng-container *ngIf=\"containsBlock(this.payments[0].method.code) as bloque; else notInfoToMethod\">\n <div class=\"wrap my-4 card-body\" [id]=\"bloque.code\">\n <div class=\"row\">\n <div class=\"col-md-12 col-12\">\n <h5 [class]=\"bloque.code+'-title'\">{{ (bloque?.translations[consts.getLocale()]?.name ?\n bloque.translations[consts.getLocale()].name :\n 'thanks-for-buying') | translate\n | uppercase }}</h5>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12 col-12 text-start\">\n <app-blocks-ec [section]=\"'info_metodo_pago'\" [blockFilters]=\"this.payments[0].method.code\">\n </app-blocks-ec>\n <div class=\"d-flex flex-column details\">\n <p class=\"card-text\">{{ ('number' | translate) + ': ' + params.external_reference }}</p>\n <p class=\"card-text\">\n {{ isBalanceInAccount(payments[0].method.code) ?\n ('balance-in-account-message' | translate) :\n ((params.payment_status || 'pending') | translate) }}\n </p>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n <ng-template #notInfoToMethod>\n <ng-template #defaultMessage>\n <div class=\"wrap my-4 card-body\">\n <div class=\"row\">\n <div class=\"col-md-12 col-12\">\n <h5 class=\"card-title titpage center-block text-center\">\n {{ 'thanks-for-buying' | translate | uppercase }}\n </h5>\n </div>\n </div>\n <div class=\"row\">\n <div class=\"col-md-12 col-12 text-center py-3\">\n <h4 class=\"thanks-details\">{{ 'thanks-details' | translate }}</h4>\n <h5 class=\"number order-info-line\" [ngClass]=\"{ 'compact': paymentDate && totalAmount }\">{{ ('number' | translate) + ': ' + params.external_reference }}</h5>\n <h5 class=\"order-info-line\" *ngIf=\"paymentDate && totalAmount\">\n {{'payment-date' | translate }}: {{ paymentDate }}\n </h5>\n <h5 class=\"order-info-line\" *ngIf=\"paymentDate && totalAmount\">\n {{'total-paid' | translate }}: {{ totalAmount | ecCurrencySymbol }}\n </h5>\n <h5 class=\"pending\">\n {{ isBalanceInAccount(payments[0].method.code) ?\n ('balance-in-account-message' | translate) :\n ((params.payment_status || 'pending') | translate) }}\n </h5>\n <!-- <h5 *ngIf=\"!from_mp\">{{ ('will_contact' | translate) }}</h5> -->\n\n <!-- <a routerLink=\"/collection\"><button class=\"comprar\">{{ 'continue-shopping' | translate }}</button></a> -->\n </div>\n </div>\n </div>\n </ng-template>\n <ng-container [ngTemplateOutlet]=\"notInfoToMethodTemplate ? notInfoToMethodTemplate : defaultMessage\"\n [ngTemplateOutletContext]=\"{params:params}\">\n </ng-container>\n </ng-template>\n </div>\n</div>\n\n<ng-template #loading>\n <app-loading-full-ec></app-loading-full-ec>\n</ng-template>",
9116
9136
  styles: [""]
9117
9137
  })
9118
9138
  ], SuccessEcComponent);
@@ -11115,9 +11135,10 @@ var ProductDetailEcComponent = /** @class */ (function (_super) {
11115
11135
  _this.plus = function (stock, changeAmount, forceMultiple) {
11116
11136
  if (changeAmount === void 0) { changeAmount = 1; }
11117
11137
  if (forceMultiple === void 0) { forceMultiple = false; }
11118
- var newQuantity = _this.quantity + changeAmount;
11138
+ var currentQuantity = Number(_this.quantity);
11139
+ var newQuantity = currentQuantity + changeAmount;
11119
11140
  if (forceMultiple && changeAmount > 0) {
11120
- if (_this.quantity < changeAmount) {
11141
+ if (currentQuantity < changeAmount) {
11121
11142
  newQuantity = changeAmount;
11122
11143
  }
11123
11144
  else {
@@ -13791,8 +13812,8 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
13791
13812
  RegisterFormEcComponent.prototype.ngOnInit = function () {
13792
13813
  var _this = this;
13793
13814
  this.registerForm = this.formBuilder.group({
13794
- firstName: ['', Validators.required],
13795
- lastName: ['', Validators.required],
13815
+ firstName: ['', [Validators.required, Validators.pattern(/^[A-Za-zÁÉÍÓÚáéíóúÑñ\s]+$/)]],
13816
+ lastName: ['', [Validators.required, Validators.pattern(/^[A-Za-zÁÉÍÓÚáéíóúÑñ\s]+$/)]],
13796
13817
  email: ['', Validators.required],
13797
13818
  plainPassword: ['', Validators.required],
13798
13819
  plainPassword2: ['', Validators.required],
@@ -14388,8 +14409,8 @@ var RegisterWholesalerFormEcComponent = /** @class */ (function (_super) {
14388
14409
  var _this = this;
14389
14410
  this.paramsService.parameters.subscribe(function (res) { return _this.params = res; });
14390
14411
  this.registerForm = this.formBuilder.group({
14391
- firstName: ['', [Validators.required]],
14392
- lastName: ['', [Validators.required]],
14412
+ firstName: ['', [Validators.required, Validators.pattern(/^[A-Za-zÁÉÍÓÚáéíóúÑñ\s]+$/)]],
14413
+ lastName: ['', [Validators.required, Validators.pattern(/^[A-Za-zÁÉÍÓÚáéíóúÑñ\s]+$/)]],
14393
14414
  documentType: [null, [Validators.required]],
14394
14415
  documentNumber: ['', [Validators.required]],
14395
14416
  email: ['', [Validators.required, Validators.email]],