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 +7 -0
- package/bundles/ng-easycommerce.umd.js +123 -24
- package/bundles/ng-easycommerce.umd.js.map +1 -1
- package/bundles/ng-easycommerce.umd.min.js +1 -1
- package/bundles/ng-easycommerce.umd.min.js.map +1 -1
- package/esm2015/lib/ec-component/auth-ec/register-form-ec/register-form-ec.component.js +94 -8
- package/esm5/lib/ec-component/auth-ec/register-form-ec/register-form-ec.component.js +109 -8
- package/fesm2015/ng-easycommerce.js +90 -6
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +123 -24
- package/fesm5/ng-easycommerce.js.map +1 -1
- package/lib/ec-component/auth-ec/register-form-ec/register-form-ec.component.d.ts +17 -3
- package/ng-easycommerce.metadata.json +1 -1
- package/package.json +1 -1
package/fesm5/ng-easycommerce.js
CHANGED
|
@@ -13564,6 +13564,17 @@ var __extends$O = (this && this.__extends) || (function () {
|
|
|
13564
13564
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13565
13565
|
};
|
|
13566
13566
|
})();
|
|
13567
|
+
var __assign$r = (this && this.__assign) || function () {
|
|
13568
|
+
__assign$r = Object.assign || function(t) {
|
|
13569
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
13570
|
+
s = arguments[i];
|
|
13571
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
13572
|
+
t[p] = s[p];
|
|
13573
|
+
}
|
|
13574
|
+
return t;
|
|
13575
|
+
};
|
|
13576
|
+
return __assign$r.apply(this, arguments);
|
|
13577
|
+
};
|
|
13567
13578
|
var __decorate$1n = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
13568
13579
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13569
13580
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13572,7 +13583,7 @@ var __decorate$1n = (this && this.__decorate) || function (decorators, target, k
|
|
|
13572
13583
|
};
|
|
13573
13584
|
var RegisterFormEcComponent = /** @class */ (function (_super) {
|
|
13574
13585
|
__extends$O(RegisterFormEcComponent, _super);
|
|
13575
|
-
function RegisterFormEcComponent(authService, toastr, router, analyticsService, formBuilder, channelConfigService) {
|
|
13586
|
+
function RegisterFormEcComponent(authService, toastr, router, analyticsService, formBuilder, channelConfigService, consts) {
|
|
13576
13587
|
var _this = _super.call(this) || this;
|
|
13577
13588
|
_this.authService = authService;
|
|
13578
13589
|
_this.toastr = toastr;
|
|
@@ -13580,6 +13591,13 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
|
|
|
13580
13591
|
_this.analyticsService = analyticsService;
|
|
13581
13592
|
_this.formBuilder = formBuilder;
|
|
13582
13593
|
_this.channelConfigService = channelConfigService;
|
|
13594
|
+
_this.consts = consts;
|
|
13595
|
+
_this.provincesSubject = new BehaviorSubject([]);
|
|
13596
|
+
_this.countriesSubject = new BehaviorSubject([]);
|
|
13597
|
+
_this.documentTypesSubject = new BehaviorSubject([]);
|
|
13598
|
+
_this.provinces$ = _this.provincesSubject.asObservable();
|
|
13599
|
+
_this.countries$ = _this.countriesSubject.asObservable();
|
|
13600
|
+
_this.documentTypes$ = _this.documentTypesSubject.asObservable();
|
|
13583
13601
|
_this.isLogged = true;
|
|
13584
13602
|
_this.darkMode = false;
|
|
13585
13603
|
_this.redirect = true;
|
|
@@ -13621,7 +13639,8 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
|
|
|
13621
13639
|
return;
|
|
13622
13640
|
}
|
|
13623
13641
|
if (_this.registerForm.valid) {
|
|
13624
|
-
_this.
|
|
13642
|
+
var normalizedData = _this.normalizeRegisterData(_this.registerForm.value);
|
|
13643
|
+
_this.authService.signUp(normalizedData).toPromise().then(function (res) {
|
|
13625
13644
|
_this.register_loading = false;
|
|
13626
13645
|
var messageKey;
|
|
13627
13646
|
switch (true) {
|
|
@@ -13663,6 +13682,18 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
|
|
|
13663
13682
|
_this.register_loading = false;
|
|
13664
13683
|
}
|
|
13665
13684
|
};
|
|
13685
|
+
_this.onCountrySelected = function (value) {
|
|
13686
|
+
$('#selectOpPais').attr('disabled', true);
|
|
13687
|
+
_this.registerForm.controls['countryCode'].setValue(value);
|
|
13688
|
+
_this.registerForm.controls['provinceCode'].setValue('');
|
|
13689
|
+
value != '' && _this.provincesSubject.next(_this.countriesSubject.value.find(function (country) { return country.code == value; }).provinces);
|
|
13690
|
+
};
|
|
13691
|
+
_this.onGenderSelected = function (value) {
|
|
13692
|
+
$('#selectOpSexo').attr('disabled', true);
|
|
13693
|
+
};
|
|
13694
|
+
_this.onProvincesSelected = function (value) {
|
|
13695
|
+
$('#selectOpProvincia').attr('disabled', true);
|
|
13696
|
+
};
|
|
13666
13697
|
_this.ecOnConstruct();
|
|
13667
13698
|
return _this;
|
|
13668
13699
|
}
|
|
@@ -13676,7 +13707,40 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
|
|
|
13676
13707
|
plainPassword2: ['', Validators.required],
|
|
13677
13708
|
newsletter: [false],
|
|
13678
13709
|
terms: ['', Validators.required],
|
|
13679
|
-
birthday: [
|
|
13710
|
+
birthday: [null, [this.optionalMaxLengthValidator(11)]],
|
|
13711
|
+
// Dirección (opcional, pero si se envía, se recomienda enviar todos los campos internos)
|
|
13712
|
+
countryCode: [''],
|
|
13713
|
+
provinceCode: [null],
|
|
13714
|
+
street: [null],
|
|
13715
|
+
city: [''],
|
|
13716
|
+
postcode: [''],
|
|
13717
|
+
// Datos empresa (opcionales)
|
|
13718
|
+
companyName: [''],
|
|
13719
|
+
legalDenomination: [''],
|
|
13720
|
+
// Datos personales adicionales (opcionales)
|
|
13721
|
+
gender: [null],
|
|
13722
|
+
phoneNumber: ['', [Validators.pattern('[0-9]+')]],
|
|
13723
|
+
subscribedToNewsletter: [false],
|
|
13724
|
+
documentType: [null],
|
|
13725
|
+
documentNumber: [''],
|
|
13726
|
+
// Comentarios y contacto (opcionales)
|
|
13727
|
+
comments: ['', []],
|
|
13728
|
+
contactFirstName: ['', []],
|
|
13729
|
+
contactLastName: ['', []],
|
|
13730
|
+
contactCompanyPosition: ['', []],
|
|
13731
|
+
contactEmail: ['', []],
|
|
13732
|
+
contactDocumentType: ['', []],
|
|
13733
|
+
contactDocumentNumber: ['', []],
|
|
13734
|
+
}, {
|
|
13735
|
+
validators: [this.direccionCompletaValidator()]
|
|
13736
|
+
});
|
|
13737
|
+
this.authService.getCountriesData().then(function (res) {
|
|
13738
|
+
_this.countriesSubject.next(res);
|
|
13739
|
+
var documentTypes = [];
|
|
13740
|
+
res.map(function (paises) {
|
|
13741
|
+
_this.consts.getLocale().toLocaleLowerCase().includes(paises.code.toLocaleLowerCase()) && (documentTypes = paises.documentTypes || []);
|
|
13742
|
+
});
|
|
13743
|
+
_this.documentTypesSubject.next(documentTypes);
|
|
13680
13744
|
});
|
|
13681
13745
|
this.channelConfigService.channelConfig$.subscribe(function (config) {
|
|
13682
13746
|
if (config && config.isAccountVerificationRequired !== undefined) {
|
|
@@ -13694,8 +13758,42 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
|
|
|
13694
13758
|
});
|
|
13695
13759
|
this.ecOnInit();
|
|
13696
13760
|
};
|
|
13697
|
-
RegisterFormEcComponent.prototype.
|
|
13698
|
-
|
|
13761
|
+
RegisterFormEcComponent.prototype.direccionCompletaValidator = function () {
|
|
13762
|
+
return function (control) {
|
|
13763
|
+
var _a, _b, _c, _d, _e;
|
|
13764
|
+
var street = (_a = control.get('street')) === null || _a === void 0 ? void 0 : _a.value;
|
|
13765
|
+
var city = (_b = control.get('city')) === null || _b === void 0 ? void 0 : _b.value;
|
|
13766
|
+
var provinceCode = (_c = control.get('provinceCode')) === null || _c === void 0 ? void 0 : _c.value;
|
|
13767
|
+
var countryCode = (_d = control.get('countryCode')) === null || _d === void 0 ? void 0 : _d.value;
|
|
13768
|
+
var postcode = (_e = control.get('postcode')) === null || _e === void 0 ? void 0 : _e.value;
|
|
13769
|
+
var hasValue = function (val) { return val !== null && val !== undefined && val.toString().trim() !== ''; };
|
|
13770
|
+
var anyFieldSet = [street, city, provinceCode, countryCode, postcode].some(hasValue);
|
|
13771
|
+
var allFieldsSet = [street, city, provinceCode, countryCode, postcode].every(hasValue);
|
|
13772
|
+
// Si al menos un campo de dirección está establecido, todos deben estarlo
|
|
13773
|
+
// Si no hay ningún campo de dirección establecido, no se aplica la validación
|
|
13774
|
+
if (anyFieldSet && !allFieldsSet) {
|
|
13775
|
+
return { direccionIncompleta: true };
|
|
13776
|
+
}
|
|
13777
|
+
return null;
|
|
13778
|
+
};
|
|
13779
|
+
};
|
|
13780
|
+
RegisterFormEcComponent.prototype.optionalMaxLengthValidator = function (max) {
|
|
13781
|
+
return function (control) {
|
|
13782
|
+
if (!control.value)
|
|
13783
|
+
return null;
|
|
13784
|
+
return control.value.length > max ? { maxLength: true } : null;
|
|
13785
|
+
};
|
|
13786
|
+
};
|
|
13787
|
+
RegisterFormEcComponent.prototype.normalizeRegisterData = function (data) {
|
|
13788
|
+
var normalizeString = function (val) {
|
|
13789
|
+
return val === undefined || val === null || val.toString().trim() === '' ? null : val.toString().trim();
|
|
13790
|
+
};
|
|
13791
|
+
var normalizeBool = function (val) {
|
|
13792
|
+
return typeof val === 'boolean' ? val : val === 'true' ? true : val === 'false' ? false : null;
|
|
13793
|
+
};
|
|
13794
|
+
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),
|
|
13795
|
+
// Dirección
|
|
13796
|
+
countryCode: normalizeString(data.countryCode), provinceCode: normalizeString(data.provinceCode), street: normalizeString(data.street), city: normalizeString(data.city), postcode: normalizeString(data.postcode) });
|
|
13699
13797
|
};
|
|
13700
13798
|
RegisterFormEcComponent.ctorParameters = function () { return [
|
|
13701
13799
|
{ type: AuthService },
|
|
@@ -13703,7 +13801,8 @@ var RegisterFormEcComponent = /** @class */ (function (_super) {
|
|
|
13703
13801
|
{ type: Router },
|
|
13704
13802
|
{ type: AnalyticsService },
|
|
13705
13803
|
{ type: FormBuilder },
|
|
13706
|
-
{ type: ChannelConfigService }
|
|
13804
|
+
{ type: ChannelConfigService },
|
|
13805
|
+
{ type: Constants }
|
|
13707
13806
|
]; };
|
|
13708
13807
|
__decorate$1n([
|
|
13709
13808
|
Input()
|
|
@@ -14094,8 +14193,8 @@ var __extends$T = (this && this.__extends) || (function () {
|
|
|
14094
14193
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14095
14194
|
};
|
|
14096
14195
|
})();
|
|
14097
|
-
var __assign$
|
|
14098
|
-
__assign$
|
|
14196
|
+
var __assign$s = (this && this.__assign) || function () {
|
|
14197
|
+
__assign$s = Object.assign || function(t) {
|
|
14099
14198
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
14100
14199
|
s = arguments[i];
|
|
14101
14200
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -14103,7 +14202,7 @@ var __assign$r = (this && this.__assign) || function () {
|
|
|
14103
14202
|
}
|
|
14104
14203
|
return t;
|
|
14105
14204
|
};
|
|
14106
|
-
return __assign$
|
|
14205
|
+
return __assign$s.apply(this, arguments);
|
|
14107
14206
|
};
|
|
14108
14207
|
var __decorate$1s = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
14109
14208
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -14167,7 +14266,7 @@ var RegisterWholesalerFormEcComponent = /** @class */ (function (_super) {
|
|
|
14167
14266
|
_this.register_loading = true;
|
|
14168
14267
|
if (_this.registerForm.valid) {
|
|
14169
14268
|
// Convertir postcode a string antes de enviar
|
|
14170
|
-
var formValue = __assign$
|
|
14269
|
+
var formValue = __assign$s(__assign$s({}, _this.registerForm.value), { postcode: String(_this.registerForm.value.postcode) });
|
|
14171
14270
|
_this.authService.signUpWholesaler(formValue).toPromise().then(function (res) {
|
|
14172
14271
|
_this.register_loading = false;
|
|
14173
14272
|
_this.toastr.show('register-ok');
|
|
@@ -15651,8 +15750,8 @@ var __extends$11 = (this && this.__extends) || (function () {
|
|
|
15651
15750
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15652
15751
|
};
|
|
15653
15752
|
})();
|
|
15654
|
-
var __assign$
|
|
15655
|
-
__assign$
|
|
15753
|
+
var __assign$t = (this && this.__assign) || function () {
|
|
15754
|
+
__assign$t = Object.assign || function(t) {
|
|
15656
15755
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
15657
15756
|
s = arguments[i];
|
|
15658
15757
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -15660,7 +15759,7 @@ var __assign$s = (this && this.__assign) || function () {
|
|
|
15660
15759
|
}
|
|
15661
15760
|
return t;
|
|
15662
15761
|
};
|
|
15663
|
-
return __assign$
|
|
15762
|
+
return __assign$t.apply(this, arguments);
|
|
15664
15763
|
};
|
|
15665
15764
|
var __decorate$1C = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15666
15765
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -15707,7 +15806,7 @@ var SelectChannelEcComponent = /** @class */ (function (_super) {
|
|
|
15707
15806
|
var _this = this;
|
|
15708
15807
|
this.subs = this.authService.channelsUser.pipe(filter(function (res) { return res != null && res.length > 0; })).subscribe(function (res) {
|
|
15709
15808
|
_this.channels = res.map(function (item) {
|
|
15710
|
-
return __assign$
|
|
15809
|
+
return __assign$t(__assign$t({}, item), { selected: false });
|
|
15711
15810
|
});
|
|
15712
15811
|
_this.initializeTemplate();
|
|
15713
15812
|
});
|
|
@@ -16926,8 +17025,8 @@ var __extends$16 = (this && this.__extends) || (function () {
|
|
|
16926
17025
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16927
17026
|
};
|
|
16928
17027
|
})();
|
|
16929
|
-
var __assign$
|
|
16930
|
-
__assign$
|
|
17028
|
+
var __assign$u = (this && this.__assign) || function () {
|
|
17029
|
+
__assign$u = Object.assign || function(t) {
|
|
16931
17030
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
16932
17031
|
s = arguments[i];
|
|
16933
17032
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -16935,7 +17034,7 @@ var __assign$t = (this && this.__assign) || function () {
|
|
|
16935
17034
|
}
|
|
16936
17035
|
return t;
|
|
16937
17036
|
};
|
|
16938
|
-
return __assign$
|
|
17037
|
+
return __assign$u.apply(this, arguments);
|
|
16939
17038
|
};
|
|
16940
17039
|
var __decorate$1L = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
16941
17040
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -16979,7 +17078,7 @@ var ProductFoundEcComponent = /** @class */ (function (_super) {
|
|
|
16979
17078
|
window.scroll(0, 0);
|
|
16980
17079
|
});
|
|
16981
17080
|
_this.productService.product$.pipe(filter(function (data) { return data && data.id && data.id != 0; })).subscribe(function (productParam) {
|
|
16982
|
-
_this.analyticsService.callEvent('view_item', __assign$
|
|
17081
|
+
_this.analyticsService.callEvent('view_item', __assign$u(__assign$u({}, productParam), { currency: _this.consts.currency.code }));
|
|
16983
17082
|
});
|
|
16984
17083
|
_this.ecOnConstruct();
|
|
16985
17084
|
return _this;
|
|
@@ -18162,8 +18261,8 @@ var BancardCatastroEcComponent = /** @class */ (function (_super) {
|
|
|
18162
18261
|
return BancardCatastroEcComponent;
|
|
18163
18262
|
}(ComponentHelper));
|
|
18164
18263
|
|
|
18165
|
-
var __assign$
|
|
18166
|
-
__assign$
|
|
18264
|
+
var __assign$v = (this && this.__assign) || function () {
|
|
18265
|
+
__assign$v = Object.assign || function(t) {
|
|
18167
18266
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18168
18267
|
s = arguments[i];
|
|
18169
18268
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -18171,7 +18270,7 @@ var __assign$u = (this && this.__assign) || function () {
|
|
|
18171
18270
|
}
|
|
18172
18271
|
return t;
|
|
18173
18272
|
};
|
|
18174
|
-
return __assign$
|
|
18273
|
+
return __assign$v.apply(this, arguments);
|
|
18175
18274
|
};
|
|
18176
18275
|
var __decorate$1U = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18177
18276
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -18238,7 +18337,7 @@ var CookiesService = /** @class */ (function () {
|
|
|
18238
18337
|
* @description realiza un merge con los valores por defecto para rellenar el objeto de cookies
|
|
18239
18338
|
*/
|
|
18240
18339
|
this.setDefaultParameters = function () {
|
|
18241
|
-
_this.cookies = __assign$
|
|
18340
|
+
_this.cookies = __assign$v(__assign$v({}, _this.defaultValues), _this.cookies);
|
|
18242
18341
|
};
|
|
18243
18342
|
/**
|
|
18244
18343
|
* @description procesa el parametro ingresado, para transformarlo en un atributo del objeto de cookies.
|
|
@@ -18259,7 +18358,7 @@ var CookiesService = /** @class */ (function () {
|
|
|
18259
18358
|
break;
|
|
18260
18359
|
case 'others':
|
|
18261
18360
|
!_this.cookies[attrName] ? _this.cookies[attrName] = {} : null;
|
|
18262
|
-
_this.cookies[attrName] = __assign$
|
|
18361
|
+
_this.cookies[attrName] = __assign$v(__assign$v({}, _this.cookies[attrName]), _this.othersAttrProcessing(element));
|
|
18263
18362
|
break;
|
|
18264
18363
|
case 'message':
|
|
18265
18364
|
_this.cookies[attrName] = _this.messageAttrProcessing(element);
|
|
@@ -18311,7 +18410,7 @@ var CookiesService = /** @class */ (function () {
|
|
|
18311
18410
|
break;
|
|
18312
18411
|
default:
|
|
18313
18412
|
//console.log(value)
|
|
18314
|
-
objReturn = __assign$
|
|
18413
|
+
objReturn = __assign$v(__assign$v({}, objReturn), _this.getObjByFormatType(objReturn.type, value));
|
|
18315
18414
|
break;
|
|
18316
18415
|
}
|
|
18317
18416
|
}
|