rebill-web-components-sdk 1.13.21 → 1.13.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/card-fields-wrapper_11.cjs.entry.js +1 -1
- package/dist/cjs/{google-maps.service-CZcMzFBX.js → google-maps.service-DgIZjibV.js} +54 -14
- package/dist/cjs/google-maps.service-DgIZjibV.js.map +1 -0
- package/dist/cjs/index-C-VTnc0I.js.map +1 -1
- package/dist/cjs/rebill-change-card.cjs.entry.js +1 -1
- package/dist/cjs/rebill-checkout.cjs.entry.js +1 -1
- package/dist/cjs/rebill-renewal.cjs.entry.js +1 -1
- package/dist/collection/utils/google-maps.service.js +52 -12
- package/dist/collection/utils/google-maps.service.js.map +1 -1
- package/dist/components/p-8BpuJ_V5.js.map +1 -1
- package/dist/components/{p-8MtEW13e.js → p-Bt9U0G__.js} +54 -14
- package/dist/components/p-Bt9U0G__.js.map +1 -0
- package/dist/components/{p-C8zfxcyS.js → p-C2IqZfrd.js} +3 -3
- package/dist/components/{p-C8zfxcyS.js.map → p-C2IqZfrd.js.map} +1 -1
- package/dist/components/rebill-address-search.js +1 -1
- package/dist/components/rebill-address.js +1 -1
- package/dist/components/rebill-change-card.js +2 -2
- package/dist/components/rebill-checkout.js +2 -2
- package/dist/components/rebill-renewal.js +2 -2
- package/dist/esm/card-fields-wrapper_11.entry.js +1 -1
- package/dist/esm/{google-maps.service-C2nYpE_A.js → google-maps.service-Lr2NbC5i.js} +54 -14
- package/dist/esm/google-maps.service-Lr2NbC5i.js.map +1 -0
- package/dist/esm/index-D8cwEAmw.js.map +1 -1
- package/dist/esm/rebill-change-card.entry.js +1 -1
- package/dist/esm/rebill-checkout.entry.js +1 -1
- package/dist/esm/rebill-renewal.entry.js +1 -1
- package/dist/rebill-web-components-sdk/{p-bf15156a.entry.js → p-1c1cb576.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/{p-c327a984.entry.js → p-247a086e.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/{p-b9a3b27f.entry.js → p-43dc2877.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/p-D8cwEAmw.js.map +1 -1
- package/dist/rebill-web-components-sdk/p-Lr2NbC5i.js +2 -0
- package/dist/rebill-web-components-sdk/p-Lr2NbC5i.js.map +1 -0
- package/dist/rebill-web-components-sdk/{p-f3859b65.entry.js → p-b72a46fd.entry.js} +2 -2
- package/dist/rebill-web-components-sdk/rebill-web-components-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/google-maps.service-CZcMzFBX.js.map +0 -1
- package/dist/components/p-8MtEW13e.js.map +0 -1
- package/dist/esm/google-maps.service-C2nYpE_A.js.map +0 -1
- package/dist/rebill-web-components-sdk/p-C2nYpE_A.js +0 -2
- package/dist/rebill-web-components-sdk/p-C2nYpE_A.js.map +0 -1
- /package/dist/rebill-web-components-sdk/{p-bf15156a.entry.js.map → p-1c1cb576.entry.js.map} +0 -0
- /package/dist/rebill-web-components-sdk/{p-c327a984.entry.js.map → p-247a086e.entry.js.map} +0 -0
- /package/dist/rebill-web-components-sdk/{p-b9a3b27f.entry.js.map → p-43dc2877.entry.js.map} +0 -0
- /package/dist/rebill-web-components-sdk/{p-f3859b65.entry.js.map → p-b72a46fd.entry.js.map} +0 -0
|
@@ -27,17 +27,27 @@ class GoogleMapsService {
|
|
|
27
27
|
}
|
|
28
28
|
return originalAttachShadow.call(this, init);
|
|
29
29
|
};
|
|
30
|
-
// Interceptar showModal() para evitar
|
|
31
|
-
//
|
|
32
|
-
// Usamos .show() en su lugar para que quede en el flujo normal del DOM
|
|
33
|
-
// y podamos estilizarlo con CSS.
|
|
30
|
+
// Interceptar showModal() para evitar el dialog fullscreen de Google en mobile.
|
|
31
|
+
// Bloqueamos la apertura completamente. El input inline + listbox funcionan sin él.
|
|
34
32
|
const originalShowModal = HTMLDialogElement.prototype.showModal;
|
|
35
33
|
HTMLDialogElement.prototype.showModal = function () {
|
|
36
34
|
const isGoogleDialog = this.classList.contains('full-window-autocomplete-dialog') ||
|
|
37
35
|
this.closest('gmp-place-autocomplete') !== null;
|
|
38
36
|
if (isGoogleDialog) {
|
|
39
|
-
//
|
|
37
|
+
// Guardar foco y scroll ANTES de abrir
|
|
38
|
+
const prev = document.activeElement;
|
|
39
|
+
const scrollX = window.scrollX;
|
|
40
|
+
const scrollY = window.scrollY;
|
|
40
41
|
this.show();
|
|
42
|
+
// Quitar foco del input del dialog sin causar scroll
|
|
43
|
+
const input = this.querySelector('input');
|
|
44
|
+
if (input)
|
|
45
|
+
input.blur();
|
|
46
|
+
if (prev && prev !== document.body) {
|
|
47
|
+
prev.focus({ preventScroll: true });
|
|
48
|
+
}
|
|
49
|
+
// Restaurar scroll
|
|
50
|
+
window.scrollTo(scrollX, scrollY);
|
|
41
51
|
return;
|
|
42
52
|
}
|
|
43
53
|
return originalShowModal.call(this);
|
|
@@ -114,6 +124,37 @@ class GoogleMapsService {
|
|
|
114
124
|
// Insertar en el container; el CSS del padre lo posiciona como overlay
|
|
115
125
|
containerElement.appendChild(placeAutocomplete);
|
|
116
126
|
await new Promise(resolve => setTimeout(resolve, 300));
|
|
127
|
+
// Asegurar que el input inline del shadow DOM esté habilitado en mobile
|
|
128
|
+
// y bloquear el .focus() automático que Google hace sobre él
|
|
129
|
+
const patchGoogleInput = () => {
|
|
130
|
+
const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');
|
|
131
|
+
if (!googleInput || googleInput.__rebillPatched)
|
|
132
|
+
return;
|
|
133
|
+
googleInput.disabled = false;
|
|
134
|
+
googleInput.style.display = 'block';
|
|
135
|
+
googleInput.style.pointerEvents = 'auto';
|
|
136
|
+
googleInput.style.visibility = 'visible';
|
|
137
|
+
googleInput.style.opacity = '1';
|
|
138
|
+
// Reemplazar .focus() en este input específico:
|
|
139
|
+
// Solo permitir focus si el usuario hizo click/tap en el container del address
|
|
140
|
+
const originalInputFocus = googleInput.focus.bind(googleInput);
|
|
141
|
+
let userClickedAddress = false;
|
|
142
|
+
containerElement.addEventListener('pointerdown', () => {
|
|
143
|
+
userClickedAddress = true;
|
|
144
|
+
setTimeout(() => { userClickedAddress = false; }, 300);
|
|
145
|
+
});
|
|
146
|
+
googleInput.focus = (opts) => {
|
|
147
|
+
if (userClickedAddress) {
|
|
148
|
+
originalInputFocus(opts);
|
|
149
|
+
}
|
|
150
|
+
// Si no fue click del usuario, ignorar (evita robo de foco)
|
|
151
|
+
};
|
|
152
|
+
googleInput.__rebillPatched = true;
|
|
153
|
+
};
|
|
154
|
+
patchGoogleInput();
|
|
155
|
+
setTimeout(patchGoogleInput, 500);
|
|
156
|
+
setTimeout(patchGoogleInput, 1000);
|
|
157
|
+
setTimeout(patchGoogleInput, 2000);
|
|
117
158
|
// Inyectar estilos Rebill en el shadow DOM (modo open vía setupShadowDOMPatch)
|
|
118
159
|
this.injectRebillStyles(placeAutocomplete);
|
|
119
160
|
// Ocultar elementos de branding de Google que se renderizan fuera del Shadow DOM
|
|
@@ -304,7 +345,8 @@ class GoogleMapsService {
|
|
|
304
345
|
border: 1.5px solid #E5E7EB !important;
|
|
305
346
|
padding: 10px 14px !important;
|
|
306
347
|
padding-right: 40px !important;
|
|
307
|
-
font-size
|
|
348
|
+
/* 16px evita auto-zoom en mobile (iOS/Android hacen zoom si font-size < 16px) */
|
|
349
|
+
font-size: 16px !important;
|
|
308
350
|
line-height: 20px !important;
|
|
309
351
|
font-weight: 400 !important;
|
|
310
352
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
|
|
@@ -467,9 +509,8 @@ class GoogleMapsService {
|
|
|
467
509
|
font-family: inherit !important;
|
|
468
510
|
}
|
|
469
511
|
|
|
470
|
-
/* FIX mobile:
|
|
471
|
-
|
|
472
|
-
Lo forzamos a ser inline dentro del contenedor. */
|
|
512
|
+
/* FIX mobile: El dialog se abre con .show() (no showModal) para evitar
|
|
513
|
+
el #top-layer. Lo contenemos inline dentro del componente. */
|
|
473
514
|
dialog,
|
|
474
515
|
.full-window-autocomplete-dialog,
|
|
475
516
|
[class*="full-window"] {
|
|
@@ -477,8 +518,8 @@ class GoogleMapsService {
|
|
|
477
518
|
top: 0 !important;
|
|
478
519
|
left: 0 !important;
|
|
479
520
|
width: 100% !important;
|
|
480
|
-
height:
|
|
481
|
-
max-height:
|
|
521
|
+
height: 38.33px !important;
|
|
522
|
+
max-height: 38.33px !important;
|
|
482
523
|
margin: 0 !important;
|
|
483
524
|
padding: 0 !important;
|
|
484
525
|
border: none !important;
|
|
@@ -487,7 +528,6 @@ class GoogleMapsService {
|
|
|
487
528
|
z-index: 10 !important;
|
|
488
529
|
}
|
|
489
530
|
|
|
490
|
-
/* El backdrop del dialog (si existiera) */
|
|
491
531
|
dialog::backdrop {
|
|
492
532
|
display: none !important;
|
|
493
533
|
}
|
|
@@ -848,6 +888,6 @@ function defineCustomElement() {
|
|
|
848
888
|
defineCustomElement();
|
|
849
889
|
|
|
850
890
|
export { AddressSearch as A, GoogleMapsService as G, defineCustomElement as d };
|
|
851
|
-
//# sourceMappingURL=p-
|
|
891
|
+
//# sourceMappingURL=p-Bt9U0G__.js.map
|
|
852
892
|
|
|
853
|
-
//# sourceMappingURL=p-
|
|
893
|
+
//# sourceMappingURL=p-Bt9U0G__.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"p-Bt9U0G__.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;AA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CAAC,IAAI,IAAI,CAAC,kBAAkB,CAAC,CAAgB,CAAC,EACvD,MAAM,EAAE,CAAC,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAgB,CAAC,GAC1D,CACE,EACL,IAAI,CAAC,KAAK,KACT,CAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAK,KAAK,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,EAAA,EACnC,CAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EACE,KAAK,EAAC,eAAe,EACrB,KAAK,EAAE;AACL,gBAAA,KAAK,EAAE,2BAA2B;AAClC,gBAAA,QAAQ,EAAE,SAAS;AACnB,gBAAA,OAAO,EAAE,OAAO;AAChB,gBAAA,UAAU,EAAE,MAAM;aACnB,EAAA,EAEA,IAAI,CAAC,KAAK,CACN,CACH,CACP,EACA,IAAI,CAAC,mBAAmB,KACvB,CAAK,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,KAAK,EAAC,2BAA2B,EAAA,EACpC,CAAA,CAAA,QAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAQ,KAAK,EAAC,mBAAmB,EAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAA,EAC7E,CAAA,CAAA,mBAAA,EAAA,EAAA,GAAA,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 el dialog fullscreen de Google en mobile.\n // Bloqueamos la apertura completamente. El input inline + listbox funcionan sin él.\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 // Guardar foco y scroll ANTES de abrir\n const prev = document.activeElement as HTMLElement | null;\n const scrollX = window.scrollX;\n const scrollY = window.scrollY;\n\n this.show();\n\n // Quitar foco del input del dialog sin causar scroll\n const input = this.querySelector('input');\n if (input) input.blur();\n if (prev && prev !== document.body) {\n prev.focus({ preventScroll: true });\n }\n\n // Restaurar scroll\n window.scrollTo(scrollX, scrollY);\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 // Asegurar que el input inline del shadow DOM esté habilitado en mobile\n // y bloquear el .focus() automático que Google hace sobre él\n const patchGoogleInput = () => {\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (!googleInput || (googleInput as any).__rebillPatched) return;\n\n googleInput.disabled = false;\n googleInput.style.display = 'block';\n googleInput.style.pointerEvents = 'auto';\n googleInput.style.visibility = 'visible';\n googleInput.style.opacity = '1';\n\n // Reemplazar .focus() en este input específico:\n // Solo permitir focus si el usuario hizo click/tap en el container del address\n const originalInputFocus = googleInput.focus.bind(googleInput);\n let userClickedAddress = false;\n\n containerElement.addEventListener('pointerdown', () => {\n userClickedAddress = true;\n setTimeout(() => { userClickedAddress = false; }, 300);\n });\n\n googleInput.focus = (opts?: FocusOptions) => {\n if (userClickedAddress) {\n originalInputFocus(opts);\n }\n // Si no fue click del usuario, ignorar (evita robo de foco)\n };\n\n (googleInput as any).__rebillPatched = true;\n };\n\n patchGoogleInput();\n setTimeout(patchGoogleInput, 500);\n setTimeout(patchGoogleInput, 1000);\n setTimeout(patchGoogleInput, 2000);\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 /* 16px evita auto-zoom en mobile (iOS/Android hacen zoom si font-size < 16px) */\n font-size: 16px !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: El dialog se abre con .show() (no showModal) para evitar\n el #top-layer. Lo contenemos inline dentro del componente. */\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: 38.33px !important;\n max-height: 38.33px !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 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-
|
|
5
|
+
import { d as defineCustomElement$6 } from './p-Bt9U0G__.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-
|
|
297
|
+
//# sourceMappingURL=p-C2IqZfrd.js.map
|
|
298
298
|
|
|
299
|
-
//# sourceMappingURL=p-
|
|
299
|
+
//# sourceMappingURL=p-C2IqZfrd.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-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AC,gBAAgB,GAAG,IAAI,CAAC,EACvD,sBAAsB,EAAE,MAAM,IAAI,CAAC,iBAAiB,EAAE,EACtD,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,mBAAmB,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAC3C,CAAA,EACD,IAAI,CAAC,gBAAgB,KACpB,CAAA,CAAA,qBAAA,EAAA,EACE,cAAc,EAAE,IAAI,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
|
+
{"file":"p-C2IqZfrd.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,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;AAC3E,YAAA,OAAO,WAAW,CAAC,SAAS,CAAC,QAAQ,CAAC;;AAExC,QAAA,OAAO,QAAQ;;AAGR,IAAA,cAAc;AASvB,IAAA,MAAM,gBAAgB,GAAA;QACpB,IAAI,CAAC,wBAAwB,EAAE;;QAE/B,MAAM,OAAO,GAAGC,KAAY,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc;QAC3E,IAAI,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,IAAI,EAAE;AACrC,YAAA,IAAI,CAAC,gBAAgB,GAAG,IAAI;;QAE9B,IAAI,CAAC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AAA,EAAA,EACE,KAAK,EAAE,IAAI,CAAC,WAAW,EACvB,iBAAiB,EAAE,CAAC,IAAI,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,MAAM,CAAC,EAC5D,iBAAiB,EAAE,CAAC,IAAI,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,MAAM,CAAC,EAC5D,iBAAiB,EAAE,OAAO,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,EACvD,sBAAsB,EAAE,MAAM,IAAI,CAAC,iBAAiB,EAAE,EACtD,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,mBAAmB,EAAE,CAAC,IAAI,CAAC,gBAAgB,EAC3C,CAAA,EACD,IAAI,CAAC,gBAAgB,KACpB,CAAA,CAAA,qBAAA,EAAA,EACE,cAAc,EAAE,IAAI,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}
|
|
@@ -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-
|
|
11
|
+
import { G as GoogleMapsService, d as defineCustomElement$q } from './p-Bt9U0G__.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-
|
|
24
|
+
import { d as defineCustomElement$s } from './p-C2IqZfrd.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-
|
|
14
|
+
import { G as GoogleMapsService, d as defineCustomElement$A } from './p-Bt9U0G__.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-
|
|
30
|
+
import { d as defineCustomElement$C } from './p-C2IqZfrd.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-
|
|
11
|
+
import { G as GoogleMapsService, d as defineCustomElement$r } from './p-Bt9U0G__.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-
|
|
28
|
+
import { d as defineCustomElement$t } from './p-C2IqZfrd.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-
|
|
8
|
+
import { G as GoogleMapsService } from './google-maps.service-Lr2NbC5i.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,17 +19,27 @@ class GoogleMapsService {
|
|
|
19
19
|
}
|
|
20
20
|
return originalAttachShadow.call(this, init);
|
|
21
21
|
};
|
|
22
|
-
// Interceptar showModal() para evitar
|
|
23
|
-
//
|
|
24
|
-
// Usamos .show() en su lugar para que quede en el flujo normal del DOM
|
|
25
|
-
// y podamos estilizarlo con CSS.
|
|
22
|
+
// Interceptar showModal() para evitar el dialog fullscreen de Google en mobile.
|
|
23
|
+
// Bloqueamos la apertura completamente. El input inline + listbox funcionan sin él.
|
|
26
24
|
const originalShowModal = HTMLDialogElement.prototype.showModal;
|
|
27
25
|
HTMLDialogElement.prototype.showModal = function () {
|
|
28
26
|
const isGoogleDialog = this.classList.contains('full-window-autocomplete-dialog') ||
|
|
29
27
|
this.closest('gmp-place-autocomplete') !== null;
|
|
30
28
|
if (isGoogleDialog) {
|
|
31
|
-
//
|
|
29
|
+
// Guardar foco y scroll ANTES de abrir
|
|
30
|
+
const prev = document.activeElement;
|
|
31
|
+
const scrollX = window.scrollX;
|
|
32
|
+
const scrollY = window.scrollY;
|
|
32
33
|
this.show();
|
|
34
|
+
// Quitar foco del input del dialog sin causar scroll
|
|
35
|
+
const input = this.querySelector('input');
|
|
36
|
+
if (input)
|
|
37
|
+
input.blur();
|
|
38
|
+
if (prev && prev !== document.body) {
|
|
39
|
+
prev.focus({ preventScroll: true });
|
|
40
|
+
}
|
|
41
|
+
// Restaurar scroll
|
|
42
|
+
window.scrollTo(scrollX, scrollY);
|
|
33
43
|
return;
|
|
34
44
|
}
|
|
35
45
|
return originalShowModal.call(this);
|
|
@@ -106,6 +116,37 @@ class GoogleMapsService {
|
|
|
106
116
|
// Insertar en el container; el CSS del padre lo posiciona como overlay
|
|
107
117
|
containerElement.appendChild(placeAutocomplete);
|
|
108
118
|
await new Promise(resolve => setTimeout(resolve, 300));
|
|
119
|
+
// Asegurar que el input inline del shadow DOM esté habilitado en mobile
|
|
120
|
+
// y bloquear el .focus() automático que Google hace sobre él
|
|
121
|
+
const patchGoogleInput = () => {
|
|
122
|
+
const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');
|
|
123
|
+
if (!googleInput || googleInput.__rebillPatched)
|
|
124
|
+
return;
|
|
125
|
+
googleInput.disabled = false;
|
|
126
|
+
googleInput.style.display = 'block';
|
|
127
|
+
googleInput.style.pointerEvents = 'auto';
|
|
128
|
+
googleInput.style.visibility = 'visible';
|
|
129
|
+
googleInput.style.opacity = '1';
|
|
130
|
+
// Reemplazar .focus() en este input específico:
|
|
131
|
+
// Solo permitir focus si el usuario hizo click/tap en el container del address
|
|
132
|
+
const originalInputFocus = googleInput.focus.bind(googleInput);
|
|
133
|
+
let userClickedAddress = false;
|
|
134
|
+
containerElement.addEventListener('pointerdown', () => {
|
|
135
|
+
userClickedAddress = true;
|
|
136
|
+
setTimeout(() => { userClickedAddress = false; }, 300);
|
|
137
|
+
});
|
|
138
|
+
googleInput.focus = (opts) => {
|
|
139
|
+
if (userClickedAddress) {
|
|
140
|
+
originalInputFocus(opts);
|
|
141
|
+
}
|
|
142
|
+
// Si no fue click del usuario, ignorar (evita robo de foco)
|
|
143
|
+
};
|
|
144
|
+
googleInput.__rebillPatched = true;
|
|
145
|
+
};
|
|
146
|
+
patchGoogleInput();
|
|
147
|
+
setTimeout(patchGoogleInput, 500);
|
|
148
|
+
setTimeout(patchGoogleInput, 1000);
|
|
149
|
+
setTimeout(patchGoogleInput, 2000);
|
|
109
150
|
// Inyectar estilos Rebill en el shadow DOM (modo open vía setupShadowDOMPatch)
|
|
110
151
|
this.injectRebillStyles(placeAutocomplete);
|
|
111
152
|
// Ocultar elementos de branding de Google que se renderizan fuera del Shadow DOM
|
|
@@ -296,7 +337,8 @@ class GoogleMapsService {
|
|
|
296
337
|
border: 1.5px solid #E5E7EB !important;
|
|
297
338
|
padding: 10px 14px !important;
|
|
298
339
|
padding-right: 40px !important;
|
|
299
|
-
font-size
|
|
340
|
+
/* 16px evita auto-zoom en mobile (iOS/Android hacen zoom si font-size < 16px) */
|
|
341
|
+
font-size: 16px !important;
|
|
300
342
|
line-height: 20px !important;
|
|
301
343
|
font-weight: 400 !important;
|
|
302
344
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
|
|
@@ -459,9 +501,8 @@ class GoogleMapsService {
|
|
|
459
501
|
font-family: inherit !important;
|
|
460
502
|
}
|
|
461
503
|
|
|
462
|
-
/* FIX mobile:
|
|
463
|
-
|
|
464
|
-
Lo forzamos a ser inline dentro del contenedor. */
|
|
504
|
+
/* FIX mobile: El dialog se abre con .show() (no showModal) para evitar
|
|
505
|
+
el #top-layer. Lo contenemos inline dentro del componente. */
|
|
465
506
|
dialog,
|
|
466
507
|
.full-window-autocomplete-dialog,
|
|
467
508
|
[class*="full-window"] {
|
|
@@ -469,8 +510,8 @@ class GoogleMapsService {
|
|
|
469
510
|
top: 0 !important;
|
|
470
511
|
left: 0 !important;
|
|
471
512
|
width: 100% !important;
|
|
472
|
-
height:
|
|
473
|
-
max-height:
|
|
513
|
+
height: 38.33px !important;
|
|
514
|
+
max-height: 38.33px !important;
|
|
474
515
|
margin: 0 !important;
|
|
475
516
|
padding: 0 !important;
|
|
476
517
|
border: none !important;
|
|
@@ -479,7 +520,6 @@ class GoogleMapsService {
|
|
|
479
520
|
z-index: 10 !important;
|
|
480
521
|
}
|
|
481
522
|
|
|
482
|
-
/* El backdrop del dialog (si existiera) */
|
|
483
523
|
dialog::backdrop {
|
|
484
524
|
display: none !important;
|
|
485
525
|
}
|
|
@@ -575,6 +615,6 @@ class GoogleMapsService {
|
|
|
575
615
|
}
|
|
576
616
|
|
|
577
617
|
export { GoogleMapsService as G };
|
|
578
|
-
//# sourceMappingURL=google-maps.service-
|
|
618
|
+
//# sourceMappingURL=google-maps.service-Lr2NbC5i.js.map
|
|
579
619
|
|
|
580
|
-
//# sourceMappingURL=google-maps.service-
|
|
620
|
+
//# sourceMappingURL=google-maps.service-Lr2NbC5i.js.map
|