import{u as y,d as u,r as o,h as C,j as a}from"./main-406.js";import{$ as I,g as S,h as _,B as N,d as w,_ as p,i as F,I as k,c as A,s as E}from"./bi.394.85.js";import{g as M,h as g,c as $}from"./bi.694.812.js";import{S as L}from"./bi.282.813.js";import"./bi.704.707.js";import"./bi.701.708.js";function z({allIntegURL:b}){const v=y(),[l,R]=u(I),[e,n]=u(S),[c,r]=o.useState(!1),[x,i]=o.useState({show:!1}),d=C(_);o.useEffect(()=>{e.action_modules||(n(t=>N(t,s=>{const m=[{label:"Create Contact",value:"contact-create"},{label:"Create lead",value:"lead-create"},{label:"Create Account",value:"account-create"},{label:"Create Campaign",value:"campaign-create"},{label:"Add campaign member",value:"add-campaign-member"},{label:"Create Task",value:"task-create"},{label:"Oportunity Create",value:"opportunity-create"},{label:"Event Create",value:"event-create"},{label:"Create Case",value:"case-create"}];s.action_modules=m,s.selesforceActionModules=m})),M(e,n,r))},[]);const f=["contact-create","lead-create","account-create","campaign-create","opportunity-create","event-create","case-create"].includes(e==null?void 0:e.actionName),h=()=>{if(f&&!$(e)){A.error("Please map mandatory fields !");return}E({flow:l,allIntegURL:b,conf:e,navigate:v,edit:1,setIsLoading:r,setSnackbar:i})},j=()=>{var t,s;if((e==null?void 0:e.actionName)==="opportunity-create")return!((t=e.actions)!=null&&t.opportunityStageId);if((e==null?void 0:e.actionName)==="event-create")return!((s=e.actions)!=null&&s.eventSubjectId);if((e==null?void 0:e.actionName)==="add-campaign-member")return!e.campaignId};return a.jsxs("div",{style:{width:900},children:[a.jsx(w,{snack:x,setSnackbar:i}),a.jsxs("div",{className:"flx mt-3",children:[a.jsx("b",{className:"wdt-200 d-in-b",children:p("Integration Name:","bit-integrations")}),a.jsx("input",{className:"btcd-paper-inp w-5",onChange:t=>g(t,e,n),name:"name",value:e.name,type:"text",placeholder:p("Integration Name...","bit-integrations")})]}),a.jsx("br",{}),a.jsx(F,{entity:l.triggered_entity,setSnackbar:i}),a.jsx(L,{formFields:d,handleInput:t=>g(t,e,n),salesforceConf:e,setSalesforceConf:n,isLoading:c,setIsLoading:r,setSnackbar:i}),a.jsx(k,{edit:!0,saveConfig:h,disabled:j()||c,isLoading:c,dataConf:e,setDataConf:n,formFields:d}),a.jsx("br",{})]})}export{z as default};
