rebill-web-components-sdk 1.13.19 → 1.13.21

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 (44) hide show
  1. package/dist/cjs/card-fields-wrapper_11.cjs.entry.js +1 -1
  2. package/dist/cjs/{google-maps.service-C61Pm1no.js → google-maps.service-CZcMzFBX.js} +49 -3
  3. package/dist/cjs/google-maps.service-CZcMzFBX.js.map +1 -0
  4. package/dist/cjs/index-C-VTnc0I.js.map +1 -1
  5. package/dist/cjs/rebill-change-card.cjs.entry.js +1 -1
  6. package/dist/cjs/rebill-checkout.cjs.entry.js +1 -1
  7. package/dist/cjs/rebill-renewal.cjs.entry.js +1 -1
  8. package/dist/collection/utils/google-maps.service.js +47 -1
  9. package/dist/collection/utils/google-maps.service.js.map +1 -1
  10. package/dist/components/p-8BpuJ_V5.js.map +1 -1
  11. package/dist/components/{p-BLo8Aps6.js → p-8MtEW13e.js} +49 -3
  12. package/dist/components/p-8MtEW13e.js.map +1 -0
  13. package/dist/components/{p-D2qupJgh.js → p-C8zfxcyS.js} +3 -3
  14. package/dist/components/{p-D2qupJgh.js.map → p-C8zfxcyS.js.map} +1 -1
  15. package/dist/components/rebill-address-search.js +1 -1
  16. package/dist/components/rebill-address.js +1 -1
  17. package/dist/components/rebill-change-card.js +2 -2
  18. package/dist/components/rebill-checkout.js +2 -2
  19. package/dist/components/rebill-renewal.js +2 -2
  20. package/dist/esm/card-fields-wrapper_11.entry.js +1 -1
  21. package/dist/esm/{google-maps.service-DM1Z3gTC.js → google-maps.service-C2nYpE_A.js} +49 -3
  22. package/dist/esm/google-maps.service-C2nYpE_A.js.map +1 -0
  23. package/dist/esm/index-D8cwEAmw.js.map +1 -1
  24. package/dist/esm/rebill-change-card.entry.js +1 -1
  25. package/dist/esm/rebill-checkout.entry.js +1 -1
  26. package/dist/esm/rebill-renewal.entry.js +1 -1
  27. package/dist/rebill-web-components-sdk/p-C2nYpE_A.js +2 -0
  28. package/dist/rebill-web-components-sdk/p-C2nYpE_A.js.map +1 -0
  29. package/dist/rebill-web-components-sdk/p-D8cwEAmw.js.map +1 -1
  30. package/dist/rebill-web-components-sdk/{p-f08ee974.entry.js → p-b9a3b27f.entry.js} +2 -2
  31. package/dist/rebill-web-components-sdk/{p-fa2647be.entry.js → p-bf15156a.entry.js} +2 -2
  32. package/dist/rebill-web-components-sdk/{p-0c396bf4.entry.js → p-c327a984.entry.js} +2 -2
  33. package/dist/rebill-web-components-sdk/{p-5c4c4d5f.entry.js → p-f3859b65.entry.js} +2 -2
  34. package/dist/rebill-web-components-sdk/rebill-web-components-sdk.esm.js +1 -1
  35. package/package.json +1 -1
  36. package/dist/cjs/google-maps.service-C61Pm1no.js.map +0 -1
  37. package/dist/components/p-BLo8Aps6.js.map +0 -1
  38. package/dist/esm/google-maps.service-DM1Z3gTC.js.map +0 -1
  39. package/dist/rebill-web-components-sdk/p-DM1Z3gTC.js +0 -2
  40. package/dist/rebill-web-components-sdk/p-DM1Z3gTC.js.map +0 -1
  41. /package/dist/rebill-web-components-sdk/{p-f08ee974.entry.js.map → p-b9a3b27f.entry.js.map} +0 -0
  42. /package/dist/rebill-web-components-sdk/{p-fa2647be.entry.js.map → p-bf15156a.entry.js.map} +0 -0
  43. /package/dist/rebill-web-components-sdk/{p-0c396bf4.entry.js.map → p-c327a984.entry.js.map} +0 -0
  44. /package/dist/rebill-web-components-sdk/{p-5c4c4d5f.entry.js.map → p-f3859b65.entry.js.map} +0 -0
@@ -27,6 +27,21 @@ class GoogleMapsService {
27
27
  }
28
28
  return originalAttachShadow.call(this, init);
29
29
  };
30
+ // Interceptar showModal() para evitar que Google abra un dialog fullscreen
31
+ // en mobile que cubre toda la pantalla (se promueve al #top-layer del navegador).
32
+ // Usamos .show() en su lugar para que quede en el flujo normal del DOM
33
+ // y podamos estilizarlo con CSS.
34
+ const originalShowModal = HTMLDialogElement.prototype.showModal;
35
+ HTMLDialogElement.prototype.showModal = function () {
36
+ const isGoogleDialog = this.classList.contains('full-window-autocomplete-dialog') ||
37
+ this.closest('gmp-place-autocomplete') !== null;
38
+ if (isGoogleDialog) {
39
+ // Abrir como dialog no-modal → queda en flujo normal, no en #top-layer
40
+ this.show();
41
+ return;
42
+ }
43
+ return originalShowModal.call(this);
44
+ };
30
45
  window.gmpShadowPatched = true;
31
46
  }
