File: /var/www/html/wordpress/wp-content/plugins/bit-integrations/assets/bi.727.1004.js
var O=Object.defineProperty;var P=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable;var $=(e,t,a)=>t in e?O(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,u=(e,t)=>{for(var a in t||(t={}))U.call(t,a)&&$(e,a,t[a]);if(P)for(var a of P(t))G.call(t,a)&&$(e,a,t[a]);return e};import{r as H,f as S,j as s,L as k}from"./main-685.js";import{x as A,u as M,a9 as L}from"./bi.451.455.js";import{d as V,_ as c}from"./bi.878.0.js";import{c as I,g as z}from"./bi.261.783.js";import{a as K}from"./bi.327.9.js";import{b as y}from"./bi.601.11.js";import{P as w}from"./bi.463.750.js";import{g as T,a as R}from"./bi.564.1003.js";import{a as D}from"./bi.776.3.js";import{C as J}from"./bi.966.825.js";import{T as Q}from"./bi.768.751.js";function W({bentoConf:e,setBentoConf:t,loading:a,setLoading:l,isLoading:d,setIsLoading:o,setSnackbar:g}){var v,_;const[m,b]=H.useState({show:!1}),x=S(V),{isPro:i}=x,h=(n,j)=>{j==="add_tags"||j==="add_tags_via_event"?T(e,t,l):j==="subscribe"&&t(N=>M(N,F=>{F[j]=!!n.target.checked})),b({show:j})},r=()=>{b({show:!1})},p=(n,j)=>{t(N=>M(N,F=>{F[j]=n}))};return s.jsx(s.Fragment,{children:s.jsxs("div",{className:"pos-rel d-flx w-8",children:[e.action==="add_people"&&s.jsxs(s.Fragment,{children:[s.jsx(y,{onChange:n=>h(n,"add_tags"),checked:((v=e==null?void 0:e.selected_tags)==null?void 0:v.length)>0||!1,className:"wdt-200 mt-4 mr-2",value:"add_tags",isInfo:!i,title:s.jsx(w,{title:c("Add Tags","bit-integrations")}),subTitle:"Add Tags"}),s.jsx(y,{onChange:n=>h(n,"add_tags_via_event"),checked:((_=e==null?void 0:e.selected_tags_via_event)==null?void 0:_.length)>0||!1,className:"wdt-200 mt-4 mr-2",value:"add_tags_via_event",isInfo:!i,title:s.jsx(w,{title:c("Add Tags via Event","bit-integrations")}),subTitle:"Add Tags via Event"}),s.jsx(y,{onChange:n=>h(n,"subscribe"),checked:(e==null?void 0:e.subscribe)||!1,className:"wdt-200 mt-4 mr-2",value:"subscribe",isInfo:!i,title:s.jsx(w,{title:c("Subscribe","bit-integrations")}),subTitle:"Subscribe User"})]}),i&&s.jsxs(s.Fragment,{children:[s.jsxs(K,{className:"custom-conf-mdl",mainMdlCls:"o-v",btnClass:"purple",btnTxt:c("Ok","bit-integrations"),show:m.show==="add_tags",close:r,action:r,title:c("Add Tags","bit-integrations"),children:[s.jsx("div",{className:"btcd-hr mt-2 mb-2"}),a!=null&&a.tags?s.jsx(k,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:45,transform:"scale(0.5)"}}):s.jsxs("div",{className:"flx mt-2",children:[s.jsx(A,{className:"msl-wrp-options",defaultValue:e==null?void 0:e.selected_tags,options:e.tags,onChange:n=>p(n,"selected_tags")}),s.jsx("button",{onClick:()=>T(e,t,l),className:"icn-btn sh-sm ml-2 mr-2 tooltip",style:{"--tooltip-txt":`'${c("Refresh Tags","bit-integrations")}'`},type:"button",children:"↻"})]})]}),s.jsxs(K,{className:"custom-conf-mdl",mainMdlCls:"o-v",btnClass:"purple",btnTxt:c("Ok","bit-integrations"),show:m.show==="add_tags_via_event",close:r,action:r,title:c("Add Tags via Event","bit-integrations"),children:[s.jsx("div",{className:"btcd-hr mt-2 mb-2"}),a!=null&&a.tags?s.jsx(k,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:45,transform:"scale(0.5)"}}):s.jsxs("div",{className:"flx mt-2",children:[s.jsx(A,{className:"msl-wrp-options",defaultValue:e==null?void 0:e.selected_tags_via_event,options:e.tags,onChange:n=>p(n,"selected_tags_via_event")}),s.jsx("button",{onClick:()=>T(e,t,l),className:"icn-btn sh-sm ml-2 mr-2 tooltip",style:{"--tooltip-txt":`'${c("Refresh Tags","bit-integrations")}'`},type:"button",children:"↻"})]})]})]})]})})}const q=(e,t,a)=>{const l=u({},t);l.field_map.splice(e,0,{}),a(u({},l))},X=(e,t,a)=>{const l=u({},t);l.field_map.length>1&&l.field_map.splice(e,1),a(u({},l))},E=(e,t,a,l)=>{const d=u({},a);d.field_map[t][e.target.name]=e.target.value,e.target.value==="custom"&&(d.field_map[t].customValue=""),l(u({},d))},Y=(e,t,a,l)=>{const d=u({},a);d.field_map[t].customValue=e.target.value,l(u({},d))};function Z({i:e,formFields:t,field:a,bentoConf:l,setBentoConf:d}){var x;const o=S(V),{isPro:g}=o,m=(l==null?void 0:l.bentoFields)&&l.bentoFields.filter(i=>i.required===!0)||[],b=(l==null?void 0:l.bentoFields)&&l.bentoFields.filter(i=>i.required===!1)||[];return s.jsx("div",{className:"flx mt-2 mb-2 btcbi-field-map",children:s.jsxs("div",{className:"pos-rel flx",children:[s.jsxs("div",{className:"flx integ-fld-wrp",children:[s.jsxs("select",{className:"btcd-paper-inp mr-2",name:"formField",value:a.formField||"",onChange:i=>E(i,e,l,d),children:[s.jsx("option",{value:"",children:c("Select Field","bit-integrations")}),s.jsx("optgroup",{label:c("Form Fields","bit-integrations"),children:t==null?void 0:t.map(i=>s.jsx("option",{value:i.name,children:i.label},`ff-rm-${i.name}`))}),s.jsx("option",{value:"custom",children:c("Custom...","bit-integrations")}),s.jsx("optgroup",{label:sprintf(c("General Smart Codes %s","bit-integrations"),g?"":`(${c("Pro","bit-integrations")})`),children:g&&((x=D)==null?void 0:x.map(i=>s.jsx("option",{value:i.name,children:i.label},`ff-rm-${i.name}`)))})]}),a.formField==="custom"&&s.jsx(Q,{onChange:i=>Y(i,e,l,d),label:c("Custom Value","bit-integrations"),className:"mr-2",type:"text",value:a.customValue,placeholder:c("Custom Value","bit-integrations"),formFields:t}),s.jsxs("select",{className:"btcd-paper-inp",disabled:e<m.length,name:"bentoFormField",value:e<m.length?m[e].key||"":a.bentoFormField||"",onChange:i=>E(i,e,l,d),children:[s.jsx("option",{value:"",children:c("Select Field","bit-integrations")}),e<m.length?s.jsx("option",{value:m[e].key,children:m[e].label},m[e].key):b.map(({key:i,label:h})=>s.jsx("option",{value:i,children:h},i)),l.action==="add_event"&&s.jsx("option",{value:"customFieldKey",children:c("Custom Field Key","bit-integrations")})]}),a.bentoFormField==="customFieldKey"&&l.action==="add_event"&&s.jsx(J,{field:a,index:e,conf:l,setConf:d,fieldValue:"customFieldKey",fieldLabel:"Custom Field Key",className:"ml-2"})]}),e>=m.length&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:()=>q(e,l,d),className:"icn-btn sh-sm ml-2 mr-1",type:"button",children:"+"}),s.jsx("button",{onClick:()=>X(e,l,d),className:"icn-btn sh-sm ml-1",type:"button","aria-label":"btn",children:s.jsx("span",{className:"btcd-icn icn-trash-2"})})]})]})})}function ms({formFields:e,bentoConf:t,setBentoConf:a,loading:l,setLoading:d,isLoading:o,setIsLoading:g,setSnackbar:m}){var h;const b=S(V),{isPro:x}=b,i=(r,p)=>{p==="action"&&r!==""&&R(t,a,r,g),a(v=>M(v,_=>{_[p]=r}))};return s.jsxs(s.Fragment,{children:[s.jsx("br",{}),s.jsx("br",{}),s.jsxs("div",{className:"flx",children:[s.jsx("b",{className:"wdt-200 d-in-b",children:c("Select Action:","bit-integrations")}),s.jsx(A,{className:"msl-wrp-options dropdown-custom-width",defaultValue:t==null?void 0:t.action,onChange:r=>i(r,"action"),options:(h=t.actions)==null?void 0:h.map(r=>({label:I(x,r.is_pro)?r.label:z(r.label),value:r.value,disabled:!I(x,r.is_pro)})),singleSelect:!0,closeOnSelect:!0})]}),s.jsx("br",{}),s.jsx("br",{}),o&&s.jsx(k,{style:{display:"flex",justifyContent:"center",alignItems:"center",height:100,transform:"scale(0.7)"}}),t.action&&t.bentoFields&&!o&&s.jsxs("div",{children:[s.jsx("br",{}),s.jsxs("div",{className:"mt-5",children:[s.jsx("b",{className:"wdt-100",children:c("Field Map","bit-integrations")}),s.jsx("button",{onClick:()=>R(t,a,t.action,g),className:"icn-btn sh-sm ml-2 mr-2 tooltip",style:{"--tooltip-txt":`'${c("Refresh fields","bit-integrations")}'`},type:"button",children:"↻"})]}),s.jsx("br",{}),s.jsx("div",{className:"btcd-hr mt-1"}),s.jsxs("div",{className:"flx flx-around mt-2 mb-2 btcbi-field-map-label",children:[s.jsx("div",{className:"txt-dp",children:s.jsx("b",{children:c("Form Fields","bit-integrations")})}),s.jsx("div",{className:"txt-dp",children:s.jsx("b",{children:c("Bento Fields","bit-integrations")})})]}),t==null?void 0:t.field_map.map((r,p)=>s.jsx(Z,{i:p,field:r,bentoConf:t,formFields:e,setBentoConf:a,setSnackbar:m},`rp-m-${p+9}`)),s.jsx("div",{className:"txt-center btcbi-field-map-button mt-2",children:s.jsx("button",{onClick:()=>q(t.field_map.length,t,a),className:"icn-btn sh-sm",type:"button",children:"+"})}),s.jsx("br",{}),s.jsx("br",{}),!x&&t.action==="add_people"(s.jsx(L,{note:`<p>${c("Custom Fields Available in Pro","bit-integrations")}</p>`})),s.jsx("div",{className:"mt-4",children:s.jsx("b",{className:"wdt-100",children:c("Utilities","bit-integrations")})}),s.jsx("div",{className:"btcd-hr mt-1"}),s.jsx(W,{bentoConf:t,setBentoConf:a,loading:l,setLoading:d,isLoading:o,setIsLoading:g,setSnackbar:m})]})]})}export{ms as B};