{"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%;\">\u00bfC\u00f3mo podemos ayudarte?<\/strong>        <style>\n            @media (max-width: 550px) {\n                #ai_api_69de61411a8c1-submit-button {\n                    display: block;\n                    width: 100%;\n                    margin-bottom: 10px;\n                }\n            }\n            @media (min-width: 551px) {\n                #ai_api_69de61411a8c1-submit-button {\n                    display: none;\n                }\n            }\n            .contact-form-wrapper {\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            .contact-form-wrapper input {\n                width: 100%;\n                max-width: 600px;\n                margin-bottom: 10px;\n                padding: 8px;\n                border-radius: 15px;\n            }\n            .h-captcha {\n                margin: 10px 0;\n            }\n            .recaptcha-badge {\n                display: none;\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_69de61411a8c1-form\">\n                <textarea id=\"ai_api_69de61411a8c1_prompt\" \n                          name=\"ai_api_prompt\" \n                          rows=\"4\" \n                          cols=\"50\" \n                          required \n                          style=\"background: #fafafa;border-radius:20px;border:3px #e0e6f0 solid;\"><\/textarea><br>\n                <input type=\"submit\" \n                       id=\"ai_api_69de61411a8c1-submit-button\" \n                       value=\"Submit\">\n            <\/form>\n\n            <div id=\"ai_api_69de61411a8c1-response\" style=\"font-size:105%;\"><\/div>\n            \n            <div id=\"ai_api_69de61411a8c1-contact-form\" class=\"contact-form-wrapper\">\n                <form id=\"ai_api_69de61411a8c1-contact-submit\">\n                    <input type=\"text\" \n                           id=\"ai_api_69de61411a8c1-name\" \n                           name=\"name\" \n                           placeholder=\"Your Name\" \n                           required>\n                    <input type=\"email\" \n                           id=\"ai_api_69de61411a8c1-email\" \n                           name=\"email\" \n                           placeholder=\"Your Email\" \n                           required>\n                                            <input type=\"hidden\" name=\"g-recaptcha-response\" id=\"ai_api_69de61411a8c1-recaptcha-response\">\n                                        <input type=\"submit\" value=\"Submit Contact Form\">\n                <\/form>\n            <\/div>\n            <\/div>\n        <\/div>\n\n        <script type=\"text\/javascript\">\n        jQuery(document).ready(function($) {\n            var $input = $('#ai_api_69de61411a8c1_prompt');\n            var $form = $('#ai_api_69de61411a8c1-form');\n            var $submitButton = $('#ai_api_69de61411a8c1-submit-button');\n            var $response = $('#ai_api_69de61411a8c1-response');\n            var $contactForm = $('#ai_api_69de61411a8c1-contact-form');\n            var captchaType = 'recaptcha';\n            var recaptchaSiteKey = '6LfvEaAqAAAAAJCK8v1P2VdN-i24nMvkJar0ImNW';\n            var isSubmitButtonVisible = false;\n            var originalPrompt = '';\n            var isSubmitting = false;\n            var lastSubmissionTime = 0;\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            $(window).resize(updateSubmitButtonVisibility);\n            updateSubmitButtonVisibility();\n\n            $input.on('keydown', function(e) {\n                if (e.key === 'Enter') {\n                    if (!isSubmitButtonVisible) {\n                        e.preventDefault();\n                        attemptSubmission();\n                    }\n                }\n            });\n\n            $form.on('submit', function(e) {\n                e.preventDefault();\n                attemptSubmission();\n            });\n\n            function attemptSubmission() {\n                var currentTime = new Date().getTime();\n                var timeSinceLastSubmission = currentTime - lastSubmissionTime;\n                \n                if (isSubmitting) {\n                    return;\n                }\n\n                if (timeSinceLastSubmission < 5000) {\n                    var remainingTime = Math.ceil((5000 - timeSinceLastSubmission) \/ 1000);\n                    $response.html('Please wait ' + remainingTime + ' seconds before submitting again.');\n                    return;\n                }\n\n                doneTyping();\n            }\n\n            function doneTyping() {\n                var prompt = $input.val().trim();\n                originalPrompt = prompt;\n                \n                if (prompt.length > 0) {\n                    isSubmitting = true;\n                    lastSubmissionTime = new Date().getTime();\n                    $response.html('Thinking...');\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                            nonce: '1fff6ede99'\n                        },\n                        success: function(response) {\n                            if (response.success) {\n                                $input.val('');\n                                \n                                if (typeof response.data === 'object') {\n                                    $response.html(response.data.response);\n                                    if (response.data.displayform === true) {\n                                        $contactForm.show();\n                                    } else {\n                                        $contactForm.hide();\n                                    }\n                                } else {\n                                    $response.html(response.data);\n                                    $contactForm.hide();\n                                }\n                            } else {\n                                $response.html('Error: ' + response.data);\n                                $contactForm.hide();\n                            }\n                        },\n                        error: function() {\n                            $response.html('An error occurred. Please try again.');\n                            $contactForm.hide();\n                        },\n                        complete: function() {\n                            isSubmitting = false;\n                        }\n                    });\n                }\n            }\n\n            function handleRecaptchaAndSubmit(e) {\n                if (captchaType === 'recaptcha' && recaptchaSiteKey) {\n                    e.preventDefault();\n                    grecaptcha.ready(function() {\n                        grecaptcha.execute(recaptchaSiteKey, {action: 'submit'}).then(function(token) {\n                            $('#ai_api_69de61411a8c1-recaptcha-response').val(token);\n                            submitContactForm();\n                        });\n                    });\n                } else {\n                    submitContactForm();\n                }\n            }\n\n            $('#ai_api_69de61411a8c1-contact-submit').on('submit', function(e) {\n                if (captchaType === 'recaptcha' && recaptchaSiteKey) {\n                    handleRecaptchaAndSubmit(e);\n                } else {\n                    e.preventDefault();\n                    submitContactForm();\n                }\n            });\n\n            function submitContactForm() {\n                var name = $('#ai_api_69de61411a8c1-name').val();\n                var email = $('#ai_api_69de61411a8c1-email').val();\n                var hcaptchaResponse = '';\n                var recaptchaResponse = '';\n\n                if (captchaType === 'hcaptcha') {\n                    hcaptchaResponse = hcaptcha.getResponse();\n                } else if (captchaType === 'recaptcha') {\n                    recaptchaResponse = $('#ai_api_69de61411a8c1-recaptcha-response').val();\n                }\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: '1fff6ede99'\n                    },\n                    success: function(response) {\n                        if (response.success) {\n                            $contactForm.html('<p style=\"color:#2498c7;\">Thank you for your submission. The WABIP Administrative Office will get back to your shortly!<\/p>');\n                            if (captchaType === 'hcaptcha') {\n                                hcaptcha.reset();\n                            }\n                        } else {\n                            $contactForm.find('form').prepend('<p style=\"color: red;\">' + response.data + '<\/p>');\n                            if (captchaType === 'hcaptcha') {\n                                hcaptcha.reset();\n                            }\n                        }\n                    },\n                    error: function() {\n                        $contactForm.find('form').prepend('<p style=\"color: red;\">An error occurred. Please try again.<\/p>');\n                        if (captchaType === 'hcaptcha') {\n                            hcaptcha.reset();\n                        }\n                    }\n                });\n            }\n        });\n        <\/script>\n        ","protected":false},"excerpt":{"rendered":"<p>\u00bfC\u00f3mo podemos ayudarte?<\/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}]}}