| Server IP : 3.93.235.159 / Your IP : 216.73.216.140 Web Server : Apache System : Linux ip-172-26-0-169 5.10.0-46-cloud-amd64 #1 SMP Debian 5.10.262-1 (2026-07-31) x86_64 User : bitnami ( 1000) PHP Version : 8.2.9 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /bitnami/wordpress/wp-content/plugins/send-app/assets/js/ |
Upload File : |
(()=>{"use strict";function e(e,t){for(;e;){if(t&&e.tagName?.toLowerCase()===t.toLowerCase())return!0;e=e.parentElement}return!1}class t{observer=null;abandonedEvents=["beforeunload"];constructor(){this.init(),this.initTracking(),this.observeDynamicForms()}getFormIdAndPosId(e){if(!e)return{formId:"",postId:""};const t=document.body.className.match(/page-id-(\d+)/)?.[1]||this.getPostId(e);return{formId:this.getFormId(e)?this.idPrefix+this.getFormId(e):"",postId:t}}observeDynamicForms(){this.observer=new MutationObserver((e=>{e.forEach((e=>{"childList"===e.type&&e.addedNodes.length>0&&e.addedNodes.forEach((e=>{e instanceof Element&&this.handleNewForm(e)}))}))})),this.observer.observe(document.body,{childList:!0,subtree:!0})}handleNewForm(e){const t=this.formSelectors.join(","),o=new Set;e.matches(t)&&o.add(e),e.querySelectorAll(t).forEach((e=>o.add(e))),o.forEach((e=>{this.trackViewedForms(e),this.trackAbandonedForms(e)}))}initTracking(){const e=this.formSelectors.join(","),t=new Set;document.querySelectorAll(e).forEach((e=>t.add(e))),t.forEach((e=>{this.trackViewedForms(e),this.trackAbandonedForms(e)}))}trackViewedForms(e){const t=new IntersectionObserver((o=>{o.forEach((async o=>{if(o.isIntersecting&&o.intersectionRatio>=this.viewedThreshold){const r=this.prepareFormData(e,this.viewedAction);if(r.has("form_id")){const e=await fetch(this.ajaxUrl,{method:"POST",body:r});!e.ok&&this.debugOn&&console.error("Error tracking form view:",e.statusText)}t.unobserve(o.target)}}))}),{threshold:[this.viewedThreshold]});t.observe(e)}trackAbandonedForms(e){let t=!1,o=!1;e.querySelectorAll("input, textarea").forEach((e=>{e.addEventListener("focus",(()=>t=!0))})),e.addEventListener("submit",(()=>o=!0)),this.abandonedEvents.forEach((r=>{window.addEventListener(r,(async()=>{if(t&&!o){const t=this.prepareFormData(e,this.abandonedAction);if(t.has("form_id")){const e=await fetch(this.ajaxUrl,{method:"POST",body:t});!e.ok&&this.debugOn&&console.error("Error tracking abandoned form:",e.statusText)}}}))}))}prepareFormData(t,o){const r=new FormData,{formId:n,postId:s}=this.getFormIdAndPosId(t);return n&&(r.append("action",o),r.append("nonce",this.nonce),r.append("form_id",n),r.append("page_id",s),r.append("location",function(t){return e(t,"header")?"header":e(t,"footer")?"footer":function(e){const t=["header","footer","popup"];for(;e;){const o=e.getAttribute("data-elementor-type");if(t.includes(o))return o;e=e.parentElement}return"page"}(t)}(t))),r}}class o extends t{init(){this.formSelectors=eSendNinjaFormsSettings.formSelectors,this.ajaxUrl=eSendNinjaFormsSettings.ajaxUrl,this.nonce=eSendNinjaFormsSettings.nonce,this.viewedThreshold=eSendNinjaFormsSettings.viewedThreshold,this.viewedAction=eSendNinjaFormsSettings.viewedAction,this.abandonedAction=eSendNinjaFormsSettings.abandonedAction,this.debugOn=eSendNinjaFormsSettings.debugOn,this.idPrefix=eSendNinjaFormsSettings.idPrefix}getFormId(e){const t=e.closest(".nf-form-cont");return t?.id?.match(/nf-form-(\d+)-cont/)?.[1]||""}getPostId(e){return document.body.className.match(/page-id-(\d+)/)?.[1]||"error-getting-post-id"}}window.addEventListener("load",(()=>{new o}))})();