ng-easycommerce 0.0.683 → 0.0.684

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.
Files changed (24) hide show
  1. package/README.md +9 -0
  2. package/bundles/ng-easycommerce.umd.js +427 -38
  3. package/bundles/ng-easycommerce.umd.js.map +1 -1
  4. package/bundles/ng-easycommerce.umd.min.js +1 -1
  5. package/bundles/ng-easycommerce.umd.min.js.map +1 -1
  6. package/esm2015/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +317 -8
  7. package/esm2015/lib/ec-component/checkout-ec/payment-ec/payment-ec.component.js +2 -2
  8. package/esm2015/lib/ec-component/widgets-ec/redsys-redirect-ec/redsys-redirect-ec.component.js +41 -24
  9. package/esm2015/lib/services/checkout/addressing.service.js +21 -1
  10. package/esm2015/lib/services/checkout/shipment.service.js +5 -4
  11. package/esm5/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.js +359 -8
  12. package/esm5/lib/ec-component/checkout-ec/payment-ec/payment-ec.component.js +2 -2
  13. package/esm5/lib/ec-component/widgets-ec/redsys-redirect-ec/redsys-redirect-ec.component.js +41 -24
  14. package/esm5/lib/services/checkout/addressing.service.js +21 -1
  15. package/esm5/lib/services/checkout/shipment.service.js +10 -9
  16. package/fesm2015/ng-easycommerce.js +380 -33
  17. package/fesm2015/ng-easycommerce.js.map +1 -1
  18. package/fesm5/ng-easycommerce.js +427 -38
  19. package/fesm5/ng-easycommerce.js.map +1 -1
  20. package/lib/ec-component/checkout-ec/dataform-ec/dataform-ec.component.d.ts +26 -0
  21. package/lib/ec-component/widgets-ec/redsys-redirect-ec/redsys-redirect-ec.component.d.ts +4 -3
  22. package/lib/services/checkout/addressing.service.d.ts +5 -0
  23. package/ng-easycommerce.metadata.json +1 -1
  24. package/package.json +1 -1
@@ -3460,6 +3460,26 @@ let AddressingService = class AddressingService extends StepService {
3460
3460
  return new Promise((resolve, reject) => reject(new Error(err.error)));
3461
3461
  }).catch(err => console.error(err));
3462
3462
  };
3463
+ this.setHeadquarterByIds = (data) => {
3464
+ return this.connection.put(this.headquarterApi(), data)
3465
+ .pipe(map(order => {
3466
+ var _a;
3467
+ if (order && order.error) {
3468
+ this.cartService.changeHaveToUpdate(false);
3469
+ return false;
3470
+ }
3471
+ this.checkoutService.updateAsociatedData(order);
3472
+ this.checkoutService.setCheckoutNotes(((_a = data) === null || _a === void 0 ? void 0 : _a.notes) || '');
3473
+ this.setStepReady(data, order);
3474
+ if (this.consts.getCheckoutView() === 'single') {
3475
+ this.checkoutService.prefetchPaymentMethods();
3476
+ }
3477
+ this.analyticsService.callEvent('payment_info', order);
3478
+ return order;
3479
+ })).toPromise().then(res => res, err => {
3480
+ return new Promise((resolve, reject) => reject(new Error(err.error)));
3481
+ }).catch(err => console.error(err));
3482
+ };
3463
3483
  this.setAddress = (user_data) => {
3464
3484
  user_data.locale = this.consts.getLocale();
3465
3485
  // se modifica el código postal para castearlo a String antes de enviarlo
@@ -5137,6 +5157,7 @@ let ShipmentService = class ShipmentService extends StepService {
5137
5157
  });
5138
5158
  };
