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
@@ -7,7 +7,7 @@ var i18n_service = require('./i18n.service-CcOnATVl.js');
7
7
  var renewal_store = require('./renewal.store-C-xUKkSJ.js');
8
8
  var breakpoint = require('./breakpoint-CWd4pcNv.js');
9
9
  var dateFormatter = require('./date-formatter-C0jF31xQ.js');
10
- var googleMaps_service = require('./google-maps.service-C61Pm1no.js');
10
+ var googleMaps_service = require('./google-maps.service-CZcMzFBX.js');
11
11
  var requiredFieldsMappers = require('./required-fields-mappers-BJ5SWcXv.js');
12
12
  var getRequiredFieldsRenewal = require('./getRequiredFieldsRenewal-DF09Fy7a.js');
13
13
  require('./_commonjsHelpers-B83fTs8d.js');
@@ -7,7 +7,7 @@ var paymentErrorMapper = require('./payment-error-mapper-C_VcX_4u.js');
7
7
  var i18n_service = require('./i18n.service-CcOnATVl.js');
8
8
  var statusReqCheckoutApm_enum = require('./status-req-checkout-apm.enum-BcCXZY86.js');
9
9
  var breakpoint = require('./breakpoint-CWd4pcNv.js');
10
- var googleMaps_service = require('./google-maps.service-C61Pm1no.js');
10
+ var googleMaps_service = require('./google-maps.service-CZcMzFBX.js');
11
11
  var requiredFieldsMappers = require('./required-fields-mappers-BJ5SWcXv.js');
12
12
  var paymentMethodMapper = require('./payment-method-mapper-B4R05M9E.js');
13
13
  require('./_commonjsHelpers-B83fTs8d.js');
@@ -9,7 +9,7 @@ var statusReqCheckoutApm_enum = require('./status-req-checkout-apm.enum-BcCXZY86
9
9
  var renewal_store = require('./renewal.store-C-xUKkSJ.js');
10
10
  var breakpoint = require('./breakpoint-CWd4pcNv.js');
11
11
  var colorClassMapper = require('./color-class-mapper-Cviu2q1o.js');
12
- var googleMaps_service = require('./google-maps.service-C61Pm1no.js');
12
+ var googleMaps_service = require('./google-maps.service-CZcMzFBX.js');
13
13
  var requiredFieldsMappers = require('./required-fields-mappers-BJ5SWcXv.js');
14
14
  var paymentMethodMapper = require('./payment-method-mapper-B4R05M9E.js');
15
15
  var getRequiredFieldsRenewal = require('./getRequiredFieldsRenewal-DF09Fy7a.js');
@@ -19,6 +19,21 @@ export 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 @@ export 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 @@ export 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
@@ -1 +1 @@
1
- {"version":3,"file":"google-maps.service.js","sourceRoot":"","sources":["../../src/utils/google-maps.service.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAC,QAAQ,CAAoB;IACnC,QAAQ,GAAY,KAAK,CAAC;IAC1B,WAAW,GAA4B,IAAI,CAAC;IAEpD,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAChC,iBAAiB,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC;YACrD,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;QAC1C,CAAC;QACD,OAAO,iBAAiB,CAAC,QAAQ,CAAC;IACpC,CAAC;IAEO,MAAM,CAAC,mBAAmB;QAChC,IAAK,MAAc,CAAC,gBAAgB;YAAE,OAAO;QAE7C,MAAM,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC;QAE5D,OAAO,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,IAAoB;YAC7D,IAAI,IAAI,CAAC,SAAS,KAAK,wBAAwB,EAAE,CAAC;gBAChD,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC,CAAC;QAED,MAAc,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,UAAU;QACd,IAAI,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,OAAO,IAAI,CAAC,W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AC;gBAC7F,WAAW,GAAG,SAAS,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE,WAAW;YACpB,IAAI;YACJ,KAAK;YACL,OAAO;YACP,GAAG;SACJ,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,oBAAoB,CAAC,gBAAyB;QACnD,kBAAkB;QAClB,MAAM,MAAM,GAAG,gBAAgB,IAAI,yCAAyC,CAAC;QAE7E,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;YAC9F,OAAO;QACT,CAAC;QAED,oCAAoC;QACpC,IAAI,QAAQ,CAAC,aAAa,CAAC,oCAAoC,CAAC,EAAE,CAAC;YACjE,OAAO;QACT,CAAC;QAED,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,oFAAoF;QACpF,MAAM,CAAC,GAAG,GAAG,+CAA+C,MAAM,wCAAwC,CAAC;QAC3G,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;QAEpB,oDAAoD;QACnD,MAAc,CAAC,cAAc,GAAG,GAAG,EAAE;YACpC,OAAQ,MAAc,CAAC,cAAc,CAAC,CAAC,WAAW;QACpD,CAAC,CAAC;QAEF,MAAM,CAAC,OAAO,GAAG,GAAG,EAAE;YACpB,OAAO,CAAC,KAAK,CACX,sFAAsF,CACvF,CAAC;QACJ,CAAC,CAAC;QAEF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF","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 (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 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 // Prioridad 1: Usar street_number + route si ambos existen\n if (streetNumber && route) {\n addressLine = `${route} ${streetNumber}`.trim();\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"]}
1
+ {"version":3,"file":"google-maps.service.js","sourceRoot":"","sources":["../../src/utils/google-maps.service.ts"],"names":[],"mappings":"AAUA,MAAM,OAAO,iBAAiB;IACpB,MAAM,CAAC,QAAQ,CAAoB;IACnC,QAAQ,GAAY,KAAK,CAAC;IAC1B,WAAW,GAA4B,IAAI,CAAC;IAEpD,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC;YAChC,iBAAiB,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE,CAAC;YACrD,iBAAiB,CAAC,mBAAmB,EAAE,CAAC;QAC1C,CAAC;QACD,OAAO,iBAAiB,CAAC,QAAQ,CAAC;IACpC,CAAC;IAEO,MAAM,CAAC,mBAAmB;QAChC,IAAK,MAAc,CAAC,gBAAgB;YAAE,OAAO;QAE7C,MAAM,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC;QAE5D,OAAO,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,IAAoB;YAC7D,IAAI,IAAI,CAAC,SAAS,KAAK,wBAAwB,EAAE,CAAC;gBAChD,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/C,CAAC,CAAC;QAEF,2EAA2E;QAC3E,kFAAkF;QAClF,uEAA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M,CAAC,oBAAoB,CAAC,gBAAyB;QACnD,kBAAkB;QAClB,MAAM,MAAM,GAAG,gBAAgB,IAAI,yCAAyC,CAAC;QAE7E,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;YAC9F,OAAO;QACT,CAAC;QAED,oCAAoC;QACpC,IAAI,QAAQ,CAAC,aAAa,CAAC,oCAAoC,CAAC,EAAE,CAAC;YACjE,OAAO;QACT,CAAC;QAED,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAChD,oFAAoF;QACpF,MAAM,CAAC,GAAG,GAAG,+CAA+C,MAAM,wCAAwC,CAAC;QAC3G,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;QAEpB,oDAAoD;QACnD,MAAc,CAAC,cAAc,GAAG,GAAG,EAAE;YACpC,OAAQ,MAAc,CAAC,cAAc,CAAC,CAAC,WAAW;QACpD,CAAC,CAAC;QAEF,MAAM,CAAC,OAAO,GAAG,GAAG,EAAE;YACpB,OAAO,CAAC,KAAK,CACX,sFAAsF,CACvF,CAAC;QACJ,CAAC,CAAC;QAEF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC;CACF","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"]}