import{h as u,g as j,$ as w,k as I,i as S,j as s,_ as a}from"./main.2.9.0.js";import{u as N,e as k,b as r}from"./react-router.DMwpH23k.js";import{S as y}from"./SnackMsg.DYSD96P4.js";import{S as E,I as F,s as P}from"./Integrations.DL8wqGct.js";import{h as $,c as g}from"./ConvertKitCommonFunc.C5tdHJeN.js";import{C as L}from"./ConvertKitIntegLayout.B8eXwmai.js";import{u as R}from"./Note.NSUdvR3c.js";import"./CopyIcn.CEA_lFLo.js";import"./react-vendor.P7K3d6op.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";function U({allIntegURL:c}){const p=N(),{id:D,formID:_}=k(),[e,i]=u(j),[n,f]=u(w),m=I(S),[d,l]=r.useState(!1),[b,t]=r.useState({show:!1});r.useEffect(()=>{e!=null&&e.module||i(o=>R(o,h=>{h.module="add_subscriber_to_a_form"}))},[]);const x=()=>{if(!g(e)){t({show:!0,msg:a("Please map all required fields to continue.","bit-integrations")});return}if(!(e!=null&&e.module)){t({show:!0,msg:a("Please select module to continue.","bit-integrations")});return}if((e==null?void 0:e.module)==="add_subscriber_to_a_form"&&!(e!=null&&e.formId)){t({show:!0,msg:a("Please select form to continue.","bit-integrations")});return}if(((e==null?void 0:e.module)==="add_tags_to_a_subscriber"||(e==null?void 0:e.module)==="remove_tags_to_a_subscriber")&&!(e!=null&&e.tagIds)){t({show:!0,msg:a("Please select tag continue.","bit-integrations")});return}e.name!==""&&e.field_map.length>0&&P({flow:n,setFlow:f,allIntegURL:c,navigate:p,conf:e,edit:1,setIsLoading:l,setSnackbar:t})};return s.jsxs("div",{style:{width:900},children:[s.jsx(y,{snack:b,setSnackbar:t}),s.jsxs("div",{className:"flx mt-3",children:[s.jsx("b",{className:"wdt-200 d-in-b",children:a("Integration Name:","bit-integrations")}),s.jsx("input",{className:"btcd-paper-inp w-5",onChange:o=>$(o,e,i),name:"name",value:e.name,type:"text",placeholder:a("Integration Name...","bit-integrations")})]}),s.jsx("br",{}),s.jsx(E,{entity:n.triggered_entity,setSnackbar:t}),s.jsx(L,{formID:_,formFields:m,convertKitConf:e,setConvertKitConf:i,isLoading:d,setIsLoading:l,setSnackbar:t}),s.jsx(F,{edit:!0,saveConfig:x,disabled:!g(e),isLoading:d,dataConf:e,setDataConf:i,formFields:m}),s.jsx("br",{})]})}export{U as default};
