ng-easycommerce 0.0.625 → 0.0.626

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,10 @@
1
+ # version 0.0.626
2
+ - Se amplió el formulario de registro `register-form-ec.component` para incluir nuevos campos adicionales, simulando un flujo de registro tipo B2B.
3
+ - Ahora se envían opcionalmente los siguientes datos:
4
+ - Dirección completa del usuario (país, provincia, calle, ciudad y código postal)
5
+ - Fecha de cumpleaños (birthday)
6
+ - Datos personales adicionales (tipo y número de documento, teléfono, género)
7
+ - Información de contacto adicional y datos de empresa
1
8
  # version 0.0.625
2
9
  - 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
10
  - En `cart.service` se agregó la validación para asegurar que la cantidad ingresada sea múltiplo del valor permitido.
@@ -13550,6 +13550,17 @@
13550
13550
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13551
13551
  };
13552
13552
  })();
13553
+ var __assign$r = (this && this.__assign) || function () {
13554
+ __assign$r = Object.assign || function(t) {
13555
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
13556
+ s = arguments[i];
13557
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
13558
+ t[p] = s[p];
13559
+ }
13560
+ return t;
13561
+ };
13562
+ return __assign$r.apply(this, arguments);
13563
+ };
13553
13564
  var __decorate$1n = (this && this.__decorate) || function (decorators, target, key, desc) {
13554
13565
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
13555
13566
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -13558,7 +13569,7 @@
13558
13569
  };
