{"id":1392,"date":"2024-12-05T16:47:29","date_gmt":"2024-12-05T07:47:29","guid":{"rendered":"https:\/\/www.bronchologyfoundation.org\/?page_id=1392"},"modified":"2025-01-02T18:44:55","modified_gmt":"2025-01-02T09:44:55","slug":"contact","status":"publish","type":"page","link":"https:\/\/www.wabip.com\/es\/contact\/","title":{"rendered":"Cont\u00e1ctenos"},"content":{"rendered":"<div style=\"width:100%;text-align:center;\">\n<strong style=\"font-size:105%;\">How can we help you?<\/strong>        <style>\n            @media (max-width: 550px) {\n                #ai_api_6abe92d4ee25d-submit-button {\n                    display: block;\n                    width: 100%;\n                    margin-bottom: 10px;\n                }\n            }\n\n            @media (min-width: 551px) {\n                #ai_api_6abe92d4ee25d-submit-button {\n                    display: none;\n                }\n            }\n\n            #ai_api_6abe92d4ee25d-contact-form {\n                display: none;\n                background-color: #fafafa;\n                margin-top: 20px;\n                padding: 15px;\n                border: 1px solid #eee;\n                border-radius: 15px;\n                color: #000;\n            }\n\n            #ai_api_6abe92d4ee25d-contact-form input {\n                width: 100%;\n                max-width: 600px;\n                margin-bottom: 10px;\n                padding: 8px;\n                border-radius: 15px;\n            }\n\n            #ai_api_6abe92d4ee25d-hcaptcha-ai,\n            #ai_api_6abe92d4ee25d-hcaptcha-contact {\n                margin: 10px 0;\n                display: flex;\n                justify-content: center;\n            }\n\n            .grecaptcha-badge {\n                visibility: hidden;\n            }\n        <\/style>\n\n        <div style=\"width:100%;text-align:center;\">\n            <div style=\"display:inline-table;color:#000;margin:0;padding:0;width:100%;max-width:800px;\">\n                <form id=\"ai_api_6abe92d4ee25d-form\">\n                    <textarea\n                        id=\"ai_api_6abe92d4ee25d_prompt\"\n                        name=\"ai_api_prompt\"\n                        rows=\"4\"\n                        cols=\"50\"\n                        required\n                        maxlength=\"1000\"\n                        style=\"background:#fafafa;border-radius:20px;border:3px #e0e6f0 solid;\"\n                    ><\/textarea>\n                    <br>\n                                            <input\n                            type=\"hidden\"\n                            id=\"ai_api_6abe92d4ee25d-recaptcha-ai-response\"\n                        >\n                                        <input\n                        type=\"submit\"\n                        id=\"ai_api_6abe92d4ee25d-submit-button\"\n                        value=\"Submit\"\n                    >\n                <\/form>\n\n                <div\n                    id=\"ai_api_6abe92d4ee25d-response\"\n                    style=\"font-size:105%;\"\n                ><\/div>\n\n                <div\n                    id=\"ai_api_6abe92d4ee25d-contact-form\"\n                >\n                    <form\n                        id=\"ai_api_6abe92d4ee25d-contact-submit\"\n                    >\n                        <input\n                            type=\"text\"\n                            id=\"ai_api_6abe92d4ee25d-name\"\n                            name=\"name\"\n                            placeholder=\"Your Name\"\n                            required\n                            maxlength=\"200\"\n                        >\n\n                        <input\n                            type=\"email\"\n                            id=\"ai_api_6abe92d4ee25d-email\"\n                            name=\"email\"\n                            placeholder=\"Your Email\"\n                            required\n                            maxlength=\"254\"\n                        >\n\n                                                    <input\n                                type=\"hidden\"\n                                name=\"g-recaptcha-response\"\n                                id=\"ai_api_6abe92d4ee25d-recaptcha-response\"\n                            >\n                        \n                        <input\n                            type=\"submit\"\n                            value=\"Submit Contact Form\"\n                        >\n                    <\/form>\n                <\/div>\n            <\/div>\n        <\/div>\n\n        <script type=\"text\/javascript\">\n        jQuery(document).ready(function($) {\n            var $input =\n                $('#ai_api_6abe92d4ee25d_prompt');\n\n            var $form =\n                $('#ai_api_6abe92d4ee25d-form');\n\n            var $submitButton =\n                $('#ai_api_6abe92d4ee25d-submit-button');\n\n            var $response =\n                $('#ai_api_6abe92d4ee25d-response');\n\n            var $contactForm =\n                $('#ai_api_6abe92d4ee25d-contact-form');\n\n            var $contactSubmit =\n                $('#ai_api_6abe92d4ee25d-contact-submit');\n\n            var captchaType =\n                'recaptcha';\n\n            var recaptchaSiteKey =\n                '6LfvEaAqAAAAAJCK8v1P2VdN-i24nMvkJar0ImNW';\n\n            var hcaptchaSiteKey =\n                'f37058f1-abc0-43b6-be15-d7975c790de3';\n\n            var aiHcaptchaId = null;\n            var contactHcaptchaId = null;\n\n            function renderHcaptchas() {\n                if (\n                    captchaType !== 'hcaptcha' ||\n                    !hcaptchaSiteKey ||\n                    typeof hcaptcha === 'undefined' ||\n                    typeof hcaptcha.render !== 'function'\n                ) {\n                    return;\n                }\n\n                try {\n                    var aiContainer = document.getElementById(\n                        'ai_api_6abe92d4ee25d-hcaptcha-ai'\n                    );\n\n                    if (aiContainer && aiHcaptchaId === null) {\n                        aiHcaptchaId = hcaptcha.render(aiContainer, {\n                            sitekey: hcaptchaSiteKey\n                        });\n                    }\n\n                    var contactContainer = document.getElementById(\n                        'ai_api_6abe92d4ee25d-hcaptcha-contact'\n                    );\n\n                    if (\n                        contactContainer &&\n                        contactHcaptchaId === null\n                    ) {\n                        contactHcaptchaId = hcaptcha.render(\n                            contactContainer,\n                            {sitekey: hcaptchaSiteKey}\n                        );\n                    }\n                } catch (e) {\n                    \/\/ Leave widgets unrendered; server fails closed.\n                }\n            }\n\n            function getHcaptchaToken(widgetId) {\n                if (\n                    captchaType !== 'hcaptcha' ||\n                    typeof hcaptcha === 'undefined' ||\n                    widgetId === null\n                ) {\n                    return '';\n                }\n\n                try {\n                    return hcaptcha.getResponse(widgetId) || '';\n                } catch (e) {\n                    return '';\n                }\n            }\n\n            function resetHcaptchaWidget(widgetId) {\n                if (\n                    captchaType !== 'hcaptcha' ||\n                    typeof hcaptcha === 'undefined' ||\n                    widgetId === null\n                ) {\n                    return;\n                }\n\n                try {\n                    hcaptcha.reset(widgetId);\n                } catch (e) {\n                    \/\/ Ignore reset failures.\n                }\n            }\n\n            function resetAiHcaptcha() {\n                resetHcaptchaWidget(aiHcaptchaId);\n            }\n\n            function resetContactHcaptcha() {\n                resetHcaptchaWidget(contactHcaptchaId);\n            }\n\n            var isSubmitButtonVisible = false;\n            var originalPrompt = '';\n            var isSubmitting = false;\n            var isContactSubmitting = false;\n            var lastSubmissionTime = 0;\n            var rateLimitMilliseconds =\n                3000;\n\n            function updateSubmitButtonVisibility() {\n                if ($(window).width() <= 550) {\n                    $submitButton.show();\n                    isSubmitButtonVisible = true;\n                } else {\n                    $submitButton.hide();\n                    isSubmitButtonVisible = false;\n                }\n            }\n\n            function showContactError(message) {\n                $contactSubmit\n                    .find('.simple-ai-contact-error')\n                    .remove();\n\n                $('<p>', {\n                    'class': 'simple-ai-contact-error',\n                    'text': message\n                })\n                .css('color', 'red')\n                .prependTo($contactSubmit);\n            }\n\n            function attemptSubmission() {\n                var currentTime = new Date().getTime();\n                var timeSinceLastSubmission =\n                    currentTime - lastSubmissionTime;\n\n                if (isSubmitting) {\n                    return;\n                }\n\n                if (\n                    rateLimitMilliseconds > 0 &&\n                    timeSinceLastSubmission <\n                        rateLimitMilliseconds\n                ) {\n                    var remainingTime = Math.ceil(\n                        (\n                            rateLimitMilliseconds -\n                            timeSinceLastSubmission\n                        ) \/ 1000\n                    );\n\n                    $response.text(\n                        'Please wait ' +\n                        remainingTime +\n                        ' seconds before submitting again.'\n                    );\n\n                    return;\n                }\n\n                \/\/ Captcha is required BEFORE any Pinecone\/OpenRouter\n                \/\/ spend: fetch a fresh token, then submit.\n                if (\n                    captchaType === 'recaptcha' &&\n                    recaptchaSiteKey\n                ) {\n                    handleAiRecaptchaAndSubmit();\n                    return;\n                }\n\n                if (captchaType === 'hcaptcha') {\n                    var token = getHcaptchaToken(aiHcaptchaId);\n\n                    if (!token) {\n                        $response.text(\n                            'Please complete the captcha before submitting.'\n                        );\n                        return;\n                    }\n\n                    submitPrompt(token, '');\n                    return;\n                }\n\n                submitPrompt('', '');\n            }\n\n            function handleAiRecaptchaAndSubmit() {\n                if (\n                    captchaType !== 'recaptcha' ||\n                    !recaptchaSiteKey\n                ) {\n                    submitPrompt('', '');\n                    return;\n                }\n\n                if (typeof grecaptcha === 'undefined') {\n                    $response.text(\n                        'reCAPTCHA is unavailable. Please try again.'\n                    );\n                    return;\n                }\n\n                grecaptcha.ready(function() {\n                    grecaptcha\n                        .execute(\n                            recaptchaSiteKey,\n                            {action: 'ai_submit'}\n                        )\n                        .then(function(aiToken) {\n                            $('#ai_api_6abe92d4ee25d-recaptcha-ai-response').val(aiToken);\n\n                            submitPrompt('', aiToken);\n                        })\n                        .catch(function() {\n                            $response.text(\n                                'Unable to verify reCAPTCHA. ' +\n                                'Please try again.'\n                            );\n                        });\n                });\n            }\n\n            function submitPrompt(hcaptchaToken, recaptchaToken) {\n                var prompt = $.trim($input.val());\n\n                if (!prompt) {\n                    return;\n                }\n\n                originalPrompt = prompt;\n                isSubmitting = true;\n                lastSubmissionTime = new Date().getTime();\n\n                $submitButton.prop('disabled', true);\n                $response.text('Thinking...');\n                $contactForm.hide();\n\n                $.ajax({\n                    url: 'https:\/\/www.wabip.com\/wp-admin\/admin-ajax.php',\n                    type: 'POST',\n                    data: {\n                        action: 'ai_api_submit',\n                        prompt: prompt,\n                        'h-captcha-response': hcaptchaToken || '',\n                        'g-recaptcha-response': recaptchaToken || '',\n                        nonce: '870f655cdf'\n                    }\n                })\n                .done(function(response) {\n                    if (!response.success) {\n                        $response.text(\n                            'Error: ' + String(response.data)\n                        );\n                        $contactForm.hide();\n                        resetAiHcaptcha();\n                        return;\n                    }\n\n                    $input.val('');\n\n                    if (\n                        response.data &&\n                        typeof response.data === 'object'\n                    ) {\n                        $response.html(\n                            response.data.response\n                        );\n\n                        if (\n                            response.data.displayform === true\n                        ) {\n                            $contactForm.show();\n                        } else {\n                            $contactForm.hide();\n                        }\n                    } else {\n                        $response.text(\n                            String(response.data)\n                        );\n                        $contactForm.hide();\n                    }\n\n                    resetAiHcaptcha();\n                })\n                .fail(function() {\n                    $response.text(\n                        'An error occurred. Please try again.'\n                    );\n                    $contactForm.hide();\n                    resetAiHcaptcha();\n                })\n                .always(function() {\n                    isSubmitting = false;\n                    $submitButton.prop('disabled', false);\n                });\n            }\n\n            function submitContactForm() {\n                if (isContactSubmitting) {\n                    return;\n                }\n\n                var name =\n                    $('#ai_api_6abe92d4ee25d-name').val();\n\n                var email =\n                    $('#ai_api_6abe92d4ee25d-email').val();\n\n                var hcaptchaResponse = '';\n                var recaptchaResponse = '';\n\n                if (captchaType === 'hcaptcha') {\n                    hcaptchaResponse =\n                        getHcaptchaToken(contactHcaptchaId);\n\n                    if (!hcaptchaResponse) {\n                        showContactError(\n                            'Please complete the captcha.'\n                        );\n                        return;\n                    }\n                } else if (captchaType === 'recaptcha') {\n                    recaptchaResponse =\n                        $('#ai_api_6abe92d4ee25d-recaptcha-response').val();\n                }\n\n                isContactSubmitting = true;\n\n                $contactSubmit\n                    .find('input[type=\"submit\"]')\n                    .prop('disabled', true);\n\n                $contactSubmit\n                    .find('.simple-ai-contact-error')\n                    .remove();\n\n                $.ajax({\n                    url: 'https:\/\/www.wabip.com\/wp-admin\/admin-ajax.php',\n                    type: 'POST',\n                    data: {\n                        action: 'ai_api_submit_contact',\n                        name: name,\n                        email: email,\n                        inquiry: originalPrompt,\n                        'h-captcha-response': hcaptchaResponse,\n                        'g-recaptcha-response': recaptchaResponse,\n                        nonce: '870f655cdf'\n                    }\n                })\n                .done(function(response) {\n                    if (response.success) {\n                        $contactForm.html(\n                            '<p style=\"color:#2498c7;\">' +\n                            'Thank you for your submission. ' +\n                            'The WABIP Administrative Office ' +\n                            'will get back to you shortly!' +\n                            '<\/p>'\n                        );\n                        resetContactHcaptcha();\n                        return;\n                    }\n\n                    showContactError(String(response.data));\n                    resetContactHcaptcha();\n                })\n                .fail(function() {\n                    showContactError(\n                        'An error occurred. Please try again.'\n                    );\n                    resetContactHcaptcha();\n                })\n                .always(function() {\n                    isContactSubmitting = false;\n\n                    $contactSubmit\n                        .find('input[type=\"submit\"]')\n                        .prop('disabled', false);\n                });\n            }\n\n            function handleRecaptchaAndSubmit() {\n                if (\n                    captchaType !== 'recaptcha' ||\n                    !recaptchaSiteKey\n                ) {\n                    submitContactForm();\n                    return;\n                }\n\n                if (typeof grecaptcha === 'undefined') {\n                    showContactError(\n                        'reCAPTCHA is unavailable. Please try again.'\n                    );\n                    return;\n                }\n\n                grecaptcha.ready(function() {\n                    grecaptcha\n                        .execute(\n                            recaptchaSiteKey,\n                            {action: 'submit'}\n                        )\n                        .then(function(token) {\n                            $('#ai_api_6abe92d4ee25d-recaptcha-response').val(token);\n\n                            submitContactForm();\n                        })\n                        .catch(function() {\n                            showContactError(\n                                'Unable to verify reCAPTCHA. ' +\n                                'Please try again.'\n                            );\n                        });\n                });\n            }\n\n            $(window).on(\n                'resize',\n                updateSubmitButtonVisibility\n            );\n\n            updateSubmitButtonVisibility();\n            renderHcaptchas();\n\n            \/\/ Retry rendering (hCaptcha script loads async).\n            var hcaptchaAttempts = 0;\n            var hcaptchaTimer = setInterval(function() {\n                if (\n                    captchaType !== 'hcaptcha' ||\n                    hcaptchaAttempts >= 20 ||\n                    (\n                        aiHcaptchaId !== null &&\n                        contactHcaptchaId !== null\n                    )\n                ) {\n                    clearInterval(hcaptchaTimer);\n                    return;\n                }\n\n                hcaptchaAttempts += 1;\n                renderHcaptchas();\n            }, 500);\n\n            $input.on('keydown', function(event) {\n                if (\n                    event.key === 'Enter' &&\n                    !isSubmitButtonVisible\n                ) {\n                    event.preventDefault();\n                    attemptSubmission();\n                }\n            });\n\n            $form.on('submit', function(event) {\n                event.preventDefault();\n                attemptSubmission();\n            });\n\n            $contactSubmit.on('submit', function(event) {\n                event.preventDefault();\n                handleRecaptchaAndSubmit();\n            });\n        });\n        <\/script>\n        <\/p>\n","protected":false},"excerpt":{"rendered":"<p>How can we help you?<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"default","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-1392","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.wabip.com\/es\/wp-json\/wp\/v2\/pages\/1392","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wabip.com\/es\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.wabip.com\/es\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.wabip.com\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wabip.com\/es\/wp-json\/wp\/v2\/comments?post=1392"}],"version-history":[{"count":0,"href":"https:\/\/www.wabip.com\/es\/wp-json\/wp\/v2\/pages\/1392\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wabip.com\/es\/wp-json\/wp\/v2\/media?parent=1392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}