5139
5159
  this.setMethod = (method) => __awaiter$6(this, void 0, void 0, function* () {
5160
+ var _a, _b;
5140
5161
  // Deshabilitar todos los botones
5141
5162
  this.buttonsDisabled = true;
5142
5163
  this.errorSubject.next(null);
@@ -5147,7 +5168,7 @@ let ShipmentService = class ShipmentService extends StepService {
5147
5168
  this.checkoutService.updateAsociatedData(res);
5148
5169
  this.order = res;
5149
5170
  const costs = yield this.getCalculatedCosts();
5150
- this.modifyCostsResponse(costs, this.getUserData().shippingAddress.postcode, method);
5171
+ this.modifyCostsResponse(costs, (_b = (_a = this.getUserData()) === null || _a === void 0 ? void 0 : _a.shippingAddress) === null || _b === void 0 ? void 0 : _b.postcode, method);
5151
5172
  }
5152
5173
  catch (err) {
5153
5174
  console.error(err);
@@ -5215,8 +5236,8 @@ let ShipmentService = class ShipmentService extends StepService {
5215
5236
  this.costsSubject.next(costs);
5216
5237
  });
5217
5238
  this.buildCostsFromResponse = (response, method) => __awaiter$6(this, void 0, void 0, function* () {
5218
- var _a;
5219
- const result = ((_a = response) === null || _a === void 0 ? void 0 : _a.multiplePrices) || [];
5239
+ var _c;
5240
+ const result = ((_c = response) === null || _c === void 0 ? void 0 : _c.multiplePrices) || [];
5220
5241
  let branch_delivery = result.findIndex(submethod => submethod.name == 'branch_delivery');
5221
5242
  if (branch_delivery != -1) {
5222
5243
  result[branch_delivery].contracts = result[branch_delivery].contracts.map(contract => {
@@ -7482,11 +7503,13 @@ let DataFormEcComponent = class DataFormEcComponent extends ComponentHelper {
7482
7503
  this.allready_data = false;
7483
7504
  this.addressBook = [];
7484
7505
  this.addressBookSelected = { id: 0, notes: "" };
7506
+ this.addressBookSelectedFacturacion = { id: 0, notes: "" };
7485
7507
  this.finish = false; //Esta variable se usa para mostrar el boton de finalizar.
7486
7508
  this.validado = false;
7487
7509
  this.viewDataFacturacion = true;
7488
7510
  this.params = {};
7489
7511
  this.selectAddres = false;
7512
+ this.selectAddressFacturacion = false;
7490
7513
  this.addressSearch = '';
7491
7514
  this.addressDropdownOpen = false;
7492
7515
  this.formReadonly = false;
@@ -7494,6 +7517,10 @@ let DataFormEcComponent = class DataFormEcComponent extends ComponentHelper {
7494
7517
  this.tempAddressId = 0;
7495
7518
  this.postalCodeErrorMessage = "";
7496
7519
  this.postalCodeErrorMessageFacturacion = "";
7520
+ this.postalCodeVisible = true;
7521
+ this.postalCodeVisibleFacturacion = true;
7522
+ this.postalCodeRequired = true;
7523
+ this.postalCodeRequiredFacturacion = true;
7497
7524
  this.documentErrorMessage = "";
7498
7525
  this.documentErrorMessageFacturacion = "";
7499
7526
  this.customerHasCustomerTaxRate = false;
@@ -7648,6 +7675,54 @@ let DataFormEcComponent = class DataFormEcComponent extends ComponentHelper {
7648
7675
  const current = this.checkoutFormFacturacion.controls['documentType'].value;
7649
7676
  return ((_b = (_a = documentTypes) === null || _a === void 0 ? void 0 : _a.find(doc => doc.code == current)) === null || _b === void 0 ? void 0 : _b.name) || '';
7650
7677
  };
7678
+ this.getBasePostalCodeEnabled = () => { var _a, _b, _c, _d; return _d = (_c = (_b = (_a = this.addressingService.getTypeForm()) === null || _a === void 0 ? void 0 : _a.viewForms) === null || _b === void 0 ? void 0 : _b.postcode) === null || _c === void 0 ? void 0 : _c.enabled, (_d !== null && _d !== void 0 ? _d : true); };
7679
+ this.getBasePostalCodeRequired = () => { var _a, _b, _c, _d; return _d = (_c = (_b = (_a = this.addressingService.getTypeForm()) === null || _a === void 0 ? void 0 : _a.viewForms) === null || _b === void 0 ? void 0 : _b.postcode) === null || _c === void 0 ? void 0 : _c.required, (_d !== null && _d !== void 0 ? _d : true); };
7680
+ this.getDefaultPostalCodeFieldState = () => {
7681
+ const visible = this.getBasePostalCodeEnabled();
7682
+ return {
7683
+ visible,
7684
+ required: visible && this.getBasePostalCodeRequired()
7685
+ };
7686
+ };
7687
+ this.resolveCountryByCode = (code) => {
7688
+ if (!code)
7689
+ return null;
7690
+ const countryFromSubjects = [
7691
+ ...(this.countriesSubject.value || []),
7692
+ ...(this.countriesFacturacionSubject.value || [])
7693
+ ].find(country => country.code == code);
7694
+ return countryFromSubjects
7695
+ || this.addressingService.countriesList.find(country => country.code == code)
7696
+ || null;
7697
+ };
7698
+ this.resolveCountryForPostalCode = (selectedCountry) => {
7699
+ if (!selectedCountry)
7700
+ return null;
7701
+ if (selectedCountry.checkoutRequiredFields || selectedCountry.isPostalCodeNumeric !== undefined) {
7702
+ return selectedCountry;
7703
+ }
7704
+ return this.resolveCountryByCode(selectedCountry.code || selectedCountry.countryCode);
7705
+ };
7706
+ this.resolvePostalCodeFieldState = (country) => {
7707
+ var _a, _b;
7708
+ const checkoutPostalCode = (_b = (_a = country) === null || _a === void 0 ? void 0 : _a.checkoutRequiredFields) === null || _b === void 0 ? void 0 : _b.postalCode;
7709
+ if (checkoutPostalCode === false) {
7710
+ return { visible: false, required: false };
7711
+ }
7712
+ if (checkoutPostalCode === true) {
7713
+ return { visible: true, required: true };
7714
+ }
7715
+ return this.getDefaultPostalCodeFieldState();
7716
+ };
7717
+ this.isPostalCodeFieldVisible = (billing = false) => billing ? this.postalCodeVisibleFacturacion : this.postalCodeVisible;
7718
+ this.isPostalCodeFieldRequired = (billing = false) => billing ? this.postalCodeRequiredFacturacion : this.postalCodeRequired;
7719
+ this.shouldShowPostalCodeByCountryCode = (code) => {
7720
+ const country = this.resolveCountryByCode(code);
7721
+ if (!country) {
7722
+ return this.getDefaultPostalCodeFieldState().visible;
7723
+ }
7724
+ return this.resolvePostalCodeFieldState(country).visible;
7725
+ };
7651
7726
  this.toggleDocumentTypeDropdown = (event) => {
7652
7727
  var _a;
7653
7728
  event.stopPropagation();
@@ -7873,6 +7948,221 @@ let DataFormEcComponent = class DataFormEcComponent extends ComponentHelper {
7873
7948
  this.setCheckoutFormReadonly(this.compactAddressView && !this.getMode());
7874
7949
  this.evaluateDirtyState();
7875
7950
  };
7951
+ this.getModeFacturacion = () => {
7952
+ switch (this.addressingService.modeSelectAddress) {
7953
+ case 'ONLY_LOAD_ADDRESS':
7954
+ return true;
7955
+ case 'ONLY_ADDRESS_SELECTION':
7956
+ return !this.authService.isAuthenticated();
7957
+ case 'LOAD_ADDRESS_AND_SELECTION':
7958
+ return this.authService.isAuthenticated() ? this.selectAddressFacturacion : true;
7959
+ }
7960
+ };
7961
+ this.setModeFacturacion = (mode) => {
7962
+ this.selectAddressFacturacion = mode === 'carga';
7963
+ this.onFormChange();
7964
+ this.evaluateDirtyState();
7965
+ };
7966
+ this.setSelectAddressFacturacion = (addressSelect) => {
7967
+ var _a;
7968
+ (this.addressBook || []).forEach(address => {
7969
+ var _a;
7970
+ address.selectedFacturacion = String(address.id) === String((_a = addressSelect) === null || _a === void 0 ? void 0 : _a.id);
7971
+ });
7972
+ this.addressBookSelectedFacturacion.id = ((_a = (this.addressBook || []).find(address => address.selectedFacturacion)) === null || _a === void 0 ? void 0 : _a.id) || 0;
7973
+ };
7974
+ this.buildAddressFromBook = (bookAddress) => {
7975
+ var _a, _b;
7976
+ const contact = ((_a = bookAddress) === null || _a === void 0 ? void 0 : _a.addressContact) || {};
7977
+ return {
7978
+ firstName: contact.firstName || '',
7979
+ lastName: contact.lastName || '',
7980
+ phoneNumber: contact.phoneNumber || '',
7981
+ email: contact.email || '',
7982
+ documentType: contact.documentType || '',
7983
+ documentNumber: contact.documentNumber || '',
7984
+ countryCode: bookAddress.countryCode,
7985
+ provinceCode: bookAddress.provinceCode,
7986
+ city: bookAddress.city,
7987
+ street: bookAddress.street,
7988
+ postcode: ((_b = bookAddress.postcode) === null || _b === void 0 ? void 0 : _b.toString()) || ''
7989
+ };
7990
+ };
7991
+ this.handleBillingFormSubmit = (event) => {
7992
+ event.preventDefault();
7993
+ if (this.getMode()) {
7994
+ this.verifyValidate(null, null);
7995
+ }
7996
+ };
7997
+ this.onSelectAddress = (items) => __awaiter$9(this, void 0, void 0, function* () {
7998
+ if (this.canCompleteLegacyAddressOnlyCheckout()) {
7999
+ this.nextStep();
8000
+ return;
8001
+ }
8002
+ const notesCfg = this.addressingService.getTypeForm().viewForms.notes;
8003
+ if (notesCfg.required && (!this.addressBookSelected.notes || !this.addressBookSelected.notes.trim())) {
8004
+ this.toast.show('required-fields');
8005
+ return;
8006
+ }
8007
+ const previousTotals = Object.assign({}, this.lastSummaryTotalsSnapshot);
8008
+ this.loading = true;
8009
+ try {
8010
+ const addressSelected = this.addressBook.find(address => address.selected);
8011
+ if (!addressSelected) {
8012
+ this.showError('invalid-form');
8013
+ return;
8014
+ }
8015
+ if (!this.addressBookSelected.id)
8016
+ this.addressBookSelected.id = addressSelected.id || 0;
8017
+ const request = {
8018
+ shippingAddressId: addressSelected.id,
8019
+ billingAddressId: addressSelected.id,
8020
+ notes: this.addressBookSelected.notes || ""
8021
+ };
8022
+ const resultSede = yield this.addressingService.setHeadquarterByIds(request);
8023
+ if (!resultSede) {
8024
+ this.toast.show('operation-error');
8025
+ return;
8026
+ }
8027
+ if (this.cartService.channelConfig.applyOrderLot) {
8028
+ (items || []).forEach(item => {
8029
+ var _a, _b, _c, _d;
8030
+ if (!item.lot[0]) {
8031
+ this.cartService.addToLot(item.product, 0, item.variant_id, 0, item.item_id, item.quantity, item.product.price, item.quantity, item.discount, item.product.price * item.quantity, 'new', '', '', 0, ((_b = (_a = resultSede) === null || _a === void 0 ? void 0 : _a.shippingAddress) === null || _b === void 0 ? void 0 : _b.city) + ' - ' + ((_d = (_c = resultSede) === null || _c === void 0 ? void 0 : _c.shippingAddress) === null || _d === void 0 ? void 0 : _d.street), 'newlot');
8032
+ }
8033
+ });
8034
+ }
8035
+ this.form_ready = true;
8036
+ this.allready_data = true;
8037
+ this.setSavedStateFromCurrent();
8038
+ const totalsChanged = this.haveTotalsChanged(previousTotals, resultSede);
8039
+ if (this.compactAddressView && this.nextStep) {
8040
+ this.nextStep();
8041
+ }
8042
+ else if (this.isLegacyAddressOnlyCheckout()) {
8043
+ totalsChanged && this.scrollToLegacySummary();
8044
+ return;
8045
+ }
8046
+ else {
8047
+ this.nextStep();
8048
+ }
8049
+ }
8050
+ catch (e) {
8051
+ this.toast.show('operation-error');
8052
+ }
8053
+ finally {
8054
+ this.loading = false;
8055
+ }
8056
+ });
8057
+ this.onSelectAddressFacturacion = (items) => __awaiter$9(this, void 0, void 0, function* () {
8058
+ const addressSelectedFacturacion = this.addressBook.find(address => address.selectedFacturacion);
8059
+ const addressSelectedEnvio = this.addressBook.find(address => address.selected);
8060
+ if (!addressSelectedFacturacion || !addressSelectedEnvio) {
8061
+ this.showError('invalid-form');
8062
+ return;
8063
+ }
8064
+ const previousTotals = Object.assign({}, this.lastSummaryTotalsSnapshot);
8065
+ this.loading = true;
8066
+ try {
8067
+ this.addressBookSelected.id = addressSelectedEnvio.id || 0;
8068
+ this.addressBookSelectedFacturacion.id = addressSelectedFacturacion.id || 0;
8069
+ const request = {
8070
+ shippingAddressId: addressSelectedEnvio.id,
8071
+ billingAddressId: addressSelectedFacturacion.id,
8072
+ notes: this.addressBookSelected.notes || ""
8073
+ };
8074
+ const resultSede = yield this.addressingService.setHeadquarterByIds(request);
8075
+ if (!resultSede) {
8076
+ this.toast.show('operation-error');
8077
+ return;
8078
+ }
8079
+ if (this.cartService.channelConfig.applyOrderLot) {
8080
+ (items || []).forEach(item => {
8081
+ if (!item.lot[0]) {
8082
+ this.cartService.addToLot(item.product, 0, item.variant_id, 0, item.item_id, item.quantity, item.product.price, item.quantity, item.discount, item.product.price * item.quantity, 'new', '', '', 0, addressSelectedEnvio.city + ' - ' + addressSelectedEnvio.street, 'newlot');
8083
+ }
8084
+ });
8085
+ }
8086
+ this.form_ready = true;
8087
+ this.allready_data = true;
8088
+ this.setSavedStateFromCurrent();
8089
+ const totalsChanged = this.haveTotalsChanged(previousTotals, resultSede);
8090
+ if (this.compactAddressView && this.nextStep) {
8091
+ this.nextStep();
8092
+ }
8093
+ else if (this.isLegacyAddressOnlyCheckout()) {
8094
+ totalsChanged && this.scrollToLegacySummary();
8095
+ return;
8096
+ }
8097
+ else {
8098
+ this.nextStep();
8099
+ }
8100
+ }
8101
+ catch (e) {
8102
+ this.toast.show('operation-error');
8103
+ }
8104
+ finally {
8105
+ this.loading = false;
8106
+ }
8107
+ });
8108
+ this.onSubmitNewBillingAddress = (items) => __awaiter$9(this, void 0, void 0, function* () {
8109
+ var _a;
8110
+ if (!this.checkoutFormFacturacion.valid) {
8111
+ this.showError('invalid-form');
8112
+ return;
8113
+ }
8114
+ const addressSelectedEnvio = this.addressBook.find(address => address.selected);
8115
+ if (!addressSelectedEnvio) {
8116
+ this.showError('invalid-form');
8117
+ return;
8118
+ }
8119
+ const previousTotals = Object.assign({}, this.lastSummaryTotalsSnapshot);
8120
+ this.loading = true;
8121
+ try {
8122
+ const billingFormData = Object.assign({}, this.checkoutFormFacturacion.getRawValue());
8123
+ billingFormData.postcode = (_a = billingFormData.postcode) === null || _a === void 0 ? void 0 : _a.toString();
8124
+ const addressData = {
8125
+ shippingAddress: this.buildAddressFromBook(addressSelectedEnvio),
8126
+ billingAddress: billingFormData,
8127
+ notes: this.addressBookSelected.notes || ""
8128
+ };
8129
+ const result = yield this.addressingService.setAddress(addressData);
8130
+ if (result === false) {
8131
+ this.require_login = true;
8132
+ this.toast.show('email_already_registered');
8133
+ return;
8134
+ }
8135
+ if (result !== undefined) {
8136
+ if (this.cartService.channelConfig.applyOrderLot) {
8137
+ (items || []).forEach(item => {
8138
+ if (!item.lot[0]) {
8139
+ this.cartService.addToLot(item.product, 0, item.variant_id, 0, item.item_id, item.quantity, item.product.price, item.quantity, item.discount, item.product.price * item.quantity, 'new', '', '', 0, addressSelectedEnvio.city + ' - ' + addressSelectedEnvio.street, 'newlot');
8140
+ }
8141
+ });
8142
+ }
8143
+ this.form_ready = true;
8144
+ this.allready_data = true;
8145
+ this.setSavedStateFromCurrent();
8146
+ const totalsChanged = this.haveTotalsChanged(previousTotals, result);
8147
+ if (this.compactAddressView && this.nextStep) {
8148
+ this.nextStep();
8149
+ }
8150
+ else if (this.isLegacyAddressOnlyCheckout()) {
8151
+ totalsChanged && this.scrollToLegacySummary();
8152
+ return;
8153
+ }
8154
+ else {
8155
+ this.nextStep();
8156
+ }
8157
+ }
8158
+ }
8159
+ catch (e) {
8160
+ this.toast.show('operation-error');
8161
+ }
8162
+ finally {
8163
+ this.loading = false;
8164
+ }
8165
+ });
7876
8166
  this.toggleAddressDropdown = () => {
7877
8167
  this.addressDropdownOpen = !this.addressDropdownOpen;
7878
8168
  };
@@ -8207,24 +8497,26 @@ let DataFormEcComponent = class DataFormEcComponent extends ComponentHelper {
8207
8497
  this.updateDocumentValidation(selectedDoc);
8208
8498
  }
8209
8499
  }
8500
+ const selectedBillingCountry = this.countriesFacturacionSubject.value.find(country => country.code == this.checkoutFormFacturacion.controls['countryCode'].value);
8501
+ this.updatePostalCodeValidationFacturacion(selectedBillingCountry);
8210
8502
  this.onFormChange();
8211
8503
  }
8212
8504
  this.suppressDirty = false;
8213
8505
  this.setDirtyState(false);
8214
8506
  };
8215
8507
  this.ecOnConstruct();
8216
- 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
8217
- }));
8508
+ this.checkoutForm = this.fb.group(Object.assign(Object.assign({}, this.addressingService.getTypeForm().configForm.formAddres), { postcode: [''] }));
8218
8509
  this.checkoutForm.statusChanges
8219
8510
  .pipe(filter(() => { this.onFormChange(); return this.checkoutForm.valid; }))
8220
8511
  .subscribe(() => this.onFormValid());
8221
8512
  this.checkoutForm.valueChanges.subscribe(() => this.evaluateDirtyState());
8222
- 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
8223
- }));
8513
+ this.checkoutFormFacturacion = this.fb.group(Object.assign(Object.assign({}, this.addressingService.getTypeForm().configForm.formBilling), { postcode: [''] }));
8224
8514
  this.checkoutFormFacturacion.statusChanges
8225
8515
  .pipe(filter(() => { this.onFormChange(); return this.checkoutFormFacturacion.valid; }))
8226
8516
  .subscribe(() => this.onFormValid());
8227
8517
  this.checkoutFormFacturacion.valueChanges.subscribe(() => this.evaluateDirtyState());
8518
+ this.updatePostalCodeValidation(null);
8519
+ this.updatePostalCodeValidationFacturacion(null);
8228
8520
  }
