ng-easycommerce 0.0.596 → 0.0.598
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 +66 -12
- 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/core.consts.js +13 -1
- package/esm2015/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +32 -8
- package/esm2015/lib/ec-component/checkout-ec/detail-checkout-block-ec/detail-checkout-block-ec.component.js +14 -4
- package/esm2015/lib/ec-component/sidebar-ec/sidebar-ec.component.js +13 -3
- package/esm5/lib/core.consts.js +13 -1
- package/esm5/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +32 -8
- package/esm5/lib/ec-component/checkout-ec/detail-checkout-block-ec/detail-checkout-block-ec.component.js +14 -4
- package/esm5/lib/ec-component/sidebar-ec/sidebar-ec.component.js +13 -3
- package/fesm2015/ng-easycommerce.js +66 -12
- package/fesm2015/ng-easycommerce.js.map +1 -1
- package/fesm5/ng-easycommerce.js +66 -12
- package/fesm5/ng-easycommerce.js.map +1 -1
- package/lib/core.consts.d.ts +2 -0
- package/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.d.ts +1 -0
- package/lib/ec-component/checkout-ec/detail-checkout-block-ec/detail-checkout-block-ec.component.d.ts +5 -1
- package/lib/ec-component/sidebar-ec/sidebar-ec.component.d.ts +5 -1
- package/ng-easycommerce.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -516,6 +516,15 @@ let Constants = class Constants {
|
|
|
516
516
|
*/
|
|
517
517
|
this.setSortFilters = (filtersCode = ['all']) => this.sortFilters = filtersCode;
|
|
518
518
|
this.getSortFilters = () => this.sortFilters;
|
|
519
|
+
this.postalCodePatterns = {
|
|
520
|
+
'AR': /^[0-9]{4}$/,
|
|
521
|
+
'UY': /^[0-9]{5}$/,
|
|
522
|
+
'GB': /^[A-Z]{1,2}[0-9][A-Z0-9]?\s?[0-9][A-Z]{2}$/,
|
|
523
|
+
'ES': /^(?:0[1-9]|[1-4]\d|5[0-2])\d{3}$/,
|
|
524
|
+
'BR': /^[0-9]{5}-[0-9]{3}$/,
|
|
525
|
+
'FR': /^[0-9]{5}$/,
|
|
526
|
+
'PT': /^[0-9]{4}-[0-9]{3}$/,
|
|
527
|
+
};
|
|
519
528
|
}
|
|
520
529
|
/**
|
|
521
530
|
*
|
|
@@ -550,6 +559,9 @@ let Constants = class Constants {
|
|
|
550
559
|
: params.find(param => param.code == (prefix + searched + suffix) || param.code == searched);
|
|
551
560
|
}
|
|
552
561
|
;
|
|
562
|
+
getPostalCodePattern(countryCode) {
|
|
563
|
+
return this.postalCodePatterns[countryCode] || /^[A-Za-z0-9\s\-]+$/;
|
|
564
|
+
}
|
|
553
565
|
};
|
|
554
566
|
Constants.ctorParameters = () => [
|
|
555
567
|
{ type: TranslateService },
|
|
@@ -6739,7 +6751,7 @@ let DataFormEcComponent = class DataFormEcComponent extends ComponentHelper {
|
|
|
6739
6751
|
this.viewDataFacturacion = true;
|
|
6740
6752
|
this.params = {};
|
|
6741
6753
|
this.selectAddres = false;
|
|
6742
|
-
this.postalCodePattern = '^[
|
|
6754
|
+
this.postalCodePattern = '^[A-Z]?[0-9]{4}[A-Z]{0,3}$';
|
|
6743
6755
|
/**
|
|
6744
6756
|
* @description filtra los paises de acuerdo al a los codigos retornados en la funcion getCountries.
|
|
6745
6757
|
* Casos de usos: Si getCountries es vacio, retorna el arreglo que ingresa por parametro.
|
|
@@ -6789,6 +6801,10 @@ let DataFormEcComponent = class DataFormEcComponent extends ComponentHelper {
|
|
|
6789
6801
|
this.checkoutForm.controls['countryCode'].setValue(value == 'null' ? null : value);
|
|
6790
6802
|
this.checkoutForm.controls['provinceCode'].setValue(null);
|
|
6791
6803
|
this.checkoutForm.controls['documentType'].setValue('');
|
|
6804
|
+
let selectedCountry = this.countriesSubject.value.find(country => country.code == value);
|
|
6805
|
+
if (selectedCountry) {
|
|
6806
|
+
this.updatePostalCodeValidation(selectedCountry.code);
|
|
6807
|
+
}
|
|
6792
6808
|
//Provinces
|
|
6793
6809
|
let provinces = value && value != 'null' ?
|
|
6794
6810
|
this.countriesSubject.value.find(country => country.code == value).provinces
|
|
@@ -6937,12 +6953,12 @@ let DataFormEcComponent = class DataFormEcComponent extends ComponentHelper {
|
|
|
6937
6953
|
this.getLabelNotesParam = () => this.hasParams(this.params, 'label_notes_' + this.consts.getChannel() + '_' + this.consts.getLocale().split('_')[0]);
|
|
6938
6954
|
this.getParamByChannelAndLanguage = (nameParam) => this.hasParams(this.params, nameParam + this.consts.getChannel() + '_' + this.consts.getLocale().split('_')[0]);
|
|
6939
6955
|
this.ecOnConstruct();
|
|
6940
|
-
this.checkoutForm = this.fb.group(Object.assign(Object.assign({}, this.addressingService.getTypeForm().configForm.formAddres), { postcode: ['', [Validators.required
|
|
6956
|
+
this.checkoutForm = this.fb.group(Object.assign(Object.assign({}, this.addressingService.getTypeForm().configForm.formAddres), { postcode: ['', [Validators.required]] // Se agrega para que sólo acepte códigos postales mayores que cero
|
|
6941
6957
|
}));
|
|
6942
6958
|
this.checkoutForm.statusChanges
|
|
6943
6959
|
.pipe(filter(() => { this.onFormChange(); return this.checkoutForm.valid; }))
|
|
6944
6960
|
.subscribe(() => this.onFormValid());
|
|
6945
|
-
this.checkoutFormFacturacion = this.fb.group(Object.assign(Object.assign({}, this.addressingService.getTypeForm().configForm.formBilling), { postcode: ['', [Validators.required
|
|
6961
|
+
this.checkoutFormFacturacion = this.fb.group(Object.assign(Object.assign({}, this.addressingService.getTypeForm().configForm.formBilling), { postcode: ['', [Validators.required]] // Se agrega para que sólo acepte códigos postales mayores que cero
|
|
6946
6962
|
}));
|
|
6947
6963
|
this.checkoutFormFacturacion.statusChanges
|
|
6948
6964
|
.pipe(filter(() => { this.onFormChange(); return this.checkoutFormFacturacion.valid; }))
|
|
@@ -6960,15 +6976,27 @@ let DataFormEcComponent = class DataFormEcComponent extends ComponentHelper {
|
|
|
6960
6976
|
this.countriesSubject.next(countries);
|
|
6961
6977
|
this.countriesFacturacionSubject.next(countries);
|
|
6962
6978
|
});
|
|
6963
|
-
(this.addressingService.modeSelectAddress
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
this.addressBook
|
|
6979
|
+
if (this.addressingService.modeSelectAddress === 'LOAD_ADDRESS_AND_SELECTION' ||
|
|
6980
|
+
this.addressingService.modeSelectAddress === 'ONLY_ADDRESS_SELECTION') {
|
|
6981
|
+
this.addressingService.getAddressBook().then(res => {
|
|
6982
|
+
this.addressBook = res || null;
|
|
6983
|
+
if (this.addressBook) {
|
|
6984
|
+
const selectedAddress = this.addressBook.find(address => address.selected);
|
|
6985
|
+
if (selectedAddress) {
|
|
6986
|
+
this.checkoutForm.controls['countryCode'].setValue(selectedAddress.countryCode);
|
|
6987
|
+
this.updatePostalCodeValidation(selectedAddress.countryCode);
|
|
6988
|
+
}
|
|
6989
|
+
}
|
|
6990
|
+
else {
|
|
6991
|
+
this.setMode('carga');
|
|
6992
|
+
}
|
|
6967
6993
|
});
|
|
6994
|
+
}
|
|
6968
6995
|
this.countries$.subscribe(res => {
|
|
6969
6996
|
var _a, _b, _c, _d;
|
|
6970
6997
|
if (res && res.length > 0) {
|
|
6971
6998
|
this.checkoutForm.controls['countryCode'].setValue(res[0].code);
|
|
6999
|
+
this.updatePostalCodeValidation(res[0].code);
|
|
6972
7000
|
// Provincia
|
|
6973
7001
|
this.checkoutForm.controls['provinceCode'].setValue((_a = res[0]) === null || _a === void 0 ? void 0 : _a.provinces[0].code);
|
|
6974
7002
|
this.provincesSubject.next((_b = res[0]) === null || _b === void 0 ? void 0 : _b.provinces);
|
|
@@ -6995,6 +7023,14 @@ let DataFormEcComponent = class DataFormEcComponent extends ComponentHelper {
|
|
|
6995
7023
|
openModal(template) {
|
|
6996
7024
|
this.modalRef = this.modalService.show(template, { class: 'modal-lg ', keyboard: false, backdrop: 'static' });
|
|
6997
7025
|
}
|
|
7026
|
+
updatePostalCodeValidation(countryCode) {
|
|
7027
|
+
const postalCodePattern = this.consts.getPostalCodePattern(countryCode) || '.*';
|
|
7028
|
+
this.checkoutForm.controls['postcode'].setValidators([
|
|
7029
|
+
Validators.required,
|
|
7030
|
+
Validators.pattern(postalCodePattern)
|
|
7031
|
+
]);
|
|
7032
|
+
this.checkoutForm.controls['postcode'].updateValueAndValidity();
|
|
7033
|
+
}
|
|
6998
7034
|
prueba(x) {
|
|
6999
7035
|
console.log(x);
|
|
7000
7036
|
}
|
|
@@ -11745,15 +11781,18 @@ var __decorate$1u = (this && this.__decorate) || function (decorators, target, k
|
|
|
11745
11781
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11746
11782
|
};
|
|
11747
11783
|
let DetailCheckoutBlockEcComponent = class DetailCheckoutBlockEcComponent extends ComponentHelper {
|
|
11748
|
-
constructor(checkoutService, cartService) {
|
|
11784
|
+
constructor(checkoutService, cartService, channelConfigService) {
|
|
11749
11785
|
super();
|
|
11750
11786
|
this.checkoutService = checkoutService;
|
|
11751
11787
|
this.cartService = cartService;
|
|
11788
|
+
this.channelConfigService = channelConfigService;
|
|
11752
11789
|
this.data = null;
|
|
11753
11790
|
this.discountTotal = 0;
|
|
11754
11791
|
this.couponTotal = 0;
|
|
11755
11792
|
this.showPrice = false;
|
|
11756
11793
|
this.creditAmountConfigured = false;
|
|
11794
|
+
this.hideDiscounts = false;
|
|
11795
|
+
this.hideTaxes = false;
|
|
11757
11796
|
this.getIcon = (data_item) => {
|
|
11758
11797
|
switch (data_item.type) {
|
|
11759
11798
|
case 'coupon': return 'fas fa-ticket-alt fa-3x';
|
|
@@ -11784,6 +11823,11 @@ let DetailCheckoutBlockEcComponent = class DetailCheckoutBlockEcComponent extend
|
|
|
11784
11823
|
this.cartService.creditAmount$.subscribe((creditAmount) => {
|
|
11785
11824
|
this.creditAmountConfigured = creditAmount !== null;
|
|
11786
11825
|
});
|
|
11826
|
+
this.channelConfigService.channelConfig$.subscribe(channel => {
|
|
11827
|
+
var _a, _b, _c, _d;
|
|
11828
|
+
this.hideDiscounts = (_b = (_a = channel) === null || _a === void 0 ? void 0 : _a.hideDiscounts, (_b !== null && _b !== void 0 ? _b : false));
|
|
11829
|
+
this.hideTaxes = (_d = (_c = channel) === null || _c === void 0 ? void 0 : _c.hideTaxes, (_d !== null && _d !== void 0 ? _d : false));
|
|
11830
|
+
});
|
|
11787
11831
|
}
|
|
11788
11832
|
calcularTotales() {
|
|
11789
11833
|
if (this.data) {
|
|
@@ -11798,7 +11842,8 @@ let DetailCheckoutBlockEcComponent = class DetailCheckoutBlockEcComponent extend
|
|
|
11798
11842
|
};
|
|
11799
11843
|
DetailCheckoutBlockEcComponent.ctorParameters = () => [
|
|
11800
11844
|
{ type: CheckoutService },
|
|
11801
|
-
{ type: CartService }
|
|
11845
|
+
{ type: CartService },
|
|
11846
|
+
{ type: ChannelConfigService }
|
|
11802
11847
|
];
|
|
11803
11848
|
__decorate$1u([
|
|
11804
11849
|
Input()
|
|
@@ -11806,7 +11851,7 @@ __decorate$1u([
|
|
|
11806
11851
|
DetailCheckoutBlockEcComponent = __decorate$1u([
|
|
11807
11852
|
Component({
|
|
11808
11853
|
selector: 'app-detail-checkout-block-ec',
|
|
11809
|
-
template: "<div id=\"appDetailCheckoutBlockEc\" class=\"d-flex flex-row w-100 justify-content-center flex-wrap\"\n *ngIf=\"data && (creditAmountConfigured ? showPrice : true)\">\n <ng-container *ngFor=\"let item of data; let i = index\">\n <ng-container *ngIf=\"item.type != 'discount' && item.type != 'coupon'\">\n <div class=\"d-flex flex-column justify-content-center mx-sm-3 mx-2 text-center mb-4 resumen\">\n <i ngClass=\"mb-2 colorIconoCheckout\" [class]=\"getIcon(item)\"></i>\n <strong class=\"text-center w-100 font-brandon font-md mb-1\">{{ item.type | translate }}</strong>\n <span class=\"text-center w-100 font-brandon font-md text-gray\">{{ (item.amount != 0 ) ? (item.amount |\n ecCurrencySymbol) : ('free' | translate) }}</span>\n </div>\n </ng-container>\n\n\n <!-- Mostrar total de descuentos -->\n <div class=\"d-flex flex-column justify-content-center mx-sm-3 mx-2 text-center mb-4 resumen\"\n *ngIf=\"this.discountTotal != 0 && i === 1\">\n <i ngClass=\"mb-2 colorIconoCheckout\" [class]=\"getIcon2('discount')\"></i>\n <strong class=\"text-center w-100 font-brandon font-md mb-1\">Descuento</strong>\n <span class=\"text-center w-100 font-brandon font-md text-gray\">{{ (this.discountTotal | ecCurrencySymbol)\n }}</span>\n </div>\n\n <!-- Mostrar total de cupones -->\n <div class=\"d-flex flex-column justify-content-center mx-sm-3 mx-2 text-center mb-4 resumen\"\n *ngIf=\"this.couponTotal != 0 && i === 1\">\n <i ngClass=\"mb-2 colorIconoCheckout\" [class]=\"getIcon2('coupon')\"></i>\n <strong class=\"text-center w-100 font-brandon font-md mb-1\">Cupon</strong>\n <span class=\"text-center w-100 font-brandon font-md text-gray\">{{(this.couponTotal| ecCurrencySymbol)\n }}</span>\n </div>\n </ng-container>\n</div>",
|
|
11854
|
+
template: "<div id=\"appDetailCheckoutBlockEc\" class=\"d-flex flex-row w-100 justify-content-center flex-wrap\"\n *ngIf=\"data && (creditAmountConfigured ? showPrice : true)\">\n <ng-container *ngFor=\"let item of data; let i = index\">\n <ng-container *ngIf=\"item.type != 'discount' && item.type != 'coupon'\">\n <div class=\"d-flex flex-column justify-content-center mx-sm-3 mx-2 text-center mb-4 resumen\">\n <i ngClass=\"mb-2 colorIconoCheckout\" [class]=\"getIcon(item)\"></i>\n <strong class=\"text-center w-100 font-brandon font-md mb-1\">{{ item.type | translate }}</strong>\n <span class=\"text-center w-100 font-brandon font-md text-gray\">{{ (item.amount != 0 ) ? (item.amount |\n ecCurrencySymbol) : ('free' | translate) }}</span>\n </div>\n </ng-container>\n\n\n <!-- Mostrar total de descuentos -->\n <div class=\"d-flex flex-column justify-content-center mx-sm-3 mx-2 text-center mb-4 resumen\"\n *ngIf=\"!hideDiscounts && this.discountTotal != 0 && i === 1\">\n <i ngClass=\"mb-2 colorIconoCheckout\" [class]=\"getIcon2('discount')\"></i>\n <strong class=\"text-center w-100 font-brandon font-md mb-1\">Descuento</strong>\n <span class=\"text-center w-100 font-brandon font-md text-gray\">{{ (this.discountTotal | ecCurrencySymbol)\n }}</span>\n </div>\n\n <!-- Mostrar total de cupones -->\n <div class=\"d-flex flex-column justify-content-center mx-sm-3 mx-2 text-center mb-4 resumen\"\n *ngIf=\"!hideDiscounts && this.couponTotal != 0 && i === 1\">\n <i ngClass=\"mb-2 colorIconoCheckout\" [class]=\"getIcon2('coupon')\"></i>\n <strong class=\"text-center w-100 font-brandon font-md mb-1\">Cupon</strong>\n <span class=\"text-center w-100 font-brandon font-md text-gray\">{{(this.couponTotal| ecCurrencySymbol)\n }}</span>\n </div>\n </ng-container>\n</div>",
|
|
11810
11855
|
styles: [""]
|
|
11811
11856
|
})
|
|
11812
11857
|
], DetailCheckoutBlockEcComponent);
|
|
@@ -15593,15 +15638,18 @@ var __decorate$1$ = (this && this.__decorate) || function (decorators, target, k
|
|
|
15593
15638
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15594
15639
|
};
|
|
15595
15640
|
let SidebarEcComponent = class SidebarEcComponent {
|
|
15596
|
-
constructor(cartService, consts, authService, router, toastrService) {
|
|
15641
|
+
constructor(cartService, consts, authService, router, toastrService, channelConfigService) {
|
|
15597
15642
|
this.cartService = cartService;
|
|
15598
15643
|
this.consts = consts;
|
|
15599
15644
|
this.authService = authService;
|
|
15600
15645
|
this.router = router;
|
|
15601
15646
|
this.toastrService = toastrService;
|
|
15647
|
+
this.channelConfigService = channelConfigService;
|
|
15602
15648
|
this.user = null;
|
|
15603
15649
|
this.promotions = [];
|
|
15604
15650
|
this.variantsToShow = ['TALLE', 'COLOR'];
|
|
15651
|
+
this.hideDiscounts = false;
|
|
15652
|
+
this.hideTaxes = false;
|
|
15605
15653
|
this.actualizarCantidad = (item, cantidad, stock, id) => {
|
|
15606
15654
|
if (id) {
|
|
15607
15655
|
const elem = document.getElementById(id);
|
|
@@ -15664,6 +15712,11 @@ let SidebarEcComponent = class SidebarEcComponent {
|
|
|
15664
15712
|
this.authService.getUserProfile().subscribe(u => {
|
|
15665
15713
|
this.user = u;
|
|
15666
15714
|
});
|
|
15715
|
+
this.channelConfigService.channelConfig$.subscribe(channel => {
|
|
15716
|
+
var _a, _b, _c, _d;
|
|
15717
|
+
this.hideDiscounts = (_b = (_a = channel) === null || _a === void 0 ? void 0 : _a.hideDiscounts, (_b !== null && _b !== void 0 ? _b : false));
|
|
15718
|
+
this.hideTaxes = (_d = (_c = channel) === null || _c === void 0 ? void 0 : _c.hideTaxes, (_d !== null && _d !== void 0 ? _d : false));
|
|
15719
|
+
});
|
|
15667
15720
|
}
|
|
15668
15721
|
redirectDetailProduct(product) {
|
|
15669
15722
|
let variant = product.variants[0];
|
|
@@ -15686,7 +15739,8 @@ SidebarEcComponent.ctorParameters = () => [
|
|
|
15686
15739
|
{ type: Constants },
|
|
15687
15740
|
{ type: AuthService },
|
|
15688
15741
|
{ type: Router },
|
|
15689
|
-
{ type: ToastService }
|
|
15742
|
+
{ type: ToastService },
|
|
15743
|
+
{ type: ChannelConfigService }
|
|
15690
15744
|
];
|
|
15691
15745
|
SidebarEcComponent = __decorate$1$([
|
|
15692
15746
|
Component({
|