ng-easycommerce 0.0.624 → 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 +10 -0
- package/bundles/ng-easycommerce.umd.js +211 -61
- 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/esm2015/lib/ec-component/cart-ec/cart-ec.component.js +41 -23
- package/esm2015/lib/ec-component/sidebar-ec/sidebar-ec.component.js +42 -16
- package/esm2015/lib/services/cart.service.js +7 -1
- package/esm5/lib/ec-component/auth-ec/register-form-ec/register-form-ec.component.js +109 -8
- package/esm5/lib/ec-component/cart-ec/cart-ec.component.js +42 -23
- package/esm5/lib/ec-component/sidebar-ec/sidebar-ec.component.js +42 -16
- package/esm5/lib/services/cart.service.js +7 -1
- package/fesm2015/ng-easycommerce.js +177 -43
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +211 -61
- 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/lib/ec-component/cart-ec/cart-ec.component.d.ts +1 -1
- package/lib/ec-component/sidebar-ec/sidebar-ec.component.d.ts +1 -1
- package/ng-easycommerce.metadata.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
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
|
|
8
|
+
# version 0.0.625
|
|
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.
|
|
10
|
+
- En `cart.service` se agregó la validación para asegurar que la cantidad ingresada sea múltiplo del valor permitido.
|
|
1
11
|
# version 0.0.624
|
|
2
12
|
- Se modificaron las funciones `plus` y `less` en `product-detail.component` para que tengan en cuenta la suma o resta de cantidades por múltiplos.
|
|
3
13
|
- En `product-detail.service` se agregó la validación para asegurar que la cantidad ingresada sea múltiplo del valor permitido.
|
|
@@ -4893,6 +4893,12 @@
|
|
|
4893
4893
|
_this.toastrService.show('minimum-items-quantity', { quantity: item.product.variants[0].minimumItemsQuantity });
|
|
4894
4894
|
return false;
|
|
4895
4895
|
}
|
|
4896
|
+
if (item.product.variants[0].multipleQuantity && item.product.variants[0].multipleQuantity > 0) {
|
|
4897
|
+
if ((_this.getCountFromItemInCart(item.productCode) + quantity) % item.product.variants[0].multipleQuantity !== 0) {
|
|
4898
|
+
_this.toastrService.show('must-be-multiple', { quantity: item.product.variants[0].multipleQuantity });
|
|
4899
|
+
return false;
|
|
4900
|
+
}
|
|
4901
|
+
}
|
|
4896
4902
|
return true;
|
|
4897
4903
|
};
|
|
4898
4904
|
this.validatePriceAndCredits = function (item, quantity) {
|
|
@@ -7431,28 +7437,6 @@
|
|
|
7431
7437
|
_this.creditAccountShowPrices = null;
|
|
7432
7438
|
_this.showTaxLegend = false;
|
|
7433
7439
|
_this.toDecimal = function (amount) { return _this.consts.toDecimal(amount); };
|
|
7434
|
-
_this.actualizarCantidad = function (item, cantidad, stock, id) {
|
|
7435
|
-
if (id) {
|
|
7436
|
-
_this.isDisabled = true; // Actualiza la propiedad vinculada a `[disabled]`
|
|
7437
|
-
if (cantidad > 0 && cantidad <= stock) {
|
|
7438
|
-
_this.cartService.updateItemQuantity(item, cantidad);
|
|
7439
|
-
}
|
|
7440
|
-
else {
|
|
7441
|
-
_this.toastrService.show('out-of-stock-actually');
|
|
7442
|
-
}
|
|
7443
|
-
setTimeout(function () {
|
|
7444
|
-
_this.isDisabled = false;
|
|
7445
|
-
}, 1000);
|
|
7446
|
-
}
|
|
7447
|
-
else {
|
|
7448
|
-
if (cantidad > 0 && cantidad <= stock) {
|
|
7449
|
-
_this.cartService.updateItemQuantity(item, cantidad);
|
|
7450
|
-
}
|
|
7451
|
-
else {
|
|
7452
|
-
_this.toastrService.show('out-of-stock-actually');
|
|
7453
|
-
}
|
|
7454
|
-
}
|
|
7455
|
-
};
|
|
7456
7440
|
_this.redirectRegister = function () { return _this.router.navigateByUrl("/auth/login"); };
|
|
7457
7441
|
_this.getVariants = function (product) {
|
|
7458
7442
|
var item = product.product;
|
|
@@ -7529,6 +7513,47 @@
|
|
|
7529
7513
|
});
|
|
7530
7514
|
this.ecOnInit();
|
|
7531
7515
|
};
|
|
7516
|
+
CartEcComponent.prototype.actualizarCantidad = function (item, cantidad, stock, id) {
|
|
7517
|
+
var _this = this;
|
|
7518
|
+
var _a;
|
|
7519
|
+
var multipleQuantity = ((_a = item.product) === null || _a === void 0 ? void 0 : _a.variants) && item.product.variants.length > 0 ? item.product.variants[0].multipleQuantity : 0;
|
|
7520
|
+
var step = multipleQuantity && multipleQuantity > 0 ? multipleQuantity : 1;
|
|
7521
|
+
var newQuantity;
|
|
7522
|
+
if (typeof cantidad === 'string') {
|
|
7523
|
+
newQuantity = parseInt(cantidad, 10);
|
|
7524
|
+
if (newQuantity % step !== 0) {
|
|
7525
|
+
this.toastrService.show('must-be-multiple', { quantity: step });
|
|
7526
|
+
newQuantity = Math.round(newQuantity / step) * step;
|
|
7527
|
+
}
|
|
7528
|
+
}
|
|
7529
|
+
else {
|
|
7530
|
+
newQuantity = cantidad;
|
|
7531
|
+
if (newQuantity % step !== 0) {
|
|
7532
|
+
newQuantity = Math.round(newQuantity / step) * step;
|
|
7533
|
+
}
|
|
7534
|
+
}
|
|
7535
|
+
if (id) {
|
|
7536
|
+
this.isDisabled = true; // Actualiza la propiedad vinculada a `[disabled]`
|
|
7537
|
+
if (newQuantity > 0 && newQuantity <= stock) {
|
|
7538
|
+
this.cartService.updateItemQuantity(item, newQuantity);
|
|
7539
|
+
}
|
|
7540
|
+
else {
|
|
7541
|
+
this.toastrService.show('out-of-stock-actually');
|
|
7542
|
+
}
|
|
7543
|
+
setTimeout(function () {
|
|
7544
|
+
_this.isDisabled = false;
|
|
7545
|
+
}, 1000);
|
|
7546
|
+
}
|
|
7547
|
+
else {
|
|
7548
|
+
if (newQuantity > 0 && newQuantity <= stock) {
|
|
7549
|
+
this.cartService.updateItemQuantity(item, newQuantity);
|
|
7550
|
+
}
|
|
7551
|
+
else {
|
|
7552
|
+
this.toastrService.show('out-of-stock-actually');
|
|
7553
|
+
}
|
|
7554
|
+
}
|
|
7555
|
+
};
|
|
7556
|
+
;
|
|
7532
7557
|
CartEcComponent.prototype.redirectCheckout = function () {
|
|
7533
7558
|
if (this.cartService.hasSufficientCreditsForCartTotal()) {
|
|
7534
7559
|
this.router.navigateByUrl("/checkout");
|
|
@@ -13525,6 +13550,17 @@
|
|
|
13525
13550
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13526
13551
|
};
|
|
13527
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
|
+
};
|
|
13528
13564
|
var __decorate$1n = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
13529
13565
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
13530
13566
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -13533,7 +13569,7 @@
|
|
|
13533
13569
|
};
|
|
13534
13570
|
var RegisterFormEcComponent = /** @class */ (function (_super) {
|
|
13535
13571
|
__extends$O(RegisterFormEcComponent, _super);
|
|
13536
|
-
function RegisterFormEcComponent(authService, toastr, router, analyticsService, formBuilder, channelConfigService) {
|
|
13572
|
+
function RegisterFormEcComponent(authService, toastr, router, analyticsService, formBuilder, channelConfigService, consts) {
|
|
13537
13573
|
var _this = _super.call(this) || this;
|
|
13538
13574
|
_this.authService = authService;
|
|
13539
13575
|
_this.toastr = toastr;
|
|
@@ -13541,6 +13577,13 @@
|
|
|
13541
13577
|
_this.analyticsService = analyticsService;
|
|
13542
13578
|
_this.formBuilder = formBuilder;
|
|
13543
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();
|
|
13544
13587
|
_this.isLogged = true;
|
|
13545
13588
|
_this.darkMode = false;
|
|
13546
13589
|
_this.redirect = true;
|
|
@@ -13582,7 +13625,8 @@
|
|
|
13582
13625
|
return;
|
|
13583
13626
|
}
|
|
13584
13627
|
if (_this.registerForm.valid) {
|
|
13585
|
-
_this.
|
|
13628
|
+
var normalizedData = _this.normalizeRegisterData(_this.registerForm.value);
|
|
13629
|
+
_this.authService.signUp(normalizedData).toPromise().then(function (res) {
|
|
13586
13630
|
_this.register_loading = false;
|
|
13587
13631
|
var messageKey;
|
|
13588
13632
|
switch (true) {
|
|
@@ -13624,6 +13668,18 @@
|
|
|
13624
13668
|
_this.register_loading = false;
|
|
13625
13669
|
}
|
|
13626
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
|
+
};
|
|
13627
13683
|
_this.ecOnConstruct();
|
|
13628
13684
|
return _this;
|
|
13629
13685
|
}
|
|
@@ -13637,7 +13693,40 @@
|
|
|
13637
13693
|
plainPassword2: ['', forms.Validators.required],
|
|
13638
13694
|
newsletter: [false],
|
|
13639
13695
|
terms: ['', forms.Validators.required],
|
|
13640
|
-
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);
|
|
13641
13730
|
});
|
|
13642
13731
|
this.channelConfigService.channelConfig$.subscribe(function (config) {
|
|
13643
13732
|
if (config && config.isAccountVerificationRequired !== undefined) {
|
|
@@ -13655,8 +13744,42 @@
|
|
|
13655
13744
|
});
|
|
13656
13745
|
this.ecOnInit();
|
|
13657
13746
|
};
|
|
13658
|
-
RegisterFormEcComponent.prototype.
|
|
13659
|
-
|
|
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) });
|
|
13660
13783
|
};
|
|
13661
13784
|
RegisterFormEcComponent.ctorParameters = function () { return [
|
|
13662
13785
|
{ type: AuthService },
|
|
@@ -13664,7 +13787,8 @@
|
|
|
13664
13787
|
{ type: router.Router },
|
|
13665
13788
|
{ type: AnalyticsService },
|
|
13666
13789
|
{ type: forms.FormBuilder },
|
|
13667
|
-
{ type: ChannelConfigService }
|
|
13790
|
+
{ type: ChannelConfigService },
|
|
13791
|
+
{ type: Constants }
|
|
13668
13792
|
]; };
|
|
13669
13793
|
__decorate$1n([
|
|
13670
13794
|
core.Input()
|
|
@@ -14055,8 +14179,8 @@
|
|
|
14055
14179
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14056
14180
|
};
|
|
14057
14181
|
})();
|
|
14058
|
-
var __assign$
|
|
14059
|
-
__assign$
|
|
14182
|
+
var __assign$s = (this && this.__assign) || function () {
|
|
14183
|
+
__assign$s = Object.assign || function(t) {
|
|
14060
14184
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
14061
14185
|
s = arguments[i];
|
|
14062
14186
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -14064,7 +14188,7 @@
|
|
|
14064
14188
|
}
|
|
14065
14189
|
return t;
|
|
14066
14190
|
};
|
|
14067
|
-
return __assign$
|
|
14191
|
+
return __assign$s.apply(this, arguments);
|
|
14068
14192
|
};
|
|
14069
14193
|
var __decorate$1s = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
14070
14194
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -14128,7 +14252,7 @@
|
|
|
14128
14252
|
_this.register_loading = true;
|
|
14129
14253
|
if (_this.registerForm.valid) {
|
|
14130
14254
|
// Convertir postcode a string antes de enviar
|
|
14131
|
-
var formValue = __assign$
|
|
14255
|
+
var formValue = __assign$s(__assign$s({}, _this.registerForm.value), { postcode: String(_this.registerForm.value.postcode) });
|
|
14132
14256
|
_this.authService.signUpWholesaler(formValue).toPromise().then(function (res) {
|
|
14133
14257
|
_this.register_loading = false;
|
|
14134
14258
|
_this.toastr.show('register-ok');
|
|
@@ -15612,8 +15736,8 @@
|
|
|
15612
15736
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15613
15737
|
};
|
|
15614
15738
|
})();
|
|
15615
|
-
var __assign$
|
|
15616
|
-
__assign$
|
|
15739
|
+
var __assign$t = (this && this.__assign) || function () {
|
|
15740
|
+
__assign$t = Object.assign || function(t) {
|
|
15617
15741
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
15618
15742
|
s = arguments[i];
|
|
15619
15743
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -15621,7 +15745,7 @@
|
|
|
15621
15745
|
}
|
|
15622
15746
|
return t;
|
|
15623
15747
|
};
|
|
15624
|
-
return __assign$
|
|
15748
|
+
return __assign$t.apply(this, arguments);
|
|
15625
15749
|
};
|
|
15626
15750
|
var __decorate$1C = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
15627
15751
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -15668,7 +15792,7 @@
|
|
|
15668
15792
|
var _this = this;
|
|
15669
15793
|
this.subs = this.authService.channelsUser.pipe(operators.filter(function (res) { return res != null && res.length > 0; })).subscribe(function (res) {
|
|
15670
15794
|
_this.channels = res.map(function (item) {
|
|
15671
|
-
return __assign$
|
|
15795
|
+
return __assign$t(__assign$t({}, item), { selected: false });
|
|
15672
15796
|
});
|
|
15673
15797
|
_this.initializeTemplate();
|
|
15674
15798
|
});
|
|
@@ -16887,8 +17011,8 @@
|
|
|
16887
17011
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16888
17012
|
};
|
|
16889
17013
|
})();
|
|
16890
|
-
var __assign$
|
|
16891
|
-
__assign$
|
|
17014
|
+
var __assign$u = (this && this.__assign) || function () {
|
|
17015
|
+
__assign$u = Object.assign || function(t) {
|
|
16892
17016
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
16893
17017
|
s = arguments[i];
|
|
16894
17018
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -16896,7 +17020,7 @@
|
|
|
16896
17020
|
}
|
|
16897
17021
|
return t;
|
|
16898
17022
|
};
|
|
16899
|
-
return __assign$
|
|
17023
|
+
return __assign$u.apply(this, arguments);
|
|
16900
17024
|
};
|
|
16901
17025
|
var __decorate$1L = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
16902
17026
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -16940,7 +17064,7 @@
|
|
|
16940
17064
|
window.scroll(0, 0);
|
|
16941
17065
|
});
|
|
16942
17066
|
_this.productService.product$.pipe(operators.filter(function (data) { return data && data.id && data.id != 0; })).subscribe(function (productParam) {
|
|
16943
|
-
_this.analyticsService.callEvent('view_item', __assign$
|
|
17067
|
+
_this.analyticsService.callEvent('view_item', __assign$u(__assign$u({}, productParam), { currency: _this.consts.currency.code }));
|
|
16944
17068
|
});
|
|
16945
17069
|
_this.ecOnConstruct();
|
|
16946
17070
|
return _this;
|
|
@@ -18123,8 +18247,8 @@
|
|
|
18123
18247
|
return BancardCatastroEcComponent;
|
|
18124
18248
|
}(ComponentHelper));
|
|
18125
18249
|
|
|
18126
|
-
var __assign$
|
|
18127
|
-
__assign$
|
|
18250
|
+
var __assign$v = (this && this.__assign) || function () {
|
|
18251
|
+
__assign$v = Object.assign || function(t) {
|
|
18128
18252
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18129
18253
|
s = arguments[i];
|
|
18130
18254
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
@@ -18132,7 +18256,7 @@
|
|
|
18132
18256
|
}
|
|
18133
18257
|
return t;
|
|
18134
18258
|
};
|
|
18135
|
-
return __assign$
|
|
18259
|
+
return __assign$v.apply(this, arguments);
|
|
18136
18260
|
};
|
|
18137
18261
|
var __decorate$1U = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18138
18262
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -18199,7 +18323,7 @@
|
|
|
18199
18323
|
* @description realiza un merge con los valores por defecto para rellenar el objeto de cookies
|
|
18200
18324
|
*/
|
|
18201
18325
|
this.setDefaultParameters = function () {
|
|
18202
|
-
_this.cookies = __assign$
|
|
18326
|
+
_this.cookies = __assign$v(__assign$v({}, _this.defaultValues), _this.cookies);
|
|
18203
18327
|
};
|
|
18204
18328
|
/**
|
|
18205
18329
|
* @description procesa el parametro ingresado, para transformarlo en un atributo del objeto de cookies.
|
|
@@ -18220,7 +18344,7 @@
|
|
|
18220
18344
|
break;
|
|
18221
18345
|
case 'others':
|
|
18222
18346
|
!_this.cookies[attrName] ? _this.cookies[attrName] = {} : null;
|
|
18223
|
-
_this.cookies[attrName] = __assign$
|
|
18347
|
+
_this.cookies[attrName] = __assign$v(__assign$v({}, _this.cookies[attrName]), _this.othersAttrProcessing(element));
|
|
18224
18348
|
break;
|
|
18225
18349
|
case 'message':
|
|
18226
18350
|
_this.cookies[attrName] = _this.messageAttrProcessing(element);
|
|
@@ -18272,7 +18396,7 @@
|
|
|
18272
18396
|
break;
|
|
18273
18397
|
default:
|
|
18274
18398
|
//console.log(value)
|
|
18275
|
-
objReturn = __assign$
|
|
18399
|
+
objReturn = __assign$v(__assign$v({}, objReturn), _this.getObjByFormatType(objReturn.type, value));
|
|
18276
18400
|
break;
|
|
18277
18401
|
}
|
|
18278
18402
|
}
|
|
@@ -18830,21 +18954,6 @@
|
|
|
18830
18954
|
this.hideTaxes = false;
|
|
18831
18955
|
this.creditAccountShowPrices = null;
|
|
18832
18956
|
this.showTaxLegend = false;
|
|
18833
|
-
this.actualizarCantidad = function (item, cantidad, stock, id) {
|
|
18834
|
-
if (id) {
|
|
18835
|
-
var elem_1 = document.getElementById(id);
|
|
18836
|
-
elem_1.disabled = true;
|
|
18837
|
-
cantidad > 0 && cantidad <= stock
|
|
18838
|
-
? _this.cartService.updateItemQuantity(item, cantidad)
|
|
18839
|
-
: _this.toastrService.show('out-of-stock-actually');
|
|
18840
|
-
setTimeout(function () {
|
|
18841
|
-
elem_1.disabled = false;
|
|
18842
|
-
}, 1000);
|
|
18843
|
-
}
|
|
18844
|
-
else {
|
|
18845
|
-
cantidad > 0 && cantidad <= stock && _this.cartService.updateItemQuantity(item, cantidad);
|
|
18846
|
-
}
|
|
18847
|
-
};
|
|
18848
18957
|
this.getVariants = function (product) {
|
|
18849
18958
|
var item = product.product;
|
|
18850
18959
|
if (item.variants && item.variants.length && item.variants[0].options && item.variants[0].options.length) {
|
|
@@ -18903,6 +19012,47 @@
|
|
|
18903
19012
|
_this.creditAccountShowPrices = showPrice;
|
|
18904
19013
|
});
|
|
18905
19014
|
};
|
|
19015
|
+
SidebarEcComponent.prototype.actualizarCantidad = function (item, cantidad, stock, id) {
|
|
19016
|
+
var _a;
|
|
19017
|
+
var multipleQuantity = ((_a = item.product) === null || _a === void 0 ? void 0 : _a.variants) && item.product.variants.length > 0 ? item.product.variants[0].multipleQuantity : 0;
|
|
19018
|
+
var step = multipleQuantity && multipleQuantity > 0 ? multipleQuantity : 1;
|
|
19019
|
+
var newQuantity;
|
|
19020
|
+
if (typeof cantidad === 'string') {
|
|
19021
|
+
newQuantity = parseInt(cantidad, 10);
|
|
19022
|
+
if (newQuantity % step !== 0) {
|
|
19023
|
+
this.toastrService.show('must-be-multiple', { quantity: step });
|
|
19024
|
+
newQuantity = Math.round(newQuantity / step) * step;
|
|
19025
|
+
}
|
|
19026
|
+
}
|
|
19027
|
+
else {
|
|
19028
|
+
newQuantity = cantidad;
|
|
19029
|
+
if (newQuantity % step !== 0) {
|
|
19030
|
+
newQuantity = Math.round(newQuantity / step) * step;
|
|
19031
|
+
}
|
|
19032
|
+
}
|
|
19033
|
+
if (id) {
|
|
19034
|
+
var elem_1 = document.getElementById(id);
|
|
19035
|
+
if (elem_1) {
|
|
19036
|
+
elem_1.disabled = true;
|
|
19037
|
+
}
|
|
19038
|
+
if (newQuantity > 0 && newQuantity <= stock) {
|
|
19039
|
+
this.cartService.updateItemQuantity(item, newQuantity);
|
|
19040
|
+
}
|
|
19041
|
+
else {
|
|
19042
|
+
this.toastrService.show('out-of-stock-actually');
|
|
19043
|
+
}
|
|
19044
|
+
if (elem_1) {
|
|
19045
|
+
setTimeout(function () {
|
|
19046
|
+
elem_1.disabled = false;
|
|
19047
|
+
}, 1000);
|
|
19048
|
+
}
|
|
19049
|
+
}
|
|
19050
|
+
else {
|
|
19051
|
+
if (newQuantity > 0 && newQuantity <= stock) {
|
|
19052
|
+
this.cartService.updateItemQuantity(item, newQuantity);
|
|
19053
|
+
}
|
|
19054
|
+
}
|
|
19055
|
+
};
|
|
18906
19056
|
SidebarEcComponent.prototype.redirectDetailProduct = function (product) {
|
|
18907
19057
|
var variant = product.variants[0];
|
|
18908
19058
|
var path = '/product/';
|