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.
@@ -1590,10 +1590,10 @@ var PriceRangeFilter = /** @class */ (function (_super) {
1590
1590
  // Genera los parámetros de la URL en base al rango de precios seleccionado
1591
1591
  _this.toUrlParams = function () {
1592
1592
  var params = '';
1593
- if (_this.currentMinPrice !== null) {
1593
+ if (_this.currentMinPrice !== null && _this.currentMinPrice !== _this.minPrice) {
1594
1594
  params += "&price_min=" + _this.currentMinPrice;
1595
1595
  }
1596
- if (_this.currentMaxPrice !== null) {
1596
+ if (_this.currentMaxPrice !== null && _this.currentMaxPrice !== _this.maxPrice) {
1597
1597
  params += "&price_max=" + _this.currentMaxPrice;
1598
1598
  }
1599
1599
  return params;
@@ -9616,6 +9616,25 @@ var FiltersEcComponent = /** @class */ (function (_super) {
9616
9616
  filter.currentMinPrice = currentMin;
9617
9617
  }
9618
9618
  };
9619
+ FiltersEcComponent.prototype.hasAppliedFilters = function () {
9620
+ var _a, _b;
9621
+ return _b = (_a = this.filters) === null || _a === void 0 ? void 0 : _a.some(function (filter) {
9622
+ var _a, _b, _c;
9623
+ if (((_b = (_a = filter).type) === null || _b === void 0 ? void 0 : _b.call(_a)) === 'price_range') {
9624
+ var minSet = filter.currentMinPrice !== null && filter.currentMinPrice !== 0;
9625
+ var maxSet = filter.currentMaxPrice !== null && filter.currentMaxPrice !== filter.maxPrice;
9626
+ if (minSet || maxSet) {
9627
+ return true;
9628
+ }
9629
+ }
9630
+ return (_c = filter.data) === null || _c === void 0 ? void 0 : _c.some(function (filterElement) {
9631
+ if (Array.isArray(filterElement.children)) {
9632
+ return filterElement.children.some(function (child) { return child.selected; });
9633
+ }
9634
+ return filterElement.selected;
9635
+ });
9636
+ }), (_b !== null && _b !== void 0 ? _b : false);
9637
+ };
9619
9638
  FiltersEcComponent.ctorParameters = function () { return [
9620
9639
  { type: Constants },
9621
9640
  { type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
@@ -13564,6 +13583,17 @@ var __extends$O = (this && this.__extends) || (function () {
13564
13583
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13565
13584
  };
13566
13585
  })();
13586
+ var __assign$r = (this && this.__assign) || function () {
13587
+ __assign$r = Object.assign || function(t) {
13588
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
13589
+ s = arguments[i];
13590
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
13591
+ t[p] = s[p];
13592
+ }
13593
+ return t;
13594
+ };
13595
+ return __assign$r.apply(this, arguments);
13596
+ };
13567
13597
  var __decorate$1n = (this && this.__decorate) || function (decorators, target, key, desc) {
13568
13598
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13569
13599
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -13572,7 +13602,7 @@ var __decorate$1n = (this && this.__decorate) || function (decorators, target, k
13572
13602
  };
13573
13603
  var RegisterFormEcComponent = /** @class */ (function (_super) {
13574
13604
  __extends$O(RegisterFormEcComponent, _super);
13575
- function RegisterFormEcComponent(authService, toastr, router, analyticsService, formBuilder, channelConfigService) {
13605
+ function RegisterFormEcComponent(authService, toastr, router, analyticsService, formBuilder, channelConfigService, consts) {
13576
13606
  var _this = _super.call(this) || this;
13577
13607
  _this.authService = authService;
13578
13608
  _this.toastr = toastr;
@@ -13580,6 +13610,13 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
13580
13610
  _this.analyticsService = analyticsService;
13581
13611
  _this.formBuilder = formBuilder;
13582
13612
  _this.channelConfigService = channelConfigService;
13613
+ _this.consts = consts;
13614
+ _this.provincesSubject = new BehaviorSubject([]);
13615
+ _this.countriesSubject = new BehaviorSubject([]);
13616
+ _this.documentTypesSubject = new BehaviorSubject([]);
13617
+ _this.provinces$ = _this.provincesSubject.asObservable();
13618
+ _this.countries$ = _this.countriesSubject.asObservable();
13619
+ _this.documentTypes$ = _this.documentTypesSubject.asObservable();
13583
13620
  _this.isLogged = true;
13584
13621
  _this.darkMode = false;
13585
13622
  _this.redirect = true;
@@ -13621,7 +13658,8 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
13621
13658
  return;
13622
13659
  }
13623
13660
  if (_this.registerForm.valid) {
13624
- _this.authService.signUp(_this.registerForm.value).toPromise().then(function (res) {
13661
+ var normalizedData = _this.normalizeRegisterData(_this.registerForm.value);
13662
+ _this.authService.signUp(normalizedData).toPromise().then(function (res) {
13625
13663
  _this.register_loading = false;
13626
13664
  var messageKey;
13627
13665
  switch (true) {
@@ -13663,6 +13701,18 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
13663
13701
  _this.register_loading = false;
13664
13702
  }
13665
13703
  };
13704
+ _this.onCountrySelected = function (value) {
13705
+ $('#selectOpPais').attr('disabled', true);
13706
+ _this.registerForm.controls['countryCode'].setValue(value);
13707
+ _this.registerForm.controls['provinceCode'].setValue('');
13708
+ value != '' && _this.provincesSubject.next(_this.countriesSubject.value.find(function (country) { return country.code == value; }).provinces);
13709
+ };
13710
+ _this.onGenderSelected = function (value) {
13711
+ $('#selectOpSexo').attr('disabled', true);
13712
+ };
13713
+ _this.onProvincesSelected = function (value) {
13714
+ $('#selectOpProvincia').attr('disabled', true);
13715
+ };
13666
13716
  _this.ecOnConstruct();
13667
13717
  return _this;
13668
13718
  }
@@ -13676,7 +13726,40 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
13676
13726
  plainPassword2: ['', Validators.required],
13677
13727
  newsletter: [false],
13678
13728
  terms: ['', Validators.required],
13679
- birthday: [''],
13729
+ birthday: [null, [this.optionalMaxLengthValidator(11)]],
13730
+ // Dirección (opcional, pero si se envía, se recomienda enviar todos los campos internos)
13731
+ countryCode: [''],
13732
+ provinceCode: [null],
13733
+ street: [null],
13734
+ city: [''],
13735
+ postcode: [''],
13736
+ // Datos empresa (opcionales)
13737
+ companyName: [''],
13738
+ legalDenomination: [''],
13739
+ // Datos personales adicionales (opcionales)
13740
+ gender: [null],
13741
+ phoneNumber: ['', [Validators.pattern('[0-9]+')]],
13742
+ subscribedToNewsletter: [false],
13743
+ documentType: [null],
13744
+ documentNumber: [''],
13745
+ // Comentarios y contacto (opcionales)
13746
+ comments: ['', []],
13747
+ contactFirstName: ['', []],
13748
+ contactLastName: ['', []],
13749
+ contactCompanyPosition: ['', []],
13750
+ contactEmail: ['', []],
13751
+ contactDocumentType: ['', []],
13752
+ contactDocumentNumber: ['', []],
13753
+ }, {
13754
+ validators: [this.direccionCompletaValidator()]
13755
+ });
13756
+ this.authService.getCountriesData().then(function (res) {
13757
+ _this.countriesSubject.next(res);
13758
+ var documentTypes = [];
13759
+ res.map(function (paises) {
13760
+ _this.consts.getLocale().toLocaleLowerCase().includes(paises.code.toLocaleLowerCase()) && (documentTypes = paises.documentTypes || []);
13761
+ });
13762
+ _this.documentTypesSubject.next(documentTypes);
13680
13763
  });
13681
13764
  this.channelConfigService.channelConfig$.subscribe(function (config) {
13682
13765
  if (config && config.isAccountVerificationRequired !== undefined) {
@@ -13694,8 +13777,42 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
13694
13777
  });
13695
13778
  this.ecOnInit();
13696
13779
  };
13697
- RegisterFormEcComponent.prototype.prueba = function () {
13698
- this.toastr.showPersistent('hola');
13780
+ RegisterFormEcComponent.prototype.direccionCompletaValidator = function () {
13781
+ return function (control) {
13782
+ var _a, _b, _c, _d, _e;
13783
+ var street = (_a = control.get('street')) === null || _a === void 0 ? void 0 : _a.value;
13784
+ var city = (_b = control.get('city')) === null || _b === void 0 ? void 0 : _b.value;
13785
+ var provinceCode = (_c = control.get('provinceCode')) === null || _c === void 0 ? void 0 : _c.value;
13786
+ var countryCode = (_d = control.get('countryCode')) === null || _d === void 0 ? void 0 : _d.value;
13787
+ var postcode = (_e = control.get('postcode')) === null || _e === void 0 ? void 0 : _e.value;
13788
+ var hasValue = function (val) { return val !== null && val !== undefined && val.toString().trim() !== ''; };
13789
+ var anyFieldSet = [street, city, provinceCode, countryCode, postcode].some(hasValue);
13790
+ var allFieldsSet = [street, city, provinceCode, countryCode, postcode].every(hasValue);
13791
+ // Si al menos un campo de dirección está establecido, todos deben estarlo
13792
+ // Si no hay ningún campo de dirección establecido, no se aplica la validación
13793
+ if (anyFieldSet && !allFieldsSet) {
13794
+ return { direccionIncompleta: true };
13795
+ }
13796
+ return null;
13797
+ };
13798
+ };
13799
+ RegisterFormEcComponent.prototype.optionalMaxLengthValidator = function (max) {
13800
+ return function (control) {
13801
+ if (!control.value)
13802
+ return null;
13803
+ return control.value.length > max ? { maxLength: true } : null;
13804
+ };
13805
+ };
13806
+ RegisterFormEcComponent.prototype.normalizeRegisterData = function (data) {
13807
+ var normalizeString = function (val) {
13808
+ return val === undefined || val === null || val.toString().trim() === '' ? null : val.toString().trim();
13809
+ };
13810
+ var normalizeBool = function (val) {
13811
+ return typeof val === 'boolean' ? val : val === 'true' ? true : val === 'false' ? false : null;
13812
+ };
13813
+ 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),
13814
+ // Dirección
13815
+ countryCode: normalizeString(data.countryCode), provinceCode: normalizeString(data.provinceCode), street: normalizeString(data.street), city: normalizeString(data.city), postcode: normalizeString(data.postcode) });
13699
13816
  };
13700
13817
  RegisterFormEcComponent.ctorParameters = function () { return [
13701
13818
  { type: AuthService },
@@ -13703,7 +13820,8 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
13703
13820
  { type: Router },
13704
13821
  { type: AnalyticsService },
13705
13822
  { type: FormBuilder },
13706
- { type: ChannelConfigService }
13823
+ { type: ChannelConfigService },
13824
+ { type: Constants }
13707
13825
  ]; };
13708
13826
  __decorate$1n([
13709
13827
  Input()
@@ -14094,8 +14212,8 @@ var __extends$T = (this && this.__extends) || (function () {
14094
14212
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14095
14213
  };
14096
14214
  })();
14097
- var __assign$r = (this && this.__assign) || function () {
14098
- __assign$r = Object.assign || function(t) {
14215
+ var __assign$s = (this && this.__assign) || function () {
14216
+ __assign$s = Object.assign || function(t) {
14099
14217
  for (var s, i = 1, n = arguments.length; i < n; i++) {
14100
14218
  s = arguments[i];
14101
14219
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -14103,7 +14221,7 @@ var __assign$r = (this && this.__assign) || function () {
14103
14221
  }
14104
14222
  return t;
14105
14223
  };
14106
- return __assign$r.apply(this, arguments);
14224
+ return __assign$s.apply(this, arguments);
14107
14225
  };
14108
14226
  var __decorate$1s = (this && this.__decorate) || function (decorators, target, key, desc) {
14109
14227
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -14167,7 +14285,7 @@ var RegisterWholesalerFormEcComponent = /** @class */ (function (_super) {
14167
14285
  _this.register_loading = true;
14168
14286
  if (_this.registerForm.valid) {
14169
14287
  // Convertir postcode a string antes de enviar
14170
- var formValue = __assign$r(__assign$r({}, _this.registerForm.value), { postcode: String(_this.registerForm.value.postcode) });
14288
+ var formValue = __assign$s(__assign$s({}, _this.registerForm.value), { postcode: String(_this.registerForm.value.postcode) });
14171
14289
  _this.authService.signUpWholesaler(formValue).toPromise().then(function (res) {
14172
14290
  _this.register_loading = false;
14173
14291
  _this.toastr.show('register-ok');
@@ -15651,8 +15769,8 @@ var __extends$11 = (this && this.__extends) || (function () {
15651
15769
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15652
15770
  };
15653
15771
  })();
15654
- var __assign$s = (this && this.__assign) || function () {
15655
- __assign$s = Object.assign || function(t) {
15772
+ var __assign$t = (this && this.__assign) || function () {
15773
+ __assign$t = Object.assign || function(t) {
15656
15774
  for (var s, i = 1, n = arguments.length; i < n; i++) {
15657
15775
  s = arguments[i];
15658
15776
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -15660,7 +15778,7 @@ var __assign$s = (this && this.__assign) || function () {
15660
15778
  }
15661
15779
  return t;
15662
15780
  };
15663
- return __assign$s.apply(this, arguments);
15781
+ return __assign$t.apply(this, arguments);
15664
15782
  };
15665
15783
  var __decorate$1C = (this && this.__decorate) || function (decorators, target, key, desc) {
15666
15784
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -15707,7 +15825,7 @@ var SelectChannelEcComponent = /** @class */ (function (_super) {
15707
15825
  var _this = this;
15708
15826
  this.subs = this.authService.channelsUser.pipe(filter(function (res) { return res != null && res.length > 0; })).subscribe(function (res) {
15709
15827
  _this.channels = res.map(function (item) {
15710
- return __assign$s(__assign$s({}, item), { selected: false });
15828
+ return __assign$t(__assign$t({}, item), { selected: false });
15711
15829
  });
15712
15830
  _this.initializeTemplate();
15713
15831
  });
@@ -16926,8 +17044,8 @@ var __extends$16 = (this && this.__extends) || (function () {
16926
17044
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16927
17045
  };
16928
17046
  })();
16929
- var __assign$t = (this && this.__assign) || function () {
16930
- __assign$t = Object.assign || function(t) {
17047
+ var __assign$u = (this && this.__assign) || function () {
17048
+ __assign$u = Object.assign || function(t) {
16931
17049
  for (var s, i = 1, n = arguments.length; i < n; i++) {
16932
17050
  s = arguments[i];
16933
17051
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -16935,7 +17053,7 @@ var __assign$t = (this && this.__assign) || function () {
16935
17053
  }
16936
17054
  return t;
16937
17055
  };
16938
- return __assign$t.apply(this, arguments);
17056
+ return __assign$u.apply(this, arguments);
16939
17057
  };
16940
17058
  var __decorate$1L = (this && this.__decorate) || function (decorators, target, key, desc) {
16941
17059
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -16979,7 +17097,7 @@ var ProductFoundEcComponent = /** @class */ (function (_super) {
16979
17097
  window.scroll(0, 0);
16980
17098
  });
16981
17099
  _this.productService.product$.pipe(filter(function (data) { return data && data.id && data.id != 0; })).subscribe(function (productParam) {
16982
- _this.analyticsService.callEvent('view_item', __assign$t(__assign$t({}, productParam), { currency: _this.consts.currency.code }));
17100
+ _this.analyticsService.callEvent('view_item', __assign$u(__assign$u({}, productParam), { currency: _this.consts.currency.code }));
16983
17101
  });
16984
17102
  _this.ecOnConstruct();
16985
17103
  return _this;
@@ -18162,8 +18280,8 @@ var BancardCatastroEcComponent = /** @class */ (function (_super) {
18162
18280
  return BancardCatastroEcComponent;
18163
18281
  }(ComponentHelper));
18164
18282
 
18165
- var __assign$u = (this && this.__assign) || function () {
18166
- __assign$u = Object.assign || function(t) {
18283
+ var __assign$v = (this && this.__assign) || function () {
18284
+ __assign$v = Object.assign || function(t) {
18167
18285
  for (var s, i = 1, n = arguments.length; i < n; i++) {
18168
18286
  s = arguments[i];
18169
18287
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -18171,7 +18289,7 @@ var __assign$u = (this && this.__assign) || function () {
18171
18289
  }
18172
18290
  return t;
18173
18291
  };
18174
- return __assign$u.apply(this, arguments);
18292
+ return __assign$v.apply(this, arguments);
18175
18293
  };
18176
18294
  var __decorate$1U = (this && this.__decorate) || function (decorators, target, key, desc) {
18177
18295
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -18238,7 +18356,7 @@ var CookiesService = /** @class */ (function () {
18238
18356
  * @description realiza un merge con los valores por defecto para rellenar el objeto de cookies
18239
18357
  */
18240
18358
  this.setDefaultParameters = function () {
18241
- _this.cookies = __assign$u(__assign$u({}, _this.defaultValues), _this.cookies);
18359
+ _this.cookies = __assign$v(__assign$v({}, _this.defaultValues), _this.cookies);
18242
18360
  };
18243
18361
  /**
18244
18362
  * @description procesa el parametro ingresado, para transformarlo en un atributo del objeto de cookies.
@@ -18259,7 +18377,7 @@ var CookiesService = /** @class */ (function () {
18259
18377
  break;
18260
18378
  case 'others':
18261
18379
  !_this.cookies[attrName] ? _this.cookies[attrName] = {} : null;
18262
- _this.cookies[attrName] = __assign$u(__assign$u({}, _this.cookies[attrName]), _this.othersAttrProcessing(element));
18380
+ _this.cookies[attrName] = __assign$v(__assign$v({}, _this.cookies[attrName]), _this.othersAttrProcessing(element));
18263
18381
  break;
18264
18382
  case 'message':
18265
18383
  _this.cookies[attrName] = _this.messageAttrProcessing(element);
@@ -18311,7 +18429,7 @@ var CookiesService = /** @class */ (function () {
18311
18429
  break;
18312
18430
  default:
18313
18431
  //console.log(value)
18314
- objReturn = __assign$u(__assign$u({}, objReturn), _this.getObjByFormatType(objReturn.type, value));
18432
+ objReturn = __assign$v(__assign$v({}, objReturn), _this.getObjByFormatType(objReturn.type, value));
18315
18433
  break;
18316
18434
  }
18317
18435
  }