rebill-web-components-sdk 1.14.2 → 1.14.4

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.
@@ -308,6 +308,8 @@ const Address = class {
308
308
  errors = null;
309
309
  unsubscribeAddressStore;
310
310
  unsubscribeSaveCardStore;
311
+ /** True cuando el cambio de país viene del autocompletado, para no borrar el estado */
312
+ isAutocompletingAddress = false;
311
313
  translateError(errorKey) {
312
314
  if (!errorKey)
313
315
  return '';
@@ -386,6 +388,7 @@ const Address = class {
386
388
  }
387
389
  async handleAddressSelected(address) {
388
390
  this.isLoadingAddress = true;
391
+ this.isAutocompletingAddress = true;
389
392
  // Normalize text function for handling accents and special characters
390
393
  const normalizeText = (text) => {
391
394
  return text
@@ -454,6 +457,7 @@ const Address = class {
454
457
  this.emitInputEventsForAddress(address);
455
458
  setTimeout(() => {
456
459
  this.isLoadingAddress = false;
460
+ this.isAutocompletingAddress = false;
457
461
  }, 500);
458
462
  });
459
463
  }
@@ -547,8 +551,11 @@ const Address = class {
547
551
  // If country changes, load states for the new country
548
552
  if (field === 'country') {
549
553
  await this.loadStatesForCountry(value);
550
- // Clear the current state selection since the country changed
551
- this.setBillingAddress({ state: '' });
554
+ // Solo limpiar el estado si el cambio de país lo hizo el usuario manualmente,
555
+ // no cuando viene de un autocompletado (que ya trae el estado correcto)
556
+ if (!this.isAutocompletingAddress) {
557
+ this.setBillingAddress({ state: '' });
558
+ }
552
559
  }
553
560
  }
554
561
  renderAddressHeader() {
@@ -570,7 +577,7 @@ const Address = class {
570
577
  })() }))));
571
578
  }
572
579
  render() {
573
- return (index.h("div", { key: 'f37bec4053e01a3893cb9574cdc3f48024da9193' }, this.renderAddressForm()));
580
+ return (index.h("div", { key: '55df1c07fe984384561109f315cf2629d363f27a' }, this.renderAddressForm()));
574
581
  }
575
582
  };
576
583
  Address.style = addressCss;