32
47
  async waitForAPI() {
@@ -451,6 +466,31 @@ class GoogleMapsService {
451
466
  color: inherit !important;
452
467
  font-family: inherit !important;
453
468
  }
469
+
470
+ /* FIX mobile: Google abre un dialog fullscreen en viewports chicos.
471
+ Con el patch de showModal→show, el dialog ya no va al #top-layer.
472
+ Lo forzamos a ser inline dentro del contenedor. */
473
+ dialog,
474
+ .full-window-autocomplete-dialog,
475
+ [class*="full-window"] {
476
+ position: absolute !important;
477
+ top: 0 !important;
478
+ left: 0 !important;
479
+ width: 100% !important;
480
+ height: auto !important;
481
+ max-height: none !important;
482
+ margin: 0 !important;
483
+ padding: 0 !important;
484
+ border: none !important;
485
+ background: transparent !important;
486
+ overflow: visible !important;
487
+ z-index: 10 !important;
488
+ }
489
+
490
+ /* El backdrop del dialog (si existiera) */
491
+ dialog::backdrop {
492
+ display: none !important;
493
+ }
454
494
  `;
455
495
  shadow.appendChild(style);
456
496
  }
@@ -466,9 +506,15 @@ class GoogleMapsService {
466
506
  const country = getComponent('country', true);
467
507
  const zip = getComponent('postal_code');
468
508
  let addressLine = '';
509
+ // Países donde el número va ANTES de la calle (ej: "600 Fifth Avenue")
510
+ const numberFirstCountries = ['US', 'CA', 'GB', 'AU', 'NZ', 'IE'];
511
+ const isNumberFirst = numberFirstCountries.includes(country);
469
512
  // Prioridad 1: Usar street_number + route si ambos existen
470
513
  if (streetNumber && route) {
471
- addressLine = `${route} ${streetNumber}`.trim();
514
+ // Formato según el país
515
+ addressLine = isNumberFirst
516
+ ? `${streetNumber} ${route}`.trim() // USA: "600 Fifth Avenue"
517
+ : `${route} ${streetNumber}`.trim(); // LATAM: "Avenida Carlos Tejedor 600"
472
518
  }
473
519
  else if (route) {
474
520
  // Si solo hay route, usarlo
@@ -802,6 +848,6 @@ function defineCustomElement() {
802
848
  defineCustomElement();
803
849
 
804
850
  export { AddressSearch as A, GoogleMapsService as G, defineCustomElement as d };
805
- //# sourceMappingURL=p-BLo8Aps6.js.map
851
+ //# sourceMappingURL=p-8MtEW13e.js.map
806
852
 
807
- //# sourceMappingURL=p-BLo8Aps6.js.map
853
+ //# sourceMappingURL=p-8MtEW13e.js.map
@@ -0,0 +1 @@
1
+ {"file":"p-8MtEW13e.js","mappings":";;;;;;;;MAUa,iBAAiB,CAAA;IACpB,OAAO,QAAQ;IACf,QAAQ,GAAY,KAAK;IACzB,WAAW,GAA4B,IAAI;AAEnD,IAAA,OAAO,WAAW,GAAA;AAChB,QAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE;AAC/B,YAAA,iBAAiB,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE;YACpD,iBAAiB,CAAC,mBAAmB,EAAE;;QAEzC,OAAO,iBAAiB,CAAC,QAAQ;;AAG3B,IAAA,OAAO,mBAAmB,GAAA;QAChC,IAAK,MAAc,CAAC,gBAAgB;YAAE;AAEtC,QAAA,MAAM,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY;AAE3D,QAAA,OAAO,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,IAAoB,EAAA;AAC7D,YAAA,IAAI,IAAI,CAAC,SAAS,KAAK,wBAAwB,EAAE;AAC/C,gBAAA,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;YAEnE,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;AAC9C,SAAC;;;;;AAMD,QAAA,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,SAAS,CAAC,SAAS;AAC/D,QAAA,iBAAiB,CAAC,SAAS,CAAC,SAA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EAAA,0CAAA,EACE,OAAO,EAAC,WAAW,EACnB,KAAK,EAAE,WAAW,CAAC,SAAS,EAC5B,KAAK,EAAC,aAAa,EAElB,EAAA,WAAW,CAAC,SAAS,CAAC,GAAG,cAAc,CAAA,YAAA,CAAc,EAAE,wBAAwB,CAAC,CAC/D,CACb,CACL,CACP,CACG,CACmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement","sessionState"],"sources":["src/utils/google-maps.service.ts","src/components/checkout/address/address-search/address-search.css?tag=rebill-address-search","src/components/checkout/address/address-search/address-search.tsx"],"sourcesContent":["export interface AddressComponents {\n address: string;\n city: string;\n state: string;\n country: string;\n zip: string;\n addInformation?: string;\n formattedAddress?: string; // Dirección completa de Google para usar como fallback\n}\n\nexport class GoogleMapsService {\n private static instance: GoogleMapsService;\n private isLoaded: boolean = false;\n private loadPromise: Promise<boolean> | null = null;\n\n static getInstance(): GoogleMapsService {\n if (!GoogleMapsService.instance) {\n GoogleMapsService.instance = new GoogleMapsService();\n GoogleMapsService.setupShadowDOMPatch();\n }\n return GoogleMapsService.instance;\n }\n\n private static setupShadowDOMPatch() {\n if ((window as any).gmpShadowPatched) return;\n\n const originalAttachShadow = Element.prototype.attachShadow;\n\n Element.prototype.attachShadow = function (init: ShadowRootInit) {\n if (this.localName === 'gmp-place-autocomplete') {\n return originalAttachShadow.call(this, { ...init, mode: 'open' });\n }\n return originalAttachShadow.call(this, init);\n };\n\n // Interceptar showModal() para evitar que Google abra un dialog fullscreen\n // en mobile que cubre toda la pantalla (se promueve al #top-layer del navegador).\n // Usamos .show() en su lugar para que quede en el flujo normal del DOM\n // y podamos estilizarlo con CSS.\n const originalShowModal = HTMLDialogElement.prototype.showModal;\n HTMLDialogElement.prototype.showModal = function () {\n const isGoogleDialog =\n this.classList.contains('full-window-autocomplete-dialog') ||\n this.closest('gmp-place-autocomplete') !== null;\n\n if (isGoogleDialog) {\n // Abrir como dialog no-modal → queda en flujo normal, no en #top-layer\n this.show();\n return;\n }\n return originalShowModal.call(this);\n };\n\n (window as any).gmpShadowPatched = true;\n }\n\n async waitForAPI(): Promise<boolean> {\n if (this.isLoaded && window.google) {\n return true;\n }\n\n if (this.loadPromise) {\n return this.loadPromise;\n }\n\n this.loadPromise = new Promise(resolve => {\n let attempts = 0;\n const maxAttempts = 100; // 10 seconds max wait\n\n const checkAPI = () => {\n attempts++;\n\n if (window.google) {\n this.isLoaded = true;\n resolve(true);\n } else if (attempts >= maxAttempts) {\n console.error('Google Maps API failed to load within timeout');\n resolve(false);\n } else {\n setTimeout(checkAPI, 100);\n }\n };\n checkAPI();\n });\n\n return this.loadPromise;\n }\n\n /**\n * Crea autocomplete usando la nueva API de Google Places (PlaceAutocompleteElement).\n * containerElement: donde se inserta (ej. search-input-container). Debe tener position: relative.\n * inputElement: input para sincronizar valor al seleccionar y para focus/blur.\n * Retorna el elemento y una función destroy para limpiar al desmontar.\n */\n async createAutocomplete(\n containerElement: HTMLElement,\n inputElement: HTMLInputElement,\n onPlaceSelected: (address: AddressComponents) => void,\n options?: {\n placeholder?: string;\n componentRestrictions?: { country: string | string[] };\n error?: string;\n disabled?: boolean;\n },\n ): Promise<{\n element: HTMLElement;\n destroy: () => void;\n syncToGoogle: (value?: string) => void;\n setError: (error?: string) => void;\n setDisabled: (disabled: boolean) => void;\n } | null> {\n const isReady = await this.waitForAPI();\n if (!isReady) {\n console.error('Google Maps API not available');\n return null;\n }\n\n try {\n // Nueva API: importLibrary carga Places (New)\n await google.maps.importLibrary('places');\n\n const elementOptions: google.maps.places.PlaceAutocompleteElementOptions = {\n types: ['address'],\n };\n\n if (options?.componentRestrictions?.country) {\n const countries = Array.isArray(options.componentRestrictions.country)\n ? options.componentRestrictions.country\n : [options.componentRestrictions.country];\n elementOptions.componentRestrictions = { country: countries };\n }\n\n const placeAutocomplete = new google.maps.places.PlaceAutocompleteElement(elementOptions);\n\n if (options?.placeholder) {\n placeAutocomplete.setAttribute('placeholder', options.placeholder);\n }\n\n // Agregar clase error si existe\n if (options?.error) {\n placeAutocomplete.classList.add('error');\n }\n\n // Deshabilitar si corresponde\n if (options?.disabled) {\n placeAutocomplete.setAttribute('disabled', 'true');\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput) googleInput.disabled = true;\n }\n\n // Insertar en el container; el CSS del padre lo posiciona como overlay\n containerElement.appendChild(placeAutocomplete);\n await new Promise(resolve => setTimeout(resolve, 300));\n\n // Inyectar estilos Rebill en el shadow DOM (modo open vía setupShadowDOMPatch)\n this.injectRebillStyles(placeAutocomplete);\n\n // Ocultar elementos de branding de Google que se renderizan fuera del Shadow DOM\n this.hideGoogleBranding();\n\n // Sincronizar valor del input → Google (SOLO una dirección)\n let isSyncing = false;\n const syncToGoogle = (value?: string) => {\n if (isSyncing) return;\n isSyncing = true;\n\n const val = value ?? inputElement.value;\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput) {\n googleInput.value = val;\n // Disparar eventos para que Google detecte el cambio\n googleInput.dispatchEvent(new Event('input', { bubbles: true }));\n googleInput.dispatchEvent(new Event('change', { bubbles: true }));\n }\n\n setTimeout(() => {\n isSyncing = false;\n }, 50);\n };\n\n const inputHandler = () => {\n if (!isSyncing) {\n syncToGoogle();\n }\n };\n inputElement.addEventListener('input', inputHandler);\n\n // Sincronizar valor inicial\n setTimeout(() => syncToGoogle(), 100);\n\n // Evento correcto: gmp-select (no gmp-placeselect)\n const selectHandler = async (ev: Event) => {\n const evt = ev as CustomEvent & {\n placePrediction?: { toPlace: () => Promise<google.maps.places.Place> };\n };\n const placePrediction = evt.placePrediction ?? (evt.detail as any)?.placePrediction;\n if (!placePrediction) return;\n const place = await placePrediction.toPlace();\n await place.fetchFields({\n fields: ['addressComponents', 'formattedAddress'],\n });\n\n if (place.addressComponents) {\n const address = this.parseAddressComponentsNew(\n place.addressComponents as any[],\n place.formattedAddress ?? undefined,\n );\n\n address.formattedAddress = place.formattedAddress ?? undefined;\n\n // Forzar actualización del input de Google con solo calle + número\n // Esto sobrescribe el texto completo que Google pone automáticamente\n setTimeout(() => {\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput && address.address) {\n googleInput.value = address.address;\n }\n }, 10);\n\n onPlaceSelected(address);\n }\n };\n\n placeAutocomplete.addEventListener('gmp-select', selectHandler);\n\n const setError = (error?: string) => {\n if (error) {\n placeAutocomplete.classList.add('error');\n } else {\n placeAutocomplete.classList.remove('error');\n }\n };\n\n const setDisabled = (disabled: boolean) => {\n if (disabled) {\n placeAutocomplete.setAttribute('disabled', 'true');\n } else {\n placeAutocomplete.removeAttribute('disabled');\n }\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput) {\n googleInput.disabled = disabled;\n }\n };\n\n const destroy = () => {\n inputElement.removeEventListener('input', inputHandler);\n placeAutocomplete.removeEventListener('gmp-select', selectHandler);\n placeAutocomplete.remove();\n containerElement.classList.remove('autocomplete-active');\n };\n\n return { element: placeAutocomplete, destroy, syncToGoogle, setError, setDisabled };\n } catch (error) {\n console.error('Failed to create Google Maps PlaceAutocompleteElement:', error);\n return null;\n }\n }\n\n private hideGoogleBranding() {\n // Inyectar CSS global para ocultar branding de Google\n const globalStyleId = 'rebill-hide-google-branding';\n if (document.getElementById(globalStyleId)) return;\n\n const style = document.createElement('style');\n style.id = globalStyleId;\n style.textContent = `\n /* Ocultar TODOS los elementos de branding de Google Maps */\n gmp-internal-attribution,\n gmp-internal-dialog,\n gmp-place-autocomplete::part(attribution),\n gmp-place-autocomplete + *,\n gmp-place-autocomplete ~ *,\n a[href*=\"maps.google.com\"],\n a[title*=\"Google Maps\"],\n [aria-label*=\"Google Maps\"],\n div:has(> a[href*=\"google.com\"]),\n .dismissButton {\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n height: 0 !important;\n max-height: 0 !important;\n overflow: hidden !important;\n position: absolute !important;\n left: -9999px !important;\n }\n `;\n document.head.appendChild(style);\n\n // Remover elementos de branding continuamente (Google los puede agregar dinámicamente)\n const removeGoogleBranding = () => {\n // Remover Web Components de Google\n document.querySelectorAll('gmp-internal-attribution, gmp-internal-dialog').forEach(el => {\n el.remove();\n });\n\n // Remover links y elementos con \"Google Maps\"\n document\n .querySelectorAll('a[href*=\"maps.google.com\"], a[title*=\"Google Maps\"]')\n .forEach(el => {\n const parent = el.closest('div');\n if (parent && parent.textContent?.includes('Google Maps')) {\n parent.style.display = 'none';\n }\n el.remove();\n });\n\n // Remover cualquier SVG con aria-label=\"Google Maps\"\n document.querySelectorAll('svg[aria-label*=\"Google Maps\"]').forEach(el => {\n el.remove();\n });\n };\n\n // Ejecutar inmediatamente y periódicamente\n removeGoogleBranding();\n setInterval(removeGoogleBranding, 500);\n\n // Observer para elementos que se agregan dinámicamente\n const observer = new MutationObserver(() => {\n removeGoogleBranding();\n });\n observer.observe(document.body, { childList: true, subtree: true });\n }\n\n private injectRebillStyles(placeAutocomplete: HTMLElement) {\n const shadow = placeAutocomplete.shadowRoot;\n if (!shadow) {\n console.warn('Shadow DOM not available - styles cannot be injected');\n return;\n }\n\n const style = document.createElement('style');\n style.textContent = `\n /* Resetear TODO */\n * {\n box-sizing: border-box !important;\n }\n\n :host {\n display: block !important;\n width: 100% !important;\n height: 38.33px !important;\n max-height: 38.33px !important;\n font-family: inherit !important;\n border: none !important;\n outline: none !important;\n box-shadow: none !important;\n background: transparent !important;\n overflow: visible !important;\n }\n\n /* Contenedores - resetear */\n div, span, ul, li {\n all: revert !important;\n }\n\n /* INPUT PRINCIPAL - Copiar estilos exactos de rebill-input-text */\n input {\n display: block !important;\n width: 100% !important;\n height: 38.33px !important;\n min-height: 38.33px !important;\n box-sizing: border-box !important;\n border-radius: 8px !important;\n border: 1.5px solid #E5E7EB !important;\n padding: 10px 14px !important;\n padding-right: 40px !important;\n font-size: 14px !important;\n line-height: 20px !important;\n font-weight: 400 !important;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;\n color: #111827 !important;\n background-color: #FFFFFF !important;\n outline: none !important;\n transition: all 0.2s ease !important;\n -webkit-appearance: none !important;\n appearance: none !important;\n }\n\n input::placeholder {\n color: #9CA3AF !important;\n opacity: 1 !important;\n }\n\n input:focus {\n border-color: var(--rebill-color-primary) !important;\n box-shadow: none !important;\n }\n\n input:disabled {\n background-color: var(--rebill-color-background) !important;\n border-color: var(--rebill-color-disabled) !important;\n color: var(--rebill-color-text-secondary) !important;\n cursor: not-allowed !important;\n opacity: 0.7 !important;\n }\n\n input:disabled:focus {\n border-color: var(--rebill-color-disabled) !important;\n box-shadow: none !important;\n }\n\n /* Estado de error - border rojo igual que inputs de Rebill */\n :host(.error) input,\n :host([error]) input {\n border-color: var(--rebill-color-error, #EF4444) !important;\n }\n\n :host(.error) input:focus,\n :host([error]) input:focus {\n border-color: var(--rebill-color-error, #EF4444) !important;\n box-shadow: 0 0 0 2px var(--rebill-color-error-light, rgba(239, 68, 68, 0.1)) !important;\n }\n\n /* Ocultar elementos decorativos de Google */\n [class*=\"icon\"],\n [class*=\"suffix\"],\n [class*=\"prefix\"],\n [class*=\"logo\"],\n [class*=\"powered\"],\n [class*=\"google\"],\n [class*=\"branding\"],\n [class*=\"divider\"],\n [class*=\"separator\"],\n [aria-label*=\"Google\"],\n [aria-label*=\"clear\"],\n [aria-label*=\"Clear\"],\n button,\n svg,\n a[href*=\"google.com\"] {\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n height: 0 !important;\n width: 0 !important;\n overflow: hidden !important;\n }\n\n /* Ocultar elementos hermanos del input EXCEPTO error-message */\n input + *:not(.error-message),\n input ~ *:not(.error-message) {\n display: none !important;\n }\n\n /* Dropdown - Estilo Rebill */\n [role=\"listbox\"] {\n position: absolute !important;\n z-index: 9999 !important;\n margin-top: 4px !important;\n width: 100% !important;\n max-height: 300px !important;\n overflow-y: auto !important;\n background: #FFFFFF !important;\n border: 1px solid #E5E7EB !important;\n border-radius: 8px !important;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;\n padding: 0 !important;\n }\n\n ul {\n list-style: none !important;\n padding: 0 !important;\n margin: 0 !important;\n }\n\n /* Ocultar contenedor de atribuciones */\n .attributions,\n [role=\"presentation\"],\n div:has(> gmp-internal-attribution) {\n display: none !important;\n height: 0 !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n }\n\n /* Ocultar UL vacío cuando no hay sugerencias */\n ul:empty {\n display: none !important;\n }\n\n [role=\"option\"] {\n padding: 0.75rem !important;\n cursor: pointer !important;\n color: var(--rebill-color-text-primary) !important;\n font-size: 0.875rem !important;\n font-weight: 400 !important;\n border-bottom: 1px solid var(--rebill-color-border) !important;\n list-style: none !important;\n list-style-type: none !important;\n transition: background-color 0.15s ease !important;\n background-color: transparent !important;\n }\n\n [role=\"option\"]::before,\n [role=\"option\"]::marker {\n display: none !important;\n content: none !important;\n }\n\n [role=\"option\"]:last-child {\n border-bottom: none !important;\n }\n\n [role=\"option\"]:hover,\n [role=\"option\"][aria-selected=\"true\"] {\n background-color: #f0f9ff !important;\n }\n\n /* Texto dentro - mismo color que la opción */\n [role=\"option\"] * {\n color: var(--rebill-color-text-primary) !important;\n font-family: inherit !important;\n font-weight: inherit !important;\n }\n\n /* Ocultar botón de cerrar (X) */\n button[aria-label*=\"dismiss\"],\n button[aria-label*=\"close\"],\n .dismiss,\n .close-button {\n display: none !important;\n }\n\n /* Texto dentro de las sugerencias */\n [role=\"option\"] * {\n color: inherit !important;\n font-family: inherit !important;\n }\n\n /* FIX mobile: Google abre un dialog fullscreen en viewports chicos.\n Con el patch de showModal→show, el dialog ya no va al #top-layer.\n Lo forzamos a ser inline dentro del contenedor. */\n dialog,\n .full-window-autocomplete-dialog,\n [class*=\"full-window\"] {\n position: absolute !important;\n top: 0 !important;\n left: 0 !important;\n width: 100% !important;\n height: auto !important;\n max-height: none !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n background: transparent !important;\n overflow: visible !important;\n z-index: 10 !important;\n }\n\n /* El backdrop del dialog (si existiera) */\n dialog::backdrop {\n display: none !important;\n }\n `;\n shadow.appendChild(style);\n }\n\n private parseAddressComponentsNew(\n components: any[],\n formattedAddress?: string,\n ): AddressComponents {\n const getComponent = (type: string, useShortName = false) => {\n const component = components.find((c: any) => c.types.includes(type));\n return component ? (useShortName ? component.shortText : component.longText) : '';\n };\n\n const streetNumber = getComponent('street_number');\n const route = getComponent('route');\n const city = getComponent('locality');\n const state = getComponent('administrative_area_level_1');\n const country = getComponent('country', true);\n const zip = getComponent('postal_code');\n\n let addressLine = '';\n\n // Países donde el número va ANTES de la calle (ej: \"600 Fifth Avenue\")\n const numberFirstCountries = ['US', 'CA', 'GB', 'AU', 'NZ', 'IE'];\n const isNumberFirst = numberFirstCountries.includes(country);\n\n // Prioridad 1: Usar street_number + route si ambos existen\n if (streetNumber && route) {\n // Formato según el país\n addressLine = isNumberFirst\n ? `${streetNumber} ${route}`.trim() // USA: \"600 Fifth Avenue\"\n : `${route} ${streetNumber}`.trim(); // LATAM: \"Avenida Carlos Tejedor 600\"\n } else if (route) {\n // Si solo hay route, usarlo\n addressLine = route;\n } else if (streetNumber) {\n // Si solo hay número, usarlo\n addressLine = streetNumber;\n }\n\n // Si ya tenemos una dirección de los componentes, usarla\n if (addressLine.length > 0) {\n return {\n address: addressLine,\n city,\n state,\n country,\n zip,\n };\n }\n\n // Prioridad 2: Extraer de formattedAddress\n if (formattedAddress) {\n // Separar por coma y tomar solo la primera parte (calle + número)\n const parts = formattedAddress.split(',').map(p => p.trim());\n const firstPart = parts[0] ?? '';\n\n // Verificar si la primera parte no contiene el nombre de la ciudad\n // Esto previene que se incluya ciudad en la dirección\n const containsCity = city && firstPart.toLowerCase().includes(city.toLowerCase());\n const containsState = state && firstPart.toLowerCase().includes(state.toLowerCase());\n\n if (firstPart.length > 0 && !containsCity && !containsState && /[0-9A-Za-z]/.test(firstPart)) {\n addressLine = firstPart;\n }\n }\n\n return {\n address: addressLine,\n city,\n state,\n country,\n zip,\n };\n }\n\n static loadGoogleMapsScript(googleMapsApiKey?: string) {\n // Use new API key\n const apiKey = googleMapsApiKey || 'AIzaSyB9pS5LHbPKjnmMQ89BQHD0SVZXVsi95pk';\n\n if (!apiKey) {\n console.warn('Google Maps API key not provided. Address autocomplete will not be available.');\n return;\n }\n\n // Check if script is already loaded\n if (document.querySelector('script[src*=\"maps.googleapis.com\"]')) {\n return;\n }\n\n const script = document.createElement('script');\n // Nueva API: loading=async, Places se carga vía importLibrary en createAutocomplete\n script.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&loading=async&callback=initGoogleMaps`;\n script.async = true;\n script.defer = true;\n\n // Add global callback for when Google Maps is ready\n (window as any).initGoogleMaps = () => {\n delete (window as any).initGoogleMaps; // Clean up\n };\n\n script.onerror = () => {\n console.error(\n 'Failed to load Google Maps script. Please check your API key and network connection.',\n );\n };\n\n document.head.appendChild(script);\n }\n}\n",":host {\n display: block;\n}\n\n.address-search-container {\n width: 100%;\n margin-bottom: 24px;\n}\n\n.search-input-container {\n position: relative;\n margin-bottom: 8px;\n overflow: visible;\n height: 38.33px;\n min-height: 38.33px;\n}\n\n/* PlaceAutocompleteElement de Google se superpone; el dropdown debe ser visible */\n.search-input-container gmp-place-autocomplete {\n position: absolute !important;\n top: 0;\n left: 0;\n width: 100% !important;\n height: 38.33px !important;\n min-height: 38.33px !important;\n max-height: 38.33px !important;\n opacity: 1 !important;\n pointer-events: auto !important;\n z-index: 10;\n /* Estilos del host para consistencia visual */\n color-scheme: light;\n}\n\n/* Ocultar input nativo cuando Google overlay está activo (evita doble input) */\n.search-input-container.autocomplete-active rebill-input-text {\n visibility: hidden;\n}\n\n.manual-entry-link-wrapper {\n display: flex;\n justify-content: flex-start;\n}\n\n.manual-entry-link {\n background: none;\n border: none;\n color: var(--rebill-color-primary);\n cursor: pointer;\n font-size: 14px;\n padding: 4px 0;\n text-decoration: underline;\n text-decoration-color: var(--rebill-color-text-secondary);\n}\n","import { Component, Element, Event, EventEmitter, h, Prop, State, Watch } from '@stencil/core';\nimport { I18nService } from '../../../../i18n/i18n.service';\nimport { sessionState, SessionStore } from '../../../../store/session.store';\nimport { COLORS_ENUM } from '../../../../utils/color-class-mapper';\nimport { AddressComponents, GoogleMapsService } from '../../../../utils/google-maps.service';\n\n@Component({\n tag: 'rebill-address-search',\n styleUrl: 'address-search.css',\n shadow: false,\n})\nexport class AddressSearch {\n @Element() el: HTMLElement;\n @State() isInitialized = false;\n @State() currentLocale: string = sessionState.currentLocale;\n /** Valor mientras el usuario edita (null = mostrar value prop) */\n @State() editingValue: string | null = null;\n /** True justo después de seleccionar un lugar para no emitir freeText en el siguiente blur */\n @State() justSelectedPlace: boolean = false;\n /** Para distinguir Enter con y sin selección de Google */\n private lastPlaceChangedAt: number = 0;\n private lastEnterAt: number = 0;\n\n @Prop() addressType: 'billing' | 'shipping' = 'billing';\n @Prop() placeholder?: string;\n @Prop() error?: string;\n @Prop() disabled: boolean = false;\n /** Valor mostrado en el input (ej. calle + número tras seleccionar o texto libre) */\n @Prop() value: string = '';\n /** Si false, no se muestra el enlace \"Ingresar dirección manualmente\" (vista unificada) */\n @Prop() showManualEntryLink: boolean = true;\n private autocompleteSetError?: (error?: string) => void;\n\n @Event() addressSelected: EventEmitter<AddressComponents>;\n @Event() manualEntryRequested: EventEmitter<void>;\n /** Se emite al salir del input con el texto actual cuando el usuario no eligió una sugerencia */\n @Event() freeTextAddress: EventEmitter<string>;\n /** Se emite al pulsar Enter sin seleccionar (para mostrar el resto de campos) */\n @Event() commitRequested: EventEmitter<void>;\n private googleMapsService = GoogleMapsService.getInstance();\n private autocompleteDestroy: (() => void) | null = null;\n private autocompleteSync: ((value?: string) => void) | null = null;\n private autocompleteSetDisabled?: (disabled: boolean) => void;\n private unsubscribeCurrentLocaleStore?: () => void;\n private inputEl: HTMLInputElement | null = null;\n private onKeyDown?: (e: KeyboardEvent) => void;\n private pendingEnterTimer: ReturnType<typeof setTimeout> | null = null;\n\n async componentDidLoad() {\n await this.initializeAutocomplete();\n\n // Listen for language changes\n this.unsubscribeCurrentLocaleStore = SessionStore.onChange('currentLocale', () => {\n this.currentLocale = sessionState.currentLocale;\n });\n }\n\n disconnectedCallback() {\n this.cleanup();\n\n if (this.unsubscribeCurrentLocaleStore) {\n this.unsubscribeCurrentLocaleStore();\n }\n }\n\n private async initializeAutocomplete() {\n if (this.isInitialized) return;\n\n try {\n const inputElement = await this.getInputElement();\n if (!inputElement) return;\n this.inputEl = inputElement;\n\n const container = this.el?.querySelector('.search-input-container') as HTMLElement;\n if (!container) return;\n\n const translationKey = this.addressType === 'shipping' ? 'shippingAddress' : 'billingAddress';\n const placeholder =\n this.placeholder ||\n I18nService.translate(`${translationKey}.searchPlaceholder`, 'Search for an address...');\n\n const result = await this.googleMapsService.createAutocomplete(\n container,\n inputElement,\n (address: AddressComponents) => this.handleAddressSelected(address),\n { placeholder, error: this.error, disabled: this.disabled },\n );\n if (result) {\n this.autocompleteDestroy = result.destroy;\n this.autocompleteSync = result.syncToGoogle;\n this.autocompleteSetError = result.setError;\n this.autocompleteSetDisabled = result.setDisabled;\n container.classList.add('autocomplete-active');\n }\n // Enter:\n // - Si selecciona sugerencia con Enter, Google dispara place_changed.\n // - Si NO hay selección, place_changed no sucede: tratamos Enter como texto libre y abrimos campos.\n this.onKeyDown = (e: KeyboardEvent) => {\n if (e.key !== 'Enter') return;\n if (this.disabled) return;\n\n this.lastEnterAt = Date.now();\n // Valor puede venir del input nativo o del PlaceAutocompleteElement\n const googleInput = container\n .querySelector('gmp-place-autocomplete')\n ?.shadowRoot?.querySelector('input');\n const value = (googleInput?.value ?? this.inputEl?.value ?? '').trim();\n\n if (this.pendingEnterTimer) clearTimeout(this.pendingEnterTimer);\n this.pendingEnterTimer = setTimeout(() => {\n this.pendingEnterTimer = null;\n if (this.lastPlaceChangedAt >= this.lastEnterAt) return;\n\n if (value) this.freeTextAddress.emit(value);\n this.commitRequested.emit();\n this.justSelectedPlace = false;\n this.editingValue = value;\n }, 250);\n };\n container.addEventListener('keydown', this.onKeyDown);\n if (this.autocompleteDestroy) {\n this.isInitialized = true;\n }\n } catch (error) {\n console.error(`Failed to initialize ${this.addressType} autocomplete:`, error);\n }\n }\n\n private async getInputElement(): Promise<HTMLInputElement | null> {\n const inputComponent = this.el?.querySelector('rebill-input-text') as any;\n if (!inputComponent) {\n console.error(`Input component not found for ${this.addressType}-search`);\n return null;\n }\n\n try {\n return await inputComponent.getInputElement();\n } catch (error) {\n console.error(`Failed to get input element:`, error);\n return null;\n }\n }\n\n @Watch('value')\n valueWatcher() {\n if (this.justSelectedPlace) return;\n this.editingValue = null;\n this.autocompleteSync?.(this.displayValue);\n }\n\n @Watch('error')\n errorWatcher() {\n this.autocompleteSetError?.(this.error);\n }\n\n @Watch('disabled')\n disabledWatcher() {\n this.autocompleteSetDisabled?.(this.disabled);\n }\n\n private async handleAddressSelected(address: AddressComponents) {\n this.lastPlaceChangedAt = Date.now();\n if (this.pendingEnterTimer) {\n clearTimeout(this.pendingEnterTimer);\n this.pendingEnterTimer = null;\n }\n this.justSelectedPlace = true;\n // Evitar re-consultar el DOM: preferir la referencia ya inicializada\n const inputEl = this.inputEl ?? (await this.getInputElement());\n const addressLine = (address.address ?? '').trim();\n // En el search solo debe quedar \"número + calle\" (sin ciudad)\n this.editingValue = addressLine;\n this.addressSelected.emit(address);\n if (inputEl) {\n inputEl.value = addressLine;\n // Forzar actualización después de un pequeño delay para sobrescribir el valor de Google\n setTimeout(() => {\n if (inputEl) inputEl.value = addressLine;\n }, 50);\n }\n }\n\n private handleAddressInput = (ev: CustomEvent<{ id: string; value: string }>) => {\n this.editingValue = ev.detail?.value ?? '';\n };\n\n private handleAddressInputBlur = (ev: CustomEvent<{ id: string; value: string }>) => {\n const value = (ev.detail?.value ?? '').trim();\n if (!this.justSelectedPlace) {\n this.freeTextAddress.emit(value);\n }\n this.justSelectedPlace = false;\n this.editingValue = null;\n };\n\n private handleManualEntry = () => {\n this.manualEntryRequested.emit();\n };\n\n private get displayValue(): string {\n return this.editingValue !== null ? this.editingValue : this.value;\n }\n private cleanup() {\n if (this.pendingEnterTimer) {\n clearTimeout(this.pendingEnterTimer);\n this.pendingEnterTimer = null;\n }\n const container = this.el?.querySelector('.search-input-container');\n if (container && this.onKeyDown) {\n container.removeEventListener('keydown', this.onKeyDown);\n }\n this.onKeyDown = undefined;\n this.inputEl = null;\n this.autocompleteDestroy?.();\n this.autocompleteDestroy = null;\n this.autocompleteSync = null;\n this.isInitialized = false;\n }\n\n render() {\n const translationKey = this.addressType === 'shipping' ? 'shippingAddress' : 'billingAddress';\n const defaultPlaceholder = I18nService.translate(\n `${translationKey}.searchPlaceholder`,\n 'Search for an address...',\n );\n\n return (\n <rebill-autofill-detector\n target-selector=\"rebill-input-text input\"\n disabled={this.disabled}\n onAutofillDetected={event => this.handleAddressSelected(event.detail)}\n onManualEntryRequested={() => this.handleManualEntry()}\n >\n <div class=\"address-search-container\">\n <div class=\"search-input-container\">\n <rebill-input-text\n id={`${this.addressType}-search`}\n value={this.displayValue}\n placeholder={this.placeholder || defaultPlaceholder}\n rightIcon=\"search\"\n error={this.error}\n disabled={this.disabled}\n onInput={e => this.handleAddressInput(e as CustomEvent)}\n onBlur={e => this.handleAddressInputBlur(e as CustomEvent)}\n />\n </div>\n {this.error && (\n <div style={{ marginTop: '0.375rem' }}>\n <span\n class=\"error-message\"\n style={{\n color: 'var(--rebill-color-error)',\n fontSize: '0.75rem',\n display: 'block',\n lineHeight: '1rem',\n }}\n >\n {this.error}\n </span>\n </div>\n )}\n {this.showManualEntryLink && (\n <div class=\"manual-entry-link-wrapper\">\n <button class=\"manual-entry-link\" type=\"button\" onClick={this.handleManualEntry}>\n <rebill-typography\n variant=\"subtitle2\"\n color={COLORS_ENUM.SECONDARY}\n class=\"footer-link\"\n >\n {I18nService.translate(`${translationKey}.manualEntry`, 'Enter address manually')}\n </rebill-typography>\n </button>\n </div>\n )}\n </div>\n </rebill-autofill-detector>\n );\n }\n}\n"],"version":3}
@@ -2,7 +2,7 @@ import { proxyCustomElement, H, createEvent, h } from './p-8BpuJ_V5.js';
2
2
  import { a as api } from './p-D0zT4zMi.js';
