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.
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-CZcMzFBX.js → google-maps.service-DgIZjibV.js} +54 -14
  3. package/dist/cjs/google-maps.service-DgIZjibV.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 +52 -12
  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-8MtEW13e.js → p-Bt9U0G__.js} +54 -14
  12. package/dist/components/p-Bt9U0G__.js.map +1 -0
  13. package/dist/components/{p-C8zfxcyS.js → p-C2IqZfrd.js} +3 -3
  14. package/dist/components/{p-C8zfxcyS.js.map → p-C2IqZfrd.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-C2nYpE_A.js → google-maps.service-Lr2NbC5i.js} +54 -14
  22. package/dist/esm/google-maps.service-Lr2NbC5i.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-bf15156a.entry.js → p-1c1cb576.entry.js} +2 -2
  28. package/dist/rebill-web-components-sdk/{p-c327a984.entry.js → p-247a086e.entry.js} +2 -2
  29. package/dist/rebill-web-components-sdk/{p-b9a3b27f.entry.js → p-43dc2877.entry.js} +2 -2
  30. package/dist/rebill-web-components-sdk/p-D8cwEAmw.js.map +1 -1
  31. package/dist/rebill-web-components-sdk/p-Lr2NbC5i.js +2 -0
  32. package/dist/rebill-web-components-sdk/p-Lr2NbC5i.js.map +1 -0
  33. package/dist/rebill-web-components-sdk/{p-f3859b65.entry.js → p-b72a46fd.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-CZcMzFBX.js.map +0 -1
  37. package/dist/components/p-8MtEW13e.js.map +0 -1
  38. package/dist/esm/google-maps.service-C2nYpE_A.js.map +0 -1
  39. package/dist/rebill-web-components-sdk/p-C2nYpE_A.js +0 -2
  40. package/dist/rebill-web-components-sdk/p-C2nYpE_A.js.map +0 -1
  41. /package/dist/rebill-web-components-sdk/{p-bf15156a.entry.js.map → p-1c1cb576.entry.js.map} +0 -0
  42. /package/dist/rebill-web-components-sdk/{p-c327a984.entry.js.map → p-247a086e.entry.js.map} +0 -0
  43. /package/dist/rebill-web-components-sdk/{p-b9a3b27f.entry.js.map → p-43dc2877.entry.js.map} +0 -0
  44. /package/dist/rebill-web-components-sdk/{p-f3859b65.entry.js.map → p-b72a46fd.entry.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ class n{static instance;isLoaded=false;loadPromise=null;static getInstance(){if(!n.instance){n.instance=new n;n.setupShadowDOMPatch()}return n.instance}static setupShadowDOMPatch(){if(window.gmpShadowPatched)return;const n=Element.prototype.attachShadow;Element.prototype.attachShadow=function(t){if(this.localName==="gmp-place-autocomplete"){return n.call(this,{...t,mode:"open"})}return n.call(this,t)};const t=HTMLDialogElement.prototype.showModal;HTMLDialogElement.prototype.showModal=function(){const n=this.classList.contains("full-window-autocomplete-dialog")||this.closest("gmp-place-autocomplete")!==null;if(n){const n=document.activeElement;const t=window.scrollX;const o=window.scrollY;this.show();const e=this.querySelector("input");if(e)e.blur();if(n&&n!==document.body){n.focus({preventScroll:true})}window.scrollTo(t,o);return}return t.call(this)};window.gmpShadowPatched=true}async waitForAPI(){if(this.isLoaded&&window.google){return true}if(this.loadPromise){return this.loadPromise}this.loadPromise=new Promise((n=>{let t=0;const o=100;const e=()=>{t++;if(window.google){this.isLoaded=true;n(true)}else if(t>=o){console.error("Google Maps API failed to load within timeout");n(false)}else{setTimeout(e,100)}};e()}));return this.loadPromise}async createAutocomplete(n,t,o,e){const i=await this.waitForAPI();if(!i){console.error("Google Maps API not available");return null}try{await google.maps.importLibrary("places");const i={types:["address"]};if(e?.componentRestrictions?.country){const n=Array.isArray(e.componentRestrictions.country)?e.componentRestrictions.country:[e.componentRestrictions.country];i.componentRestrictions={country:n}}const r=new google.maps.places.PlaceAutocompleteElement(i);if(e?.placeholder){r.setAttribute("placeholder",e.placeholder)}if(e?.error){r.classList.add("error")}if(e?.disabled){r.setAttribute("disabled","true");const n=r.shadowRoot?.querySelector("input");if(n)n.disabled=true}n.appendChild(r);await new Promise((n=>setTimeout(n,300)));const a=()=>{const t=r.shadowRoot?.querySelector("input");if(!t||t.__rebillPatched)return;t.disabled=false;t.style.display="block";t.style.pointerEvents="auto";t.style.visibility="visible";t.style.opacity="1";const o=t.focus.bind(t);let e=false;n.addEventListener("pointerdown",(()=>{e=true;setTimeout((()=>{e=false}),300)}));t.focus=n=>{if(e){o(n)}};t.__rebillPatched=true};a();setTimeout(a,500);setTimeout(a,1e3);setTimeout(a,2e3);this.injectRebillStyles(r);this.hideGoogleBranding();let s=false;const l=n=>{if(s)return;s=true;const o=n??t.value;const e=r.shadowRoot?.querySelector("input");if(e){e.value=o;e.dispatchEvent(new Event("input",{bubbles:true}));e.dispatchEvent(new Event("change",{bubbles:true}))}setTimeout((()=>{s=false}),50)};const p=()=>{if(!s){l()}};t.addEventListener("input",p);setTimeout((()=>l()),100);const c=async n=>{const t=n;const e=t.placePrediction??t.detail?.placePrediction;if(!e)return;const i=await e.toPlace();await i.fetchFields({fields:["addressComponents","formattedAddress"]});if(i.addressComponents){const n=this.parseAddressComponentsNew(i.addressComponents,i.formattedAddress??undefined);n.formattedAddress=i.formattedAddress??undefined;setTimeout((()=>{const t=r.shadowRoot?.querySelector("input");if(t&&n.address){t.value=n.address}}),10);o(n)}};r.addEventListener("gmp-select",c);const m=n=>{if(n){r.classList.add("error")}else{r.classList.remove("error")}};const d=n=>{if(n){r.setAttribute("disabled","true")}else{r.removeAttribute("disabled")}const t=r.shadowRoot?.querySelector("input");if(t){t.disabled=n}};const u=()=>{t.removeEventListener("input",p);r.removeEventListener("gmp-select",c);r.remove();n.classList.remove("autocomplete-active")};return{element:r,destroy:u,syncToGoogle:l,setError:m,setDisabled:d}}catch(n){console.error("Failed to create Google Maps PlaceAutocompleteElement:",n);return null}}hideGoogleBranding(){const n="rebill-hide-google-branding";if(document.getElementById(n))return;const t=document.createElement("style");t.id=n;t.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 `;document.head.appendChild(t);const o=()=>{document.querySelectorAll("gmp-internal-attribution, gmp-internal-dialog").forEach((n=>{n.remove()}));document.querySelectorAll('a[href*="maps.google.com"], a[title*="Google Maps"]').forEach((n=>{const t=n.closest("div");if(t&&t.textContent?.includes("Google Maps")){t.style.display="none"}n.remove()}));document.querySelectorAll('svg[aria-label*="Google Maps"]').forEach((n=>{n.remove()}))};o();setInterval(o,500);const e=new MutationObserver((()=>{o()}));e.observe(document.body,{childList:true,subtree:true})}injectRebillStyles(n){const t=n.shadowRoot;if(!t){console.warn("Shadow DOM not available - styles cannot be injected");return}const o=document.createElement("style");o.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 `;t.appendChild(o)}parseAddressComponentsNew(n,t){const o=(t,o=false)=>{const e=n.find((n=>n.types.includes(t)));return e?o?e.shortText:e.longText:""};const e=o("street_number");const i=o("route");const r=o("locality");const a=o("administrative_area_level_1");const s=o("country",true);const l=o("postal_code");let p="";const c=["US","CA","GB","AU","NZ","IE"];const m=c.includes(s);if(e&&i){p=m?`${e} ${i}`.trim():`${i} ${e}`.trim()}else if(i){p=i}else if(e){p=e}if(p.length>0){return{address:p,city:r,state:a,country:s,zip:l}}if(t){const n=t.split(",").map((n=>n.trim()));const o=n[0]??"";const e=r&&o.toLowerCase().includes(r.toLowerCase());const i=a&&o.toLowerCase().includes(a.toLowerCase());if(o.length>0&&!e&&!i&&/[0-9A-Za-z]/.test(o)){p=o}}return{address:p,city:r,state:a,country:s,zip:l}}static loadGoogleMapsScript(n){const t=n||"AIzaSyB9pS5LHbPKjnmMQ89BQHD0SVZXVsi95pk";if(!t){console.warn("Google Maps API key not provided. Address autocomplete will not be available.");return}if(document.querySelector('script[src*="maps.googleapis.com"]')){return}const o=document.createElement("script");o.src=`https://maps.googleapis.com/maps/api/js?key=${t}&loading=async&callback=initGoogleMaps`;o.async=true;o.defer=true;window.initGoogleMaps=()=>{delete window.initGoogleMaps};o.onerror=()=>{console.error("Failed to load Google Maps script. Please check your API key and network connection.")};document.head.appendChild(o)}}export{n as G};
2
+ //# sourceMappingURL=p-Lr2NbC5i.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"p-Lr2NbC5i.js","sources":["src/utils/google-maps.service.ts"],"sourcesContent":["export interface AddressComponents {\n address: string;\n city: string;\n state: string;\n country: string;\n zip: string;\n addInformation?: string;\n formattedAddress?: string; // Dirección completa de Google para usar como fallback\n}\n\nexport class GoogleMapsService {\n private static instance: GoogleMapsService;\n private isLoaded: boolean = false;\n private loadPromise: Promise<boolean> | null = null;\n\n static getInstance(): GoogleMapsService {\n if (!GoogleMapsService.instance) {\n GoogleMapsService.instance = new GoogleMapsService();\n GoogleMapsService.setupShadowDOMPatch();\n }\n return GoogleMapsService.instance;\n }\n\n private static setupShadowDOMPatch() {\n if ((window as any).gmpShadowPatched) return;\n\n const originalAttachShadow = Element.prototype.attachShadow;\n\n Element.prototype.attachShadow = function (init: ShadowRootInit) {\n if (this.localName === 'gmp-place-autocomplete') {\n return originalAttachShadow.call(this, { ...init, mode: 'open' });\n }\n return originalAttachShadow.call(this, init);\n };\n\n // Interceptar showModal() para evitar 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"],"names":[],"mappings":"MAUa,iBAAiB,CAAA;IACpB,OAAO,QAAQ;IACf,QAAQ,GAAY,KAAK;IACzB,WAAW,GAA4B,IAAI;AAEnD,IAAA,OAAO,WAAW,GAAA;AAChB,QAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE;AAC/B,YAAA,iBAAiB,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE;YACpD,iBAAiB,CAAC,mBAAmB,EAAE;;QAEzC,OAAO,iBAAiB,CAAC,QAAQ;;AAG3B,IAAA,OAAO,mBAAmB,GAAA;QAChC,IAAK,MAAc,CAAC,gBAAgB;YAAE;AAEtC,QAAA,MAAM,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY;AAE3D,QAAA,OAAO,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,IAAoB,EAAA;AAC7D,YAAA,IAAI,IAAI,CAAC,SAAS,KAAK,wBAAwB,EAAE;AAC/C,gBAAA,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;YAEnE,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;AAC9C,SAAC;;;AAID,QAAA,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,SAAS,CAAC,SAAS;AAC/D,QAAA,iBAAiB,CAAC,SAAS,CAAC,SAAS,GAAG,YAAA;YACtC,MAAM,cAAc,GAClB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,iCAAiC,CAAC;AAC1D,gBAAA,IAAI,CAAC,OAAO,CAAC,wBAAwB,CAAC,KAAK,IAAI;YAEjD,IA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,+EAA+E,CAAC;YAC7F;;;AAIF,QAAA,IAAI,QAAQ,CAAC,aAAa,CAAC,oCAAoC,CAAC,EAAE;YAChE;;QAGF,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC;;AAE/C,QAAA,MAAM,CAAC,GAAG,GAAG,CAA+C,4CAAA,EAAA,MAAM,wCAAwC;AAC1G,QAAA,MAAM,CAAC,KAAK,GAAG,IAAI;AACnB,QAAA,MAAM,CAAC,KAAK,GAAG,IAAI;;AAGlB,QAAA,MAAc,CAAC,cAAc,GAAG,MAAK;AACpC,YAAA,OAAQ,MAAc,CAAC,cAAc,CAAC;AACxC,SAAC;AAED,QAAA,MAAM,CAAC,OAAO,GAAG,MAAK;AACpB,YAAA,OAAO,CAAC,KAAK,CACX,sFAAsF,CACvF;AACH,SAAC;AAED,QAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;;AAEpC;;;;"}
@@ -1,2 +1,2 @@
1
- import{r as t,c as e,h as i}from"./p-D8cwEAmw.js";import{c as s}from"./p-MMCcKmy_.js";import{a as n}from"./p-CtVYl54u.js";import{g as o,P as a,C as r,a as l}from"./p-CYYBIKsp.js";import{s as c,a as d,I as h,S as u,i as m,P as p,o as f,b as y}from"./p-B0zTy7-V.js";import{S as b}from"./p-vsLqF4hk.js";import{B as g,g as w,i as k}from"./p-Do_vNuMa.js";import{G as x}from"./p-C2nYpE_A.js";import{m as v,b as C,s as I,i as P,g as S}from"./p-CznPkI5O.js";import{P as N}from"./p-NRdSSs6s.js";import"./p-E-ZsRS8r.js";import"./p-gx2Z4Khq.js";const j={checkoutSummary:true,submitButton:true,billingAddress:true,customerInformation:true,discountCode:true,logo:true,footer:true,sandboxMode:true,processingPayment:true,successPage:true,errorMessage:true,useAddressSearch:true};var M;(function(t){t["BAMBOO"]="bamboo_payment";t["FISERV"]="fiserv";t["KUSHKI"]="kushki";t["PAYWAY"]="payway";t["DOCK"]="dock";t["KLAP"]="klap";t["MOVII"]="movii";t["STRIPE"]="stripe";t["DECIDIR"]="decidir"})(M||(M={}));function R(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")}function D(t){return`${t}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function T(t,e){const i=document.createElement("link");i.rel="stylesheet";i.href=t;i.id=e;i.setAttribute("data-rebill-injected","true");return i}function z(t,e){const i=document.createElement("style");i.id=e;i.setAttribute("data-rebill-injected","true");i.textContent=t;return i}function q(t,e){const i=document.createElement("script");i.src=t;i.id=e;i.setAttribute("data-rebill-injected","true");i.async=true;return i}function A(t,e){const i=document.createElement("script");i.id=e;i.setAttribute("data-rebill-injected","true");i.textContent=t;return i}function E(t){if(!t){return}try{t.remove()}catch(t){console.warn("Error removing injected resource:",t)}}function O(t,e=null){if(!t){return null}E(e);const i=D("rebill-checkout-css");const s=R(t)?T(t,i):z(t,i);document.head.appendChild(s);return s}function F(t,e=null){if(!t){return null}E(e);const i=D("rebill-checkout-js");const s=R(t)?q(t,i):A(t,i);document.head.appendChild(s);return s}function K(t){E(t)}function B(t){E(t)}const L=async(t,e,i)=>{const s=await n.checkout.getRequiredFields({currency:t,method:e},i);return{fields:v(s.data),original:s.data}};const V=async()=>{const t=c.data?.itemInformation?.paymentMethods;const e=t.map((async t=>{try{const e=N.mapToAPMPaymentMethod(t,c.data?.pricing?.country);const i=await L(c.data.pricing.currency,e,c.data.organization.id);return{paymentMethod:t,...i}}catch(e){console.error(`Error getting required fields for ${t}:`,e);return{paymentMethod:t,fields:[],original:[]}}}));const i=await Promise.all(e);const s={};i.forEach((t=>{s[t.paymentMethod]={fields:t.fields,original:t.original}}));return s};const $=(t,e)=>{const i=e[t];if(i){return i}else{return{fields:[],original:[]}}};const Y=t=>typeof t==="string"?JSON.parse(t):t;const _=t=>Y(t);const Z=()=>"190.188.127.250";const J=async({publicKey:t,instantProduct:e,instantPlan:i})=>{const s=Y(e?e:i);const{metadata:a,...r}=s;const l=await n.sessions.createSDKInstantSessionRequest(r,o(),Z(),t);const c={...l.data,...l.data.plan&&{plan:{...l.data.plan,description:s.description||[],metadata:a||null}},...l.data.product&&{product:{...l.data.product,description:s.description||[],metadata:a||null}}};const d=c;return d};const U=async({publicKey:t,productId:e,planId:i})=>{const s=await n.sessions.createSDKItemSessionRequest({...e?{productId:e}:{},...i?{planId:i}:{},idempotencyKey:o(),deviceId:"123123123",clientIP:Z(),publicKey:t});const a=s.data;return a};const X=async({publicKey:t,checkoutLandingSession:e,instantProduct:i,instantPlan:s,productId:n,planId:o})=>{if(e){const t=await _(e);return{session:t,type:d.CHECKOUT_LANDING}}if(i||s){const e=await J({publicKey:t,instantProduct:i,instantPlan:s});return{session:e,type:d.INSTANT}}if(n||o){const e=await U({publicKey:t,productId:n,planId:o});return{session:e,type:d.SDK_ITEM}}};const W="@media (max-width: 1024px){.rebill-checkout{width:100%;flex-direction:column;gap:0;justify-content:flex-start;background:var(--rebill-color-background);padding:20px}.right-section-checkout .left-section{width:100%;height:100%;background:var(--rebill-color-background)}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;gap:24px;height:100%}.otp-container{display:flex;flex-direction:column;justify-content:flex-start;gap:24px}.rebill-checkout.full-width-layout .left-section{width:100%}.rebill-checkout.full-width-layout .left-section-container{max-width:none;width:100%}}@media (min-width: 1025px){.rebill-checkout{width:100%;min-height:600px;display:flex;flex-direction:row;justify-content:center;overflow-y:auto}.left-section{display:flex;width:60%;background:var(--rebill-color-background-left);justify-content:space-around}.right-section-checkout{display:flex;padding-top:72px;width:40%;background:var(--rebill-color-background-right);position:sticky;top:0;justify-content:center}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;margin-bottom:36px;gap:32px}.left-section-container{max-width:450px;min-width:450px;margin:2.5rem 2rem 1.5rem 2rem;display:flex;flex-direction:column}.checkout-summary-section{max-width:450px;min-width:350px;margin:0rem 2rem;background:var(--rebill-color-background-right);display:flex;flex-direction:column;justify-content:flex-start;width:100%}.checkout-form-section user-information,.checkout-form-section payment-method-selector,.checkout-form-section rebill-address,.checkout-summary-section rebill-summary{width:100%}.rebill-checkout.full-width-layout .left-section{width:100%;justify-content:stretch}.rebill-checkout.full-width-layout .left-section-container{max-width:none;min-width:auto;width:100%;margin:2.5rem 2rem 1.5rem 2rem}.pac-container{border-radius:4px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1);border:1px solid #e0e0e0;margin-top:4px;font-family:inherit}.pac-item{padding:10px 12px;cursor:pointer;border-top:none}.pac-item:first-child{border-top:none}.pac-item:hover{background-color:#f5f5f5}.pac-item-query{font-weight:500}.pac-icon{display:none}}.payment-button-container{display:flex;flex-direction:column;gap:16px;margin-bottom:16px}.animated-component{transition:all 0.3s ease-in-out;overflow:visible}.fade-in{animation:fadeIn 0.4s ease-in-out}.slide-in{animation:slideIn 0.5s ease-out}@keyframes fadeIn{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes slideIn{from{opacity:0;transform:translateX(-20px);max-height:0}to{opacity:1;transform:translateX(0);max-height:450px}}.animated-component.hide{animation:fadeOut 0.3s ease-in-out forwards}@keyframes fadeOut{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}rebill-mode-sandbox{position:fixed;bottom:50px;left:50%;transform:translateX(-50%);z-index:1000}@media (max-width: 1024px){rebill-test-mode-chip{bottom:46px}}@media (min-width: 1025px){rebill-test-mode-chip{bottom:46px}}.mode-sandbox-mobile-container{display:flex;align-items:center;width:100%;padding:0;margin:0;box-sizing:border-box}@media (min-width: 1451px){.left-section-container{min-width:450px;margin:2.5rem 5rem 1.5rem 5rem}.checkout-summary-section{min-width:450px;margin:0rem 5rem}}";const G=class{constructor(i){t(this,i);this.error=e(this,"error");this.success=e(this,"success");this.successRedirect=e(this,"successRedirect");this.formChange=e(this,"formChange");this.paymentMethodSelected=e(this,"paymentMethodSelected")}productId;planId;publicKey;instantProduct;instantPlan;display;customerInformation;oneClickCheckout=true;css;js;language;async handleLanguageChange(t,e){if(t&&t!==e){try{await h.changeLanguage(t);u.changeLanguage(t);console.log(`[RebillCheckout] Language changed from ${e} to ${t}`)}catch(t){console.error("[RebillCheckout] Failed to change language:",t)}}}error;success;successRedirect;formChange;couponCode;checkoutLandingSession;externalPayment;rejectedPaymentCard=false;rejectedPaymentAPM=false;countries=[];currentPaymentMethod;checkoutResponse=null;isSubmitting=false;isCardSubmitting=false;isCardSuccess=false;isAPMSubmitting=false;isAPMSuccess=false;storedCheckoutResults=new Map;alertErrorKeys=null;currentApmPaymentMethod=null;breakpoint=g.DESKTOP;showRefreshModal=false;cardError={showCardInvalid:false,type:null};initialData={};allRequiredFields={};currentRequiredFields=[];customerExists=false;showOtp=false;otpVerified=false;responseCheckoutCard=null;cardMode=null;formElement;emailDebounceTimeout=null;injectedStyleElement=null;injectedScriptElement=null;get displayConfig(){if(!this.display){return j}if(typeof this.display==="string"){try{const t=JSON.parse(this.display);return{...j,...t}}catch(t){console.warn("Invalid display configuration string, using defaults:",t);return j}}return{...j,...this.display}}get parsedCustomerInformation(){if(!this.customerInformation){return null}if(typeof this.customerInformation==="string"){try{return JSON.parse(this.customerInformation)}catch(t){console.warn("Invalid customerInformation configuration string, ignoring:",t);return null}}return this.customerInformation}get filteredPaymentMethods(){const t=c.data?.itemInformation?.paymentMethods||[];const e=this.displayConfig.excludePaymentMethods;if(!e||e.length===0){return t}return t.filter((t=>!e.includes(t)))}getCombinedUserData(t={}){const e=c.data.userInformation;const i=this.parsedCustomerInformation;return{email:t?.email||i?.email||e.email,fullName:t?.fullName||i?.fullName||e.fullName,countryCodePhoneNumber:t?.countryCodePhoneNumber||i?.phoneNumber?.countryCode||i?.countryCode||e.countryCode,phoneNumber:t?.phoneNumber||i?.phoneNumber?.number||e.phoneNumber,documentType:t?.documentType||i?.documentType||e.documentType,documentNumber:t?.documentNumber||i?.documentNumber||e.documentNumber,"billing-country":t?.["billing-country"]||i?.address?.billingAddress?.country||e.address?.billingAddress?.country,"billing-state":t?.["billing-state"]||i?.address?.billingAddress?.state||e.address?.billingAddress?.state,"billing-address":t?.["billing-address"]||i?.address?.billingAddress?.address||e.address?.billingAddress?.address,"billing-city":t?.["billing-city"]||i?.address?.billingAddress?.city||e.address?.billingAddress?.city,"billing-zip":t?.["billing-zip"]||i?.address?.billingAddress?.zip||e.address?.billingAddress?.zip,"billing-addInformation":t?.["billing-addInformation"]||i?.address?.billingAddress?.addInformation||e.address?.billingAddress?.addInformation}}injectCustomCSS(){this.injectedStyleElement=O(this.css,this.injectedStyleElement)}cleanupInjectedCSS(){K(this.injectedStyleElement);this.injectedStyleElement=null}injectCustomJS(){this.injectedScriptElement=F(this.js,this.injectedScriptElement)}cleanupInjectedJS(){B(this.injectedScriptElement);this.injectedScriptElement=null}timeToRedirectAPM=5e3;resizeHandler=()=>{const t=w(window.innerWidth);if(t!==this.breakpoint){this.breakpoint=t}};disconnectedCallback(){window.removeEventListener("resize",this.resizeHandler);if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout);this.emailDebounceTimeout=null}this.cleanupInjectedCSS();this.cleanupInjectedJS()}async componentWillLoad(){try{this.resizeHandler();window.addEventListener("resize",this.resizeHandler);this.injectCustomCSS();this.injectCustomJS();if(this.language){await h.changeLanguage(this.language)}else{m()}const{session:t,type:e}=await X({publicKey:this.publicKey,checkoutLandingSession:this.checkoutLandingSession,instantProduct:this.instantProduct,instantPlan:this.instantPlan,productId:this.productId,planId:this.planId});const i=t?.restoredOTP;u.initializeSession({session:t,type:e,payment:typeof this.externalPayment==="string"?JSON.parse(this.externalPayment):this.externalPayment});if(i){u.setAccessToken(i.accessToken);u.setCustomerId(i.customerId);u.setUserInformation(i.userInformation);this.otpVerified=true;this.cardMode="select"}if(c.sessionRefreshed){this.showRefreshModal=true}x.loadGoogleMapsScript();const s=await n.data.getCountries();this.countries=s.data;if(this.parsedCustomerInformation){u.setUserInformation(this.parsedCustomerInformation)}this.initialData=this.getInitialData();this.allRequiredFields=await V();if(this.filteredPaymentMethods.length>0){if(c.data.paymentStatus===a.REJECTED||c.data.paymentStatus===a.APPROVED&&this.filteredPaymentMethods.includes(p.BANK_TRANSFER)){const t=this.filteredPaymentMethods.find((t=>t===p.BANK_TRANSFER));if(t){this.changePaymentMethod(t);u.setPaymentMethodSelected(t)}}else{this.changePaymentMethod(this.filteredPaymentMethods[0])}}if(c.data.providerKey===M.DECIDIR&&!c.deviceId){try{const t=crypto.randomUUID();const e=await n.fingerPrint.getFingerPrint(t);c.deviceId=t;const i=e.result.script;const s=document.createElement("script");s.innerHTML=i;document.body.appendChild(s)}catch(t){console.error("[RebillCheckout] Failed to initialize Decidir fingerprint:",t)}}if(this.oneClickCheckout){n.customers.exists({email:c.data?.prefilledData?.email},this.publicKey).then((t=>{this.customerExists=t.data.exists}))}this.cardMode=c.cardMode;f("cardMode",(()=>{this.cardMode=c.cardMode}))}catch(t){console.error("Error initializing checkout:",t)}}componentWillUpdate(){this.injectCustomCSS();this.injectCustomJS()}async changePaymentMethod(t){if(t!==this.currentPaymentMethod&&this.filteredPaymentMethods.includes(t)){if(this.checkoutResponse){this.checkoutResponse=null;u.clearCheckoutResponse()}this.currentPaymentMethod=t;u.setPaymentMethodSelected(t);if(t!==p.CARD){this.cardMode="input";u.setCardMode("input")}this.isSubmitting=false;this.currentApmPaymentMethod=N.mapToAPMPaymentMethod(t,c.data?.pricing?.country);if(t!==p.CASH&&t!==p.BANK_TRANSFER){this.checkoutResponse=null;u.clearCheckoutResponse()}else{this.checkoutResponse=null;u.clearCheckoutResponse()}this.paymentMethodSelected.emit(t);try{this.currentRequiredFields=$(t,this.allRequiredFields).fields;const e=await n.sessions.updateCurrentSessionPaymentMethod(c.data.sessionId,{paymentMethodName:N.mapToAPMPaymentMethod(t,c.data.pricing.country),paymentMethodType:t,currency:c.data.pricing.currency});u.setProviderKey(e.providerKey);if(e.providerKey===M.DECIDIR||c.data.providerKey===M.DECIDIR){const t=crypto.randomUUID();const e=await n.fingerPrint.getFingerPrint(t);c.deviceId=t;const i=e.result.script;const s=document.createElement("script");s.innerHTML=i;document.body.appendChild(s)}}catch(t){console.error("Failed to update payment method or get required fields:",t)}}}get currentPaymentError(){if(this.currentPaymentMethod===p.CARD){return this.rejectedPaymentCard}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){return this.rejectedPaymentAPM}return false}paymentMethodSelected;async handlePaymentMethodSelected(t){t.stopPropagation();const e=t.detail;this.changePaymentMethod(e);if(this.formElement){this.formElement.resetValidation()}}async handleSubmit(t){if(this.isSubmitting){return}this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false;if(this.currentPaymentMethod===p.CARD){this.handleSubmitCard(t)}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){this.handleSubmitAPM(t)}}handleFormChange(t){const e=t.detail;let i=true;let s={};if(this.formElement?.errors){s=this.formElement.errors;i=Object.keys(s).length===0}this.formChange.emit({data:e,isValid:i,errors:Object.keys(s).length>0?s:undefined})}async handleSubmitCard(t){const e=t.detail;const i=this.getCombinedUserData(e);if(!c.data.cardTokenId&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"card_error"};return}if(!c.data.cardInformation&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"tokenization_error"};return}this.cardError={showCardInvalid:false,type:null};const s={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},installments:Number(e.installments||c.data.cardInformation?.installments?.selectedInstallment?.installment),...c.data.cardTokenId&&{cardTokenId:c.data.cardTokenId,...c.data?.itemInformation?.type!==y.PLAN&&{saveCard:c.saveCard}},...c.data.cardId&&{cardId:c.data.cardId},...(!this.otpVerified||this.cardMode==="input")&&{customer:{firstName:i.fullName?.split(" ")[0],lastName:i.fullName?.split(" ").slice(1).join(" "),email:i.email,phone:{countryCode:i.countryCodePhoneNumber,number:i.phoneNumber}}},billingDetails:{address:{lineOne:i["billing-address"],city:i["billing-city"],state:i["billing-state"],country:i["billing-country"]||"",zipCode:i["billing-zip"],lineTwo:i["billing-addInformation"]},identification:C(c.data?.pricing?.currency,i.documentType,i.documentNumber,this.currentPaymentMethod)},customAttributes:{...c.deviceId&&{deviceId:c.deviceId,..."production"!=="production"}},...c.metadata&&{paymentMetadata:c.metadata}};const l=o();this.isSubmitting=true;this.isCardSubmitting=true;try{const t=await n.checkout.createCardCheckoutRequest(c.data.sessionId,l,s,c.data.accessToken||undefined);u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;if(t.data.result?.status.toUpperCase()===r.APPROVED){this.isCardSuccess=true;u.setPaymentStatus(a.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:t.data});c.data.cardInformation.lastFour=t.data.result?.cardLastFour}else{this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data.result?.statusDetail.toLowerCase()??t.data.error?.error?.message?.toLowerCase()}}}catch(t){this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()}}finally{this.isSubmitting=false;this.isCardSubmitting=false}}async handleSubmitAPM(t){if(this.currentPaymentMethod!==p.CASH&&this.currentPaymentMethod!==p.BANK_TRANSFER){return}this.isSubmitting=true;const e=t.detail;const i=this.getCombinedUserData(e);try{const t={address:{country:i["billing-country"]||"",state:i["billing-state"]||"",city:i["billing-city"]||"",zipCode:i["billing-zip"]||"",lineOne:i["billing-address"]||"",lineTwo:i["billing-addInformation"]},identification:C(c.data?.pricing?.currency,i.documentType,i.documentNumber,this.currentPaymentMethod)};const s=this.currentApmPaymentMethod||N.mapToAPMPaymentMethod(this.currentPaymentMethod,c.data?.pricing?.country);const a={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},method:s,billingDetails:t,redirect:{approved:window.location.origin+"/payment/success",rejected:window.location.origin+"/payment/failure"},paymentMetadata:c.metadata,customAttributes:{bank:e.bankId||c.data?.bankId?.code}};{a.customer={firstName:i.fullName?.split(" ")[0]||"",lastName:i.fullName?.split(" ").slice(1).join(" ")||"",email:i.email,phone:{countryCode:i.countryCodePhoneNumber||"",number:i.phoneNumber||""}}}const r=o();const l=await n.checkout.createAPMCheckoutRequest(c.data.sessionId,r,a);this.isSubmitting=false;this.checkoutResponse=l.data;this.storedCheckoutResults.set(this.currentPaymentMethod,l.data);if(l.data?.date){c.data.paymentDate=l.data.date;c.createdAt=l.data.date}if(l.data?.traceId){c.data.paymentReference=l.data.traceId}}catch(t){this.isSubmitting=false;this.checkoutResponse=t.data;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()};this.rejectedPaymentAPM=true}}async submit(){if(this.formElement&&typeof this.formElement.submit==="function"){this.formElement.submit()}else{await this.handleSubmit({detail:{}})}}handlePaymentStatusChange=t=>{if(t.isCompleted){if(t.status===b.APPROVED){u.setPaymentStatus(a.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:this.checkoutResponse})}else if(t.status===b.REJECTED){u.setPaymentStatus(a.REJECTED);this.alertErrorKeys={alertTitle:a.APM_ERROR_GENERIC,message:a.APM_MESSAGE_ERROR}}}};async handleInputChange(t){if(t?.detail?.id==="email"&&this.oneClickCheckout){if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout)}if(!t.detail.value||t.detail.value.trim()===""){this.customerExists=false;u.clearCustomerIdAndToken();return}this.emailDebounceTimeout=setTimeout((async()=>{try{const t=await n.customers.exists({email:c.data.userInformation.email},this.publicKey);this.customerExists=t.data.exists}catch(t){this.customerExists=false}}),500)}}get validationSchema(){const t=this.currentRequiredFields;const e=this.otpVerified;const i=this.cardMode;const n=this.currentPaymentMethod;return{email:s().when([],{is:()=>!e,then:t=>t.email("validation.emailInvalid").matches(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"validation.emailInvalid").required("validation.emailRequired"),otherwise:t=>t.notRequired()}),fullName:s().when([],{is:()=>!e,then:t=>t.required("validation.fullNameRequired").matches(/^[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}\s+[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}$/,"validation.fullNameInvalid"),otherwise:t=>t.notRequired()}),phoneNumber:s().when([],{is:()=>P("phoneNumber",t)&&!e||e&&i==="input",then:t=>t.required("validation.phoneRequired"),otherwise:t=>t.notRequired()}),isValidPhoneNumber:s().when([],{is:()=>P("phoneNumber",t)&&!e||e&&i==="input",then:t=>t.equals(["true"],"validation.phoneRequired"),otherwise:t=>t.notRequired()}),"billing-country":s().when([],{is:()=>P("billing-country",t)&&!e||e&&i==="input",then:t=>t.required("validation.countryRequired"),otherwise:t=>t.notRequired()}),"billing-state":s().when([],{is:()=>P("billing-state",t)&&!e||e&&i==="input",then:t=>t.required("validation.stateRequired"),otherwise:t=>t.notRequired()}),"billing-address":s().when([],{is:()=>P("billing-address",t)&&!e||e&&i==="input",then:t=>t.required("validation.addressRequired"),otherwise:t=>t.notRequired()}),"billing-city":s().when([],{is:()=>P("billing-city",t)&&!e||e&&i==="input",then:t=>t.required("validation.cityRequired"),otherwise:t=>t.notRequired()}),"billing-zip":s().when([],{is:()=>P("billing-zip",t)&&!e||e&&i==="input",then:t=>t.required("validation.zipRequired"),otherwise:t=>t.notRequired()}),bankId:s().when([],{is:()=>P("bankId",t),then:t=>t.required("validation.bankRequired"),otherwise:t=>t.notRequired()}),installments:s().when([],{is:()=>n===p.CARD&&c.data?.cardInformation?.installments?.isAvailableInstallments&&(c.data?.cardInformation?.installments?.installments?.length??0)>0&&c.data?.itemInformation?.type!==y.PLAN,then:t=>t.required("validation.installmentsRequired"),otherwise:t=>t.notRequired()}),documentType:s().when([],{is:()=>I(c.data?.pricing?.currency)&&((P("documentType",t)||P("documentNumber",t))&&!e||e&&i==="input"),then:t=>t.required("validation.documentTypeRequired"),otherwise:t=>t.notRequired()}),documentNumber:s().when([],{is:()=>I(c.data?.pricing?.currency)&&((P("documentNumber",t)||P("documentType",t))&&!e||e&&i==="input"),then:t=>{const e=t.required("validation.documentNumberRequired").min(7,"validation.documentInvalid");if(c.data?.pricing?.country==="BR"){return e.test("numeric-only","validation.documentNumberNumericOnly",(t=>{if(!t)return true;return/^\d+$/.test(t)}))}return e},otherwise:t=>t.notRequired()})}}getInitialData=()=>({email:c.data.userInformation.email||"",fullName:c.data.userInformation.fullName||"",phoneNumber:c.data.userInformation.phoneNumber?.number||"",countryCodePhoneNumber:c.data.userInformation.countryCode||"",documentType:"",documentNumber:"","billing-country":c.data.userInformation.address?.billingAddress?.country||"","billing-state":c.data.userInformation?.address?.billingAddress?.state||"","billing-address":c.data.userInformation?.address?.billingAddress?.address||"","billing-city":c.data.userInformation?.address?.billingAddress?.city||"","billing-zip":c.data.userInformation?.address?.billingAddress?.zip||"",bankId:c.data.bankId?.code||"",card:"",installments:c.data.cardInformation?.installments?.selectedInstallment?.installment?.toString()||""});hasPrefilledAddress=()=>{const t=["billing-country","billing-state","billing-address","billing-city","billing-zip"];return t.some((t=>{const e=this.initialData[t];return e&&e.trim()!==""}))};get isQrCodeVisible(){return!!this.checkoutResponse?.result?.data?.qrCode}get isBankTransferVisible(){return!!this.checkoutResponse?.result?.data?.account&&!!this.checkoutResponse?.result?.data?.bankName&&!!this.checkoutResponse?.result?.data?.reference}get isBoletoVisible(){return this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&!!this.checkoutResponse?.result?.data?.barcode}isPaymentApproved=()=>{if(c.data.paymentStatus===a.APPROVED){return true}return false};handleRebillAccountClick(t){this.showOtp=t.detail}handleReturnForm(t){this.showOtp=t.detail;u.clearCustomerIdAndToken()}handleSignOut(){this.showOtp=false;this.otpVerified=false;if(!c?.data?.prefilledData?.email){this.customerExists=false}u.clearCustomerIdAndToken();u.clearUserInformation();u.setCardId(null);u.setCardTokenId(null);this.cardMode="input";u.setCardMode("input");this.cardError={showCardInvalid:false,type:null};this.alertErrorKeys=null;this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false}handleCodeVerified(){this.otpVerified=true;this.showOtp=false;this.rejectedPaymentCard=false;this.alertErrorKeys=null;this.cardError={showCardInvalid:false,type:null};if(this.formElement){this.formElement.resetValidation()}}isPaymentRejected(){return c.data.paymentStatus===a.REJECTED&&this.currentPaymentMethod===p.BANK_TRANSFER}render(){const t=this.countries.map((t=>({label:t.country,value:t.isoCountryCode})));const e=(t={})=>i("rebill-summary",{key:"27bf2a0eb744f9be27c6d11c9585a3db69c563f1",totalAmount:c.data.pricing.total,currency:c.data.pricing.currency,itemTitle:c._session?.getTitle(),itemDescription:c._session?.getDescription(),itemAmount:c.data.pricing.subtotal,subtotal:c.data.pricing.subtotal,allowCoupon:c._session?.getAllowCoupon(this.displayConfig),currentBreakpoint:this.breakpoint,planFrequency:c._session?.getPlanFrequency(),planFrequencyCount:c._session?.getPlanFrequencyCount(),discountType:c.data.discount.discountType,discountedPercentage:c.data.discount.discountedPercentage,discountDuration:c.data.discount.discountDuration,discountAmount:c.data.discount.discountAmount,initialCouponCode:this.couponCode,...t});return c.isInitialized&&i(i.Fragment,null,this.showRefreshModal&&i("rebill-modal-overlay",{key:"e8923ed0d91e204e56259842e998820586f04493"}),this.displayConfig.processingPayment&&i("rebill-processing-payment",{key:"48b27b39d74c703bdd1172c567255ce924dab0ce",style:{display:this.isCardSubmitting?"block":"none"}}),this.displayConfig.successPage&&this.isPaymentApproved()&&c.isInitialized?i("success-page",{typePaymentMethod:c.data.paymentMethodSelected,paymentMethodName:N.mapToAPMPaymentMethod(c.data.paymentMethodSelected||c.data.payment?.paymentMethodType,c.data?.pricing?.country),country:c.data?.pricing?.country,bank:c.data.payment?.paymentMethodMetadata?.bankName,cardLastFour:this.responseCheckoutCard?.result?.cardLastFour||c.data.cardInformation?.lastFour,paymentDate:c.data.paymentDate||this.responseCheckoutCard?.date||c.data.payment?.createdAt||this.checkoutResponse?.result?.data?.createdAt,referenceNumber:c.data.paymentReference||c.data.payment?.traceId||this.responseCheckoutCard?.traceId,onSuccessRedirect:t=>{this.successRedirect.emit(t.detail)},trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,debitDay:c.data?.itemInformation?.debitDay,planAmount:c.data?.pricing?.planAmount}):i(i.Fragment,null,this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===d.CHECKOUT_LANDING&&k(this.breakpoint,g.DESKTOP)&&i("div",{class:"mode-sandbox-mobile-container",style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"}},i("rebill-mode-sandbox-mobile",null)),i("rebill-checkout-form",{ref:t=>this.formElement=t,style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"},validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:t=>this.handleSubmit(t),onChange:t=>this.handleFormChange(t),renderForm:({submit:s,formData:n,errors:o})=>{const a=!this.isCardSuccess&&this.checkoutResponse?.result&&(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER);return i("div",{class:`rebill-checkout ${!this.displayConfig.checkoutSummary?"full-width-layout":""}`},i("div",{class:"left-section"},i("div",{class:"left-section-container"},this.displayConfig.logo&&i("organization-logo",{organization:c.data.organization}),i("div",{class:"otp-container",style:{display:this.showOtp?"block":"none"}},i("otp-component",null)),i("div",{style:{display:this.showOtp?"none":"block"}},i("div",{class:"checkout-form-section"},this.displayConfig.checkoutSummary&&i("div",{class:"summary-mobile-tablet",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},e({displayedComponents:["totalAmount","discount","timelineFreeTrial","timelineDebitDay","itemDetails"]})),!this.otpVerified&&this.displayConfig.customerInformation&&i("user-information",{customerExists:this.customerExists,disabled:this.isSubmitting,errors:{email:o.email,fullName:o.fullName}}),this.otpVerified&&this.displayConfig.customerInformation&&i("user-information-static",{variant:"otp",userInfo:{customerName:c.data.userInformation.fullName?.split(" ")[0],customerEmail:c.data.userInformation.email}}),i("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},i("payment-method-selector",{enabledPaymentMethods:this.filteredPaymentMethods,defaultSelected:this.currentPaymentMethod,disabled:this.isSubmitting,errorComponent:{showErrorComponent:this.displayConfig.errorMessage&&(this.currentPaymentError||this.isPaymentRejected()),alertTitle:l.getErrorTitle(this.currentPaymentMethod,c.data?.pricing?.country||"",this.alertErrorKeys?.alertTitle),message:l.getErrorMessage(this.alertErrorKeys?.message,this.currentPaymentMethod,c.data?.pricing?.country)},country:c.data?.pricing?.country,installmentsError:o.installments,showDocument:(!this.otpVerified||this.otpVerified&&this.cardMode==="input")&&!a&&!this.isQrCodeVisible&&I(c.data?.pricing?.currency)&&(P("documentNumber",this.currentRequiredFields)||P("documentType",this.currentRequiredFields)),documentTypeError:o.documentType,documentNumberError:o.documentNumber,cardError:this.cardError,customCSS:this.css}),!a&&(()=>{const t=P("bankId",this.currentRequiredFields);return t})()&&i("div",{class:"animated-component fade-in"},i("rebill-bank-selector",{banks:S("bank",this.allRequiredFields[this.currentPaymentMethod].original)||[],defaultSelectedBankId:n.bankId||"",error:o?.bankId,disabled:this.isSubmitting}))),!a&&(!this.otpVerified||this.cardMode==="input")&&i(i.Fragment,null,this.displayConfig.billingAddress&&(P("billing-country",this.currentRequiredFields)||P("billing-state",this.currentRequiredFields)||P("billing-address",this.currentRequiredFields)||P("billing-city",this.currentRequiredFields)||P("billing-zip",this.currentRequiredFields))&&i("div",{class:"animated-component slide-in"},i("rebill-address",{disabled:this.isSubmitting,countryOptions:t,billingView:(()=>{if(this.displayConfig.useAddressSearch!==undefined&&this.displayConfig.useAddressSearch===false){return"form"}return this.hasPrefilledAddress()?"form":"search"})(),errors:{"billing-country":o["billing-country"],"billing-state":o["billing-state"],"billing-address":o["billing-address"],"billing-city":o["billing-city"],"billing-zip":o["billing-zip"]}})),this.displayConfig.customerInformation&&P("phoneNumber",this.currentRequiredFields)&&i("div",{class:"animated-component fade-in"},i("user-information-phone",{disabled:this.isSubmitting,error:o?.phoneNumber||o?.isValidPhoneNumber,countryCode:c.data.userInformation?.countryCode||c.data.country}))),a&&(()=>{const t=this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&this.checkoutResponse?.result?.data?.barcode;return i("apm-checkout",{paymentMethod:this.currentPaymentMethod,barcode:t?this.checkoutResponse?.result?.data?.barcode:undefined,referenceId:this.currentPaymentMethod===p.CASH&&!t?this.checkoutResponse?.result?.data?.referenceId:undefined,qrCodeData:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.qrCode:undefined,code:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.code:undefined,checkoutRequestId:this.checkoutResponse?.result?.checkoutRequestId,providerName:c.data.providerKey,expirationDate:(()=>{const t=new Date;t.setDate(t.getDate()+30);return t.toISOString()})(),onPaymentStatusChange:t=>this.handlePaymentStatusChange(t.detail),country:c.data?.pricing?.country,redirectUrl:this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,bearerToken:this.checkoutResponse?.result?.data?.bearerToken,bankTransferData:this.checkoutResponse?.result?.data?.account&&this.checkoutResponse?.result?.data?.bankName&&this.checkoutResponse?.result?.data?.reference?{account:this.checkoutResponse.result.data.account,bankName:this.checkoutResponse.result.data.bankName,reference:this.checkoutResponse.result.data.reference}:undefined})})(),this.displayConfig.checkoutSummary&&i("div",{class:"summary-price-details",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},e({displayedComponents:["priceDetails"]})),this.displayConfig.submitButton&&!(a&&(this.isQrCodeVisible||this.isBankTransferVisible||this.isBoletoVisible))&&i("div",{class:"payment-button-container"},i("payment-button",{paymentMethod:this.currentPaymentMethod,isLoading:this.isSubmitting,trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,onSubmit:()=>{s()},redirectUrl:!!this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,isDisabled:c.data.fetchingInstallments,country:c.data?.pricing?.country}),i("rebill-alert",{type:"secure",variant:"variant-secure",icon:"lock-outline",message:h.translate("otp.secureMessage")}))),this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===d.CHECKOUT_LANDING&&!k(this.breakpoint,g.DESKTOP)&&i("rebill-mode-sandbox",null)),this.displayConfig.footer&&i("rebill-footer",{style:{marginTop:k(this.breakpoint,g.DESKTOP)?"24px":"auto"}}))),this.displayConfig.checkoutSummary&&i("div",{class:"right-section-checkout"},i("div",{class:"checkout-summary-section"},i("div",{class:"summary-desktop",style:{display:!k(this.breakpoint,g.DESKTOP)?"block":"none"}},e()))))}})))}static get watchers(){return{language:["handleLanguageChange"]}}};G.style=W;export{G as rebill_checkout};
2
- //# sourceMappingURL=p-f3859b65.entry.js.map
1
+ import{r as t,c as e,h as i}from"./p-D8cwEAmw.js";import{c as s}from"./p-MMCcKmy_.js";import{a as n}from"./p-CtVYl54u.js";import{g as o,P as a,C as r,a as l}from"./p-CYYBIKsp.js";import{s as c,a as d,I as h,S as u,i as m,P as p,o as f,b as y}from"./p-B0zTy7-V.js";import{S as b}from"./p-vsLqF4hk.js";import{B as g,g as w,i as k}from"./p-Do_vNuMa.js";import{G as x}from"./p-Lr2NbC5i.js";import{m as v,b as C,s as I,i as P,g as S}from"./p-CznPkI5O.js";import{P as N}from"./p-NRdSSs6s.js";import"./p-E-ZsRS8r.js";import"./p-gx2Z4Khq.js";const j={checkoutSummary:true,submitButton:true,billingAddress:true,customerInformation:true,discountCode:true,logo:true,footer:true,sandboxMode:true,processingPayment:true,successPage:true,errorMessage:true,useAddressSearch:true};var M;(function(t){t["BAMBOO"]="bamboo_payment";t["FISERV"]="fiserv";t["KUSHKI"]="kushki";t["PAYWAY"]="payway";t["DOCK"]="dock";t["KLAP"]="klap";t["MOVII"]="movii";t["STRIPE"]="stripe";t["DECIDIR"]="decidir"})(M||(M={}));function R(t){return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")}function D(t){return`${t}-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function T(t,e){const i=document.createElement("link");i.rel="stylesheet";i.href=t;i.id=e;i.setAttribute("data-rebill-injected","true");return i}function z(t,e){const i=document.createElement("style");i.id=e;i.setAttribute("data-rebill-injected","true");i.textContent=t;return i}function q(t,e){const i=document.createElement("script");i.src=t;i.id=e;i.setAttribute("data-rebill-injected","true");i.async=true;return i}function A(t,e){const i=document.createElement("script");i.id=e;i.setAttribute("data-rebill-injected","true");i.textContent=t;return i}function E(t){if(!t){return}try{t.remove()}catch(t){console.warn("Error removing injected resource:",t)}}function O(t,e=null){if(!t){return null}E(e);const i=D("rebill-checkout-css");const s=R(t)?T(t,i):z(t,i);document.head.appendChild(s);return s}function F(t,e=null){if(!t){return null}E(e);const i=D("rebill-checkout-js");const s=R(t)?q(t,i):A(t,i);document.head.appendChild(s);return s}function K(t){E(t)}function B(t){E(t)}const L=async(t,e,i)=>{const s=await n.checkout.getRequiredFields({currency:t,method:e},i);return{fields:v(s.data),original:s.data}};const V=async()=>{const t=c.data?.itemInformation?.paymentMethods;const e=t.map((async t=>{try{const e=N.mapToAPMPaymentMethod(t,c.data?.pricing?.country);const i=await L(c.data.pricing.currency,e,c.data.organization.id);return{paymentMethod:t,...i}}catch(e){console.error(`Error getting required fields for ${t}:`,e);return{paymentMethod:t,fields:[],original:[]}}}));const i=await Promise.all(e);const s={};i.forEach((t=>{s[t.paymentMethod]={fields:t.fields,original:t.original}}));return s};const $=(t,e)=>{const i=e[t];if(i){return i}else{return{fields:[],original:[]}}};const Y=t=>typeof t==="string"?JSON.parse(t):t;const Z=t=>Y(t);const _=()=>"190.188.127.250";const J=async({publicKey:t,instantProduct:e,instantPlan:i})=>{const s=Y(e?e:i);const{metadata:a,...r}=s;const l=await n.sessions.createSDKInstantSessionRequest(r,o(),_(),t);const c={...l.data,...l.data.plan&&{plan:{...l.data.plan,description:s.description||[],metadata:a||null}},...l.data.product&&{product:{...l.data.product,description:s.description||[],metadata:a||null}}};const d=c;return d};const U=async({publicKey:t,productId:e,planId:i})=>{const s=await n.sessions.createSDKItemSessionRequest({...e?{productId:e}:{},...i?{planId:i}:{},idempotencyKey:o(),deviceId:"123123123",clientIP:_(),publicKey:t});const a=s.data;return a};const X=async({publicKey:t,checkoutLandingSession:e,instantProduct:i,instantPlan:s,productId:n,planId:o})=>{if(e){const t=await Z(e);return{session:t,type:d.CHECKOUT_LANDING}}if(i||s){const e=await J({publicKey:t,instantProduct:i,instantPlan:s});return{session:e,type:d.INSTANT}}if(n||o){const e=await U({publicKey:t,productId:n,planId:o});return{session:e,type:d.SDK_ITEM}}};const W="@media (max-width: 1024px){.rebill-checkout{width:100%;flex-direction:column;gap:0;justify-content:flex-start;background:var(--rebill-color-background);padding:20px}.right-section-checkout .left-section{width:100%;height:100%;background:var(--rebill-color-background)}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;gap:24px;height:100%}.otp-container{display:flex;flex-direction:column;justify-content:flex-start;gap:24px}.rebill-checkout.full-width-layout .left-section{width:100%}.rebill-checkout.full-width-layout .left-section-container{max-width:none;width:100%}}@media (min-width: 1025px){.rebill-checkout{width:100%;min-height:600px;display:flex;flex-direction:row;justify-content:center;overflow-y:auto}.left-section{display:flex;width:60%;background:var(--rebill-color-background-left);justify-content:space-around}.right-section-checkout{display:flex;padding-top:72px;width:40%;background:var(--rebill-color-background-right);position:sticky;top:0;justify-content:center}.checkout-form-section{display:flex;flex-direction:column;justify-content:flex-start;margin-bottom:36px;gap:32px}.left-section-container{max-width:450px;min-width:450px;margin:2.5rem 2rem 1.5rem 2rem;display:flex;flex-direction:column}.checkout-summary-section{max-width:450px;min-width:350px;margin:0rem 2rem;background:var(--rebill-color-background-right);display:flex;flex-direction:column;justify-content:flex-start;width:100%}.checkout-form-section user-information,.checkout-form-section payment-method-selector,.checkout-form-section rebill-address,.checkout-summary-section rebill-summary{width:100%}.rebill-checkout.full-width-layout .left-section{width:100%;justify-content:stretch}.rebill-checkout.full-width-layout .left-section-container{max-width:none;min-width:auto;width:100%;margin:2.5rem 2rem 1.5rem 2rem}.pac-container{border-radius:4px;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1);border:1px solid #e0e0e0;margin-top:4px;font-family:inherit}.pac-item{padding:10px 12px;cursor:pointer;border-top:none}.pac-item:first-child{border-top:none}.pac-item:hover{background-color:#f5f5f5}.pac-item-query{font-weight:500}.pac-icon{display:none}}.payment-button-container{display:flex;flex-direction:column;gap:16px;margin-bottom:16px}.animated-component{transition:all 0.3s ease-in-out;overflow:visible}.fade-in{animation:fadeIn 0.4s ease-in-out}.slide-in{animation:slideIn 0.5s ease-out}@keyframes fadeIn{from{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}@keyframes slideIn{from{opacity:0;transform:translateX(-20px);max-height:0}to{opacity:1;transform:translateX(0);max-height:450px}}.animated-component.hide{animation:fadeOut 0.3s ease-in-out forwards}@keyframes fadeOut{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}rebill-mode-sandbox{position:fixed;bottom:50px;left:50%;transform:translateX(-50%);z-index:1000}@media (max-width: 1024px){rebill-test-mode-chip{bottom:46px}}@media (min-width: 1025px){rebill-test-mode-chip{bottom:46px}}.mode-sandbox-mobile-container{display:flex;align-items:center;width:100%;padding:0;margin:0;box-sizing:border-box}@media (min-width: 1451px){.left-section-container{min-width:450px;margin:2.5rem 5rem 1.5rem 5rem}.checkout-summary-section{min-width:450px;margin:0rem 5rem}}";const G=class{constructor(i){t(this,i);this.error=e(this,"error");this.success=e(this,"success");this.successRedirect=e(this,"successRedirect");this.formChange=e(this,"formChange");this.paymentMethodSelected=e(this,"paymentMethodSelected")}productId;planId;publicKey;instantProduct;instantPlan;display;customerInformation;oneClickCheckout=true;css;js;language;async handleLanguageChange(t,e){if(t&&t!==e){try{await h.changeLanguage(t);u.changeLanguage(t);console.log(`[RebillCheckout] Language changed from ${e} to ${t}`)}catch(t){console.error("[RebillCheckout] Failed to change language:",t)}}}error;success;successRedirect;formChange;couponCode;checkoutLandingSession;externalPayment;rejectedPaymentCard=false;rejectedPaymentAPM=false;countries=[];currentPaymentMethod;checkoutResponse=null;isSubmitting=false;isCardSubmitting=false;isCardSuccess=false;isAPMSubmitting=false;isAPMSuccess=false;storedCheckoutResults=new Map;alertErrorKeys=null;currentApmPaymentMethod=null;breakpoint=g.DESKTOP;showRefreshModal=false;cardError={showCardInvalid:false,type:null};initialData={};allRequiredFields={};currentRequiredFields=[];customerExists=false;showOtp=false;otpVerified=false;responseCheckoutCard=null;cardMode=null;formElement;emailDebounceTimeout=null;injectedStyleElement=null;injectedScriptElement=null;get displayConfig(){if(!this.display){return j}if(typeof this.display==="string"){try{const t=JSON.parse(this.display);return{...j,...t}}catch(t){console.warn("Invalid display configuration string, using defaults:",t);return j}}return{...j,...this.display}}get parsedCustomerInformation(){if(!this.customerInformation){return null}if(typeof this.customerInformation==="string"){try{return JSON.parse(this.customerInformation)}catch(t){console.warn("Invalid customerInformation configuration string, ignoring:",t);return null}}return this.customerInformation}get filteredPaymentMethods(){const t=c.data?.itemInformation?.paymentMethods||[];const e=this.displayConfig.excludePaymentMethods;if(!e||e.length===0){return t}return t.filter((t=>!e.includes(t)))}getCombinedUserData(t={}){const e=c.data.userInformation;const i=this.parsedCustomerInformation;return{email:t?.email||i?.email||e.email,fullName:t?.fullName||i?.fullName||e.fullName,countryCodePhoneNumber:t?.countryCodePhoneNumber||i?.phoneNumber?.countryCode||i?.countryCode||e.countryCode,phoneNumber:t?.phoneNumber||i?.phoneNumber?.number||e.phoneNumber,documentType:t?.documentType||i?.documentType||e.documentType,documentNumber:t?.documentNumber||i?.documentNumber||e.documentNumber,"billing-country":t?.["billing-country"]||i?.address?.billingAddress?.country||e.address?.billingAddress?.country,"billing-state":t?.["billing-state"]||i?.address?.billingAddress?.state||e.address?.billingAddress?.state,"billing-address":t?.["billing-address"]||i?.address?.billingAddress?.address||e.address?.billingAddress?.address,"billing-city":t?.["billing-city"]||i?.address?.billingAddress?.city||e.address?.billingAddress?.city,"billing-zip":t?.["billing-zip"]||i?.address?.billingAddress?.zip||e.address?.billingAddress?.zip,"billing-addInformation":t?.["billing-addInformation"]||i?.address?.billingAddress?.addInformation||e.address?.billingAddress?.addInformation}}injectCustomCSS(){this.injectedStyleElement=O(this.css,this.injectedStyleElement)}cleanupInjectedCSS(){K(this.injectedStyleElement);this.injectedStyleElement=null}injectCustomJS(){this.injectedScriptElement=F(this.js,this.injectedScriptElement)}cleanupInjectedJS(){B(this.injectedScriptElement);this.injectedScriptElement=null}timeToRedirectAPM=5e3;resizeHandler=()=>{const t=w(window.innerWidth);if(t!==this.breakpoint){this.breakpoint=t}};disconnectedCallback(){window.removeEventListener("resize",this.resizeHandler);if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout);this.emailDebounceTimeout=null}this.cleanupInjectedCSS();this.cleanupInjectedJS()}async componentWillLoad(){try{this.resizeHandler();window.addEventListener("resize",this.resizeHandler);this.injectCustomCSS();this.injectCustomJS();if(this.language){await h.changeLanguage(this.language)}else{m()}const{session:t,type:e}=await X({publicKey:this.publicKey,checkoutLandingSession:this.checkoutLandingSession,instantProduct:this.instantProduct,instantPlan:this.instantPlan,productId:this.productId,planId:this.planId});const i=t?.restoredOTP;u.initializeSession({session:t,type:e,payment:typeof this.externalPayment==="string"?JSON.parse(this.externalPayment):this.externalPayment});if(i){u.setAccessToken(i.accessToken);u.setCustomerId(i.customerId);u.setUserInformation(i.userInformation);this.otpVerified=true;this.cardMode="select"}if(c.sessionRefreshed){this.showRefreshModal=true}x.loadGoogleMapsScript();const s=await n.data.getCountries();this.countries=s.data;if(this.parsedCustomerInformation){u.setUserInformation(this.parsedCustomerInformation)}this.initialData=this.getInitialData();this.allRequiredFields=await V();if(this.filteredPaymentMethods.length>0){if(c.data.paymentStatus===a.REJECTED||c.data.paymentStatus===a.APPROVED&&this.filteredPaymentMethods.includes(p.BANK_TRANSFER)){const t=this.filteredPaymentMethods.find((t=>t===p.BANK_TRANSFER));if(t){this.changePaymentMethod(t);u.setPaymentMethodSelected(t)}}else{this.changePaymentMethod(this.filteredPaymentMethods[0])}}if(c.data.providerKey===M.DECIDIR&&!c.deviceId){try{const t=crypto.randomUUID();const e=await n.fingerPrint.getFingerPrint(t);c.deviceId=t;const i=e.result.script;const s=document.createElement("script");s.innerHTML=i;document.body.appendChild(s)}catch(t){console.error("[RebillCheckout] Failed to initialize Decidir fingerprint:",t)}}if(this.oneClickCheckout){n.customers.exists({email:c.data?.prefilledData?.email},this.publicKey).then((t=>{this.customerExists=t.data.exists}))}this.cardMode=c.cardMode;f("cardMode",(()=>{this.cardMode=c.cardMode}))}catch(t){console.error("Error initializing checkout:",t)}}componentWillUpdate(){this.injectCustomCSS();this.injectCustomJS()}async changePaymentMethod(t){if(t!==this.currentPaymentMethod&&this.filteredPaymentMethods.includes(t)){if(this.checkoutResponse){this.checkoutResponse=null;u.clearCheckoutResponse()}this.currentPaymentMethod=t;u.setPaymentMethodSelected(t);if(t!==p.CARD){this.cardMode="input";u.setCardMode("input")}this.isSubmitting=false;this.currentApmPaymentMethod=N.mapToAPMPaymentMethod(t,c.data?.pricing?.country);if(t!==p.CASH&&t!==p.BANK_TRANSFER){this.checkoutResponse=null;u.clearCheckoutResponse()}else{this.checkoutResponse=null;u.clearCheckoutResponse()}this.paymentMethodSelected.emit(t);try{this.currentRequiredFields=$(t,this.allRequiredFields).fields;const e=await n.sessions.updateCurrentSessionPaymentMethod(c.data.sessionId,{paymentMethodName:N.mapToAPMPaymentMethod(t,c.data.pricing.country),paymentMethodType:t,currency:c.data.pricing.currency});u.setProviderKey(e.providerKey);if(e.providerKey===M.DECIDIR||c.data.providerKey===M.DECIDIR){const t=crypto.randomUUID();const e=await n.fingerPrint.getFingerPrint(t);c.deviceId=t;const i=e.result.script;const s=document.createElement("script");s.innerHTML=i;document.body.appendChild(s)}}catch(t){console.error("Failed to update payment method or get required fields:",t)}}}get currentPaymentError(){if(this.currentPaymentMethod===p.CARD){return this.rejectedPaymentCard}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){return this.rejectedPaymentAPM}return false}paymentMethodSelected;async handlePaymentMethodSelected(t){t.stopPropagation();const e=t.detail;this.changePaymentMethod(e);if(this.formElement){this.formElement.resetValidation()}}async handleSubmit(t){if(this.isSubmitting){return}this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false;if(this.currentPaymentMethod===p.CARD){this.handleSubmitCard(t)}else if(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER){this.handleSubmitAPM(t)}}handleFormChange(t){const e=t.detail;let i=true;let s={};if(this.formElement?.errors){s=this.formElement.errors;i=Object.keys(s).length===0}this.formChange.emit({data:e,isValid:i,errors:Object.keys(s).length>0?s:undefined})}async handleSubmitCard(t){const e=t.detail;const i=this.getCombinedUserData(e);if(!c.data.cardTokenId&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"card_error"};return}if(!c.data.cardInformation&&!c.data.cardId){this.cardError={showCardInvalid:true,type:"tokenization_error"};return}this.cardError={showCardInvalid:false,type:null};const s={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},installments:Number(e.installments||c.data.cardInformation?.installments?.selectedInstallment?.installment),...c.data.cardTokenId&&{cardTokenId:c.data.cardTokenId,...c.data?.itemInformation?.type!==y.PLAN&&{saveCard:c.saveCard}},...c.data.cardId&&{cardId:c.data.cardId},...(!this.otpVerified||this.cardMode==="input")&&{customer:{firstName:i.fullName?.split(" ")[0],lastName:i.fullName?.split(" ").slice(1).join(" "),email:i.email,phone:{countryCode:i.countryCodePhoneNumber,number:i.phoneNumber}}},billingDetails:{address:{lineOne:i["billing-address"],city:i["billing-city"],state:i["billing-state"],country:i["billing-country"]||"",zipCode:i["billing-zip"],lineTwo:i["billing-addInformation"]},identification:C(c.data?.pricing?.currency,i.documentType,i.documentNumber,this.currentPaymentMethod)},customAttributes:{...c.deviceId&&{deviceId:c.deviceId,..."production"!=="production"}},...c.metadata&&{paymentMetadata:c.metadata}};const l=o();this.isSubmitting=true;this.isCardSubmitting=true;try{const t=await n.checkout.createCardCheckoutRequest(c.data.sessionId,l,s,c.data.accessToken||undefined);u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;if(t.data.result?.status.toUpperCase()===r.APPROVED){this.isCardSuccess=true;u.setPaymentStatus(a.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:t.data});c.data.cardInformation.lastFour=t.data.result?.cardLastFour}else{this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data.result?.statusDetail.toLowerCase()??t.data.error?.error?.message?.toLowerCase()}}}catch(t){this.error.emit({paymentMethod:this.currentPaymentMethod,data:t.data});u.setCheckoutResponse(t.data);this.responseCheckoutCard=t.data;this.rejectedPaymentCard=true;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()}}finally{this.isSubmitting=false;this.isCardSubmitting=false}}async handleSubmitAPM(t){if(this.currentPaymentMethod!==p.CASH&&this.currentPaymentMethod!==p.BANK_TRANSFER){return}this.isSubmitting=true;const e=t.detail;const i=this.getCombinedUserData(e);try{const t={address:{country:i["billing-country"]||"",state:i["billing-state"]||"",city:i["billing-city"]||"",zipCode:i["billing-zip"]||"",lineOne:i["billing-address"]||"",lineTwo:i["billing-addInformation"]},identification:C(c.data?.pricing?.currency,i.documentType,i.documentNumber,this.currentPaymentMethod)};const s=this.currentApmPaymentMethod||N.mapToAPMPaymentMethod(this.currentPaymentMethod,c.data?.pricing?.country);const a={transaction:{quantity:1,...c.data.discount.couponCode&&{couponCode:c.data.discount.couponCode}},method:s,billingDetails:t,redirect:{approved:window.location.origin+"/payment/success",rejected:window.location.origin+"/payment/failure"},paymentMetadata:c.metadata,customAttributes:{bank:e.bankId||c.data?.bankId?.code}};{a.customer={firstName:i.fullName?.split(" ")[0]||"",lastName:i.fullName?.split(" ").slice(1).join(" ")||"",email:i.email,phone:{countryCode:i.countryCodePhoneNumber||"",number:i.phoneNumber||""}}}const r=o();const l=await n.checkout.createAPMCheckoutRequest(c.data.sessionId,r,a);this.isSubmitting=false;this.checkoutResponse=l.data;this.storedCheckoutResults.set(this.currentPaymentMethod,l.data);if(l.data?.date){c.data.paymentDate=l.data.date;c.createdAt=l.data.date}if(l.data?.traceId){c.data.paymentReference=l.data.traceId}}catch(t){this.isSubmitting=false;this.checkoutResponse=t.data;this.alertErrorKeys={message:t.data?.error?.type?.toLowerCase()??t.data?.result?.statusDetail?.toLowerCase()};this.rejectedPaymentAPM=true}}async submit(){if(this.formElement&&typeof this.formElement.submit==="function"){this.formElement.submit()}else{await this.handleSubmit({detail:{}})}}handlePaymentStatusChange=t=>{if(t.isCompleted){if(t.status===b.APPROVED){u.setPaymentStatus(a.APPROVED);this.success.emit({paymentMethod:this.currentPaymentMethod,data:this.checkoutResponse})}else if(t.status===b.REJECTED){u.setPaymentStatus(a.REJECTED);this.alertErrorKeys={alertTitle:a.APM_ERROR_GENERIC,message:a.APM_MESSAGE_ERROR}}}};async handleInputChange(t){if(t?.detail?.id==="email"&&this.oneClickCheckout){if(this.emailDebounceTimeout){clearTimeout(this.emailDebounceTimeout)}if(!t.detail.value||t.detail.value.trim()===""){this.customerExists=false;u.clearCustomerIdAndToken();return}this.emailDebounceTimeout=setTimeout((async()=>{try{const t=await n.customers.exists({email:c.data.userInformation.email},this.publicKey);this.customerExists=t.data.exists}catch(t){this.customerExists=false}}),500)}}get validationSchema(){const t=this.currentRequiredFields;const e=this.otpVerified;const i=this.cardMode;const n=this.currentPaymentMethod;return{email:s().when([],{is:()=>!e,then:t=>t.email("validation.emailInvalid").matches(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,"validation.emailInvalid").required("validation.emailRequired"),otherwise:t=>t.notRequired()}),fullName:s().when([],{is:()=>!e,then:t=>t.required("validation.fullNameRequired").matches(/^[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}\s+[a-zA-ZÀ-ÿ\u00f1\u00d1\s]{2,}$/,"validation.fullNameInvalid"),otherwise:t=>t.notRequired()}),phoneNumber:s().when([],{is:()=>P("phoneNumber",t)&&!e||e&&i==="input",then:t=>t.required("validation.phoneRequired"),otherwise:t=>t.notRequired()}),isValidPhoneNumber:s().when([],{is:()=>P("phoneNumber",t)&&!e||e&&i==="input",then:t=>t.equals(["true"],"validation.phoneRequired"),otherwise:t=>t.notRequired()}),"billing-country":s().when([],{is:()=>P("billing-country",t)&&!e||e&&i==="input",then:t=>t.required("validation.countryRequired"),otherwise:t=>t.notRequired()}),"billing-state":s().when([],{is:()=>P("billing-state",t)&&!e||e&&i==="input",then:t=>t.required("validation.stateRequired"),otherwise:t=>t.notRequired()}),"billing-address":s().when([],{is:()=>P("billing-address",t)&&!e||e&&i==="input",then:t=>t.required("validation.addressRequired"),otherwise:t=>t.notRequired()}),"billing-city":s().when([],{is:()=>P("billing-city",t)&&!e||e&&i==="input",then:t=>t.required("validation.cityRequired"),otherwise:t=>t.notRequired()}),"billing-zip":s().when([],{is:()=>P("billing-zip",t)&&!e||e&&i==="input",then:t=>t.required("validation.zipRequired"),otherwise:t=>t.notRequired()}),bankId:s().when([],{is:()=>P("bankId",t),then:t=>t.required("validation.bankRequired"),otherwise:t=>t.notRequired()}),installments:s().when([],{is:()=>n===p.CARD&&c.data?.cardInformation?.installments?.isAvailableInstallments&&(c.data?.cardInformation?.installments?.installments?.length??0)>0&&c.data?.itemInformation?.type!==y.PLAN,then:t=>t.required("validation.installmentsRequired"),otherwise:t=>t.notRequired()}),documentType:s().when([],{is:()=>I(c.data?.pricing?.currency)&&((P("documentType",t)||P("documentNumber",t))&&!e||e&&i==="input"),then:t=>t.required("validation.documentTypeRequired"),otherwise:t=>t.notRequired()}),documentNumber:s().when([],{is:()=>I(c.data?.pricing?.currency)&&((P("documentNumber",t)||P("documentType",t))&&!e||e&&i==="input"),then:t=>{const e=t.required("validation.documentNumberRequired").min(7,"validation.documentInvalid");if(c.data?.pricing?.country==="BR"){return e.test("numeric-only","validation.documentNumberNumericOnly",(t=>{if(!t)return true;return/^\d+$/.test(t)}))}return e},otherwise:t=>t.notRequired()})}}getInitialData=()=>({email:c.data.userInformation.email||"",fullName:c.data.userInformation.fullName||"",phoneNumber:c.data.userInformation.phoneNumber?.number||"",countryCodePhoneNumber:c.data.userInformation.countryCode||"",documentType:"",documentNumber:"","billing-country":c.data.userInformation.address?.billingAddress?.country||"","billing-state":c.data.userInformation?.address?.billingAddress?.state||"","billing-address":c.data.userInformation?.address?.billingAddress?.address||"","billing-city":c.data.userInformation?.address?.billingAddress?.city||"","billing-zip":c.data.userInformation?.address?.billingAddress?.zip||"",bankId:c.data.bankId?.code||"",card:"",installments:c.data.cardInformation?.installments?.selectedInstallment?.installment?.toString()||""});hasPrefilledAddress=()=>{const t=["billing-country","billing-state","billing-address","billing-city","billing-zip"];return t.some((t=>{const e=this.initialData[t];return e&&e.trim()!==""}))};get isQrCodeVisible(){return!!this.checkoutResponse?.result?.data?.qrCode}get isBankTransferVisible(){return!!this.checkoutResponse?.result?.data?.account&&!!this.checkoutResponse?.result?.data?.bankName&&!!this.checkoutResponse?.result?.data?.reference}get isBoletoVisible(){return this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&!!this.checkoutResponse?.result?.data?.barcode}isPaymentApproved=()=>{if(c.data.paymentStatus===a.APPROVED){return true}return false};handleRebillAccountClick(t){this.showOtp=t.detail}handleReturnForm(t){this.showOtp=t.detail;u.clearCustomerIdAndToken()}handleSignOut(){this.showOtp=false;this.otpVerified=false;if(!c?.data?.prefilledData?.email){this.customerExists=false}u.clearCustomerIdAndToken();u.clearUserInformation();u.setCardId(null);u.setCardTokenId(null);this.cardMode="input";u.setCardMode("input");this.cardError={showCardInvalid:false,type:null};this.alertErrorKeys=null;this.rejectedPaymentCard=false;this.rejectedPaymentAPM=false}handleCodeVerified(){this.otpVerified=true;this.showOtp=false;this.rejectedPaymentCard=false;this.alertErrorKeys=null;this.cardError={showCardInvalid:false,type:null};if(this.formElement){this.formElement.resetValidation()}}isPaymentRejected(){return c.data.paymentStatus===a.REJECTED&&this.currentPaymentMethod===p.BANK_TRANSFER}render(){const t=this.countries.map((t=>({label:t.country,value:t.isoCountryCode})));const e=(t={})=>i("rebill-summary",{key:"27bf2a0eb744f9be27c6d11c9585a3db69c563f1",totalAmount:c.data.pricing.total,currency:c.data.pricing.currency,itemTitle:c._session?.getTitle(),itemDescription:c._session?.getDescription(),itemAmount:c.data.pricing.subtotal,subtotal:c.data.pricing.subtotal,allowCoupon:c._session?.getAllowCoupon(this.displayConfig),currentBreakpoint:this.breakpoint,planFrequency:c._session?.getPlanFrequency(),planFrequencyCount:c._session?.getPlanFrequencyCount(),discountType:c.data.discount.discountType,discountedPercentage:c.data.discount.discountedPercentage,discountDuration:c.data.discount.discountDuration,discountAmount:c.data.discount.discountAmount,initialCouponCode:this.couponCode,...t});return c.isInitialized&&i(i.Fragment,null,this.showRefreshModal&&i("rebill-modal-overlay",{key:"e8923ed0d91e204e56259842e998820586f04493"}),this.displayConfig.processingPayment&&i("rebill-processing-payment",{key:"48b27b39d74c703bdd1172c567255ce924dab0ce",style:{display:this.isCardSubmitting?"block":"none"}}),this.displayConfig.successPage&&this.isPaymentApproved()&&c.isInitialized?i("success-page",{typePaymentMethod:c.data.paymentMethodSelected,paymentMethodName:N.mapToAPMPaymentMethod(c.data.paymentMethodSelected||c.data.payment?.paymentMethodType,c.data?.pricing?.country),country:c.data?.pricing?.country,bank:c.data.payment?.paymentMethodMetadata?.bankName,cardLastFour:this.responseCheckoutCard?.result?.cardLastFour||c.data.cardInformation?.lastFour,paymentDate:c.data.paymentDate||this.responseCheckoutCard?.date||c.data.payment?.createdAt||this.checkoutResponse?.result?.data?.createdAt,referenceNumber:c.data.paymentReference||c.data.payment?.traceId||this.responseCheckoutCard?.traceId,onSuccessRedirect:t=>{this.successRedirect.emit(t.detail)},trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,debitDay:c.data?.itemInformation?.debitDay,planAmount:c.data?.pricing?.planAmount}):i(i.Fragment,null,this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===d.CHECKOUT_LANDING&&k(this.breakpoint,g.DESKTOP)&&i("div",{class:"mode-sandbox-mobile-container",style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"}},i("rebill-mode-sandbox-mobile",null)),i("rebill-checkout-form",{ref:t=>this.formElement=t,style:{display:this.isCardSubmitting||this.isCardSuccess?"none":"block"},validationSchema:this.validationSchema,initialData:this.initialData,onSubmit:t=>this.handleSubmit(t),onChange:t=>this.handleFormChange(t),renderForm:({submit:s,formData:n,errors:o})=>{const a=!this.isCardSuccess&&this.checkoutResponse?.result&&(this.currentPaymentMethod===p.CASH||this.currentPaymentMethod===p.BANK_TRANSFER);return i("div",{class:`rebill-checkout ${!this.displayConfig.checkoutSummary?"full-width-layout":""}`},i("div",{class:"left-section"},i("div",{class:"left-section-container"},this.displayConfig.logo&&i("organization-logo",{organization:c.data.organization}),i("div",{class:"otp-container",style:{display:this.showOtp?"block":"none"}},i("otp-component",null)),i("div",{style:{display:this.showOtp?"none":"block"}},i("div",{class:"checkout-form-section"},this.displayConfig.checkoutSummary&&i("div",{class:"summary-mobile-tablet",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},e({displayedComponents:["totalAmount","discount","timelineFreeTrial","timelineDebitDay","itemDetails"]})),!this.otpVerified&&this.displayConfig.customerInformation&&i("user-information",{customerExists:this.customerExists,disabled:this.isSubmitting,errors:{email:o.email,fullName:o.fullName}}),this.otpVerified&&this.displayConfig.customerInformation&&i("user-information-static",{variant:"otp",userInfo:{customerName:c.data.userInformation.fullName?.split(" ")[0],customerEmail:c.data.userInformation.email}}),i("div",{style:{display:"flex",flexDirection:"column",gap:"16px"}},i("payment-method-selector",{enabledPaymentMethods:this.filteredPaymentMethods,defaultSelected:this.currentPaymentMethod,disabled:this.isSubmitting,errorComponent:{showErrorComponent:this.displayConfig.errorMessage&&(this.currentPaymentError||this.isPaymentRejected()),alertTitle:l.getErrorTitle(this.currentPaymentMethod,c.data?.pricing?.country||"",this.alertErrorKeys?.alertTitle),message:l.getErrorMessage(this.alertErrorKeys?.message,this.currentPaymentMethod,c.data?.pricing?.country)},country:c.data?.pricing?.country,installmentsError:o.installments,showDocument:(!this.otpVerified||this.otpVerified&&this.cardMode==="input")&&!a&&!this.isQrCodeVisible&&I(c.data?.pricing?.currency)&&(P("documentNumber",this.currentRequiredFields)||P("documentType",this.currentRequiredFields)),documentTypeError:o.documentType,documentNumberError:o.documentNumber,cardError:this.cardError,customCSS:this.css}),!a&&(()=>{const t=P("bankId",this.currentRequiredFields);return t})()&&i("div",{class:"animated-component fade-in"},i("rebill-bank-selector",{banks:S("bank",this.allRequiredFields[this.currentPaymentMethod].original)||[],defaultSelectedBankId:n.bankId||"",error:o?.bankId,disabled:this.isSubmitting}))),!a&&(!this.otpVerified||this.cardMode==="input")&&i(i.Fragment,null,this.displayConfig.billingAddress&&(P("billing-country",this.currentRequiredFields)||P("billing-state",this.currentRequiredFields)||P("billing-address",this.currentRequiredFields)||P("billing-city",this.currentRequiredFields)||P("billing-zip",this.currentRequiredFields))&&i("div",{class:"animated-component slide-in"},i("rebill-address",{disabled:this.isSubmitting,countryOptions:t,billingView:(()=>{if(this.displayConfig.useAddressSearch!==undefined&&this.displayConfig.useAddressSearch===false){return"form"}return this.hasPrefilledAddress()?"form":"search"})(),errors:{"billing-country":o["billing-country"],"billing-state":o["billing-state"],"billing-address":o["billing-address"],"billing-city":o["billing-city"],"billing-zip":o["billing-zip"]}})),this.displayConfig.customerInformation&&P("phoneNumber",this.currentRequiredFields)&&i("div",{class:"animated-component fade-in"},i("user-information-phone",{disabled:this.isSubmitting,error:o?.phoneNumber||o?.isValidPhoneNumber,countryCode:c.data.userInformation?.countryCode||c.data.country}))),a&&(()=>{const t=this.currentPaymentMethod===p.CASH&&c.data?.pricing?.country==="BR"&&this.checkoutResponse?.result?.data?.barcode;return i("apm-checkout",{paymentMethod:this.currentPaymentMethod,barcode:t?this.checkoutResponse?.result?.data?.barcode:undefined,referenceId:this.currentPaymentMethod===p.CASH&&!t?this.checkoutResponse?.result?.data?.referenceId:undefined,qrCodeData:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.qrCode:undefined,code:this.currentPaymentMethod===p.BANK_TRANSFER?this.checkoutResponse?.result?.data?.code:undefined,checkoutRequestId:this.checkoutResponse?.result?.checkoutRequestId,providerName:c.data.providerKey,expirationDate:(()=>{const t=new Date;t.setDate(t.getDate()+30);return t.toISOString()})(),onPaymentStatusChange:t=>this.handlePaymentStatusChange(t.detail),country:c.data?.pricing?.country,redirectUrl:this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,bearerToken:this.checkoutResponse?.result?.data?.bearerToken,bankTransferData:this.checkoutResponse?.result?.data?.account&&this.checkoutResponse?.result?.data?.bankName&&this.checkoutResponse?.result?.data?.reference?{account:this.checkoutResponse.result.data.account,bankName:this.checkoutResponse.result.data.bankName,reference:this.checkoutResponse.result.data.reference}:undefined})})(),this.displayConfig.checkoutSummary&&i("div",{class:"summary-price-details",style:{display:k(this.breakpoint,g.DESKTOP)?"block":"none"}},e({displayedComponents:["priceDetails"]})),this.displayConfig.submitButton&&!(a&&(this.isQrCodeVisible||this.isBankTransferVisible||this.isBoletoVisible))&&i("div",{class:"payment-button-container"},i("payment-button",{paymentMethod:this.currentPaymentMethod,isLoading:this.isSubmitting,trialPeriodDays:c.data?.itemInformation?.trial?.trialPeriodDays,onSubmit:()=>{s()},redirectUrl:!!this.checkoutResponse?.result?.data?.url,timeToRedirect:this.timeToRedirectAPM,isDisabled:c.data.fetchingInstallments,country:c.data?.pricing?.country}),i("rebill-alert",{type:"secure",variant:"variant-secure",icon:"lock-outline",message:h.translate("otp.secureMessage")}))),this.displayConfig.sandboxMode&&c.isSandbox&&c.data.sessionType===d.CHECKOUT_LANDING&&!k(this.breakpoint,g.DESKTOP)&&i("rebill-mode-sandbox",null)),this.displayConfig.footer&&i("rebill-footer",{style:{marginTop:k(this.breakpoint,g.DESKTOP)?"24px":"auto"}}))),this.displayConfig.checkoutSummary&&i("div",{class:"right-section-checkout"},i("div",{class:"checkout-summary-section"},i("div",{class:"summary-desktop",style:{display:!k(this.breakpoint,g.DESKTOP)?"block":"none"}},e()))))}})))}static get watchers(){return{language:["handleLanguageChange"]}}};G.style=W;export{G as rebill_checkout};
2
+ //# sourceMappingURL=p-b72a46fd.entry.js.map
@@ -1,2 +1,2 @@
1
- import{p as e,b as t}from"./p-D8cwEAmw.js";export{s as setNonce}from"./p-D8cwEAmw.js";import{g as r}from"./p-DQuL1Twl.js";var a=()=>{const t=import.meta.url;const r={};if(t!==""){r.resourcesUrl=new URL(".",t).href}return e(r)};a().then((async e=>{await r();return t(JSON.parse('[["p-f3859b65",[[256,"rebill-checkout",{"productId":[1,"product-id"],"planId":[1,"plan-id"],"publicKey":[1,"public-key"],"instantProduct":[1,"instant-product"],"instantPlan":[1,"instant-plan"],"display":[1],"customerInformation":[1,"customer-information"],"oneClickCheckout":[4,"one-click-checkout"],"css":[1],"js":[1],"language":[1],"couponCode":[1,"coupon-code"],"checkoutLandingSession":[1,"checkout-landing-session"],"externalPayment":[1,"external-payment"],"rejectedPaymentCard":[32],"rejectedPaymentAPM":[32],"countries":[32],"currentPaymentMethod":[32],"checkoutResponse":[32],"isSubmitting":[32],"isCardSubmitting":[32],"isCardSuccess":[32],"isAPMSubmitting":[32],"isAPMSuccess":[32],"storedCheckoutResults":[32],"alertErrorKeys":[32],"currentApmPaymentMethod":[32],"breakpoint":[32],"showRefreshModal":[32],"cardError":[32],"initialData":[32],"allRequiredFields":[32],"currentRequiredFields":[32],"customerExists":[32],"showOtp":[32],"otpVerified":[32],"responseCheckoutCard":[32],"cardMode":[32],"submit":[64]},[[0,"paymentMethodSelected","handlePaymentMethodSelected"],[0,"input","handleInputChange"],[0,"onRebillAccountClick","handleRebillAccountClick"],[0,"returnForm","handleReturnForm"],[0,"signOut","handleSignOut"],[0,"codeVerified","handleCodeVerified"]],{"language":["handleLanguageChange"]}]]],["p-bf15156a",[[256,"rebill-renewal",{"renewalData":[1,"renewal-data"],"renewalToken":[1,"renewal-token"],"currentPaymentMethod":[32],"isSubmitting":[32],"isCardSubmitting":[32],"isCardSuccess":[32],"errorMessage":[32],"breakpoint":[32],"errorPaymentCard":[32],"errorPaymentAPM":[32],"initialData":[32],"checkoutResponse":[32],"currentApmPaymentMethod":[32],"countries":[32],"allRequiredFields":[32],"currentRequiredFields":[32],"errorCardInvalid":[32],"cardMode":[32]},[[0,"paymentMethodSelected","handlePaymentMethodSelected"],[0,"bankSelected","handleBankSelected"],[0,"cardSelected","handleCardSelected"]]]]],["p-b9a3b27f",[[256,"rebill-change-card",{"changeCardData":[1,"change-card-data"],"changeCardToken":[1,"change-card-token"],"isSubmitting":[32],"isCardSubmitting":[32],"isCardSuccess":[32],"errorMessage":[32],"breakpoint":[32],"errorPaymentCard":[32],"initialData":[32],"countries":[32],"allRequiredFields":[32],"currentRequiredFields":[32],"errorCardInvalid":[32],"cardMode":[32],"completedAt":[32]}]]],["p-70cf5bb8",[[256,"root-component",{"isLoading":[32],"currentLang":[32],"formData":[32]}]]],["p-85d3974b",[[256,"rebill-card-carousel",{"interval":[2],"size":[1],"color":[1],"showAllCards":[4,"show-all-cards"],"currentIndex":[32]}]]],["p-ecf4cff4",[[260,"rebill-flex-container",{"direction":[1],"wrap":[1],"gap":[1],"alignItems":[1,"align-items"],"justifyContent":[1,"justify-content"]}]]],["p-85a17349",[[260,"rebill-grid-container",{"columns":[2],"gap":[1],"alignItems":[1,"align-items"],"justifyContent":[1,"justify-content"]}]]],["p-2292f5cb",[[260,"rebill-typography",{"variant":[1],"color":[1],"align":[1],"noWrap":[4,"no-wrap"],"gutterBottom":[4,"gutter-bottom"],"paragraph":[4]}],[256,"rebill-icon",{"name":[1],"size":[1],"color":[1],"svgContent":[32]}]]],["p-3800e494",[[256,"renewal-success-page",{"typePaymentMethod":[1,"type-payment-method"],"country":[1],"bank":[1],"paymentMethodName":[1,"payment-method-name"],"cardLastFour":[1,"card-last-four"],"paymentDate":[1,"payment-date"],"referenceNumber":[1,"reference-number"],"trialPeriodDays":[2,"trial-period-days"],"debitDay":[2,"debit-day"],"planAmount":[2,"plan-amount"],"timeToRedirect":[2,"time-to-redirect"],"currentLocale":[32],"breakpoint":[32],"loaderProgress":[32],"isLoadingLottie":[32],"showRedirectMessage":[32]}]]],["p-41e57546",[[256,"change-card-success",{"customerName":[1,"customer-name"],"cardLastFour":[1,"card-last-four"],"cardBrand":[1,"card-brand"],"paymentDate":[1,"payment-date"],"customerEmail":[1,"customer-email"],"currentLocale":[32]}]]],["p-6ec7d549",[[256,"discount-coupon",{"hideLabel":[4,"hide-label"],"displayMode":[1,"display-mode"],"readonlyCouponCode":[1,"readonly-coupon-code"],"readonlyDiscountAmount":[2,"readonly-discount-amount"],"readonlyCurrency":[1,"readonly-currency"],"initialCouponCode":[1,"initial-coupon-code"],"couponCode":[32],"actionStatus":[32],"isLoading":[32],"isError":[32],"currentLocale":[32]}],[256,"rebill-divider"],[260,"collapsible-card",{"header":[1],"open":[4],"variant":[1],"isOpen":[32]}]]],["p-a6cdb7b1",[[256,"renewal-summary",{"displayedComponents":[16],"totalAmount":[2,"total-amount"],"subTotalAmount":[2,"sub-total-amount"],"subscriptionTitle":[1,"subscription-title"],"subscriptionAmount":[2,"subscription-amount"],"nextChargeDate":[1,"next-charge-date"],"frequency":[16],"currency":[1],"couponCode":[1,"coupon-code"],"discountAmount":[2,"discount-amount"],"discountPercentage":[2,"discount-percentage"],"titleKey":[1,"title-key"],"forceUpdate":[32]}]]],["p-ac778c24",[[256,"input-otp",{"error":[1],"otp":[1],"clearable":[4],"placeholder":[1],"otpValue":[32]}]]],["p-38d7cee1",[[260,"rebill-container",{"maxWidth":[1,"max-width"],"padding":[1],"fluid":[4]}],[256,"rebill-input-checkbox",{"label":[1],"checked":[1540],"error":[1],"id":[1],"disabled":[4]},[[4,"change","handleFormChange"]]]]],["p-04ba839d",[[256,"rebill-timeline-debit-day",{"debitDay":[2,"debit-day"],"totalAmount":[2,"total-amount"],"planAmount":[2,"plan-amount"],"currency":[1],"debitStrategy":[1,"debit-strategy"],"language":[1],"discountApplied":[4,"discount-applied"],"discountType":[1,"discount-type"],"discountedPercentage":[2,"discounted-percentage"],"discountDuration":[2,"discount-duration"],"discountAmount":[2,"discount-amount"],"currentLanguage":[32]}],[256,"rebill-timeline-free-trial",{"trialPeriodEndsAt":[1,"trial-period-ends-at"],"trialPeriodEndsReminderAt":[1,"trial-period-ends-reminder-at"],"trialPeriodDays":[2,"trial-period-days"],"subtotal":[2],"currency":[1],"language":[1],"discountApplied":[4,"discount-applied"],"discountType":[1,"discount-type"],"discountedPercentage":[2,"discounted-percentage"],"discountDuration":[2,"discount-duration"],"discountAmount":[2,"discount-amount"],"currentLanguage":[32]}]]],["p-e81d6673",[[256,"rebill-mode-sandbox",{"isPanelVisible":[32],"isPanelClosing":[32],"isCardsPanelVisible":[32],"isCardsPanelClosing":[32],"currentLanguage":[32]}],[256,"rebill-mode-sandbox-mobile",{"isPanelVisible":[32],"currentLanguage":[32]}]]],["p-6d59117f",[[256,"rebill-card",{"cardTitle":[1,"card-title"],"cardLabels":[16]}],[256,"rebill-input-email",{"label":[1],"placeholder":[1],"value":[1537],"error":[1],"id":[1],"disabled":[4],"leftIcon":[1,"left-icon"],"clearable":[4],"variant":[1],"emailSuggestions":[32],"highlightedSuggestionIndex":[32],"emailCorrectionSuggestion":[32],"dropdownPosition":[32],"getInputElement":[64]},[[4,"change","handleFormChange"],[4,"click","handleDocumentClick"],[5,"touchend","handleDocumentTouchEnd"]]]]],["p-d616792b",[[256,"rebill-vertical-divider",{"height":[1],"color":[1],"thickness":[1],"dashed":[4],"connectorActive":[4,"connector-active"],"withDot":[4,"with-dot"]}]]],["p-ee5e293c",[[256,"rebill-alert",{"type":[1],"message":[1],"alertTitle":[1,"alert-title"],"icon":[1],"variant":[1],"size":[1],"colorIcon":[1,"color-icon"]}]]],["p-03e56f51",[[256,"rebill-input-text",{"label":[1],"placeholder":[1],"value":[1537],"error":[1],"id":[1],"disabled":[4],"leftIcon":[1,"left-icon"],"rightIcon":[1,"right-icon"],"clearable":[4],"variant":[1],"uppercase":[4],"getInputElement":[64]},[[4,"change","handleFormChange"]]]]],["p-644f0d63",[[256,"rebill-input-select",{"label":[1],"options":[16],"value":[1537],"error":[1],"id":[1],"disabled":[4],"placeholder":[1],"variant":[1],"arrowIcon":[1,"arrow-icon"],"dropPosition":[1,"drop-position"],"fontSize":[1,"font-size"],"backgroundColor":[1,"background-color"],"searchable":[4],"searchPlaceholder":[1,"search-placeholder"],"loading":[4],"isOpen":[32],"componentId":[32],"highlightedIndex":[32],"searchTerm":[32],"filteredOptions":[32],"languageUpdateTrigger":[32]},[[4,"change","handleFormChange"],[4,"closeAllSelects","handleCloseAllSelects"],[4,"click","handleDocumentClick"],[0,"keydown","handleKeyDown"]]]]],["p-4b8ba30e",[[260,"rebill-button",{"type":[1],"disabled":[4],"id":[1],"loading":[4],"showSpinnerWithText":[4,"show-spinner-with-text"],"nonClickable":[4,"non-clickable"],"variant":[1],"theme":[1],"size":[1],"icon":[1],"iconColor":[1,"icon-color"]}]]],["p-ba4d1631",[[256,"rebill-card-icon",{"cardBrand":[1,"card-brand"],"width":[2],"height":[2]}],[260,"rebill-checkout-single-column"],[256,"rebill-footer",{"breakpoint":[32]}],[256,"organization-logo",{"organization":[16]}]]],["p-1071451c",[[256,"rebill-summary",{"totalAmount":[8,"total-amount"],"itemTitle":[1,"item-title"],"itemDescription":[1,"item-description"],"itemAmount":[8,"item-amount"],"planFrequency":[1,"plan-frequency"],"planFrequencyCount":[2,"plan-frequency-count"],"subtotal":[8],"discount":[8],"currency":[1],"displayedComponents":[16],"allowCoupon":[4,"allow-coupon"],"currentBreakpoint":[1,"current-breakpoint"],"initialCouponCode":[1,"initial-coupon-code"],"discountType":[1,"discount-type"],"discountedPercentage":[2,"discounted-percentage"],"discountDuration":[2,"discount-duration"],"discountAmount":[2,"discount-amount"],"discountApplied":[32]},[[0,"discountApplied","handleDiscountApplied"]]],[256,"success-page",{"typePaymentMethod":[1,"type-payment-method"],"country":[1],"bank":[1],"paymentMethodName":[1,"payment-method-name"],"cardLastFour":[1,"card-last-four"],"paymentDate":[1,"payment-date"],"referenceNumber":[1,"reference-number"],"trialPeriodDays":[2,"trial-period-days"],"debitDay":[2,"debit-day"],"planAmount":[2,"plan-amount"],"timeToRedirect":[2,"time-to-redirect"],"currentLocale":[32],"breakpoint":[32],"loaderProgress":[32],"isLoadingLottie":[32],"showRedirectMessage":[32]}],[256,"user-information",{"userInformation":[16],"errors":[16],"customerExists":[4,"customer-exists"],"disabled":[4]},[[0,"input","handleInputChange"],[0,"blur","handleBlur"]]],[256,"otp-component",{"timeLeft":[32],"isTimerRunning":[32],"codeResent":[32],"isVerifying":[32],"otpValue":[32],"error":[32]}],[256,"rebill-modal-overlay",{"visible":[32],"languageUpdateTrigger":[32]}]]],["p-3a703f22",[[260,"rebill-autofill-detector",{"targetSelector":[1,"target-selector"],"disabled":[4],"browserAutocompleteDetected":[32],"disabledDetector":[32]}]]],["p-10d543f4",[[260,"rebill-form",{"validationSchema":[8,"validation-schema"],"initialData":[16],"renderForm":[16],"formData":[32],"errors":[32],"submitForm":[64],"resetValidation":[64],"clearError":[64]},[[0,"input","handleInputChange"],[0,"blur","handleBlur"]],{"initialData":["handleInitialDataChange"],"validationSchema":["handleValidationSchemaChange"]}]]],["p-c327a984",[[256,"card-fields-wrapper",{"installmentsError":[1,"installments-error"],"documentTypeError":[1,"document-type-error"],"documentNumberError":[1,"document-number-error"],"showDocument":[4,"show-document"],"customCSS":[1,"custom-c-s-s"]}],[256,"rebill-address-form",{"addressType":[1,"address-type"],"countryOptions":[16],"stateOptions":[16],"errors":[16],"disabled":[4],"showAdditionalInformation":[32]}],[256,"rebill-address-search",{"addressType":[1,"address-type"],"placeholder":[1],"error":[1],"disabled":[4],"value":[1],"showManualEntryLink":[4,"show-manual-entry-link"],"isInitialized":[32],"currentLocale":[32],"editingValue":[32],"justSelectedPlace":[32]},null,{"value":["valueWatcher"],"error":["errorWatcher"],"disabled":["disabledWatcher"]}],[256,"single-payment-method",{"paymentMethod":[1,"payment-method"],"currencyCountry":[1,"currency-country"],"paymentMethodDetails":[16],"icons":[16]}],[256,"rebill-input-phone",{"placeholder":[1],"value":[1537],"error":[1],"phoneNumberId":[1,"phone-number-id"],"countryCodeId":[1,"country-code-id"],"validationErrorId":[1,"validation-error-id"],"disabled":[4],"initialCountry":[1,"initial-country"],"required":[4],"searchable":[4],"searchPlaceholder":[1,"search-placeholder"],"selectedCountry":[32],"isDropdownOpen":[32],"validationError":[32],"searchTerm":[32],"filteredCountries":[32],"componentId":[32],"languageUpdateTrigger":[32]},[[4,"change","handleFormChange"],[4,"closeAllSelects","handleCloseAllSelects"],[4,"click","handleDocumentClick"]]],[260,"selectable-card",{"selected":[4],"label":[1],"cardKey":[1,"card-key"],"disabled":[4]}],[256,"rebill-installments",{"error":[1],"currentValue":[32],"isDisabled":[32],"value":[32],"placeholder":[32]}],[256,"card-identification",{"documentTypeError":[1,"document-type-error"],"documentNumberError":[1,"document-number-error"],"disabled":[4],"documentTypes":[32],"country":[32],"currentLanguage":[32]}],[256,"card-iframe",{"customCSS":[1,"custom-c-s-s"],"iframeLoaded":[32],"currentLang":[32],"initialLang":[32],"iframeHeight":[32],"showCvcTooltip":[32],"tooltipPosition":[32]}],[256,"rebill-input-combo",{"label":[1],"options":[16],"selectValue":[1537,"select-value"],"inputValue":[1537,"input-value"],"inputPlaceholder":[1,"input-placeholder"],"selectPlaceholder":[1,"select-placeholder"],"error":[1],"selectId":[1,"select-id"],"inputId":[1,"input-id"],"disabled":[4],"selectWidth":[1,"select-width"],"isOpen":[32],"highlightedIndex":[32],"componentId":[32]},[[4,"change","handleFormChange"],[4,"closeAllSelects","handleCloseAllSelects"],[4,"click","handleDocumentClick"]]],[256,"card-skeleton"]]],["p-9fa0e894",[[256,"apm-checkout",{"paymentMethod":[1,"payment-method"],"referenceId":[1,"reference-id"],"qrCodeData":[1,"qr-code-data"],"code":[1],"providerName":[1,"provider-name"],"expirationDate":[1,"expiration-date"],"country":[1],"redirectUrl":[1,"redirect-url"],"timeToRedirect":[2,"time-to-redirect"],"checkoutRequestId":[1,"checkout-request-id"],"bearerToken":[1,"bearer-token"],"bankTransferData":[8,"bank-transfer-data"],"barcode":[1],"amount":[2],"currency":[1],"showRedirectMessage":[32],"isPolling":[32],"minutesLeft":[32],"qrStartTime":[32],"downloadData":[32]}],[256,"rebill-bank-selector",{"banks":[16],"defaultSelectedBankId":[1,"default-selected-bank-id"],"error":[1],"disabled":[4],"selectedBankId":[32],"languageUpdateTrigger":[32]}],[256,"payment-method-selector",{"enabledPaymentMethods":[16],"defaultSelected":[1,"default-selected"],"showErrorComponent":[4,"show-error-component"],"cardError":[16],"country":[1],"installmentsError":[1,"installments-error"],"documentTypeError":[1,"document-type-error"],"showDocument":[4,"show-document"],"documentNumberError":[1,"document-number-error"],"customCSS":[1,"custom-c-s-s"],"errorComponent":[16],"disabled":[4],"icon":[32],"selectedPaymentMethod":[32],"saveCard":[32]},[[0,"selectableCardClick","handleSelectableCardClick"]]],[256,"rebill-address",{"billingView":[1537,"billing-view"],"disabled":[4],"countryOptions":[16],"errors":[16],"currentBillingStateOptions":[32],"isLoadingAddress":[32],"addressLine":[32],"addressCommitted":[32]}],[256,"rebill-processing-payment",{"titleKey":[1,"title-key"],"subtitleKey":[1,"subtitle-key"],"currentLocale":[32],"breakpoint":[32],"loaderProgress":[32],"isLoadingLottie":[32]}],[256,"bank-transfer",{"bankTransferData":[8,"bank-transfer-data"]}],[256,"qr-code",{"qrCodeData":[1,"qr-code-data"],"providerName":[1,"provider-name"],"expirationDate":[1,"expiration-date"],"paymentMethod":[1,"payment-method"],"code":[1],"qrCodeSvg":[32],"isImage":[32],"timeLeft":[32],"formattedTime":[32],"hasCopied":[32]}],[256,"user-information-static",{"userInfo":[16],"variant":[1]}],[256,"apm-download",{"data":[16]}],[256,"payment-button",{"isDisabled":[4,"is-disabled"],"isLoading":[4,"is-loading"],"paymentMethod":[1,"payment-method"],"isRenewal":[4,"is-renewal"],"isChangeCard":[4,"is-change-card"],"trialPeriodDays":[2,"trial-period-days"],"redirectUrl":[4,"redirect-url"],"timeToRedirect":[2,"time-to-redirect"],"country":[1],"currentLanguage":[32],"countdownSeconds":[32],"paymentMethodDisplayName":[32]},null,{"redirectUrl":["onRedirectPropsChange"],"timeToRedirect":["onRedirectPropsChange"]}],[256,"user-information-phone",{"error":[1],"countryCode":[1,"country-code"],"disabled":[4],"languageUpdateTrigger":[32]}],[256,"boleto-payment",{"barcode":[1],"referenceId":[1,"reference-id"],"providerName":[1,"provider-name"],"expirationDate":[1,"expiration-date"],"instructions":[16],"showInstructions":[32],"hasCopied":[32]}],[256,"rebill-checkout-form",{"validationSchema":[8,"validation-schema"],"initialData":[16],"renderForm":[16],"resetValidation":[64]},[[0,"change","handleFormChange"]]],[256,"reference-code",{"referenceId":[1,"reference-id"],"providerName":[1,"provider-name"],"expirationDate":[1,"expiration-date"],"instructions":[16],"showInstructions":[32]}]]]]'),e)}));
1
+ import{p as e,b as t}from"./p-D8cwEAmw.js";export{s as setNonce}from"./p-D8cwEAmw.js";import{g as r}from"./p-DQuL1Twl.js";var a=()=>{const t=import.meta.url;const r={};if(t!==""){r.resourcesUrl=new URL(".",t).href}return e(r)};a().then((async e=>{await r();return t(JSON.parse('[["p-b72a46fd",[[256,"rebill-checkout",{"productId":[1,"product-id"],"planId":[1,"plan-id"],"publicKey":[1,"public-key"],"instantProduct":[1,"instant-product"],"instantPlan":[1,"instant-plan"],"display":[1],"customerInformation":[1,"customer-information"],"oneClickCheckout":[4,"one-click-checkout"],"css":[1],"js":[1],"language":[1],"couponCode":[1,"coupon-code"],"checkoutLandingSession":[1,"checkout-landing-session"],"externalPayment":[1,"external-payment"],"rejectedPaymentCard":[32],"rejectedPaymentAPM":[32],"countries":[32],"currentPaymentMethod":[32],"checkoutResponse":[32],"isSubmitting":[32],"isCardSubmitting":[32],"isCardSuccess":[32],"isAPMSubmitting":[32],"isAPMSuccess":[32],"storedCheckoutResults":[32],"alertErrorKeys":[32],"currentApmPaymentMethod":[32],"breakpoint":[32],"showRefreshModal":[32],"cardError":[32],"initialData":[32],"allRequiredFields":[32],"currentRequiredFields":[32],"customerExists":[32],"showOtp":[32],"otpVerified":[32],"responseCheckoutCard":[32],"cardMode":[32],"submit":[64]},[[0,"paymentMethodSelected","handlePaymentMethodSelected"],[0,"input","handleInputChange"],[0,"onRebillAccountClick","handleRebillAccountClick"],[0,"returnForm","handleReturnForm"],[0,"signOut","handleSignOut"],[0,"codeVerified","handleCodeVerified"]],{"language":["handleLanguageChange"]}]]],["p-1c1cb576",[[256,"rebill-renewal",{"renewalData":[1,"renewal-data"],"renewalToken":[1,"renewal-token"],"currentPaymentMethod":[32],"isSubmitting":[32],"isCardSubmitting":[32],"isCardSuccess":[32],"errorMessage":[32],"breakpoint":[32],"errorPaymentCard":[32],"errorPaymentAPM":[32],"initialData":[32],"checkoutResponse":[32],"currentApmPaymentMethod":[32],"countries":[32],"allRequiredFields":[32],"currentRequiredFields":[32],"errorCardInvalid":[32],"cardMode":[32]},[[0,"paymentMethodSelected","handlePaymentMethodSelected"],[0,"bankSelected","handleBankSelected"],[0,"cardSelected","handleCardSelected"]]]]],["p-43dc2877",[[256,"rebill-change-card",{"changeCardData":[1,"change-card-data"],"changeCardToken":[1,"change-card-token"],"isSubmitting":[32],"isCardSubmitting":[32],"isCardSuccess":[32],"errorMessage":[32],"breakpoint":[32],"errorPaymentCard":[32],"initialData":[32],"countries":[32],"allRequiredFields":[32],"currentRequiredFields":[32],"errorCardInvalid":[32],"cardMode":[32],"completedAt":[32]}]]],["p-70cf5bb8",[[256,"root-component",{"isLoading":[32],"currentLang":[32],"formData":[32]}]]],["p-85d3974b",[[256,"rebill-card-carousel",{"interval":[2],"size":[1],"color":[1],"showAllCards":[4,"show-all-cards"],"currentIndex":[32]}]]],["p-ecf4cff4",[[260,"rebill-flex-container",{"direction":[1],"wrap":[1],"gap":[1],"alignItems":[1,"align-items"],"justifyContent":[1,"justify-content"]}]]],["p-85a17349",[[260,"rebill-grid-container",{"columns":[2],"gap":[1],"alignItems":[1,"align-items"],"justifyContent":[1,"justify-content"]}]]],["p-2292f5cb",[[260,"rebill-typography",{"variant":[1],"color":[1],"align":[1],"noWrap":[4,"no-wrap"],"gutterBottom":[4,"gutter-bottom"],"paragraph":[4]}],[256,"rebill-icon",{"name":[1],"size":[1],"color":[1],"svgContent":[32]}]]],["p-3800e494",[[256,"renewal-success-page",{"typePaymentMethod":[1,"type-payment-method"],"country":[1],"bank":[1],"paymentMethodName":[1,"payment-method-name"],"cardLastFour":[1,"card-last-four"],"paymentDate":[1,"payment-date"],"referenceNumber":[1,"reference-number"],"trialPeriodDays":[2,"trial-period-days"],"debitDay":[2,"debit-day"],"planAmount":[2,"plan-amount"],"timeToRedirect":[2,"time-to-redirect"],"currentLocale":[32],"breakpoint":[32],"loaderProgress":[32],"isLoadingLottie":[32],"showRedirectMessage":[32]}]]],["p-41e57546",[[256,"change-card-success",{"customerName":[1,"customer-name"],"cardLastFour":[1,"card-last-four"],"cardBrand":[1,"card-brand"],"paymentDate":[1,"payment-date"],"customerEmail":[1,"customer-email"],"currentLocale":[32]}]]],["p-6ec7d549",[[256,"discount-coupon",{"hideLabel":[4,"hide-label"],"displayMode":[1,"display-mode"],"readonlyCouponCode":[1,"readonly-coupon-code"],"readonlyDiscountAmount":[2,"readonly-discount-amount"],"readonlyCurrency":[1,"readonly-currency"],"initialCouponCode":[1,"initial-coupon-code"],"couponCode":[32],"actionStatus":[32],"isLoading":[32],"isError":[32],"currentLocale":[32]}],[256,"rebill-divider"],[260,"collapsible-card",{"header":[1],"open":[4],"variant":[1],"isOpen":[32]}]]],["p-a6cdb7b1",[[256,"renewal-summary",{"displayedComponents":[16],"totalAmount":[2,"total-amount"],"subTotalAmount":[2,"sub-total-amount"],"subscriptionTitle":[1,"subscription-title"],"subscriptionAmount":[2,"subscription-amount"],"nextChargeDate":[1,"next-charge-date"],"frequency":[16],"currency":[1],"couponCode":[1,"coupon-code"],"discountAmount":[2,"discount-amount"],"discountPercentage":[2,"discount-percentage"],"titleKey":[1,"title-key"],"forceUpdate":[32]}]]],["p-ac778c24",[[256,"input-otp",{"error":[1],"otp":[1],"clearable":[4],"placeholder":[1],"otpValue":[32]}]]],["p-38d7cee1",[[260,"rebill-container",{"maxWidth":[1,"max-width"],"padding":[1],"fluid":[4]}],[256,"rebill-input-checkbox",{"label":[1],"checked":[1540],"error":[1],"id":[1],"disabled":[4]},[[4,"change","handleFormChange"]]]]],["p-04ba839d",[[256,"rebill-timeline-debit-day",{"debitDay":[2,"debit-day"],"totalAmount":[2,"total-amount"],"planAmount":[2,"plan-amount"],"currency":[1],"debitStrategy":[1,"debit-strategy"],"language":[1],"discountApplied":[4,"discount-applied"],"discountType":[1,"discount-type"],"discountedPercentage":[2,"discounted-percentage"],"discountDuration":[2,"discount-duration"],"discountAmount":[2,"discount-amount"],"currentLanguage":[32]}],[256,"rebill-timeline-free-trial",{"trialPeriodEndsAt":[1,"trial-period-ends-at"],"trialPeriodEndsReminderAt":[1,"trial-period-ends-reminder-at"],"trialPeriodDays":[2,"trial-period-days"],"subtotal":[2],"currency":[1],"language":[1],"discountApplied":[4,"discount-applied"],"discountType":[1,"discount-type"],"discountedPercentage":[2,"discounted-percentage"],"discountDuration":[2,"discount-duration"],"discountAmount":[2,"discount-amount"],"currentLanguage":[32]}]]],["p-e81d6673",[[256,"rebill-mode-sandbox",{"isPanelVisible":[32],"isPanelClosing":[32],"isCardsPanelVisible":[32],"isCardsPanelClosing":[32],"currentLanguage":[32]}],[256,"rebill-mode-sandbox-mobile",{"isPanelVisible":[32],"currentLanguage":[32]}]]],["p-6d59117f",[[256,"rebill-card",{"cardTitle":[1,"card-title"],"cardLabels":[16]}],[256,"rebill-input-email",{"label":[1],"placeholder":[1],"value":[1537],"error":[1],"id":[1],"disabled":[4],"leftIcon":[1,"left-icon"],"clearable":[4],"variant":[1],"emailSuggestions":[32],"highlightedSuggestionIndex":[32],"emailCorrectionSuggestion":[32],"dropdownPosition":[32],"getInputElement":[64]},[[4,"change","handleFormChange"],[4,"click","handleDocumentClick"],[5,"touchend","handleDocumentTouchEnd"]]]]],["p-d616792b",[[256,"rebill-vertical-divider",{"height":[1],"color":[1],"thickness":[1],"dashed":[4],"connectorActive":[4,"connector-active"],"withDot":[4,"with-dot"]}]]],["p-ee5e293c",[[256,"rebill-alert",{"type":[1],"message":[1],"alertTitle":[1,"alert-title"],"icon":[1],"variant":[1],"size":[1],"colorIcon":[1,"color-icon"]}]]],["p-03e56f51",[[256,"rebill-input-text",{"label":[1],"placeholder":[1],"value":[1537],"error":[1],"id":[1],"disabled":[4],"leftIcon":[1,"left-icon"],"rightIcon":[1,"right-icon"],"clearable":[4],"variant":[1],"uppercase":[4],"getInputElement":[64]},[[4,"change","handleFormChange"]]]]],["p-644f0d63",[[256,"rebill-input-select",{"label":[1],"options":[16],"value":[1537],"error":[1],"id":[1],"disabled":[4],"placeholder":[1],"variant":[1],"arrowIcon":[1,"arrow-icon"],"dropPosition":[1,"drop-position"],"fontSize":[1,"font-size"],"backgroundColor":[1,"background-color"],"searchable":[4],"searchPlaceholder":[1,"search-placeholder"],"loading":[4],"isOpen":[32],"componentId":[32],"highlightedIndex":[32],"searchTerm":[32],"filteredOptions":[32],"languageUpdateTrigger":[32]},[[4,"change","handleFormChange"],[4,"closeAllSelects","handleCloseAllSelects"],[4,"click","handleDocumentClick"],[0,"keydown","handleKeyDown"]]]]],["p-4b8ba30e",[[260,"rebill-button",{"type":[1],"disabled":[4],"id":[1],"loading":[4],"showSpinnerWithText":[4,"show-spinner-with-text"],"nonClickable":[4,"non-clickable"],"variant":[1],"theme":[1],"size":[1],"icon":[1],"iconColor":[1,"icon-color"]}]]],["p-ba4d1631",[[256,"rebill-card-icon",{"cardBrand":[1,"card-brand"],"width":[2],"height":[2]}],[260,"rebill-checkout-single-column"],[256,"rebill-footer",{"breakpoint":[32]}],[256,"organization-logo",{"organization":[16]}]]],["p-1071451c",[[256,"rebill-summary",{"totalAmount":[8,"total-amount"],"itemTitle":[1,"item-title"],"itemDescription":[1,"item-description"],"itemAmount":[8,"item-amount"],"planFrequency":[1,"plan-frequency"],"planFrequencyCount":[2,"plan-frequency-count"],"subtotal":[8],"discount":[8],"currency":[1],"displayedComponents":[16],"allowCoupon":[4,"allow-coupon"],"currentBreakpoint":[1,"current-breakpoint"],"initialCouponCode":[1,"initial-coupon-code"],"discountType":[1,"discount-type"],"discountedPercentage":[2,"discounted-percentage"],"discountDuration":[2,"discount-duration"],"discountAmount":[2,"discount-amount"],"discountApplied":[32]},[[0,"discountApplied","handleDiscountApplied"]]],[256,"success-page",{"typePaymentMethod":[1,"type-payment-method"],"country":[1],"bank":[1],"paymentMethodName":[1,"payment-method-name"],"cardLastFour":[1,"card-last-four"],"paymentDate":[1,"payment-date"],"referenceNumber":[1,"reference-number"],"trialPeriodDays":[2,"trial-period-days"],"debitDay":[2,"debit-day"],"planAmount":[2,"plan-amount"],"timeToRedirect":[2,"time-to-redirect"],"currentLocale":[32],"breakpoint":[32],"loaderProgress":[32],"isLoadingLottie":[32],"showRedirectMessage":[32]}],[256,"user-information",{"userInformation":[16],"errors":[16],"customerExists":[4,"customer-exists"],"disabled":[4]},[[0,"input","handleInputChange"],[0,"blur","handleBlur"]]],[256,"otp-component",{"timeLeft":[32],"isTimerRunning":[32],"codeResent":[32],"isVerifying":[32],"otpValue":[32],"error":[32]}],[256,"rebill-modal-overlay",{"visible":[32],"languageUpdateTrigger":[32]}]]],["p-3a703f22",[[260,"rebill-autofill-detector",{"targetSelector":[1,"target-selector"],"disabled":[4],"browserAutocompleteDetected":[32],"disabledDetector":[32]}]]],["p-10d543f4",[[260,"rebill-form",{"validationSchema":[8,"validation-schema"],"initialData":[16],"renderForm":[16],"formData":[32],"errors":[32],"submitForm":[64],"resetValidation":[64],"clearError":[64]},[[0,"input","handleInputChange"],[0,"blur","handleBlur"]],{"initialData":["handleInitialDataChange"],"validationSchema":["handleValidationSchemaChange"]}]]],["p-247a086e",[[256,"card-fields-wrapper",{"installmentsError":[1,"installments-error"],"documentTypeError":[1,"document-type-error"],"documentNumberError":[1,"document-number-error"],"showDocument":[4,"show-document"],"customCSS":[1,"custom-c-s-s"]}],[256,"rebill-address-form",{"addressType":[1,"address-type"],"countryOptions":[16],"stateOptions":[16],"errors":[16],"disabled":[4],"showAdditionalInformation":[32]}],[256,"rebill-address-search",{"addressType":[1,"address-type"],"placeholder":[1],"error":[1],"disabled":[4],"value":[1],"showManualEntryLink":[4,"show-manual-entry-link"],"isInitialized":[32],"currentLocale":[32],"editingValue":[32],"justSelectedPlace":[32]},null,{"value":["valueWatcher"],"error":["errorWatcher"],"disabled":["disabledWatcher"]}],[256,"single-payment-method",{"paymentMethod":[1,"payment-method"],"currencyCountry":[1,"currency-country"],"paymentMethodDetails":[16],"icons":[16]}],[256,"rebill-input-phone",{"placeholder":[1],"value":[1537],"error":[1],"phoneNumberId":[1,"phone-number-id"],"countryCodeId":[1,"country-code-id"],"validationErrorId":[1,"validation-error-id"],"disabled":[4],"initialCountry":[1,"initial-country"],"required":[4],"searchable":[4],"searchPlaceholder":[1,"search-placeholder"],"selectedCountry":[32],"isDropdownOpen":[32],"validationError":[32],"searchTerm":[32],"filteredCountries":[32],"componentId":[32],"languageUpdateTrigger":[32]},[[4,"change","handleFormChange"],[4,"closeAllSelects","handleCloseAllSelects"],[4,"click","handleDocumentClick"]]],[260,"selectable-card",{"selected":[4],"label":[1],"cardKey":[1,"card-key"],"disabled":[4]}],[256,"rebill-installments",{"error":[1],"currentValue":[32],"isDisabled":[32],"value":[32],"placeholder":[32]}],[256,"card-identification",{"documentTypeError":[1,"document-type-error"],"documentNumberError":[1,"document-number-error"],"disabled":[4],"documentTypes":[32],"country":[32],"currentLanguage":[32]}],[256,"card-iframe",{"customCSS":[1,"custom-c-s-s"],"iframeLoaded":[32],"currentLang":[32],"initialLang":[32],"iframeHeight":[32],"showCvcTooltip":[32],"tooltipPosition":[32]}],[256,"rebill-input-combo",{"label":[1],"options":[16],"selectValue":[1537,"select-value"],"inputValue":[1537,"input-value"],"inputPlaceholder":[1,"input-placeholder"],"selectPlaceholder":[1,"select-placeholder"],"error":[1],"selectId":[1,"select-id"],"inputId":[1,"input-id"],"disabled":[4],"selectWidth":[1,"select-width"],"isOpen":[32],"highlightedIndex":[32],"componentId":[32]},[[4,"change","handleFormChange"],[4,"closeAllSelects","handleCloseAllSelects"],[4,"click","handleDocumentClick"]]],[256,"card-skeleton"]]],["p-9fa0e894",[[256,"apm-checkout",{"paymentMethod":[1,"payment-method"],"referenceId":[1,"reference-id"],"qrCodeData":[1,"qr-code-data"],"code":[1],"providerName":[1,"provider-name"],"expirationDate":[1,"expiration-date"],"country":[1],"redirectUrl":[1,"redirect-url"],"timeToRedirect":[2,"time-to-redirect"],"checkoutRequestId":[1,"checkout-request-id"],"bearerToken":[1,"bearer-token"],"bankTransferData":[8,"bank-transfer-data"],"barcode":[1],"amount":[2],"currency":[1],"showRedirectMessage":[32],"isPolling":[32],"minutesLeft":[32],"qrStartTime":[32],"downloadData":[32]}],[256,"rebill-bank-selector",{"banks":[16],"defaultSelectedBankId":[1,"default-selected-bank-id"],"error":[1],"disabled":[4],"selectedBankId":[32],"languageUpdateTrigger":[32]}],[256,"payment-method-selector",{"enabledPaymentMethods":[16],"defaultSelected":[1,"default-selected"],"showErrorComponent":[4,"show-error-component"],"cardError":[16],"country":[1],"installmentsError":[1,"installments-error"],"documentTypeError":[1,"document-type-error"],"showDocument":[4,"show-document"],"documentNumberError":[1,"document-number-error"],"customCSS":[1,"custom-c-s-s"],"errorComponent":[16],"disabled":[4],"icon":[32],"selectedPaymentMethod":[32],"saveCard":[32]},[[0,"selectableCardClick","handleSelectableCardClick"]]],[256,"rebill-address",{"billingView":[1537,"billing-view"],"disabled":[4],"countryOptions":[16],"errors":[16],"currentBillingStateOptions":[32],"isLoadingAddress":[32],"addressLine":[32],"addressCommitted":[32]}],[256,"rebill-processing-payment",{"titleKey":[1,"title-key"],"subtitleKey":[1,"subtitle-key"],"currentLocale":[32],"breakpoint":[32],"loaderProgress":[32],"isLoadingLottie":[32]}],[256,"bank-transfer",{"bankTransferData":[8,"bank-transfer-data"]}],[256,"qr-code",{"qrCodeData":[1,"qr-code-data"],"providerName":[1,"provider-name"],"expirationDate":[1,"expiration-date"],"paymentMethod":[1,"payment-method"],"code":[1],"qrCodeSvg":[32],"isImage":[32],"timeLeft":[32],"formattedTime":[32],"hasCopied":[32]}],[256,"user-information-static",{"userInfo":[16],"variant":[1]}],[256,"apm-download",{"data":[16]}],[256,"payment-button",{"isDisabled":[4,"is-disabled"],"isLoading":[4,"is-loading"],"paymentMethod":[1,"payment-method"],"isRenewal":[4,"is-renewal"],"isChangeCard":[4,"is-change-card"],"trialPeriodDays":[2,"trial-period-days"],"redirectUrl":[4,"redirect-url"],"timeToRedirect":[2,"time-to-redirect"],"country":[1],"currentLanguage":[32],"countdownSeconds":[32],"paymentMethodDisplayName":[32]},null,{"redirectUrl":["onRedirectPropsChange"],"timeToRedirect":["onRedirectPropsChange"]}],[256,"user-information-phone",{"error":[1],"countryCode":[1,"country-code"],"disabled":[4],"languageUpdateTrigger":[32]}],[256,"boleto-payment",{"barcode":[1],"referenceId":[1,"reference-id"],"providerName":[1,"provider-name"],"expirationDate":[1,"expiration-date"],"instructions":[16],"showInstructions":[32],"hasCopied":[32]}],[256,"rebill-checkout-form",{"validationSchema":[8,"validation-schema"],"initialData":[16],"renderForm":[16],"resetValidation":[64]},[[0,"change","handleFormChange"]]],[256,"reference-code",{"referenceId":[1,"reference-id"],"providerName":[1,"provider-name"],"expirationDate":[1,"expiration-date"],"instructions":[16],"showInstructions":[32]}]]]]'),e)}));
2
2
  //# sourceMappingURL=rebill-web-components-sdk.esm.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rebill-web-components-sdk",
3
- "version": "1.13.21",
3
+ "version": "1.13.22",
4
4
  "description": "Stencil Component Starter",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"file":"google-maps.service-CZcMzFBX.js","sources":["src/utils/google-maps.service.ts"],"sourcesContent":["export interface AddressComponents {\n address: string;\n city: string;\n state: string;\n country: string;\n zip: string;\n addInformation?: string;\n formattedAddress?: string; // Dirección completa de Google para usar como fallback\n}\n\nexport class GoogleMapsService {\n private static instance: GoogleMapsService;\n private isLoaded: boolean = false;\n private loadPromise: Promise<boolean> | null = null;\n\n static getInstance(): GoogleMapsService {\n if (!GoogleMapsService.instance) {\n GoogleMapsService.instance = new GoogleMapsService();\n GoogleMapsService.setupShadowDOMPatch();\n }\n return GoogleMapsService.instance;\n }\n\n private static setupShadowDOMPatch() {\n if ((window as any).gmpShadowPatched) return;\n\n const originalAttachShadow = Element.prototype.attachShadow;\n\n Element.prototype.attachShadow = function (init: ShadowRootInit) {\n if (this.localName === 'gmp-place-autocomplete') {\n return originalAttachShadow.call(this, { ...init, mode: 'open' });\n }\n return originalAttachShadow.call(this, init);\n };\n\n // Interceptar showModal() para evitar que Google abra un dialog fullscreen\n // en mobile que cubre toda la pantalla (se promueve al #top-layer del navegador).\n // Usamos .show() en su lugar para que quede en el flujo normal del DOM\n // y podamos estilizarlo con CSS.\n const originalShowModal = HTMLDialogElement.prototype.showModal;\n HTMLDialogElement.prototype.showModal = function () {\n const isGoogleDialog =\n this.classList.contains('full-window-autocomplete-dialog') ||\n this.closest('gmp-place-autocomplete') !== null;\n\n if (isGoogleDialog) {\n // Abrir como dialog no-modal → queda en flujo normal, no en #top-layer\n this.show();\n return;\n }\n return originalShowModal.call(this);\n };\n\n (window as any).gmpShadowPatched = true;\n }\n\n async waitForAPI(): Promise<boolean> {\n if (this.isLoaded && window.google) {\n return true;\n }\n\n if (this.loadPromise) {\n return this.loadPromise;\n }\n\n this.loadPromise = new Promise(resolve => {\n let attempts = 0;\n const maxAttempts = 100; // 10 seconds max wait\n\n const checkAPI = () => {\n attempts++;\n\n if (window.google) {\n this.isLoaded = true;\n resolve(true);\n } else if (attempts >= maxAttempts) {\n console.error('Google Maps API failed to load within timeout');\n resolve(false);\n } else {\n setTimeout(checkAPI, 100);\n }\n };\n checkAPI();\n });\n\n return this.loadPromise;\n }\n\n /**\n * Crea autocomplete usando la nueva API de Google Places (PlaceAutocompleteElement).\n * containerElement: donde se inserta (ej. search-input-container). Debe tener position: relative.\n * inputElement: input para sincronizar valor al seleccionar y para focus/blur.\n * Retorna el elemento y una función destroy para limpiar al desmontar.\n */\n async createAutocomplete(\n containerElement: HTMLElement,\n inputElement: HTMLInputElement,\n onPlaceSelected: (address: AddressComponents) => void,\n options?: {\n placeholder?: string;\n componentRestrictions?: { country: string | string[] };\n error?: string;\n disabled?: boolean;\n },\n ): Promise<{\n element: HTMLElement;\n destroy: () => void;\n syncToGoogle: (value?: string) => void;\n setError: (error?: string) => void;\n setDisabled: (disabled: boolean) => void;\n } | null> {\n const isReady = await this.waitForAPI();\n if (!isReady) {\n console.error('Google Maps API not available');\n return null;\n }\n\n try {\n // Nueva API: importLibrary carga Places (New)\n await google.maps.importLibrary('places');\n\n const elementOptions: google.maps.places.PlaceAutocompleteElementOptions = {\n types: ['address'],\n };\n\n if (options?.componentRestrictions?.country) {\n const countries = Array.isArray(options.componentRestrictions.country)\n ? options.componentRestrictions.country\n : [options.componentRestrictions.country];\n elementOptions.componentRestrictions = { country: countries };\n }\n\n const placeAutocomplete = new google.maps.places.PlaceAutocompleteElement(elementOptions);\n\n if (options?.placeholder) {\n placeAutocomplete.setAttribute('placeholder', options.placeholder);\n }\n\n // Agregar clase error si existe\n if (options?.error) {\n placeAutocomplete.classList.add('error');\n }\n\n // Deshabilitar si corresponde\n if (options?.disabled) {\n placeAutocomplete.setAttribute('disabled', 'true');\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput) googleInput.disabled = true;\n }\n\n // Insertar en el container; el CSS del padre lo posiciona como overlay\n containerElement.appendChild(placeAutocomplete);\n await new Promise(resolve => setTimeout(resolve, 300));\n\n // Inyectar estilos Rebill en el shadow DOM (modo open vía setupShadowDOMPatch)\n this.injectRebillStyles(placeAutocomplete);\n\n // Ocultar elementos de branding de Google que se renderizan fuera del Shadow DOM\n this.hideGoogleBranding();\n\n // Sincronizar valor del input → Google (SOLO una dirección)\n let isSyncing = false;\n const syncToGoogle = (value?: string) => {\n if (isSyncing) return;\n isSyncing = true;\n\n const val = value ?? inputElement.value;\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput) {\n googleInput.value = val;\n // Disparar eventos para que Google detecte el cambio\n googleInput.dispatchEvent(new Event('input', { bubbles: true }));\n googleInput.dispatchEvent(new Event('change', { bubbles: true }));\n }\n\n setTimeout(() => {\n isSyncing = false;\n }, 50);\n };\n\n const inputHandler = () => {\n if (!isSyncing) {\n syncToGoogle();\n }\n };\n inputElement.addEventListener('input', inputHandler);\n\n // Sincronizar valor inicial\n setTimeout(() => syncToGoogle(), 100);\n\n // Evento correcto: gmp-select (no gmp-placeselect)\n const selectHandler = async (ev: Event) => {\n const evt = ev as CustomEvent & {\n placePrediction?: { toPlace: () => Promise<google.maps.places.Place> };\n };\n const placePrediction = evt.placePrediction ?? (evt.detail as any)?.placePrediction;\n if (!placePrediction) return;\n const place = await placePrediction.toPlace();\n await place.fetchFields({\n fields: ['addressComponents', 'formattedAddress'],\n });\n\n if (place.addressComponents) {\n const address = this.parseAddressComponentsNew(\n place.addressComponents as any[],\n place.formattedAddress ?? undefined,\n );\n\n address.formattedAddress = place.formattedAddress ?? undefined;\n\n // Forzar actualización del input de Google con solo calle + número\n // Esto sobrescribe el texto completo que Google pone automáticamente\n setTimeout(() => {\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput && address.address) {\n googleInput.value = address.address;\n }\n }, 10);\n\n onPlaceSelected(address);\n }\n };\n\n placeAutocomplete.addEventListener('gmp-select', selectHandler);\n\n const setError = (error?: string) => {\n if (error) {\n placeAutocomplete.classList.add('error');\n } else {\n placeAutocomplete.classList.remove('error');\n }\n };\n\n const setDisabled = (disabled: boolean) => {\n if (disabled) {\n placeAutocomplete.setAttribute('disabled', 'true');\n } else {\n placeAutocomplete.removeAttribute('disabled');\n }\n const googleInput = placeAutocomplete.shadowRoot?.querySelector('input');\n if (googleInput) {\n googleInput.disabled = disabled;\n }\n };\n\n const destroy = () => {\n inputElement.removeEventListener('input', inputHandler);\n placeAutocomplete.removeEventListener('gmp-select', selectHandler);\n placeAutocomplete.remove();\n containerElement.classList.remove('autocomplete-active');\n };\n\n return { element: placeAutocomplete, destroy, syncToGoogle, setError, setDisabled };\n } catch (error) {\n console.error('Failed to create Google Maps PlaceAutocompleteElement:', error);\n return null;\n }\n }\n\n private hideGoogleBranding() {\n // Inyectar CSS global para ocultar branding de Google\n const globalStyleId = 'rebill-hide-google-branding';\n if (document.getElementById(globalStyleId)) return;\n\n const style = document.createElement('style');\n style.id = globalStyleId;\n style.textContent = `\n /* Ocultar TODOS los elementos de branding de Google Maps */\n gmp-internal-attribution,\n gmp-internal-dialog,\n gmp-place-autocomplete::part(attribution),\n gmp-place-autocomplete + *,\n gmp-place-autocomplete ~ *,\n a[href*=\"maps.google.com\"],\n a[title*=\"Google Maps\"],\n [aria-label*=\"Google Maps\"],\n div:has(> a[href*=\"google.com\"]),\n .dismissButton {\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n height: 0 !important;\n max-height: 0 !important;\n overflow: hidden !important;\n position: absolute !important;\n left: -9999px !important;\n }\n `;\n document.head.appendChild(style);\n\n // Remover elementos de branding continuamente (Google los puede agregar dinámicamente)\n const removeGoogleBranding = () => {\n // Remover Web Components de Google\n document.querySelectorAll('gmp-internal-attribution, gmp-internal-dialog').forEach(el => {\n el.remove();\n });\n\n // Remover links y elementos con \"Google Maps\"\n document\n .querySelectorAll('a[href*=\"maps.google.com\"], a[title*=\"Google Maps\"]')\n .forEach(el => {\n const parent = el.closest('div');\n if (parent && parent.textContent?.includes('Google Maps')) {\n parent.style.display = 'none';\n }\n el.remove();\n });\n\n // Remover cualquier SVG con aria-label=\"Google Maps\"\n document.querySelectorAll('svg[aria-label*=\"Google Maps\"]').forEach(el => {\n el.remove();\n });\n };\n\n // Ejecutar inmediatamente y periódicamente\n removeGoogleBranding();\n setInterval(removeGoogleBranding, 500);\n\n // Observer para elementos que se agregan dinámicamente\n const observer = new MutationObserver(() => {\n removeGoogleBranding();\n });\n observer.observe(document.body, { childList: true, subtree: true });\n }\n\n private injectRebillStyles(placeAutocomplete: HTMLElement) {\n const shadow = placeAutocomplete.shadowRoot;\n if (!shadow) {\n console.warn('Shadow DOM not available - styles cannot be injected');\n return;\n }\n\n const style = document.createElement('style');\n style.textContent = `\n /* Resetear TODO */\n * {\n box-sizing: border-box !important;\n }\n\n :host {\n display: block !important;\n width: 100% !important;\n height: 38.33px !important;\n max-height: 38.33px !important;\n font-family: inherit !important;\n border: none !important;\n outline: none !important;\n box-shadow: none !important;\n background: transparent !important;\n overflow: visible !important;\n }\n\n /* Contenedores - resetear */\n div, span, ul, li {\n all: revert !important;\n }\n\n /* INPUT PRINCIPAL - Copiar estilos exactos de rebill-input-text */\n input {\n display: block !important;\n width: 100% !important;\n height: 38.33px !important;\n min-height: 38.33px !important;\n box-sizing: border-box !important;\n border-radius: 8px !important;\n border: 1.5px solid #E5E7EB !important;\n padding: 10px 14px !important;\n padding-right: 40px !important;\n font-size: 14px !important;\n line-height: 20px !important;\n font-weight: 400 !important;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;\n color: #111827 !important;\n background-color: #FFFFFF !important;\n outline: none !important;\n transition: all 0.2s ease !important;\n -webkit-appearance: none !important;\n appearance: none !important;\n }\n\n input::placeholder {\n color: #9CA3AF !important;\n opacity: 1 !important;\n }\n\n input:focus {\n border-color: var(--rebill-color-primary) !important;\n box-shadow: none !important;\n }\n\n input:disabled {\n background-color: var(--rebill-color-background) !important;\n border-color: var(--rebill-color-disabled) !important;\n color: var(--rebill-color-text-secondary) !important;\n cursor: not-allowed !important;\n opacity: 0.7 !important;\n }\n\n input:disabled:focus {\n border-color: var(--rebill-color-disabled) !important;\n box-shadow: none !important;\n }\n\n /* Estado de error - border rojo igual que inputs de Rebill */\n :host(.error) input,\n :host([error]) input {\n border-color: var(--rebill-color-error, #EF4444) !important;\n }\n\n :host(.error) input:focus,\n :host([error]) input:focus {\n border-color: var(--rebill-color-error, #EF4444) !important;\n box-shadow: 0 0 0 2px var(--rebill-color-error-light, rgba(239, 68, 68, 0.1)) !important;\n }\n\n /* Ocultar elementos decorativos de Google */\n [class*=\"icon\"],\n [class*=\"suffix\"],\n [class*=\"prefix\"],\n [class*=\"logo\"],\n [class*=\"powered\"],\n [class*=\"google\"],\n [class*=\"branding\"],\n [class*=\"divider\"],\n [class*=\"separator\"],\n [aria-label*=\"Google\"],\n [aria-label*=\"clear\"],\n [aria-label*=\"Clear\"],\n button,\n svg,\n a[href*=\"google.com\"] {\n display: none !important;\n visibility: hidden !important;\n opacity: 0 !important;\n height: 0 !important;\n width: 0 !important;\n overflow: hidden !important;\n }\n\n /* Ocultar elementos hermanos del input EXCEPTO error-message */\n input + *:not(.error-message),\n input ~ *:not(.error-message) {\n display: none !important;\n }\n\n /* Dropdown - Estilo Rebill */\n [role=\"listbox\"] {\n position: absolute !important;\n z-index: 9999 !important;\n margin-top: 4px !important;\n width: 100% !important;\n max-height: 300px !important;\n overflow-y: auto !important;\n background: #FFFFFF !important;\n border: 1px solid #E5E7EB !important;\n border-radius: 8px !important;\n box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;\n padding: 0 !important;\n }\n\n ul {\n list-style: none !important;\n padding: 0 !important;\n margin: 0 !important;\n }\n\n /* Ocultar contenedor de atribuciones */\n .attributions,\n [role=\"presentation\"],\n div:has(> gmp-internal-attribution) {\n display: none !important;\n height: 0 !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n }\n\n /* Ocultar UL vacío cuando no hay sugerencias */\n ul:empty {\n display: none !important;\n }\n\n [role=\"option\"] {\n padding: 0.75rem !important;\n cursor: pointer !important;\n color: var(--rebill-color-text-primary) !important;\n font-size: 0.875rem !important;\n font-weight: 400 !important;\n border-bottom: 1px solid var(--rebill-color-border) !important;\n list-style: none !important;\n list-style-type: none !important;\n transition: background-color 0.15s ease !important;\n background-color: transparent !important;\n }\n\n [role=\"option\"]::before,\n [role=\"option\"]::marker {\n display: none !important;\n content: none !important;\n }\n\n [role=\"option\"]:last-child {\n border-bottom: none !important;\n }\n\n [role=\"option\"]:hover,\n [role=\"option\"][aria-selected=\"true\"] {\n background-color: #f0f9ff !important;\n }\n\n /* Texto dentro - mismo color que la opción */\n [role=\"option\"] * {\n color: var(--rebill-color-text-primary) !important;\n font-family: inherit !important;\n font-weight: inherit !important;\n }\n\n /* Ocultar botón de cerrar (X) */\n button[aria-label*=\"dismiss\"],\n button[aria-label*=\"close\"],\n .dismiss,\n .close-button {\n display: none !important;\n }\n\n /* Texto dentro de las sugerencias */\n [role=\"option\"] * {\n color: inherit !important;\n font-family: inherit !important;\n }\n\n /* FIX mobile: Google abre un dialog fullscreen en viewports chicos.\n Con el patch de showModal→show, el dialog ya no va al #top-layer.\n Lo forzamos a ser inline dentro del contenedor. */\n dialog,\n .full-window-autocomplete-dialog,\n [class*=\"full-window\"] {\n position: absolute !important;\n top: 0 !important;\n left: 0 !important;\n width: 100% !important;\n height: auto !important;\n max-height: none !important;\n margin: 0 !important;\n padding: 0 !important;\n border: none !important;\n background: transparent !important;\n overflow: visible !important;\n z-index: 10 !important;\n }\n\n /* El backdrop del dialog (si existiera) */\n dialog::backdrop {\n display: none !important;\n }\n `;\n shadow.appendChild(style);\n }\n\n private parseAddressComponentsNew(\n components: any[],\n formattedAddress?: string,\n ): AddressComponents {\n const getComponent = (type: string, useShortName = false) => {\n const component = components.find((c: any) => c.types.includes(type));\n return component ? (useShortName ? component.shortText : component.longText) : '';\n };\n\n const streetNumber = getComponent('street_number');\n const route = getComponent('route');\n const city = getComponent('locality');\n const state = getComponent('administrative_area_level_1');\n const country = getComponent('country', true);\n const zip = getComponent('postal_code');\n\n let addressLine = '';\n\n // Países donde el número va ANTES de la calle (ej: \"600 Fifth Avenue\")\n const numberFirstCountries = ['US', 'CA', 'GB', 'AU', 'NZ', 'IE'];\n const isNumberFirst = numberFirstCountries.includes(country);\n\n // Prioridad 1: Usar street_number + route si ambos existen\n if (streetNumber && route) {\n // Formato según el país\n addressLine = isNumberFirst\n ? `${streetNumber} ${route}`.trim() // USA: \"600 Fifth Avenue\"\n : `${route} ${streetNumber}`.trim(); // LATAM: \"Avenida Carlos Tejedor 600\"\n } else if (route) {\n // Si solo hay route, usarlo\n addressLine = route;\n } else if (streetNumber) {\n // Si solo hay número, usarlo\n addressLine = streetNumber;\n }\n\n // Si ya tenemos una dirección de los componentes, usarla\n if (addressLine.length > 0) {\n return {\n address: addressLine,\n city,\n state,\n country,\n zip,\n };\n }\n\n // Prioridad 2: Extraer de formattedAddress\n if (formattedAddress) {\n // Separar por coma y tomar solo la primera parte (calle + número)\n const parts = formattedAddress.split(',').map(p => p.trim());\n const firstPart = parts[0] ?? '';\n\n // Verificar si la primera parte no contiene el nombre de la ciudad\n // Esto previene que se incluya ciudad en la dirección\n const containsCity = city && firstPart.toLowerCase().includes(city.toLowerCase());\n const containsState = state && firstPart.toLowerCase().includes(state.toLowerCase());\n\n if (firstPart.length > 0 && !containsCity && !containsState && /[0-9A-Za-z]/.test(firstPart)) {\n addressLine = firstPart;\n }\n }\n\n return {\n address: addressLine,\n city,\n state,\n country,\n zip,\n };\n }\n\n static loadGoogleMapsScript(googleMapsApiKey?: string) {\n // Use new API key\n const apiKey = googleMapsApiKey || 'AIzaSyB9pS5LHbPKjnmMQ89BQHD0SVZXVsi95pk';\n\n if (!apiKey) {\n console.warn('Google Maps API key not provided. Address autocomplete will not be available.');\n return;\n }\n\n // Check if script is already loaded\n if (document.querySelector('script[src*=\"maps.googleapis.com\"]')) {\n return;\n }\n\n const script = document.createElement('script');\n // Nueva API: loading=async, Places se carga vía importLibrary en createAutocomplete\n script.src = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&loading=async&callback=initGoogleMaps`;\n script.async = true;\n script.defer = true;\n\n // Add global callback for when Google Maps is ready\n (window as any).initGoogleMaps = () => {\n delete (window as any).initGoogleMaps; // Clean up\n };\n\n script.onerror = () => {\n console.error(\n 'Failed to load Google Maps script. Please check your API key and network connection.',\n );\n };\n\n document.head.appendChild(script);\n }\n}\n"],"names":[],"mappings":";;MAUa,iBAAiB,CAAA;IACpB,OAAO,QAAQ;IACf,QAAQ,GAAY,KAAK;IACzB,WAAW,GAA4B,IAAI;AAEnD,IAAA,OAAO,WAAW,GAAA;AAChB,QAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE;AAC/B,YAAA,iBAAiB,CAAC,QAAQ,GAAG,IAAI,iBAAiB,EAAE;YACpD,iBAAiB,CAAC,mBAAmB,EAAE;;QAEzC,OAAO,iBAAiB,CAAC,QAAQ;;AAG3B,IAAA,OAAO,mBAAmB,GAAA;QAChC,IAAK,MAAc,CAAC,gBAAgB;YAAE;AAEtC,QAAA,MAAM,oBAAoB,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY;AAE3D,QAAA,OAAO,CAAC,SAAS,CAAC,YAAY,GAAG,UAAU,IAAoB,EAAA;AAC7D,YAAA,IAAI,IAAI,CAAC,SAAS,KAAK,wBAAwB,EAAE;AAC/C,gBAAA,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;YAEnE,OAAO,oBAAoB,CAAC,IAAI,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