8229
8521
  ngOnInit() {
8230
8522
  var _a;
@@ -8328,10 +8620,48 @@ let DataFormEcComponent = class DataFormEcComponent extends ComponentHelper {
8328
8620
  form.controls[formControlName].updateValueAndValidity();
8329
8621
  }
8330
8622
  updatePostalCodeValidation(selectedCountry) {
8331
- this.updateValidation(selectedCountry, 'postcode', this.checkoutForm, 'postalCodeErrorMessage', 'isPostalCodeNumeric', 'postal-code-pattern-error');
8623
+ var _a, _b;
8624
+ const country = this.resolveCountryForPostalCode(selectedCountry);
8625
+ const { visible, required } = country
8626
+ ? this.resolvePostalCodeFieldState(country)
8627
+ : this.getDefaultPostalCodeFieldState();
8628
+ const isNumeric = (_b = (_a = country) === null || _a === void 0 ? void 0 : _a.isPostalCodeNumeric, (_b !== null && _b !== void 0 ? _b : false));
8629
+ const validators = [];
8630
+ if (required) {
8631
+ validators.push(Validators.required);
8632
+ }
8633
+ if (visible && isNumeric) {
8634
+ validators.push(Validators.pattern(/^\d+$/));
8635
+ }
8636
+ this.postalCodeVisible = visible;
8637
+ this.postalCodeRequired = required;
8638
+ this.postalCodeErrorMessage = isNumeric
8639
+ ? 'postal-code-pattern-error.numeric'
8640
+ : 'postal-code-pattern-error.default';
8641
+ this.checkoutForm.controls['postcode'].setValidators(validators);
8642
+ this.checkoutForm.controls['postcode'].updateValueAndValidity({ emitEvent: false });
8332
8643
  }
8333
8644
  updatePostalCodeValidationFacturacion(selectedCountry) {
8334
- this.updateValidation(selectedCountry, 'postcode', this.checkoutFormFacturacion, 'postalCodeErrorMessageFacturacion', 'isPostalCodeNumeric', 'postal-code-pattern-error');
8645
+ var _a, _b;
8646
+ const country = this.resolveCountryForPostalCode(selectedCountry);
8647
+ const { visible, required } = country
8648
+ ? this.resolvePostalCodeFieldState(country)
8649
+ : this.getDefaultPostalCodeFieldState();
8650
+ const isNumeric = (_b = (_a = country) === null || _a === void 0 ? void 0 : _a.isPostalCodeNumeric, (_b !== null && _b !== void 0 ? _b : false));
8651
+ const validators = [];
8652
+ if (required) {
8653
+ validators.push(Validators.required);
8654
+ }
8655
+ if (visible && isNumeric) {
8656
+ validators.push(Validators.pattern(/^\d+$/));
8657
+ }
8658
+ this.postalCodeVisibleFacturacion = visible;
8659
+ this.postalCodeRequiredFacturacion = required;
8660
+ this.postalCodeErrorMessageFacturacion = isNumeric
8661
+ ? 'postal-code-pattern-error.numeric'
8662
+ : 'postal-code-pattern-error.default';
8663
+ this.checkoutFormFacturacion.controls['postcode'].setValidators(validators);
8664
+ this.checkoutFormFacturacion.controls['postcode'].updateValueAndValidity({ emitEvent: false });
8335
8665
  }
8336
8666
  updateDocumentValidation(selectedDocumentType) {
8337
8667
  this.updateValidation(selectedDocumentType, 'documentNumber', this.checkoutForm, 'documentErrorMessage', 'isNumeric', 'document-pattern-error', this.addressingService.getTypeForm().viewForms.documentNumber.required);
@@ -8374,7 +8704,7 @@ __decorate$P([
8374
8704
  DataFormEcComponent = __decorate$P([
8375
8705
  Component({
8376
8706
  selector: 'app-dataform-ec',
8377
- template: "<ng-container\n *ngIf=\"this.channelConfig.channelType != 'b2b' || (this.channelConfig.channelType == 'b2b' && authService.isAuthenticated()); else pleaseLogin\">\n <ng-container\n *ngIf=\"this.addressingService.modeSelectAddress == 'LOAD_ADDRESS_AND_SELECTION' && this.authService.isAuthenticated() && this.addressBook != null && !compactAddressView\">\n <div class=\"container card p-4 mb-3\">\n <div class=\"row justify-content-center\">\n <div class=\"col-12 col-md-10 col-lg-8 text-center\">\n <div class=\"btn-group btn-group-toggle\" data-bs-toggle=\"buttons\">\n <label [class]=\"'btn btn-outline-secondary ' + (!getMode() ? 'active' : '')\">\n <input type=\"radio\" name=\"options\" id=\"option1\" autocomplete=\"off\" checked\n (change)=\"setMode('seleccion')\"> {{'select-address' | translate | titlecase}}\n </label>\n\n <label [class]=\"'btn btn-outline-secondary ' + (getMode() ? 'active' : '')\"\n *ngIf=\"!getParamByChannelAndLanguage('btn_new_address_') && !customerHasCustomerTaxRate\">\n <input type=\"radio\" name=\"options\" id=\"option2\" autocomplete=\"off\"\n (change)=\"setMode('carga')\">\n {{ 'new-address' | translate | titlecase}}\n </label>\n\n <label [class]=\"'btn btn-outline-secondary ' + (selectAddress ? 'active' : '')\"\n *ngIf=\"getParamByChannelAndLanguage('btn_new_address_') as param\">\n <input type=\"radio\" name=\"options\" id=\"option2\" autocomplete=\"off\"\n (change)=\"setMode('carga')\">\n {{ param.value}}\n </label>\n\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"compactAddressView || getMode(); else addressSelection\">\n <div *ngIf=\"!require_login; else requireLoginView\">\n <div class=\"single-step-surface\">\n <div class=\"single-step-overlay\" *ngIf=\"compactAddressView && loading\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n\n <ng-container *ngIf=\"this.addressingService.modeSelectAddress == 'ONLY_LOAD_ADDRESS'\">\n <div class=\"checkout-title my-2\">\n <h3>{{'billing-details'|translate}}</h3>\n </div>\n </ng-container>\n\n <app-dataform-ec-single\n *ngIf=\"compactAddressView\"\n [showToggle]=\"this.addressingService.modeSelectAddress == 'LOAD_ADDRESS_AND_SELECTION' && this.authService.isAuthenticated() && this.addressBook != null\"\n [isNewAddressMode]=\"getMode()\"\n [showDefaultNewAddressButton]=\"!getParamByChannelAndLanguage('btn_new_address_') && !customerHasCustomerTaxRate\"\n [customNewAddressLabel]=\"getParamByChannelAndLanguage('btn_new_address_')?.value\"\n [isTemporarySelected]=\"selectedAddress?.isTemporary\"\n [selectedAddressLabel]=\"getSelectedAddressLabel()\"\n [addressDropdownOpen]=\"addressDropdownOpen\"\n [addressSearch]=\"addressSearch\"\n [addressOptions]=\"getFilteredAddressOptions()\"\n [showSelectBlock]=\"!getMode()\"\n [hasSelectedAddress]=\"hasSelectedAddress()\"\n (modeChange)=\"setMode($event)\"\n (toggleDropdown)=\"toggleAddressDropdown()\"\n (closeDropdown)=\"addressDropdownOpen = false\"\n (selectAddress)=\"selectAddressFromDropdown($event)\"\n (addressSearchChange)=\"addressSearch = $event\">\n </app-dataform-ec-single>\n\n <form (submit)=\"verifyValidate(false,this.cartService.items)\"\n [class.compact-address-form]=\"compactAddressView\"\n *ngIf=\"!compactAddressView || getMode() || hasSelectedAddress()\">\n <div class=\"row mt-df\"><!--Fila 1-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.enabled\">\n <label class=\"field-label\">{{'first-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"firstName\"\n [formControl]=\"checkoutForm.controls['firstName']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.firstName.dirty || checkoutForm.controls.firstName.touched) && checkoutForm.controls.firstName.errors?.required\">\n <span class=\"text-danger\">{{'first-name-help1'|translate}}</span>\n\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.firstName.dirty || checkoutForm.controls.firstName.touched) && checkoutForm.controls.firstName.errors?.pattern\">\n <span class=\"text-danger\">\n {{'first-name-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.enabled\">\n <label class=\"field-label\">{{'last-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"lastName\"\n [formControl]=\"checkoutForm.controls['lastName']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.lastName.dirty || checkoutForm.controls.lastName.touched) && checkoutForm.controls.lastName.errors?.required\">\n <span class=\"text-danger\">{{'last-name-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.lastName.dirty || checkoutForm.controls.lastName.touched) && checkoutForm.controls.lastName.errors?.pattern\">\n <span class=\"text-danger\">{{'last-name-help2'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\"><!--Fila 2-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.enabled\">\n <label class=\"field-label\">{{'phone'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"tel\" name=\"phoneNumber\"\n [formControl]=\"checkoutForm.controls['phoneNumber']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.phoneNumber.dirty || checkoutForm.controls.phoneNumber.touched) && checkoutForm.controls.phoneNumber.errors?.required\">\n <span class=\"text-danger\">\n\n {{'phone-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.phoneNumber.dirty || checkoutForm.controls.phoneNumber.touched) && checkoutForm.controls.phoneNumber.errors?.pattern\">\n <span class=\"text-danger\">\n {{'phone-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.enabled\">\n <label class=\"field-label\">{{'email-address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"email\" name=\"email\"\n [formControl]=\"checkoutForm.controls['email']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.email.dirty || checkoutForm.controls.email.touched) && checkoutForm.controls.email.errors?.required\">\n <span class=\"text-danger\">\n {{'email-address-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.email.dirty || checkoutForm.controls.email.touched) && checkoutForm.controls.email.errors?.email\">\n <span class=\"text-danger\">\n {{'email-address-help2'|translate}}\n </span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 3-->\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(countries$ | async) as countries\">\n <label class=\"field-label\">{{'country'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"countryCode\"\n [formControl]=\"checkoutForm.controls['countryCode']\"\n (change)=\"onCountrySelected($event.target.value)\">\n <!-- <option selected [value]=\"countries[0].code\">{{ 'choose-country' | translate }}</option> -->\n <option *ngFor=\"let country of countries\" [value]=\"country.code\">{{ country.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutForm.controls.countryCode.dirty || checkoutForm.controls.countryCode.touched) && checkoutForm.controls.countryCode.errors?.required\"\n class=\"text text-danger\">\n {{'country-help'|translate}}\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(provinces$ | async) as provinces\">\n <label class=\"field-label\">{{'state'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"provinceCode\"\n (change)=\"onProvincesSelected($event.target.value)\"\n [formControl]=\"checkoutForm.controls['provinceCode']\">\n <!-- <option selected [value]=\"null\">{{ 'choose-province' | translate }}</option>\n -->\n <option *ngFor=\"let province of provinces\" [value]=\"province.code\">{{ province.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutForm.controls.provinceCode.dirty || checkoutForm.controls.provinceCode.touched) && checkoutForm.controls.provinceCode.errors?.required\"\n class=\"text text-danger\">\n {{'state-help'|translate}}\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.enabled\">\n <label class=\"field-label\">{{'town-city'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"city\"\n [formControl]=\"checkoutForm.controls['city']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.city.dirty || checkoutForm.controls.city.touched) && checkoutForm.controls.city.errors?.required\">\n <span class=\"text-danger\">{{'town-city-help'|translate}}</span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 4-->\n <div class=\"form-group col-12 col-md-8\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.enabled\">\n <label class=\"field-label\">{{'address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.required\"\n class=\"required\">*</span>\n <span class=\"char-count\">\n {{ 50 - (checkoutForm.controls['street'].value?.length || 0) }}\n {{'remainingCharacters'|translate}}\n </span>\n </label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"street\"\n [formControl]=\"checkoutForm.controls['street']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.street.dirty || checkoutForm.controls.street.touched) && checkoutForm.controls.street.errors?.required\">\n <span class=\"text-danger\">{{'address-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.street.dirty || checkoutForm.controls.street.touched) && checkoutForm.controls.street.errors?.maxlength\">\n <span class=\"text-danger\">{{'address-help2'|translate}}</span>\n </div>\n </div>\n\n <!-- form direcci\u00F3n -->\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.postcode.enabled\">\n <label class=\"field-label\">{{'postal-code'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.postcode.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"postcode\"\n [formControl]=\"checkoutForm.controls['postcode']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.postcode.dirty || checkoutForm.controls.postcode.touched) && checkoutForm.controls.postcode.errors?.required\">\n <span class=\"text-danger\">{{'postal-code-help'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.postcode.dirty || checkoutForm.controls.postcode.touched) && checkoutForm.controls.postcode.errors?.pattern\">\n <span class=\"text-danger\"> {{postalCodeErrorMessage | translate}} </span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 5-->\n <ng-container *ngIf=\"compactAddressView; else documentRowFull\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled; else documentNumberOnly\">\n <div class=\"form-group col-12\" *ngIf=\"(documentTypes$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <div class=\"input-group document-input-group\">\n <button class=\"btn btn-outline-secondary dropdown-toggle\" type=\"button\"\n (click)=\"toggleDocumentTypeDropdown($event)\"\n [attr.aria-expanded]=\"documentTypeDropdownOpen\"\n [disabled]=\"checkoutForm.controls['documentType']?.disabled || formReadonly\">\n {{ getSelectedDocumentTypeLabel(documentTypes) || ('document-type' | translate) }}\n </button>\n <div class=\"dropdown-menu\" [class.show]=\"documentTypeDropdownOpen\">\n <button class=\"dropdown-item\" type=\"button\"\n *ngFor=\"let item of documentTypes\"\n (click)=\"selectDocumentType(item.code)\">\n {{ item.name }}\n </button>\n </div>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentType.dirty || checkoutForm.controls.documentType.touched) && checkoutForm.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n <ng-template #documentNumberOnly>\n <div class=\"form-group col-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </ng-container>\n <ng-template #documentRowFull>\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(documentTypes$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.required\"\n class=\"required\">*</span></label>\n <select name=\"documentType\" class=\"form-select\"\n (change)=\"onDocumentTypesSelected($event.target.value)\"\n [formControl]=\"checkoutForm.controls['documentType']\">\n <option *ngFor=\"let item of documentTypes\" [value]=\"item.code\">{{item.name}}</option>\n </select>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentType.dirty || checkoutForm.controls.documentType.touched) && checkoutForm.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\" name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </div>\n\n <div class=\"row mt-df\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a' && !(compactAddressView && !getMode())\"><!--Fila 6-->\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"><span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n\n <!-- <label class=\"field-label\">{{'notes'|translate}}<span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\" class=\"required\">*</span></label> -->\n <textarea (change)=\"onInputChange()\" class=\"form-control notes-textarea\" name=\"notes\"\n [formControl]=\"checkoutForm.controls['notes']\" rows=\"3\" placeholder=\"\"\n autocomplete=\"off\"></textarea>\n </div>\n </div>\n <div class=\"row mt-df address-meta-row\" *ngIf=\"!(compactAddressView && !getMode())\"><!--Fila 7-->\n <div class=\"form-group col-12 col-md-12\">\n <label for=\"formFact\"><b>{{ 'same-billing-address' | translate }}</b> <input type=\"checkbox\"\n class=\"ms-2\" [checked]=\"viewDataFacturacion\" (change)=\"showFormFacturacion()\"\n id=\"formFact\"></label>\n </div>\n </div>\n <div class=\"row mt-df address-required-row\" *ngIf=\"!(compactAddressView && !getMode())\">\n <div class=\"col-12\">\n <span class=\"required-hint-text\">\n <span class=\"required-hint-asterisk\">*</span> {{ 'required-fields' | translate }}\n </span>\n </div>\n </div>\n <div class=\"row mt-df address-terms-row\" *ngIf=\"!(compactAddressView && !getMode())\">\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.terms.enabled\">\n <label class=\"terms-label\" for=\"\">\n <input class=\"me-2\" name=\"terms\" [formControl]=\"checkoutForm.controls['terms']\"\n type=\"checkbox\" required (change)=\"onInputChange()\" />\n <span>{{ 'accept-terms-prefix' | translate }}</span>\n <button type=\"button\" class=\"terms-link\" (click)=\"openModal(template)\">\n {{ 'terms-and-conditions' | translate }}\n </button>\n <span *ngIf=\"this.addressingService.getTypeForm().viewForms.terms.required\"\n class=\"required\">*</span>\n </label>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.terms.dirty || checkoutForm.controls.terms.touched) && !checkoutForm.controls.terms.value\">\n <span class=\"text-danger\">{{ 'must-accept-terms' | translate }}</span>\n </div>\n </div>\n </div>\n <div class=\"row\" *ngIf=\"viewDataFacturacion ; else datosFormFacturacion\"> </div>\n <div class=\"checkout-btn-unique text-end\" *ngIf=\"!formReadonly\">\n <button type=\"submit\" [disabled]=\"!validado\" class=\"btn valid-btn mt-2\">\n {{ getPrimaryActionLabel() | translate }}</button>\n\n\n </div>\n <div *ngIf=\"loading && !compactAddressView\" class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </form>\n <ng-container *ngIf=\"compactAddressView && !getMode()\">\n <div class=\"w-100\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <div class=\"row mt-df\">\n <div class=\"form-group col-12 col-md-12\">\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"></label>\n <textarea (change)=\"onSelectionNotesChange()\" class=\"form-control notes-textarea\"\n name=\"notes\" [(ngModel)]=\"this.addressBookSelected.notes\" #ctrl=\"ngModel\" rows=\"3\"\n placeholder=\"\" autocomplete=\"off\" [disabled]=\"selectedAddress?.isTemporary\"></textarea>\n <div class=\"invalid-feedback d-block\" *ngIf=\"\n addressingService.getTypeForm().viewForms.notes.required\n && (!addressBookSelected.notes || !addressBookSelected.notes.trim())\n \">\n {{ 'required-field' | translate }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n </div>\n </div>\n </ng-container>\n\n <ng-template #addressSelection>\n\n <ng-container *ngIf=\"this.addressingService.modeSelectAddress == 'ONLY_ADDRESS_SELECTION'\">\n <div class=\"checkout-title my-2\">\n <h3>{{'address-selection'|translate}}</h3>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"this.addressBook; else addressBookNotResult\">\n\n <ng-container *ngIf=\"this.addressBook?.length ;else addressBookLoading\">\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-sm-6 col-12 my-3\" *ngFor=\"let item of addressBook; let i = index\">\n <ng-container *ngIf=\"compactAddressView; else addressCardFull\">\n <div class=\"address-card-compact\" [class.is-selected]=\"item.selected\"\n (click)=\"setSelectAddress(item); onInputChange()\">\n <label class=\"address-card-radio\">\n <input class=\"form-check-input input-size-lg\" type=\"radio\" [name]=\"'n-'+i\"\n [id]=\"i\" [checked]=\"item.selected\" (click)=\"setSelectAddress(item)\"\n (change)=\"onInputChange()\">\n </label>\n <div class=\"address-card-content\">\n <div class=\"address-card-main\">\n <div class=\"address-card-title\">{{ item.street }}</div>\n <div class=\"address-card-sub\">\n {{ item.city }} - {{ getProvince(item.provinceCode) }} - {{ getCountry(item.countryCode) }}\n </div>\n <div class=\"address-card-sub\">\n {{ 'postal-code' | translate }} {{ item.postcode }}\n </div>\n </div>\n <details class=\"address-card-details\" (click)=\"$event.stopPropagation()\">\n <summary>{{ 'details' | translate }}</summary>\n <div class=\"address-card-details-body\">\n <div class=\"address-card-detail-title\">{{ 'address-contact' | translate }}</div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'first-name' | translate }}</strong> {{ item.addressContact.firstName }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'last-name' | translate }}</strong> {{ item.addressContact.lastName }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'document-type' | translate }}</strong> {{ getDocumentType(item.addressContact.documentType) }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'document-number' | translate }}</strong> {{ item.addressContact.documentNumber }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'email-address' | translate }}</strong> {{ item.addressContact.email }}\n </div>\n </div>\n </details>\n </div>\n </div>\n </ng-container>\n <ng-template #addressCardFull>\n <div class=\"card p-3\">\n <input class=\"ms-1 mt-3 form-check-input input-size-lg\" type=\"radio\" [name]=\"'n-'+i\"\n [id]=\"i\" [checked]=\"item.selected\" (click)=\"setSelectAddress(item)\"\n (change)=\"onInputChange()\">\n <div class=\"ms-5\">\n <h4 class=\"card-title\">\n <strong>{{'address'|translate}}</strong><br>\n <span class=\"text-uppercase h3\">{{item.street}}</span>\n </h4>\n <div class=\"row\">\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'country'|translate}}</strong> {{getCountry(item.countryCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'state'|translate}}</strong> {{getProvince(item.provinceCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'town-city'|translate}}</strong> {{item.city}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'postal-code'|translate}}</strong> {{item.postcode}}\n </h5>\n </div>\n <div class=\"row px-3\">\n <div class=\"card p-2 bg-light w-100\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">{{'address-contact'|translate}}</h5>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'first-name'|translate}}</strong>\n {{item.addressContact.firstName}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'last-name'|translate}}</strong>\n {{item.addressContact.lastName}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'document-type'|translate}}</strong>\n {{getDocumentType(item.addressContact.documentType)}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'document-number'|translate}}</strong>\n {{item.addressContact.documentNumber}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'email-address'|translate}}</strong>\n {{item.addressContact.email}}\n </h6>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n\n </div>\n <!-- Se hardcodea el canal de mundo del juguete empresa A ya que se necesita con urgencia, se sustituira por un campo que llegara de backend. -->\n <div class=\"w-100\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <div class=\"row mt-df\">\n <div class=\"form-group col-12 col-md-12\">\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"notes\"\n [(ngModel)]=\"this.addressBookSelected.notes\" #ctrl=\"ngModel\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"invalid-feedback d-block\" *ngIf=\"\n addressingService.getTypeForm().viewForms.notes.required\n && (!addressBookSelected.notes || !addressBookSelected.notes.trim())\n \">\n {{ 'required-field' | translate }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n <div class=\"checkout-btn-unique text-end\">\n <button (click)=\"selectAddress(this.cartService.items)\" class=\"btn valid-btn mt-2\">\n {{ getPrimaryActionLabel() | translate }}\n </button>\n </div>\n <div *ngIf=\"loading\" class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n </ng-template>\n\n\n <ng-template #requireLoginView>\n <div id=\"loginCheckout\">\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center\" *ngIf=\"require_login\">\n <div class=\"col-12\">\n <app-login-form-ec (ready)=\"verifyValidate($event)\" [redirect]=\"false\" [title]=\"'need-login'\">\n </app-login-form-ec>\n </div>\n </div>\n </div>\n </ng-template>\n\n\n\n <ng-template #datosFormFacturacion>\n <div class=\"container-fluid px-0 px-md-2\">\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card \">\n <div class=\"card-header text-dark text-center\">\n <h3>{{'billing-data'|translate}}</h3>\n </div>\n <div class=\"card-body\">\n <form (submit)=\"verifyValidate()\">\n <div class=\"row mt-df\">\n <!--Fila 1-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.enabled\">\n <label class=\"field-label\">{{'first-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"firstName\"\n [formControl]=\"checkoutFormFacturacion.controls['firstName']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.firstName.dirty || checkoutFormFacturacion.controls.firstName.touched) && checkoutFormFacturacion.controls.firstName.errors?.required\">\n <span class=\"text-danger\">{{'first-name-help1'|translate}}</span>\n\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.firstName.dirty || checkoutFormFacturacion.controls.firstName.touched) && checkoutFormFacturacion.controls.firstName.errors?.pattern\">\n <span class=\"text-danger\">\n {{'first-name-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.enabled\">\n <label class=\"field-label\">{{'last-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"lastName\"\n [formControl]=\"checkoutFormFacturacion.controls['lastName']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.lastName.dirty || checkoutFormFacturacion.controls.lastName.touched) && checkoutFormFacturacion.controls.lastName.errors?.required\">\n <span class=\"text-danger\">{{'last-name-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.lastName.dirty || checkoutFormFacturacion.controls.lastName.touched) && checkoutFormFacturacion.controls.lastName.errors?.pattern\">\n <span class=\"text-danger\">{{'last-name-help2'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 2-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.enabled\">\n <label class=\"field-label\">{{'phone'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"tel\"\n name=\"phoneNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['phoneNumber']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.phoneNumber.dirty || checkoutFormFacturacion.controls.phoneNumber.touched) && checkoutFormFacturacion.controls.phoneNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'phone-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.phoneNumber.dirty || checkoutFormFacturacion.controls.phoneNumber.touched) && checkoutFormFacturacion.controls.phoneNumber.errors?.pattern\">\n <span class=\"text-danger\">\n {{'phone-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.enabled\">\n <label class=\"field-label\">{{'email-address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"email\" name=\"email\"\n [formControl]=\"checkoutFormFacturacion.controls['email']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.email.dirty || checkoutFormFacturacion.controls.email.touched) && checkoutFormFacturacion.controls.email.errors?.required\">\n <span class=\"text-danger\">\n {{'email-address-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.email.dirty || checkoutFormFacturacion.controls.email.touched) && checkoutFormFacturacion.controls.email.errors?.email\">\n <span class=\"text-danger\">\n {{'email-address-help2'|translate}}\n </span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 3-->\n\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.enabled\">\n\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(countriesFacturacion$ | async) as countries\">\n <label class=\"field-label\">{{'country'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"countryCode\"\n [formControl]=\"checkoutFormFacturacion.controls['countryCode']\"\n (change)=\"onCountrySelectedFacturacion($event.target.value)\">\n <!-- <option selected [value]=\"null\">{{ 'choose-country' | translate }}</option> -->\n <option *ngFor=\"let country of countries\" [value]=\"country.code\">\n {{ country.name }}</option>\n </select>\n <div *ngIf=\"(checkoutFormFacturacion.controls.countryCode.dirty || checkoutFormFacturacion.controls.countryCode.touched) && checkoutFormFacturacion.controls.countryCode.errors?.required\"\n class=\"text text-danger\">\n {{'country-help'|translate}}\n </div>\n </div>\n </ng-container>\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.enabled\">\n\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(provincesFacturacion$ | async) as provinces\">\n <label class=\"field-label\">{{'state'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"provinceCode\"\n (change)=\"onProvincesSelectedFacturacion($event.target.value)\"\n [formControl]=\"checkoutFormFacturacion.controls['provinceCode']\">\n <!-- <option selected [value]=\"null\">{{ 'choose-province' | translate }}</option> -->\n <option *ngFor=\"let province of provinces\" [value]=\"province.code\">\n {{ province.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutFormFacturacion.controls.provinceCode.dirty || checkoutFormFacturacion.controls.provinceCode.touched) && checkoutFormFacturacion.controls.provinceCode.errors?.required\"\n class=\"text text-danger\">\n {{'state-help'|translate}}\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.enabled\">\n <label class=\"field-label\">{{'town-city'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"city\"\n [formControl]=\"checkoutFormFacturacion.controls['city']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.city.dirty || checkoutFormFacturacion.controls.city.touched) && checkoutFormFacturacion.controls.city.errors?.required\">\n <span class=\"text-danger\">{{'town-city-help'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 4-->\n <div class=\"form-group col-12 col-md-8\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.enabled\">\n <label class=\"field-label\">{{'address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"street\"\n [formControl]=\"checkoutFormFacturacion.controls['street']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.street.dirty || checkoutFormFacturacion.controls.street.touched) && checkoutFormFacturacion.controls.street.errors?.required\">\n <span class=\"text-danger\">{{'address-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.street.dirty || checkoutFormFacturacion.controls.street.touched) && checkoutFormFacturacion.controls.street.errors?.maxlength\">\n <span class=\"text-danger\">{{'address-help2'|translate}}</span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.postcode.enabled\">\n <label class=\"field-label\">{{'postal-code'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.postcode.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\"\n name=\"postcode\" [formControl]=\"checkoutFormFacturacion.controls['postcode']\"\n value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.postcode.dirty || checkoutFormFacturacion.controls.postcode.touched) && checkoutFormFacturacion.controls.postcode.errors?.required\">\n <span class=\"text-danger\">{{'postal-code-help'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.postcode.dirty || checkoutFormFacturacion.controls.postcode.touched) && checkoutFormFacturacion.controls.postcode.errors?.pattern\">\n <span class=\"text-danger\">{{postalCodeErrorMessage |translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 5-->\n <ng-container *ngIf=\"compactAddressView; else documentRowFullFacturacion\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled; else documentNumberOnlyFacturacion\">\n <div class=\"form-group col-12\"\n *ngIf=\"(documentTypesFacturacion$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <div class=\"input-group document-input-group\">\n <button class=\"btn btn-outline-secondary dropdown-toggle\" type=\"button\"\n (click)=\"toggleDocumentTypeDropdownFacturacion($event)\"\n [attr.aria-expanded]=\"documentTypeFactDropdownOpen\"\n [disabled]=\"checkoutFormFacturacion.controls['documentType']?.disabled || formReadonly\">\n {{ getSelectedDocumentTypeLabelFacturacion(documentTypes) || ('document-type' | translate) }}\n </button>\n <div class=\"dropdown-menu\" [class.show]=\"documentTypeFactDropdownOpen\">\n <button class=\"dropdown-item\" type=\"button\"\n *ngFor=\"let item of documentTypes\"\n (click)=\"selectDocumentTypeFacturacion(item.code)\">\n {{ item.name }}\n </button>\n </div>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentType.dirty || checkoutFormFacturacion.controls.documentType.touched) && checkoutFormFacturacion.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n <ng-template #documentNumberOnlyFacturacion>\n <div class=\"form-group col-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </ng-container>\n <ng-template #documentRowFullFacturacion>\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled\">\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(documentTypesFacturacion$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.required\"\n class=\"required\">*</span></label>\n <select name=\"documentType\" class=\"form-select\"\n [formControl]=\"checkoutFormFacturacion.controls['documentType']\"\n (change)=\"onDocumentTypesSelectedFacturacion($event.target.value)\">\n <option *ngFor=\"let item of documentTypes\" [value]=\"item.code\">\n {{item.name}}</option>\n </select>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentType.dirty || checkoutFormFacturacion.controls.documentType.touched) && checkoutFormFacturacion.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n </ng-template>\n </div>\n <div class=\"row mt-df\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <label class=\"field-label\"\n *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}} <span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelNotesHtml\">\n <div [innerHTML]=\"labelNotesHtml.value\"></div> \n <span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span>\n </label>\n\n <!-- <label class=\"field-label\">{{'notes'|translate}}<span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\" class=\"required\">*</span></label> -->\n <textarea (change)=\"onInputChange()\" class=\"form-control notes-textarea\"\n name=\"notes\" [formControl]=\"checkoutFormFacturacion.controls['notes']\"\n rows=\"3\" placeholder=\"\" autocomplete=\"off\"></textarea>\n </div>\n </div>\n </form>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n\n\n\n <ng-template #template>\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"btn-close float-end\" aria-label=\"Close\" (click)=\"modalRef.hide()\">\n </button>\n </div>\n </div>\n\n <div class=\"modal-body scrol-if\">\n <app-section-container-ec [name]=\"'terminos-y-condiciones'\"> </app-section-container-ec>\n </div>\n\n </ng-template>\n\n\n <ng-template #addressBookNotResult>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12 text-center my-2\">\n <h4> {{'address-book-not-result' | translate }} </h4>\n </div>\n </div>\n </div>\n </ng-template>\n\n <ng-template #addressBookLoading>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12 text-center my-2\">\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-template #pleaseLogin>\n <div class=\"container\">\n <p>Por favor <a [routerLink]=\"['/auth/login']\"> Inicie Sesi\u00F3n</a></p>\n </div>\n</ng-template>\n",
8707
+ template: "<ng-container\n *ngIf=\"this.channelConfig.channelType != 'b2b' || (this.channelConfig.channelType == 'b2b' && authService.isAuthenticated()); else pleaseLogin\">\n <ng-container\n *ngIf=\"this.addressingService.modeSelectAddress == 'LOAD_ADDRESS_AND_SELECTION' && this.authService.isAuthenticated() && this.addressBook != null && !compactAddressView\">\n <div class=\"container card p-4 mb-3\">\n <div class=\"row justify-content-center\">\n <div class=\"col-12 col-md-10 col-lg-8 text-center\">\n <div class=\"btn-group btn-group-toggle\" data-bs-toggle=\"buttons\">\n <label [class]=\"'btn btn-outline-secondary ' + (!getMode() ? 'active' : '')\">\n <input type=\"radio\" name=\"options\" id=\"option1\" autocomplete=\"off\" checked\n (change)=\"setMode('seleccion')\"> {{'select-address' | translate | titlecase}}\n </label>\n\n <label [class]=\"'btn btn-outline-secondary ' + (getMode() ? 'active' : '')\"\n *ngIf=\"!getParamByChannelAndLanguage('btn_new_address_') && !customerHasCustomerTaxRate\">\n <input type=\"radio\" name=\"options\" id=\"option2\" autocomplete=\"off\"\n (change)=\"setMode('carga')\">\n {{ 'new-address' | translate | titlecase}}\n </label>\n\n <label [class]=\"'btn btn-outline-secondary ' + (selectAddress ? 'active' : '')\"\n *ngIf=\"getParamByChannelAndLanguage('btn_new_address_') as param\">\n <input type=\"radio\" name=\"options\" id=\"option2\" autocomplete=\"off\"\n (change)=\"setMode('carga')\">\n {{ param.value}}\n </label>\n\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"compactAddressView || getMode(); else addressSelection\">\n <div *ngIf=\"!require_login; else requireLoginView\">\n <div class=\"single-step-surface\">\n <div class=\"single-step-overlay\" *ngIf=\"compactAddressView && loading\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n\n <ng-container *ngIf=\"this.addressingService.modeSelectAddress == 'ONLY_LOAD_ADDRESS'\">\n <div class=\"checkout-title my-2\">\n <h3>{{'billing-details'|translate}}</h3>\n </div>\n </ng-container>\n\n <app-dataform-ec-single\n *ngIf=\"compactAddressView\"\n [showToggle]=\"this.addressingService.modeSelectAddress == 'LOAD_ADDRESS_AND_SELECTION' && this.authService.isAuthenticated() && this.addressBook != null\"\n [isNewAddressMode]=\"getMode()\"\n [showDefaultNewAddressButton]=\"!getParamByChannelAndLanguage('btn_new_address_') && !customerHasCustomerTaxRate\"\n [customNewAddressLabel]=\"getParamByChannelAndLanguage('btn_new_address_')?.value\"\n [isTemporarySelected]=\"selectedAddress?.isTemporary\"\n [selectedAddressLabel]=\"getSelectedAddressLabel()\"\n [addressDropdownOpen]=\"addressDropdownOpen\"\n [addressSearch]=\"addressSearch\"\n [addressOptions]=\"getFilteredAddressOptions()\"\n [showSelectBlock]=\"!getMode()\"\n [hasSelectedAddress]=\"hasSelectedAddress()\"\n (modeChange)=\"setMode($event)\"\n (toggleDropdown)=\"toggleAddressDropdown()\"\n (closeDropdown)=\"addressDropdownOpen = false\"\n (selectAddress)=\"selectAddressFromDropdown($event)\"\n (addressSearchChange)=\"addressSearch = $event\">\n </app-dataform-ec-single>\n\n <form (submit)=\"verifyValidate(false,this.cartService.items)\"\n [class.compact-address-form]=\"compactAddressView\"\n *ngIf=\"!compactAddressView || getMode() || hasSelectedAddress()\">\n <div class=\"row mt-df\"><!--Fila 1-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.enabled\">\n <label class=\"field-label\">{{'first-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"firstName\"\n [formControl]=\"checkoutForm.controls['firstName']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.firstName.dirty || checkoutForm.controls.firstName.touched) && checkoutForm.controls.firstName.errors?.required\">\n <span class=\"text-danger\">{{'first-name-help1'|translate}}</span>\n\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.firstName.dirty || checkoutForm.controls.firstName.touched) && checkoutForm.controls.firstName.errors?.pattern\">\n <span class=\"text-danger\">\n {{'first-name-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.enabled\">\n <label class=\"field-label\">{{'last-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"lastName\"\n [formControl]=\"checkoutForm.controls['lastName']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.lastName.dirty || checkoutForm.controls.lastName.touched) && checkoutForm.controls.lastName.errors?.required\">\n <span class=\"text-danger\">{{'last-name-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.lastName.dirty || checkoutForm.controls.lastName.touched) && checkoutForm.controls.lastName.errors?.pattern\">\n <span class=\"text-danger\">{{'last-name-help2'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\"><!--Fila 2-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.enabled\">\n <label class=\"field-label\">{{'phone'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"tel\" name=\"phoneNumber\"\n [formControl]=\"checkoutForm.controls['phoneNumber']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.phoneNumber.dirty || checkoutForm.controls.phoneNumber.touched) && checkoutForm.controls.phoneNumber.errors?.required\">\n <span class=\"text-danger\">\n\n {{'phone-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.phoneNumber.dirty || checkoutForm.controls.phoneNumber.touched) && checkoutForm.controls.phoneNumber.errors?.pattern\">\n <span class=\"text-danger\">\n {{'phone-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.enabled\">\n <label class=\"field-label\">{{'email-address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"email\" name=\"email\"\n [formControl]=\"checkoutForm.controls['email']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.email.dirty || checkoutForm.controls.email.touched) && checkoutForm.controls.email.errors?.required\">\n <span class=\"text-danger\">\n {{'email-address-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.email.dirty || checkoutForm.controls.email.touched) && checkoutForm.controls.email.errors?.email\">\n <span class=\"text-danger\">\n {{'email-address-help2'|translate}}\n </span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 3-->\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(countries$ | async) as countries\">\n <label class=\"field-label\">{{'country'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"countryCode\"\n [formControl]=\"checkoutForm.controls['countryCode']\"\n (change)=\"onCountrySelected($event.target.value)\">\n <!-- <option selected [value]=\"countries[0].code\">{{ 'choose-country' | translate }}</option> -->\n <option *ngFor=\"let country of countries\" [value]=\"country.code\">{{ country.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutForm.controls.countryCode.dirty || checkoutForm.controls.countryCode.touched) && checkoutForm.controls.countryCode.errors?.required\"\n class=\"text text-danger\">\n {{'country-help'|translate}}\n </div>\n </div>\n </ng-container>\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(provinces$ | async) as provinces\">\n <label class=\"field-label\">{{'state'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"provinceCode\"\n (change)=\"onProvincesSelected($event.target.value)\"\n [formControl]=\"checkoutForm.controls['provinceCode']\">\n <!-- <option selected [value]=\"null\">{{ 'choose-province' | translate }}</option>\n -->\n <option *ngFor=\"let province of provinces\" [value]=\"province.code\">{{ province.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutForm.controls.provinceCode.dirty || checkoutForm.controls.provinceCode.touched) && checkoutForm.controls.provinceCode.errors?.required\"\n class=\"text text-danger\">\n {{'state-help'|translate}}\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.enabled\">\n <label class=\"field-label\">{{'town-city'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"city\"\n [formControl]=\"checkoutForm.controls['city']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.city.dirty || checkoutForm.controls.city.touched) && checkoutForm.controls.city.errors?.required\">\n <span class=\"text-danger\">{{'town-city-help'|translate}}</span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 4-->\n <div class=\"form-group col-12 col-md-8\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.enabled\">\n <label class=\"field-label\">{{'address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.required\"\n class=\"required\">*</span>\n <span class=\"char-count\">\n {{ 50 - (checkoutForm.controls['street'].value?.length || 0) }}\n {{'remainingCharacters'|translate}}\n </span>\n </label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"street\"\n [formControl]=\"checkoutForm.controls['street']\" value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.street.dirty || checkoutForm.controls.street.touched) && checkoutForm.controls.street.errors?.required\">\n <span class=\"text-danger\">{{'address-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.street.dirty || checkoutForm.controls.street.touched) && checkoutForm.controls.street.errors?.maxlength\">\n <span class=\"text-danger\">{{'address-help2'|translate}}</span>\n </div>\n </div>\n\n <!-- form direcci\u00F3n -->\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"isPostalCodeFieldVisible()\">\n <label class=\"field-label\">{{'postal-code'|translate}}<span\n *ngIf=\"isPostalCodeFieldRequired()\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"postcode\"\n [formControl]=\"checkoutForm.controls['postcode']\" value=\"\" placeholder=\"\"\n autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.postcode.dirty || checkoutForm.controls.postcode.touched) && checkoutForm.controls.postcode.errors?.required\">\n <span class=\"text-danger\">{{'postal-code-help'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.postcode.dirty || checkoutForm.controls.postcode.touched) && checkoutForm.controls.postcode.errors?.pattern\">\n <span class=\"text-danger\"> {{postalCodeErrorMessage | translate}} </span>\n </div>\n </div>\n </div>\n\n <div class=\"row mt-df\"><!--Fila 5-->\n <ng-container *ngIf=\"compactAddressView; else documentRowFull\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled; else documentNumberOnly\">\n <div class=\"form-group col-12\" *ngIf=\"(documentTypes$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <div class=\"input-group document-input-group\">\n <button class=\"btn btn-outline-secondary dropdown-toggle\" type=\"button\"\n (click)=\"toggleDocumentTypeDropdown($event)\"\n [attr.aria-expanded]=\"documentTypeDropdownOpen\"\n [disabled]=\"checkoutForm.controls['documentType']?.disabled || formReadonly\">\n {{ getSelectedDocumentTypeLabel(documentTypes) || ('document-type' | translate) }}\n </button>\n <div class=\"dropdown-menu\" [class.show]=\"documentTypeDropdownOpen\">\n <button class=\"dropdown-item\" type=\"button\"\n *ngFor=\"let item of documentTypes\"\n (click)=\"selectDocumentType(item.code)\">\n {{ item.name }}\n </button>\n </div>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentType.dirty || checkoutForm.controls.documentType.touched) && checkoutForm.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n <ng-template #documentNumberOnly>\n <div class=\"form-group col-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </ng-container>\n <ng-template #documentRowFull>\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled\">\n <div class=\"form-group col-12 col-md-4\" *ngIf=\"(documentTypes$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.required\"\n class=\"required\">*</span></label>\n <select name=\"documentType\" class=\"form-select\"\n (change)=\"onDocumentTypesSelected($event.target.value)\"\n [formControl]=\"checkoutForm.controls['documentType']\">\n <option *ngFor=\"let item of documentTypes\" [value]=\"item.code\">{{item.name}}</option>\n </select>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentType.dirty || checkoutForm.controls.documentType.touched) && checkoutForm.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\" name=\"documentNumber\"\n [formControl]=\"checkoutForm.controls['documentNumber']\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">{{ 'document-number-help' | translate }}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.documentNumber.dirty || checkoutForm.controls.documentNumber.touched) && checkoutForm.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </div>\n\n <div class=\"row mt-df\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a' && !(compactAddressView && !getMode())\"><!--Fila 6-->\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"><span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n\n <!-- <label class=\"field-label\">{{'notes'|translate}}<span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\" class=\"required\">*</span></label> -->\n <textarea (change)=\"onInputChange()\" class=\"form-control notes-textarea\" name=\"notes\"\n [formControl]=\"checkoutForm.controls['notes']\" rows=\"3\" placeholder=\"\"\n autocomplete=\"off\"></textarea>\n </div>\n </div>\n <div class=\"row mt-df address-meta-row\" *ngIf=\"!(compactAddressView && !getMode())\"><!--Fila 7-->\n <div class=\"form-group col-12 col-md-12\">\n <label for=\"formFact\"><b>{{ 'same-billing-address' | translate }}</b> <input type=\"checkbox\"\n class=\"ms-2\" [checked]=\"viewDataFacturacion\" (change)=\"showFormFacturacion()\"\n id=\"formFact\"></label>\n </div>\n </div>\n <div class=\"row mt-df address-required-row\" *ngIf=\"!(compactAddressView && !getMode())\">\n <div class=\"col-12\">\n <span class=\"required-hint-text\">\n <span class=\"required-hint-asterisk\">*</span> {{ 'required-fields' | translate }}\n </span>\n </div>\n </div>\n <div class=\"row mt-df address-terms-row\" *ngIf=\"!(compactAddressView && !getMode())\">\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.terms.enabled\">\n <label class=\"terms-label\" for=\"\">\n <input class=\"me-2\" name=\"terms\" [formControl]=\"checkoutForm.controls['terms']\"\n type=\"checkbox\" required (change)=\"onInputChange()\" />\n <span>{{ 'accept-terms-prefix' | translate }}</span>\n <button type=\"button\" class=\"terms-link\" (click)=\"openModal(template)\">\n {{ 'terms-and-conditions' | translate }}\n </button>\n <span *ngIf=\"this.addressingService.getTypeForm().viewForms.terms.required\"\n class=\"required\">*</span>\n </label>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutForm.controls.terms.dirty || checkoutForm.controls.terms.touched) && !checkoutForm.controls.terms.value\">\n <span class=\"text-danger\">{{ 'must-accept-terms' | translate }}</span>\n </div>\n </div>\n </div>\n <div class=\"row\" *ngIf=\"viewDataFacturacion ; else datosFormFacturacion\"> </div>\n <div class=\"checkout-btn-unique text-end\" *ngIf=\"!formReadonly\">\n <button type=\"submit\" [disabled]=\"!validado\" class=\"btn valid-btn mt-2\">\n {{ getPrimaryActionLabel() | translate }}</button>\n\n\n </div>\n <div *ngIf=\"loading && !compactAddressView\" class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </form>\n <ng-container *ngIf=\"compactAddressView && !getMode()\">\n <div class=\"w-100\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <div class=\"row mt-df\">\n <div class=\"form-group col-12 col-md-12\">\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"></label>\n <textarea (change)=\"onSelectionNotesChange()\" class=\"form-control notes-textarea\"\n name=\"notes\" [(ngModel)]=\"this.addressBookSelected.notes\" #ctrl=\"ngModel\" rows=\"3\"\n placeholder=\"\" autocomplete=\"off\" [disabled]=\"selectedAddress?.isTemporary\"></textarea>\n <div class=\"invalid-feedback d-block\" *ngIf=\"\n addressingService.getTypeForm().viewForms.notes.required\n && (!addressBookSelected.notes || !addressBookSelected.notes.trim())\n \">\n {{ 'required-field' | translate }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n </ng-container>\n </div>\n </div>\n </ng-container>\n\n <ng-template #addressSelection>\n\n <ng-container *ngIf=\"this.addressingService.modeSelectAddress == 'ONLY_ADDRESS_SELECTION'\">\n <div class=\"checkout-title my-2\">\n <h3>{{'address-selection'|translate}}</h3>\n </div>\n </ng-container>\n\n <ng-container *ngIf=\"this.addressBook; else addressBookNotResult\">\n\n <ng-container *ngIf=\"this.addressBook?.length ;else addressBookLoading\">\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-sm-6 col-12 my-3\" *ngFor=\"let item of addressBook; let i = index\">\n <ng-container *ngIf=\"compactAddressView; else addressCardFull\">\n <div class=\"address-card-compact\" [class.is-selected]=\"item.selected\"\n (click)=\"setSelectAddress(item); onInputChange()\">\n <label class=\"address-card-radio\">\n <input class=\"form-check-input input-size-lg\" type=\"radio\" [name]=\"'n-'+i\"\n [id]=\"i\" [checked]=\"item.selected\" (click)=\"setSelectAddress(item)\"\n (change)=\"onInputChange()\">\n </label>\n <div class=\"address-card-content\">\n <div class=\"address-card-main\">\n <div class=\"address-card-title\">{{ item.street }}</div>\n <div class=\"address-card-sub\">\n {{ item.city }} - {{ getProvince(item.provinceCode) }} - {{ getCountry(item.countryCode) }}\n </div>\n <div class=\"address-card-sub\"\n *ngIf=\"shouldShowPostalCodeByCountryCode(item.countryCode)\">\n {{ 'postal-code' | translate }} {{ item.postcode }}\n </div>\n </div>\n <details class=\"address-card-details\" (click)=\"$event.stopPropagation()\">\n <summary>{{ 'details' | translate }}</summary>\n <div class=\"address-card-details-body\">\n <div class=\"address-card-detail-title\">{{ 'address-contact' | translate }}</div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'first-name' | translate }}</strong> {{ item.addressContact.firstName }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'last-name' | translate }}</strong> {{ item.addressContact.lastName }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'document-type' | translate }}</strong> {{ getDocumentType(item.addressContact.documentType) }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'document-number' | translate }}</strong> {{ item.addressContact.documentNumber }}\n </div>\n <div class=\"address-card-detail-line\">\n <strong>{{ 'email-address' | translate }}</strong> {{ item.addressContact.email }}\n </div>\n </div>\n </details>\n </div>\n </div>\n </ng-container>\n <ng-template #addressCardFull>\n <div class=\"card p-3\">\n <input class=\"ms-1 mt-3 form-check-input input-size-lg\" type=\"radio\" [name]=\"'n-'+i\"\n [id]=\"i\" [checked]=\"item.selected\" (click)=\"setSelectAddress(item)\"\n (change)=\"onInputChange()\">\n <div class=\"ms-5\">\n <h4 class=\"card-title\">\n <strong>{{'address'|translate}}</strong><br>\n <span class=\"text-uppercase h3\">{{item.street}}</span>\n </h4>\n <div class=\"row\">\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'country'|translate}}</strong> {{getCountry(item.countryCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'state'|translate}}</strong> {{getProvince(item.provinceCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'town-city'|translate}}</strong> {{item.city}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\"\n *ngIf=\"shouldShowPostalCodeByCountryCode(item.countryCode)\">\n <strong>{{'postal-code'|translate}}</strong> {{item.postcode}}\n </h5>\n </div>\n <div class=\"row px-3\">\n <div class=\"card p-2 bg-light w-100\">\n <div class=\"card-body\">\n <h5 class=\"card-title\">{{'address-contact'|translate}}</h5>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'first-name'|translate}}</strong>\n {{item.addressContact.firstName}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'last-name'|translate}}</strong>\n {{item.addressContact.lastName}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'document-type'|translate}}</strong>\n {{getDocumentType(item.addressContact.documentType)}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'document-number'|translate}}</strong>\n {{item.addressContact.documentNumber}}\n </h6>\n <h6 class=\"card-subtitle mb-2 text-muted\">\n <strong>{{'email-address'|translate}}</strong>\n {{item.addressContact.email}}\n </h6>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n </div>\n\n </div>\n <!-- Se hardcodea el canal de mundo del juguete empresa A ya que se necesita con urgencia, se sustituira por un campo que llegara de backend. -->\n <div class=\"w-100\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <div class=\"row mt-df\">\n <div class=\"form-group col-12 col-md-12\">\n <label class=\"field-label\" *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelnotes\"\n [innerHTML]=\"labelnotes.value\"></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"notes\"\n [(ngModel)]=\"this.addressBookSelected.notes\" #ctrl=\"ngModel\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"invalid-feedback d-block\" *ngIf=\"\n addressingService.getTypeForm().viewForms.notes.required\n && (!addressBookSelected.notes || !addressBookSelected.notes.trim())\n \">\n {{ 'required-field' | translate }}\n </div>\n </div>\n </div>\n </ng-container>\n </div>\n <div class=\"row mt-df\"><!--Direcci\u00F3n de facturaci\u00F3n-->\n <div class=\"form-group col-12 col-md-12\">\n <label for=\"formFactSelection\"><b>{{ 'same-billing-address' | translate }}</b> <input type=\"checkbox\"\n class=\"ms-2\" [checked]=\"viewDataFacturacion\" (change)=\"showFormFacturacion()\"\n id=\"formFactSelection\"></label>\n </div>\n </div>\n <ng-container *ngIf=\"!viewDataFacturacion\">\n <!-- Selector de modo para direcci\u00F3n de facturaci\u00F3n -->\n <div class=\"container card p-4 mb-3\">\n <div class=\"row justify-content-center\">\n <div class=\"col-12 col-md-10 col-lg-8 text-center\">\n <div class=\"btn-group btn-group-toggle\" data-bs-toggle=\"buttons\">\n <label [class]=\"'btn btn-outline-secondary ' + (!getModeFacturacion() ? 'active' : '')\">\n <input type=\"radio\" name=\"billingOptions\" id=\"billingOption1\" autocomplete=\"off\"\n [checked]=\"!getModeFacturacion()\" (change)=\"setModeFacturacion('seleccion')\">\n {{'select-address' | translate | titlecase}}\n </label>\n <label [class]=\"'btn btn-outline-secondary ' + (getModeFacturacion() ? 'active' : '')\">\n <input type=\"radio\" name=\"billingOptions\" id=\"billingOption2\" autocomplete=\"off\"\n [checked]=\"getModeFacturacion()\" (change)=\"setModeFacturacion('carga')\">\n {{ 'new-address' | translate | titlecase}}\n </label>\n </div>\n </div>\n </div>\n </div>\n <!-- Formulario de nueva direcci\u00F3n de facturaci\u00F3n -->\n <ng-container *ngIf=\"getModeFacturacion()\">\n <ng-container *ngTemplateOutlet=\"datosFormFacturacion\"></ng-container>\n </ng-container>\n <!-- Selecci\u00F3n de direcci\u00F3n de facturaci\u00F3n del address book -->\n <ng-container *ngIf=\"!getModeFacturacion()\">\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-sm-6 col-12 my-3\" *ngFor=\"let item of addressBook; let i = index\">\n <div class=\"card p-3\">\n <input class=\"ms-1 mt-3 form-check-input input-size-lg\" type=\"radio\" [name]=\"'billing-'+i\"\n [id]=\"'billing-'+i\" [checked]=\"item.selectedFacturacion\"\n (click)=\"setSelectAddressFacturacion(item)\" (change)=\"onInputChange()\">\n <div class=\"ms-5\">\n <h4 class=\"card-title\">\n <strong>{{'address'|translate}}</strong><br>\n <span class=\"text-uppercase h3\">{{item.street}}</span>\n </h4>\n <div class=\"row\">\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'country'|translate}}</strong> {{getCountry(item.countryCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'state'|translate}}</strong> {{getProvince(item.provinceCode)}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\">\n <strong>{{'town-city'|translate}}</strong> {{item.city}}\n </h5>\n <h5 class=\"card-subtitle mb-2 text-muted col-auto\"\n *ngIf=\"shouldShowPostalCodeByCountryCode(item.countryCode)\">\n <strong>{{'postal-code'|translate}}</strong> {{item.postcode}}\n </h5>\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n </ng-container>\n <div class=\"checkout-btn-unique text-end\">\n <button *ngIf=\"!viewDataFacturacion && !getModeFacturacion()\"\n (click)=\"onSelectAddressFacturacion(this.cartService.items)\" class=\"btn valid-btn mt-2\"\n [disabled]=\"!addressBookSelectedFacturacion.id\">\n {{ getPrimaryActionLabel() | translate }}\n </button>\n <button *ngIf=\"!viewDataFacturacion && getModeFacturacion()\"\n (click)=\"onSubmitNewBillingAddress(this.cartService.items)\" class=\"btn valid-btn mt-2\"\n [disabled]=\"checkoutFormFacturacion.invalid\">\n {{ getPrimaryActionLabel() | translate }}\n </button>\n <button *ngIf=\"viewDataFacturacion\"\n (click)=\"onSelectAddress(this.cartService.items)\" class=\"btn valid-btn mt-2\">\n {{ getPrimaryActionLabel() | translate }}\n </button>\n </div>\n <div *ngIf=\"loading\" class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </div>\n </ng-container>\n </ng-container>\n\n </ng-template>\n\n\n <ng-template #requireLoginView>\n <div id=\"loginCheckout\">\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center\" *ngIf=\"require_login\">\n <div class=\"col-12\">\n <app-login-form-ec (ready)=\"verifyValidate($event)\" [redirect]=\"false\" [title]=\"'need-login'\">\n </app-login-form-ec>\n </div>\n </div>\n </div>\n </ng-template>\n\n\n\n <ng-template #datosFormFacturacion>\n <div class=\"container-fluid px-0 px-md-2\">\n <div class=\"row\">\n <div class=\"col-12\">\n <div class=\"card \">\n <div class=\"card-header text-dark text-center\">\n <h3>{{'billing-data'|translate}}</h3>\n </div>\n <div class=\"card-body\">\n <form (submit)=\"handleBillingFormSubmit($event)\">\n <div class=\"row mt-df\">\n <!--Fila 1-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.enabled\">\n <label class=\"field-label\">{{'first-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.firstName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"firstName\"\n [formControl]=\"checkoutFormFacturacion.controls['firstName']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.firstName.dirty || checkoutFormFacturacion.controls.firstName.touched) && checkoutFormFacturacion.controls.firstName.errors?.required\">\n <span class=\"text-danger\">{{'first-name-help1'|translate}}</span>\n\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.firstName.dirty || checkoutFormFacturacion.controls.firstName.touched) && checkoutFormFacturacion.controls.firstName.errors?.pattern\">\n <span class=\"text-danger\">\n {{'first-name-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.enabled\">\n <label class=\"field-label\">{{'last-name'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.lastName.required\"\n class=\"required\">*</span></label>\n <input class=\"form-control\" type=\"text\" name=\"lastName\"\n [formControl]=\"checkoutFormFacturacion.controls['lastName']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.lastName.dirty || checkoutFormFacturacion.controls.lastName.touched) && checkoutFormFacturacion.controls.lastName.errors?.required\">\n <span class=\"text-danger\">{{'last-name-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.lastName.dirty || checkoutFormFacturacion.controls.lastName.touched) && checkoutFormFacturacion.controls.lastName.errors?.pattern\">\n <span class=\"text-danger\">{{'last-name-help2'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 2-->\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.enabled\">\n <label class=\"field-label\">{{'phone'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.phoneNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"tel\"\n name=\"phoneNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['phoneNumber']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.phoneNumber.dirty || checkoutFormFacturacion.controls.phoneNumber.touched) && checkoutFormFacturacion.controls.phoneNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'phone-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.phoneNumber.dirty || checkoutFormFacturacion.controls.phoneNumber.touched) && checkoutFormFacturacion.controls.phoneNumber.errors?.pattern\">\n <span class=\"text-danger\">\n {{'phone-help2'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-6\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.enabled\">\n <label class=\"field-label\">{{'email-address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.email.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"email\" name=\"email\"\n [formControl]=\"checkoutFormFacturacion.controls['email']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.email.dirty || checkoutFormFacturacion.controls.email.touched) && checkoutFormFacturacion.controls.email.errors?.required\">\n <span class=\"text-danger\">\n {{'email-address-help1'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.email.dirty || checkoutFormFacturacion.controls.email.touched) && checkoutFormFacturacion.controls.email.errors?.email\">\n <span class=\"text-danger\">\n {{'email-address-help2'|translate}}\n </span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 3-->\n\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.enabled\">\n\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(countriesFacturacion$ | async) as countries\">\n <label class=\"field-label\">{{'country'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.countryCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"countryCode\"\n [formControl]=\"checkoutFormFacturacion.controls['countryCode']\"\n (change)=\"onCountrySelectedFacturacion($event.target.value)\">\n <!-- <option selected [value]=\"null\">{{ 'choose-country' | translate }}</option> -->\n <option *ngFor=\"let country of countries\" [value]=\"country.code\">\n {{ country.name }}</option>\n </select>\n <div *ngIf=\"(checkoutFormFacturacion.controls.countryCode.dirty || checkoutFormFacturacion.controls.countryCode.touched) && checkoutFormFacturacion.controls.countryCode.errors?.required\"\n class=\"text text-danger\">\n {{'country-help'|translate}}\n </div>\n </div>\n </ng-container>\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.enabled\">\n\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(provincesFacturacion$ | async) as provinces\">\n <label class=\"field-label\">{{'state'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.provinceCode.required\"\n class=\"required\">*</span></label>\n <select class=\"form-select\" name=\"provinceCode\"\n (change)=\"onProvincesSelectedFacturacion($event.target.value)\"\n [formControl]=\"checkoutFormFacturacion.controls['provinceCode']\">\n <!-- <option selected [value]=\"null\">{{ 'choose-province' | translate }}</option> -->\n <option *ngFor=\"let province of provinces\" [value]=\"province.code\">\n {{ province.name }}\n </option>\n </select>\n <div *ngIf=\"(checkoutFormFacturacion.controls.provinceCode.dirty || checkoutFormFacturacion.controls.provinceCode.touched) && checkoutFormFacturacion.controls.provinceCode.errors?.required\"\n class=\"text text-danger\">\n {{'state-help'|translate}}\n </div>\n </div>\n </ng-container>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.enabled\">\n <label class=\"field-label\">{{'town-city'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.city.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"city\"\n [formControl]=\"checkoutFormFacturacion.controls['city']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.city.dirty || checkoutFormFacturacion.controls.city.touched) && checkoutFormFacturacion.controls.city.errors?.required\">\n <span class=\"text-danger\">{{'town-city-help'|translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 4-->\n <div class=\"form-group col-12 col-md-8\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.enabled\">\n <label class=\"field-label\">{{'address'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.street.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\" name=\"street\"\n [formControl]=\"checkoutFormFacturacion.controls['street']\" value=\"\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.street.dirty || checkoutFormFacturacion.controls.street.touched) && checkoutFormFacturacion.controls.street.errors?.required\">\n <span class=\"text-danger\">{{'address-help1'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.street.dirty || checkoutFormFacturacion.controls.street.touched) && checkoutFormFacturacion.controls.street.errors?.maxlength\">\n <span class=\"text-danger\">{{'address-help2'|translate}}</span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"isPostalCodeFieldVisible(true)\">\n <label class=\"field-label\">{{'postal-code'|translate}}<span\n *ngIf=\"isPostalCodeFieldRequired(true)\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" type=\"text\"\n name=\"postcode\" [formControl]=\"checkoutFormFacturacion.controls['postcode']\"\n value=\"\" placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.postcode.dirty || checkoutFormFacturacion.controls.postcode.touched) && checkoutFormFacturacion.controls.postcode.errors?.required\">\n <span class=\"text-danger\">{{'postal-code-help'|translate}}</span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.postcode.dirty || checkoutFormFacturacion.controls.postcode.touched) && checkoutFormFacturacion.controls.postcode.errors?.pattern\">\n <span class=\"text-danger\">{{postalCodeErrorMessageFacturacion |translate}}</span>\n </div>\n </div>\n </div>\n <div class=\"row mt-df\">\n <!--Fila 5-->\n <ng-container *ngIf=\"compactAddressView; else documentRowFullFacturacion\">\n <ng-container *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled; else documentNumberOnlyFacturacion\">\n <div class=\"form-group col-12\"\n *ngIf=\"(documentTypesFacturacion$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <div class=\"input-group document-input-group\">\n <button class=\"btn btn-outline-secondary dropdown-toggle\" type=\"button\"\n (click)=\"toggleDocumentTypeDropdownFacturacion($event)\"\n [attr.aria-expanded]=\"documentTypeFactDropdownOpen\"\n [disabled]=\"checkoutFormFacturacion.controls['documentType']?.disabled || formReadonly\">\n {{ getSelectedDocumentTypeLabelFacturacion(documentTypes) || ('document-type' | translate) }}\n </button>\n <div class=\"dropdown-menu\" [class.show]=\"documentTypeFactDropdownOpen\">\n <button class=\"dropdown-item\" type=\"button\"\n *ngFor=\"let item of documentTypes\"\n (click)=\"selectDocumentTypeFacturacion(item.code)\">\n {{ item.name }}\n </button>\n </div>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentType.dirty || checkoutFormFacturacion.controls.documentType.touched) && checkoutFormFacturacion.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n <ng-template #documentNumberOnlyFacturacion>\n <div class=\"form-group col-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-template>\n </ng-container>\n <ng-template #documentRowFullFacturacion>\n <ng-container\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.enabled\">\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"(documentTypesFacturacion$ | async) as documentTypes\">\n <label class=\"field-label\">{{'document-type'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentType.required\"\n class=\"required\">*</span></label>\n <select name=\"documentType\" class=\"form-select\"\n [formControl]=\"checkoutFormFacturacion.controls['documentType']\"\n (change)=\"onDocumentTypesSelectedFacturacion($event.target.value)\">\n <option *ngFor=\"let item of documentTypes\" [value]=\"item.code\">\n {{item.name}}</option>\n </select>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentType.dirty || checkoutFormFacturacion.controls.documentType.touched) && checkoutFormFacturacion.controls.documentType.errors?.required\">\n <span class=\"text-danger\">\n {{'type-document-help'|translate}}\n </span>\n </div>\n </div>\n <div class=\"form-group col-12 col-md-4\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.enabled\">\n <label class=\"field-label\">{{'document-number'|translate}}<span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.documentNumber.required\"\n class=\"required\">*</span></label>\n <input (change)=\"onInputChange()\" class=\"form-control\" [type]=\"'text'\"\n name=\"documentNumber\"\n [formControl]=\"checkoutFormFacturacion.controls['documentNumber']\"\n placeholder=\"\" autocomplete=\"off\">\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.required\">\n <span class=\"text-danger\">\n {{'document-number-help'|translate}}\n </span>\n </div>\n <div class=\"text-danger-container\"\n *ngIf=\"(checkoutFormFacturacion.controls.documentNumber.dirty || checkoutFormFacturacion.controls.documentNumber.touched) && checkoutFormFacturacion.controls.documentNumber.errors?.pattern\">\n <span class=\"text-danger\">{{ documentErrorMessage | translate }}</span>\n </div>\n </div>\n </ng-container>\n </ng-template>\n </div>\n <div class=\"row mt-df\" *ngIf=\"this.consts.getChannel() != 'mdj-empresa-a'\">\n <div class=\"form-group col-12 col-md-12\"\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.enabled\">\n <label class=\"field-label\"\n *ngIf=\"!getLabelNotesParam()\">{{'notes'|translate}} <span\n *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span></label>\n <label class=\"field-label\" *ngIf=\"getLabelNotesParam() as labelNotesHtml\">\n <div [innerHTML]=\"labelNotesHtml.value\"></div> \n <span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\"\n class=\"required\">*</span>\n </label>\n\n <!-- <label class=\"field-label\">{{'notes'|translate}}<span *ngIf=\"this.addressingService.getTypeForm().viewForms.notes.required\" class=\"required\">*</span></label> -->\n <textarea (change)=\"onInputChange()\" class=\"form-control notes-textarea\"\n name=\"notes\" [formControl]=\"checkoutFormFacturacion.controls['notes']\"\n rows=\"3\" placeholder=\"\" autocomplete=\"off\"></textarea>\n </div>\n </div>\n </form>\n </div>\n\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n\n\n\n <ng-template #template>\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"btn-close float-end\" aria-label=\"Close\" (click)=\"modalRef.hide()\">\n </button>\n </div>\n </div>\n\n <div class=\"modal-body scrol-if\">\n <app-section-container-ec [name]=\"'terminos-y-condiciones'\"> </app-section-container-ec>\n </div>\n\n </ng-template>\n\n\n <ng-template #addressBookNotResult>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12 text-center my-2\">\n <h4> {{'address-book-not-result' | translate }} </h4>\n </div>\n </div>\n </div>\n </ng-template>\n\n <ng-template #addressBookLoading>\n <div class=\"container\">\n <div class=\"row\">\n <div class=\"col-12 text-center my-2\">\n <div class=\"d-flex flex-column jusitfy-content-center align-items-center\">\n <app-loading-full-ec></app-loading-full-ec>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n</ng-container>\n\n<ng-template #pleaseLogin>\n <div class=\"container\">\n <p>Por favor <a [routerLink]=\"['/auth/login']\"> Inicie Sesi\u00F3n</a></p>\n </div>\n</ng-template>\n",
8378
8708
  providers: [BsModalService],
8379
8709
  styles: ["@charset \"UTF-8\";.btn.valid-btn{background-color:var(--ec-primary,#000);border-color:var(--ec-primary,#000);color:var(--ec-primary-contrast,#fff);margin-right:-3px;margin-bottom:10px}.btn.valid-btn:disabled,.btn.valid-btn[disabled]{background-color:var(--ec-primary-muted,#6c757d);border-color:var(--ec-primary-muted,#6c757d);color:var(--ec-primary-contrast,#fff);opacity:.8}.mt-df{margin:10px auto 0}.btn.btn-outline-secondary.active,.btn.btn-outline-secondary:hover{color:#fff!important}.required{color:red}.address-required-row .required-hint-text{color:#6b6b6b;font-size:.85rem;font-weight:500;letter-spacing:.01em}.address-required-row .required-hint-asterisk{color:#6b6b6b;font-weight:700}.field-label{color:#000}:host-context(#appCheckoutEc) .field-label{font-weight:700}:host-context(#appCheckoutEc) .address-meta-row b,:host-context(#appCheckoutEc) .address-terms-row label{font-weight:400}.terms-label{display:inline-flex;flex-wrap:wrap;align-items:center;gap:.35rem}.terms-link{background:0 0;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer}.form-control.ng-dirty.ng-invalid,.form-control.ng-touched.ng-invalid{border-color:#dc3545;box-shadow:0 0 0 .15rem rgba(220,53,69,.18)}.form-control.ng-dirty.ng-valid,.form-control.ng-touched.ng-valid{border-color:#16a34a;box-shadow:0 0 0 .15rem rgba(22,163,74,.15)}.char-count{margin-left:.35rem;font-size:.78rem;font-weight:400;color:#888;white-space:nowrap}.notes-textarea{min-height:120px;max-height:240px;resize:vertical;max-width:100%}.compact-address-form .valid-btn{font-size:1rem;padding:.7rem 1.1rem;letter-spacing:.02em}.document-input-group{position:relative;align-items:stretch}.document-input-group .dropdown-menu{max-height:240px;overflow-y:auto}.document-input-group .dropdown-toggle{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;min-height:100%;border-color:#ced4da;color:#495057}.document-input-group .form-control{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0}:host-context(#appCheckoutEc) .checkout-btn-unique{display:flex;justify-content:flex-end}:host-context(#appCheckoutEc) .checkout-btn-unique .valid-btn{display:block;margin-left:auto;width:56%;max-width:360px;min-width:220px}@media screen and (max-width:992px){:host-context(#appCheckoutEc) .checkout-btn-unique{justify-content:stretch}:host-context(#appCheckoutEc) .checkout-btn-unique .valid-btn{width:100%;min-width:0}.address-required-row .required-hint-text{font-size:.82rem}}:host-context(#appCheckoutEc) .valid-btn{text-transform:uppercase}label{color:#000}#appCheckoutEc .checkout-single .btn-group-toggle{border:1px solid #e3e3e3;border-radius:6px;overflow:hidden}#appCheckoutEc .checkout-single .btn-group-toggle .btn{border-radius:0!important;font-weight:600;padding:.55rem 1rem;border-left:1px solid #e3e3e3}#appCheckoutEc .checkout-single .btn-group-toggle .btn:first-child{border-left:0}.input-size-lg{width:1.8rem;height:1.8rem}.address-card-compact{display:flex;gap:.75rem;border:1px solid #e3e3e3;border-radius:6px;padding:.75rem;background:#fff;align-items:flex-start;cursor:pointer;transition:border-color .2s,box-shadow .2s}.address-card-compact.is-selected{border-color:#000;box-shadow:0 0 0 1px #000 inset}.address-card-compact:hover{border-color:#444}.address-card-radio{margin-top:.25rem}.address-card-content{flex:1;display:flex;flex-direction:column;gap:.35rem}.address-card-title{font-weight:600;font-size:1rem}.address-card-sub{color:#666;font-size:.9rem}.address-card-details{margin-top:.5rem}.address-card-details summary{cursor:pointer;color:#000;font-weight:600;font-size:.9rem;list-style:none;display:inline-flex;align-items:center;gap:.35rem}.address-card-details summary::-webkit-details-marker{display:none}.address-card-details summary::before{content:\"\u25B8\";font-size:.85rem}.address-card-details[open] summary::before{content:\"\u25BE\"}.address-card-details-body{margin-top:.5rem;padding:.5rem;background:#f8f8f8;border-radius:6px}.address-card-detail-title{font-weight:600;margin-bottom:.25rem}.address-card-detail-line{font-size:.9rem;color:#555}.single-step-surface{position:relative}.single-step-overlay{position:absolute;inset:0;background:rgba(255,255,255,.6);display:flex;align-items:center;justify-content:center;z-index:5}.compact-address-form .address-meta-row,.compact-address-form .address-required-row,.compact-address-form .address-terms-row{margin-top:.4rem}.compact-address-form .address-meta-row label,.compact-address-form .address-terms-row label{display:inline-flex;align-items:center;gap:.4rem;margin-bottom:0;font-weight:600}.compact-address-form .address-terms-row a{margin-left:0!important;display:inline-block;font-size:.85rem}.compact-address-form .address-terms-row .text-danger-container{margin-top:.35rem}"]
8380
8710
  })
