{"id":48107,"date":"2025-08-26T07:05:45","date_gmt":"2025-08-26T13:05:45","guid":{"rendered":"https:\/\/bestpolicy.co\/?page_id=48107"},"modified":"2025-09-09T15:02:20","modified_gmt":"2025-09-09T21:02:20","slug":"thank-you-form-already-enrolled","status":"publish","type":"page","link":"https:\/\/developer.bestpolicy.co\/es\/thank-you-form-already-enrolled\/","title":{"rendered":"Thank-You Form"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"48107\" class=\"elementor elementor-48107\" data-elementor-post-type=\"page\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-75e8310 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"75e8310\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-5559221\" data-id=\"5559221\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-0664109 elementor-widget elementor-widget-spacer\" data-id=\"0664109\" data-element_type=\"widget\" data-widget_type=\"spacer.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-spacer\">\n\t\t\t<div class=\"elementor-spacer-inner\"><\/div>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-80810a8 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"80810a8\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ef0c95e\" data-id=\"ef0c95e\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-b6edc75 elementor-widget elementor-widget-text-editor\" data-id=\"b6edc75\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"bp-enrollment\">\n<h2 style=\"color: #0a2c61; text-align: center; margin-bottom: 20px;\">Almost done!<\/h2>\n<p style=\"text-align: center;\">It looks like you qualified. We need to gather a couple more pieces of information.\nPlease choose one of the options below to continue.<\/p>\n\n<div class=\"bp-options\" style=\"display: flex; gap: 20px; flex-wrap: wrap;\">\n<div style=\"flex: 1; min-width: 250px; background: #fff; border: 1px solid #ccc; border-radius: 6px; padding: 15px;\">\n\n\ud83d\udcde Call us directly at <a style=\"font-weight: bold; text-decoration: none; color: #0a2c61;\" href=\"tel:3854255915\">385-425-5915<\/a>\n<a href=\"tel:3854255915\">\n<button id=\"bp-call-btn\" style=\"background: #0a2c61; color: #fff; padding: 10px 16px; border: none; border-radius: 4px; cursor: pointer; display: inline-block; margin-top: 8px;\">\nCall Now\n<\/button>\n<\/a>\n\n<\/div>\n<div style=\"flex: 1; min-width: 250px; background: #fff; border: 1px solid #ccc; border-radius: 6px; padding: 15px;\">\n\n\ud83d\udcac Chat now with a licensed agent:\n\n<button id=\"openChatBtn\" style=\"background: #0a2c61; color: #fff; padding: 10px 16px; border: none; border-radius: 4px; cursor: pointer;\">Start\nChat<\/button>\n<div id=\"chat-container\"><\/div>\n<script src=\"https:\/\/beta.leadconnectorhq.com\/loader.js\" data-resources-url=\"https:\/\/beta.leadconnectorhq.com\/chat-widget\/loader.js\" data-widget-id=\"685189ea7bca468ddc0dc152\">\n          <\/script>\n\n<script>\n    const button = document.getElementById(\"openChatBtn\");\n    const container = document.getElementById(\"chat-container\");\n    \n    button.disabled = true;\n    button.innerText = \"Loading Chat...\";\n    \n    function getQueryParams() {\n      const params = new URLSearchParams(window.location.search);\n      return {\n        phone: params.get(\"phone\") || \"\",\n        email: params.get(\"email\") || \"\",\n        first_name: params.get(\"first_name\") || \"\",\n        last_name: params.get(\"last_name\") || \"\",\n        list_id: params.get(\"listid\") || \"11865\"\n      };\n    }\n    \n    function fillChatForm(widget, data, retries = 50) {\n      if (!widget?.shadowRoot) return;\n    \n      const chatForm = widget.shadowRoot.querySelector(\"chat-form\");\n      if (!chatForm?.shadowRoot) {\n        if (retries > 0) setTimeout(() => fillChatForm(widget, data, retries - 1), 500);\n        return;\n      }\n    \n      const phoneField = chatForm.shadowRoot.querySelector('input[name=\"phone\"]');\n      const emailField = chatForm.shadowRoot.querySelector('input[name=\"email\"]');\n      const nameField = chatForm.shadowRoot.querySelector('input[name=\"name\"]');\n      const submitBtn = chatForm.shadowRoot.querySelector('button[type=\"submit\"]');\n      const checkbox = chatForm.shadowRoot.querySelector(\"ion-checkbox\");\n    \n      if (phoneField) phoneField.value = data.phone;\n      if (emailField) emailField.value = data.email;\n      if (nameField) nameField.value = data.first_name + \" \" + data.last_name;\n      if (checkbox) {\n        checkbox.checked = true;\n        checkbox.dispatchEvent(new Event(\"ionChange\", { bubbles: true }));\n      }\n    \n      [phoneField, emailField, nameField].forEach(el => el?.dispatchEvent(new Event(\"input\", { bubbles: true })));\n      submitBtn?.click();\n    }\n    \n    function resetChatSession() {\n      if (window.LC_API?.end_chat) {\n        window.LC_API.end_chat();\n      }\n      localStorage.removeItem(\"lc_chat_session\");\n      sessionStorage.removeItem(\"lc_chat_session\");\n    }\n    \n    window.addEventListener(\"load\", () => {\n      try {\n        const params = new URLSearchParams(window.location.search);\n        const phone = params.get(\"phone\");\n        if (phone) document.getElementById(\"bp-phone\").value = phone;\n      } catch (e) {\n         console.log(\"ERROR PHONE: \" + e);\n      }\n  \n      const waitForWidget = setInterval(() => {\n        const chatWidget = document.querySelector(\"chat-widget\");\n        if (chatWidget && chatWidget.shadowRoot) {\n          clearInterval(waitForWidget);\n    \n          button.disabled = false;\n          button.innerText = \"Start Chat\";\n    \n          button.addEventListener(\"click\", () => {\n            container.style.display = \"block\";\n            container.appendChild(chatWidget);\n    \n            resetChatSession();\n    \n            const firstDiv = chatWidget.shadowRoot.querySelector(\"div\");\n            if (firstDiv) {\n              firstDiv.removeAttribute(\"style\");\n              firstDiv.style.position = \"relative\";\n              firstDiv.style.bottom = \"auto\";\n              firstDiv.style.right = \"auto\";\n              firstDiv.style.marginTop = \"30px\";\n            }\n    \n            const chatBtn = chatWidget.shadowRoot.querySelector(\"button\");\n            if (chatBtn) chatBtn.click();\n    \n            const params = getQueryParams();\n            fillChatForm(chatWidget, params);\n          });\n        }\n      }, 500);\n  \n      var callBackButton = document.getElementById('callback-btn');\n    \n      callBackButton.addEventListener('click', function(e){\n          e.preventDefault();\n          var phoneNumber = document.getElementById('bp-phone').value;\n          phoneNumber = phoneNumber.replace(\/\\s+\/g, '');\n          const params = getQueryParams();\n          if(!phoneNumber) { alert('Please enter a phone number'); return; }\n          var url = `https:\/\/bestpolicy.co\/wp-admin\/admin-ajax.php?action=send_a_call&list_id=${params.list_id}&phone_code=1&first_name=${params.first_name}&last_name=${params.last_name}&phone_number=${phoneNumber}`;\n          fetch(url, { method: 'POST' })\n            .then(resp => resp.text())\n            .then(raw => { \n              console.log('data', typeof raw, raw)\n              const fixed = raw.replace(\/}\\s*{\/g, \"},{\");\n              const wrapped = `[${fixed}]`; \/\/ wrap as array\n              const parsed = JSON.parse(wrapped);\n              console.log('parsed', parsed);\n              const respBody = parsed?.length > 1 ? JSON.parse(parsed[1]?.body) : JSON.parse(parsed[0]?.body)\n              if(respBody?.success){\n              alert('Thank you! We will call you shortly.');\n              }\n              else{\n                alert(respBody.text);\n              }\n             })\n            .catch(err => { \n              console.log('err', typeof err, err)\n\n              if(err?.response){\n                const errorBody = error?.response?.body\n                alert(errorBody?.text)\n              }\n             });\n        });\n    });\n  \n    \n    <\/script>\n\n<\/div>\n<\/div>\n<\/div>\n<div style=\"background: #fff; border: 1px solid #ccc; border-radius: 6px; padding: 15px; margin-top: 20px;\">\n\n\ud83d\udcc5 Schedule a call at your convenience:\n\n<button id=\"bp-schedule-btn\" style=\"background: #0a2c61; color: #fff; padding: 10px 16px; border: none; border-radius: 4px; cursor: pointer;\">Schedule\na Call<\/button>\n<div id=\"schedule-container\" style=\"margin-top: 15px; display: none;\"><\/div>\n<\/div>\n<div style=\"background: #fff; border: 1px solid #ccc; border-radius: 6px; padding: 15px; margin-top: 20px;\">\n\nIf you prefer, we can call you back right away:\n<div id=\"callback-form\"><label for=\"bp-phone\">Your Phone Number:<\/label>\n<input id=\"bp-phone\" style=\"width: 100%; padding: 10px; margin-top: 8px; border: 1px solid #ccc; border-radius: 4px;\" name=\"phone\" type=\"tel\" value=\"\" \/>\n<button id=\"callback-btn\" style=\"background: #0a2c61; color: #fff; padding: 10px 16px; border: none; border-radius: 4px; cursor: pointer; margin-top: 10px;\" type=\"submit\">Call Me Back<\/button><\/div>\n<\/div>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-c4bd8d8 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"c4bd8d8\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-a274503\" data-id=\"a274503\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-eced230 elementor-widget elementor-widget-image\" data-id=\"eced230\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"800\" height=\"308\" src=\"https:\/\/developer.bestpolicy.co\/wp-content\/uploads\/2023\/01\/Life-insurance-05-1024x394.jpeg\" class=\"attachment-large size-large wp-image-4516\" alt=\"\" srcset=\"https:\/\/developer.bestpolicy.co\/wp-content\/uploads\/2023\/01\/Life-insurance-05-1024x394.jpeg 1024w, https:\/\/developer.bestpolicy.co\/wp-content\/uploads\/2023\/01\/Life-insurance-05-300x115.jpeg 300w, https:\/\/developer.bestpolicy.co\/wp-content\/uploads\/2023\/01\/Life-insurance-05-768x295.jpeg 768w, https:\/\/developer.bestpolicy.co\/wp-content\/uploads\/2023\/01\/Life-insurance-05.jpeg 1443w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-be7e65f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"be7e65f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-dc1487a\" data-id=\"dc1487a\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e805e90 elementor-widget elementor-widget-html\" data-id=\"e805e90\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<!-- Trackdesk tracker begin -->\n<script async src=\"\/\/cdn.trackdesk.com\/tracking.js\"><\/script>\n<script>\n  (function(t,d,k){(t[k]=t[k]||[]).push(d);t[d]=t[d]||t[k].f||function(){(t[d].q=t[d].q||[]).push(arguments)}})(window,\"trackdesk\",\"TrackdeskObject\");\n\n  trackdesk(\"bestpolicy\", \"conversion\", {\n    \"conversionType\": \"sale\"\n  });\n<\/script>\n<!-- Trackdesk tracker end -->\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-82ecd52 elementor-widget elementor-widget-html\" data-id=\"82ecd52\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<script \n  src=\"https:\/\/widgets.leadconnectorhq.com\/loader.js\" \n  data-resources-url=\"https:\/\/widgets.leadconnectorhq.com\/chat-widget\/loader.js\" \n  data-widget-id=\"689d08b3389bcfca13c37d11\">\n<\/script>\n\n<script>\n  \/\/ This function contains the logic to fill the form\n  const prefillGHLForm = () => {\n    console.log('GHL Widget found, attempting to pre-fill form...');\n    \n    \/\/ --- YOUR LOGIC GOES HERE ---\n    \/\/ Example 1: Pre-fill from URL parameters automatically\n    const urlParams = new URLSearchParams(window.location.search);\n    const name = urlParams.get('name');\n    const email = urlParams.get('email');\n    const phone = urlParams.get('phone');\n\n    \/\/ Example 2: Pre-fill with hardcoded data (for testing)\n    \/\/ const name = \"John Doe\";\n    \/\/ const email = \"john.doe@example.com\";\n    \/\/ const phone = \"5551234567\";\n\n    \/\/ Example 3: Pre-fill from your website's data (if a user is logged in)\n    \/\/ This part is custom to your site's structure\n    \/\/ const loggedInUser = yourWebsite.getCurrentUser(); \/\/ This is a placeholder\n    \/\/ const name = loggedInUser.fullName;\n    \/\/ const email = loggedInUser.email;\n    \n    \/\/ An object to hold the data we want to fill\n    const dataToFill = {\n        'full_name': name, \/\/ or 'name' depending on your field\n        'email': email,\n        'phone': phone\n    };\n\n    \/\/ Loop through the data and fill the corresponding fields\n    for (const fieldName in dataToFill) {\n        const value = dataToFill[fieldName];\n        if (value) { \/\/ Only fill if we have a value\n            const inputField = document.querySelector(`#chat-widget-container input[name=\"${fieldName}\"]`);\n            if (inputField) {\n                inputField.value = value;\n                \/\/ IMPORTANT: Dispatch an 'input' event to make sure the widget's framework (like React) recognizes the change.\n                inputField.dispatchEvent(new Event('input', { bubbles: true }));\n            }\n        }\n    }\n  };\n\n  \/\/ This observer waits for the chat widget to be added to the page\n  const observer = new MutationObserver((mutations, obs) => {\n    const widgetContainer = document.getElementById('chat-widget-container');\n    if (widgetContainer) {\n      prefillGHLForm(); \/\/ Run our function once the widget exists\n      obs.disconnect(); \/\/ Stop observing once we've found it\n    }\n  });\n\n  \/\/ Start observing the body for changes\n  observer.observe(document.body, {\n    childList: true,\n    subtree: true\n  });\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7cb871b elementor-section-full_width elementor-section-content-middle elementor-section-height-default elementor-section-height-default\" data-id=\"7cb871b\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-d97b034\" data-id=\"d97b034\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-8ea157d elementor-button-success elementor-align-center elementor-widget elementor-widget-button\" data-id=\"8ea157d\" data-element_type=\"widget\" data-widget_type=\"button.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<div class=\"elementor-button-wrapper\">\n\t\t\t\t\t<a class=\"elementor-button elementor-button-link elementor-size-sm\" href=\"https:\/\/bestpolicy.co\/\">\n\t\t\t\t\t\t<span class=\"elementor-button-content-wrapper\">\n\t\t\t\t\t\t\t\t\t<span class=\"elementor-button-text\">Return to Homepage<\/span>\n\t\t\t\t\t<\/span>\n\t\t\t\t\t<\/a>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7bb489f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7bb489f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f69480c\" data-id=\"f69480c\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-e8f8734 elementor-widget elementor-widget-html\" data-id=\"e8f8734\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t <img decoding=\"async\"\r\n\t src=\"https:\/\/l5srv.net\/AdServer\/convert.ads?aid=Y29tLnVwd2FyZC5zcG9uc29yZWRBZHMuYWRzZGIuYWR2Y2VudHJhbC5lbnRpdGllcy5BZHZlcnRpc2VyQGMxOGNlYzQ=\"\r\n\t width=\"0\" height=\"0\"\r\n \/>\r\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>Almost done! It looks like you qualified. We need to gather a couple more pieces of information. Please choose one of the options below to continue. \ud83d\udcde Call us directly at 385-425-5915 Call Now \ud83d\udcac Chat now with a licensed agent: Start Chat \ud83d\udcc5 Schedule a call at your convenience: Schedule a Call If you [&hellip;]<\/p>","protected":false},"author":5,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_seopress_robots_primary_cat":"","_seopress_titles_title":"","_seopress_titles_desc":"","_seopress_robots_index":"yes","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-48107","page","type-page","status-publish","hentry"],"featured_image_src":null,"featured_image_src_square":null,"_links":{"self":[{"href":"https:\/\/developer.bestpolicy.co\/es\/wp-json\/wp\/v2\/pages\/48107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developer.bestpolicy.co\/es\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/developer.bestpolicy.co\/es\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/developer.bestpolicy.co\/es\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/developer.bestpolicy.co\/es\/wp-json\/wp\/v2\/comments?post=48107"}],"version-history":[{"count":296,"href":"https:\/\/developer.bestpolicy.co\/es\/wp-json\/wp\/v2\/pages\/48107\/revisions"}],"predecessor-version":[{"id":51761,"href":"https:\/\/developer.bestpolicy.co\/es\/wp-json\/wp\/v2\/pages\/48107\/revisions\/51761"}],"wp:attachment":[{"href":"https:\/\/developer.bestpolicy.co\/es\/wp-json\/wp\/v2\/media?parent=48107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}