ng-easycommerce 0.0.625 → 0.0.627

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 CHANGED
@@ -1,3 +1,12 @@
1
+ # version 0.0.627
2
+ - En el componente `filters-ec.component` se agrego un metodo `hasAppliedFilters` para verificar si hay filtros aplicados
3
+ # version 0.0.626
4
+ - Se amplió el formulario de registro `register-form-ec.component` para incluir nuevos campos adicionales, simulando un flujo de registro tipo B2B.
5
+ - Ahora se envían opcionalmente los siguientes datos:
6
+ - Dirección completa del usuario (país, provincia, calle, ciudad y código postal)
7
+ - Fecha de cumpleaños (birthday)
8
+ - Datos personales adicionales (tipo y número de documento, teléfono, género)
9
+ - Información de contacto adicional y datos de empresa
1
10
  # version 0.0.625
2
11
  - Se modifico la funcion `actualizarCantidad` en `cart-ec.component` y `sidebar-ec.component` para que tengan en cuenta la suma o resta de cantidades por múltiplos.
3
12
  - En `cart.service` se agregó la validación para asegurar que la cantidad ingresada sea múltiplo del valor permitido.
@@ -1576,10 +1576,10 @@
1576
1576
  // Genera los parámetros de la URL en base al rango de precios seleccionado
1577
1577
  _this.toUrlParams = function () {
1578
1578
  var params = '';
1579
- if (_this.currentMinPrice !== null) {
1579
+ if (_this.currentMinPrice !== null && _this.currentMinPrice !== _this.minPrice) {
1580
1580
  params += "&price_min=" + _this.currentMinPrice;
1581
1581
  }
1582
- if (_this.currentMaxPrice !== null) {
1582
+ if (_this.currentMaxPrice !== null && _this.currentMaxPrice !== _this.maxPrice) {
1583
1583
  params += "&price_max=" + _this.currentMaxPrice;
1584
1584
  }
1585
1585
  return params;
@@ -9602,6 +9602,25 @@
9602
9602
  filter.currentMinPrice = currentMin;
9603
9603
  }
9604
9604
  };
9605
+ FiltersEcComponent.prototype.hasAppliedFilters = function () {
9606
+ var _a, _b;
9607
+ return _b = (_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (filter) {
9608
+ var _a, _b, _c;
9609
+ if (((_b = (_a = filter).type) === null || _b === void 0 ? void 0 : _b.call(_a)) === 'price_range') {
9610
+ var minSet = filter.currentMinPrice !== null && filter.currentMinPrice !== 0;
9611
+ var maxSet = filter.currentMaxPrice !== null && filter.currentMaxPrice !== filter.maxPrice;
9612
+ if (minSet || maxSet) {
9613
+ return true;
9614
+ }
9615
+ }
9616
+ return (_c = filter.data) === null || _c === void 0 ? void 0 : _c.some(function (filterElement) {
9617
+ if (Array.isArray(filterElement.children)) {
9618
+ return filterElement.children.some(function (child) { return child.selected; });
9619
+ }
9620
+ return filterElement.selected;
9621
+ });
9622
+ }), (_b !== null && _b !== void 0 ? _b : false);
9623
+ };
9605
9624
  FiltersEcComponent.ctorParameters = function () { return [
9606
9625
  { type: Constants },
9607
9626
  { type: Document, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
@@ -13550,6 +13569,17 @@
13550
13569
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13551
13570
  };
13552
13571
  })();
13572
+ var __assign$r = (this && this.__assign) || function () {
13573
+ __assign$r = Object.assign || function(t) {
13574
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
13575
+ s = arguments[i];
13576
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
13577
+ t[p] = s[p];
13578
+ }
13579
+ return t;
13580
+ };
13581
+ return __assign$r.apply(this, arguments);
13582
+ };
13553
13583
  var __decorate$1n = (this && this.__decorate) || function (decorators, target, key, desc) {
13554
13584
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13555
13585
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -13558,7 +13588,7 @@
13558
13588
  };