13559
13570
  var RegisterFormEcComponent = /** @class */ (function (_super) {
13560
13571
  __extends$O(RegisterFormEcComponent, _super);
13561
- function RegisterFormEcComponent(authService, toastr, router, analyticsService, formBuilder, channelConfigService) {
13572
+ function RegisterFormEcComponent(authService, toastr, router, analyticsService, formBuilder, channelConfigService, consts) {
13562
13573
  var _this = _super.call(this) || this;
13563
13574
  _this.authService = authService;
13564
13575
  _this.toastr = toastr;
@@ -13566,6 +13577,13 @@
13566
13577
  _this.analyticsService = analyticsService;
13567
13578
  _this.formBuilder = formBuilder;
13568
13579
  _this.channelConfigService = channelConfigService;
13580
+ _this.consts = consts;
13581
+ _this.provincesSubject = new rxjs.BehaviorSubject([]);
13582
+ _this.countriesSubject = new rxjs.BehaviorSubject([]);
13583
+ _this.documentTypesSubject = new rxjs.BehaviorSubject([]);
13584
+ _this.provinces$ = _this.provincesSubject.asObservable();
13585
+ _this.countries$ = _this.countriesSubject.asObservable();
13586
+ _this.documentTypes$ = _this.documentTypesSubject.asObservable();
13569
13587
  _this.isLogged = true;
13570
13588
  _this.darkMode = false;
13571
13589
  _this.redirect = true;
@@ -13607,7 +13625,8 @@
13607
13625
  return;
13608
13626
  }
13609
13627
  if (_this.registerForm.valid) {
13610
- _this.authService.signUp(_this.registerForm.value).toPromise().then(function (res) {
13628
+ var normalizedData = _this.normalizeRegisterData(_this.registerForm.value);
13629
+ _this.authService.signUp(normalizedData).toPromise().then(function (res) {
13611
13630
  _this.register_loading = false;
13612
13631
  var messageKey;
13613
13632
  switch (true) {
@@ -13649,6 +13668,18 @@
13649
13668
  _this.register_loading = false;
13650
13669
  }
13651
13670
  };
13671
+ _this.onCountrySelected = function (value) {
13672
+ $('#selectOpPais').attr('disabled', true);
13673
+ _this.registerForm.controls['countryCode'].setValue(value);
13674
+ _this.registerForm.controls['provinceCode'].setValue('');
13675
+ value != '' && _this.provincesSubject.next(_this.countriesSubject.value.find(function (country) { return country.code == value; }).provinces);
13676
+ };
13677
+ _this.onGenderSelected = function (value) {
13678
+ $('#selectOpSexo').attr('disabled', true);
13679
+ };
13680
+ _this.onProvincesSelected = function (value) {
13681
+ $('#selectOpProvincia').attr('disabled', true);
13682
+ };
13652
13683
  _this.ecOnConstruct();
13653
13684
  return _this;
13654
13685
  }
@@ -13662,7 +13693,40 @@
13662
13693
  plainPassword2: ['', forms.Validators.required],
13663
13694
  newsletter: [false],
13664
13695
  terms: ['', forms.Validators.required],
13665
- birthday: [''],
13696
+ birthday: [null, [this.optionalMaxLengthValidator(11)]],
13697
+ // Dirección (opcional, pero si se envía, se recomienda enviar todos los campos internos)
13698
+ countryCode: [''],
13699
+ provinceCode: [null],
13700
+ street: [null],
13701
+ city: [''],
13702
+ postcode: [''],
13703
+ // Datos empresa (opcionales)
13704
+ companyName: [''],
13705
+ legalDenomination: [''],
13706
+ // Datos personales adicionales (opcionales)
13707
+ gender: [null],
13708
+ phoneNumber: ['', [forms.Validators.pattern('[0-9]+')]],
13709
+ subscribedToNewsletter: [false],
13710
+ documentType: [null],
13711
+ documentNumber: [''],
13712
+ // Comentarios y contacto (opcionales)
13713
+ comments: ['', []],
13714
+ contactFirstName: ['', []],
13715
+ contactLastName: ['', []],
13716
+ contactCompanyPosition: ['', []],
13717
+ contactEmail: ['', []],
13718
+ contactDocumentType: ['', []],
13719
+ contactDocumentNumber: ['', []],
13720
+ }, {
13721
+ validators: [this.direccionCompletaValidator()]
13722
+ });
13723
+ this.authService.getCountriesData().then(function (res) {
13724
+ _this.countriesSubject.next(res);
13725
+ var documentTypes = [];
13726
+ res.map(function (paises) {
13727
+ _this.consts.getLocale().toLocaleLowerCase().includes(paises.code.toLocaleLowerCase()) && (documentTypes = paises.documentTypes || []);
13728
+ });
13729
+ _this.documentTypesSubject.next(documentTypes);
13666
13730
  });
13667
13731
  this.channelConfigService.channelConfig$.subscribe(function (config) {
13668
13732
  if (config && config.isAccountVerificationRequired !== undefined) {
@@ -13680,8 +13744,42 @@
13680
13744
  });
13681
13745
  this.ecOnInit();
13682
13746
  };
13683
- RegisterFormEcComponent.prototype.prueba = function () {
13684
- this.toastr.showPersistent('hola');
13747
+ RegisterFormEcComponent.prototype.direccionCompletaValidator = function () {
13748
+ return function (control) {
13749
+ var _a, _b, _c, _d, _e;
13750
+ var street = (_a = control.get('street')) === null || _a === void 0 ? void 0 : _a.value;
13751
+ var city = (_b = control.get('city')) === null || _b === void 0 ? void 0 : _b.value;
13752
+ var provinceCode = (_c = control.get('provinceCode')) === null || _c === void 0 ? void 0 : _c.value;
13753
+ var countryCode = (_d = control.get('countryCode')) === null || _d === void 0 ? void 0 : _d.value;
13754
+ var postcode = (_e = control.get('postcode')) === null || _e === void 0 ? void 0 : _e.value;
13755
+ var hasValue = function (val) { return val !== null && val !== undefined && val.toString().trim() !== ''; };
13756
+ var anyFieldSet = [street, city, provinceCode, countryCode, postcode].some(hasValue);
13757
+ var allFieldsSet = [street, city, provinceCode, countryCode, postcode].every(hasValue);
13758
+ // Si al menos un campo de dirección está establecido, todos deben estarlo
13759
+ // Si no hay ningún campo de dirección establecido, no se aplica la validación
13760
+ if (anyFieldSet && !allFieldsSet) {
13761
+ return { direccionIncompleta: true };
13762
+ }
13763
+ return null;
13764
+ };
13765
+ };
13766
+ RegisterFormEcComponent.prototype.optionalMaxLengthValidator = function (max) {
13767
+ return function (control) {
13768
+ if (!control.value)
13769
+ return null;
13770
+ return control.value.length > max ? { maxLength: true } : null;
13771
+ };
13772
+ };
13773
+ RegisterFormEcComponent.prototype.normalizeRegisterData = function (data) {
13774
+ var normalizeString = function (val) {
13775
+ return val === undefined || val === null || val.toString().trim() === '' ? null : val.toString().trim();
13776
+ };
13777
+ var normalizeBool = function (val) {
13778
+ return typeof val === 'boolean' ? val : val === 'true' ? true : val === 'false' ? false : null;
13779
+ };
13780
+ 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),
13781
+ // Dirección
13782
+ countryCode: normalizeString(data.countryCode), provinceCode: normalizeString(data.provinceCode), street: normalizeString(data.street), city: normalizeString(data.city), postcode: normalizeString(data.postcode) });
13685
13783
  };
13686
13784
  RegisterFormEcComponent.ctorParameters = function () { return [
13687
13785
  { type: AuthService },
@@ -13689,7 +13787,8 @@
13689
13787
  { type: router.Router },
13690
13788
  { type: AnalyticsService },
13691
13789
  { type: forms.FormBuilder },
13692
- { type: ChannelConfigService }
13790
+ { type: ChannelConfigService },
13791
+ { type: Constants }
13693
13792
  ]; };
13694
13793
  __decorate$1n([
13695
13794
  core.Input()
@@ -14080,8 +14179,8 @@
14080
14179
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14081
14180
  };
14082
14181
  })();
14083
- var __assign$r = (this && this.__assign) || function () {
14084
- __assign$r = Object.assign || function(t) {
14182
+ var __assign$s = (this && this.__assign) || function () {
14183
+ __assign$s = Object.assign || function(t) {
14085
14184
  for (var s, i = 1, n = arguments.length; i < n; i++) {
14086
14185
  s = arguments[i];
14087
14186
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -14089,7 +14188,7 @@
14089
14188
  }
14090
14189
  return t;
14091
14190
  };
14092
- return __assign$r.apply(this, arguments);
14191
+ return __assign$s.apply(this, arguments);
14093
14192
  };
14094
14193
  var __decorate$1s = (this && this.__decorate) || function (decorators, target, key, desc) {
14095
14194
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -14153,7 +14252,7 @@
14153
14252
  _this.register_loading = true;
14154
14253
  if (_this.registerForm.valid) {
14155
14254
  // Convertir postcode a string antes de enviar
14156
- var formValue = __assign$r(__assign$r({}, _this.registerForm.value), { postcode: String(_this.registerForm.value.postcode) });
14255
+ var formValue = __assign$s(__assign$s({}, _this.registerForm.value), { postcode: String(_this.registerForm.value.postcode) });
14157
14256
  _this.authService.signUpWholesaler(formValue).toPromise().then(function (res) {
14158
14257
  _this.register_loading = false;
14159
14258
  _this.toastr.show('register-ok');
@@ -15637,8 +15736,8 @@
15637
15736
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15638
15737
  };
15639
15738
  })();
15640
- var __assign$s = (this && this.__assign) || function () {
15641
- __assign$s = Object.assign || function(t) {
15739
+ var __assign$t = (this && this.__assign) || function () {
15740
+ __assign$t = Object.assign || function(t) {
15642
15741
  for (var s, i = 1, n = arguments.length; i < n; i++) {
15643
15742
  s = arguments[i];
15644
15743
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -15646,7 +15745,7 @@
15646
15745
  }
15647
15746
  return t;
15648
15747
  };
15649
- return __assign$s.apply(this, arguments);
15748
+ return __assign$t.apply(this, arguments);
15650
15749
  };
15651
15750
  var __decorate$1C = (this && this.__decorate) || function (decorators, target, key, desc) {
15652
15751
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -15693,7 +15792,7 @@
15693
15792
  var _this = this;
15694
15793
  this.subs = this.authService.channelsUser.pipe(operators.filter(function (res) { return res != null && res.length > 0; })).subscribe(function (res) {
15695
15794
  _this.channels = res.map(function (item) {
15696
- return __assign$s(__assign$s({}, item), { selected: false });
15795
+ return __assign$t(__assign$t({}, item), { selected: false });
15697
15796
  });
15698
15797
  _this.initializeTemplate();
15699
15798
  });
@@ -16912,8 +17011,8 @@
16912
17011
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
16913
17012
  };
16914
17013
  })();
16915
- var __assign$t = (this && this.__assign) || function () {
16916
- __assign$t = Object.assign || function(t) {
17014
+ var __assign$u = (this && this.__assign) || function () {
17015
+ __assign$u = Object.assign || function(t) {
16917
17016
  for (var s, i = 1, n = arguments.length; i < n; i++) {
16918
17017
  s = arguments[i];
16919
17018
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -16921,7 +17020,7 @@
16921
17020
  }
16922
17021
  return t;
16923
17022
  };
16924
- return __assign$t.apply(this, arguments);
17023
+ return __assign$u.apply(this, arguments);
16925
17024
  };
16926
17025
  var __decorate$1L = (this && this.__decorate) || function (decorators, target, key, desc) {
16927
17026
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -16965,7 +17064,7 @@
16965
17064
  window.scroll(0, 0);
16966
17065
  });
16967
17066
  _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 }));
17067
+ _this.analyticsService.callEvent('view_item', __assign$u(__assign$u({}, productParam), { currency: _this.consts.currency.code }));
16969
17068
  });