@@ -8567,7 +8897,7 @@ let PaymentEcComponent = class PaymentEcComponent extends ComponentHelper {
8567
8897
  };
8568
8898
  this.verifyValidate = () => {
8569
8899
  this.setLoading();
8570
- setTimeout(r => this.emitResult(), 1000);
8900
+ this.emitResult();
8571
8901
  };
8572
8902
  this.setMethod = (method) => __awaiter$b(this, void 0, void 0, function* () {
8573
8903
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
@@ -13938,14 +14268,13 @@ var __decorate$1m = (this && this.__decorate) || function (decorators, target, k
13938
14268
  return c > 3 && r && Object.defineProperty(target, key, r), r;
13939
14269
  };
13940
14270
  let RedSysRedirectEcComponent = class RedSysRedirectEcComponent extends ComponentHelper {
13941
- constructor(renderer, connection, toastrService, consts, cartService, toastr, activedRoute, modalService) {
14271
+ constructor(renderer, connection, toastrService, consts, cartService, activedRoute, modalService) {
13942
14272
  super();
13943
14273
  this.renderer = renderer;
13944
14274
  this.connection = connection;
13945
14275
  this.toastrService = toastrService;
13946
14276
  this.consts = consts;
13947
14277
  this.cartService = cartService;
13948
- this.toastr = toastr;
13949
14278
  this.activedRoute = activedRoute;
13950
14279
  this.modalService = modalService;
13951
14280
  this.method = null;
@@ -13955,41 +14284,44 @@ let RedSysRedirectEcComponent = class RedSysRedirectEcComponent extends Componen
13955
14284
  this.loading = true;
13956
14285
  this.isDobleAuth = false;
13957
14286
  this.urls = [];
13958
- this.closeModal = '';
14287
+ this.closeModalReason = ''; // Renombrado para evitar confusión
13959
14288
  this.dataRedirect = () => this.consts.getUrlBase() + 'shop-api/' + this.consts.getChannel() + '/redsys/redirect/' + this.cartService.cart_token + '/process-payment';
13960
14289
  this.clearStorageState = () => {
13961
14290
  sessionStorage.removeItem('state');
13962
14291
  localStorage.removeItem('state');
13963
14292
  };
14293
+ // Método que se llama desde la X de la cabecera del modal en el HTML
13964
14294
  this.clickClose = () => {
13965
- this.closeModal = 'cancel';
13966
- this.modalRef.hide();
13967
- this.processError('Se cancelo el pago con tarjeta');
14295
+ this.closeModalReason = 'cancel';
14296
+ if (this.modalRef) {
14297
+ this.modalRef.hide();
14298
+ }
14299
+ this.processError('Se canceló el pago con tarjeta');
13968
14300
  };
13969
14301
  this.callState = () => {
13970
- let state = this.closeModal != '' ? this.closeModal : sessionStorage.getItem('state');
13971
- console.log(state);
14302
+ var _a, _b, _c;
14303
+ let state = this.closeModalReason != '' ? this.closeModalReason : sessionStorage.getItem('state');
13972
14304
  if (state) {
13973
- sessionStorage.removeItem('state');
13974
- localStorage.removeItem('state');
14305
+ this.clearStorageState();
13975
14306
  if (state == 'ok') {
13976
- this.modalRef.hide();
14307
+ (_a = this.modalRef) === null || _a === void 0 ? void 0 : _a.hide();
13977
14308
  this.ready.emit(true);
13978
14309
  return;
13979
14310
  }
13980
14311
  if (state == 'menosuno') {
13981
- this.modalRef.hide();
13982
- this.processError('');
14312
+ (_b = this.modalRef) === null || _b === void 0 ? void 0 : _b.hide();
14313
+ this.processError('Error en el pago');
13983
14314
  return;
13984
14315
  }
13985
14316
  if (state == 'cancel') {
13986
- return;
14317
+ return; // El modal ya se escondió dentro de clickClose()
13987
14318
  }
13988
- this.modalRef.hide();
13989
- this.processError('');
14319
+ (_c = this.modalRef) === null || _c === void 0 ? void 0 : _c.hide();
14320
+ this.processError('Error desconocido en la transacción');
13990
14321
  return;
13991
14322
  }
13992
- setTimeout(() => {
14323
+ // Guardamos el timeout en una variable de clase
14324
+ this.stateTimeout = setTimeout(() => {
13993
14325
  this.callState();
13994
14326
  }, 6000);
13995
14327
  };
@@ -14004,6 +14336,10 @@ let RedSysRedirectEcComponent = class RedSysRedirectEcComponent extends Componen
14004
14336
  }
14005
14337
  ngOnDestroy() {
14006
14338
  console.log("SE DESTROZA");
14339
+ // Limpiar el setTimeout al salir del componente
14340
+ if (this.stateTimeout) {
14341
+ clearTimeout(this.stateTimeout);
14342
+ }
14007
14343
  }
14008
14344
  ngOnChanges() {
14009
14345
  console.log("SE CAMBIO");
@@ -14011,10 +14347,20 @@ let RedSysRedirectEcComponent = class RedSysRedirectEcComponent extends Componen
14011
14347
  openModal(template) {
14012
14348
  this.clearStorageState();
14013
14349
  sessionStorage.setItem('dataRedirect', this.dataRedirect());
14014
- this.modalRef = this.modalService.show(template, { class: 'modal-lg modal-dialog-centered ', keyboard: false, backdrop: 'static', animated: true });
14015
- this.closeModal = '';
14350
+ // Abrimos el modal y guardamos la referencia en this.modalRef
14351
+ this.modalRef = this.modalService.show(template, { class: 'modal-lg modal-dialog-centered', keyboard: false, backdrop: 'static', animated: true });
14352
+ this.closeModalReason = '';
14016
14353
  this.callState();
14017
14354
  }
14355
+ // Opcional pero recomendado: Capturar mensajes enviados desde el Iframe de Redsys
14356
+ onMessage(event) {
14357
+ if (event.data === 'pago_completado' || event.data === 'ok') {
14358
+ sessionStorage.setItem('state', 'ok');
14359
+ }
14360
+ else if (event.data === 'pago_error' || event.data === 'menosuno') {
14361
+ sessionStorage.setItem('state', 'menosuno');
14362
+ }
14363
+ }
14018
14364
  };
14019
14365
  RedSysRedirectEcComponent.ctorParameters = () => [
14020
14366
  { type: Renderer2 },
@@ -14022,7 +14368,6 @@ RedSysRedirectEcComponent.ctorParameters = () => [
14022
14368
  { type: ToastService },
14023
14369
  { type: Constants },
14024
14370
  { type: CartService },
14025
- { type: ToastService },
14026
14371
  { type: ActivatedRoute },
14027
14372
  { type: BsModalService }
14028
14373
  ];
@@ -14041,11 +14386,13 @@ __decorate$1m([
14041
14386
  __decorate$1m([
14042
14387
  ViewChild('template')
14043
14388
  ], RedSysRedirectEcComponent.prototype, "template", void 0);
14389
+ __decorate$1m([
14390
+ HostListener('window:message', ['$event'])
14391
+ ], RedSysRedirectEcComponent.prototype, "onMessage", null);
14044
14392
  RedSysRedirectEcComponent = __decorate$1m([
14045
14393
  Component({
14046
14394
  selector: 'app-redsys-redirect-ec',
14047
- template: "<div class=\"text-center\">\n <h3>Continuar con el pago</h3>\n <p *ngIf=\"method\" class=\"px-5\">{{ method?.description }}</p>\n <p *ngIf=\"method\" class=\"px-5\">{{ method?.instructions }}</p>\n <button class=\"btn btn-outline-secondary comprar\" (click)=\"openModal(template)\">Pagar con tarjeta</button>\n</div>\n\n<ng-template #template>\n <div class=\"modal-content\">\n </div>\n <div class=\"modal-body\">\n <iframe src=\"../../../assets/redsysFrameRedirectBase.html\" frameborder=\"0\" class=\"iframeStyle\"></iframe>\n </div>\n \n</ng-template>",
14048
- providers: [BsModalService],
14395
+ template: "<div class=\"text-center\">\n <h3>Continuar con el pago</h3>\n <p *ngIf=\"method\" class=\"px-5\">{{ method?.description }}</p>\n <p *ngIf=\"method\" class=\"px-5\">{{ method?.instructions }}</p>\n <button class=\"btn btn-outline-secondary comprar\" (click)=\"openModal(template)\">\n Pagar con tarjeta\n </button>\n</div>\n\n<ng-template #template>\n <div class=\"modal-header\">\n <h4 class=\"modal-title pull-left\">Pasarela de pago</h4>\n <button type=\"button\" class=\"btn-close close pull-right\" aria-label=\"Close\" (click)=\"clickClose()\">\n </button>\n </div>\n \n <div class=\"modal-body p-0\">\n <iframe src=\"../../../assets/redsysFrameRedirectBase.html\" \n frameborder=\"0\" \n class=\"iframeStyle\"\n style=\"width: 100%; height: 600px; min-height: 60vh;\">\n </iframe>\n </div>\n</ng-template>",
14049
14396
  styles: [".half-width{width:49%!important}.ml-1{margin-left:1%}#card-form{height:450px}.iframeStyle{height:800px;width:100%;max-height:800px}"]
14050
14397
  })
14051
14398
  ], RedSysRedirectEcComponent);