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