16970
17069
  _this.ecOnConstruct();
16971
17070
  return _this;
@@ -18148,8 +18247,8 @@
18148
18247
  return BancardCatastroEcComponent;
18149
18248
  }(ComponentHelper));
18150
18249
 
18151
- var __assign$u = (this && this.__assign) || function () {
18152
- __assign$u = Object.assign || function(t) {
18250
+ var __assign$v = (this && this.__assign) || function () {
18251
+ __assign$v = Object.assign || function(t) {
18153
18252
  for (var s, i = 1, n = arguments.length; i < n; i++) {
18154
18253
  s = arguments[i];
18155
18254
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
@@ -18157,7 +18256,7 @@
18157
18256
  }
18158
18257
  return t;
18159
18258
  };
18160
- return __assign$u.apply(this, arguments);
18259
+ return __assign$v.apply(this, arguments);
18161
18260
  };
18162
18261
  var __decorate$1U = (this && this.__decorate) || function (decorators, target, key, desc) {
18163
18262
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -18224,7 +18323,7 @@
18224
18323
  * @description realiza un merge con los valores por defecto para rellenar el objeto de cookies
18225
18324
  */
18226
18325
  this.setDefaultParameters = function () {
18227
- _this.cookies = __assign$u(__assign$u({}, _this.defaultValues), _this.cookies);
18326
+ _this.cookies = __assign$v(__assign$v({}, _this.defaultValues), _this.cookies);
18228
18327
  };
18229
18328
  /**
18230
18329
  * @description procesa el parametro ingresado, para transformarlo en un atributo del objeto de cookies.
@@ -18245,7 +18344,7 @@
18245
18344
  break;
18246
18345
  case 'others':
18247
18346
  !_this.cookies[attrName] ? _this.cookies[attrName] = {} : null;
18248
- _this.cookies[attrName] = __assign$u(__assign$u({}, _this.cookies[attrName]), _this.othersAttrProcessing(element));
18347
+ _this.cookies[attrName] = __assign$v(__assign$v({}, _this.cookies[attrName]), _this.othersAttrProcessing(element));
18249
18348
  break;
18250
18349
  case 'message':
18251
18350
  _this.cookies[attrName] = _this.messageAttrProcessing(element);
@@ -18297,7 +18396,7 @@
18297
18396
  break;
18298
18397
  default:
18299
18398
  //console.log(value)
18300
- objReturn = __assign$u(__assign$u({}, objReturn), _this.getObjByFormatType(objReturn.type, value));
18399
+ objReturn = __assign$v(__assign$v({}, objReturn), _this.getObjByFormatType(objReturn.type, value));
18301
18400
  break;
18302
18401
  }
18303
18402
  }