3
3
  import { I as I18nService, s as state, o as onChange, S as SessionStore } from './p-DWn7p2EM.js';
4
4
  import { d as defineCustomElement$7 } from './p-iW7xLE4t.js';
5
- import { d as defineCustomElement$6 } from './p-BLo8Aps6.js';
5
+ import { d as defineCustomElement$6 } from './p-8MtEW13e.js';
6
6
  import { d as defineCustomElement$5 } from './p-C_5EcO0h.js';
7
7
  import { d as defineCustomElement$4 } from './p-CEObp3Ol.js';
8
8
  import { d as defineCustomElement$3 } from './p-BSseyChF.js';
@@ -294,6 +294,6 @@ function defineCustomElement() {
294
294
  defineCustomElement();
295
295
 
296
296
  export { Address as A, defineCustomElement as d };
297
- //# sourceMappingURL=p-D2qupJgh.js.map
297
+ //# sourceMappingURL=p-C8zfxcyS.js.map
298
298
 
299
- //# sourceMappingURL=p-D2qupJgh.js.map
299
+ //# sourceMappingURL=p-C8zfxcyS.js.map
@@ -1 +1 @@
1
- {"file":"p-D2qupJgh.js","mappings":";;;;;;;;;;;AAAA,MAAM,UAAU,GAAG,4hFAA4hF;;MCWliF,OAAO,iBAAAA,kBAAA,CAAA,MAAA,OAAA,SAAAC,CAAA,CAAA;;;;;;;;;;;IAGsB,WAAW,GAAsB,QAAQ;IACxE,0BAA0B,GAAuC,EAAE;IACnE,gBAAgB,GAAY,KAAK;;IAEjC,WAAW,GAAW,EAAE;;IAExB,gBAAgB,GAAY,KAAK;IAClC,QAAQ,GAAY,KAAK;AACxB,IAAA,eAAe;IAChB,cAAc,GAAuC,EAAE;IAEvD,MAAM,GAMH,IAAI;AAEP,IAAA,uBAAuB;AAEvB,IAAA,cAAc,CAAC,QAA4B,EAAA;AACjD,QAAA,IAAI,CAAC,QAAQ;AAAE,YAAA,OAAO,EAAE;AACxB,QAAA,IAAI,QAAQ,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AC,EACrE,CAAA,CACH,CACG;;IAIV,MAAM,GAAA;AACJ,QAAA,QACE,8DAEG,IAAI,CAAC,iBAAiB,EAAE,CACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement","sessionState"],"sources":["src/components/checkout/address/address.css?tag=rebill-address","src/components/checkout/address/address.tsx"],"sourcesContent":["@import '../../../styles/variables.css';\n\n:host {\n display: block;\n}\n\n.billing-header-row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 16px;\n}\n\n.address-container {\n display: flex;\n flex-direction: column;\n gap: 16px;\n width: 100%;\n}\n\n.state-zip-row {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 16px;\n}\n.search-link {\n background: none;\n border: none;\n text-decoration: underline;\n font-size: 14px;\n cursor: pointer;\n padding: 4px 0;\n text-decoration-color: var(--rebill-color-primary);\n}\n\n.state-zip-row rebill-input-select,\n.state-zip-row rebill-input-text {\n flex: 1;\n}\n\n.search-input-container {\n margin-top: 8px;\n}\n\n.manual-entry-link-wrapper {\n margin-top: 8px;\n text-align: left;\n}\n\n.same-as-shipping-section {\n margin: 24px 0;\n padding: 16px 0;\n}\n\n.shipping-address-section {\n margin-top: 24px;\n padding-top: 24px;\n}\n","import { Component, Element, Event, EventEmitter, h, Prop, State } from '@stencil/core';\nimport { api } from '../../../api';\nimport { I18nService } from '../../../i18n/i18n.service';\nimport { onChange, sessionState, SessionStore } from '../../../store/session.store';\nimport { AddressComponents } from '../../../utils';\n\n@Component({\n tag: 'rebill-address',\n styleUrl: 'address.css',\n shadow: false,\n})\nexport class Address {\n @Element() el: HTMLElement;\n /** @deprecated Vista unificada: siempre se muestra search + formulario. Se mantiene por compatibilidad. */\n @Prop({ mutable: true, reflect: true }) billingView: 'search' | 'form' = 'search';\n @State() currentBillingStateOptions: { label: string; value: string }[] = [];\n @State() isLoadingAddress: boolean = false;\n /** Dirección \"calle + número\" (valor que se persiste en store) */\n @State() addressLine: string = '';\n /** false = solo search; true = search + formulario (ciudad, estado, etc.) */\n @State() addressCommitted: boolean = false;\n @Prop() disabled: boolean = false;\n @Event() searchRequested: EventEmitter<void>;\n @Prop() countryOptions: { label: string; value: string }[] = [];\n\n @Prop() errors?: {\n 'billing-country': string;\n 'billing-state': string;\n 'billing-address': string;\n 'billing-city': string;\n 'billing-zip': string;\n } | null = null;\n\n private unsubscribeAddressStore?: () => void;\n\n private translateError(errorKey: string | undefined): string {\n if (!errorKey) return '';\n if (errorKey.includes('validation.') || errorKey.includes('paymentErrors.')) {\n return I18nService.translate(errorKey);\n }\n return errorKey;\n }\n\n @Event() addressUpdated: EventEmitter<{\n country: string;\n state: string;\n address: string;\n city: string;\n zip: string;\n addInformation: string;\n }>;\n\n async componentDidLoad() {\n this.syncAddressLineFromStore();\n // Si ya hay dirección en store (prefilled o vuelve al checkout), mostrar formulario completo\n const billing = sessionState.data?.userInformation?.address?.billingAddress;\n if (billing?.address || billing?.city) {\n this.addressCommitted = true;\n }\n this.unsubscribeAddressStore = onChange('data', () => {\n const billingAddress = sessionState.data.userInformation.address?.billingAddress;\n\n if (billingAddress) {\n this.addressLine = billingAddress.address ?? '';\n const addressData: AddressComponents = {\n country: billingAddress.country || '',\n state: billingAddress.state || '',\n address: billingAddress.address || '',\n city: billingAddress.city || '',\n zip: billingAddress.zip || '',\n addInformation: billingAddress.addInformation || '',\n };\n\n this.emitInputEventsForAddress(addressData);\n }\n });\n }\n\n private syncAddressLineFromStore() {\n const billingAddress = sessionState.data?.userInformation?.address?.billingAddress;\n this.addressLine = billingAddress?.address ?? '';\n }\n\n disconnectedCallback() {\n if (this.unsubscribeAddressStore) {\n this.unsubscribeAddressStore();\n }\n }\n\n private async handleAddressSelected(address: AddressComponents) {\n this.isLoadingAddress = true;\n\n // Normalize text function for handling accents and special characters\n const normalizeText = (text: string) => {\n return text\n .toLowerCase()\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '') // Remove accents\n .replace(/\\./g, '') // Remove dots\n .replace(/\\s+/g, ' ') // Normalize spaces\n .trim();\n };\n // Persistimos en store solo calle + número, y eso mismo se muestra en el search\n this.addressLine = address.address ?? '';\n this.addressCommitted = true;\n\n if (address.country) {\n await this.loadStatesForCountry(address.country);\n\n // Compare Google state with API states\n if (address.state && this.currentBillingStateOptions.length > 0) {\n const exactMatch = this.currentBillingStateOptions.find(\n option => option.value.toLowerCase() === address.state.toLowerCase(),\n );\n\n const partialMatch = this.currentBillingStateOptions.find(\n option =>\n option.value.toLowerCase().includes(address.state.toLowerCase()) ||\n address.state.toLowerCase().includes(option.value.toLowerCase()),\n );\n\n // Try to find matches with common variations\n const normalizedGoogleState = normalizeText(address.state)\n .replace('ciudad de ', '')\n .replace('estado de ', '')\n .replace('provincia de ', '');\n\n const normalizedMatch = this.currentBillingStateOptions.find(option => {\n const normalizedOption = normalizeText(option.value)\n .replace('ciudad de ', '')\n .replace('estado de ', '')\n .replace('provincia de ', '');\n\n // Chile: API puede devolver \"Santiago Region Metropolitana\" y Google \"Región Metropolitana\"\n const optionWithoutSantiagoPrefix = normalizedOption.replace(/^santiago\\s+/, '');\n\n const matches =\n normalizedOption === normalizedGoogleState ||\n normalizedOption.startsWith(normalizedGoogleState + ' ') ||\n normalizedGoogleState.startsWith(normalizedOption + ' ') ||\n optionWithoutSantiagoPrefix === normalizedGoogleState ||\n normalizedGoogleState.startsWith(optionWithoutSantiagoPrefix + ' ');\n return matches;\n });\n\n if (exactMatch) {\n address.state = exactMatch.value;\n } else if (normalizedMatch) {\n address.state = normalizedMatch.value;\n } else if (partialMatch) {\n address.state = partialMatch.value;\n } else {\n address.state = undefined;\n }\n }\n }\n SessionStore.setBillingAddress(address);\n\n this.addressUpdated.emit({\n country: address.country || '',\n address: address.address || '',\n city: address.city || '',\n state: address.state || undefined,\n zip: address.zip || '',\n addInformation: address.addInformation || '',\n });\n\n // Use requestAnimationFrame to ensure the form is rendered with the new state options\n // before emitting events. This ensures the state field can be properly populated.\n requestAnimationFrame(() => {\n this.emitInputEventsForAddress(address);\n setTimeout(() => {\n this.isLoadingAddress = false;\n }, 500);\n });\n }\n\n private emitInputEventsForAddress(address: AddressComponents) {\n // Emit input events for each address field that has a value\n // This mimics user input to properly clear validation errors\n const fields = [\n { id: `billing-country`, value: address.country },\n { id: `billing-address`, value: address.address },\n { id: `billing-city`, value: address.city },\n { id: `billing-state`, value: address.state },\n { id: `billing-zip`, value: address.zip },\n { id: `billing-addInformation`, value: address.addInformation },\n ];\n\n fields.forEach(field => {\n if (field.value) {\n this.emitInputEvent(field.id, field.value);\n }\n });\n }\n\n private emitInputEvent(id: string, value: string) {\n if (value) {\n // Create and dispatch a custom input event that the form component can listen to\n const inputEvent = new CustomEvent('input', {\n detail: { id, value },\n bubbles: true,\n composed: true,\n });\n this.el.dispatchEvent(inputEvent);\n }\n }\n private handleFreeTextAddress = (value: string) => {\n // No activar modo manual en blur - solo guardar el valor\n // El modo manual se activa con Enter (commitRequested) o click en \"Ingresar manualmente\"\n SessionStore.setBillingAddress({ address: value });\n this.addressLine = value;\n this.emitInputEvent('billing-address', value);\n this.addressUpdated.emit({\n country: sessionState.data?.userInformation?.address?.billingAddress?.country ?? '',\n address: value,\n city: sessionState.data?.userInformation?.address?.billingAddress?.city ?? '',\n state: sessionState.data?.userInformation?.address?.billingAddress?.state ?? '',\n zip: sessionState.data?.userInformation?.address?.billingAddress?.zip ?? '',\n addInformation:\n sessionState.data?.userInformation?.address?.billingAddress?.addInformation ?? '',\n });\n };\n\n private async loadStatesForCountry(countryCode: string) {\n try {\n const response = await api.data.getStates(countryCode);\n const statesResponse = response.data;\n const stateOptions =\n statesResponse && statesResponse.states\n ? statesResponse.states.map(state => ({ label: state, value: state }))\n : [];\n\n this.currentBillingStateOptions = stateOptions;\n } catch (error) {\n this.currentBillingStateOptions = [];\n }\n }\n\n private handleManualEntry = () => {\n this.addressCommitted = true;\n };\n\n private async handleInput(field: string, value: string) {\n if (value === undefined) return;\n SessionStore.setBillingAddress({ [field]: value } as any);\n // Emit input event to form to sync with form data\n this.emitInputEvent(`billing-${field}`, value);\n\n // If country changes, load states for the new country\n if (field === 'country') {\n await this.loadStatesForCountry(value);\n // Clear the current state selection since the country changed\n SessionStore.setBillingAddress({ state: '' } as any);\n }\n }\n\n private renderAddressHeader() {\n return (\n <div class=\"billing-header-row\">\n <rebill-typography variant=\"body2\">\n {I18nService.translate('billingAddress.title')}\n </rebill-typography>\n </div>\n );\n }\n\n private renderAddressForm() {\n // Solo mostrar en el search el error del campo dirección; ciudad/estado/zip tienen su error en su propio campo\n const addressSearchError = this.translateError(this.errors?.['billing-address']) || '';\n const errorsToShow = this.isLoadingAddress ? null : this.errors;\n\n return (\n <div>\n {this.renderAddressHeader()}\n <rebill-address-search\n value={this.addressLine}\n onAddressSelected={e => this.handleAddressSelected(e.detail)}\n onFreeTextAddress={e => this.handleFreeTextAddress(e.detail)}\n onCommitRequested={() => (this.addressCommitted = true)}\n onManualEntryRequested={() => this.handleManualEntry()}\n error={addressSearchError}\n disabled={this.disabled}\n showManualEntryLink={!this.addressCommitted}\n />\n {this.addressCommitted && (\n <rebill-address-form\n countryOptions={this.countryOptions}\n stateOptions={this.currentBillingStateOptions}\n errors={errorsToShow}\n disabled={this.disabled}\n onFieldChanged={e => this.handleInput(e.detail.field, e.detail.value)}\n />\n )}\n </div>\n );\n }\n\n render() {\n return (\n <div>\n {/* Billing Address */}\n {this.renderAddressForm()}\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"p-C8zfxcyS.js","mappings":";;;;;;;;;;;AAAA,MAAM,UAAU,GAAG,4hFAA4hF;;MCWliF,OAAO,iBAAAA,kBAAA,CAAA,MAAA,OAAA,SAAAC,CAAA,CAAA;;;;;;;;;;;IAGsB,WAAW,GAAsB,QAAQ;IACxE,0BAA0B,GAAuC,EAAE;IACnE,gBAAgB,GAAY,KAAK;;IAEjC,WAAW,GAAW,EAAE;;IAExB,gBAAgB,GAA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AAI,CAAC,cAAc,EACnC,YAAY,EAAE,IAAI,CAAC,0BAA0B,EAC7C,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,cAAc,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACrE,CAAA,CACH,CACG;;IAIV,MAAM,GAAA;AACJ,QAAA,QACE,8DAEG,IAAI,CAAC,iBAAiB,EAAE,CACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["__stencil_proxyCustomElement","HTMLElement","sessionState"],"sources":["src/components/checkout/address/address.css?tag=rebill-address","src/components/checkout/address/address.tsx"],"sourcesContent":["@import '../../../styles/variables.css';\n\n:host {\n display: block;\n}\n\n.billing-header-row {\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 16px;\n}\n\n.address-container {\n display: flex;\n flex-direction: column;\n gap: 16px;\n width: 100%;\n}\n\n.state-zip-row {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 16px;\n}\n.search-link {\n background: none;\n border: none;\n text-decoration: underline;\n font-size: 14px;\n cursor: pointer;\n padding: 4px 0;\n text-decoration-color: var(--rebill-color-primary);\n}\n\n.state-zip-row rebill-input-select,\n.state-zip-row rebill-input-text {\n flex: 1;\n}\n\n.search-input-container {\n margin-top: 8px;\n}\n\n.manual-entry-link-wrapper {\n margin-top: 8px;\n text-align: left;\n}\n\n.same-as-shipping-section {\n margin: 24px 0;\n padding: 16px 0;\n}\n\n.shipping-address-section {\n margin-top: 24px;\n padding-top: 24px;\n}\n","import { Component, Element, Event, EventEmitter, h, Prop, State } from '@stencil/core';\nimport { api } from '../../../api';\nimport { I18nService } from '../../../i18n/i18n.service';\nimport { onChange, sessionState, SessionStore } from '../../../store/session.store';\nimport { AddressComponents } from '../../../utils';\n\n@Component({\n tag: 'rebill-address',\n styleUrl: 'address.css',\n shadow: false,\n})\nexport class Address {\n @Element() el: HTMLElement;\n /** @deprecated Vista unificada: siempre se muestra search + formulario. Se mantiene por compatibilidad. */\n @Prop({ mutable: true, reflect: true }) billingView: 'search' | 'form' = 'search';\n @State() currentBillingStateOptions: { label: string; value: string }[] = [];\n @State() isLoadingAddress: boolean = false;\n /** Dirección \"calle + número\" (valor que se persiste en store) */\n @State() addressLine: string = '';\n /** false = solo search; true = search + formulario (ciudad, estado, etc.) */\n @State() addressCommitted: boolean = false;\n @Prop() disabled: boolean = false;\n @Event() searchRequested: EventEmitter<void>;\n @Prop() countryOptions: { label: string; value: string }[] = [];\n\n @Prop() errors?: {\n 'billing-country': string;\n 'billing-state': string;\n 'billing-address': string;\n 'billing-city': string;\n 'billing-zip': string;\n } | null = null;\n\n private unsubscribeAddressStore?: () => void;\n\n private translateError(errorKey: string | undefined): string {\n if (!errorKey) return '';\n if (errorKey.includes('validation.') || errorKey.includes('paymentErrors.')) {\n return I18nService.translate(errorKey);\n }\n return errorKey;\n }\n\n @Event() addressUpdated: EventEmitter<{\n country: string;\n state: string;\n address: string;\n city: string;\n zip: string;\n addInformation: string;\n }>;\n\n async componentDidLoad() {\n this.syncAddressLineFromStore();\n // Si ya hay dirección en store (prefilled o vuelve al checkout), mostrar formulario completo\n const billing = sessionState.data?.userInformation?.address?.billingAddress;\n if (billing?.address || billing?.city) {\n this.addressCommitted = true;\n }\n this.unsubscribeAddressStore = onChange('data', () => {\n const billingAddress = sessionState.data.userInformation.address?.billingAddress;\n\n if (billingAddress) {\n this.addressLine = billingAddress.address ?? '';\n const addressData: AddressComponents = {\n country: billingAddress.country || '',\n state: billingAddress.state || '',\n address: billingAddress.address || '',\n city: billingAddress.city || '',\n zip: billingAddress.zip || '',\n addInformation: billingAddress.addInformation || '',\n };\n\n this.emitInputEventsForAddress(addressData);\n }\n });\n }\n\n private syncAddressLineFromStore() {\n const billingAddress = sessionState.data?.userInformation?.address?.billingAddress;\n this.addressLine = billingAddress?.address ?? '';\n }\n\n disconnectedCallback() {\n if (this.unsubscribeAddressStore) {\n this.unsubscribeAddressStore();\n }\n }\n\n private async handleAddressSelected(address: AddressComponents) {\n this.isLoadingAddress = true;\n\n // Normalize text function for handling accents and special characters\n const normalizeText = (text: string) => {\n return text\n .toLowerCase()\n .normalize('NFD')\n .replace(/[\\u0300-\\u036f]/g, '') // Remove accents\n .replace(/\\./g, '') // Remove dots\n .replace(/\\s+/g, ' ') // Normalize spaces\n .trim();\n };\n // Persistimos en store solo calle + número, y eso mismo se muestra en el search\n this.addressLine = address.address ?? '';\n this.addressCommitted = true;\n\n if (address.country) {\n await this.loadStatesForCountry(address.country);\n\n // Compare Google state with API states\n if (address.state && this.currentBillingStateOptions.length > 0) {\n const exactMatch = this.currentBillingStateOptions.find(\n option => option.value.toLowerCase() === address.state.toLowerCase(),\n );\n\n const partialMatch = this.currentBillingStateOptions.find(\n option =>\n option.value.toLowerCase().includes(address.state.toLowerCase()) ||\n address.state.toLowerCase().includes(option.value.toLowerCase()),\n );\n\n // Try to find matches with common variations\n const normalizedGoogleState = normalizeText(address.state)\n .replace('ciudad de ', '')\n .replace('estado de ', '')\n .replace('provincia de ', '');\n\n const normalizedMatch = this.currentBillingStateOptions.find(option => {\n const normalizedOption = normalizeText(option.value)\n .replace('ciudad de ', '')\n .replace('estado de ', '')\n .replace('provincia de ', '');\n\n // Chile: API puede devolver \"Santiago Region Metropolitana\" y Google \"Región Metropolitana\"\n const optionWithoutSantiagoPrefix = normalizedOption.replace(/^santiago\\s+/, '');\n\n const matches =\n normalizedOption === normalizedGoogleState ||\n normalizedOption.startsWith(normalizedGoogleState + ' ') ||\n normalizedGoogleState.startsWith(normalizedOption + ' ') ||\n optionWithoutSantiagoPrefix === normalizedGoogleState ||\n normalizedGoogleState.startsWith(optionWithoutSantiagoPrefix + ' ');\n return matches;\n });\n\n if (exactMatch) {\n address.state = exactMatch.value;\n } else if (normalizedMatch) {\n address.state = normalizedMatch.value;\n } else if (partialMatch) {\n address.state = partialMatch.value;\n } else {\n address.state = undefined;\n }\n }\n }\n SessionStore.setBillingAddress(address);\n\n this.addressUpdated.emit({\n country: address.country || '',\n address: address.address || '',\n city: address.city || '',\n state: address.state || undefined,\n zip: address.zip || '',\n addInformation: address.addInformation || '',\n });\n\n // Use requestAnimationFrame to ensure the form is rendered with the new state options\n // before emitting events. This ensures the state field can be properly populated.\n requestAnimationFrame(() => {\n this.emitInputEventsForAddress(address);\n setTimeout(() => {\n this.isLoadingAddress = false;\n }, 500);\n });\n }\n\n private emitInputEventsForAddress(address: AddressComponents) {\n // Emit input events for each address field that has a value\n // This mimics user input to properly clear validation errors\n const fields = [\n { id: `billing-country`, value: address.country },\n { id: `billing-address`, value: address.address },\n { id: `billing-city`, value: address.city },\n { id: `billing-state`, value: address.state },\n { id: `billing-zip`, value: address.zip },\n { id: `billing-addInformation`, value: address.addInformation },\n ];\n\n fields.forEach(field => {\n if (field.value) {\n this.emitInputEvent(field.id, field.value);\n }\n });\n }\n\n private emitInputEvent(id: string, value: string) {\n if (value) {\n // Create and dispatch a custom input event that the form component can listen to\n const inputEvent = new CustomEvent('input', {\n detail: { id, value },\n bubbles: true,\n composed: true,\n });\n this.el.dispatchEvent(inputEvent);\n }\n }\n private handleFreeTextAddress = (value: string) => {\n // No activar modo manual en blur - solo guardar el valor\n // El modo manual se activa con Enter (commitRequested) o click en \"Ingresar manualmente\"\n SessionStore.setBillingAddress({ address: value });\n this.addressLine = value;\n this.emitInputEvent('billing-address', value);\n this.addressUpdated.emit({\n country: sessionState.data?.userInformation?.address?.billingAddress?.country ?? '',\n address: value,\n city: sessionState.data?.userInformation?.address?.billingAddress?.city ?? '',\n state: sessionState.data?.userInformation?.address?.billingAddress?.state ?? '',\n zip: sessionState.data?.userInformation?.address?.billingAddress?.zip ?? '',\n addInformation:\n sessionState.data?.userInformation?.address?.billingAddress?.addInformation ?? '',\n });\n };\n\n private async loadStatesForCountry(countryCode: string) {\n try {\n const response = await api.data.getStates(countryCode);\n const statesResponse = response.data;\n const stateOptions =\n statesResponse && statesResponse.states\n ? statesResponse.states.map(state => ({ label: state, value: state }))\n : [];\n\n this.currentBillingStateOptions = stateOptions;\n } catch (error) {\n this.currentBillingStateOptions = [];\n }\n }\n\n private handleManualEntry = () => {\n this.addressCommitted = true;\n };\n\n private async handleInput(field: string, value: string) {\n if (value === undefined) return;\n SessionStore.setBillingAddress({ [field]: value } as any);\n // Emit input event to form to sync with form data\n this.emitInputEvent(`billing-${field}`, value);\n\n // If country changes, load states for the new country\n if (field === 'country') {\n await this.loadStatesForCountry(value);\n // Clear the current state selection since the country changed\n SessionStore.setBillingAddress({ state: '' } as any);\n }\n }\n\n private renderAddressHeader() {\n return (\n <div class=\"billing-header-row\">\n <rebill-typography variant=\"body2\">\n {I18nService.translate('billingAddress.title')}\n </rebill-typography>\n </div>\n );\n }\n\n private renderAddressForm() {\n // Solo mostrar en el search el error del campo dirección; ciudad/estado/zip tienen su error en su propio campo\n const addressSearchError = this.translateError(this.errors?.['billing-address']) || '';\n const errorsToShow = this.isLoadingAddress ? null : this.errors;\n\n return (\n <div>\n {this.renderAddressHeader()}\n <rebill-address-search\n value={this.addressLine}\n onAddressSelected={e => this.handleAddressSelected(e.detail)}\n onFreeTextAddress={e => this.handleFreeTextAddress(e.detail)}\n onCommitRequested={() => (this.addressCommitted = true)}\n onManualEntryRequested={() => this.handleManualEntry()}\n error={addressSearchError}\n disabled={this.disabled}\n showManualEntryLink={!this.addressCommitted}\n />\n {this.addressCommitted && (\n <rebill-address-form\n countryOptions={this.countryOptions}\n stateOptions={this.currentBillingStateOptions}\n errors={errorsToShow}\n disabled={this.disabled}\n onFieldChanged={e => this.handleInput(e.detail.field, e.detail.value)}\n />\n )}\n </div>\n );\n }\n\n render() {\n return (\n <div>\n {/* Billing Address */}\n {this.renderAddressForm()}\n </div>\n );\n }\n}\n"],"version":3}
@@ -1,4 +1,4 @@
1
- import { A as AddressSearch, d as defineCustomElement$1 } from './p-BLo8Aps6.js';
1
+ import { A as AddressSearch, d as defineCustomElement$1 } from './p-8MtEW13e.js';
2
2
 
3
3
  const RebillAddressSearch = AddressSearch;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -1,4 +1,4 @@
1
- import { A as Address, d as defineCustomElement$1 } from './p-D2qupJgh.js';
1
+ import { A as Address, d as defineCustomElement$1 } from './p-C8zfxcyS.js';
2
2
 
3
3
  const RebillAddress = Address;
4
4
  const defineCustomElement = defineCustomElement$1;
@@ -8,7 +8,7 @@ import { P as PAYMENT_METHOD_ENUM, S as SessionStore, I as I18nService } from '.
8
8
  import { r as renewalState, R as RenewalStore, o as onChange } from './p-C4EyL9pU.js';
9
9
  import { B as BREAKPOINT_ENUM, g as getBreakpoint, i as isBreakpointBelow } from './p-Do_vNuMa.js';
10
10
  import { f as formatDateTime } from './p-Lq1iQbjq.js';
11
- import { G as GoogleMapsService, d as defineCustomElement$q } from './p-BLo8Aps6.js';
11
+ import { G as GoogleMapsService, d as defineCustomElement$q } from './p-8MtEW13e.js';
12
12
  import { s as shouldAskIdentification, i as isFieldRequired, b as buildIdentification } from './p-o2MEAJIp.js';
13
13
  import { d as defineCustomElement$6 } from './p-C4akJvrI.js';
14
14
  import { g as getAllRequiredFieldsRenewal, a as getRequiredFieldsForMethod } from './p-542cdzdq.js';
@@ -21,7 +21,7 @@ import { d as defineCustomElement$z } from './p-C819kccG.js';
21
21
  import { d as defineCustomElement$x } from './p-BGKegj9g.js';
22
22
  import { d as defineCustomElement$w } from './p-DeSbytQS.js';
23
23
  import { d as defineCustomElement$v } from './p-C_SGjDIF.js';
24
- import { d as defineCustomElement$s } from './p-D2qupJgh.js';
24
+ import { d as defineCustomElement$s } from './p-C8zfxcyS.js';
25
25
  import { d as defineCustomElement$r } from './p-iW7xLE4t.js';
26
26
  import { d as defineCustomElement$p } from './p-MO5_tN5S.js';
27
27
  import { d as defineCustomElement$o } from './p-C_5EcO0h.js';
@@ -11,7 +11,7 @@ import { d as defineCustomElement$2 } from './p-C7MrBj9n.js';
11
11
  import { d as defineCustomElement$H } from './p-C_SGjDIF.js';
12
12
  import { s as state, a as SESSION_TYPE_ENUM, I as I18nService, S as SessionStore, i as initializeI18nWithSessionLanguage, P as PAYMENT_METHOD_ENUM, o as onChange, b as SESSION_ITEM_TYPE_ENUM } from './p-DWn7p2EM.js';
13
13
  import { B as BREAKPOINT_ENUM, g as getBreakpoint, i as isBreakpointBelow } from './p-Do_vNuMa.js';
14
- import { G as GoogleMapsService, d as defineCustomElement$A } from './p-BLo8Aps6.js';
14
+ import { G as GoogleMapsService, d as defineCustomElement$A } from './p-8MtEW13e.js';
15
15
  import { m as mapRequiredFields, b as buildIdentification, s as shouldAskIdentification, i as isFieldRequired, g as getFieldValues } from './p-o2MEAJIp.js';
16
16
  import { P as PaymentMethodMapper } from './p-BB8-tqRT.js';
17
17
  import { d as defineCustomElement$g } from './p-CK7WWMQD.js';
@@ -27,7 +27,7 @@ import { d as defineCustomElement$I } from './p-DfgaqHel.js';
27
27
  import { d as defineCustomElement$G } from './p-BDJ6hGgd.js';
28
28
  import { d as defineCustomElement$E } from './p-CHZx_ErJ.js';
29
29
  import { d as defineCustomElement$D } from './p-DwOrAE9w.js';
30
- import { d as defineCustomElement$C } from './p-D2qupJgh.js';
30
+ import { d as defineCustomElement$C } from './p-C8zfxcyS.js';
31
31
  import { d as defineCustomElement$B } from './p-iW7xLE4t.js';
32
32
  import { d as defineCustomElement$z } from './p-MO5_tN5S.js';
33
33
  import { d as defineCustomElement$y } from './p-C_5EcO0h.js';
@@ -8,7 +8,7 @@ import { P as PAYMENT_METHOD_ENUM, I as I18nService } from './p-DWn7p2EM.js';
8
8
  import { r as renewalState, R as RenewalStore, o as onChange } from './p-C4EyL9pU.js';
9
9
  import { B as BREAKPOINT_ENUM, g as getBreakpoint, i as isBreakpointBelow } from './p-Do_vNuMa.js';
10
10
  import { C as COLORS_ENUM } from './p-C5Pu-n-i.js';
11
- import { G as GoogleMapsService, d as defineCustomElement$r } from './p-BLo8Aps6.js';
11
+ import { G as GoogleMapsService, d as defineCustomElement$r } from './p-8MtEW13e.js';
12
12
  import { s as shouldAskIdentification, i as isFieldRequired, b as buildIdentification, g as getFieldValues } from './p-o2MEAJIp.js';
13
13
  import { P as PaymentMethodMapper } from './p-BB8-tqRT.js';
14
14
  import { g as getAllRequiredFieldsRenewal, a as getRequiredFieldsForMethod } from './p-542cdzdq.js';
@@ -25,7 +25,7 @@ import { d as defineCustomElement$x } from './p-C_SGjDIF.js';
25
25
  import { d as defineCustomElement$w } from './p-GAYqdzRD.js';
26
26
  import { d as defineCustomElement$v } from './p-CHZx_ErJ.js';
27
27
  import { d as defineCustomElement$u } from './p-DwOrAE9w.js';
28
- import { d as defineCustomElement$t } from './p-D2qupJgh.js';
28
+ import { d as defineCustomElement$t } from './p-C8zfxcyS.js';
29
29
  import { d as defineCustomElement$s } from './p-iW7xLE4t.js';
30
30
  import { d as defineCustomElement$q } from './p-MO5_tN5S.js';
31
31
  import { d as defineCustomElement$p } from './p-C_5EcO0h.js';
@@ -5,7 +5,7 @@ import { a as api } from './index-Ck5Bx4fO.js';
5
5
  import { g as getAPIConfig } from './config-f7nCusI1.js';
6
6
  import { g as getAssetURL } from './assets-BKF_7Jfj.js';
7
7
  import { C as COLORS_ENUM } from './color-class-mapper-C5Pu-n-i.js';
8
- import { G as GoogleMapsService } from './google-maps.service-DM1Z3gTC.js';
8
+ import { G as GoogleMapsService } from './google-maps.service-C2nYpE_A.js';
9
9
  import { c as create$6, V as ValidationError } from './index.esm-CRUbzQx9.js';
10
10
  import { c as getInstallmentDisabledPlaceholderByCurrency, d as getInstallmentPlaceholderByCurrency, E as ENUM_INSTALLMENT_MODEL, e as getInstallmentLabel, b as getRecalculatedInstallmentAmount } from './installment-utils-wMHKZANV.js';
11
11
  import { a as getPaymentMethodDisplayName } from './get-payment-method-display-name-B5ehKHVz.js';
@@ -19,6 +19,21 @@ class GoogleMapsService {
19
19
  }
20
20
  return originalAttachShadow.call(this, init);
21
21
  };
