| 1 |
var $=Object.defineProperty;var g=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var y=(e,n,o)=>n in e?$(e,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[n]=o,r=(e,n)=>{for(var o in n||(n={}))P.call(n,o)&&y(e,o,n[o]);if(g)for(var o of g(n))S.call(n,o)&&y(e,o,n[o]);return e};import{c as _,d as v,_ as p,u as T,j as l,y as V,$ as w}from"./main-162.js";import{S as q}from"./bf-361-122.js";import{M as z}from"./bf-527-130.js";const O=(e,n,o,a)=>{const t=r({},o);t[e].splice(n,0,{}),a(r({},t))},I=(e,n,o)=>{const a=_({post_type:e==null?void 0:e.post_type},"bitforms_get_metabox_fields").then(t=>{var i,c,m,u;return t!==void 0&&t.success&&((i=t==null?void 0:t.data)!=null&&i.metaboxFields&&n(t.data.metaboxFields),(c=t==null?void 0:t.data)!=null&&c.metaboxFile&&o(t.data.metaboxFile)),((m=t==null?void 0:t.data)==null?void 0:m.metaboxFields.length)!==0||((u=t==null?void 0:t.data)==null?void 0:u.metaboxFile.length)!==0?"Successfully refresh MetaBox Fields.":"MetaBox Fields not found"});v.promise(a,{success:t=>t,error:p("Error Occured"),loading:p("Loading MetaBox Fields...")})},B=(e,n,o,a)=>{const t=r({},o);t[e].length>1&&t[e].splice(n,1),a(r({},t))},j=(e,n,o,a,t)=>{const i=r({},a);i[e][o][n.target.name]=n.target.value,t(r({},i))},L=e=>!((e!=null&&e.post_map?e.post_map.filter(o=>!o.formField&&o.postField&&o.required):[]).length>0),G=e=>!((e!=null&&e.metabox_map?e.metabox_map.filter(o=>!o.formField&&o.acfField&&o.required):[]).length>0),U=(e,n)=>{const o=_({},"bitforms_get_post_type").then(a=>{var t,i,c;if(a&&a.success){let m=r({},e);return(t=a==null?void 0:a.data)!=null&&t.post_types&&(m=Object.values((i=a==null?void 0:a.data)==null?void 0:i.post_types),n(m)),((c=a==null?void 0:a.data)==null?void 0:c.post_types.length)!==0?"Successfully refresh Post Types.":" Post Types not found"}});v.promise(o,{success:a=>a,error:p("Error Occured"),loading:p("Loading Post Types...")})};function H({i:e,type:n,formFields:o,field:a,dataConf:t,setDataConf:i,customFields:c,fieldType:m}){var f;const u=T(w),{isPro:x}=u,N={metabox:{propName:"metabox_map",fldName:"metaboxField"},post:{propName:"post_map",fldName:"postField"},metaboxFile:{propName:"metabox_file_map",fldName:"metaboxFileUpload"}},{propName:d,fldName:h}=N[n],M=(s,k)=>{const F=r({},t);F[d][k].customValue=s.target.value,i(F)},b=!!c.find(s=>s.key===a[h]&&s.required);return l.jsxs("div",{className:"flx mt-2 mr-1",children:[l.jsxs("div",{className:"flx integ-fld-wrp",children:[l.jsxs("select",{className:"btcd-paper-inp mr-2",name:"formField",value:a.formField||"",onChange:s=>j(d,s,e,t,i),children:[l.jsx("option",{value:"",children:p("Select Field")}),l.jsx("optgroup",{label:"Form Fields",children:n==="post"?l.jsxs(l.Fragment,{children:[o.map(s=>s.type!=="file-up"&&l.jsx("option",{value:s.key,children:s.name},`ff-zhcrm-${s.key}`)),l.jsx("option",{value:"custom",children:p("Custom...")})]}):l.jsxs(l.Fragment,{children:[m==="file"?o.map(s=>s.type==="file-up"&&l.jsx("option",{value:s.key,children:s.name},`ff-zhcrm-${s.key}`)):o.map(s=>s.type!=="file-up"&&l.jsx("option",{value:s.key,children:s.name},`ff-zhcrm-${s.key}`)),m!=="file"&&l.jsx("option",{value:"custom",children:p("Custom...")})]})}),m!=="file"&&l.jsx("optgroup",{label:`General Smart Codes ${x?"":"(PRO)"}`,children:x&&((f=q)==null?void 0:f.map(s=>l.jsx("option",{value:s.name,children:s.label},`ff-rm-${s.name}`)))})]}),a.formField==="custom"&&l.jsx(z,{onChange:s=>M(s,e),label:p("Custom Value"),className:"mr-2",type:"text",value:a.customValue,placeholder:p("Custom Value")}),l.jsxs("select",{className:"btcd-paper-inp",name:h,value:a[h]||"",onChange:s=>j(d,s,e,t,i),disabled:b,children:[l.jsx("option",{value:"",children:p("Select Field")}),c==null?void 0:c.map(s=>l.jsx("option",{value:s.key,children:`${s.name}`},`${s.name}-1`))]})]}),!b&&l.jsxs(l.Fragment,{children:[l.jsx("button",{onClick:()=>O(d,e,t,i),className:"icn-btn sh-sm ml-2 mr-1",type:"button",children:"+"}),l.jsx("button",{onClick:()=>B(d,e,t,i),className:"icn-btn sh-sm ml-1",type:"button","aria-label":"btn",children:l.jsx(V,{size:"15"})})]})]})}export{H as F,O as a,I as b,L as c,G as d,U as r}; |