import{b as s,c as l,a as S}from"./vendor-redux-a1f00e6b.js";import{a as O,i as I,j as k,k as E,l as N,m as L,n as T,o as A,p as $,q as R,r as b,s as h}from"./OpportunityServices-fa4fabfd.js";import{ac as x,ad as v,F as G}from"./index-c62ac197.js";const r="opportunity",n=s(r+"/getOpportunities",async(a,{rejectWithValue:e})=>{const t=`apiCache-opportunities-${JSON.stringify(a)}`,i=x(t);if(i)return i;try{const o=await O(a),d={data:o.data.finalResults.$values,metricData:o.data.metrics};return v(t,d),d}catch(o){return e(o)}}),p=s(r+"/getOpportunitiesById",async a=>({data:(await I(a)).data})),ae=async a=>(await E(a)).success,M=s(r+"/getOpportunityAccountList",async()=>(await k()).data.$values),_={total:0,pageIndex:1,pageSize:10,query:"",sort:{order:"",key:""}},B={loading:!1,loadingDetails:!1,deleteConfirmation:!1,selectedOpportunity:{opportunityName:""},opportunityList:[],tableData:_,filterData:{opportunityStageId:"",accountId:""},IsDrawerOpen:!1,IsDetailsOpen:!1,type:"Add",accountsList:[],metricData:{}},D=l({name:"opportunity",initialState:B,reducers:{setTableData:(a,e)=>{a.tableData=e.payload},setFilterData:(a,e)=>{a.filterData=e.payload},toggleDeleteConfirmation:(a,e)=>{a.deleteConfirmation=e.payload},setSelectedOpportunity:(a,e)=>{a.selectedOpportunity=e.payload},toggleDrawer:(a,e)=>{a.IsDrawerOpen=e.payload.IsDrawerOpen,a.type=e.payload.type},toggleViewDrawer:(a,e)=>{a.IsDetailsOpen=e.payload}},extraReducers:a=>{a.addCase(n.fulfilled,(e,t)=>{e.opportunityList=t.payload.data,e.metricData=t.payload.metricData,e.loading=!1}).addCase(n.pending,e=>{e.loading=!0}).addCase(n.rejected,(e,t)=>{e.opportunityList=[],e.loading=!1}).addCase(p.fulfilled,(e,t)=>{e.opportunityDetails=t.payload.data,e.loadingDetails=!1}).addCase(p.pending,e=>{e.loadingDetails=!0}).addCase(M.fulfilled,(e,t)=>{e.accountsList=t.payload})}}),{setTableData:te,setFilterData:se,toggleDeleteConfirmation:le,setSelectedOpportunity:oe,toggleDrawer:ne,toggleViewDrawer:re}=D.actions,j=D.reducer,q="notes",c=s(q+"/getNotes",async a=>({data:(await N(a)).data.$values})),ie=async a=>(await L(a)).success,F={loading:!1,deleteConfirmation:!1,selectedNote:[],notesList:[],IsNotesDrawerOpen:!1,type:"Add"},f=l({name:"notes",initialState:F,reducers:{toggleNotesDelete:(a,e)=>{a.deleteConfirmation=e.payload},setSelectedNote:(a,e)=>{a.selectedNote=e.payload},toggleNotesDrawer:(a,e)=>{a.IsNotesDrawerOpen=e.payload.IsNotesDrawerOpen,a.type=e.payload.type}},extraReducers:a=>{a.addCase(c.fulfilled,(e,t)=>{e.notesList=t.payload.data,e.loading=!1}).addCase(c.pending,e=>{e.loading=!0})}}),{toggleNotesDelete:de,toggleNotesDrawer:pe,setSelectedNote:ce}=f.actions,z=f.reducer,V="call",u=s(V+"/getCalls",async a=>({data:(await T(a)).data.$values})),ue=async a=>(await A(a)).success,J={loading:!1,deleteConfirmation:!1,selectedCall:[],callsList:[],IsCallDrawerOpen:!1,type:"Add"},m=l({name:"calls",initialState:J,reducers:{toggleCallDelete:(a,e)=>{a.deleteConfirmation=e.payload},setSelectedCall:(a,e)=>{a.selectedCall=e.payload},toggleCallDrawer:(a,e)=>{a.IsCallDrawerOpen=e.payload.IsCallDrawerOpen,a.type=e.payload.type}},extraReducers:a=>{a.addCase(u.fulfilled,(e,t)=>{e.callsList=t.payload.data,e.loading=!1}).addCase(u.pending,e=>{e.loading=!0})}}),{toggleCallDelete:ge,toggleCallDrawer:ye,setSelectedCall:De}=m.actions,K=m.reducer,H="task",g=s(H+"/getTasks",async a=>({data:(await $(a)).data.$values})),fe=async a=>(await R(a)).success,P={loading:!1,deleteConfirmation:!1,selectedTask:[],tasksList:[],IsTaskDrawerOpen:!1,type:"Add"},C=l({name:"tasks",initialState:P,reducers:{toggleTaskDelete:(a,e)=>{a.deleteConfirmation=e.payload},setSelectedTask:(a,e)=>{a.selectedTask=e.payload},toggleTaskDrawer:(a,e)=>{a.IsTaskDrawerOpen=e.payload.IsTaskDrawerOpen,a.type=e.payload.type}},extraReducers:a=>{a.addCase(g.fulfilled,(e,t)=>{e.tasksList=t.payload.data,e.loading=!1}).addCase(g.pending,e=>{e.loading=!0})}}),{toggleTaskDelete:me,toggleTaskDrawer:Ce,setSelectedTask:we}=C.actions,Q=C.reducer,U="email",y=s(U+"/getEmails",async a=>({data:(await b(a)).data.$values})),Se=async a=>(await h(a)).success,W={loading:!1,deleteConfirmation:!1,selectedEmail:[],emailsList:[],IsEmailDrawerOpen:!1,type:"Add"},w=l({name:"emails",initialState:W,reducers:{toggleEmailDelete:(a,e)=>{a.deleteConfirmation=e.payload},setSelectedEmail:(a,e)=>{a.selectedEmail=e.payload},toggleEmailDrawer:(a,e)=>{a.IsEmailDrawerOpen=e.payload.IsEmailDrawerOpen,a.type=e.payload.type}},extraReducers:a=>{a.addCase(y.fulfilled,(e,t)=>{e.emailsList=t.payload.data,e.loading=!1}).addCase(y.pending,e=>{e.loading=!0})}}),{toggleEmailDelete:Oe,toggleEmailDrawer:Ie,setSelectedEmail:ke}=w.actions,X=w.reducer,Ee=S({data:j,notes:z,emails:X,tasks:Q,calls:K}),Ne=G;export{u as A,De as B,ge as C,ue as D,le as a,n as b,oe as c,ae as d,pe as e,p as f,M as g,c as h,ce as i,de as j,ie as k,Ie as l,y as m,ke as n,Oe as o,Se as p,Ce as q,Ee as r,se as s,ne as t,Ne as u,g as v,we as w,me as x,fe as y,ye as z};