22
+ // Interceptar showModal() para evitar que Google abra un dialog fullscreen
23
+ // en mobile que cubre toda la pantalla (se promueve al #top-layer del navegador).
24
+ // Usamos .show() en su lugar para que quede en el flujo normal del DOM
25
+ // y podamos estilizarlo con CSS.
26
+ const originalShowModal = HTMLDialogElement.prototype.showModal;
27
+ HTMLDialogElement.prototype.showModal = function () {
28
+ const isGoogleDialog = this.classList.contains('full-window-autocomplete-dialog') ||
29
+ this.closest('gmp-place-autocomplete') !== null;
30
+ if (isGoogleDialog) {
31
+ // Abrir como dialog no-modal → queda en flujo normal, no en #top-layer
32
+ this.show();
33
+ return;
34
+ }
35
+ return originalShowModal.call(this);
36
+ };
22
37
  window.gmpShadowPatched = true;
23
38
  }
24
39
  async waitForAPI() {
@@ -443,6 +458,31 @@ class GoogleMapsService {
443
458
  color: inherit !important;
444
459
  font-family: inherit !important;
445
460
  }
461
+
462
+ /* FIX mobile: Google abre un dialog fullscreen en viewports chicos.
463
+ Con el patch de showModal→show, el dialog ya no va al #top-layer.
464
+ Lo forzamos a ser inline dentro del contenedor. */
465
+ dialog,
466
+ .full-window-autocomplete-dialog,
467
+ [class*="full-window"] {
468
+ position: absolute !important;
469
+ top: 0 !important;
470
+ left: 0 !important;
471
+ width: 100% !important;
472
+ height: auto !important;
473
+ max-height: none !important;
474
+ margin: 0 !important;
475
+ padding: 0 !important;
476
+ border: none !important;
477
+ background: transparent !important;
478
+ overflow: visible !important;
479
+ z-index: 10 !important;
480
+ }
481
+
482
+ /* El backdrop del dialog (si existiera) */
483
+ dialog::backdrop {
484
+ display: none !important;
485
+ }
446
486
  `;
447
487
  shadow.appendChild(style);
448
488
  }
@@ -458,9 +498,15 @@ class GoogleMapsService {
458
498
  const country = getComponent('country', true);
459
499
  const zip = getComponent('postal_code');
460
500
  let addressLine = '';
501
+ // Países donde el número va ANTES de la calle (ej: "600 Fifth Avenue")
502
+ const numberFirstCountries = ['US', 'CA', 'GB', 'AU', 'NZ', 'IE'];
503
+ const isNumberFirst = numberFirstCountries.includes(country);
461
504
  // Prioridad 1: Usar street_number + route si ambos existen
462
505
  if (streetNumber && route) {
463
- addressLine = `${route} ${streetNumber}`.trim();
506
+ // Formato según el país
507
+ addressLine = isNumberFirst
508
+ ? `${streetNumber} ${route}`.trim() // USA: "600 Fifth Avenue"
509
+ : `${route} ${streetNumber}`.trim(); // LATAM: "Avenida Carlos Tejedor 600"
464
510
  }
465
511
  else if (route) {
466
512
  // Si solo hay route, usarlo
@@ -529,6 +575,6 @@ class GoogleMapsService {
529
575
  }
530
576
 
531
577
  export { GoogleMapsService as G };
532
- //# sourceMappingURL=google-maps.service-DM1Z3gTC.js.map
578
+ //# sourceMappingURL=google-maps.service-C2nYpE_A.js.map
533
579
 
534
- //# sourceMappingURL=google-maps.service-DM1Z3gTC.js.map
580
+ //# sourceMappingURL=google-maps.service-C2nYpE_A.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google-maps.service-C2nYpE_A.js","sources":["src/utils/google-maps.service.ts"],"sourcesContent":["export interface AddressComponents {\n address: string;\n city: string;\n state: string;\n country: string;\n zip: string;\n addInformation?: string;\n formattedAddress?: string; // Dirección completa de Google para usar como fallback\n}\n\nexport class GoogleMapsService {\n private static instance: GoogleMapsService;\n private isLoaded: boolean = false;\n private loadPromise: Promise<boolean> | null = null;\n\n static getInstance(): GoogleMapsService {\n if (!GoogleMapsService.instance) {\n GoogleMapsService.instance = new GoogleMapsService();\n GoogleMapsService.setupShadowDOMPatch();\n }\n return GoogleMapsService.instance;\n }\n\n private static setupShadowDOMPatch() {\n if ((window as any).gmpShadowPatched) return;\n\n const originalAttachShadow = Element.prototype.attachShadow;\n\n Element.prototype.attachShadow = function (init: ShadowRootInit) {\n if (this.localName === 'gmp-place-autocomplete') {\n return originalAttachShadow.call(this, { ...init, mode: 'open' });\n }\n return originalAttachShadow.call(this, init);\n };\n\n // Interceptar showModal() para evitar que Google abra un dialog fullscreen\n // en mobile que cubre toda la pantalla (se promueve al #top-layer del navegador).\n // Usamos .show() en su lugar para que quede en el flujo normal del DOM\n // y podamos estilizarlo con CSS.\n const originalShowModal = HTMLDialogElement.prototype.showModal;\n HTMLDialogElement.prototype.showModal = function () {\n const isGoogleDialog =\n this.classList.contains('full-window-autocomplete-dialog') ||\n this.closest('gmp-place-autocomplete') !== null;\n\n if (isGoogleDialog) {\n // Abrir como dialog no-modal → queda en flujo normal, no en #top-layer\n this.show();\n return;\n }\n return originalShowModal.call(this);\n };\n\n (window as any).gmpShadowPatched = true;\n }\n\n async waitForAPI(): Promise<boolean> {\n if (this.isLoaded && window.google) {\n return true;\n }\n\n if (this.loadPromise) {\n return this.loadPromise;\n }\n\n this.loadPromise = new Promise(resolve => {\n let attempts = 0;\n const maxAttempts = 100; // 10 seconds max wait\n\n const checkAPI = () => {\n attempts++;\n\n if (window.google) {\n this.isLoaded = true;\n resolve(true);\n } else if (attempts >= maxAttempts) {\n console.error('Google Maps API failed to load within timeout');\n resolve(false);\n } else {\n setTimeout(checkAPI, 100);\n }\n };\n checkAPI();\n });\n\n return this.loadPromise;\n }\n\n /**\n * Crea autocomplete usando la nueva API de Google Places (PlaceAutocompleteElement).\n * containerElement: donde se inserta (ej. search-input-container). Debe tener position: relative.\n * inputElement: input para sincronizar valor al seleccionar y para focus/blur.\n * Retorna el elemento y una función destroy para limpiar al desmontar.\n */\n async createAutocomplete(\n containerElement: HTMLElement,\n inputElement: HTMLInputElement,\n onPlaceSelected: (address: AddressComponents) => void,\n options?: {\n placeholder?: string;\n componentRestrictions?: { country: string | string[] };\n error?: string;\n disabled?: boolean;\n },\n ): Promise<{\n element: HTMLElement;\n destroy: () => void;\n syncToGoogle: (value?: string) => void;\n setError: (error?: string) => void;\n setDisabled: (disabled: boolean) => void;\n } | null> {\n const isReady = await this.waitForAPI();\n if (!isReady) {\n console.error('Google Maps API not available');\n return null;\n }\n\n try {\n // Nueva API: importLibrary carga Places (New)\n await google.maps.importLibrary('places');\n\n const elementOptions: google.maps.places.PlaceAutocompleteElementOptions = {\n types: ['address'],\n };\n\n if (options?.componentRestrictions?.country) {\n const countries = Array.isArray(options.componentRestrictions.country)\n ? options.componentRestrictions.country\n : [options.componentRestrictions.country];\n elementOptions.componentRestrictions = { country: countries };\n }\n\n const placeAutocomplete = new google.maps.places.PlaceAutocompleteElement(elementOptions);\n\n if (options?.placeholder) {\n placeAutocomplete.setAttribute('placeholder', options.placeholder);\n }\n\n // Agregar clase error si existe\n if (options?.error) {\n placeAutocomplete.classList.add('error');\n }\n\n // Deshabilitar si corresponde\n if (options?.disabled) {\n placeAutocomplete.setAttribute('disabled', 'true');\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput) googleInput.disabled = true;\n }\n\n // Insertar en el container; el CSS del padre lo posiciona como overlay\n containerElement.appendChild(placeAutocomplete);\n await new Promise(resolve => setTimeout(resolve, 300));\n\n // Inyectar estilos Rebill en el shadow DOM (modo open vía setupShadowDOMPatch)\n this.injectRebillStyles(placeAutocomplete);\n\n // Ocultar elementos de branding de Google que se renderizan fuera del Shadow DOM\n this.hideGoogleBranding();\n\n // Sincronizar valor del input → Google (SOLO una dirección)\n let isSyncing = false;\n const syncToGoogle = (value?: string) => {\n if (isSyncing) return;\n isSyncing = true;\n\n const val = value ?? inputElement.value;\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput) {\n googleInput.value = val;\n // Disparar eventos para que Google detecte el cambio\n googleInput.dispatchEvent(new Event('input', { bubbles: true }));\n googleInput.dispatchEvent(new Event('change', { bubbles: true }));\n }\n\n setTimeout(() => {\n isSyncing = false;\n }, 50);\n };\n\n const inputHandler = () => {\n if (!isSyncing) {\n syncToGoogle();\n }\n };\n inputElement.addEventListener('input', inputHandler);\n\n // Sincronizar valor inicial\n setTimeout(() => syncToGoogle(), 100);\n\n // Evento correcto: gmp-select (no gmp-placeselect)\n const selectHandler = async (ev: Event) => {\n const evt = ev as CustomEvent & {\n placePrediction?: { toPlace: () => Promise<google.maps.places.Place> };\n };\n const placePrediction = evt.placePrediction ?? (evt.detail as any)?.placePrediction;\n if (!placePrediction) return;\n const place = await placePrediction.toPlace();\n await place.fetchFields({\n fields: ['addressComponents', 'formattedAddress'],\n });\n\n if (place.addressComponents) {\n const address = this.parseAddressComponentsNew(\n place.addressComponents as any[],\n place.formattedAddress ?? undefined,\n );\n\n address.formattedAddress = place.formattedAddress ?? undefined;\n\n // Forzar actualización del input de Google con solo calle + número\n // Esto sobrescribe el texto completo que Google pone automáticamente\n setTimeout(() => {\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput && address.address) {\n googleInput.value = address.address;\n }\n }, 10);\n\n onPlaceSelected(address);\n }\n };\n\n placeAutocomplete.addEventListener('gmp-select', selectHandler);\n\n const setError = (error?: string) => {\n if (error) {\n placeAutocomplete.classList.add('error');\n } else {\n placeAutocomplete.classList.remove('error');\n }\n };\n\n const setDisabled = (disabled: boolean) => {\n if (disabled) {\n placeAutocomplete.setAttribute('disabled', 'true');\n } else {\n placeAutocomplete.removeAttribute('disabled');\n }\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput) {\n googleInput.disabled = disabled;\n }\n };\n\n const destroy = () => {\n inputElement.removeEventListener('input', inputHandler);\n placeAutocomplete.removeEventListener('gmp-select', selectHandler);\n placeAutocomplete.remove();\n containerElement.classList.remove('autocomplete-active');\n };\n\n return { element: placeAutocomplete, destroy, syncToGoogle, setError, setDisabled };\n } catch (error) {\n console.error('Failed to create Google Maps PlaceAutocompleteElement:', error);\n return null;\n }\n }\n\n private hideGoogleBranding() {\n // Inyectar CSS global para ocultar branding de Google\n const globalStyleId = 'rebill-hide-google-branding';\n if (document.getElementById(globalStyleId)) return;\n\n const style = document.createElement('style');\n style.id = globalStyleId;\n style.textContent = `\n /* Ocultar TODOS los elementos de branding de Google Maps */\n gmp-internal-attribution,\n gmp-internal-dialog,\n gmp-place-autocomplete::part(attribution),\n gmp-place-autocomplete + *,\n gmp-place-autocomplete ~ *,\n a[href*=\"maps.google.com\"],\n a[title*=\"Google Maps\"],\n [aria-label*=\"Google Maps\"],\n div:has(> a[href*=\"google.com\"]),\n .dismissButton {\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n height: 0 !important;\n max-height: 0 !important;\n overflow: hidden !important;\n position: absolute !important;\n left: -9999px !important;\n }\n `;\n document.head.appendChild(style);\n\n // Remover elementos de branding continuamente (Google los puede agregar dinámicamente)\n const removeGoogleBranding = () => {\n // Remover Web Components de Google\n document.querySelectorAll('gmp-internal-attribution, gmp-internal-dialog').forEach(el => {\n el.remove();\n });\n\n // Remover links y elementos con \"Google Maps\"\n document\n .querySelectorAll('a[href*=\"maps.google.com\"], a[title*=\"Google Maps\"]')\n .forEach(el => {\n const parent = el.closest('div');\n if (parent && parent.textContent?.includes('Google Maps')) {\n parent.style.display = 'none';\n }\n el.remove();\n });\n\n // Remover cualquier SVG con aria-label=\"Google Maps\"\n document.querySelectorAll('svg[aria-label*=\"Google Maps\"]').forEach(el => {\n el.remove();\n });\n };\n\n // Ejecutar inmediatamente y periódicamente\n removeGoogleBranding();\n setInterval(removeGoogleBranding, 500);\n\n // Observer para elementos que se agregan dinámicamente\n const observer = new MutationObserver(() => {\n removeGoogleBranding();\n });\n observer.observe(document.body, { childList: true, subtree: true });\n }\n\n private injectRebillStyles(placeAutocomplete: HTMLElement) {\n const shadow = placeAutocomplete.shadowRoot;\n if (!shadow) {\n console.warn('Shadow DOM not available - styles cannot be injected');\n return;\n }\n\n const style = document.createElement('style');\n style.textContent = `\n /* Resetear TODO */\n * {\n box-sizing: border-box !important;\n }\n\n :host {\n display: block !important;\n width: 100% !important;\n height: 38.33px !important;\n max-height: 38.33px !important;\n font-family: inherit !important;\n border: none !important;\n outline: none !important;\n box-shadow: none !important;\n background: transparent !important;\n overflow: visible !important;\n }\n\n /* Contenedores - resetear */\n div, span, ul, li {\n all: revert !important;\n }\n\n /* INPUT PRINCIPAL - Copiar estilos exactos de rebill-input-text */\n input {\n display: block !important;\n width: 100% !important;\n height: 38.33px !important;\n min-height: 38.33px !important;\n box-sizing: border-box !important;\n border-radius: 8px !important;\n border: 1.5px solid #E5E7EB !important;\n padding: 10px 14px !important;\n padding-right: 40px !important;\n font-size: 14px !important;\n line-height: 20px !important;\n font-weight: 400 !important;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;\n color: #111827 !important;\n background-color: #FFFFFF !important;\n outline: none !important;\n transition: all 0.2s ease !important;\n -webkit-appearance: none !important;\n appearance: none !important;\n }\n\n input::placeholder {\n color: #9CA3AF !important;\n opacity: 1 !important;\n }\n\n input:focus {\n border-color: var(--rebill-color-primary) !important;\n box-shadow: none !important;\n }\n\n input:disabled {\n background-color: var(--rebill-color-background) !important;\n border-color: var(--rebill-color-disabled) !important;\n color: var(--rebill-color-text-secondary) !important;\n cursor: not-allowed !important;\n opacity: 0.7 !important;\n }\n\n input:disabled:focus {\n border-color: var(--rebill-color-disabled) !important;\n box-shadow: none !important;\n }\n\n /* Estado de error - border rojo igual que inputs de Rebill */\n :host(.error) input,\n :host([error]) input {\n border-color: var(--rebill-color-error, #EF4444) !important;\n }\n\n :host(.error) input:focus,\n :host([error]) input:focus {\n border-color: var(--rebill-color-error, #EF4444) !important;\n box-shadow: 0 0 0 2px var(--rebill-color-error-light, rgba(239, 68, 68, 0.1)) !important;\n }\n\n /* Ocultar elementos decorativos de Google */\n [class*=\"icon\"],\n [class*=\"suffix\"],\n [class*=\"prefix\"],\n [class*=\"logo\"],\n [class*=\"powered\"],\n [class*=\"google\"],\n [class*=\"branding\"],\n [class*=\"divider\"],\n [class*=\"separator\"],\n [aria-label*=\"Google\"],\n [aria-label*=\"clear\"],\n [aria-label*=\"Clear\"],\n button,\n svg,\n a[href*=\"google.com\"] {\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n height: 0 !important;\n width: 0 !important;\n overflow: hidden !important;\n }\n\n /* Ocultar elementos hermanos del input EXCEPTO error-message */\n input + *:not(.error-message),\n input ~ *:not(.error-message) {\n display: none !important;\n }\n\n /* Dropdown - Estilo Rebill */\n [role=\"listbox\"] {\n position: absolute !important;\n z-index: 9999 !important;\n margin-top: 4px !important;\n width: 100% !important;\n max-height: 300px !important;\n overflow-y: auto !important;\n background: #FFFFFF !important;\n border: 1px solid #E5E7EB !important;\n border-radius: 8px !important;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;\n padding: 0 !important;\n }\n\n ul {\n list-style: none !important;\n padding: 0 !important;\n margin: 0 !important;\n }\n\n /* Ocultar contenedor de atribuciones */\n .attributions,\n [role=\"presentation\"],\n div:has(> gmp-internal-attribution) {\n display: none !important;\n height: 0 !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n }\n\n /* Ocultar UL vacío cuando no hay sugerencias */\n ul:empty {\n display: none !important;\n }\n\n [role=\"option\"] {\n padding: 0.75rem !important;\n cursor: pointer !important;\n color: var(--rebill-color-text-primary) !important;\n font-size: 0.875rem !important;\n font-weight: 400 !important;\n border-bottom: 1px solid var(--rebill-color-border) !important;\n list-style: none !important;\n list-style-type: none !important;\n transition: background-color 0.15s ease !important;\n background-color: transparent !important;\n }\n\n [role=\"option\"]::before,\n [role=\"option\"]::marker {\n display: none !important;\n content: none !important;\n }\n\n [role=\"option\"]:last-child {\n border-bottom: none !important;\n }\n\n [role=\"option\"]:hover,\n [role=\"option\"][aria-selected=\"true\"] {\n background-color: #f0f9ff !important;\n }\n\n /* Texto dentro - mismo color que la opción */\n [role=\"option\"] * {\n color: var(--rebill-color-text-primary) !important;\n font-family: inherit !important;\n font-weight: inherit !important;\n }\n\n /* Ocultar botón de cerrar (X) */\n button[aria-label*=\"dismiss\"],\n button[aria-label*=\"close\"],\n .dismiss,\n .close-button {\n display: none !important;\n }\n\n /* Texto dentro de las sugerencias */\n [role=\"option\"] * {\n color: inherit !important;\n font-family: inherit !important;\n }\n\n /* FIX mobile: Google abre un dialog fullscreen en viewports chicos.\n Con el patch de showModal→show, el dialog ya no va al #top-layer.\n Lo forzamos a ser inline dentro del contenedor. */\n dialog,\n .full-window-autocomplete-dialog,\n [class*=\"full-window\"] {\n position: absolute !important;\n top: 0 !important;\n left: 0 !important;\n width: 100% !important;\n height: auto !important;\n max-height: none !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n background: transparent !important;\n overflow: visible !important;\n z-index: 10 !important;\n }\n\n /* El backdrop del dialog (si existiera) */\n dialog::backdrop {\n display: none !important;\n }\n `;\n shadow.appendChild(style);\n }\n\n private parseAddressComponentsNew(\n components: any[],\n formattedAddress?: string,\n ): AddressComponents {\n const getComponent = (type: string, useShortName = false) => {\n const component = components.find((c: any) => c.types.includes(type));\n return component ? (useShortName ? component.shortText : component.longText) : '';\n };\n\n const streetNumber = getComponent('street_number');\n const route = getComponent('route');\n const city = getComponent('locality');\n const state = getComponent('administrative_area_level_1');\n const country = getComponent('country', true);\n const zip = getComponent('postal_code');\n\n let addressLine = '';\n\n // Países donde el número va ANTES de la calle (ej: \"600 Fifth Avenue\")\n const numberFirstCountries = ['US', 'CA', 'GB', 'AU', 'NZ', 'IE'];\n const isNumberFirst = numberFirstCountries.includes(country);\n\n // Prioridad 1: Usar street_number + route si ambos existen\n if (streetNumber && route) {\n // Formato según el país\n addressLine = isNumberFirst\n ? `${streetNumber} ${route}`.trim() // USA: \"600 Fifth Avenue\"\n : `${route} ${streetNumber}`.trim(); // LATAM: \"Avenida Carlos Tejedor 600\"\n } else if (route) {\n // Si solo hay route, usarlo\n addressLine = route;\n } else if (streetNumber) {\n // Si solo hay número, usarlo\n addressLine = streetNumber;\n }\n\n // Si ya tenemos una dirección de los componentes, usarla\n if (addressLine.length > 0) {\n return {\n address: addressLine,\n city,\n state,\n country,\n zip,\n };\n }\n\n // Prioridad 2: Extraer de formattedAddress\n if (formattedAddress) {\n // Separar por coma y tomar solo la primera parte (calle + número)\n const parts = formattedAddress.split(',').map(p => p.trim());\n const firstPart = parts[0] ?? '';\n\n // Verificar si la primera parte no contiene el nombre de la ciudad\n // Esto previene que se incluya ciudad en la dirección\n const containsCity = city && firstPart.toLowerCase().includes(city.toLowerCase());\n const containsState = state && firstPart.toLowerCase().includes(state.toLowerCase());\n\n if (firstPart.length > 0 && !containsCity && !containsState && /[0-9A-Za-z]/.test(firstPart)) {\n addressLine = firstPart;\n }\n }\n\n return {\n address: addressLine,\n city,\n state,\n country,\n zip,\n };\n }\n\n static loadGoogleMapsScript(googleMapsApiKey?: string) {\n // Use new API key\n const apiKey = googleMapsApiKey || 'AIzaSyB9pS5LHbPKjnmMQ89BQHD0SVZXVsi95pk';\n\n if (!apiKey) {\n console.warn('Google Maps API key not provided. Address autocomplete will not be available.');\n return;\n }\n\n // Check if script is already loaded\n if (document.querySelector('script[src*=\"maps.googleapis.com\"]')) {\n return;\n }\n\n const script = document.createElement('script');\n // Nueva API: loading=async, Places se carga vía importLibrary en createAutocomplete\n script.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&loading=async&callback=initGoogleMaps`;\n script.async = true;\n script.defer = true;\n\n // Add global callback for when Google Maps is ready\n (window as any).initGoogleMaps = () => {\n delete (window as any).initGoogleMaps; // Clean up\n };\n\n script.onerror = () => {\n console.error(\n 'Failed to load Google Maps script. Please check your API key and network connection.',\n );\n };\n\n document.head.appendChild(script);\n }\n}\n"],"names":[],"mappings":"MAUa,iBAAiB,CAAA;IACpB,OAAO,QAAQ;IACf,QAAQ,GAAY,KAAK;IACzB,WAAW,GAA4B,IAAI;AAEnD,IAAA,OAAO,WAAW,GAAA;AAChB,QAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE;AAC/B,YAAA,iBAAiB,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE;YACpD,iBAAiB,CAAC,mBAAmB,EAAE;;QAEzC,OAAO,iBAAiB,CAAC,QAAQ;;AAG3B,IAAA,OAAO,mBAAmB,GAAA;QAChC,IAAK,MAAc,CAAC,gBAAg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