| 1 |
var k=Object.defineProperty,M=Object.defineProperties;var D=Object.getOwnPropertyDescriptors;var b=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var w=(a,t,n)=>t in a?k(a,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):a[t]=n,j=(a,t)=>{for(var n in t||(t={}))A.call(t,n)&&w(a,n,t[n]);if(b)for(var n of b(t))E.call(t,n)&&w(a,n,t[n]);return a},y=(a,t)=>M(a,D(t));import{i as I,aq as O,u as N,r as P,I as h,as as W,j as e,_ as r,p as c,e as L,d as $,b8 as z,aM as R,N as U,aU as T,f as B,m as C}from"./main-294.js";import{t as F}from"./bf-582-82.js";import{u as q,P as H,C as d}from"./bf-176-80.js";const K=()=>{const[a,t]=I(z),n=O(R),g=N(U),_=N(T),[u,p]=P.useState({show:!1,msg:""}),{isLoading:x}=q(["bitforms_get_form_abandonment_config",g],{formID:g},{fetchCondition:h&&W(a),onSuccess:s=>t(s)}),l=(s,m)=>{if(!h)return!0;t(f=>B(f,o=>{if(C(o,s,m),s==="active"&&m&&!("saveFormDraft"in o)&&(o.saveFormDraft=!0,o.saveMode="always"),s==="showWarningMsg"&&m&&!("warningMsg"in o)&&(o.warningMsg="Please note that your information is saved on our server as you enter it."),s==="saveFormDraft"&&(m?o.saveMode="always":delete o.saveMode),s==="saveEmptyFromDraft"&&(m?o.saveEmptyFromDraft=!0:delete o.saveEmptyFromDraft),s==="repopulateForm"&&m&&_.enabled.submission){const S=r('In order to repopulate form fields, it is necessary to store the submitted data in the database. Please make sure to turn off the "disable storing form submission data" option in the form settings.');p({show:!0,msg:S}),delete o.repopulateForm}})),n(f=>y(j({},f),{unsaved:!0}))},v=()=>{p({show:!1})},i={};return a.active?(i.opacity=1,i.pointerEvents="auto",i.userSelect="auto"):(i.opacity=.6,i.pointerEvents="none",i.userSelect="none"),e.jsxs("div",{className:"pos-rel",children:[e.jsxs("div",{className:"flx mt-4",children:[e.jsx("h2",{className:"m-0",children:r("Form Abandonment")}),!x&&e.jsx(c,{name:"status",action:s=>l("active",s.target.checked),checked:a.active||!1,className:"ml-2 flx"})]}),e.jsxs("h5",{className:"mt-3",children:[r("How to setup Form Abandonment & save partial form progress:"),e.jsx("a",{href:F.formAbandonment.link,target:"_blank",rel:"noreferrer",className:"yt-txt ml-1 mr-1",children:r("YouTube")}),e.jsx("a",{href:F.formAbandonmentDoc.link,target:"_blank",rel:"noreferrer",className:"doc-txt",children:r("Documentation")})]}),!h&&e.jsx(H,{style:{height:"111%",left:-53,width:"104%"}}),x?e.jsx(L,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:70,transform:"scale(0.7)"}}):e.jsx("div",{className:"w-5",children:e.jsxs("div",{style:i,className:"mt-4",children:[e.jsxs("div",{className:"mt-2 mb-2 flx",children:[e.jsx(c,{name:"dflt_temp",action:s=>l("showWarningMsg",s.target.checked),checked:a.showWarningMsg||!1,className:"flx"}),e.jsx("label",{htmlFor:"dflt_temp",children:r("Show warning message below the form description")}),e.jsx(d,{className:"ml-1",icnSize:14,width:600,children:r("Places an admin-defined message below the form description, making your users aware that their field values are being saved before submission.")})]}),a.showWarningMsg&&e.jsx("div",{className:"flx",children:e.jsx("input",{onChange:s=>l("warningMsg",s.target.value),name:"warningMsg",value:a.warningMsg||"",className:"btcd-paper-inp mr-2 w-10",placeholder:"Set warning message",type:"text"})}),e.jsxs("div",{className:`flx ${a.showWarningMsg?"mt-2":"mt-3"}`,children:[e.jsx(c,{name:"disable_loggin_user",action:s=>l("onlyLoggedInUsers",s.target.checked),checked:a.onlyLoggedInUsers||!1,className:"flx"}),e.jsx("label",{htmlFor:"disable_loggin_user",children:r("Save draft only for logged in users")})]}),e.jsxs("div",{className:"mt-3 flx",children:[e.jsx(c,{name:"repopulate_fields",action:s=>l("repopulateForm",s.target.checked),checked:a.repopulateForm||!1,className:"flx"}),e.jsx("label",{htmlFor:"repopulate_fields",children:r("Repopulate form fields with previous partial entry")}),e.jsx(d,{className:"ml-1",icnSize:14,width:600,children:r(`If the user is logged in, the form will be repopulated with the previous partial entry from the database. |