1import{d as e}from"./ui-vendor-wXL1vB-g.js";import{r as s,R as X,u as le,i as xe,f as jt}from"./react-vendor-BktoabIY.js";import{e as _,u as Ue}from"./redux-vendor-DyFZt5ds.js";import{h as vt,f as wt,A as yt}from"./all-outreach.page-CUd8_OYt.js";import{u as Ie}from"./useIdToGetEventType-DKJn7EGK.js";import{a1 as ge,aL as z,cN as Nt,b7 as It,bJ as bt,ak as F,a0 as Ce,cE as Ze,T as _e,aM as ae,gA as ze,gB as We,$ as Y,ac as Z,l as we,fD as Et,fC as St,gC as qe,gD as kt,gE as Lt,O as J,gF as Mt,gG as At,dy as q,g as Ee,fz as Se,gH as Tt,aa as he,bf as ce,f1 as Dt,cY as Vt,bh as ue,am as Pt}from"./index-DHpc7hhq.js";import{T as Ht}from"./textfield-new.atom-xYya_Ihr.js";import{T as Ft}from"./textarea-new.atom-BF8liSzi.js";import{g as Pe,f as Bt}from"./typeFilterGpt-D2JIvJgH.js";import{A as Rt}from"./ai-prompt-fields.component-Br60ixW_.js";import{c as ne,I as Ye,u as $t}from"./custom-options.component-DylXWhv1.js";import{_ as Ot}from"./index-CYBVbqUN.js";import{S as Ut}from"./upload-Jb2I4npZ.js";import{S as Zt}from"./big-edit-B7MLxmLZ.js";import{S as _t}from"./delete-CVS5AHlv.js";import{M as Ge}from"./media-library-dialog.component-DZaA_6R9.js";import{J as He}from"./firebase-vendor-DpNCE-dN.js";import{A as zt}from"./audit-logs.component-BW9O2GdC.js";import{a as Wt,c as qt,d as Yt,e as Gt}from"./emails-CjL0JEsX.js";import{e as Kt,c as Fe,d as re}from"./emailCmsFunctions-CB3uVNdy.js";import{r as Be}from"./replaceWithDynamicContent-Cmtijmdh.js";import{S as Xt}from"./NewsFeedAvatar-J6DuG0tG.js";import{l as Jt,a as Qt}from"./analytics-509EAsrE.js";import{R as es}from"./rich-text-editor.atom-0SDXpsSI.js";import{o as ts}from"./outreachgetDate-Brswp9Zg.js";import{D as ss}from"./date-field.atom-CS4QPmws.js";import"./data-table-wrapper.component-D0dQLfev.js";import"./index-DdYyfB3z.js";/* empty css */import"./chart-vendor-CfmrB_PR.js";import"./form-vendor-B7oKYy-s.js";/* empty css */import"./custom-csv-button.style-DuAxjoiR.js";import"./custom-modal-header.component-CrD1aPQA.js";import"./media-library-listing.component-DhKs1EZU.js";import"./media-libarary-styled.components-C3xI6xvu.js";import"./alert-confirmation.component-vmuLS6wT.js";import"./alert-icon-CIy-mDLg.js";import"./column-filter-icon-DxTa9zPj.js";import"./trash-icon-BNtpn1e5.js";import"./admin-user-profile.action-DsJZGmbw.js";import"./getDataFromApplicationObjects-D0HY_znK.js";import"./exportIcon-IuewquxF.js";import"./xlsx-APjLrsY0.js";import"./donationTimeStampListener-DkXpVS6G.js";import"./calendar-jeW4USFq.js";/* empty css */const as=t=>s.createElement("svg",{width:10,height:16,viewBox:"0 0 10 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M2.21166e-06 14.8556C-0.000649136 14.5887 0.115477 14.33 0.328222 14.1244L6.72138 8.00112L0.556551 1.86638C0.438012 1.74953 0.34949 1.61507 0.296073 1.47074C0.242657 1.32641 0.225398 1.17505 0.24529 1.02536C0.265182 0.875674 0.321831 0.730609 0.411983 0.598505C0.502134 0.4664 0.624011 0.349861 0.770607 0.255587C0.916576 0.160691 1.08453 0.0898264 1.26483 0.047064C1.44512 0.00430169 1.63419 -0.00951442 1.82117 0.00640986C2.00816 0.0223341 2.18936 0.0676847 2.35438 0.139855C2.5194 0.212025 2.66498 0.309592 2.78274 0.426948L9.67536 7.2814C9.88526 7.48582 10 7.74222 10 8.00683C10 8.27145 9.88526 8.52785 9.67536 8.73226L2.54014 15.5867C2.42034 15.7024 2.27321 15.798 2.10718 15.8681C1.94115 15.9382 1.75947 15.9814 1.57257 15.9952C1.38566 16.009 1.19718 15.9931 1.01794 15.9485C0.838698 15.9039 0.672209 15.8314 0.528009 15.7352C0.364308 15.6289 0.232057 15.4949 0.140763 15.3428C0.0494674 15.1907 0.00139648 15.0243 2.21166e-06 14.8556Z",fill:"black"}));function ns({onSelectChange:t,batch:i,typeName:n,title:a,defaultSelectedOption:o,selectedCauseLabel:m,outreachLinked:c,valueId:p}){const[y,g]=s.useState(o||{label:"",value:"",idToStore:""}),[j,E]=s.useState(!1),[I,b]=s.useState(!0),x=ge("causeName"),h=ge("campaignName"),{activeCampaignsList:f,activeCauseProjects:N}=_(r=>r.campaign),{activeEvents:M}=_(r=>r.events),k=N.sort((r,l)=>{const u=r.createdAt.seconds*1e3+r.createdAt.nanoseconds/1e6,d=l.createdAt.seconds*1e3+l.createdAt.nanoseconds/1e6;return u-d}),L=X.useMemo(()=>
1[{label:x,options:k},{label:h,options:f},{label:"Events",options:M}],[x,h,f,M,k]);s.useEffect(()=>{if(i&&i.linkSubType){const r=i.linkSubType,l=L.find(u=>Array.isArray(u.options)?u.options.find(d=>d.campaignName===r||d.eventName===r):null);if(l){const u=l.options.find(A=>A.campaignName===r||A.eventName===r),d={label:u.eventName?"Event":u.type?z(x):z(h),value:r,idToStore:u.campaignId||u.eventId||""};g(d),t&&t(d);return}}g(o||{label:"",value:"",idToStore:""})},[L,i,h,x,t,o]),s.useEffect(()=>{if(n){const r=Pe(L,a,!0),l=Bt(r,h,x,n);g(l)}else if(L){const r=Pe(L,x,!1),l={label:x,value:r.campaignName,idToStore:r.campaignId};g(o||l)}},[L,o,h,x,a,n,i,m]);const v=r=>{const l=r.target.value,u=L.find(d=>Array.isArray(d.options)?d.options.find(A=>A.campaignName===l||A.eventName===l):null);if(u){const d=u.options.find(A=>A.campaignName===l||A.eventName===l);if(d){const A={label:u.label||"Not applicable",value:l,idToStore:d.campaignId?d.campaignId:d.eventId?d.eventId:null};if(g(A),t){const H=d==null?void 0:d.shortUrl,V=(d==null?void 0:d.organizationId)||"";t(A,H,V)}E(!1)}else{const A={label:"Not applicable",value:l,idToStore:null};g(A),t&&t(A),E(!0)}}},w=()=>{b(!0)},C="Please select an option",S=c?"Outreach is Linked To":"Email is Linked to",D=s.useRef(null),T=i||!!n;return e.jsx("div",{children:e.jsxs("div",{className:"service-campaign-project-dropdown",children:[L.length>0&&e.jsxs("label",{className:I?"focus":"",children:[S," ",e.jsx(Nt,{})]}),e.jsx("div",{className:"dropdown-icon",children:e.jsx(It,{})}),e.jsx("select",{className:"",ref:D,value:y.value,onChange:r=>v(r),onClick:w,disabled:T,children:L.map((r,l)=>e.jsx("optgroup",{label:r.label,children:Array.isArray(r.options)&&r.options.length>0&&r.options.map((u,d)=>e.jsx("option",{value:r.label==="Events"?u.eventName:u.campaignName,children:r.label==="Events"?u.eventName:u.campaignName},d))},l))}),j?e.jsx(bt,{absolute:!0,message:`${C}`}):""]})})}const Ke=({previous:t,current:i,previousLink:n,handleCancel:a})=>{const o=le(),m=()=>{a?a():o(n)};return e.jsxs("div",{className:"breadcrumbs-header-atom",children:[e.jsx("div",{onClick:m,className:"heading-previous",children:t}),e.jsx(as,{}),e.jsx("div",{className:"heading-current",children:i})]})},is=({outreachData:t,setOutreachData:i,setOutreachError:n,outreachError:a,draftVisibility:o})=>{const m=le(),c=()=>{const y=()=>{m("/outreach/all-outreach"),i(ze),n(We)};t.name!==""||t.description!==""&&t.images.length?Ce("Warning","You'll lose your data. Are you sure you want to cancel?",y,"Leave","Stay Here"):y()},p=async(y,g=!1)=>{try{const j="Please wait!";let E="Creating Outreach";
1g?E="Drafting Outreach":t!=null&&t.id&&(E="Regenerating Outreach"),Ze(E,y?j:`${j}`);const I=await ne({...t,status:y||"draft"});if(_e(),!I.data.success)throw new Error(I.data.message);m(y?`/outreach/outreach-content/${I.data.id}`:"/outreach/all-outreach")}catch(j){console.log(j),ae("Something went wrong",j.message)}};return e.jsx("div",{className:"outreach-header-component",children:e.jsxs("div",{className:"outreach-fixed-header",children:[e.jsx(Ke,{previous:"Digital Outreach",previousLink:"/outreach/all-outreach",current:"Create an outreach",handleCancel:c}),e.jsxs("div",{className:"outreach-events",children:[e.jsx(F,{handleClick:c,gray:!0,children:"Cancel"}),o?"":e.jsx(F,{handleClick:()=>p(!1,!0),gray:!0,children:"Save as draft"}),e.jsx(F,{handleClick:()=>p(!0),children:"Next"})]})]})})},Xe=t=>s.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("g",{id:"file-text"},s.createElement("path",{id:"Icon",d:"M11.6666 1.66602H4.99992C4.55789 1.66602 4.13397 1.84161 3.82141 2.15417C3.50885 2.46673 3.33325 2.89065 3.33325 3.33268V16.666C3.33325 17.108 3.50885 17.532 3.82141 17.8445C4.13397 18.1571 4.55789 18.3327 4.99992 18.3327H14.9999C15.4419 18.3327 15.8659 18.1571 16.1784 17.8445C16.491 17.532 16.6666 17.108 16.6666 16.666V6.66602M11.6666 1.66602L16.6666 6.66602M11.6666 1.66602V6.66602H16.6666M13.3333 10.8327H6.66659M13.3333 14.166H6.66659M8.33325 7.49935H6.66659",stroke:"#1F5E72",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))),W=t=>s.createElement("svg",{width:36,height:20,viewBox:"0 0 36 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("g",{clipPath:"url(#clip0_16424_11607)"},s.createElement("rect",{width:36,height:20,rx:10,fill:"#1F5E72"}),s.createElement("g",{filter:"url(#filter0_dd_16424_11607)"},s.createElement("circle",{cx:26,cy:10,r:8,fill:"white"}))),s.createElement("defs",null,s.createElement("filter",{id:"filter0_dd_16424_11607",x:15,y:0,width:22,height:22,filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB"},s.createElement("feFlood",{floodOpacity:0,result:"BackgroundImageFix"}),s.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),s.createElement("feOffset",{dy:1}),s.createElement("feGaussianBlur",{stdDeviation:1}),s.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.0627451 0 0 0 0 0.0941176 0 0 0 0 0.156863 0 0 0 0.06 0"}),s.createElement("feBlend",{mode:"normal",in2:"BackgroundImageFix",result:"effect1_dropShadow_16424_11607"}),s.createElement("feColorMatrix",{in:"SourceAlpha",type:"matrix",values:"0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",result:"hardAlpha"}),s.createElement("feOffset",{dy:1}),s.createElement("feGaussianBlur",{stdDeviation:1.5}),s.createElement("feColorMatrix",{type:"matrix",values:"0 0 0 0 0.0627451 0 0 0 0 0.0941176 0 0 0 0 0.156863 0 0 0 0.1 0"}),s.createElement("feBlend",{mode:"normal",in2:"effect1_dropShadow_16424_11607",result:"effect2_dropShadow_16424_11607"}),s.createElement("feBlend",{mode:"normal",in:"SourceGraphic",in2:"effect2_dropShadow_16424_11607",result:"shape"})),s.createElement("clipPath",{id:"clip0_16424_11607"},s.createElement("rect",{width:36,height:20,rx:10,fill:"white"})))),Je=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M10.8333 1.66602H4.99992C4.55789 1.66602 4.13397 1.84161 3.82141 2.15417C3.50885 2.46673 3.33325 2.89065 3.33325 3.33268V16.666C3.33325 17.108 3.50885 17.532 3.82141 17.8445C4.13397 18.1571 4.55789 18.3327 4.99992 18.3327H14.9999C15.4419 18.3327 15.8659 18.1571 16.1784 17.8445C16.491 17.532 16.6666 17.108 16.6666 16.666V7.49935M10.8333 1.66602L16.6666 7.49935M10.8333 1.66602V7.49935H16.6666",stroke:"#1F5E72",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),ke=t=>s.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M18.3334 5.00065C18.3334 4.08398 17.5834 3.33398 16.6667 3.33398H3.33341C2.41675 3.33398 1.66675 4.08398 1.66675 5.00065M18.3334 5.00065V15.0007C18.3334 15.9173 17.5834 16.6673 16.6667 16.66
173H3.33341C2.41675 16.6673 1.66675 15.9173 1.66675 15.0007V5.00065M18.3334 5.00065L10.0001 10.834L1.66675 5.00065",stroke:"#1f5e72",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),Qe=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("rect",{width:20,height:20,fill:"#E5E5E5"}),s.createElement("g",{id:"Outreach R2 Email Improvised and Social media"},s.createElement("path",{d:"M-7052 -4393C-7052 -4394.1 -7051.1 -4395 -7050 -4395H59088C59089.1 -4395 59090 -4394.1 59090 -4393V6987C59090 6988.1 59089.1 6989 59088 6989H-7050C-7051.11 6989 -7052 6988.1 -7052 6987V-4393Z",fill:"#535353"}),s.createElement("path",{d:"M-7050 -4394H59088V-4396H-7050V-4394ZM59089 -4393V6987H59091V-4393H59089ZM59088 6988H-7050V6990H59088V6988ZM-7051 6987V-4393H-7053V6987H-7051ZM-7050 6988C-7050.55 6988 -7051 6987.55 -7051 6987H-7053C-7053 6988.66 -7051.66 6990 -7050 6990V6988ZM59089 6987C59089 6987.55 59088.6 6988 59088 6988V6990C59089.7 6990 59091 6988.66 59091 6987H59089ZM59088 -4394C59088.6 -4394 59089 -4393.55 59089 -4393H59091C59091 -4394.66 59089.7 -4396 59088 -4396V-4394ZM-7050 -4396C-7051.66 -4396 -7053 -4394.66 -7053 -4393H-7051C-7051 -4393.55 -7050.55 -4394 -7050 -4394V-4396Z",fill:"black",fillOpacity:.1}),s.createElement("g",{id:"03 Outreach - Prompt"},s.createElement("rect",{width:1440,height:1576,transform:"translate(-342 -420)",fill:"white"}),s.createElement("g",{id:"Group 3111"},s.createElement("g",{id:"Group 3110"},s.createElement("rect",{id:"base",x:-72,y:-84,width:1140,height:188,rx:18,fill:"#F9FAFA"}),s.createElement("g",{id:"Facebook toggle"},s.createElement("g",{id:"Frame 1"},s.createElement("g",{id:"Social icon",clipPath:"url(#clip0_14716_476)"},s.createElement("path",{id:"Vector",d:"M20 10C20 4.47715 15.5229 0 10 0C4.47715 0 0 4.47715 0 10C0 14.9912 3.65684 19.1283 8.4375 19.8785V12.8906H5.89844V10H8.4375V7.79688C8.4375 5.29063 9.93047 3.90625 12.2146 3.90625C13.3084 3.90625 14.4531 4.10156 14.4531 4.10156V6.5625H13.1922C11.95 6.5625 11.5625 7.3334 11.5625 8.125V10H14.3359L13.8926 12.8906H11.5625V19.8785C16.3432 19.1283 20 14.9912 20 10Z",fill:"#1877F2"})))))))),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_14716_476"},s.createElement("rect",{width:20,height:20,fill:"white"})))),et=t=>s.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("rect",{width:20,height:20,fill:"#E5E5E5"}),s.createElement("g",{id:"Outreach R2 Email Improvised and Social media"},s.createElement("path",{d:"M-7264 -4393C-7264 -4394.1 -7263.1 -4395 -7262 -4395H58876C58877.1 -4395 58878 -4394.1 58878 -4393V6987C58878 6988.1 58877.1 6989 58876 6989H-7262C-7263.11 6989 -7264 6988.1 -7264 6987V-4393Z",fill:"#535353"}),s.createElement("path",{d:"M-7262 -4394H58876V-4396H-7262V-4394ZM58877 -4393V6987H58879V-4393H58877ZM58876 6988H-7262V6990H58876V6988ZM-7263 6987V-4393H-7265V6987H-7263ZM-7262 6988C-7262.55 6988 -7263 6987.55 -7263 6987H-7265C-7265 6988.66 -7263.66 6990 -7262 6990V6988ZM58877 6987C58877 6987.55 58876.6 6988 58876 6988V6990C58877.7 6990 58879 6988.66 58879 6987H58877ZM58876 -4394C58876.6 -4394 58877 -4393.55 58877 -4393H58879C58879 -4394.66 58877.7 -4396 58876 -4396V-4394ZM-7262 -4396C-7263.66 -4396 -7265 -4394.66 -7265 -4393H-7263C-7263 -4393.55 -7262.55 -4394 -7262 -4394V-4396Z",fill:"black",fillOpacity:.1}),s.createElement("g",{id:"03 Outreach - Prompt"},s.createElement("rect",{width:1440,height:1576,transform:"translate(-554 -420)",fill:"white"}),s.createElement("g",{id:"Group 3111"},s.createElement("g",{id:"Group 3110"},s.createElement("rect",{id:"base",x:-284,y:-84,width:1140,height:188,rx:18,fill:"#F9FAFA"}),s.createElement("g",{id:"X/Twitter toggle"},s.createElement("g",{id:"Frame 1"},s.createElement("g",{id:"twitter-x 1",clipPath:"url(#clip0_14716_476)"},s.createElement("path",{id:"Vector",d:"M15.75 0.9375H18.8175L12.1175 8.615L20 19.0625H13.8287L8.995 12.725L3.46375 19.0625H0.395L7.56125 10.85L0 0.9375H6.32875L10.6975 6.72875L15.75 0.9375ZM14.675 17.2225H16.375L5.4037
15 2.68125H3.58125L14.675 17.2225Z",fill:"black"})))))))),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_14716_476"},s.createElement("rect",{width:20,height:20,fill:"white"})))),tt=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("g",{clipPath:"url(#clip0_16424_11637)"},s.createElement("path",{d:"M18.5195 0H1.47656C0.660156 0 0 0.644531 0 1.44141V18.5547C0 19.3516 0.660156 20 1.47656 20H18.5195C19.3359 20 20 19.3516 20 18.5586V1.44141C20 0.644531 19.3359 0 18.5195 0ZM5.93359 17.043H2.96484V7.49609H5.93359V17.043ZM4.44922 6.19531C3.49609 6.19531 2.72656 5.42578 2.72656 4.47656C2.72656 3.52734 3.49609 2.75781 4.44922 2.75781C5.39844 2.75781 6.16797 3.52734 6.16797 4.47656C6.16797 5.42188 5.39844 6.19531 4.44922 6.19531ZM17.043 17.043H14.0781V12.4023C14.0781 11.2969 14.0586 9.87109 12.5352 9.87109C10.9922 9.87109 10.7578 11.0781 10.7578 12.3242V17.043H7.79688V7.49609H10.6406V8.80078H10.6797C11.0742 8.05078 12.043 7.25781 13.4844 7.25781C16.4883 7.25781 17.043 9.23438 17.043 11.8047V17.043Z",fill:"#0A66C2"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_16424_11637"},s.createElement("rect",{width:20,height:20,fill:"white"})))),st=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("g",{clipPath:"url(#clip0_16424_11627)"},s.createElement("path",{d:"M10 1.80078C12.6719 1.80078 12.9883 1.8125 14.0391 1.85937C15.0156 1.90234 15.543 2.06641 15.8945 2.20313C16.3594 2.38281 16.6953 2.60156 17.043 2.94922C17.3945 3.30078 17.6094 3.63281 17.7891 4.09766C17.9258 4.44922 18.0898 4.98047 18.1328 5.95312C18.1797 7.00781 18.1914 7.32422 18.1914 9.99219C18.1914 12.6641 18.1797 12.9805 18.1328 14.0313C18.0898 15.0078 17.9258 15.5352 17.7891 15.8867C17.6094 16.3516 17.3906 16.6875 17.043 17.0352C16.6914 17.3867 16.3594 17.6016 15.8945 17.7813C15.543 17.918 15.0117 18.082 14.0391 18.125C12.9844 18.1719 12.668 18.1836 10 18.1836C7.32813 18.1836 7.01172 18.1719 5.96094 18.125C4.98438 18.082 4.45703 17.918 4.10547 17.7813C3.64063 17.6016 3.30469 17.3828 2.95703 17.0352C2.60547 16.6836 2.39063 16.3516 2.21094 15.8867C2.07422 15.5352 1.91016 15.0039 1.86719 14.0313C1.82031 12.9766 1.80859 12.6602 1.80859 9.99219C1.80859 7.32031 1.82031 7.00391 1.86719 5.95312C1.91016 4.97656 2.07422 4.44922 2.21094 4.09766C2.39063 3.63281 2.60938 3.29688 2.95703 2.94922C3.30859 2.59766 3.64063 2.38281 4.10547 2.20313C4.45703 2.06641 4.98828 1.90234 5.96094 1.85937C7.01172 1.8125 7.32813 1.80078 10 1.80078ZM10 0C7.28516 0 6.94531 0.0117187 5.87891 0.0585938C4.81641 0.105469 4.08594 0.277344 3.45313 0.523438C2.79297 0.78125 2.23438 1.12109 1.67969 1.67969C1.12109 2.23438 0.78125 2.79297 0.523438 3.44922C0.277344 4.08594 0.105469 4.8125 0.0585938 5.875C0.0117188 6.94531 0 7.28516 0 10C0 12.7148 0.0117188 13.0547 0.0585938 14.1211C0.105469 15.1836 0.277344 15.9141 0.523438 16.5469C0.78125 17.207 1.12109 17.7656 1.67969 18.3203C2.23438 18.875 2.79297 19.2188 3.44922 19.4727C4.08594 19.7188 4.8125 19.8906 5.875 19.9375C6.94141 19.9844 7.28125 19.9961 9.99609 19.9961C12.7109 19.9961 13.0508 19.9844 14.1172 19.9375C15.1797 19.8906 15.9102 19.7188 16.543 19.4727C17.1992 19.2188 17.7578 18.875 18.3125 18.3203C18.8672 17.7656 19.2109 17.207 19.4648 16.5508C19.7109 15.9141 19.8828 15.1875 19.9297 14.125C19.9766 13.0586 19.9883 12.7188 19.9883 10.0039C19.9883 7.28906 19.9766 6.94922 19.9297 5.88281C19.8828 4.82031 19.7109 4.08984 19.4648 3.45703C19.2188 2.79297 18.8789 2.23438 18.3203 1.67969C17.7656 1.125 17.207 0.78125 16.5508 0.527344C15.9141 0.28125 15.1875 0.109375 14.125 0.0625C13.0547 0.0117188 12.7148 0 10 0Z",fill:"#000100"}),s.createElement("path",{d:"M10 4.86328C7.16406 4.86328 4.86328 7.16406 4.86328 10C4.86328 12.8359 7.16406 15.1367 10 15.1367C12.8359 15.1367 15.1367 12.8359 15.1367 10C15.1367 7.16406 12.8359 4.86328 10 4.86328ZM10 13.332C8.16016 13.332 6.66797 11.8398 6.66797 10C6.66797 8.16016 8.16016 6.66797 10 6.66797C11.8398 6.66797 13.332 8.16016 13.332 10C13.332 11.8398 11.8398 13.332 10 13.332Z",fill:"#000100"}),s.createElement("path",{d:"M16.5391 4.66016C16.5391 5.32422 16 5.85938 15.3398 5.85938C14.6758 5.85938 14.1406 5.32031 14.1406 4.66016C14.1406 3.99609 14.6797 3.46094 15.3398 3.46094C16 3.46094 16.5391 4 16.5391 4.66016Z",fill:"#000100"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_16424_11627"},s.createElement("rect",{width:20,height:20,fill:"white"})))),at=t=>s.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("g",{clipPath:"url(#clip0_16424_11161)"},s.createElement("path",{d:"M17.0012 2.90757C16.0845 1.98194 14.9926 1.24813 13.7893 0.748936C12.586 0.249746 11.2953 -0.00482603 9.9925 6.92813e-05C4.53375 6.92813e-05 0.085 4.44757 0.08 9.90757C0.08 11.6563 0.5375 13.3576 1.40125 14.8638L0 20.0001L5.255 18.6226C6.70811 19.4154 8.33719 19.8302 9.9925 19.8288H9.9975C15.4575 19.8288 19.905 15.3813 19.91 9.91632C19.9111 8.61389 19.6546 7.32411 19.1551 6.12125C18.6557 4.91838 17.9245 3.82619 17.0012 2.90757ZM9.9925 18.1513C8.51647 18.1502 7.06778 17.753 5.7975 17.0013L5.4975 16.8213L2.38 17.6388L3.2125 14.5976L3.0175 14.2838C2.19226 12.9717 1.75581 11.4526 1.75875 9.90257C1.75875 5.37007 5.455 1.67257 9.9975 1.67257C11.0797 1.67063 12.1515 1.88291 13.1513 2.29718C14.151 2.71145 15.0589 3.31952 15.8225 4.08632C16.5886 4.85025 17.196 5.75825 17.6096 6.75798C18.0232 7.75771 18.2349 8.82941 18.2325 9.91132C18.2275 14.4601 14.5312 18.1513 9.9925 18.1513ZM14.5113 11.9838C14.265 11.8601 13.0487 11.2613 12.82 11.1763C12.5925 11.0951 12.4262 11.0526 12.2638 11.3001C12.0975 11.5463 11.6225 12.1076 11.48 12.2688C11.3375 12.4351 11.19 12.4538 10.9425 12.3313C10.
16962 12.2063 9.8975 11.9463 8.9525 11.1001C8.215 10.4438 7.72125 9.63132 7.57375 9.38507C7.43125 9.13757 7.56 9.00507 7.68375 8.88132C7.7925 8.77132 7.93 8.59132 8.05375 8.44882C8.17875 8.30632 8.22 8.20132 8.30125 8.03632C8.3825 7.86882 8.34375 7.72632 8.2825 7.60257C8.22 7.47882 7.72625 6.25757 7.5175 5.76507C7.3175 5.27882 7.11375 5.34632 6.96125 5.34007C6.81875 5.33132 6.6525 5.33132 6.48625 5.33132C6.36072 5.33451 6.2372 5.36358 6.12342 5.41671C6.00963 5.46984 5.90804 5.54588 5.825 5.64007C5.5975 5.88757 4.96125 6.48632 4.96125 7.70757C4.96125 8.92882 5.84875 10.1026 5.97375 10.2688C6.09625 10.4351 7.71625 12.9338 10.2025 14.0088C10.79 14.2651 11.2525 14.4163 11.6138 14.5313C12.2075 14.7213 12.7437 14.6926 13.1712 14.6313C13.6462 14.5588 14.635 14.0313 14.8438 13.4526C15.0487 12.8726 15.0488 12.3776 14.9862 12.2738C14.925 12.1688 14.7587 12.1076 14.5113 11.9838Z",fill:"#2AB540"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_16424_11161"},s.createElement("rect",{width:20,height:20,fill:"white"})))),nt=t=>s.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20Z",fill:"url(#paint0_linear_16732_4209)"}),s.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.5266 9.89397C7.4418 8.62386 9.38573 7.78653 10.3584 7.38197C13.1355 6.22688 13.7125 6.02623 14.0887 6.0196C14.1714 6.01814 14.3563 6.03865 14.4762 6.13587C14.5773 6.21796 14.6052 6.32885 14.6185 6.40668C14.6318 6.48451 14.6484 6.66181 14.6352 6.80034C14.4847 8.38158 13.8335 12.2188 13.5022 13.9898C13.3621 14.7392 13.0861 14.9905 12.8188 15.0151C12.2381 15.0685 11.7972 14.6313 11.2347 14.2626C10.3546 13.6857 9.85735 13.3265 9.00303 12.7635C8.01572 12.1129 8.65575 11.7553 9.21842 11.1709C9.36567 11.018 11.9243 8.69066 11.9739 8.47954C11.98 8.45313 11.9858 8.35471 11.9273 8.30274C11.8689 8.25077 11.7826 8.26854 11.7203 8.28267C11.632 8.30271 10.226 9.23203 7.50222 11.0706C7.10313 11.3447 6.74164 11.4782 6.41776 11.4712C6.06071 11.4635 5.37388 11.2693 4.8633 11.1034C4.23705 10.8998 3.73932 10.7922 3.78266 10.4465C3.80524 10.2664 4.05321 10.0822 4.5266 9.89397Z",fill:"white"}),s.createElement("defs",null,s.createElement("linearGradient",{id:"paint0_linear_16732_4209",x1:10,y1:0,x2:10,y2:19.8517,gradientUnits:"userSpaceOnUse"},s.createElement("stop",{stopColor:"#2AABEE"}),s.createElement("stop",{offset:1,stopColor:"#229ED9"})))),it=t=>s.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M17.5 12.5C17.5 12.942 17.3244 13.366 17.0118 13.6785C16.6993 13.9911 16.2754 14.1667 15.8333 14.1667H5.83333L2.5 17.5V4.16667C2.5 3.72464 2.67559 3.30072 2.98816 2.98816C3.30072 2.67559 3.72464 2.5 4.16667 2.5H15.8333C16.2754 2.5 16.6993 2.67559 17.0118 2.98816C17.3244 3.30072 17.5 3.72464 17.5 4.16667V12.5Z",stroke:"#1F5E72",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),lt=t=>s.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M10.668 28H21.3346M16.0013 22.6667V28M5.33464 4H26.668C28.1407 4 29.3346 5.19391 29.3346 6.66667V20C29.3346 21.4728 28.1407 22.6667 26.668 22.6667H5.33464C3.86188 22.6667 2.66797 21.4728 2.66797 20V6.66667C2.66797 5.19391 3.86188 4 5.33464 4Z",stroke:"#1F5E72",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})),ot=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M10 6.5C10 4.567 8.433 3 6.5 3V3C4.567 3 3 4.567 3 6.5V6.5C3 8.433 4.567 10 6.5 10V10C8.433 10 10 8.433 10 6.5V6.5Z",stroke:"#D0D5DD",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{d:"M21 6.5C21 4.567 19.433 3 17.5 3V3C15.567 3 14 4.567 14 6.5V6.5C14 8.433 15.567 10 17.5 10V10C19.433 10 21 8.433 21 6.5V6.5Z",stroke:"#D0D5DD",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{d:"M21 17.5C21 15.567 19.433 14 17.5 14V14C15.567 14 14 15.567 14 17.5V17.5C14 19.433 15.567 21 17.5 21V21C19.433 21 21 19.433 21 17.5V17.5Z",stroke:"#D0D5DD",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{d:"M10 17.5C10 15.567 8.433 14 6.5 14V14C4.567 14 3 15.567 3 17.5V17.5C3 19.433 4.567 21 6.5 21V21C8.433 21 10 19.433 10 17.5V17.5Z",stroke:"#D0D5DD",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),ct=t=>s.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M28 19.732V9.59863V9.59423C28 8.10369 28 7.35796 27.7096 6.78809C27.454 6.28632 27.0455 5.87834 26.5437 5.62268C25.9733 5.33203 25.2271 5.33203 23.7336 5.33203H8.26693C6.77345 5.33203 6.02616 5.33203 5.45573 5.62268C4.95396 5.87834 4.54631 6.28632 4.29065 6.78809C4 7.35852 4 8.10516 4 9.59863V24.8933C4 26.3142 4 27.0248 4.29128 27.3897C4.54459 27.707 4.92858 27.8917 5.33464 27.8912C5.80153 27.8907 6.35658 27.4468 7.46615 26.5592L9.4981 24.9336C9.93125 24.5871 10.1478 24.4139 10.389 24.2907C10.6029 24.1814 10.8304 24.1014 11.0658 24.0531C11.331 23.9987 11.6087 23.9987 12.1634 23.9987H23.7334C25.2269 23.9987 25.9733 23.9987 26.5437 23.708C27.0455 23.4523 27.454 23.0445 27.7096 22.5427C28 21.9729 28 21.2269 28 19.7364V19.732Z",stroke:"#1F5E72",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})),ls=[{title:"In App Updates",icon:e.jsx(lt,{}),items:[{id:"newsFeed",name:"Newsfeed",toggleButton:e.jsx(W,{}),icon:e.jsx(Xe,{})},{id:"email",name:"Email",toggleButton:e.jsx(W,{}),icon:e.jsx(ke,{})}
1,{id:"fundRaising",name:"Fund Raising",toggleButton:e.jsx(W,{}),icon:e.jsx(Je,{})}]},{title:"Social Media",icon:e.jsx(ot,{className:"social-icon"}),items:[{id:"instagram",name:"Instagram",toggleButton:e.jsx(W,{}),icon:e.jsx(st,{})},{id:"facebook",name:"Facebook",toggleButton:e.jsx(W,{}),icon:e.jsx(Qe,{})},{id:"twitter",name:"X/Twitter",toggleButton:e.jsx(W,{}),icon:e.jsx(et,{})},{id:"linkedIn",name:"LinkedIn",toggleButton:e.jsx(W,{}),icon:e.jsx(tt,{})}]},{title:"Messaging Apps",icon:e.jsx(ct,{}),label:"Currently, we are only generating content for messaging apps. Posting is coming soon.",items:[{id:"whatsapp",name:"WhatsApp",toggleButton:e.jsx(W,{}),icon:e.jsx(at,{})},{id:"telegram",name:"Telegram",toggleButton:e.jsx(W,{}),icon:e.jsx(nt,{})},{id:"textMessage",name:"Text Message",toggleButton:e.jsx(W,{}),icon:e.jsx(it,{})}]}],os=({handleChannelToggle:t,outreachData:i,linkedTo:n})=>{const a=(o,m)=>{o.forEach(c=>{t(c.id,!m)})};return e.jsxs("div",{className:"channel-container",children:[e.jsx(Y,{type:"h3",children:"Selected Desired Channels"}),e.jsx("div",{className:"selected-desired-channels",children:ls.map((o,m)=>{const c=o.items.every(p=>i.channels[p.id]);return e.jsxs("div",{className:"channel-group",children:[e.jsxs("div",{className:"group-title",children:[o.icon,e.jsx(Y,{type:"h3",children:o.title}
1),e.jsx(Ot,{icons:!1,checked:c,className:"group-toggle",onChange:()=>a(o.items,c)}),o.label&&e.jsx("span",{children:o.label})]}),e.jsx("div",{className:"channels-horizontal",children:o.items.map((p,y)=>e.jsx("div",{className:"channel-container-child",children:e.jsx("div",{className:"toggle-container",children:e.jsxs("div",{className:"toggle-wrapper",children:[e.jsx("div",{className:`channel-icon ${i.channels[p.id]?"":"grayed-out"}`,children:p.icon}),e.jsx("div",{className:`channel-name ${i.channels[p.id]?"":"grayed-out"}`,children:p.name==="Fund Raising"?n.category?`${z(n.category)} Page`:"":p.name})]})},p.id)},y))})]},m)})})]})},cs=t=>s.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("rect",{x:.5,y:.5,width:31,height:31,rx:15.5,fill:"white"}),s.createElement("rect",{x:.5,y:.5,width:31,height:31,rx:15.5,stroke:"#FAAC32"}),s.createElement("circle",{cx:16,cy:16,r:8,fill:"#FAAC32"})),Re=t=>s.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("rect",{x:.5,y:.5,width:31,height:31,rx:15.5,fill:"#FAAC32"}),s.createElement("rect",{x:.5,y:.5,width:31,height:31,rx:15.5,stroke:"#FAAC32"}),s.createElement("path",{d:"M22.6673 11L13.5007 20.1667L9.33398 16",stroke:"#1F5E72",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})),ie=t=>s.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("g",{clipPath:"url(#clip0_16438_2618)"},s.createElement("path",{d:"M3.75 11.25H3C2.60218 11.25 2.22064 11.092 1.93934 10.8107C1.65804 10.5294 1.5 10.1478 1.5 9.75V3C1.5 2.60218 1.65804 2.22064 1.93934 1.93934C2.22064 1.65804 2.60218 1.5 3 1.5H9.75C10.1478 1.5 10.5294 1.65804 10.8107 1.93934C11.092 2.22064 11.25 2.60218 11.25 3V3.75M8.25 6.75H15C15.8284 6.75 16.5 7.42157 16.5 8.25V15C16.5 15.8284 15.8284 16.5 15 16.5H8.25C7.42157 16.5 6.75 15.8284 6.75 15V8.25C6.75 7.42157 7.42157 6.75 8.25 6.75Z",stroke:"var(--secondary-color)",strokeWidth:1.67,strokeLinecap:"round",strokeLinejoin:"round"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_16438_2618"},s.createElement("rect",{width:18,height:18,fill:"white"})))),rt=({outreach:t,steps:i,generated:n,completed:a,outreachLink:o,outreachType:m,outreachStep:c})=>{const[p,y]=X.useState(!1),g=j=>{navigator.clipboard.writeText(t.shortUrl),y(!0),setTimeout(()=>y(!1),1e3),j.preventDefault()};return e.jsxs("div",{className:"progress-bar-atom",children:[n&&e.jsxs("div",{className:"outreach-linked-to",children:[e.jsx("b",{children:"Linked To:"})," ",o," (",m,")"," ",e.jsx(ie,{onClick:g}),p&&e.jsx("span",{children:"copied!"})]}),e.jsx("div",{className:"progress-sequence",children:i.map((j,E)=>e.jsx("div",{className:"progress-step",children:e.jsxs("div",{className:"icon-and-label",children:[e.jsx("div",{className:"circle-progress-icon",children:n&&E<2||a&&E===i.length-1?e.jsx(Re,{className:"progress-completed"}):c===2&&E===0?e.jsx(Re,{className:"progress-completed"}):e.jsx(cs,{})}),e.jsx("span",{children:j})]})},E))})]})},rs=t=>s.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"var(--secondary-color)",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M7.99967 1.33398L10.0597 5.50732L14.6663 6.18065L11.333 9.42732L12.1197 14.014L7.99967 11.8473L3.87967 14.014L4.66634 9.42732L1.33301 6.18065L5.93967 5.50732L7.99967 1.33398Z",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),pe=({id:t,square:i,index:n,setError:a,isDefault:o,width:m,file:c,type:p,setFile:y,subText:g,edit:j,smallIcon:E,crop:I,markAsDefaultCallback:b,openDialog:x})=>{const[h,f]=s.useState(!1),[N,M]=s.useState(!1),[k,L]=s.useState(null),v=X.useRef(null),w=()=>{j&&x?x():j&&v.current.click()},C=r=>{const l=r.target.files[0];if(I)if(l.name.toLowerCase().match(/\.(jpg|jpeg|png|gif)$/)){const u=new FileReader;u.readAsDataURL(l),u.onloadend=()=>{L(u.result),f(!0)}}else return a?a("Please select a valid image format"):Z.error("Please select a valid image format"),S(),!1;else if(l){const u=Math.round(l.size/1024)/1024;if(l.name.toLowerCase().match(/\.(jpg|jpeg|png|gif)$/)){if(u>4)return a?(M(!0),a("You can only upload files less than 4MB")):Z.error("File too large. Please select a file less than 4MB"),S(),!1;u<4&&M(!1)}else return a?a("Please select a valid image format"):Z.error("Please select a valid image format"),S(),!1;const d=new FileReader;d.readAsDataURL(l),d.onloadend=function(A){a&&a(!1),y(d.result)}}},S=r=>{r&&r.stopPropagation(),y(""),v.current.value=null},D=r=>{r.stopPropagation(),b&&b(n)},T=r=>{y(r),L(null)};return e.jsxs("div",{className:"image-previewer-and-edit-component-outreach",children:[e.jsxs("div",{className:`image-previewer-and-edit-container ${i?"square":""} ${E?"smallIcon":""} ${c?"image-exist":"no-image"} ${j?"image-edit":""} ${N?"large-file":""}`,style:{width:m,height:m},onClick:w,children:[c?X.createElement("img",{id:t,src:c.url||c,alt:"preview"}):X.createElement(Ut,{id:t,alt:"preview"}),g&&!c&&e.jsx("span",{className:"sub-text",children:g}),j&&e.jsxs("span",{className:"icon-button-container",children:[e.jsx(Zt,{className:"edit-icon"}),c&&j&&e.jsx(_t,{onClick:r=>S(r),className:"remove-icon"}),p==="social"&&e.jsx(rs,{onClick:r=>D(r),className:"star-icon"})]}),e.jsx("input",{ref:v,type:"file",accepts:"images/*",onChange:C,id:"myFile"})]}),o&&e.jsx("span",{className:"bold-text",children:"Default"}),e.jsx(Ye,{show:h,onHide:()=>{f(!1)},imageSrc:k,onImageCropped:T,aspectRatio:I})]})},ds=({count:t,images:i=[],subText:n,setImages:a,gallery:o,type:m,onlyImages:c,width:p,defaultIndex:y,markAsDefaultCallback:g})=>{const[j,E]=s.useState(!1),I=i.filter(v=>v).map(v=>v.data_url?v.data_url:v),b=(v,w)=>{const C=[...I];C[w]=v,a(C)},[x,h]=s.useState(!1),[f,N]=s.useState(null),M=v=>{N(v),h(!0)},k=()=>{h(!1)},L=v=>{if(f!==null){const w=[...I];w[f]=v.url,a(w)}k()};return e.jsx("div",{className:"images-upload-with-fix-number-component-outreach",children:e.jsxs("div",{className:"images-container",children:[o&&e.jsx(e.Fragment,{children:e.jsx(pe,{setError:E,id:"context-image0",file:I[0]?I[0]:"",setFile:v=>b(v,0),square:!0,type:!0,smallIcon:!0,edit:!0,width:"180px"})}),e.jsx("div",{className:"images",children:Array(t).fill("").map((v,w)=>e.jsxs("div",{className:"image-wrapper",children:[e.jsx(pe,{index:w,setError:E,id:`context-image${w+1}`,file:I[o?w+1:w]||"",setFile:C=>b(C,o?w+1:w),markAsDefaultCallback:g,type:m,square:!0,subText:n&&e.jsx("p",{className:"sub-text",children:n}),smallIcon:!0,edit:!0,width:p||"142px",isDefault:y===w,openDialog:()=>M(o?w+1:w)},w),e.jsx(Ge,{open:x,handleClose:k,isInMediaLibrary:!0,handleSelectFileFrom
1Library:L})]},w))}),!c&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"subtext",children:e.jsxs("p",{children:["You can add up to ",o?t:t-1," images."]})}),e.jsx("br",{}),e.jsxs("div",{className:"subtext1 text-center",children:["Recommended Dimensions: â",e.jsx("span",{className:"dark",children:"1080 px width â 1080 px height"})]}),e.jsxs("div",{className:"subtext1 text-center",children:[e.jsx("span",{className:"note-red",children:" Note: "})," Images other than the mentioned dimension may not look good."]})]}),e.jsx("div",{className:"error-red text-center",children:j})]})})},$e=({type:t,outreachData:i,handleInputChange:n,setDefaultImageIndex:a,defaultIndex:o})=>{var L;const[m,c]=s.useState(!1),{mediaLibrary:p}=_(v=>v.mediaLibrary),[y,g]=s.useState(null),[j,E]=s.useState(null),[I,b]=s.useState(!1),x=14/5,h=(v,w)=>{g({field:v,imageType:w}),c(!0)},f=()=>{c(!1)},N=v=>{if(y){let w;y.field==="emailImages"&&(y.imageType==="banner"?(w={...i.emailImages,banner:v.url},E(v.url),b(!0)):y.imageType==="body"&&(w={...i.emailImages,body:v.url})),n(y.field,w),f()}},M=v=>{const w=document.createElement("canvas"),C=w.getContext("2d");w.width=1400,w.height=500;const S=new Image;S.src=v,S.crossOrigin="anonymous",S.onload=()=>{C.drawImage(S,0,0,1400,500);const D=w.toDataURL("image/jpeg"),T=k(D),r=`resized_${Date.now()}.jpg`,l=new File([T],r,{type:"image/jpeg"}),u=He.storage().ref(`media_library/${r}`);u.put(l).on("state_changed",A=>{},A=>{console.error("Upload error:",A)},async()=>{const A=await u.getDownloadURL();n("emailImages",{...i.emailImages,banner:A});const H=p.find(V=>V.url===i.emailImages.banner);if(H){const B=He.functions().httpsCallable("manageMediaLibrary-manageMediaLibrary");try{await B({type:"updateWithCroppedURL",docId:H.id,croppedUrl:A,fundraiser:""})}catch(P){console.error("Error adding cropped URL to media library:",P)}}else console.error("Original image not found in media library for cropping.");E(null),b(!1)})}};function k(v){const w=v.split(","),C=w[0].match(/:(.*?);/)[1],S=atob(w[1]);let D=S.length;const T=new Uint8Array(D);for(;D--;)T[D]=S.charCodeAt(D);return new Blob([T],{type:C})}return e.jsxs("div",{children:[e.jsxs(Y,{type:"h3",children:["Upload ",t==="email"?"Email":"Social Media"," Images"]}),e.jsx("div",{className:"context-section-content",children:e.jsxs("div",{className:"context-images",children:[t==="email"&&e.jsxs("div",{className:"banner-image",children:[e.jsx(pe,{edit:!0,subText:"Recommended size for banner: 1200 x 300",crop:4/1,file:i.emailImages.banner,setFile:v=>n("emailImages",{...i.emailImages,banner:v}),openDialog:()=>h("emailImages","banner")}),e.jsx("div",{className:"image-subtext",children:"Banner"})]}),t==="email"&&e.jsxs("div",{className:"body-image",children:[e.jsx(pe,{edit:!0,subText:"Recommended size for body: 400 x 400",file:i[`${t}Images`].body,setFile:v=>n(`${t}Images`,{...i[`${t}Images`],body:v}),openDialog:()=>h(`${t}Images`,"body")}),e.jsx(Ge,{open:m,handleClose:f,isInMediaLibrary:!0,handleSelectFileFromLibrary:N}),e.jsx("div",{className:"image-subtext",children:"Body"})]}),t==="social"&&e.jsx("div",{className:"body-image",children:e.jsx(ds,{count:6,edit:!0,subText:"Recommended size for body: 400 x 400",images:((L=i[`${t}Images`])==null?void 0:L.bodyImages)||[],setImages:v=>{var w,C,S,D,T,r,l;return n(`${t}Images`,{...i[`${t}Images`],bodyImages:v,DefaultImage:((w=i[`${t}Images`])==null?void 0:w.DefaultImage)||0,facebook:((C=i[`${t}Images`])==null?void 0:C.DefaultImage)||0,instagram:((S=i[`${t}Images`])==null?void 0:S.DefaultImage)||0,linkedIn:((D=i[`${t}Images`])==null?void 0:D.DefaultImage)||0,telegram:((T=i[`${t}Images`])==null?void 0:T.DefaultImage)||0,twitter:((r=i[`${t}Images`])==null?void 0:r.DefaultImage)||0,whatsapp:((l=i[`${t}Images`])==null?void 0:l.DefaultImage)||0})},onlyImages:!0,type:t,width:172,height:172,markAsDefaultCallback:v=>{a(v),n(`${t}Images`,{...i[`${t}Images`],DefaultImage:v,facebook:v,instagram:v,linkedIn:v,whatsapp:v,twitter:v,telegram:v})},defaultIndex:o})})]})}),e.jsx(Ye,{show:I,onHide:()=>{b(!1)},imageSrc:j,onImageCropped:M,aspectRatio:x})]})},ye=()=>{const{id:t,outreachPage:i}=xe(),n=jt(),a=new URLSearchParams(n.search),o=a.get("type"),m=a.get("value"),c=Ie(),{activeOutreach:p,outreachDrafts:y}=_(r=>r.outreach),[g,j]=s.useState(ze),[E,I]=s.useState(We),[b,x]=s.useState(0),h=ge("causeName"),f=ge("campaignName"),{allCampaigns:N,allCauseProjects:M}=_(r=>r.campaign),{allEvents:k}=_(r=>r.events);let L;const v=X.useMemo(()=>[{label:h,options:M},{label:f,options:N},{label:"Events",options:k}],[h,f,N,M,k]),w=i==="edit",C=Ie(g.subtype.idToStore)||{};s.useEffect(()=>{var A,H,V,B,P,R,$,U,G,te,K;if(!c||o)return;const r=O=>
1({...O,subtype:{idToStore:c.campaignId,label:c.category,value:c.campaignName},shortUrl:c.shortUrl,organizationId:c.organizationId});if(!t){j(r);return}const l=p.find(O=>O.id===t)||y.find(O=>O.id===t),u={email:!!((A=l==null?void 0:l.channels)!=null&&A.email||l!=null&&l.email),facebook:!!((H=l==null?void 0:l.channels)!=null&&H.facebook||l!=null&&l.facebook),fundRaising:!!((V=l==null?void 0:l.channels)!=null&&V.fundRaising||l!=null&&l.fundRaising),instagram:!!((B=l==null?void 0:l.channels)!=null&&B.instagram||l!=null&&l.instagram),linkedIn:!!((P=l==null?void 0:l.channels)!=null&&P.linkedIn||l!=null&&l.linkedIn),newsFeed:!!((R=l==null?void 0:l.channels)!=null&&R.newsFeed||l!=null&&l.newsFeed),telegram:!!(($=l==null?void 0:l.channels)!=null&&$.telegram||l!=null&&l.telegram),textMessage:!!((U=l==null?void 0:l.channels)!=null&&U.textMessage||l!=null&&l.textMessage),twitter:!!((G=l==null?void 0:l.channels)!=null&&G.twitter||l!=null&&l.twitter),whatsapp:!!((te=l==null?void 0:l.channels)!=null&&te.whatsapp||l!=null&&l.whatsapp)};if(!l){j(r);return}let d;if(!we.isObject(l.subtype)){const O=M.find(Q=>Q.campaignId===l.subtype)||N.find(Q=>Q.campaignId===l.subtype)||k.find(Q=>Q.eventId===l.subtype);d={idToStore:O.campaignId||O.eventId,label:O.eventName?"Events":O.type?z(h):z(f),value:O.campaignName}}j(O=>({...O,name:l.name||"",description:l.description||"",emailImages:l.emailImages||{},outreachType:l.outreachType||"",tone:l.tone||St[0],demographic:l.demographic||Et[0],channels:w?u:l.channels||{...O.channels},subtype:(we.isObject(l.subtype)?g.subtype:d)||{idToStore:c.campaignId,label:c.category,value:c.campaignName},shortUrl:l.shortUrl||c.shortUrl,id:l.id||"",fromDraft:l.status==="draft",socialImages:l.socialImages||[]})),x(((K=l.socialImages)==null?void 0:K.DefaultImage)||0)},[c,t,p,y,o,w]),X.useEffect(()=>{const r=v.find(l=>Array.isArray(l.options)?l.options.find(u=>u.campaignId===m||u.eventId===m):null);if(r){const l=r.options.find(u=>u.campaignId===m||u.eventId===m);if(l){const u={label:l.eventName?"Events":l.type?z(h):z(f),value:l.eventName||l.campaignName,idToStore:l.campaignId||l.eventId||""};if(u.idToStore){const d=l==null?void 0:l.shortUrl;j(A=>({...A,subtype:u,outreachType:u,organizationId:l.organizationId,shortUrl:d||A.shortUrl}))}}}},[o,v,f,h,m]);const S=(r,l,u,d)=>{j(A=>({...A,[r]:l,shortUrl:u||A.shortUrl,organizationId:d||A.organizationId}))},D=(r,l)=>{I(u=>({...u,[r]:l}))},T=r=>{j(l=>{const u={...l.channels},d=!u[r];u[r]=!u[r];const A=Object.entries(u).some(([H,V])=>kt.includes(H)&&V);return w?{...l,channels:u,socialsStatus:A,[r]:w?d?l[r]:"":l[r]}:{...l,channels:u,socialsStatus:A}})};return e.jsxs("div",{className:"individual-outreach-page",children:[e.jsx(is,{outreachError:E,outreachData:g,setOutreachData:j,setOutreachError:I,draftVisibility:!!t}),e.jsxs("div",{className:"outreach-container",children:[e.jsx(rt,{steps:qe}),e.jsxs("div",{className:"basic-outreach-details",children:[e.jsx(Ht,{min:50,characterCount:4e3,name:"name",label:"Outreach name",required:!0,value:g.name,error:E.name,setError:r=>D("name",r),setValue:r=>S("name",r)}),e.jsx(ns,{onSelectChange:(r,l,u)=>S("subtype",r,l,u),defaultSelectedOption:we.isObject(g.subtype)?g.subtype:L,outreachLinked:!0,valueId:m,selectedCauseLabel:o})]}),e.jsx(os,{outreachData:g,handleChannelToggle:T,linkedTo:C}),e.jsxs("div",{className:"prompt-container",children:[e.jsx(Y,{type:"h3",children:"Description"}),e.jsx(Ft,{min:50,characterCount:4e3,label:"Outreach Description",required:!0,placeholder:"This is the description of the outreach. It will be sent to AI as prompt for content generation across desired channels.",name:"description",value:g.description,error:E.description,setValue:r=>S("description",r),setError:r=>D("description",r)}),e.jsx(Rt,{data:g,handleTone:r=>S("tone",r),handleDemographic:r=>S("demographic",r)}),g.channels.email&&e.jsx($e,{type:"email",outreachData:g,handleInputChange:S,setDefaultImageIndex:x,defaultIndex:b}),g.socialsStatus&&e.jsx($e,{type:"social",outreachData:g,handleInputChange:S,setDefaultImageIndex:x,defaultIndex:b})]})]})]})},ms=t=>s.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("rect",{x:.5,y:.5,width:19,height:19,rx:5.5,fill:"white"}),s.createElement("rect",{x:.5,y:.5,width:19,height:19,rx:5.5,stroke:"#D3D2D2"})),hs=t=>s.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("rect",{width:20,height:20,rx:6,fill:"#FAAC32"}),s.createElement("path",{d:"M14.6654 6.5L8.2487 12.9167L5.33203 10",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})),gs=async(t,i,n)=>{const a={...i,channels:{...i.channels,[t]:!0}
1,regeneratePrompt:n},o=await ne(a);console.log("resp",o)};function us(t){var o,m,c,p;if(!t)return console.error("Data is undefined."),[];const i={twitter:{postId:((o=t==null?void 0:t.twitter)==null?void 0:o.parentPostId)||""},facebook:{postId:((m=t==null?void 0:t.facebook)==null?void 0:m.parentPostId)||""},linkedin:{postId:((c=t==null?void 0:t.linkedIn)==null?void 0:c.parentPostId)||""},instagram:{postId:((p=t==null?void 0:t.instagram)==null?void 0:p.parentPostId)||""}};return Object.values(i).map(y=>y.postId).filter(y=>y!=="")}const se=({icon:t,label:i,value:n,onClick:a,style:o,posted:m})=>e.jsxs("div",{style:o,onClick:a,className:"stats-gap-icon",children:[t&&e.jsx(t,{className:m?"icon-active":""}),e.jsxs("div",{children:[i,": ",n||0]})]}),ps=async(t,i,n,a)=>{try{const o=At,m={"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")}`,"Access-Control-Allow-Origin":o},c={projectId:"cido-infaque",post:t,platforms:[i],media:n,outreachId:a,action:"post"},p=await J.post(o,c,{headers:m});if(p.status===200)return p.data}catch(o){return o}},xs=async()=>{try{const t=Mt,i={"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")}`,"Access-Control-Allow-Origin":t},n={projectId:"cido-infaque",action:"profileDetails"},a=await J.post(t,n,{headers:i});if(a.status===200)return a.data.responseData}catch(t){console.error(t)}},Cs=async({postIds:t,outreachId:i})=>{try{const n=Lt,a={"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("token")}`,"Access-Control-Allow-Origin":n},o={projectId:"cido-infaque",analyticspostIds:t,action:"analytics",outreachId:i},m=await J.post(n,o,{headers:a});if(m.status===200)return m.data}catch(n){return n}};function fs(t,i,n){const a=s.useRef();s.useEffect(()=>{a.current=t},[t]),s.useEffect(()=>{function o(){a.current()}if(n){let m=setInterval(o,i);return()=>clearInterval(m)}},[i,n])}const js=(t,i)=>{const{activeOutreach:n,inactiveOutreach:a}=_(x=>x.outreach),[o,m]=s.useState(0),[c,p]=s.useState({}),[y,g]=s.useState(null),j=xe().id,E=s.useMemo(()=>[...a,...n],[a,n]);s.useEffect(()=>{if(!j||!E.length)return;const x=E.find(f=>f.id===j);if(!x)return;p({...x});const h=us(x);h.length&&I(h,x)},[j,E]);const I=(x,h)=>{Cs({postIds:x,outreachId:h.id}).then(f=>{g(f)}).catch(f=>{console.error("Error fetching post analytics:",f)})};return fs(()=>{m(x=>(x+1)%t)},i,(()=>{if(Object.keys(c).length)return Object.values(c.channels).some(x=>x===!0)})()),{currentIndex:o,outreach:c,setOutreach:p,postAnalytics:y}},Le=t=>s.createElement("svg",{width:40,height:40,viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("circle",{cx:20,cy:19.998,r:20,transform:"rotate(-180 20 19.998)",fill:"var(--primary-color)"}),s.createElement("path",{d:"M21.9925 14.3909L26.455 19.746C27.9886 21.5863 28.7554 22.5065 28.4057 23.2532C28.0559 24 26.8581 24 24.4626 24L15.5374 24C13.1419 24 11.9441 24 11.5943 23.2532C11.2446 22.5065 12.0114 21.5863 13.545 19.746L18.0075 14.3909C18.9309 13.2829 19.3926 12.7289 20 12.7289C20.6074 12.7289 21.0691 13.2829 21.9924 14.3909L21.9925 14.3909Z",fill:"black"})),Me=t=>s.createElement("svg",{width:40,height:40,viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("rect",{width:40,height:40,fill:"#E5E5E5"}),s.createElement("g",{id:"Outreach R2 Email Improvised and Social media"},s.createElement("path",{d:"M-34325 -4301C-34325 -4302.1 -34324.1 -4303 -34323 -4303H31815C31816.1 -4303 31817 -4302.1 31817 -4301V7079C31817 7080.1 31816.1 7081 31815 7081H-34323C-34324.1 7081 -34325 7080.1 -34325 7079V-4301Z",fill:"#535353"}),s.createElement("path",{d:"M-34323 -4302H31815V-4304H-34323V-4302ZM31816 -4301V7079H31818V-4301H31816ZM31815 7080H-34323V7082H31815V7080ZM-34324 7079V-4301H-34326V7079H-34324ZM-34323 7080C-34323.6 7080 -34324 7079.55 -34324 7079H-34326C-34326 7080.66 -34324.7 7082 -34323 7082V7080ZM31816 7079C31816 7079.55 31815.6 7080 31815 7080V7082C31816.7 7082 31818 7080.66 31818 7079H31816ZM31815 -4302C31815.6 -4302 31816 -4301.55 31816 -4301H31818C31818 -4302.66 31816.7 -4304 31815 -4304V-4302ZM-34323 -4304C-34324.7 -4304 -34326 -4302.66 -34326 -4301H-34324C-34324 -4301.55 -34323.6 -4302 -34323 -4302V-4304Z",fill:"black",fillOpacity:.1}),s.createElement("g",{id:"07 Outreach - Generated/Fund raising page"},s.createElement("rect",{width:1440,height:4128,transform:"translate(-1370 -328)",fill:"white"}),s.createElement("g",{id:"Frame 2651"},s.createElement("g",{id:"Frame 2650"},s.createElement("g",{id:"Frame 2647"},s.createElement("g",{id:"Group 2920"},s.createElement("circle",{id:"Ellipse 136",cx:20,cy:20,r:20,fill:"#D3D2D2"})),s.createElement("path",{id:"Vector 6",d:"M18.0075 25.6091L13.545 20.254C12.0114 18.4137 11.2446 17.4935 11.5943 16.7468C11.9441 16 13.1419 16 15.5374 16L24.4626 16C26.8581 16 28.0559 16 28.4057 16.7468C28.7554 17.4935 27.9886 18.4137 26.455 20.254L21.9925 25.6091C21.0691 26.7171 20.6074 27.2711 20 27.2711C19.3926 27.2711 18.9309 26.7171 18.0076 25.6091L18.0075 25.6091Z",fill:"black"}))))))),ee=t=>s.createElement("svg",{width:141,height:140,viewBox:"0 0 141 140",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("rect",{x:.0742188,width:140.897,height:140,rx:8,fill:"#F1F2F2"}),s.createElement("path",{d:"M55.5524 53C54.1844 53 52.8725 53.5117 51.9052 54.4226C50.9379 55.3335 50.3945 56.5689 50.3945 57.8571V82.1429C50.3945 83.4311 50.9379 84.6665 51.9052 85.5774C52.8725 86.4883 54.1844 87 55.5524 87H86.4993C87.8672 87 89.1791 86.4883 90.1464 85.5774C91.1137 84.6665 91.6571 83.4311 91.6571 82.1429V57.8571C91.6571 56.5689 91.1137 55.3335 90.1464 54.4226C89.1791 53.5117 87.8672 53 86.4993 53H55.5524ZM86.4993 55.4286C87.1833 55.4286 87.8392 55.6844 88.3229 56.1399C88.8065 56.5953 89.0782 57.213 89.0782 57.8571V73.6429L79.3377 68.9144C79.0958 68.8003 78.822 68.7608 78.5549 68.8013C78.2879 68.8418 78.0412 68.9604 77.8496 69.1403L68.2819 78.1503L61.422 73.8469C61.1743 73.6916 60.8772 73.6217 60.5811 73.6492C60.285 73.6766 60.008 73.7997 59.7972 73.9974L52.9734 79.7143V57.8571C52.9734 57.213 53.2451 56.5953 53.7288 56.1399C54.2124 55.6844 54.8684 55.4286 55.5524 55.4286H86.4993Z",fill:"#A7A5A6"})),Ae=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("circle",{cx:12,cy:12,r:12,fill:"#7B7979"}),s.createElement("path",{d:"M16.5 7.5L7.5 16.5",stroke:"white",strokeWidth:2.31004,strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{d:"M7.5 7.5L16.5 16.5",stroke:"white",strokeWidth:2.31004,strokeLinecap:"round",strokeLinejoin:"round"})),Te=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("circle",{cx:12,cy:12,r:12,fill:"#EBEDED"}),s.createElement("path",{d:"M8.85 13.35H8.4C8.16131 13.35 7.93239 13.2552 7.7636 13.0864C7.59482 12.9176 7.5 12.6887 7.5 12.45V8.4C7.5 8.16131 7.59482 7.93239 7.7636 7.7636C7.93239 7.59482 8.16131 7.5 8.4 7.5H12.45C12.6887 7.5 12.9176 7.59482 13.0864 7.7636C13.2552 7.93239 13.35 8.16131 13.35 8.4V8.85M11.55 10.65H15.6C16.0971 10.65 16.5 11.0529 16.5 11.55V15.6C16.5 16.0971 16.0971 16.5 15.6 16.5H11.55C11.0529 16.5 10.65 16.0971 10.65 15.6V11.55C10.65 11.0529 11.0529 10.65 11.55 10.65Z",stroke:"var(--secondary-color)",strokeLinecap:"round",strokeLinejoin:"round"})),Oe="data:image/svg+xml,%3csvg%20width='141'%20height='140'%20viewBox='0%200%20141%20140'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20x='0.0742188'%20width='140.897'%20height='140'%20rx='8'%20fill='%23F1F2F2'/%3e%3cpath%20d='M55.5524%2053C54.1844%2053%2052.8725%2053.5117%2051.9052%2054.4226C50.9379%2055.3335%2050.3945%2056.5689%2050.3945%2057.8571V82.1429C50.3945%2083.4311%2050.9379%2084.6665%2051.9052%2085.5774C52.8725%2086.4883%2054.1844%2087%2055.5524%2087H86.4993C87.8672%2087%2089.1791%2086.4883%2090.1464%2085.5774C91.1137%2084.6665%2091.6571%2083.4311%2091.6571%2082.1429V57.8571C91.6571%2056.5689%2091.1137%2055.3335%2090.1464%2054.4226C89.1791%2053.5117%2087.8672%2053%2086.4993%2053H55.5524ZM86.4993%2055.4286C87.1833%2055.4286%2087.8392%2055.6844%2088.3229%2056.
11399C88.8065%2056.5953%2089.0782%2057.213%2089.0782%2057.8571V73.6429L79.3377%2068.9144C79.0958%2068.8003%2078.822%2068.7608%2078.5549%2068.8013C78.2879%2068.8418%2078.0412%2068.9604%2077.8496%2069.1403L68.2819%2078.1503L61.422%2073.8469C61.1743%2073.6916%2060.8772%2073.6217%2060.5811%2073.6492C60.285%2073.6766%2060.008%2073.7997%2059.7972%2073.9974L52.9734%2079.7143V57.8571C52.9734%2057.213%2053.2451%2056.5953%2053.7288%2056.1399C54.2124%2055.6844%2054.8684%2055.4286%2055.5524%2055.4286H86.4993Z'%20fill='%23A7A5A6'/%3e%3c/svg%3e",dt=({images:t,defaultIndex:i,setDefaultImageIndex:n,outreach:a,title:o})=>{const[m,c]=s.useState(t[i]||null),[p,y]=s.useState((a==null?void 0:a.socialImages[o.toLowerCase()])||i),[g,j]=s.useState(!1);s.useEffect(()=>{const b=setTimeout(()=>{j(!1)},2e3);return()=>clearTimeout(b)},[p]);const E=Array(6).fill(Oe).map((b,x)=>t[x]||b),I=(b,x)=>{!g&&b!==Oe&&(c(b),y(x),n(x),j(!0))};return e.jsxs("div",{className:"carousel-container",children:[e.jsx("div",{className:"label",children:"Select an Image"}),e.jsx("div",{className:"carousel",children:E.map((b,x)=>e.jsxs("div",{className:"carousel-image-container",children:[e.jsx("img",{src:b,alt:`carousel-img-${x}`,className:`carousel-image ${m===b?"selected":""}`,onClick:()=>I(b,x),loading:"lazy"},x),e.jsx("div",{className:"default-img-selector",children:p===x&&e.jsx("span",{children:"Primary Image"})})]},x))})]})},vs=({outreach:t,title:i,maxLength:n,onClose:a,linkText:o,icon:m,regenerateType:c,indexOfContent:p})=>{var v,w;const[y,g]=s.useState(f()),[j,E]=s.useState(!1),[I,b]=s.useState(!1),[x,h]=s.useState(((v=t.socialImages)==null?void 0:v[c])||null);function f(){return t&&t[c]?t[c].content[p]:""}const N=()=>{const C=`${o}`;navigator.clipboard.writeText(C).then(()=>{E(!0),setTimeout(()=>E(!1),1e3)}).catch(S=>console.error("Failed to copy: ",S))},M=C=>{const S=C.target.value;g(S)},k=async()=>{b(!0);try{const C={...t};C[c].content[p]=y,(await ne(C)).data.success&&b(!1)}catch(C){console.error("Error saving content:",C),b(!1)}},L=async C=>{try{h(C);const S={...t.socialImages,[i.toLowerCase()]:C},D={...t,socialImages:S};await ne(D)}catch(S){console.error(S.message)}};return e.jsx("div",{className:"messaging-modal-overlay",children:e.jsxs("div",{className:"newsfeed-modal",children:[e.jsxs("div",{className:"title-holder",children:[e.jsxs("div",{className:"title-element",children:["Edit and Save ",m," ",i]}),e.jsx("span",{style:{cursor:"pointer"},onClick:()=>a(),children:e.jsx(Ae,{})})]}),c!=="textmessage"&&((w=t.socialImages)==null?void 0:w.bodyImages)&&e.jsx("div",{className:"carousel-holder-modal",children:e.jsx(dt,{images:t.socialImages.bodyImages,defaultIndex:x,setDefaultImageIndex:L,outreach:t,title:i})}),e.jsxs("div",{className:"modal-content-holder",children:[e.jsx("span",{className:"textfield-label-social",children:"Caption"}),e.jsx("textarea",{className:"inner-content-container",value:y,onChange:M})]}),e.jsxs("div",{className:"textfield-info-msg",children:["Ideal maximum characters length is ",n," only"]}),o&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"link-label",children:"Link (Cause/Campaign/Event):"}),e.jsxs("div",{className:"hyperlink-container",children:[e.jsx("a",{href:o,children:o}),e.jsx("span",{style:{cursor:"pointer"},onClick:N,children:e.jsx(Te,{})}),j&&e.jsx("span",{className:"copy-status",children:"copied!"})]})]}),e.jsxs("div",{className:"button-container",children:[e.jsx("span",{className:"coming-soon",children:"Posting Coming Soon!"}),e.jsx(F,{loading:I,onClick:k,children:"Save"})]})]})})},ws=t=>s.createElement("svg",{width:8,height:12,viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M6.5 1L1.5 6L6.5 11",stroke:"#101828",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})),ys=t=>s.createElement("svg",{width:8,height:12,viewBox:"0 0 8 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M1.5 11L6.5 6L1.5 1",stroke:"#101828",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})),oe=({currValue:t,setCurrValue:i,maxValue:n})=>{const[a,o]=s.useState(t);s.useEffect(()=>{o(t)},[t]);const m=()=>{if(a>0){const p=a-1;o(p),i(p)}},c=()=>
1{if(a<n){const p=a+1;o(p),i(p)}};return e.jsx(e.Fragment,{children:e.jsx("div",{children:e.jsxs("div",{className:"outreach-regenerated-indicator",children:[e.jsx("span",{className:"label-text",children:"Regenerated:"})," Â ",e.jsxs("div",{className:"control-container",children:[e.jsx(ws,{className:"arrow-icons",onClick:m})," ",a,"/3 ",e.jsx(ys,{className:"arrow-icons",onClick:c})]})]})})})},Ne=({outreach:t,icon:i,title:n,regenerateType:a,disableActions:o,handleRegenerateClick:m,isLoading:c})=>{var L,v;const[p,y]=s.useState(!1),[g,j]=s.useState(null),E=s.useRef(null),[I,b]=s.useState(((L=t[a])==null?void 0:L.count)-1||0),x=((v=t[a])==null?void 0:v.count)-1,h=Object.keys(t.socialImages).length>0&&t.socialImages.bodyImages[t.socialImages[a]||t.socialImages.DefaultImage],f=()=>{y(!p)},N=t&&t[a]?t[a].content[I]:"",M=()=>{if(N){const w=N;navigator.clipboard.writeText(w).then(()=>{j("copied"),setTimeout(()=>j(null),1e3)}).catch(C=>{console.error("Unable to copy text to clipboard",C),j("error"),setTimeout(()=>j(null),1e3)})}};let k;switch(a){case"whatsapp":k=2e3;break;case"telegram":k=2e3;break;case"textMessage":k=160;break;default:k=200;break}return t[a]?e.jsxs("div",{className:"outreach-messaging-apps-section",children:[e.jsxs("div",{className:"outreach-header",children:[e.jsxs("div",{className:"heading-style",children:[i,e.jsx(Y,{type:"h3",children:`${n}`})]}),e.jsxs("div",{className:"icons-heading-style",ref:E,children:[e.jsx("div",{className:"copy-text",onClick:M,children:g?e.jsxs("span",{className:`copy-status ${g}`,children:[g,"!"]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Copy Message "})," ",e.jsx(ie,{className:"copy-icon-outreach"})]})}),x<3?e.jsx(F,{handleClick:()=>m(a),disabled:o()||c||!t.status,gray:!0,children:"Regenerate"}):null,e.jsx(F,{disabled:!t.status,handleClick:f,children:"Edit"})]})]}),N&&e.jsxs("div",{className:"mixed-content-container",children:[h&&a!=="textMessage"?e.jsx("img",{src:h,alt:ee,loading:"lazy"}):"",e.jsx("div",{className:"textual-content-container ",children:N})]}),e.jsx("div",{className:"info-container",children:e.jsx(oe,{currValue:I,setCurrValue:b,maxValue:x})}),p&&e.jsx(vs,{outreach:t,onClose:f,title:n,maxLength:k,linkText:t.shortUrl,icon:i,regenerateType:a,indexOfContent:I})]}):null};function De(t,i){var n;for(const a of t)if(((n=i[a])==null?void 0:n.content.length)>0||i.channels&&i.channels[a])return!0;return!1}const Ns=({outreach:t,disableActions:i,currentMessage:n,handleRegenerateClick:a,isLoading:o})=>{const[m,c]=s.useState(!0),[p,y]=s.useState(!0),g=()=>{c(!m),y(!p)},E=De(["whatsapp","telegram","textMessage"],t);return e.jsx(e.Fragment,{children:E&&e.jsxs("div",{className:"messaging-container",children:[e.jsxs("div",{className:"outreach-main-header",children:[e.jsxs("div",{className:"heading-style",children:[e.jsx(ct,{className:"msg-icon-outreach"}),e.jsx(Y,{type:"h3",children:"Messaging App"})]}),e.jsx("div",{className:"icons-heading-style",children:m?e.jsx(Le,{onClick:g}):e.jsx(Me,{onClick:g})})]}),e.jsx("div",{className:"messaging-section",children:m&&p&&e.jsxs("div",{children:[q(t)&&!t.channels.whatsapp?e.jsx(Ne,{outreach:t,icon:e.jsx(at,{}),title:"WhatsApp",regenerateType:"whatsapp",disableActions:i,handleRegenerateClick:a,isLoading:o.whatsapp}):e.jsx("div",{className:"structural-loading",children:e.jsx("div",{className:"message-container",children:n})}),q(t)&&!t.channels.telegram?e.jsx(Ne,{outreach:t,icon:e.jsx(nt,{}),title:"Telegram",regenerateType:"telegram",disableActions:i,handleRegenerateClick:a,isLoading:o.telegram}):e.jsx("div",{className:"structural-loading",children:e.jsx("div",{className:"message-container",children:n})}),q(t)&&!t.channels.textMessage?e.jsx(Ne,{outreach:t,icon:e.jsx(it,{className:"msg-icon-outreach"}),title:"Text Message",regenerateType:"textMessage",disableActions:i,handleRegenerateClick:a,isLoading:o.textMessage}):e.jsx("div",{className:"structural-loading",children:e.jsx("div",{className:"message-container",children:n})})]})})]})})},Is=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M22 6C22 4.9 21.1 4 20 4H4C2.9 4 2 4.9 2 6M22 6V18C22 19.1 21.1 20 20 20H4C2.9 20 2 19.1 2 18V6M22 6L12 13L2 6",stroke:"#A7A5A6",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"})),bs=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M0 6C0 5.20435 0.316071 4.44129 0.87868 3.87868C1.44129 3.31607 2.20435 3 3 3H21C21.7956 3 22.5587 3.31607 23.1213 3.87868C23.6839 4.44129 24 5.20435 24 6V12.75C24 12.9489 23.921 13.1397 23.7803 13.2803C23.6397 13.421 23.4489 13.5 23.25 13.5C23.0511 13.5 22.8
1603 13.421 22.7197 13.2803C22.579 13.1397 22.5 12.9489 22.5 12.75V8.0745L12 14.3745L10.011 13.182L1.551 18.387C1.63624 18.7062 1.82447 18.9883 2.08648 19.1896C2.34849 19.3908 2.66962 19.5 3 19.5H11.25C11.4489 19.5 11.6397 19.579 11.7803 19.7197C11.921 19.8603 12 20.0511 12 20.25C12 20.4489 11.921 20.6397 11.7803 20.7803C11.6397 20.921 11.4489 21 11.25 21H3C2.20694 21 1.44615 20.686 0.883965 20.1266C0.321786 19.5673 0.00396529 18.808 0 18.015L0 6ZM1.5 16.6575L8.562 12.312L1.5 8.0745V16.6575ZM1.5 6V6.3255L12 12.6255L22.5 6.3255V6C22.5 5.60218 22.342 5.22064 22.0607 4.93934C21.7794 4.65804 21.3978 4.5 21 4.5H3C2.60218 4.5 2.22064 4.65804 1.93934 4.93934C1.65804 5.22064 1.5 5.60218 1.5 6Z",fill:"#A7A5A6"}),s.createElement("path",{d:"M18.75 24C20.1424 24 21.4777 23.4469 22.4623 22.4623C23.4469 21.4777 24 20.1424 24 18.75C24 17.3576 23.4469 16.0223 22.4623 15.0377C21.4777 14.0531 20.1424 13.5 18.75 13.5C17.3576 13.5 16.0223 14.0531 15.0377 15.0377C14.0531 16.0223 13.5 17.3576 13.5 18.75C13.5 20.1424 14.0531 21.4777 15.0377 22.4623C16.0223 23.4469 17.3576 24 18.75 24ZM19.281 15.969L21.156 17.844C21.2968 17.9848 21.3759 18.1758 21.3759 18.375C21.3759 18.5742 21.2968 18.7652 21.156 18.906C21.0152 19.0468 20.8242 19.1259 20.625 19.1259C20.4258 19.1259 20.2348 19.0468 20.094 18.906L19.5 18.3105V21C19.5 21.1989 19.421 21.3897 19.2803 21.5303C19.1397 21.671 18.9489 21.75 18.75 21.75C18.5511 21.75 18.3603 21.671 18.2197 21.5303C18.079 21.3897 18 21.1989 18 21V18.4245L17.58 18.882C17.4455 19.0286 17.2583 19.1158 17.0596 19.1244C16.8609 19.1329 16.6668 19.0622 16.5203 18.9277C16.3737 18.7933 16.2865 18.6061 16.2779 18.4073C16.2693 18.2086 16.34 18.0146 16.4745 17.868L18.198 15.993C18.2664 15.9184 18.3491 15.8584 18.4413 15.8166C18.5335 15.7748 18.6332 15.7521 18.7344 15.7498C18.8356 15.7476 18.9362 15.7659 19.0301 15.8035C19.124 15.8412 19.2094 15.8975 19.281 15.969Z",fill:"#A7A5A6"})),Es=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("g",{clipPath:"url(#clip0_18582_9355)"},s.createElement("path",{d:"M3 3C2.20435 3 1.44129 3.31607 0.87868 3.87868C0.316071 4.44129 0 5.20435 0 6L0 18.015C0.00396529 18.808 0.321786 19.5673 0.883965 20.1266C1.44615 20.686 2.20694 21 3 21H11.25C11.4489 21 11.6397 20.921 11.7803 20.7803C11.921 20.6397 12 20.4489 12 20.25C12 20.0511 11.921 19.8603 11.7803 19.7197C11.6397 19.579 11.4489 19.5 11.25 19.5H3C2.66982 19.5 2.34884 19.3911 2.08686 19.1902C1.82487 18.9892 1.63652 18.7074 1.551 18.3885L10.011 13.182L12 14.3745L22.5 8.0745V12.75C22.5 12.9489 22.579 13.1397 22.7197 13.2803C22.8603 13.421 23.0511 13.5 23.25 13.5C23.4489 13.5 23.6397 13.421 23.7803 13.2803C23.921 13.1397 24 12.9489 24 12.75V6C24 5.20435 23.6839 4.44129 23.1213 3.87868C22.5587 3.31607 21.7956 3 21 3H3ZM8.562 12.312L1.5 16.6575V8.0745L8.562 12.312ZM1.5 6.3255V6C1.5 5.60218 1.65804 5.22064 1.93934 4.93934C2.22064 4.65804 2.60218 4.5 3 4.5H21C21.3978 4.5 21.7794 4.65804 22.0607 4.93934C22.342 5.22064 22.5 5.60218 22.5 6V6.3255L12 12.6255L1.5 6.3255Z",fill:"#A7A5A6"}),s.createElement("path",{d:"M24 18.75C24 20.1424 23.4469 21.4777 22.4623 22.4623C21.4777 23.4469 20.1424 24 18.75 24C17.3576 24 16.0223 23.4469 15.0377 22.4623C14.0531 21.4777 13.5 20.1424 13.5 18.75C13.5 17.3576 14.0531 16.0223 15.0377 15.0377C16.0223 14.0531 17.3576 13.5 18.75 13.5C20.1424 13.5 21.4777 14.0531 22.4623 15.0377C23.4469 16.0223 24 17.3576 24 18.75ZM21.0105 16.2315C20.926 16.1809 20.8323 16.1474 20.7349 16.1329C20.6374 16.1185 20.5381 16.1234 20.4426 16.1473C20.347 16.1713 20.2571 16.2138 20.178 16.2726C20.0989 16.3313 20.0321 16.405 19.9815 16.4895L18.2265 19.4145L17.406 18.594C17.2652 18.4532 17.0742 18.3741 16.875 18.3741C16.6758 18.3741 16.4848 18.4532 16.344 18.594C16.2032 18.7348 16.1241 18.9258 16.1241 19.125C16.1241 19.3242 16.2032 19.5152 16.344 19.656L17.505 20.8155C17.6258 20.9366 17.7727 21.0285 17.9344 21.0843C18.0961 21.1401 18.2684 21.1582 18.4382 21.1374C18.608 21.1166 18.7708 21.0573 18.9143 20.9641C19.0577 20.8709 19.178 20.7462 19.266 20.5995L21.2685 17.2605C21.3191 17.176 21.3526 17.0823 21.3671 16.9849C21.3815 16.8874 21.3766 16.7881 21.3527 16.6926C21.3287 16.597 21.2862 16.5071 21.2274 16.428C21.1687 16.3489 21.095 16.2821 21.0105 16.2315Z",fill:"#A7A5A6"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_18582_9355"},s.createElement("rect",{width:24,height:24,fill:"white"})))),Ss=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("g",{clipPath:"url(#clip0_18582_9364)"},s.createElement("path",{d:"M12.705 1.97808C12.488 1.86252 12.2459 1.80208 12 1.80208C11.7541 1.80208 11.512 1.86252 11.295 1.97808L2.295 6.77808C2.05503 6.90586 1.8543 7.09645 1.71428 7.32948C1.57425 7.56251 1.50018 7.82922 1.5 8.10108V9.32658L10.125 14.5016L12 13.3766L13.875 14.5016L22.5 9.32658V8.10108C22.4998 7.82922 22.4258 7.56251 22.2857 7.32948C22.1457 7.09645 21.945 6.90586 21.705 6.77808L12.705 1.97808ZM22.5 11.0756L15.333 15.3761L22.5 19.6766V11.0756ZM22.4475 21.3956L12 15.1241L1.5525 21.3941C1.63879 21.7119 1.82728 21.9925 2.08888 22.1926C2.35049 22.3927 2.67066 22.5011 3 22.5011H2
11C21.3293 22.5011 21.6495 22.3927 21.9111 22.1926C22.1727 21.9925 22.3612 21.7134 22.4475 21.3956ZM1.5 19.6751L8.667 15.3746L1.5 11.0756V19.6751ZM10.5885 0.653581C11.0229 0.421944 11.5077 0.300781 12 0.300781C12.4923 0.300781 12.9771 0.421944 13.4115 0.653581L22.4115 5.45358C22.8914 5.70946 23.2927 6.09096 23.5725 6.55729C23.8523 7.02363 24.0001 7.55725 24 8.10108V21.0011C24 21.7967 23.6839 22.5598 23.1213 23.1224C22.5587 23.685 21.7956 24.0011 21 24.0011H3C2.20435 24.0011 1.44129 23.685 0.87868 23.1224C0.316071 22.5598 1.50058e-08 21.7967 1.50058e-08 21.0011V8.10108C-5.437e-05 7.55725 0.147721 7.02363 0.427521 6.55729C0.707321 6.09096 1.10862 5.70946 1.5885 5.45358L10.5885 0.653581Z",fill:"#A7A5A6"})),s.createElement("defs",null,s.createElement("clipPath",{id:"clip0_18582_9364"},s.createElement("rect",{width:24,height:24,fill:"white"})))),mt=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M13 13L19 19M3 3L10.07 19.97L12.58 12.58L19.97 10.07L3 3Z",stroke:"#A7A5A6",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}));function ks(t){return t=t.replace(/(^|\n)(#{1,6})\s*(.*?)(\s+|$)/g,function(i,n,a,o,m){const c=a.length;return`${n}${"#".repeat(c)} ${o.trim()}${m}`}),t=t.replace(/(\*\*|__)(.*?)\1/g,"$2"),t=t.replace(/(\*|_)(.*?)\1/g,"$2"),t=t.replace(/^( *)([*+-]|\d+\.)\s+(.*)(\n|$)/gm,function(i,n,a,o,m){return`${n}- ${o.trim()}${m}`}),t=t.replace(/\[([^\]]+)\]\(([^\s)]+)\)/g,"$1 ($2)"),t=t.replace(/!\[([^\]]+)\]\(([^\s)]+)\)/g,""),t=t.replace(/(^|\n)>\s*(.*?)(\n|$)/g,function(i,n,a,o){return`${n}${a.trim()}${o}`}),t=t.replace(/```(\w+)?\n([\s\S]+?)\n```/g,"$2"),t=t.replace(/^\s*[-*_]{3,}\s*$/gm,""),t}const Ls=(t,i,n,a,o,m,c)=>{const p=window.location.origin,y=Kt(a),g=`${p}/dashboard`,j=`${p}/login`,E=o.toLowerCase(),I=m.toLowerCase();return{WebsiteName:t,Logo:Fe(i),OrgEmail:n,SocialLinksFooter:y||"",WebsiteEmail:n,OrgName:t,DashboardLink:re("Dashboard",g),DonorDashboardLink:re("Dashboard",g),LoginLink:re("Login",j),DonorLoginLink:re("Login",j),CampaignTitle:E,CauseTitle:I,OrgLogo:Fe(i),RecipientName:c}},Ms=({redirectToEmail:t,disableActions:i,outreach:n,handleRegenerateClick:a,isLoading:o})=>{var T,r,l;const{basicBrandInfo:m}=_(u=>u.InfauqeInstance),{websiteName:c,socialLinks:p,logo:y,webEmail:g,campaignName:j,causeName:E}=m,I=Ls(c,y,g,p,j,E),b=n.emailSent,[x,h]=s.useState(((T=n.email)==null?void 0:T.count)-1||0),f=((r=n.email)==null?void 0:r.count)-1,[N,M]=s.useState(Wt),[k,L]=s.useState(qt),v=le();X.useEffect(()=>{let u;return n.single?u=Yt({id:n.batchId,setSingleEmail:L}):u=Gt({id:n.batchId,setBatch:M}),()=>{typeof u=="function"&&u()}},[n.batchId,n.single]);const w=n.single?k:N,C=[{id:1,title:"All Emails",value:w.totalEmails,icon:Is},{id:2,title:"Sent",value:w.totalEmails-w.notSent,icon:bs},{id:3,title:"Delivered",value:w.delivered,icon:Es},{id:4,title:"Opened",value:w.openedby,icon:Ss},{id:5,title:"Clicked",value:w.clickedby,icon:mt}],S=()=>{if(n.single)v("/sent-emails");else return v(`/email-details/${n.batchId}`)},D=()=>n.emailSent?e.jsx(F,{handleClick:S,children:"View Details"}):e.jsxs(e.Fragment,{children:[f!==3?e.jsx(F,{handleClick:()=>a("email"),disabled:i()||o||!n.status,gray:!0,children:"Regenerate"}):null,e.jsx(F,{disabled:!n.status,handleClick:t,children:"Edit and Send"})]});return(l=n.email)!=null&&l.content?e.jsx("div",{className:"outreach-emails-container",children:e.jsxs("div",{className:"outreach-content-container",children:[e.jsxs("div",{className:"outreach-header",children:[e.jsxs("div",{className:"heading-style",children:[e.jsx(ke,{className:"email-icon-outreach"}),e.jsx(Y,{type:"h3",children:"Email"}),e.jsx("div",{className:`badge-${n.emailSent?"posted":"not-posted"}`,children:e.jsx("div",{className:"text",children:n.emailSent?"( Sent )":"( Not Sent )"})}),n.emailSent&&n.emailsenddate&&e.jsxs("span",{className:"label-text",children:["( ",e.jsx("span",{className:"green-text",children:"Sent on:"})," ",Ee(new Date(n.emailsenddate))," - ",Se(new Date(n.emailsenddate))," )"]})]}),e.jsx("div",{className:"icons-heading-style",children:D()})]}),n.emailSent?e.jsx("div",{className:"send-adhoc-emails-modal-system",children:n.email.content.emailBody&&e.jsx("div",{dangerouslySetInnerHTML:{__html:Be(n.email.content.emailBody,I)},className:"adhoc-modal-body"})}):e.jsxs("div",{className:"email-outreach-data",children:[q(n.emailImages)&&e.jsxs("div",{className:"outreach-images",children:[e.jsx("div",{className:"subtext-style",children:"Selected Images for email"}),e.jsxs("div",{className:"all-images-container",children:[n.emailImages.banner&&e.jsxs("div",{className:"outreach-banner-container",children:[e.jsx("img",{src:n.emailImages.banner,alt:"Banner",loading:"lazy"}),e.jsx("div",{className:"image-subtext",children:"Banner"})]}),n.emailImages.body&&e.jsxs("div",{className:"outreach-body-container",children:[e.jsx("img",{src:n.emailImages.body,alt:"Body",loading:"lazy"}),e.jsx("div",{className:"image-subtext",children:"Body"})]})]})]}),e.jsx("div",{className:"subtext-style",children:"Description"}),e.jsx("div",{dangerouslySetInnerHTML:{__html:Be(Tt(ks(n.email.content[x].emailBody))).replace(/\[.*?\]/g,"")},className:"disabled-emails-field"}),e.jsx("div",{className:"subtext-style",children:"Subject"}),e.jsx("div",{className:"disabled-emails-field",children:n.email.content[x].emailSubject})]}),e.jsx("div",{className:`email-stats-gap ${n.emailSent?"sent":""} `,children:C.map(u=>e.jsx(se,{label:u.title,value:u.value,icon:u.icon,posted:b},u.id))}),b?null:e.jsx("div",{className:"indicator-container-email",children:e.jsx(oe,{currValue:x,setCurrValue:h,maxValue:f})})]})}):null},ht=({title:t,label:i,maxLength:n,linkText:a,outreach:o,onClose:m,contentOf:c,indexOfContent:p})=>{var D;
1const[y,g]=s.useState(o[c].content[p]),{activeCampaignsListIndexed:j}=_(T=>T.campaign),{writeActivityLogLoading:E}=_(T=>T.activityLogs),[I,b]=s.useState(!1),[x,h]=s.useState(!1),[f,N]=s.useState(!1),M=Ue(),k=o.subtype,L=((D=j==null?void 0:j[k])==null?void 0:D.organizationId)||"";s.useEffect(()=>{E.success&&I&&c==="newsFeed"&&m()},[E,m,I,c]);const v=async()=>{b(!0);try{const T=y,r=o.id,l=o.name,u=o.outreachType.idToStore,d={outreachTypeValue:o.outreachType.value,outreachTypeLabel:o.outreachType.label},A=o.shortUrl;if(c==="newsFeed")Jt({featureId:u,featureType:c,activityType:"Posted",outreachNewsFeedContent:T,outreachId:r,outreachName:l,outreachLinkedTo:d,outreachShortUrl:A,dispatch:M,logAction:Qt});else if(c==="fundRaising"){if(await he.httpsCallable("outreach-postFundRaisingNewFeedContentToPages")({featureId:u,outreachFundRaisingContent:{contentArray:[T]},outreachLinkedTo:d,outreachId:r,organizationId:L}),y!==o[c].content[o[c].content.length-1]){const V={...o,[c]:{...o[c],content:[...o[c].content,T],posted:!0}};await he.httpsCallable("outreach-createOutreachToDB")(V)}m()}}catch(T){console.error("Failed to post:",T)}finally{c==="fundRaising"&&b(!1)}},w=T=>{g(T)},C=()=>{navigator.clipboard.writeText(a).then(()=>{h(!0),setTimeout(()=>h(!1),1e3)}).catch(T=>console.error("Failed to copy: ",T))},S=async()=>{N(!0);const T=y,r=o[c].content;r[p]=T;const l={...o,[c]:{...o[c],content:r}};(await he.httpsCallable("outreach-createOutreachToDB")(l)).data.success&&N(!1)};return e.jsx("div",{className:"sub-modal-overlay",children:e.jsxs("div",{className:"newsfeed-modal",children:[e.jsxs("header",{className:"title-holder",children:[e.jsxs("div",{className:"title-element",children:["Edit and Post ",z(t)]}),e.jsx("span",{style:{cursor:"pointer"},onClick:m,children:e.jsx(Ae,{})})]}),e.jsx("span",{className:"textfield-label-modal",children:i}),e.jsxs("div",{style:{border:"2px solid #a7a5a6",borderRadius:"8px",padding:"1.5px",marginTop:"10px"},className:"modal-content-holder",children:[e.jsx(es,{value:y,setValue:w,characterCount:n,placeholder:"Type here..."}),e.jsxs("div",{className:"textfield-info-msg",children:["Ideal maximum characters length is ",n," only"]})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"textfield-label-modal",children:"Link (Cause/Campaign/Event):"}),e.jsxs("div",{className:"hyperlink-container",children:[e.jsx("a",{href:a,children:a}),e.jsx("span",{style:{cursor:"pointer"},onClick:C,children:e.jsx(Te,{})}),x&&e.jsx("span",{className:"copy-status",children:"copied!"})]})]}),e.jsxs("div",{className:"button-container",children:[e.jsx(F,{loading:f,onClick:S,children:"Save"}),e.jsx(F,{loading:I||E.loading,onClick:v,children:"Post"})]})]})})},As=({outreach:t,icon:i,title:n,regenerateType:a,disableActions:o,handleRegenerateClick:m,isLoading:c})=>{var v,w;const[p,y]=s.useState(!1),[g,j]=s.useState(null),E=s.useRef(null),[I,b]=s.useState(((v=t[a])==null?void 0:v.count)-1||0),x=((w=t[a])==null?void 0:w.count)-1,h=t&&t[a]?t[a].content[I]:"",f=t&&t[a]?t[a].posted:"",N=()=>{y(!p)},M=()=>{const C=t.newsFeed.content[I];C&&navigator.clipboard.writeText(C).then(()=>{j("copied"),setTimeout(()=>j(null),1e3)}).catch(S=>{console.error("Unable to copy text to clipboard",S),j("error"),setTimeout(()=>j(null),1e3)})},k=C=>C?C.replace(/<\/?(p|div|h[1-6]|ul|ol|blockquote|pre|table)[^>]*>/gi,` 2 3`).replace(/<\/?(br|li|tr|td)[^>]*>/gi,` 4`).replace(/<li>/gi,"- ").replace(/<\/?[^>]+(>|$)/g,"").replace(/\n{3,}/g,` 5 6`).trim():"",L=()=>{const C=t.createdAt,S=new Date(C.seconds*1e3+C.nanoseconds/1e6),D=Ee(S,"yyy/MM/dd"),T=Se(S);return e.jsxs("div",{children:[D," - ",T]})};return h?e.jsxs("div",{children:[e.jsxs("div",{className:"outreach-newsfeed-content-container",children:[e.jsxs("div",{className:"outreach-header",children:[e.jsxs("div",{className:"heading-style",children:[e.jsx("div",{className:"nf-icon-outreach",children:i}),e.jsx("div",{className:"title-style",children:n}),e.jsx("div",{className:`badge-${f?"posted":"not-posted"}`,children:e.jsx("div",{className:"text",children:f?"":"( Not Posted )"})})]}),e.jsxs("div",{className:"icons-heading-style",children:[f?null:e.jsx("div",{className:"copy-text",onClick:M,children:g?e.jsxs("span",{className:`copy-status ${g}`,children:[g,"!"]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Copy Text "})," ",e.jsx(ie,{className:"copy-icon-outreach"})]})}),f?null:e.jsxs(e.Fragment,{children:[x!==3?e.jsx(F,{handleClick:()=>m(a),disabled:o()||c||!t.status,gray:!0,children:"Regenerate"}):null,e.jsx(F,{disabled:!t.status,handleClick:N,children:"Edit and Post"})]})]})]}),f&&e.jsx("div",{className:"text-container",ref:E}),f?e.jsxs("div",{className:"posted-activity-details",children:[e.jsxs("div",{className:"label-text",children:[e.jsx("strong",{children:"Activity"}),e.jsxs("span",{className:"posted-on",children:["(",e.jsx("span",{className:"green-text",children:"Posted on:"})," ",L(),")"]})]}),e.jsx("div",{className:"outreach-content",children:e.jsxs("div",{className:"outreach-linked-to",children:[e.jsx(Xt,{}),e.jsxs("div",{className:"linked-to",children:[e.jsx("span",{className:"linked-to-info",children:t.outreachType.value}),e.jsx("span",{className:"news-feed-content",children:k(h)})]})]})})]}):e.jsx("div",{className:"disabled-emails-field",children:k(h)}),f?null:e.jsxs("div",{className:"info-container",children:[e.jsx(oe,{currValue:I,setCurrValue:b,maxValue:x}),e.jsx("div",{className:"max-text-limit",children:"Maximum characters are 200 only"})]})]}),p&&e.jsx(ht,{outreach:t,onClose:N,title:"Contact Newsfeed",label:"Contact Newsfeed Text",maxLength:120,linkText:t.shortUrl,contentOf:a,indexOfContent:I})]}):null},Ts=({outreach:t,icon:i,title:n,regenerateType:a,disableActions:o,handleRegenerateClick:m,isLoading:c})=>{var L,v;const[p,y]=s.useState(!1),[g,j]=s.useState(null),E=s.useRef(null),[I,b]=s.useState(((L=t[a])==null?void 0:L.count)-1||0),x=((v=t[a])==null?void 0:v.count)-1,h=t&&t[a]?t[a].content[I]:"",f=t&&t[a]?t[a].posted:"",N=()=>{y(!p)},M=()=>{const w=t.fundRaising.content[I];w&&navigator.clipboard.writeText(w).then(()=>{j("copied"),setTimeout(()=>j(null),1e3)}).catch(C=>{console.error("Unable to copy text to clipboard",C),j("error"),setTimeout(()=>j(null),1e3)})};if(!h)return null;
6const k=w=>w?w.replace(/<\/p>|<\/div>|<\/li>|<br\s*\/?>/gi,` 7`).replace(/<li>/gi,"- ").replace(/<\/?[^>]+(>|$)/g,"").trim():"";return e.jsxs("div",{className:"outreach-fundraising-component",children:[e.jsxs("div",{className:"outreach-content-container",children:[e.jsxs("div",{className:"outreach-header",children:[e.jsxs("div",{className:"heading-style",children:[e.jsx("div",{className:"file-icon-outreach",children:i}),e.jsx("div",{className:"title-style",children:z(n)}),e.jsx("div",{className:`badge-${f?"posted":"not-posted"}`,children:e.jsx("div",{className:"text",children:f?"":"( Not Posted )"})}),f?e.jsxs("span",{className:"label-text",children:["( ",e.jsx("span",{className:"green-text",children:"Posted on:"})," ",ts({outreach:t})," )"]}):null]}),f?null:e.jsxs("div",{className:"icons-heading-style",children:[e.jsx("div",{className:"copy-text",onClick:M,children:g?e.jsxs("span",{className:`copy-status ${g}`,children:[g,"!"]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Copy Text "})," ",e.jsx(ie,{className:"copy-icon-outreach"})]})}),x!==3?e.jsx(F,{handleClick:()=>m(a),disabled:o()||c||!t.status,gray:!0,children:"Regenerate"}):null,e.jsx(F,{disabled:!t.status,handleClick:N,children:"Edit and Post"})]})]}),e.jsxs("div",{className:"text-fundraising",children:["This update ",f?"is":"will be"," posted on the public page of"," ",e.jsx("strong",{children:t.outreachType.value&&`"${t.outreachType.value} (${t.outreachType.label})"`})]}),e.jsx("div",{className:"text-container",ref:E}),f?e.jsxs("div",{className:"emails-field",style:{whiteSpace:"pre-line"},children:[" ",k(h)]}):e.jsx("div",{style:{whiteSpace:"pre-line"},className:"disabled-emails-field",children:k(h)}),f?null:e.jsxs("div",{className:"info-container",children:[e.jsx(oe,{currValue:I,setCurrValue:b,maxValue:x}),e.jsx("div",{className:"max-text-limit",children:"Maximum characters are 200 only"})]})]}),p&&e.jsx(ht,{outreach:t,onClose:N,title:`${z(n)} Text`,label:`${z(n)} Text`,maxLength:"200",linkText:t.shortUrl,contentOf:a,indexOfContent:I})]})},Ve=({show:t,handleClose:i,header:n,headerTitle:a,className:o,children:m,...c})=>e.jsxs(ce,{show:t,onHide:i,className:`comment-section-modal-component ${o||""}`,"aria-labelledby":"contained-modal-title-vcenter",centered:!0,...c,children:[n&&e.jsxs(ce.Header,{children:[a&&e.jsx(ce.Title,{children:a}),e.jsx("span",{onClick:()=>i(),children:e.jsx(Dt,{})})]}),e.jsx(ce.Body,{children:m})]}),gt=t=>{const i=new Date().getTimezoneOffset(),n=Math.floor(Math.abs(i)/60),a=Math.abs(i)%60,[o,m]=t.split(":");let c=parseInt(o,10)+n,p=parseInt(m,10)+a;return p>=60?(p-=60,c+=1):p<0&&(p+=60,c-=1),`${c.toString().padStart(2,"0")}:${p.toString().padStart(2,"0")}`},Ds=(t,i)=>{const[n,a]=i.split(":"),o=new Date(t);return o.setHours(n),o.setMinutes(a),o.toISOString().split("T")[1].split(".")[0]};function ut(t){const{currentUser:i}=_(h=>h.user),[n,a]=s.useState(()=>{var N,M,k,L;let h;return t.forsocialmedia?h=((M=(N=t.outreach.schedule)==null?void 0:N.socialMediaSchedule)==null?void 0:M.date)||new Date:h=((L=(k=t.outreach.schedule)==null?void 0:k.inAppSchedule)==null?void 0:L.date)||new Date,new Date(h)}),[o,m]=s.useState(()=>{var N,M,k,L;let h;return t.forsocialmedia?h=((M=(N=t.outreach.schedule)==null?void 0:N.socialMediaSchedule)==null?void 0:M.time)||"12:00":h=((L=(k=t.outreach.schedule)==null?void 0:k.inAppSchedule)==null?void 0:L.time)||"12:00",gt(h)}),[c,p]=s.useState("12:00"),[y,g]=s.useState(!1),[j,E]=s.useState(!1),I=h=>{a(h)},b=h=>{const f=h.target.value;f!==""&&m(f)};s.useEffect(()=>{const h=Ds(n,o);p(h)},[n,o]);const x=async()=>{g(!0);try{let h={...t.outreach};h.schedule||(h.schedule={}),h.schedule.scheduledBy={email:i.email,uid:i.uid},t.forsocialmedia?(h.schedule.socialMediaSchedule||(h.schedule.socialMediaSchedule={}),h.schedule.socialMediaSchedule.date=n,h.schedule.socialMediaSchedule.time=c,h.schedule.socialMediaSchedule.executed=!1):(h.schedule.inAppSchedule||(h.schedule.inAppSchedule={}),h.schedule.inAppSchedule.date=n,h.schedule.inAppSchedule.time=c,h.schedule.inAppSchedule.executed=!1),await he.httpsCallable("outreach-createOutreachToDB")(h),t.closeModal()}catch(h){console.error("Error scheduling event:",h)}finally{g(!1)}};return e.jsxs("div",{className:"schedular-container",children:[e.jsxs("div",{className:"parent-container-td",children:[e.jsx("div",{className:"date-container",children:e.jsx(ss,{date:n,"data-test":"date-input",setDate:h=>I(h),label:"Date",required:!0,setError:E,error:j,errorMessage:"Date is required"})}),e.jsx("div",{className:"time-container",children:e.jsxs("div",{className:"time-input",children:[e.jsxs("label",{className:"time-label",children:["Time ",e.jsx("span",{className:"required",children:"*"})," "]}),e.jsx("input",{id:"timeInput",type:"time",value:o,onChange:b})]})})]}),e.jsx("div",{className:"btn-container",children:e.jsx(F,{handleClick:x,loading:y,children:"Schedule"})})]})}const Vs=({outreach:t,disableActions:i,currentMessage:n,handleRegenerateClick:a,isLoading:o})=>{var D,T,r,l,u,d,A;const[m,c]=s.useState(!0),[p,y]=s.useState(!0),[g,j]=s.useState(!1),[E,I]=s.useState(!1),b=(T=(D=t.schedule)==null?void 0:D.inAppSchedule)==null?void 0:T.executed,x=(r=t.schedule)==null?void 0:r.inAppSchedule,h=le();let f;const N=Ie(t.subtype)||{}
7,M=N.category?`${N.category} Page`:"Unknown Page",k=((l=t.newsFeed)==null?void 0:l.posted)&&((u=t.fundRaising)==null?void 0:u.posted)&&t.emailSent,L=()=>{c(!m),y(!p)},v=()=>{var P,R,$,U;let H="/Email-Send/outreach?fromoutreach=true",V=[];(P=t.emailImages)!=null&&P.banner&&V.push(t.emailImages.banner),(R=t.emailImages)!=null&&R.body&&V.push(t.emailImages.body);const B=`&typeid=${t.subtype}&outreachId=${t.id}&type=${N.category==="event"?"events":N.category}&selectedusers=[]&selectedfilter=[]`;h(`${H}${B}`,{state:{images:V,mailText:`${t.email.content[(($=t.email)==null?void 0:$.count)-1||0].emailBody} <br/><br/> `,mailSubject:t.email.content[((U=t.email)==null?void 0:U.count)-1||0].emailSubject,selectedTemplate:"outreach"}})},w=()=>{j(!g)};if(Object.keys(t).length&&((d=t==null?void 0:t.schedule)!=null&&d.inAppSchedule)){const H=new Date(t.schedule.inAppSchedule.date),V=t.schedule.inAppSchedule.time;if(V){const B=gt(V);f=H.toLocaleDateString()+" "+Vt(B)}else f=H.toLocaleDateString()}if(Object.keys(t).length&&((A=t==null?void 0:t.schedule)!=null&&A.inAppSchedule)){const H=t.schedule.inAppSchedule.date,V=t.schedule.inAppSchedule.time;if(H&&V)try{const B=H.split("T")[0],P=ue.utc(`${B}T${V}Z`),R=ue.tz.guess();f=P.tz(R).format("M/D/YYYY hh:mm A")}catch(B){console.error("Error processing date/time:",B)}else console.error("Invalid or missing schedule data.")}const S=De(["newsFeed","fundRaising","email"],t);return e.jsx(e.Fragment,{children:S&&e.jsxs("div",{className:"in-app-container",children:[e.jsxs("div",{className:"outreach-main-header",children:[e.jsxs("div",{className:"heading-style",children:[e.jsx(lt,{className:"inapp-icon-outreach"}),e.jsx(Y,{type:"h3",children:"In-App Updates"}),x&&!b&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"schedule-info-container",children:[e.jsx("span",{className:"scheduler-status-card"}),e.jsxs("span",{children:["( Scheduled for: ",f," )"]})]})})]}),e.jsxs("div",{className:"dropdown-schedule-container",children:[!b&&e.jsx(F,{disabled:!t.status||k,onClick:()=>{I(!0)},children:x?"Edit schedule":"Schedule"}),m?e.jsx(Le,{onClick:L}):e.jsx(Me,{onClick:L})]})]}),e.jsx(Ve,{show:E,handleClose:()=>{I(!1)},header:!0,headerTitle:"Schedule posts for In-App updates",children:e.jsx(ut,{outreach:t,closeModal:()=>{I(!1)}})}),e.jsx("div",{className:"messaging-section",children:q(t)&&m&&p&&e.jsxs("div",{children:[t.channels.newsFeed?e.jsx("div",{className:"structural-loading",children:e.jsx("div",{className:"message-container",children:n})}):e.jsx(As,{outreach:t,icon:e.jsx(Je,{}),title:"Contact Newsfeed",regenerateType:"newsFeed",disableActions:i,handleRegenerateClick:a,isLoading:o.newsFeed}),t.channels.fundRaising?e.jsx("div",{className:"structural-loading",children:e.jsx("div",{className:"message-container",children:n})}):e.jsx(Ts,{outreach:t,icon:e.jsx(Xe,{}),title:M,regenerateType:"fundRaising",disableActions:i,handleRegenerateClick:a,isLoading:o.fundRaising,eventName:N.eventName,compaignName:N.campaignName}),t.channels.email?e.jsx("div",{className:"structural-loading",children:e.jsx("div",{className:"message-container",children:n})}):e.jsx(Ms,{outreach:t,disableActions:i,icon:e.jsx(ke,{}
7),redirectToEmail:v,handleViewDetailsClick:w,showDetails:g,isLoading:o.email,handleRegenerateClick:a})]})})]})})},Ps=({outreach:t,title:i,onClose:n,linkText:a,maxLength:o,icon:m,regenerateType:c,setOutreach:p,indexOfContent:y})=>{var T,r,l;const{featuresPermv2:g}=_(u=>u.InfauqeInstance),[j,E]=s.useState(L()),[I,b]=s.useState(!1),[x,h]=s.useState(!1),[f,N]=s.useState(!1),[M,k]=s.useState(((T=t.socialImages)==null?void 0:T[c])||0);function L(){return t&&t[c]?t[c].content[y]:""}const v=()=>{const u=`${a}`;navigator.clipboard.writeText(u).then(()=>{b(!0),setTimeout(()=>b(!1),1e3)}).catch(d=>console.error("Failed to copy: ",d))},w=u=>{const d=u.target.value;E(d)},C=async u=>{var d,A,H,V,B,P,R,$,U,G;N(!0);try{const te=c.toLowerCase(),K=await ps(u,te,(d=t.socialImages)==null?void 0:d.bodyImages[M],t.id);if((H=(A=K.response)==null?void 0:A.data)!=null&&H.errorDetails){const O=K.response.data.errorDetails;let Q=(($=(R=(P=(B=(V=O.data)==null?void 0:V.posts)==null?void 0:B[0])==null?void 0:P.errors)==null?void 0:R[0])==null?void 0:$.message)||O.message||"Unknown error occurred";Z.error(Q,{position:"top-right",autoClose:5e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0})}else K.data&&((G=(U=K.response)==null?void 0:U.data)!=null&&G.error)&&Z.error(K.response.data.error,{position:"top-right",autoClose:5e3});N(!1),n()}catch(te){console.error("Failed to create post:",te),Z.error(`Failed to post to ${i}. Please try again later.`),N(!1),n()}},S=async()=>{var u;h(!0);try{const d={...t},A=[...(u=d[c])==null?void 0:u.content];A[y]=j,d[c]={...d[c],content:A},(await ne(d)).data.success&&h(!1)}catch(d){console.error("Error saving content:",d),h(!1)}},D=async u=>{try{k(u);const d={...t,socialImages:{...t.socialImages,[c]:u}};p(d),await ne(d)}catch(d){console.error(d.message)}};return e.jsx("div",{className:"social-modal-overlay",children:e.jsxs("div",{className:"newsfeed-modal",children:[e.jsxs("div",{className:"title-holder",children:[e.jsxs("div",{className:"title-element",children:["Edit and Post ",m," ",i]}),e.jsx("span",{style:{cursor:"pointer"},onClick:()=>n(),children:e.jsx(Ae,{})})]}),e.jsx("div",{className:"carousel-holder-modal",children:((r=t==null?void 0:t.socialImages)==null?void 0:r.bodyImages)&&e.jsx(dt,{images:(l=t==null?void 0:t.socialImages)==null?void 0:l.bodyImages,defaultIndex:M,setDefaultImageIndex:D})}),e.jsx("span",{className:"textfield-label-social",children:"Caption"}),e.jsx("div",{className:"modal-content-holder",children:e.jsx("textarea",{className:"inner-content-container",value:j,onChange:w})}),e.jsxs("div",{className:"textfield-info-msg",children:["Ideal maximum characters length is ",o," only"]}),a&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"link-label",children:"Link (Cause/Campaign/Event):"}),e.jsxs("div",{className:"hyperlink-container",children:[e.jsx("a",{href:a,children:a}),e.jsx("span",{style:{cursor:"pointer"},onClick:v,children:e.jsx(Te,{})}),I&&e.jsx("span",{className:"copy-status",children:"copied!"})]})]}),e.jsxs("div",{className:"button-container",children:[e.jsx(F,{loading:x,onClick:()=>S(),children:"Save"}),e.jsx(F,{loading:f,disabled:!g["social-media"],onClick:()=>C(j),children:"Post"})]})]})})},Hs=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M1 12C1 12 5 4 12 4C19 4 23 12 23 12C23 12 19 20 12 20C5 20 1 12 1 12Z",stroke:"#A7A5A6",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),s.createElement("path",{d:"M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z",stroke:"#A7A5A6",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})),Fs=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M21 11.5C21.0034 12.8199 20.6951 14.1219 20.1 15.3C19.3944 16.7118 18.3098 17.8992 16.9674 18.7293C15.6251 19.5594 14.0782 19.9994 12.5 20C11.1801 20.0035 9.87812 19.6951 8.7 19.1L3 21L4.9 15.3C4.30493 14.1219 3.99656 12.8199 4 11.5C4.00061 9.92179 4.44061 8.37488 5.27072 7.03258C6.10083 5.69028 7.28825 4.6056 8.7 3.90003C9.87812 3.30496 11.1801 2.99659 12.5 3.00003H13C15.0843 3.11502 17.053 3.99479 18.5291 5.47089C20.0052 6.94699 20.885 8.91568 21 11V11.5Z",stroke:"#A7A5A6",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})),Bs=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M7 22H4C3.46957 22 2.96086 21.7893 2.58579 21.4142C2.21071 21.0391 2 20.5304 2 20V13C2 12.4696 2.21071 11.9609 2.58579 11.5858C2.96086 11.2107 3.46957 11 4 11H7M14 9V5C14 4.20435 13.6839 3.44129 13.1213 2.87868C12.5587 2.31607 11.7956 2 11 2L7 11V22H18.28C18.7623 22.0055 19.2304 21.8364 19.5979 21.524C19.9654 21.2116 20.2077 20.7769 20.28 20.3L21.66 11.3C21.7035 11.0134 21.6842 10.7207 21.6033 10.4423C21.5225 10.1638 21.3821 9.90629 21.1919 9.68751C21.0016 9.46873 20.7661 9.29393 20.5016 9.17522C20.2371 9.0565 19.9499 8.99672 19.66 9H14Z",stroke:"#A7A5A6",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})),Rs=t=>s.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M8.59 13.51L15.42 17.49M15.41 6.51L8.59 10.49M21 5C21 6.65685 19.6569 8 18 8C16.3431 8 15 6.65685 15 5C15 3.34315 16.3431 2 18 2C19.6569 2 21 3.34315 21 5ZM9 12C9 13.6569 7.65685 15 6 15C4.34315 15 3 13.6569 3 12C3 10.3431 4.34315 9 6 9C7.65685 9 9 10.3431 9 12ZM21 19C21 20.6569
719.6569 22 18 22C16.3431 22 15 20.6569 15 19C15 17.3431 16.3431 16 18 16C19.6569 16 21 17.3431 21 19Z",stroke:"#A7A5A6",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})),pt=t=>s.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M7.12612 9.80992V12.4071C7.12612 12.5833 7.01449 12.7351 6.85413 12.8004L6.85408 12.8005C6.69439 12.8654 6.50841 12.8372 6.37779 12.7244C6.37779 12.7244 6.37779 12.7243 6.37779 12.7243L0.997508 8.07785L0.997439 8.07779L1.09548 7.96426C1.03397 7.91121 0.999267 7.83621 1.00001 7.75801L7.12612 9.80992ZM7.12612 9.80992C8.69216 9.82183 10.0495 9.90951 11.2263 10.3247C12.4328 10.7503 13.4572 11.5233 14.3147 12.9368L14.3147 12.9369C14.3986 13.075 14.55 13.15 14.7022 13.15C14.7533 13.15 14.8052 13.1416 14.8554 13.1242L14.8557 13.1242C15.0576 13.0538 15.1872 12.8502 15.1407 12.6356C15.1406 12.6354 15.1406 12.6353 15.1406 12.6351L14.994 12.6671C14.9787 12.5957 14.6013 10.9051 13.3968 9.19025L7.12612 9.80992ZM1.00337 7.43801L1.00334 7.43804L1.09935 7.55329L1.00337 7.43801ZM1.00337 7.43801L6.38384 2.95537M1.00337 7.43801L6.38384 2.95537M6.38384 2.95537L6.38388 2.95534C6.51538 2.84585 6.70008 2.82006 6.85766 2.88578C7.01635 2.95196 7.12612 3.10292 7.12612 3.2777V5.54544L6.38384 2.95537ZM12.7658 9.56671C12.9866 9.87983 13.1784 10.1943 13.3441 10.4978C11.5265 9.08903 9.25829 8.95275 6.67824 8.95275C6.44101 8.95275 6.23037 9.13465 6.23037 9.38053V11.4434L1.9724 7.76617L6.23037 4.21848V5.96272C6.23037 6.20859 6.44101 6.3905 6.67824 6.3905C9.23367 6.3905 11.2776 7.45634 12.7657 9.56669L12.7658 9.56671Z",fill:"#1F5E72",stroke:"#1F5E72",strokeWidth:.3})),xt=t=>s.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},s.createElement("path",{d:"M2.5 5.0013H4.16667M4.16667 5.0013H17.5M4.16667 5.0013V16.668C4.16667 17.11 4.34226 17.5339 4.65482 17.8465C4.96738 18.159 5.39131 18.3346 5.83333 18.3346H14.1667C14.6087 18.3346 15.0326 18.159 15.3452 17.8465C15.6577 17.5339 15.8333 17.11 15.8333 16.668V5.0013H4.16667ZM6.66667 5.0013V3.33464C6.66667 2.89261 6.84226 2.46868 7.15482 2.15612C7.46738 1.84356 7.89131 1.66797 8.33333 1.66797H11.6667C12.1087 1.66797 12.5326 1.84356 12.8452 2.15612C13.1577 2.46868 13.3333 2.89261 13.3333 3.33464V5.0013M8.33333 9.16797V14.168M11.6667 9.16797V14.168",stroke:"#7B7979",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),$s="cido-infaque";async function fe(){const t=`https://us-central1-infq-short-code-generator.cloudfunctions.net/fetchAyrshareProfileKey?projectId=${$s}`;try{const i=await J.get(t,{headers:{"Content-Type":"application/json"}});if(i.status===200)return i.data.profileKey;console.error("Failed to fetch profile key:",i.statusText)}catch(i){console.error("Error fetching profile key:",i.message)}}const je="EFXFEF3-WKN4AZG-P6BAS5T-FXE1SRD",ve=()=>localStorage.getItem("token");async function Os(t,i,n){try{const a=JSON.stringify({id:t,platforms:[i],comment:n}),o=await fe(),m={Authorization:`Bearer ${ve()||je}`,"Profile-Key":o,"Content-Type":"application/json"},c=await J.post("https://app.ayrshare.com/api/comments",{headers:m},a);if(!c.ok)throw new Error(`HTTP error! Status: ${c.json()}`);return await c.json()}catch(a){throw console.error("Error:",a),a}}async function Us(t){try{const i=await fe();return(await J.get(`https://app.ayrshare.com/api/comments/${t}`,{headers:{Authorization:`Bearer ${ve()||je}`,"Profile-Key":i,"Content-Type":"application/json"}})).data}catch(i){throw i}}async function Ct(t,i,n){try{const a=await fe();return(await J.post("https://app.ayrshare.com/api/comments/reply",{commentId:t,platforms:[i],comment:n,searchPlatformId:!0},{headers:{Authorization:`Bearer ${ve()||je}`,"Profile-Key":a,"Content-Type":"application/json"}})).data}catch(a){throw console.error(a),a}}async function ft(t,i){try{const n=await fe();return(await J.delete(`https://app.ayrshare.com/api/comments/${t}`,{headers:{Authorization:`Bearer ${ve()||je}`,"Profile-Key":n},params:{searchPlatformId:!0,platform:i}})).data}catch(n){throw console.error(n),n}}function Zs({comment:t,id:i,platform:n}){const a=m=>{const c={year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return new Date(m).toLocaleDateString("en-US",c)},o=()=>{Ce("Delete Comment","Are you sure you want to delete this comment?",()=>{ft(i,n).then(()=>{Z.success("Comment deleted successfully")}).catch(m=>{Z.error("Error deleting comment",m)})},"Delete","Cancel")};return e.jsxs("div",{className:"comments-card",children:[e.jsx("img",{className:"commenter-img",src:t.profileImageUrl||ee,alt:"dummy",loading:"lazy"}),e.jsxs("div",{className:"commenter-info",children:[e.jsxs("div",{className:"commenter-name-and-action",children:[e.jsx("div",{className:"commenter-name",children:t.from.name||t.from.username}),n!=="linkedin"?e.jsx(xt,{className:"delete-icon",onClick:o}):null]}),e.jsx("div",{className:"commenter-time",children:a(t.created)}),e.jsx("div",{className:"commenter-comment",children:t.comment})]})]})}const be=({replyText:t,setReplyText:i,isReplying:n,handleReply:a,image:o})=>e.jsx("div",{className:"parent-reply-text-field-container",children:e.jsxs("div",{className:"d-flex",children:[e.jsx("img",{className:"commenter-img",src:o,alt:"dummy",loading:"lazy"}),e.jsxs("div",{children:[e.jsx("input",{className:"reply-tf",type:"text",value:t,onChange:m=>i(m.target.value)}),e.jsx(F,{className:"reply-act-btn",loading:n,onClick:a,children:n?"Replying...":"Reply"})]})]})});function _s({comment:t,platform:i,replyId:n}){const[a,o]=s.useState(""),[m,c]=s.useState(!1),[p,y]=s.useState(!1),g=f=>{const N={year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"};return new Date(f).toLocaleDateString("en-US",N)},j=()=>{Ce("Delete Comment","Are you sure you want to delete this comment?",()=>{ft(n,i).then(()=>{Z.success("Comment deleted successfully")}).catch(f=>{Z.error("Error deleting comment")})},"Delete","Cancel")},E=()=>{y(!p)},I=async()=>{try{a.trim()!==""?(c(!0),await Ct(n,i,a),c(!1),o(""),y(!1)):Z.error("Please enter a reply before posting")}catch{Z.error("Error replying to comment")}},b=f=>{if(!f)return{username:"",comment:""};if(f.startsWith("@")){const N=f.indexOf(" "),M=N!==-1?f.substring(1,N):f.substring(1),k=N!==-1?f.substring(N+1):"";return{username:M,comment:k}}else return{username:"",comment:f}},x=f=>{const{username:N,comment:M}=b(f.text);return{from:{name:N},created:f.timestamp,comment:M}};let h;return i==="facebook"||i==="twitter"||i==="linkedin"?h=t:i==="instagram"&&(h=x(t)),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"reply-card",children:[e.jsx("img",{className:"commenter-img",src:ee,alt:"dummy",loading:"lazy"}),e.jsxs("div",{className:"commenter-info",children:[e.jsxs("div",{className:"commenter-name-and-action",children:[e.jsx("div",{className:"commenter-name",children:h.from.name||"Anonymous"}),i!=="linkedin"?e.jsx(xt,{className:"delete-icon",onClick:j}):null]}),e.jsx("div",{className:"commenter-time",children:g(h.created)}),e.jsx("div",{className:"commenter-comment",children:h.comment})]})]}),e.jsxs("div",{className:"rrt",onClick:E,children:[e.jsx(pt,{className:"reply-icon"})," Reply"]}),p&&e.jsx(be,{replyText:a,setReplyText:o,isReplying:m,handleReply:I,image:ee})]})}const zs=({commentsData:t,platform:i,postId:n,outreach:a})=>{var w;const[o,m]=s.useState({}),[c,p]=s.useState(""),[y,g]=s.useState(!1),[j,E]=s.useState(!1),[I,b]=s.useState(""),[x,h]=s.useState(null),f=(w=a[i==="linkedin"?"linkedIn":i])==null?void 0:w.postUrl,N=a.socialImages&&Object.keys(a.socialImages.bodyImages).length>0,M=C=>{m(S=>({...S,[C]:!S[C]}))},k=async()=>{try{c.trim()!==""?(g(!0),!f||i==="instagram"&&!N?(g(!1),f?ae("Post Exception",`${i} requires images.`):ae("Post Exception","Post does not exist.")):(await O
7s(n,i,c),g(!1),p(""))):ae("Post Exception","Please enter a comment before posting.")}catch(C){ae("Post Exception",C)}},L=async C=>{try{I.trim()!==""?(E(!0),await Ct(C,i,I),E(!1),b(""),h(null)):console.log("Please enter a reply before posting")}catch(S){console.error("Error replying to comment:",S)}},v=C=>{h(C===x?null:C),b("")};return e.jsxs("div",{className:"comments-section",children:[e.jsxs("div",{className:"comments-handler-container",children:[e.jsx("span",{children:"Write a comment here"}),e.jsx("input",{className:"comments-tf",type:"text",placeholder:"Enter a new Comment",value:c,onChange:C=>p(C.target.value)}),e.jsx("div",{className:"d-flex justify-content-end",children:e.jsx(F,{loading:y,onClick:k,disabled:i==="instagram"&&!N,children:y?"Posting...":"Post Comment"})})]}),t?e.jsxs("div",{className:"posted-comments-section",children:[e.jsx("div",{className:"label-comments",children:"Posted Comments"}),e.jsx("div",{className:"comments-card-parent-container",children:t.map(C=>e.jsxs("div",{children:[e.jsx(Zs,{comment:C,id:C.commentId,platform:i}),e.jsxs("div",{className:"reply-action-parent",children:[e.jsxs("div",{className:"reply-action-container",children:[e.jsxs("div",{className:"reply-handler",onClick:()=>v(C.commentId),children:[e.jsx(pt,{})," Reply"," ",C.replies?`(${C.replies.length})`:""]}),C.replies&&C.replies.length>0&&e.jsx("div",{className:"total-reply",onClick:()=>M(C.commentId),children:o[C.commentId]?"Hide replies":"Show all replies"})]}),x===C.commentId&&!C.replies&&e.jsx(be,{replyText:I,setReplyText:S=>b(S),isPosting:j,handleReply:()=>L(x),image:ee}),o[C.commentId]&&C.replies&&C.replies.length>0&&e.jsx("div",{className:"comments-card-parent-container",children:C.replies.map(S=>e.jsx(_s,{replyId:S.commentId,comment:S,platform:i},S.commentId))}),x===C.commentId&&C.replies&&e.jsx(be,{replyText:I,setReplyText:S=>b(S),isReplying:j,handleReply:()=>L(x),image:ee})]})]},C.commentId))})]}):null]})},de=({outreach:t,icon:i,title:n,regenerateType:a,disableActions:o,handleRegenerateClick:m,isLoading:c,setOutreach:p,isConnected:y})=>{var A,H,V,B;const[g,j]=s.useState(!1),[E,I]=s.useState(!1),[b,x]=s.useState(null),[h,f]=s.useState(((A=t[a])==null?void 0:A.count)-1||0),[N,M]=s.useState([]),k=(H=t[a])==null?void 0:H.postUrl,L=((V=t[a])==null?void 0:V.count)-1,v=s.useRef(null),w=s.useRef({});s.useEffect(()=>{var P,R,$;if((R=(P=t[a])==null?void 0:P.error)!=null&&R.message){const U=t[a].error.message,G=`${a}-${U}`;w.current[G]||(Z.error(U),w.current[G]=!0)}a!=="twitter"&&(($=t[a])!=null&&$.parentPostId)&&Us(t[a].parentPostId).then(U=>{M(U)}).catch(()=>{console.log("Error occurred while fetching data")})},[a,t]);const C=Object.keys(t.socialImages).length>0&&t.socialImages.bodyImages[t.socialImages[a]||t.socialImages.DefaultImage],S=()=>{I(!E)},D=()=>{j(!g)},T=()=>{const P=t[a].postedAt,R=Ee(P,"yyy/MM/dd"),$=Se(P);return e.jsxs("div",{children:[R," - ",$]})},r=t&&t[a]?t[a].content[h]:"",l=P=>{if(P){const R=P;navigator.clipboard.writeText(R).then(()=>{x("copied"),setTimeout(()=>x(null),1e3)}).catch($=>{console.error("Unable to copy text to clipboard",$),x("error"),setTimeout(()=>x(null),1e3)})}else if(r){const R=r;navigator.clipboard.writeText(R).then(()=>{x("copied"),setTimeout(()=>x(null),1e3)}).catch($=>{console.error("Unable to copy text to clipboard",$),x("error"),setTimeout(()=>x(null),1e3)})}};let u;switch(a){case"facebook":u=80;break;case"twitter":u=280;break;case"instagram":u=150;break;case"linkedIn":u=100;break;default:u=200;break}let d=t[a];return t[a]?e.jsxs("div",{className:"outreach-social-media-section",children:[e.jsxs("div",{className:"outreach-header-content",children:[e.jsxs("div",{className:"heading-style",children:[i,e.jsx(Y,{type:"h3",children:`${n}`}),!y&&e.jsx("div",{className:"badge-not-linked",children:e.jsx("div",{className:"text",children:"( Not Linked )"})}),y&&e.jsx("div",{className:`badge-${d!=null&&d.postUrl?"posted":"not-posted"}`,children:e.jsx("div",{className:"text",children:d!=null&&d.postUrl?"":"( Not Posted )"})}),(d==null?void 0:d.postUrl)&&e.jsxs("span",{className:"posted-on",children:["(",e.jsx("span",{className:"green-text",children:"Posted on:"}),T(),")"]})]}),d!=null&&d.postUrl?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"post-actions-container",children:[e.jsx("div",{className:"icons-heading-style",ref:v,children:e.jsxs("div",{className:"parent-container-post",children:[e.jsx("span",{className:"label",children:"Post Link "})," ",e.jsx("div",{className:"post-link-container",children:d.postUrl}),b?e.jsx("span",{className:`copy-status ${b}`,children:b==="copied"?"Copied!":"Error!"}):e.jsx(e.Fragment,{children:e.jsx(ie,{className:"copy-post-container",onClick:()=>l(d.postUrl)})})]})}),e.jsx(F,{as:"a",href:d.postUrl,target:"_blank",rel:"noopener noreferrer",children:"View Post"})]})}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"icons-heading-style",ref:v,children:[e.jsx("div",{className:"copy-text",onClick:l,children:b?e.jsx("span",{className:`copy-status ${b}`,children:b==="copied"?"Copied!":"Error!"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Copy Caption "})," ",e.jsx(ie,{className:"copy-icon-outreach"})]})}),L<3?e.jsx(F,{handleClick:()=>m(a),disabled:o()||c||!t.status,gray:!0,children:"Regenerate"}):null,e.jsx(F,{disabled:!t.status,handleClick:D,children:"Edit and Post"})]})})]}),r&&e.jsxs("div",{className:"mixed-content-container",children:[C?e.jsx("img",{src:C,alt:ee,loading:"lazy"}):"",e.jsx("div",{className:"textual-content-container ",children:r})]}),e.jsx("div",{className:d!=null&&d.postUrl?"states-bar-icon-posted":"states-bar-icon",children:e.jsxs("div",{className:"stats-gap",children:[e.jsx(se,{icon:Hs,label:"Views",value:d==null?void 0:d.views,posted:k}),e.jsx(se,{icon:Bs,label:"Likes",value:d==null?void 0:d.likes,posted:k}),e.jsx(se,{icon:Rs,label:"Shares",value:d==null?void 0:d.shares,posted:k}),e.jsx(se,{style:{cursor:"pointer"},icon:Fs,label:"Comments",value:d==null?void 0:d.comments,onClick:S,posted:k}),e.jsx(se,{icon:mt,label:"Click",value:d==null?void 0:d.clicks,posted:k})]})}),!(d!=null&&d.postUrl)&&e.jsx("div",{className:"d-flex justify-content-start mt-2",children:e.jsx(oe,{currValue:h,setCurrValue:f,maxValue:L})}),e.jsx(Ve,{className:"modal-custom-width",header:!0,headerTitle:`Comments for ${a}`,show:E,handleClose:S,children:e.jsx(zs,{outreach:t,commentsData:N[a.toLowerCase()],platform:a.toLowerCase(),postId:(B=t[a])==null?void 0:B.parentPostId})}),g&&e.jsx(Ps,{outreach:t,setOutreach:p,onClose:D,title:n,regenerateType:a,icon:i,maxLength:u,linkText:t.shortUrl,indexOfContent:h})]}):null},Ws=({outreach:t,disableActions:i,currentMessage:n,handleRegenerateClick:a,isLoading:o,setOutreach:m})=>{var T,r,l,u,d,A,H,V;const[c,p]=s.useState(!0),[y,g]=s.useState(!0),[j,E]=s.useState(!1),[I,b]=s.useState({});let x;s.useEffect(()=>{(async()=>{try{const P=await xs();P&&b(P)}catch(P){console.error("Failed to fetch profile details:",P)}})()},[]);const h=(I==null?void 0:I.activeSocialAccounts)||[],f=h.includes("facebook"),N=h.includes("twitter"),M=h.includes("instagram"),k=h.includes("linkedin"),L=()=>{p(!c),g(!y)},v=(T=t.schedule)==null?void 0:T.socialMediaSchedule,w=(l=(r=t.schedule)==null?void 0:r.socialMediaSchedule)==null?void 0:l.executed;if(Object.keys(t).length&&((u=t==null?void 0:t.schedule)!=null&&u.socialMediaSchedule)){const B=t.schedule.socialMediaSchedule.date,P=t.schedule.socialMediaSchedule.time;if(B&&P)try{const R=B.split("T")[0],$=ue.utc(`${R}T${P}Z`),U=ue.tz.guess();x=$.tz(U).format("M/D/YYYY hh:mm A")}catch(R){console.error("Error processing date/time:",R)}else console.error("Invalid or missing schedule data.")}const C=((d=t.facebook)==null?void 0:d.postUrl)&&((A=t.twitter)==null?void 0:A.postUrl)&&((H=t.instagram)==null?void 0:H.postUrl)&&((V=t.linkedIn)==null?void 0:V.postUrl),D=De(["facebook","twitter","instagram","linkedIn"],t);return e.jsx(e.Fragment,{children:D&&e.jsxs("div",{className:"social-media-container",children:[e.jsxs("div",{className:"outreach-main-header",children:[e.jsxs("div",{className:"heading-style",children:[e.jsx(ot,{className:"sm-icon-outreach"}),e.jsx(Y,{type:"h3",children:"Social Media"}),e.jsx("span",{className:"outreach-status-container",children:v&&!w&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"schedule-info-container",children:[e.jsx("span",{className:"scheduler-status-card"}),e.jsxs("span",{children:["( Scheduled for: ",x," )"]})]})})})]}),e.jsxs("div",{className:"dropdown-schedule-container",children:[!w&&e.jsx(F,{disabled:!t.status||C,onClick:()=>{E(!0)},children:v?"Edit schedule":"Schedule"}),c?e.jsx(Le,{onClick:L}):e.jsx(Me,{onClick:L})]})]}),e.jsx(Ve,{show:j,handleClose:()=>{E(!1)},header:!0,headerTitle:"Schedule post for social media",children:e.jsx(ut,{outreach:t,forsocialmedia:!0,closeModal:()=>{E(!1)}})}),e.jsx("div",{className:"social-media-section",children:c&&y&&e.jsxs("div",{children:[q(t)&&!t.channels.facebook?e.jsx(de,{outreach:t,icon:e.jsx(Qe,{}),title:"Facebook",regenerateType:"facebook",disableActions:i,handleRegenerateClick:a,isLoading:o.facebook,setOutreach:m,isConnected:f}):e.jsx("div",{className:"structural-loading",children:e.jsx("div",{className:"message-container",children:n})}),q(t)&&!t.channels.twitter?e.jsx(de,{outreach:t,icon:e.jsx(et,{}),title:"X/Twitter",regenerateType:"twitter",disableActions:i,handleRegenerateClick:a,isLoading:o.twitter,setOutreach:m,isConnected:N}):e.jsx("div",{className:"structural-loading",children:e.jsx("div",{className:"message-container",children:n})}),q(t)&&!t.channels.instagram?e.jsx(de,{outreach:t,icon:e.jsx(st,{}),title:"Instagram",regenerateType:"instagram",disableActions:i,handleRegenerateClick:a,isLoading:o.instagram,setOutreach:m,isConnected:M}):e.jsx("div",{className:"structural-loading",children:e.jsx("div",{className:"message-container",children:n})}),q(t)&&!t.channels.linkedIn?e.jsx(de,{outreach:t,icon:e.jsx(tt,{}),title:"LinkedIn",regenerateType:"linkedIn",disableActions:i,handleRegenerateClick:a,isLoading:o.linkedIn,setOutreach:m,isConnected:k}):e.jsx("div",{className:"structural-loading",children:e.jsx("div",{className:"message-container",children:n})})]})})]})})},me=["Reading your data.","Feeding it to the AI Model.","Processing your request.","AI Model is working on it.","Almost done."],qs=()=>{const{id:t}=xe(),i=le(),[n,a]=s.useState(""),[o,m]=s.useState({}),[c,p]=s.useState(""),{currentIndex:y,outreach:g,setOutreach:j}=js(me.length,3e3),E=N=>{var M,k,L,v,w,C;return!N.emailSent&&!((M=N.newsFeed)!=null&&M.posted)&&!((k=N.fundRaising)!=null&&k.posted)&&!((L=N.facebook)!=null&&L.postUrl)&&!((v=N.twitter)!=null&&v.postUrl)&&!((w=N.instagram)!=null&&w.postUrl)&&!((C=N.linkedIn)!=null&&C.postUrl)},I=()=>Object.keys(g).length&&Object.values(g.channels).some(N=>N===!0);function b(){Ce("Warning","Are you sure you want to update this Outreach?",async()=>{try{Ze("Update Outreach","Please wait while we update this outreach");const M=await $t({id:t,isCompleted:!g.isCompleted});if(_e(),!M.data.success)throw new Error(M.data.message);i("/outreach/all-outreach")}catch(M){console.log(M),ae("Something went wrong",M.message)}})}const x=async N=>{a(N)},h=()=>{a("")},f=async()=>{m({[n]:!0}),await gs(n,g,c),m({[n]:!1}),p(""),h()};return e.jsxs("div",{className:"outreach-content-page",children:[e.jsx("div",{className:"outreach-header",children:e.jsxs("div",{className:"outreach-fixed-header",children:[e.jsx(Ke,{previous:"Digital Outreach",previousLink:"/outreach/all-outreach",current:g.name}),e.jsxs("div",{className:"actionables-container",children:[e.jsx("span",{children:"Status:"}),g.isCompleted?e.jsx(hs,{className:"completion-status",onClick:b}):e.jsx(ms,{onClick:b}),e.jsx("span",{children:"Complete"}),e.jsx(F,{gray:!0,handleClick:()=>vt(t,g.status?"archive":"unarchive",i,g.name),children:g.status?"archive":"unarchive"}),E(g)&&e.jsx(F,{disabled:!g.status,onClick:()=>{i(`/outreach/edit/${t}`)},children:"Edit Prompt"})]})]})}),q(g)?e.jsx(rt,{outreach:g,steps:qe,generated:g.generated,completed:g.isCompleted,outreachLink:g.outreachType.value,outreachType:g.outreachType.label,outreachStep:2}):e.jsx("div",{}),e.jsx(Vs,{outreach:g,disableActions:I,currentMessage:me[y],isLoading:o,handleRegenerateClick:x,setOutreach:j}),e.jsx(Ws,{outreach:g,disableActions:I,currentMessage:me[y],isLoading:o,handleRegenerateClick:x,setOutreach:j}),e.jsx(Ns,{outreach:g,setOutreach:j,disableActions:I,currentMessage:me[y],isLoading:o,handleRegenerateClick:x}),e.jsx(zt,{campaign:g,id:g.id,type:"outreach"}),e.jsx(Pt,{header:!0,headerTitle:`Regenerate ${n} Content`,show:n,handleClose:h,submitButtonText:"Submit",submitButtonFunction:f,submitButtonLoading:Object.values(o).some(N=>N===!0),className:"ai-regenerated-modal",submitButton:!0,children:e.jsxs("div",{className:"modal-body-regenerate",children:[e.jsx("span",{className:"text",children:"Give your feedback"}),e.jsx("textarea",{className:"regenerate-textarea",value:c,rows:5,placeholder:"Write your feedback here",onChange:N=>p(N.target.value)})]})})]})},Oa=()=>{const t=Ue(),{outreachPage:i}=xe();return s.useEffect(()=>{t(wt())},[t]),e.jsx("div",{children:{"all-outreach":e.jsx(yt,{}),"outreach-content":e.jsx(qs,{}),create:e.jsx(ye,{}),draft:e.jsx(ye,{}),edit:e.jsx(ye,{})}[i]})};export{Oa as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.