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
package/README.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# version 0.0.598
|
|
2
|
+
- Se implementa la validación de códigos postales según el país seleccionado en el formulario de checkout.
|
|
3
|
+
- Se agrega la lógica en `dataform-ec.component.ts` para establecer patrones de validación dinámicos de acuerdo con el país.
|
|
4
|
+
- Se obtiene el código del país seleccionado en el formulario y se aplica la validación correspondiente.
|
|
5
|
+
- Se añaden patrones de validación para los códigos postales de Argentina, Uruguay, Reino Unido, España, Brasil, Francia y Portugal.
|
|
6
|
+
# version 0.0.597
|
|
7
|
+
- Se integran los parámetros `hideDiscounts` y `hideTaxes` del servicio `channel-config.service.ts` en el componente `sidebar-ec.component.ts` y `detail-checkout-block-ec.component.ts`
|
|
1
8
|
# version 0.0.596
|
|
2
9
|
- Se integran los parámetros `hidePrices`, `hideDiscounts` y `hideTaxes` del servicio `channel-config.service.ts` en los siguientes componentes:
|
|
3
10
|
- `product-detail-ec.component` y `product-ec.component`: Se ocultan los precios si `hidePrices` está activado.
|
|
@@ -549,6 +549,15 @@
|
|
|
549
549
|
return _this.sortFilters = filtersCode;
|
|
550
550
|
};
|
|
551
551
|
this.getSortFilters = function () { return _this.sortFilters; };
|
|
552
|
+
this.postalCodePatterns = {
|
|
553
|
+
'AR': /^[0-9]{4}$/,
|
|
554
|
+
'UY': /^[0-9]{5}$/,
|
|
555
|
+
'GB': /^[A-Z]{1,2}[0-9][A-Z0-9]?\s?[0-9][A-Z]{2}$/,
|
|
556
|
+
'ES': /^(?:0[1-9]|[1-4]\d|5[0-2])\d{3}$/,
|
|
557
|
+
'BR': /^[0-9]{5}-[0-9]{3}$/,
|
|
558
|
+
'FR': /^[0-9]{5}$/,
|
|
559
|
+
'PT': /^[0-9]{4}-[0-9]{3}$/,
|
|
560
|
+
};
|
|
552
561
|
}
|
|
553
562
|
/**
|
|
554
563
|
*
|
|
@@ -586,6 +595,9 @@
|
|
|
586
595
|
: params.find(function (param) { return param.code == (prefix + searched + suffix) || param.code == searched; });
|
|
587
596
|
};
|
|
588
597
|
;
|
|
598
|
+
Constants$1.prototype.getPostalCodePattern = function (countryCode) {
|
|
599
|
+
return this.postalCodePatterns[countryCode] || /^[A-Za-z0-9\s\-]+$/;
|
|
600
|
+
};
|
|
589
601
|
Constants$1.ctorParameters = function () { return [
|
|
590
602
|
{ type: core$1.TranslateService },
|
|
591
603
|
{ type: router.Router },
|
|
@@ -8023,7 +8035,7 @@
|
|
|
8023
8035
|
_this.viewDataFacturacion = true;
|
|
8024
8036
|
_this.params = {};
|
|
8025
8037
|
_this.selectAddres = false;
|
|
8026
|
-
_this.postalCodePattern = '^[
|
|
8038
|
+
_this.postalCodePattern = '^[A-Z]?[0-9]{4}[A-Z]{0,3}$';
|
|
8027
8039
|
/**
|
|
8028
8040
|
* @description filtra los paises de acuerdo al a los codigos retornados en la funcion getCountries.
|
|
8029
8041
|
* Casos de usos: Si getCountries es vacio, retorna el arreglo que ingresa por parametro.
|
|
@@ -8073,6 +8085,10 @@
|
|
|
8073
8085
|
_this.checkoutForm.controls['countryCode'].setValue(value == 'null' ? null : value);
|
|
8074
8086
|
_this.checkoutForm.controls['provinceCode'].setValue(null);
|
|
8075
8087
|
_this.checkoutForm.controls['documentType'].setValue('');
|
|
8088
|
+
var selectedCountry = _this.countriesSubject.value.find(function (country) { return country.code == value; });
|
|
8089
|
+
if (selectedCountry) {
|
|
8090
|
+
_this.updatePostalCodeValidation(selectedCountry.code);
|
|
8091
|
+
}
|
|
8076
8092
|
//Provinces
|
|
8077
8093
|
var provinces = value && value != 'null' ?
|
|
8078
8094
|
_this.countriesSubject.value.find(function (country) { return country.code == value; }).provinces
|
|
@@ -8251,12 +8267,12 @@
|
|
|
8251
8267
|
_this.getLabelNotesParam = function () { return _this.hasParams(_this.params, 'label_notes_' + _this.consts.getChannel() + '_' + _this.consts.getLocale().split('_')[0]); };
|
|
8252
8268
|
_this.getParamByChannelAndLanguage = function (nameParam) { return _this.hasParams(_this.params, nameParam + _this.consts.getChannel() + '_' + _this.consts.getLocale().split('_')[0]); };
|
|
8253
8269
|
_this.ecOnConstruct();
|
|
8254
|
-
_this.checkoutForm = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formAddres), { postcode: ['', [forms.Validators.required
|
|
8270
|
+
_this.checkoutForm = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formAddres), { postcode: ['', [forms.Validators.required]] // Se agrega para que sólo acepte códigos postales mayores que cero
|
|
8255
8271
|
}));
|
|
8256
8272
|
_this.checkoutForm.statusChanges
|
|
8257
8273
|
.pipe(operators.filter(function () { _this.onFormChange(); return _this.checkoutForm.valid; }))
|
|
8258
8274
|
.subscribe(function () { return _this.onFormValid(); });
|
|
8259
|
-
_this.checkoutFormFacturacion = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formBilling), { postcode: ['', [forms.Validators.required
|
|
8275
|
+
_this.checkoutFormFacturacion = _this.fb.group(__assign$j(__assign$j({}, _this.addressingService.getTypeForm().configForm.formBilling), { postcode: ['', [forms.Validators.required]] // Se agrega para que sólo acepte códigos postales mayores que cero
|
|
8260
8276
|
}));
|
|
8261
8277
|
_this.checkoutFormFacturacion.statusChanges
|
|
8262
8278
|
.pipe(operators.filter(function () { _this.onFormChange(); return _this.checkoutFormFacturacion.valid; }))
|
|
@@ -8276,15 +8292,27 @@
|
|
|
8276
8292
|
_this.countriesSubject.next(countries);
|
|
8277
8293
|
_this.countriesFacturacionSubject.next(countries);
|
|
8278
8294
|
});
|
|
8279
|
-
(this.addressingService.modeSelectAddress
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
_this.addressBook
|
|
8295
|
+
if (this.addressingService.modeSelectAddress === 'LOAD_ADDRESS_AND_SELECTION' ||
|
|
8296
|
+
this.addressingService.modeSelectAddress === 'ONLY_ADDRESS_SELECTION') {
|
|
8297
|
+
this.addressingService.getAddressBook().then(function (res) {
|
|
8298
|
+
_this.addressBook = res || null;
|
|
8299
|
+
if (_this.addressBook) {
|
|
8300
|
+
var selectedAddress = _this.addressBook.find(function (address) { return address.selected; });
|
|
8301
|
+
if (selectedAddress) {
|
|
8302
|
+
_this.checkoutForm.controls['countryCode'].setValue(selectedAddress.countryCode);
|
|
8303
|
+
_this.updatePostalCodeValidation(selectedAddress.countryCode);
|
|
8304
|
+
}
|
|
8305
|
+
}
|
|
8306
|
+
else {
|
|
8307
|
+
_this.setMode('carga');
|
|
8308
|
+
}
|
|
8283
8309
|
});
|
|
8310
|
+
}
|
|
8284
8311
|
this.countries$.subscribe(function (res) {
|
|
8285
8312
|
var _a, _b, _c, _d;
|
|
8286
8313
|
if (res && res.length > 0) {
|
|
8287
8314
|
_this.checkoutForm.controls['countryCode'].setValue(res[0].code);
|
|
8315
|
+
_this.updatePostalCodeValidation(res[0].code);
|
|
8288
8316
|
// Provincia
|
|
8289
8317
|
_this.checkoutForm.controls['provinceCode'].setValue((_a = res[0]) === null || _a === void 0 ? void 0 : _a.provinces[0].code);
|
|
8290
8318
|
_this.provincesSubject.next((_b = res[0]) === null || _b === void 0 ? void 0 : _b.provinces);
|
|
@@ -8311,6 +8339,14 @@
|
|
|
8311
8339
|
DataFormEcComponent.prototype.openModal = function (template) {
|
|
8312
8340
|
this.modalRef = this.modalService.show(template, { class: 'modal-lg ', keyboard: false, backdrop: 'static' });
|
|
8313
8341
|
};
|
|
8342
|
+
DataFormEcComponent.prototype.updatePostalCodeValidation = function (countryCode) {
|
|
8343
|
+
var postalCodePattern = this.consts.getPostalCodePattern(countryCode) || '.*';
|
|
8344
|
+
this.checkoutForm.controls['postcode'].setValidators([
|
|
8345
|
+
forms.Validators.required,
|
|
8346
|
+
forms.Validators.pattern(postalCodePattern)
|
|
8347
|
+
]);
|
|
8348
|
+
this.checkoutForm.controls['postcode'].updateValueAndValidity();
|
|
8349
|
+
};
|
|
8314
8350
|
DataFormEcComponent.prototype.prueba = function (x) {
|
|
8315
8351
|
console.log(x);
|
|
8316
8352
|
};
|
|
@@ -14118,15 +14154,18 @@
|
|
|
14118
14154
|
};
|
|
14119
14155
|
var DetailCheckoutBlockEcComponent = /** @class */ (function (_super) {
|
|
14120
14156
|
__extends$V(DetailCheckoutBlockEcComponent, _super);
|
|
14121
|
-
function DetailCheckoutBlockEcComponent(checkoutService, cartService) {
|
|
14157
|
+
function DetailCheckoutBlockEcComponent(checkoutService, cartService, channelConfigService) {
|
|
14122
14158
|
var _this = _super.call(this) || this;
|
|
14123
14159
|
_this.checkoutService = checkoutService;
|
|
14124
14160
|
_this.cartService = cartService;
|
|
14161
|
+
_this.channelConfigService = channelConfigService;
|
|
14125
14162
|
_this.data = null;
|
|
14126
14163
|
_this.discountTotal = 0;
|
|
14127
14164
|
_this.couponTotal = 0;
|
|
14128
14165
|
_this.showPrice = false;
|
|
14129
14166
|
_this.creditAmountConfigured = false;
|
|
14167
|
+
_this.hideDiscounts = false;
|
|
14168
|
+
_this.hideTaxes = false;
|
|
14130
14169
|
_this.getIcon = function (data_item) {
|
|
14131
14170
|
switch (data_item.type) {
|
|
14132
14171
|
case 'coupon': return 'fas fa-ticket-alt fa-3x';
|
|
@@ -14159,6 +14198,11 @@
|
|
|
14159
14198
|
this.cartService.creditAmount$.subscribe(function (creditAmount) {
|
|
14160
14199
|
_this.creditAmountConfigured = creditAmount !== null;
|
|
14161
14200
|
});
|
|
14201
|
+
this.channelConfigService.channelConfig$.subscribe(function (channel) {
|
|
14202
|
+
var _a, _b, _c, _d;
|
|
14203
|
+
_this.hideDiscounts = (_b = (_a = channel) === null || _a === void 0 ? void 0 : _a.hideDiscounts, (_b !== null && _b !== void 0 ? _b : false));
|
|
14204
|
+
_this.hideTaxes = (_d = (_c = channel) === null || _c === void 0 ? void 0 : _c.hideTaxes, (_d !== null && _d !== void 0 ? _d : false));
|
|
14205
|
+
});
|
|
14162
14206
|
};
|
|
14163
14207
|
DetailCheckoutBlockEcComponent.prototype.calcularTotales = function () {
|
|
14164
14208
|
if (this.data) {
|
|
@@ -14172,7 +14216,8 @@
|
|
|
14172
14216
|
};
|
|
14173
14217
|
DetailCheckoutBlockEcComponent.ctorParameters = function () { return [
|
|
14174
14218
|
{ type: CheckoutService },
|
|
14175
|
-
{ type: CartService }
|
|
14219
|
+
{ type: CartService },
|
|
14220
|
+
{ type: ChannelConfigService }
|
|
14176
14221
|
]; };
|
|
14177
14222
|
__decorate$1u([
|
|
14178
14223
|
core.Input()
|
|
@@ -14180,7 +14225,7 @@
|
|
|
14180
14225
|
DetailCheckoutBlockEcComponent = __decorate$1u([
|
|
14181
14226
|
core.Component({
|
|
14182
14227
|
selector: 'app-detail-checkout-block-ec',
|
|
14183
|
-
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>",
|
|
14228
|
+
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>",
|
|
14184
14229
|
styles: [""]
|
|
14185
14230
|
})
|
|
14186
14231
|
], DetailCheckoutBlockEcComponent);
|
|
@@ -18501,16 +18546,19 @@
|
|
|
18501
18546
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18502
18547
|
};
|
|
18503
18548
|
var SidebarEcComponent = /** @class */ (function () {
|
|
18504
|
-
function SidebarEcComponent(cartService, consts, authService, router, toastrService) {
|
|
18549
|
+
function SidebarEcComponent(cartService, consts, authService, router, toastrService, channelConfigService) {
|
|
18505
18550
|
var _this = this;
|
|
18506
18551
|
this.cartService = cartService;
|
|
18507
18552
|
this.consts = consts;
|
|
18508
18553
|
this.authService = authService;
|
|
18509
18554
|
this.router = router;
|
|
18510
18555
|
this.toastrService = toastrService;
|
|
18556
|
+
this.channelConfigService = channelConfigService;
|
|
18511
18557
|
this.user = null;
|
|
18512
18558
|
this.promotions = [];
|
|
18513
18559
|
this.variantsToShow = ['TALLE', 'COLOR'];
|
|
18560
|
+
this.hideDiscounts = false;
|
|
18561
|
+
this.hideTaxes = false;
|
|
18514
18562
|
this.actualizarCantidad = function (item, cantidad, stock, id) {
|
|
18515
18563
|
if (id) {
|
|
18516
18564
|
var elem_1 = document.getElementById(id);
|
|
@@ -18574,6 +18622,11 @@
|
|
|
18574
18622
|
this.authService.getUserProfile().subscribe(function (u) {
|
|
18575
18623
|
_this.user = u;
|
|
18576
18624
|
});
|
|
18625
|
+
this.channelConfigService.channelConfig$.subscribe(function (channel) {
|
|
18626
|
+
var _a, _b, _c, _d;
|
|
18627
|
+
_this.hideDiscounts = (_b = (_a = channel) === null || _a === void 0 ? void 0 : _a.hideDiscounts, (_b !== null && _b !== void 0 ? _b : false));
|
|
18628
|
+
_this.hideTaxes = (_d = (_c = channel) === null || _c === void 0 ? void 0 : _c.hideTaxes, (_d !== null && _d !== void 0 ? _d : false));
|
|
18629
|
+
});
|
|
18577
18630
|
};
|
|
18578
18631
|
SidebarEcComponent.prototype.redirectDetailProduct = function (product) {
|
|
18579
18632
|
var variant = product.variants[0];
|
|
@@ -18595,7 +18648,8 @@
|
|
|
18595
18648
|
{ type: Constants },
|
|
18596
18649
|
{ type: AuthService },
|
|
18597
18650
|
{ type: router.Router },
|
|
18598
|
-
{ type: ToastService }
|
|
18651
|
+
{ type: ToastService },
|
|
18652
|
+
{ type: ChannelConfigService }
|
|
18599
18653
|
]; };
|
|
18600
18654
|
SidebarEcComponent = __decorate$1$([
|
|
18601
18655
|
core.Component({
|