13559
13589
  var RegisterFormEcComponent = /** @class */ (function (_super) {
13560
13590
  __extends$O(RegisterFormEcComponent, _super);
13561
- function RegisterFormEcComponent(authService, toastr, router, analyticsService, formBuilder, channelConfigService) {
13591
+ function RegisterFormEcComponent(authService, toastr, router, analyticsService, formBuilder, channelConfigService, consts) {
13562
13592
  var _this = _super.call(this) || this;
13563
13593
  _this.authService = authService;
13564
13594
  _this.toastr = toastr;
@@ -13566,6 +13596,13 @@
13566
13596
  _this.analyticsService = analyticsService;
13567
13597
  _this.formBuilder = formBuilder;
13568
13598
  _this.channelConfigService = channelConfigService;
13599
+ _this.consts = consts;
13600
+ _this.provincesSubject = new rxjs.BehaviorSubject([]);
13601
+ _this.countriesSubject = new rxjs.BehaviorSubject([]);
13602
+ _this.documentTypesSubject = new rxjs.BehaviorSubject([]);
13603
+ _this.provinces$ = _this.provincesSubject.asObservable();
13604
+ _this.countries$ = _this.countriesSubject.asObservable();
13605
+ _this.documentTypes$ = _this.documentTypesSubject.asObservable();
13569
13606
  _this.isLogged = true;
13570
13607
  _this.darkMode = false;
13571
13608
  _this.redirect = true;
@@ -13607,7 +13644,8 @@
13607
13644
  return;
13608
13645
  }
13609
13646
  if (_this.registerForm.valid) {
13610
- _this.authService.signUp(_this.registerForm.value).toPromise().then(function (res) {
13647
+ var normalizedData = _this.normalizeRegisterData(_this.registerForm.value);
13648
+ _this.authService.signUp(normalizedData).toPromise().then(function (res) {
13611
13649
  _this.register_loading = false;
13612
13650
  var messageKey;
13613
13651
  switch (true) {
@@ -13649,6 +13687,18 @@
13649
13687
  _this.register_loading = false;
13650
13688
  }
13651
13689
  };
13690
+ _this.onCountrySelected = function (value) {
13691
+ $('#selectOpPais').attr('disabled', true);
13692
+ _this.registerForm.controls['countryCode'].setValue(value);
13693
+ _this.registerForm.controls['provinceCode'].setValue('');
13694
+ value != '' && _this.provincesSubject.next(_this.countriesSubject.value.find(function (country) { return country.code == value; }).provinces);
13695
+ };
13696
+ _this.onGenderSelected = function (value) {
13697
+ $('#selectOpSexo').attr('disabled', true);
13698
+ };
13699
+ _this.onProvincesSelected = function (value) {
13700
+ $('#selectOpProvincia').attr('disabled', true);
13701
+ };
13652
13702
  _this.ecOnConstruct();
13653
13703
  return _this;
13654
13704
  }
@@ -13662,7 +13712,40 @@
13662
13712
  plainPassword2: ['', forms.Validators.required],
13663
13713
  newsletter: [false],
13664
13714
  terms: ['', forms.Validators.required],
13665
- birthday: [''],
13715
+ birthday: [null, [this.optionalMaxLengthValidator(11)]],
13716
+ // Dirección (opcional, pero si se envía, se recomienda enviar todos los campos internos)
13717
+ countryCode: [''],
13718
+ provinceCode: [null],
13719
+ street: [null],
13720
+ city: [''],
13721
+ postcode: [''],
13722
+ // Datos empresa (opcionales)
13723
+ companyName: [''],
13724
+ legalDenomination: [''],
13725
+ // Datos personales adicionales (opcionales)
13726
+ gender: [null],
13727
+ phoneNumber: ['', [forms.Validators.pattern('[0-9]+')]],
13728
+ subscribedToNewsletter: [false],
13729
+ documentType: [null],
13730
+ documentNumber: [''],
13731
+ // Comentarios y contacto (opcionales)
13732
+ comments: ['', []],
13733
+ contactFirstName: ['', []],
13734
+ contactLastName: ['', []],
13735
+ contactCompanyPosition: ['', []],
13736
+ contactEmail: ['', []],
13737
+ contactDocumentType: ['', []],
13738
+ contactDocumentNumber: ['', []],
13739
+ }, {
13740
+ validators: [this.direccionCompletaValidator()]
13741
+ });
13742
+ this.authService.getCountriesData().then(function (res) {
13743
+ _this.countriesSubject.next(res);
13744
+ var documentTypes = [];
13745
+ res.map(function (paises) {
13746
+ _this.consts.getLocale().toLocaleLowerCase().includes(paises.code.toLocaleLowerCase()) && (documentTypes = paises.documentTypes || []);
13747
+ });
13748
+ _this.documentTypesSubject.next(documentTypes);
13666
13749
  });
13667
13750
  this.channelConfigService.channelConfig$.subscribe(function (config) {
13668
13751
  if (config && config.isAccountVerificationRequired !== undefined) {
@@ -13680,8 +13763,42 @@
13680
13763
  });
13681
13764
  this.ecOnInit();
13682
13765
  };
13683
- RegisterFormEcComponent.prototype.prueba = function () {
13684
- this.toastr.showPersistent('hola');
13766
+ RegisterFormEcComponent.prototype.direccionCompletaValidator = function () {
13767
+ return function (control) {
13768
+ var _a, _b, _c, _d, _e;
13769
+ var street = (_a = control.get('street')) === null || _a === void 0 ? void 0 : _a.value;
13770
+ var city = (_b = control.get('city')) === null || _b === void 0 ? void 0 : _b.value;
13771
+ var provinceCode = (_c = control.get('provinceCode')) === null || _c === void 0 ? void 0 : _c.value;
13772
+ var countryCode = (_d = control.get('countryCode')) === null || _d === void 0 ? void 0 : _d.value;
13773
+ var postcode = (_e = control.get('postcode')) === null || _e === void 0 ? void 0 : _e.value;
13774
+ var hasValue = function (val) { return val !== null && val !== undefined && val.toString().trim() !== ''; };
13775
+ var anyFieldSet = [street, city, provinceCode, countryCode, postcode].some(hasValue);
13776
+ var allFieldsSet = [street, city, provinceCode, countryCode, postcode].every(hasValue);
13777
+ // Si al menos un campo de dirección está establecido, todos deben estarlo
13778
+ // Si no hay ningún campo de dirección establecido, no se aplica la validación
13779
+ if (anyFieldSet && !allFieldsSet) {
13780
+ return { direccionIncompleta: true };
13781
+ }
13782
+ return null;
13783
+ };
13784
+ };
13785
+ RegisterFormEcComponent.prototype.optionalMaxLengthValidator = function (max) {
13786
+ return function (control) {
13787
+ if (!control.value)
13788
+ return null;
13789
+ return control.value.length > max ? { maxLength: true } : null;
13790
+ };
13791
+ };
13792
+ RegisterFormEcComponent.prototype.normalizeRegisterData = function (data) {
13793
+ var normalizeString = function (val) {
13794
+ return val === undefined || val === null || val.toString().trim() === '' ? null : val.toString().trim();
13795
+ };
13796
+ var normalizeBool = function (val) {
13797
+ return typeof val === 'boolean' ? val : val === 'true' ? true : val === 'false' ? false : null;
13798
+ };
13799
+ return __assign$r(__assign$r({}, data), { birthday: normalizeString(data.birthday) || '', companyName: normalizeString(data.companyName), legalDenomination: normalizeString(data.legalDenomination), gender: normalizeString(data.gender), phoneNumber: normalizeString(data.phoneNumber), subscribedToNewsletter: normalizeBool(data.subscribedToNewsletter), documentType: normalizeString(data.documentType), documentNumber: normalizeString(data.documentNumber), comments: normalizeString(data.comments), contactFirstName: normalizeString(data.contactFirstName), contactLastName: normalizeString(data.contactLastName), contactCompanyPosition: normalizeString(data.contactCompanyPosition), contactEmail: normalizeString(data.contactEmail), contactDocumentType: normalizeString(data.contactDocumentType), contactDocumentNumber: normalizeString(data.contactDocumentNumber),
13800
+ // Dirección
13801
+ countryCode: normalizeString(data.countryCode), provinceCode: normalizeString(data.provinceCode), street: normalizeString(data.street), city: normalizeString(data.city), postcode: normalizeString(data.postcode) });
13685
13802
  };
13686
13803
  RegisterFormEcComponent.ctorParameters = function () { return [
13687
13804
  { type: AuthService },
@@ -13689,7 +13806,8 @@
13689
13806
  { type: router.Router },
13690
13807
  { type: AnalyticsService },
13691
13808
  { type: forms.FormBuilder },
13692
- { type: ChannelConfigService }
13809
+ { type: ChannelConfigService },
13810
+ { type: Constants }
13693
13811
  ]; };
13694
13812
  __decorate$1n([
13695
13813
  core.Input()
@@ -14080,8 +14198,8 @@
14080
14198
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14081
14199
  };
14082
14200
  })();
14083
- var __assign$r = (this && this.__assign) || function () {
14084
- __assign$r = Object.assign || function(t) {
14201
+ var __assign$s = (this && this.__assign) || function () {
14202
+ __assign$s = Object.assign || function(t) {
14085
14203
  for (var s, i = 1, n = arguments.length; i < n; i++) {
14086
14204
  s = arguments[i];
14087
14205
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -14089,7 +14207,7 @@
14089
14207
  }
14090
14208
  return t;
14091
14209
  };
14092
- return __assign$r.apply(this, arguments);
14210
+ return __assign$s.apply(this, arguments);
14093
14211
  };
14094
14212
  var __decorate$1s = (this && this.__decorate) || function (decorators, target, key, desc) {
14095
14213
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -14153,7 +14271,7 @@
14153
14271
  _this.register_loading = true;
14154
14272
  if (_this.registerForm.valid) {
14155
14273
  // Convertir postcode a string antes de enviar
14156
- var formValue = __assign$r(__assign$r({}, _this.registerForm.value), { postcode: String(_this.registerForm.value.postcode) });
14274
+ var formValue = __assign$s(__assign$s({}, _this.registerForm.value), { postcode: String(_this.registerForm.value.postcode) });
14157
14275
  _this.authService.signUpWholesaler(formValue).toPromise().then(function (res) {
14158
14276
  _this.register_loading = false;
14159
14277
  _this.toastr.show('register-ok');
@@ -15637,8 +15755,8 @@
15637
15755
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15638
15756
  };
15639
15757
  })();
15640
- var __assign$s = (this && this.__assign) || function () {
15641
- __assign$s = Object.assign || function(t) {
15758
+ var __assign$t = (this && this.__assign) || function () {
15759
+ __assign$t = Object.assign || function(t) {
15642
15760
  for (var s, i = 1, n = arguments.length; i < n; i++) {
15643
15761
  s = arguments[i];
15644
15762
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -15646,7 +15764,7 @@
15646
15764
  }
15647
15765
  return t;
15648
15766
  };
15649
- return __assign$s.apply(this, arguments);
15767
+ return __assign$t.apply(this, arguments);
15650
15768
  };
15651
15769
  var __decorate$1C = (this && this.__decorate) || function (decorators, target, key, desc) {
15652
15770
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -15693,7 +15811,7 @@
15693
15811
  var _this = this;
15694
15812
  this.subs = this.authService.channelsUser.pipe(operators.filter(function (res) { return res != null && res.length > 0; })).subscribe(function (res) {
15695
15813
  _this.channels = res.map(function (item) {
15696
- return __assign$s(__assign$s({}, item), { selected: false });
15814
+ return __assign$t(__assign$t({}, item), { selected: false });
15697
15815
  });
15698
15816
  _this.initializeTemplate();
15699
15817
  });
@@ -16912,8 +17030,8 @@
16912
17030
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16913
17031
  };
16914
17032
  })();
16915
- var __assign$t = (this && this.__assign) || function () {
16916
- __assign$t = Object.assign || function(t) {
17033
+ var __assign$u = (this && this.__assign) || function () {
17034
+ __assign$u = Object.assign || function(t) {
16917
17035
  for (var s, i = 1, n = arguments.length; i < n; i++) {
16918
17036
  s = arguments[i];
16919
17037
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -16921,7 +17039,7 @@
16921
17039
  }
16922
17040
  return t;
16923
17041
  };
16924
- return __assign$t.apply(this, arguments);
17042
+ return __assign$u.apply(this, arguments);
16925
17043
  };
16926
17044
  var __decorate$1L = (this && this.__decorate) || function (decorators, target, key, desc) {
16927
17045
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -16965,7 +17083,7 @@
16965
17083
  window.scroll(0, 0);
16966
17084
  });
16967
17085
  _this.productService.product$.pipe(operators.filter(function (data) { return data && data.id && data.id != 0; })).subscribe(function (productParam) {
16968
- _this.analyticsService.callEvent('view_item', __assign$t(__assign$t({}, productParam), { currency: _this.consts.currency.code }));
17086
+ _this.analyticsService.callEvent('view_item', __assign$u(__assign$u({}, productParam), { currency: _this.consts.currency.code }));
16969
17087
  });
16970
17088
  _this.ecOnConstruct();
16971
17089
  return _this;
@@ -18148,8 +18266,8 @@
18148
18266
  return BancardCatastroEcComponent;
18149
18267
  }(ComponentHelper));
18150
18268
 
18151
- var __assign$u = (this && this.__assign) || function () {
18152
- __assign$u = Object.assign || function(t) {
18269
+ var __assign$v = (this && this.__assign) || function () {
18270
+ __assign$v = Object.assign || function(t) {
18153
18271
  for (var s, i = 1, n = arguments.length; i < n; i++) {
18154
18272
  s = arguments[i];
18155
18273
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -18157,7 +18275,7 @@
18157
18275
  }
18158
18276
  return t;
18159
18277
  };
18160
- return __assign$u.apply(this, arguments);
18278
+ return __assign$v.apply(this, arguments);
18161
18279
  };
18162
18280
  var __decorate$1U = (this && this.__decorate) || function (decorators, target, key, desc) {
18163
18281
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -18224,7 +18342,7 @@
18224
18342
  * @description realiza un merge con los valores por defecto para rellenar el objeto de cookies
18225
18343
  */
18226
18344
  this.setDefaultParameters = function () {
18227
- _this.cookies = __assign$u(__assign$u({}, _this.defaultValues), _this.cookies);
18345
+ _this.cookies = __assign$v(__assign$v({}, _this.defaultValues), _this.cookies);
18228
18346
  };
18229
18347
  /**
18230
18348
  * @description procesa el parametro ingresado, para transformarlo en un atributo del objeto de cookies.
@@ -18245,7 +18363,7 @@
18245
18363
  break;
18246
18364
  case 'others':
18247
18365
  !_this.cookies[attrName] ? _this.cookies[attrName] = {} : null;
18248
- _this.cookies[attrName] = __assign$u(__assign$u({}, _this.cookies[attrName]), _this.othersAttrProcessing(element));
18366
+ _this.cookies[attrName] = __assign$v(__assign$v({}, _this.cookies[attrName]), _this.othersAttrProcessing(element));
18249
18367
  break;
18250
18368
  case 'message':
18251
18369
  _this.cookies[attrName] = _this.messageAttrProcessing(element);
@@ -18297,7 +18415,7 @@
18297
18415
  break;
18298
18416
  default:
18299
18417
  //console.log(value)
18300
- objReturn = __assign$u(__assign$u({}, objReturn), _this.getObjByFormatType(objReturn.type, value));
18418
+ objReturn = __assign$v(__assign$v({}, objReturn), _this.getObjByFormatType(objReturn.type, value));
18301
18419
  break;
18302
18420
  }
18303
18421
  }