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.9.0.js";import{u as N,b as l}from"./react-router.DMwpH23k.js";import{S as k}from"./SnackMsg.DYSD96P4.js";import{u as w}from"./Note.NSUdvR3c.js";import"./CopyIcn.CEA_lFLo.js";import{S as F,I as A,s as E}from"./Integrations.DL8wqGct.js";import{g as M,h as g,c as $}from"./SalesforceCommonFunc.MjYD6_iX.js";import{S as L}from"./SalesforceIntegLayout.C7SiLQvq.js";import"./react-vendor.P7K3d6op.js";import"./Table.BfF8RYFZ.js";import"./index.DpWdl9V1.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";import"./ActionProFeatureLabels.gUp7_RXn.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};
