import{b as f,$ as v,h as w,k as N,i as y,j as e,_ as d}from"./main.2.8.1.js";import{u as F,h as E,d as n}from"./react-router-dom.9mCuUg3q.js";import{S as M}from"./SnackMsg.S8DrwLlT.js";import{u as p}from"./Note.BeM7sN-p.js";import{S as k,I as C,s as L}from"./Integrations.D2bgBas2.js";import{h as $,c as R}from"./MailerLiteCommonFunc.C7trWZsR.js";import{M as D}from"./MailerLiteIntegLayout.DSkspxld.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";import"./ProUtilHelpers.fQlR3mWW.js";function Y({allIntegURL:g}){const u=F(),{id:P}=E(),[o,A]=f(v),[t,s]=f(w),[h,T]=n.useState(!1),[x,b]=n.useState((t==null?void 0:t.name)||""),[m,l]=n.useState({list:!1,field:!1,auth:!1,group:!1}),[j,i]=n.useState({show:!1}),c=N(y),_=()=>{if(!R(t)){i({show:!0,msg:d("Please map mandatory fields","bit-integrations")});return}L({flow:o,allIntegURL:g,conf:t,navigate:u,edit:1,setSnackbar:i})};n.useEffect(()=>{t!=null&&t.action||s(a=>p(a,r=>{r.action="add_subscriber"}))},[]);const I=a=>{b(a.target.value),s(r=>p(r,S=>{S.name=a.target.value}))};return e.jsxs("div",{style:{width:900},children:[e.jsx(M,{snack:j,setSnackbar:i}),e.jsxs("div",{className:"flx mt-3",children:[e.jsx("b",{className:"wdt-200 d-in-b",children:d("Integration Name:","bit-integrations")}),e.jsx("input",{className:"btcd-paper-inp w-5",onChange:I,name:"name",value:x,type:"text",placeholder:d("Integration Name...","bit-integrations")})]}),e.jsx("br",{}),e.jsx(k,{entity:o.triggered_entity,setSnackbar:i}),e.jsx(D,{formID:o.triggered_entity_id,formFields:c,handleInput:a=>$(a,t,s,m,l),mailerLiteConf:t,setMailerLiteConf:s,loading:m,setLoading:l,setSnackbar:i}),e.jsx(C,{edit:!0,saveConfig:_,disabled:t.field_map.length<1,isLoading:h,dataConf:t,setDataConf:s,formFields:c}),e.jsx("br",{})]})}export{Y as default};
